[gnome-control-center] region: Handle being opened twice gracefully
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] region: Handle being opened twice gracefully
- Date: Fri, 20 Jul 2012 01:38:22 +0000 (UTC)
commit 1e4b0649f497e3969c73ac20e27a25df1886b435
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jul 19 21:36:20 2012 -0400
region: Handle being opened twice gracefully
When the going from the region panel to the overview and back,
the input methods in the list loose their display names. What
is happening is that we recreate the ibus object, but the second
time around it is already connected since ibus uses a shared
singleton connection internally. Thus, the ::connected signal
is never emitted, and we don't fetch the engines.
Work around this by checking if the newly created ibus object
is already connected, and directly calling fetch_ibus_engines
if it is. To make this work, we have to set up the treeview
with its model earlier.
panels/region/gnome-region-panel-input.c | 39 ++++++++++++++++-------------
1 files changed, 21 insertions(+), 18 deletions(-)
---
diff --git a/panels/region/gnome-region-panel-input.c b/panels/region/gnome-region-panel-input.c
index a8ff912..6fdccd4 100644
--- a/panels/region/gnome-region-panel-input.c
+++ b/panels/region/gnome-region-panel-input.c
@@ -893,6 +893,22 @@ setup_input_tabs (GtkBuilder *builder,
GtkListStore *store;
GtkTreeSelection *selection;
+ /* set up the list of active inputs */
+ treeview = WID("active_input_sources");
+ column = gtk_tree_view_column_new ();
+ cell = gtk_cell_renderer_text_new ();
+ gtk_tree_view_column_pack_start (column, cell, TRUE);
+ gtk_tree_view_column_add_attribute (column, cell, "text", NAME_COLUMN);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
+
+ store = gtk_list_store_new (N_COLUMNS,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_DESKTOP_APP_INFO);
+
+ gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (store));
+
input_sources_settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR);
g_settings_delay (input_sources_settings);
g_object_weak_ref (G_OBJECT (builder), (GWeakNotify) g_object_unref, input_sources_settings);
@@ -905,35 +921,22 @@ setup_input_tabs (GtkBuilder *builder,
if (!ibus)
{
ibus = ibus_bus_new_async ();
- g_signal_connect_swapped (ibus, "connected",
- G_CALLBACK (fetch_ibus_engines), builder);
+ if (ibus_bus_is_connected (ibus))
+ fetch_ibus_engines (builder);
+ else
+ g_signal_connect_swapped (ibus, "connected",
+ G_CALLBACK (fetch_ibus_engines), builder);
g_object_weak_ref (G_OBJECT (builder), (GWeakNotify) clear_ibus, NULL);
}
maybe_start_ibus ();
#endif
- /* set up the list of active inputs */
- treeview = WID("active_input_sources");
- column = gtk_tree_view_column_new ();
- cell = gtk_cell_renderer_text_new ();
- gtk_tree_view_column_pack_start (column, cell, TRUE);
- gtk_tree_view_column_add_attribute (column, cell, "text", NAME_COLUMN);
- gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
-
- store = gtk_list_store_new (N_COLUMNS,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_DESKTOP_APP_INFO);
-
populate_with_active_sources (store);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
g_signal_connect_swapped (selection, "changed",
G_CALLBACK (update_button_sensitivity), builder);
- gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (store));
-
/* set up the buttons */
g_signal_connect (WID("input_source_add"), "clicked",
G_CALLBACK (add_input), builder);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]