diff options
-rw-r--r-- | mail/e-mail-browser.c | 10 | ||||
-rw-r--r-- | mail/e-mail-notebook-view.c | 16 | ||||
-rw-r--r-- | mail/e-mail-paned-view.c | 14 | ||||
-rw-r--r-- | mail/e-mail-reader-utils.c | 17 | ||||
-rw-r--r-- | mail/e-mail-reader-utils.h | 2 | ||||
-rw-r--r-- | mail/e-mail-reader.c | 35 | ||||
-rw-r--r-- | mail/e-mail-reader.h | 11 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-content.c | 18 |
8 files changed, 81 insertions, 42 deletions
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c index 900ba63052..6e0a18ff21 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -742,13 +742,19 @@ mail_browser_submit_alert (EAlertSink *alert_sink, } static GtkActionGroup * -mail_browser_get_action_group (EMailReader *reader) +mail_browser_get_action_group (EMailReader *reader, + EMailReaderActionGroup group) { EMailBrowserPrivate *priv; priv = E_MAIL_BROWSER (reader)->priv; - return priv->action_group; + switch (group) { + case E_MAIL_READER_ACTION_GROUP_STANDARD: + return priv->action_group; + default: + g_return_val_if_reached (NULL); + } } static EAlertSink * diff --git a/mail/e-mail-notebook-view.c b/mail/e-mail-notebook-view.c index 16e2fe308b..d72016d608 100644 --- a/mail/e-mail-notebook-view.c +++ b/mail/e-mail-notebook-view.c @@ -776,17 +776,27 @@ mail_notebook_view_set_preview_visible (EMailView *view, } static GtkActionGroup * -mail_notebook_view_get_action_group (EMailReader *reader) +mail_notebook_view_get_action_group (EMailReader *reader, + EMailReaderActionGroup group) { EMailView *view; - EShellWindow *shell_window; EShellView *shell_view; + EShellWindow *shell_window; + const gchar *group_name; view = E_MAIL_VIEW (reader); shell_view = e_mail_view_get_shell_view (view); shell_window = e_shell_view_get_shell_window (shell_view); - return E_SHELL_WINDOW_ACTION_GROUP_MAIL (shell_window); + switch (group) { + case E_MAIL_READER_ACTION_GROUP_STANDARD: + group_name = "mail"; + break; + default: + g_return_val_if_reached (NULL); + } + + return e_shell_window_get_action_group (shell_window, group_name); } static EAlertSink * diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c index 8c79a824df..d95fca16c2 100644 --- a/mail/e-mail-paned-view.c +++ b/mail/e-mail-paned-view.c @@ -366,17 +366,27 @@ mail_paned_view_dispose (GObject *object) } static GtkActionGroup * -mail_paned_view_get_action_group (EMailReader *reader) +mail_paned_view_get_action_group (EMailReader *reader, + EMailReaderActionGroup group) { EMailView *view; EShellView *shell_view; EShellWindow *shell_window; + const gchar *group_name; view = E_MAIL_VIEW (reader); shell_view = e_mail_view_get_shell_view (view); shell_window = e_shell_view_get_shell_window (shell_view); - return E_SHELL_WINDOW_ACTION_GROUP_MAIL (shell_window); + switch (group) { + case E_MAIL_READER_ACTION_GROUP_STANDARD: + group_name = "mail"; + break; + default: + g_return_val_if_reached (NULL); + } + + return e_shell_window_get_action_group (shell_window, group_name); } static EAlertSink * diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index 18f5df7295..51eff2a325 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -86,23 +86,6 @@ mail_reader_is_special_local_folder (const gchar *name) strcmp (name, "Templates") == 0); } -void -e_mail_reader_activate (EMailReader *reader, - const gchar *action_name) -{ - GtkActionGroup *action_group; - GtkAction *action; - - g_return_if_fail (E_IS_MAIL_READER (reader)); - g_return_if_fail (action_name != NULL); - - action_group = e_mail_reader_get_action_group (reader); - action = gtk_action_group_get_action (action_group, action_name); - g_return_if_fail (action != NULL); - - gtk_action_activate (action); -} - gboolean e_mail_reader_confirm_delete (EMailReader *reader) { diff --git a/mail/e-mail-reader-utils.h b/mail/e-mail-reader-utils.h index 95643e6327..da27112cd7 100644 --- a/mail/e-mail-reader-utils.h +++ b/mail/e-mail-reader-utils.h @@ -36,8 +36,6 @@ struct _EMailReaderHeader { guint is_default:1; }; -void e_mail_reader_activate (EMailReader *reader, - const gchar *action_name); gboolean e_mail_reader_confirm_delete (EMailReader *reader); void e_mail_reader_delete_folder (EMailReader *reader, CamelFolder *folder); diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 27096c4a03..1697db9ab3 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -2350,17 +2350,21 @@ mail_reader_double_click_cb (EMailReader *reader, gint col, GdkEvent *event) { + GtkAction *action; + /* Ignore double clicks on columns that handle their own state. */ if (MESSAGE_LIST_COLUMN_IS_ACTIVE (col)) return; - e_mail_reader_activate (reader, "mail-message-open"); + action = e_mail_reader_get_action (reader, "mail-message-open"); + gtk_action_activate (action); } static gboolean mail_reader_key_press_event_cb (EMailReader *reader, GdkEventKey *event) { + GtkAction *action; const gchar *action_name; if ((event->state & GDK_CONTROL_MASK) != 0) @@ -2426,7 +2430,8 @@ ctrl: } exit: - e_mail_reader_activate (reader, action_name); + action = e_mail_reader_get_action (reader, action_name); + gtk_action_activate (action); return TRUE; } @@ -3201,7 +3206,8 @@ mail_reader_init_charset_actions (EMailReader *reader) GtkRadioAction *default_action; GSList *radio_group; - action_group = e_mail_reader_get_action_group (reader); + action_group = e_mail_reader_get_action_group ( + reader, E_MAIL_READER_ACTION_GROUP_STANDARD); radio_group = e_charset_add_radio_actions ( action_group, "mail-charset-", NULL, @@ -3377,7 +3383,8 @@ e_mail_reader_init (EMailReader *reader, if (!init_actions) goto connect_signals; - action_group = e_mail_reader_get_action_group (reader); + action_group = e_mail_reader_get_action_group ( + reader, E_MAIL_READER_ACTION_GROUP_STANDARD); /* The "mail-forward" action is special: it uses a GtkMenuToolButton * for its toolbar item type. So we have to create it separately. */ @@ -3812,14 +3819,21 @@ GtkAction * e_mail_reader_get_action (EMailReader *reader, const gchar *action_name) { - GtkActionGroup *action_group; - GtkAction *action; + GtkAction *action = NULL; + gint ii; g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL); g_return_val_if_fail (action_name != NULL, NULL); - action_group = e_mail_reader_get_action_group (reader); - action = gtk_action_group_get_action (action_group, action_name); + for (ii = 0; ii < E_MAIL_READER_NUM_ACTION_GROUPS; ii++) { + GtkActionGroup *group; + + group = e_mail_reader_get_action_group (reader, ii); + action = gtk_action_group_get_action (group, action_name); + + if (action != NULL) + break; + } if (action == NULL) g_critical ( @@ -3829,7 +3843,8 @@ e_mail_reader_get_action (EMailReader *reader, } GtkActionGroup * -e_mail_reader_get_action_group (EMailReader *reader) +e_mail_reader_get_action_group (EMailReader *reader, + EMailReaderActionGroup group) { EMailReaderInterface *interface; @@ -3838,7 +3853,7 @@ e_mail_reader_get_action_group (EMailReader *reader) interface = E_MAIL_READER_GET_INTERFACE (reader); g_return_val_if_fail (interface->get_action_group != NULL, NULL); - return interface->get_action_group (reader); + return interface->get_action_group (reader, group); } EAlertSink * diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h index 0e874603c4..ea6732a055 100644 --- a/mail/e-mail-reader.h +++ b/mail/e-mail-reader.h @@ -60,6 +60,11 @@ G_BEGIN_DECLS typedef struct _EMailReader EMailReader; typedef struct _EMailReaderInterface EMailReaderInterface; +typedef enum { + E_MAIL_READER_ACTION_GROUP_STANDARD, + E_MAIL_READER_NUM_ACTION_GROUPS +} EMailReaderActionGroup; + enum { E_MAIL_READER_HAVE_ENABLED_ACCOUNT = 1 << 0, E_MAIL_READER_SELECTION_SINGLE = 1 << 1, @@ -85,7 +90,8 @@ struct _EMailReaderInterface { GTypeInterface parent_interface; GtkActionGroup * - (*get_action_group) (EMailReader *reader); + (*get_action_group) (EMailReader *reader, + EMailReaderActionGroup group); EAlertSink * (*get_alert_sink) (EMailReader *reader); EMailBackend * (*get_backend) (EMailReader *reader); EMFormatHTML * (*get_formatter) (EMailReader *reader); @@ -121,7 +127,8 @@ void e_mail_reader_update_actions (EMailReader *reader, GtkAction * e_mail_reader_get_action (EMailReader *reader, const gchar *action_name); GtkActionGroup * - e_mail_reader_get_action_group (EMailReader *reader); + e_mail_reader_get_action_group (EMailReader *reader, + EMailReaderActionGroup group); EAlertSink * e_mail_reader_get_alert_sink (EMailReader *reader); EMailBackend * e_mail_reader_get_backend (EMailReader *reader); EMFormatHTML * e_mail_reader_get_formatter (EMailReader *reader); diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c index 57d1663434..30c842243f 100644 --- a/modules/mail/e-mail-shell-content.c +++ b/modules/mail/e-mail-shell-content.c @@ -248,17 +248,27 @@ mail_shell_content_open_selected_mail (EMailReader *reader) } static GtkActionGroup * -mail_shell_content_get_action_group (EMailReader *reader) +mail_shell_content_get_action_group (EMailReader *reader, + EMailReaderActionGroup group) { - EShellContent *shell_content; - EShellWindow *shell_window; EShellView *shell_view; + EShellWindow *shell_window; + EShellContent *shell_content; + const gchar *group_name; shell_content = E_SHELL_CONTENT (reader); shell_view = e_shell_content_get_shell_view (shell_content); shell_window = e_shell_view_get_shell_window (shell_view); - return E_SHELL_WINDOW_ACTION_GROUP_MAIL (shell_window); + switch (group) { + case E_MAIL_READER_ACTION_GROUP_STANDARD: + group_name = "mail"; + break; + default: + g_return_val_if_reached (NULL); + } + + return e_shell_window_get_action_group (shell_window, group_name); } static EAlertSink * |