diff options
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | mail/em-folder-utils.c | 66 | ||||
-rw-r--r-- | mail/em-folder-utils.h | 4 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-actions.c | 29 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-actions.h | 2 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view.c | 4 | ||||
-rw-r--r-- | plugins/folder-unsubscribe/ChangeLog | 58 | ||||
-rw-r--r-- | plugins/folder-unsubscribe/Makefile.am | 18 | ||||
-rw-r--r-- | plugins/folder-unsubscribe/folder-unsubscribe.c | 110 | ||||
-rw-r--r-- | plugins/folder-unsubscribe/org-gnome-mail-folder-unsubscribe.eplug.xml | 20 | ||||
-rw-r--r-- | ui/evolution-mail.ui | 4 |
11 files changed, 107 insertions, 212 deletions
diff --git a/configure.ac b/configure.ac index 8cab9ff338..78a5748543 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 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); diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c index 25e7d80da3..22bd86320b 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 2a05582df8..3fb7142fff 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 8d8b4aa2b3..ce18936eb8 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/plugins/folder-unsubscribe/ChangeLog b/plugins/folder-unsubscribe/ChangeLog deleted file mode 100644 index fd8eb19b43..0000000000 --- a/plugins/folder-unsubscribe/ChangeLog +++ /dev/null @@ -1,58 +0,0 @@ -2008-09-23 Matthew Barnes <mbarnes@redhat.com> - - ** Fixes part of bug #552850 - - * org-gnome-mail-folder-unsubscribe.eplug.xml: - Prefer the term "side bar" over "folder tree". - -2008-08-27 Sankar P <psankar@novell.com> - -License Changes - - * folder-unsubscribe.c: - -2008-08-12 Bharath Acharya <abharath@novell.com> - - * Makefile.am: Use NO_UNDEFINED. Link with more libraries. To generate - dlls on Windows. - -2007-12-20 Matthew Barnes <mbarnes@redhat.com> - - ** Fixes part of bug #362638 - - * folder-unsubscribe.c: - Use the new MailMsg API for messages. - -2007-11-18 Gilles Dartiguelongue <gdartigu@svn.gnome.org> - - ** Fix bug #495875 - - * org-gnome-mail-folder-unsubscribe.eplug.xml: - right click menu reordering - -2007-04-02 Sankar P <psankar@novell.com> - - * Committed on behalf of Gilles Dartiguelongue <dartigug@esiee.fr> - - * org-gnome-mail-folder-unsubscribe.eplug.xml: - Cleanup. - Fixes part of #301149 - - -2005-05-06 Not Zed <NotZed@Ximian.com> - - * Makefile.am: - * org-gnome-mail-folder-unsubscribe.eplug.xml: s/.in/.xml/ & i18n. - -2005-02-24 Björn Torkelsson <torkel@acc.umu.se> - - * org-gnome-mail-folder-unsubscribe.eplug.in: Updated description. - -2004-11-01 JP Rosevear <jpr@novell.com> - - * Makefile.am: dist .eplug.in file - -2004-10-28 Not Zed <NotZed@Ximian.com> - - * org-gnome-mail-folder-unsubscribe.eplug.in: fix hook id - diff --git a/plugins/folder-unsubscribe/Makefile.am b/plugins/folder-unsubscribe/Makefile.am deleted file mode 100644 index b3f1ba12bf..0000000000 --- a/plugins/folder-unsubscribe/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_MAIL_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-mail-folder-unsubscribe.eplug -plugin_LTLIBRARIES = liborg-gnome-mail-folder-unsubscribe.la - -liborg_gnome_mail_folder_unsubscribe_la_SOURCES = folder-unsubscribe.c -liborg_gnome_mail_folder_unsubscribe_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) -liborg_gnome_mail_folder_unsubscribe_la_LIBADD = \ - $(top_builddir)/mail/libevolution-mail.la \ - $(EVOLUTION_MAIL_LIBS) - -EXTRA_DIST = org-gnome-mail-folder-unsubscribe.eplug.xml - --include $(top_srcdir)/git.mk diff --git a/plugins/folder-unsubscribe/folder-unsubscribe.c b/plugins/folder-unsubscribe/folder-unsubscribe.c deleted file mode 100644 index 7005ac7feb..0000000000 --- a/plugins/folder-unsubscribe/folder-unsubscribe.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Jeffrey Stedfast <fejj@novell.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <glib/gi18n.h> - -#include <string.h> - -#include <camel/camel-session.h> -#include <camel/camel-store.h> -#include <camel/camel-url.h> - -#include "mail/em-popup.h" -#include "mail/mail-mt.h" -#include "mail/mail-ops.h" - - -void org_gnome_mail_folder_unsubscribe (EPlugin *plug, EMPopupTargetFolder *target); - - - -struct _folder_unsub_t { - MailMsg base; - - gchar *uri; -}; - -static gchar * -folder_unsubscribe_desc (struct _folder_unsub_t *msg) -{ - return g_strdup_printf ( - _("Unsubscribing from folder \"%s\""), msg->uri); -} - -extern CamelSession *session; - -static void -folder_unsubscribe_exec (struct _folder_unsub_t *msg) -{ - const gchar *path = NULL; - CamelStore *store; - CamelURL *url; - - if (!(store = camel_session_get_store (session, msg->uri, &msg->base.ex))) - return; - - url = camel_url_new (msg->uri, NULL); - if (((CamelService *) store)->provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH) - path = url->fragment; - else if (url->path && 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 -folder_unsubscribe_free (struct _folder_unsub_t *msg) -{ - g_free (msg->uri); -} - -static MailMsgInfo unsubscribe_info = { - sizeof (struct _folder_unsub_t), - (MailMsgDescFunc) folder_unsubscribe_desc, - (MailMsgExecFunc) folder_unsubscribe_exec, - (MailMsgDoneFunc) NULL, - (MailMsgFreeFunc) folder_unsubscribe_free -}; - - -void -org_gnome_mail_folder_unsubscribe (EPlugin *plug, EMPopupTargetFolder *target) -{ - struct _folder_unsub_t *unsub; - - if (target->uri == NULL) - return; - - unsub = mail_msg_new (&unsubscribe_info); - unsub->uri = g_strdup (target->uri); - - mail_msg_unordered_push (unsub); -} diff --git a/plugins/folder-unsubscribe/org-gnome-mail-folder-unsubscribe.eplug.xml b/plugins/folder-unsubscribe/org-gnome-mail-folder-unsubscribe.eplug.xml deleted file mode 100644 index 24271fa8af..0000000000 --- a/plugins/folder-unsubscribe/org-gnome-mail-folder-unsubscribe.eplug.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - id="org.gnome.evolution.mail.folder.unsubscribe" - type="shlib" - domain="@GETTEXT_PACKAGE@" - _name="Unsubscribe Folders" - location="@PLUGINDIR@/liborg-gnome-mail-folder-unsubscribe@SOEXT@"> - <_description>Unsubscribe from an IMAP folder by right-clicking on it in the folder tree.</_description> - <author name="Jeffrey Stedfast" email="fejj@novell.com"/> - - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu id="org.gnome.evolution.mail.foldertree.popup" target="folder"> - <item type="item" path="30.emc.03" _label="_Unsubscribe" - activate="org_gnome_mail_folder_unsubscribe" - enable="delete" visible="delete"/> - </menu> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/ui/evolution-mail.ui b/ui/evolution-mail.ui index 1b3df418f3..a73cfd0a18 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'> |