aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-06-26 01:27:20 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-06-26 01:27:20 +0800
commitf0cf88bc99a458193f2c16a3ed346c20f6a5fd1a (patch)
tree46f65e318310ad0eb481ba11d761b9a189cb4bb5 /mail
parente26654bf19d9d2b5df889631e6c211af0e7de655 (diff)
downloadgsoc2013-evolution-f0cf88bc99a458193f2c16a3ed346c20f6a5fd1a.tar.gz
gsoc2013-evolution-f0cf88bc99a458193f2c16a3ed346c20f6a5fd1a.tar.zst
gsoc2013-evolution-f0cf88bc99a458193f2c16a3ed346c20f6a5fd1a.zip
Kill the "folder-unsubscribe" plugin.
Feature is now integrated in core mailer, and has a main menu item.
Diffstat (limited to 'mail')
-rw-r--r--mail/em-folder-utils.c66
-rw-r--r--mail/em-folder-utils.h4
2 files changed, 68 insertions, 2 deletions
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index 8890e48cbd..21ec52b142 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 86d58ef9f3..d0db789b96 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);