[gtk+] GtkFileChooserButton: Also emit 'file-set' when changing the selection through the combo box



commit 32e75adf6a13acd367416e07fc08a0fa814815a5
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Jun 21 19:14:36 2013 -0500

    GtkFileChooserButton: Also emit 'file-set' when changing the selection through the combo box
    
    https://bugzilla.gnome.org/show_bug.cgi?id=696498

 gtk/gtkfilechooserbutton.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c
index c2c686f..06bf946 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -2712,12 +2712,15 @@ static void
 combo_box_changed_cb (GtkComboBox *combo_box,
                      gpointer     user_data)
 {
+  GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (user_data);
+  GtkFileChooserButtonPrivate *priv = button->priv;
   GtkTreeIter iter;
+  gboolean file_was_set;
+
+  file_was_set = FALSE;
 
   if (gtk_combo_box_get_active_iter (combo_box, &iter))
     {
-      GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (user_data);
-      GtkFileChooserButtonPrivate *priv = button->priv;
       gchar type;
       gpointer data;
 
@@ -2736,7 +2739,10 @@ combo_box_changed_cb (GtkComboBox *combo_box,
        case ROW_TYPE_BOOKMARK:
        case ROW_TYPE_CURRENT_FOLDER:
          if (data)
-           gtk_file_chooser_button_select_file (GTK_FILE_CHOOSER (button), data, NULL);
+           {
+             gtk_file_chooser_button_select_file (GTK_FILE_CHOOSER (button), data, NULL);
+             file_was_set = TRUE;
+           }
          break;
        case ROW_TYPE_VOLUME:
          {
@@ -2746,6 +2752,7 @@ combo_box_changed_cb (GtkComboBox *combo_box,
            if (base_file)
              {
                gtk_file_chooser_button_select_file (GTK_FILE_CHOOSER (button), base_file, NULL);
+               file_was_set = TRUE;
                g_object_unref (base_file);
              }
          }
@@ -2757,6 +2764,9 @@ combo_box_changed_cb (GtkComboBox *combo_box,
          break;
        }
     }
+
+  if (file_was_set)
+    g_signal_emit (button, file_chooser_button_signals[FILE_SET], 0);
 }
 
 /* Calback for the "notify::popup-shown" signal on the combo box.


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