[evolution] Bug 510020 - Add "Manage Subscriptions" to store context menus



commit a69cbcd79aff01585620a12b378686d86c219ce9
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun Oct 3 09:39:10 2010 -0400

    Bug 510020 - Add "Manage Subscriptions" to store context menus

 mail/e-mail-sidebar.c                    |    2 ++
 mail/e-mail-sidebar.h                    |   13 +++++++------
 modules/mail/e-mail-shell-view-actions.c |   20 +++++++++++++++++++-
 modules/mail/e-mail-shell-view-actions.h |    2 ++
 modules/mail/e-mail-shell-view.c         |    7 +++++++
 ui/evolution-mail.ui                     |    1 +
 6 files changed, 38 insertions(+), 7 deletions(-)
---
diff --git a/mail/e-mail-sidebar.c b/mail/e-mail-sidebar.c
index 5ed65f9..5967734 100644
--- a/mail/e-mail-sidebar.c
+++ b/mail/e-mail-sidebar.c
@@ -370,6 +370,8 @@ mail_sidebar_check_state (EMailSidebar *sidebar)
 		state |= E_MAIL_SIDEBAR_FOLDER_IS_STORE;
 	if (is_trash)
 		state |= E_MAIL_SIDEBAR_FOLDER_IS_TRASH;
+	if (camel_store_supports_subscriptions (store))
+		state |= E_MAIL_SIDEBAR_STORE_SUPPORTS_SUBSCRIPTIONS;
 
 	g_free (full_name);
 	g_free (uri);
