diff options
-rw-r--r-- | mail/ChangeLog | 9 | ||||
-rw-r--r-- | mail/em-folder-tree.c | 21 |
2 files changed, 25 insertions, 5 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 569d0b01b8..3cbca6aee7 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,12 @@ +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. + 2004-06-07 Jeffrey Stedfast <fejj@novell.com> * em-folder-tree-model.c (em_folder_tree_model_add_store): Set the 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 |