summaryrefslogtreecommitdiff
path: root/gtk/gtkfilechooserentry.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnu.org>2008-03-13 00:35:31 +0000
committerFederico Mena Quintero <federico@src.gnome.org>2008-03-13 00:35:31 +0000
commit073093bde09b18e5710bbbee96fcbf8df8e181ba (patch)
treeaca5926c2ed931c2b679405b3137aa45b99fbd0e /gtk/gtkfilechooserentry.c
parentf5343b9037b5158e8648a86ff7c53722f875628a (diff)
downloadgtk+-073093bde09b18e5710bbbee96fcbf8df8e181ba.tar.gz
Discard the completion store when we change the folder
Signed-off-by: Federico Mena Quintero <federico@gnu.org> svn path=/trunk/; revision=19820
Diffstat (limited to 'gtk/gtkfilechooserentry.c')
-rw-r--r--gtk/gtkfilechooserentry.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c
index 8d6fce3b91..4cc5853419 100644
--- a/gtk/gtkfilechooserentry.c
+++ b/gtk/gtkfilechooserentry.c
@@ -727,6 +727,17 @@ gtk_file_chooser_entry_activate (GtkEntry *entry)
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 @@ populate_completion_store (GtkFileChooserEntry *chooser_entry)
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 @@ load_directory_get_folder_callback (GtkFileSystemHandle *handle,
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