[gnome-bluetooth/gnome-2-32] Port properties to GSettings



commit a382480eefa9a15804ac356e7c4481fccc26d64f
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Apr 20 15:44:31 2010 +0100

    Port properties to GSettings

 .gitignore                              |    7 +
 configure.ac                            |   15 +-
 po/POTFILES.in                          |    2 -
 properties/Makefile.am                  |   26 +-
 properties/bluetooth-manager.schemas.in |   17 -
 properties/gconf-bridge.c               | 1259 -------------------------------
 properties/gconf-bridge.h               |  116 ---
 properties/gnome-bluetooth              |    2 +
 properties/main.c                       |   17 +-
 9 files changed, 36 insertions(+), 1425 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 7ded793..e66f6a6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -51,6 +51,13 @@ applet/bluetooth-applet.desktop.in
 applet/test-agentdialog
 properties/bluetooth-properties
 properties/bluetooth-properties.desktop.in
+properties/org.gnome.Bluetooth.gschema.xml
+
+moblin/bluetooth-panel
+moblin/bluetooth-panel.desktop.in
+moblin/org.moblin.UX.Shell.Panels.bluetooth.service
+moblin/theme/bluetooth-panel.css
+
 wizard/bluetooth-wizard
 sendto/bluetooth-sendto
 browse/bluetooth-browse
diff --git a/configure.ac b/configure.ac
index 33d1ae2..2c73ccd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,8 +47,6 @@ AM_GLIB_GNU_GETTEXT
 IT_PROG_INTLTOOL([0.35.0])
 
 AC_PATH_PROG([XMLLINT],[xmllint])
-AC_PATH_PROG(GCONFTOOL, [gconftool-2])
-AM_GCONF_SOURCE_2
 
 dnl gtk-doc checks
 GTK_DOC_CHECK(1.9)
@@ -69,23 +67,32 @@ if (test "$enable_icon_update" != no); then
 fi
 AM_CONDITIONAL([ICON_UPDATE], [test -n "$UPDATE_ICON_CACHE"])
 
+AC_SUBST(gsettingsschemadir, `pkg-config --variable gsettingsschemadir gio-2.0`)
+AC_SUBST(gsettingsupdateschemacache, `pkg-config --variable gsettingsupdateschemacache gio-2.0`)
+
 GTK_REQUIRED=2.19.1
+GLIB_REQUIRED=2.25.1
 DBUS_GLIB_REQUIRED=0.74
 NOTIFY_REQUIRED=0.4.3
 NAUTILUS_SENDTO_REQUIRED=2.28.0.1
+GCONF_REQUIRED=2.31.1
+
+dnl Requires for the GConf GSettings backend
+PKG_CHECK_MODULES(GCONF,
+		  gconf-2.0 >= $GCONF_REQUIRED)
 
 dnl Requires for the properties window
 PKG_CHECK_MODULES(PROPS,
 		  dbus-glib-1 >= $DBUS_GLIB_REQUIRED
-		  gconf-2.0
+		  glib-2.0 >= $GLIB_REQUIRED
 		  gtk+-2.0
 		  unique-1.0)
 
 dnl Requires for the applet
 PKG_CHECK_MODULES(APPLET,
 		  dbus-glib-1 >= $DBUS_GLIB_REQUIRED
-		  gconf-2.0
 		  gmodule-export-2.0
+		  glib-2.0 >= $GLIB_REQUIRED
 		  gtk+-2.0 >= $GTK_REQUIRED
 		  libnotify >= $NOTIFY_REQUIRED
 		  unique-1.0)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7923b69..7881c26 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -19,8 +19,6 @@ properties/adapter.c
 [type: gettext/glade] properties/properties-no-adapter.ui
 [type: gettext/glade] properties/properties-adapter-off.ui
 properties/bluetooth-properties.desktop.in.in
-properties/bluetooth-manager.schemas.in
-properties/gconf-bridge.c
 wizard/main.c
 [type: gettext/glade] wizard/wizard.ui
 sendto/main.c
diff --git a/properties/Makefile.am b/properties/Makefile.am
index 0a361ad..5637182 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -1,7 +1,7 @@
 
 bin_PROGRAMS = bluetooth-properties
 
-bluetooth_properties_SOURCES = main.c general.h general.c adapter.h adapter.c gconf-bridge.c gconf-bridge.h
+bluetooth_properties_SOURCES = main.c general.h general.c adapter.h adapter.c
 
 bluetooth_properties_LDADD = $(top_builddir)/lib/libgnome-bluetooth.la $(top_builddir)/lib/libcommon.la $(PROPS_LIBS)
 
