[gnome-control-center] keyboard: Use GTK+ to parse keys
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] keyboard: Use GTK+ to parse keys
- Date: Fri, 4 Nov 2011 17:01:28 +0000 (UTC)
commit df493ef93cd8adb65e666652ad90943b5f65c9cd
Author: Bastien Nocera <hadess hadess net>
Date: Thu Nov 3 17:25:29 2011 +0000
keyboard: Use GTK+ to parse keys
Instead of some custom code
https://bugzilla.gnome.org/show_bug.cgi?id=663341
configure.ac | 2 +-
panels/keyboard/Makefile.am | 2 +-
panels/keyboard/cc-keyboard-item.c | 8 ++++++--
panels/keyboard/cc-keyboard-item.h | 1 -
panels/keyboard/keyboard-shortcuts.c | 4 ++--
5 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 7963abb..a0247d2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,7 +60,7 @@ dnl Check that we meet the dependencies
dnl ==============================================
GLIB_REQUIRED_VERSION=2.29.14
-GTK_REQUIRED_VERSION=3.1.19
+GTK_REQUIRED_VERSION=3.3.3
DESKTOP_SCHEMAS_REQUIRED_VERSION=3.0.2
PA_REQUIRED_VERSION=0.9.16
CANBERRA_REQUIRED_VERSION=0.13
diff --git a/panels/keyboard/Makefile.am b/panels/keyboard/Makefile.am
index 521ed1d..1a5ec03 100644
--- a/panels/keyboard/Makefile.am
+++ b/panels/keyboard/Makefile.am
@@ -18,7 +18,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/libshortcuts.la
+libkeyboard_la_LIBADD = $(PANEL_LIBS) $(KEYBOARD_PANEL_LIBS)
libkeyboard_la_LDFLAGS = $(PANEL_LDFLAGS)
@INTLTOOL_DESKTOP_RULE@
diff --git a/panels/keyboard/cc-keyboard-item.c b/panels/keyboard/cc-keyboard-item.c
index 203e6ac..95b27d4 100644
--- a/panels/keyboard/cc-keyboard-item.c
+++ b/panels/keyboard/cc-keyboard-item.c
@@ -30,7 +30,6 @@
#include <gconf/gconf-client.h>
#include "cc-keyboard-item.h"
-#include "eggaccelerators.h"
#define CC_KEYBOARD_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_KEYBOARD_ITEM, CcKeyboardItemPrivate))
@@ -64,6 +63,7 @@ binding_from_string (const char *str,
GdkModifierType *accelerator_mods)
{
g_return_val_if_fail (accelerator_key != NULL, FALSE);
+ guint *keycodes;
if (str == NULL || strcmp (str, "disabled") == 0)
{
@@ -73,7 +73,11 @@ binding_from_string (const char *str,
return TRUE;
}
- egg_accelerator_parse_virtual (str, accelerator_key, keycode, (EggVirtualModifierType *) accelerator_mods);
+ gtk_accelerator_parse_with_keycode (str, accelerator_key, &keycodes, accelerator_mods);
+
+ if (keycode != NULL)
+ *keycode = (keycodes ? keycodes[0] : 0);
+ g_free (keycodes);
if (*accelerator_key == 0)
return FALSE;
diff --git a/panels/keyboard/cc-keyboard-item.h b/panels/keyboard/cc-keyboard-item.h
index ccad575..8da59e7 100644
--- a/panels/keyboard/cc-keyboard-item.h
+++ b/panels/keyboard/cc-keyboard-item.h
@@ -22,7 +22,6 @@
#define __CC_KEYBOARD_ITEM_H
#include <glib-object.h>
-#include "eggaccelerators.h"
G_BEGIN_DECLS
diff --git a/panels/keyboard/keyboard-shortcuts.c b/panels/keyboard/keyboard-shortcuts.c
index 4e6b45b..75abd2e 100644
--- a/panels/keyboard/keyboard-shortcuts.c
+++ b/panels/keyboard/keyboard-shortcuts.c
@@ -1184,8 +1184,8 @@ binding_name (guint keyval,
{
if (keyval != 0 || keycode != 0)
return translate ?
- egg_virtual_accelerator_label (keyval, keycode, mask) :
- egg_virtual_accelerator_name (keyval, keycode, mask);
+ gtk_accelerator_get_label_with_keycode (NULL, keyval, keycode, mask) :
+ gtk_accelerator_name_with_keycode (NULL, keyval, keycode, mask);
else
return g_strdup (translate ? _("Disabled") : "");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]