[gnome-settings-daemon] keyboard: Fix crash on "Show layout"
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] keyboard: Fix crash on "Show layout"
- Date: Wed, 6 Apr 2011 12:40:30 +0000 (UTC)
commit a038ed1176b00408d47fb1191854a67c1a60cacf
Author: Vincent Untz <vuntz gnome org>
Date: Wed Apr 6 07:39:32 2011 +0200
keyboard: Fix crash on "Show layout"
We need to make sure that we do have a xkl registry available.
https://bugzilla.gnome.org/show_bug.cgi?id=646887
plugins/keyboard/gsd-keyboard-xkb.c | 33 +++++++++++++++++++++++----------
1 files changed, 23 insertions(+), 10 deletions(-)
---
diff --git a/plugins/keyboard/gsd-keyboard-xkb.c b/plugins/keyboard/gsd-keyboard-xkb.c
index fd44faf..bc46b69 100644
--- a/plugins/keyboard/gsd-keyboard-xkb.c
+++ b/plugins/keyboard/gsd-keyboard-xkb.c
@@ -100,6 +100,23 @@ activation_error (void)
gsd_delayed_show_dialog (dialog);
}
+static gboolean
+ensure_xkl_registry (void)
+{
+ if (!xkl_registry) {
+ xkl_registry =
+ xkl_config_registry_get_instance (xkl_engine);
+ /* load all materials, unconditionally! */
+ if (!xkl_config_registry_load (xkl_registry, TRUE)) {
+ g_object_unref (xkl_registry);
+ xkl_registry = NULL;
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
static void
apply_desktop_settings (void)
{
@@ -174,6 +191,9 @@ popup_menu_show_layout ()
return;
}
+ if (!ensure_xkl_registry ())
+ return;
+
dialog = gkbd_keyboard_drawing_dialog_new ();
gkbd_keyboard_drawing_dialog_set_group (dialog, xkl_registry, xkl_state->group);
@@ -324,16 +344,9 @@ filter_xkb_config (void)
gboolean any_change = FALSE;
xkl_debug (100, "Filtering configuration against the registry\n");
- if (!xkl_registry) {
- xkl_registry =
- xkl_config_registry_get_instance (xkl_engine);
- /* load all materials, unconditionally! */
- if (!xkl_config_registry_load (xkl_registry, TRUE)) {
- g_object_unref (xkl_registry);
- xkl_registry = NULL;
- return FALSE;
- }
- }
+ if (!ensure_xkl_registry ())
+ return FALSE;
+
lv = current_kbd_config.layouts_variants;
item = xkl_config_item_new ();
while (*lv) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]