evolution r36696 - in branches/kill-bonobo: calendar/gui calendar/modules shell



Author: mbarnes
Date: Wed Oct 29 20:11:07 2008
New Revision: 36696
URL: http://svn.gnome.org/viewvc/evolution?rev=36696&view=rev

Log:
Get the calendar's memopad and taskpad working.

What's interesting here is we're actually sharing the ECalModel across views.
Instead of having the Calendar view listen to GConf for changes to the Task
and Memo models, the Calendar view fetches the models directly from the Task
and Memo views -- starting the views if it has to, although the shell really
takes care of that -- and loads the models into its own taskpad and memopad.

We couldn't do that sort of thing before with Bonobo in the way.
Big chunks of redundant code should begin falling out shortly.


Modified:
   branches/kill-bonobo/calendar/gui/e-cal-model-memos.c
   branches/kill-bonobo/calendar/gui/e-cal-model-memos.h
   branches/kill-bonobo/calendar/gui/e-cal-model-tasks.c
   branches/kill-bonobo/calendar/gui/e-cal-model-tasks.h
   branches/kill-bonobo/calendar/gui/e-calendar-table.c
   branches/kill-bonobo/calendar/gui/e-calendar-table.h
   branches/kill-bonobo/calendar/gui/e-memo-table.c
   branches/kill-bonobo/calendar/gui/e-memo-table.h
   branches/kill-bonobo/calendar/modules/e-cal-shell-content.c
   branches/kill-bonobo/calendar/modules/e-cal-shell-view-memopad.c
   branches/kill-bonobo/calendar/modules/e-cal-shell-view-private.c
   branches/kill-bonobo/calendar/modules/e-cal-shell-view-private.h
   branches/kill-bonobo/calendar/modules/e-cal-shell-view-taskpad.c
   branches/kill-bonobo/calendar/modules/e-memo-shell-content.c
   branches/kill-bonobo/calendar/modules/e-memo-shell-content.h
   branches/kill-bonobo/calendar/modules/e-task-shell-content.c
   branches/kill-bonobo/calendar/modules/e-task-shell-content.h
   branches/kill-bonobo/shell/e-shell-view.c
   branches/kill-bonobo/shell/e-shell-view.h
   branches/kill-bonobo/shell/e-shell-window.c

Modified: branches/kill-bonobo/calendar/gui/e-cal-model-memos.c
==============================================================================
--- branches/kill-bonobo/calendar/gui/e-cal-model-memos.c	(original)
+++ branches/kill-bonobo/calendar/gui/e-cal-model-memos.c	Wed Oct 29 20:11:07 2008
@@ -261,7 +261,7 @@
 /**
  * e_cal_model_memos_new
  */
-ECalModelMemos *
+ECalModel *
 e_cal_model_memos_new (void)
 {
 	return g_object_new (E_TYPE_CAL_MODEL_MEMOS, NULL);

Modified: branches/kill-bonobo/calendar/gui/e-cal-model-memos.h
==============================================================================
--- branches/kill-bonobo/calendar/gui/e-cal-model-memos.h	(original)
+++ branches/kill-bonobo/calendar/gui/e-cal-model-memos.h	Wed Oct 29 20:11:07 2008
@@ -55,8 +55,8 @@
 	ECalModelClass parent_class;
 } ECalModelMemosClass;
 
-GType          e_cal_model_memos_get_type (void);
-ECalModelMemos *e_cal_model_memos_new (void);
+GType		e_cal_model_memos_get_type	(void);
+ECalModel *	e_cal_model_memos_new		(void);
 
 G_END_DECLS
 

Modified: branches/kill-bonobo/calendar/gui/e-cal-model-tasks.c
==============================================================================
--- branches/kill-bonobo/calendar/gui/e-cal-model-tasks.c	(original)
+++ branches/kill-bonobo/calendar/gui/e-cal-model-tasks.c	Wed Oct 29 20:11:07 2008
@@ -1108,7 +1108,7 @@
 /**
  * e_cal_model_tasks_new
  */
-ECalModelTasks *
+ECalModel *
 e_cal_model_tasks_new (void)
 {
 	return g_object_new (E_TYPE_CAL_MODEL_TASKS, NULL);

Modified: branches/kill-bonobo/calendar/gui/e-cal-model-tasks.h
==============================================================================
--- branches/kill-bonobo/calendar/gui/e-cal-model-tasks.h	(original)
+++ branches/kill-bonobo/calendar/gui/e-cal-model-tasks.h	Wed Oct 29 20:11:07 2008
@@ -64,7 +64,7 @@
 } ECalModelTasksClass;
 
 GType           e_cal_model_tasks_get_type (void);
-ECalModelTasks *e_cal_model_tasks_new (void);
+ECalModel *	e_cal_model_tasks_new (void);
 
 void            e_cal_model_tasks_mark_comp_complete (ECalModelTasks *model, ECalModelComponent *comp_data);
 void            e_cal_model_tasks_mark_comp_incomplete (ECalModelTasks *model, ECalModelComponent *comp_data);

Modified: branches/kill-bonobo/calendar/gui/e-calendar-table.c
==============================================================================
--- branches/kill-bonobo/calendar/gui/e-calendar-table.c	(original)
+++ branches/kill-bonobo/calendar/gui/e-calendar-table.c	Wed Oct 29 20:11:07 2008
@@ -65,10 +65,12 @@
 
 struct _ECalendarTablePrivate {
 	gpointer shell_view;  /* weak pointer */
+	ECalModel *model;
 };
 
 enum {
 	PROP_0,
+	PROP_MODEL,
 	PROP_SHELL_VIEW
 };
 
@@ -238,9 +240,11 @@
                                 gint col,
                                 GdkEvent *event)
 {
+	ECalModel *model;
 	ECalModelComponent *comp_data;
 
-	comp_data = e_cal_model_get_component_at (cal_table->model, row);
+	model = e_calendar_table_get_model (cal_table);
+	comp_data = e_cal_model_get_component_at (model, row);
 	calendar_table_emit_open_component (cal_table, comp_data);
 }
 
