aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/modules
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-10-30 04:11:07 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-10-30 04:11:07 +0800
commitd6b8b58bb45b16c1cb3a575c277ffdc77441e2df (patch)
treec80db345f4d3e05a1ee165b40c561f2649e574cb /calendar/modules
parent5e82bdba14fba81603f3879a46b46a011db7d2e4 (diff)
downloadgsoc2013-evolution-d6b8b58bb45b16c1cb3a575c277ffdc77441e2df.tar
gsoc2013-evolution-d6b8b58bb45b16c1cb3a575c277ffdc77441e2df.tar.gz
gsoc2013-evolution-d6b8b58bb45b16c1cb3a575c277ffdc77441e2df.tar.bz2
gsoc2013-evolution-d6b8b58bb45b16c1cb3a575c277ffdc77441e2df.tar.lz
gsoc2013-evolution-d6b8b58bb45b16c1cb3a575c277ffdc77441e2df.tar.xz
gsoc2013-evolution-d6b8b58bb45b16c1cb3a575c277ffdc77441e2df.tar.zst
gsoc2013-evolution-d6b8b58bb45b16c1cb3a575c277ffdc77441e2df.zip
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. svn path=/branches/kill-bonobo/; revision=36696
Diffstat (limited to 'calendar/modules')
-rw-r--r--calendar/modules/e-cal-shell-content.c24
-rw-r--r--calendar/modules/e-cal-shell-view-memopad.c1
-rw-r--r--calendar/modules/e-cal-shell-view-private.c96
-rw-r--r--calendar/modules/e-cal-shell-view-private.h4
-rw-r--r--calendar/modules/e-cal-shell-view-taskpad.c1
-rw-r--r--calendar/modules/e-memo-shell-content.c59
-rw-r--r--calendar/modules/e-memo-shell-content.h2
-rw-r--r--calendar/modules/e-task-shell-content.c59
-rw-r--r--calendar/modules/e-task-shell-content.h3
9 files changed, 195 insertions, 54 deletions
diff --git a/calendar/modules/e-cal-shell-content.c b/calendar/modules/e-cal-shell-content.c
index f8bd9f6ddd..865ae7de5a 100644
--- a/calendar/modules/e-cal-shell-content.c
+++ b/calendar/modules/e-cal-shell-content.c
@@ -304,10 +304,15 @@ cal_shell_content_constructed (GObject *object)
{
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 @@ cal_shell_content_constructed (GObject *object)
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 @@ cal_shell_content_constructed (GObject *object)
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 @@ cal_shell_content_constructed (GObject *object)
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 @@ cal_shell_content_constructed (GObject *object)
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 @@ cal_shell_content_constructed (GObject *object)
object);
gal_view_instance_load (view_instance);
priv->view_instance = view_instance;
+
+ g_object_unref (memo_model);
+ g_object_unref (task_model);
}
static void
diff --git a/calendar/modules/e-cal-shell-view-memopad.c b/calendar/modules/e-cal-shell-view-memopad.c
index 5c2bf19052..7c306fd8eb 100644
--- a/calendar/modules/e-cal-shell-view-memopad.c
+++ b/calendar/modules/e-cal-shell-view-memopad.c
@@ -351,7 +351,6 @@ e_cal_shell_view_memopad_actions_init (ECalShellView *cal_shell_view)
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
diff --git a/calendar/modules/e-cal-shell-view-private.c b/calendar/modules/e-cal-shell-view-private.c
index 3b7bea2449..7f24eddd2e 100644
--- a/calendar/modules/e-cal-shell-view-private.c
+++ b/calendar/modules/e-cal-shell-view-private.c
@@ -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 @@ cal_shell_view_update_timezone (ECalShellView *cal_shell_view)
}
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 @@ e_cal_shell_view_private_init (ECalShellView *cal_shell_view,
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 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
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 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
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 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
/* 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 @@ void
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 @@ e_cal_shell_view_private_dispose (ECalShellView *cal_shell_view)
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
diff --git a/calendar/modules/e-cal-shell-view-private.h b/calendar/modules/e-cal-shell-view-private.h
index f1116f9c35..66083a0903 100644
--- a/calendar/modules/e-cal-shell-view-private.h
+++ b/calendar/modules/e-cal-shell-view-private.h
@@ -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 @@ struct _ECalShellViewPrivate {
EActivity *calendar_activity;
EActivity *memopad_activity;
EActivity *taskpad_activity;
+
+ /* GConf notification IDs */
+ GList *notifications;
};
void e_cal_shell_view_private_init
diff --git a/calendar/modules/e-cal-shell-view-taskpad.c b/calendar/modules/e-cal-shell-view-taskpad.c
index aa3a73cbab..082572b4c8 100644
--- a/calendar/modules/e-cal-shell-view-taskpad.c
+++ b/calendar/modules/e-cal-shell-view-taskpad.c
@@ -439,7 +439,6 @@ e_cal_shell_view_taskpad_actions_init (ECalShellView *cal_shell_view)
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
diff --git a/calendar/modules/e-memo-shell-content.c b/calendar/modules/e-memo-shell-content.c
index fc245b8f44..f3d0d5bcbd 100644
--- a/calendar/modules/e-memo-shell-content.c
+++ b/calendar/modules/e-memo-shell-content.c
@@ -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 @@ struct _EMemoShellContentPrivate {
GtkWidget *memo_table;
GtkWidget *memo_preview;
+ ECalModel *memo_model;
EMemoTableConfig *table_config;
GalViewInstance *view_instance;
@@ -57,6 +59,7 @@ struct _EMemoShellContentPrivate {
enum {
PROP_0,
+ PROP_MODEL,
PROP_PREVIEW_VISIBLE
};
@@ -96,7 +99,7 @@ memo_shell_content_display_view_cb (EMemoShellContent *memo_shell_content,
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 @@ memo_shell_content_cursor_change_cb (EMemoShellContent *memo_shell_content,
{
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 @@ memo_shell_content_selection_change_cb (EMemoShellContent *memo_shell_content,
{
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 @@ memo_shell_content_model_row_changed_cb (EMemoShellContent *memo_shell_content,
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 @@ memo_shell_content_get_property (GObject *object,
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 @@ memo_shell_content_dispose (GObject *object)
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 @@ memo_shell_content_constructed (GObject *object)
EShellViewClass *shell_view_class;
GalViewCollection *view_collection;
GalViewInstance *view_instance;
- ECalModel *model;
ETable *table;
GConfBridge *bridge;
GtkWidget *container;
@@ -328,7 +339,7 @@ memo_shell_content_constructed (GObject *object)
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 @@ memo_shell_content_constructed (GObject *object)
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 @@ memo_shell_content_constructed (GObject *object)
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 @@ memo_shell_content_class_init (EMemoShellContentClass *class)
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_init (EMemoShellContent *memo_shell_content)
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 @@ e_memo_shell_content_new (EShellView *shell_view)
"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)
{
diff --git a/calendar/modules/e-memo-shell-content.h b/calendar/modules/e-memo-shell-content.h
index 036a04be56..9edb986cc1 100644
--- a/calendar/modules/e-memo-shell-content.h
+++ b/calendar/modules/e-memo-shell-content.h
@@ -73,6 +73,8 @@ struct _EMemoShellContentClass {
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);
diff --git a/calendar/modules/e-task-shell-content.c b/calendar/modules/e-task-shell-content.c
index 40b8372c46..b45daedd21 100644
--- a/calendar/modules/e-task-shell-content.c
+++ b/calendar/modules/e-task-shell-content.c
@@ -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 @@ struct _ETaskShellContentPrivate {
GtkWidget *task_table;
GtkWidget *task_preview;
+ ECalModel *task_model;
ECalendarTableConfig *table_config;
GalViewInstance *view_instance;
@@ -58,6 +60,7 @@ struct _ETaskShellContentPrivate {
enum {
PROP_0,
+ PROP_MODEL,
PROP_PREVIEW_VISIBLE
};
@@ -97,7 +100,7 @@ task_shell_content_display_view_cb (ETaskShellContent *task_shell_content,
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 @@ task_shell_content_cursor_change_cb (ETaskShellContent *task_shell_content,
{
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 @@ task_shell_content_selection_change_cb (ETaskShellContent *task_shell_content,
{
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 @@ task_shell_content_model_row_changed_cb (ETaskShellContent *task_shell_content,
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 @@ task_shell_content_get_property (GObject *object,
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 @@ task_shell_content_dispose (GObject *object)
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 @@ task_shell_content_constructed (GObject *object)
EShellViewClass *shell_view_class;
GalViewCollection *view_collection;
GalViewInstance *view_instance;
- ECalModel *model;
ETable *table;
GConfBridge *bridge;
GtkWidget *container;
@@ -329,7 +340,7 @@ task_shell_content_constructed (GObject *object)
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 @@ task_shell_content_constructed (GObject *object)
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 @@ task_shell_content_constructed (GObject *object)
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 @@ task_shell_content_class_init (ETaskShellContentClass *class)
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_init (ETaskShellContent *task_shell_content)
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 @@ e_task_shell_content_new (EShellView *shell_view)
"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)
{
diff --git a/calendar/modules/e-task-shell-content.h b/calendar/modules/e-task-shell-content.h
index 361b289f77..e6f64f7406 100644
--- a/calendar/modules/e-task-shell-content.h
+++ b/calendar/modules/e-task-shell-content.h
@@ -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 @@ struct _ETaskShellContentClass {
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);