diff options
author | Not Zed <NotZed@Ximian.com> | 2004-01-19 16:41:11 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-01-19 16:41:11 +0800 |
commit | 35243289664c9e672b2802ffdd1408294a53b4a4 (patch) | |
tree | df7113e172f5333abbf7320e93f02f1b1e064274 /mail/em-popup.c | |
parent | 3f3cb88b8e27d8926701bac89ec8773f4bf99d83 (diff) | |
download | gsoc2013-evolution-35243289664c9e672b2802ffdd1408294a53b4a4.tar.gz gsoc2013-evolution-35243289664c9e672b2802ffdd1408294a53b4a4.tar.zst gsoc2013-evolution-35243289664c9e672b2802ffdd1408294a53b4a4.zip |
removed this like i asked radek to ages ago, just call the parent
2004-01-19 Not Zed <NotZed@Ximian.com>
* mail-ops.c (add_vjunk_info, add_vtrash_info): removed this like
i asked radek to ages ago, just call the parent directly.
(add_vtrash_or_vjunk_info): renamed to something saner.
add_special_info.
(add_special_info): removed the 'unread count' parameter & return
the added info.
** See bug #52854.
* em-folder-tree.c (emft_tree_button_press): setup a FOLDER target
for the popup menu.
* em-popup.c (em_popup_target_free): implement free for
TARGET_FOLDER, changed the target options somewhat.
(em_popup_target_new_folder): implement folder selection target.
Total Hack(tm) alert.
(emp_standard_menu_factory): removed the stupid
g_assert_if_not_reached() call.
* message-list.c (message_list_destroy): NULL out the uid_nodemap
when we destroy it.
svn path=/trunk/; revision=24302
Diffstat (limited to 'mail/em-popup.c')
-rw-r--r-- | mail/em-popup.c | 65 |
1 files changed, 63 insertions, 2 deletions
diff --git a/mail/em-popup.c b/mail/em-popup.c index e1efd4f268..128db12d12 100644 --- a/mail/em-popup.c +++ b/mail/em-popup.c @@ -26,6 +26,9 @@ #include <camel/camel-mime-part.h> #include <camel/camel-url.h> +#include <camel/camel-vee-folder.h> +#include <camel/camel-vtrash-folder.h> + #include <gconf/gconf.h> #include <gconf/gconf-client.h> @@ -544,6 +547,62 @@ em_popup_target_new_part(struct _CamelMimePart *part, const char *mime_type) return t; } +/* TODO: This should be based on the CamelFolderInfo, but ... em-folder-tree doesn't keep it? */ +EMPopupTarget * +em_popup_target_new_folder(const char *uri, int isstore) +{ + EMPopupTarget *t = g_malloc0(sizeof(*t)); + guint32 mask = ~0; + CamelURL *url; + + t->type = EM_POPUP_TARGET_FOLDER; + t->data.folder.folder_uri = g_strdup(uri); + + if (isstore) + mask &= ~(EM_POPUP_FOLDER_STORE|EM_POPUP_FOLDER_INFERIORS); + else + mask &= ~EM_POPUP_FOLDER_FOLDER; + + url = camel_url_new(uri, NULL); + if (url == NULL) + goto done; + + if (!isstore) { + const char *path; + + /* We have no way to find out FOLDER_INFERIORS without + * the FolderInfo, so turn it on always (except vtrash/junk below) */ + mask &= ~EM_POPUP_FOLDER_INFERIORS; + + /* FIXME: this is a total hack, but i think all we can do at present */ + path = url->fragment?url->fragment:url->path; + mask &= ~EM_POPUP_FOLDER_DELETE; + if (path && path[0] + && (strcmp(path, CAMEL_VTRASH_NAME) == 0 + || strcmp(path, CAMEL_VJUNK_NAME) == 0 + || strcmp(path, CAMEL_UNMATCHED_NAME) == 0 + /* more hack, for maildir root */ + || strcmp(path, ".") == 0)) + mask |= EM_POPUP_FOLDER_DELETE|EM_POPUP_FOLDER_INFERIORS; + + /* since vtrash/vjunk currently make scarily bogus + * url's, we have to check this too */ + if (strcmp(url->protocol, "vtrash") == 0 + || strcmp(url->protocol, "vjunk") == 0) + mask |= EM_POPUP_FOLDER_DELETE|EM_POPUP_FOLDER_INFERIORS; + /* end hack bit */ + + if (camel_url_get_param(url, "noselect") == NULL) + mask &= ~EM_POPUP_FOLDER_SELECT; + } + + camel_url_free(url); +done: + t->mask = mask; + + return t; +} + void em_popup_target_free(EMPopupTarget *t) { @@ -561,6 +620,9 @@ em_popup_target_free(EMPopupTarget *t) camel_object_unref(t->data.part.part); g_free(t->data.part.mime_type); break; + case EM_POPUP_TARGET_FOLDER: + g_free(t->data.folder.folder_uri); + break; } g_free(t); @@ -820,9 +882,9 @@ emp_standard_menu_factory(EMPopup *emp, EMPopupTarget *target, void *data) GSList *menus = NULL; switch (target->type) { +#if 0 case EM_POPUP_TARGET_SELECT: return; -#if 0 items = emp_standard_select_popups; len = LEN(emp_standard_select_popups); break; @@ -890,7 +952,6 @@ emp_standard_menu_factory(EMPopup *emp, EMPopupTarget *target, void *data) default: items = NULL; len = 0; - g_assert_not_reached (); } for (i=0;i<len;i++) { |