[evolution/kill-bonobo] Kill the "folder-unsubscribe" plugin.



commit f0cf88bc99a458193f2c16a3ed346c20f6a5fd1a
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Jun 25 13:27:20 2009 -0400

    Kill the "folder-unsubscribe" plugin.
    
    Feature is now integrated in core mailer, and has a main menu item.

 configure.ac                                       |    4 +-
 mail/em-folder-utils.c                             |   66 ++++++++++++
 mail/em-folder-utils.h                             |    4 +-
 modules/mail/e-mail-shell-view-actions.c           |   29 +++++-
 modules/mail/e-mail-shell-view-actions.h           |    2 +
 modules/mail/e-mail-shell-view.c                   |    4 +
 plugins/folder-unsubscribe/ChangeLog               |   58 ----------
 plugins/folder-unsubscribe/Makefile.am             |   18 ---
 plugins/folder-unsubscribe/folder-unsubscribe.c    |  110 --------------------
 .../org-gnome-mail-folder-unsubscribe.eplug.xml    |   20 ----
 ui/evolution-mail.ui                               |    4 +
 11 files changed, 107 insertions(+), 212 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 8cab9ff..78a5748 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1785,7 +1785,7 @@ plugins_standard_always="bbdb subject-thread save-calendar mail-to-task audio-in
 plugins_standard="$plugins_standard_always"
 all_plugins_standard="$plugins_standard"
 
-plugins_experimental_always="face folder-unsubscribe external-editor hula-account-setup"
+plugins_experimental_always="face external-editor hula-account-setup"
 plugins_experimental="$plugins_experimental_always $IPOD_SYNC $TNEF_ATTACHMENTS $PYTHON_PLUGIN"
 all_plugins_experimental="$plugins_experimental_always ipod-sync tnef-attachments"
 
@@ -1797,7 +1797,6 @@ dnl ------------------------
 dnl backup-restore
 dnl calendar-weather
 dnl exchange-operations
-dnl folder-unsubscribe
 dnl groupwise-features
 dnl ipod-sync
 dnl itip-formatter
@@ -2098,7 +2097,6 @@ plugins/email-custom-header/Makefile
 plugins/exchange-operations/Makefile
 plugins/external-editor/Makefile
 plugins/face/Makefile
-plugins/folder-unsubscribe/Makefile
 plugins/google-account-setup/Makefile
 plugins/groupwise-account-setup/Makefile
 plugins/groupwise-features/Makefile
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index 8890e48..21ec52b 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -718,6 +718,72 @@ em_folder_utils_create_folder (CamelFolderInfo *folderinfo, EMFolderTree *emft,
 	gtk_widget_show (dialog);
 }
 
