[gnome-control-center] region: Show the XKB option for the input source switch shortcut
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] region: Show the XKB option for the input source switch shortcut
- Date: Mon, 27 May 2013 13:21:17 +0000 (UTC)
commit cf2399e978c05cb028af15ea1fcf194b751094a4
Author: Rui Matos <tiagomatos gmail com>
Date: Tue May 14 23:40:03 2013 +0200
region: Show the XKB option for the input source switch shortcut
Mutter now uses the "grp" XKB option to implement a special
modifiers-only shortcut use by gnome-shell to switch input sources.
https://bugzilla.gnome.org/show_bug.cgi?id=700346
panels/region/cc-input-options.c | 33 ++++++++++++++++++++++++++++++++-
1 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/panels/region/cc-input-options.c b/panels/region/cc-input-options.c
index b55b392..aa16989 100644
--- a/panels/region/cc-input-options.c
+++ b/panels/region/cc-input-options.c
@@ -23,6 +23,9 @@
#include <config.h>
#include <glib/gi18n.h>
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+#include <libgnome-desktop/gnome-xkb-info.h>
+
#include "cc-input-options.h"
typedef struct {
@@ -99,8 +102,35 @@ update_shortcuts (GtkWidget *options)
g_strfreev (next);
g_object_unref (settings);
+}
+
+static void
+update_modifiers_shortcut (GtkWidget *dialog)
+{
+ CcInputOptionsPrivate *priv = GET_PRIVATE (dialog);
+ gchar **options, **p;
+ GSettings *settings;
+ GnomeXkbInfo *xkb_info;
+ const gchar *text;
+
+ xkb_info = gnome_xkb_info_new ();
+ settings = g_settings_new ("org.gnome.desktop.input-sources");
+ options = g_settings_get_strv (settings, "xkb-options");
+
+ for (p = options; p && *p; ++p)
+ if (g_str_has_prefix (*p, "grp:"))
+ break;
+
+ if (p && *p) {
+ text = gnome_xkb_info_description_for_option (xkb_info, "grp", *p);
+ gtk_label_set_text (GTK_LABEL (priv->alt_next_source), text);
+ } else {
+ gtk_widget_hide (priv->alt_next_source);
+ }
- gtk_widget_hide (priv->alt_next_source); /* FIXME */
+ g_strfreev (options);
+ g_object_unref (settings);
+ g_object_unref (xkb_info);
}
#define WID(name) ((GtkWidget *) gtk_builder_get_object (builder, name))
@@ -151,6 +181,7 @@ cc_input_options_new (GtkWidget *parent)
G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_INVERT_BOOLEAN);
update_shortcuts (options);
+ update_modifiers_shortcut (options);
gtk_window_set_transient_for (GTK_WINDOW (options), GTK_WINDOW (parent));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]