[gnome-initial-setup] language chooser: Add a confirm signal
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] language chooser: Add a confirm signal
- Date: Sun, 7 Sep 2014 15:19:06 +0000 (UTC)
commit 2e053a573a5fdd945a8cc1e9dae5beeb6f9ac058
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Sep 7 09:49:03 2014 -0400
language chooser: Add a confirm signal
Add a confirm signal, and emit it when the active row is activated
again. This will be use to make Enter go to the next page.
Note that we delay the emission of the signal to an idle to avoid
problems with accessibility.
.../pages/language/cc-language-chooser.c | 30 +++++++++++++++++++-
.../pages/language/cc-language-chooser.h | 2 +
2 files changed, 31 insertions(+), 1 deletions(-)
---
diff --git a/gnome-initial-setup/pages/language/cc-language-chooser.c
b/gnome-initial-setup/pages/language/cc-language-chooser.c
index e3fdeb9..0b61916 100644
--- a/gnome-initial-setup/pages/language/cc-language-chooser.c
+++ b/gnome-initial-setup/pages/language/cc-language-chooser.c
@@ -61,6 +61,13 @@ enum {
static GParamSpec *obj_props[PROP_LAST];
+enum {
+ CONFIRM,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
typedef struct {
GtkWidget *box;
GtkWidget *checkmark;
@@ -387,6 +394,16 @@ set_locale_id (CcLanguageChooser *chooser,
g_object_notify_by_pspec (G_OBJECT (chooser), obj_props[PROP_LANGUAGE]);
}
+static gboolean
+confirm_choice (gpointer data)
+{
+ GtkWidget *widget = data;
+
+ g_signal_emit (widget, signals[CONFIRM], 0);
+
+ return G_SOURCE_REMOVE;
+}
+
static void
row_activated (GtkListBox *box,
GtkListBoxRow *row,
@@ -406,7 +423,10 @@ row_activated (GtkListBox *box,
widget = get_language_widget (child);
if (widget == NULL)
return;
- set_locale_id (chooser, widget->locale_id);
+ if (g_strcmp0 (priv->language, widget->locale_id) == 0)
+ g_idle_add (confirm_choice, chooser);
+ else
+ set_locale_id (chooser, widget->locale_id);
}
}
@@ -524,6 +544,14 @@ cc_language_chooser_class_init (CcLanguageChooserClass *klass)
object_class->set_property = cc_language_chooser_set_property;
object_class->constructed = cc_language_chooser_constructed;
+ signals[CONFIRM] = g_signal_new ("confirm",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (CcLanguageChooserClass, confirm),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
obj_props[PROP_LANGUAGE] =
g_param_spec_string ("language", "", "", "",
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
diff --git a/gnome-initial-setup/pages/language/cc-language-chooser.h
b/gnome-initial-setup/pages/language/cc-language-chooser.h
index a94f1bb..749af78 100644
--- a/gnome-initial-setup/pages/language/cc-language-chooser.h
+++ b/gnome-initial-setup/pages/language/cc-language-chooser.h
@@ -46,6 +46,8 @@ struct _CcLanguageChooser
struct _CcLanguageChooserClass
{
GtkBoxClass parent_class;
+
+ void (*confirm) (CcLanguageChooser *chooser);
};
GType cc_language_chooser_get_type (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]