Remove libglade dependency on gnome-mouse-properties

This commit is contained in:
Robert Ancell 2009-07-30 13:26:35 +10:00
parent d224c36f6e
commit 5e17d0984f
6 changed files with 581 additions and 419 deletions

View file

@ -17,8 +17,8 @@ pixmap_DATA = \
double-click-off.png \ double-click-off.png \
double-click-maybe.png double-click-maybe.png
Gladedir = $(pkgdatadir)/glade uidir = $(pkgdatadir)/ui
Glade_DATA = gnome-mouse-properties.glade ui_DATA = gnome-mouse-properties.ui
desktopdir = $(datadir)/applications desktopdir = $(datadir)/applications
Desktop_in_files = gnome-settings-mouse.desktop.in Desktop_in_files = gnome-settings-mouse.desktop.in
@ -28,8 +28,8 @@ INCLUDES = \
$(GNOMECC_CAPPLETS_CFLAGS) \ $(GNOMECC_CAPPLETS_CFLAGS) \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \ -DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
-DGNOMECC_GLADE_DIR="\"$(pkgdatadir)/glade\"" -DGNOMECC_UI_DIR="\"$(uidir)\""
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA) CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA)
EXTRA_DIST = $(Glade_DATA) $(pixmap_DATA) EXTRA_DIST = $(ui_DATA) $(pixmap_DATA)
-include $(top_srcdir)/git.mk -include $(top_srcdir)/git.mk

View file

