[gnome-initial-setup/shell/4765: 31/362] Sync input sources with taskbar
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup/shell/4765: 31/362] Sync input sources with taskbar
- Date: Thu, 19 Mar 2015 01:23:40 +0000 (UTC)
commit 4417a10668a7018e05acc0199dcfe9d40a14b141
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Mon May 5 19:37:07 2014 +0200
Sync input sources with taskbar
Keep the selected source in the input page in sync with the current
keyboard layout selected in the taskbar.
So any change in one of them is applied inmediatly in the other.
[endlessm/eos-shell#2044]
.../pages/keyboard/gis-keyboard-page.c | 44 ++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
index ead196c..386cc63 100644
--- a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
+++ b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
@@ -524,6 +524,23 @@ input_sources_changed (GSettings *settings,
}
}
+static void
+current_input_source_changed (GisKeyboardPage *self)
+{
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
+ GList *all_inputs;
+ GtkWidget *current_input;
+ guint current_input_index;
+
+ current_input_index = g_settings_get_uint (priv->input_settings, KEY_CURRENT_INPUT_SOURCE);
+ all_inputs = gtk_container_get_children (GTK_CONTAINER (priv->input_list));
+ current_input = g_list_nth_data (all_inputs, current_input_index);
+ if (current_input)
+ egg_list_box_select_child (EGG_LIST_BOX (priv->input_list), current_input);
+
+ g_list_free (all_inputs);
+}
+
static void
update_buttons (GisKeyboardPage *self)
@@ -554,6 +571,24 @@ update_buttons (GisKeyboardPage *self)
}
static void
+update_current_input (GisKeyboardPage *self)
+{
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
+ GtkWidget *selected;
+ GList *children;
+ guint index;
+
+ selected = egg_list_box_get_selected_child (EGG_LIST_BOX (priv->input_list));
+ if (selected) {
+ children = gtk_container_get_children (GTK_CONTAINER (priv->input_list));
+ index = g_list_index (children, selected);
+ g_settings_set_uint (priv->input_settings, KEY_CURRENT_INPUT_SOURCE, index);
+ g_settings_apply (priv->input_settings);
+ g_list_free (children);
+ }
+}
+
+static void
set_input_settings (GisKeyboardPage *self)
{
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
@@ -966,10 +1001,17 @@ setup_input_section (GisKeyboardPage *self)
g_signal_connect_swapped (priv->input_list, "child-selected",
G_CALLBACK (update_buttons), self);
+ g_signal_connect_swapped (priv->input_list, "child-selected",
+ G_CALLBACK (update_current_input), self);
+
g_signal_connect (priv->input_settings, "changed::" KEY_INPUT_SOURCES,
G_CALLBACK (input_sources_changed), self);
+ g_signal_connect_swapped (priv->input_settings, "changed::" KEY_CURRENT_INPUT_SOURCE,
+ G_CALLBACK (current_input_source_changed), self);
+
add_default_input_source_for_locale (self);
+ current_input_source_changed (self);
}
static void
@@ -1091,6 +1133,8 @@ localed_proxy_ready (GObject *source,
priv->localed = proxy;
add_input_sources_from_localed (self);
+ update_input (self);
+ current_input_source_changed (self);
update_buttons (self);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]