gtk+ r19820 - trunk/gtk



Author: federico
Date: Thu Mar 13 00:35:31 2008
New Revision: 19820
URL: http://svn.gnome.org/viewvc/gtk+?rev=19820&view=rev

Log:
Discard the completion store when we change the folder

Signed-off-by: Federico Mena Quintero <federico gnu org>


Modified:
   trunk/gtk/gtkfilechooserentry.c

Modified: trunk/gtk/gtkfilechooserentry.c
==============================================================================
--- trunk/gtk/gtkfilechooserentry.c	(original)
+++ trunk/gtk/gtkfilechooserentry.c	Thu Mar 13 00:35:31 2008
@@ -727,6 +727,17 @@
   GTK_ENTRY_CLASS (_gtk_file_chooser_entry_parent_class)->activate (entry);
 }
 
+static void
+discard_completion_store (GtkFileChooserEntry *chooser_entry)
+{
+  if (!chooser_entry->completion_store)
+    return;
+
+  gtk_entry_completion_set_model (gtk_entry_get_completion (GTK_ENTRY (chooser_entry)), NULL);
+  g_object_unref (chooser_entry->completion_store);
+  chooser_entry->completion_store = NULL;
+}
+
 /* Fills the completion store from the contents of the current folder */
 static void
 populate_completion_store (GtkFileChooserEntry *chooser_entry)
@@ -737,11 +748,7 @@
   if (!gtk_file_folder_list_children (chooser_entry->current_folder, &paths, NULL)) /* NULL-GError */
     return;
 
-  if (chooser_entry->completion_store)
-    {
-      gtk_entry_completion_set_model (gtk_entry_get_completion (GTK_ENTRY (chooser_entry)), NULL);
-      g_object_unref (chooser_entry->completion_store);
-    }
+  discard_completion_store (chooser_entry);
 
   chooser_entry->completion_store = gtk_list_store_new (N_COLUMNS,
 							G_TYPE_STRING,
@@ -849,6 +856,8 @@
   g_assert (folder != NULL);
   chooser_entry->current_folder = folder;
 
+  discard_completion_store (chooser_entry);
+
   if (gtk_file_folder_is_finished_loading (chooser_entry->current_folder))
     finish_folder_load (chooser_entry);
   else



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