From e74576a4377a8daa0e8fcc233c6c530943aeeba4 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Fri, 11 Jun 2004 09:18:55 +0000 Subject: rearrange the setting up of the target flags, stores can have a null path. 2004-06-11 Not Zed * em-folder-tree.c (emft_tree_button_press): rearrange the setting up of the target flags, stores can have a null path. * em-folder-selector.c (emfs_create_name_changed): use get_selected_uri rather than path. a valid uri may have a null path now. (emfs_create_name_activate): and here too. (em_folder_selector_get_selected_path): check the uri is null for a selected path, and then handle a null path. svn path=/trunk/; revision=26307 --- mail/ChangeLog | 10 ++++++++++ mail/em-folder-selector.c | 14 ++++++++------ mail/em-folder-tree.c | 31 ++++++++++++++++++------------- 3 files changed, 36 insertions(+), 19 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index c13399c9ce..8a4b463d9f 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,15 @@ 2004-06-11 Not Zed + * em-folder-tree.c (emft_tree_button_press): rearrange the setting + up of the target flags, stores can have a null path. + + * em-folder-selector.c (emfs_create_name_changed): use + get_selected_uri rather than path. a valid uri may have a null + path now. + (emfs_create_name_activate): and here too. + (em_folder_selector_get_selected_path): check the uri is null for + a selected path, and then handle a null path. + * em-folder-tree-model.c (em_folder_tree_model_add_store): revert previous change. Stupid emftm. diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c index f31e06c78c..9f75db119d 100644 --- a/mail/em-folder-selector.c +++ b/mail/em-folder-selector.c @@ -195,7 +195,7 @@ emfs_create_name_changed (GtkEntry *entry, EMFolderSelector *emfs) if (emfs->name_entry->text_length > 0) text = gtk_entry_get_text (emfs->name_entry); - path = em_folder_tree_get_selected_path (emfs->emft); + path = em_folder_tree_get_selected_uri(emfs->emft); active = text && path && !strchr (text, '/'); @@ -279,7 +279,7 @@ emfs_create_name_activate (GtkEntry *entry, EMFolderSelector *emfs) const char *path, *text; text = gtk_entry_get_text (emfs->name_entry); - path = em_folder_tree_get_selected_path (emfs->emft); + path = em_folder_tree_get_selected_uri(emfs->emft); if (text && path && !strchr (text, '/')) g_signal_emit_by_name (emfs, "response", GTK_RESPONSE_OK); @@ -403,13 +403,15 @@ em_folder_selector_get_selected_path (EMFolderSelector *emfs) /* already did the work in a previous call */ return emfs->selected_path; } - - if (!(path = em_folder_tree_get_selected_path (emfs->emft))) { + + if (!em_folder_tree_get_selected_uri(emfs->emft)) { d(printf ("no selected folder?\n")); return NULL; } - - if (path && emfs->name_entry) { + + path = em_folder_tree_get_selected_path(emfs->emft); + path = path?path:""; + if (emfs->name_entry) { const char *name; char *newpath; diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 614012deb3..1988fc2d73 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -994,6 +994,7 @@ tree_drag_data_received(GtkWidget *widget, GdkDragContext *context, int x, int y COL_STRING_FULL_NAME, &full_name, -1); /* make sure user isn't try to drop on a placeholder row */ + /* FIXME: must allow drop of folders onto a store */ if (full_name == NULL) { gtk_drag_finish (context, FALSE, FALSE, GDK_CURRENT_TIME); return; @@ -2632,25 +2633,29 @@ emft_tree_button_press (GtkTreeView *treeview, GdkEventButton *event, EMFolderTr gtk_tree_model_get (model, &iter, COL_POINTER_CAMEL_STORE, &store, COL_STRING_URI, &uri, COL_STRING_FULL_NAME, &full_name, COL_BOOL_IS_STORE, &isstore, -1); - - if (full_name == NULL) + + /* Stores have full_name == NULL, otherwise its just a placeholder */ + /* NB: This is kind of messy */ + if (!isstore && full_name == NULL) return FALSE; - if (isstore) + /* TODO: em_popup_target_folder_new? */ + if (isstore) { flags |= EM_POPUP_FOLDER_STORE; - else + } else { flags |= EM_POPUP_FOLDER_FOLDER; + + local = mail_component_peek_local_store (NULL); - local = mail_component_peek_local_store (NULL); - - /* don't allow deletion of special local folders */ - if (!(store == local && is_special_local_folder (full_name))) - flags |= EM_POPUP_FOLDER_DELETE; - - /* 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; + /* don't allow deletion of special local folders */ + if (!(store == local && is_special_local_folder (full_name))) + flags |= EM_POPUP_FOLDER_DELETE; + /* 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; + } + /* handle right-click by opening a context menu */ emp = em_popup_new ("com.ximian.mail.storageset.popup.select"); -- cgit