From e18f01469d382189d9d9365a8c79828081e09d1d Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Fri, 11 May 2007 06:26:42 +0000 Subject: Added support for flush outbox and refresh folder. svn path=/trunk/; revision=33504 --- mail/ChangeLog | 10 ++++++++++ mail/em-folder-browser.c | 14 ++++++++++++++ mail/em-folder-tree.c | 25 +++++++++++++++++++++++++ mail/em-popup.c | 9 ++++++++- mail/em-popup.h | 2 ++ 5 files changed, 59 insertions(+), 1 deletion(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 386a0bd307..3d1baeebd9 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,13 @@ +2007-05-11 Srinivasa Ragavan + + ** Added support for Refresh folder and Flush Outbox functions. + + * em-folder-browser.c: (emfb_folder_refresh): + * em-folder-tree.c: (emft_popup_refresh_folder), + (emft_popup_flush_outbox), (emft_popup): + * em-popup.c: (em_popup_target_new_folder): + * em-popup.h: + 2007-05-03 Sankar P * em-folder-view.c: (emfv_activate): diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c index e24cb2e3a0..a05734f44c 100644 --- a/mail/em-folder-browser.c +++ b/mail/em-folder-browser.c @@ -72,6 +72,7 @@ #include #include "mail-vfolder.h" #include "em-vfolder-rule.h" +#include "em-folder-tree.h" #include #include #include @@ -1355,6 +1356,18 @@ emfb_folder_delete(BonoboUIComponent *uid, void *data, const char *path) return; } +static void +emfb_folder_refresh(BonoboUIComponent *uid, void *data, const char *path) +{ + EMFolderBrowser *emfb = data; + EMFolderTree *tree = g_object_get_data (emfb, "foldertree"); + CamelFolder *folder; + + if ((folder = em_folder_tree_get_selected_folder (tree)) != NULL) + mail_refresh_folder(folder, NULL, NULL); +} + + static void emfb_folder_rename(BonoboUIComponent *uid, void *data, const char *path) { @@ -1537,6 +1550,7 @@ static BonoboUIVerb emfb_verbs[] = { BONOBO_UI_UNSAFE_VERB ("FolderCopy", emfb_folder_copy), BONOBO_UI_UNSAFE_VERB ("FolderMove", emfb_folder_move), BONOBO_UI_UNSAFE_VERB ("FolderDelete", emfb_folder_delete), + BONOBO_UI_UNSAFE_VERB ("FolderRefresh", emfb_folder_refresh), BONOBO_UI_UNSAFE_VERB ("FolderRename", emfb_folder_rename), BONOBO_UI_UNSAFE_VERB ("FolderCreate", emfb_folder_create), diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 72cbf051cb..626bea2392 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -61,6 +61,7 @@ #include "mail-tools.h" #include "mail-config.h" #include "mail-component.h" +#include "mail-send-recv.h" #include "mail-vfolder.h" #include "em-utils.h" @@ -2061,6 +2062,22 @@ emft_popup_rename_folder (EPopup *ep, EPopupItem *pitem, void *data) } } +static void +emft_popup_refresh_folder (EPopup *ep, EPopupItem *pitem, void *data) +{ + EMFolderTree *emft = data; + CamelFolder *folder; + + if ((folder = em_folder_tree_get_selected_folder (emft)) != NULL) + mail_refresh_folder(folder, NULL, NULL); +} + +static void +emft_popup_flush_outbox (EPopup *ep, EPopupItem *pitem, void *data) +{ + mail_send (); +} + static void emft_popup_empty_trash (EPopup *ep, EPopupItem *pitem, void *data) { @@ -2102,6 +2119,9 @@ static EPopupItem emft_popup_items[] = { /* FIXME: need to disable for undeletable folders */ { E_POPUP_ITEM, "20.emc.01", N_("_Delete"), emft_popup_delete_folder, NULL, "stock_delete", 0, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_DELETE }, { E_POPUP_ITEM, "20.emc.02", N_("_Rename..."), emft_popup_rename_folder, NULL, NULL, 0, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_DELETE }, + { E_POPUP_ITEM, "20.emc.03", N_("Re_fresh"), emft_popup_refresh_folder, NULL, "stock_refresh", EM_POPUP_FOLDER_NONSTATIC, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_SELECT}, + { E_POPUP_ITEM, "20.emc.04", N_("Fl_ush Outbox"), emft_popup_flush_outbox, NULL, "stock_mail-send", EM_POPUP_FOLDER_OUTBOX, 0 }, + { E_POPUP_BAR, "80.emc" }, { E_POPUP_ITEM, "80.emc.00", N_("_Properties"), emft_popup_properties, NULL, "stock_folder-properties", 0, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_SELECT } @@ -2131,6 +2151,7 @@ emft_popup (EMFolderTree *emft, GdkEvent *event) char *uri, *full_name; GtkMenu *menu; EMPopup *emp; + CamelFolder *selfolder = NULL; int i; treeview = emft->priv->treeview; @@ -2169,6 +2190,10 @@ emft_popup (EMFolderTree *emft, GdkEvent *event) /* hack for vTrash/vJunk */ if (!strcmp (full_name, CAMEL_VTRASH_NAME) || !strcmp (full_name, CAMEL_VJUNK_NAME)) info_flags |= CAMEL_FOLDER_VIRTUAL | CAMEL_FOLDER_NOINFERIORS; + + selfolder = em_folder_tree_get_selected_folder (emft); + if (em_utils_folder_is_outbox (selfolder, NULL)) + info_flags |= CAMEL_FOLDER_TYPE_OUTBOX; } /** @HookPoint-EMPopup: Folder Tree Context Menu diff --git a/mail/em-popup.c b/mail/em-popup.c index c48f901d94..b059926f94 100644 --- a/mail/em-popup.c +++ b/mail/em-popup.c @@ -338,7 +338,12 @@ em_popup_target_new_folder (EMPopup *emp, const char *uri, guint32 info_flags, g if (!(info_flags & CAMEL_FOLDER_NOINFERIORS)) mask &= ~EM_POPUP_FOLDER_INFERIORS; - + + if (info_flags & CAMEL_FOLDER_TYPE_OUTBOX) + mask &= ~EM_POPUP_FOLDER_OUTBOX; + else + mask &= ~EM_POPUP_FOLDER_NONSTATIC; + if (!(info_flags & CAMEL_FOLDER_NOSELECT)) mask &= ~EM_POPUP_FOLDER_SELECT; @@ -868,6 +873,8 @@ static const EPopupHookTargetMask emph_folder_masks[] = { { "inferiors", EM_POPUP_FOLDER_INFERIORS }, { "delete", EM_POPUP_FOLDER_DELETE }, { "select", EM_POPUP_FOLDER_SELECT }, + { "outbox", EM_POPUP_FOLDER_OUTBOX }, + { "nonstatic", EM_POPUP_FOLDER_NONSTATIC }, { 0 } }; diff --git a/mail/em-popup.h b/mail/em-popup.h index 42752bc3ec..0a26e9c523 100644 --- a/mail/em-popup.h +++ b/mail/em-popup.h @@ -151,6 +151,8 @@ enum _em_popup_target_folder_t { EM_POPUP_FOLDER_INFERIORS = 1<<2, /* folder can have children */ EM_POPUP_FOLDER_DELETE = 1<<3, /* folder can be deleted/renamed */ EM_POPUP_FOLDER_SELECT = 1<<4, /* folder can be selected/opened */ + EM_POPUP_FOLDER_OUTBOX = 1<<5, /* Outbox folder */ + EM_POPUP_FOLDER_NONSTATIC = 1<<6, /* Except static folders like Outbox.*/ }; /** -- cgit