[gnome-control-center/gnome-3-8] Remove the input-source-switcher setting



commit e016bce5ab6d6aa221c8bdb427774813fa3fc710
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Apr 1 20:02:38 2013 +0200

    Remove the input-source-switcher setting
    
    Mutter now has a special modifiers-only shortcut used by gnome-shell
    to switch input sources which no longer uses this setting.
    
    This reverts commit ae3014ba3e10f37baff039bf969d6c075b303e67.
    This reverts commit 77b7569c3ddb83db9cb866f7f9d87e6f6d1dd5ad.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=700346

 panels/common/cc-util.c              |   27 +-----
 panels/common/cc-util.h              |    7 --
 panels/keyboard/Makefile.am          |    2 +-
 panels/keyboard/cc-keyboard-option.c |  193 +++++++---------------------------
 panels/region/cc-input-options.c     |   19 +---
 5 files changed, 43 insertions(+), 205 deletions(-)
---
diff --git a/panels/common/cc-util.c b/panels/common/cc-util.c
index 3db2500..e51a9d2 100644
--- a/panels/common/cc-util.c
+++ b/panels/common/cc-util.c
@@ -20,34 +20,9 @@
 #include "config.h"
 
 #include <string.h>
-#include <glib/gi18n.h>
 
-#include "cc-util.h"
 
