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 ae3014ba3e.
This reverts commit 77b7569c3d.

https://bugzilla.gnome.org/show_bug.cgi?id=700346
This commit is contained in:
Rui Matos 2013-04-01 20:02:38 +02:00
parent 4f2f50cd3b
commit 1f03f33230
5 changed files with 44 additions and 206 deletions

View file

@ -20,35 +20,10 @@
#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 }
};
/* Combining diacritical mark?
* Basic range: [0x0300,0x036F]
* Supplement: [0x1DC0,0x1DFF]

View file

@ -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

View file

@ -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)

View file

@ -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))
{
@ -165,21 +153,6 @@ xkb_options_changed (GSettings *settings,
reload_setting (CC_KEYBOARD_OPTION (l->data));
}
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,
@ -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;
@ -374,18 +328,6 @@ cc_keyboard_option_get_all (void)
*/
"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;
}
@ -410,44 +352,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
@ -508,51 +416,31 @@ void
cc_keyboard_option_set_selection (CcKeyboardOption *self,
GtkTreeIter *iter)
{
gchar *new_value = NULL;
g_return_if_fail (CC_IS_KEYBOARD_OPTION (self));
if (self->is_xkb)
gtk_tree_model_get (GTK_TREE_MODEL (self->store), iter,
XKB_OPTION_ID_COLUMN, &new_value,
-1);
if (!new_value)
{
gchar *new_value = NULL;
gtk_tree_model_get (GTK_TREE_MODEL (self->store), iter,
XKB_OPTION_ID_COLUMN, &new_value,
-1);
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_settings_set_strv (input_sources_settings, XKB_OPTIONS_KEY,
(const gchar * const *) current_xkb_options);
g_free (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);
g_free (self->current_value);
g_free (self->current_description);
self->current_value = value;
self->current_description = description;
g_settings_set_string (input_switcher_settings, INPUT_SWITCHER_KEY, self->current_value);
if (self->current_value)
replace_value (self->current_value, new_value);
else
add_value (new_value);
}
g_settings_set_strv (input_sources_settings, XKB_OPTIONS_KEY,
(const gchar * const *) current_xkb_options);
g_free (new_value);
}
void
@ -566,6 +454,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);
}

View file

@ -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))