[evolution/wip/gsettings: 25/25] Migrate ECalShellContent to GSettings



commit b77871e4fd7a4464e3a2e4e458f0d10e71805a02
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Mon Oct 10 18:11:01 2011 +0200

    Migrate ECalShellContent to GSettings

 data/evolution.convert                           |    3 ++
 data/org.gnome.evolution.calendar.gschema.xml.in |   15 +++++++++
 modules/calendar/e-cal-shell-content.c           |   36 +++++++++++-----------
 3 files changed, 36 insertions(+), 18 deletions(-)
---
diff --git a/data/evolution.convert b/data/evolution.convert
index 8bcec69..452ea39 100644
--- a/data/evolution.convert
+++ b/data/evolution.convert
@@ -46,10 +46,12 @@ editor-show-type = /apps/evolution/calendar/display/show_type
 hide-completed-tasks = /apps/evolution/calendar/tasks/hide_completed
 hide-completed-tasks-units = /apps/evolution/calendar/tasks/hide_completed_units
 hide-completed-tasks-value = /apps/evolution/calendar/tasks/hide_completed_value
+hpane-position = /apps/evolution/calendar/display/hpane_position
 last-notification-time = /apps/evolution/calendar/notify/last_notification_time
 memo-hpane-position = /apps/evolution/calendar/display/memo_hpane_position
 memo-layout = /apps/evolution/calendar/display/memo_layout
 memo-vpane-position = /apps/evolution/calendar/display/memo_vpane_position
+month-hpane-position = /apps/evolution/calendar/display/month_hpane_position
 month-scroll-by-week = /apps/evolution/calendar/display/month_scroll_by_week
 notify-programs = /apps/evolution/calendar/notify/programs
 notify-with-tray = /apps/evolution/calendar/notify/notify_with_tray
@@ -58,6 +60,7 @@ selected-memos = /apps/evolution/calendar/memos/selected_memos
 selected-tasks = /apps/evolution/calendar/tasks/selected_tasks
 show-memo-preview = /apps/evolution/calendar/display/show_memo_preview
 show-task-preview = /apps/evolution/calendar/display/show_task_preview
+tag-vpane-position = /apps/evolution/calendar/display/tag_vpane_position
 task-hpane-position = /apps/evolution/calendar/display/task_hpane_position
 task-vpane-position = /apps/evolution/calendar/display/task_vpane_position
 task-layout = /apps/evolution/calendar/display/task_layout
diff --git a/data/org.gnome.evolution.calendar.gschema.xml.in b/data/org.gnome.evolution.calendar.gschema.xml.in
index 6915a0c..cc32a3c 100644
--- a/data/org.gnome.evolution.calendar.gschema.xml.in
+++ b/data/org.gnome.evolution.calendar.gschema.xml.in
@@ -70,6 +70,11 @@
       <_summary>Hide task value</_summary>
       <_description>Number of units for determining when to hide tasks</_description>
     </key>
+    <key name="hpane-position" type="i">
+      <default>400</default>
+      <_summary>Horizontal pane position</_summary>
+      <_description>Position of the horizontal pane, between the date navigator calendar and the task list when not in the month view, in pixels</_description>
+    </key>
     <key name="last-notification-time" type="i">
       <default>1</default>
       <_summary>Last reminder time</_summary>
@@ -90,6 +95,11 @@
       <_summary>Memo preview pane position (vertical)</_summary>
       <_description>Position of the memo preview pane when oriented vertically</_description>
     </key>
+    <key name="month-hpane-position" type="i">
+      <default>32000</default>
+      <_summary>Month view horizontal pane position</_summary>
+      <_description>Position of the horizontal pane, between the view and the date navigator calendar and task list in the month view, in pixels</_description>
+    </key>
     <key name="month-scroll-by-week" type="b">
       <default>true</default>
       <_summary>Scroll Month View by a week, not by a month</_summary>
@@ -130,6 +140,11 @@
       <_summary>Show the task preview pane</_summary>
       <_description>If "true", show the task preview pane in the main window</_description>
     </key>
