[evolution/wip/gsettings] Port event/task/meeting editor to GSettings



commit 0886cc544f0616f90383d4d51709a45da42dea37
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Wed Sep 14 16:40:30 2011 +0200

    Port event/task/meeting editor to GSettings

 calendar/gui/dialogs/comp-editor.c               |   33 +++++++++------------
 data/evolution.convert                           |    6 ++++
 data/org.gnome.evolution.calendar.gschema.xml.in |   30 ++++++++++++++++++++
 3 files changed, 50 insertions(+), 19 deletions(-)
---
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 1d5a45a..507076e 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -34,13 +34,13 @@
 #include <unistd.h>
 #include <glib/gi18n-lib.h>
 #include <glib/gstdio.h>
+#include <gio/gio.h>
 #include <gdk/gdkkeysyms.h>
 #include <e-util/e-util.h>
 #include <e-util/e-alert-sink.h>
 #include <e-util/e-dialog-utils.h>
 #include <e-util/e-extensible.h>
 #include <e-util/e-util-private.h>
-#include <e-util/gconf-bridge.h>
 #include <shell/e-shell.h>
 
 #include <libecal/e-cal-client.h>
@@ -70,6 +70,8 @@ struct _CompEditorPrivate {
 
 	gpointer shell;  /* weak pointer */
 
+	GSettings *calendar_settings;
+
 	/* EFocusTracker keeps selection actions up-to-date. */
 	EFocusTracker *focus_tracker;
 
@@ -1616,6 +1618,7 @@ comp_editor_finalize (GObject *object)
 
 	priv = COMP_EDITOR (object)->priv;
 
+	g_object_unref (priv->calendar_settings);
 	g_free (priv->summary);
 
 	/* Chain up to parent's finalize() method. */
@@ -1632,39 +1635,29 @@ comp_editor_constructed (GObject *object)
 }
 
 static void
-comp_editor_bind_gconf (CompEditor *editor)
+comp_editor_bind_settings (CompEditor *editor)
 {
-	GConfBridge *bridge;
 	GtkAction *action;
-	const gchar *key;
 
 	g_return_if_fail (editor != NULL);
 
-	bridge = gconf_bridge_get ();
-
-	key = "/apps/evolution/calendar/display/show_categories";
 	action = comp_editor_get_action (editor, "view-categories");
-	gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active");
+	g_settings_bind (priv->calendar_settings, "editor-show-categories", G_OBJECT (action), "active");
 
-	key = "/apps/evolution/calendar/display/show_role";
 	action = comp_editor_get_action (editor, "view-role");
-	gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active");
+	g_settings_bind (priv->calendar_settings, "editor-show-role", G_OBJECT (action), "active");
 
-	key = "/apps/evolution/calendar/display/show_rsvp";
 	action = comp_editor_get_action (editor, "view-rsvp");
-	gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active");
+	g_settings_bind (priv->calendar_settings, "editor-show-rsvp", G_OBJECT (action), "active");
 
-	key = "/apps/evolution/calendar/display/show_status";
 	action = comp_editor_get_action (editor, "view-status");
-	gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active");
+	g_settings_bind (priv->calendar_settings, "editor-show-status", G_OBJECT (action), "active");
 
-	key = "/apps/evolution/calendar/display/show_timezone";
 	action = comp_editor_get_action (editor, "view-time-zone");
-	gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active");
+	g_settings_bind (priv->calendar_settings, "editor-show-timezone", G_OBJECT (action), "active");
 
-	key = "/apps/evolution/calendar/display/show_type";
 	action = comp_editor_get_action (editor, "view-type");
-	gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active");
+	g_settings_bind (priv->calendar_settings, "editor-show-type", G_OBJECT (action), "active");
 }
 
 static gboolean
@@ -1960,6 +1953,8 @@ comp_editor_init (CompEditor *editor)
 
 	active_editors = g_list_prepend (active_editors, editor);
 
+	priv->calendar_settings = g_settings_new ("org.gnome.evolution.calendar");
+
 	/* Each editor window gets its own window group. */
 	window = GTK_WINDOW (editor);
 	priv->window_group = gtk_window_group_new ();
@@ -2172,7 +2167,7 @@ comp_editor_init (CompEditor *editor)
 		store, "row-inserted",
 		G_CALLBACK (attachment_store_changed_cb), editor);
 
-	comp_editor_bind_gconf (editor);
+	comp_editor_bind_settings (editor);
 
 	e_shell_watch_window (shell, GTK_WINDOW (editor));
 	e_shell_adapt_window_size (shell, GTK_WINDOW (editor));
diff --git a/data/evolution.convert b/data/evolution.convert
index 643e5d6..ad6c946 100644
--- a/data/evolution.convert
+++ b/data/evolution.convert
@@ -32,6 +32,12 @@ vpane-position = /apps/evolution/addressbook/display/vpane_position
 show-preview = /apps/evolution/addressbook/display/show_preview
 
 [org.gnome.evolution.calendar]
+editor-show-categories = /apps/evolution/calendar/display/show_categories
+editor-show-role = /apps/evolution/calendar/display/show_role
+editor-show-rsvp = /apps/evolution/calendar/display/show_rsvp
+editor-show-status = /apps/evolution/calendar/display/show_status
+editor-show-timezone = /apps/evolution/calendar/display/show_timezone
+editor-show-type = /apps/evolution/calendar/display/show_type
 
 [org.gnome.evolution.mail]
 check-if-default-mailer = /apps/evolution/mail/prompts/checkdefault
diff --git a/data/org.gnome.evolution.calendar.gschema.xml.in b/data/org.gnome.evolution.calendar.gschema.xml.in
index 3cd7f77..c10a100 100644
--- a/data/org.gnome.evolution.calendar.gschema.xml.in
+++ b/data/org.gnome.evolution.calendar.gschema.xml.in
@@ -1,4 +1,34 @@
 <schemalist>
   <schema gettext-domain="evolution" id="org.gnome.evolution.calendar" path="/apps/evolution/calendar/">
   </schema>
+  <key name="editor-show-categories" type="b">
+    <default>false</default>
+    <_summary>Show categories field in the event/meeting/task editor</_summary>
+    <_description>Whether to show categories field in the event/meeting editor</_description>
+  </key>
+  <key name="editor-show-role" type="b">
+    <default>true</default>
+    <_summary>Show Role field in the event/task/meeting editor</_summary>
+    <_description>Whether to show role field in the event/task/meeting editor</_description>
+  </key>
+  <key name="editor-show-rsvp" type="b">
+    <default>false</default>
+    <_summary>Show RSVP field in the event/task/meeting editor</_summary>
+    <_description>Whether to show RSVP field in the event/task/meeting editor</_description>
+  </key>
+  <key name="editor-show-status" type="b">
+    <default>false</default>
+    <_summary>Show status field in the event/task/meeting editor</_summary>
+    <_description>Whether to show status field in the event/task/meeting editor</_description>
+  </key>
+  <key name="editor-show-timezone" type="b">
+    <default>false</default>
+    <_summary>Show timezone field in the event/meeting editor</_summary>
+    <_description>Whether to show timezone field in the event/meeting editor</_description>
+  </key>
+  <key name="editor-show-type" type="b">
+    <default>false</default>
+    <_summary>Show type field in the event/task/meeting editor</_summary>
+    <_description>Whether to show type field in the event/task/meeting editor</_description>
+  </key>
 </schemalist>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]