[gtk+/gtk-2-18] bgo#563010 - Fix clearing the selection in GtkFileChooserButton



commit e7e58a5301a7b6ee78ce2294e44e4f0900a7aebe
Author: Federico Mena Quintero <federico novell com>
Date:   Wed Oct 21 12:31:25 2009 -0500

    bgo#563010 - Fix clearing the selection in GtkFileChooserButton
    
    Previously the filename would get re-set on the button if one cleared the selection,
    as an async cancellable was not getting canceled in that case.  Patch with
    contributions from Milan Crha <mcrha redhat com>
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

 gtk/gtkfilechooserbutton.c  |   12 ++++++------
 gtk/gtkfilechooserdefault.c |    6 ++++++
 2 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c
index 4319bb0..70b0b4f 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -2302,6 +2302,12 @@ update_label_and_image (GtkFileChooserButton *button)
   label_text = NULL;
   pixbuf = NULL;
 
+  if (priv->update_button_cancellable)
+    {
+      g_cancellable_cancel (priv->update_button_cancellable);
+      priv->update_button_cancellable = NULL;
+    }
+
   if (files && files->data)
     {
       GFile *file;
@@ -2333,12 +2339,6 @@ update_label_and_image (GtkFileChooserButton *button)
 	    goto out;
 	}
 
-      if (priv->update_button_cancellable)
-	{
-	  g_cancellable_cancel (priv->update_button_cancellable);
-	  priv->update_button_cancellable = NULL;
-	}
-
       if (g_file_is_native (file))
 	{
 	  priv->update_button_cancellable =
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index f77041a..a904d1c 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -7571,6 +7571,12 @@ gtk_file_chooser_default_unselect_all (GtkFileChooser *chooser)
   GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
   GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
 
+  if (impl->show_and_select_files_cancellable)
+    {
+      g_cancellable_cancel (impl->show_and_select_files_cancellable);
+      impl->show_and_select_files_cancellable = NULL;
+    }
+
   gtk_tree_selection_unselect_all (selection);
   pending_select_files_free (impl);
 }



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