diff --git a/mail/e-mail-sidebar.h b/mail/e-mail-sidebar.h
index f08c05d..b57ff76 100644
--- a/mail/e-mail-sidebar.h
+++ b/mail/e-mail-sidebar.h
@@ -51,12 +51,13 @@ typedef struct _EMailSidebarPrivate EMailSidebarPrivate;
 
 /* Flags describing the selected folder. */
 enum {
-	E_MAIL_SIDEBAR_FOLDER_ALLOWS_CHILDREN	= 1 << 0,
-	E_MAIL_SIDEBAR_FOLDER_CAN_DELETE	= 1 << 1,
-	E_MAIL_SIDEBAR_FOLDER_IS_JUNK		= 1 << 2,
-	E_MAIL_SIDEBAR_FOLDER_IS_OUTBOX		= 1 << 3,
-	E_MAIL_SIDEBAR_FOLDER_IS_STORE		= 1 << 4,
-	E_MAIL_SIDEBAR_FOLDER_IS_TRASH		= 1 << 5
+	E_MAIL_SIDEBAR_FOLDER_ALLOWS_CHILDREN		= 1 << 0,
+	E_MAIL_SIDEBAR_FOLDER_CAN_DELETE		= 1 << 1,
+	E_MAIL_SIDEBAR_FOLDER_IS_JUNK			= 1 << 2,
+	E_MAIL_SIDEBAR_FOLDER_IS_OUTBOX			= 1 << 3,
+	E_MAIL_SIDEBAR_FOLDER_IS_STORE			= 1 << 4,
+	E_MAIL_SIDEBAR_FOLDER_IS_TRASH			= 1 << 5,
+	E_MAIL_SIDEBAR_STORE_SUPPORTS_SUBSCRIPTIONS	= 1 << 6
 };
 
 struct _EMailSidebar {
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index b521dc3..4b4a1d8 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -1029,6 +1029,20 @@ static GtkActionEntry mail_entries[] = {
 	  NULL,  /* XXX Add a tooltip! */
 	  G_CALLBACK (action_mail_label_none_cb) },
 
+	/* This is the same as "mail-tools-subscriptions" but only
+	 * appears in the sidebar context menu when right-clicking
+	 * on a store that supports folder subscriptions.  No need
+	 * for a special callback because Folder->Subscriptions...
+	 * already tries to open the "Folder Subscriptions" dialog
+	 * according to the highlighted item in the sidebar, which
+	 * is exactly the behavior we want here. */
+	{ "mail-manage-subscriptions",
+	  NULL,
+	  N_("_Manage Subscriptions"),
+	  NULL,
+	  N_("Subscribe or unsubscribe to folders on remote servers"),
+	  G_CALLBACK (action_mail_tools_subscriptions_cb) },
+
 	{ "mail-smart-backward",
 	  NULL,
 	  NULL,  /* No menu item; key press only */
@@ -1153,7 +1167,11 @@ static EPopupActionEntry mail_popup_entries[] = {
 
 	{ "mail-popup-folder-unsubscribe",
 	  NULL,
-	  "mail-folder-unsubscribe" }
+	  "mail-folder-unsubscribe" },
+
+	{ "mail-popup-manage-subscriptions",
+	  NULL,
+	  "mail-manage-subscriptions" }
 };
 
 static GtkToggleActionEntry mail_toggle_entries[] = {
diff --git a/modules/mail/e-mail-shell-view-actions.h b/modules/mail/e-mail-shell-view-actions.h
index 34f6e6c..5eb015b 100644
--- a/modules/mail/e-mail-shell-view-actions.h
+++ b/modules/mail/e-mail-shell-view-actions.h
@@ -105,6 +105,8 @@
 	E_SHELL_WINDOW_ACTION ((window), "mail-label-none")
 #define E_SHELL_WINDOW_ACTION_MAIL_LOAD_IMAGES(window) \
 	E_SHELL_WINDOW_ACTION ((window), "mail-load-images")
+#define E_SHELL_WINDOW_ACTION_MAIL_MANAGE_SUBSCRIPTIONS(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-manage-subscriptions")
 #define E_SHELL_WINDOW_ACTION_MAIL_MARK_IMPORTANT(window) \
 	E_SHELL_WINDOW_ACTION ((window), "mail-mark-important")
 #define E_SHELL_WINDOW_ACTION_MAIL_MARK_JUNK(window) \
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index 0e9a66c..6b6b530 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -843,6 +843,7 @@ mail_shell_view_update_actions (EShellView *shell_view)
 	gboolean folder_is_trash;
 	gboolean folder_has_unread_rec = FALSE;
 	gboolean folder_tree_and_message_list_agree = TRUE;
+	gboolean store_supports_subscriptions;
 	gboolean have_enabled_account;
 
 	/* Chain up to parent's update_actions() method. */
@@ -878,6 +879,8 @@ mail_shell_view_update_actions (EShellView *shell_view)
 		(state & E_MAIL_SIDEBAR_FOLDER_IS_STORE);
 	folder_is_trash =
 		(state & E_MAIL_SIDEBAR_FOLDER_IS_TRASH);
+	store_supports_subscriptions =
+		(state & E_MAIL_SIDEBAR_STORE_SUPPORTS_SUBSCRIPTIONS);
 
 	uri = em_folder_tree_get_selected_uri (folder_tree);
 	if (uri != NULL) {
@@ -985,6 +988,10 @@ mail_shell_view_update_actions (EShellView *shell_view)
 	sensitive = folder_has_unread_rec && !folder_is_store;
 	gtk_action_set_sensitive (action, sensitive);
 
+	action = ACTION (MAIL_MANAGE_SUBSCRIPTIONS);
+	sensitive = folder_is_store && store_supports_subscriptions;
+	gtk_action_set_sensitive (action, sensitive);
+
 	action = ACTION (MAIL_TOOLS_SUBSCRIPTIONS);
 	sensitive = have_enabled_account;
 	gtk_action_set_sensitive (action, sensitive);
diff --git a/ui/evolution-mail.ui b/ui/evolution-mail.ui
index 52a887c..d158cf8 100644
--- a/ui/evolution-mail.ui
+++ b/ui/evolution-mail.ui
@@ -91,6 +91,7 @@
     <menuitem action='mail-popup-folder-rename'/>
     <menuitem action='mail-popup-folder-refresh'/>
     <menuitem action='mail-popup-flush-outbox'/>
+    <menuitem action='mail-popup-manage-subscriptions'/>
     <menuitem action='mail-popup-account-expunge'/>
     <menuitem action='mail-popup-account-disable'/>
     <separator/>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]