universal-access: Use GTK+ instead of custom code

https://bugzilla.gnome.org/show_bug.cgi?id=663341
This commit is contained in:
Bastien Nocera 2011-11-03 17:29:15 +00:00
parent df493ef93c
commit 1465f98af9
2 changed files with 7 additions and 6 deletions

View file

@ -23,7 +23,7 @@ libuniversal_access_la_SOURCES = \
zoom-options.c \ zoom-options.c \
zoom-options.h zoom-options.h
libuniversal_access_la_LIBADD = $(PANEL_LIBS) $(UNIVERSAL_ACCESS_PANEL_LIBS) $(top_builddir)/panels/common/libshortcuts.la libuniversal_access_la_LIBADD = $(PANEL_LIBS) $(UNIVERSAL_ACCESS_PANEL_LIBS)
libuniversal_access_la_LDFLAGS = $(PANEL_LDFLAGS) libuniversal_access_la_LDFLAGS = $(PANEL_LDFLAGS)
uidir = $(pkgdatadir)/ui uidir = $(pkgdatadir)/ui

View file

@ -29,7 +29,6 @@
#include <gconf/gconf-client.h> #include <gconf/gconf-client.h>
#include "eggaccelerators.h"
#include "gconf-property-editor.h" #include "gconf-property-editor.h"
#include "zoom-options.h" #include "zoom-options.h"
@ -495,8 +494,8 @@ cc_ua_panel_set_shortcut_label (CcUaPanel *self,
GtkWidget *widget; GtkWidget *widget;
char *value; char *value;
char *text; char *text;
guint accel_key, keycode; guint accel_key, *keycode;
EggVirtualModifierType mods; GdkModifierType mods;
widget = WID (self->priv->builder, label); widget = WID (self->priv->builder, label);
value = g_settings_get_string (self->priv->mediakeys_settings, key); value = g_settings_get_string (self->priv->mediakeys_settings, key);
@ -506,7 +505,8 @@ cc_ua_panel_set_shortcut_label (CcUaPanel *self,
g_free (value); g_free (value);
return; return;
} }
if (egg_accelerator_parse_virtual (value, &accel_key, &keycode, &mods) == FALSE) { gtk_accelerator_parse_with_keycode (value, &accel_key, &keycode, &mods);
if (accel_key == 0 && keycode == NULL && mods == 0) {
gtk_label_set_text (GTK_LABEL (widget), _("No shortcut set")); gtk_label_set_text (GTK_LABEL (widget), _("No shortcut set"));
g_free (value); g_free (value);
g_warning ("Failed to parse keyboard shortcut: '%s'", value); g_warning ("Failed to parse keyboard shortcut: '%s'", value);
@ -514,7 +514,8 @@ cc_ua_panel_set_shortcut_label (CcUaPanel *self,
} }
g_free (value); g_free (value);
text = egg_virtual_accelerator_label (accel_key, keycode, mods); text = gtk_accelerator_get_label_with_keycode (gtk_widget_get_display (widget), accel_key, *keycode, mods);
g_free (keycode);
gtk_label_set_text (GTK_LABEL (widget), text); gtk_label_set_text (GTK_LABEL (widget), text);
g_free (text); g_free (text);
} }