aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/e-mail-browser.c48
-rw-r--r--mail/e-mail-notebook-view.c3
-rw-r--r--mail/e-mail-paned-view.c3
-rw-r--r--mail/e-mail-reader.c84
-rw-r--r--mail/e-mail-reader.h1
-rw-r--r--modules/mail/e-mail-config-reader.c30
-rw-r--r--modules/mail/e-mail-shell-content.c3
-rw-r--r--modules/mail/e-mail-shell-view-actions.c37
-rw-r--r--modules/mail/e-mail-shell-view-actions.h2
-rw-r--r--modules/mail/e-mail-shell-view-private.c1
10 files changed, 141 insertions, 71 deletions
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c
index 6e0a18ff21..63bfb4d5b5 100644
--- a/mail/e-mail-browser.c
+++ b/mail/e-mail-browser.c
@@ -43,11 +43,13 @@
#define MAIL_BROWSER_GCONF_PREFIX "/apps/evolution/mail/mail_browser"
+#define ACTION_GROUP_STANDARD "action-group-standard"
+#define ACTION_GROUP_SEARCH_FOLDERS "action-group-search-folders"
+
struct _EMailBrowserPrivate {
EMailBackend *backend;
GtkUIManager *ui_manager;
EFocusTracker *focus_tracker;
- GtkActionGroup *action_group;
EMFormatHTMLDisplay *formatter;
GtkWidget *main_menu;
@@ -485,11 +487,6 @@ mail_browser_dispose (GObject *object)
priv->focus_tracker = NULL;
}
- if (priv->action_group != NULL) {
- g_object_unref (priv->action_group);
- priv->action_group = NULL;
- }
-
if (priv->formatter != NULL) {
g_object_unref (priv->formatter);
priv->formatter = NULL;
@@ -598,9 +595,11 @@ mail_browser_constructed (GObject *object)
web_view, "status-message",
G_CALLBACK (mail_browser_status_message_cb), object);
+ /* Add action groups before initializing the reader interface. */
+
e_mail_reader_init (reader, TRUE, TRUE);
- action_group = priv->action_group;
+ action_group = gtk_action_group_new (ACTION_GROUP_STANDARD);
gtk_action_group_set_translation_domain (action_group, domain);
gtk_action_group_add_actions (
action_group, mail_browser_entries,
@@ -610,6 +609,20 @@ mail_browser_constructed (GObject *object)
G_N_ELEMENTS (mail_browser_popup_entries));
gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+ /* For easy access. Takes ownership of the reference. */
+ g_object_set_data_full (
+ object, ACTION_GROUP_STANDARD,
+ action_group, (GDestroyNotify) g_object_unref);
+
+ action_group = gtk_action_group_new (ACTION_GROUP_SEARCH_FOLDERS);
+ gtk_action_group_set_translation_domain (action_group, domain);
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+
+ /* For easy access. Takes ownership of the reference. */
+ g_object_set_data_full (
+ object, ACTION_GROUP_SEARCH_FOLDERS,
+ action_group, (GDestroyNotify) g_object_unref);
+
e_ui_manager_add_ui_from_file (
E_UI_MANAGER (ui_manager), E_MAIL_READER_UI_DEFINITION);
e_ui_manager_add_ui_from_string (
@@ -628,13 +641,13 @@ mail_browser_constructed (GObject *object)
/* Configure an EFocusTracker to manage selection actions. */
focus_tracker = e_focus_tracker_new (GTK_WINDOW (object));
- action = gtk_action_group_get_action (action_group, "cut-clipboard");
+ action = e_mail_reader_get_action (reader, "cut-clipboard");
e_focus_tracker_set_cut_clipboard_action (focus_tracker, action);
- action = gtk_action_group_get_action (action_group, "copy-clipboard");
+ action = e_mail_reader_get_action (reader, "copy-clipboard");
e_focus_tracker_set_copy_clipboard_action (focus_tracker, action);
- action = gtk_action_group_get_action (action_group, "paste-clipboard");
+ action = e_mail_reader_get_action (reader, "paste-clipboard");
e_focus_tracker_set_paste_clipboard_action (focus_tracker, action);
- action = gtk_action_group_get_action (action_group, "select-all");
+ action = e_mail_reader_get_action (reader, "select-all");
e_focus_tracker_set_select_all_action (focus_tracker, action);
priv->focus_tracker = focus_tracker;
@@ -745,16 +758,20 @@ static GtkActionGroup *
mail_browser_get_action_group (EMailReader *reader,
EMailReaderActionGroup group)
{
- EMailBrowserPrivate *priv;
-
- priv = E_MAIL_BROWSER (reader)->priv;
+ const gchar *group_name;
switch (group) {
case E_MAIL_READER_ACTION_GROUP_STANDARD:
- return priv->action_group;
+ group_name = ACTION_GROUP_STANDARD;
+ break;
+ case E_MAIL_READER_ACTION_GROUP_SEARCH_FOLDERS:
+ group_name = ACTION_GROUP_SEARCH_FOLDERS;
+ break;
default:
g_return_val_if_reached (NULL);
}
+
+ return g_object_get_data (G_OBJECT (reader), group_name);
}
static EAlertSink *
@@ -959,7 +976,6 @@ e_mail_browser_init (EMailBrowser *browser)
browser->priv = G_TYPE_INSTANCE_GET_PRIVATE (
browser, E_TYPE_MAIL_BROWSER, EMailBrowserPrivate);
- browser->priv->action_group = gtk_action_group_new ("mail-browser");
browser->priv->formatter = em_format_html_display_new ();
bridge = gconf_bridge_get ();
diff --git a/mail/e-mail-notebook-view.c b/mail/e-mail-notebook-view.c
index d72016d608..74b9eadf2d 100644
--- a/mail/e-mail-notebook-view.c
+++ b/mail/e-mail-notebook-view.c
@@ -792,6 +792,9 @@ mail_notebook_view_get_action_group (EMailReader *reader,
case E_MAIL_READER_ACTION_GROUP_STANDARD:
group_name = "mail";
break;
+ case E_MAIL_READER_ACTION_GROUP_SEARCH_FOLDERS:
+ group_name = "search-folders";
+ break;
default:
g_return_val_if_reached (NULL);
}
diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c
index d95fca16c2..6d381009d6 100644
--- a/mail/e-mail-paned-view.c
+++ b/mail/e-mail-paned-view.c
@@ -382,6 +382,9 @@ mail_paned_view_get_action_group (EMailReader *reader,
case E_MAIL_READER_ACTION_GROUP_STANDARD:
group_name = "mail";
break;
+ case E_MAIL_READER_ACTION_GROUP_SEARCH_FOLDERS:
+ group_name = "search-folders";
+ break;
default:
g_return_val_if_reached (NULL);
}
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 1697db9ab3..bbbcfabae1 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -2108,34 +2108,6 @@ static GtkActionEntry mail_reader_entries[] = {
N_("Save selected messages as an mbox file"),
G_CALLBACK (action_mail_save_as_cb) },
- { "mail-search-folder-from-mailing-list",
- NULL,
- N_("Search Folder from Mailing _List..."),
- NULL,
- N_("Create a search folder for this mailing list"),
- G_CALLBACK (action_mail_search_folder_from_mailing_list_cb) },
-
- { "mail-search-folder-from-recipients",
- NULL,
- N_("Search Folder from Recipien_ts..."),
- NULL,
- N_("Create a search folder for these recipients"),
- G_CALLBACK (action_mail_search_folder_from_recipients_cb) },
-
- { "mail-search-folder-from-sender",
- NULL,
- N_("Search Folder from Sen_der..."),
- NULL,
- N_("Create a search folder for this sender"),
- G_CALLBACK (action_mail_search_folder_from_sender_cb) },
-
- { "mail-search-folder-from-subject",
- NULL,
- N_("Search Folder from S_ubject..."),
- NULL,
- N_("Create a search folder for this subject"),
- G_CALLBACK (action_mail_search_folder_from_subject_cb) },
-
{ "mail-show-source",
NULL,
N_("_Message Source"),
@@ -2237,6 +2209,37 @@ static GtkActionEntry mail_reader_entries[] = {
NULL }
};
+static GtkActionEntry mail_reader_search_folder_entries[] = {
+
+ { "mail-search-folder-from-mailing-list",
+ NULL,
+ N_("Search Folder from Mailing _List..."),
+ NULL,
+ N_("Create a search folder for this mailing list"),
+ G_CALLBACK (action_mail_search_folder_from_mailing_list_cb) },
+
+ { "mail-search-folder-from-recipients",
+ NULL,
+ N_("Search Folder from Recipien_ts..."),
+ NULL,
+ N_("Create a search folder for these recipients"),
+ G_CALLBACK (action_mail_search_folder_from_recipients_cb) },
+
+ { "mail-search-folder-from-sender",
+ NULL,
+ N_("Search Folder from Sen_der..."),
+ NULL,
+ N_("Create a search folder for this sender"),
+ G_CALLBACK (action_mail_search_folder_from_sender_cb) },
+
+ { "mail-search-folder-from-subject",
+ NULL,
+ N_("Search Folder from S_ubject..."),
+ NULL,
+ N_("Create a search folder for this subject"),
+ G_CALLBACK (action_mail_search_folder_from_subject_cb) },
+};
+
static EPopupActionEntry mail_reader_popup_entries[] = {
{ "mail-popup-copy",
@@ -3200,15 +3203,12 @@ mail_reader_update_actions (EMailReader *reader,
}
static void
-mail_reader_init_charset_actions (EMailReader *reader)
+mail_reader_init_charset_actions (EMailReader *reader,
+ GtkActionGroup *action_group)
{
- GtkActionGroup *action_group;
GtkRadioAction *default_action;
GSList *radio_group;
- 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,
G_CALLBACK (action_mail_charset_cb), reader);
@@ -3383,6 +3383,8 @@ e_mail_reader_init (EMailReader *reader,
if (!init_actions)
goto connect_signals;
+ /* Add the "standard" EMailReader actions. */
+
action_group = e_mail_reader_get_action_group (
reader, E_MAIL_READER_ACTION_GROUP_STANDARD);
@@ -3403,7 +3405,7 @@ e_mail_reader_init (EMailReader *reader,
gtk_action_group_add_action_with_accel (
action_group, GTK_ACTION (menu_tool_action), "<Control>f");
- /* Likewise the "mail-reply-group" action */
+ /* Likewise the "mail-reply-group" action. */
/* For Translators: "Group Reply" will reply either to a mailing list
(if possible and if that configuration option is enabled), or else
@@ -3424,8 +3426,6 @@ e_mail_reader_init (EMailReader *reader,
action_group, GTK_ACTION (menu_tool_action), "<Control>g");
/* Add the other actions the normal way. */
-
- gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions (
action_group, mail_reader_entries,
G_N_ELEMENTS (mail_reader_entries), reader);
@@ -3436,7 +3436,17 @@ e_mail_reader_init (EMailReader *reader,
action_group, mail_reader_toggle_entries,
G_N_ELEMENTS (mail_reader_toggle_entries), reader);
- mail_reader_init_charset_actions (reader);
+ mail_reader_init_charset_actions (reader, action_group);
+
+ /* Add EMailReader actions for Search Folders. The action group
+ * should be made invisible if Search Folders are disabled. */
+
+ action_group = e_mail_reader_get_action_group (
+ reader, E_MAIL_READER_ACTION_GROUP_SEARCH_FOLDERS);
+
+ gtk_action_group_add_actions (
+ action_group, mail_reader_search_folder_entries,
+ G_N_ELEMENTS (mail_reader_search_folder_entries), reader);
/* Bind GObject properties to GConf keys. */
diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h
index ea6732a055..f4df175a67 100644
--- a/mail/e-mail-reader.h
+++ b/mail/e-mail-reader.h
@@ -62,6 +62,7 @@ typedef struct _EMailReaderInterface EMailReaderInterface;
typedef enum {
E_MAIL_READER_ACTION_GROUP_STANDARD,
+ E_MAIL_READER_ACTION_GROUP_SEARCH_FOLDERS,
E_MAIL_READER_NUM_ACTION_GROUPS
} EMailReaderActionGroup;
diff --git a/modules/mail/e-mail-config-reader.c b/modules/mail/e-mail-config-reader.c
index a13f0bf936..5aea86b7b1 100644
--- a/modules/mail/e-mail-config-reader.c
+++ b/modules/mail/e-mail-config-reader.c
@@ -24,15 +24,14 @@
static gpointer parent_class;
-static void
-mail_config_reader_constructed (GObject *object)
+static gboolean
+mail_config_reader_idle_cb (EExtension *extension)
{
- EExtension *extension;
EExtensible *extensible;
+ GtkActionGroup *action_group;
EShellSettings *shell_settings;
EShell *shell;
- extension = E_EXTENSION (object);
extensible = e_extension_get_extensible (extension);
shell = e_shell_get_default ();
@@ -48,6 +47,29 @@ mail_config_reader_constructed (GObject *object)
extensible, "reply-style",
G_BINDING_SYNC_CREATE);
+ action_group = e_mail_reader_get_action_group (
+ E_MAIL_READER (extensible),
+ E_MAIL_READER_ACTION_GROUP_SEARCH_FOLDERS);
+
+ g_object_bind_property (
+ shell_settings, "mail-enable-search-folders",
+ action_group, "visible",
+ G_BINDING_SYNC_CREATE);
+
+ return FALSE;
+}
+
+static void
+mail_config_reader_constructed (GObject *object)
+{
+ /* Bind properties to settings from an idle callback so the
+ * EMailReader interface has a chance to be initialized first. */
+ g_idle_add_full (
+ G_PRIORITY_DEFAULT_IDLE,
+ (GSourceFunc) mail_config_reader_idle_cb,
+ g_object_ref (object),
+ (GDestroyNotify) g_object_unref);
+
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (parent_class)->constructed (object);
}
diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c
index 30c842243f..5657db18ac 100644
--- a/modules/mail/e-mail-shell-content.c
+++ b/modules/mail/e-mail-shell-content.c
@@ -264,6 +264,9 @@ mail_shell_content_get_action_group (EMailReader *reader,
case E_MAIL_READER_ACTION_GROUP_STANDARD:
group_name = "mail";
break;
+ case E_MAIL_READER_ACTION_GROUP_SEARCH_FOLDERS:
+ group_name = "search-folders";
+ break;
default:
g_return_val_if_reached (NULL);
}
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index 90096393e3..f5c5524648 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -1117,13 +1117,6 @@ static GtkActionEntry mail_entries[] = {
N_("Permanently remove all the deleted messages from all folders"),
G_CALLBACK (action_mail_folder_expunge_cb) },
- { "mail-create-search-folder",
- NULL,
- N_("C_reate Search Folder From Search..."),
- NULL,
- NULL, /* XXX Add a tooltip! */
- G_CALLBACK (action_mail_create_search_folder_cb) },
-
{ "mail-download",
NULL,
N_("_Download Messages for Offline Usage"),
@@ -1329,13 +1322,6 @@ static GtkActionEntry mail_entries[] = {
N_("Create or edit rules for filtering new mail"),
G_CALLBACK (action_mail_tools_filters_cb) },
- { "mail-tools-search-folders",
- NULL,
- N_("Search F_olders"),
- NULL,
- N_("Create or edit search folder definitions"),
- G_CALLBACK (action_mail_tools_search_folders_cb) },
-
{ "mail-tools-subscriptions",
NULL,
N_("_Subscriptions..."),
@@ -1367,6 +1353,23 @@ static GtkActionEntry mail_entries[] = {
NULL }
};
+static GtkActionEntry search_folder_entries[] = {
+
+ { "mail-create-search-folder",
+ NULL,
+ N_("C_reate Search Folder From Search..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_mail_create_search_folder_cb) },
+
+ { "mail-tools-search-folders",
+ NULL,
+ N_("Search F_olders"),
+ NULL,
+ N_("Create or edit search folder definitions"),
+ G_CALLBACK (action_mail_tools_search_folders_cb) },
+};
+
static EPopupActionEntry mail_popup_entries[] = {
{ "mail-popup-account-disable",
@@ -1666,6 +1669,12 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view)
G_N_ELEMENTS (mail_scope_entries),
MAIL_SCOPE_CURRENT_FOLDER, NULL, NULL);
+ /* Search Folder Actions */
+ action_group = ACTION_GROUP (SEARCH_FOLDERS);
+ gtk_action_group_add_actions (
+ action_group, search_folder_entries,
+ G_N_ELEMENTS (search_folder_entries), mail_shell_view);
+
action = ACTION (MAIL_SCOPE_ALL_ACCOUNTS);
combo_box = e_shell_searchbar_get_scope_combo_box (searchbar);
e_action_combo_box_set_action (combo_box, GTK_RADIO_ACTION (action));
diff --git a/modules/mail/e-mail-shell-view-actions.h b/modules/mail/e-mail-shell-view-actions.h
index d9b801a9c0..c6ca167e14 100644
--- a/modules/mail/e-mail-shell-view-actions.h
+++ b/modules/mail/e-mail-shell-view-actions.h
@@ -259,5 +259,7 @@
E_SHELL_WINDOW_ACTION_GROUP ((window), "mail-filter")
#define E_SHELL_WINDOW_ACTION_GROUP_MAIL_LABEL(window) \
E_SHELL_WINDOW_ACTION_GROUP ((window), "mail-label")
+#define E_SHELL_WINDOW_ACTION_GROUP_SEARCH_FOLDERS(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "search-folders")
#endif /* E_MAIL_SHELL_VIEW_ACTIONS_H */
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index 8cc7d45c85..01ceca277e 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -644,6 +644,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
e_shell_window_add_action_group (shell_window, "mail");
e_shell_window_add_action_group (shell_window, "mail-filter");
e_shell_window_add_action_group (shell_window, "mail-label");
+ e_shell_window_add_action_group (shell_window, "search-folders");
merge_id = gtk_ui_manager_new_merge_id (ui_manager);
priv->label_merge_id = merge_id;