[gnome-control-center] Revert "Revert "Use a common definition for modifier-only keybindings array""
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] Revert "Revert "Use a common definition for modifier-only keybindings array""
- Date: Mon, 13 May 2013 14:26:39 +0000 (UTC)
commit 0b7479572e877a305717302fc1f4f2d283e8dfe5
Author: Rui Matos <tiagomatos gmail com>
Date: Mon May 13 16:26:01 2013 +0200
Revert "Revert "Use a common definition for modifier-only keybindings array""
This reverts commit 34906dba2730b42dc0f756822298291e8da7411c.
panels/common/cc-util.c | 27 +++++++++++++++++++++-
panels/common/cc-util.h | 7 +++++
panels/keyboard/Makefile.am | 2 +-
panels/keyboard/cc-keyboard-option.c | 38 ++++---------------------------
panels/region/cc-input-options.c | 41 ++++-----------------------------
5 files changed, 44 insertions(+), 71 deletions(-)
---
diff --git a/panels/common/cc-util.c b/panels/common/cc-util.c
index e51a9d2..3db2500 100644
--- a/panels/common/cc-util.c
+++ b/panels/common/cc-util.c
@@ -20,10 +20,35 @@
#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]
diff --git a/panels/common/cc-util.h b/panels/common/cc-util.h
index 42b09ff..737a86b 100644
--- a/panels/common/cc-util.h
+++ b/panels/common/cc-util.h
@@ -23,6 +23,13 @@
#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 bd9faea..81cc7bb 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)
+libkeyboard_la_LIBADD = $(PANEL_LIBS) $(KEYBOARD_PANEL_LIBS) $(top_builddir)/panels/common/liblanguage.la
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 a8ff9a0..38f3532 100644
--- a/panels/keyboard/cc-keyboard-option.c
+++ b/panels/keyboard/cc-keyboard-option.c
@@ -19,11 +19,13 @@
* 02110-1301, USA.
*/
+#include <config.h>
#include <glib/gi18n.h>
#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 ())
@@ -245,36 +247,6 @@ cc_keyboard_option_finalize (GObject *object)
G_OBJECT_CLASS (cc_keyboard_option_parent_class)->finalize (object);
}
-static struct
-{
- const gchar *value;
- const gchar *description;
-} 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 }
-};
-
static void
cc_keyboard_option_constructed (GObject *object)
{
@@ -324,11 +296,11 @@ cc_keyboard_option_constructed (GObject *object)
else
{
gint i;
- for (i = 0; input_switcher_options[i].value; 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,
input_switcher_options[i].description,
- XKB_OPTION_ID_COLUMN, input_switcher_options[i].value,
+ XKB_OPTION_DESCRIPTION_COLUMN,
_(cc_input_switcher_options[i].description),
+ XKB_OPTION_ID_COLUMN, cc_input_switcher_options[i].value,
-1);
}
}
diff --git a/panels/region/cc-input-options.c b/panels/region/cc-input-options.c
index 7c90952..83528ce 100644
--- a/panels/region/cc-input-options.c
+++ b/panels/region/cc-input-options.c
@@ -20,12 +20,11 @@
* Matthias Clasen
*/
-#define _GNU_SOURCE
#include <config.h>
-#include "cc-input-options.h"
-
#include <glib/gi18n.h>
+#include "cc-util.h"
+#include "cc-input-options.h"
typedef struct {
GtkWidget *dialog;
@@ -74,36 +73,6 @@ update_shortcut_label (GtkWidget *widget,
g_free (text);
}
-static struct
-{
- const gchar *value;
- const gchar *description;
-} 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 }
-};
-
static void
update_shortcuts (GtkWidget *options)
{
@@ -140,9 +109,9 @@ update_shortcuts (GtkWidget *options)
if (strcmp (s, "off") == 0) {
gtk_widget_hide (priv->alt_next_source);
} else {
- for (i = 0; input_switcher_options[i].value; i++) {
- if (strcmp (s, input_switcher_options[i].value) == 0) {
- gtk_label_set_text (GTK_LABEL (priv->alt_next_source),
_(input_switcher_options[i].description));
+ 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;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]