[gnome-control-center] region: Tick an unselected row when enter is pressed



commit 7916040cea8387e8c63fef4ad1bdc91e75a0b0e2
Author: Rui Matos <tiagomatos gmail com>
Date:   Tue Jul 7 17:58:47 2015 +0200

    region: Tick an unselected row when enter is pressed
    
    This makes the dialog easier to use via keyboard navigation since
    otherwise we would just dismiss the dialog with the current selection
    on enter when the user actually intended to change the selection.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=752001

 panels/region/cc-format-chooser.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/panels/region/cc-format-chooser.c b/panels/region/cc-format-chooser.c
index edd6780..015ef53 100644
--- a/panels/region/cc-format-chooser.c
+++ b/panels/region/cc-format-chooser.c
@@ -472,6 +472,26 @@ row_activated (GtkListBox  *box,
 }
 
 static void
+activate_default (GtkWindow *window,
+                  GtkDialog *chooser)
+{
+        CcFormatChooserPrivate *priv = GET_PRIVATE (chooser);
+        GtkWidget *focus;
+        gchar *locale_id;
+
+        focus = gtk_window_get_focus (window);
+        if (!focus)
+                return;
+
+        locale_id = g_object_get_data (G_OBJECT (focus), "locale-id");
+        if (g_strcmp0 (locale_id, priv->region) == 0)
+                return;
+
+        g_signal_stop_emission_by_name (window, "activate-default");
+        gtk_widget_activate (focus);
+}
+
+static void
 cc_format_chooser_private_free (gpointer data)
 {
         CcFormatChooserPrivate *priv = data;
@@ -546,6 +566,9 @@ cc_format_chooser_new (GtkWidget *parent)
 
         gtk_window_set_transient_for (GTK_WINDOW (chooser), GTK_WINDOW (parent));
 
+        g_signal_connect (chooser, "activate-default",
+                          G_CALLBACK (activate_default), chooser);
+
         return chooser;
 }
 


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