Re: [evolution-patches] [Tasks] Updated patch for Bug #324560



Hi, Chenthill and all 

pls review the new patch. 

thanks.
-Sam

On Thu, 2006-03-02 at 22:24 +0530, pchenthill wrote:
> On Mon, 2006-02-27 at 12:02 +0800, sam yang wrote:
> >        /* Private data */
> >         ETasksPrivate *priv;
> > +
> > +       /* if we're active, this will be set */
> > +       BonoboUIComponent *uic;
> > }; 
> 
> It could be put inside the Private structure as its used only by
> ETasks and might not be needed outside.
As I thought before, the reason to put uic inside ETasks other than its
private structure, ETasksPrivate, is uic is evaluated in
tasks_control_activate() in tasks-control.c, where ETasksPrivate isn't
avaible.

When I planed to put uic inside ETasksPrivate and provide a function to
set its value, as you have suggested, I found we needn't to add a new
BonoboUIComponent at all, because we have had one: E_SEARCH_BAR
(ETasks->priv->search_bar)->ui_component. It is set in
tasks_control_activate() through  e_tasks_set_ui_component(). And it's
exactly the UI component which I want to get.
> 
> 
> thanks, Chenthill.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.3001
diff -u -r1.3001 ChangeLog
--- ChangeLog	28 Feb 2006 12:16:43 -0000	1.3001
+++ ChangeLog	3 Mar 2006 06:47:52 -0000
@@ -1,3 +1,12 @@
+2006-03-03  Sam Yang  <sam yang sun com>
+
+	Fixes #324560
+	* gui/calendar-config.h:
+	* 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 notification request and store connection ID.
+
 2006-02-28  Chenthill Palanisamy  <pchenthill novell com>
 
 	Fixes #332726
Index: gui/calendar-config.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-config.c,v
retrieving revision 1.85
diff -u -r1.85 calendar-config.c
--- gui/calendar-config.c	13 Jan 2006 11:02:13 -0000	1.85
+++ gui/calendar-config.c	3 Mar 2006 06:47:53 -0000
@@ -658,6 +658,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/calendar-config.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-config.h,v
retrieving revision 1.45
diff -u -r1.45 calendar-config.h
--- gui/calendar-config.h	13 Jan 2006 11:02:10 -0000	1.45
+++ gui/calendar-config.h	3 Mar 2006 06:47:53 -0000
@@ -164,6 +164,7 @@
 
 gboolean  calendar_config_get_preview_state	(void);
 void	  calendar_config_set_preview_state	(gboolean     state);
+guint	  calendar_config_add_notification_preview_state (GConfClientNotifyFunc func, gpointer data);
 
 gint      calendar_config_get_month_hpane_pos	(void);
 void	  calendar_config_set_month_hpane_pos	(gint	      hpane_pos);
Index: gui/e-tasks.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-tasks.c,v
retrieving revision 1.129
diff -u -r1.129 e-tasks.c
--- gui/e-tasks.c	8 Feb 2006 13:06:02 -0000	1.129
+++ gui/e-tasks.c	3 Mar 2006 06:47:53 -0000
@@ -377,6 +377,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 (E_SEARCH_BAR (tasks->priv->search_bar)->ui_component, "/commands/ViewPreview", "state", state ? "1" : "0", NULL);
+}
+
+static void
 setup_config (ETasks *tasks)
 {
 	ETasksPrivate *priv;
@@ -401,6 +416,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


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