-CcInputSwitcherOptions cc_input_switcher_options[] = {
-  { "off", N_("Disabled") },
-  { "shift-l", N_("Left Shift") },
-  { "alt-l", N_("Left Alt") },
-  { "ctrl-l", N_("Left Ctrl") },
-  { "shift-r", N_("Right Shift") },
-  { "alt-r", N_("Right Alt") },
-  { "ctrl-r", N_("Right Ctrl") },
-  { "alt-shift-l", N_("Left Alt+Shift") },
-  { "alt-shift-r", N_("Right Alt+Shift") },
-  { "ctrl-shift-l", N_("Left Ctrl+Shift") },
-  { "ctrl-shift-r", N_("Right Ctrl+Shift") },
-  { "shift-l-shift-r", N_("Left+Right Shift") },
-  { "alt-l-alt-r", N_("Left+Right Alt") },
-  { "ctrl-l-ctrl-r", N_("Left+Right Ctrl") },
-  { "alt-shift", N_("Alt+Shift") },
-  { "ctrl-shift", N_("Ctrl+Shift") },
-  { "alt-ctrl", N_("Alt+Ctrl") },
-  { "caps", N_("Caps") },
-  { "shift-caps", N_("Shift+Caps") },
-  { "alt-caps", N_("Alt+Caps") },
-  { "ctrl-caps", N_("Ctrl+Caps") },
-  { NULL, NULL }
-};
+#include "cc-util.h"
 
 /* Combining diacritical mark?
  *  Basic range: [0x0300,0x036F]
diff --git a/panels/common/cc-util.h b/panels/common/cc-util.h
index 737a86b..42b09ff 100644
--- a/panels/common/cc-util.h
+++ b/panels/common/cc-util.h
@@ -23,13 +23,6 @@
 
 #include <glib.h>
 
-typedef struct {
-  const gchar *value;
-  const gchar *description;
-} CcInputSwitcherOptions;
-
-extern CcInputSwitcherOptions cc_input_switcher_options[];
-
 char *cc_util_normalize_casefold_and_unaccent (const char *str);
 
 #endif
diff --git a/panels/keyboard/Makefile.am b/panels/keyboard/Makefile.am
index 81cc7bb..bd9faea 100644
--- a/panels/keyboard/Makefile.am
+++ b/panels/keyboard/Makefile.am
@@ -23,7 +23,7 @@ libkeyboard_la_SOURCES =   \
        keyboard-shortcuts.h
 
 libkeyboard_la_CFLAGS = $(PANEL_CFLAGS) $(KEYBOARD_PANEL_CFLAGS) -I$(top_srcdir)/panels/common/
-libkeyboard_la_LIBADD = $(PANEL_LIBS) $(KEYBOARD_PANEL_LIBS) $(top_builddir)/panels/common/liblanguage.la
+libkeyboard_la_LIBADD = $(PANEL_LIBS) $(KEYBOARD_PANEL_LIBS)
 
 resource_files = $(shell glib-compile-resources --sourcedir=$(srcdir) --generate-dependencies 
$(srcdir)/keyboard.gresource.xml)
 cc-keyboard-resources.c: keyboard.gresource.xml $(resource_files)
diff --git a/panels/keyboard/cc-keyboard-option.c b/panels/keyboard/cc-keyboard-option.c
index 38f3532..1370e8f 100644
--- a/panels/keyboard/cc-keyboard-option.c
+++ b/panels/keyboard/cc-keyboard-option.c
@@ -25,7 +25,6 @@
 #define GNOME_DESKTOP_USE_UNSTABLE_API
 #include <libgnome-desktop/gnome-xkb-info.h>
 
-#include "cc-util.h"
 #include "cc-keyboard-option.h"
 
 #define CC_TYPE_KEYBOARD_OPTION            (cc_keyboard_option_get_type ())
@@ -41,9 +40,6 @@
 #define XKB_OPTION_GROUP_LVL3 "lv3"
 #define XKB_OPTION_GROUP_COMP "Compose key"
 
-#define INPUT_SWITCHER_SCHEMA "org.gnome.settings-daemon.peripherals.keyboard"
-#define INPUT_SWITCHER_KEY "input-sources-switcher"
-
 enum
 {
   PROP_0,
@@ -67,10 +63,6 @@ struct _CcKeyboardOption
   GtkListStore *store;
 
   const gchar * const *whitelist;
-
-  gboolean is_xkb;
-
-  gchar *current_description;
 };
 
 typedef struct _CcKeyboardOptionClass CcKeyboardOptionClass;
@@ -83,7 +75,6 @@ static guint keyboard_option_signals[LAST_SIGNAL] = { 0 };
 
 static GnomeXkbInfo *xkb_info = NULL;
 static GSettings *input_sources_settings = NULL;
-static GSettings *input_switcher_settings = NULL;
 static gchar **current_xkb_options = NULL;
 
 static const gchar *xkb_option_lvl3_whitelist[] = {
@@ -129,9 +120,6 @@ reload_setting (CcKeyboardOption *self)
 {
   gchar **iter;
 
-  if (!self->is_xkb)
-    return;
-
   for (iter = current_xkb_options; *iter; ++iter)
     if (strv_contains (self->whitelist, *iter))
       {
@@ -166,21 +154,6 @@ xkb_options_changed (GSettings *settings,
 }
 
 static void
-input_switcher_changed (GSettings *settings,
-                        gchar     *key,
-                        gpointer   data)
-{
-  CcKeyboardOption *option = data;
-
-  g_free (option->current_value);
-  g_free (option->current_description);
-  option->current_value = g_settings_get_string (settings, key);
-  option->current_description = NULL;
-
-  g_signal_emit (option, keyboard_option_signals[CHANGED_SIGNAL], 0);
-}
-
-static void
 cc_keyboard_option_get_property (GObject    *object,
                                  guint       prop_id,
                                  GValue     *value,
@@ -241,7 +214,6 @@ cc_keyboard_option_finalize (GObject *object)
   g_clear_pointer (&self->group, g_free);
   g_clear_pointer (&self->description, g_free);
   g_clear_pointer (&self->current_value, g_free);
-  g_clear_pointer (&self->current_description, g_free);
   g_clear_object (&self->store);
 
   G_OBJECT_CLASS (cc_keyboard_option_parent_class)->finalize (object);
@@ -257,11 +229,7 @@ cc_keyboard_option_constructed (GObject *object)
 
   G_OBJECT_CLASS (cc_keyboard_option_parent_class)->constructed (object);
 
-  self->is_xkb = TRUE;
-
-  if (self->group == NULL)
-    self->is_xkb = FALSE;
-  else if (g_str_equal (self->group, XKB_OPTION_GROUP_LVL3))
+  if (g_str_equal (self->group, XKB_OPTION_GROUP_LVL3))
     self->whitelist = xkb_option_lvl3_whitelist;
   else if (g_str_equal (self->group, XKB_OPTION_GROUP_COMP))
     self->whitelist = xkb_option_comp_whitelist;
@@ -269,41 +237,29 @@ cc_keyboard_option_constructed (GObject *object)
     g_assert_not_reached ();
 
   self->store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
-
-  if (self->is_xkb)
+  gtk_list_store_append (self->store, &iter);
+  gtk_list_store_set (self->store, &iter,
+                      XKB_OPTION_DESCRIPTION_COLUMN, _("Disabled"),
+                      XKB_OPTION_ID_COLUMN, NULL,
+                      -1);
+  options = gnome_xkb_info_get_options_for_group (xkb_info, self->group);
+  for (l = options; l; l = l->next)
     {
-      gtk_list_store_insert_with_values (self->store, &iter, -1,
-                                         XKB_OPTION_DESCRIPTION_COLUMN, _("Disabled"),
-                                         XKB_OPTION_ID_COLUMN, NULL,
-                                         -1);
-      options = gnome_xkb_info_get_options_for_group (xkb_info, self->group);
-      for (l = options; l; l = l->next)
+      option_id = l->data;
+      if (strv_contains (self->whitelist, option_id))
         {
-          option_id = l->data;
-          if (strv_contains (self->whitelist, option_id))
-            {
-              gtk_list_store_insert_with_values (self->store, &iter, -1,
-                                                 XKB_OPTION_DESCRIPTION_COLUMN,
-                                                 gnome_xkb_info_description_for_option (xkb_info, 
self->group, option_id),
-                                                 XKB_OPTION_ID_COLUMN, option_id,
-                                                 -1);
-            }
-        }
-      g_list_free (options);
-
-      reload_setting (self);
-    }
-  else
-    {
-      gint i;
-      for (i = 0; cc_input_switcher_options[i].value; i++)
-        {
-          gtk_list_store_insert_with_values (self->store, NULL, -1,
-                                             XKB_OPTION_DESCRIPTION_COLUMN, 
_(cc_input_switcher_options[i].description),
-                                             XKB_OPTION_ID_COLUMN, cc_input_switcher_options[i].value,
-                                             -1);
+          gtk_list_store_append (self->store, &iter);
+          gtk_list_store_set (self->store, &iter,
+                              XKB_OPTION_DESCRIPTION_COLUMN,
+                              gnome_xkb_info_description_for_option (xkb_info, self->group, option_id),
+                              XKB_OPTION_ID_COLUMN,
+                              option_id,
+                              -1);
         }
     }
+  g_list_free (options);
+
+  reload_setting (self);
 }
 
 static void
@@ -342,8 +298,6 @@ cc_keyboard_option_class_init (CcKeyboardOptionClass *klass)
 GList *
 cc_keyboard_option_get_all (void)
 {
-  CcKeyboardOption *option;
-
   if (objects_list)
     return objects_list;
 
@@ -366,18 +320,6 @@ cc_keyboard_option_get_all (void)
                                                "group", XKB_OPTION_GROUP_COMP,
                                                "description", _("Compose Key"),
                                                NULL));
-
-  option = g_object_new (CC_TYPE_KEYBOARD_OPTION,
-                         "description", _("Modifiers-only switch to next source"),
-                         NULL);
-
-  input_switcher_settings = g_settings_new (INPUT_SWITCHER_SCHEMA);
-  g_signal_connect (input_switcher_settings, "changed::" INPUT_SWITCHER_KEY,
-                    G_CALLBACK (input_switcher_changed), option);
-  input_switcher_changed (input_switcher_settings, INPUT_SWITCHER_KEY, option);
-
-  objects_list = g_list_prepend (objects_list, option);
-
   return objects_list;
 }
 
@@ -402,44 +344,10 @@ cc_keyboard_option_get_current_value_description (CcKeyboardOption *self)
 {
   g_return_val_if_fail (CC_IS_KEYBOARD_OPTION (self), NULL);
 
-  if (self->is_xkb)
-    {
-      if (!self->current_value)
-        return _("Disabled");
+  if (!self->current_value)
+    return _("Disabled");
 
-      return gnome_xkb_info_description_for_option (xkb_info, self->group, self->current_value);
-    }
-  else
-    {
-      GtkTreeIter iter;
-      gboolean ret;
-      gchar *desc;
-      gchar *id;
-
-      if (self->current_description)
-        return self->current_description;
-
-      ret = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (self->store), &iter);
-      while (ret)
-        {
-          gtk_tree_model_get (GTK_TREE_MODEL (self->store), &iter,
-                              XKB_OPTION_DESCRIPTION_COLUMN, &desc,
-                              XKB_OPTION_ID_COLUMN, &id,
-                              -1);
-          if (g_strcmp0 (self->current_value, id) == 0)
-            {
-              g_free (id);
-              g_free (self->current_description);
-              self->current_description = desc;
-              break;
-            }
-          g_free (id);
-          g_free (desc);
-          ret = gtk_tree_model_iter_next (GTK_TREE_MODEL (self->store), &iter);
-        }
-
-      return self->current_description;
-    }
+  return gnome_xkb_info_description_for_option (xkb_info, self->group, self->current_value);
 }
 
 static void
@@ -500,51 +408,31 @@ void
 cc_keyboard_option_set_selection (CcKeyboardOption *self,
                                   GtkTreeIter      *iter)
 {
-  g_return_if_fail (CC_IS_KEYBOARD_OPTION (self));
-
-  if (self->is_xkb)
-    {
-      gchar *new_value = NULL;
-
-      gtk_tree_model_get (GTK_TREE_MODEL (self->store), iter,
-                          XKB_OPTION_ID_COLUMN, &new_value,
-                          -1);
+  gchar *new_value = NULL;
 
-      if (!new_value)
-        {
-          if (self->current_value)
-            remove_value (self->current_value);
-        }
-      else
-        {
-          if (self->current_value)
-            replace_value (self->current_value, new_value);
-          else
-            add_value (new_value);
-        }
+  g_return_if_fail (CC_IS_KEYBOARD_OPTION (self));
 
-      g_settings_set_strv (input_sources_settings, XKB_OPTIONS_KEY,
-                           (const gchar * const *) current_xkb_options);
+  gtk_tree_model_get (GTK_TREE_MODEL (self->store), iter,
+                      XKB_OPTION_ID_COLUMN, &new_value,
+                      -1);
 
-      g_free (new_value);
+  if (!new_value)
+    {
+      if (self->current_value)
+        remove_value (self->current_value);
     }
   else
     {
-      gchar *value = NULL;
-      gchar *description = NULL;
-
-      gtk_tree_model_get (GTK_TREE_MODEL (self->store), iter,
-                          XKB_OPTION_ID_COLUMN, &value,
-                          XKB_OPTION_DESCRIPTION_COLUMN, &description,
-                          -1);
+      if (self->current_value)
+        replace_value (self->current_value, new_value);
+      else
+        add_value (new_value);
+    }
 
-      g_free (self->current_value);
-      g_free (self->current_description);
-      self->current_value = value;
-      self->current_description = description;
+  g_settings_set_strv (input_sources_settings, XKB_OPTIONS_KEY,
+                       (const gchar * const *) current_xkb_options);
 
-      g_settings_set_string (input_switcher_settings, INPUT_SWITCHER_KEY, self->current_value);
-    }
+  g_free (new_value);
 }
 
 void
@@ -558,6 +446,5 @@ cc_keyboard_option_clear_all (void)
   g_clear_pointer (&objects_list, g_list_free);
   g_clear_pointer (&current_xkb_options, g_strfreev);
   g_clear_object (&input_sources_settings);
-  g_clear_object (&input_switcher_settings);
   g_clear_object (&xkb_info);
 }
diff --git a/panels/region/cc-input-options.c b/panels/region/cc-input-options.c
index 83528ce..b55b392 100644
--- a/panels/region/cc-input-options.c
+++ b/panels/region/cc-input-options.c
@@ -23,7 +23,6 @@
 #include <config.h>
 #include <glib/gi18n.h>
 
-#include "cc-util.h"
 #include "cc-input-options.h"
 
 typedef struct {
@@ -81,8 +80,6 @@ update_shortcuts (GtkWidget *options)
         gchar **next;
         gchar *previous_shortcut;
         GSettings *settings;
-        gchar *s;
-        gint i;
 
         settings = g_settings_new ("org.gnome.desktop.wm.keybindings");
 
@@ -103,21 +100,7 @@ update_shortcuts (GtkWidget *options)
 
         g_object_unref (settings);
 
-        settings = g_settings_new ("org.gnome.settings-daemon.peripherals.keyboard");
-        s = g_settings_get_string (settings, "input-sources-switcher");
-
-        if (strcmp (s, "off") == 0) {
-                gtk_widget_hide (priv->alt_next_source);
-        } else {
-                for (i = 0; cc_input_switcher_options[i].value; i++) {
-                        if (strcmp (s, cc_input_switcher_options[i].value) == 0) {
-                                gtk_label_set_text (GTK_LABEL (priv->alt_next_source), 
_(cc_input_switcher_options[i].description));
-                                break;
-                        }
-                }
-        }
-        g_free (s);
-        g_object_unref (settings);
+        gtk_widget_hide (priv->alt_next_source); /* FIXME */
 }
 
 #define WID(name) ((GtkWidget *) gtk_builder_get_object (builder, name))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]