[gthumb] first batch of changes to port the core to GSettings
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] first batch of changes to port the core to GSettings
- Date: Sun, 13 Nov 2011 18:12:27 +0000 (UTC)
commit 2eaad77cdc058b5ae768aae6a954a3d7ab38ab57
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Nov 13 15:12:31 2011 +0100
first batch of changes to port the core to GSettings
gthumb/Makefile.am | 2 -
gthumb/dlg-personalize-filters.c | 8 +-
gthumb/dlg-preferences-extensions.c | 68 ++++----
gthumb/dlg-preferences.c | 65 ++++---
gthumb/gnome-desktop-thumbnail.c | 2 -
gthumb/gth-browser-actions-callbacks.c | 36 +++-
gthumb/gth-browser.c | 307 ++++++++++++++++----------------
gthumb/gth-extensions.c | 63 ++++---
gthumb/gth-extensions.h | 5 +-
gthumb/gth-file-list.c | 24 ++-
gthumb/gth-file-source-vfs.c | 11 +-
gthumb/gth-main.c | 56 +++---
gthumb/gth-preferences.c | 129 ++++++-------
gthumb/gth-source-tree.c | 15 ++-
gthumb/main-migrate-catalogs.c | 73 +++++---
gthumb/main.c | 12 +-
16 files changed, 471 insertions(+), 405 deletions(-)
---
diff --git a/gthumb/Makefile.am b/gthumb/Makefile.am
index 6344504..69640bc 100644
--- a/gthumb/Makefile.am
+++ b/gthumb/Makefile.am
@@ -28,7 +28,6 @@ PUBLIC_HEADER_FILES = \
dom.h \
egg-macros.h \
eggfileformatchooser.h \
- gconf-utils.h \
gedit-message-area.h \
gio-utils.h \
glib-utils.h \
@@ -154,7 +153,6 @@ gthumb_SOURCES = \
dlg-preferences-extensions.c \
dlg-sort-order.c \
dom.c \
- gconf-utils.c \
gio-utils.c \
glib-utils.c \
gsignature.c \
diff --git a/gthumb/dlg-personalize-filters.c b/gthumb/dlg-personalize-filters.c
index 14713c2..32cfb75 100644
--- a/gthumb/dlg-personalize-filters.c
+++ b/gthumb/dlg-personalize-filters.c
@@ -22,7 +22,6 @@
#include <config.h>
#include <gtk/gtk.h>
#include "dlg-personalize-filters.h"
-#include "gconf-utils.h"
#include "glib-utils.h"
#include "gth-filter-editor-dialog.h"
#include "gth-main.h"
@@ -46,6 +45,7 @@ enum {
typedef struct {
GthBrowser *browser;
GtkBuilder *builder;
+ GSettings *settings;
GtkWidget *dialog;
GtkWidget *list_view;
GtkWidget *general_filter_combobox;
@@ -69,6 +69,7 @@ destroy_cb (GtkWidget *widget,
_g_string_list_free (data->general_tests);
g_object_unref (data->builder);
+ g_object_unref (data->settings);
g_free (data);
}
@@ -489,7 +490,7 @@ general_filter_changed_cb (GtkComboBox *widget,
int idx;
idx = gtk_combo_box_get_active (widget);
- eel_gconf_set_string (PREF_GENERAL_FILTER, g_list_nth (data->general_tests, idx)->data);
+ g_settings_set_string (data->settings, PREF_BROWSER_GENERAL_FILTER, g_list_nth (data->general_tests, idx)->data);
}
@@ -510,6 +511,7 @@ dlg_personalize_filters (GthBrowser *browser)
data = g_new0 (DialogData, 1);
data->browser = browser;
data->builder = _gtk_builder_new_from_file ("personalize-filters.ui", NULL);
+ data->settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
/* Get the widgets. */
@@ -520,7 +522,7 @@ dlg_personalize_filters (GthBrowser *browser)
/* Set widgets data. */
tests = gth_main_get_registered_objects_id (GTH_TYPE_TEST);
- general_filter = eel_gconf_get_string (PREF_GENERAL_FILTER, DEFAULT_GENERAL_FILTER);
+ general_filter = g_settings_get_string (data->settings, PREF_BROWSER_GENERAL_FILTER);
active_filter = 0;
data->general_filter_combobox = gtk_combo_box_text_new ();
diff --git a/gthumb/dlg-preferences-extensions.c b/gthumb/dlg-preferences-extensions.c
index e0392fa..30739b0 100644
--- a/gthumb/dlg-preferences-extensions.c
+++ b/gthumb/dlg-preferences-extensions.c
@@ -21,7 +21,6 @@
#include <config.h>
#include <gtk/gtk.h>
-#include "gconf-utils.h"
#include "glib-utils.h"
#include "gth-browser.h"
#include "gth-main.h"
@@ -83,11 +82,12 @@ static ExtensionCategory extension_category[] = {
typedef struct {
GthBrowser *browser;
GtkBuilder *builder;
+ GSettings *settings;
GtkWidget *dialog;
GtkWidget *list_view;
GtkListStore *list_store;
GtkTreeModel *model_filter;
- GSList *active_extensions;
+ GList *active_extensions;
char *current_category;
gboolean enabled_disabled_cardinality_changed;
} BrowserData;
@@ -97,8 +97,9 @@ typedef struct {
static void
browser_data_free (BrowserData *data)
{
- g_slist_foreach (data->active_extensions, (GFunc) g_free, NULL);
- g_slist_free (data->active_extensions);
+ g_list_foreach (data->active_extensions, (GFunc) g_free, NULL);
+ g_list_free (data->active_extensions);
+ g_object_unref (data->settings);
g_object_unref (data->builder);
g_free (data->current_category);
g_free (data);
@@ -106,17 +107,17 @@ browser_data_free (BrowserData *data)
static gboolean
-list_equal (GSList *list1,
- GSList *list2)
+list_equal (GList *list1,
+ GList *list2)
{
- GSList *sscan1;
+ GList *sscan1;
- if (g_slist_length (list1) != g_slist_length (list2))
+ if (g_list_length (list1) != g_list_length (list2))
return FALSE;
for (sscan1 = list1; sscan1; sscan1 = sscan1->next) {
- char *name1 = sscan1->data;
- GSList *sscan2;
+ char *name1 = sscan1->data;
+ GList *sscan2;
for (sscan2 = list2; sscan2; sscan2 = sscan2->next) {
char *name2 = sscan2->data;
@@ -626,20 +627,20 @@ extensions__dlg_preferences_construct_cb (GtkWidget *dialog,
GthBrowser *browser,
GtkBuilder *dialog_builder)
{
- BrowserData *data;
- GtkWidget *notebook;
- GtkWidget *page;
- GthExtensionManager *manager;
- GList *extensions;
- GList *scan;
- GSList *all_active_extensions;
- GSList *s_scan;
- GtkTreePath *first;
- int i;
- GtkWidget *label;
+ BrowserData *data;
+ GtkWidget *notebook;
+ GtkWidget *page;
+ GthExtensionManager *manager;
+ GList *extensions;
+ GList *scan;
+ char **all_active_extensions;
+ int i;
+ GtkTreePath *first;
+ GtkWidget *label;
data = g_new0 (BrowserData, 1);
data->builder = _gtk_builder_new_from_file ("extensions-preferences.ui", NULL);
+ data->settings = g_settings_new (GTHUMB_GENERAL_SCHEMA);
data->dialog = dialog;
data->enabled_disabled_cardinality_changed = FALSE;
@@ -647,20 +648,19 @@ extensions__dlg_preferences_construct_cb (GtkWidget *dialog,
manager = gth_main_get_default_extension_manager ();
data->active_extensions = NULL;
- all_active_extensions = eel_gconf_get_string_list (PREF_ACTIVE_EXTENSIONS);
- for (s_scan = all_active_extensions; s_scan; s_scan = s_scan->next) {
- char *name = s_scan->data;
+ all_active_extensions = g_settings_get_strv (data->settings, PREF_GENERAL_ACTIVE_EXTENSIONS);
+ for (i = 0; all_active_extensions[i] != NULL; i++) {
+ char *name = all_active_extensions[i];
GthExtensionDescription *description;
description = gth_extension_manager_get_description (manager, name);
if ((description == NULL) || description->mandatory || description->hidden)
continue;
- data->active_extensions = g_slist_prepend (data->active_extensions, g_strdup (name));
+ data->active_extensions = g_list_prepend (data->active_extensions, g_strdup (name));
}
- data->active_extensions = g_slist_reverse (data->active_extensions);
- g_slist_foreach (all_active_extensions, (GFunc) g_free, NULL);
- g_slist_free (all_active_extensions);
+ data->active_extensions = g_list_reverse (data->active_extensions);
+ g_strfreev (all_active_extensions);
notebook = _gtk_builder_get_widget (dialog_builder, "notebook");
page = _gtk_builder_get_widget (data->builder, "preferences_page");
@@ -784,7 +784,7 @@ extensions__dlg_preferences_apply (GtkWidget *dialog,
GtkBuilder *dialog_builder)
{
BrowserData *data;
- GSList *active_extensions;
+ GList *active_extensions;
GthExtensionManager *manager;
GList *names;
GList *scan;
@@ -804,10 +804,10 @@ extensions__dlg_preferences_apply (GtkWidget *dialog,
continue;
if (gth_extension_description_is_active (description))
- active_extensions = g_slist_prepend (active_extensions, g_strdup (name));
+ active_extensions = g_list_prepend (active_extensions, g_strdup (name));
}
- active_extensions = g_slist_reverse (active_extensions);
- eel_gconf_set_string_list (PREF_ACTIVE_EXTENSIONS, active_extensions);
+ active_extensions = g_list_reverse (active_extensions);
+ _g_settings_set_string_list (data->settings, PREF_GENERAL_ACTIVE_EXTENSIONS, active_extensions);
if (! list_equal (active_extensions, data->active_extensions)) {
GtkWidget *dialog;
@@ -828,6 +828,6 @@ extensions__dlg_preferences_apply (GtkWidget *dialog,
gth_quit (TRUE);
}
- g_slist_foreach (active_extensions, (GFunc) g_free, NULL);
- g_slist_free (active_extensions);
+ g_list_foreach (active_extensions, (GFunc) g_free, NULL);
+ g_list_free (active_extensions);
}
diff --git a/gthumb/dlg-preferences.c b/gthumb/dlg-preferences.c
index 3547a01..73e6212 100644
--- a/gthumb/dlg-preferences.c
+++ b/gthumb/dlg-preferences.c
@@ -22,7 +22,6 @@
#include <config.h>
#include <gtk/gtk.h>
#include "dlg-preferences.h"
-#include "gconf-utils.h"
#include "gth-browser.h"
#include "gth-enum-types.h"
#include "gth-file-source-vfs.h"
@@ -42,6 +41,9 @@ typedef struct {
GtkBuilder *builder;
GtkWidget *dialog;
GtkWidget *thumbnail_caption_chooser;
+ GSettings *general_settings;
+ GSettings *browser_settings;
+ GSettings *messages_settings;
} DialogData;
static int thumb_size[] = { 48, 64, 85, 95, 112, 128, 164, 200, 256 };
@@ -65,15 +67,15 @@ apply_changes (DialogData *data)
{
/* Startup dir. */
- eel_gconf_set_boolean (PREF_GO_TO_LAST_LOCATION, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("go_to_last_location_radiobutton"))));
- eel_gconf_set_boolean (PREF_USE_STARTUP_LOCATION, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("use_startup_location_radiobutton"))));
- eel_gconf_set_boolean (PREF_STORE_METADATA_IN_FILES, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("embed_metadata_checkbutton"))));
+ g_settings_set_boolean (data->browser_settings, PREF_BROWSER_GO_TO_LAST_LOCATION, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("go_to_last_location_radiobutton"))));
+ g_settings_set_boolean (data->browser_settings, PREF_BROWSER_USE_STARTUP_LOCATION, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("use_startup_location_radiobutton"))));
+ g_settings_set_boolean (data->general_settings, PREF_GENERAL_STORE_METADATA_IN_FILES, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("embed_metadata_checkbutton"))));
- if (eel_gconf_get_boolean (PREF_USE_STARTUP_LOCATION, FALSE)) {
+ if (g_settings_get_boolean (data->browser_settings, PREF_BROWSER_USE_STARTUP_LOCATION)) {
char *location;
location = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (GET_WIDGET ("startup_dir_filechooserbutton")));
- eel_gconf_set_path (PREF_STARTUP_LOCATION, location);
+ _g_settings_set_uri (data->browser_settings, PREF_BROWSER_STARTUP_LOCATION, location);
gth_pref_set_startup_location (location);
g_free (location);
}
@@ -88,6 +90,10 @@ destroy_cb (GtkWidget *widget,
{
apply_changes (data);
gth_browser_set_dialog (data->browser, "preferences", NULL);
+
+ g_object_unref (data->general_settings);
+ g_object_unref (data->browser_settings);
+ g_object_unref (data->messages_settings);
g_object_unref (data->builder);
g_free (data);
}
@@ -144,7 +150,7 @@ static void
toolbar_style_changed_cb (GtkWidget *widget,
DialogData *data)
{
- eel_gconf_set_enum (PREF_UI_TOOLBAR_STYLE, GTH_TYPE_TOOLBAR_STYLE, gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("toolbar_style_combobox"))));
+ g_settings_set_enum (data->browser_settings, PREF_BROWSER_TOOLBAR_STYLE, gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("toolbar_style_combobox"))));
}
@@ -152,7 +158,7 @@ static void
thumbnails_pane_orientation_changed_cb (GtkWidget *widget,
DialogData *data)
{
- eel_gconf_set_enum (PREF_UI_VIEWER_THUMBNAILS_ORIENT, GTK_TYPE_ORIENTATION, gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnails_pane_orient_combobox"))));
+ g_settings_set_enum (data->browser_settings, PREF_BROWSER_VIEWER_THUMBNAILS_ORIENT, gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnails_pane_orient_combobox"))));
}
@@ -160,7 +166,7 @@ static void
confirm_deletion_toggled_cb (GtkToggleButton *button,
DialogData *data)
{
- eel_gconf_set_boolean (PREF_MSG_CONFIRM_DELETION, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("confirm_deletion_checkbutton"))));
+ g_settings_set_boolean (data->messages_settings, PREF_MSG_CONFIRM_DELETION, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("confirm_deletion_checkbutton"))));
}
@@ -168,7 +174,7 @@ static void
ask_to_save_toggled_cb (GtkToggleButton *button,
DialogData *data)
{
- eel_gconf_set_boolean (PREF_MSG_SAVE_MODIFIED_IMAGE, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("ask_to_save_checkbutton"))));
+ g_settings_set_boolean (data->messages_settings, PREF_MSG_SAVE_MODIFIED_IMAGE, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("ask_to_save_checkbutton"))));
}
@@ -176,7 +182,7 @@ static void
thumbnail_size_changed_cb (GtkWidget *widget,
DialogData *data)
{
- eel_gconf_set_integer (PREF_THUMBNAIL_SIZE, thumb_size[gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnail_size_combobox")))]);
+ g_settings_set_int (data->browser_settings, PREF_BROWSER_THUMBNAIL_SIZE, thumb_size[gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnail_size_combobox")))]);
}
@@ -184,7 +190,7 @@ static void
fast_file_type_toggled_cb (GtkToggleButton *button,
DialogData *data)
{
- eel_gconf_set_boolean (PREF_FAST_FILE_TYPE, ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("slow_mime_type_checkbutton"))));
+ g_settings_set_boolean (data->browser_settings, PREF_BROWSER_FAST_FILE_TYPE, ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("slow_mime_type_checkbutton"))));
}
@@ -195,7 +201,7 @@ thumbnail_caption_chooser_changed_cb (GthMetadataChooser *chooser,
char *attributes;
attributes = gth_metadata_chooser_get_selection (chooser);
- eel_gconf_set_string (PREF_THUMBNAIL_CAPTION, attributes);
+ g_settings_set_string (data->browser_settings, PREF_BROWSER_THUMBNAIL_CAPTION, attributes);
g_free (attributes);
}
@@ -218,25 +224,25 @@ dlg_preferences (GthBrowser *browser)
data->browser = browser;
data->builder = _gtk_builder_new_from_file ("preferences.ui", NULL);
data->dialog = GET_WIDGET ("preferences_dialog");
+ data->general_settings = g_settings_new (GTHUMB_GENERAL_SCHEMA);
+ data->browser_settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
+ data->messages_settings = g_settings_new (GTHUMB_MESSAGES_SCHEMA);
gth_browser_set_dialog (browser, "preferences", data->dialog);
- eel_gconf_preload_cache ("/apps/gthumb/browser", GCONF_CLIENT_PRELOAD_ONELEVEL);
- eel_gconf_preload_cache ("/apps/gthumb/ui", GCONF_CLIENT_PRELOAD_ONELEVEL);
-
/* caption list */
data->thumbnail_caption_chooser = gth_metadata_chooser_new (GTH_METADATA_ALLOW_IN_FILE_LIST);
gtk_widget_show (data->thumbnail_caption_chooser);
gtk_container_add (GTK_CONTAINER (GET_WIDGET ("caption_scrolledwindow")), data->thumbnail_caption_chooser);
- current_caption = eel_gconf_get_string (PREF_THUMBNAIL_CAPTION, DEFAULT_THUMBNAIL_CAPTION);
+ current_caption = g_settings_get_string (data->browser_settings, PREF_BROWSER_THUMBNAIL_CAPTION);
gth_metadata_chooser_set_selection (GTH_METADATA_CHOOSER (data->thumbnail_caption_chooser), current_caption);
g_free (current_caption);
/* * general */
- if (eel_gconf_get_boolean (PREF_USE_STARTUP_LOCATION, FALSE))
+ if (g_settings_get_boolean (data->browser_settings, PREF_BROWSER_USE_STARTUP_LOCATION))
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("use_startup_location_radiobutton")), TRUE);
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("go_to_last_location_radiobutton")), TRUE);
@@ -246,7 +252,7 @@ dlg_preferences (GthBrowser *browser)
gtk_widget_set_sensitive (GET_WIDGET ("set_to_current_button"), FALSE);
}
- startup_location = eel_gconf_get_path (PREF_STARTUP_LOCATION, NULL);
+ startup_location = _g_settings_get_uri (data->browser_settings, PREF_BROWSER_STARTUP_LOCATION);
if (startup_location == NULL)
startup_location = g_strdup (get_home_uri ());
file_source = gth_main_get_file_source_for_uri (startup_location);
@@ -267,17 +273,24 @@ dlg_preferences (GthBrowser *browser)
g_object_unref (file_source);
g_free (startup_location);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("confirm_deletion_checkbutton")), eel_gconf_get_boolean (PREF_MSG_CONFIRM_DELETION, DEFAULT_MSG_CONFIRM_DELETION));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("ask_to_save_checkbutton")), eel_gconf_get_boolean (PREF_MSG_SAVE_MODIFIED_IMAGE, DEFAULT_MSG_SAVE_MODIFIED_IMAGE));
- gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("toolbar_style_combobox")), eel_gconf_get_enum (PREF_UI_TOOLBAR_STYLE, GTH_TYPE_TOOLBAR_STYLE, GTH_TOOLBAR_STYLE_SYSTEM));
- gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnails_pane_orient_combobox")), eel_gconf_get_enum (PREF_UI_VIEWER_THUMBNAILS_ORIENT, GTK_TYPE_ORIENTATION, GTK_ORIENTATION_HORIZONTAL));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("confirm_deletion_checkbutton")),
+ g_settings_get_boolean (data->messages_settings, PREF_MSG_CONFIRM_DELETION));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("ask_to_save_checkbutton")),
+ g_settings_get_boolean (data->messages_settings, PREF_MSG_SAVE_MODIFIED_IMAGE));
+ gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("toolbar_style_combobox")),
+ g_settings_get_enum (data->browser_settings, PREF_BROWSER_TOOLBAR_STYLE));
+ gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnails_pane_orient_combobox")),
+ g_settings_get_enum (data->browser_settings, PREF_BROWSER_VIEWER_THUMBNAILS_ORIENT));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("embed_metadata_checkbutton")), eel_gconf_get_boolean (PREF_STORE_METADATA_IN_FILES, TRUE));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("embed_metadata_checkbutton")),
+ g_settings_get_boolean (data->general_settings, PREF_GENERAL_STORE_METADATA_IN_FILES));
/* * browser */
- gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnail_size_combobox")), get_idx_from_size (eel_gconf_get_integer (PREF_THUMBNAIL_SIZE, DEFAULT_THUMBNAIL_SIZE)));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("slow_mime_type_checkbutton")), ! eel_gconf_get_boolean (PREF_FAST_FILE_TYPE, DEFAULT_FAST_FILE_TYPE));
+ gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnail_size_combobox")),
+ get_idx_from_size (g_settings_get_int (data->browser_settings, PREF_BROWSER_THUMBNAIL_SIZE)));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("slow_mime_type_checkbutton")),
+ ! g_settings_get_boolean (data->browser_settings, PREF_BROWSER_FAST_FILE_TYPE));
gth_hook_invoke ("dlg-preferences-construct", data->dialog, data->browser, data->builder);
diff --git a/gthumb/gnome-desktop-thumbnail.c b/gthumb/gnome-desktop-thumbnail.c
index 1c19adf..0e08e80 100644
--- a/gthumb/gnome-desktop-thumbnail.c
+++ b/gthumb/gnome-desktop-thumbnail.c
@@ -58,8 +58,6 @@
#include <png.h>
#define GDK_PIXBUF_ENABLE_BACKEND
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gconf/gconf.h>
-#include <gconf/gconf-client.h>
#include <glib/gstdio.h>
#define GNOME_DESKTOP_USE_UNSTABLE_API
#include "gnome-desktop-thumbnail.h"
diff --git a/gthumb/gth-browser-actions-callbacks.c b/gthumb/gth-browser-actions-callbacks.c
index 5cf01c7..b5058b6 100644
--- a/gthumb/gth-browser-actions-callbacks.c
+++ b/gthumb/gth-browser-actions-callbacks.c
@@ -24,7 +24,6 @@
#include "dlg-personalize-filters.h"
#include "dlg-preferences.h"
#include "dlg-sort-order.h"
-#include "gconf-utils.h"
#include "glib-utils.h"
#include "gth-browser.h"
#include "gth-file-list.h"
@@ -200,7 +199,12 @@ void
gth_browser_activate_action_view_toolbar (GtkAction *action,
GthBrowser *browser)
{
- eel_gconf_set_boolean (PREF_UI_TOOLBAR_VISIBLE, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+ GSettings *settings;
+
+ settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
+ g_settings_set_boolean (settings, PREF_BROWSER_TOOLBAR_VISIBLE, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+
+ g_object_unref (settings);
}
@@ -208,7 +212,12 @@ void
gth_browser_activate_action_view_show_hidden_files (GtkAction *action,
GthBrowser *browser)
{
- eel_gconf_set_boolean (PREF_SHOW_HIDDEN_FILES, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+ GSettings *settings;
+
+ settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
+ g_settings_set_boolean (settings, PREF_BROWSER_SHOW_HIDDEN_FILES, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+
+ g_object_unref (settings);
}
@@ -216,7 +225,12 @@ void
gth_browser_activate_action_view_statusbar (GtkAction *action,
GthBrowser *browser)
{
- eel_gconf_set_boolean (PREF_UI_STATUSBAR_VISIBLE, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+ GSettings *settings;
+
+ settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
+ g_settings_set_boolean (settings, PREF_BROWSER_STATUSBAR_VISIBLE, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+
+ g_object_unref (settings);
}
@@ -224,7 +238,12 @@ void
gth_browser_activate_action_view_sidebar (GtkAction *action,
GthBrowser *browser)
{
- eel_gconf_set_boolean (PREF_UI_SIDEBAR_VISIBLE, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+ GSettings *settings;
+
+ settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
+ g_settings_set_boolean (settings, PREF_BROWSER_SIDEBAR_VISIBLE, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+
+ g_object_unref (settings);
}
@@ -232,7 +251,12 @@ void
gth_browser_activate_action_view_thumbnail_list (GtkAction *action,
GthBrowser *browser)
{
- eel_gconf_set_boolean (PREF_UI_THUMBNAIL_LIST_VISIBLE, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+ GSettings *settings;
+
+ settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
+ g_settings_set_boolean (settings, PREF_BROWSER_THUMBNAIL_LIST_VISIBLE, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+
+ g_object_unref (settings);
}
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index a1860f0..ad33f0e 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -24,7 +24,6 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "dlg-personalize-filters.h"
-#include "gconf-utils.h"
#include "glib-utils.h"
#include "gtk-utils.h"
#include "gth-browser.h"
@@ -64,10 +63,6 @@
#define GTH_BROWSER_CALLBACK(f) ((GthBrowserCallback) (f))
#define MAX_HISTORY_LENGTH 15
-#define GCONF_NOTIFICATIONS 13
-#define DEF_SIDEBAR_WIDTH 255
-#define DEF_VIEWER_SIDEBAR_WIDTH 285
-#define DEF_THUMBNAIL_SIZE 128
#define LOAD_FILE_DELAY 150
#define HIDE_MOUSE_DELAY 1000
#define MOTION_THRESHOLD 0
@@ -145,7 +140,6 @@ struct _GthBrowserPrivate {
GFile *monitor_location;
gboolean activity_ref;
GthIconCache *menu_icon_cache;
- guint cnxn_id[GCONF_NOTIFICATIONS];
GthFileDataSort *current_sort_type;
gboolean current_sort_inverse;
GthFileDataSort *default_sort_type;
@@ -170,6 +164,12 @@ struct _GthBrowserPrivate {
gboolean recalc_location_free_space;
gboolean shrink_wrap_viewer;
+ /* settings */
+
+ GSettings *browser_settings;
+ GSettings *messages_settings;
+ GSettings *desktop_interface_settings;
+
/* fulscreen */
gboolean fullscreen;
@@ -1323,7 +1323,7 @@ _gth_browser_get_list_attributes (GthBrowser *browser,
/* attributes required for the thumbnail caption */
- thumbnail_caption = eel_gconf_get_string (PREF_THUMBNAIL_CAPTION, DEFAULT_THUMBNAIL_CAPTION);
+ thumbnail_caption = g_settings_get_string (browser->priv->browser_settings, PREF_BROWSER_THUMBNAIL_CAPTION);
if ((thumbnail_caption[0] != '\0') && (strcmp (thumbnail_caption, "none") != 0)) {
g_string_append (attributes, ",");
g_string_append (attributes, thumbnail_caption);
@@ -2121,18 +2121,18 @@ _gth_browser_close_final_step (gpointer user_data)
&height);
if (size_set) {
- eel_gconf_set_integer (PREF_UI_WINDOW_WIDTH, width);
- eel_gconf_set_integer (PREF_UI_WINDOW_HEIGHT, height);
+ g_settings_set_int (browser->priv->browser_settings, PREF_BROWSER_WINDOW_WIDTH, width);
+ g_settings_set_int (browser->priv->browser_settings, PREF_BROWSER_WINDOW_HEIGHT, height);
}
}
gtk_widget_get_allocation (browser->priv->browser_sidebar, &allocation);
if (allocation.width > MIN_SIDEBAR_SIZE)
- eel_gconf_set_integer (PREF_UI_BROWSER_SIDEBAR_WIDTH, allocation.width);
+ g_settings_set_int (browser->priv->browser_settings, PREF_BROWSER_BROWSER_SIDEBAR_WIDTH, allocation.width);
gtk_widget_get_allocation (browser->priv->viewer_sidebar_alignment, &allocation);
if (allocation.width > MIN_SIDEBAR_SIZE)
- eel_gconf_set_integer (PREF_UI_VIEWER_SIDEBAR_WIDTH, allocation.width);
+ g_settings_set_int (browser->priv->browser_settings, PREF_BROWSER_VIEWER_SIDEBAR_WIDTH, allocation.width);
}
/**/
@@ -2142,27 +2142,27 @@ _gth_browser_close_final_step (gpointer user_data)
gth_hook_invoke ("gth-browser-close", browser);
if (gtk_widget_get_realized (GTK_WIDGET (browser)) && last_window) {
- if (eel_gconf_get_boolean (PREF_GO_TO_LAST_LOCATION, TRUE)
+ if (g_settings_get_boolean (browser->priv->browser_settings, PREF_BROWSER_GO_TO_LAST_LOCATION)
&& (browser->priv->location != NULL))
{
char *uri;
uri = g_file_get_uri (browser->priv->location->file);
- eel_gconf_set_path (PREF_STARTUP_LOCATION, uri);
+ _g_settings_set_uri (browser->priv->browser_settings, PREF_BROWSER_STARTUP_LOCATION, uri);
g_free (uri);
if (browser->priv->current_file != NULL) {
uri = g_file_get_uri (browser->priv->current_file->file);
- eel_gconf_set_path (PREF_STARTUP_CURRENT_FILE, uri);
+ _g_settings_set_uri (browser->priv->browser_settings, PREF_BROWSER_STARTUP_CURRENT_FILE, uri);
g_free (uri);
}
else
- eel_gconf_set_path (PREF_STARTUP_CURRENT_FILE, "");
+ _g_settings_set_uri (browser->priv->browser_settings, PREF_BROWSER_STARTUP_CURRENT_FILE, "");
}
if (browser->priv->default_sort_type != NULL) {
- eel_gconf_set_string (PREF_SORT_TYPE, browser->priv->default_sort_type->name);
- eel_gconf_set_boolean (PREF_SORT_INVERSE, browser->priv->default_sort_inverse);
+ g_settings_set_string (browser->priv->browser_settings, PREF_BROWSER_SORT_TYPE, browser->priv->default_sort_type->name);
+ g_settings_set_boolean (browser->priv->browser_settings, PREF_BROWSER_SORT_INVERSE, browser->priv->default_sort_inverse);
}
gth_hook_invoke ("gth-browser-close-last-window", browser);
@@ -2214,18 +2214,16 @@ static void _gth_browser_cancel (GthBrowser *browser,
static void
_gth_browser_real_close (GthBrowser *browser)
{
- int i;
-
if (browser->priv->closing)
return;
browser->priv->closing = TRUE;
- /* remove gconf notifications */
+ /* disconnect from the settings */
- for (i = 0; i < GCONF_NOTIFICATIONS; i++)
- if (browser->priv->cnxn_id[i] != 0)
- eel_gconf_notification_remove (browser->priv->cnxn_id[i]);
+ g_signal_handlers_disconnect_by_data (browser->priv->browser_settings, browser);
+ g_signal_handlers_disconnect_by_data (browser->priv->messages_settings, browser);
+ g_signal_handlers_disconnect_by_data (browser->priv->desktop_interface_settings, browser);
/* disconnect from the monitor */
@@ -2278,7 +2276,7 @@ _gth_browser_close (GthWindow *window)
return;
}
- if (eel_gconf_get_boolean (PREF_MSG_SAVE_MODIFIED_IMAGE, DEFAULT_MSG_SAVE_MODIFIED_IMAGE)
+ if (g_settings_get_boolean (browser->priv->messages_settings, PREF_MSG_SAVE_MODIFIED_IMAGE)
&& gth_browser_get_file_modified (browser))
{
gth_browser_ask_whether_to_save (browser,
@@ -2466,7 +2464,7 @@ _gth_browser_set_current_page (GthWindow *window,
if (page == gth_window_get_current_page (window))
return;
- if (eel_gconf_get_boolean (PREF_MSG_SAVE_MODIFIED_IMAGE, DEFAULT_MSG_SAVE_MODIFIED_IMAGE)
+ if (g_settings_get_boolean (browser->priv->messages_settings, PREF_MSG_SAVE_MODIFIED_IMAGE)
&& gth_browser_get_file_modified (browser))
{
gth_browser_ask_whether_to_save (browser,
@@ -2483,6 +2481,9 @@ gth_browser_finalize (GObject *object)
{
GthBrowser *browser = GTH_BROWSER (object);
+ _g_object_unref (&browser->priv->browser_settings);
+ _g_object_unref (&browser->priv->messages_settings);
+ _g_object_unref (&browser->priv->desktop_interface_settings);
g_free (browser->priv->location_free_space);
_g_object_unref (browser->priv->location_source);
_g_object_unref (browser->priv->monitor_location);
@@ -3342,10 +3343,9 @@ order_changed_cb (GthMonitor *monitor,
static void
-pref_general_filter_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
+pref_general_filter_changed (GSettings *settings,
+ const char *key,
+ gpointer user_data)
{
GthBrowser *browser = user_data;
GthTest *filter;
@@ -3693,7 +3693,6 @@ _gth_browser_update_toolbar_style (GthBrowser *browser)
GtkToolbarStyle prop = GTK_TOOLBAR_BOTH;
toolbar_style = gth_pref_get_real_toolbar_style ();
-
switch (toolbar_style) {
case GTH_TOOLBAR_STYLE_TEXT_BELOW:
prop = GTK_TOOLBAR_BOTH;
@@ -3717,10 +3716,9 @@ _gth_browser_update_toolbar_style (GthBrowser *browser)
static void
-pref_ui_toolbar_style_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
+pref_ui_toolbar_style_changed (GSettings *settings,
+ const char *key,
+ gpointer user_data)
{
GthBrowser *browser = user_data;
_gth_browser_update_toolbar_style (browser);
@@ -3728,10 +3726,9 @@ pref_ui_toolbar_style_changed (GConfClient *client,
static void
-pref_ui_viewer_thumbnails_orient_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
+pref_ui_viewer_thumbnails_orient_changed (GSettings *settings,
+ const char *key,
+ gpointer user_data)
{
GthBrowser *browser = user_data;
GtkOrientation viewer_thumbnails_orientation;
@@ -3739,7 +3736,7 @@ pref_ui_viewer_thumbnails_orient_changed (GConfClient *client,
GtkWidget *child1;
GtkWidget *child2;
- viewer_thumbnails_orientation = eel_gconf_get_enum (PREF_UI_VIEWER_THUMBNAILS_ORIENT, GTK_TYPE_ORIENTATION, GTK_ORIENTATION_HORIZONTAL);
+ viewer_thumbnails_orientation = g_settings_get_enum (browser->priv->browser_settings, PREF_BROWSER_VIEWER_THUMBNAILS_ORIENT);
if (viewer_thumbnails_orientation == GTK_ORIENTATION_HORIZONTAL)
viewer_thumbnails_pane = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
else
@@ -3811,18 +3808,17 @@ _gth_browser_set_toolbar_visibility (GthBrowser *browser,
static void
-pref_ui_toolbar_visible_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
+pref_ui_toolbar_visible_changed (GSettings *settings,
+ const char *key,
+ gpointer user_data)
{
GthBrowser *browser = user_data;
- _gth_browser_set_toolbar_visibility (browser, gconf_value_get_bool (gconf_entry_get_value (entry)));
+ _gth_browser_set_toolbar_visibility (browser, g_settings_get_boolean (settings, key));
}
static void
-_gth_browser_set_statusbar_visibility (GthBrowser *browser,
+_gth_browser_set_statusbar_visibility (GthBrowser *browser,
gboolean visible)
{
g_return_if_fail (browser != NULL);
@@ -3836,13 +3832,12 @@ _gth_browser_set_statusbar_visibility (GthBrowser *browser,
static void
-pref_ui_statusbar_visible_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
+pref_ui_statusbar_visible_changed (GSettings *settings,
+ const char *key,
+ gpointer user_data)
{
GthBrowser *browser = user_data;
- _gth_browser_set_statusbar_visibility (browser, gconf_value_get_bool (gconf_entry_get_value (entry)));
+ _gth_browser_set_statusbar_visibility (browser, g_settings_get_boolean (settings, key));
}
@@ -3857,7 +3852,8 @@ _gth_browser_set_sidebar_visibility (GthBrowser *browser,
GtkAllocation allocation;
gtk_widget_show (browser->priv->browser_sidebar);
- gtk_paned_set_position (GTK_PANED (browser->priv->browser_container), eel_gconf_get_integer (PREF_UI_BROWSER_SIDEBAR_WIDTH, DEF_SIDEBAR_WIDTH));
+ gtk_paned_set_position (GTK_PANED (browser->priv->browser_container),
+ g_settings_get_int (browser->priv->browser_settings, PREF_BROWSER_BROWSER_SIDEBAR_WIDTH));
gtk_widget_get_allocation (browser->priv->browser_sidebar, &allocation);
gtk_paned_set_position (GTK_PANED (browser->priv->browser_sidebar), allocation.height / 2);
}
@@ -3867,13 +3863,12 @@ _gth_browser_set_sidebar_visibility (GthBrowser *browser,
static void
-pref_ui_sidebar_visible_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
+pref_ui_sidebar_visible_changed (GSettings *settings,
+ const char *key,
+ gpointer user_data)
{
GthBrowser *browser = user_data;
- _gth_browser_set_sidebar_visibility (browser, gconf_value_get_bool (gconf_entry_get_value (entry)));
+ _gth_browser_set_sidebar_visibility (browser, g_settings_get_boolean (settings, key));
}
@@ -3974,26 +3969,24 @@ _gth_browser_set_thumbnail_list_visibility (GthBrowser *browser,
static void
-pref_ui_thumbnail_list_visible_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
+pref_ui_thumbnail_list_visible_changed (GSettings *settings,
+ const char *key,
+ gpointer user_data)
{
GthBrowser *browser = user_data;
- _gth_browser_set_thumbnail_list_visibility (browser, gconf_value_get_bool (gconf_entry_get_value (entry)));
+ _gth_browser_set_thumbnail_list_visibility (browser, g_settings_get_boolean (settings, key));
}
static void
-pref_show_hidden_files_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
+pref_show_hidden_files_changed (GSettings *settings,
+ const char *key,
+ gpointer user_data)
{
GthBrowser *browser = user_data;
gboolean show_hidden_files;
- show_hidden_files = eel_gconf_get_boolean (PREF_SHOW_HIDDEN_FILES, FALSE);
+ show_hidden_files = g_settings_get_boolean (settings, key);
if (show_hidden_files == browser->priv->show_hidden_files)
return;
@@ -4005,41 +3998,38 @@ pref_show_hidden_files_changed (GConfClient *client,
static void
-pref_fast_file_type_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
+pref_fast_file_type_changed (GSettings *settings,
+ const char *key,
+ gpointer user_data)
{
GthBrowser *browser = user_data;
- browser->priv->fast_file_type = eel_gconf_get_boolean (PREF_FAST_FILE_TYPE, TRUE);
+ browser->priv->fast_file_type = g_settings_get_boolean (settings, key);
gth_browser_reload (browser);
}
static void
-pref_thumbnail_size_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
+pref_thumbnail_size_changed (GSettings *settings,
+ const char *key,
+ gpointer user_data)
{
GthBrowser *browser = user_data;
- gth_file_list_set_thumb_size (GTH_FILE_LIST (browser->priv->file_list), eel_gconf_get_integer (PREF_THUMBNAIL_SIZE, DEF_THUMBNAIL_SIZE));
+ gth_file_list_set_thumb_size (GTH_FILE_LIST (browser->priv->file_list), g_settings_get_int (settings, key));
gth_browser_reload (browser);
}
static void
-pref_thumbnail_caption_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
+pref_thumbnail_caption_changed (GSettings *settings,
+ const char *key,
+ gpointer user_data)
{
GthBrowser *browser = user_data;
char *caption;
- caption = eel_gconf_get_string (PREF_THUMBNAIL_CAPTION, DEFAULT_THUMBNAIL_CAPTION);
+ caption = g_settings_get_string (settings, key);
gth_file_list_set_caption (GTH_FILE_LIST (browser->priv->file_list), caption);
if (_gth_browser_reload_required (browser))
@@ -4135,13 +4125,16 @@ gth_browser_init (GthBrowser *browser)
browser->priv->forward_history_menu = NULL;
browser->priv->go_parent_menu = NULL;
browser->priv->shrink_wrap_viewer = FALSE;
+ browser->priv->browser_settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
+ browser->priv->messages_settings = g_settings_new (GTHUMB_MESSAGES_SCHEMA);
+ browser->priv->desktop_interface_settings = g_settings_new (GNOME_DESKTOP_INTERFACE_SCHEMA);
{
int width;
int height;
- width = eel_gconf_get_integer (PREF_UI_WINDOW_WIDTH, 0);
- height = eel_gconf_get_integer (PREF_UI_WINDOW_HEIGHT, 0);
+ width = g_settings_get_int (browser->priv->browser_settings, PREF_BROWSER_WINDOW_WIDTH);
+ height = g_settings_get_int (browser->priv->browser_settings, PREF_BROWSER_WINDOW_HEIGHT);
if ((width == 0) || (height == 0)) {
GdkScreen *screen;
@@ -4225,7 +4218,7 @@ gth_browser_init (GthBrowser *browser)
/* content */
- viewer_thumbnails_orientation = eel_gconf_get_enum (PREF_UI_VIEWER_THUMBNAILS_ORIENT, GTK_TYPE_ORIENTATION, GTK_ORIENTATION_HORIZONTAL);
+ viewer_thumbnails_orientation = g_settings_get_enum (browser->priv->browser_settings, PREF_BROWSER_VIEWER_THUMBNAILS_ORIENT);
if (viewer_thumbnails_orientation == GTK_ORIENTATION_HORIZONTAL)
browser->priv->viewer_thumbnails_pane = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
else
@@ -4247,7 +4240,7 @@ gth_browser_init (GthBrowser *browser)
gtk_paned_pack1 (GTK_PANED (browser->priv->viewer_sidebar_pane), browser->priv->viewer_container, TRUE, FALSE);
browser->priv->viewer_sidebar_alignment = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
- gtk_widget_set_size_request (browser->priv->viewer_sidebar_alignment, DEF_VIEWER_SIDEBAR_WIDTH, -1);
+ gtk_widget_set_size_request (browser->priv->viewer_sidebar_alignment, g_settings_get_int (browser->priv->browser_settings, PREF_BROWSER_BROWSER_SIDEBAR_WIDTH), -1);
gtk_paned_pack2 (GTK_PANED (browser->priv->viewer_sidebar_pane), browser->priv->viewer_sidebar_alignment, FALSE, FALSE);
browser->priv->thumbnail_list = gth_file_list_new (gth_icon_view_new (), (viewer_thumbnails_orientation == GTK_ORIENTATION_HORIZONTAL) ? GTH_FILE_LIST_TYPE_H_SIDEBAR : GTH_FILE_LIST_TYPE_V_SIDEBAR, TRUE);
@@ -4258,7 +4251,7 @@ gth_browser_init (GthBrowser *browser)
gtk_paned_pack2 (GTK_PANED (browser->priv->viewer_thumbnails_pane), browser->priv->thumbnail_list, FALSE, FALSE);
else
gtk_paned_pack1 (GTK_PANED (browser->priv->viewer_thumbnails_pane), browser->priv->thumbnail_list, FALSE, FALSE);
- _gth_browser_set_thumbnail_list_visibility (browser, eel_gconf_get_boolean (PREF_UI_THUMBNAIL_LIST_VISIBLE, TRUE));
+ _gth_browser_set_thumbnail_list_visibility (browser, g_settings_get_boolean (browser->priv->browser_settings, PREF_BROWSER_THUMBNAIL_LIST_VISIBLE));
g_signal_connect (gth_file_list_get_view (GTH_FILE_LIST (browser->priv->thumbnail_list)),
"file-selection-changed",
@@ -4317,7 +4310,7 @@ gth_browser_init (GthBrowser *browser)
browser->priv->statusbar = gth_statusbar_new ();
browser->priv->help_message_cid = gtk_statusbar_get_context_id (GTK_STATUSBAR (browser->priv->statusbar), "gth_help_message");
- _gth_browser_set_statusbar_visibility (browser, eel_gconf_get_boolean (PREF_UI_STATUSBAR_VISIBLE, TRUE));
+ _gth_browser_set_statusbar_visibility (browser, g_settings_get_boolean (browser->priv->browser_settings, PREF_BROWSER_STATUSBAR_VISIBLE));
gth_window_attach (GTH_WINDOW (browser), browser->priv->statusbar, GTH_WINDOW_STATUSBAR);
/* main content */
@@ -4329,7 +4322,7 @@ gth_browser_init (GthBrowser *browser)
/* the browser sidebar */
browser->priv->browser_sidebar = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
- gtk_widget_set_size_request (browser->priv->browser_sidebar, eel_gconf_get_integer (PREF_UI_BROWSER_SIDEBAR_WIDTH, DEF_SIDEBAR_WIDTH), -1);
+ gtk_widget_set_size_request (browser->priv->browser_sidebar, g_settings_get_int (browser->priv->browser_settings, PREF_BROWSER_BROWSER_SIDEBAR_WIDTH), -1);
gtk_widget_show (browser->priv->browser_sidebar);
gtk_paned_pack1 (GTK_PANED (browser->priv->browser_container), browser->priv->browser_sidebar, FALSE, TRUE);
@@ -4457,11 +4450,12 @@ gth_browser_init (GthBrowser *browser)
browser->priv->file_list = gth_file_list_new (gth_icon_view_new (), GTH_FILE_LIST_TYPE_NORMAL, TRUE);
gth_browser_set_sort_order (browser,
- gth_main_get_sort_type (eel_gconf_get_string (PREF_SORT_TYPE, "file::mtime")),
- eel_gconf_get_boolean (PREF_SORT_INVERSE, FALSE));
- gth_browser_enable_thumbnails (browser, eel_gconf_get_boolean (PREF_SHOW_THUMBNAILS, TRUE));
- gth_file_list_set_thumb_size (GTH_FILE_LIST (browser->priv->file_list), eel_gconf_get_integer (PREF_THUMBNAIL_SIZE, DEF_THUMBNAIL_SIZE));
- caption = eel_gconf_get_string (PREF_THUMBNAIL_CAPTION, DEFAULT_THUMBNAIL_CAPTION);
+ gth_main_get_sort_type (g_settings_get_string (browser->priv->browser_settings, PREF_BROWSER_SORT_TYPE)),
+ g_settings_get_boolean (browser->priv->browser_settings, PREF_BROWSER_SORT_INVERSE));
+ gth_browser_enable_thumbnails (browser, g_settings_get_boolean (browser->priv->browser_settings, PREF_BROWSER_SHOW_THUMBNAILS));
+ gth_file_list_set_thumb_size (GTH_FILE_LIST (browser->priv->file_list),
+ g_settings_get_int (browser->priv->browser_settings, PREF_BROWSER_THUMBNAIL_SIZE));
+ caption = g_settings_get_string (browser->priv->browser_settings, PREF_BROWSER_THUMBNAIL_CAPTION);
gth_file_list_set_caption (GTH_FILE_LIST (browser->priv->file_list), caption);
g_free (caption);
@@ -4498,11 +4492,11 @@ gth_browser_init (GthBrowser *browser)
/* the filter bar */
- general_filter = eel_gconf_get_string (PREF_GENERAL_FILTER, DEFAULT_GENERAL_FILTER);
+ general_filter = g_settings_get_string (browser->priv->browser_settings, PREF_BROWSER_GENERAL_FILTER);
browser->priv->filterbar = gth_filterbar_new (general_filter);
g_free (general_filter);
- gth_browser_show_filterbar (browser, eel_gconf_get_boolean (PREF_UI_FILTERBAR_VISIBLE, TRUE));
+ gth_browser_show_filterbar (browser, g_settings_get_boolean (browser->priv->browser_settings, PREF_BROWSER_FILTERBAR_VISIBLE));
gtk_box_pack_end (GTK_BOX (vbox), browser->priv->filterbar, FALSE, FALSE, 0);
g_signal_connect (browser->priv->filterbar,
@@ -4550,76 +4544,75 @@ gth_browser_init (GthBrowser *browser)
browser->priv->file_popup = gtk_ui_manager_get_widget (browser->priv->ui, "/FilePopup");
- _gth_browser_set_sidebar_visibility (browser, eel_gconf_get_boolean (PREF_UI_SIDEBAR_VISIBLE, TRUE));
- _gth_browser_set_toolbar_visibility (browser, eel_gconf_get_boolean (PREF_UI_TOOLBAR_VISIBLE, TRUE));
+ _gth_browser_set_sidebar_visibility (browser, g_settings_get_boolean (browser->priv->browser_settings, PREF_BROWSER_SIDEBAR_VISIBLE));
+ _gth_browser_set_toolbar_visibility (browser, g_settings_get_boolean (browser->priv->browser_settings, PREF_BROWSER_TOOLBAR_VISIBLE));
_gth_browser_update_toolbar_style (browser);
- browser->priv->show_hidden_files = eel_gconf_get_boolean (PREF_SHOW_HIDDEN_FILES, FALSE);
+ browser->priv->show_hidden_files = g_settings_get_boolean (browser->priv->browser_settings, PREF_BROWSER_SHOW_HIDDEN_FILES);
_gth_browser_set_action_active (browser, "View_ShowHiddenFiles", browser->priv->show_hidden_files);
- browser->priv->shrink_wrap_viewer = eel_gconf_get_boolean (PREF_SHRINK_WRAP_VIEWER, FALSE);
+ browser->priv->shrink_wrap_viewer = g_settings_get_boolean (browser->priv->browser_settings, PREF_BROWSER_SHRINK_WRAP_VIEWER);
_gth_browser_set_action_active (browser, "View_ShrinkWrap", browser->priv->shrink_wrap_viewer);
_gth_browser_set_action_sensitive (browser, "Viewer_Tools", FALSE);
- gth_browser_show_file_properties (browser, eel_gconf_get_boolean (PREF_UI_PROPERTIES_VISIBLE, TRUE));
+ gth_browser_show_file_properties (browser, g_settings_get_boolean (browser->priv->browser_settings, PREF_BROWSER_PROPERTIES_VISIBLE));
- browser->priv->fast_file_type = eel_gconf_get_boolean (PREF_FAST_FILE_TYPE, TRUE);
+ browser->priv->fast_file_type = g_settings_get_boolean (browser->priv->browser_settings, PREF_BROWSER_FAST_FILE_TYPE);
gth_hook_invoke ("gth-browser-construct", browser);
performance (DEBUG_INFO, "window initialized");
- /* gconf notifications */
+ /* settings notifications */
- i = 0;
- browser->priv->cnxn_id[i++] = eel_gconf_notification_add (
- PREF_GENERAL_FILTER,
- pref_general_filter_changed,
- browser);
- browser->priv->cnxn_id[i++] = eel_gconf_notification_add (
- PREF_UI_TOOLBAR_STYLE,
- pref_ui_toolbar_style_changed,
- browser);
- browser->priv->cnxn_id[i++] = eel_gconf_notification_add (
- PREF_UI_VIEWER_THUMBNAILS_ORIENT,
- pref_ui_viewer_thumbnails_orient_changed,
- browser);
- browser->priv->cnxn_id[i++] = eel_gconf_notification_add (
- "/desktop/gnome/interface/toolbar_style",
- pref_ui_toolbar_style_changed,
- browser);
- browser->priv->cnxn_id[i++] = eel_gconf_notification_add (
- PREF_UI_TOOLBAR_VISIBLE,
- pref_ui_toolbar_visible_changed,
- browser);
- browser->priv->cnxn_id[i++] = eel_gconf_notification_add (
- PREF_UI_STATUSBAR_VISIBLE,
- pref_ui_statusbar_visible_changed,
- browser);
- browser->priv->cnxn_id[i++] = eel_gconf_notification_add (
- PREF_UI_SIDEBAR_VISIBLE,
- pref_ui_sidebar_visible_changed,
- browser);
- browser->priv->cnxn_id[i++] = eel_gconf_notification_add (
- PREF_UI_THUMBNAIL_LIST_VISIBLE,
- pref_ui_thumbnail_list_visible_changed,
- browser);
- browser->priv->cnxn_id[i++] = eel_gconf_notification_add (
- PREF_SHOW_HIDDEN_FILES,
- pref_show_hidden_files_changed,
- browser);
- browser->priv->cnxn_id[i++] = eel_gconf_notification_add (
- PREF_FAST_FILE_TYPE,
- pref_fast_file_type_changed,
- browser);
- browser->priv->cnxn_id[i++] = eel_gconf_notification_add (
- PREF_THUMBNAIL_SIZE,
- pref_thumbnail_size_changed,
- browser);
- browser->priv->cnxn_id[i++] = eel_gconf_notification_add (
- PREF_THUMBNAIL_CAPTION,
- pref_thumbnail_caption_changed,
- browser);
+ g_signal_connect (browser->priv->browser_settings,
+ "changed::" PREF_BROWSER_GENERAL_FILTER,
+ G_CALLBACK (pref_general_filter_changed),
+ browser);
+ g_signal_connect (browser->priv->browser_settings,
+ "changed::" PREF_BROWSER_TOOLBAR_STYLE,
+ G_CALLBACK (pref_ui_toolbar_style_changed),
+ browser);
+ g_signal_connect (browser->priv->browser_settings,
+ "changed::" PREF_BROWSER_VIEWER_THUMBNAILS_ORIENT,
+ G_CALLBACK (pref_ui_viewer_thumbnails_orient_changed),
+ browser);
+ g_signal_connect (browser->priv->desktop_interface_settings,
+ "changed::" PREF_BROWSER_TOOLBAR_STYLE,
+ G_CALLBACK (pref_ui_toolbar_style_changed),
+ browser);
+ g_signal_connect (browser->priv->browser_settings,
+ "changed::" PREF_BROWSER_TOOLBAR_VISIBLE,
+ G_CALLBACK (pref_ui_toolbar_visible_changed),
+ browser);
+ g_signal_connect (browser->priv->browser_settings,
+ "changed::" PREF_BROWSER_STATUSBAR_VISIBLE,
+ G_CALLBACK (pref_ui_statusbar_visible_changed),
+ browser);
+ g_signal_connect (browser->priv->browser_settings,
+ "changed::" PREF_BROWSER_SIDEBAR_VISIBLE,
+ G_CALLBACK (pref_ui_sidebar_visible_changed),
+ browser);
+ g_signal_connect (browser->priv->browser_settings,
+ "changed::" PREF_BROWSER_THUMBNAIL_LIST_VISIBLE,
+ G_CALLBACK (pref_ui_thumbnail_list_visible_changed),
+ browser);
+ g_signal_connect (browser->priv->browser_settings,
+ "changed::" PREF_BROWSER_SHOW_HIDDEN_FILES,
+ G_CALLBACK (pref_show_hidden_files_changed),
+ browser);
+ g_signal_connect (browser->priv->browser_settings,
+ "changed::" PREF_BROWSER_FAST_FILE_TYPE,
+ G_CALLBACK (pref_fast_file_type_changed),
+ browser);
+ g_signal_connect (browser->priv->browser_settings,
+ "changed::" PREF_BROWSER_THUMBNAIL_SIZE,
+ G_CALLBACK (pref_thumbnail_size_changed),
+ browser);
+ g_signal_connect (browser->priv->browser_settings,
+ "changed::" PREF_BROWSER_THUMBNAIL_CAPTION,
+ G_CALLBACK (pref_thumbnail_caption_changed),
+ browser);
browser->priv->constructed = TRUE;
}
@@ -5684,7 +5677,7 @@ load_file_delayed_cb (gpointer user_data)
browser->priv->load_file_timeout = 0;
}
- if (eel_gconf_get_boolean (PREF_MSG_SAVE_MODIFIED_IMAGE, DEFAULT_MSG_SAVE_MODIFIED_IMAGE)
+ if (g_settings_get_boolean (browser->priv->messages_settings, PREF_MSG_SAVE_MODIFIED_IMAGE)
&& gth_browser_get_file_modified (browser))
{
load_file_data_ref (data);
@@ -5740,7 +5733,7 @@ gth_browser_show_file_properties (GthBrowser *browser,
switch (gth_window_get_current_page (GTH_WINDOW (browser))) {
case GTH_BROWSER_PAGE_BROWSER:
case GTH_WINDOW_PAGE_UNDEFINED: /* when called from gth_browser_init */
- eel_gconf_set_boolean (PREF_UI_PROPERTIES_VISIBLE, show);
+ g_settings_set_boolean (browser->priv->browser_settings, PREF_BROWSER_PROPERTIES_VISIBLE, show);
_gth_browser_set_action_active (browser, "Browser_Properties", show);
if (show) {
if (gth_window_get_current_page (GTH_WINDOW (browser)) != GTH_WINDOW_PAGE_UNDEFINED) {
@@ -5806,7 +5799,7 @@ gth_browser_set_shrink_wrap_viewer (GthBrowser *browser,
int max_height;
browser->priv->shrink_wrap_viewer = value;
- eel_gconf_set_boolean (PREF_SHRINK_WRAP_VIEWER, browser->priv->shrink_wrap_viewer);
+ g_settings_set_boolean (browser->priv->browser_settings, PREF_BROWSER_SHRINK_WRAP_VIEWER, browser->priv->shrink_wrap_viewer);
if (browser->priv->viewer_page == NULL)
return;
@@ -5843,7 +5836,7 @@ gth_browser_set_shrink_wrap_viewer (GthBrowser *browser,
other_height += _gtk_widget_get_allocated_height (gth_window_get_area (GTH_WINDOW (browser), GTH_WINDOW_TOOLBAR));
other_height += _gtk_widget_get_allocated_height (gth_window_get_area (GTH_WINDOW (browser), GTH_WINDOW_STATUSBAR));
other_height += _gtk_widget_get_allocated_height (gth_browser_get_viewer_toolbar (browser));
- if (eel_gconf_get_enum (PREF_UI_VIEWER_THUMBNAILS_ORIENT, GTK_TYPE_ORIENTATION, GTK_ORIENTATION_HORIZONTAL) == GTK_ORIENTATION_HORIZONTAL)
+ if (g_settings_get_enum (browser->priv->browser_settings, PREF_BROWSER_VIEWER_THUMBNAILS_ORIENT) == GTK_ORIENTATION_HORIZONTAL)
other_height += _gtk_widget_get_allocated_height (gth_browser_get_thumbnail_list (browser));
else
other_width += _gtk_widget_get_allocated_width (gth_browser_get_thumbnail_list (browser));
@@ -6099,7 +6092,7 @@ gth_browser_enable_thumbnails (GthBrowser *browser,
{
gth_file_list_enable_thumbs (GTH_FILE_LIST (browser->priv->file_list), show);
_gth_browser_set_action_active (browser, "View_Thumbnails", show);
- eel_gconf_set_boolean (PREF_SHOW_THUMBNAILS, show);
+ g_settings_set_boolean (browser->priv->browser_settings, PREF_BROWSER_SHOW_THUMBNAILS, show);
}
@@ -6112,7 +6105,7 @@ gth_browser_show_filterbar (GthBrowser *browser,
else
gtk_widget_hide (browser->priv->filterbar);
_gth_browser_set_action_active (browser, "View_Filterbar", show);
- eel_gconf_set_boolean (PREF_UI_FILTERBAR_VISIBLE, show);
+ g_settings_set_boolean (browser->priv->browser_settings, PREF_BROWSER_FILTERBAR_VISIBLE, show);
}
diff --git a/gthumb/gth-extensions.c b/gthumb/gth-extensions.c
index 580d87d..5305501 100644
--- a/gthumb/gth-extensions.c
+++ b/gthumb/gth-extensions.c
@@ -798,49 +798,56 @@ get_extension_optional_dependencies (GthExtensionManager *manager,
}
-GSList *
-gth_extension_manager_order_extensions (GthExtensionManager *manager,
- GSList *extensions)
+GList *
+gth_extension_manager_order_extensions (GthExtensionManager *manager,
+ char **extensions)
{
- GSList *scan;
- GSList *ordered = NULL;
+ GList *extension_list;
+ int i;
+ GList *ordered_by_dependency;
+ GList *scan;
+
+ extension_list = NULL;
+ for (i = 0; extensions[i] != NULL; i++)
+ if (g_hash_table_lookup (manager->priv->extensions, extensions[i]) != NULL)
+ extension_list = g_list_prepend (extension_list, g_strdup (extensions[i]));
+ extension_list = g_list_reverse (extension_list);
- for (scan = extensions; scan; /* void */) {
- char *ext_name = scan->data;
+ ordered_by_dependency = NULL;
+ for (scan = extension_list; scan; /* void */) {
+ GList *next;
+ char *ext_name;
GthExtensionDescription *ext_description;
- GSList *next = scan->next;
GList *dependencies;
- GSList *slink;
- GList *scan_d;
+ GList *scan_dep;
+ next = extension_list->next;
+ ext_name = extension_list->data;
ext_description = g_hash_table_lookup (manager->priv->extensions, ext_name);
- if (ext_description == NULL) {
- g_free (scan->data);
- extensions = g_slist_delete_link (extensions, scan);
- scan = next;
- continue;
- }
+ g_assert (ext_description != NULL);
dependencies = get_extension_optional_dependencies (manager, ext_description);
- for (scan_d = dependencies; scan_d; scan_d = scan_d->next) {
- char *dep_name = scan_d->data;
+ for (scan_dep = dependencies; scan_dep; scan_dep = scan_dep->next) {
+ char *dep_name = scan_dep->data;
+ GList *link;
- slink = g_slist_find_custom (extensions, dep_name, (GCompareFunc) strcmp);
- if (slink != NULL) {
- if (slink == next)
+ link = g_list_find_custom (extension_list, dep_name, (GCompareFunc) strcmp);
+ if (link != NULL) {
+ if (link == next)
next = next->next;
- extensions = g_slist_remove_link (extensions, slink);
- slink->next = ordered;
- ordered = slink;
+ /* prepend the extension dependency to the ordered list */
+ extension_list = g_list_remove_link (extension_list, link);
+ ordered_by_dependency = _g_list_prepend_link (ordered_by_dependency, link);
}
}
- extensions = g_slist_remove_link (extensions, scan);
- scan->next = ordered;
- ordered = scan;
+ /* prepend the extension to the ordered list */
+ extension_list = g_list_remove_link (extension_list, scan);
+ ordered_by_dependency = _g_list_prepend_link (ordered_by_dependency, scan);
+
scan = next;
}
- return g_slist_reverse (ordered);
+ return g_list_reverse (ordered_by_dependency);
}
diff --git a/gthumb/gth-extensions.h b/gthumb/gth-extensions.h
index 347d167..3164cd4 100644
--- a/gthumb/gth-extensions.h
+++ b/gthumb/gth-extensions.h
@@ -174,8 +174,9 @@ gboolean gth_extension_manager_is_active (GthExtension
GList * gth_extension_manager_get_extensions (GthExtensionManager *manager);
GthExtensionDescription * gth_extension_manager_get_description (GthExtensionManager *manager,
const char *extension_name);
-GSList * gth_extension_manager_order_extensions (GthExtensionManager *manager,
- GSList *extensions);
+GList * gth_extension_manager_order_extensions (GthExtensionManager *manager,
+ char **extensions);
+
G_END_DECLS
#endif
diff --git a/gthumb/gth-file-list.c b/gthumb/gth-file-list.c
index 99305d7..18a342e 100644
--- a/gthumb/gth-file-list.c
+++ b/gthumb/gth-file-list.c
@@ -23,7 +23,6 @@
#include <string.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include "gconf-utils.h"
#include "glib-utils.h"
#include "gth-cell-renderer-caption.h"
#include "gth-cell-renderer-thumbnail.h"
@@ -108,6 +107,7 @@ enum {
struct _GthFileListPrivateData
{
+ GSettings *settings;
GthFileListType type;
GtkAdjustment *vadj;
GtkWidget *notebook;
@@ -269,6 +269,7 @@ gth_file_list_finalize (GObject *object)
g_hash_table_unref (file_list->priv->thumb_data);
if (file_list->priv->icon_cache != NULL)
gth_icon_cache_free (file_list->priv->icon_cache);
+ g_object_unref (file_list->priv->settings);
g_free (file_list->priv);
file_list->priv = NULL;
@@ -382,8 +383,9 @@ static void
gth_file_list_init (GthFileList *file_list)
{
file_list->priv = g_new0 (GthFileListPrivateData, 1);
+ file_list->priv->settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
file_list->priv->thumb_data = g_hash_table_new_full (g_file_hash, (GEqualFunc) g_file_equal, g_object_unref, (GDestroyNotify) thumb_data_unref);
- file_list->priv->thumb_size = DEFAULT_THUMBNAIL_SIZE;
+ file_list->priv->thumb_size = g_settings_get_int (file_list->priv->settings, PREF_BROWSER_THUMBNAIL_SIZE);
file_list->priv->ignore_hidden_thumbs = FALSE;
file_list->priv->load_thumbs = TRUE;
file_list->priv->cancelling = FALSE;
@@ -1142,8 +1144,10 @@ static void
gfl_set_files (GthFileList *file_list,
GList *files)
{
- gth_thumb_loader_set_save_thumbnails (file_list->priv->thumb_loader, eel_gconf_get_boolean (PREF_SAVE_THUMBNAILS, TRUE));
- gth_thumb_loader_set_max_file_size (file_list->priv->thumb_loader, eel_gconf_get_integer (PREF_THUMBNAIL_LIMIT, 0));
+ gth_thumb_loader_set_save_thumbnails (file_list->priv->thumb_loader,
+ g_settings_get_boolean (file_list->priv->settings, PREF_BROWSER_SAVE_THUMBNAILS));
+ gth_thumb_loader_set_max_file_size (file_list->priv->thumb_loader,
+ g_settings_get_int (file_list->priv->settings, PREF_BROWSER_THUMBNAIL_LIMIT));
gth_file_selection_unselect_all (GTH_FILE_SELECTION (file_list->priv->view));
gth_cell_renderer_caption_clear_cache (GTH_CELL_RENDERER_CAPTION (file_list->priv->caption_renderer));
@@ -1259,8 +1263,10 @@ gfl_enable_thumbs (GthFileList *file_list,
GthFileStore *file_store;
GtkTreeIter iter;
- gth_thumb_loader_set_save_thumbnails (file_list->priv->thumb_loader, eel_gconf_get_boolean (PREF_SAVE_THUMBNAILS, TRUE));
- gth_thumb_loader_set_max_file_size (file_list->priv->thumb_loader, eel_gconf_get_integer (PREF_THUMBNAIL_LIMIT, 0));
+ gth_thumb_loader_set_save_thumbnails (file_list->priv->thumb_loader,
+ g_settings_get_boolean (file_list->priv->settings, PREF_BROWSER_SAVE_THUMBNAILS));
+ gth_thumb_loader_set_max_file_size (file_list->priv->thumb_loader,
+ g_settings_get_int (file_list->priv->settings, PREF_BROWSER_THUMBNAIL_LIMIT));
file_list->priv->load_thumbs = enable;
@@ -1324,8 +1330,10 @@ gth_file_list_set_thumb_size (GthFileList *file_list,
file_list->priv->thumb_size = size;
gth_thumb_loader_set_requested_size (file_list->priv->thumb_loader, size);
- gth_thumb_loader_set_save_thumbnails (file_list->priv->thumb_loader, eel_gconf_get_boolean (PREF_SAVE_THUMBNAILS, TRUE));
- gth_thumb_loader_set_max_file_size (file_list->priv->thumb_loader, eel_gconf_get_integer (PREF_THUMBNAIL_LIMIT, 0));
+ gth_thumb_loader_set_save_thumbnails (file_list->priv->thumb_loader,
+ g_settings_get_boolean (file_list->priv->settings, PREF_BROWSER_SAVE_THUMBNAILS));
+ gth_thumb_loader_set_max_file_size (file_list->priv->thumb_loader,
+ g_settings_get_int (file_list->priv->settings, PREF_BROWSER_THUMBNAIL_LIMIT));
gth_icon_cache_free (file_list->priv->icon_cache);
file_list->priv->icon_cache = gth_icon_cache_new (gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (file_list))), size / 2);
diff --git a/gthumb/gth-file-source-vfs.c b/gthumb/gth-file-source-vfs.c
index 82f7c41..da82a4c 100644
--- a/gthumb/gth-file-source-vfs.c
+++ b/gthumb/gth-file-source-vfs.c
@@ -23,7 +23,6 @@
#include <string.h>
#include <glib/gi18n.h>
#include <glib.h>
-#include "gconf-utils.h"
#include "gth-file-data.h"
#include "gio-utils.h"
#include "glib-utils.h"
@@ -776,7 +775,10 @@ void
gth_file_mananger_trash_files (GtkWindow *window,
GList *file_list /* GthFileData list */)
{
- if (eel_gconf_get_boolean (PREF_MSG_CONFIRM_DELETION, DEFAULT_MSG_CONFIRM_DELETION)) {
+ GSettings *settings;
+
+ settings = g_settings_new (GTHUMB_MESSAGES_SCHEMA);
+ if (g_settings_get_boolean (settings, PREF_MSG_CONFIRM_DELETION)) {
int file_count;
char *prompt;
GtkWidget *d;
@@ -784,7 +786,8 @@ gth_file_mananger_trash_files (GtkWindow *window,
file_count = g_list_length (file_list);
if (file_count == 1) {
GthFileData *file_data = file_list->data;
- prompt = g_strdup_printf (_("Are you sure you want to move \"%s\" to trash?"), g_file_info_get_display_name (file_data->info));
+ prompt = g_strdup_printf (_("Are you sure you want to move \"%s\" to trash?"),
+ g_file_info_get_display_name (file_data->info));
}
else
prompt = g_strdup_printf (ngettext("Are you sure you want to move to trash "
@@ -810,6 +813,8 @@ gth_file_mananger_trash_files (GtkWindow *window,
}
else
trash_files (window, file_list);
+
+ g_object_unref (settings);
}
diff --git a/gthumb/gth-main.c b/gthumb/gth-main.c
index 7b7ee59..a505256 100644
--- a/gthumb/gth-main.c
+++ b/gthumb/gth-main.c
@@ -25,7 +25,6 @@
#include <glib.h>
#include <glib-object.h>
#include <gobject/gvaluecollector.h>
-#include "gconf-utils.h"
#include "glib-utils.h"
#include "gth-duplicable.h"
#include "gth-filter.h"
@@ -745,12 +744,16 @@ gth_main_get_pixbuf_saver (const char *mime_type)
GthTest *
gth_main_get_general_filter (void)
{
- char *filter_name;
- GthTest *filter;
+ GSettings *settings;
+ char *filter_name;
+ GthTest *filter;
+
+ settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
+ filter_name = g_settings_get_string (settings, PREF_BROWSER_GENERAL_FILTER);
+ filter = gth_main_get_registered_object (GTH_TYPE_TEST, filter_name);
- filter_name = eel_gconf_get_string (PREF_GENERAL_FILTER, DEFAULT_GENERAL_FILTER);
- filter = gth_main_get_registered_object (GTH_TYPE_TEST, filter_name);
g_free (filter_name);
+ g_object_unref (settings);
return filter;
}
@@ -1204,11 +1207,13 @@ gth_main_activate_extensions (void)
"slideshow",
"webalbums",
NULL };
- int i;
- GError *error = NULL;
- GSList *active_extensions;
- GthExtensionManager *manager;
- GSList *scan;
+ int i;
+ GError *error = NULL;
+ GSettings *settings;
+ char **active_extensions;
+ GList *ordered_extensions;
+ GthExtensionManager *manager;
+ GList *scan;
if (Main->priv->extension_manager == NULL)
Main->priv->extension_manager = gth_extension_manager_new ();
@@ -1220,27 +1225,20 @@ gth_main_activate_extensions (void)
}
}
- active_extensions = eel_gconf_get_string_list_with_error (PREF_ACTIVE_EXTENSIONS, &error);
- if ((error != NULL)
- || ((active_extensions != NULL)
- && (active_extensions->next == NULL)
- && (g_strcmp0 (active_extensions->data, "default") == 0)))
+ settings = g_settings_new (GTHUMB_GENERAL_SCHEMA);
+ active_extensions = g_settings_get_strv (settings, PREF_GENERAL_ACTIVE_EXTENSIONS);
+ if ((active_extensions != NULL)
+ && (active_extensions[1] == NULL)
+ && (g_strcmp0 (active_extensions[0], "default") == 0))
{
- g_clear_error (&error);
- g_slist_foreach (active_extensions, (GFunc) g_free, NULL);
- g_slist_free (active_extensions);
-
- active_extensions = NULL;
- for (i = 0; default_extensions[i] != NULL; i++)
- active_extensions = g_slist_prepend (active_extensions, g_strdup (default_extensions[i]));
-
- eel_gconf_set_string_list (PREF_ACTIVE_EXTENSIONS, active_extensions);
+ g_strfreev (active_extensions);
+ active_extensions = g_strdupv ((char **) default_extensions);
+ g_settings_set_strv (settings, PREF_GENERAL_ACTIVE_EXTENSIONS, (const char *const *) active_extensions);
}
- active_extensions = gth_extension_manager_order_extensions (Main->priv->extension_manager, active_extensions);
+ ordered_extensions = gth_extension_manager_order_extensions (Main->priv->extension_manager, active_extensions);
manager = gth_main_get_default_extension_manager ();
-
- for (scan = active_extensions; scan; scan = scan->next) {
+ for (scan = ordered_extensions; scan; scan = scan->next) {
char *name = scan->data;
GthExtensionDescription *description;
GError *error = NULL;
@@ -1255,8 +1253,8 @@ gth_main_activate_extensions (void)
}
}
- g_slist_foreach (active_extensions, (GFunc) g_free, NULL);
- g_slist_free (active_extensions);
+ _g_string_list_free (ordered_extensions);
+ g_strfreev (active_extensions);
}
diff --git a/gthumb/gth-preferences.c b/gthumb/gth-preferences.c
index 8414cbc..bd08e7a 100644
--- a/gthumb/gth-preferences.c
+++ b/gthumb/gth-preferences.c
@@ -22,13 +22,10 @@
#include <string.h>
#include <math.h>
#include <gio/gio.h>
-#include "gconf-utils.h"
#include "glib-utils.h"
#include "gth-enum-types.h"
#include "gth-preferences.h"
-#define DIALOG_KEY_PREFIX "/apps/gthumb/dialogs/"
-
typedef struct {
char *wallpaper_filename;
@@ -37,20 +34,30 @@ typedef struct {
} GthPreferences;
-static GthPreferences *Preferences;
+static GthPreferences *Preferences = NULL;
void
gth_pref_initialize (void)
{
- Preferences = g_new0 (GthPreferences, 1);
+ GSettings *settings;
+
+ if (Preferences == NULL)
+ Preferences = g_new0 (GthPreferences, 1);
+
+ /* desktop background */
- Preferences->wallpaper_filename = eel_gconf_get_string ("/desktop/gnome/background/picture_filename", NULL);
- Preferences->wallpaper_options = eel_gconf_get_string ("/desktop/gnome/background/picture_options", NULL);
+ settings = g_settings_new (GNOME_DESKTOP_BACKGROUND_SCHEMA);
+ Preferences->wallpaper_filename = g_settings_get_string(settings, PREF_BACKGROUND_PICTURE_URI);
+ Preferences->wallpaper_options = g_settings_get_string(settings, PREF_BACKGROUND_PICTURE_OPTIONS);
+ g_object_unref (settings);
+ /* startup location */
+
+ settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
Preferences->startup_location = NULL;
- if (eel_gconf_get_boolean (PREF_USE_STARTUP_LOCATION, FALSE) ||
- eel_gconf_get_boolean (PREF_GO_TO_LAST_LOCATION, FALSE))
+ if (g_settings_get_boolean (settings, PREF_BROWSER_USE_STARTUP_LOCATION)
+ || g_settings_get_boolean (settings, PREF_BROWSER_GO_TO_LAST_LOCATION))
{
char *startup_location;
@@ -71,18 +78,21 @@ gth_pref_initialize (void)
g_free (current_uri);
g_free (current_dir);
}
-
- eel_gconf_monitor_add ("/apps/gthumb");
+ g_object_unref (settings);
}
void
gth_pref_release (void)
{
+ if (Preferences == NULL)
+ return;
+
g_free (Preferences->wallpaper_filename);
g_free (Preferences->wallpaper_options);
g_free (Preferences->startup_location);
g_free (Preferences);
+ Preferences = NULL;
}
@@ -120,95 +130,74 @@ gth_pref_get_wallpaper_options (void)
}
-static void
-_gth_pref_dialog_property_set_int (const char *dialog_name,
- const char *property,
- int value)
-{
- char *key;
-
- key = g_strconcat (DIALOG_KEY_PREFIX, dialog_name, "/", property, NULL);
- eel_gconf_set_integer (key, value);
- g_free (key);
-}
-
-
GthToolbarStyle
gth_pref_get_real_toolbar_style (void)
{
- GthToolbarStyle toolbar_style;
+ GSettings *settings;
+ GthToolbarStyle toolbar_style;
- toolbar_style = eel_gconf_get_enum (PREF_UI_TOOLBAR_STYLE, GTH_TYPE_TOOLBAR_STYLE, GTH_TOOLBAR_STYLE_SYSTEM);
+ settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
+ toolbar_style = g_settings_get_enum (settings, PREF_BROWSER_TOOLBAR_STYLE);
if (toolbar_style == GTH_TOOLBAR_STYLE_SYSTEM) {
char *system_style;
- system_style = eel_gconf_get_string ("/desktop/gnome/interface/toolbar_style", "system");
+ toolbar_style = GTH_TOOLBAR_STYLE_TEXT_BELOW; /* default value */
- if (system_style == NULL)
- toolbar_style = GTH_TOOLBAR_STYLE_TEXT_BELOW;
- else if (strcmp (system_style, "both") == 0)
+ g_object_unref (settings);
+ settings = g_settings_new (GNOME_DESKTOP_INTERFACE_SCHEMA);
+
+ system_style = g_settings_get_string (settings, "toolbar-style");
+ if (g_strcmp0 (system_style, "both") == 0)
toolbar_style = GTH_TOOLBAR_STYLE_TEXT_BELOW;
- else if (strcmp (system_style, "both-horiz") == 0)
+ else if (g_strcmp0 (system_style, "both-horiz") == 0)
toolbar_style = GTH_TOOLBAR_STYLE_TEXT_BESIDE;
- else if (strcmp (system_style, "icons") == 0)
+ else if (g_strcmp0 (system_style, "icons") == 0)
toolbar_style = GTH_TOOLBAR_STYLE_ICONS;
- else if (strcmp (system_style, "text") == 0)
+ else if (g_strcmp0 (system_style, "text") == 0)
toolbar_style = GTH_TOOLBAR_STYLE_TEXT;
- else
- toolbar_style = GTH_TOOLBAR_STYLE_TEXT_BELOW;
g_free (system_style);
}
+ g_object_unref (settings);
+
return toolbar_style;
}
void
gth_pref_save_window_geometry (GtkWindow *window,
- const char *dialog_name)
+ const char *schema)
{
- int x, y, width, height;
+ GSettings *settings;
+ int width;
+ int height;
- gtk_window_get_position (window, &x, &y);
- _gth_pref_dialog_property_set_int (dialog_name, "x", x);
- _gth_pref_dialog_property_set_int (dialog_name, "y", y);
-
- gtk_window_get_size (window, &width, &height);
- _gth_pref_dialog_property_set_int (dialog_name, "width", width);
- _gth_pref_dialog_property_set_int (dialog_name, "height", height);
-}
+ settings = g_settings_new (schema);
+ gtk_window_get_size (window, &width, &height);
+ g_settings_set_int (settings, "width", width);
+ g_settings_set_int (settings, "height", height);
-static int
-_gth_pref_dialog_property_get_int (const char *dialog_name,
- const char *property)
-{
- char *key;
- int value;
-
- key = g_strconcat (DIALOG_KEY_PREFIX, dialog_name, "/", property, NULL);
- value = eel_gconf_get_integer (key, -1);
- g_free (key);
-
- return value;
+ g_object_unref (settings);
}
void
gth_pref_restore_window_geometry (GtkWindow *window,
- const char *dialog_name)
+ const char *schema)
{
- int x, y, width, height;
-
- x = _gth_pref_dialog_property_get_int (dialog_name, "x");
- y = _gth_pref_dialog_property_get_int (dialog_name, "y");
- width = _gth_pref_dialog_property_get_int (dialog_name, "width");
- height = _gth_pref_dialog_property_get_int (dialog_name, "height");
-
- if ((width != -1) && (height != 1))
- gtk_window_set_default_size (window, width, height);
- if ((x != -1) && (y != 1))
- gtk_window_move (window, x, y);
- gtk_window_present (window);
+ GSettings *settings;
+ int width;
+ int height;
+
+ settings = g_settings_new (schema);
+
+ width = g_settings_get_int (settings, "width");
+ height = g_settings_get_int (settings, "height");
+ if ((width != -1) && (height != 1))
+ gtk_window_set_default_size (window, width, height);
+ gtk_window_present (window);
+
+ g_object_unref (settings);
}
diff --git a/gthumb/gth-source-tree.c b/gthumb/gth-source-tree.c
index b669163..e4e63a6 100644
--- a/gthumb/gth-source-tree.c
+++ b/gthumb/gth-source-tree.c
@@ -22,7 +22,6 @@
#include <config.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include "gconf-utils.h"
#include "glib-utils.h"
#include "gtk-utils.h"
#include "gth-icon-cache.h"
@@ -124,11 +123,16 @@ static void
load_data_run (LoadData *load_data,
ListReady func)
{
+ GSettings *settings;
+
+ settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
gth_file_source_list (load_data->file_source,
load_data->folder,
- eel_gconf_get_boolean (PREF_FAST_FILE_TYPE, TRUE) ? GFILE_STANDARD_ATTRIBUTES_WITH_FAST_CONTENT_TYPE : GFILE_STANDARD_ATTRIBUTES_WITH_CONTENT_TYPE,
+ g_settings_get_boolean (settings, PREF_BROWSER_FAST_FILE_TYPE) ? GFILE_STANDARD_ATTRIBUTES_WITH_FAST_CONTENT_TYPE : GFILE_STANDARD_ATTRIBUTES_WITH_CONTENT_TYPE,
func,
load_data);
+
+ g_object_unref (settings);
}
@@ -250,6 +254,9 @@ monitor_folder_changed_cb (GthMonitor *monitor,
|| ((path != NULL) && gtk_tree_view_row_expanded (GTK_TREE_VIEW (source_tree), path)))
{
MonitorEventData *monitor_data;
+ GSettings *settings;
+
+ settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
switch (event) {
case GTH_MONITOR_EVENT_CREATED:
@@ -260,7 +267,7 @@ monitor_folder_changed_cb (GthMonitor *monitor,
monitor_data->source_tree = source_tree;
gth_file_source_read_attributes (source_tree->priv->file_source,
list,
- eel_gconf_get_boolean (PREF_FAST_FILE_TYPE, TRUE) ? GFILE_STANDARD_ATTRIBUTES_WITH_FAST_CONTENT_TYPE : GFILE_STANDARD_ATTRIBUTES_WITH_CONTENT_TYPE,
+ g_settings_get_boolean (settings, PREF_BROWSER_FAST_FILE_TYPE) ? GFILE_STANDARD_ATTRIBUTES_WITH_FAST_CONTENT_TYPE : GFILE_STANDARD_ATTRIBUTES_WITH_CONTENT_TYPE,
file_attributes_ready_cb,
monitor_data);
break;
@@ -270,6 +277,8 @@ monitor_folder_changed_cb (GthMonitor *monitor,
gth_folder_tree_delete_children (GTH_FOLDER_TREE (source_tree), parent, list);
break;
}
+
+ g_object_unref (settings);
}
gtk_tree_path_free (path);
diff --git a/gthumb/main-migrate-catalogs.c b/gthumb/main-migrate-catalogs.c
index 27aaeae..78619f2 100644
--- a/gthumb/main-migrate-catalogs.c
+++ b/gthumb/main-migrate-catalogs.c
@@ -22,7 +22,6 @@
#include <config.h>
#include <string.h>
#include "dom.h"
-#include "gconf-utils.h"
#include "gio-utils.h"
#include "glib-utils.h"
#include "gth-time.h"
@@ -33,14 +32,29 @@
#define MAX_LINE_LENGTH 4096
+typedef struct {
+ GSettings *settings;
+ GFile *collections_dir;
+} MigrationData;
+
+
+static void
+migration_data_free (MigrationData *data)
+{
+ _g_object_unref (data->collections_dir);
+ _g_object_unref (data->settings);
+ g_free (data);
+}
+
+
static void
migration_done (GError *error,
gpointer user_data)
{
- GFile *collections_dir = user_data;
+ MigrationData *data = user_data;
- eel_gconf_set_boolean (PREF_DATA_MIGRATION_CATALOGS_2_10, TRUE);
- g_object_unref (collections_dir);
+ g_settings_set_boolean (data->settings, PREF_DATA_MIGRATION_CATALOGS_2_10, TRUE);
+ migration_data_free (data);
}
@@ -60,22 +74,22 @@ migration_for_each_file (GFile *file,
GFileInfo *info,
gpointer user_data)
{
- GFile *collections_dir = user_data;
- char *buffer;
- gsize buffer_size;
- GError *error = NULL;
- DomDocument *document;
- char *extension;
- char *new_buffer;
- gsize new_buffer_size;
- char *catalogs_path;
- char *relative_path;
- char *tmp_path;
- char *full_path_no_ext;
- char *full_path;
- GFile *catalog_file;
- GFile *catalog_dir;
- char *catalog_dir_path;
+ MigrationData *data = user_data;
+ char *buffer;
+ gsize buffer_size;
+ GError *error = NULL;
+ DomDocument *document;
+ char *extension;
+ char *new_buffer;
+ gsize new_buffer_size;
+ char *catalogs_path;
+ char *relative_path;
+ char *tmp_path;
+ char *full_path_no_ext;
+ char *full_path;
+ GFile *catalog_file;
+ GFile *catalog_dir;
+ char *catalog_dir_path;
if (g_file_info_get_file_type (info) != G_FILE_TYPE_REGULAR)
return;
@@ -415,7 +429,7 @@ migration_for_each_file (GFile *file,
new_buffer = dom_document_dump (document, &new_buffer_size);
catalogs_path = gth_user_dir_get_file (GTH_DIR_DATA, "gthumb", "catalogs", NULL);
- relative_path = g_file_get_relative_path (collections_dir, file);
+ relative_path = g_file_get_relative_path (data->collections_dir, file);
tmp_path = g_strconcat (catalogs_path, G_DIR_SEPARATOR_S, relative_path, NULL);
full_path_no_ext = _g_uri_remove_extension (tmp_path);
full_path = g_strconcat (full_path_no_ext, extension, NULL);
@@ -468,16 +482,21 @@ migration_start_dir (GFile *directory,
void
migrate_catalogs_from_2_10 (void)
{
- GFile *home_dir;
- GFile *collections_dir;
+ MigrationData *data;
+ GFile *home_dir;
- if (eel_gconf_get_boolean (PREF_DATA_MIGRATION_CATALOGS_2_10, FALSE))
+ data = g_new0 (MigrationData, 1);
+ data->settings = g_settings_new (GTHUMB_DATA_MIGRATION_SCHEMA);
+
+ if (g_settings_get_boolean (data->settings, PREF_DATA_MIGRATION_CATALOGS_2_10)) {
+ migration_data_free (data);
return;
+ }
home_dir = g_file_new_for_path (g_get_home_dir ());
- collections_dir = _g_file_get_child (home_dir, ".gnome2", "gthumb", "collections", NULL);
+ data->collections_dir = _g_file_get_child (home_dir, ".gnome2", "gthumb", "collections", NULL);
- g_directory_foreach_child (collections_dir,
+ g_directory_foreach_child (data->collections_dir,
TRUE,
TRUE,
"standard::name,standard::type",
@@ -485,7 +504,7 @@ migrate_catalogs_from_2_10 (void)
migration_start_dir,
migration_for_each_file,
migration_done,
- collections_dir);
+ data);
g_object_unref (home_dir);
}
diff --git a/gthumb/main.c b/gthumb/main.c
index 34ed4bb..e9d5ce5 100644
--- a/gthumb/main.c
+++ b/gthumb/main.c
@@ -34,7 +34,6 @@
# include "eggsmclient.h"
#endif
#include "eggdesktopfile.h"
-#include "gconf-utils.h"
#include "glib-utils.h"
#include "gth-browser.h"
#include "gth-file-data.h"
@@ -406,12 +405,14 @@ gth_application_command_line (GApplication *application,
}
if (remaining_args == NULL) { /* No location specified. */
- GFile *location;
- char *file_to_select_uri;
- GFile *file_to_select;
+ GFile *location;
+ GSettings *settings;
+ char *file_to_select_uri;
+ GFile *file_to_select;
location = g_file_new_for_uri (gth_pref_get_startup_location ());
- file_to_select_uri = eel_gconf_get_path (PREF_STARTUP_CURRENT_FILE, NULL);
+ settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
+ file_to_select_uri = _g_settings_get_uri (settings, PREF_BROWSER_STARTUP_CURRENT_FILE);
if (file_to_select_uri != NULL)
file_to_select = g_file_new_for_uri (file_to_select_uri);
else
@@ -422,6 +423,7 @@ gth_application_command_line (GApplication *application,
_g_object_unref (file_to_select);
g_free (file_to_select_uri);
+ g_object_unref (settings);
g_object_unref (location);
return 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]