[gthumb] browser: fixed error when the new location is an entry point



commit d57c99e44f702ec9c275a05b8fc9db55b851d84e
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Mon Apr 23 19:44:29 2012 +0200

    browser: fixed error when the new location is an entry point
    
    Block selection-changed signals when collapsing the folder tree, to avoid
    to incorrectly open an automatically selected entry.

 gthumb/gth-browser.c     |    2 +-
 gthumb/gth-folder-tree.c |   12 ++++++++++++
 gthumb/gth-folder-tree.h |    1 +
 3 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index b92c32f..c86faf5 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -1608,7 +1608,7 @@ load_data_continue (LoadData *load_data,
 				GthFileData *file_data = scan->data;
 
 				if (g_file_equal (file_data->file, load_data->requested_folder->file)) {
-					gtk_tree_view_collapse_all (GTK_TREE_VIEW (browser->priv->folder_tree));
+					gth_folder_tree_collapse_all (GTH_FOLDER_TREE (browser->priv->folder_tree));
 					gtk_tree_view_expand_row (GTK_TREE_VIEW (browser->priv->folder_tree), path, FALSE);
 					is_entry_point = TRUE;
 					break;
diff --git a/gthumb/gth-folder-tree.c b/gthumb/gth-folder-tree.c
index 1f0caf4..12f7605 100644
--- a/gthumb/gth-folder-tree.c
+++ b/gthumb/gth-folder-tree.c
@@ -1603,6 +1603,18 @@ gth_folder_tree_expand_row (GthFolderTree *folder_tree,
 }
 
 
+void
+gth_folder_tree_collapse_all (GthFolderTree *folder_tree)
+{
+	GtkTreeSelection *selection;
+
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_tree));
+	g_signal_handlers_block_by_func (selection, selection_changed_cb, folder_tree);
+	gtk_tree_view_collapse_all (GTK_TREE_VIEW (folder_tree));
+	g_signal_handlers_unblock_by_func (selection, selection_changed_cb, folder_tree);
+}
+
+
 GthFileData *
 gth_folder_tree_get_file (GthFolderTree *folder_tree,
 			  GtkTreePath   *path)
diff --git a/gthumb/gth-folder-tree.h b/gthumb/gth-folder-tree.h
index 54680ee..dc83532 100644
--- a/gthumb/gth-folder-tree.h
+++ b/gthumb/gth-folder-tree.h
@@ -97,6 +97,7 @@ void          gth_folder_tree_reset_loaded       (GthFolderTree        *folder_t
 void          gth_folder_tree_expand_row         (GthFolderTree        *folder_tree,
 						  GtkTreePath          *path,
 						  gboolean              open_all);
+void          gth_folder_tree_collapse_all       (GthFolderTree        *folder_tree);
 void          gth_folder_tree_select_path        (GthFolderTree        *folder_tree,
 						  GtkTreePath          *path);
 GFile *       gth_folder_tree_get_root           (GthFolderTree        *folder_tree);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]