diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-11-15 06:28:34 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-11-15 06:28:34 +0800 |
commit | 83c14461d14d15400e22dfe60478f3ef26bbb1d7 (patch) | |
tree | 2ba0b52aa535f2cf73f7fd481d4ae5ee49b90119 /mail | |
parent | c02fe8b8c2867fa647cd5dd820cfc7650e0ed5f1 (diff) | |
download | gsoc2013-evolution-83c14461d14d15400e22dfe60478f3ef26bbb1d7.tar.gz gsoc2013-evolution-83c14461d14d15400e22dfe60478f3ef26bbb1d7.tar.zst gsoc2013-evolution-83c14461d14d15400e22dfe60478f3ef26bbb1d7.zip |
We can't use a uri to do a lookup of a store-info on the store_hash, we
2003-11-14 Jeffrey Stedfast <fejj@ximian.com>
* em-folder-tree.c (emft_popup_new_folder_response): We can't use
a uri to do a lookup of a store-info on the store_hash, we have to
get a CamelStore first.
(row_draggable_cb): validate the iter before using it.
(row_drop_possible_cb): Same.
(drag_data_received_cb): Here too.
(drag_data_get_cb): Same.
(drag_data_delete_cb): Again here.
(tree_store_set_folder_info): Recursively add nodes if fi->child
is non-NULL rather than adding a dummy node.
(folder_renamed_cb): Implemented.
svn path=/trunk/; revision=23367
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 3 | ||||
-rw-r--r-- | mail/em-folder-tree.c | 70 | ||||
-rw-r--r-- | mail/mail-vfolder.c | 4 |
3 files changed, 72 insertions, 5 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index b50f7fe932..930a00e535 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -8,6 +8,9 @@ (drag_data_received_cb): Here too. (drag_data_get_cb): Same. (drag_data_delete_cb): Again here. + (tree_store_set_folder_info): Recursively add nodes if fi->child + is non-NULL rather than adding a dummy node. + (folder_renamed_cb): Implemented. 2003-11-14 Jeffrey Stedfast <fejj@ximian.com> diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index f79a7ec5b7..c54c3fabd8 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -891,7 +891,15 @@ tree_store_set_folder_info (GtkTreeStore *model, GtkTreeIter *iter, COL_BOOL_LOAD_SUBDIRS, load, -1); - if (load) { + if (fi->child) { + fi = fi->child; + + do { + gtk_tree_store_append (model, &sub, iter); + tree_store_set_folder_info ((GtkTreeStore *) model, &sub, priv, si, fi); + fi = fi->sibling; + } while (fi); + } else if (load) { /* create a placeholder node for our subfolders... */ gtk_tree_store_append (model, &sub, iter); gtk_tree_store_set (model, &sub, @@ -1866,7 +1874,65 @@ folder_deleted_cb (CamelStore *store, void *event_data, EMFolderTree *emft) static void folder_renamed_cb (CamelStore *store, void *event_data, EMFolderTree *emft) { - /* FIXME: implement me */ + struct _EMFolderTreePrivate *priv = emft->priv; + struct _EMFolderTreeModelStoreInfo *si; + CamelRenameInfo *info = event_data; + GtkTreeRowReference *row; + GtkTreeIter root, iter; + GtkTreeModel *model; + GtkTreePath *path; + char *parent, *p; + + if (!(si = g_hash_table_lookup (priv->model->store_hash, store))) + return; + + parent = g_strdup_printf ("/%s", info->old_base); + if (!(row = g_hash_table_lookup (si->path_hash, parent))) { + g_free (parent); + return; + } + g_free (parent); + + path = gtk_tree_row_reference_get_path (row); + model = gtk_tree_view_get_model (emft->priv->treeview); + if (!(gtk_tree_model_get_iter (model, &iter, path))) { + gtk_tree_path_free (path); + return; + } + + remove_folders (emft, model, si, &iter); + + parent = g_strdup (info->new->path); + if ((p = strrchr (parent + 1, '/'))) + *p = '\0'; + + if (!strcmp (parent, "/")) { + /* renamed to a toplevel folder on the store */ + path = gtk_tree_row_reference_get_path (si->row); + } else { + if (!(row = g_hash_table_lookup (si->path_hash, parent))) { + /* NOTE: this should never happen, but I + * suppose if it does in reality, we can add + * code here to add the missing nodes to the + * tree */ + g_assert_not_reached (); + g_free (parent); + return; + } + + path = gtk_tree_row_reference_get_path (row); + } + + g_free (parent); + + if (!gtk_tree_model_get_iter (model, &root, path)) { + gtk_tree_path_free (path); + g_assert_not_reached (); + return; + } + + gtk_tree_store_append ((GtkTreeStore *) model, &iter, &root); + tree_store_set_folder_info ((GtkTreeStore *) model, &iter, priv, si, info->new); } diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index e474ea70db..b3acc7f650 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -719,9 +719,7 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data) char *user; char *key; CamelFolder *folder; - - store = store; - + /* This should be more-or-less thread-safe */ d(printf("Folder renamed to '%s' from '%s'\n", info->new->full_name, info->old_base)); |