diff options
author | Jeffrey Stedfast <fejj@novell.com> | 2004-06-09 03:04:19 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-06-09 03:04:19 +0800 |
commit | 19e87233d261b02464fc08ce6a5d2b31f089044b (patch) | |
tree | 3bb9ef3edc6aa986ae6b55913af6e58e76fd94e7 /mail/em-folder-tree.c | |
parent | aa8514a7f6ea6a3e80686a9f091a9d4a3355885f (diff) | |
download | gsoc2013-evolution-19e87233d261b02464fc08ce6a5d2b31f089044b.tar.gz gsoc2013-evolution-19e87233d261b02464fc08ce6a5d2b31f089044b.tar.zst gsoc2013-evolution-19e87233d261b02464fc08ce6a5d2b31f089044b.zip |
Only change the cursor if the currently selected folder is a subfolder of
2004-06-08 Jeffrey Stedfast <fejj@novell.com>
* em-folder-tree.c (emft_tree_row_collapsed): Only change the
cursor if the currently selected folder is a subfolder of the
folder collapsed. Fixes bug #59801 without breaking bug #57665.
(emft_tree_test_collapse_row): Renamed from
emft_tree_collapse_row() to match the new signal we are connected
to.
svn path=/trunk/; revision=26258
Diffstat (limited to 'mail/em-folder-tree.c')
-rw-r--r-- | mail/em-folder-tree.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 1186aef1b7..163f834a6f 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -148,7 +148,7 @@ static void emft_queue_save_state (EMFolderTree *emft); static void emft_update_model_expanded_state (struct _EMFolderTreePrivate *priv, GtkTreeIter *iter, gboolean expanded); static void emft_tree_row_activated (GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *column, EMFolderTree *emft); -static void emft_tree_row_collapsed (GtkTreeView *treeview, GtkTreeIter *root, GtkTreePath *path, EMFolderTree *emft); +static gboolean emft_tree_test_collapse_row (GtkTreeView *treeview, GtkTreeIter *root, GtkTreePath *path, EMFolderTree *emft); static void emft_tree_row_expanded (GtkTreeView *treeview, GtkTreeIter *root, GtkTreePath *path, EMFolderTree *emft); static gboolean emft_tree_button_press (GtkTreeView *treeview, GdkEventButton *event, EMFolderTree *emft); static void emft_tree_selection_changed (GtkTreeSelection *selection, EMFolderTree *emft); @@ -466,7 +466,7 @@ em_folder_tree_construct (EMFolderTree *emft, EMFolderTreeModel *model) gtk_widget_show ((GtkWidget *) priv->treeview); g_signal_connect (priv->treeview, "row-expanded", G_CALLBACK (emft_tree_row_expanded), emft); - g_signal_connect (priv->treeview, "row-collapsed", G_CALLBACK (emft_tree_row_collapsed), emft); + g_signal_connect (priv->treeview, "test-collapse-row", G_CALLBACK (emft_tree_test_collapse_row), emft); g_signal_connect (priv->treeview, "row-activated", G_CALLBACK (emft_tree_row_activated), emft); g_signal_connect (priv->treeview, "button-press-event", G_CALLBACK (emft_tree_button_press), emft); @@ -1747,13 +1747,24 @@ emft_tree_row_expanded (GtkTreeView *treeview, GtkTreeIter *root, GtkTreePath *t e_thread_put (mail_thread_new, (EMsg *) m); } -static void -emft_tree_row_collapsed (GtkTreeView *treeview, GtkTreeIter *root, GtkTreePath *tree_path, EMFolderTree *emft) +static gboolean +emft_tree_test_collapse_row (GtkTreeView *treeview, GtkTreeIter *root, GtkTreePath *tree_path, EMFolderTree *emft) { - gtk_tree_view_set_cursor (treeview, tree_path, NULL, FALSE); + GtkTreeSelection *selection; + GtkTreeModel *model; + GtkTreeIter cursor; + + selection = gtk_tree_view_get_selection (treeview); + if (gtk_tree_selection_get_selected (selection, &model, &cursor)) { + /* select the collapsed node IFF it is a parent of the currently selected folder */ + if (gtk_tree_store_is_ancestor ((GtkTreeStore *) model, root, &cursor)) + gtk_tree_view_set_cursor (treeview, tree_path, NULL, FALSE); + } emft_update_model_expanded_state (emft->priv, root, FALSE); emft_queue_save_state (emft); + + return FALSE; } static void |