@@ -12,37 +12,25 @@ INCLUDES = -I$(top_srcdir)/lib
 man_MANS = bluetooth-properties.1
 
 desktopdir = $(datadir)/applications
-
 desktop_in_in_files = bluetooth-properties.desktop.in.in
 desktop_in_files = bluetooth-properties.desktop.in
-
 desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
-
 @INTLTOOL_DESKTOP_RULE@
 
 ui_DATA = properties-no-adapter.ui properties-adapter-off.ui
 uidir = $(pkgdatadir)
 
-schemadir = $(GCONF_SCHEMA_FILE_DIR)
-
-schema_in_files = bluetooth-manager.schemas.in
-
-schema_DATA = $(schema_in_files:.schemas.in=.schemas)
+convertdir=$(datadir)/gsettings-data-convert/
+convert_DATA=gnome-bluetooth
 
- INTLTOOL_SCHEMAS_RULE@
+gsettingsschema_DATA = org.gnome.Bluetooth.gschema.xml
+install-data-hook:
+	$(gsettingsupdateschemacache) $(gsettingsschemadir) --targetdir=$(gsettingsschemadir)
 
 CLEANFILES = $(desktop_DATA) $(schema_DATA)
 
-EXTRA_DIST = $(man_MANS) $(desktop_in_in_files) $(schema_in_files) $(ui_DATA)
+EXTRA_DIST = $(man_MANS) $(desktop_in_in_files) $(schema_in_files) $(ui_DATA) $(convert_DATA) $(gsettingsschema_DATA)
 
 MAINTAINERCLEANFILES = Makefile.in
 
-if GCONF_SCHEMAS_INSTALL
-install-data-local:
-	-GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \
-	$(GCONFTOOL) --makefile-install-rule $(schema_DATA)
 
-uninstall-local:
-	-GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \
-	$(GCONFTOOL) --makefile-uninstall-rule $(schema_DATA)
-endif
diff --git a/properties/gnome-bluetooth b/properties/gnome-bluetooth
new file mode 100644
index 0000000..520c45d
--- /dev/null
+++ b/properties/gnome-bluetooth
@@ -0,0 +1,2 @@
+[org.gnome.Bluetooth]
+/apps/bluetooth-manager/show-icon = /apps/bluetooth-manager/show_icon
diff --git a/properties/main.c b/properties/main.c
index a6754f2..3ea59a4 100644
--- a/properties/main.c
+++ b/properties/main.c
@@ -35,12 +35,11 @@
 #include "bluetooth-plugin-manager.h"
 #include "bluetooth-client.h"
 #include "bluetooth-client-private.h"
-#include "gconf-bridge.h"
 #include "general.h"
 #include "adapter.h"
 
-#define PREF_DIR		"/apps/bluetooth-manager"
-#define PREF_SHOW_ICON		PREF_DIR "/show_icon"
+#define SCHEMA_NAME		"org.gnome.Bluetooth"
+#define PREF_SHOW_ICON		"show-icon"
 
 static gboolean delete_callback(GtkWidget *window, GdkEvent *event,
 							gpointer user_data)
@@ -110,7 +109,7 @@ static void help_callback(GtkWidget *item)
 		g_printerr("Unable to launch help: %s", error->message);
 		g_error_free(error);
 	}
-}	
+}
 
 static GtkWidget *create_window(GtkWidget *notebook)
 {
@@ -119,7 +118,7 @@ static GtkWidget *create_window(GtkWidget *notebook)
 	GtkWidget *buttonbox;
 	GtkWidget *button;
 	GtkWidget *image;
-	GConfBridge *bridge;
+	GSettings *settings;
 
 	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 	gtk_window_set_title(GTK_WINDOW(window), _("Bluetooth Preferences"));
@@ -138,10 +137,10 @@ static GtkWidget *create_window(GtkWidget *notebook)
 	gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
 
 	button = gtk_check_button_new_with_mnemonic (_("_Show Bluetooth icon"));
-	bridge = gconf_bridge_get ();
 	gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
-	gconf_bridge_bind_property_full (bridge, PREF_SHOW_ICON, G_OBJECT (button),
-					 "active", FALSE);
+	settings = g_settings_new (SCHEMA_NAME);
+	g_settings_bind (settings, PREF_SHOW_ICON, G_OBJECT (button), "active",
+			 G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY);
 
 	buttonbox = gtk_hbutton_box_new();
 	gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonbox), GTK_BUTTONBOX_END);
@@ -220,6 +219,8 @@ int main(int argc, char *argv[])
 	GtkWidget *notebook;
 	GError *error = NULL;
 
+	g_setenv ("GSETTINGS_BACKEND", "gconf", FALSE);
+
 	bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
 	bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
 	textdomain(GETTEXT_PACKAGE);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]