[gnome-utils] Port baobab to gsettings.
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-utils] Port baobab to gsettings.
- Date: Sat, 9 Oct 2010 20:36:43 +0000 (UTC)
commit 8c75aa622036b1fb0af2621e7d78994d813b74b2
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Oct 9 22:04:25 2010 +0200
Port baobab to gsettings.
The port is based on vuntz's gsettings-tutorial branch - which I
discoverd only when I was half way through :( - but it is updated to the
latest changes in the application and to the definitive gsettings api
baobab/README | 11 +-
baobab/data/Makefile.am | 22 +--
baobab/data/baobab-main-window.ui | 2 -
baobab/data/org.gnome.baobab.gschema.xml.in | 35 ++++
baobab/src/Makefile.am | 4 -
baobab/src/baobab-prefs.c | 63 +++----
baobab/src/baobab-utils.c | 11 --
baobab/src/baobab-utils.h | 1 -
baobab/src/baobab.c | 254 +++++++++++----------------
baobab/src/baobab.h | 19 +-
baobab/src/callbacks.c | 31 ----
baobab/src/callbacks.h | 2 -
configure.ac | 6 +
po/POTFILES.in | 2 +-
14 files changed, 194 insertions(+), 269 deletions(-)
---
diff --git a/baobab/README b/baobab/README
index 43156b3..8768ee7 100644
--- a/baobab/README
+++ b/baobab/README
@@ -24,11 +24,11 @@ Copyright
What is Baobab
==============
- Baobab is able to scan either specific directories or the whole
+ Baobab is able to scan either specific directories or the whole
filesystem, in order to give the user a graphical tree representation
including each directory size or percentage in the branch.
- It also auto-detects in real-time any change made to your home
- folder as far as any mounted/unmounted device.
+ It also auto-detects in real-time any change made to your home
+ folder as far as any mounted/unmounted device.
A detailed documentation of the program could be read at:
http://www.gnome.org/projects/baobab.
@@ -37,9 +37,8 @@ What is Baobab
System Requirements
===================
-Baobab should build on most unices. It needs the X11R6 (or xorg)
-libraries, glib, gtk 2.x, gnome-vfs2, gconf2 libraries.
-
+Baobab should build on most unices. It needs the X11R6 (or xorg)
+libraries, glib and gtk 3.x
Author
======
diff --git a/baobab/data/Makefile.am b/baobab/data/Makefile.am
index 56d2211..d97ed28 100644
--- a/baobab/data/Makefile.am
+++ b/baobab/data/Makefile.am
@@ -1,5 +1,6 @@
uidir = $(datadir)/baobab
-ui_DATA = baobab-main-window.ui \
+ui_DATA = \
+ baobab-main-window.ui \
baobab-preferences-dialog.ui
baobabappdir = $(datadir)/applications
@@ -11,21 +12,14 @@ $(baobabapp_in_files): $(baobabapp_in_files:.desktop.in=.desktop.in.in)
@INTLTOOL_DESKTOP_RULE@
-schemasdir = $(GCONF_SCHEMA_FILE_DIR)
-schemas_in_files = baobab.schemas.in
-schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
- INTLTOOL_SCHEMAS_RULE@
+gsettingsschema_in_files = org.gnome.baobab.gschema.xml.in
+gsettings_SCHEMAS = $(gsettingsschema_in_files:.xml.in=.xml)
-man_MANS = baobab.1
+ INTLTOOL_XML_NOMERGE_RULE@
+
+ GSETTINGS_RULES@
-if GCONF_SCHEMAS_INSTALL
-install-data-local:
- if test -z "$(DESTDIR)" ; then \
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(schemas_DATA) ; \
- fi
-else
-install-data-local:
-endif
+man_MANS = baobab.1
EXTRA_DIST = \
$(ui_DATA) \
diff --git a/baobab/data/baobab-main-window.ui b/baobab/data/baobab-main-window.ui
index a0ae73d..2b4ae4f 100644
--- a/baobab/data/baobab-main-window.ui
+++ b/baobab/data/baobab-main-window.ui
@@ -106,7 +106,6 @@
<property name="active">True</property>
<property name="name">view_tb</property>
<property name="label" translatable="yes">_Toolbar</property>
- <signal handler="on_view_tb_activate" last_modification_time="Wed, 19 Apr 2006 12:10:25 GMT" name="activate"/>
</object>
</child>
<child>
@@ -114,7 +113,6 @@
<property name="active">True</property>
<property name="name">view_sb</property>
<property name="label" translatable="yes">St_atusbar</property>
- <signal handler="on_view_sb_activate" last_modification_time="Wed, 19 Apr 2006 12:45:08 GMT" name="activate"/>
</object>
</child>
<child>
diff --git a/baobab/data/org.gnome.baobab.gschema.xml.in b/baobab/data/org.gnome.baobab.gschema.xml.in
new file mode 100644
index 0000000..6688902
--- /dev/null
+++ b/baobab/data/org.gnome.baobab.gschema.xml.in
@@ -0,0 +1,35 @@
+<schemalist>
+ <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.baobab" path="/apps/baobab/">
+ <child name="preferences" schema="org.gnome.baobab.preferences"/>
+ <child name="ui" schema="org.gnome.baobab.ui"/>
+ </schema>
+ <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.baobab.preferences" path="/apps/baobab/preferences/">
+ <key name="monitor-home" type="b">
+ <default>false</default>
+ <_summary>Monitor Home</_summary>
+ <_description>Whether any change to the home directory should be monitored.</_description>
+ </key>
+ <key name="excluded-uris" type="as">
+ <default>[]</default>
+ <_summary>Excluded partitions URIs</_summary>
+ <_description>A list of URIs for partitions to be excluded from scanning.</_description>
+ </key>
+ </schema>
+ <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.baobab.ui" path="/apps/baobab/ui/">
+ <key name="toolbar-visible" type="b">
+ <default>true</default>
+ <_summary>Toolbar is Visible</_summary>
+ <_description>Whether the toolbar should be visible in main window.</_description>
+ </key>
+ <key name="statusbar-visible" type="b">
+ <default>false</default>
+ <_summary>Statusbar is Visible</_summary>
+ <_description>Whether the status bar at the bottom of main window should be visible.</_description>
+ </key>
+ <key name="active-chart" type="s">
+ <default>'rings'</default>
+ <_summary>Active Chart</_summary>
+ <_description>Which type of chart should be displayed.</_description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/baobab/src/Makefile.am b/baobab/src/Makefile.am
index 7dfebad..47dd7be 100644
--- a/baobab/src/Makefile.am
+++ b/baobab/src/Makefile.am
@@ -1,5 +1,3 @@
-## Process this file with automake to produce Makefile.in
-
NULL =
INCLUDES = \
@@ -43,7 +41,6 @@ baobab_CFLAGS = \
$(GIO_CFLAGS) \
$(GTK_CFLAGS) \
$(LIBGTOP_CFLAGS) \
- $(GCONF_CFLAGS) \
$(NULL)
baobab_LDFLAGS = -export-dynamic
@@ -53,6 +50,5 @@ baobab_LDADD = \
$(GIO_LIBS) \
$(GTK_LIBS) \
$(LIBGTOP_LIBS) \
- $(GCONF_LIBS) \
$(NULL)
diff --git a/baobab/src/baobab-prefs.c b/baobab/src/baobab-prefs.c
index 9adf8fa..95d85ad 100644
--- a/baobab/src/baobab-prefs.c
+++ b/baobab/src/baobab-prefs.c
@@ -28,7 +28,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
-#include <gconf/gconf-client.h>
#include <glibtop/mountlist.h>
#include <glibtop/fsusage.h>
#include "baobab.h"
@@ -53,14 +52,11 @@ static gboolean
add_excluded_item (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
- GSList **list)
+ GPtrArray *uris)
{
- GSList *l;
gchar *mount;
gboolean check;
- l = *list;
-
gtk_tree_model_get (model,
iter,
COL_MOUNT, &mount,
@@ -68,53 +64,43 @@ add_excluded_item (GtkTreeModel *model,
-1);
if (!check) {
- l = g_slist_prepend (l, mount);
+ g_ptr_array_add (uris, mount);
+ }
+ else {
+ g_free (mount);
}
-
- *list = l;
return FALSE;
}
-static GSList *
+static gchar **
get_excluded_locations (GtkTreeModel *model)
{
- GSList *l = NULL;
+ GPtrArray *uris;
+
+ uris = g_ptr_array_new ();
gtk_tree_model_foreach (model,
(GtkTreeModelForeachFunc) add_excluded_item,
- &l);
+ uris);
- return g_slist_reverse (l);
-}
+ g_ptr_array_add (uris, NULL);
-static void
-save_gconf (GtkTreeModel *model)
-{
- GSList *l;
-
- l = get_excluded_locations (model);
-
- gconf_client_set_list (baobab.gconf_client,
- BAOBAB_EXCLUDED_DIRS_KEY, GCONF_VALUE_STRING,
- l, NULL);
-
- g_slist_foreach (l, (GFunc) g_free, NULL);
- g_slist_free (l);
+ return (gchar **) g_ptr_array_free (uris, FALSE);
}
static void
-enable_home_cb (GtkToggleButton *togglebutton, gpointer user_data)
+save_excluded_uris (GtkTreeModel *model)
{
- gboolean enable;
+ gchar **uris;
- enable = gtk_toggle_button_get_active (togglebutton);
+ uris = get_excluded_locations (model);
- gconf_client_set_bool (baobab.gconf_client,
- BAOBAB_ENABLE_HOME_MONITOR_KEY,
- enable,
- NULL);
+ g_settings_set_strv (baobab.prefs_settings,
+ BAOBAB_SETTINGS_EXCLUDED_URIS,
+ (const gchar * const *) uris);
+ g_strfreev (uris);
}
static void
@@ -129,7 +115,7 @@ filechooser_response_cb (GtkDialog *dialog,
break;
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CLOSE:
- save_gconf (model);
+ save_excluded_uris (model);
default:
gtk_widget_destroy (GTK_WIDGET (dialog));
break;
@@ -328,11 +314,10 @@ baobab_prefs_dialog (void)
fill_props_model (model);
check_enablehome = GTK_WIDGET (gtk_builder_get_object (builder, "check_enable_home"));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_enablehome),
- baobab.monitor_home != NULL);
-
- g_signal_connect (check_enablehome, "toggled",
- G_CALLBACK (enable_home_cb), NULL);
+ g_settings_bind (baobab.prefs_settings,
+ BAOBAB_SETTINGS_MONITOR_HOME,
+ check_enablehome, "active",
+ G_SETTINGS_BIND_DEFAULT);
g_signal_connect (dlg, "response",
G_CALLBACK (filechooser_response_cb), model);
diff --git a/baobab/src/baobab-utils.c b/baobab/src/baobab-utils.c
index 3f09625..664c319 100644
--- a/baobab/src/baobab-utils.c
+++ b/baobab/src/baobab-utils.c
@@ -495,17 +495,6 @@ trash_file (GFile *file)
return TRUE;
}
-gchar *
-baobab_gconf_get_string_with_default (GConfClient *client,
- const gchar *key,
- const gchar *def)
-{
- gchar *val;
-
- val = gconf_client_get_string (client, key, NULL);
- return val ? val : g_strdup (def);
-}
-
gboolean
baobab_help_display (GtkWindow *parent,
const gchar *file_name,
diff --git a/baobab/src/baobab-utils.h b/baobab/src/baobab-utils.h
index 9b121a5..2742831 100644
--- a/baobab/src/baobab-utils.h
+++ b/baobab/src/baobab-utils.h
@@ -42,7 +42,6 @@ gboolean can_trash_file (GFile *file);
gboolean trash_file (GFile *file);
void set_ui_action_sens (const gchar *name, gboolean sens);
void set_ui_widget_sens (const gchar *name, gboolean sens);
-gchar *baobab_gconf_get_string_with_default (GConfClient *client, const gchar *key, const gchar *def);
gboolean baobab_help_display (GtkWindow *parent, const gchar *file_name, const gchar *link_id);
gboolean is_virtual_filesystem (GFile *file);
diff --git a/baobab/src/baobab.c b/baobab/src/baobab.c
index bc2d722..eca4bb5 100644
--- a/baobab/src/baobab.c
+++ b/baobab/src/baobab.c
@@ -25,7 +25,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gio/gio.h>
-#include <gconf/gconf-client.h>
#include <glibtop.h>
#include "baobab.h"
@@ -605,36 +604,6 @@ monitor_home (gboolean enable)
}
void
-baobab_set_toolbar_visible (gboolean visible)
-{
- GtkToggleAction *action;
-
- if (visible)
- gtk_widget_show (baobab.toolbar);
- else
- gtk_widget_hide (baobab.toolbar);
-
- /* make sure the check menu item is consistent */
- action = GTK_TOGGLE_ACTION (gtk_builder_get_object (baobab.main_ui, "view_tb"));
- gtk_toggle_action_set_active (action, visible);
-}
-
-void
-baobab_set_statusbar_visible (gboolean visible)
-{
- GtkToggleAction *action;
-
- if (visible)
- gtk_widget_show (baobab.statusbar);
- else
- gtk_widget_hide (baobab.statusbar);
-
- /* make sure the check menu item is consistent */
- action = GTK_TOGGLE_ACTION (gtk_builder_get_object (baobab.main_ui, "view_sb"));
- gtk_toggle_action_set_active (action, visible);
-}
-
-void
baobab_set_statusbar (const gchar *text)
{
gtk_statusbar_pop (GTK_STATUSBAR (baobab.statusbar), 1);
@@ -666,38 +635,6 @@ toolbar_reconfigured_cb (GtkToolItem *item,
}
static void
-baobab_toolbar_style (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
-{
- gchar *toolbar_setting;
-
- toolbar_setting = baobab_gconf_get_string_with_default (baobab.gconf_client,
- SYSTEM_TOOLBAR_STYLE_KEY,
- "both");
-
- if (!strcmp(toolbar_setting, "icons")) {
- gtk_toolbar_set_style (GTK_TOOLBAR(baobab.toolbar),
- GTK_TOOLBAR_ICONS);
- }
- else if (!strcmp(toolbar_setting, "both")) {
- gtk_toolbar_set_style (GTK_TOOLBAR(baobab.toolbar),
- GTK_TOOLBAR_BOTH);
- }
- else if (!strcmp(toolbar_setting, "both-horiz")) {
- gtk_toolbar_set_style (GTK_TOOLBAR(baobab.toolbar),
- GTK_TOOLBAR_BOTH_HORIZ);
- }
- else if (!strcmp(toolbar_setting, "text")) {
- gtk_toolbar_set_style (GTK_TOOLBAR(baobab.toolbar),
- GTK_TOOLBAR_TEXT);
- }
-
- g_free (toolbar_setting);
-}
-
-static void
baobab_create_toolbar (void)
{
GtkWidget *toolbar;
@@ -729,13 +666,18 @@ baobab_create_toolbar (void)
G_CALLBACK (toolbar_reconfigured_cb), baobab.spinner);
toolbar_reconfigured_cb (item, baobab.spinner);
- baobab_toolbar_style (NULL, 0, NULL, NULL);
-
- visible = gconf_client_get_bool (baobab.gconf_client,
- BAOBAB_TOOLBAR_VISIBLE_KEY,
- NULL);
-
- baobab_set_toolbar_visible (visible);
+ g_settings_bind (baobab.ui_settings,
+ BAOBAB_SETTINGS_TOOLBAR_VISIBLE,
+ baobab.toolbar, "visible",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (baobab.ui_settings,
+ BAOBAB_SETTINGS_TOOLBAR_VISIBLE,
+ GTK_TOGGLE_ACTION (gtk_builder_get_object (baobab.main_ui, "view_tb")), "active",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (baobab.desktop_settings,
+ DESKTOP_SETTINGS_TOOLBAR_STYLE,
+ baobab.toolbar, "toolbar-style",
+ G_SETTINGS_BIND_GET);
}
static void
@@ -750,24 +692,28 @@ baobab_create_statusbar (void)
return;
}
- visible = gconf_client_get_bool (baobab.gconf_client,
- BAOBAB_STATUSBAR_VISIBLE_KEY,
- NULL);
-
- baobab_set_statusbar_visible (visible);
+ g_settings_bind (baobab.ui_settings,
+ BAOBAB_SETTINGS_STATUSBAR_VISIBLE,
+ baobab.statusbar, "visible",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (baobab.ui_settings,
+ BAOBAB_SETTINGS_STATUSBAR_VISIBLE,
+ GTK_TOGGLE_ACTION (gtk_builder_get_object (baobab.main_ui, "view_sb")), "active",
+ G_SETTINGS_BIND_DEFAULT);
}
static void
-baobab_set_excluded_locations (GSList *excluded_uris)
+baobab_set_excluded_locations (gchar **uris)
{
GSList *l;
+ gint i;
g_slist_foreach (baobab.excluded_locations, (GFunc) g_object_unref, NULL);
g_slist_free (baobab.excluded_locations);
baobab.excluded_locations = NULL;
- for (l = excluded_uris; l != NULL; l = l->next) {
+ for (i = 0; uris[i] != NULL; ++i) {
baobab.excluded_locations = g_slist_prepend (baobab.excluded_locations,
- g_file_new_for_uri (l->data));
+ g_file_new_for_uri (uris[i]));
}
}
@@ -775,22 +721,22 @@ static void
store_excluded_locations (void)
{
GSList *l;
+ GPtrArray *uris;
GSList *uri_list = NULL;
- for (l = baobab.excluded_locations; l != NULL; l = l->next) {
- GSList *uri_list = NULL;
+ uris = g_ptr_array_new ();
- uri_list = g_slist_prepend (uri_list, g_file_get_uri(l->data));
+ for (l = baobab.excluded_locations; l != NULL; l = l->next) {
+ g_ptr_array_add (uris, g_file_get_uri (l->data));
}
- gconf_client_set_list (baobab.gconf_client,
- BAOBAB_EXCLUDED_DIRS_KEY,
- GCONF_VALUE_STRING,
- uri_list,
- NULL);
+ g_ptr_array_add (uris, NULL);
+
+ g_settings_set_strv (baobab.prefs_settings,
+ BAOBAB_SETTINGS_EXCLUDED_URIS,
+ (const gchar *const *) uris->pdata);
- g_slist_foreach (uri_list, (GFunc) g_free, NULL);
- g_slist_free (uri_list);
+ g_ptr_array_free (uris, TRUE);
}
static void
@@ -799,7 +745,7 @@ sanity_check_excluded_locations (void)
GFile *root;
GSList *l;
- /* Verify if gconf wrongly contains root dir exclusion, and remove it from gconf. */
+ /* Make sure the root dir is not excluded */
root = g_file_new_for_uri ("file:///");
for (l = baobab.excluded_locations; l != NULL; l = l->next) {
@@ -814,20 +760,15 @@ sanity_check_excluded_locations (void)
}
static void
-excluded_locations_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
+excluded_uris_changed (GSettings *settings,
+ const gchar *key,
+ gpointer user_data)
{
- GSList *uris;
+ gchar **uris;
- uris = gconf_client_get_list (client,
- BAOBAB_EXCLUDED_DIRS_KEY,
- GCONF_VALUE_STRING,
- NULL);
+ uris = g_settings_get_strv (settings, key);
baobab_set_excluded_locations (uris);
- g_slist_foreach (uris, (GFunc) g_free, NULL);
- g_slist_free (uris);
+ g_strfreev (uris);
baobab_update_filesystem ();
@@ -836,16 +777,49 @@ excluded_locations_changed (GConfClient *client,
}
static void
-baobab_monitor_home_toggled (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
+baobab_setup_excluded_locations (void)
+{
+ gchar **uris;
+
+ uris = g_settings_get_strv (baobab.prefs_settings,
+ BAOBAB_SETTINGS_EXCLUDED_URIS);
+ baobab_set_excluded_locations (uris);
+ g_strfreev (uris);
+
+ sanity_check_excluded_locations ();
+
+ g_signal_connect (baobab.prefs_settings,
+ "changed::" BAOBAB_SETTINGS_EXCLUDED_URIS,
+ G_CALLBACK (excluded_uris_changed),
+ NULL);
+}
+
+static void
+baobab_settings_monitor_home_changed (GSettings *settings,
+ const gchar *key,
+ gpointer user_data)
{
gboolean enable;
- enable = gconf_client_get_bool (baobab.gconf_client,
- BAOBAB_ENABLE_HOME_MONITOR_KEY,
- NULL);
+ enable = g_settings_get_boolean (settings, key);
+
+ monitor_home (enable);
+}
+
+static void
+baobab_setup_monitors (void)
+{
+ gboolean enable;
+
+ monitor_volume ();
+
+ enable = g_settings_get_boolean (baobab.prefs_settings,
+ BAOBAB_SETTINGS_MONITOR_HOME);
+
+ g_signal_connect (baobab.prefs_settings,
+ "changed::" BAOBAB_SETTINGS_MONITOR_HOME,
+ G_CALLBACK (baobab_settings_monitor_home_changed),
+ NULL);
monitor_home (enable);
}
@@ -853,9 +827,7 @@ baobab_monitor_home_toggled (GConfClient *client,
static void
baobab_init (void)
{
- GSList *uri_list;
GError *error = NULL;
- gboolean enable;
/* FileSystem usage */
baobab_get_filesystem (&baobab.fs);
@@ -873,53 +845,31 @@ baobab_init (void)
gtk_builder_connect_signals (baobab.main_ui, NULL);
+ /* Settings */
+ baobab.ui_settings = g_settings_new ("org.gnome.baobab.ui");
+ baobab.prefs_settings = g_settings_new ("org.gnome.baobab.preferences");
+ baobab.desktop_settings = g_settings_new ("org.gnome.desktop.interface");
+
/* Misc */
baobab.CONTENTS_CHANGED_DELAYED = FALSE;
baobab.STOP_SCANNING = TRUE;
baobab.show_allocated = TRUE;
baobab.is_local = TRUE;
- /* GConf */
- baobab.gconf_client = gconf_client_get_default ();
- gconf_client_add_dir (baobab.gconf_client, BAOBAB_KEY_DIR,
- GCONF_CLIENT_PRELOAD_NONE, NULL);
- gconf_client_notify_add (baobab.gconf_client, BAOBAB_EXCLUDED_DIRS_KEY, excluded_locations_changed,
- NULL, NULL, NULL);
- gconf_client_notify_add (baobab.gconf_client, SYSTEM_TOOLBAR_STYLE_KEY, baobab_toolbar_style,
- NULL, NULL, NULL);
- gconf_client_notify_add (baobab.gconf_client, BAOBAB_ENABLE_HOME_MONITOR_KEY, baobab_monitor_home_toggled,
- NULL, NULL, NULL);
-
- uri_list = gconf_client_get_list (baobab.gconf_client,
- BAOBAB_EXCLUDED_DIRS_KEY,
- GCONF_VALUE_STRING,
- NULL);
-
- baobab_set_excluded_locations (uri_list);
-
- g_slist_foreach (uri_list, (GFunc) g_free, NULL);
- g_slist_free (uri_list);
-
- sanity_check_excluded_locations ();
+ baobab_setup_excluded_locations ();
baobab_create_toolbar ();
-
baobab_create_statusbar ();
- monitor_volume ();
-
- enable = gconf_client_get_bool (baobab.gconf_client,
- BAOBAB_ENABLE_HOME_MONITOR_KEY,
- NULL);
-
- monitor_home (enable);
+ baobab_setup_monitors ();
}
static void
baobab_shutdown (void)
{
- if (baobab.current_location)
+ if (baobab.current_location) {
g_object_unref (baobab.current_location);
+ }
if (baobab.monitor_vol) {
g_object_unref (baobab.monitor_vol);
@@ -935,8 +885,16 @@ baobab_shutdown (void)
g_slist_foreach (baobab.excluded_locations, (GFunc) g_object_unref, NULL);
g_slist_free (baobab.excluded_locations);
- if (baobab.gconf_client) {
- g_object_unref (baobab.gconf_client);
+ if (baobab.ui_settings) {
+ g_object_unref (baobab.ui_settings);
+ }
+
+ if (baobab.prefs_settings) {
+ g_object_unref (baobab.prefs_settings);
+ }
+
+ if (baobab.desktop_settings) {
+ g_object_unref (baobab.desktop_settings);
}
}
@@ -1102,10 +1060,9 @@ set_active_chart (GtkWidget *chart)
gtk_widget_show_all (baobab.chart_frame);
- gconf_client_set_string (baobab.gconf_client,
- BAOBAB_ACTIVE_CHART_KEY,
- baobab.current_chart == baobab.rings_chart ? "rings" : "treemap",
- NULL);
+ g_settings_set_string (baobab.ui_settings,
+ BAOBAB_SETTINGS_ACTIVE_CHART,
+ baobab.current_chart == baobab.rings_chart ? "rings" : "treemap");
}
}
@@ -1211,9 +1168,8 @@ initialize_charts (void)
g_object_ref_sink (baobab.rings_chart);
baobab_chart_freeze_updates (baobab.rings_chart);
- saved_chart = baobab_gconf_get_string_with_default (baobab.gconf_client,
- BAOBAB_ACTIVE_CHART_KEY,
- "rings");
+ saved_chart = g_settings_get_string (baobab.ui_settings,
+ BAOBAB_SETTINGS_ACTIVE_CHART);
if (0 == g_ascii_strcasecmp (saved_chart, "treemap")) {
set_active_chart (baobab.treemap_chart);
diff --git a/baobab/src/baobab.h b/baobab/src/baobab.h
index 9bb1814..3011607 100644
--- a/baobab/src/baobab.h
+++ b/baobab/src/baobab.h
@@ -28,18 +28,16 @@
#include <glib.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
-#include <gconf/gconf-client.h>
struct BaobabSearchOpt;
/* Settings */
-#define BAOBAB_KEY_DIR "/apps/baobab"
-#define BAOBAB_TOOLBAR_VISIBLE_KEY BAOBAB_KEY_DIR "/ui/toolbar_visible"
-#define BAOBAB_STATUSBAR_VISIBLE_KEY BAOBAB_KEY_DIR "/ui/statusbar_visible"
-#define BAOBAB_ACTIVE_CHART_KEY BAOBAB_KEY_DIR "/ui/active_chart"
-#define BAOBAB_EXCLUDED_DIRS_KEY BAOBAB_KEY_DIR "/properties/skip_scan_uri_list"
-#define BAOBAB_ENABLE_HOME_MONITOR_KEY BAOBAB_KEY_DIR "/properties/enable_home_monitor"
-#define SYSTEM_TOOLBAR_STYLE_KEY "/desktop/gnome/interface/toolbar_style"
+#define BAOBAB_SETTINGS_TOOLBAR_VISIBLE "toolbar-visible"
+#define BAOBAB_SETTINGS_STATUSBAR_VISIBLE "statusbar-visible"
+#define BAOBAB_SETTINGS_ACTIVE_CHART "active-chart"
+#define BAOBAB_SETTINGS_MONITOR_HOME "monitor-home"
+#define BAOBAB_SETTINGS_EXCLUDED_URIS "excluded-uris"
+#define DESKTOP_SETTINGS_TOOLBAR_STYLE "toolbar-style"
typedef struct _BaobabChartMenu BaobabChartMenu;
@@ -92,8 +90,11 @@ struct _BaobabApplication {
GVolumeMonitor *monitor_vol;
GFileMonitor *monitor_home;
- GConfClient *gconf_client;
gint model_max_depth;
+
+ GSettings *ui_settings;
+ GSettings *prefs_settings;
+ GSettings *desktop_settings;
};
/* Application singleton */
diff --git a/baobab/src/callbacks.c b/baobab/src/callbacks.c
index 1f5b2b9..64c1cd6 100644
--- a/baobab/src/callbacks.c
+++ b/baobab/src/callbacks.c
@@ -27,7 +27,6 @@
#include <string.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <gconf/gconf-client.h>
#include <gio/gio.h>
#include "baobab.h"
@@ -271,36 +270,6 @@ on_ck_allocated_activate (GtkToggleAction *action,
}
void
-on_view_tb_activate (GtkToggleAction *action,
- gpointer user_data)
-{
- gboolean visible;
-
- visible = gtk_toggle_action_get_active (action);
- baobab_set_toolbar_visible (visible);
-
- gconf_client_set_bool (baobab.gconf_client,
- BAOBAB_TOOLBAR_VISIBLE_KEY,
- visible,
- NULL);
-}
-
-void
-on_view_sb_activate (GtkToggleAction *action,
- gpointer user_data)
-{
- gboolean visible;
-
- visible = gtk_toggle_action_get_active (action);
- baobab_set_statusbar_visible (visible);
-
- gconf_client_set_bool (baobab.gconf_client,
- BAOBAB_STATUSBAR_VISIBLE_KEY,
- visible,
- NULL);
-}
-
-void
on_helpcontents_activate (GtkAction *a, gpointer user_data)
{
baobab_help_display (GTK_WINDOW (baobab.window), "baobab", NULL);
diff --git a/baobab/src/callbacks.h b/baobab/src/callbacks.h
index 699b636..0f51796 100644
--- a/baobab/src/callbacks.h
+++ b/baobab/src/callbacks.h
@@ -48,8 +48,6 @@ void list_all_cb (GtkMenuItem *pmenu, gpointer dummy);
void on_pref_menu (GtkAction *a, gpointer user_data);
void on_tb_scan_remote_clicked (GtkToolButton *toolbutton, gpointer user_data);
void on_menu_scan_rem_activate (GtkMenuItem *menuitem, gpointer user_data);
-void on_view_tb_activate (GtkToggleAction *action, gpointer user_data);
-void on_view_sb_activate (GtkToggleAction *action, gpointer user_data);
void on_ck_allocated_activate (GtkToggleAction *action, gpointer user_data);
void on_helpcontents_activate (GtkAction *a, gpointer user_data);
void on_tv_selection_changed (GtkTreeSelection *selection, gpointer user_data);
diff --git a/configure.ac b/configure.ac
index 3785973..68b5e5f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -110,6 +110,10 @@ PKG_CHECK_MODULES(GCONF, gconf-2.0)
AC_SUBST(GCONF_CFLAGS)
AC_SUBST(GCONF_LIBS)
+PKG_CHECK_MODULES(DESKTOP_GSETTINGS, gsettings-desktop-schemas)
+AC_SUBST(DESKTOP_GSETTINGS)
+AC_SUBST(DESKTOP_GSETTINGS)
+
# For each cycle:
# first release: increment major += 1, minor = micro = 0;
# each release before API freeze: minor += 1;
@@ -144,6 +148,8 @@ AS_IF([test "x$GCONFTOOL" = "xno"],
[AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])]
)
+GLIB_GSETTINGS
+
AM_GCONF_SOURCE_2
AC_ARG_ENABLE([gdict-applet],
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2661432..7da4b3e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -3,7 +3,7 @@
baobab/data/baobab.desktop.in.in
[type: gettext/glade]baobab/data/baobab-dialog-scan-props.ui
[type: gettext/glade]baobab/data/baobab-main-window.ui
-baobab/data/baobab.schemas.in
+baobab/data/org.gnome.baobab.gschema.in
baobab/src/baobab.c
baobab/src/baobab-chart.c
baobab/src/baobab-prefs.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]