aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/modules
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-10-14 01:57:46 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-10-14 01:57:46 +0800
commit79aa45cfed7e87150de85869795ef0dd3be06db0 (patch)
tree422b9e6c3840747ffb243d596d4459514ec3a457 /calendar/modules
parent1bed00795bf092ad6e9e076eccf7cc2a8c20cb27 (diff)
downloadgsoc2013-evolution-79aa45cfed7e87150de85869795ef0dd3be06db0.tar
gsoc2013-evolution-79aa45cfed7e87150de85869795ef0dd3be06db0.tar.gz
gsoc2013-evolution-79aa45cfed7e87150de85869795ef0dd3be06db0.tar.bz2
gsoc2013-evolution-79aa45cfed7e87150de85869795ef0dd3be06db0.tar.lz
gsoc2013-evolution-79aa45cfed7e87150de85869795ef0dd3be06db0.tar.xz
gsoc2013-evolution-79aa45cfed7e87150de85869795ef0dd3be06db0.tar.zst
gsoc2013-evolution-79aa45cfed7e87150de85869795ef0dd3be06db0.zip
Progress update:
- Calendar is kind of a mess at the moment. Doesn't compile. - Roughed in the Mail module, including all the actions. That _does_ compile. Runs, even. svn path=/branches/kill-bonobo/; revision=36611
Diffstat (limited to 'calendar/modules')
-rw-r--r--calendar/modules/e-cal-shell-content.c601
-rw-r--r--calendar/modules/e-cal-shell-content.h18
-rw-r--r--calendar/modules/e-cal-shell-module.c17
-rw-r--r--calendar/modules/e-cal-shell-sidebar.c131
-rw-r--r--calendar/modules/e-cal-shell-sidebar.h5
-rw-r--r--calendar/modules/e-cal-shell-view-actions.c604
-rw-r--r--calendar/modules/e-cal-shell-view-actions.h66
-rw-r--r--calendar/modules/e-cal-shell-view-memopad.c472
-rw-r--r--calendar/modules/e-cal-shell-view-private.c186
-rw-r--r--calendar/modules/e-cal-shell-view-private.h59
-rw-r--r--calendar/modules/e-cal-shell-view-taskpad.c600
-rw-r--r--calendar/modules/e-cal-shell-view.c86
-rw-r--r--calendar/modules/e-memo-shell-module.c7
-rw-r--r--calendar/modules/e-memo-shell-sidebar.c3
-rw-r--r--calendar/modules/e-memo-shell-view-actions.c19
-rw-r--r--calendar/modules/e-memo-shell-view-private.c2
-rw-r--r--calendar/modules/e-memo-shell-view.c4
-rw-r--r--calendar/modules/e-task-shell-module.c7
-rw-r--r--calendar/modules/e-task-shell-sidebar.c3
-rw-r--r--calendar/modules/e-task-shell-view-actions.c59
-rw-r--r--calendar/modules/e-task-shell-view-private.c2
-rw-r--r--calendar/modules/e-task-shell-view.c3
22 files changed, 2873 insertions, 81 deletions
diff --git a/calendar/modules/e-cal-shell-content.c b/calendar/modules/e-cal-shell-content.c
index 7529893026..8300c657ca 100644
--- a/calendar/modules/e-cal-shell-content.c
+++ b/calendar/modules/e-cal-shell-content.c
@@ -34,20 +34,128 @@
((obj), E_TYPE_CAL_SHELL_CONTENT, ECalShellContentPrivate))
struct _ECalShellContentPrivate {
- gint dummy;
+ GtkWidget *hpaned;
+ GtkWidget *notebook;
+ GtkWidget *vpaned;
+
+ GtkWidget *day_view;
+ GtkWidget *work_week_view;
+ GtkWidget *week_view;
+ GtkWidget *month_view;
+ GtkWidget *list_view;
+ GtkWidget *task_table;
+ GtkWidget *memo_table;
+
+ EDayViewConfig *day_view_config;
+ EDayViewConfig *work_week_view_config;
+ EWeekViewConfig *week_view_config;
+ EWeekViewConfig *month_view_config;
+ ECalListViewConfig *list_view_config;
+ ECalendarTableConfig *task_table_config;
+ EMemoTableConfig *memo_table_config;
+
+ GalViewInstance *view_instance;
};
enum {
PROP_0
};
+/* Used to indicate who has the focus within the calendar view. */
+typedef enum {
+ FOCUS_CALENDAR,
+ FOCUS_MEMO_TABLE,
+ FOCUS_TASK_TABLE,
+ FOCUS_OTHER
+} FocusLocation;
+
static gpointer parent_class;
static void
+cal_shell_content_changed_cb (ECalShellContent *cal_shell_content,
+ GalViewInstance *view_instance)
+{
+ EShellView *shell_view;
+ EShellContent *shell_content;
+ gchar *view_id;
+
+ shell_content = E_SHELL_CONTENT (cal_shell_content);
+ shell_view = e_shell_content_get_shell_view (shell_content);
+ view_id = gal_view_instance_get_current_view_id (view_instance);
+ e_shell_view_set_view_id (shell_view, view_id);
+ g_free (view_id);
+}
+
+static void
+cal_shell_content_display_view_cb (ECalShellContent *cal_shell_content,
+ GalView *gal_view)
+{
+}
+
+static FocusLocation
+cal_shell_content_get_focus_location (ECalShellContent *cal_shell_content)
+{
+ GtkWidget *widget;
+ GnomeCalendar *calendar;
+ ECalendarTable *task_table;
+ EMemoTable *memo_table;
+ ETable *table;
+ ECalendarView *calendar_view;
+
+ calendar = GNOME_CALENDAR (cal_shell_content->priv->calendar);
+ widget = gnome_calendar_get_current_view_widget (calendar);
+
+ memo_table = E_MEMO_TABLE (cal_shell_content->priv->memo_table);
+ task_table = E_CALENDAR_TABLE (cal_shell_content->priv->task_table);
+
+ table = e_memo_table_get_table (memo_table);
+ if (GTK_WIDGET_HAS_FOCUS (table->table_canvas))
+ return FOCUS_MEMO_TABLE;
+
+ table = e_calendar_table_get_table (task_table);
+ if (GTK_WIDGET_HAS_FOCUS (table->table_canvas))
+ return FOCUS_TASK_TABLE;
+
+ if (E_IS_DAY_VIEW (widget)) {
+ EDayView *view = E_DAY_VIEW (widget);
+
+ if (GTK_WIDGET_HAS_FOCUS (view->top_canvas))
+ return FOCUS_CALENDAR;
+
+ if (GNOME_CANVAS (view->top_canvas)->focused_item != NULL)
+ return FOCUS_CALENDAR;
+
+ if (GTK_WIDGET_HAS_FOCUS (view->main_canvas))
+ return FOCUS_CALENDAR;
+
+ if (GNOME_CANVAS (view->main_canvas)->focused_item != NULL)
+ return FOCUS_CALENDAR;
+
+ } else if (E_IS_WEEK_VIEW (widget)) {
+ EWeekView *view = E_WEEK_VIEW (widget);
+
+ if (GTK_WIDGET_HAS_FOCUS (view->main_canvas))
+ return FOCUS_CALENDAR;
+
+ if (GNOME_CANVAS (view->main_canvas)->focused_item != NULL)
+ return FOCUS_CALENDAR;
+
+ } else if (E_IS_CAL_LIST_VIEW (widget)) {
+ ECalListView *view = E_CAL_LIST_VIEW (widget);
+
+ table = e_table_scrolled_get_table (view->table_scrolled);
+ if (GTK_WIDGET_HAS_FOCUS (table))
+ return FOCUS_CALENDAR;
+ }
+
+ return FOCUS_OTHER;
+}
+
+static void
cal_shell_content_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
switch (property_id) {
}
@@ -57,9 +165,9 @@ cal_shell_content_set_property (GObject *object,
static void
cal_shell_content_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
switch (property_id) {
}
@@ -74,6 +182,96 @@ cal_shell_content_dispose (GObject *object)
priv = E_CAL_SHELL_CONTENT_GET_PRIVATE (object);
+ if (priv->hpaned != NULL) {
+ g_object_unref (priv->hpaned);
+ priv->hpaned = NULL;
+ }
+
+ if (priv->notebook != NULL) {
+ g_object_unref (priv->notebook);
+ priv->notebook = NULL;
+ }
+
+ if (priv->vpaned != NULL) {
+ g_object_unref (priv->vpaned);
+ priv->vpaned = NULL;
+ }
+
+ if (priv->day_view != NULL) {
+ g_object_unref (priv->day_view);
+ priv->day_view = NULL;
+ }
+
+ if (priv->work_week_view != NULL) {
+ g_object_unref (priv->work_week_view);
+ priv->work_week_view = NULL;
+ }
+
+ if (priv->week_view != NULL) {
+ g_object_unref (priv->week_view);
+ priv->week_view = NULL;
+ }
+
+ if (priv->month_view != NULL) {
+ g_object_unref (priv->month_view);
+ priv->month_view = NULL;
+ }
+
+ if (priv->list_view != NULL) {
+ g_object_unref (priv->list_view);
+ priv->list_view = NULL;
+ }
+
+ if (priv->task_table != NULL) {
+ g_object_unref (priv->task_table);
+ priv->task_table = NULL;
+ }
+
+ if (priv->memo_table != NULL) {
+ g_object_unref (priv->memo_table);
+ priv->memo_table = NULL;
+ }
+
+ if (priv->day_view_config != NULL) {
+ g_object_unref (priv->day_view_config);
+ priv->day_view_config = NULL;
+ }
+
+ if (priv->work_week_view_config != NULL) {
+ g_object_unref (priv->work_week_view_config);
+ priv->work_week_view_config = NULL;
+ }
+
+ if (priv->week_view_config != NULL) {
+ g_object_unref (priv->week_view_config);
+ priv->week_view_config = NULL;
+ }
+
+ if (priv->month_view_config != NULL) {
+ g_object_unref (priv->month_view_config);
+ priv->month_view_config = NULL;
+ }
+
+ if (priv->list_view_config != NULL) {
+ g_object_unref (priv->list_view_config);
+ priv->list_view_config = NULL;
+ }
+
+ if (priv->task_table_config != NULL) {
+ g_object_unref (priv->task_table_config);
+ priv->task_table_config = NULL;
+ }
+
+ if (priv->memo_table_config != NULL) {
+ g_object_unref (priv->memo_table_config);
+ priv->memo_table_config = NULL;
+ }
+
+ if (priv->view_instance != NULL) {
+ g_object_unref (priv->view_instance);
+ priv->view_instance = NULL;
+ }
+
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -93,12 +291,217 @@ static void
cal_shell_content_constructed (GObject *object)
{
ECalShellContentPrivate *priv;
+ ECalModelCalendar *cal_model;
+ EShellContent *shell-content;
+ EShellModule *shell_module;
+ EShellView *shell_view;
+ EShellViewClass *shell_view_class;
+ GalViewCollection *view_collection;
+ GalViewInstnace *view_instance;
+ GtkWidget *container;
+ GtkWidget *widget;
+ const gchar *config_dir;
+ gchar *filename;
+ gchar *markup;
+ gint page_num;
priv = E_CAL_SHELL_CONTENT_GET_PRIVATE (object);
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (parent_class)->constructed (object);
+ shell_content = E_SHELL_CONTENT (object);
+ shell_view = e_shell_content_get_shell_view (shell_content);
+ shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
+ view_collection = shell_view_class->view_collection;
+
+ shell_module = e_shell_view_get_shell_module (shell_view);
+ config_dir = e_shell_module_get_config_dir (shell_module);
+
+ /* Calendar model for the views. */
+ cal_model = e_cal_model_calendar_new ();
+ e_cal_model_set_flags (
+ E_CAL_MODEL (cal_model),
+ E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES);
+
+ /* Build content widgets. */
+
+ container = GTK_WIDGET (object);
+
+ /* FIXME Need to deal with saving and restoring the position.
+ * Month view has its own position. */
+ widget = gtk_hpaned_new ();
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->hpaned = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ container = priv->hpaned;
+
+ widget = gtk_notebook_new ();
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE);
+ gtk_paned_pack1 (GTK_PANED (container), widget, FALSE, TRUE);
+ priv->notebook = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* FIXME Need to deal with saving and restoring the position.
+ * Month view has its own position. */
+ widget = gtk_vpaned_new ();
+ gtk_paned_pack2 (GTK_PANED (container), widget, TRUE, TRUE);
+ priv->vpaned = g_object_ref ();
+ gtk_widget_show (widget);
+
+ container = priv->notebook;
+
+ /* Add views in the order defined by GnomeCalendarViewType, such
+ * that the notebook page number corresponds to the view type.
+ * The assertions below ensure that stays true. */
+
+ /* FIXME Need to establish a calendar and timezone first. */
+ widget = e_day_view_new (E_CAL_MODEL (cal_model));
+ e_calendar_view_set_calendar (
+ E_CALENDAR_VIEW (widget), GNOME_CALENDAR (priv->calendar));
+ e_calendar_view_set_timezone (
+ E_CALENDAR_VIEW (widget), priv->timezone);
+ page_num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (widget));
+ gtk_notebook_append_page (GTK_NOTEBOOK (container), widget, NULL);
+ g_return_if_fail (page_num == GNOME_CAL_DAY_VIEW);
+ priv->day_view = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* FIXME Need to establish a calendar and timezone first. */
+ widget = e_day_view_new (E_CAL_MODEL (cal_model));
+ e_day_view_set_work_week_view (E_DAY_VIEW (widget), TRUE);
+ e_day_view_set_days_shown (E_DAY_VIEW (widget), 5);
+ e_calendar_view_set_calendar (
+ E_CALENDAR_VIEW (widget), GNOME_CALENDAR (priv->calendar));
+ e_calendar_view_set_timezone (
+ E_CALENDAR_VIEW (widget), priv->timezone);
+ page_num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (widget));
+ gtk_notebook_append_page (GTK_NOTEBOOK (container), widget, NULL);
+ g_return_if_fail (page_num == GNOME_CAL_WORK_WEEK_VIEW);
+ priv->work_week_view = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* FIXME Need to establish a calendar and timezone first. */
+ widget = e_week_view_new (E_CAL_MODEL (cal_model));
+ e_calendar_view_set_calendar (
+ E_CALENDAR_VIEW (widget), GNOME_CALENDAR (priv->calendar));
+ e_calendar_view_set_timezone (
+ E_CALENDAR_VIEW (widget), priv->timezone);
+ page_num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (widget));
+ gtk_notebook_append_page (GTK_NOTEBOOK (container), widget, NULL);
+ g_return_if_fail (page_num == GNOME_CAL_WEEK_VIEW);
+ priv->week_view = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* FIXME Need to establish a calendar and timezone first. */
+ widget = e_week_view_new (E_CAL_MODEL (cal_model));
+ e_week_view_set_multi_week_view (E_WEEK_VIEW (widget), TRUE);
+ e_week_view_set_weeks_shown (E_WEEK_VIEW (widget), 6);
+ e_calendar_view_set_calendar (
+ E_CALENDAR_VIEW (widget), GNOME_CALENDAR (priv->calendar));
+ e_calendar_view_set_timezone (
+ E_CALENDAR_VIEW (widget), priv->timezone);
+ page_num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (widget));
+ gtk_notebook_append_page (GTK_NOTEBOOK (container), widget, NULL);
+ g_return_if_fail (page_num == GNOME_CAL_MONTH_VIEW);
+ priv->month_view = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* FIXME Need to establish a calendar and timezone first. */
+ widget = e_cal_list_view_new (E_CAL_MODEL (cal_model));
+ e_calendar_view_set_calendar (
+ E_CALENDAR_VIEW (widget), GNOME_CALENDAR (priv->calendar));
+ e_calendar_view_set_timezone (
+ E_CALENDAR_VIEW (widget), priv->timezone);
+ page_num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (widget));
+ gtk_notebook_append_page (GTK_NOTEBOOK (container), widget, NULL);
+ g_return_if_fail (page_num == GNOME_CAL_LIST_VIEW);
+ priv->list_view = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ container = priv->vpaned;
+
+ widget = gtk_vbox_new (FALSE, 0);
+ gtk_paned_pack1 (GTK_PANED (container), widget, TRUE, TRUE);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_hseparator_new ();
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, TRUE, 0);
+ gtk_widget_show (widget);
+
+ widget = gtk_label_new (NULL);
+ markup = g_strdup_printf ("<b>%s</b>", _("Tasks"));
+ gtk_label_set_markup (GTK_LABEL (widget), markup);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, TRUE, 0);
+ gtk_widget_show (widget);
+ g_free (markup);
+
+ widget = e_calendar_table_new ();
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ priv->task_table = g_object_ref ();
+ gtk_widget_show (widget);
+
+ filename = g_build_filename (config_dir, "TaskPad", NULL);
+ e_calendar_table_load_state (E_CALENDAR_TABLE (widget), filename);
+ g_free (filename);
+
+ container = priv->vpaned;
+
+ widget = gtk_vbox_new (FALSE, 0);
+ gtk_paned_pack2 (GTK_PANED (container), widget, TRUE, TRUE);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_label_new (NULL);
+ markup = g_strdup_printf ("<b>%s</b>", _("Memos"));
+ gtk_label_set_markup (GTK_LABEL (widget), markup);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, TRUE, 0);
+ gtk_widget_show (widget);
+ g_free (markup);
+
+ widget = e_memo_table_new ();
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ priv->memo_table = g_object_ref ();
+ gtk_widget_show (widget);
+
+ filename = g_build_filename (config_dir, "MemoPad", NULL);
+ e_memo_table_load_state (E_MEMO_TABLE (widget), filename);
+ g_free (filename);
+
+ /* Configuration managers for views and tables. */
+ priv->day_view_config = e_day_view_config_new (
+ E_DAY_VIEW (priv->day_view));
+ priv->work_week_view_config = e_day_view_config_new (
+ E_DAY_VIEW (priv->work_week_view));
+ priv->week_view_config = e_week_view_config_new (
+ E_WEEK_VIEW (priv->week_view));
+ priv->month_view_config = e_week_view_config_new (
+ E_WEEK_VIEW (priv->month_view));
+ priv->list_view_config = e_cal_list_view_config_new (
+ E_CAL_LIST_VIEW (priv->list_view));
+ priv->task_table_config = e_calendar_table_config_new (
+ E_CALENDAR_TABLE (priv->task_table));
+ priv->memo_table_config = e_memo_table_config_new (
+ E_MEMO_TABLE (priv->memo_table));
+
+ /* Load the view instance. */
+
+ view_instance = gal_view_instance_new (view_collection, NULL);
+ g_signal_connect_swapped (
+ view_instance, "changed",
+ G_CALLBACK (cal_shell_content_changed_cb),
+ object);
+ g_signal_connect_swapped (
+ view_instance, "display-view",
+ G_CALLBACK (cal_shell_content_display_view_cb),
+ object);
+ gal_view_instance_load (view_instance);
+ priv->view_instance = view_instance;
}
static void
@@ -162,3 +565,187 @@ e_cal_shell_content_new (EShellView *shell_view)
E_TYPE_CAL_SHELL_CONTENT,
"shell-view", shell_view, NULL);
}
+
+GnomeCalendar *
+e_cal_shell_content_get_calendar (ECalShellContent *cal_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_CAL_SHELL_CONTENT (cal_shell_content), NULL);
+
+ return GNOME_CALENDAR (cal_shell_content->priv->calendar);
+}
+
+EMemoTable *
+e_cal_shell_content_get_memo_table (ECalShellContent *cal_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_CAL_SHELL_CONTENT (cal_shell_content), NULL);
+
+ return E_MEMO_TABLE (cal_shell_content->priv->memo_table);
+}
+
+ECalendarTable *
+e_cal_shell_content_get_task_table (ECalShellContent *cal_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_CAL_SHELL_CONTENT (cal_shell_content), NULL);
+
+ return E_CALENDAR_TABLE (cal_shell_content->priv->task_table);
+}
+
+icaltimezone *
+e_cal_shell_content_get_timezone (ECalShellContent *cal_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_CAL_SHELL_CONTENT (cal_shell_content), NULL);
+
+ return cal_shell_content->priv->timezone;
+}
+
+GalViewInstance *
+e_cal_shell_content_get_view_instance (ECalShellContent *cal_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_CAL_SHELL_CONTENT (cal_shell_content), NULL);
+
+ return cal_shell_content->priv->view_instance;
+}
+
+void
+e_cal_shell_content_copy_clipboard (ECalShellContent *cal_shell_content)
+{
+ GnomeCalendar *calendar;
+ EMemoTable *memo_table;
+ ECalendarTable *task_table;
+
+ g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
+
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ switch (cal_shell_content_get_focus_location (cal_shell_content)) {
+ case FOCUS_CALENDAR:
+ gnome_calendar_copy_clipboard (calendar);
+ break;
+
+ case FOCUS_MEMO_TABLE:
+ e_memo_table_copy_clipboard (memo_table);
+ break;
+
+ case FOCUS_TASK_TABLE:
+ e_calendar_table_copy_clipboard (task_table);
+ break;
+
+ default:
+ g_return_if_reached ();
+ }
+}
+
+void
+e_cal_shell_content_cut_clipboard (ECalShellContent *cal_shell_content)
+{
+ GnomeCalendar *calendar;
+ EMemoTable *memo_table;
+ ECalendarTable *task_table;
+
+ g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
+
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ switch (cal_shell_content_get_focus_location (cal_shell_content)) {
+ case FOCUS_CALENDAR:
+ gnome_calendar_cut_clipboard (calendar);
+ break;
+
+ case FOCUS_MEMO_TABLE:
+ e_memo_table_copy_clipboard (memo_table);
+ break;
+
+ case FOCUS_TASK_TABLE:
+ e_calendar_table_copy_clipboard (task_table);
+ break;
+
+ default:
+ g_return_if_reached ();
+ }
+}
+
+void
+e_cal_shell_content_paste_clipboard (ECalShellContent *cal_shell_content)
+{
+ GnomeCalendar *calendar;
+ EMemoTable *memo_table;
+ ECalendarTable *task_table;
+
+ g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
+
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ switch (cal_shell_content_get_focus_location (cal_shell_content)) {
+ case FOCUS_CALENDAR:
+ gnome_calendar_paste_clipboard (calendar);
+ break;
+
+ case FOCUS_MEMO_TABLE:
+ e_memo_table_copy_clipboard (memo_table);
+ break;
+
+ case FOCUS_TASK_TABLE:
+ e_calendar_table_copy_clipboard (task_table);
+ break;
+
+ default:
+ g_return_if_reached ();
+ }
+}
+
+void
+e_cal_shell_content_delete_selection (ECalShellContent *cal_shell_content)
+{
+ GnomeCalendar *calendar;
+ EMemoTable *memo_table;
+ ECalendarTable *task_table;
+
+ g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
+
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ switch (cal_shell_content_get_focus_location (cal_shell_content)) {
+ case FOCUS_CALENDAR:
+ gnome_calendar_delete_selection (calendar);
+ break;
+
+ case FOCUS_MEMO_TABLE:
+ e_memo_table_delete_selected (memo_table);
+ break;
+
+ case FOCUS_TASK_TABLE:
+ e_calendar_table_delete_selected (task_table);
+ break;
+
+ default:
+ g_return_if_reached ();
+ }
+}
+
+void
+e_cal_shell_content_delete_selected_occurrence (ECalShellContent *cal_shell_content)
+{
+ GnomeCalendar *calendar;
+ FocusLocation focus;
+
+ g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
+
+ focus = cal_shell_content_get_focus_location (cal_shell_content);
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+
+ if (focus == FOCUS_CALENDAR)
+ gnome_calendar_delete_selected_occurrence (calendar);
+}
diff --git a/calendar/modules/e-cal-shell-content.h b/calendar/modules/e-cal-shell-content.h
index c7b78c52a4..5d8a56a185 100644
--- a/calendar/modules/e-cal-shell-content.h
+++ b/calendar/modules/e-cal-shell-content.h
@@ -25,6 +25,8 @@
#include <shell/e-shell-content.h>
#include <shell/e-shell-view.h>
+#include <calendar/gui/e-memo-table.h>
+#include <calendar/gui/gnome-cal.h>
#include <widgets/menus/gal-view-instance.h>
/* Standard GObject macros */
@@ -63,9 +65,25 @@ struct _ECalShellContentClass {
GType e_cal_shell_content_get_type (void);
GtkWidget * e_cal_shell_content_new (EShellView *shell_view);
+GnomeCalendar * e_cal_shell_content_get_calendar(ECalShellContent *cal_shell_content);
+EMemoTable * e_cal_shell_content_get_memo_table
+ (ECalShellContent *cal_shell_content);
+ECalendarTable *e_cal_shell_content_get_task_table
+ (ECalShellContent *cal_shell_content);
+icaltimezone * e_cal_shell_content_get_timezone(ECalShellContent *cal_shell_content);
GalViewInstance *
e_cal_shell_content_get_view_instance
(ECalShellContent *cal_shell_content);
+void e_cal_shell_content_copy_clipboard
+ (ECalShellContent *cal_shell_content);
+void e_cal_shell_content_cut_clipboard
+ (ECalShellContent *cal_shell_content);
+void e_cal_shell_content_paste_clipboard
+ (ECalShellContent *cal_shell_content);
+void e_cal_shell_content_delete_selection
+ (ECalShellContent *cal_shell_content);
+void e_cal_shell_content_delete_selected_occurrence
+ (ECalShellContent *cal_shell_content);
G_END_DECLS
diff --git a/calendar/modules/e-cal-shell-module.c b/calendar/modules/e-cal-shell-module.c
index 17c4b2152b..88f743f1ee 100644
--- a/calendar/modules/e-cal-shell-module.c
+++ b/calendar/modules/e-cal-shell-module.c
@@ -307,10 +307,10 @@ cal_module_cal_opened_cb (ECal *cal,
flags |= COMP_EDITOR_NEW_ITEM;
flags |= COMP_EDITOR_USER_ORG;
- if (strcmp (action_name, "meeting-new") == 0)
+ if (strcmp (action_name, "event-meeting-new") == 0)
flags |= COMP_EDITOR_MEETING;
- all_day = (strcmp (action_name, "appointment-all-day-new") == 0);
+ all_day = (strcmp (action_name, "event-all-day-new") == 0);
editor = event_editor_new (cal, flags);
comp = cal_comp_event_new_with_current_time (cal, all_day);
@@ -372,21 +372,21 @@ action_calendar_new_cb (GtkAction *action,
static GtkActionEntry item_entries[] = {
- { "appointment-new",
+ { "event-new",
"appointment-new",
N_("_Appointment"), /* XXX Need C_() here */
"<Control>a",
N_("Create a new appointment"),
G_CALLBACK (action_event_new_cb) },
- { "appointment-all-day-new",
+ { "event-all-day-new",
"stock_new-24h-appointment",
N_("All Day A_ppointment"),
NULL,
N_("Create a new all-day appointment"),
G_CALLBACK (action_event_new_cb) },
- { "meeting-new",
+ { "event-meeting-new",
"stock_new-meeting",
N_("M_eeting"),
"<Control>e",
@@ -450,10 +450,9 @@ e_shell_module_init (GTypeModule *type_module)
shell_module = E_SHELL_MODULE (type_module);
shell = e_shell_module_get_shell (shell_module);
- /* Register the GType for ECalShellView. */
- e_cal_shell_view_get_type (type_module);
-
- e_shell_module_set_info (shell_module, &module_info);
+ e_shell_module_set_info (
+ shell_module, &module_info,
+ e_cal_shell_view_get_type (type_module));
cal_module_ensure_sources (shell_module);
diff --git a/calendar/modules/e-cal-shell-sidebar.c b/calendar/modules/e-cal-shell-sidebar.c
index bbe0c15caf..707770df81 100644
--- a/calendar/modules/e-cal-shell-sidebar.c
+++ b/calendar/modules/e-cal-shell-sidebar.c
@@ -28,6 +28,7 @@
#include "calendar/common/authentication.h"
#include "calendar/gui/calendar-config.h"
#include "calendar/gui/e-calendar-selector.h"
+#include "calendar/gui/e-mini-calendar-config.h"
#include "calendar/gui/misc.h"
#include "e-cal-shell-view.h"
@@ -37,14 +38,19 @@
((obj), E_TYPE_CAL_SHELL_SIDEBAR, ECalShellSidebarPrivate))
struct _ECalShellSidebarPrivate {
+ GtkWidget *paned;
GtkWidget *selector;
+ GtkWidget *mini_calendar;
/* UID -> Client */
GHashTable *client_table;
+
+ EMiniCalendarConfig *mini_calendar_config;
};
enum {
PROP_0,
+ PROP_MINI_CALENDAR,
PROP_SELECTOR
};
@@ -86,33 +92,6 @@ cal_shell_sidebar_emit_status_message (ECalShellSidebar *cal_shell_sidebar,
}
static void
-cal_shell_sidebar_update_timezone (ECalShellSidebar *cal_shell_sidebar)
-{
- GHashTable *client_table;
- icaltimezone *zone;
- GList *values;
-
- zone = calendar_config_get_icaltimezone ();
- client_table = cal_shell_sidebar->priv->client_table;
- values = g_hash_table_get_values (client_table);
-
- while (values != NULL) {
- ECal *client = values->data;
-
- if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED)
- e_cal_set_default_timezone (client, zone, NULL);
-
- values = g_list_delete_link (values, values);
- }
-
- /* XXX Need to call e_calendar_view_set_timezone() here but the
- * sidebar is not really supposed to access content stuff.
- * I guess we could emit an "update-timezone" signal here,
- * but that feels wrong. Maybe this whole thing should be
- * in ECalShellView instead. */
-}
-
-static void
cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar,
ECal *client)
{
@@ -305,6 +284,12 @@ cal_shell_sidebar_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_MINI_CALENDAR:
+ g_value_set_object (
+ value, e_cal_shell_sidebar_get_mini_calendar (
+ E_CAL_SHELL_SIDEBAR (object)));
+ return;
+
case PROP_SELECTOR:
g_value_set_object (
value, e_cal_shell_sidebar_get_selector (
@@ -322,13 +307,28 @@ cal_shell_sidebar_dispose (GObject *object)
priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (object);
+ if (priv->paned != NULL) {
+ g_object_unref (priv->paned);
+ priv->paned = NULL;
+ }
+
if (priv->selector != NULL) {
g_object_unref (priv->selector);
priv->selector = NULL;
}
+ if (priv->mini_calendar != NULL) {
+ g_object_unref (priv->mini_calendar);
+ priv->mini_calendar = NULL;
+ }
+
g_hash_table_remove_all (priv->client_table);
+ if (priv->mini_calendar_config != NULL) {
+ g_object_unref (priv->mini_calendar_config);
+ priv->mini_calendar = NULL;
+ }
+
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -356,9 +356,11 @@ cal_shell_sidebar_constructed (GObject *object)
ESourceSelector *selector;
ESourceList *source_list;
ESource *source;
- GtkContainer *container;
+ ECalendarItem *calitem;
GtkTreeModel *model;
+ GtkWidget *container;
GtkWidget *widget;
+ AtkObject *a11y;
GSList *list, *iter;
gchar *uid;
@@ -372,7 +374,14 @@ cal_shell_sidebar_constructed (GObject *object)
cal_shell_view = E_CAL_SHELL_VIEW (shell_view);
source_list = e_cal_shell_view_get_source_list (cal_shell_view);
- container = GTK_CONTAINER (shell_sidebar);
+ container = GTK_WIDGET (shell_sidebar);
+
+ widget = gtk_vpaned_new ();
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->paned = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ container = widget;
widget = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (
@@ -380,17 +389,33 @@ cal_shell_sidebar_constructed (GObject *object)
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (
GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
- gtk_container_add (container, widget);
+ gtk_paned_add1 (GTK_PANED (container), widget);
gtk_widget_show (widget);
- container = GTK_CONTAINER (widget);
+ container = widget;
widget = e_calendar_selector_new (source_list);
e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE);
- gtk_container_add (container, widget);
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ a11y = gtk_widget_get_accessible (widget);
+ atk_object_set_name (a11y, _("Calendar Selector"));
priv->selector = g_object_ref (widget);
gtk_widget_show (widget);
+ container = priv->paned;
+
+ widget = e_calendar_new ();
+ calitem = E_CALENDAR (widget)->calitem;
+ e_calendar_item_set_days_start_week_sel (calitem, 9);
+ e_calendar_item_set_max_days_sel (calitem, 42);
+ widget = gnome_calendar_new (shell_view);
+ gtk_paned_add2 (GTK_PANED (container), widget);
+ priv->mini_calendar = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ priv->mini_calendar_config =
+ e_mini_calendar_config_new (E_CALENDAR (widget));
+
/* Restore the selector state from the last session. */
selector = E_SOURCE_SELECTOR (priv->selector);
@@ -488,6 +513,16 @@ cal_shell_sidebar_class_init (ECalShellSidebarClass *class)
g_object_class_install_property (
object_class,
+ PROP_MINI_CALENDAR,
+ g_param_spec_object (
+ "mini-calendar",
+ _("Mini-Calendar Widget"),
+ _("This widget displays a miniature calendar"),
+ E_TYPE_CALENDAR,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (
+ object_class,
PROP_SELECTOR,
g_param_spec_object (
"selector",
@@ -582,6 +617,15 @@ e_cal_shell_sidebar_new (EShellView *shell_view)
"shell-view", shell_view, NULL);
}
+ECalendar *
+e_cal_shell_sidebar_get_mini_calendar (ECalShellSidebar *cal_shell_sidebar)
+{
+ g_return_val_if_fail (
+ E_IS_CAL_SHELL_SIDEBAR (cal_shell_sidebar), NULL);
+
+ return E_CALENDAR (cal_shell_sidebar->priv->mini_calendar);
+}
+
ESourceSelector *
e_cal_shell_sidebar_get_selector (ECalShellSidebar *cal_shell_sidebar)
{
@@ -666,3 +710,26 @@ e_cal_shell_sidebar_remove_source (ECalShellSidebar *cal_shell_sidebar,
cal_shell_sidebar_emit_client_removed (cal_shell_sidebar, client);
}
+
+void
+e_cal_shell_sidebar_update_timezone (ECalShellSidebar *cal_shell_sidebar)
+{
+ GHashTable *client_table;
+ icaltimezone *timezone;
+ GList *values;
+
+ g_return_if_fail (E_CAL_SHELL_SIDEBAR (cal_shell_sidebar));
+
+ timezone = calendar_config_get_icaltimezone ();
+ client_table = cal_shell_sidebar->priv->client_table;
+ values = g_hash_table_get_values (client_table);
+
+ while (values != NULL) {
+ ECal *client = values->data;
+
+ if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED)
+ e_cal_set_default_timezone (client, timezone, NULL);
+
+ values = g_list_delete_link (values, values);
+ }
+}
diff --git a/calendar/modules/e-cal-shell-sidebar.h b/calendar/modules/e-cal-shell-sidebar.h
index 49b89c556e..eecb6a0365 100644
--- a/calendar/modules/e-cal-shell-sidebar.h
+++ b/calendar/modules/e-cal-shell-sidebar.h
@@ -27,6 +27,7 @@
#include <shell/e-shell-sidebar.h>
#include <shell/e-shell-view.h>
+#include <widgets/misc/e-calendar.h>
/* Standard GObject macros */
#define E_TYPE_CAL_SHELL_SIDEBAR \
@@ -72,6 +73,8 @@ struct _ECalShellSidebarClass {
GType e_cal_shell_sidebar_get_type (void);
GtkWidget * e_cal_shell_sidebar_new (EShellView *shell_view);
+ECalendar * e_cal_shell_sidebar_get_mini_calendar
+ (ECalShellSidebar *cal_shell_sidebar);
ESourceSelector *
e_cal_shell_sidebar_get_selector(ECalShellSidebar *cal_shell_sidebar);
void e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
@@ -79,6 +82,8 @@ void e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
void e_cal_shell_sidebar_remove_source
(ECalShellSidebar *cal_shell_sidebar,
ESource *source);
+void e_cal_shell_sidebar_update_timezone
+ (ECalShellSidebar *cal_shell_sidebar);
G_END_DECLS
diff --git a/calendar/modules/e-cal-shell-view-actions.c b/calendar/modules/e-cal-shell-view-actions.c
index 18c740d28b..4e077b273f 100644
--- a/calendar/modules/e-cal-shell-view-actions.c
+++ b/calendar/modules/e-cal-shell-view-actions.c
@@ -25,48 +25,187 @@ static void
action_calendar_copy_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+ ECalShellSidebar *cal_shell_sidebar;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ ESourceSelector *selector;
+ ESource *source;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
+ selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
+ source = e_source_selector_peek_primary_selection (selector);
+ g_return_if_fail (E_IS_SOURCE (source));
+
+ copy_source_dialog (
+ GTK_WINDOW (shell_window),
+ source, E_CAL_SOURCE_TYPE_EVENT);
}
static void
action_calendar_delete_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+ ECalShellContent *cal_shell_content;
+ ECalShellSidebar *cal_shell_sidebar;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ ECalendarView *calendar_view;
+ GnomeCalendarViewType view_type;
+ ECalModel *model;
+ ESourceSelector *selector;
+ ESourceGroup *source_group;
+ ESourceList *source_list;
+ ESource *source;
+ gint response;
+ gchar *uri;
+ GError *error = NULL;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ cal_shell_content = cal_shell_content->priv->cal_shell_content;
+ view_type = e_cal_shell_content_get_current_view (cal_shell_content);
+ calendar_view = e_cal_shell_content_get_calendar_view (
+ cal_shell_content, view_type);
+ model = e_calendar_view_get_model (calendar_view);
+
+ cal_shell_sidebar = cal_shell_sidebar->priv->cal_shell_sidebar;
+ selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
+ source = e_source_selector_peek_primary_selection (selector);
+ g_return_if_fail (E_IS_SOURCE (source));
+
+ /* Ask for confirmation. */
+ response = e_error_run (
+ GTK_WINDOW (shell_window),
+ "calendar:prompt-delete-calendar",
+ e_source_peek_name (source));
+ if (response != GTK_RESPONSE_YES)
+ return;
+
+ uri = e_source_get_uri (source);
+ client = e_cal_model_get_client_for_uri (model, uri);
+ if (client == NULL)
+ client = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_EVENT);
+ g_free (uri);
+
+ g_return_if_fail (client != NULL);
+
+ if (!e_cal_remove (client, &error)) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ if (e_source_selector_source_is_selected (selector, source)) {
+ e_cal_shell_sidebar_remove_source (
+ cal_shell_sidebar, source);
+ e_source_selector_unselect_source (selector, source);
+ }
+
+ source_group = e_source_peek_group (source);
+ e_source_group_remove_source (source_group, source);
+
+ source_list = cal_shell_view->priv->source_list;
+ if (!e_source_list_sync (source_list, &error)) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
}
static void
action_calendar_go_back_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+ ECalShellContent *cal_shell_content;
+ GnomeCalendar *calendar;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ calendar = e_shell_content_get_calendar (cal_shell_content);
+
+ gnome_claendar_previous (calendar);
}
static void
action_calendar_go_forward_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+ ECalShellContent *cal_shell_content;
+ GnomeCalendar *calendar;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ calendar = e_shell_content_get_calendar (cal_shell_content);
+
+ gnome_calendar_next (calendar);
}
static void
action_calendar_go_today_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+ ECalShellContent *cal_shell_content;
+ GnomeCalendar *calendar;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+
+ gnome_calendar_goto_today (calendar);
}
static void
action_calendar_jump_to_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+ ECalShellContent *cal_shell_content;
+ GnomeCalendar *calendar;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+
+ goto_dialog (calendar);
}
static void
action_calendar_new_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ calendar_setup_new_calendar (GTK_WINDOW (shell_window));
}
static void
action_calendar_print_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+ ECalShellContent *cal_shell_content;
+ GnomeCalendar *calendar;
+ GtkPrintOperationAction print_action;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
+
+ if (gnome_calendar_get_view (calendar) == GNOME_CAL_LIST_VIEW) {
+ ECalListView *list_view;
+ GtkWidget *widget;
+ ETable *table;
+
+ widget = gnome_calendar_get_current_view_widget (calendar);
+ list_view = E_CAL_LIST_VIEW (widget);
+ table = e_table_scrolled_get_table (list_view->table_scrolled);
+ print_table (table, _("Print"), _("Calendar"), action);
+ } else {
+ time_t start;
+
+ gnome_calendar_get_current_time_range (calendar, &start, NULL);
+ print_calendar (calendar, action, start);
+ }
}
static void
@@ -74,17 +213,56 @@ action_calendar_print_preview_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
}
+ ECalShellContent *cal_shell_content;
+ GnomeCalendar *calendar;
+ GtkPrintOperationAction print_action;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW;
+
+ if (gnome_calendar_get_view (calendar) == GNOME_CAL_LIST_VIEW) {
+ ECalListView *list_view;
+ GtkWidget *widget;
+ ETable *table;
+
+ widget = gnome_calendar_get_current_view_widget (calendar);
+ list_view = E_CAL_LIST_VIEW (widget);
+ table = e_table_scrolled_get_table (list_view->table_scrolled);
+ print_table (table, _("Print"), _("Calendar"), action);
+ } else {
+ time_t start;
+
+ gnome_calendar_get_current_time_range (calendar, &start, NULL);
+ print_calendar (calendar, action, start);
+ }
static void
action_calendar_properties_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+ ECalShellSidebar *cal_shell_sidebar;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ ESource *source;
+ ESourceSelector *selector;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
+ selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
+ source = e_source_selector_peek_primary_selection (selector);
+ g_return_if_fail (E_IS_SOURCE (source));
+
+ calendar_setup_edit_calendar (GTK_WINDOW (shell_window), source);
}
static void
action_calendar_purge_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+ /* FIXME */
}
static void
@@ -92,48 +270,230 @@ action_calendar_view_cb (GtkRadioAction *action,
GtkRadioAction *current,
ECalShellView *cal_shell_view)
{
+ EShellView *shell_view;
+ GnomeCalendarViewType view_type;
+ const gchar *view_id;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ view_type = gtk_radio_action_get_current_value (action);
+
+ switch (view_type) {
+ case GNOME_CAL_DAY_VIEW:
+ view_id = "Day_View";
+ break;
+
+ case GNOME_CAL_WORK_WEEK_VIEW:
+ view_id = "Work_Week_View";
+ break;
+
+ case GNOME_CAL_WEEK_VIEW:
+ view_id = "Week_View";
+ break;
+
+ case GNOME_CAL_MONTH_VIEW:
+ view_id = "Month_View";
+ break;
+
+ case GNOME_CAL_LIST_VIEW:
+ view_id = "List_View";
+ break;
+
+ default:
+ g_return_if_reached ();
+ }
+
+ e_shell_view_set_view_id (shell_view, view_id);
}
static void
action_event_clipboard_copy_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+ ECalShellContent *cal_shell_content;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ e_cal_shell_content_copy_clipboard (cal_shell_content);
}
static void
action_event_clipboard_cut_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+ ECalShellContent *cal_shell_content;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ e_cal_shell_content_cut_clipboard (cal_shell_content);
}
static void
action_event_clipboard_paste_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+ ECalShellContent *cal_shell_content;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ e_cal_shell_content_paste_clipboard (cal_shell_content);
+}
+
+static void
+action_event_copy_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_event_delegate_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
}
static void
action_event_delete_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+ ECalShellContent *cal_shell_content;
+
+ cal_shell_content = cal_shell-view->priv->cal_shell_content;
+ e_cal_shell_content_delete_selection (cal_shell_content);
}
static void
action_event_delete_occurrence_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+ ECalShellContent *cal_shell_content;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ e_cal_shell_content_delete_selected_occurrence (cal_shell_content);
}
static void
action_event_delete_occurrence_all_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+ ECalShellContent *cal_shell_content;
+ GnomeCalendar *calendar;
+
+ /* XXX Same as "event-delete". */
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ e_cal_shell_content_delete_selection (cal_shell_content);
+}
+
+static void
+action_event_forward_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_event_move_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_event_occurrence_movable_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
}
static void
action_event_open_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+ ECalShellContent *cal_shell_content;
+ GnomeCalendar *calendar;
+ GtkWidget *widget;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ widget = gnome_calendar_get_current_view_widget (calendar);
+
+ e_calendar_view_open_event (E_CALENDAR_VIEW (widget));
+}
+
+static void
+action_event_print_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_event_reply_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_event_reply_all_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_event_save_as_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_event_schedule_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_gal_save_custom_view_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EShellView *shell_view;
+ GalViewInstance *view_instance;
+
+ /* All shell views respond to the activation of this action,
+ * which is defined by EShellWindow. But only the currently
+ * active shell view proceeds with saving the custom view. */
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ if (!e_shell_view_is_active (shell_view))
+ return;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ view_instance = e_cal_shell_content_get_view_instance (cal_shell_content);
+ gal_view_instance_save_as (view_instance);
+}
+
+static void
+action_search_execute_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ EShellView *shell_view;
+
+ /* All shell views respond to the activation of this action,
+ * which is defined by EShellWindow. But only the currently
+ * active shell view proceeds with executing the search. */
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ if (!e_shell_view_is_active (shell_view))
+ return;
+
+ e_cal_shell_view_execute_search (cal_shell_view);
+}
+
+static void
+action_search_filter_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ ECalShellView *cal_shell_view)
+{
+ e_cal_shell_view_execute_search (cal_shell_view);
}
static GtkActionEntry calendar_entries[] = {
@@ -236,6 +596,20 @@ static GtkActionEntry calendar_entries[] = {
N_("Paste the clipboard"),
G_CALLBACK (action_event_clipboard_paste_cb) },
+ { "event-copy",
+ NULL,
+ N_("Cop_y to Calendar..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_copy_cb) },
+
+ { "event-delegate",
+ NULL,
+ N_("_Delegate Meeting..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_delegate_cb) },
+
{ "event-delete",
GTK_STOCK_DELETE,
NULL,
@@ -257,12 +631,89 @@ static GtkActionEntry calendar_entries[] = {
N_("Delete all occurrences"),
G_CALLBACK (action_event_delete_occurrence_all_cb) },
+ { "event-all-day-new",
+ NULL,
+ N_("New All Day _Event..."),
+ NULL,
+ N_("Create a new all day event"),
+ G_CALLBACK (action_event_all_day_new_cb) },
+
+ { "event-forward",
+ "mail-forward",
+ N_("_Forward as iCalendar..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_forward_new_cb) },
+
+ { "event-meeting-new",
+ NULL,
+ N_("New _Meeting..."),
+ NULL,
+ N_("Create a new meeting"),
+ G_CALLBACK (action_event_meeting_new_cb) },
+
+ { "event-move",
+ NULL,
+ N_("Mo_ve to Calendar..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_move_cb) },
+
+ { "event-new",
+ NULL,
+ N_("New _Appointment..."),
+ NULL,
+ N_("Create a new appointment"),
+ G_CALLBACK (action_event_new_cb) },
+
+ { "event-occurrence-movable",
+ NULL,
+ N_("Make this Occurrence _Movable"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_occurrence_movable_cb) },
+
{ "event-open",
NULL,
N_("_Open Appointment"),
"<Control>o",
N_("View the current appointment"),
- G_CALLBACK (action_event_open_cb) }
+ G_CALLBACK (action_event_open_cb) },
+
+ { "event-print",
+ GTK_STOCK_PRINT,
+ NULL,
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_print_cb) },
+
+ { "event-reply",
+ "mail-reply-sender",
+ N_("_Reply"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_reply_cb) },
+
+ { "event-reply-all",
+ "mail-reply-all",
+ N_("Reply to _All"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_reply_all_cb) },
+
+ { "event-save-as",
+ GTK_STOCK_SAVE_AS,
+ NULL,
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_save_as_cb) },
+
+ { "event-schedule",
+ NULL,
+ N_("_Schedule Meeting..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_schedule_cb) }
};
static GtkRadioActionEntry calendar_view_entries[] = {
@@ -303,22 +754,76 @@ static GtkRadioActionEntry calendar_view_entries[] = {
GNOME_CAL_WORK_WEEK_VIEW }
};
+static GtkRadioActionEntry calendar_filter_entries[] = {
+
+ { "calendar-filter-active-appointments",
+ NULL,
+ N_("Active Appointements"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ CALENDAR_FILTER_ACTIVE_APPOINTMENTS },
+
+ { "calendar-filter-any-category",
+ NULL,
+ N_("Any Category"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ CALENDAR_FILTER_ANY_CATEGORY },
+
+ { "calendar-filter-next-7-days-appointments",
+ NULL,
+ N_("Next 7 Days' Appointments"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ CALENDAR_FILTER_NEXT_7_DAYS_APPOINTMENTS },
+
+ { "calendar-filter-unmatched",
+ NULL,
+ N_("Unmatched"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ CALENDAR_FILTER_UNMATCHED }
+};
+
+static GtkRadioActionEntry calendar_search_entries[] = {
+
+ { "calendar-search-any-field-contains",
+ NULL,
+ N_("Any field contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ CALENDAR_SEARCH_ANY_FIELD_CONTAINS },
+
+ { "calendar-search-description-contains",
+ NULL,
+ N_("Description contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ CALENDAR_SEARCH_DESCRIPTION_CONTAINS },
+
+ { "calendar-search-summary-contains",
+ NULL,
+ N_("Summary contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ CALENDAR_SEARCH_SUMMARY_CONTAINS }
+};
+
void
e_cal_shell_view_actions_init (ECalShellView *cal_shell_view)
{
EShellView *shell_view;
EShellWindow *shell_window;
GtkActionGroup *action_group;
- GtkUIManager *manager;
+ GtkUIManager *ui_manager;
+ GtkAction *action;
const gchar *domain;
shell_view = E_SHELL_VIEW (cal_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- manager = e_shell_window_get_ui_manager (shell_window);
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
domain = GETTEXT_PACKAGE;
- e_load_ui_definition (manager, "evolution-calendars.ui");
-
action_group = cal_shell_view->priv->calendar_actions;
gtk_action_group_set_translation_domain (action_group, domain);
gtk_action_group_add_actions (
@@ -328,5 +833,92 @@ e_cal_shell_view_actions_init (ECalShellView *cal_shell_view)
action_group, calendar_view_entries,
G_N_ELEMENTS (calendar_view_entries), GNOME_CAL_DAY_VIEW,
G_CALLBACK (action_calendar_view_cb), cal_shell_view);
- gtk_ui_manager_insert_action_group (manager, action_group, 0);
+ gtk_action_group_add_radio_actions (
+ action_group, calendar_search_entries,
+ G_N_ELEMENTS (calendar_search_entries),
+ CALENDAR_SEARCH_SUMMARY_CONTAINS,
+ NULL, NULL);
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+
+ /* Fine tuning. */
+
+ action = ACTION (EVENT_DELETE);
+ g_object_set (action, "short-label", _("Delete"), NULL);
+
+ g_signal_connect (
+ ACTION (GAL_SAVE_CUSTOM_VIEW), "activate",
+ G_CALLBACK (action_gal_save_custom_view_cb), cal_shell_view);
+
+ g_signal_connect (
+ ACTION (SEARCH_EXECUTE), "activate",
+ G_CALLBACK (action_search_execute_cb), cal_shell_view);
+
+ /* Initialize the memo and task pad actions. */
+ e_cal_shell_view_memopad_actions_init (cal_shell_view);
+ e_cal_shell_view_taskpad_actions_init (cal_shell_view);
+}
+
+void
+e_cal_shell_view_update_search_filter (ECalShellView *cal_shell_view)
+{
+ EShellContent *shell_content;
+ EShellView *shell_view;
+ GtkActionGroup *action_group;
+ GtkRadioAction *radio_action;
+ GList *list, *iter;
+ GSList *group;
+ gint ii;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ action_group = cal_shell_view->priv->filter_actions;
+
+ e_action_group_remove_all_actions (action_group);
+
+ /* Add the standard filter actions. */
+ gtk_action_group_add_radio_actions (
+ action_group, calendar_filter_entries,
+ G_N_ELEMENTS (calendar_filter_entries),
+ CALENDAR_FILTER_ANY_CATEGORY,
+ G_CALLBACK (action_search_filter_cb),
+ cal_shell_view);
+
+ /* Retrieve the radio group from an action we just added. */
+ list = gtk_action_group_list_actions (action_group);
+ radio_action = GTK_RADIO_ACTION (list->data);
+ group = gtk_radio_action_get_group (radio_action);
+ g_list_free (list);
+
+ /* Build the category actions. */
+
+ list = e_categories_get_list ();
+ for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) {
+ const gchar *category_name = iter->data;
+ GtkAction *action;
+ gchar *action_name;
+
+ action_name = g_strdup_printf (
+ "calendar-filter-category-%d", ii);
+ radio_action = gtk_radio_action_new (
+ action_name, category_name, NULL, NULL, ii);
+ g_free (action_name);
+
+ gtk_radio_action_set_group (radio_action, group);
+ group = gtk_radio_action_get_group (radio_action);
+
+ /* The action group takes ownership of the action. */
+ action = GTK_ACTION (radio_action);
+ gtk_action_group_add_action (action_group, action);
+ g_object_unref (radio_action);
+ }
+ g_list_free (list);
+
+ /* Use any action in the group; doesn't matter which. */
+ e_shell_content_set_filter_action (shell_content, radio_action);
+
+ ii = CALENDAR_FILTER_UNMATCHED;
+ e_shell_content_add_filter_separator_after (shell_content, ii);
+
+ ii = CALENDAR_FILTER_NEXT_7_DAYS_APPOINTMENTS;
+ e_shell_content_add_filter_separator_after (shell_content, ii);
}
diff --git a/calendar/modules/e-cal-shell-view-actions.h b/calendar/modules/e-cal-shell-view-actions.h
index 6436a26b97..c682b22190 100644
--- a/calendar/modules/e-cal-shell-view-actions.h
+++ b/calendar/modules/e-cal-shell-view-actions.h
@@ -74,6 +74,72 @@
#define E_SHELL_WINDOW_ACTION_EVENT_OPEN(window) \
E_SHELL_WINDOW_ACTION ((window), "event-open")
+/* Memo Pad Actions */
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_CLIPBOARD_COPY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-clipboard-copy")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_CLIPBOARD_CUT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-clipboard-cut")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_CLIPBOARD_PASTE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-clipboard-paste")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_DELETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-delete")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_FORWARD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-forward")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_NEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-new")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_OPEN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-open")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_OPEN_URL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-open-url")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_PRINT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-print")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_SAVE_AS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-save-as")
+
+/* Task Pad Actions */
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_ASSIGN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-assign")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_CLIPBOARD_COPY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-clipboard-copy")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_CLIPBOARD_CUT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-clipboard-cut")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_CLIPBOARD_PASTE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-clipboard-paste")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_DELETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-delete")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_FORWARD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-forward")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_MARK_COMPLETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-mark-complete")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_MARK_INCOMPLETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-mark-incomplete")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_NEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-new")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_OPEN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-open")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_OPEN_URL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-open-url")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_PRINT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-print")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_SAVE_AS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-save-as")
+
+/* Calendar Query Actions */
+#define E_SHELL_WINDOW_ACTION_CALENDAR_FILTER_ACTIVE_APPOINTMENTS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-filter-active-appointments")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_FILTER_ANY_CATEGORY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-filter-any-category")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_FILTER_NEXT_7_DAYS_APPOINTMENTS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-filter-next-7-days-appointments")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_FILTER_UNMATCHED(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-filter-unmatched")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_SEARCH_ANY_FIELD_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-search-any-field-contains")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_SEARCH_DESCRIPTION_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-search-description-contains")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_SEARCH_SUMMARY_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-search-summary-contains")
+
/* Action Groups */
#define E_SHELL_WINDOW_ACTION_GROUP_CALS(window) \
E_SHELL_WINDOW_ACTION_GROUP ((window), "calendars")
diff --git a/calendar/modules/e-cal-shell-view-memopad.c b/calendar/modules/e-cal-shell-view-memopad.c
new file mode 100644
index 0000000000..ff9c235062
--- /dev/null
+++ b/calendar/modules/e-cal-shell-view-memopad.c
@@ -0,0 +1,472 @@
+/*
+ * e-cal-shell-view-memopad.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-cal-shell-view-private.h"
+
+/* Much of this file is based on e-memo-shell-view-actions.c. */
+
+static void
+action_calendar_memopad_clipboard_copy_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ e_memo_table_copy_clipboard (memo_table);
+}
+
+static void
+action_calendar_memopad_clipboard_cut_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ e_memo_table_cut_clipboard (memo_table);
+}
+
+static void
+action_calendar_memopad_clipboard_paste_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ e_memo_table_paste_clipboard (memo_table);
+}
+
+static void
+action_calendar_memopad_delete_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+ const gchar *status_message;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ status_message = _("Deleting selected memos...");
+ e_cal_shell_view_set_status_message (cal_shell_view, status_message);
+ e_memo_table_delete_selected (memo_table);
+ e_cal_shell_view_set_status_message (cal_shell_view, NULL);
+}
+
+static void
+action_calendar_memopad_forward_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+ ECalModelComponent *comp_data;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ ECalComponentItipMethod method;
+ GSList *list;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ list = e_memo_table_get_selected (memo_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only forward the first selected memo. */
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ method = E_CAL_COMPONENT_METHOD_PUBLISH;
+ e_cal_component_set_icalcomponent (comp, clone);
+ itip_send_comp (method, comp, comp_data->client, NULL, NULL, NULL);
+ g_object_unref (comp);
+}
+
+static void
+action_calendar_memopad_new_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+ ECalModelComponent *comp_data;
+ ECal *client;
+ ECalComponent *comp;
+ CompEditor *editor;
+ GSList *list;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ list = e_memo_table_get_selected (memo_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ client = comp_data->client;
+ editor = memo_editor_new (client, COMP_EDITOR_NEW_ITEM);
+ comp = cal_comp_memo_new_with_defaults (client);
+ comp_editor_edit_comp (editor, comp);
+
+ gtk_window_present (GTK_WINDOW (editor));
+
+ g_object_unref (comp);
+ g_object_unref (client);
+}
+
+static void
+action_calendar_memopad_open_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+ ECalModelComponent *comp_data;
+ GSList *list;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ list = e_memo_table_get_selected (memo_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only open the first selected memo. */
+ e_cal_shell_view_memopad_open_memo (cal_shell_view, comp_data);
+}
+
+static void
+action_calendar_memopad_open_url_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+ ECalModelComponent *comp_data;
+ icalproperty *prop;
+ GdkScreen *screen;
+ const gchar *uri;
+ GSList *list;
+ GError *error = NULL;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ list = e_memo_table_get_selected (memo_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only open the URI of the first selected memo. */
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_URL_PROPERTY);
+ g_return_if_fail (prop == NULL);
+
+ screen = gtk_widget_get_screen (GTK_WIDGET (cal_shell_view));
+ uri = icalproperty_get_url (prop);
+ gtk_show_uri (screen, uri, GDK_CURRENT_TIME, &error);
+
+ if (error != NULL) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
+}
+
+static void
+action_calendar_memopad_print_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+ ECalModelComponent *comp_data;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ GtkPrintOperationAction print_action;
+ GSList *list;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ list = e_memo_table_get_selected (memo_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only print the first selected memo. */
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
+ e_cal_component_set_icalcomponent (comp, clone);
+ print_comp (comp, comp_data->client, print_action);
+ g_object_unref (comp);
+}
+
+static void
+action_calendar_memopad_save_as_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+ ECalModelComponent *comp_data;
+ GSList *list;
+ gchar *filename;
+ gchar *string;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ list = e_memo_table_get_selected (memo_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ filename = e_file_dialog_save (_("Save as..."), NULL);
+ if (filename == NULL)
+ return;
+
+ /* XXX We only save the first selected memo. */
+ string = e_cal_get_component_as_string (
+ comp_data->client, comp_data->icalcomp);
+ if (string == NULL) {
+ g_warning ("Could not convert memo to a string.");
+ return;
+ }
+
+ e_write_file_uri (filename, string);
+
+ g_free (filename);
+ g_free (string);
+}
+
+static GtkActionEntry calendar_memopad_entries[] = {
+
+ { "calendar-memopad-clipboard-copy",
+ GTK_STOCK_COPY,
+ NULL,
+ NULL,
+ N_("Copy selected memo"),
+ G_CALLBACK (action_calendar_memopad_clipboard_copy_cb) },
+
+ { "calendar-memopad-clipboard-cut",
+ GTK_STOCK_CUT,
+ NULL,
+ NULL,
+ N_("Cut selected memo"),
+ G_CALLBACK (action_calendar_memopad_clipboard_cut_cb) },
+
+ { "calendar-memopad-clipboard-paste",
+ GTK_STOCK_PASTE,
+ NULL,
+ NULL,
+ N_("Paste memo from the clipboard"),
+ G_CALLBACK (action_calendar_memopad_clipboard_paste_cb) },
+
+ { "calendar-memopad-delete",
+ GTK_STOCK_DELETE,
+ N_("_Delete Memo"),
+ NULL,
+ N_("Delete selected memos"),
+ G_CALLBACK (action_calendar_memopad_delete_cb) },
+
+ { "calendar-memopad-forward",
+ "mail-forward",
+ N_("_Forward as iCalendar..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_calendar_memopad_forward_cb) },
+
+ { "calendar-memopad-new",
+ "stock_insert-note",
+ N_("New _Memo"),
+ NULL,
+ N_("Create a new memo"),
+ G_CALLBACK (action_calendar_memopad_new_cb) },
+
+ { "calendar-memopad-open",
+ GTK_STOCK_OPEN,
+ N_("_Open Memo"),
+ NULL,
+ N_("View the selected memo"),
+ G_CALLBACK (action_calendar_memopad_open_cb) },
+
+ { "calendar-memopad-open-url",
+ "applications-internet",
+ N_("Open _Web Page"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_calendar_memopad_open_url_cb) },
+
+ { "calendar-memopad-print",
+ GTK_STOCK_PRINT,
+ NULL,
+ NULL,
+ N_("Print the selected memo"),
+ G_CALLBACK (action_calendar_memopad_print_cb) },
+
+ { "calendar-memopad-save-as",
+ GTK_STOCK_SAVE_AS,
+ NULL,
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_calendar_memopad_save_as_cb) }
+};
+
+void
+e_cal_shell_view_memopad_actions_init (ECalShellView *cal_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ GtkActionGroup *action_group;
+ GtkUIManager *ui_manager;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+
+ action_group = cal_shell_view->priv->calendar_actions;
+ 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
+e_cal_shell_view_memopad_actions_update (ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ EMemoTable *memo_table;
+ ETable *table;
+ GtkAction *action;
+ GSList *list, *iter;
+ const gchar *label;
+ gboolean editable = TRUE;
+ gboolean has_url = FALSE;
+ gboolean sensitive;
+ gint n_selected;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ table = e_memo_table_get_table (memo_table);
+ n_selected = e_table_selected_count (table);
+
+ list = e_memo_table_get_selected (memo_table);
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ECalModelComponent *comp_data = iter->data;
+ icalproperty *prop;
+ gboolean read_only;
+
+ e_cal_is_read_only (comp_data->client, &read_only, NULL);
+ editable &= !read_only;
+
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_URL_PROPERTY);
+ has_url |= (prop != NULL);
+ }
+ g_slist_free (list);
+
+ action = ACTION (CALENDAR_MEMOPAD_CLIPBOARD_COPY);
+ sensitive = (n_selected > 0);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_MEMOPAD_CLIPBOARD_CUT);
+ sensitive = (n_selected > 0) && editable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_MEMOPAD_CLIPBOARD_PASTE);
+ sensitive = editable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_MEMOPAD_DELETE);
+ sensitive = (n_selected > 0) && editable;
+ gtk_action_set_sensitive (action, sensitive);
+ label = ngettext ("Delete Memo", "Delete Memos", n_selected);
+ g_object_set (action, "label", label, NULL);
+
+ action = ACTION (CALENDAR_MEMOPAD_FORWARD);
+ sensitive = (n_selected == 1);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_MEMOPAD_OPEN);
+ sensitive = (n_selected == 1);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_MEMOPAD_OPEN_URL);
+ sensitive = (n_selected == 1) && has_url;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_MEMOPAD_PRINT);
+ sensitive = (n_selected == 1);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_MEMOPAD_SAVE_AS);
+ sensitive = (n_selected == 1);
+ gtk_action_set_sensitive (action, sensitive);
+}
+
+void
+e_cal_shell_view_memopad_open_memo (ECalShellView *cal_shell_view,
+ ECalModelComponent *comp_data)
+{
+ CompEditor *editor;
+ CompEditorFlags flags = 0;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ const gchar *uid;
+
+ g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view));
+ g_return_if_fail (E_IS_CAL_MODEL_COMPONENT (comp_data));
+
+ uid = icalcomponent_get_uid (comp_data->icalcomp);
+ editor = comp_editor_find_instance (uid);
+
+ if (editor != NULL)
+ goto exit;
+
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ e_cal_component_set_icalcomponent (comp, clone);
+
+ if (e_cal_component_has_organizer (comp))
+ flags |= COMP_EDITOR_IS_SHARED;
+
+ if (itip_organizer_is_user (comp, comp_data->client))
+ flags |= COMP_EDITOR_USER_ORG;
+
+ editor = memo_editor_new (comp_data->client, flags);
+ comp_editor_edit_comp (editor, comp);
+
+ g_object_unref (comp);
+
+exit:
+ gtk_window_present (GTK_WINDOW (editor));
+}
diff --git a/calendar/modules/e-cal-shell-view-private.c b/calendar/modules/e-cal-shell-view-private.c
index 9107aee1fa..65be70ae93 100644
--- a/calendar/modules/e-cal-shell-view-private.c
+++ b/calendar/modules/e-cal-shell-view-private.c
@@ -25,6 +25,104 @@
#include "widgets/menus/gal-view-factory-etable.h"
static void
+cal_shell_view_update_timezone (ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalShellSidebar *cal_shell_sidebar;
+ GnomeCalendarViewType view_type;
+ ECalendarView *calendar_view;
+ icaltimezone *timezone;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
+
+ e_cal_shell_sidebar_update_timezone (cal_shell_sidebar);
+
+ view_type = e_cal_shell_content_get_current_view (cal_shell_content);
+ calendar_view = e_cal_shell_content_get_calendar_view (
+ cal_shell_content, view_type);
+
+ timezone = calendar_config_get_icaltimezone ();
+ e_calendar_view_get_icaltimezone (calendar_view, timezone);
+}
+
+static void
+cal_shell_view_timezone_changed_cb (GConfClient *client,
+ guint id,
+ GConfEntry *entry,
+ gpointer user_data)
+{
+ ECalShellView *cal_shell_view = user_data;
+
+ cal_shell_view_update_timezone (cal_shell_view);
+}
+
+static struct tm
+cal_shell_view_get_current_time (ECalendarItem *calitem,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ struct icaltimetype tt;
+ icaltimezone *timezone;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ timezone = e_cal_shell_content_get_timezone (cal_shell_content);
+
+ tt = icaltime_from_timet_with_zone (time (NULL), FALSE, timezone);
+
+ return icaltimetype_to_tm (&tt);
+}
+
+static void
+cal_shell_view_mini_calendar_date_range_changed_cb (ECalShellView *cal_shell_view,
+ ECalendarItem *calitem)
+{
+ /* FIXME gnome-calendar.c calls update_query() here. */
+}
+
+static void
+cal_shell_view_mini_calendar_selection_changed_cb (ECalShellView *cal_shell_view,
+ ECalendarItem *calitem)
+{
+ /* FIXME */
+}
+
+static void
+cal_shell_view_mini_calendar_scroll_event_cb (ECalShellView *cal_shell_view,
+ GdkEventScroll *event,
+ ECalendar *mini_calendar)
+{
+ ECalendarItem *calitem;
+ GDate start_date, end_date;
+
+ calitem = mini_calendar->calitem;
+ if (!e_calendar_item_get_selection (calitem, &start_date, &end_date))
+ return;
+
+ switch (event->direction) {
+ case GDK_SCROLL_UP:
+ g_date_subtract_months (&start_date, 1);
+ g_date_subtract_months (&end_date, 1);
+ break;
+
+ case GDK_SCROLL_DOWN:
+ g_date_add_months (&start_date, 1);
+ g_date_add_months (&end_date, 1);
+ break;
+
+ default:
+ g_return_if_reached ();
+ }
+
+ /* XXX Does ECalendarItem emit a signal for this? If so, maybe
+ * we could move this handler into ECalShellSidebar. */
+ e_calendar_item_set_selection (calitem, &start_date, &end_date);
+
+ cal_shell_view_mini_calendar_date_range_changed_cb (
+ cal_shell_view, calitem);
+}
+
+static void
cal_shell_view_load_view_collection (EShellViewClass *shell_view_class)
{
GalViewCollection *collection;
@@ -104,6 +202,7 @@ e_cal_shell_view_private_init (ECalShellView *cal_shell_view,
priv->source_list = g_object_ref (source_list);
priv->calendar_actions = gtk_action_group_new ("calendars");
+ priv->filter_actions = gtk_action_group_new ("calendars-filter");
if (!gal_view_collection_loaded (shell_view_class->view_collection))
cal_shell_view_load_view_collection (shell_view_class);
@@ -117,10 +216,14 @@ void
e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
{
ECalShellViewPrivate *priv = cal_shell_view->priv;
+ ECalShellContent *cal_shell_content;
+ ECalShellSidebar *cal_shell_sidebar;
EShellContent *shell_content;
EShellSidebar *shell_sidebar;
EShellView *shell_view;
GnomeCalendar *calendar;
+ ECalendar *mini_calendar;
+ guint notification;
shell_view = E_SHELL_VIEW (cal_shell_view);
shell_content = e_shell_view_get_shell_content (shell_view);
@@ -130,13 +233,44 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
priv->cal_shell_content = g_object_ref (shell_content);
priv->cal_shell_sidebar = g_object_ref (shell_sidebar);
- calendar = e_cal_shell_view_get_calendar (cal_shell_view);
+ cal_shell_content = E_CAL_SHELL_CONTENT (shell_content);
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+
+ cal_shell_sidebar = E_CAL_SHELL_SIDEBAR (shell_sidebar);
+ mini_calendar = e_cal_shell_sidebar_get_mini_calendar (cal_shell_sidebar);
+
+ e_calendar_item_set_get_time_callback (
+ mini_calendar->calitem, (ECalendarItemGetTimeCallback)
+ cal_shell_view_get_current_time, cal_shell_view, NULL);
g_signal_connect_swapped (
calendar, "dates-shown-changed",
G_CALLBACK (e_cal_shell_view_update_sidebar),
cal_shell_view);
+ g_signal_connect_swapped (
+ mini_calendar, "scroll-event",
+ G_CALLBACK (cal_shell_view_mini_calendar_scroll_event_cb),
+ cal_shell_view);
+
+ g_signal_connect_swapped (
+ mini_calendar->calitem, "date-range-changed",
+ G_CALLBACK (cal_shell_view_mini_calendar_date_range_changed_cb),
+ cal_shell_view);
+
+ g_signal_connect_swapped (
+ mini_calendar->calitem, "selection-changed",
+ G_CALLBACK (cal_shell_view_mini_calendar_selection_changed_cb),
+ cal_shell_view);
+
+ /* Listen for configuration changes. */
+
+ notification = calendar_config_add_notification_timezone (
+ cal_shell_view_timezone_changed_cb, cal_shell_view);
+ priv->notifications = g_list_prepend (
+ priv->notifications, GUINT_TO_POINTER (notification));
+ cal_shell_view_update_timezone (cal_shell_view);
+
e_shell_view_update_actions (shell_view);
e_cal_shell_view_update_sidebar (cal_shell_view);
}
@@ -149,6 +283,7 @@ e_cal_shell_view_private_dispose (ECalShellView *cal_shell_view)
DISPOSE (priv->source_list);
DISPOSE (priv->calendar_actions);
+ DISPOSE (priv->filter_actions);
DISPOSE (priv->cal_shell_content);
DISPOSE (priv->cal_shell_sidebar);
@@ -168,6 +303,53 @@ e_cal_shell_view_private_finalize (ECalShellView *cal_shell_view)
}
void
+e_cal_shell_view_open_event (ECalShellView *cal_shell_view,
+ ECalModelComponent *comp_data)
+{
+ CompEditor *editor;
+ CompEditorFlags flags = 0;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ icalproperty *prop;
+ const gchar *uid;
+
+ g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view));
+ g_return_if_fail (E_IS_CAL_MODEL_COMPONENT (comp_data));
+
+ uid = icalcomponent_get_uid (comp_data->icalcomp);
+ editor = comp_editor_find_instance (uid);
+
+ if (editor != NULL)
+ goto exit;
+
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ e_cal_component_set_icalcomponent (comp, clone);
+
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY);
+ if (prop != NULL)
+ flags |= COMP_EDITOR_MEETING;
+
+ if (itip_organizer_is_user (comp, comp_data->client))
+ flags |= COMP_EDITOR_USER_ORG;
+
+ if (itip_sentby_is_user (comp))
+ flags |= COMP_EDITOR_USER_ORG;
+
+ if (!e_cal_component_has_attendees (comp))
+ flags |= COMP_EDITOR_USER_ORG;
+
+ editor = event_editor_new (comp_data->client, flags);
+ comp_editor_edit_comp (editor, comp);
+
+ g_object_ref (comp);
+
+exit:
+ gtk_window_present (GTK_WINDOW (editor));
+}
+
+void
e_cal_shell_view_set_status_message (ECalShellView *cal_shell_view,
const gchar *status_message)
{
@@ -212,6 +394,8 @@ e_cal_shell_view_update_sidebar (ECalShellView *cal_shell_view)
gchar buffer[512];
gchar end_buffer[512];
+ g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view));
+
shell_view = E_SHELL_VIEW (cal_shell_view);
shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
diff --git a/calendar/modules/e-cal-shell-view-private.h b/calendar/modules/e-cal-shell-view-private.h
index 320e489cbc..bf246cd4ac 100644
--- a/calendar/modules/e-cal-shell-view-private.h
+++ b/calendar/modules/e-cal-shell-view-private.h
@@ -29,11 +29,19 @@
#include <libecal/e-cal-time-util.h>
#include <libedataserver/e-data-server-util.h>
+#include "e-util/e-dialog-utils.h"
#include "e-util/e-util.h"
-#include "shell/e-shell-content.h"
-
+#include "calendar/gui/comp-util.h"
+#include "calendar/gui/e-cal-model-tasks.h"
+#include "calendar/gui/e-calendar-view.h"
#include "calendar/gui/gnome-cal.h"
+#include "calendar/gui/goto.h"
+#include "calendar/gui/print.h"
+#include "calendar/gui/dialogs/copy-source-dialog.h"
+#include "calendar/gui/dialogs/event-editor.h"
+#include "calendar/gui/dialogs/memo-editor.h"
+#include "calendar/gui/dialogs/task-editor.h"
#include "e-cal-shell-content.h"
#include "e-cal-shell-sidebar.h"
@@ -60,6 +68,22 @@
G_BEGIN_DECLS
+/* Filter items are displayed in ascending order.
+ * Non-negative values are reserved for categories. */
+enum {
+ CALENDAR_FILTER_ANY_CATEGORY = -4,
+ CALENDAR_FILTER_UNMATCHED = -3,
+ CALENDAR_FILTER_ACTIVE_APPOINTMENTS = -2,
+ CALENDAR_FILTER_NEXT_7_DAYS_APPOINTMENTS = -1
+};
+
+/* Search items are displayed in ascending order. */
+enum {
+ CALENDAR_SEARCH_SUMMARY_CONTAINS,
+ CALENDAR_SEARCH_DESCRIPTION_CONTAINS,
+ CALENDAR_SEARCH_ANY_FIELD_CONTAINS
+};
+
struct _ECalShellViewPrivate {
/*** Module Data ***/
@@ -69,11 +93,15 @@ struct _ECalShellViewPrivate {
/*** UI Management ***/
GtkActionGroup *calendar_actions;
+ GtkActionGroup *filter_actions;
/* These are just for convenience. */
ECalShellContent *cal_shell_content;
ECalShellSidebar *cal_shell_sidebar;
+ /* The last time explicitly selected by the user. */
+ time_t base_view_time;
+
EActivity *activity;
};
@@ -91,11 +119,38 @@ void e_cal_shell_view_private_finalize
void e_cal_shell_view_actions_init
(ECalShellView *cal_shell_view);
+void e_cal_shell_view_execute_search
+ (ECalShellView *cal_shell_view);
+void e_cal_shell_view_open_event
+ (ECalShellView *cal_shell_view,
+ ECalModelComponent *comp_data);
void e_cal_shell_view_set_status_message
(ECalShellView *cal_shell_view,
const gchar *status_message);
void e_cal_shell_view_update_sidebar
(ECalShellView *cal_shell_view);
+void e_cal_shell_view_update_search_filter
+ (ECalShellView *cal_shell_view);
+
+/* Memo Pad Utilities */
+
+void e_cal_shell_view_memopad_actions_init
+ (ECalShellView *cal_shell_view);
+void e_cal_shell_view_memopad_actions_update
+ (ECalShellView *cal_shell_view);
+void e_cal_shell_view_memopad_open_memo
+ (ECalShellView *cal_shell_view,
+ ECalModelComponent *comp_data);
+
+/* Task Pad Utilities */
+
+void e_cal_shell_view_taskpad_actions_init
+ (ECalShellView *cal_shell_view);
+void e_cal_shell_view_taskpad_actions_update
+ (ECalShellView *cal_shell_view);
+void e_cal_shell_view_taskpad_open_task
+ (ECalShellView *cal_shell_view,
+ ECalModelComponent *comp_data);
G_END_DECLS
diff --git a/calendar/modules/e-cal-shell-view-taskpad.c b/calendar/modules/e-cal-shell-view-taskpad.c
new file mode 100644
index 0000000000..e2cc9d9a52
--- /dev/null
+++ b/calendar/modules/e-cal-shell-view-taskpad.c
@@ -0,0 +1,600 @@
+/*
+ * e-cal-shell-view-taskpad.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-cal-shell-view-private.h"
+
+/* Much of this file is based on e-task-shell-view-actions.c. */
+
+static void
+action_calendar_taskpad_assign_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ GSList *list;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only open the first selected task. */
+ e_cal_shell_view_taskpad_open_task (cal_shell_view, comp_data);
+
+ /* FIXME Need to actually assign the task. */
+}
+
+static void
+action_calendar_taskpad_clipboard_copy_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ 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_copy_clipboard (task_table);
+}
+
+static void
+action_calendar_taskpad_clipboard_cut_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ 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_cut_clipboard (task_table);
+}
+
+static void
+action_calendar_taskpad_clipboard_paste_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ 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_paste_clipboard (task_table);
+}
+
+static void
+action_calendar_taskpad_delete_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+ const gchar *status_message;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ status_message = _("Deleting selected tasks...");
+ e_cal_shell_view_set_status_message (cal_shell_view, status_message);
+ e_calendar_table_delete_selected (task_table);
+ e_cal_shell_view_set_status_message (cal_shell_view, NULL);
+}
+
+static void
+action_calendar_taskpad_forward_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ ECalComponentItipMethod method;
+ GSList *list;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only forward the first selected task. */
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ method = E_CAL_COMPONENT_METHOD_PUBLISH;
+ e_cal_component_set_icalcomponent (comp, clone);
+ itip_send_comp (method, comp, comp_data->client, NULL, NULL, NULL);
+ g_object_unref (comp);
+}
+
+static void
+action_calendar_taskpad_mark_complete_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+ ECalModel *model;
+ GSList *list, *iter;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+ list = e_calendar_table_get_selected (task_table);
+ model = e_calendar_table_get_model (task_table);
+
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ECalModelComponent *comp_data = iter->data;
+ e_cal_model_tasks_mark_comp_complete (
+ E_CAL_MODEL_TASKS (model), comp_data);
+ }
+
+ g_slist_free (list);
+}
+
+static void
+action_calendar_taskpad_mark_incomplete_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+ ECalModel *model;
+ GSList *list, *iter;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+ list = e_calendar_table_get_selected (task_table);
+ model = e_calendar_table_get_model (task_table);
+
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ECalModelComponent *comp_data = iter->data;
+ e_cal_model_tasks_mark_comp_incomplete (
+ E_CAL_MODEL_TASKS (model), comp_data);
+ }
+
+ g_slist_free (list);
+}
+
+static void
+action_calendar_taskpad_new_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ ECal *client;
+ ECalComponent *comp;
+ CompEditor *editor;
+ GSList *list;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ client = comp_data->client;
+ editor = task_editor_new (client, COMP_EDITOR_NEW_ITEM);
+ comp = cal_comp_task_new_with_defaults (client);
+ comp_editor_edit_comp (editor, comp);
+
+ gtk_window_present (GTK_WINDOW (editor));
+
+ g_object_unref (comp);
+ g_object_unref (client);
+}
+
+static void
+action_calendar_taskpad_open_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ GSList *list;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only open the first selected task. */
+ e_cal_shell_view_taskpad_open_task (cal_shell_view, comp_data);
+}
+
+static void
+action_calendar_taskpad_open_url_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ icalproperty *prop;
+ GdkScreen *screen;
+ const gchar *uri;
+ GSList *list;
+ GError *error = NULL;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+
+ /* XXX We only open the URI of the first selected task. */
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_URL_PROPERTY);
+ g_return_if_fail (prop == NULL);
+
+ screen = gtk_widget_get_screen (GTK_WIDGET (cal_shell_view));
+ uri = icalproperty_get_url (prop);
+ gtk_show_uri (screen, uri, GDK_CURRENT_TIME, &error);
+
+ if (error != NULL) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
+}
+
+static void
+action_calendar_taskpad_print_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ GtkPrintOperationAction print_action;
+ GSList *list;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only print the first selected task. */
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
+ e_cal_component_set_icalcomponent (comp, clone);
+ print_comp (comp, comp_data->client, print_action);
+ g_object_unref (comp);
+}
+
+static void
+action_calendar_taskpad_save_as_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ GSList *list;
+ gchar *filename;
+ gchar *string;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ filename = e_file_dialog_save (_("Save as..."), NULL);
+ if (filename == NULL)
+ return;
+
+ string = e_cal_get_component_as_string (
+ comp_data->client, comp_data->icalcomp);
+ if (string == NULL) {
+ g_warning ("Could not convert task to a string");
+ return;
+ }
+
+ e_write_file_uri (filename, string);
+
+ g_free (filename);
+ g_free (string);
+}
+
+static GtkActionEntry calendar_taskpad_entries[] = {
+
+ { "calendar-taskpad-assign",
+ NULL,
+ N_("_Assign Task"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_calendar_taskpad_assign_cb) },
+
+ { "calendar-taskpad-clipboard-copy",
+ GTK_STOCK_COPY,
+ NULL,
+ NULL,
+ N_("Copy selected tasks"),
+ G_CALLBACK (action_calendar_taskpad_clipboard_copy_cb) },
+
+ { "calendar-taskpad-clipboard-cut",
+ GTK_STOCK_CUT,
+ NULL,
+ NULL,
+ N_("Cut selected tasks"),
+ G_CALLBACK (action_calendar_taskpad_clipboard_cut_cb) },
+
+ { "calendar-taskpad-clipboard-paste",
+ GTK_STOCK_PASTE,
+ NULL,
+ NULL,
+ N_("Paste tasks from the clipboard"),
+ G_CALLBACK (action_calendar_taskpad_clipboard_paste_cb) },
+
+ { "calendar-taskpad-delete",
+ GTK_STOCK_DELETE,
+ N_("_Delete Task"),
+ NULL,
+ N_("Delete selected tasks"),
+ G_CALLBACK (action_calendar_taskpad_delete_cb) },
+
+ { "calendar-taskpad-forward",
+ "mail-forward",
+ N_("_Forward as iCalendar..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_calendar_taskpad_forward_cb) },
+
+ { "calendar-taskpad-mark-complete",
+ NULL,
+ N_("_Mark as Complete"),
+ NULL,
+ N_("Mark selected tasks as complete"),
+ G_CALLBACK (action_calendar_taskpad_mark_complete_cb) },
+
+ { "calendar-taskpad-mark-incomplete",
+ NULL,
+ N_("_Mar_k as Incomplete"),
+ NULL,
+ N_("Mark selected tasks as incomplete"),
+ G_CALLBACK (action_calendar_taskpad_mark_incomplete_cb) },
+
+ { "calendar-taskpad-new",
+ "stock_task",
+ N_("New _Task"),
+ NULL,
+ N_("Create a new task"),
+ G_CALLBACK (action_calendar_taskpad_new_cb) },
+
+ { "calendar-taskpad-open",
+ GTK_STOCK_OPEN,
+ N_("_Open Task"),
+ NULL,
+ N_("View the selected task"),
+ G_CALLBACK (action_calendar_taskpad_open_cb) },
+
+ { "calendar-taskpad-open-url",
+ "applications-internet",
+ N_("Open _Web Page"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_calendar_taskpad_open_url_cb) },
+
+ { "calendar-taskpad-print",
+ GTK_STOCK_PRINT,
+ NULL,
+ NULL,
+ N_("Print the selected task"),
+ G_CALLBACK (action_calendar_taskpad_print_cb) },
+
+ { "calendar-taskpad-save-as",
+ GTK_STOCK_SAVE_AS,
+ N_("_Save as iCalendar..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_calendar_taskpad_save_as_cb) }
+};
+
+void
+e_cal_shell_view_taskpad_actions_init (ECalShellView *cal_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ GtkActionGroup *action_group;
+ GtkUIManager *ui_manager;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+
+ action_group = cal_shell_view->priv->calendar_actions;
+ 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
+e_cal_shell_view_taskpad_actions_update (ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ ECalendarTable *task_table;
+ ETable *table;
+ GtkAction *action;
+ GSList *list, *iter;
+ const gchar *label;
+ gboolean assignable = TRUE;
+ gboolean editable = TRUE;
+ gboolean has_url = FALSE;
+ gboolean sensitive;
+ gint n_selected;
+ gint n_complete = 0;
+ gint n_incomplete = 0;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ table = e_calendar_table_get_table (task_table);
+ n_selected = e_table_selected_count (table);
+
+ list = e_calendar_table_get_selected (task_table);
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ECalModelComponent *comp_data = iter->data;
+ icalproperty *prop;
+ const gchar *cap;
+ gboolean read_only;
+
+ e_cal_is_read_only (comp_data->client, &read_only, NULL);
+ editable &= !read_only;
+
+ cap = CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT;
+ if (e_cal_get_static_capability (comp_data->client, cap))
+ assignable = FALSE;
+
+ cap = CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK;
+ if (e_cal_get_static_capability (comp_data->client, cap))
+ assignable = FALSE;
+
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_URL_PROPERTY);
+ has_url |= (prop != NULL);
+
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_COMPLETED_PROPERTY);
+ if (prop != NULL)
+ n_complete++;
+ else
+ n_incomplete++;
+ }
+ g_slist_free (list);
+
+ action = ACTION (CALENDAR_TASKPAD_ASSIGN);
+ sensitive = (n_selected == 1) && editable && assignable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_CLIPBOARD_COPY);
+ sensitive = (n_selected > 0);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_CLIPBOARD_CUT);
+ sensitive = (n_selected > 0) && editable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_CLIPBOARD_PASTE);
+ sensitive = editable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_DELETE);
+ sensitive = (n_selected > 0) && editable;
+ gtk_action_set_sensitive (action, sensitive);
+ label = ngettext ("Delete Task", "Delete Tasks", n_selected);
+ g_object_set (action, "label", label, NULL);
+
+ action = ACTION (CALENDAR_TASKPAD_FORWARD);
+ sensitive = (n_selected == 1);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_MARK_COMPLETE);
+ sensitive = (n_selected > 0) && editable && (n_incomplete > 0);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_MARK_INCOMPLETE);
+ sensitive = (n_selected > 0) && editable && (n_complete > 0);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_OPEN);
+ sensitive = (n_selected == 1);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_OPEN_URL);
+ sensitive = (n_selected == 1) && has_url;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_PRINT);
+ sensitive = (n_selected == 1);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_SAVE_AS);
+ sensitive = (n_selected == 1);
+ gtk_action_set_sensitive (action, sensitive);
+}
+
+void
+e_cal_shell_view_taskpad_open_task (ECalShellView *cal_shell_view,
+ ECalModelComponent *comp_data)
+{
+ CompEditor *editor;
+ CompEditorFlags flags = 0;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ icalproperty *prop;
+ const gchar *uid;
+
+ g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view));
+ g_return_if_fail (E_IS_CAL_MODEL_COMPONENT (comp_data));
+
+ uid = icalcomponent_get_uid (comp_data->icalcomp);
+ editor = comp_editor_find_instance (uid);
+
+ if (editor != NULL)
+ goto exit;
+
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ e_cal_component_set_icalcomponent (comp, clone);
+
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY);
+ if (prop != NULL)
+ flags |= COMP_EDITOR_IS_ASSIGNED;
+
+ if (itip_organizer_is_user (comp, comp_data->client))
+ flags |= COMP_EDITOR_USER_ORG;
+
+ if (!e_cal_component_has_attendees (comp))
+ flags |= COMP_EDITOR_USER_ORG;
+
+ editor = task_editor_new (comp_data->client, flags);
+ comp_editor_edit_comp (editor, comp);
+
+ g_object_ref (comp);
+
+ if (flags & COMP_EDITOR_IS_ASSIGNED)
+ task_editor_show_assignment (TASK_EDITOR (editor));
+
+exit:
+ gtk_window_present (GTK_WINDOW (editor));
+}
diff --git a/calendar/modules/e-cal-shell-view.c b/calendar/modules/e-cal-shell-view.c
index 06e433be31..353658474b 100644
--- a/calendar/modules/e-cal-shell-view.c
+++ b/calendar/modules/e-cal-shell-view.c
@@ -77,17 +77,99 @@ static void
cal_shell_view_update_actions (EShellView *shell_view)
{
ECalShellViewPrivate *priv;
+ ECalShellContent *cal_shell_content;
+ ECalShellSidebar *cal_shell_sidebar;
EShellWindow *shell_window;
+ GnomeCalendar *calendar;
+ ECalModel *model;
+ ESourceSelector *selector;
+ ESource *source;
+ GtkAction *action;
+ GtkWidget *widget;
+ GList *list, *iter;
+ const gchar *uri = NULL;
+ gboolean user_created_source;
+ gboolean editable = TRUE;
+ gboolean recurring = FALSE;
+ gboolean sensitive;
+ gint n_selected;
priv = E_CAL_SHELL_VIEW_GET_PRIVATE (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- /* FIXME */
+ cal_shell_content = priv->cal_shell_content;
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ widget = gnome_calendar_get_current_view_widget (calendar);
+ model = e_calendar_view_get_model (E_CALENDAR_VIEW (widget));
+
+ cal_shell_sidebar = priv->cal_shell_sidebar;
+ selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
+
+ list = e_calendar_view_get_selected_events (E_CALENDAR_VIEW (widget));
+ n_selected = g_list_length (list);
+
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ECalModelComponent *comp_data = iter->data;
+ gboolean read_only;
+
+ e_cal_is_read_only (comp_data->client, &read_only, NULL);
+ editable &= !read_only;
+
+ if (e_cal_util_component_has_recurrences (comp_data->icalcomp))
+ recurring |= TRUE;
+ else if (e_cal_util_component_is_instance (comp_data->icalcomp))
+ recurring |= TRUE;
+ }
+
+ source = e_source_selector_peek_primary_selection (selector);
+ if (source != NULL)
+ uri = e_source_peek_relative_uri (source);
+ user_created_source = (uri != NULL && strcmp (uri, "system") != 0);
+
+ action = ACTION (CALENDAR_COPY);
+ sensitive = (source != NULL);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_DELETE);
+ sensitive = user_created_source;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_PROPERTIES);
+ sensitive = (source != NULL);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (EVENT_CLIPBOARD_COPY);
+ sensitive = (n_selected > 0);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (EVENT_CLIPBOARD_CUT);
+ sensitive = (n_selected > 0) && editable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (EVENT_CLIPBOARD_PASTE);
+ sensitive = editable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (EVENT_DELETE);
+ sensitive = (n_selected > 0) && editable && !recurring;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (EVENT_DELETE_OCCURRENCE);
+ sensitive = (n_selected > 0) && editable && recurring;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (EVENT_DELETE_OCCURRENCE_ALL);
+ sensitive = (n_selected > 0) && editable && recurring;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (EVENT_OPEN);
+ sensitive = (n_selected == 1);
+ gtk_action_set_sensitive (action, sensitive);
}
static void
-cal_shell_view_class_init (ECalShellView *class,
+cal_shell_view_class_init (ECalShellViewClass *class,
GTypeModule *type_module)
{
GObjectClass *object_class;
diff --git a/calendar/modules/e-memo-shell-module.c b/calendar/modules/e-memo-shell-module.c
index 7f6df49691..9f6c45b695 100644
--- a/calendar/modules/e-memo-shell-module.c
+++ b/calendar/modules/e-memo-shell-module.c
@@ -480,10 +480,9 @@ e_shell_module_init (GTypeModule *type_module)
shell_module = E_SHELL_MODULE (type_module);
shell = e_shell_module_get_shell (shell_module);
- /* Register the GType for EMemoShellView. */
- e_memo_shell_view_get_type (type_module);
-
- e_shell_module_set_info (shell_module, &module_info);
+ e_shell_module_set_info (
+ shell_module, &module_info,
+ e_memo_shell_view_get_type (type_module));
memo_module_ensure_sources (shell_module);
diff --git a/calendar/modules/e-memo-shell-sidebar.c b/calendar/modules/e-memo-shell-sidebar.c
index 63629f2108..e46b84e8ea 100644
--- a/calendar/modules/e-memo-shell-sidebar.c
+++ b/calendar/modules/e-memo-shell-sidebar.c
@@ -360,6 +360,7 @@ memo_shell_sidebar_constructed (GObject *object)
GtkContainer *container;
GtkTreeModel *model;
GtkWidget *widget;
+ AtkObject *a11y;
GSList *list, *iter;
gchar *uid;
@@ -389,6 +390,8 @@ memo_shell_sidebar_constructed (GObject *object)
widget = e_calendar_selector_new (source_list);
e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE);
gtk_container_add (container, widget);
+ a11y = gtk_widget_get_accessible (widget);
+ atk_object_set_name (a11y, _("Memo List Selector"));
priv->selector = g_object_ref (widget);
gtk_widget_show (widget);
diff --git a/calendar/modules/e-memo-shell-view-actions.c b/calendar/modules/e-memo-shell-view-actions.c
index cbbaceaf9c..d6e9387e31 100644
--- a/calendar/modules/e-memo-shell-view-actions.c
+++ b/calendar/modules/e-memo-shell-view-actions.c
@@ -29,6 +29,9 @@ action_gal_save_custom_view_cb (GtkAction *action,
EShellView *shell_view;
GalViewInstance *view_instance;
+ /* All shell views respond to the activation of this action,
+ * which is defined by EShellWindow. But only the currently
+ * active shell view proceeds with saving the custom view. */
shell_view = E_SHELL_VIEW (memo_shell_view);
if (!e_shell_view_is_active (shell_view))
return;
@@ -47,6 +50,7 @@ action_memo_clipboard_copy_cb (GtkAction *action,
memo_shell_content = memo_shell_view->priv->memo_shell_content;
memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+
e_memo_table_copy_clipboard (memo_table);
}
@@ -59,6 +63,7 @@ action_memo_clipboard_cut_cb (GtkAction *action,
memo_shell_content = memo_shell_view->priv->memo_shell_content;
memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+
e_memo_table_cut_clipboard (memo_table);
}
@@ -71,6 +76,7 @@ action_memo_clipboard_paste_cb (GtkAction *action,
memo_shell_content = memo_shell_view->priv->memo_shell_content;
memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+
e_memo_table_paste_clipboard (memo_table);
}
@@ -384,6 +390,7 @@ action_memo_open_url_cb (GtkAction *action,
list = e_memo_table_get_selected (memo_table);
g_return_if_fail (list != NULL);
comp_data = list->data;
+ g_slist_free (list);
/* XXX We only open the URI of the first selected memo. */
prop = icalcomponent_get_first_property (
@@ -464,6 +471,7 @@ action_memo_save_as_cb (GtkAction *action,
if (filename == NULL)
return;
+ /* XXX We only save the first selected memo. */
string = e_cal_get_component_as_string (
comp_data->client, comp_data->icalcomp);
if (string == NULL) {
@@ -483,6 +491,9 @@ action_search_execute_cb (GtkAction *action,
{
EShellView *shell_view;
+ /* All shell views respond to the activation of this action,
+ * which is defined by EShellWindow. But only the currently
+ * active shell view proceeds with executing the search. */
shell_view = E_SHELL_VIEW (memo_shell_view);
if (!e_shell_view_is_active (shell_view))
return;
@@ -523,7 +534,7 @@ static GtkActionEntry memo_entries[] = {
{ "memo-delete",
GTK_STOCK_DELETE,
- N_("Delete Memo"),
+ N_("_Delete Memo"),
NULL,
N_("Delete selected memos"),
G_CALLBACK (action_memo_delete_cb) },
@@ -678,7 +689,7 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view)
EShellView *shell_view;
EShellWindow *shell_window;
GtkActionGroup *action_group;
- GtkUIManager *manager;
+ GtkUIManager *ui_manager;
GConfBridge *bridge;
GtkAction *action;
GObject *object;
@@ -687,7 +698,7 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view)
shell_view = E_SHELL_VIEW (memo_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- manager = e_shell_window_get_ui_manager (shell_window);
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
domain = GETTEXT_PACKAGE;
action_group = memo_shell_view->priv->memo_actions;
@@ -703,7 +714,7 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view)
G_N_ELEMENTS (memo_search_entries),
MEMO_SEARCH_SUMMARY_CONTAINS,
NULL, NULL);
- gtk_ui_manager_insert_action_group (manager, action_group, 0);
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
/* Bind GObject properties to GConf keys. */
diff --git a/calendar/modules/e-memo-shell-view-private.c b/calendar/modules/e-memo-shell-view-private.c
index 4c2312a9d2..183d48a5b0 100644
--- a/calendar/modules/e-memo-shell-view-private.c
+++ b/calendar/modules/e-memo-shell-view-private.c
@@ -178,7 +178,6 @@ e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view)
EMemoShellContent *memo_shell_content;
EMemoShellSidebar *memo_shell_sidebar;
EShellView *shell_view;
- EShellWindow *shell_window;
EShellContent *shell_content;
EShellSidebar *shell_sidebar;
EMemoTable *memo_table;
@@ -187,7 +186,6 @@ e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view)
ESourceSelector *selector;
shell_view = E_SHELL_VIEW (memo_shell_view);
- shell_window = e_shell_view_get_shell_window (shell_view);
shell_content = e_shell_view_get_shell_content (shell_view);
shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
diff --git a/calendar/modules/e-memo-shell-view.c b/calendar/modules/e-memo-shell-view.c
index 17a28fb0d8..72427107d3 100644
--- a/calendar/modules/e-memo-shell-view.c
+++ b/calendar/modules/e-memo-shell-view.c
@@ -81,8 +81,8 @@ memo_shell_view_update_actions (EShellView *shell_view)
EMemoShellSidebar *memo_shell_sidebar;
EShellWindow *shell_window;
ESourceSelector *selector;
- ETable *table;
EMemoTable *memo_table;
+ ETable *table;
ESource *source;
GtkAction *action;
GSList *list, *iter;
@@ -179,7 +179,7 @@ memo_shell_view_update_actions (EShellView *shell_view)
}
static void
-memo_shell_view_class_init (EMemoShellView *class,
+memo_shell_view_class_init (EMemoShellViewClass *class,
GTypeModule *type_module)
{
GObjectClass *object_class;
diff --git a/calendar/modules/e-task-shell-module.c b/calendar/modules/e-task-shell-module.c
index c5f268d131..9ed38b0cad 100644
--- a/calendar/modules/e-task-shell-module.c
+++ b/calendar/modules/e-task-shell-module.c
@@ -486,10 +486,9 @@ e_shell_module_init (GTypeModule *type_module)
shell_module = E_SHELL_MODULE (type_module);
shell = e_shell_module_get_shell (shell_module);
- /* Register the GType for ETaskShellView. */
- e_task_shell_view_get_type (type_module);
-
- e_shell_module_set_info (shell_module, &module_info);
+ e_shell_module_set_info (
+ shell_module, &module_info,
+ e_task_shell_view_get_type (type_module));
task_module_ensure_sources (shell_module);
diff --git a/calendar/modules/e-task-shell-sidebar.c b/calendar/modules/e-task-shell-sidebar.c
index e36c05b879..6a84ef3179 100644
--- a/calendar/modules/e-task-shell-sidebar.c
+++ b/calendar/modules/e-task-shell-sidebar.c
@@ -360,6 +360,7 @@ task_shell_sidebar_constructed (GObject *object)
GtkContainer *container;
GtkTreeModel *model;
GtkWidget *widget;
+ AtkObject *a11y;
GSList *list, *iter;
gchar *uid;
@@ -389,6 +390,8 @@ task_shell_sidebar_constructed (GObject *object)
widget = e_calendar_selector_new (source_list);
e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE);
gtk_container_add (container, widget);
+ a11y = gtk_widget_get_accessible (widget);
+ atk_object_set_name (a11y, _("Task List Selector"));
priv->selector = g_object_ref (widget);
gtk_widget_show (widget);
diff --git a/calendar/modules/e-task-shell-view-actions.c b/calendar/modules/e-task-shell-view-actions.c
index fe7331b4be..805089ea8b 100644
--- a/calendar/modules/e-task-shell-view-actions.c
+++ b/calendar/modules/e-task-shell-view-actions.c
@@ -29,6 +29,9 @@ action_gal_save_custom_view_cb (GtkAction *action,
EShellView *shell_view;
GalViewInstance *view_instance;
+ /* All shell views respond to the activation of this action,
+ * which is defined by EShellWindow. But only the currently
+ * active shell view proceeds with saving the custom view. */
shell_view = E_SHELL_VIEW (task_shell_view);
if (!e_shell_view_is_active (shell_view))
return;
@@ -44,6 +47,9 @@ action_search_execute_cb (GtkAction *action,
{
EShellView *shell_view;
+ /* All shell views respond to the activation of this action,
+ * which is defined by EShellWindow. But only the currently
+ * active shell view proceeds with executing the search. */
shell_view = E_SHELL_VIEW (task_shell_view);
if (!e_shell_view_is_active (shell_view))
return;
@@ -91,6 +97,7 @@ action_task_clipboard_copy_cb (GtkAction *action,
task_shell_content = task_shell_view->priv->task_shell_content;
task_table = e_task_shell_content_get_task_table (task_shell_content);
+
e_calendar_table_copy_clipboard (task_table);
}
@@ -103,6 +110,7 @@ action_task_clipboard_cut_cb (GtkAction *action,
task_shell_content = task_shell_view->priv->task_shell_content;
task_table = e_task_shell_content_get_task_table (task_shell_content);
+
e_calendar_table_cut_clipboard (task_table);
}
@@ -115,6 +123,7 @@ action_task_clipboard_paste_cb (GtkAction *action,
task_shell_content = task_shell_view->priv->task_shell_content;
task_table = e_task_shell_content_get_task_table (task_shell_content);
+
e_calendar_table_paste_clipboard (task_table);
}
@@ -535,6 +544,50 @@ static void
action_task_purge_cb (GtkAction *action,
ETaskShellView *task_shell_view)
{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ GtkWidget *dialog;
+ GtkWidget *widget;
+ gboolean active;
+ gint response;
+
+ shell_view = E_SHELL_VIEW (task_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ if (!calendar_config_get_confirm_purge ())
+ goto purge;
+
+ /* XXX This needs reworked. The dialog looks like ass. */
+
+ dialog = gtk_message_dialog_new (
+ GTK_WINDOW (shell_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_YES_NO,
+ "%s", _("This operation will permanently erase all tasks "
+ "marked as completed. If you continue, you will not be able "
+ "to recover these tasks.\n\nReally erase these tasks?"));
+
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_NO);
+
+ widget = gtk_check_button_new_with_label (_("Do not ask me again"));
+ gtk_box_pack_start (
+ GTK_BOX (GTK_DIALOG (dialog)->vbox), widget, TRUE, TRUE, 6);
+ gtk_widget_show (widget);
+
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+ active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+ gtk_widget_destroy (dialog);
+
+ if (response != GTK_RESPONSE_YES)
+ return;
+
+ if (active)
+ calendar_config_set_confirm_purge (FALSE);
+
+purge:
+
+ /* FIXME */
}
static void
@@ -825,7 +878,7 @@ e_task_shell_view_actions_init (ETaskShellView *task_shell_view)
EShellView *shell_view;
EShellWindow *shell_window;
GtkActionGroup *action_group;
- GtkUIManager *manager;
+ GtkUIManager *ui_manager;
GConfBridge *bridge;
GtkAction *action;
GObject *object;
@@ -834,7 +887,7 @@ e_task_shell_view_actions_init (ETaskShellView *task_shell_view)
shell_view = E_SHELL_VIEW (task_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- manager = e_shell_window_get_ui_manager (shell_window);
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
domain = GETTEXT_PACKAGE;
action_group = task_shell_view->priv->task_actions;
@@ -850,7 +903,7 @@ e_task_shell_view_actions_init (ETaskShellView *task_shell_view)
G_N_ELEMENTS (task_search_entries),
TASK_SEARCH_SUMMARY_CONTAINS,
NULL, NULL);
- gtk_ui_manager_insert_action_group (manager, action_group, 0);
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
/* Bind GObject properties to GConf keys. */
diff --git a/calendar/modules/e-task-shell-view-private.c b/calendar/modules/e-task-shell-view-private.c
index bd48cf3f23..754f6fe4c6 100644
--- a/calendar/modules/e-task-shell-view-private.c
+++ b/calendar/modules/e-task-shell-view-private.c
@@ -178,7 +178,6 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view)
ETaskShellContent *task_shell_content;
ETaskShellSidebar *task_shell_sidebar;
EShellView *shell_view;
- EShellWindow *shell_window;
EShellContent *shell_content;
EShellSidebar *shell_sidebar;
ECalendarTable *task_table;
@@ -187,7 +186,6 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view)
ESourceSelector *selector;
shell_view = E_SHELL_VIEW (task_shell_view);
- shell_window = e_shell_view_get_shell_window (shell_view);
shell_content = e_shell_view_get_shell_content (shell_view);
shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
diff --git a/calendar/modules/e-task-shell-view.c b/calendar/modules/e-task-shell-view.c
index 8ff7e16c91..9fc0643a14 100644
--- a/calendar/modules/e-task-shell-view.c
+++ b/calendar/modules/e-task-shell-view.c
@@ -148,6 +148,7 @@ task_shell_view_update_actions (EShellView *shell_view)
action = ACTION (TASK_ASSIGN);
sensitive = (n_selected == 1) && editable && assignable;
+ gtk_action_set_sensitive (action, sensitive);
action = ACTION (TASK_CLIPBOARD_COPY);
sensitive = (n_selected > 0);
@@ -213,7 +214,7 @@ task_shell_view_update_actions (EShellView *shell_view)
}
static void
-task_shell_view_class_init (ETaskShellView *class,
+task_shell_view_class_init (ETaskShellViewClass *class,
GTypeModule *type_module)
{
GObjectClass *object_class;