[evolution-patches] [Tasks] Fixes Bug #324560



Hi, Chenthill and all

The attached patch fixes #324560. Evolution now can respond to the
change of calendar/display/show_task_preview, and task preview pane can
show or hide when show_task_preview changes. Thus, it helps to implement
central management over evolution.  

BTW: I added a BonoboUIComponent pointer(uic) to ETasks, because we need
access to the Bonobo UI of ETasks in config_preview_state_changed_cb().
The reason to add uic to ETasks other than ETasksPrivate is we have to
evaluate uic in setup_config() in tasks-control.c, but ETasksPrivate
isn't in this scope.

Please review it.

Thanks,
Sam 
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2899
diff -u -r1.2899 ChangeLog
--- ChangeLog	21 Dec 2005 04:13:33 -0000	1.2899
+++ ChangeLog	21 Dec 2005 06:59:44 -0000
@@ -1,3 +1,13 @@
+2005-12-21  Sam Yang  <sam yang sun com>
+
+	Fixes #324560
+	* gui/calendar-config.c:
+	(calendar_config_add_notification_preview_state): Request notification of changes to show_task_preview.
+	* gui/e-tasks.c: (config_preview_state_changed_cb): Callback function.
+	(setup_config): Send request and store connection ID.
+	* gui/e-tasks.h:
+	* gui/tasks-control.c: (tasks_control_activate): Gain access to the Bonobo UI of Tasks view through ETasks.
+
 2005-12-20  Chenthill Palanisamy  <pchenthill novell com>
 
 	Fixes #324525
Index: gui/calendar-config.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-config.c,v
retrieving revision 1.82
diff -u -r1.82 calendar-config.c
--- gui/calendar-config.c	16 Nov 2005 13:53:46 -0000	1.82
+++ gui/calendar-config.c	21 Dec 2005 06:59:44 -0000
@@ -657,6 +657,16 @@
 	gconf_client_set_bool (config, CALENDAR_CONFIG_TASK_PREVIEW, state, NULL);
 }
 
+guint
+calendar_config_add_notification_preview_state (GConfClientNotifyFunc func, gpointer data)
+{
+	guint id;
+	
+	id = gconf_client_notify_add (config, CALENDAR_CONFIG_TASK_PREVIEW, func, data, NULL, NULL);
+	
+	return id;
+}
+		
 gint
 calendar_config_get_month_hpane_pos	(void)
 {
Index: gui/e-tasks.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-tasks.c,v
retrieving revision 1.127
diff -u -r1.127 e-tasks.c
--- gui/e-tasks.c	26 Nov 2005 02:31:49 -0000	1.127
+++ gui/e-tasks.c	21 Dec 2005 06:59:44 -0000
@@ -338,6 +338,21 @@
 }
 
 static void
+config_preview_state_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+{
+	gboolean state;
+	GConfValue *value;
+	ETasks *tasks = (ETasks *)data;
+	
+	g_return_if_fail (gconf_entry_get_key (entry) != NULL);
+	g_return_if_fail ((value = gconf_entry_get_value (entry)) != NULL);
+	
+	state = gconf_value_get_bool (value);
+	e_tasks_show_preview (tasks, state);
+	bonobo_ui_component_set_prop (tasks->uic, "/commands/ViewPreview", "state", state ? "1" : "0", NULL);
+}
+
+static void
 model_row_changed_cb (ETableModel *etm, int row, gpointer data)
 {
 	ETasks *tasks;
@@ -404,6 +419,9 @@
 	not = calendar_config_add_notification_hide_completed_tasks_value (config_hide_completed_tasks_changed_cb, 
 							      tasks);
 	priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));	
+
+	not = calendar_config_add_notification_preview_state (config_preview_state_changed_cb, tasks);
+	priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
 }
 
 static void
Index: gui/e-tasks.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-tasks.h,v
retrieving revision 1.26
diff -u -r1.26 e-tasks.h
--- gui/e-tasks.h	6 Oct 2005 18:21:51 -0000	1.26
+++ gui/e-tasks.h	21 Dec 2005 06:59:44 -0000
@@ -47,6 +47,9 @@
 
 	/* Private data */
 	ETasksPrivate *priv;
+
+	/* if we're active, this will be set */
+	BonoboUIComponent *uic;
 };
 
 struct _ETasksClass {
Index: gui/tasks-control.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/tasks-control.c,v
retrieving revision 1.85
diff -u -r1.85 tasks-control.c
--- gui/tasks-control.c	26 Nov 2005 02:31:50 -0000	1.85
+++ gui/tasks-control.c	21 Dec 2005 06:59:44 -0000
@@ -268,6 +268,7 @@
 
 	uic = bonobo_control_get_ui_component (control);
 	g_assert (uic != NULL);
+	tasks->uic = uic;
 
 	remote_uih = bonobo_control_get_remote_ui_container (control, NULL);
 	bonobo_ui_component_set_container (uic, remote_uih, NULL);


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