aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-popup.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2004-02-19 04:22:04 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-02-19 04:22:04 +0800
commit484a226767548759a29493d2a3e2db82202bd675 (patch)
tree5f91f944844d12fecff35ae4c70d54944474ce37 /mail/em-popup.c
parent327242a925af1a111d07dc1f9171b4bead02e85f (diff)
downloadgsoc2013-evolution-484a226767548759a29493d2a3e2db82202bd675.tar.gz
gsoc2013-evolution-484a226767548759a29493d2a3e2db82202bd675.tar.zst
gsoc2013-evolution-484a226767548759a29493d2a3e2db82202bd675.zip
Pass flags to em_popup_target_new_folder() instead of just an isstore arg.
2004-02-18 Jeffrey Stedfast <fejj@ximian.com> * em-folder-tree.c (emft_tree_button_press): Pass flags to em_popup_target_new_folder() instead of just an isstore arg. * em-popup.c (em_popup_target_new_folder): Instead of taking an isstore argument, take a flags argument so that our caller can give us hints about the selected folder/store. Also fixed a logic bug from my previous commit. svn path=/trunk/; revision=24785
Diffstat (limited to 'mail/em-popup.c')
-rw-r--r--mail/em-popup.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/mail/em-popup.c b/mail/em-popup.c
index 8f154ade93..60f10dbb04 100644
--- a/mail/em-popup.c
+++ b/mail/em-popup.c
@@ -585,7 +585,7 @@ em_popup_target_new_part(struct _CamelMimePart *part, const char *mime_type)
/* 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, guint32 info_flags, int isstore)
+em_popup_target_new_folder (const char *uri, guint32 info_flags, guint32 popup_flags)
{
EMPopupTarget *t = g_malloc0(sizeof(*t));
guint32 mask = ~0;
@@ -594,43 +594,37 @@ em_popup_target_new_folder(const char *uri, guint32 info_flags, int isstore)
t->type = EM_POPUP_TARGET_FOLDER;
t->data.folder.folder_uri = g_strdup(uri);
- if (isstore)
+ if (popup_flags & EM_POPUP_FOLDER_STORE)
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) {
+ if (!(popup_flags & EM_POPUP_FOLDER_STORE)) {
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;
- /* end hack bit */
+ if (popup_flags & EM_POPUP_FOLDER_DELETE)
+ mask &= ~EM_POPUP_FOLDER_DELETE;
+
+ if (!(info_flags & CAMEL_FOLDER_NOINFERIORS))
+ mask &= ~EM_POPUP_FOLDER_INFERIORS;
+
+ if (!(info_flags & CAMEL_FOLDER_NOSELECT))
+ mask &= ~EM_POPUP_FOLDER_SELECT;
- /* check for vTrash/vJunk */
if (info_flags & CAMEL_FOLDER_VIRTUAL)
mask |= EM_POPUP_FOLDER_DELETE|EM_POPUP_FOLDER_INFERIORS;
- if (info_flags & CAMEL_FOLDER_NOSELECT)
- mask &= ~EM_POPUP_FOLDER_SELECT;
+ if ((path = url->fragment ? url->fragment : url->path)) {
+ if ((!strcmp (url->protocol, "vfolder") && !strcmp (path, CAMEL_UNMATCHED_NAME))
+ || (!strcmp (url->protocol, "maildir") && !strcmp (path, "."))) /* hack for maildir toplevel folder */
+ mask |= EM_POPUP_FOLDER_DELETE|EM_POPUP_FOLDER_INFERIORS;
+ }
}
-
+
camel_url_free(url);
done:
t->mask = mask;