]> Pileus Git - ~andy/gtk/commitdiff
Removed the in_change flag. (completion_idle_callback): Use a temporary
authorFederico Mena Quintero <federico@ximian.com>
Thu, 4 Dec 2003 02:13:27 +0000 (02:13 +0000)
committerFederico Mena Quintero <federico@src.gnome.org>
Thu, 4 Dec 2003 02:13:27 +0000 (02:13 +0000)
2003-12-03  Federico Mena Quintero  <federico@ximian.com>

* gtk/gtkfilechooserentry.c (struct _GtkFileChooserEntry): Removed
the in_change flag.
(completion_idle_callback): Use a temporary list store and re-set
it on the completion rather than modifying the old one.  We are
re-reading the folder anyway, and this gets rid of non-atomicity
problems.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkfilechooserentry.c

index f7074d62f0c7a60da6212cf646871630590194e8..27cce4ec11b8c723d5c2454413bf65804a1a3758 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2003-12-03  Federico Mena Quintero  <federico@ximian.com>
+
+       * gtk/gtkfilechooserentry.c (struct _GtkFileChooserEntry): Removed
+       the in_change flag.
+       (completion_idle_callback): Use a temporary list store and re-set
+       it on the completion rather than modifying the old one.  We are
+       re-reading the folder anyway, and this gets rid of non-atomicity
+       problems.
+
 2003-12-01  Federico Mena Quintero  <federico@ximian.com>
 
        Decouple impl->current_folder from the selection in the folder
index f7074d62f0c7a60da6212cf646871630590194e8..27cce4ec11b8c723d5c2454413bf65804a1a3758 100644 (file)
@@ -1,3 +1,12 @@
+2003-12-03  Federico Mena Quintero  <federico@ximian.com>
+
+       * gtk/gtkfilechooserentry.c (struct _GtkFileChooserEntry): Removed
+       the in_change flag.
+       (completion_idle_callback): Use a temporary list store and re-set
+       it on the completion rather than modifying the old one.  We are
+       re-reading the folder anyway, and this gets rid of non-atomicity
+       problems.
+
 2003-12-01  Federico Mena Quintero  <federico@ximian.com>
 
        Decouple impl->current_folder from the selection in the folder
index f7074d62f0c7a60da6212cf646871630590194e8..27cce4ec11b8c723d5c2454413bf65804a1a3758 100644 (file)
@@ -1,3 +1,12 @@
+2003-12-03  Federico Mena Quintero  <federico@ximian.com>
+
+       * gtk/gtkfilechooserentry.c (struct _GtkFileChooserEntry): Removed
+       the in_change flag.
+       (completion_idle_callback): Use a temporary list store and re-set
+       it on the completion rather than modifying the old one.  We are
+       re-reading the folder anyway, and this gets rid of non-atomicity
+       problems.
+
 2003-12-01  Federico Mena Quintero  <federico@ximian.com>
 
        Decouple impl->current_folder from the selection in the folder
index f7074d62f0c7a60da6212cf646871630590194e8..27cce4ec11b8c723d5c2454413bf65804a1a3758 100644 (file)
@@ -1,3 +1,12 @@
+2003-12-03  Federico Mena Quintero  <federico@ximian.com>
+
+       * gtk/gtkfilechooserentry.c (struct _GtkFileChooserEntry): Removed
+       the in_change flag.
+       (completion_idle_callback): Use a temporary list store and re-set
+       it on the completion rather than modifying the old one.  We are
+       re-reading the folder anyway, and this gets rid of non-atomicity
+       problems.
+
 2003-12-01  Federico Mena Quintero  <federico@ximian.com>
 
        Decouple impl->current_folder from the selection in the folder
index f7074d62f0c7a60da6212cf646871630590194e8..27cce4ec11b8c723d5c2454413bf65804a1a3758 100644 (file)
@@ -1,3 +1,12 @@
+2003-12-03  Federico Mena Quintero  <federico@ximian.com>
+
+       * gtk/gtkfilechooserentry.c (struct _GtkFileChooserEntry): Removed
+       the in_change flag.
+       (completion_idle_callback): Use a temporary list store and re-set
+       it on the completion rather than modifying the old one.  We are
+       re-reading the folder anyway, and this gets rid of non-atomicity
+       problems.
+
 2003-12-01  Federico Mena Quintero  <federico@ximian.com>
 
        Decouple impl->current_folder from the selection in the folder
