[gnome-settings-daemon] Apply all keyboard settings to new keyboards
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] Apply all keyboard settings to new keyboards
- Date: Wed, 10 Mar 2010 10:43:30 +0000 (UTC)
commit f168d9042dc39879976c52a31ccae517dd4a2fd6
Author: Bastien Nocera <hadess hadess net>
Date: Tue Mar 9 14:40:07 2010 +0000
Apply all keyboard settings to new keyboards
When libxklavier sends in a new device event, apply all the
settings to the new keyboard.
https://bugzilla.gnome.org/show_bug.cgi?id=610245
plugins/keyboard/gsd-keyboard-manager.c | 14 ++++++++++++--
plugins/keyboard/gsd-keyboard-manager.h | 1 +
plugins/keyboard/gsd-keyboard-xkb.c | 10 ++++++++--
plugins/keyboard/gsd-keyboard-xkb.h | 5 +++--
4 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/plugins/keyboard/gsd-keyboard-manager.c b/plugins/keyboard/gsd-keyboard-manager.c
index c1454e4..2855d41 100644
--- a/plugins/keyboard/gsd-keyboard-manager.c
+++ b/plugins/keyboard/gsd-keyboard-manager.c
@@ -370,6 +370,16 @@ apply_settings (GConfClient *client,
gdk_error_trap_pop ();
}
+void
+gsd_keyboard_manager_apply_settings (GsdKeyboardManager *manager)
+{
+ GConfClient *client;
+
+ client = gconf_client_get_default ();
+ apply_settings (client, 0, NULL, manager);
+ g_object_unref (client);
+}
+
static gboolean
start_keyboard_idle_cb (GsdKeyboardManager *manager)
{
@@ -386,14 +396,14 @@ start_keyboard_idle_cb (GsdKeyboardManager *manager)
/* Essential - xkb initialization should happen before */
gsd_keyboard_xkb_set_post_activation_callback ((PostActivationCallback) gsd_load_modmap_files, NULL);
- gsd_keyboard_xkb_init (client);
+ gsd_keyboard_xkb_init (client, manager);
#ifdef HAVE_X11_EXTENSIONS_XKB_H
numlock_xkb_init (manager);
#endif /* HAVE_X11_EXTENSIONS_XKB_H */
/* apply current settings before we install the callback */
- apply_settings (client, 0, NULL, manager);
+ gsd_keyboard_manager_apply_settings (manager);
manager->priv->notify = gconf_client_notify_add (client, GSD_KEYBOARD_KEY,
(GConfClientNotifyFunc) apply_settings, manager,
diff --git a/plugins/keyboard/gsd-keyboard-manager.h b/plugins/keyboard/gsd-keyboard-manager.h
index 42e2600..434e652 100644
--- a/plugins/keyboard/gsd-keyboard-manager.h
+++ b/plugins/keyboard/gsd-keyboard-manager.h
@@ -51,6 +51,7 @@ GsdKeyboardManager * gsd_keyboard_manager_new (void);
gboolean gsd_keyboard_manager_start (GsdKeyboardManager *manager,
GError **error);
void gsd_keyboard_manager_stop (GsdKeyboardManager *manager);
+void gsd_keyboard_manager_apply_settings (GsdKeyboardManager *manager);
G_END_DECLS
diff --git a/plugins/keyboard/gsd-keyboard-xkb.c b/plugins/keyboard/gsd-keyboard-xkb.c
index ff31149..748ddd2 100644
--- a/plugins/keyboard/gsd-keyboard-xkb.c
+++ b/plugins/keyboard/gsd-keyboard-xkb.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
- * Copyright © 2001 Udaltsoft
+ * Copyright (C) 2001 Udaltsoft
*
* Written by Sergey V. Oudaltsov <svu users sourceforge net>
*
@@ -44,6 +44,8 @@
#define GTK_RESPONSE_PRINT 2
+static GsdKeyboardManager *manager = NULL;
+
static XklEngine *xkl_engine;
static XklConfigRegistry *xkl_registry = NULL;
@@ -140,6 +142,7 @@ apply_desktop_settings (void)
if (!inited_ok)
return;
+ gsd_keyboard_manager_apply_settings (manager);
gkbd_desktop_config_load_from_gconf (¤t_config);
/* again, probably it would be nice to compare things
before activating them */
@@ -813,7 +816,8 @@ gsd_keyboard_new_device (XklEngine * engine)
}
void
-gsd_keyboard_xkb_init (GConfClient * client)
+gsd_keyboard_xkb_init (GConfClient * client,
+ GsdKeyboardManager * kbd_manager)
{
gnome_settings_profile_start (NULL);
#ifdef GSDKX
@@ -821,6 +825,7 @@ gsd_keyboard_xkb_init (GConfClient * client)
logfile = fopen ("/tmp/gsdkx.log", "a");
xkl_set_log_appender (gsd_keyboard_log_appender);
#endif
+ manager = kbd_manager;
gnome_settings_profile_start ("xkl_engine_get_instance");
xkl_engine = xkl_engine_get_instance (GDK_DISPLAY ());
gnome_settings_profile_end ("xkl_engine_get_instance");
@@ -886,6 +891,7 @@ gsd_keyboard_xkb_shutdown (void)
pa_callback = NULL;
pa_callback_user_data = NULL;
+ manager = NULL;
g_hash_table_destroy (preview_dialogs);
diff --git a/plugins/keyboard/gsd-keyboard-xkb.h b/plugins/keyboard/gsd-keyboard-xkb.h
index cad70ff..21d3705 100644
--- a/plugins/keyboard/gsd-keyboard-xkb.h
+++ b/plugins/keyboard/gsd-keyboard-xkb.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
* gnome-settings-keyboard-xkb.h
*
- * Copyright © 2001 Udaltsoft
+ * Copyright (C) 2001 Udaltsoft
*
* Written by Sergey V. Oudaltsov <svu users sourceforge net>
*
@@ -28,8 +28,9 @@
#include <gconf/gconf-client.h>
#include <libxklavier/xklavier.h>
+#include "gsd-keyboard-manager.h"
-void gsd_keyboard_xkb_init (GConfClient *client);
+void gsd_keyboard_xkb_init (GConfClient *client, GsdKeyboardManager *manager);
void gsd_keyboard_xkb_shutdown (void);
typedef void (*PostActivationCallback) (void *userData);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]