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



commit afc7466dfdb96c3778b92672f078916cdaf175c3
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 d1e2d2e..7460e39 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -2683,8 +2683,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)
     {
@@ -2712,9 +2715,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,
@@ -2731,7 +2731,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]