[gtk+/gtk-2-24] [GtkFileChooserButton] bgo#645065 - Restore the previously-selected file when the button's GtkFileCh



commit 71505d982b0f8ce719885f5f9c4c36b0042efb01
Author: Sebastian Geiger <sbastig gmx net>
Date:   Fri Aug 31 12:02:00 2012 -0500

    [GtkFileChooserButton] bgo#645065 - Restore the previously-selected file when the button's GtkFileChooserDialog is canceled
    
    The file chooser is asynchronous, so doing 'select_file (old_file)' and subsequently querying
    the file for updating the labels is not going to work.  However, the underlying file chooser
    will emit 'selection-changed' as appropriate when it finishes restoring the old file.  So,
    we only need to update the labels when the file chooser dialog is confirmed, not cancelled.

 gtk/gtkfilechooserbutton.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c
index b6eed01..e52e955 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -2662,8 +2662,11 @@ dialog_response_cb (GtkDialog *dialog,
   if (response == GTK_RESPONSE_ACCEPT ||
       response == GTK_RESPONSE_OK)
     {
-      g_signal_emit_by_name (user_data, "current-folder-changed");
-      g_signal_emit_by_name (user_data, "selection-changed");
+      g_signal_emit_by_name (button, "current-folder-changed");
+      g_signal_emit_by_name (button, "selection-changed");
+
+      update_label_and_image (button);
+      update_combo_box (button);
     }
   else if (priv->old_file)
     {
@@ -2691,9 +2694,6 @@ dialog_response_cb (GtkDialog *dialog,
       priv->old_file = NULL;
     }
 
-  update_label_and_image (user_data);
-  update_combo_box (user_data);
-  
   if (priv->active)
     {
       g_signal_handler_unblock (priv->dialog,
@@ -2710,7 +2710,7 @@ dialog_response_cb (GtkDialog *dialog,
 
   if (response == GTK_RESPONSE_ACCEPT ||
       response == GTK_RESPONSE_OK)
-    g_signal_emit (user_data, file_chooser_button_signals[FILE_SET], 0);
+    g_signal_emit (button, file_chooser_button_signals[FILE_SET], 0);
 }
 
 


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