index 7b1a3eb2674be33b81ee8e7c64e2aeec7b41bfbc..f601b54c680dabb6ed7583b3cb68076edb11b977 100644 (file)
@@ -50,7 +50,6 @@ struct _GtkFileChooserEntry
 
   GtkListStore *completion_store;
 
-  guint in_change : 1;
   guint has_completion : 1;
 };
 
@@ -243,6 +242,7 @@ completion_idle_callback (GtkFileChooserEntry *chooser_entry)
   GSList *tmp_list;
   gchar *common_prefix = NULL;
   GtkFilePath *unique_path = NULL;
+  GtkListStore *new_store;
 
   chooser_entry->completion_idle = NULL;
 
@@ -261,8 +261,7 @@ completion_idle_callback (GtkFileChooserEntry *chooser_entry)
                                   &child_paths,
                                   NULL); /* NULL-GError */
 
-  chooser_entry->in_change = TRUE;
-  gtk_list_store_clear (chooser_entry->completion_store);
+  new_store = gtk_list_store_new (1, G_TYPE_STRING);
 
   for (tmp_list = child_paths; tmp_list; tmp_list = tmp_list->next)
     {
@@ -279,8 +278,8 @@ completion_idle_callback (GtkFileChooserEntry *chooser_entry)
          const gchar *display_name = gtk_file_info_get_display_name (info);
          GtkTreeIter iter;
 
-         gtk_list_store_append (chooser_entry->completion_store, &iter);
-         gtk_list_store_set (chooser_entry->completion_store, &iter,
+         gtk_list_store_append (new_store, &iter);
+         gtk_list_store_set (new_store, &iter,
                              0, display_name,
                              -1);
 
@@ -312,7 +311,11 @@ completion_idle_callback (GtkFileChooserEntry *chooser_entry)
          gtk_file_info_free (info);
        }
     }
-  chooser_entry->in_change = FALSE;
+
+  g_object_unref (chooser_entry->completion_store);
+  chooser_entry->completion_store = new_store;
+  gtk_entry_completion_set_model (gtk_entry_get_completion (GTK_ENTRY (chooser_entry)),
+                                 GTK_TREE_MODEL (new_store));
 
   if (unique_path)
     {
@@ -352,8 +355,6 @@ completion_idle_callback (GtkFileChooserEntry *chooser_entry)
 
       if (common_prefix_len > file_part_len)
        {
-         chooser_entry->in_change = TRUE;
-         
          pos = total_len - file_part_len;
          gtk_editable_delete_text (editable,
                                    pos, -1);
@@ -363,8 +364,7 @@ completion_idle_callback (GtkFileChooserEntry *chooser_entry)
          gtk_editable_select_region (editable,
                                      total_len,
                                      total_len - file_part_len + common_prefix_len);
-         
-         chooser_entry->in_change = FALSE;
+
          chooser_entry->has_completion = TRUE;
        }
          
@@ -381,12 +381,10 @@ gtk_file_chooser_entry_do_insert_text (GtkEditable *editable,
                                       gint        *position)
 {
   GtkFileChooserEntry *chooser_entry = GTK_FILE_CHOOSER_ENTRY (editable);
-  char *tmp;
 
   parent_editable_iface->do_insert_text (editable, new_text, new_text_length, position);
 
-  if (!chooser_entry->in_change &&
-      *position == GTK_ENTRY (editable)->text_length &&
+  if (*position == GTK_ENTRY (editable)->text_length &&
       !chooser_entry->completion_idle)
     {
       chooser_entry->completion_idle = g_idle_source_new ();
@@ -574,7 +572,5 @@ _gtk_file_chooser_entry_set_file_part (GtkFileChooserEntry *chooser_entry,
 {
   g_return_if_fail (GTK_IS_FILE_CHOOSER_ENTRY (chooser_entry));
 
-  chooser_entry->in_change = TRUE;
   gtk_entry_set_text (GTK_ENTRY (chooser_entry), file_part);
-  chooser_entry->in_change = FALSE;
 }