[eog] Convert lockdown settings from GConf to GSettings
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] Convert lockdown settings from GConf to GSettings
- Date: Sat, 20 Nov 2010 13:29:03 +0000 (UTC)
commit 653cf389ef92241aa2a66d04b3dad71eeacd4bf3
Author: Felix Riemann <friemann gnome org>
Date: Sat Nov 20 14:03:45 2010 +0100
Convert lockdown settings from GConf to GSettings
Part of bug 620121.
src/eog-config-keys.h | 8 +++++---
src/eog-window.c | 49 +++++++++++++++++++++----------------------------
2 files changed, 26 insertions(+), 31 deletions(-)
---
diff --git a/src/eog-config-keys.h b/src/eog-config-keys.h
index b45393a..1fd5333 100644
--- a/src/eog-config-keys.h
+++ b/src/eog-config-keys.h
@@ -34,9 +34,11 @@
#define EOG_CONF_DESKTOP_WALLPAPER_SCHEMA "org.gnome.desktop.background"
#define EOG_CONF_DESKTOP_WALLPAPER "picture-filename"
-#define EOG_CONF_DESKTOP_CAN_SAVE "/desktop/gnome/lockdown/disable_save_to_disk"
-#define EOG_CONF_DESKTOP_CAN_PRINT "/desktop/gnome/lockdown/disable_printing"
-#define EOG_CONF_DESKTOP_CAN_SETUP_PAGE "/desktop/gnome/lockdown/disable_print_setup"
+
+#define EOG_CONF_DESKTOP_LOCKDOWN_SCHEMA "org.gnome.desktop.lockdown"
+#define EOG_CONF_DESKTOP_CAN_PRINT "disable-printing"
+#define EOG_CONF_DESKTOP_CAN_SAVE "disable-save-to-disk"
+#define EOG_CONF_DESKTOP_CAN_SETUP_PAGE "disable-print-setup"
#define EOG_CONF_VIEW_BACKGROUND_COLOR "background-color"
#define EOG_CONF_VIEW_INTERPOLATE "interpolate"
diff --git a/src/eog-window.c b/src/eog-window.c
index 3f99abd..09133ba 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -129,6 +129,7 @@ struct _EogWindowPrivate {
GSettings *fullscreen_settings;
GSettings *ui_settings;
GSettings *view_settings;
+ GSettings *lockdown_settings;
GConfClient *client;
guint client_notifications[EOG_WINDOW_NOTIFY_LENGTH];
@@ -344,10 +345,9 @@ eog_window_set_gallery_mode (EogWindow *window,
}
static void
-eog_window_can_save_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
+eog_window_can_save_changed_cb (GSettings *settings,
+ const gchar *key,
+ gpointer user_data)
{
EogWindowPrivate *priv;
EogWindow *window;
@@ -361,9 +361,7 @@ eog_window_can_save_changed_cb (GConfClient *client,
window = EOG_WINDOW (user_data);
priv = EOG_WINDOW (user_data)->priv;
- if (entry->value != NULL && entry->value->type == GCONF_VALUE_BOOL) {
- save_disabled = gconf_value_get_bool (entry->value);
- }
+ save_disabled = g_settings_get_boolean (settings, key);
priv->save_disabled = save_disabled;
@@ -688,17 +686,15 @@ update_action_groups_state (EogWindow *window)
gtk_widget_grab_focus (priv->view);
}
- print_disabled = gconf_client_get_bool (priv->client,
- EOG_CONF_DESKTOP_CAN_PRINT,
- NULL);
+ print_disabled = g_settings_get_boolean (priv->lockdown_settings,
+ EOG_CONF_DESKTOP_CAN_PRINT);
if (print_disabled) {
gtk_action_set_sensitive (action_print, FALSE);
}
- page_setup_disabled = gconf_client_get_bool (priv->client,
- EOG_CONF_DESKTOP_CAN_SETUP_PAGE,
- NULL);
+ page_setup_disabled = g_settings_get_boolean (priv->lockdown_settings,
+ EOG_CONF_DESKTOP_CAN_SETUP_PAGE);
if (eog_sidebar_is_empty (EOG_SIDEBAR (priv->sidebar))) {
gtk_action_set_sensitive (action_sidebar, FALSE);
@@ -4174,7 +4170,6 @@ eog_window_construct_ui (EogWindow *window)
GtkWidget *menuitem;
GtkAction *action = NULL;
- GConfEntry *entry;
g_return_if_fail (EOG_IS_WINDOW (window));
@@ -4427,14 +4422,12 @@ eog_window_construct_ui (EogWindow *window)
g_settings_bind (priv->ui_settings, EOG_CONF_UI_IMAGE_GALLERY_RESIZABLE,
window, "gallery-resizable", G_SETTINGS_BIND_GET);
- entry = gconf_client_get_entry (priv->client,
- EOG_CONF_DESKTOP_CAN_SAVE,
- NULL, TRUE, NULL);
- if (entry != NULL) {
- eog_window_can_save_changed_cb (priv->client, 0, entry, window);
- gconf_entry_unref (entry);
- entry = NULL;
- }
+ g_signal_connect (priv->lockdown_settings,
+ "changed::" EOG_CONF_DESKTOP_CAN_SAVE,
+ G_CALLBACK (eog_window_can_save_changed_cb), window);
+ // Call callback once to have the value set
+ eog_window_can_save_changed_cb (priv->lockdown_settings,
+ EOG_CONF_DESKTOP_CAN_SAVE, window);
if ((priv->flags & EOG_STARTUP_FULLSCREEN) ||
(priv->flags & EOG_STARTUP_SLIDE_SHOW)) {
@@ -4466,15 +4459,10 @@ eog_window_init (EogWindow *window)
priv->fullscreen_settings = g_settings_new (EOG_CONF_FULLSCREEN);
priv->ui_settings = g_settings_new (EOG_CONF_UI);
priv->view_settings = g_settings_new (EOG_CONF_VIEW);
+ priv->lockdown_settings = g_settings_new (EOG_CONF_DESKTOP_LOCKDOWN_SCHEMA);
priv->client = gconf_client_get_default ();
- priv->client_notifications[EOG_WINDOW_NOTIFY_CAN_SAVE] =
- gconf_client_notify_add (window->priv->client,
- EOG_CONF_DESKTOP_CAN_SAVE,
- eog_window_can_save_changed_cb,
- window, NULL, NULL);
-
window->priv->store = NULL;
window->priv->image = NULL;
@@ -4619,6 +4607,11 @@ eog_window_dispose (GObject *object)
priv->fullscreen_settings = NULL;
}
+ if (priv->lockdown_settings) {
+ g_object_unref (priv->lockdown_settings);
+ priv->lockdown_settings = NULL;
+ }
+
if (priv->file_list != NULL) {
g_slist_foreach (priv->file_list, (GFunc) g_object_unref, NULL);
g_slist_free (priv->file_list);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]