From 066d66383e9c3d476eb85c6f6e8dfd42e6eb2bac Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Wed, 15 Oct 2014 13:51:20 +0200 Subject: [PATCH] cc-language-chooser: Reset dialog to original state when used the 2nd time The language chooser dialog is used in the users panel repeatedly. When we click to show more languages and/or select language, close the dialog and show it again e.g. for different user, the chooser isn't in an original state. So filter entry isn't hidden (and all languages are shown) and/or the last selected language is focused. But the dialog should be in the original state when it is open. This patch changes cc_language_chooser_clear_filter to clear the dialog into the original state that we can reuse the dialog later. https://bugzilla.gnome.org/show_bug.cgi?id=738077 --- panels/common/cc-language-chooser.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/panels/common/cc-language-chooser.c b/panels/common/cc-language-chooser.c index 0f77d8ad5..6e52639b9 100644 --- a/panels/common/cc-language-chooser.c +++ b/panels/common/cc-language-chooser.c @@ -285,7 +285,7 @@ filter_changed (GtkDialog *chooser) } static void -show_more (GtkDialog *chooser) +show_more (GtkDialog *chooser, gboolean visible) { CcLanguageChooserPrivate *priv = GET_PRIVATE (chooser); GtkWidget *widget; @@ -298,16 +298,15 @@ show_more (GtkDialog *chooser) widget = priv->scrolledwindow; gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (widget), GTK_POLICY_NEVER, - GTK_POLICY_AUTOMATIC); + visible ? GTK_POLICY_AUTOMATIC : GTK_POLICY_NEVER); - gtk_widget_show (priv->filter_entry); - gtk_widget_grab_focus (priv->filter_entry); + gtk_widget_set_visible (priv->filter_entry, visible); + gtk_widget_grab_focus (visible ? priv->filter_entry : priv->language_list); - priv->showing_extra = TRUE; + priv->showing_extra = visible; gtk_list_box_invalidate_filter (GTK_LIST_BOX (priv->language_list)); } - static void set_locale_id (GtkDialog *chooser, const gchar *locale_id) @@ -356,7 +355,7 @@ row_activated (GtkListBox *box, return; if (row == priv->more_item) { - show_more (chooser); + show_more (chooser, TRUE); return; } new_locale_id = g_object_get_data (G_OBJECT (row), "locale-id"); @@ -436,6 +435,7 @@ cc_language_chooser_clear_filter (GtkWidget *chooser) CcLanguageChooserPrivate *priv = GET_PRIVATE (chooser); gtk_entry_set_text (GTK_ENTRY (priv->filter_entry), ""); + show_more (GTK_DIALOG (chooser), FALSE); } const gchar *