@@ -270,6 +274,7 @@
                                  gboolean keyboard_mode,
                                  GtkTooltip *tooltip)
 {
+	ECalModel *model;
 	ECalModelComponent *comp_data;
 	int row = -1, col = -1;
 	GtkWidget *box, *l, *w;
@@ -304,7 +309,8 @@
 	if (esm && esm->sorter && e_sorter_needs_sorting (esm->sorter))
 		row = e_sorter_sorted_to_model (esm->sorter, row);
 
-	comp_data = e_cal_model_get_component_at (cal_table->model, row);
+	model = e_calendar_table_get_model (cal_table);
+	comp_data = e_cal_model_get_component_at (model, row);
 	if (!comp_data || !comp_data->icalcomp)
 		return FALSE;
 
@@ -375,7 +381,7 @@
 	e_cal_component_get_dtstart (new_comp, &dtstart);
 	e_cal_component_get_due (new_comp, &dtdue);
 
-	default_zone = e_cal_model_get_timezone  (cal_table->model);
+	default_zone = e_cal_model_get_timezone (model);
 
 	if (dtstart.tzid) {
 		zone = icalcomponent_get_timezone (e_cal_component_get_icalcomponent (new_comp), dtstart.tzid);
@@ -487,6 +493,29 @@
 }
 
 static void
+calendar_table_set_model (ECalendarTable *cal_table,
+                          ECalModel *model)
+{
+	g_return_if_fail (cal_table->priv->model == NULL);
+
+	cal_table->priv->model = g_object_ref (model);
+
+	g_signal_connect_swapped (
+		model, "row_appended",
+		G_CALLBACK (calendar_table_emit_user_created), cal_table);
+
+	g_signal_connect_swapped (
+		model, "cal-view-progress",
+		G_CALLBACK (calendar_table_model_cal_view_progress_cb),
+		cal_table);
+
+	g_signal_connect_swapped (
+		model, "cal-view-done",
+		G_CALLBACK (calendar_table_model_cal_view_done_cb),
+		cal_table);
+}
+
+static void
 calendar_table_set_shell_view (ECalendarTable *cal_table,
                                EShellView *shell_view)
 {
@@ -506,6 +535,12 @@
                              GParamSpec *pspec)
 {
 	switch (property_id) {
+		case PROP_MODEL:
+			calendar_table_set_model (
+				E_CALENDAR_TABLE (object),
+				g_value_get_object (value));
+			return;
+
 		case PROP_SHELL_VIEW:
 			calendar_table_set_shell_view (
 				E_CALENDAR_TABLE (object),
@@ -523,6 +558,12 @@
                              GParamSpec *pspec)
 {
 	switch (property_id) {
+		case PROP_MODEL:
+			g_value_set_object (
+				value, e_calendar_table_get_model (
+				E_CALENDAR_TABLE (object)));
+			return;
+
 		case PROP_SHELL_VIEW:
 			g_value_set_object (
 				value, e_calendar_table_get_shell_view (
@@ -536,13 +577,13 @@
 static void
 calendar_table_dispose (GObject *object)
 {
-	ECalendarTable *cal_table;
+	ECalendarTablePrivate *priv;
 
-	cal_table = E_CALENDAR_TABLE (object);
+	priv = E_CALENDAR_TABLE_GET_PRIVATE (object);
 
-	if (cal_table->model != NULL) {
-		g_object_unref (cal_table->model);
-		cal_table->model = NULL;
+	if (priv->model != NULL) {
+		g_object_unref (priv->model);
+		priv->model = NULL;
 	}
 
 	/* Chain up to parent's dispose() method. */
@@ -550,75 +591,11 @@
 }
 
 static void
-calendar_table_class_init (ECalendarTableClass *class)
-{
-	GObjectClass *object_class;
-
-	parent_class = g_type_class_peek_parent (class);
-	g_type_class_add_private (class, sizeof (ECalendarTablePrivate));
-
-	object_class = G_OBJECT_CLASS (class);
-	object_class->set_property = calendar_table_set_property;
-	object_class->get_property = calendar_table_get_property;
-	object_class->dispose = calendar_table_dispose;
-
-	g_object_class_install_property (
-		object_class,
-		PROP_SHELL_VIEW,
-		g_param_spec_object (
-			"shell-view",
-			_("Shell View"),
-			NULL,
-			E_TYPE_SHELL_VIEW,
-			G_PARAM_READWRITE |
-			G_PARAM_CONSTRUCT_ONLY));
-
-	signals[OPEN_COMPONENT] = g_signal_new (
-		"open-component",
-		G_TYPE_FROM_CLASS (class),
-		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-		G_STRUCT_OFFSET (ECalendarTableClass, open_component),
-		NULL, NULL,
-		g_cclosure_marshal_VOID__OBJECT,
-		G_TYPE_NONE, 1,
-		E_TYPE_CAL_MODEL_COMPONENT);
-
-	signals[POPUP_EVENT] = g_signal_new (
-		"popup-event",
-		G_TYPE_FROM_CLASS (class),
-		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-		G_STRUCT_OFFSET (ECalendarTableClass, popup_event),
-		NULL, NULL,
-		g_cclosure_marshal_VOID__BOXED,
-		G_TYPE_NONE, 1,
-		GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
-
-	signals[STATUS_MESSAGE] = g_signal_new (
-		"status-message",
-		G_TYPE_FROM_CLASS (class),
-		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-		G_STRUCT_OFFSET (ECalendarTableClass, status_message),
-		NULL, NULL,
-		g_cclosure_marshal_VOID__STRING,
-		G_TYPE_NONE, 1,
-		G_TYPE_STRING);
-
-	signals[USER_CREATED] = g_signal_new (
-		"user-created",
-		G_TYPE_FROM_CLASS (class),
-		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-		G_STRUCT_OFFSET (ECalendarTableClass, user_created),
-		NULL, NULL,
-		g_cclosure_marshal_VOID__VOID,
-		G_TYPE_NONE, 0);
-
-	clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
-}
-
-static void
-calendar_table_init (ECalendarTable *cal_table)
+calendar_table_constructed (GObject *object)
 {
+	ECalendarTable *cal_table;
 	GtkWidget *widget;
+	ECalModel *model;
 	ETable *table;
 	ECell *cell, *popup_cell;
 	ETableExtras *extras;
@@ -628,25 +605,8 @@
 	AtkObject *a11y;
 	gchar *etspecfile;
 
-	cal_table->priv = E_CALENDAR_TABLE_GET_PRIVATE (cal_table);
-
-	/* Create the model */
-
-	cal_table->model = (ECalModel *) e_cal_model_tasks_new ();
-
-	g_signal_connect_swapped (
-		cal_table->model, "row_appended",
-		G_CALLBACK (calendar_table_emit_user_created), cal_table);
-
-	g_signal_connect_swapped (
-		cal_table->model, "cal-view-progress",
-		G_CALLBACK (calendar_table_model_cal_view_progress_cb),
-		cal_table);
-
-	g_signal_connect_swapped (
-		cal_table->model, "cal-view-done",
-		G_CALLBACK (calendar_table_model_cal_view_done_cb),
-		cal_table);
+	cal_table = E_CALENDAR_TABLE (object);
+	model = e_calendar_table_get_model (cal_table);
 
 	/* Create the header columns */
 
@@ -837,7 +797,7 @@
 	etspecfile = g_build_filename (
 		EVOLUTION_ETSPECDIR, "e-calendar-table.etspec", NULL);
 	widget = e_table_scrolled_new_from_spec_file (
-		E_TABLE_MODEL (cal_table->model), extras, etspecfile, NULL);
+		E_TABLE_MODEL (model), extras, etspecfile, NULL);
 	gtk_table_attach (
 		GTK_TABLE (cal_table), widget, 0, 1, 0, 1,
 		GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
@@ -865,6 +825,90 @@
 		atk_object_set_name (a11y, _("Tasks"));
 }
 
+static void
+calendar_table_class_init (ECalendarTableClass *class)
+{
+	GObjectClass *object_class;
+
+	parent_class = g_type_class_peek_parent (class);
+	g_type_class_add_private (class, sizeof (ECalendarTablePrivate));
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->set_property = calendar_table_set_property;
+	object_class->get_property = calendar_table_get_property;
+	object_class->dispose = calendar_table_dispose;
+	object_class->constructed = calendar_table_constructed;
+
+	g_object_class_install_property (
+		object_class,
+		PROP_MODEL,
+		g_param_spec_object (
+			"model",
+			_("Model"),
+			NULL,
+			E_TYPE_CAL_MODEL,
+			G_PARAM_READWRITE |
+			G_PARAM_CONSTRUCT_ONLY));
+
+	g_object_class_install_property (
+		object_class,
+		PROP_SHELL_VIEW,
+		g_param_spec_object (
+			"shell-view",
+			_("Shell View"),
+			NULL,
+			E_TYPE_SHELL_VIEW,
+			G_PARAM_READWRITE |
+			G_PARAM_CONSTRUCT_ONLY));
+
+	signals[OPEN_COMPONENT] = g_signal_new (
+		"open-component",
+		G_TYPE_FROM_CLASS (class),
+		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+		G_STRUCT_OFFSET (ECalendarTableClass, open_component),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__OBJECT,
+		G_TYPE_NONE, 1,
+		E_TYPE_CAL_MODEL_COMPONENT);
+
+	signals[POPUP_EVENT] = g_signal_new (
+		"popup-event",
+		G_TYPE_FROM_CLASS (class),
+		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+		G_STRUCT_OFFSET (ECalendarTableClass, popup_event),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__BOXED,
+		G_TYPE_NONE, 1,
+		GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+
+	signals[STATUS_MESSAGE] = g_signal_new (
+		"status-message",
+		G_TYPE_FROM_CLASS (class),
+		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+		G_STRUCT_OFFSET (ECalendarTableClass, status_message),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__STRING,
+		G_TYPE_NONE, 1,
+		G_TYPE_STRING);
+
+	signals[USER_CREATED] = g_signal_new (
+		"user-created",
+		G_TYPE_FROM_CLASS (class),
+		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+		G_STRUCT_OFFSET (ECalendarTableClass, user_created),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__VOID,
+		G_TYPE_NONE, 0);
+
+	clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
+}
+
+static void
+calendar_table_init (ECalendarTable *cal_table)
+{
+	cal_table->priv = E_CALENDAR_TABLE_GET_PRIVATE (cal_table);
+}
+
 GType
 e_calendar_table_get_type (void)
 {
@@ -894,19 +938,22 @@
 /**
  * e_calendar_table_new:
  * @shell_view: an #EShellView
+ * @model: an #ECalModel for the table
  *
  * Returns a new #ECalendarTable.
  *
  * Returns: a new #ECalendarTable
  **/
 GtkWidget *
-e_calendar_table_new (EShellView *shell_view)
+e_calendar_table_new (EShellView *shell_view,
+                      ECalModel *model)
 {
 	g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+	g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
 
 	return g_object_new (
 		E_TYPE_CALENDAR_TABLE,
-		"shell-view", shell_view, NULL);
+		"model", model, "shell-view", shell_view, NULL);
 }
 
 EShellView *
@@ -928,10 +975,9 @@
 ECalModel *
 e_calendar_table_get_model (ECalendarTable *cal_table)
 {
-	g_return_val_if_fail (cal_table != NULL, NULL);
 	g_return_val_if_fail (E_IS_CALENDAR_TABLE (cal_table), NULL);
 
-	return cal_table->model;
+	return cal_table->priv->model;
 }
 
 
@@ -975,9 +1021,11 @@
 static ECalModelComponent *
 get_selected_comp (ECalendarTable *cal_table)
 {
+	ECalModel *model;
 	ETable *etable;
 	int row;
 
+	model = e_calendar_table_get_model (cal_table);
 	etable = e_calendar_table_get_table (cal_table);
 	if (e_table_selected_count (etable) != 1)
 		return NULL;
@@ -988,7 +1036,7 @@
 				      &row);
 	g_return_val_if_fail (row != -1, NULL);
 
-	return e_cal_model_get_component_at (cal_table->model, row);
+	return e_cal_model_get_component_at (model, row);
 }
 
 struct get_selected_uids_closure {
@@ -1000,12 +1048,12 @@
 static void
 add_uid_cb (int model_row, gpointer data)
 {
-	struct get_selected_uids_closure *closure;
+	struct get_selected_uids_closure *closure = data;
 	ECalModelComponent *comp_data;
+	ECalModel *model;
 
-	closure = data;
-
-	comp_data = e_cal_model_get_component_at (closure->cal_table->model, model_row);
+	model = e_calendar_table_get_model (closure->cal_table);
+	comp_data = e_cal_model_get_component_at (model, model_row);
 
 	closure->objects = g_slist_prepend (closure->objects, comp_data);
 }
@@ -1221,6 +1269,7 @@
 {
 	ECalendarTable *cal_table;
 	ECalModelComponent *comp_data;
+	ECalModel *model;
 	gchar *comp_str;
 	icalcomponent *child;
 
@@ -1228,7 +1277,8 @@
 
 	g_return_if_fail (cal_table->tmp_vcal != NULL);
 
-	comp_data = e_cal_model_get_component_at (cal_table->model, model_row);
+	model = e_calendar_table_get_model (cal_table);
+	comp_data = e_cal_model_get_component_at (model, model_row);
 	if (!comp_data)
 		return;
 
@@ -1289,6 +1339,7 @@
 	icalcomponent *icalcomp;
 	char *uid;
 	ECalComponent *comp;
+	ECalModel *model;
 	ECal *client;
 	icalcomponent_kind kind;
 	const gchar *status_message;
@@ -1311,7 +1362,8 @@
 		return;
 	}
 
-	client = e_cal_model_get_default_client (cal_table->model);
+	model = e_calendar_table_get_model (cal_table);
+	client = e_cal_model_get_default_client (model);
 
 	status_message = _("Updating objects");
 	calendar_table_emit_status_message (cal_table, status_message, -1.0);

Modified: branches/kill-bonobo/calendar/gui/e-calendar-table.h
==============================================================================
--- branches/kill-bonobo/calendar/gui/e-calendar-table.h	(original)
+++ branches/kill-bonobo/calendar/gui/e-calendar-table.h	Wed Oct 29 20:11:07 2008
@@ -61,9 +61,6 @@
 struct _ECalendarTable {
 	GtkTable parent;
 
-	/* The model that we use */
-	ECalModel *model;
-
 	GtkWidget *etable;
 
 	/* The ECell used to view & edit dates. */
@@ -90,7 +87,8 @@
 };
 
 GType		e_calendar_table_get_type	(void);
-GtkWidget *	e_calendar_table_new		(EShellView *shell_view);
+GtkWidget *	e_calendar_table_new		(EShellView *shell_view,
+						 ECalModel *model);
 ECalModel *	e_calendar_table_get_model	(ECalendarTable *cal_table);
 ETable *	e_calendar_table_get_table	(ECalendarTable *cal_table);
 EShellView *	e_calendar_table_get_shell_view	(ECalendarTable *cal_table);

Modified: branches/kill-bonobo/calendar/gui/e-memo-table.c
==============================================================================
--- branches/kill-bonobo/calendar/gui/e-memo-table.c	(original)
+++ branches/kill-bonobo/calendar/gui/e-memo-table.c	Wed Oct 29 20:11:07 2008
@@ -66,10 +66,12 @@
 
 struct _EMemoTablePrivate {
 	gpointer shell_view;  /* weak pointer */
+	ECalModel *model;
 };
 
 enum {
 	PROP_0,
+	PROP_MODEL,
 	PROP_SHELL_VIEW
 };
 
@@ -176,9 +178,11 @@
                             gint col,
                             GdkEvent *event)
 {
+	ECalModel *model;
 	ECalModelComponent *comp_data;
 
-	comp_data = e_cal_model_get_component_at (memo_table->model, row);
+	model = e_memo_table_get_model (memo_table);
+	comp_data = e_cal_model_get_component_at (model, row);
 	memo_table_emit_open_component (memo_table, comp_data);
 }
 
@@ -208,6 +212,7 @@
                              gboolean keyboard_mode,
                              GtkTooltip *tooltip)
 {
+	ECalModel *model;
 	ECalModelComponent *comp_data;
 	int row = -1, col = -1;
 	GtkWidget *box, *l, *w;
@@ -242,7 +247,8 @@
 	if (esm && esm->sorter && e_sorter_needs_sorting (esm->sorter))
 		row = e_sorter_sorted_to_model (esm->sorter, row);
 
-	comp_data = e_cal_model_get_component_at (memo_table->model, row);
+	model = e_memo_table_get_model (memo_table);
+	comp_data = e_cal_model_get_component_at (model, row);
 	if (!comp_data || !comp_data->icalcomp)
 		return FALSE;
 
@@ -313,7 +319,7 @@
 	e_cal_component_get_dtstart (new_comp, &dtstart);
 	e_cal_component_get_due (new_comp, &dtdue);
 
-	default_zone = e_cal_model_get_timezone  (memo_table->model);
+	default_zone = e_cal_model_get_timezone (model);
 
 	if (dtstart.tzid) {
 		zone = icalcomponent_get_timezone (e_cal_component_get_icalcomponent (new_comp), dtstart.tzid);
@@ -425,6 +431,29 @@
 }
 
 static void
+memo_table_set_model (EMemoTable *memo_table,
+                      ECalModel *model)
+{
+	g_return_if_fail (memo_table->priv->model == NULL);
+
+	memo_table->priv->model = g_object_ref (model);
+
+	g_signal_connect_swapped (
+		model, "row-appended",
+		G_CALLBACK (memo_table_emit_user_created), memo_table);
+
+	g_signal_connect_swapped (
+		model, "cal-view-progress",
+		G_CALLBACK (memo_table_model_cal_view_progress_cb),
+		memo_table);
+
+	g_signal_connect_swapped (
+		model, "cal-view-done",
+		G_CALLBACK (memo_table_model_cal_view_done_cb),
+		memo_table);
+}
+
+static void
 memo_table_set_shell_view (EMemoTable *memo_table,
                            EShellView *shell_view)
 {
@@ -444,6 +473,12 @@
                          GParamSpec *pspec)
 {
 	switch (property_id) {
+		case PROP_MODEL:
+			memo_table_set_model (
+				E_MEMO_TABLE (object),
+				g_value_get_object (value));
+			return;
+
 		case PROP_SHELL_VIEW:
 			memo_table_set_shell_view (
 				E_MEMO_TABLE (object),
@@ -461,6 +496,12 @@
                          GParamSpec *pspec)
 {
 	switch (property_id) {
+		case PROP_MODEL:
+			g_value_set_object (
+				value, e_memo_table_get_model (
+				E_MEMO_TABLE (object)));
+			return;
+
 		case PROP_SHELL_VIEW:
 			g_value_set_object (
 				value, e_memo_table_get_shell_view (
@@ -474,13 +515,13 @@
 static void
 memo_table_dispose (GObject *object)
 {
-	EMemoTable *memo_table;
+	EMemoTablePrivate *priv;
 
-	memo_table = E_MEMO_TABLE (object);
+	priv = E_MEMO_TABLE_GET_PRIVATE (object);
 
-	if (memo_table->model != NULL) {
-		g_object_unref (memo_table->model);
-		memo_table->model = NULL;
+	if (priv->model != NULL) {
+		g_object_unref (priv->model);
+		priv->model = NULL;
 	}
 
 	/* Chain up to parent's dispose() method. */
@@ -488,75 +529,11 @@
 }
 
 static void
-memo_table_class_init (EMemoTableClass *class)
-{
-	GObjectClass *object_class;
-
-	parent_class = g_type_class_peek_parent (class);
-	g_type_class_add_private (class, sizeof (EMemoTablePrivate));
-
-	object_class = G_OBJECT_CLASS (class);
-	object_class->set_property = memo_table_set_property;
-	object_class->get_property = memo_table_get_property;
-	object_class->dispose = memo_table_dispose;
-
-	g_object_class_install_property (
-		object_class,
-		PROP_SHELL_VIEW,
-		g_param_spec_object (
-			"shell-view",
-			_("Shell View"),
-			NULL,
-			E_TYPE_SHELL_VIEW,
-			G_PARAM_READWRITE |
-			G_PARAM_CONSTRUCT_ONLY));
-
-	signals[OPEN_COMPONENT] = g_signal_new (
-		"open-component",
-		G_TYPE_FROM_CLASS (class),
-		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-		G_STRUCT_OFFSET (EMemoTableClass, open_component),
-		NULL, NULL,
-		g_cclosure_marshal_VOID__OBJECT,
-		G_TYPE_NONE, 1,
-		E_TYPE_CAL_MODEL_COMPONENT);
-
-	signals[POPUP_EVENT] = g_signal_new (
-		"popup-event",
-		G_TYPE_FROM_CLASS (class),
-		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-		G_STRUCT_OFFSET (EMemoTableClass, popup_event),
-		NULL, NULL,
-		g_cclosure_marshal_VOID__BOXED,
-		G_TYPE_NONE, 1,
-		GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
-
-	signals[STATUS_MESSAGE] = g_signal_new (
-		"status-message",
-		G_TYPE_FROM_CLASS (class),
-		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-		G_STRUCT_OFFSET (EMemoTableClass, status_message),
-		NULL, NULL,
-		g_cclosure_marshal_VOID__STRING,
-		G_TYPE_NONE, 1,
-		G_TYPE_STRING);
-
-	signals[USER_CREATED] = g_signal_new (
-		"user-created",
-		G_TYPE_FROM_CLASS (class),
-		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-		G_STRUCT_OFFSET (EMemoTableClass, user_created),
-		NULL, NULL,
-		g_cclosure_marshal_VOID__VOID,
-		G_TYPE_NONE, 0);
-
-	clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
-}
-
-static void
-memo_table_init (EMemoTable *memo_table)
+memo_table_constructed (GObject *object)
 {
+	EMemoTable *memo_table;
 	GtkWidget *widget;
+	ECalModel *model;
 	ETable *table;
 	ECell *cell, *popup_cell;
 	ETableExtras *extras;
@@ -564,25 +541,8 @@
 	AtkObject *a11y;
 	gchar *etspecfile;
 
-	memo_table->priv = E_MEMO_TABLE_GET_PRIVATE (memo_table);
-
-	/* Create the model */
-
-	memo_table->model = (ECalModel *) e_cal_model_memos_new ();
-
-	g_signal_connect_swapped (
-		memo_table->model, "row-appended",
-		G_CALLBACK (memo_table_emit_user_created), memo_table);
-
-	g_signal_connect_swapped (
-		memo_table->model, "cal-view-progress",
-		G_CALLBACK (memo_table_model_cal_view_progress_cb),
-		memo_table);
-
-	g_signal_connect_swapped (
-		memo_table->model, "cal-view-done",
-		G_CALLBACK (memo_table_model_cal_view_done_cb),
-		memo_table);
+	memo_table = E_MEMO_TABLE (object);
+	model = e_memo_table_get_model (memo_table);
 
 	/* Create the header columns */
 
@@ -632,7 +592,7 @@
 	etspecfile = g_build_filename (
 		EVOLUTION_ETSPECDIR, "e-memo-table.etspec", NULL);
 	widget = e_table_scrolled_new_from_spec_file (
-		E_TABLE_MODEL (memo_table->model), extras, etspecfile, NULL);
+		E_TABLE_MODEL (model), extras, etspecfile, NULL);
 	gtk_table_attach (
 		GTK_TABLE (memo_table), widget, 0, 1, 0, 1,
 		GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
@@ -660,6 +620,90 @@
 		atk_object_set_name (a11y, _("Memos"));
 }
 
+static void
+memo_table_class_init (EMemoTableClass *class)
+{
+	GObjectClass *object_class;
+
+	parent_class = g_type_class_peek_parent (class);
+	g_type_class_add_private (class, sizeof (EMemoTablePrivate));
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->set_property = memo_table_set_property;
+	object_class->get_property = memo_table_get_property;
+	object_class->dispose = memo_table_dispose;
+	object_class->constructed = memo_table_constructed;
+
+	g_object_class_install_property (
+		object_class,
+		PROP_MODEL,
+		g_param_spec_object (
+			"model",
+			_("Model"),
+			NULL,
+			E_TYPE_CAL_MODEL,
+			G_PARAM_READWRITE |
+			G_PARAM_CONSTRUCT_ONLY));
+
+	g_object_class_install_property (
+		object_class,
+		PROP_SHELL_VIEW,
+		g_param_spec_object (
+			"shell-view",
+			_("Shell View"),
+			NULL,
+			E_TYPE_SHELL_VIEW,
+			G_PARAM_READWRITE |
+			G_PARAM_CONSTRUCT_ONLY));
+
+	signals[OPEN_COMPONENT] = g_signal_new (
+		"open-component",
+		G_TYPE_FROM_CLASS (class),
+		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+		G_STRUCT_OFFSET (EMemoTableClass, open_component),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__OBJECT,
+		G_TYPE_NONE, 1,
+		E_TYPE_CAL_MODEL_COMPONENT);
+
+	signals[POPUP_EVENT] = g_signal_new (
+		"popup-event",
+		G_TYPE_FROM_CLASS (class),
+		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+		G_STRUCT_OFFSET (EMemoTableClass, popup_event),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__BOXED,
+		G_TYPE_NONE, 1,
+		GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+
+	signals[STATUS_MESSAGE] = g_signal_new (
+		"status-message",
+		G_TYPE_FROM_CLASS (class),
+		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+		G_STRUCT_OFFSET (EMemoTableClass, status_message),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__STRING,
+		G_TYPE_NONE, 1,
+		G_TYPE_STRING);
+
+	signals[USER_CREATED] = g_signal_new (
+		"user-created",
+		G_TYPE_FROM_CLASS (class),
+		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+		G_STRUCT_OFFSET (EMemoTableClass, user_created),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__VOID,
+		G_TYPE_NONE, 0);
+
+	clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
+}
+
+static void
+memo_table_init (EMemoTable *memo_table)
+{
+	memo_table->priv = E_MEMO_TABLE_GET_PRIVATE (memo_table);
+}
+
 GType
 e_memo_table_get_type (void)
 {
@@ -689,19 +733,22 @@
 /**
  * e_memo_table_new:
  * @shell_view: an #EShellView
+ * @model: an #ECalModel for the table
  *
  * Returns a new #EMemoTable.
  *
  * Returns: a new #EMemoTable
  **/
 GtkWidget *
-e_memo_table_new (EShellView *shell_view)
+e_memo_table_new (EShellView *shell_view,
+                  ECalModel *model)
 {
 	g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+	g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
 
 	return g_object_new (
 		E_TYPE_MEMO_TABLE,
-		"shell-view", shell_view, NULL);
+		"model", model, "shell-view", shell_view, NULL);
 }
 
 EShellView *
@@ -726,7 +773,7 @@
 	g_return_val_if_fail (memo_table != NULL, NULL);
 	g_return_val_if_fail (E_IS_MEMO_TABLE (memo_table), NULL);
 
-	return memo_table->model;
+	return memo_table->priv->model;
 }
 
 
@@ -770,9 +817,11 @@
 static ECalModelComponent *
 get_selected_comp (EMemoTable *memo_table)
 {
+	ECalModel *model;
 	ETable *etable;
 	int row;
 
+	model = e_memo_table_get_model (memo_table);
 	etable = e_memo_table_get_table (memo_table);
 	if (e_table_selected_count (etable) != 1)
 		return NULL;
@@ -783,7 +832,7 @@
 				      &row);
 	g_return_val_if_fail (row != -1, NULL);
 
-	return e_cal_model_get_component_at (memo_table->model, row);
+	return e_cal_model_get_component_at (model, row);
 }
 
 struct get_selected_uids_closure {
@@ -797,10 +846,12 @@
 {
 	struct get_selected_uids_closure *closure;
 	ECalModelComponent *comp_data;
+	ECalModel *model;
 
 	closure = data;
 
-	comp_data = e_cal_model_get_component_at (closure->memo_table->model, model_row);
+	model = e_memo_table_get_model (closure->memo_table);
+	comp_data = e_cal_model_get_component_at (model, model_row);
 
 	closure->objects = g_slist_prepend (closure->objects, comp_data);
 }
@@ -941,6 +992,7 @@
 {
 	EMemoTable *memo_table;
 	ECalModelComponent *comp_data;
+	ECalModel *model;
 	gchar *comp_str;
 	icalcomponent *child;
 
@@ -948,7 +1000,8 @@
 
 	g_return_if_fail (memo_table->tmp_vcal != NULL);
 
-	comp_data = e_cal_model_get_component_at (memo_table->model, model_row);
+	model = e_memo_table_get_model (memo_table);
+	comp_data = e_cal_model_get_component_at (model, model_row);
 	if (!comp_data)
 		return;
 
@@ -1010,6 +1063,7 @@
 	char *uid;
 	ECalComponent *comp;
 	ECal *client;
+	ECalModel *model;
 	icalcomponent_kind kind;
 	const gchar *status_message;
 
@@ -1031,7 +1085,8 @@
 		return;
 	}
 
-	client = e_cal_model_get_default_client (memo_table->model);
+	model = e_memo_table_get_model (memo_table);
+	client = e_cal_model_get_default_client (model);
 
 	status_message = _("Updating objects");
 	memo_table_emit_status_message (memo_table, status_message, -1.0);

Modified: branches/kill-bonobo/calendar/gui/e-memo-table.h
==============================================================================
--- branches/kill-bonobo/calendar/gui/e-memo-table.h	(original)
+++ branches/kill-bonobo/calendar/gui/e-memo-table.h	Wed Oct 29 20:11:07 2008
@@ -67,9 +67,6 @@
 struct _EMemoTable {
 	GtkTable parent;
 
-	/* The model that we use */
-	ECalModel *model;
-
 	GtkWidget *etable;
 
 	/* The ECell used to view & edit dates. */
@@ -96,7 +93,8 @@
 };
 
 GType		e_memo_table_get_type		(void);
-GtkWidget *	e_memo_table_new		(EShellView *shell_view);
+GtkWidget *	e_memo_table_new		(EShellView *shell_view,
+						 ECalModel *model);
 ECalModel *	e_memo_table_get_model		(EMemoTable *memo_table);
 ETable *	e_memo_table_get_table		(EMemoTable *memo_table);
 EShellView *	e_memo_table_get_shell_view	(EMemoTable *memo_table);

Modified: branches/kill-bonobo/calendar/modules/e-cal-shell-content.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-cal-shell-content.c	(original)
+++ branches/kill-bonobo/calendar/modules/e-cal-shell-content.c	Wed Oct 29 20:11:07 2008
@@ -304,10 +304,15 @@
 {
 	ECalShellContentPrivate *priv;
 	ECalModelCalendar *cal_model;
+	ECalModel *memo_model;
+	ECalModel *task_model;
 	EShellContent *shell_content;
 	EShellModule *shell_module;
 	EShellView *shell_view;
+	EShellWindow *shell_window;
 	EShellViewClass *shell_view_class;
+	EShellContent *foreign_content;
+	EShellView *foreign_view;
 	GalViewCollection *view_collection;
 	GalViewInstance *view_instance;
 	GtkWidget *container;
@@ -324,6 +329,7 @@
 
 	shell_content = E_SHELL_CONTENT (object);
 	shell_view = e_shell_content_get_shell_view (shell_content);
+	shell_window = e_shell_view_get_shell_window (shell_view);
 	shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
 	view_collection = shell_view_class->view_collection;
 
@@ -336,6 +342,17 @@
 		E_CAL_MODEL (cal_model),
 		E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES);
 
+	/* We borrow the memopad and taskpad models from the memo
+	 * and task views, loading the views if necessary. */
+
+	foreign_view = e_shell_window_get_shell_view (shell_window, "memos");
+	foreign_content = e_shell_view_get_shell_content (foreign_view);
+	g_object_get (foreign_content, "model", &memo_model, NULL);
+
+	foreign_view = e_shell_window_get_shell_view (shell_window, "tasks");
+	foreign_content = e_shell_view_get_shell_content (foreign_view);
+	g_object_get (foreign_content, "model", &task_model, NULL);
+
 	/* Build content widgets. */
 
 	container = GTK_WIDGET (object);
@@ -454,7 +471,7 @@
 	gtk_widget_show (widget);
 	g_free (markup);
 
-	widget = e_calendar_table_new (shell_view);
+	widget = e_calendar_table_new (shell_view, task_model);
 	gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
 	priv->task_table = g_object_ref (widget);
 	gtk_widget_show (widget);
@@ -478,7 +495,7 @@
 	gtk_widget_show (widget);
 	g_free (markup);
 
-	widget = e_memo_table_new (shell_view);
+	widget = e_memo_table_new (shell_view, memo_model);
 	gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
 	priv->memo_table = g_object_ref (widget);
 	gtk_widget_show (widget);
@@ -516,6 +533,9 @@
 		object);
 	gal_view_instance_load (view_instance);
 	priv->view_instance = view_instance;
+
+	g_object_unref (memo_model);
+	g_object_unref (task_model);
 }
 
 static void

Modified: branches/kill-bonobo/calendar/modules/e-cal-shell-view-memopad.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-cal-shell-view-memopad.c	(original)
+++ branches/kill-bonobo/calendar/modules/e-cal-shell-view-memopad.c	Wed Oct 29 20:11:07 2008
@@ -351,7 +351,6 @@
 	gtk_action_group_add_actions (
 		action_group, calendar_memopad_entries,
 		G_N_ELEMENTS (calendar_memopad_entries), cal_shell_view);
-	gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
 }
 
 void

Modified: branches/kill-bonobo/calendar/modules/e-cal-shell-view-private.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-cal-shell-view-private.c	(original)
+++ branches/kill-bonobo/calendar/modules/e-cal-shell-view-private.c	Wed Oct 29 20:11:07 2008
@@ -25,6 +25,22 @@
 #include "widgets/menus/gal-view-factory-etable.h"
 
 static void
+cal_shell_view_process_completed_tasks (ECalShellView *cal_shell_view,
+                                        gboolean config_changed)
+{
+#if 0
+	ECalShellContent *cal_shell_content;
+	ECalendarTable *task_table;
+
+	cal_shell_content = cal_shell_view->priv->cal_shell_content;
+	task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+	e_calendar_table_process_completed_tasks (
+		task_table, clients, config_changed);
+#endif
+}
+
+static void
 cal_shell_view_update_timezone (ECalShellView *cal_shell_view)
 {
 #if 0
@@ -49,10 +65,21 @@
 }
 
 static void
-cal_shell_view_timezone_changed_cb (GConfClient *client,
-                                    guint id,
-                                    GConfEntry *entry,
-                                    gpointer user_data)
+cal_shell_view_config_hide_completed_tasks_changed_cb (GConfClient *client,
+                                                       guint id,
+                                                       GConfEntry *entry,
+                                                       gpointer user_data)
+{
+	ECalShellView *cal_shell_view = user_data;
+
+	/* FIXME */
+}
+
+static void
+cal_shell_view_config_timezone_changed_cb (GConfClient *client,
+                                           guint id,
+                                           GConfEntry *entry,
+                                           gpointer user_data)
 {
 	ECalShellView *cal_shell_view = user_data;
 
@@ -197,6 +224,7 @@
 	ECalShellViewPrivate *priv = cal_shell_view->priv;
 	ESourceList *source_list;
 	GObject *object;
+	guint notification_id;
 
 	object = G_OBJECT (shell_view_class->type_module);
 	source_list = g_object_get_data (object, "source-list");
@@ -227,7 +255,7 @@
 	ECalendar *mini_calendar;
 	EMemoTable *memo_table;
 	ECalendarTable *task_table;
-	guint notification;
+	guint id;
 
 	shell_view = E_SHELL_VIEW (cal_shell_view);
 	shell_content = e_shell_view_get_shell_content (shell_view);
@@ -249,10 +277,12 @@
 		mini_calendar->calitem, (ECalendarItemGetTimeCallback)
 		cal_shell_view_get_current_time, cal_shell_view, NULL);
 
+#if 0 /* KILL-BONOBO */
 	g_signal_connect_swapped (
 		calendar, "dates-shown-changed",
 		G_CALLBACK (e_cal_shell_view_update_sidebar),
 		cal_shell_view);
+#endif
 
 	g_signal_connect_swapped (
 		mini_calendar, "scroll-event",
@@ -291,13 +321,27 @@
 
 	/* Listen for configuration changes. */
 
-#if 0
-	notification = calendar_config_add_notification_timezone (
-		cal_shell_view_timezone_changed_cb, cal_shell_view);
+	/* Timezone */
+	id = calendar_config_add_notification_timezone (
+		cal_shell_view_config_timezone_changed_cb, cal_shell_view);
 	priv->notifications = g_list_prepend (
-		priv->notifications, GUINT_TO_POINTER (notification));
+		priv->notifications, GUINT_TO_POINTER (id));
 	cal_shell_view_update_timezone (cal_shell_view);
-#endif
+
+	/* Hide Completed Tasks (enable/units/value) */
+	id = calendar_config_add_notification_hide_completed_tasks (
+		cal_shell_view_config_hide_completed_tasks_changed_cb,
+		cal_shell_view);
+	priv->notifications = g_list_prepend (
+		priv->notifications, GUINT_TO_POINTER (id));
+	id = calendar_config_add_notification_hide_completed_tasks_units (
+		cal_shell_view_config_hide_completed_tasks_changed_cb,
+		cal_shell_view);
+	priv->notifications = g_list_prepend (
+		priv->notifications, GUINT_TO_POINTER (id));
+	id = calendar_config_add_notification_hide_completed_tasks_value (
+		cal_shell_view_config_hide_completed_tasks_changed_cb,
+		cal_shell_view);
 
 	e_categories_register_change_listener (
 		G_CALLBACK (e_cal_shell_view_update_search_filter),
@@ -312,6 +356,7 @@
 e_cal_shell_view_private_dispose (ECalShellView *cal_shell_view)
 {
 	ECalShellViewPrivate *priv = cal_shell_view->priv;
+	GList *iter;
 
 	DISPOSE (priv->source_list);
 
@@ -321,26 +366,33 @@
 	DISPOSE (priv->cal_shell_content);
 	DISPOSE (priv->cal_shell_sidebar);
 
-	if (cal_shell_view->priv->calendar_activity != NULL) {
+	if (priv->calendar_activity != NULL) {
 		/* XXX Activity is not cancellable. */
-		e_activity_complete (cal_shell_view->priv->calendar_activity);
-		g_object_unref (cal_shell_view->priv->calendar_activity);
-		cal_shell_view->priv->calendar_activity = NULL;
+		e_activity_complete (priv->calendar_activity);
+		g_object_unref (priv->calendar_activity);
+		priv->calendar_activity = NULL;
 	}
 
-	if (cal_shell_view->priv->memopad_activity != NULL) {
+	if (priv->memopad_activity != NULL) {
 		/* XXX Activity is not cancellable. */
-		e_activity_complete (cal_shell_view->priv->memopad_activity);
-		g_object_unref (cal_shell_view->priv->memopad_activity);
-		cal_shell_view->priv->memopad_activity = NULL;
+		e_activity_complete (priv->memopad_activity);
+		g_object_unref (priv->memopad_activity);
+		priv->memopad_activity = NULL;
 	}
 
-	if (cal_shell_view->priv->taskpad_activity != NULL) {
+	if (priv->taskpad_activity != NULL) {
 		/* XXX Activity is not cancellable. */
-		e_activity_complete (cal_shell_view->priv->taskpad_activity);
-		g_object_unref (cal_shell_view->priv->taskpad_activity);
-		cal_shell_view->priv->taskpad_activity = NULL;
+		e_activity_complete (priv->taskpad_activity);
+		g_object_unref (priv->taskpad_activity);
+		priv->taskpad_activity = NULL;
+	}
+
+	for (iter = priv->notifications; iter != NULL; iter = iter->next) {
+		guint notification_id = GPOINTER_TO_UINT (iter->data);
+		calendar_config_remove_notification (notification_id);
 	}
+	g_list_free (priv->notifications);
+	priv->notifications = NULL;
 }
 
 void

Modified: branches/kill-bonobo/calendar/modules/e-cal-shell-view-private.h
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-cal-shell-view-private.h	(original)
+++ branches/kill-bonobo/calendar/modules/e-cal-shell-view-private.h	Wed Oct 29 20:11:07 2008
@@ -33,6 +33,7 @@
 #include "e-util/e-dialog-utils.h"
 #include "e-util/e-util.h"
 
+#include "calendar/gui/calendar-config.h"
 #include "calendar/gui/comp-util.h"
 #include "calendar/gui/e-cal-list-view.h"
 #include "calendar/gui/e-cal-model-tasks.h"
@@ -107,6 +108,9 @@
 	EActivity *calendar_activity;
 	EActivity *memopad_activity;
 	EActivity *taskpad_activity;
+
+	/* GConf notification IDs */
+	GList *notifications;
 };
 
 void		e_cal_shell_view_private_init

Modified: branches/kill-bonobo/calendar/modules/e-cal-shell-view-taskpad.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-cal-shell-view-taskpad.c	(original)
+++ branches/kill-bonobo/calendar/modules/e-cal-shell-view-taskpad.c	Wed Oct 29 20:11:07 2008
@@ -439,7 +439,6 @@
 	gtk_action_group_add_actions (
 		action_group, calendar_taskpad_entries,
 		G_N_ELEMENTS (calendar_taskpad_entries), cal_shell_view);
-	gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
 }
 
 void

Modified: branches/kill-bonobo/calendar/modules/e-memo-shell-content.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-memo-shell-content.c	(original)
+++ branches/kill-bonobo/calendar/modules/e-memo-shell-content.c	Wed Oct 29 20:11:07 2008
@@ -26,6 +26,7 @@
 #include "e-util/gconf-bridge.h"
 
 #include "calendar/gui/calendar-config.h"
+#include "calendar/gui/e-cal-model-memos.h"
 #include "calendar/gui/e-memo-table.h"
 #include "calendar/gui/e-memo-table-config.h"
 
@@ -49,6 +50,7 @@
 	GtkWidget *memo_table;
 	GtkWidget *memo_preview;
 
+	ECalModel *memo_model;
 	EMemoTableConfig *table_config;
 	GalViewInstance *view_instance;
 
@@ -57,6 +59,7 @@
 
 enum {
 	PROP_0,
+	PROP_MODEL,
 	PROP_PREVIEW_VISIBLE
 };
 
@@ -96,7 +99,7 @@
 	if (!GAL_IS_VIEW_ETABLE (gal_view))
 		return;
 
-	memo_table = E_MEMO_TABLE (memo_shell_content->priv->memo_table);
+	memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
 	table = e_memo_table_get_table (memo_table);
 
 	gal_view_etable_attach_table (GAL_VIEW_ETABLE (gal_view), table);
@@ -133,23 +136,22 @@
 {
 	ECalComponentPreview *memo_preview;
 	EMemoTable *memo_table;
-	ECalModel *model;
+	ECalModel *memo_model;
 	ECalModelComponent *comp_data;
 	ECalComponent *comp;
 	const gchar *uid;
 
-	memo_preview = E_CAL_COMPONENT_PREVIEW (
-		memo_shell_content->priv->memo_preview);
-	memo_table = E_MEMO_TABLE (memo_shell_content->priv->memo_table);
+	memo_model = e_memo_shell_content_get_memo_model (memo_shell_content);
+	memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+	memo_preview = e_memo_shell_content_get_memo_preview (memo_shell_content);
 
 	if (e_table_selected_count (table) != 1) {
 		e_cal_component_preview_clear (memo_preview);
 		return;
 	}
 
-	model = e_memo_table_get_model (memo_table);
 	row = e_table_get_cursor_row (table);
-	comp_data = e_cal_model_get_component_at (model, row);
+	comp_data = e_cal_model_get_component_at (memo_model, row);
 
 	comp = e_cal_component_new ();
 	e_cal_component_set_icalcomponent (
@@ -170,8 +172,7 @@
 {
 	ECalComponentPreview *memo_preview;
 
-	memo_preview = E_CAL_COMPONENT_PREVIEW (
-		memo_shell_content->priv->memo_preview);
+	memo_preview = e_memo_shell_content_get_memo_preview (memo_shell_content);
 
 	/* XXX Old code emits a "selection-changed" signal here. */
 
@@ -202,7 +203,7 @@
 	if (g_strcmp0 (uid, current_uid) != 0)
 		return;
 
-	memo_table = E_MEMO_TABLE (memo_shell_content->priv->memo_table);
+	memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
 	table = e_memo_table_get_table (memo_table);
 
 	memo_shell_content_cursor_change_cb (memo_shell_content, 0, table);
@@ -232,6 +233,12 @@
                                  GParamSpec *pspec)
 {
 	switch (property_id) {
+		case PROP_MODEL:
+			g_value_set_object (
+				value, e_memo_shell_content_get_memo_model (
+				E_MEMO_SHELL_CONTENT (object)));
+			return;
+
 		case PROP_PREVIEW_VISIBLE:
 			g_value_set_boolean (
 				value, e_memo_shell_content_get_preview_visible (
@@ -264,6 +271,11 @@
 		priv->memo_preview = NULL;
 	}
 
+	if (priv->memo_model != NULL) {
+		g_object_unref (priv->memo_model);
+		priv->memo_model = NULL;
+	}
+
 	if (priv->table_config != NULL) {
 		g_object_unref (priv->table_config);
 		priv->table_config = NULL;
@@ -300,7 +312,6 @@
 	EShellViewClass *shell_view_class;
 	GalViewCollection *view_collection;
 	GalViewInstance *view_instance;
-	ECalModel *model;
 	ETable *table;
 	GConfBridge *bridge;
 	GtkWidget *container;
@@ -328,7 +339,7 @@
 
 	container = widget;
 
-	widget = e_memo_table_new (shell_view);
+	widget = e_memo_table_new (shell_view, priv->memo_model);
 	gtk_paned_add1 (GTK_PANED (container), widget);
 	priv->memo_table = g_object_ref (widget);
 	gtk_widget_show (widget);
@@ -356,7 +367,6 @@
 
 	widget = E_MEMO_TABLE (priv->memo_table)->etable;
 	table = e_table_scrolled_get_table (E_TABLE_SCROLLED (widget));
-	model = e_memo_table_get_model (E_MEMO_TABLE (priv->memo_table));
 
 	priv->table_config = e_memo_table_config_new (
 		E_MEMO_TABLE (priv->memo_table));
@@ -389,7 +399,7 @@
 		object);
 
 	g_signal_connect_swapped (
-		model, "model-row-changed",
+		priv->memo_model, "model-row-changed",
 		G_CALLBACK (memo_shell_content_model_row_changed_cb),
 		object);
 
@@ -482,6 +492,16 @@
 
 	g_object_class_install_property (
 		object_class,
+		PROP_MODEL,
+		g_param_spec_object (
+			"model",
+			_("Model"),
+			_("The memo table model"),
+			E_TYPE_CAL_MODEL,
+			G_PARAM_READABLE));
+
+	g_object_class_install_property (
+		object_class,
 		PROP_PREVIEW_VISIBLE,
 		g_param_spec_boolean (
 			"preview-visible",
@@ -497,6 +517,8 @@
 	memo_shell_content->priv =
 		E_MEMO_SHELL_CONTENT_GET_PRIVATE (memo_shell_content);
 
+	memo_shell_content->priv->memo_model = e_cal_model_memos_new ();
+
 	/* Postpone widget construction until we have a shell view. */
 }
 
@@ -537,6 +559,15 @@
 		"shell-view", shell_view, NULL);
 }
 
+ECalModel *
+e_memo_shell_content_get_memo_model (EMemoShellContent *memo_shell_content)
+{
+	g_return_val_if_fail (
+		E_IS_MEMO_SHELL_CONTENT (memo_shell_content), NULL);
+
+	return memo_shell_content->priv->memo_model;
+}
+
 ECalComponentPreview *
 e_memo_shell_content_get_memo_preview (EMemoShellContent *memo_shell_content)
 {

Modified: branches/kill-bonobo/calendar/modules/e-memo-shell-content.h
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-memo-shell-content.h	(original)
+++ branches/kill-bonobo/calendar/modules/e-memo-shell-content.h	Wed Oct 29 20:11:07 2008
@@ -73,6 +73,8 @@
 
 GType		e_memo_shell_content_get_type	(void);
 GtkWidget *	e_memo_shell_content_new	(EShellView *shell_view);
+ECalModel *	e_memo_shell_content_get_memo_model
+						(EMemoShellContent *memo_shell_conent);
 ECalComponentPreview *
 		e_memo_shell_content_get_memo_preview
 						(EMemoShellContent *memo_shell_content);

Modified: branches/kill-bonobo/calendar/modules/e-task-shell-content.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-task-shell-content.c	(original)
+++ branches/kill-bonobo/calendar/modules/e-task-shell-content.c	Wed Oct 29 20:11:07 2008
@@ -26,6 +26,7 @@
 #include "e-util/gconf-bridge.h"
 
 #include "calendar/gui/calendar-config.h"
+#include "calendar/gui/e-cal-model-tasks.h"
 #include "calendar/gui/e-calendar-table.h"
 #include "calendar/gui/e-calendar-table-config.h"
 
@@ -50,6 +51,7 @@
 	GtkWidget *task_table;
 	GtkWidget *task_preview;
 
+	ECalModel *task_model;
 	ECalendarTableConfig *table_config;
 	GalViewInstance *view_instance;
 
@@ -58,6 +60,7 @@
 
 enum {
 	PROP_0,
+	PROP_MODEL,
 	PROP_PREVIEW_VISIBLE
 };
 
@@ -97,7 +100,7 @@
 	if (!GAL_IS_VIEW_ETABLE (gal_view))
 		return;
 
-	task_table = E_CALENDAR_TABLE (task_shell_content->priv->task_table);
+	task_table = e_task_shell_content_get_task_table (task_shell_content);
 	table = e_calendar_table_get_table (task_table);
 
 	gal_view_etable_attach_table (GAL_VIEW_ETABLE (gal_view), table);
@@ -134,23 +137,22 @@
 {
 	ECalComponentPreview *task_preview;
 	ECalendarTable *task_table;
-	ECalModel *model;
+	ECalModel *task_model;
 	ECalModelComponent *comp_data;
 	ECalComponent *comp;
 	const gchar *uid;
 
-	task_preview = E_CAL_COMPONENT_PREVIEW (
-		task_shell_content->priv->task_preview);
-	task_table = E_CALENDAR_TABLE (task_shell_content->priv->task_table);
+	task_model = e_task_shell_content_get_task_model (task_shell_content);
+	task_table = e_task_shell_content_get_task_table (task_shell_content);
+	task_preview = e_task_shell_content_get_task_preview (task_shell_content);
 
 	if (e_table_selected_count (table) != 1) {
 		e_cal_component_preview_clear (task_preview);
 		return;
 	}
 
-	model = e_calendar_table_get_model (task_table);
 	row = e_table_get_cursor_row (table);
-	comp_data = e_cal_model_get_component_at (model, row);
+	comp_data = e_cal_model_get_component_at (task_model, row);
 
 	comp = e_cal_component_new ();
 	e_cal_component_set_icalcomponent (
@@ -171,8 +173,7 @@
 {
 	ECalComponentPreview *task_preview;
 
-	task_preview = E_CAL_COMPONENT_PREVIEW (
-		task_shell_content->priv->task_preview);
+	task_preview = e_task_shell_content_get_task_preview (task_shell_content);
 
 	/* XXX Old code emits a "selection-changed" signal here. */
 
@@ -203,7 +204,7 @@
 	if (g_strcmp0 (uid, current_uid) != 0)
 		return;
 
-	task_table = E_CALENDAR_TABLE (task_shell_content->priv->task_table);
+	task_table = e_task_shell_content_get_task_table (task_shell_content);
 	table = e_calendar_table_get_table (task_table);
 
 	task_shell_content_cursor_change_cb (task_shell_content, 0, table);
@@ -233,6 +234,12 @@
                                  GParamSpec *pspec)
 {
 	switch (property_id) {
+		case PROP_MODEL:
+			g_value_set_object (
+				value, e_task_shell_content_get_task_model (
+				E_TASK_SHELL_CONTENT (object)));
+			return;
+
 		case PROP_PREVIEW_VISIBLE:
 			g_value_set_boolean (
 				value, e_task_shell_content_get_preview_visible (
@@ -265,6 +272,11 @@
 		priv->task_preview = NULL;
 	}
 
+	if (priv->task_model != NULL) {
+		g_object_unref (priv->task_model);
+		priv->task_model = NULL;
+	}
+
 	if (priv->table_config != NULL) {
 		g_object_unref (priv->table_config);
 		priv->table_config = NULL;
@@ -301,7 +313,6 @@
 	EShellViewClass *shell_view_class;
 	GalViewCollection *view_collection;
 	GalViewInstance *view_instance;
-	ECalModel *model;
 	ETable *table;
 	GConfBridge *bridge;
 	GtkWidget *container;
@@ -329,7 +340,7 @@
 
 	container = widget;
 
-	widget = e_calendar_table_new (shell_view);
+	widget = e_calendar_table_new (shell_view, priv->task_model);
 	gtk_paned_add1 (GTK_PANED (container), widget);
 	priv->task_table = g_object_ref (widget);
 	gtk_widget_show (widget);
@@ -357,7 +368,6 @@
 
 	widget = E_CALENDAR_TABLE (priv->task_table)->etable;
 	table = e_table_scrolled_get_table (E_TABLE_SCROLLED (widget));
-	model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->task_table));
 
 	priv->table_config = e_calendar_table_config_new (
 		E_CALENDAR_TABLE (priv->task_table));
@@ -390,7 +400,7 @@
 		object);
 
 	g_signal_connect_swapped (
-		model, "model-row-changed",
+		priv->task_model, "model-row-changed",
 		G_CALLBACK (task_shell_content_model_row_changed_cb),
 		object);
 
@@ -508,6 +518,16 @@
 
 	g_object_class_install_property (
 		object_class,
+		PROP_MODEL,
+		g_param_spec_object (
+			"model",
+			_("Model"),
+			_("The task table model"),
+			E_TYPE_CAL_MODEL,
+			G_PARAM_READABLE));
+
+	g_object_class_install_property (
+		object_class,
 		PROP_PREVIEW_VISIBLE,
 		g_param_spec_boolean (
 			"preview-visible",
@@ -523,6 +543,8 @@
 	task_shell_content->priv =
 		E_TASK_SHELL_CONTENT_GET_PRIVATE (task_shell_content);
 
+	task_shell_content->priv->task_model = e_cal_model_tasks_new ();
+
 	/* Postpone widget construction until we have a shell view. */
 }
 
@@ -563,6 +585,15 @@
 		"shell-view", shell_view, NULL);
 }
 
+ECalModel *
+e_task_shell_content_get_task_model (ETaskShellContent *task_shell_content)
+{
+	g_return_val_if_fail (
+		E_IS_TASK_SHELL_CONTENT (task_shell_content), NULL);
+
+	return task_shell_content->priv->task_model;
+}
+
 ECalComponentPreview *
 e_task_shell_content_get_task_preview (ETaskShellContent *task_shell_content)
 {

Modified: branches/kill-bonobo/calendar/modules/e-task-shell-content.h
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-task-shell-content.h	(original)
+++ branches/kill-bonobo/calendar/modules/e-task-shell-content.h	Wed Oct 29 20:11:07 2008
@@ -25,6 +25,7 @@
 #include <shell/e-shell-content.h>
 #include <shell/e-shell-view.h>
 
+#include <calendar/gui/e-cal-model.h>
 #include <calendar/gui/e-calendar-table.h>
 #include <calendar/gui/e-cal-component-preview.h>
 
@@ -76,6 +77,8 @@
 
 GType		e_task_shell_content_get_type	(void);
 GtkWidget *	e_task_shell_content_new	(EShellView *shell_view);
+ECalModel *	e_task_shell_content_get_task_model
+						(ETaskShellContent *task_shell_content);
 ECalComponentPreview *
 		e_task_shell_content_get_task_preview
 						(ETaskShellContent *task_shell_content);

Modified: branches/kill-bonobo/shell/e-shell-view.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-view.c	(original)
+++ branches/kill-bonobo/shell/e-shell-view.c	Wed Oct 29 20:11:07 2008
@@ -136,13 +136,6 @@
 }
 
 static void
-shell_view_set_page_num (EShellView *shell_view,
-                         gint page_num)
-{
-	shell_view->priv->page_num = page_num;
-}
-
-static void
 shell_view_set_shell_window (EShellView *shell_view,
                              GtkWidget *shell_window)
 {
@@ -169,7 +162,7 @@
 			return;
 
 		case PROP_PAGE_NUM:
-			shell_view_set_page_num (
+			e_shell_view_set_page_num (
 				E_SHELL_VIEW (object),
 				g_value_get_int (value));
 			return;
@@ -406,8 +399,7 @@
 			-1,
 			G_MAXINT,
 			-1,
-			G_PARAM_READWRITE |
-			G_PARAM_CONSTRUCT_ONLY));
+			G_PARAM_READWRITE));
 
 	/**
 	 * EShellView:title
@@ -814,6 +806,26 @@
 }
 
 /**
+ * e_shell_view_set_page_num:
+ * @shell_view: an #EShellView
+ * @page_num: a notebook page number
+ *
+ * This function is only interesting to #EShellWindow.  It sets the
+ * #GtkNotebook page number for @shell_view.  The rest of the application
+ * must never call this because it could mess up shell view switching.
+ **/
+void
+e_shell_view_set_page_num (EShellView *shell_view,
+                           gint page_num)
+{
+	g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
+
+	shell_view->priv->page_num = page_num;
+
+	g_object_notify (G_OBJECT (shell_view), "page-num");
+}
+
+/**
  * e_shell_view_get_size_group:
  * @shell_view: an #EShellView
  *

Modified: branches/kill-bonobo/shell/e-shell-view.h
==============================================================================
--- branches/kill-bonobo/shell/e-shell-view.h	(original)
+++ branches/kill-bonobo/shell/e-shell-view.h	Wed Oct 29 20:11:07 2008
@@ -162,6 +162,8 @@
 						 const gchar *view_id);
 gboolean	e_shell_view_is_active		(EShellView *shell_view);
 gint		e_shell_view_get_page_num	(EShellView *shell_view);
+void		e_shell_view_set_page_num	(EShellView *shell_view,
+						 gint page_num);
 GtkSizeGroup *	e_shell_view_get_size_group	(EShellView *shell_view);
 EShellContent *	e_shell_view_get_shell_content	(EShellView *shell_view);
 EShellSidebar *	e_shell_view_get_shell_sidebar	(EShellView *shell_view);

Modified: branches/kill-bonobo/shell/e-shell-window.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window.c	(original)
+++ branches/kill-bonobo/shell/e-shell-window.c	Wed Oct 29 20:11:07 2008
@@ -52,7 +52,6 @@
 
 	/* Determine the page number for the new shell view. */
 	notebook = GTK_NOTEBOOK (shell_window->priv->content_notebook);
-	page_num = gtk_notebook_get_n_pages (notebook);
 
 	/* Get the switcher action for this view. */
 	action = e_shell_window_get_shell_view_action (
@@ -64,11 +63,19 @@
 		page_num, "shell-window", shell_window, NULL);
 
 	/* Register the shell view. */
+	g_debug ("Loaded view '%s' (page %d)", view_name, page_num);
 	loaded_views = shell_window->priv->loaded_views;
 	g_hash_table_insert (loaded_views, g_strdup (view_name), shell_view);
 
 	/* Add pages to the various shell window notebooks. */
 
+	/* We can't determine the shell view's page number until after the
+	 * shell view is fully initialized because the shell view may load
+	 * other shell views during initialization, and those other shell
+	 * views will append their widgets to the notebooks before us. */
+	page_num = gtk_notebook_get_n_pages (notebook);
+	e_shell_view_set_page_num (shell_view, page_num);
+
 	notebook = GTK_NOTEBOOK (shell_window->priv->content_notebook);
 	widget = GTK_WIDGET (e_shell_view_get_shell_content (shell_view));
 	gtk_notebook_append_page (notebook, widget, NULL);



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