[gtk+/filesystemmodel: 5/20] Simplify gtk_file_chooser_default_unselect_file()
- From: Benjamin Otte <otte src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+/filesystemmodel: 5/20] Simplify gtk_file_chooser_default_unselect_file()
- Date: Wed, 1 Jul 2009 08:42:11 +0000 (UTC)
commit 585772c32eae2df0e4dbfedacf1a024eeb2b5cb8
Author: Benjamin Otte <otte gnome org>
Date: Tue Jun 30 21:10:07 2009 +0200
Simplify gtk_file_chooser_default_unselect_file()
gtk/gtkfilechooserdefault.c | 37 +++++++++++--------------------------
1 files changed, 11 insertions(+), 26 deletions(-)
---
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 273feac..cda87fd 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -7430,41 +7430,26 @@ gtk_file_chooser_default_select_file (GtkFileChooser *chooser,
}
static void
-unselect_func (GtkFileSystemModel *model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- gpointer user_data)
-{
- GtkFileChooserDefault *impl = user_data;
- GtkTreeView *tree_view = GTK_TREE_VIEW (impl->browse_files_tree_view);
- GtkTreePath *sorted_path;
-
- sorted_path = gtk_tree_model_sort_convert_child_path_to_path (impl->sort_model,
- path);
- gtk_tree_selection_unselect_path (gtk_tree_view_get_selection (tree_view),
- sorted_path);
- gtk_tree_path_free (sorted_path);
-}
-
-static void
gtk_file_chooser_default_unselect_file (GtkFileChooser *chooser,
GFile *file)
{
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
- GtkTreePath *path;
- GtkTreeIter iter;
-
- if (!impl->browse_files_model)
- return;
-
+ GtkTreeView *tree_view = GTK_TREE_VIEW (impl->browse_files_tree_view);
+ GtkTreeIter iter, sorted_iter;
+
+ if (!impl->browse_files_model)
+ return;
+
if (!_gtk_file_system_model_get_iter_for_file (impl->browse_files_model,
&iter,
file))
return;
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->browse_files_model), &iter);
- unselect_func (impl->browse_files_model, path, &iter, impl);
- gtk_tree_path_free (path);
+ gtk_tree_model_sort_convert_child_iter_to_iter (impl->sort_model,
+ &sorted_iter,
+ &iter);
+ gtk_tree_selection_unselect_iter (gtk_tree_view_get_selection (tree_view),
+ &sorted_iter);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]