[gedit] EncodingsComboBox: update correctly the menu



commit 0f792dcbd59b5b89e4190aa673b598148d346359
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon Aug 11 22:06:34 2014 +0200

    EncodingsComboBox: update correctly the menu
    
    The menu was updated *before* the settings are saved, so the menu was
    incorrectly updated. Now the operations are executed in the correct
    order: first save the gsetting, then update the combo box menu.
    
    Now the dialog window is destroyed externally (by the combo box),
    instead of internally (which is quite strange). So that the
    connect_after() works.

 gedit/gedit-encodings-combo-box.c |   13 +++++++++----
 gedit/gedit-encodings-dialog.c    |    3 +--
 2 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/gedit/gedit-encodings-combo-box.c b/gedit/gedit-encodings-combo-box.c
index 9025e92..dad6b6d 100644
--- a/gedit/gedit-encodings-combo-box.c
+++ b/gedit/gedit-encodings-combo-box.c
@@ -175,6 +175,11 @@ dialog_response_cb (GtkDialog              *dialog,
        {
                update_menu (menu);
        }
+
+       if (response_id != GTK_RESPONSE_HELP)
+       {
+               gtk_widget_destroy (GTK_WIDGET (dialog));
+       }
 }
 
 static void
@@ -218,10 +223,10 @@ configure_encodings (GeditEncodingsComboBox *menu)
 
        gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
 
-       g_signal_connect (dialog,
-                         "response",
-                         G_CALLBACK (dialog_response_cb),
-                         menu);
+       g_signal_connect_after (dialog,
+                               "response",
+                               G_CALLBACK (dialog_response_cb),
+                               menu);
 
        gtk_widget_show (dialog);
 }
diff --git a/gedit/gedit-encodings-dialog.c b/gedit/gedit-encodings-dialog.c
index c341c45..c5c141a 100644
--- a/gedit/gedit-encodings-dialog.c
+++ b/gedit/gedit-encodings-dialog.c
@@ -101,9 +101,8 @@ gedit_encodings_dialog_response (GtkDialog *dialog,
                                             (const gchar * const *)enc_strv);
 
                        g_strfreev (enc_strv);
+                       break;
                }
-               default:
-                       gtk_widget_destroy (GTK_WIDGET (dialog));
        }
 }
 


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