+struct _folder_unsub_t {
+	MailMsg base;
+	gchar *folder_uri;
+};
+
+static gchar *
+emfu_unsubscribe_folder__desc (struct _folder_unsub_t *msg)
+{
+	return g_strdup_printf (
+		_("Unsubscribing from folder \"%s\""), msg->folder_uri);
+}
+
+static void
+emfu_unsubscribe_folder__exec (struct _folder_unsub_t *msg)
+{
+	CamelStore *store;
+	CamelURL *url;
+	const gchar *path = NULL;
+	gint url_flags;
+
+	store = camel_session_get_store (
+		session, msg->folder_uri, &msg->base.ex);
+	if (store == NULL)
+		return;
+
+	url = camel_url_new (msg->folder_uri, NULL);
+	url_flags = CAMEL_SERVICE (store)->provider->url_flags;
+
+	if (url_flags & CAMEL_URL_FRAGMENT_IS_PATH)
+		path = url->fragment;
+	else if (url->path != NULL && *url->path != '\0')
+		path = url->path + 1;
+
+	if (path != NULL)
+		camel_store_unsubscribe_folder (store, path, &msg->base.ex);
+
+	camel_url_free (url);
+}
+
+static void
+emfu_unsubscribe_folder__free (struct _folder_unsub_t *msg)
+{
+	g_free (msg->folder_uri);
+}
+
+static MailMsgInfo unsubscribe_info = {
+	sizeof (struct _folder_unsub_t),
+	(MailMsgDescFunc) emfu_unsubscribe_folder__desc,
+	(MailMsgExecFunc) emfu_unsubscribe_folder__exec,
+	(MailMsgDoneFunc) NULL,
+	(MailMsgFreeFunc) emfu_unsubscribe_folder__free
+};
+
+void
+em_folder_utils_unsubscribe_folder (const gchar *folder_uri)
+{
+	struct _folder_unsub_t *unsub;
+
+	g_return_if_fail (folder_uri != NULL);
+
+	unsub = mail_msg_new (&unsubscribe_info);
+	unsub->folder_uri = g_strdup (folder_uri);
+
+	mail_msg_unordered_push (unsub);
+}
+
 const gchar *
 em_folder_utils_get_icon_name (guint32 flags)
 {
diff --git a/mail/em-folder-utils.h b/mail/em-folder-utils.h
index 86d58ef..d0db789 100644
--- a/mail/em-folder-utils.h
+++ b/mail/em-folder-utils.h
@@ -42,13 +42,13 @@ gint		em_folder_utils_copy_folders	(CamelStore *fromstore,
 
 void		em_folder_utils_copy_folder	(CamelFolderInfo *folderinfo,
 						 gboolean delete);
-
 void		em_folder_utils_delete_folder	(CamelFolder *folder);
 void		em_folder_utils_rename_folder	(CamelFolder *folder);
-
 void		em_folder_utils_create_folder	(CamelFolderInfo *folderinfo,
 						 EMFolderTree *emft,
 						 GtkWindow *parent);
+void		em_folder_utils_unsubscribe_folder
+						(const gchar *folder_uri);
 
 const gchar *	em_folder_utils_get_icon_name	(guint32 flags);
 
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index 25e7d80..22bd863 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -385,6 +385,22 @@ action_mail_folder_select_subthread_cb (GtkAction *action,
 }
 
 static void
+action_mail_folder_unsubscribe_cb (GtkAction *action,
+                                   EMailShellView *mail_shell_view)
+{
+	EMailShellSidebar *mail_shell_sidebar;
+	EMFolderTree *folder_tree;
+	gchar *folder_uri;
+
+	mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+	folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+	folder_uri = em_folder_tree_get_selected_uri (folder_tree);
+	em_folder_utils_unsubscribe_folder (folder_uri);
+	g_free (folder_uri);
+}
+
+static void
 action_mail_hide_deleted_cb (GtkToggleAction *action,
                              EMailShellView *mail_shell_view)
 {
@@ -1104,6 +1120,13 @@ static GtkActionEntry mail_entries[] = {
 	  N_("Select all replies to the currently selected message"),
 	  G_CALLBACK (action_mail_folder_select_subthread_cb) },
 
+	{ "mail-folder-unsubscribe",
+	  NULL,
+	  N_("_Unsubscribe"),
+	  NULL,
+	  N_("Unsubscribe from the selected folder"),
+	  G_CALLBACK (action_mail_folder_unsubscribe_cb) },
+
 	{ "mail-label-new",
 	  NULL,
 	  N_("_New Label"),
@@ -1259,7 +1282,11 @@ static EPopupActionEntry mail_popup_entries[] = {
 
 	{ "mail-popup-folder-rename",
 	  NULL,
-	  "mail-folder-rename" }
+	  "mail-folder-rename" },
+
+	{ "mail-popup-folder-unsubscribe",
+	  NULL,
+	  "mail-folder-unsubscribe" }
 };
 
 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 2a05582..3fb7142 100644
--- a/modules/mail/e-mail-shell-view-actions.h
+++ b/modules/mail/e-mail-shell-view-actions.h
@@ -89,6 +89,8 @@
 	E_SHELL_WINDOW_ACTION ((window), "mail-folder-select-thread")
 #define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_SELECT_SUBTHREAD(window) \
 	E_SHELL_WINDOW_ACTION ((window), "mail-folder-select-subthread")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_UNSUBSCRIBE(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-folder-unsubscribe")
 #define E_SHELL_WINDOW_ACTION_MAIL_FORWARD(window) \
 	E_SHELL_WINDOW_ACTION ((window), "mail-forward")
 #define E_SHELL_WINDOW_ACTION_MAIL_FORWARD_ATTACHED(window) \
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index 8d8b4aa..ce18936 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -191,6 +191,10 @@ mail_shell_view_update_actions (EShellView *shell_view)
 	sensitive = !folder_is_store && folder_can_be_deleted;
 	gtk_action_set_sensitive (action, sensitive);
 
+	action = ACTION (MAIL_FOLDER_UNSUBSCRIBE);
+	sensitive = !folder_is_store && folder_can_be_deleted;
+	gtk_action_set_sensitive (action, sensitive);
+
 	e_mail_shell_view_update_popup_labels (mail_shell_view);
 }
 
diff --git a/ui/evolution-mail.ui b/ui/evolution-mail.ui
index 1b3df41..a73cfd0 100644
--- a/ui/evolution-mail.ui
+++ b/ui/evolution-mail.ui
@@ -51,6 +51,8 @@
         <menuitem action='mail-folder-refresh'/>
         <menuitem action='mail-folder-delete'/>
         <separator/>
+        <menuitem action='mail-folder-unsubscribe'/>
+        <separator/>
         <menuitem action='mail-folder-properties'/>
       </menu>
       <menu action='mail-message-menu'/>
@@ -82,6 +84,8 @@
     <menuitem action='mail-popup-empty-trash'/>
     <menuitem action='mail-popup-account-disable'/>
     <separator/>
+    <menuitem action='mail-popup-folder-unsubscribe'/>
+    <separator/>
     <menuitem action='mail-popup-folder-properties'/>
   </popup>
   <popup name='mail-message-popup'>



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