[gnome-settings-daemon] Remove libglade dependency from a11y-keyboard plugin
- From: Felix Riemann <friemann src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-settings-daemon] Remove libglade dependency from a11y-keyboard plugin
- Date: Sat, 18 Jul 2009 13:15:46 +0000 (UTC)
commit 9dc89728e18fa4ebb9b5605729f4b0d424dff017
Author: Felix Riemann <friemann gnome org>
Date: Sat Jul 18 14:44:20 2009 +0200
Remove libglade dependency from a11y-keyboard plugin
If GtkBuilder cannot build the UI an empty dialog with just a close
button is shown.
plugins/a11y-keyboard/Makefile.am | 12 +-
.../a11y-keyboard/gsd-a11y-preferences-dialog.c | 60 ++++++---
...dialog.glade => gsd-a11y-preferences-dialog.ui} | 130 +++++++++++---------
po/POTFILES.in | 2 +-
4 files changed, 118 insertions(+), 86 deletions(-)
---
diff --git a/plugins/a11y-keyboard/Makefile.am b/plugins/a11y-keyboard/Makefile.am
index 41eefd4..99bfa90 100644
--- a/plugins/a11y-keyboard/Makefile.am
+++ b/plugins/a11y-keyboard/Makefile.am
@@ -1,8 +1,8 @@
NULL =
-gladedir = $(pkgdatadir)
-glade_DATA = \
- gsd-a11y-preferences-dialog.glade \
+gtkbuilderdir = $(pkgdatadir)
+gtkbuilder_DATA = \
+ gsd-a11y-preferences-dialog.ui \
$(NULL)
noinst_PROGRAMS = \
@@ -18,7 +18,7 @@ test_a11y_preferences_dialog_SOURCES = \
test_a11y_preferences_dialog_CPPFLAGS = \
-I$(top_srcdir)/gnome-settings-daemon \
-DPIXMAPDIR=\""$(pkgdatadir)"\" \
- -DGLADEDIR=\""$(pkgdatadir)"\" \
+ -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \
-DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
$(AM_CPPFLAGS)
@@ -47,7 +47,7 @@ liba11y_keyboard_la_SOURCES = \
liba11y_keyboard_la_CPPFLAGS = \
-I$(top_srcdir)/gnome-settings-daemon \
-DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
- -DGLADEDIR=\""$(gladedir)"\" \
+ -DGTKBUILDERDIR=\""$(gtkbuilderdir)"\" \
$(AM_CPPFLAGS)
liba11y_keyboard_la_CFLAGS = \
@@ -73,7 +73,7 @@ plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin
EXTRA_DIST = \
$(plugin_in_files) \
- $(glade_DATA) \
+ $(gtkbuilder_DATA) \
$(NULL)
CLEANFILES = \
diff --git a/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c b/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c
index aeea0b9..d731dd3 100644
--- a/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c
+++ b/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c
@@ -32,7 +32,6 @@
#include <dbus/dbus-glib.h>
-#include <glade/glade-xml.h>
#include <gconf/gconf-client.h>
#include "gsd-a11y-preferences-dialog.h"
@@ -44,7 +43,7 @@
#define GSD_A11Y_PREFERENCES_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_A11Y_PREFERENCES_DIALOG, GsdA11yPreferencesDialogPrivate))
-#define GLADE_XML_FILE "gsd-a11y-preferences-dialog.glade"
+#define GTKBUILDER_UI_FILE "gsd-a11y-preferences-dialog.ui"
#define KEY_A11Y_DIR "/desktop/gnome/accessibility"
#define KEY_STICKY_KEYS_ENABLED KEY_A11Y_DIR "/keyboard/stickykeys_enable"
@@ -731,14 +730,15 @@ key_changed_cb (GConfClient *client,
static void
setup_dialog (GsdA11yPreferencesDialog *dialog,
- GladeXML *xml)
+ GtkBuilder *builder)
{
GtkWidget *widget;
gboolean enabled;
gboolean is_writable;
GConfClient *client;
- widget = glade_xml_get_widget (xml, "sticky_keys_checkbutton");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder,
+ "sticky_keys_checkbutton"));
dialog->priv->sticky_keys_checkbutton = widget;
g_signal_connect (widget,
"toggled",
@@ -750,7 +750,8 @@ setup_dialog (GsdA11yPreferencesDialog *dialog,
gtk_widget_set_sensitive (widget, FALSE);
}
- widget = glade_xml_get_widget (xml, "bounce_keys_checkbutton");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder,
+ "bounce_keys_checkbutton"));
dialog->priv->bounce_keys_checkbutton = widget;
g_signal_connect (widget,
"toggled",
@@ -762,7 +763,8 @@ setup_dialog (GsdA11yPreferencesDialog *dialog,
gtk_widget_set_sensitive (widget, FALSE);
}
- widget = glade_xml_get_widget (xml, "slow_keys_checkbutton");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder,
+ "slow_keys_checkbutton"));
dialog->priv->slow_keys_checkbutton = widget;
g_signal_connect (widget,
"toggled",
@@ -774,7 +776,8 @@ setup_dialog (GsdA11yPreferencesDialog *dialog,
gtk_widget_set_sensitive (widget, FALSE);
}
- widget = glade_xml_get_widget (xml, "high_contrast_checkbutton");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder,
+ "high_contrast_checkbutton"));
dialog->priv->high_contrast_checkbutton = widget;
g_signal_connect (widget,
"toggled",
@@ -786,7 +789,8 @@ setup_dialog (GsdA11yPreferencesDialog *dialog,
gtk_widget_set_sensitive (widget, FALSE);
}
- widget = glade_xml_get_widget (xml, "at_screen_keyboard_checkbutton");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder,
+ "at_screen_keyboard_checkbutton"));
dialog->priv->screen_keyboard_checkbutton = widget;
g_signal_connect (widget,
"toggled",
@@ -804,7 +808,8 @@ setup_dialog (GsdA11yPreferencesDialog *dialog,
gtk_widget_hide (widget);
}
- widget = glade_xml_get_widget (xml, "at_screen_reader_checkbutton");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder,
+ "at_screen_reader_checkbutton"));
dialog->priv->screen_reader_checkbutton = widget;
g_signal_connect (widget,
"toggled",
@@ -822,7 +827,8 @@ setup_dialog (GsdA11yPreferencesDialog *dialog,
gtk_widget_hide (widget);
}
- widget = glade_xml_get_widget (xml, "at_screen_magnifier_checkbutton");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder,
+ "at_screen_magnifier_checkbutton"));
dialog->priv->screen_magnifier_checkbutton = widget;
g_signal_connect (widget,
"toggled",
@@ -840,7 +846,8 @@ setup_dialog (GsdA11yPreferencesDialog *dialog,
gtk_widget_hide (widget);
}
- widget = glade_xml_get_widget (xml, "large_print_checkbutton");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder,
+ "large_print_checkbutton"));
dialog->priv->large_print_checkbutton = widget;
g_signal_connect (widget,
"toggled",
@@ -882,19 +889,33 @@ setup_dialog (GsdA11yPreferencesDialog *dialog,
static void
gsd_a11y_preferences_dialog_init (GsdA11yPreferencesDialog *dialog)
{
- GtkWidget *widget;
- GladeXML *xml;
+ static const gchar *ui_file_path = GTKBUILDERDIR "/" GTKBUILDER_UI_FILE;
+ gchar *objects[] = {"main_box", NULL};
+ GError *error = NULL;
+ GtkBuilder *builder;
dialog->priv = GSD_A11Y_PREFERENCES_DIALOG_GET_PRIVATE (dialog);
- xml = glade_xml_new (GLADEDIR "/" GLADE_XML_FILE, "main_box", PACKAGE);
- g_assert (xml != NULL);
+ builder = gtk_builder_new ();
+ gtk_builder_set_translation_domain (builder, PACKAGE);
+ if (gtk_builder_add_objects_from_file (builder, ui_file_path, objects,
+ &error) == 0) {
+ g_warning ("Could not load A11Y-UI: %s", error->message);
+ g_error_free (error);
+ } else {
+ GtkWidget *widget;
+
+ widget = GTK_WIDGET (gtk_builder_get_object (builder,
+ "main_box"));
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox),
+ widget);
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 12);
+ setup_dialog (dialog, builder);
+ }
- widget = glade_xml_get_widget (xml, "main_box");
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), widget);
+ g_object_unref (builder);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
- gtk_container_set_border_width (GTK_CONTAINER (widget), 12);
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_window_set_title (GTK_WINDOW (dialog), _("Universal Access Preferences"));
gtk_window_set_icon_name (GTK_WINDOW (dialog), "preferences-desktop-accessibility");
@@ -911,9 +932,6 @@ gsd_a11y_preferences_dialog_init (GsdA11yPreferencesDialog *dialog)
G_CALLBACK (on_response),
dialog);
- setup_dialog (dialog, xml);
-
- g_object_unref (xml);
gtk_widget_show_all (GTK_WIDGET (dialog));
}
diff --git a/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.glade b/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.ui
similarity index 75%
rename from plugins/a11y-keyboard/gsd-a11y-preferences-dialog.glade
rename to plugins/a11y-keyboard/gsd-a11y-preferences-dialog.ui
index 6ba0a59..6a0fcb0 100644
--- a/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.glade
+++ b/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.ui
@@ -1,185 +1,199 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.4 on Tue Aug 5 00:11:25 2008 -->
-<glade-interface>
- <widget class="GtkDialog" id="dialog1">
+<?xml version="1.0"?>
+<interface>
+ <!-- interface-requires gtk+ 2.6 -->
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkDialog" id="dialog1">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Universal Access Preferences</property>
- <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+ <property name="window_position">center-on-parent</property>
<property name="icon_name">preferences-desktop-accessibility</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox1">
+ <object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">2</property>
<child>
- <widget class="GtkHBox" id="main_box">
+ <object class="GtkHBox" id="main_box">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">5</property>
<property name="spacing">10</property>
<child>
- <widget class="GtkImage" id="image1">
+ <object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="yalign">0</property>
- <property name="icon_size">6</property>
<property name="icon_name">preferences-desktop-accessibility</property>
- </widget>
+ <property name="icon-size">6</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
</child>
<child>
- <widget class="GtkVBox" id="vbox1">
+ <object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">5</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkCheckButton" id="at_screen_keyboard_checkbutton">
+ <object class="GtkCheckButton" id="at_screen_keyboard_checkbutton">
+ <property name="label" translatable="yes">Use on-screen _keyboard</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="receives_default">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">Use on-screen _keyboard</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
</child>
<child>
- <widget class="GtkCheckButton" id="at_screen_reader_checkbutton">
+ <object class="GtkCheckButton" id="at_screen_reader_checkbutton">
+ <property name="label" translatable="yes">Use screen _reader</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="receives_default">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">Use screen _reader</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="at_screen_magnifier_checkbutton">
+ <object class="GtkCheckButton" id="at_screen_magnifier_checkbutton">
+ <property name="label" translatable="yes">Use screen _magnifier</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="receives_default">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">Use screen _magnifier</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="high_contrast_checkbutton">
+ <object class="GtkCheckButton" id="high_contrast_checkbutton">
+ <property name="label" translatable="yes">Enhance _contrast in colors</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="receives_default">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">Enhance _contrast in colors</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
<packing>
<property name="position">3</property>
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="large_print_checkbutton">
+ <object class="GtkCheckButton" id="large_print_checkbutton">
+ <property name="label" translatable="yes">Make _text larger and easier to read</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="receives_default">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">Make _text larger and easier to read</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
<packing>
<property name="position">4</property>
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="sticky_keys_checkbutton">
+ <object class="GtkCheckButton" id="sticky_keys_checkbutton">
+ <property name="label" translatable="yes">_Press keyboard shortcuts one key at a time (Sticky Keys)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="receives_default">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">_Press keyboard shortcuts one key at a time (Sticky Keys)</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
<packing>
<property name="position">5</property>
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="bounce_keys_checkbutton">
+ <object class="GtkCheckButton" id="bounce_keys_checkbutton">
+ <property name="label" translatable="yes">_Ignore duplicate keypresses (Bounce Keys)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="receives_default">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">_Ignore duplicate keypresses (Bounce Keys)</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
<packing>
<property name="position">6</property>
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="slow_keys_checkbutton">
+ <object class="GtkCheckButton" id="slow_keys_checkbutton">
+ <property name="label" translatable="yes">Press and _hold keys to accept them (Slow Keys)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="receives_default">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">Press and _hold keys to accept them (Slow Keys)</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
<packing>
<property name="position">7</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area1">
+ <object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <property name="layout_style">end</property>
<child>
- <widget class="GtkButton" id="button1">
+ <object class="GtkButton" id="button1">
+ <property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label">gtk-close</property>
<property name="use_stock">True</property>
- <property name="response_id">0</property>
- </widget>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
</packing>
</child>
- </widget>
+ </object>
</child>
- </widget>
-</glade-interface>
+ <action-widgets>
+ <action-widget response="0">button1</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 035f427..eb5c6fd 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -12,7 +12,7 @@ gnome-settings-daemon/main.c
[type: gettext/ini]plugins/a11y-keyboard/a11y-keyboard.gnome-settings-plugin.in
plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c
-plugins/a11y-keyboard/gsd-a11y-preferences-dialog.glade
+[type: gettext/glade]plugins/a11y-keyboard/gsd-a11y-preferences-dialog.ui
[type: gettext/ini]plugins/background/background.gnome-settings-plugin.in
[type: gettext/ini]plugins/clipboard/clipboard.gnome-settings-plugin.in
[type: gettext/ini]plugins/dummy/dummy.gnome-settings-plugin.in
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]