diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-12-08 00:31:17 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-12-26 04:42:17 +0800 |
commit | abc0e4c694fb3d9624e890384880def730769fa0 (patch) | |
tree | 8d411f90f4edb0859ffe0b260c85e02e7d273088 /shell/e-shell-window-actions.c | |
parent | 83dc7625983470bff4ce8b9070fbc23c3370c472 (diff) | |
download | gsoc2013-evolution-abc0e4c694fb3d9624e890384880def730769fa0.tar.gz gsoc2013-evolution-abc0e4c694fb3d9624e890384880def730769fa0.tar.zst gsoc2013-evolution-abc0e4c694fb3d9624e890384880def730769fa0.zip |
Introduce ESelectable and EFocusTracker.
EFocusTracker tracks the input focus within a window and helps keep
the sensitivity of "selectable" actions in the main menu up-to-date.
Selectable actions include Cut, Copy, Paste, Select All and Delete.
EFocusTracker has built-in support for widgets that implement the
GtkEditable interface such as GtkEntry and GtkTextView. It also
supports custom widgets that implement the ESelectable interface,
which is a subset of GtkEditable and can apply to anything that
displays selectable content (esp. tree views and ETables).
This commit integrates EFocusTracker with EShellWindow, CompEditor,
EMsgComposer, and ESignatureManager.
It also bumps the GtkHTML requirement to 2.29.5 to utilize the new
GtkhtmlEditor:html constructor property.
Diffstat (limited to 'shell/e-shell-window-actions.c')
-rw-r--r-- | shell/e-shell-window-actions.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c index 4483347beb..5cdf2a932f 100644 --- a/shell/e-shell-window-actions.c +++ b/shell/e-shell-window-actions.c @@ -1437,6 +1437,27 @@ static GtkActionEntry shell_entries[] = { N_("Open the Evolution User Guide"), G_CALLBACK (action_contents_cb) }, + { "copy-clipboard", + GTK_STOCK_COPY, + NULL, + NULL, + N_("Copy the selection"), + NULL }, /* Handled by EFocusTracker */ + + { "cut-clipboard", + GTK_STOCK_CUT, + NULL, + NULL, + N_("Cut the selection"), + NULL }, /* Handled by EFocusTracker */ + + { "delete-selection", + GTK_STOCK_DELETE, + NULL, + NULL, + N_("Delete the selection"), + NULL }, /* Handled by EFocusTracker */ + { "faq", "help-faq", N_("Evolution _FAQ"), @@ -1465,6 +1486,13 @@ static GtkActionEntry shell_entries[] = { N_("Create a new window displaying this view"), G_CALLBACK (action_new_window_cb) }, + { "paste-clipboard", + GTK_STOCK_PASTE, + NULL, + NULL, + N_("Paste the clipboard"), + NULL }, /* Handled by EFocusTracker */ + { "preferences", GTK_STOCK_PREFERENCES, NULL, @@ -1528,6 +1556,13 @@ static GtkActionEntry shell_entries[] = { N_("Save the current search parameters"), G_CALLBACK (action_search_save_cb) }, + { "select-all", + GTK_STOCK_SELECT_ALL, + NULL, + "<Control>a", + N_("Select all text"), + NULL }, /* Handled by EFocusTracker */ + { "send-receive", "mail-send-receive", N_("Send / _Receive"), @@ -1629,6 +1664,25 @@ static GtkActionEntry shell_entries[] = { NULL } }; +static EPopupActionEntry shell_popup_entries[] = { + + { "popup-copy-clipboard", + NULL, + "copy-clipboard" }, + + { "popup-cut-clipboard", + NULL, + "cut-clipboard" }, + + { "popup-delete-selection", + NULL, + "delete-selection" }, + + { "popup-paste-clipboard", + NULL, + "paste-clipboard" } +}; + static GtkToggleActionEntry shell_toggle_entries[] = { { "show-sidebar", @@ -1811,6 +1865,7 @@ void e_shell_window_actions_init (EShellWindow *shell_window) { GtkActionGroup *action_group; + EFocusTracker *focus_tracker; GtkUIManager *ui_manager; g_return_if_fail (E_IS_SHELL_WINDOW (shell_window)); @@ -1824,6 +1879,9 @@ e_shell_window_actions_init (EShellWindow *shell_window) gtk_action_group_add_actions ( action_group, shell_entries, G_N_ELEMENTS (shell_entries), shell_window); + e_action_group_add_popup_actions ( + action_group, shell_popup_entries, + G_N_ELEMENTS (shell_popup_entries)); gtk_action_group_add_toggle_actions ( action_group, shell_toggle_entries, G_N_ELEMENTS (shell_toggle_entries), shell_window); @@ -1854,6 +1912,21 @@ e_shell_window_actions_init (EShellWindow *shell_window) G_N_ELEMENTS (shell_lockdown_print_setup_entries), shell_window); + /* Configure an EFocusTracker to manage selection actions. */ + + focus_tracker = e_focus_tracker_new (GTK_WINDOW (shell_window)); + e_focus_tracker_set_cut_clipboard_action ( + focus_tracker, ACTION (CUT_CLIPBOARD)); + e_focus_tracker_set_copy_clipboard_action ( + focus_tracker, ACTION (COPY_CLIPBOARD)); + e_focus_tracker_set_paste_clipboard_action ( + focus_tracker, ACTION (PASTE_CLIPBOARD)); + e_focus_tracker_set_delete_selection_action ( + focus_tracker, ACTION (DELETE_SELECTION)); + e_focus_tracker_set_select_all_action ( + focus_tracker, ACTION (SELECT_ALL)); + shell_window->priv->focus_tracker = focus_tracker; + /* Fine tuning. */ gtk_action_set_sensitive (ACTION (SEARCH_QUICK), FALSE); |