From c0f7c70b8a268748a3f6f05a8ecd3f1982258b90 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 18 Jun 2002 20:49:16 +0000 Subject: New convenience function to find the first parent node that is visible and 2002-06-18 Jeffrey Stedfast * message-list.c (message_list_change_first_visible_parent): New convenience function to find the first parent node that is visible and emit a changed signal on it. (main_folder_changed): If a message changed, call change_first_visible_parent() in case we are in a collapsed thread so that our first visible parent gets updated as well. Fixes bug #26263. * component-factory.c (storage_remove_folder): Simplify the error checking. svn path=/trunk/; revision=17228 --- mail/ChangeLog | 13 +++++++++++++ mail/component-factory.c | 14 +++++--------- mail/message-list.c | 25 +++++++++++++++++++++++-- 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index be51adaa64..e996c29a68 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,16 @@ +2002-06-18 Jeffrey Stedfast + + * message-list.c (message_list_change_first_visible_parent): New + convenience function to find the first parent node that is visible + and emit a changed signal on it. + (main_folder_changed): If a message changed, call + change_first_visible_parent() in case we are in a collapsed thread + so that our first visible parent gets updated as well. Fixes bug + #26263. + + * component-factory.c (storage_remove_folder): Simplify the error + checking. + 2002-06-17 Jeffrey Stedfast * message-list.c (get_normalised_string): New convenience function diff --git a/mail/component-factory.c b/mail/component-factory.c index 07dcba7c32..5384bbd249 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -1132,7 +1132,7 @@ storage_remove_folder (EvolutionStorage *storage, g_warning ("storage_remove_folder: path=\"%s\"; uri=\"%s\"", path, physical_uri); - if (!path || !physical_uri || !strncmp (physical_uri, "vtrash:", 7)) { + if (!path || !*path || !physical_uri || !strncmp (physical_uri, "vtrash:", 7)) { notify_listener (listener, GNOME_Evolution_Storage_INVALID_URI); return; } @@ -1143,21 +1143,15 @@ storage_remove_folder (EvolutionStorage *storage, return; } - if (!*path) { - camel_url_free (url); - notify_listener (listener, GNOME_Evolution_Storage_INVALID_URI); - return; - } - camel_exception_init (&ex); - + if (url->fragment) name = url->fragment; else if (url->path && url->path[0]) name = url->path+1; else name = ""; - + if (camel_store_supports_subscriptions (store)) camel_store_unsubscribe_folder (store, name, NULL); @@ -1192,6 +1186,8 @@ storage_xfer_folder (EvolutionStorage *storage, d(printf("Transfer folder on store source = '%s' dest = '%s'\n", source_path, destination_path)); + /* FIXME: this is totally not gonna work once we have namespaces */ + /* Remap the 'path' to the camel friendly name based on the store dir separator */ sep = store->dir_sep; src = g_strdup(source_path[0]=='/'?source_path+1:source_path); diff --git a/mail/message-list.c b/mail/message-list.c index 1d5c4595d4..a96b2ed473 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -1894,6 +1894,22 @@ build_flat (MessageList *ml, GPtrArray *summary, CamelFolderChangeInfo *changes) } +static void +message_list_change_first_visible_parent (MessageList *ml, ETreePath node) +{ + ETreePath first_visible = NULL; + + while (node && (node = e_tree_model_node_get_parent (ml->model, node))) { + if (!e_tree_node_is_expanded (ml->tree, node)) + first_visible = node; + } + + if (first_visible != NULL) { + e_tree_model_pre_change (ml->model); + e_tree_model_node_data_changed (ml->model, first_visible); + } +} + #ifndef BROKEN_ETREE static void @@ -1942,6 +1958,8 @@ build_flat_diff(MessageList *ml, CamelFolderChangeInfo *changes) if (node) { e_tree_model_pre_change (ml->model); e_tree_model_node_data_changed (ml->model, node); + + message_list_change_first_visible_parent (ml, node) } } @@ -1955,6 +1973,7 @@ build_flat_diff(MessageList *ml, CamelFolderChangeInfo *changes) } #endif /* ! BROKEN_ETREE */ + static void main_folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) { @@ -2016,6 +2035,8 @@ main_folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) if (node) { e_tree_model_pre_change (ml->model); e_tree_model_node_data_changed (ml->model, node); + + message_list_change_first_visible_parent (ml, node); } } @@ -2032,14 +2053,14 @@ folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) { CamelFolderChangeInfo *changes; MessageList *ml = MESSAGE_LIST (user_data); - + if (event_data) { changes = camel_folder_change_info_new(); camel_folder_change_info_cat(changes, (CamelFolderChangeInfo *)event_data); } else { changes = NULL; } - + mail_async_event_emit(ml->async_event, MAIL_ASYNC_GUI, (MailAsyncFunc)main_folder_changed, o, changes, user_data); } -- cgit