From a0b2261343a7938b4c85f8659216b9df1c81769b Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 2 Dec 2003 20:57:23 +0000 Subject: Connect to the loading row signal. (loading_row_cb): Expand the path if 2003-12-02 Jeffrey Stedfast * em-folder-tree.c (em_folder_tree_new_with_model): Connect to the loading row signal. (loading_row_cb): Expand the path if needed. (em_folder_tree_destroy): Disconnect from the loading-row signal. * em-folder-tree-model.c (em_folder_tree_model_class_init): Define the loading-row signal. (em_folder_tree_model_set_folder_info): emit the loading-row signal. svn path=/trunk/; revision=23589 --- mail/em-folder-tree.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'mail/em-folder-tree.c') diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 00692595b1..42ffcf0f1d 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -74,6 +74,8 @@ struct _EMFolderTreePrivate { guint save_state_id; + guint loading_row_id; + /* dnd signal ids */ guint ddr, rdp, rd, ddg, ddd; }; @@ -315,6 +317,11 @@ em_folder_tree_destroy (GtkObject *obj) { struct _EMFolderTreePrivate *priv = ((EMFolderTree *) obj)->priv; + if (priv->loading_row_id != 0) { + g_signal_handler_disconnect (priv->model, priv->loading_row_id); + priv->loading_row_id = 0; + } + if (priv->ddr != 0) { g_signal_handler_disconnect (priv->model, priv->ddr); priv->ddr = 0; @@ -907,6 +914,33 @@ expand_node (const char *key, gpointer value, EMFolderTree *emft) } +static void +loading_row_cb (EMFolderTreeModel *model, GtkTreePath *tree_path, GtkTreeIter *iter, EMFolderTree *emft) +{ + struct _EMFolderTreeModelStoreInfo *si; + CamelStore *store; + EAccount *account; + char *path, *key; + + gtk_tree_model_get ((GtkTreeModel *) model, iter, + COL_STRING_FOLDER_PATH, &path, + COL_POINTER_CAMEL_STORE, &store, + -1); + + si = g_hash_table_lookup (model->store_hash, store); + if ((account = mail_config_get_account_by_name (si->display_name))) { + key = g_strdup_printf ("%s:%s", account->uid, path); + } else { + key = g_strdup_printf ("%s:%s", si->display_name, path); + } + + if (em_folder_tree_model_get_expanded (model, key)) + gtk_tree_view_expand_to_path (emft->priv->treeview, tree_path); + + g_free (key); +} + + GtkWidget * em_folder_tree_new_with_model (EMFolderTreeModel *model) { @@ -919,6 +953,8 @@ em_folder_tree_new_with_model (EMFolderTreeModel *model) /* FIXME: this sucks... */ g_hash_table_foreach (model->expanded, (GHFunc) expand_node, emft); + emft->priv->loading_row_id = g_signal_connect (model, "loading-row", G_CALLBACK (loading_row_cb), emft); + return (GtkWidget *) emft; } -- cgit v1.2.3