[gnome-initial-setup] input chooser: Add a confirm signal
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] input chooser: Add a confirm signal
- Date: Sun, 7 Sep 2014 15:19:26 +0000 (UTC)
commit 16e119d062fe44282e9324d87a2fcc275949fdfa
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Sep 7 10:11:10 2014 -0400
input 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/keyboard/cc-input-chooser.c | 26 +++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
b/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
index 3a059fd..14c97a1 100644
--- a/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
+++ b/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
@@ -82,6 +82,7 @@ static GParamSpec *obj_props[PROP_LAST];
enum {
CHANGED,
+ CONFIRM,
LAST_SIGNAL
};
@@ -494,6 +495,16 @@ set_input (CcInputChooser *chooser,
g_signal_emit (chooser, signals[CHANGED], 0);
}
+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,
@@ -513,7 +524,11 @@ row_activated (GtkListBox *box,
widget = get_input_widget (child);
if (widget == NULL)
return;
- set_input (chooser, widget->id, widget->type);
+ if (g_strcmp0 (priv->id, widget->id) == 0 &&
+ g_strcmp0 (priv->type, widget->type) == 0)
+ confirm_choice (chooser);
+ else
+ set_input (chooser, widget->id, widget->type);
}
}
@@ -800,6 +815,15 @@ cc_input_chooser_class_init (CcInputChooserClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ signals[CONFIRM] =
+ g_signal_new ("confirm",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
g_object_class_install_properties (object_class, PROP_LAST, obj_props);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]