@ -16,7 +16,6 @@
*/ */
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <glade/glade.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include "capplet-util.h" #include "capplet-util.h"
@ -27,6 +26,9 @@
/* 5th entry in combo box */ /* 5th entry in combo box */
#define DIRECTION_DISABLE 4 #define DIRECTION_DISABLE 4
#undef WID
#define WID(s) GTK_WIDGET (gtk_builder_get_object (dialog, s))
enum { enum {
CLICK_TYPE_SINGLE, CLICK_TYPE_SINGLE,
CLICK_TYPE_DOUBLE, CLICK_TYPE_DOUBLE,
@ -36,7 +38,7 @@ enum {
}; };
static void static void
update_mode_sensitivity (GladeXML *dialog, gint mode) update_mode_sensitivity (GtkBuilder *dialog, gint mode)
{ {
gtk_widget_set_sensitive (WID ("box_ctw"), !mode); gtk_widget_set_sensitive (WID ("box_ctw"), !mode);
gtk_widget_set_sensitive (WID ("box_gesture"), mode); gtk_widget_set_sensitive (WID ("box_gesture"), mode);
@ -119,14 +121,14 @@ populate_gesture_combo (GtkWidget *combo)
} }
static void static void
delay_enable_toggled_cb (GtkWidget *checkbox, GladeXML *dialog) delay_enable_toggled_cb (GtkWidget *checkbox, GtkBuilder *dialog)
{ {
gtk_widget_set_sensitive (WID ("delay_box"), gtk_widget_set_sensitive (WID ("delay_box"),
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox))); gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)));
} }
static void static void
dwell_enable_toggled_cb (GtkWidget *checkbox, GladeXML *dialog) dwell_enable_toggled_cb (GtkWidget *checkbox, GtkBuilder *dialog)
{ {
gtk_widget_set_sensitive (WID ("dwell_box"), gtk_widget_set_sensitive (WID ("dwell_box"),
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox))); gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)));
@ -171,7 +173,7 @@ gconf_value_changed (GConfClient *client,
} }
void void
setup_accessibility (GladeXML *dialog, GConfClient *client) setup_accessibility (GtkBuilder *dialog, GConfClient *client)
{ {
gconf_client_add_dir (client, MT_GCONF_HOME, gconf_client_add_dir (client, MT_GCONF_HOME,
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);

View file

@ -18,12 +18,11 @@
#ifndef __GNOME_MOUSE_A11Y_H #ifndef __GNOME_MOUSE_A11Y_H
#define __GNOME_MOUSE_A11Y_H #define __GNOME_MOUSE_A11Y_H
#include <glade/glade.h>
#include <gconf/gconf-client.h> #include <gconf/gconf-client.h>
G_BEGIN_DECLS G_BEGIN_DECLS
void setup_accessibility (GladeXML *dialog, GConfClient *client); void setup_accessibility (GtkBuilder *dialog, GConfClient *client);
G_END_DECLS G_END_DECLS

View file

@ -28,7 +28,6 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <string.h> #include <string.h>
#include <gconf/gconf-client.h> #include <gconf/gconf-client.h>
#include <glade/glade.h>
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#include <math.h> #include <math.h>
@ -50,6 +49,9 @@
#include <X11/Xcursor/Xcursor.h> #include <X11/Xcursor/Xcursor.h>
#endif #endif
#undef WID
#define WID(s) GTK_WIDGET (gtk_builder_get_object (dialog, s))
enum enum
{ {
DOUBLE_CLICK_TEST_OFF, DOUBLE_CLICK_TEST_OFF,
@ -319,7 +321,7 @@ left_handed_to_gconf (GConfPropertyEditor *peditor,
static void static void
scrollmethod_radio_button_release_event (GtkWidget *widget, scrollmethod_radio_button_release_event (GtkWidget *widget,
GdkEventButton *event, GdkEventButton *event,
GladeXML *dialog) GtkBuilder *dialog)
{ {
gtk_widget_set_sensitive (WID ("horiz_scroll_toggle"), gtk_widget_set_sensitive (WID ("horiz_scroll_toggle"),
(widget != WID ("scroll_disabled_radio"))); (widget != WID ("scroll_disabled_radio")));
@ -411,7 +413,7 @@ find_synaptics (void)
/* Set up the property editors in the dialog. */ /* Set up the property editors in the dialog. */
static void static void
setup_dialog (GladeXML *dialog, GConfChangeSet *changeset) setup_dialog (GtkBuilder *dialog, GConfChangeSet *changeset)
{ {
GtkRadioButton *radio; GtkRadioButton *radio;
GObject *peditor; GObject *peditor;
@ -488,15 +490,19 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset)
/* Construct the dialog */ /* Construct the dialog */
static GladeXML * static GtkBuilder *
create_dialog (void) create_dialog (void)
{ {
GladeXML *dialog; GtkBuilder *dialog;
GtkSizeGroup *size_group; GtkSizeGroup *size_group;
GError *error = NULL;
dialog = glade_xml_new (GNOMECC_GLADE_DIR "/gnome-mouse-properties.glade", "mouse_properties_dialog", NULL); dialog = gtk_builder_new ();
if (!dialog) gtk_builder_add_from_file (dialog, GNOMECC_UI_DIR "/gnome-mouse-properties.ui", &error);
if (error != NULL) {
g_warning ("Error loading UI file: %s", error->message);
return NULL; return NULL;
}
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
gtk_size_group_add_widget (size_group, WID ("acceleration_label")); gtk_size_group_add_widget (size_group, WID ("acceleration_label"));
@ -550,7 +556,7 @@ int
main (int argc, char **argv) main (int argc, char **argv)
{ {
GConfClient *client; GConfClient *client;
GladeXML *dialog; GtkBuilder *dialog;
GtkWidget *dialog_win, *w; GtkWidget *dialog_win, *w;
gchar *start_page = NULL; gchar *start_page = NULL;

View file

@ -63,7 +63,7 @@ capplets/keyboard/gnome-keyboard-properties-xkbpv.c
capplets/keyboard/keyboard.desktop.in.in capplets/keyboard/keyboard.desktop.in.in
capplets/mouse/gnome-mouse-accessibility.c capplets/mouse/gnome-mouse-accessibility.c
capplets/mouse/gnome-mouse-properties.c capplets/mouse/gnome-mouse-properties.c
capplets/mouse/gnome-mouse-properties.glade capplets/mouse/gnome-mouse-properties.ui
capplets/mouse/gnome-settings-mouse.desktop.in.in capplets/mouse/gnome-settings-mouse.desktop.in.in
capplets/network/gnome-network-properties.c capplets/network/gnome-network-properties.c
capplets/network/gnome-network-properties.desktop.in.in capplets/network/gnome-network-properties.desktop.in.in