+    <key name="tag-vpane-position" type="i">
+      <default>0</default>
+      <_summary>Vertical position for the tag pane</_summary>
+      <_description>Vertical position for the tag pane</_description>
+    </key>
     <key name="task-hpane-position" type="i">
       <default>200</default>
       <_summary>Task preview pane position (horizontal)</_summary>
diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c
index 81fc76b..6c86f5f 100644
--- a/modules/calendar/e-cal-shell-content.c
+++ b/modules/calendar/e-cal-shell-content.c
@@ -28,7 +28,6 @@
 #include <string.h>
 #include <glib/gi18n.h>
 
-#include "e-util/gconf-bridge.h"
 #include "widgets/menus/gal-view-etable.h"
 #include "widgets/misc/e-paned.h"
 #include "widgets/misc/e-selectable.h"
@@ -54,7 +53,7 @@ struct _ECalShellContentPrivate {
 
 	GalViewInstance *view_instance;
 
-	guint paned_binding_id;
+	gboolean paned_bound;
 };
 
 enum {
@@ -111,32 +110,32 @@ cal_shell_content_notify_view_id_cb (ECalShellContent *cal_shell_content)
 {
 	EShellContent *shell_content;
 	EShellView *shell_view;
-	GConfBridge *bridge;
+	GSettings *settings;
 	GtkWidget *paned;
-	guint binding_id;
+	gboolean bound;
 	const gchar *key;
 	const gchar *view_id;
 
-	bridge = gconf_bridge_get ();
+	settings = g_settings_new ("org.gnome.evolution.calendar");
 	paned = cal_shell_content->priv->hpaned;
-	binding_id = cal_shell_content->priv->paned_binding_id;
+	bound = cal_shell_content->priv->paned_bound;
 
 	shell_content = E_SHELL_CONTENT (cal_shell_content);
 	shell_view = e_shell_content_get_shell_view (shell_content);
 	view_id = e_shell_view_get_view_id (shell_view);
 
-	if (binding_id > 0)
-		gconf_bridge_unbind (bridge, binding_id);
-
 	if (view_id != NULL && strcmp (view_id, "Month_View") == 0)
-		key = "/apps/evolution/calendar/display/month_hpane_position";
+		key = "month-hpane-position";
 	else
-		key = "/apps/evolution/calendar/display/hpane_position";
+		key = "hpane-position";
+
+	if (bound)
+		g_settings_unbind (settings, key);
 
-	binding_id = gconf_bridge_bind_property_delayed (
-		bridge, key, G_OBJECT (paned), "hposition");
+	g_settings_bind (settings, key, G_OBJECT (paned), "hposition", G_SETTINGS_BIND_DEFAULT);
+	cal_shell_content->priv->paned_bound = TRUE;
 
-	cal_shell_content->priv->paned_binding_id = binding_id;
+	g_object_unref (settings);
 }
 
 static gchar *
@@ -332,7 +331,7 @@ cal_shell_content_constructed (GObject *object)
 	EShellView *foreign_view;
 	GnomeCalendar *calendar;
 	GalViewInstance *view_instance;
-	GConfBridge *bridge;
+	GSettings *settings;
 	GtkWidget *container;
 	GtkWidget *widget;
 	const gchar *key;
@@ -521,11 +520,12 @@ cal_shell_content_constructed (GObject *object)
 			G_CALLBACK (cal_shell_content_notify_view_id_cb),
 			object);
 
-		bridge = gconf_bridge_get ();
+		settings = g_settings_new ("org.gnome.evolution.calendar");
 
 		object = G_OBJECT (priv->vpaned);
-		key = "/apps/evolution/calendar/display/tag_vpane_position";
-		gconf_bridge_bind_property_delayed (bridge, key, object, "proportion");
+		g_settings_bind (settings, "tag-vpane-position", object, "proportion", G_SETTINGS_BIND_DEFAULT);
+
+		g_object_unref (settings);
 	}
 
 	if (memo_model)



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