diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2004-02-19 04:22:04 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-02-19 04:22:04 +0800 |
commit | 484a226767548759a29493d2a3e2db82202bd675 (patch) | |
tree | 5f91f944844d12fecff35ae4c70d54944474ce37 /mail/em-folder-tree.c | |
parent | 327242a925af1a111d07dc1f9171b4bead02e85f (diff) | |
download | gsoc2013-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-folder-tree.c')
-rw-r--r-- | mail/em-folder-tree.c | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 0e1c6c4357..bdab24952f 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -2204,29 +2204,50 @@ emft_tree_button_press (GtkWidget *treeview, GdkEventButton *event, EMFolderTree /* FIXME: need to disable Rename/Move for Outbox and possibly other special folders */ struct _EMFolderTreePrivate *priv = emft->priv; GtkTreeSelection *selection; + CamelStore *local, *store; + const char *folder_name; + EMPopupTarget *target; GtkTreeModel *model; GtkTreeIter iter; GSList *menus = NULL; + guint32 flags = 0; + gboolean isstore; + char *uri, *path; GtkMenu *menu; EMPopup *emp; - EMPopupTarget *target; - char *uri; - gboolean isstore; int i; if (event->button != 3) return FALSE; - /* handle right-click by opening a context menu */ - emp = em_popup_new ("com.ximian.mail.storageset.popup.select"); - /* FIXME: we really need the folderinfo to build a proper menu */ selection = gtk_tree_view_get_selection (priv->treeview); emft_selection_get_selected (selection, &model, &iter); - gtk_tree_model_get (model, &iter, COL_STRING_URI, &uri, COL_BOOL_IS_STORE, &isstore, -1); + gtk_tree_model_get (model, &iter, COL_POINTER_CAMEL_STORE, &store, + COL_STRING_URI, &uri, COL_STRING_FOLDER_PATH, &path, + COL_BOOL_IS_STORE, &isstore, -1); + + if (path == NULL) + return FALSE; + + if (isstore) + flags |= EM_POPUP_FOLDER_STORE; + else + flags |= EM_POPUP_FOLDER_FOLDER; + + local = mail_component_peek_local_store (NULL); + + folder_name = path[0] == '/' ? path + 1 : path; + + /* don't allow deletion of special local folders */ + if (!(store == local && is_special_local_folder (folder_name))) + flags |= EM_POPUP_FOLDER_DELETE; + + /* handle right-click by opening a context menu */ + emp = em_popup_new ("com.ximian.mail.storageset.popup.select"); /* FIXME: pass valid fi->flags here */ - target = em_popup_target_new_folder(uri, 0, isstore); + target = em_popup_target_new_folder (uri, /* fi->flags */ 0, flags); for (i = 0; i < sizeof (emft_popup_menu) / sizeof (emft_popup_menu[0]); i++) { EMPopupItem *item = &emft_popup_menu[i]; |