[gtk+] file chooser: Small cleanup



commit a4dcc6bc5254d95823c2e7773ea75a17ee7dd81c
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jun 19 01:04:42 2015 -0400

    file chooser: Small cleanup
    
    Ask the search model if it is empty, instead of maintaining this
    information manually in the file chooser widget.

 gtk/gtkfilechooserwidget.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index c9d4b57..51b0294 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -246,7 +246,6 @@ struct _GtkFileChooserWidgetPrivate {
   GtkSearchEngine *search_engine;
   GtkQuery *search_query;
   GtkFileSystemModel *search_model;
-  gboolean search_model_empty;
 
   /* OPERATION_MODE_RECENT */
   GtkRecentManager *recent_manager;
@@ -6146,9 +6145,6 @@ search_engine_hits_added_cb (GtkSearchEngine      *engine,
         files = g_list_prepend (files, file);
     }
 
-  if (files || files_with_info)
-    impl->priv->search_model_empty = FALSE;
-
   _gtk_file_system_model_update_files (impl->priv->search_model,
                                        files_with_info, infos);
   _gtk_file_system_model_add_and_query_files (impl->priv->search_model,
@@ -6170,7 +6166,7 @@ search_engine_finished_cb (GtkSearchEngine *engine,
 
   set_busy_cursor (impl, FALSE);
 
-  if (impl->priv->search_model_empty)
+  if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (impl->priv->search_model), NULL) == 0)
     gtk_stack_set_visible_child_name (GTK_STACK (impl->priv->browse_files_stack), "empty");
 }
 
@@ -6252,7 +6248,6 @@ search_setup_model (GtkFileChooserWidget *impl)
   priv->search_model = _gtk_file_system_model_new (file_system_model_set,
                                                    impl,
                                                   MODEL_COLUMN_TYPES);
-  priv->search_model_empty = TRUE;
 
   gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (priv->search_model),
                                   MODEL_COL_NAME,


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