diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/eom-config-keys.h | 78 | ||||
-rw-r--r-- | src/eom-file-chooser.c | 1 | ||||
-rw-r--r-- | src/eom-plugin-engine.c | 112 | ||||
-rw-r--r-- | src/eom-preferences-dialog.c | 307 | ||||
-rw-r--r-- | src/eom-preferences-dialog.h | 5 | ||||
-rw-r--r-- | src/eom-window.c | 584 |
6 files changed, 381 insertions, 706 deletions
diff --git a/src/eom-config-keys.h b/src/eom-config-keys.h index f96503b..c4a35ae 100644 --- a/src/eom-config-keys.h +++ b/src/eom-config-keys.h @@ -1,12 +1,13 @@ -/* Eye Of Mate - MateConf Keys Macros +/* Eye Of Mate - GSettings Keys and Schemas definitions * * Copyright (C) 2000-2006 The Free Software Foundation * * Author: Lucas Rocha <[email protected]> + * Stefano Karapetsas <[email protected]> * * Based on code by: - * - Federico Mena-Quintero <[email protected]> - * - Jens Finke <[email protected]> + * - Federico Mena-Quintero <[email protected]> + * - Jens Finke <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,38 +27,43 @@ #ifndef __EOM_CONFIG_KEYS_H__ #define __EOM_CONFIG_KEYS_H__ -#define EOM_CONF_DIR "/apps/eom" - -#define EOM_CONF_DESKTOP_WALLPAPER "/desktop/mate/background/picture_filename" -#define EOM_CONF_DESKTOP_CAN_SAVE "/desktop/mate/lockdown/disable_save_to_disk" -#define EOM_CONF_DESKTOP_CAN_PRINT "/desktop/mate/lockdown/disable_printing" -#define EOM_CONF_DESKTOP_CAN_SETUP_PAGE "/desktop/mate/lockdown/disable_print_setup" - -#define EOM_CONF_VIEW_BACKGROUND_COLOR "/apps/eom/view/background-color" -#define EOM_CONF_VIEW_INTERPOLATE "/apps/eom/view/interpolate" -#define EOM_CONF_VIEW_EXTRAPOLATE "/apps/eom/view/extrapolate" -#define EOM_CONF_VIEW_SCROLL_WHEEL_ZOOM "/apps/eom/view/scroll_wheel_zoom" -#define EOM_CONF_VIEW_ZOOM_MULTIPLIER "/apps/eom/view/zoom_multiplier" -#define EOM_CONF_VIEW_AUTOROTATE "/apps/eom/view/autorotate" -#define EOM_CONF_VIEW_TRANSPARENCY "/apps/eom/view/transparency" -#define EOM_CONF_VIEW_TRANS_COLOR "/apps/eom/view/trans_color" -#define EOM_CONF_VIEW_USE_BG_COLOR "/apps/eom/view/use-background-color" - -#define EOM_CONF_FULLSCREEN_LOOP "/apps/eom/full_screen/loop" -#define EOM_CONF_FULLSCREEN_UPSCALE "/apps/eom/full_screen/upscale" -#define EOM_CONF_FULLSCREEN_SECONDS "/apps/eom/full_screen/seconds" - -#define EOM_CONF_UI_TOOLBAR "/apps/eom/ui/toolbar" -#define EOM_CONF_UI_STATUSBAR "/apps/eom/ui/statusbar" -#define EOM_CONF_UI_IMAGE_COLLECTION "/apps/eom/ui/image_collection" -#define EOM_CONF_UI_IMAGE_COLLECTION_POSITION "/apps/eom/ui/image_collection_position" -#define EOM_CONF_UI_IMAGE_COLLECTION_RESIZABLE "/apps/eom/ui/image_collection_resizable" -#define EOM_CONF_UI_SIDEBAR "/apps/eom/ui/sidebar" -#define EOM_CONF_UI_SCROLL_BUTTONS "/apps/eom/ui/scroll_buttons" -#define EOM_CONF_UI_DISABLE_TRASH_CONFIRMATION "/apps/eom/ui/disable_trash_confirmation" -#define EOM_CONF_UI_FILECHOOSER_XDG_FALLBACK "/apps/eom/ui/filechooser_xdg_fallback" -#define EOM_CONF_UI_PROPSDIALOG_NETBOOK_MODE "/apps/eom/ui/propsdialog_netbook_mode" - -#define EOM_CONF_PLUGINS_ACTIVE_PLUGINS "/apps/eom/plugins/active_plugins" +#define EOM_CONF_BACKGROUND_SCHEMA "org.mate.background" +#define EOM_CONF_BACKGROUND_FILE "picture-filename" + +#define EOM_CONF_LOCKDOWN_SCHEMA "org.mate.lockdown" +#define EOM_CONF_LOCKDOWN_CAN_SAVE "disable-save-to-disk" +#define EOM_CONF_LOCKDOWN_CAN_PRINT "disable-printing" +#define EOM_CONF_LOCKDOWN_CAN_SETUP_PAGE "disable-print-setup" + +#define EOM_CONF_VIEW_SCHEMA "org.mate.eom.view" +#define EOM_CONF_VIEW_BACKGROUND_COLOR "background-color" +#define EOM_CONF_VIEW_INTERPOLATE "interpolate" +#define EOM_CONF_VIEW_EXTRAPOLATE "extrapolate" +#define EOM_CONF_VIEW_SCROLL_WHEEL_ZOOM "scroll-wheel-zoom" +#define EOM_CONF_VIEW_ZOOM_MULTIPLIER "zoom-multiplier" +#define EOM_CONF_VIEW_AUTOROTATE "autorotate" +#define EOM_CONF_VIEW_TRANSPARENCY "transparency" +#define EOM_CONF_VIEW_TRANS_COLOR "trans-color" +#define EOM_CONF_VIEW_USE_BG_COLOR "use-background-color" + +#define EOM_CONF_FULLSCREEN_SCHEMA "org.mate.eom.full-screen" +#define EOM_CONF_FULLSCREEN_LOOP "loop" +#define EOM_CONF_FULLSCREEN_UPSCALE "upscale" +#define EOM_CONF_FULLSCREEN_SECONDS "seconds" + +#define EOM_CONF_UI_SCHEMA "org.mate.eom.ui" +#define EOM_CONF_UI_TOOLBAR "toolbar" +#define EOM_CONF_UI_STATUSBAR "statusbar" +#define EOM_CONF_UI_IMAGE_COLLECTION "image-collection" +#define EOM_CONF_UI_IMAGE_COLLECTION_POSITION "image-collection-position" +#define EOM_CONF_UI_IMAGE_COLLECTION_RESIZABLE "image-collection-resizable" +#define EOM_CONF_UI_SIDEBAR "sidebar" +#define EOM_CONF_UI_SCROLL_BUTTONS "scroll-buttons" +#define EOM_CONF_UI_DISABLE_TRASH_CONFIRMATION "disable-trash-confirmation" +#define EOM_CONF_UI_FILECHOOSER_XDG_FALLBACK "filechooser-xdg-fallback" +#define EOM_CONF_UI_PROPSDIALOG_NETBOOK_MODE "propsdialog-netbook-mode" + +#define EOM_CONF_PLUGINS_SCHEMA "org.mate.eom.plugins" +#define EOM_CONF_PLUGINS_ACTIVE_PLUGINS "active-plugins" #endif /* __EOM_CONFIG_KEYS_H__ */ diff --git a/src/eom-file-chooser.c b/src/eom-file-chooser.c index 8a13393..c73d268 100644 --- a/src/eom-file-chooser.c +++ b/src/eom-file-chooser.c @@ -29,7 +29,6 @@ #include <glib/gi18n.h> #include <gio/gio.h> #include <gtk/gtk.h> -#include <mateconf/mateconf-client.h> /* We must define MATE_DESKTOP_USE_UNSTABLE_API to be able to use MateDesktopThumbnail */ diff --git a/src/eom-plugin-engine.c b/src/eom-plugin-engine.c index a9cd6a7..b283ea4 100644 --- a/src/eom-plugin-engine.c +++ b/src/eom-plugin-engine.c @@ -38,7 +38,7 @@ #include <glib/gi18n.h> #include <glib.h> -#include <mateconf/mateconf-client.h> +#include <gio/gio.h> #ifdef ENABLE_PYTHON #include "eom-python-module.h" @@ -46,8 +46,6 @@ #define USER_EOM_PLUGINS_LOCATION "plugins/" -#define EOM_PLUGINS_ENGINE_BASE_KEY "/apps/eom/plugins" - #define PLUGIN_EXT ".eom-plugin" typedef enum { @@ -80,14 +78,13 @@ struct _EomPluginInfo gint available : 1; }; -static void eom_plugin_engine_active_plugins_changed (MateConfClient *client, - guint cnxn_id, - MateConfEntry *entry, +static void eom_plugin_engine_active_plugins_changed (GSettings *settings, + gchar *key, gpointer user_data); static GList *eom_plugins_list = NULL; -static MateConfClient *eom_plugin_engine_mateconf_client = NULL; +static GSettings *eom_plugin_engine_settings = NULL; static GSList *active_plugins = NULL; @@ -296,7 +293,7 @@ eom_plugin_engine_load_dir (const gchar *dir) return; } - g_return_if_fail (eom_plugin_engine_mateconf_client != NULL); + g_return_if_fail (eom_plugin_engine_settings != NULL); eom_debug_message (DEBUG_PLUGINS, "DIR: %s", dir); @@ -369,6 +366,22 @@ eom_plugin_engine_load_all (void) eom_plugin_engine_load_dir (EOM_PLUGIN_DIR "/"); } +static void +eom_plugin_engine_get_active_plugins (void) +{ + gchar **array; + gint i; + + active_plugins = NULL; + array = g_settings_get_strv (eom_plugin_engine_settings, EOM_CONF_PLUGINS_ACTIVE_PLUGINS); + if (array != NULL) { + for (i = 0; array[i]; i++) { + active_plugins = g_slist_append (active_plugins, g_strdup (array[i])); + } + } + g_strfreev (array); +} + gboolean eom_plugin_engine_init (void) { @@ -382,24 +395,14 @@ eom_plugin_engine_init (void) return FALSE; } - eom_plugin_engine_mateconf_client = mateconf_client_get_default (); - - g_return_val_if_fail (eom_plugin_engine_mateconf_client != NULL, FALSE); + eom_plugin_engine_settings = g_settings_new (EOM_CONF_PLUGINS_SCHEMA); - mateconf_client_add_dir (eom_plugin_engine_mateconf_client, - EOM_PLUGINS_ENGINE_BASE_KEY, - MATECONF_CLIENT_PRELOAD_ONELEVEL, - NULL); + g_signal_connect (eom_plugin_engine_settings, + "changed::" EOM_CONF_PLUGINS_ACTIVE_PLUGINS, + G_CALLBACK (eom_plugin_engine_active_plugins_changed), + NULL); - mateconf_client_notify_add (eom_plugin_engine_mateconf_client, - EOM_CONF_PLUGINS_ACTIVE_PLUGINS, - eom_plugin_engine_active_plugins_changed, - NULL, NULL, NULL); - - active_plugins = mateconf_client_get_list (eom_plugin_engine_mateconf_client, - EOM_CONF_PLUGINS_ACTIVE_PLUGINS, - MATECONF_VALUE_STRING, - NULL); + eom_plugin_engine_get_active_plugins (); eom_plugin_engine_load_all (); @@ -431,7 +434,7 @@ eom_plugin_engine_shutdown (void) eom_python_shutdown (); #endif - g_return_if_fail (eom_plugin_engine_mateconf_client != NULL); + g_return_if_fail (eom_plugin_engine_settings != NULL); for (pl = eom_plugins_list; pl; pl = pl->next) { EomPluginInfo *info = (EomPluginInfo*) pl->data; @@ -447,8 +450,8 @@ eom_plugin_engine_shutdown (void) g_list_free (eom_plugins_list); eom_plugins_list = NULL; - g_object_unref (eom_plugin_engine_mateconf_client); - eom_plugin_engine_mateconf_client = NULL; + g_object_unref (eom_plugin_engine_settings); + eom_plugin_engine_settings = NULL; } const GList * @@ -619,7 +622,6 @@ eom_plugin_engine_activate_plugin (EomPluginInfo *info) return TRUE; if (eom_plugin_engine_activate_plugin_real (info)) { - gboolean res; GSList *list; /* Update plugin state */ @@ -641,14 +643,15 @@ eom_plugin_engine_activate_plugin (EomPluginInfo *info) g_strdup (info->location), (GCompareFunc)strcmp); - res = mateconf_client_set_list (eom_plugin_engine_mateconf_client, - EOM_CONF_PLUGINS_ACTIVE_PLUGINS, - MATECONF_VALUE_STRING, - active_plugins, - NULL); - - if (!res) - g_warning ("Error saving the list of active plugins."); + GArray *array; + GSList *l; + array = g_array_new (TRUE, TRUE, sizeof (gchar *)); + for (l = active_plugins; l; l = l->next) { + array = g_array_append_val (array, l->data); + } + g_settings_set_strv (eom_plugin_engine_settings, EOM_CONF_PLUGINS_ACTIVE_PLUGINS, + (const gchar **) array->data); + g_array_free (array, TRUE); return TRUE; } @@ -707,14 +710,15 @@ eom_plugin_engine_deactivate_plugin (EomPluginInfo *info) return TRUE; } - res = mateconf_client_set_list (eom_plugin_engine_mateconf_client, - EOM_CONF_PLUGINS_ACTIVE_PLUGINS, - MATECONF_VALUE_STRING, - active_plugins, - NULL); - - if (!res) - g_warning ("Error saving the list of active plugins."); + GArray *array; + GSList *l; + array = g_array_new (TRUE, TRUE, sizeof (gchar *)); + for (l = active_plugins; l; l = l->next) { + array = g_array_append_val (array, l->data); + } + g_settings_set_strv (eom_plugin_engine_settings, EOM_CONF_PLUGINS_ACTIVE_PLUGINS, + (const gchar **) array->data); + g_array_free (array, TRUE); return TRUE; } @@ -837,9 +841,8 @@ eom_plugin_engine_configure_plugin (EomPluginInfo *info, } static void -eom_plugin_engine_active_plugins_changed (MateConfClient *client, - guint cnxn_id, - MateConfEntry *entry, +eom_plugin_engine_active_plugins_changed (GSettings *settings, + gchar *key, gpointer user_data) { GList *pl; @@ -847,19 +850,10 @@ eom_plugin_engine_active_plugins_changed (MateConfClient *client, eom_debug (DEBUG_PLUGINS); - g_return_if_fail (entry->key != NULL); - g_return_if_fail (entry->value != NULL); - - if (!((entry->value->type == MATECONF_VALUE_LIST) && - (mateconf_value_get_list_type (entry->value) == MATECONF_VALUE_STRING))) { - g_warning ("The mateconf key '%s' may be corrupted.", EOM_CONF_PLUGINS_ACTIVE_PLUGINS); - return; - } + g_return_if_fail (settings != NULL); + g_return_if_fail (key != NULL); - active_plugins = mateconf_client_get_list (eom_plugin_engine_mateconf_client, - EOM_CONF_PLUGINS_ACTIVE_PLUGINS, - MATECONF_VALUE_STRING, - NULL); + eom_plugin_engine_get_active_plugins (); for (pl = eom_plugins_list; pl; pl = pl->next) { EomPluginInfo *info = (EomPluginInfo*)pl->data; diff --git a/src/eom-preferences-dialog.c b/src/eom-preferences-dialog.c index 1eaa605..e11847b 100644 --- a/src/eom-preferences-dialog.c +++ b/src/eom-preferences-dialog.c @@ -35,65 +35,26 @@ #include <glib/gi18n.h> #include <glib-object.h> #include <gtk/gtk.h> -#include <mateconf/mateconf-client.h> +#include <gio/gio.h> #define EOM_PREFERENCES_DIALOG_GET_PRIVATE(object) \ (G_TYPE_INSTANCE_GET_PRIVATE ((object), EOM_TYPE_PREFERENCES_DIALOG, EomPreferencesDialogPrivate)) G_DEFINE_TYPE (EomPreferencesDialog, eom_preferences_dialog, EOM_TYPE_DIALOG); -enum { - PROP_0, - PROP_MATECONF_CLIENT, -}; - -#define MATECONF_OBJECT_KEY "MATECONF_KEY" -#define MATECONF_OBJECT_VALUE "MATECONF_VALUE" -#define TOGGLE_INVERT_VALUE "TOGGLE_INVERT_VALUE" +#define GSETTINGS_OBJECT_KEY "GSETTINGS_KEY" +#define GSETTINGS_OBJECT_VALUE "GSETTINGS_VALUE" struct _EomPreferencesDialogPrivate { - MateConfClient *client; + GSettings *view_settings; + GSettings *ui_settings; + GSettings *fullscreen_settings; }; static GObject *instance = NULL; static void -pd_check_toggle_cb (GtkWidget *widget, gpointer data) -{ - char *key = NULL; - gboolean invert = FALSE; - gboolean value; - - key = g_object_get_data (G_OBJECT (widget), MATECONF_OBJECT_KEY); - invert = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), TOGGLE_INVERT_VALUE)); - - value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); - - if (key == NULL) return; - - mateconf_client_set_bool (MATECONF_CLIENT (data), - key, - (invert) ? !value : value, - NULL); -} - -static void -pd_spin_button_changed_cb (GtkWidget *widget, gpointer data) -{ - char *key = NULL; - - key = g_object_get_data (G_OBJECT (widget), MATECONF_OBJECT_KEY); - - if (key == NULL) return; - - mateconf_client_set_int (MATECONF_CLIENT (data), - key, - gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget)), - NULL); -} - -static void -pd_color_change_cb (GtkColorButton *button, gpointer data) +pd_color_change_cb (GtkColorButton *button, GSettings *settings) { GdkColor color; char *key = NULL; @@ -106,20 +67,17 @@ pd_color_change_cb (GtkColorButton *button, gpointer data) color.green / 256, color.blue / 256); - key = g_object_get_data (G_OBJECT (button), MATECONF_OBJECT_KEY); + key = g_object_get_data (G_OBJECT (button), GSETTINGS_OBJECT_KEY); if (key == NULL || value == NULL) return; - mateconf_client_set_string (MATECONF_CLIENT (data), - key, - value, - NULL); + g_settings_set_string (settings, key, value); g_free (value); } static void -pd_radio_toggle_cb (GtkWidget *widget, gpointer data) +pd_radio_toggle_cb (GtkWidget *widget, GSettings *settings) { char *key = NULL; char *value = NULL; @@ -127,16 +85,13 @@ pd_radio_toggle_cb (GtkWidget *widget, gpointer data) if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) return; - key = g_object_get_data (G_OBJECT (widget), MATECONF_OBJECT_KEY); - value = g_object_get_data (G_OBJECT (widget), MATECONF_OBJECT_VALUE); + key = g_object_get_data (G_OBJECT (widget), GSETTINGS_OBJECT_KEY); + value = g_object_get_data (G_OBJECT (widget), GSETTINGS_OBJECT_VALUE); if (key == NULL || value == NULL) return; - mateconf_client_set_string (MATECONF_CLIENT (data), - key, - value, - NULL); + g_settings_set_string (settings, key, value); } static void @@ -152,36 +107,6 @@ eom_preferences_response_cb (GtkDialog *dlg, gint res_id, gpointer data) } } -static void -eom_preferences_dialog_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EomPreferencesDialog *pref_dlg = EOM_PREFERENCES_DIALOG (object); - - switch (prop_id) { - case PROP_MATECONF_CLIENT: - pref_dlg->priv->client = g_value_get_object (value); - break; - } -} - -static void -eom_preferences_dialog_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EomPreferencesDialog *pref_dlg = EOM_PREFERENCES_DIALOG (object); - - switch (prop_id) { - case PROP_MATECONF_CLIENT: - g_value_set_object (value, pref_dlg->priv->client); - break; - } -} - static GObject * eom_preferences_dialog_constructor (GType type, guint n_construct_properties, @@ -222,8 +147,8 @@ eom_preferences_dialog_constructor (GType type, "interpolate_check", &interpolate_check, "extrapolate_check", &extrapolate_check, "autorotate_check", &autorotate_check, - "bg_color_check", &bg_color_check, - "bg_color_button", &bg_color_button, + "bg_color_check", &bg_color_check, + "bg_color_button", &bg_color_button, "color_radio", &color_radio, "checkpattern_radio", &checkpattern_radio, "background_radio", &background_radio, @@ -239,61 +164,29 @@ eom_preferences_dialog_constructor (GType type, G_CALLBACK (eom_preferences_response_cb), dlg); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (interpolate_check), - mateconf_client_get_bool (priv->client, - EOM_CONF_VIEW_INTERPOLATE, - NULL)); - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extrapolate_check), - mateconf_client_get_bool (priv->client, - EOM_CONF_VIEW_EXTRAPOLATE, - NULL)); - - g_object_set_data (G_OBJECT (interpolate_check), - MATECONF_OBJECT_KEY, - EOM_CONF_VIEW_INTERPOLATE); - - g_object_set_data (G_OBJECT (extrapolate_check), - MATECONF_OBJECT_KEY, - EOM_CONF_VIEW_EXTRAPOLATE); - - g_signal_connect (G_OBJECT (interpolate_check), - "toggled", - G_CALLBACK (pd_check_toggle_cb), - priv->client); - - g_signal_connect (G_OBJECT (extrapolate_check), - "toggled", - G_CALLBACK (pd_check_toggle_cb), - priv->client); - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (autorotate_check), - mateconf_client_get_bool (priv->client, - EOM_CONF_VIEW_AUTOROTATE, - NULL)); - - g_object_set_data (G_OBJECT (autorotate_check), - MATECONF_OBJECT_KEY, - EOM_CONF_VIEW_AUTOROTATE); - - g_signal_connect (G_OBJECT (autorotate_check), - "toggled", - G_CALLBACK (pd_check_toggle_cb), - priv->client); - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bg_color_check), - mateconf_client_get_bool (priv->client, - EOM_CONF_VIEW_USE_BG_COLOR, NULL)); - g_object_set_data (G_OBJECT (bg_color_check), - MATECONF_OBJECT_KEY, - EOM_CONF_VIEW_USE_BG_COLOR); - g_signal_connect (G_OBJECT (bg_color_check), - "toggled", G_CALLBACK (pd_check_toggle_cb), - priv->client); - - value = mateconf_client_get_string (priv->client, - EOM_CONF_VIEW_BACKGROUND_COLOR, - NULL); + g_settings_bind (priv->view_settings, + EOM_CONF_VIEW_INTERPOLATE, + G_OBJECT (interpolate_check), + "active", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (priv->view_settings, + EOM_CONF_VIEW_EXTRAPOLATE, + G_OBJECT (extrapolate_check), + "active", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (priv->view_settings, + EOM_CONF_VIEW_AUTOROTATE, + G_OBJECT (autorotate_check), + "active", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (priv->view_settings, + EOM_CONF_VIEW_USE_BG_COLOR, + G_OBJECT (bg_color_check), + "active", + G_SETTINGS_BIND_DEFAULT); + + value = g_settings_get_string (priv->view_settings, + EOM_CONF_VIEW_BACKGROUND_COLOR); if (gdk_color_parse (value, &color)){ gtk_color_button_set_color (GTK_COLOR_BUTTON (bg_color_button), &color); @@ -301,58 +194,55 @@ eom_preferences_dialog_constructor (GType type, g_free (value); g_object_set_data (G_OBJECT (bg_color_button), - MATECONF_OBJECT_KEY, + GSETTINGS_OBJECT_KEY, EOM_CONF_VIEW_BACKGROUND_COLOR); g_signal_connect (G_OBJECT (bg_color_button), "color-set", G_CALLBACK (pd_color_change_cb), - priv->client); - - + priv->view_settings); g_object_set_data (G_OBJECT (color_radio), - MATECONF_OBJECT_KEY, + GSETTINGS_OBJECT_KEY, EOM_CONF_VIEW_TRANSPARENCY); g_object_set_data (G_OBJECT (color_radio), - MATECONF_OBJECT_VALUE, + GSETTINGS_OBJECT_VALUE, "COLOR"); g_signal_connect (G_OBJECT (color_radio), "toggled", G_CALLBACK (pd_radio_toggle_cb), - priv->client); + priv->view_settings); g_object_set_data (G_OBJECT (checkpattern_radio), - MATECONF_OBJECT_KEY, + GSETTINGS_OBJECT_KEY, EOM_CONF_VIEW_TRANSPARENCY); g_object_set_data (G_OBJECT (checkpattern_radio), - MATECONF_OBJECT_VALUE, + GSETTINGS_OBJECT_VALUE, "CHECK_PATTERN"); g_signal_connect (G_OBJECT (checkpattern_radio), "toggled", G_CALLBACK (pd_radio_toggle_cb), - priv->client); + priv->view_settings); g_object_set_data (G_OBJECT (background_radio), - MATECONF_OBJECT_KEY, + GSETTINGS_OBJECT_KEY, EOM_CONF_VIEW_TRANSPARENCY); g_object_set_data (G_OBJECT (background_radio), - MATECONF_OBJECT_VALUE, + GSETTINGS_OBJECT_VALUE, "NONE"); g_signal_connect (G_OBJECT (background_radio), "toggled", G_CALLBACK (pd_radio_toggle_cb), - priv->client); + priv->view_settings); - value = mateconf_client_get_string (priv->client, - EOM_CONF_VIEW_TRANSPARENCY, - NULL); + value = g_settings_get_string (priv->view_settings, + EOM_CONF_VIEW_TRANSPARENCY); if (g_ascii_strcasecmp (value, "COLOR") == 0) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (color_radio), TRUE); @@ -366,9 +256,8 @@ eom_preferences_dialog_constructor (GType type, g_free (value); - value = mateconf_client_get_string (priv->client, - EOM_CONF_VIEW_TRANS_COLOR, - NULL); + value = g_settings_get_string (priv->view_settings, + EOM_CONF_VIEW_TRANS_COLOR); if (gdk_color_parse (value, &color)) { gtk_color_button_set_color (GTK_COLOR_BUTTON (color_button), @@ -376,57 +265,33 @@ eom_preferences_dialog_constructor (GType type, } g_object_set_data (G_OBJECT (color_button), - MATECONF_OBJECT_KEY, + GSETTINGS_OBJECT_KEY, EOM_CONF_VIEW_TRANS_COLOR); g_signal_connect (G_OBJECT (color_button), "color-set", G_CALLBACK (pd_color_change_cb), - priv->client); + priv->view_settings); g_free (value); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (upscale_check), - mateconf_client_get_bool (priv->client, - EOM_CONF_FULLSCREEN_UPSCALE, - NULL)); + g_settings_bind (priv->fullscreen_settings, + EOM_CONF_FULLSCREEN_UPSCALE, + G_OBJECT (upscale_check), + "active", + G_SETTINGS_BIND_DEFAULT); - g_object_set_data (G_OBJECT (upscale_check), - MATECONF_OBJECT_KEY, - EOM_CONF_FULLSCREEN_UPSCALE); + g_settings_bind (priv->fullscreen_settings, + EOM_CONF_FULLSCREEN_LOOP, + G_OBJECT (loop_check), + "active", + G_SETTINGS_BIND_DEFAULT); - g_signal_connect (G_OBJECT (upscale_check), - "toggled", - G_CALLBACK (pd_check_toggle_cb), - priv->client); - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (loop_check), - mateconf_client_get_bool (priv->client, - EOM_CONF_FULLSCREEN_LOOP, - NULL)); - - g_object_set_data (G_OBJECT (loop_check), - MATECONF_OBJECT_KEY, - EOM_CONF_FULLSCREEN_LOOP); - - g_signal_connect (G_OBJECT (loop_check), - "toggled", - G_CALLBACK (pd_check_toggle_cb), - priv->client); - - gtk_spin_button_set_value (GTK_SPIN_BUTTON (seconds_spin), - mateconf_client_get_int (priv->client, - EOM_CONF_FULLSCREEN_SECONDS, - NULL)); - - g_object_set_data (G_OBJECT (seconds_spin), - MATECONF_OBJECT_KEY, - EOM_CONF_FULLSCREEN_SECONDS); - - g_signal_connect (G_OBJECT (seconds_spin), - "value-changed", - G_CALLBACK (pd_spin_button_changed_cb), - priv->client); + g_settings_bind (priv->fullscreen_settings, + EOM_CONF_FULLSCREEN_SECONDS, + G_OBJECT (seconds_spin), + "value", + G_SETTINGS_BIND_DEFAULT); plugin_manager = eom_plugin_manager_new (); @@ -444,25 +309,22 @@ eom_preferences_dialog_constructor (GType type, } static void +eom_preferences_dialog_dispose (EomPreferencesDialog *pref_dlg) +{ + pref_dlg->priv = EOM_PREFERENCES_DIALOG_GET_PRIVATE (pref_dlg); + + g_object_unref (pref_dlg->priv->view_settings); + g_object_unref (pref_dlg->priv->fullscreen_settings); + g_object_unref (pref_dlg->priv->ui_settings); +} + +static void eom_preferences_dialog_class_init (EomPreferencesDialogClass *class) { GObjectClass *g_object_class = (GObjectClass *) class; g_object_class->constructor = eom_preferences_dialog_constructor; - g_object_class->set_property = eom_preferences_dialog_set_property; - g_object_class->get_property = eom_preferences_dialog_get_property; - - g_object_class_install_property (g_object_class, - PROP_MATECONF_CLIENT, - g_param_spec_object ("mateconf-client", - "MateConf Client", - "MateConf Client", - MATECONF_TYPE_CLIENT, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_NAME | - G_PARAM_STATIC_NICK | - G_PARAM_STATIC_BLURB)); + g_object_class->dispose = eom_preferences_dialog_dispose; g_type_class_add_private (g_object_class, sizeof (EomPreferencesDialogPrivate)); } @@ -472,16 +334,17 @@ eom_preferences_dialog_init (EomPreferencesDialog *pref_dlg) { pref_dlg->priv = EOM_PREFERENCES_DIALOG_GET_PRIVATE (pref_dlg); - pref_dlg->priv->client = NULL; + pref_dlg->priv->view_settings = g_settings_new (EOM_CONF_VIEW_SCHEMA); + pref_dlg->priv->fullscreen_settings = g_settings_new (EOM_CONF_FULLSCREEN_SCHEMA); + pref_dlg->priv->ui_settings = g_settings_new (EOM_CONF_UI_SCHEMA); } GObject * -eom_preferences_dialog_get_instance (GtkWindow *parent, MateConfClient *client) +eom_preferences_dialog_get_instance (GtkWindow *parent) { if (instance == NULL) { instance = g_object_new (EOM_TYPE_PREFERENCES_DIALOG, "parent-window", parent, - "mateconf-client", client, NULL); } diff --git a/src/eom-preferences-dialog.h b/src/eom-preferences-dialog.h index 685cffd..dd7d184 100644 --- a/src/eom-preferences-dialog.h +++ b/src/eom-preferences-dialog.h @@ -29,7 +29,7 @@ #include <glib.h> #include <glib-object.h> #include <gtk/gtk.h> -#include <mateconf/mateconf-client.h> +#include <gio/gio.h> G_BEGIN_DECLS @@ -58,8 +58,7 @@ G_GNUC_INTERNAL GType eom_preferences_dialog_get_type (void) G_GNUC_CONST; G_GNUC_INTERNAL -GObject *eom_preferences_dialog_get_instance (GtkWindow *parent, - MateConfClient *client); +GObject *eom_preferences_dialog_get_instance (GtkWindow *parent); G_END_DECLS diff --git a/src/eom-window.c b/src/eom-window.c index 7114899..db49a7b 100644 --- a/src/eom-window.c +++ b/src/eom-window.c @@ -65,7 +65,6 @@ #include <gio/gio.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> -#include <mateconf/mateconf-client.h> #if HAVE_LCMS #include <X11/Xlib.h> @@ -116,32 +115,16 @@ enum { static gint signals[SIGNAL_LAST]; -/* MateConfNotifications */ -enum { - EOM_WINDOW_NOTIFY_INTERPOLATE, - EOM_WINDOW_NOTIFY_EXTRAPOLATE, - EOM_WINDOW_NOTIFY_SCROLLWHEEL_ZOOM, - EOM_WINDOW_NOTIFY_ZOOM_MULTIPLIER, - EOM_WINDOW_NOTIFY_BACKGROUND_COLOR, - EOM_WINDOW_NOTIFY_USE_BG_COLOR, - EOM_WINDOW_NOTIFY_TRANSPARENCY, - EOM_WINDOW_NOTIFY_TRANS_COLOR, - EOM_WINDOW_NOTIFY_SCROLL_BUTTONS, - EOM_WINDOW_NOTIFY_COLLECTION_POS, - EOM_WINDOW_NOTIFY_COLLECTION_RESIZABLE, - EOM_WINDOW_NOTIFY_CAN_SAVE, - EOM_WINDOW_NOTIFY_PROPSDIALOG_NETBOOK_MODE, - EOM_WINDOW_NOTIFY_LENGTH -}; - struct _EomWindowPrivate { - MateConfClient *client; - guint client_notifications[EOM_WINDOW_NOTIFY_LENGTH]; + GSettings *view_settings; + GSettings *ui_settings; + GSettings *fullscreen_settings; + GSettings *lockdown_settings; EomListStore *store; EomImage *image; - EomWindowMode mode; - EomWindowStatus status; + EomWindowMode mode; + EomWindowStatus status; GtkUIManager *ui_mgr; GtkWidget *box; @@ -152,16 +135,16 @@ struct _EomWindowPrivate { GtkWidget *thumbview; GtkWidget *statusbar; GtkWidget *nav; - GtkWidget *message_area; - GtkWidget *toolbar; - GObject *properties_dlg; + GtkWidget *message_area; + GtkWidget *toolbar; + GObject *properties_dlg; GtkActionGroup *actions_window; GtkActionGroup *actions_image; GtkActionGroup *actions_collection; GtkActionGroup *actions_recent; - GtkWidget *fullscreen_popup; + GtkWidget *fullscreen_popup; GSource *fullscreen_timeout_source; gboolean slideshow_loop; @@ -234,10 +217,7 @@ eom_window_error_quark (void) } static void -eom_window_interp_in_type_changed_cb (MateConfClient *client, - guint cnxn_id, - MateConfEntry *entry, - gpointer user_data) +eom_window_interp_in_type_changed_cb (GSettings *settings, gchar *key, gpointer user_data) { EomWindowPrivate *priv; gboolean interpolate_in = TRUE; @@ -250,19 +230,14 @@ eom_window_interp_in_type_changed_cb (MateConfClient *client, g_return_if_fail (EOM_IS_SCROLL_VIEW (priv->view)); - if (entry->value != NULL && entry->value->type == MATECONF_VALUE_BOOL) { - interpolate_in = mateconf_value_get_bool (entry->value); - } + interpolate_in = g_settings_get_boolean (settings, key); eom_scroll_view_set_antialiasing_in (EOM_SCROLL_VIEW (priv->view), interpolate_in); } static void -eom_window_interp_out_type_changed_cb (MateConfClient *client, - guint cnxn_id, - MateConfEntry *entry, - gpointer user_data) +eom_window_interp_out_type_changed_cb (GSettings *settings, gchar *key, gpointer user_data) { EomWindowPrivate *priv; gboolean interpolate_out = TRUE; @@ -275,19 +250,14 @@ eom_window_interp_out_type_changed_cb (MateConfClient *client, g_return_if_fail (EOM_IS_SCROLL_VIEW (priv->view)); - if (entry->value != NULL && entry->value->type == MATECONF_VALUE_BOOL) { - interpolate_out = mateconf_value_get_bool (entry->value); - } + interpolate_out = g_settings_get_boolean (settings, key); eom_scroll_view_set_antialiasing_out (EOM_SCROLL_VIEW (priv->view), interpolate_out); } static void -eom_window_scroll_wheel_zoom_changed_cb (MateConfClient *client, - guint cnxn_id, - MateConfEntry *entry, - gpointer user_data) +eom_window_scroll_wheel_zoom_changed_cb (GSettings *settings, gchar *key, gpointer user_data) { EomWindowPrivate *priv; gboolean scroll_wheel_zoom = FALSE; @@ -300,19 +270,14 @@ eom_window_scroll_wheel_zoom_changed_cb (MateConfClient *client, g_return_if_fail (EOM_IS_SCROLL_VIEW (priv->view)); - if (entry->value != NULL && entry->value->type == MATECONF_VALUE_BOOL) { - scroll_wheel_zoom = mateconf_value_get_bool (entry->value); - } + scroll_wheel_zoom = g_settings_get_boolean (settings, key); eom_scroll_view_set_scroll_wheel_zoom (EOM_SCROLL_VIEW (priv->view), scroll_wheel_zoom); } static void -eom_window_zoom_multiplier_changed_cb (MateConfClient *client, - guint cnxn_id, - MateConfEntry *entry, - gpointer user_data) +eom_window_zoom_multiplier_changed_cb (GSettings *settings, gchar *key, gpointer user_data) { EomWindowPrivate *priv; gdouble multiplier = 0.05; @@ -325,22 +290,17 @@ eom_window_zoom_multiplier_changed_cb (MateConfClient *client, g_return_if_fail (EOM_IS_SCROLL_VIEW (priv->view)); - if (entry->value != NULL && entry->value->type == MATECONF_VALUE_FLOAT) { - multiplier = mateconf_value_get_float (entry->value); - } + multiplier = g_settings_get_double (settings, key); eom_scroll_view_set_zoom_multiplier (EOM_SCROLL_VIEW (priv->view), multiplier); } static void -eom_window_transparency_changed_cb (MateConfClient *client, - guint cnxn_id, - MateConfEntry *entry, - gpointer user_data) +eom_window_transparency_changed_cb (GSettings *settings, gchar *key, gpointer user_data) { EomWindowPrivate *priv; - const char *value = NULL; + char *value = NULL; g_return_if_fail (EOM_IS_WINDOW (user_data)); @@ -350,9 +310,7 @@ eom_window_transparency_changed_cb (MateConfClient *client, g_return_if_fail (EOM_IS_SCROLL_VIEW (priv->view)); - if (entry->value != NULL && entry->value->type == MATECONF_VALUE_STRING) { - value = mateconf_value_get_string (entry->value); - } + value = g_settings_get_string (settings, key); if (value == NULL) { return; @@ -360,8 +318,7 @@ eom_window_transparency_changed_cb (MateConfClient *client, GdkColor color; char *color_str; - color_str = mateconf_client_get_string (priv->client, - EOM_CONF_VIEW_TRANS_COLOR, NULL); + color_str = g_settings_get_string (priv->view_settings, EOM_CONF_VIEW_TRANS_COLOR); if (gdk_color_parse (color_str, &color)) { eom_scroll_view_set_transparency (EOM_SCROLL_VIEW (priv->view), EOM_TRANSP_COLOR, &color); @@ -374,17 +331,15 @@ eom_window_transparency_changed_cb (MateConfClient *client, eom_scroll_view_set_transparency (EOM_SCROLL_VIEW (priv->view), EOM_TRANSP_BACKGROUND, NULL); } + g_free (value); } static void -eom_window_bg_color_changed_cb (MateConfClient *client, - guint cnxn_id, - MateConfEntry *entry, - gpointer user_data) +eom_window_bg_color_changed_cb (GSettings *settings, gchar *key, gpointer user_data) { EomWindowPrivate *priv; GdkColor color; - const char *color_str; + char *color_str; g_return_if_fail (EOM_IS_WINDOW (user_data)); @@ -394,20 +349,16 @@ eom_window_bg_color_changed_cb (MateConfClient *client, g_return_if_fail (EOM_IS_SCROLL_VIEW (priv->view)); - if (entry->value != NULL && entry->value->type == MATECONF_VALUE_STRING) { - color_str = mateconf_value_get_string (entry->value); + color_str = g_settings_get_string (settings, key); - if (gdk_color_parse (color_str, &color)) { - eom_scroll_view_set_background_color (EOM_SCROLL_VIEW (priv->view), &color); - } + if (gdk_color_parse (color_str, &color)) { + eom_scroll_view_set_background_color (EOM_SCROLL_VIEW (priv->view), &color); } + g_free (color_str); } static void -eom_window_use_bg_color_changed_cb (MateConfClient *client, - guint cnxn_id, - MateConfEntry *entry, - gpointer user_data) +eom_window_use_bg_color_changed_cb (GSettings *settings, gchar *key, gpointer user_data) { EomWindowPrivate *priv; gboolean use_bg_color = TRUE; @@ -420,9 +371,7 @@ eom_window_use_bg_color_changed_cb (MateConfClient *client, g_return_if_fail (EOM_IS_SCROLL_VIEW (priv->view)); - if (entry->value != NULL && entry->value->type == MATECONF_VALUE_BOOL) { - use_bg_color = mateconf_value_get_bool (entry->value); - } + use_bg_color = g_settings_get_boolean (settings, key); eom_scroll_view_set_use_bg_color (EOM_SCROLL_VIEW (priv->view), use_bg_color); @@ -430,14 +379,11 @@ eom_window_use_bg_color_changed_cb (MateConfClient *client, static void -eom_window_trans_color_changed_cb (MateConfClient *client, - guint cnxn_id, - MateConfEntry *entry, - gpointer user_data) +eom_window_trans_color_changed_cb (GSettings *settings, gchar *key, gpointer user_data) { EomWindowPrivate *priv; GdkColor color; - const char *color_str; + char *color_str; char *value; g_return_if_fail (EOM_IS_WINDOW (user_data)); @@ -448,31 +394,25 @@ eom_window_trans_color_changed_cb (MateConfClient *client, g_return_if_fail (EOM_IS_SCROLL_VIEW (priv->view)); - value = mateconf_client_get_string (priv->client, - EOM_CONF_VIEW_TRANSPARENCY, - NULL); + value = g_settings_get_string (priv->view_settings, EOM_CONF_VIEW_TRANSPARENCY); if (!value || g_ascii_strcasecmp (value, "COLOR") != 0) { g_free (value); return; } - if (entry->value != NULL && entry->value->type == MATECONF_VALUE_STRING) { - color_str = mateconf_value_get_string (entry->value); + color_str = g_settings_get_string (settings, key); - if (gdk_color_parse (color_str, &color)) { - eom_scroll_view_set_transparency (EOM_SCROLL_VIEW (priv->view), - EOM_TRANSP_COLOR, &color); - } + if (gdk_color_parse (color_str, &color)) { + eom_scroll_view_set_transparency (EOM_SCROLL_VIEW (priv->view), + EOM_TRANSP_COLOR, &color); } g_free (value); + g_free (color_str); } static void -eom_window_scroll_buttons_changed_cb (MateConfClient *client, - guint cnxn_id, - MateConfEntry *entry, - gpointer user_data) +eom_window_scroll_buttons_changed_cb (GSettings *settings, gchar *key, gpointer user_data) { EomWindowPrivate *priv; gboolean show_buttons = TRUE; @@ -485,22 +425,16 @@ eom_window_scroll_buttons_changed_cb (MateConfClient *client, g_return_if_fail (EOM_IS_SCROLL_VIEW (priv->view)); - if (entry->value != NULL && entry->value->type == MATECONF_VALUE_BOOL) { - show_buttons = mateconf_value_get_bool (entry->value); - } + show_buttons = g_settings_get_boolean (settings, key); eom_thumb_nav_set_show_buttons (EOM_THUMB_NAV (priv->nav), show_buttons); } static void -eom_window_collection_mode_changed_cb (MateConfClient *client, - guint cnxn_id, - MateConfEntry *entry, - gpointer user_data) +eom_window_collection_mode_changed_cb (GSettings *settings, gchar *key, gpointer user_data) { EomWindowPrivate *priv; - MateConfEntry *mode_entry; GtkWidget *hpaned; EomThumbNavMode mode = EOM_THUMB_NAV_MODE_ONE_ROW; gint position = 0; @@ -512,29 +446,8 @@ eom_window_collection_mode_changed_cb (MateConfClient *client, priv = EOM_WINDOW (user_data)->priv; - mode_entry = mateconf_client_get_entry (priv->client, - EOM_CONF_UI_IMAGE_COLLECTION_POSITION, - NULL, TRUE, NULL); - - if (G_LIKELY (mode_entry != NULL)) { - if (mode_entry->value != NULL && - mode_entry->value->type == MATECONF_VALUE_INT) { - position = mateconf_value_get_int (mode_entry->value); - } - mateconf_entry_unref (mode_entry); - } - - mode_entry = mateconf_client_get_entry (priv->client, - EOM_CONF_UI_IMAGE_COLLECTION_RESIZABLE, - NULL, TRUE, NULL); - - if (G_LIKELY (mode_entry != NULL)) { - if (mode_entry->value != NULL && - mode_entry->value->type == MATECONF_VALUE_BOOL) { - resizable = mateconf_value_get_bool (mode_entry->value); - } - mateconf_entry_unref (mode_entry); - } + position = g_settings_get_int (priv->ui_settings, EOM_CONF_UI_IMAGE_COLLECTION_POSITION); + resizable = g_settings_get_boolean (priv->ui_settings, EOM_CONF_UI_IMAGE_COLLECTION_RESIZABLE); if (priv->collection_position == position && priv->collection_resizable == resizable) @@ -624,10 +537,7 @@ eom_window_collection_mode_changed_cb (MateConfClient *client, } static void -eom_window_can_save_changed_cb (MateConfClient *client, - guint cnxn_id, - MateConfEntry *entry, - gpointer user_data) +eom_window_can_save_changed_cb (GSettings *settings, gchar *key, gpointer user_data) { EomWindowPrivate *priv; EomWindow *window; @@ -641,9 +551,7 @@ eom_window_can_save_changed_cb (MateConfClient *client, window = EOM_WINDOW (user_data); priv = EOM_WINDOW (user_data)->priv; - if (entry->value != NULL && entry->value->type == MATECONF_VALUE_BOOL) { - save_disabled = mateconf_value_get_bool (entry->value); - } + save_disabled = g_settings_get_boolean (settings, key); priv->save_disabled = save_disabled; @@ -668,10 +576,7 @@ eom_window_can_save_changed_cb (MateConfClient *client, } static void -eom_window_pd_nbmode_changed_cb (MateConfClient *client, - guint cnxn_id, - MateConfEntry *entry, - gpointer user_data) +eom_window_pd_nbmode_changed_cb (GSettings *settings, gchar *key, gpointer user_data) { EomWindow *window = EOM_WINDOW (user_data); @@ -679,7 +584,7 @@ eom_window_pd_nbmode_changed_cb (MateConfClient *client, gboolean netbook_mode; EomPropertiesDialog *dlg; - netbook_mode = mateconf_value_get_bool (entry->value); + netbook_mode = g_settings_get_boolean (settings, key); dlg = EOM_PROPERTIES_DIALOG (window->priv->properties_dlg); eom_properties_dialog_set_netbook_mode (dlg, netbook_mode); @@ -821,7 +726,11 @@ update_status_bar (EomWindow *window) if ((width > 0) && (height > 0)) { char *size_string; - size_string = g_format_size_for_display (bytes); + #if GLIB_CHECK_VERSION(2, 30, 0) + size_string = g_format_size (bytes); + #else + size_string = g_format_size_for_display (bytes); + #endif /* Translators: This is the string displayed in the statusbar * The tokens are from left to right: @@ -942,17 +851,12 @@ update_action_groups_state (EomWindow *window) } } else { if (priv->flags & EOM_STARTUP_DISABLE_COLLECTION) { - mateconf_client_set_bool (priv->client, - EOM_CONF_UI_IMAGE_COLLECTION, - FALSE, - NULL); + g_settings_set_boolean (priv->ui_settings, EOM_CONF_UI_IMAGE_COLLECTION, FALSE); show_image_collection = FALSE; } else { show_image_collection = - mateconf_client_get_bool (priv->client, - EOM_CONF_UI_IMAGE_COLLECTION, - NULL); + g_settings_get_boolean (priv->ui_settings, EOM_CONF_UI_IMAGE_COLLECTION); } show_image_collection = show_image_collection && @@ -987,17 +891,15 @@ update_action_groups_state (EomWindow *window) gtk_widget_grab_focus (priv->view); } - print_disabled = mateconf_client_get_bool (priv->client, - EOM_CONF_DESKTOP_CAN_PRINT, - NULL); + print_disabled = g_settings_get_boolean (priv->lockdown_settings, + EOM_CONF_LOCKDOWN_CAN_PRINT); if (print_disabled) { gtk_action_set_sensitive (action_print, FALSE); } - page_setup_disabled = mateconf_client_get_bool (priv->client, - EOM_CONF_DESKTOP_CAN_SETUP_PAGE, - NULL); + page_setup_disabled = g_settings_get_boolean (priv->lockdown_settings, + EOM_CONF_LOCKDOWN_CAN_SETUP_PAGE); if (eom_sidebar_is_empty (EOM_SIDEBAR (priv->sidebar))) { gtk_action_set_sensitive (action_sidebar, FALSE); @@ -2226,7 +2128,6 @@ update_ui_visibility (EomWindow *window) GtkAction *action; GtkWidget *menubar; - GError *error = NULL; gboolean fullscreen_mode, visible; @@ -2242,32 +2143,24 @@ update_ui_visibility (EomWindow *window) menubar = gtk_ui_manager_get_widget (priv->ui_mgr, "/MainMenu"); g_assert (GTK_IS_WIDGET (menubar)); - visible = mateconf_client_get_bool (priv->client, EOM_CONF_UI_TOOLBAR, &error); + visible = g_settings_get_boolean (priv->ui_settings, EOM_CONF_UI_TOOLBAR); visible = visible && !fullscreen_mode; - if (error) { - g_error_free (error); - error = NULL; - visible = !fullscreen_mode; - } + action = gtk_ui_manager_get_action (priv->ui_mgr, "/MainMenu/View/ToolbarToggle"); g_assert (action != NULL); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), visible); g_object_set (G_OBJECT (priv->toolbar), "visible", visible, NULL); - visible = mateconf_client_get_bool (priv->client, EOM_CONF_UI_STATUSBAR, &error); + visible = g_settings_get_boolean (priv->ui_settings, EOM_CONF_UI_STATUSBAR); visible = visible && !fullscreen_mode; - if (error) { - g_error_free (error); - error = NULL; - visible = !fullscreen_mode; - } + action = gtk_ui_manager_get_action (priv->ui_mgr, "/MainMenu/View/StatusbarToggle"); g_assert (action != NULL); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), visible); g_object_set (G_OBJECT (priv->statusbar), "visible", visible, NULL); if (priv->status != EOM_WINDOW_STATUS_INIT) { - visible = mateconf_client_get_bool (priv->client, EOM_CONF_UI_IMAGE_COLLECTION, NULL); + visible = g_settings_get_boolean (priv->ui_settings, EOM_CONF_UI_IMAGE_COLLECTION); visible = visible && priv->mode != EOM_WINDOW_MODE_SLIDESHOW; action = gtk_ui_manager_get_action (priv->ui_mgr, "/MainMenu/View/ImageCollectionToggle"); g_assert (action != NULL); @@ -2279,7 +2172,7 @@ update_ui_visibility (EomWindow *window) } } - visible = mateconf_client_get_bool (priv->client, EOM_CONF_UI_SIDEBAR, NULL); + visible = g_settings_get_boolean (priv->ui_settings, EOM_CONF_UI_SIDEBAR); visible = visible && !fullscreen_mode; action = gtk_ui_manager_get_action (priv->ui_mgr, "/MainMenu/View/SidebarToggle"); g_assert (action != NULL); @@ -2350,21 +2243,18 @@ eom_window_run_fullscreen (EomWindow *window, gboolean slideshow) if (slideshow) { priv->slideshow_loop = - mateconf_client_get_bool (priv->client, - EOM_CONF_FULLSCREEN_LOOP, - NULL); + g_settings_get_boolean (priv->fullscreen_settings, + EOM_CONF_FULLSCREEN_LOOP); priv->slideshow_switch_timeout = - mateconf_client_get_int (priv->client, - EOM_CONF_FULLSCREEN_SECONDS, - NULL); + g_settings_get_int (priv->fullscreen_settings, + EOM_CONF_FULLSCREEN_SECONDS); slideshow_set_timeout (window); } - upscale = mateconf_client_get_bool (priv->client, - EOM_CONF_FULLSCREEN_UPSCALE, - NULL); + upscale = g_settings_get_boolean (priv->fullscreen_settings, + EOM_CONF_FULLSCREEN_UPSCALE); eom_scroll_view_set_zoom_upscale (EOM_SCROLL_VIEW (priv->view), upscale); @@ -2546,9 +2436,8 @@ eom_window_cmd_file_open (GtkAction *action, gpointer user_data) const gchar *pics_dir; gboolean use_fallback; - use_fallback = mateconf_client_get_bool (priv->client, - EOM_CONF_UI_FILECHOOSER_XDG_FALLBACK, - NULL); + use_fallback = g_settings_get_boolean (priv->fullscreen_settings, + EOM_CONF_UI_FILECHOOSER_XDG_FALLBACK); pics_dir = g_get_user_special_dir (G_USER_DIRECTORY_PICTURES); if (use_fallback && pics_dir) { gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dlg), @@ -2691,8 +2580,7 @@ eom_window_cmd_preferences (GtkAction *action, gpointer user_data) window = EOM_WINDOW (user_data); - pref_dlg = eom_preferences_dialog_get_instance (GTK_WINDOW (window), - window->priv->client); + pref_dlg = eom_preferences_dialog_get_instance (GTK_WINDOW (window)); eom_dialog_show (EOM_DIALOG (pref_dlg)); } @@ -2903,13 +2791,13 @@ eom_window_cmd_show_hide_bar (GtkAction *action, gpointer user_data) g_object_set (G_OBJECT (priv->toolbar), "visible", visible, NULL); if (priv->mode == EOM_WINDOW_MODE_NORMAL) - mateconf_client_set_bool (priv->client, EOM_CONF_UI_TOOLBAR, visible, NULL); + g_settings_set_boolean (priv->ui_settings, EOM_CONF_UI_TOOLBAR, visible); } else if (g_ascii_strcasecmp (gtk_action_get_name (action), "ViewStatusbar") == 0) { g_object_set (G_OBJECT (priv->statusbar), "visible", visible, NULL); if (priv->mode == EOM_WINDOW_MODE_NORMAL) - mateconf_client_set_bool (priv->client, EOM_CONF_UI_STATUSBAR, visible, NULL); + g_settings_set_boolean (priv->ui_settings, EOM_CONF_UI_STATUSBAR, visible); } else if (g_ascii_strcasecmp (gtk_action_get_name (action), "ViewImageCollection") == 0) { if (visible) { @@ -2946,7 +2834,7 @@ eom_window_cmd_show_hide_bar (GtkAction *action, gpointer user_data) #endif gtk_widget_grab_focus (priv->view); } - mateconf_client_set_bool (priv->client, EOM_CONF_UI_IMAGE_COLLECTION, visible, NULL); + g_settings_set_boolean (priv->ui_settings, EOM_CONF_UI_IMAGE_COLLECTION, visible); } else if (g_ascii_strcasecmp (gtk_action_get_name (action), "ViewSidebar") == 0) { if (visible) { @@ -2954,7 +2842,7 @@ eom_window_cmd_show_hide_bar (GtkAction *action, gpointer user_data) } else { gtk_widget_hide (priv->sidebar); } - mateconf_client_set_bool (priv->client, EOM_CONF_UI_SIDEBAR, visible, NULL); + g_settings_set_boolean (priv->ui_settings, EOM_CONF_UI_SIDEBAR, visible); } } @@ -2986,12 +2874,13 @@ eom_window_set_wallpaper (EomWindow *window, const gchar *filename, const gchar gchar *markup; gchar *text; gchar *basename; + GSettings *wallpaper_settings; - - mateconf_client_set_string (priv->client, - EOM_CONF_DESKTOP_WALLPAPER, - filename, - NULL); + wallpaper_settings = g_settings_new (EOM_CONF_BACKGROUND_SCHEMA); + g_settings_set_string (wallpaper_settings, + EOM_CONF_BACKGROUND_FILE, + filename); + g_object_unref (wallpaper_settings); /* I18N: When setting mnemonics for these strings, watch out to not clash with mnemonics from eom's menubar */ @@ -3313,9 +3202,8 @@ eom_window_cmd_properties (GtkAction *action, gpointer user_data) eom_properties_dialog_update (EOM_PROPERTIES_DIALOG (priv->properties_dlg), priv->image); netbook_mode = - mateconf_client_get_bool (priv->client, - EOM_CONF_UI_PROPSDIALOG_NETBOOK_MODE, - NULL); + g_settings_get_boolean (priv->ui_settings, + EOM_CONF_UI_PROPSDIALOG_NETBOOK_MODE); eom_properties_dialog_set_netbook_mode (EOM_PROPERTIES_DIALOG (priv->properties_dlg), netbook_mode); } @@ -3473,11 +3361,9 @@ show_move_to_trash_confirm_dialog (EomWindow *window, GList *images, gboolean ca gboolean neverask = FALSE; GtkWidget* dontask_cbutton = NULL; - /* Check if the user never wants to be bugged. Ignore the error as - * it returns FALSE for safety anyway */ - neverask = mateconf_client_get_bool (window->priv->client, - EOM_CONF_UI_DISABLE_TRASH_CONFIRMATION, - NULL); + /* Check if the user never wants to be bugged. */ + neverask = g_settings_get_boolean (window->priv->ui_settings, + EOM_CONF_UI_DISABLE_TRASH_CONFIRMATION); /* Assume agreement, if the user doesn't want to be * asked and the trash is available */ @@ -4323,10 +4209,9 @@ eom_window_sidebar_visibility_changed (GtkWidget *widget, EomWindow *window) visible = gtk_widget_get_visible (window->priv->sidebar); - mateconf_client_set_bool (window->priv->client, + g_settings_set_boolean (window->priv->ui_settings, EOM_CONF_UI_SIDEBAR, - visible, - NULL); + visible); action = gtk_action_group_get_action (window->priv->actions_window, "ViewSidebar"); @@ -4401,8 +4286,6 @@ eom_window_construct_ui (EomWindow *window) GtkWidget *hpaned; GtkWidget *menuitem; - MateConfEntry *entry; - g_return_if_fail (EOM_IS_WINDOW (window)); priv = window->priv; @@ -4619,9 +4502,8 @@ eom_window_construct_ui (EomWindow *window) priv->nav = eom_thumb_nav_new (priv->thumbview, EOM_THUMB_NAV_MODE_ONE_ROW, - mateconf_client_get_bool (priv->client, - EOM_CONF_UI_SCROLL_BUTTONS, - NULL)); + g_settings_get_boolean (priv->ui_settings, + EOM_CONF_UI_SCROLL_BUTTONS)); thumb_popup = gtk_ui_manager_get_widget (priv->ui_mgr, "/ThumbnailPopup"); eom_thumb_view_set_thumbnail_popup (EOM_THUMB_VIEW (priv->thumbview), @@ -4631,96 +4513,36 @@ eom_window_construct_ui (EomWindow *window) gtk_box_pack_end (GTK_BOX (priv->cbox), priv->layout, TRUE, TRUE, 0); - - entry = mateconf_client_get_entry (priv->client, + eom_window_interp_in_type_changed_cb (priv->view_settings, EOM_CONF_VIEW_EXTRAPOLATE, - NULL, TRUE, NULL); - if (entry != NULL) { - eom_window_interp_in_type_changed_cb (priv->client, 0, entry, window); - mateconf_entry_unref (entry); - entry = NULL; - } - - entry = mateconf_client_get_entry (priv->client, + window); + eom_window_interp_out_type_changed_cb (priv->view_settings, EOM_CONF_VIEW_INTERPOLATE, - NULL, TRUE, NULL); - if (entry != NULL) { - eom_window_interp_out_type_changed_cb (priv->client, 0, entry, window); - mateconf_entry_unref (entry); - entry = NULL; - } - - entry = mateconf_client_get_entry (priv->client, + window); + eom_window_scroll_wheel_zoom_changed_cb (priv->view_settings, EOM_CONF_VIEW_SCROLL_WHEEL_ZOOM, - NULL, TRUE, NULL); - if (entry != NULL) { - eom_window_scroll_wheel_zoom_changed_cb (priv->client, 0, entry, window); - mateconf_entry_unref (entry); - entry = NULL; - } - - entry = mateconf_client_get_entry (priv->client, + window); + eom_window_zoom_multiplier_changed_cb (priv->view_settings, EOM_CONF_VIEW_ZOOM_MULTIPLIER, - NULL, TRUE, NULL); - if (entry != NULL) { - eom_window_zoom_multiplier_changed_cb (priv->client, 0, entry, window); - mateconf_entry_unref (entry); - entry = NULL; - } - - entry = mateconf_client_get_entry (priv->client, + window); + eom_window_bg_color_changed_cb (priv->view_settings, EOM_CONF_VIEW_BACKGROUND_COLOR, - NULL, TRUE, NULL); - if (entry != NULL) { - eom_window_bg_color_changed_cb (priv->client, 0, entry, window); - mateconf_entry_unref (entry); - entry = NULL; - } - - entry = mateconf_client_get_entry (priv->client, + window); + eom_window_use_bg_color_changed_cb (priv->view_settings, EOM_CONF_VIEW_USE_BG_COLOR, - NULL, TRUE, NULL); - if (entry != NULL) { - eom_window_use_bg_color_changed_cb (priv->client, 0, entry, window); - mateconf_entry_unref (entry); - entry = NULL; - } - - entry = mateconf_client_get_entry (priv->client, + window); + eom_window_transparency_changed_cb (priv->view_settings, EOM_CONF_VIEW_TRANSPARENCY, - NULL, TRUE, NULL); - if (entry != NULL) { - eom_window_transparency_changed_cb (priv->client, 0, entry, window); - mateconf_entry_unref (entry); - entry = NULL; - } - - entry = mateconf_client_get_entry (priv->client, + window); + eom_window_trans_color_changed_cb (priv->view_settings, EOM_CONF_VIEW_TRANS_COLOR, - NULL, TRUE, NULL); - if (entry != NULL) { - eom_window_trans_color_changed_cb (priv->client, 0, entry, window); - mateconf_entry_unref (entry); - entry = NULL; - } - - entry = mateconf_client_get_entry (priv->client, + window); + eom_window_collection_mode_changed_cb (priv->ui_settings, EOM_CONF_UI_IMAGE_COLLECTION_POSITION, - NULL, TRUE, NULL); - if (entry != NULL) { - eom_window_collection_mode_changed_cb (priv->client, 0, entry, window); - mateconf_entry_unref (entry); - entry = NULL; - } - - entry = mateconf_client_get_entry (priv->client, - EOM_CONF_DESKTOP_CAN_SAVE, - NULL, TRUE, NULL); - if (entry != NULL) { - eom_window_can_save_changed_cb (priv->client, 0, entry, window); - mateconf_entry_unref (entry); - entry = NULL; - } + window); + eom_window_can_save_changed_cb (priv->lockdown_settings, + EOM_CONF_LOCKDOWN_CAN_SAVE, + window); if ((priv->flags & EOM_STARTUP_FULLSCREEN) || (priv->flags & EOM_STARTUP_SLIDE_SHOW)) { @@ -4749,88 +4571,75 @@ eom_window_init (EomWindow *window) priv = window->priv = EOM_WINDOW_GET_PRIVATE (window); - priv->client = mateconf_client_get_default (); - - mateconf_client_add_dir (window->priv->client, EOM_CONF_DIR, - MATECONF_CLIENT_PRELOAD_RECURSIVE, NULL); - - priv->client_notifications[EOM_WINDOW_NOTIFY_EXTRAPOLATE] = - mateconf_client_notify_add (window->priv->client, - EOM_CONF_VIEW_EXTRAPOLATE, - eom_window_interp_in_type_changed_cb, - window, NULL, NULL); - - priv->client_notifications[EOM_WINDOW_NOTIFY_INTERPOLATE] = - mateconf_client_notify_add (window->priv->client, - EOM_CONF_VIEW_INTERPOLATE, - eom_window_interp_out_type_changed_cb, - window, NULL, NULL); - - priv->client_notifications[EOM_WINDOW_NOTIFY_SCROLLWHEEL_ZOOM] = - mateconf_client_notify_add (window->priv->client, - EOM_CONF_VIEW_SCROLL_WHEEL_ZOOM, - eom_window_scroll_wheel_zoom_changed_cb, - window, NULL, NULL); - - priv->client_notifications[EOM_WINDOW_NOTIFY_ZOOM_MULTIPLIER] = - mateconf_client_notify_add (window->priv->client, - EOM_CONF_VIEW_ZOOM_MULTIPLIER, - eom_window_zoom_multiplier_changed_cb, - window, NULL, NULL); - - priv->client_notifications[EOM_WINDOW_NOTIFY_BACKGROUND_COLOR] = - mateconf_client_notify_add (window->priv->client, - EOM_CONF_VIEW_BACKGROUND_COLOR, - eom_window_bg_color_changed_cb, - window, NULL, NULL); - - priv->client_notifications[EOM_WINDOW_NOTIFY_USE_BG_COLOR] = - mateconf_client_notify_add (window->priv->client, - EOM_CONF_VIEW_USE_BG_COLOR, - eom_window_use_bg_color_changed_cb, - window, NULL, NULL); - - priv->client_notifications[EOM_WINDOW_NOTIFY_TRANSPARENCY] = - mateconf_client_notify_add (window->priv->client, - EOM_CONF_VIEW_TRANSPARENCY, - eom_window_transparency_changed_cb, - window, NULL, NULL); - - priv->client_notifications[EOM_WINDOW_NOTIFY_TRANS_COLOR] = - mateconf_client_notify_add (window->priv->client, - EOM_CONF_VIEW_TRANS_COLOR, - eom_window_trans_color_changed_cb, - window, NULL, NULL); - - priv->client_notifications[EOM_WINDOW_NOTIFY_SCROLL_BUTTONS] = - mateconf_client_notify_add (window->priv->client, - EOM_CONF_UI_SCROLL_BUTTONS, - eom_window_scroll_buttons_changed_cb, - window, NULL, NULL); - - priv->client_notifications[EOM_WINDOW_NOTIFY_COLLECTION_POS] = - mateconf_client_notify_add (window->priv->client, - EOM_CONF_UI_IMAGE_COLLECTION_POSITION, - eom_window_collection_mode_changed_cb, - window, NULL, NULL); - - priv->client_notifications[EOM_WINDOW_NOTIFY_COLLECTION_RESIZABLE] = - mateconf_client_notify_add (window->priv->client, - EOM_CONF_UI_IMAGE_COLLECTION_RESIZABLE, - eom_window_collection_mode_changed_cb, - window, NULL, NULL); - - priv->client_notifications[EOM_WINDOW_NOTIFY_CAN_SAVE] = - mateconf_client_notify_add (window->priv->client, - EOM_CONF_DESKTOP_CAN_SAVE, - eom_window_can_save_changed_cb, - window, NULL, NULL); - - priv->client_notifications[EOM_WINDOW_NOTIFY_PROPSDIALOG_NETBOOK_MODE] = - mateconf_client_notify_add (window->priv->client, - EOM_CONF_UI_PROPSDIALOG_NETBOOK_MODE, - eom_window_pd_nbmode_changed_cb, - window, NULL, NULL); + priv->view_settings = g_settings_new (EOM_CONF_VIEW_SCHEMA); + priv->ui_settings = g_settings_new (EOM_CONF_UI_SCHEMA); + priv->fullscreen_settings = g_settings_new (EOM_CONF_FULLSCREEN_SCHEMA); + priv->lockdown_settings = g_settings_new (EOM_CONF_LOCKDOWN_SCHEMA); + + g_signal_connect (priv->view_settings, + "changed::" EOM_CONF_VIEW_EXTRAPOLATE, + G_CALLBACK (eom_window_interp_in_type_changed_cb), + window); + + g_signal_connect (priv->view_settings, + "changed::" EOM_CONF_VIEW_INTERPOLATE, + G_CALLBACK (eom_window_interp_out_type_changed_cb), + window); + + g_signal_connect (priv->view_settings, + "changed::" EOM_CONF_VIEW_SCROLL_WHEEL_ZOOM, + G_CALLBACK (eom_window_scroll_wheel_zoom_changed_cb), + window); + + g_signal_connect (priv->view_settings, + "changed::" EOM_CONF_VIEW_ZOOM_MULTIPLIER, + G_CALLBACK (eom_window_zoom_multiplier_changed_cb), + window); + + g_signal_connect (priv->view_settings, + "changed::" EOM_CONF_VIEW_BACKGROUND_COLOR, + G_CALLBACK (eom_window_bg_color_changed_cb), + window); + + g_signal_connect (priv->view_settings, + "changed::" EOM_CONF_VIEW_USE_BG_COLOR, + G_CALLBACK (eom_window_use_bg_color_changed_cb), + window); + + g_signal_connect (priv->view_settings, + "changed::" EOM_CONF_VIEW_TRANSPARENCY, + G_CALLBACK (eom_window_transparency_changed_cb), + window); + + g_signal_connect (priv->view_settings, + "changed::" EOM_CONF_VIEW_TRANS_COLOR, + G_CALLBACK (eom_window_trans_color_changed_cb), + window); + + g_signal_connect (priv->ui_settings, + "changed::" EOM_CONF_UI_SCROLL_BUTTONS, + G_CALLBACK (eom_window_scroll_buttons_changed_cb), + window); + + g_signal_connect (priv->ui_settings, + "changed::" EOM_CONF_UI_IMAGE_COLLECTION_POSITION, + G_CALLBACK (eom_window_collection_mode_changed_cb), + window); + + g_signal_connect (priv->ui_settings, + "changed::" EOM_CONF_UI_IMAGE_COLLECTION_RESIZABLE, + G_CALLBACK (eom_window_collection_mode_changed_cb), + window); + + g_signal_connect (priv->ui_settings, + "changed::" EOM_CONF_UI_PROPSDIALOG_NETBOOK_MODE, + G_CALLBACK (eom_window_pd_nbmode_changed_cb), + window); + + g_signal_connect (priv->lockdown_settings, + "changed::" EOM_CONF_LOCKDOWN_CAN_SAVE, + G_CALLBACK (eom_window_can_save_changed_cb), + window); window->priv->store = NULL; window->priv->image = NULL; @@ -4950,16 +4759,21 @@ eom_window_dispose (GObject *object) eom_window_clear_transform_job (window); - if (priv->client) { - int i; - - for (i = 0; i < EOM_WINDOW_NOTIFY_LENGTH; ++i) { - mateconf_client_notify_remove (priv->client, - priv->client_notifications[i]); - } - mateconf_client_remove_dir (priv->client, EOM_CONF_DIR, NULL); - g_object_unref (priv->client); - priv->client = NULL; + if (priv->view_settings) { + g_object_unref (priv->view_settings); + priv->view_settings = NULL; + } + if (priv->ui_settings) { + g_object_unref (priv->ui_settings); + priv->ui_settings = NULL; + } + if (priv->fullscreen_settings) { + g_object_unref (priv->fullscreen_settings); + priv->fullscreen_settings = NULL; + } + if (priv->lockdown_settings) { + g_object_unref (priv->lockdown_settings); + priv->lockdown_settings = NULL; } if (priv->file_list != NULL) { @@ -5495,7 +5309,7 @@ eom_job_model_cb (EomJobModel *job, gpointer data) n_images = eom_list_store_length (EOM_LIST_STORE (priv->store)); #ifdef HAVE_EXIF - if (mateconf_client_get_bool (priv->client, EOM_CONF_VIEW_AUTOROTATE, NULL)) { + if (g_settings_get_boolean (priv->view_settings, EOM_CONF_VIEW_AUTOROTATE)) { for (i = 0; i < n_images; i++) { image = eom_list_store_get_image_by_pos (priv->store, i); eom_image_autorotate (image); |