Commit 2e0a6370 authored by Bastien Nocera's avatar Bastien Nocera
Browse files

Port properties to GSettings

parent efbb0fb1
......@@ -53,6 +53,7 @@ applet/test-icon
properties/bluetooth-properties
properties/bluetooth-properties.desktop.in
properties/org.gnome.Bluetooth.gschema.xml
moblin/bluetooth-panel
moblin/bluetooth-panel.desktop.in
......
......@@ -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)
......
......@@ -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
......
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
<gconfschemafile>
<schemalist>
<schema>
<key>/schemas/apps/bluetooth-manager/show_icon</key>
<applyto>/apps/bluetooth-manager/show_icon</applyto>
<owner>bluetooth-manager</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short>Whether to show the notification icon</short>
<long>Whether to show the notification icon.</long>
</locale>
</schema>
</schemalist>
</gconfschemafile>
This diff is collapsed.
/*
* (C) 2005 OpenedHand Ltd.
*
* Author: Jorn Baayen <jorn@openedhand.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GCONF_BRIDGE_H__
#define __GCONF_BRIDGE_H__
#include <gconf/gconf-client.h>
#include <gtk/gtk.h>
G_BEGIN_DECLS
void gconf_bridge_install_default_error_handler (void);
typedef struct _GConfBridge GConfBridge;
GConfBridge *gconf_bridge_get (void);
GConfClient *gconf_bridge_get_client (GConfBridge *bridge);
guint gconf_bridge_bind_property_full (GConfBridge *bridge,
const char *key,
GObject *object,
const char *prop,
gboolean delayed_sync);
/**
* gconf_bridge_bind_property
* @bridge: A #GConfBridge
* @key: A GConf key to be bound
* @object: A #GObject
* @prop: The property of @object to be bound
*
* Binds @key to @prop without delays, causing them to have the same value at all times. See
* #gconf_bridge_bind_property_full for more details.
*
**/
#define gconf_bridge_bind_property(bridge, key, object, prop) \
gconf_bridge_bind_property_full ((bridge), (key), \
(object), (prop), FALSE)
/**
* gconf_bridge_bind_property_delayed
* @bridge: A #GConfBridge
* @key: A GConf key to be bound
* @object: A #GObject
* @prop: The property of @object to be bound
*
* Binds @key to @prop with a delay, causing them to have the same value at all
* times. See #gconf_bridge_bind_property_full for more details.
**/
#define gconf_bridge_bind_property_delayed(bridge, key, object, prop) \
gconf_bridge_bind_property_full ((bridge), (key), \
(object), (prop), TRUE)
guint gconf_bridge_bind_window (GConfBridge *bridge,
const char *key_prefix,
GtkWindow *window,
gboolean bind_size,
gboolean bind_pos);
/**
* gconf_bridge_bind_window_size
* @bridge: A #GConfBridge
* @key_prefix: The prefix of the GConf keys
* @window: A #GtkWindow
*
* On calling this function @window will be resized to the values specified by
* "@key_prefix<!-- -->_width" and "@key_prefix<!-- -->_height". The respective
* GConf values will be updated when the window is resized. See
* #gconf_bridge_bind_window for more details.
**/
#define gconf_bridge_bind_window_size(bridge, key_prefix, window) \
gconf_bridge_bind_window ((bridge), (key_prefix), (window), TRUE, FALSE)
/**
* gconf_bridge_bind_window_pos
* @bridge: A #GConfBridge
* @key_prefix: The prefix of the GConf keys
* @window: A #GtkWindow
*
* On calling this function @window will be moved to the values specified by
* "@key_prefix<!-- -->_x" and "@key_prefix<!-- -->_y". The respective GConf
* values will be updated when the window is moved. See
* #gconf_bridge_bind_window for more details.
**/
#define gconf_bridge_bind_window_pos(bridge, key_prefix, window) \
gconf_bridge_bind_window ((bridge), (key_prefix), (window), FALSE, TRUE)
guint gconf_bridge_bind_string_list_store (GConfBridge *bridge,
const char *key,
GtkListStore *list_store);
void gconf_bridge_unbind (GConfBridge *bridge,
guint binding_id);
G_END_DECLS
#endif /* __GCONF_BRIDGE_H__ */
[org.gnome.Bluetooth]
/apps/bluetooth-manager/show-icon = /apps/bluetooth-manager/show_icon
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment