aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/Makefile.am2
-rw-r--r--calendar/gui/Makefile.am379
-rw-r--r--calendar/gui/calendar-component.c57
-rw-r--r--calendar/gui/comp-editor-factory.c4
-rw-r--r--calendar/gui/dialogs/comp-editor.c41
-rw-r--r--calendar/gui/dialogs/comp-editor.h3
-rw-r--r--calendar/gui/e-cal-component-memo-preview.h66
-rw-r--r--calendar/gui/e-cal-model.c8
-rw-r--r--calendar/gui/e-calendar-selector.c63
-rw-r--r--calendar/gui/e-calendar-table-config.c282
-rw-r--r--calendar/gui/e-calendar-table-config.h46
-rw-r--r--calendar/gui/e-calendar-table.c713
-rw-r--r--calendar/gui/e-calendar-table.h113
-rw-r--r--calendar/gui/e-calendar-view.c5
-rw-r--r--calendar/gui/e-meeting-time-sel.c1
-rw-r--r--calendar/gui/e-memo-preview.c (renamed from calendar/gui/e-cal-component-memo-preview.c)196
-rw-r--r--calendar/gui/e-memo-preview.h84
-rw-r--r--calendar/gui/e-memo-shell-view-private.c85
-rw-r--r--calendar/gui/e-memo-table.c265
-rw-r--r--calendar/gui/e-memo-table.h90
-rw-r--r--calendar/gui/e-memos.c436
-rw-r--r--calendar/gui/e-select-names-renderer.c4
-rw-r--r--calendar/gui/e-task-shell-view-private.c59
-rw-r--r--calendar/gui/e-tasks.c10
-rw-r--r--calendar/gui/gnome-cal.c15
-rw-r--r--calendar/gui/main.c2
-rw-r--r--calendar/gui/memos-component.c118
-rw-r--r--calendar/gui/tasks-component.c4
-rw-r--r--calendar/gui/tasks-control.c141
-rw-r--r--calendar/modules/e-cal-shell-module.c (renamed from calendar/gui/e-cal-shell-module.c)0
-rw-r--r--calendar/modules/e-cal-shell-sidebar.c (renamed from calendar/gui/e-cal-shell-sidebar.c)0
-rw-r--r--calendar/modules/e-cal-shell-sidebar.h (renamed from calendar/gui/e-cal-shell-sidebar.h)0
-rw-r--r--calendar/modules/e-cal-shell-view-actions.c (renamed from calendar/gui/e-cal-shell-view-actions.c)0
-rw-r--r--calendar/modules/e-cal-shell-view-actions.h (renamed from calendar/gui/e-cal-shell-view-actions.h)0
-rw-r--r--calendar/modules/e-cal-shell-view-private.c (renamed from calendar/gui/e-cal-shell-view-private.c)14
-rw-r--r--calendar/modules/e-cal-shell-view-private.h (renamed from calendar/gui/e-cal-shell-view-private.h)5
-rw-r--r--calendar/modules/e-cal-shell-view.c (renamed from calendar/gui/e-cal-shell-view.c)5
-rw-r--r--calendar/modules/e-cal-shell-view.h (renamed from calendar/gui/e-cal-shell-view.h)0
-rw-r--r--calendar/modules/e-memo-shell-content.c550
-rw-r--r--calendar/modules/e-memo-shell-content.h83
-rw-r--r--calendar/modules/e-memo-shell-module.c (renamed from calendar/gui/e-memo-shell-module.c)13
-rw-r--r--calendar/modules/e-memo-shell-sidebar.c (renamed from calendar/gui/e-memo-shell-sidebar.c)21
-rw-r--r--calendar/modules/e-memo-shell-sidebar.h (renamed from calendar/gui/e-memo-shell-sidebar.h)9
-rw-r--r--calendar/modules/e-memo-shell-view-actions.c (renamed from calendar/gui/e-memo-shell-view-actions.c)88
-rw-r--r--calendar/modules/e-memo-shell-view-actions.h (renamed from calendar/gui/e-memo-shell-view-actions.h)0
-rw-r--r--calendar/modules/e-memo-shell-view-private.c316
-rw-r--r--calendar/modules/e-memo-shell-view-private.h (renamed from calendar/gui/e-memo-shell-view-private.h)34
-rw-r--r--calendar/modules/e-memo-shell-view.c (renamed from calendar/gui/e-memo-shell-view.c)6
-rw-r--r--calendar/modules/e-memo-shell-view.h (renamed from calendar/gui/e-memo-shell-view.h)2
-rw-r--r--calendar/modules/e-task-shell-content.c550
-rw-r--r--calendar/modules/e-task-shell-content.h76
-rw-r--r--calendar/modules/e-task-shell-module.c (renamed from calendar/gui/e-task-shell-module.c)11
-rw-r--r--calendar/modules/e-task-shell-sidebar.c (renamed from calendar/gui/e-task-shell-sidebar.c)17
-rw-r--r--calendar/modules/e-task-shell-sidebar.h (renamed from calendar/gui/e-task-shell-sidebar.h)4
-rw-r--r--calendar/modules/e-task-shell-view-actions.c (renamed from calendar/gui/e-task-shell-view-actions.c)69
-rw-r--r--calendar/modules/e-task-shell-view-actions.h (renamed from calendar/gui/e-task-shell-view-actions.h)0
-rw-r--r--calendar/modules/e-task-shell-view-private.c141
-rw-r--r--calendar/modules/e-task-shell-view-private.h (renamed from calendar/gui/e-task-shell-view-private.h)23
-rw-r--r--calendar/modules/e-task-shell-view.c (renamed from calendar/gui/e-task-shell-view.c)5
-rw-r--r--calendar/modules/e-task-shell-view.h (renamed from calendar/gui/e-task-shell-view.h)2
60 files changed, 3276 insertions, 2060 deletions
diff --git a/calendar/Makefile.am b/calendar/Makefile.am
index f9a54aff06..1083f27bbb 100644
--- a/calendar/Makefile.am
+++ b/calendar/Makefile.am
@@ -4,7 +4,7 @@ else
CONDUIT_DIR =
endif
-SUBDIRS = idl common importers gui $(CONDUIT_DIR)
+SUBDIRS = idl common importers gui $(CONDUIT_DIR) modules
error_DATA = calendar.error
errordir = $(privdatadir)/errors
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 84b7bd25dc..0651f0253f 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -34,61 +34,6 @@ INCLUDES = \
$(LIBSOUP_CFLAGS) \
$(EVOLUTION_CALENDAR_CFLAGS)
-module_LTLIBRARIES = \
- libevolution-calendar.la \
- libevolution-memos.la \
- libevolution-tasks.la
-
-libevolution_calendar_la_SOURCES = \
- calendar-config-keys.h \
- calendar-config.c \
- calendar-config.h \
- e-cal-shell-module.c \
- e-cal-shell-sidebar.c \
- e-cal-shell-sidebar.h \
- e-cal-shell-view-actions.c \
- e-cal-shell-view-actions.h \
- e-cal-shell-view-private.c \
- e-cal-shell-view-private.h \
- e-cal-shell-view.c \
- e-cal-shell-view.h \
- e-calendar-selector.c \
- e-calendar-selector.h
-
-libevolution_memos_la_SOURCES = \
- calendar-config-keys.h \
- calendar-config.c \
- calendar-config.h \
- e-calendar-selector.c \
- e-calendar-selector.h \
- e-memo-shell-module.c \
- e-memo-shell-sidebar.c \
- e-memo-shell-sidebar.h \
- e-memo-shell-view-actions.c \
- e-memo-shell-view-actions.h \
- e-memo-shell-view-private.c \
- e-memo-shell-view-private.h \
- e-memo-shell-view.c \
- e-memo-shell-view.h \
- e-memos.c \
- e-memos.h
-
-libevolution_tasks_la_SOURCES = \
- calendar-config-keys.h \
- calendar-config.c \
- calendar-config.h \
- e-calendar-selector.c \
- e-calendar-selector.h \
- e-task-shell-module.c \
- e-task-shell-sidebar.c \
- e-task-shell-sidebar.h \
- e-task-shell-view-actions.c \
- e-task-shell-view-actions.h \
- e-task-shell-view-private.c \
- e-task-shell-view-private.h \
- e-task-shell-view.c \
- e-task-shell-view.h
-
glade_DATA = \
e-itip-control.glade \
goto-dialog.glade
@@ -99,182 +44,150 @@ etspec_DATA = \
e-cal-list-view.etspec \
e-memo-table.etspec
-#libevolution_calendar_la_SOURCES = \
-# cal-search-bar.c \
-# cal-search-bar.h \
-# calendar-config.c \
-# calendar-config.h \
-# calendar-config-keys.h \
-# calendar-commands.c \
-# calendar-commands.h \
-# calendar-component.c \
-# calendar-component.h \
-# calendar-view.c \
-# calendar-view.h \
-# calendar-view-factory.c \
-# calendar-view-factory.h \
-# comp-editor-factory.c \
-# comp-editor-factory.h \
-# comp-util.c \
-# comp-util.h \
-# control-factory.c \
-# control-factory.h \
-# e-alarm-list.c \
-# e-alarm-list.h \
-# e-cal-component-preview.c \
-# e-cal-component-preview.h \
-# e-cal-component-memo-preview.c \
-# e-cal-component-memo-preview.h \
-# e-cal-config.c \
-# e-cal-config.h \
-# e-cal-event.c \
-# e-cal-event.h \
-# e-cal-menu.c \
-# e-cal-menu.h \
-# e-cal-model-calendar.h \
-# e-cal-model-calendar.c \
-# e-cal-model-calendar.h \
-# e-cal-model-tasks.c \
-# e-cal-model-tasks.h \
-# e-cal-model.c \
-# e-cal-model.h \
-# e-cal-popup.h \
-# e-cal-popup.c \
-# e-calendar-view.c \
-# e-calendar-view.h \
-# e-cal-list-view.c \
-# e-cal-list-view.h \
-# e-cal-list-view-config.c \
-# e-cal-list-view-config.h \
-# e-cal-model-memos.c \
-# e-cal-model-memos.h \
-# e-calendar-table.c \
-# e-calendar-table.h \
-# e-calendar-table-config.c \
-# e-calendar-table-config.h \
-# e-cell-date-edit-config.c \
-# e-cell-date-edit-config.h \
-# e-cell-date-edit-text.h \
-# e-cell-date-edit-text.c \
-# e-comp-editor-registry.c \
-# e-comp-editor-registry.h \
-# e-date-edit-config.c \
-# e-date-edit-config.h \
-# e-date-time-list.c \
-# e-date-time-list.h \
-# e-day-view-config.c \
-# e-day-view-config.h \
-# e-day-view-layout.c \
-# e-day-view-layout.h \
-# e-day-view-main-item.c \
-# e-day-view-main-item.h \
-# e-day-view-time-item.c \
-# e-day-view-time-item.h \
-# e-day-view-top-item.c \
-# e-day-view-top-item.h \
-# e-day-view.c \
-# e-day-view.h \
-# e-itip-control.h \
-# e-itip-control.c \
-# e-meeting-attendee.c \
-# e-meeting-attendee.h \
-# e-meeting-list-view.c \
-# e-meeting-list-view.h \
-# e-meeting-store.c \
-# e-meeting-store.h \
-# e-meeting-time-sel.c \
-# e-meeting-time-sel.h \
-# e-meeting-time-sel-item.c \
-# e-meeting-time-sel-item.h \
-# e-meeting-types.h \
-# e-meeting-utils.c \
-# e-meeting-utils.h \
-# e-memo-table.c \
-# e-memo-table.h \
-# e-memo-table-config.c \
-# e-memo-table-config.h \
-# e-memos.c \
-# e-memos.h \
-# e-mini-calendar-config.c \
-# e-mini-calendar-config.h \
-# e-select-names-editable.c \
-# e-select-names-editable.h \
-# e-select-names-renderer.c \
-# e-select-names-renderer.h \
-# e-week-view-config.c \
-# e-week-view-config.h \
-# e-week-view-event-item.c \
-# e-week-view-event-item.h \
-# e-week-view-layout.c \
-# e-week-view-layout.h \
-# e-week-view-main-item.c \
-# e-week-view-main-item.h \
-# e-week-view-titles-item.c \
-# e-week-view-titles-item.h \
-# e-week-view.c \
-# e-week-view.h \
-# e-tasks.c \
-# e-tasks.h \
-# e-timezone-entry.c \
-# e-timezone-entry.h \
-# gnome-cal.c \
-# gnome-cal.h \
-# goto.c \
-# goto.h \
-# itip-bonobo-control.c \
-# itip-bonobo-control.h \
-# itip-utils.c \
-# itip-utils.h \
-# main.c \
-# memos-component.c \
-# memos-component.h \
-# migration.c \
-# migration.h \
-# misc.c \
-# misc.h \
-# print.c \
-# print.h \
-# tag-calendar.c \
-# tag-calendar.h \
-# tasks-component.c \
-# tasks-component.h \
-# tasks-control.c \
-# tasks-control.h \
-# weekday-picker.c \
-# weekday-picker.h
-
-libevolution_calendar_la_LIBADD = \
- $(WIN32_BOOTSTRAP_LIBS) \
- $(top_builddir)/widgets/menus/libmenus.la \
- $(top_builddir)/shell/libeshell.la \
- $(top_builddir)/calendar/common/libevolution-calendarprivate.la \
- $(top_builddir)/calendar/gui/dialogs/libcal-dialogs.la \
- $(top_builddir)/calendar/importers/libevolution-calendar-importers.la \
- $(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.la \
- $(top_builddir)/widgets/misc/libemiscwidgets.la \
- $(top_builddir)/filter/libfilter.la \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/a11y/calendar/libevolution-calendar-a11y.la \
- $(LIBSOUP_LIBS) \
- $(CAMEL_LIBS) \
- $(EVOLUTION_CALENDAR_LIBS)
-
-libevolution_memos_la_LIBADD = \
- $(WIN32_BOOTSTRAP_LIBS) \
- $(top_builddir)/widgets/menus/libmenus.la \
- $(top_builddir)/shell/libeshell.la \
- $(top_builddir)/calendar/common/libevolution-calendarprivate.la \
- $(top_builddir)/calendar/gui/dialogs/libcal-dialogs.la \
- $(top_builddir)/calendar/importers/libevolution-calendar-importers.la \
- $(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.la \
- $(top_builddir)/widgets/misc/libemiscwidgets.la \
- $(top_builddir)/filter/libfilter.la \
- $(top_builddir)/e-util/libeutil.la \
- $(LIBSOUP_LIBS) \
- $(CAMEL_LIBS) \
- $(EVOLUTION_CALENDAR_LIBS)
-
-libevolution_tasks_la_LIBADD = \
+privsolib_LTLIBRARIES = libcal-gui.la
+
+# Removed from SOURCES
+# cal-search-bar.c
+# cal-search-bar.h
+# calendar-commands.c
+# calendar-commands.h
+# comp-editor-factory.c
+# comp-editor-factory.h
+# e-calendar-view.c
+# e-calendar-view.h
+# e-calendar-table.c
+# e-calendar-table.h
+# e-memos.c
+# e-memos.h
+# e-tasks.c
+# e-tasks.h
+# gnome-cal.c
+# gnome-cal.h
+# main.c
+# migration.c
+# migration.h
+# tasks-control.c
+# tasks-control.h
+
+libcal_gui_la_SOURCES = \
+ calendar-config.c \
+ calendar-config.h \
+ calendar-config-keys.h \
+ calendar-view.c \
+ calendar-view.h \
+ calendar-view-factory.c \
+ calendar-view-factory.h \
+ comp-util.c \
+ comp-util.h \
+ control-factory.c \
+ control-factory.h \
+ e-alarm-list.c \
+ e-alarm-list.h \
+ e-cal-component-preview.c \
+ e-cal-component-preview.h \
+ e-cal-config.c \
+ e-cal-config.h \
+ e-cal-event.c \
+ e-cal-event.h \
+ e-cal-menu.c \
+ e-cal-menu.h \
+ e-cal-model-calendar.h \
+ e-cal-model-calendar.c \
+ e-cal-model-calendar.h \
+ e-cal-model-tasks.c \
+ e-cal-model-tasks.h \
+ e-cal-model.c \
+ e-cal-model.h \
+ e-cal-popup.h \
+ e-cal-popup.c \
+ e-cal-list-view.c \
+ e-cal-list-view.h \
+ e-cal-list-view-config.c \
+ e-cal-list-view-config.h \
+ e-cal-model-memos.c \
+ e-cal-model-memos.h \
+ e-calendar-table-config.c \
+ e-calendar-table-config.h \
+ e-cell-date-edit-config.c \
+ e-cell-date-edit-config.h \
+ e-cell-date-edit-text.h \
+ e-cell-date-edit-text.c \
+ e-comp-editor-registry.c \
+ e-comp-editor-registry.h \
+ e-date-edit-config.c \
+ e-date-edit-config.h \
+ e-date-time-list.c \
+ e-date-time-list.h \
+ e-day-view-config.c \
+ e-day-view-config.h \
+ e-day-view-layout.c \
+ e-day-view-layout.h \
+ e-day-view-main-item.c \
+ e-day-view-main-item.h \
+ e-day-view-time-item.c \
+ e-day-view-time-item.h \
+ e-day-view-top-item.c \
+ e-day-view-top-item.h \
+ e-day-view.c \
+ e-day-view.h \
+ e-itip-control.h \
+ e-itip-control.c \
+ e-meeting-attendee.c \
+ e-meeting-attendee.h \
+ e-meeting-list-view.c \
+ e-meeting-list-view.h \
+ e-meeting-store.c \
+ e-meeting-store.h \
+ e-meeting-time-sel.c \
+ e-meeting-time-sel.h \
+ e-meeting-time-sel-item.c \
+ e-meeting-time-sel-item.h \
+ e-meeting-types.h \
+ e-meeting-utils.c \
+ e-meeting-utils.h \
+ e-memo-table.c \
+ e-memo-table.h \
+ e-memo-table-config.c \
+ e-memo-table-config.h \
+ e-mini-calendar-config.c \
+ e-mini-calendar-config.h \
+ e-select-names-editable.c \
+ e-select-names-editable.h \
+ e-select-names-renderer.c \
+ e-select-names-renderer.h \
+ e-week-view-config.c \
+ e-week-view-config.h \
+ e-week-view-event-item.c \
+ e-week-view-event-item.h \
+ e-week-view-layout.c \
+ e-week-view-layout.h \
+ e-week-view-main-item.c \
+ e-week-view-main-item.h \
+ e-week-view-titles-item.c \
+ e-week-view-titles-item.h \
+ e-week-view.c \
+ e-week-view.h \
+ e-timezone-entry.c \
+ e-timezone-entry.h \
+ goto.c \
+ goto.h \
+ itip-bonobo-control.c \
+ itip-bonobo-control.h \
+ itip-utils.c \
+ itip-utils.h \
+ misc.c \
+ misc.h \
+ print.c \
+ print.h \
+ tag-calendar.c \
+ tag-calendar.h \
+ weekday-picker.c \
+ weekday-picker.h
+
+# REMOVED
+# $(top_builddir)/a11y/calendar/libevolution-calendar-a11y.la
+
+libcal_gui_la_LIBADD = \
$(WIN32_BOOTSTRAP_LIBS) \
$(top_builddir)/widgets/menus/libmenus.la \
$(top_builddir)/shell/libeshell.la \
@@ -289,9 +202,7 @@ libevolution_tasks_la_LIBADD = \
$(CAMEL_LIBS) \
$(EVOLUTION_CALENDAR_LIBS)
-libevolution_calendar_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED)
-libevolution_memos_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED)
-libevolution_tasks_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED)
+libcal_gui_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED)
@INTLTOOL_SERVER_RULE@
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index 5f81c81acc..183c339c5e 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -110,9 +110,6 @@ struct _CalendarComponentPrivate {
GList *notifications;
};
-/* FIXME This should be gnome cal likely */
-extern ECompEditorRegistry *comp_editor_registry;
-
static void
calcomp_vpane_realized (GtkWidget *vpane, CalendarComponentView *view)
{
@@ -650,60 +647,6 @@ impl_upgradeFromVersion (PortableServer_Servant servant,
g_error_free(err);
}
-static gboolean
-update_single_object (ECal *client, icalcomponent *icalcomp)
-{
- char *uid;
- icalcomponent *tmp_icalcomp;
-
- uid = (char *) icalcomponent_get_uid (icalcomp);
-
- if (e_cal_get_object (client, uid, NULL, &tmp_icalcomp, NULL))
- return e_cal_modify_object (client, icalcomp, CALOBJ_MOD_ALL, NULL);
-
- return e_cal_create_object (client, icalcomp, &uid, NULL);
-}
-
-static gboolean
-update_objects (ECal *client, icalcomponent *icalcomp)
-{
- icalcomponent *subcomp;
- icalcomponent_kind kind;
-
- kind = icalcomponent_isa (icalcomp);
- if (kind == ICAL_VTODO_COMPONENT || kind == ICAL_VEVENT_COMPONENT)
- return update_single_object (client, icalcomp);
- else if (kind != ICAL_VCALENDAR_COMPONENT)
- return FALSE;
-
- subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT);
- while (subcomp) {
- gboolean success;
-
- kind = icalcomponent_isa (subcomp);
- if (kind == ICAL_VTIMEZONE_COMPONENT) {
- icaltimezone *zone;
-
- zone = icaltimezone_new ();
- icaltimezone_set_component (zone, subcomp);
-
- success = e_cal_add_timezone (client, zone, NULL);
- icaltimezone_free (zone, 1);
- if (!success)
- return success;
- } else if (kind == ICAL_VTODO_COMPONENT ||
- kind == ICAL_VEVENT_COMPONENT) {
- success = update_single_object (client, subcomp);
- if (!success)
- return success;
- }
-
- subcomp = icalcomponent_get_next_component (icalcomp, ICAL_ANY_COMPONENT);
- }
-
- return TRUE;
-}
-
static void
config_create_ecal_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
{
diff --git a/calendar/gui/comp-editor-factory.c b/calendar/gui/comp-editor-factory.c
index 508714dbc3..cd0f49517a 100644
--- a/calendar/gui/comp-editor-factory.c
+++ b/calendar/gui/comp-editor-factory.c
@@ -36,10 +36,6 @@
#include "dialogs/event-editor.h"
#include "dialogs/task-editor.h"
-extern ECompEditorRegistry *comp_editor_registry;
-
-
-
/* A pending request */
typedef enum {
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index ee5ad096d0..430b559948 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -214,7 +214,15 @@ enum {
LAST_SIGNAL
};
-static guint comp_editor_signals[LAST_SIGNAL] = { 0 };
+static guint signals[LAST_SIGNAL];
+static GList *active_editors;
+
+static void
+comp_editor_weak_notify_cb (gpointer unused,
+ GObject *where_the_object_was)
+{
+ active_editors = g_list_remove (active_editors, where_the_object_was);
+}
static void
attach_message(CompEditor *editor, CamelMimeMessage *msg)
@@ -1704,7 +1712,7 @@ comp_editor_class_init (CompEditorClass *class)
NULL,
G_PARAM_READWRITE));
- comp_editor_signals[OBJECT_CREATED] =
+ signals[OBJECT_CREATED] =
g_signal_new ("object_created",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
@@ -1724,6 +1732,12 @@ comp_editor_init (CompEditor *editor)
editor->priv = priv = COMP_EDITOR_GET_PRIVATE (editor);
+ g_object_weak_ref (
+ G_OBJECT (editor), (GWeakNotify)
+ comp_editor_weak_notify_cb, NULL);
+
+ active_editors = g_list_prepend (active_editors, editor);
+
priv->pages = NULL;
priv->changed = FALSE;
priv->needs_send = FALSE;
@@ -2279,7 +2293,18 @@ close_dialog (CompEditor *editor)
gtk_widget_destroy (GTK_WIDGET (editor));
}
-
+gint
+comp_editor_compare (CompEditor *editor_a,
+ CompEditor *editor_b)
+{
+ const gchar *uid_a = NULL;
+ const gchar *uid_b = NULL;
+
+ e_cal_component_get_uid (editor_a->priv->comp, &uid_a);
+ e_cal_component_get_uid (editor_b->priv->comp, &uid_b);
+
+ return g_strcmp0 (uid_a, uid_b);
+}
void
comp_editor_set_existing_org (CompEditor *editor, gboolean existing_org)
@@ -2547,6 +2572,16 @@ comp_editor_get_managed_widget (CompEditor *editor,
return widget;
}
+CompEditor *
+comp_editor_find_instance (const gchar *uid)
+{
+ g_return_val_if_fail (uid != NULL, NULL);
+
+ return g_list_find_custom (
+ active_editors, uid,
+ (GCompareFunc) comp_editor_compare);
+}
+
/**
* comp_editor_set_needs_send:
* @editor: A component editor
diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h
index 9289b9ced7..23a8d3acea 100644
--- a/calendar/gui/dialogs/comp-editor.h
+++ b/calendar/gui/dialogs/comp-editor.h
@@ -87,6 +87,8 @@ typedef enum {
} CompEditorFlags;
GType comp_editor_get_type (void);
+gint comp_editor_compare (CompEditor *editor_a,
+ CompEditor *editor_b);
void comp_editor_set_changed (CompEditor *editor,
gboolean changed);
gboolean comp_editor_get_changed (CompEditor *editor);
@@ -149,6 +151,7 @@ GtkActionGroup *
const gchar *group_name);
GtkWidget * comp_editor_get_managed_widget (CompEditor *editor,
const gchar *widget_path);
+CompEditor * comp_editor_find_instance (const gchar *uid);
G_END_DECLS
diff --git a/calendar/gui/e-cal-component-memo-preview.h b/calendar/gui/e-cal-component-memo-preview.h
deleted file mode 100644
index 144e54fe5c..0000000000
--- a/calendar/gui/e-cal-component-memo-preview.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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/>
- *
- *
- * Authors:
- * Federico Mena Quintero <federico@ximian.com>
- * Damon Chaplin <damon@ximian.com>
- * Nathan Owens <pianocomp81@yahoo.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_CAL_COMPONENT_MEMO_PREVIEW_H_
-#define _E_CAL_COMPONENT_MEMO_PREVIEW_H_
-
-#include <gtk/gtk.h>
-#include <libecal/e-cal.h>
-
-#define E_TYPE_CAL_COMPONENT_MEMO_PREVIEW (e_cal_component_memo_preview_get_type ())
-#define E_CAL_COMPONENT_MEMO_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CAL_COMPONENT_MEMO_PREVIEW, ECalComponentMemoPreview))
-#define E_CAL_COMPONENT_MEMO_PREVIEW_CLASS(klass) (G_TYPE_CHECK_INSTANCE_CAST_CLASS ((klass), E_TYPE_CAL_COMPONENT_MEMO_PREVIEW, \
- ECalComponentMemoPreviewClass))
-#define E_IS_CAL_COMPONENT_MEMO_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CAL_COMPONENT_MEMO_PREVIEW))
-#define E_IS_CAL_COMPONENT_MEMO_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CAL_COMPONENT_MEMO_PREVIEW))
-
-typedef struct _ECalComponentMemoPreview ECalComponentMemoPreview;
-typedef struct _ECalComponentMemoPreviewClass ECalComponentMemoPreviewClass;
-typedef struct _ECalComponentMemoPreviewPrivate ECalComponentMemoPreviewPrivate;
-
-struct _ECalComponentMemoPreview {
- GtkTable table;
-
- /* Private data */
- ECalComponentMemoPreviewPrivate *priv;
-};
-
-struct _ECalComponentMemoPreviewClass {
- GtkTableClass parent_class;
-
- /* Notification signals */
- void (* selection_changed) (ECalComponentMemoPreview *preview, int n_selected);
-};
-
-
-GType e_cal_component_memo_preview_get_type (void);
-GtkWidget *e_cal_component_memo_preview_new (void);
-
-icaltimezone *e_cal_component_memo_preview_get_default_timezone (ECalComponentMemoPreview *preview);
-void e_cal_component_memo_preview_set_default_timezone (ECalComponentMemoPreview *preview, icaltimezone *zone);
-
-void e_cal_component_memo_preview_display (ECalComponentMemoPreview *preview, ECal *ecal, ECalComponent *comp);
-void e_cal_component_memo_preview_clear (ECalComponentMemoPreview *preview);
-
-#endif /* _E_CAL_COMPONENT_MEMO_PREVIEW_H_ */
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index 0b476a4bd5..3bd6ae38d8 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -35,8 +35,8 @@
#include "e-cal-model.h"
#include "itip-utils.h"
#include "misc.h"
-#include "e-calendar-marshal.h"
#include "calendar-config.h"
+#include "e-util/e-util.h"
typedef struct {
ECal *client;
@@ -149,7 +149,7 @@ e_cal_model_class_init (ECalModelClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ECalModelClass, time_range_changed),
NULL, NULL,
- e_calendar_marshal_VOID__LONG_LONG,
+ e_marshal_VOID__LONG_LONG,
G_TYPE_NONE, 2, G_TYPE_LONG, G_TYPE_LONG);
signals[ROW_APPENDED] =
@@ -176,7 +176,7 @@ e_cal_model_class_init (ECalModelClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ECalModelClass, cal_view_progress),
NULL, NULL,
- e_calendar_marshal_VOID__STRING_INT_INT,
+ e_marshal_VOID__STRING_INT_INT,
G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT);
signals[CAL_VIEW_DONE] =
g_signal_new ("cal_view_done",
@@ -184,7 +184,7 @@ e_cal_model_class_init (ECalModelClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ECalModelClass, cal_view_done),
NULL, NULL,
- e_calendar_marshal_VOID__INT_INT,
+ e_marshal_VOID__INT_INT,
G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
}
diff --git a/calendar/gui/e-calendar-selector.c b/calendar/gui/e-calendar-selector.c
index b23ef1b32a..b9ebdf7f70 100644
--- a/calendar/gui/e-calendar-selector.c
+++ b/calendar/gui/e-calendar-selector.c
@@ -42,6 +42,67 @@ static GtkTargetEntry drag_types[] = {
static gpointer parent_class;
+static gboolean
+calendar_selector_update_single_object (ECal *client,
+ icalcomponent *icalcomp)
+{
+ gchar *uid;
+ icalcomponent *tmp_icalcomp;
+
+ uid = (gchar *) icalcomponent_get_uid (icalcomp);
+
+ if (e_cal_get_object (client, uid, NULL, &tmp_icalcomp, NULL))
+ return e_cal_modify_object (
+ client, icalcomp, CALOBJ_MOD_ALL, NULL);
+
+ return e_cal_create_object (client, icalcomp, &uid, NULL);
+}
+
+static gboolean
+calendar_selector_update_objects (ECal *client,
+ icalcomponent *icalcomp)
+{
+ icalcomponent *subcomp;
+ icalcomponent_kind kind;
+
+ kind = icalcomponent_isa (icalcomp);
+ if (kind == ICAL_VTODO_COMPONENT || kind == ICAL_VEVENT_COMPONENT)
+ return calendar_selector_update_single_object (
+ client, icalcomp);
+ else if (kind != ICAL_VCALENDAR_COMPONENT)
+ return FALSE;
+
+ subcomp = icalcomponent_get_first_component (
+ icalcomp, ICAL_ANY_COMPONENT);
+ while (subcomp != NULL) {
+ gboolean success;
+
+ kind = icalcomponent_isa (subcomp);
+ if (kind == ICAL_VTIMEZONE_COMPONENT) {
+ icaltimezone *zone;
+
+ zone = icaltimezone_new ();
+ icaltimezone_set_component (zone, subcomp);
+
+ success = e_cal_add_timezone (client, zone, NULL);
+ icaltimezone_free (zone, 1);
+ if (!success)
+ return FALSE;
+ } else if (kind == ICAL_VTODO_COMPONENT ||
+ kind == ICAL_VEVENT_COMPONENT) {
+ success = calendar_selector_update_single_object (
+ client, subcomp);
+ if (!success)
+ return FALSE;
+ }
+
+ subcomp = icalcomponent_get_next_component (
+ icalcomp, ICAL_ANY_COMPONENT);
+ }
+
+ return TRUE;
+}
+
static void
calendar_selector_drag_leave (GtkWidget *widget,
GdkDragContext *context,
@@ -208,7 +269,7 @@ calendar_selector_drag_data_received (GtkWidget *widget,
if (client != NULL) {
if (e_cal_open (client, TRUE, NULL)) {
success = TRUE;
- update_objects (client, icalcomp);
+ calendar_selector_update_objects (client, icalcomp);
}
g_object_unref (client);
diff --git a/calendar/gui/e-calendar-table-config.c b/calendar/gui/e-calendar-table-config.c
index f8a7af9c14..6e43886dbd 100644
--- a/calendar/gui/e-calendar-table-config.c
+++ b/calendar/gui/e-calendar-table-config.c
@@ -24,221 +24,245 @@
#include "e-cell-date-edit-config.h"
#include "e-calendar-table-config.h"
+#define E_CALENDAR_TABLE_CONFIG_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CALENDAR_TABLE_CONFIG, ECalendarTableConfigPrivate))
+
struct _ECalendarTableConfigPrivate {
ECalendarTable *table;
-
ECellDateEditConfig *cell_config;
-
GList *notifications;
};
-/* Property IDs */
-enum props {
+enum {
PROP_0,
PROP_TABLE
};
-G_DEFINE_TYPE (ECalendarTableConfig, e_calendar_table_config, G_TYPE_OBJECT)
+static gpointer parent_class;
static void
-e_calendar_table_config_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+calendar_table_config_set_timezone (ECalendarTable *table)
{
- ECalendarTableConfig *table_config;
-
- table_config = E_CALENDAR_TABLE_CONFIG (object);
+ ECalModel *model;
+ icaltimezone *zone;
- switch (property_id) {
- case PROP_TABLE:
- e_calendar_table_config_set_table (table_config, g_value_get_object (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
+ zone = calendar_config_get_icaltimezone ();
+ model = e_calendar_table_get_model (table);
+ if (model != NULL)
+ e_cal_model_set_timezone (model, zone);
}
static void
-e_calendar_table_config_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+calendar_table_config_timezone_changed_cb (GConfClient *client,
+ guint id,
+ GConfEntry *entry,
+ gpointer data)
{
- ECalendarTableConfig *table_config;
-
- table_config = E_CALENDAR_TABLE_CONFIG (object);
+ ECalendarTableConfig *table_config = data;
- switch (property_id) {
- case PROP_TABLE:
- g_value_set_object (value, e_calendar_table_config_get_table (table_config));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
+ calendar_table_config_set_timezone (table_config->priv->table);
}
static void
-e_calendar_table_config_dispose (GObject *object)
+calendar_table_config_set_twentyfour_hour (ECalendarTable *table)
{
- ECalendarTableConfig *table_config = E_CALENDAR_TABLE_CONFIG (object);
+ ECalModel *model;
+ gboolean use_24_hour;
- e_calendar_table_config_set_table (table_config, NULL);
+ use_24_hour = calendar_config_get_24_hour_format ();
- if (G_OBJECT_CLASS (e_calendar_table_config_parent_class)->dispose)
- G_OBJECT_CLASS (e_calendar_table_config_parent_class)->dispose (object);
+ model = e_calendar_table_get_model (table);
+ if (model != NULL)
+ e_cal_model_set_use_24_hour_format (model, use_24_hour);
}
static void
-e_calendar_table_config_finalize (GObject *object)
+calendar_table_config_twentyfour_hour_changed_cb (GConfClient *client,
+ guint id,
+ GConfEntry *entry,
+ gpointer data)
{
- ECalendarTableConfig *table_config = E_CALENDAR_TABLE_CONFIG (object);
- ECalendarTableConfigPrivate *priv;
-
- priv = table_config->priv;
-
- g_free (priv);
+ ECalendarTableConfig *table_config = data;
- if (G_OBJECT_CLASS (e_calendar_table_config_parent_class)->finalize)
- G_OBJECT_CLASS (e_calendar_table_config_parent_class)->finalize (object);
+ calendar_table_config_set_twentyfour_hour (table_config->priv->table);
}
static void
-e_calendar_table_config_class_init (ECalendarTableConfigClass *klass)
+calendar_table_config_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GParamSpec *spec;
-
- /* Method override */
- gobject_class->set_property = e_calendar_table_config_set_property;
- gobject_class->get_property = e_calendar_table_config_get_property;
- gobject_class->dispose = e_calendar_table_config_dispose;
- gobject_class->finalize = e_calendar_table_config_finalize;
-
- spec = g_param_spec_object ("table", NULL, NULL, e_calendar_table_get_type (),
- G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
- g_object_class_install_property (gobject_class, PROP_TABLE, spec);
+ switch (property_id) {
+ case PROP_TABLE:
+ e_calendar_table_config_set_table (
+ E_CALENDAR_TABLE_CONFIG (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
-e_calendar_table_config_init (ECalendarTableConfig *table_config)
+calendar_table_config_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- table_config->priv = g_new0 (ECalendarTableConfigPrivate, 1);
+ switch (property_id) {
+ case PROP_TABLE:
+ g_value_set_object (
+ value, e_calendar_table_config_get_table (
+ E_CALENDAR_TABLE_CONFIG (object)));
+ return;
+ }
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
-ECalendarTableConfig *
-e_calendar_table_config_new (ECalendarTable *table)
+static void
+calendar_table_config_dispose (GObject *object)
{
- ECalendarTableConfig *table_config;
+ ECalendarTableConfig *table_config = E_CALENDAR_TABLE_CONFIG (object);
- table_config = g_object_new (e_calendar_table_config_get_type (), "table", table, NULL);
+ e_calendar_table_config_set_table (table_config, NULL);
- return table_config;
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
-ECalendarTable *
-e_calendar_table_config_get_table (ECalendarTableConfig *table_config)
+static void
+calendar_table_config_class_init (ECalendarTableConfigClass *class)
{
- ECalendarTableConfigPrivate *priv;
-
- g_return_val_if_fail (table_config != NULL, NULL);
- g_return_val_if_fail (E_IS_CALENDAR_TABLE_CONFIG (table_config), NULL);
-
- priv = table_config->priv;
-
- return priv->table;
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ECalendarTableConfigPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = calendar_table_config_set_property;
+ object_class->get_property = calendar_table_config_get_property;
+ object_class->dispose = calendar_table_config_dispose;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_TABLE,
+ g_param_spec_object (
+ "table",
+ NULL,
+ NULL,
+ E_TYPE_CALENDAR_TABLE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
}
static void
-set_timezone (ECalendarTable *table)
+calendar_table_config_init (ECalendarTableConfig *table_config)
{
- ECalModel *model;
- icaltimezone *zone;
-
- zone = calendar_config_get_icaltimezone ();
- model = e_calendar_table_get_model (table);
- if (model)
- e_cal_model_set_timezone (model, zone);
+ table_config->priv =
+ E_CALENDAR_TABLE_CONFIG_GET_PRIVATE (table_config);
}
-static void
-timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+GType
+e_calendar_table_config_get_type (void)
{
- ECalendarTableConfig *table_config = data;
- ECalendarTableConfigPrivate *priv;
-
- priv = table_config->priv;
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (ECalendarTableConfigClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) calendar_table_config_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ECalendarTableConfig),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) calendar_table_config_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ G_TYPE_OBJECT, "ECalendarTableConfig", &type_info, 0);
+ }
- set_timezone (priv->table);
+ return type;
}
-static void
-set_twentyfour_hour (ECalendarTable *table)
+ECalendarTableConfig *
+e_calendar_table_config_new (ECalendarTable *table)
{
- ECalModel *model;
- gboolean use_24_hour;
+ g_return_val_if_fail (E_IS_CALENDAR_TABLE (table), NULL);
- use_24_hour = calendar_config_get_24_hour_format ();
-
- model = e_calendar_table_get_model (table);
- if (model)
- e_cal_model_set_use_24_hour_format (model, use_24_hour);
+ return g_object_new (
+ E_TYPE_CALENDAR_TABLE_CONFIG,
+ "table", table, NULL);
}
-static void
-twentyfour_hour_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+ECalendarTable *
+e_calendar_table_config_get_table (ECalendarTableConfig *table_config)
{
- ECalendarTableConfig *table_config = data;
- ECalendarTableConfigPrivate *priv;
-
- priv = table_config->priv;
+ g_return_val_if_fail (E_IS_CALENDAR_TABLE_CONFIG (table_config), NULL);
- set_twentyfour_hour (priv->table);
+ return table_config->priv->table;
}
void
-e_calendar_table_config_set_table (ECalendarTableConfig *table_config, ECalendarTable *table)
+e_calendar_table_config_set_table (ECalendarTableConfig *table_config,
+ ECalendarTable *table)
{
ECalendarTableConfigPrivate *priv;
- guint not;
- GList *l;
+ guint notification;
+ GList *list, *iter;
- g_return_if_fail (table_config != NULL);
g_return_if_fail (E_IS_CALENDAR_TABLE_CONFIG (table_config));
priv = table_config->priv;
- if (priv->table) {
- g_object_unref (priv->table);
- priv->table = NULL;
+ if (table_config->priv->table) {
+ g_object_unref (table_config->priv->table);
+ table_config->priv->table = NULL;
}
- if (priv->cell_config) {
- g_object_unref (priv->cell_config);
- priv->cell_config = NULL;
+ if (table_config->priv->cell_config) {
+ g_object_unref (table_config->priv->cell_config);
+ table_config->priv->cell_config = NULL;
}
- for (l = priv->notifications; l; l = l->next)
- calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
-
- g_list_free (priv->notifications);
- priv->notifications = NULL;
+ list = table_config->priv->notifications;
+ for (iter = list; iter != NULL; iter = iter->next) {
+ notification = GPOINTER_TO_UINT (iter->data);
+ calendar_config_remove_notification (notification);
+ }
+ g_list_free (list);
+ table_config->priv->notifications = NULL;
- /* If the new view is NULL, return right now */
- if (!table)
+ if (table == NULL)
return;
- priv->table = g_object_ref (table);
+ table_config->priv->table = g_object_ref (table);
/* Time zone */
- set_timezone (table);
+ calendar_table_config_set_timezone (table);
- not = calendar_config_add_notification_timezone (timezone_changed_cb, table_config);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+ notification = calendar_config_add_notification_timezone (
+ calendar_table_config_timezone_changed_cb, table_config);
+ table_config->priv->notifications = g_list_prepend (
+ table_config->priv->notifications,
+ GUINT_TO_POINTER (notification));
/* 24 Hour format */
- set_twentyfour_hour (table);
+ calendar_table_config_set_twentyfour_hour (table);
- not = calendar_config_add_notification_24_hour_format (twentyfour_hour_changed_cb, table_config);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+ notification = calendar_config_add_notification_24_hour_format (
+ calendar_table_config_twentyfour_hour_changed_cb, table_config);
+ table_config->priv->notifications = g_list_prepend (
+ table_config->priv->notifications,
+ GUINT_TO_POINTER (notification));
/* Date cell */
- priv->cell_config = e_cell_date_edit_config_new (table->dates_cell);
+ table_config->priv->cell_config =
+ e_cell_date_edit_config_new (table->dates_cell);
}
diff --git a/calendar/gui/e-calendar-table-config.h b/calendar/gui/e-calendar-table-config.h
index 12cbc3e326..8f2284ab40 100644
--- a/calendar/gui/e-calendar-table-config.h
+++ b/calendar/gui/e-calendar-table-config.h
@@ -21,24 +21,38 @@
*
*/
-#ifndef _E_CALENDAR_TABLE_CONFIG_H_
-#define _E_CALENDAR_TABLE_CONFIG_H_
+#ifndef E_CALENDAR_TABLE_CONFIG_H
+#define E_CALENDAR_TABLE_CONFIG_H
#include "e-calendar-table.h"
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define E_TYPE_CALENDAR_TABLE_CONFIG \
+ (e_calendar_table_config_get_type ())
+#define E_CALENDAR_TABLE_CONFIG(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CALENDAR_TABLE_CONFIG, ECalendarTableConfig))
+#define E_CALENDAR_TABLE_CONFIG_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CALENDAR_TABLE_CONFIG, ECalendarTableConfigClass))
+#define E_IS_CALENDAR_TABLE_CONFIG(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CALENDAR_TABLE_CONFIG))
+#define E_IS_CALENDAR_TABLE_CONFIG_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CALENDAR_TABLE_CONFIG))
+#define E_CALENDAR_TABLE_CONFIG_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CALENDAR_TABLE_CONFIG, ECalendarTableConfigClass))
-#define E_CALENDAR_TABLE_CONFIG(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, e_calendar_table_config_get_type (), ECalendarTableConfig)
-#define E_CALENDAR_TABLE_CONFIG_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, e_calendar_table_config_get_type (), ECalendarTableConfigClass)
-#define E_IS_CALENDAR_TABLE_CONFIG(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, e_calendar_table_config_get_type ())
+G_BEGIN_DECLS
-typedef struct _ECalendarTableConfig ECalendarTableConfig;
-typedef struct _ECalendarTableConfigClass ECalendarTableConfigClass;
+typedef struct _ECalendarTableConfig ECalendarTableConfig;
+typedef struct _ECalendarTableConfigClass ECalendarTableConfigClass;
typedef struct _ECalendarTableConfigPrivate ECalendarTableConfigPrivate;
struct _ECalendarTableConfig {
GObject parent;
-
ECalendarTableConfigPrivate *priv;
};
@@ -46,11 +60,15 @@ struct _ECalendarTableConfigClass {
GObjectClass parent_class;
};
-GType e_calendar_table_config_get_type (void);
-ECalendarTableConfig *e_calendar_table_config_new (ECalendarTable *table);
-ECalendarTable *e_calendar_table_config_get_table (ECalendarTableConfig *view_config);
-void e_calendar_table_config_set_table (ECalendarTableConfig *view_config, ECalendarTable *table);
+GType e_calendar_table_config_get_type(void);
+ECalendarTableConfig *
+ e_calendar_table_config_new (ECalendarTable *table);
+ECalendarTable *e_calendar_table_config_get_table
+ (ECalendarTableConfig *table_config);
+void e_calendar_table_config_set_table
+ (ECalendarTableConfig *table_config,
+ ECalendarTable *table);
G_END_DECLS
-#endif
+#endif /* E_CALENDAR_TABLE_CONFIG_H */
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index 9e74ea2c26..ed254d0680 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -65,6 +65,16 @@
#include "e-tasks.h"
#include "misc.h"
+#define E_CALENDAR_TABLE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CALENDAR_TABLE, ECalendarTablePrivate))
+
+struct _ECalendarTablePrivate {
+ gpointer shell_view; /* weak pointer */
+
+ EActivity *activity;
+};
+
enum TargetType{
TARGET_TYPE_VCALENDAR
};
@@ -76,12 +86,6 @@ static GtkTargetEntry target_types[] = {
static guint n_target_types = G_N_ELEMENTS (target_types);
-extern ECompEditorRegistry *comp_editor_registry;
-
-static void e_calendar_table_class_init (ECalendarTableClass *class);
-static void e_calendar_table_init (ECalendarTable *cal_table);
-static void e_calendar_table_destroy (GtkObject *object);
-
static void e_calendar_table_on_double_click (ETable *table,
gint row,
gint col,
@@ -118,7 +122,8 @@ enum {
LAST_SIGNAL
};
-static guint signals[LAST_SIGNAL] = { 0 };
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
/* The icons to represent the task. */
#define E_CALENDAR_MODEL_NUM_ICONS 4
@@ -129,17 +134,92 @@ static GdkPixbuf* icon_pixbufs[E_CALENDAR_MODEL_NUM_ICONS] = { NULL };
static GdkAtom clipboard_atom = GDK_NONE;
-G_DEFINE_TYPE (ECalendarTable, e_calendar_table, GTK_TYPE_TABLE)
+static void
+calendar_table_emit_user_created (ECalendarTable *cal_table)
+{
+ g_signal_emit (cal_table, signals[USER_CREATED], 0);
+}
+
+static void
+calendar_table_set_shell_view (ECalendarTable *cal_table,
+ EShellView *shell_view)
+{
+ g_return_if_fail (cal_table->priv->shell_view == NULL);
+
+ cal_table->priv->shell_view = shell_view;
+
+ g_object_add_weak_pointer (
+ G_OBJECT (shell_view),
+ &cal_table->priv->shell_view);
+}
+
+static void
+calendar_table_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SHELL_VIEW:
+ calendar_table_set_shell_view (
+ E_CALENDAR_TABLE (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+calendar_table_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SHELL_VIEW:
+ g_value_set_object (
+ value, e_calendar_table_get_shell_view (
+ E_CALENDAR_TABLE (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+calendar_table_dispose (GObject *object)
+{
+ ECalendarTable *cal_table;
+
+ cal_table = E_CALENDAR_TABLE (object);
+
+ if (cal_table->model != NULL) {
+ g_object_unref (cal_table->model);
+ cal_table->model = NULL;
+ }
+
+ if (cal_table->priv->activity != NULL) {
+ /* XXX Activity is not cancellable. */
+ e_activity_complete (cal_table->priv->activity);
+ g_object_unref (cal_table->priv->activity);
+ cal_table->priv->activity = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
static void
-e_calendar_table_class_init (ECalendarTableClass *class)
+calendar_table_class_init (ECalendarTableClass *class)
{
- GtkObjectClass *object_class;
+ GObjectClass *object_class;
- object_class = (GtkObjectClass *) class;
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ECalendarTablePrivate));
- /* Method override */
- object_class->destroy = e_calendar_table_destroy;
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = calendar_table_dispose;
signals[USER_CREATED] =
g_signal_new ("user_created",
@@ -150,9 +230,299 @@ e_calendar_table_class_init (ECalendarTableClass *class)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- /* clipboard atom */
- if (!clipboard_atom)
- clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
+ clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
+}
+
+static void
+calendar_table_init (ECalendarTable *cal_table)
+{
+ GtkWidget *table;
+ ETable *e_table;
+ ECell *cell, *popup_cell;
+ ETableExtras *extras;
+ gint i;
+ GdkPixbuf *pixbuf;
+ GList *strings;
+ AtkObject *a11y;
+ char *etspecfile;
+
+ cal_table->priv = E_CALENDAR_TABLE_GET_PRIVATE (cal_table);
+
+ /* Create the model */
+
+ cal_table->model = (ECalModel *) e_cal_model_tasks_new ();
+ g_signal_connect_swapped (
+ cal_table->model, "row_appended",
+ G_CALLBACK (calendar_table_emit_user_created), cal_table);
+
+ /* Create the header columns */
+
+ extras = e_table_extras_new ();
+
+ /*
+ * Normal string fields.
+ */
+ cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
+ g_object_set (G_OBJECT (cell),
+ "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT,
+ "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE,
+ "bg_color_column", E_CAL_MODEL_FIELD_COLOR,
+ NULL);
+
+ e_table_extras_add_cell (extras, "calstring", cell);
+
+
+ /*
+ * Date fields.
+ */
+ cell = e_cell_date_edit_text_new (NULL, GTK_JUSTIFY_LEFT);
+ g_object_set (G_OBJECT (cell),
+ "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT,
+ "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE,
+ "bg_color_column", E_CAL_MODEL_FIELD_COLOR,
+ NULL);
+
+ popup_cell = e_cell_date_edit_new ();
+ e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
+ g_object_unref (cell);
+ e_table_extras_add_cell (extras, "dateedit", popup_cell);
+ cal_table->dates_cell = E_CELL_DATE_EDIT (popup_cell);
+
+ e_cell_date_edit_set_get_time_callback (E_CELL_DATE_EDIT (popup_cell),
+ e_calendar_table_get_current_time,
+ cal_table, NULL);
+
+
+ /*
+ * Combo fields.
+ */
+
+ /* Classification field. */
+ cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
+ g_object_set (G_OBJECT (cell),
+ "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT,
+ "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE,
+ "bg_color_column", E_CAL_MODEL_FIELD_COLOR,
+ "editable", FALSE,
+ NULL);
+
+ popup_cell = e_cell_combo_new ();
+ e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
+ g_object_unref (cell);
+
+ strings = NULL;
+ strings = g_list_append (strings, (char*) _("Public"));
+ strings = g_list_append (strings, (char*) _("Private"));
+ strings = g_list_append (strings, (char*) _("Confidential"));
+ e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
+ strings);
+
+ e_table_extras_add_cell (extras, "classification", popup_cell);
+
+ /* Priority field. */
+ cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
+ g_object_set (G_OBJECT (cell),
+ "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT,
+ "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE,
+ "bg_color_column", E_CAL_MODEL_FIELD_COLOR,
+ "editable", FALSE,
+ NULL);
+
+ popup_cell = e_cell_combo_new ();
+ e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
+ g_object_unref (cell);
+
+ strings = NULL;
+ strings = g_list_append (strings, (char*) _("High"));
+ strings = g_list_append (strings, (char*) _("Normal"));
+ strings = g_list_append (strings, (char*) _("Low"));
+ strings = g_list_append (strings, (char*) _("Undefined"));
+ e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
+ strings);
+
+ e_table_extras_add_cell (extras, "priority", popup_cell);
+
+ /* Percent field. */
+ cell = e_cell_percent_new (NULL, GTK_JUSTIFY_LEFT);
+ g_object_set (G_OBJECT (cell),
+ "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT,
+ "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE,
+ "bg_color_column", E_CAL_MODEL_FIELD_COLOR,
+ NULL);
+
+ popup_cell = e_cell_combo_new ();
+ e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
+ g_object_unref (cell);
+
+ strings = NULL;
+ strings = g_list_append (strings, (char*) _("0%"));
+ strings = g_list_append (strings, (char*) _("10%"));
+ strings = g_list_append (strings, (char*) _("20%"));
+ strings = g_list_append (strings, (char*) _("30%"));
+ strings = g_list_append (strings, (char*) _("40%"));
+ strings = g_list_append (strings, (char*) _("50%"));
+ strings = g_list_append (strings, (char*) _("60%"));
+ strings = g_list_append (strings, (char*) _("70%"));
+ strings = g_list_append (strings, (char*) _("80%"));
+ strings = g_list_append (strings, (char*) _("90%"));
+ strings = g_list_append (strings, (char*) _("100%"));
+ e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
+ strings);
+
+ e_table_extras_add_cell (extras, "percent", popup_cell);
+
+ /* Transparency field. */
+ cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
+ g_object_set (G_OBJECT (cell),
+ "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT,
+ "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE,
+ "bg_color_column", E_CAL_MODEL_FIELD_COLOR,
+ "editable", FALSE,
+ NULL);
+
+ popup_cell = e_cell_combo_new ();
+ e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
+ g_object_unref (cell);
+
+ strings = NULL;
+ strings = g_list_append (strings, (char*) _("Free"));
+ strings = g_list_append (strings, (char*) _("Busy"));
+ e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
+ strings);
+
+ e_table_extras_add_cell (extras, "transparency", popup_cell);
+
+ /* Status field. */
+ cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
+ g_object_set (G_OBJECT (cell),
+ "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT,
+ "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE,
+ "bg_color_column", E_CAL_MODEL_FIELD_COLOR,
+ "editable", FALSE,
+ NULL);
+
+ popup_cell = e_cell_combo_new ();
+ e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
+ g_object_unref (cell);
+
+ strings = NULL;
+ strings = g_list_append (strings, (char*) _("Not Started"));
+ strings = g_list_append (strings, (char*) _("In Progress"));
+ strings = g_list_append (strings, (char*) _("Completed"));
+ strings = g_list_append (strings, (char*) _("Canceled"));
+ e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
+ strings);
+
+ e_table_extras_add_cell (extras, "calstatus", popup_cell);
+
+ e_table_extras_add_compare (extras, "date-compare",
+ date_compare_cb);
+ e_table_extras_add_compare (extras, "percent-compare",
+ percent_compare_cb);
+ e_table_extras_add_compare (extras, "priority-compare",
+ priority_compare_cb);
+ e_table_extras_add_compare (extras, "status-compare",
+ status_compare_cb);
+
+ /* Create pixmaps */
+
+ if (!icon_pixbufs[0])
+ for (i = 0; i < E_CALENDAR_MODEL_NUM_ICONS; i++) {
+ icon_pixbufs[i] = e_icon_factory_get_icon (icon_names[i], E_ICON_SIZE_LIST);
+ }
+
+ cell = e_cell_toggle_new (0, E_CALENDAR_MODEL_NUM_ICONS, icon_pixbufs);
+ e_table_extras_add_cell(extras, "icon", cell);
+ e_table_extras_add_pixbuf(extras, "icon", icon_pixbufs[0]);
+
+ pixbuf = e_icon_factory_get_icon ("stock_check-filled", E_ICON_SIZE_LIST);
+ e_table_extras_add_pixbuf(extras, "complete", pixbuf);
+ g_object_unref(pixbuf);
+
+ /* Create the table */
+
+ etspecfile = g_build_filename (EVOLUTION_ETSPECDIR,
+ "e-calendar-table.etspec",
+ NULL);
+ table = e_table_scrolled_new_from_spec_file (E_TABLE_MODEL (cal_table->model),
+ extras,
+ etspecfile,
+ NULL);
+ g_free (etspecfile);
+
+ /* FIXME: this causes a message from GLib about 'extras' having only a floating
+ reference */
+ /* g_object_unref (extras); */
+
+ cal_table->etable = table;
+ gtk_table_attach (GTK_TABLE (cal_table), table, 0, 1, 0, 1,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+ gtk_widget_show (table);
+
+
+ e_table = e_table_scrolled_get_table (E_TABLE_SCROLLED (table));
+ g_signal_connect (e_table, "double_click", G_CALLBACK (e_calendar_table_on_double_click), cal_table);
+ g_signal_connect (e_table, "right_click", G_CALLBACK (e_calendar_table_on_right_click), cal_table);
+ g_signal_connect (e_table, "key_press", G_CALLBACK (e_calendar_table_on_key_press), cal_table);
+ g_signal_connect (e_table, "popup_menu", G_CALLBACK (e_calendar_table_on_popup_menu), cal_table);
+ g_signal_connect (e_table, "query-tooltip", G_CALLBACK (query_tooltip_cb), cal_table);
+ gtk_widget_set_has_tooltip (GTK_WIDGET (e_table), TRUE);
+
+ a11y = gtk_widget_get_accessible ((GtkWidget *)e_table);
+ if (a11y)
+ atk_object_set_name (a11y, _("Tasks"));
+}
+
+GType
+e_calendar_table_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (ECalendarTableClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) calendar_table_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ECalendarTable),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) calendar_table_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_TABLE, "ECalendarTable", &type_info, 0);
+ }
+
+ return type;
+}
+
+/**
+ * e_calendar_table_new:
+ * @shell_view: an #EShellView
+ *
+ * Returns a new #ECalendarTable.
+ *
+ * Returns: a new #ECalendarTable
+ **/
+GtkWidget *
+e_calendar_table_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_CALENDAR_TABLE,
+ "shell-view", shell_view, NULL);
+}
+
+EShellView *
+e_calendar_table_get_shell_view (ECalendarTable *cal_table)
+{
+ g_return_val_if_fail (E_IS_CALENDAR_TABLE (cal_table), NULL);
+
+ return cal_table->priv->shell_view;
}
static gint
@@ -257,12 +627,6 @@ status_compare_cb (gconstpointer a, gconstpointer b)
}
static void
-row_appended_cb (ECalModel *model, ECalendarTable *cal_table)
-{
- g_signal_emit (cal_table, signals[USER_CREATED], 0);
-}
-
-static void
get_time_as_text (struct icaltimetype *tt, icaltimezone *f_zone, icaltimezone *t_zone, char *buff, int buff_len)
{
struct tm tmp_tm;
@@ -465,261 +829,6 @@ query_tooltip_cb (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, Gtk
return TRUE;
}
-static void
-e_calendar_table_init (ECalendarTable *cal_table)
-{
- GtkWidget *table;
- ETable *e_table;
- ECell *cell, *popup_cell;
- ETableExtras *extras;
- gint i;
- GdkPixbuf *pixbuf;
- GList *strings;
- AtkObject *a11y;
- char *etspecfile;
-
- /* Create the model */
-
- cal_table->model = (ECalModel *) e_cal_model_tasks_new ();
- g_signal_connect (cal_table->model, "row_appended", G_CALLBACK (row_appended_cb), cal_table);
-
- cal_table->user_created_cal = NULL;
-
- /* Create the header columns */
-
- extras = e_table_extras_new();
-
- /*
- * Normal string fields.
- */
- cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
- g_object_set (G_OBJECT (cell),
- "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT,
- "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE,
- "bg_color_column", E_CAL_MODEL_FIELD_COLOR,
- NULL);
-
- e_table_extras_add_cell (extras, "calstring", cell);
-
-
- /*
- * Date fields.
- */
- cell = e_cell_date_edit_text_new (NULL, GTK_JUSTIFY_LEFT);
- g_object_set (G_OBJECT (cell),
- "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT,
- "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE,
- "bg_color_column", E_CAL_MODEL_FIELD_COLOR,
- NULL);
-
- popup_cell = e_cell_date_edit_new ();
- e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
- g_object_unref (cell);
- e_table_extras_add_cell (extras, "dateedit", popup_cell);
- cal_table->dates_cell = E_CELL_DATE_EDIT (popup_cell);
-
- e_cell_date_edit_set_get_time_callback (E_CELL_DATE_EDIT (popup_cell),
- e_calendar_table_get_current_time,
- cal_table, NULL);
-
-
- /*
- * Combo fields.
- */
-
- /* Classification field. */
- cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
- g_object_set (G_OBJECT (cell),
- "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT,
- "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE,
- "bg_color_column", E_CAL_MODEL_FIELD_COLOR,
- "editable", FALSE,
- NULL);
-
- popup_cell = e_cell_combo_new ();
- e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
- g_object_unref (cell);
-
- strings = NULL;
- strings = g_list_append (strings, (char*) _("Public"));
- strings = g_list_append (strings, (char*) _("Private"));
- strings = g_list_append (strings, (char*) _("Confidential"));
- e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
- strings);
-
- e_table_extras_add_cell (extras, "classification", popup_cell);
-
- /* Priority field. */
- cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
- g_object_set (G_OBJECT (cell),
- "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT,
- "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE,
- "bg_color_column", E_CAL_MODEL_FIELD_COLOR,
- "editable", FALSE,
- NULL);
-
- popup_cell = e_cell_combo_new ();
- e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
- g_object_unref (cell);
-
- strings = NULL;
- strings = g_list_append (strings, (char*) _("High"));
- strings = g_list_append (strings, (char*) _("Normal"));
- strings = g_list_append (strings, (char*) _("Low"));
- strings = g_list_append (strings, (char*) _("Undefined"));
- e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
- strings);
-
- e_table_extras_add_cell (extras, "priority", popup_cell);
-
- /* Percent field. */
- cell = e_cell_percent_new (NULL, GTK_JUSTIFY_LEFT);
- g_object_set (G_OBJECT (cell),
- "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT,
- "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE,
- "bg_color_column", E_CAL_MODEL_FIELD_COLOR,
- NULL);
-
- popup_cell = e_cell_combo_new ();
- e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
- g_object_unref (cell);
-
- strings = NULL;
- strings = g_list_append (strings, (char*) _("0%"));
- strings = g_list_append (strings, (char*) _("10%"));
- strings = g_list_append (strings, (char*) _("20%"));
- strings = g_list_append (strings, (char*) _("30%"));
- strings = g_list_append (strings, (char*) _("40%"));
- strings = g_list_append (strings, (char*) _("50%"));
- strings = g_list_append (strings, (char*) _("60%"));
- strings = g_list_append (strings, (char*) _("70%"));
- strings = g_list_append (strings, (char*) _("80%"));
- strings = g_list_append (strings, (char*) _("90%"));
- strings = g_list_append (strings, (char*) _("100%"));
- e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
- strings);
-
- e_table_extras_add_cell (extras, "percent", popup_cell);
-
- /* Transparency field. */
- cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
- g_object_set (G_OBJECT (cell),
- "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT,
- "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE,
- "bg_color_column", E_CAL_MODEL_FIELD_COLOR,
- "editable", FALSE,
- NULL);
-
- popup_cell = e_cell_combo_new ();
- e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
- g_object_unref (cell);
-
- strings = NULL;
- strings = g_list_append (strings, (char*) _("Free"));
- strings = g_list_append (strings, (char*) _("Busy"));
- e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
- strings);
-
- e_table_extras_add_cell (extras, "transparency", popup_cell);
-
- /* Status field. */
- cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
- g_object_set (G_OBJECT (cell),
- "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT,
- "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE,
- "bg_color_column", E_CAL_MODEL_FIELD_COLOR,
- "editable", FALSE,
- NULL);
-
- popup_cell = e_cell_combo_new ();
- e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
- g_object_unref (cell);
-
- strings = NULL;
- strings = g_list_append (strings, (char*) _("Not Started"));
- strings = g_list_append (strings, (char*) _("In Progress"));
- strings = g_list_append (strings, (char*) _("Completed"));
- strings = g_list_append (strings, (char*) _("Canceled"));
- e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
- strings);
-
- e_table_extras_add_cell (extras, "calstatus", popup_cell);
-
- e_table_extras_add_compare (extras, "date-compare",
- date_compare_cb);
- e_table_extras_add_compare (extras, "percent-compare",
- percent_compare_cb);
- e_table_extras_add_compare (extras, "priority-compare",
- priority_compare_cb);
- e_table_extras_add_compare (extras, "status-compare",
- status_compare_cb);
-
- /* Create pixmaps */
-
- if (!icon_pixbufs[0])
- for (i = 0; i < E_CALENDAR_MODEL_NUM_ICONS; i++) {
- icon_pixbufs[i] = e_icon_factory_get_icon (icon_names[i], E_ICON_SIZE_LIST);
- }
-
- cell = e_cell_toggle_new (0, E_CALENDAR_MODEL_NUM_ICONS, icon_pixbufs);
- e_table_extras_add_cell(extras, "icon", cell);
- e_table_extras_add_pixbuf(extras, "icon", icon_pixbufs[0]);
-
- pixbuf = e_icon_factory_get_icon ("stock_check-filled", E_ICON_SIZE_LIST);
- e_table_extras_add_pixbuf(extras, "complete", pixbuf);
- g_object_unref(pixbuf);
-
- /* Create the table */
-
- etspecfile = g_build_filename (EVOLUTION_ETSPECDIR,
- "e-calendar-table.etspec",
- NULL);
- table = e_table_scrolled_new_from_spec_file (E_TABLE_MODEL (cal_table->model),
- extras,
- etspecfile,
- NULL);
- g_free (etspecfile);
-
- /* FIXME: this causes a message from GLib about 'extras' having only a floating
- reference */
- /* g_object_unref (extras); */
-
- cal_table->etable = table;
- gtk_table_attach (GTK_TABLE (cal_table), table, 0, 1, 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (table);
-
-
- e_table = e_table_scrolled_get_table (E_TABLE_SCROLLED (table));
- g_signal_connect (e_table, "double_click", G_CALLBACK (e_calendar_table_on_double_click), cal_table);
- g_signal_connect (e_table, "right_click", G_CALLBACK (e_calendar_table_on_right_click), cal_table);
- g_signal_connect (e_table, "key_press", G_CALLBACK (e_calendar_table_on_key_press), cal_table);
- g_signal_connect (e_table, "popup_menu", G_CALLBACK (e_calendar_table_on_popup_menu), cal_table);
- g_signal_connect (e_table, "query-tooltip", G_CALLBACK (query_tooltip_cb), cal_table);
- gtk_widget_set_has_tooltip (GTK_WIDGET (e_table), TRUE);
-
- a11y = gtk_widget_get_accessible ((GtkWidget *)e_table);
- if (a11y)
- atk_object_set_name (a11y, _("Tasks"));
-}
-
-
-/**
- * e_calendar_table_new:
- * @Returns: a new #ECalendarTable.
- *
- * Creates a new #ECalendarTable.
- **/
-GtkWidget *
-e_calendar_table_new (void)
-{
- GtkWidget *cal_table;
-
- cal_table = GTK_WIDGET (g_object_new (e_calendar_table_get_type (), NULL));
-
- return cal_table;
-}
-
/**
* e_calendar_table_get_model:
@@ -739,21 +848,6 @@ e_calendar_table_get_model (ECalendarTable *cal_table)
}
-static void
-e_calendar_table_destroy (GtkObject *object)
-{
- ECalendarTable *cal_table;
-
- cal_table = E_CALENDAR_TABLE (object);
-
- if (cal_table->model) {
- g_object_unref (cal_table->model);
- cal_table->model = NULL;
- }
-
- GTK_OBJECT_CLASS (e_calendar_table_parent_class)->destroy (object);
-}
-
/**
* e_calendar_table_get_table:
* @cal_table: A calendar table.
@@ -1836,20 +1930,35 @@ static char *test[] = {
#endif
void
-e_calendar_table_set_activity_handler (ECalendarTable *cal_table, EActivityHandler *activity_handler)
+e_calendar_table_set_status_message (ECalendarTable *cal_table,
+ const gchar *message,
+ gdouble percent)
{
- g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table));
-
- cal_table->activity_handler = activity_handler;
-}
+ EActivity *activity;
+ EShellView *shell_view;
-void
-e_calendar_table_set_status_message (ECalendarTable *cal_table, const gchar *message, int percent)
-{
g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table));
- if (!cal_table->activity_handler)
- return;
+ activity = cal_table->priv->activity;
+ shell_view = e_calendar_table_get_shell_view (cal_table);
+
+ if (message == NULL || *message == '\0') {
+ if (activity != NULL) {
+ e_activity_complete (activity);
+ g_object_unref (activity);
+ cal_table->priv->activity = NULL;
+ }
+
+ } else if (activity == NULL) {
+ activity = e_activity_new (message);
+ cal_able->priv->activity = activity;
+ e_activity_set_percent (activity, percent);
+ e_shell_view_add_activity (shell_view, activity);
+
+ } else {
+ e_activity_set_percent (activity, percent);
+ e_activity_set_primary_text (activity, message);
+ }
if (!message || !*message) {
if (cal_table->activity_id != 0) {
diff --git a/calendar/gui/e-calendar-table.h b/calendar/gui/e-calendar-table.h
index 04b2f9fa4a..6647572e89 100644
--- a/calendar/gui/e-calendar-table.h
+++ b/calendar/gui/e-calendar-table.h
@@ -23,29 +23,43 @@
#ifndef _E_CALENDAR_TABLE_H_
#define _E_CALENDAR_TABLE_H_
-#include <gtk/gtk.h>
+#include <shell/e-shell-view.h>
#include <table/e-table-scrolled.h>
#include <misc/e-cell-date-edit.h>
#include "e-cal-model.h"
-G_BEGIN_DECLS
-
/*
* ECalendarTable - displays the iCalendar objects in a table (an ETable).
* Used for calendar events and tasks.
*/
-#define E_CALENDAR_TABLE(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, e_calendar_table_get_type (), ECalendarTable)
-#define E_CALENDAR_TABLE_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, e_calendar_table_get_type (), ECalendarTableClass)
-#define E_IS_CALENDAR_TABLE(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, e_calendar_table_get_type ())
-
+/* Standard GObject macros */
+#define E_TYPE_CALENDAR_TABLE \
+ (e_calendar_table_get_type ())
+#define E_CALENDAR_TABLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CALENDAR_TABLE, ECalendarTable))
+#define E_CALENDAR_TABLE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CALENDAR_TABLE, ECalendarTableClass))
+#define E_IS_CALENDAR_TABLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CALENDAR_TABLE))
+#define E_IS_CALENDAR_TABLE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CALENDAR_TABLE))
+#define E_CALENDAR_TABLE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CALENDAR_TABLE, ECalendarTableClass))
-typedef struct _ECalendarTable ECalendarTable;
-typedef struct _ECalendarTableClass ECalendarTableClass;
+G_BEGIN_DECLS
+typedef struct _ECalendarTable ECalendarTable;
+typedef struct _ECalendarTableClass ECalendarTableClass;
+typedef struct _ECalendarTablePrivate ECalendarTablePrivate;
struct _ECalendarTable {
- GtkTable table;
+ GtkTable parent;
/* The model that we use */
ECalModel *model;
@@ -58,14 +72,9 @@ struct _ECalendarTable {
/* Fields used for cut/copy/paste */
icalcomponent *tmp_vcal;
-#if 0 /* KILL-BONOBO */
- /* Activity ID for the EActivityHandler (i.e. the status bar). */
- EActivityHandler *activity_handler;
- guint activity_id;
-#endif
-
- /* We should know which calendar has been used to create object, so store it here
- before emitting "user_created" signal and make it NULL just after the emit. */
+ /* We should know which calendar has been used to create object,
+ * so store it here before emitting "user_created" signal and make
+ * it NULL just after the emit. */
ECal *user_created_cal;
};
@@ -77,42 +86,48 @@ struct _ECalendarTableClass {
};
-GType e_calendar_table_get_type (void);
-GtkWidget* e_calendar_table_new (void);
-
-ECalModel *e_calendar_table_get_model (ECalendarTable *cal_table);
-
-ETable *e_calendar_table_get_table (ECalendarTable *cal_table);
-
-void e_calendar_table_open_selected (ECalendarTable *cal_table);
-void e_calendar_table_complete_selected (ECalendarTable *cal_table);
-void e_calendar_table_delete_selected (ECalendarTable *cal_table);
-
-GSList *e_calendar_table_get_selected (ECalendarTable *cal_table);
+GType e_calendar_table_get_type (void);
+GtkWidget * e_calendar_table_new (void);
+ECalModel * e_calendar_table_get_model (ECalendarTable *cal_table);
+ETable * e_calendar_table_get_table (ECalendarTable *cal_table);
+EShellView * e_calendar_table_get_shell_view (ECalendarTable *cal_table);
+void e_calendar_table_open_selected (ECalendarTable *cal_table);
+void e_calendar_table_complete_selected
+ (ECalendarTable *cal_table);
+void e_calendar_table_delete_selected(ECalendarTable *cal_table);
+GSList * e_calendar_table_get_selected (ECalendarTable *cal_table);
/* Clipboard related functions */
-void e_calendar_table_cut_clipboard (ECalendarTable *cal_table);
-void e_calendar_table_copy_clipboard (ECalendarTable *cal_table);
-void e_calendar_table_paste_clipboard (ECalendarTable *cal_table);
+void e_calendar_table_cut_clipboard (ECalendarTable *cal_table);
+void e_calendar_table_copy_clipboard (ECalendarTable *cal_table);
+void e_calendar_table_paste_clipboard(ECalendarTable *cal_table);
/* These load and save the state of the table (headers shown etc.) to/from
the given file. */
-void e_calendar_table_load_state (ECalendarTable *cal_table,
- gchar *filename);
-void e_calendar_table_save_state (ECalendarTable *cal_table,
- gchar *filename);
-
-void e_calendar_table_set_status_message (ECalendarTable *cal_table,
- const gchar *message,
- int percent);
-void e_calendar_table_open_task (ECalendarTable *cal_table,
- ECal *client,
- icalcomponent *icalcomp,
- gboolean assign);
-ECalModelComponent * e_calendar_table_get_selected_comp (ECalendarTable *cal_table);
-void e_calendar_table_hide_completed_tasks (ECalendarTable *table, GList *clients_list, gboolean config_changed);
-
-void e_calendar_table_process_completed_tasks (ECalendarTable *table, GList *clients_list, gboolean config_changed);
+void e_calendar_table_load_state (ECalendarTable *cal_table,
+ gchar *filename);
+void e_calendar_table_save_state (ECalendarTable *cal_table,
+ gchar *filename);
+
+void e_calendar_table_set_status_message
+ (ECalendarTable *cal_table,
+ const gchar *message,
+ gdouble percent);
+void e_calendar_table_open_task (ECalendarTable *cal_table,
+ ECal *client,
+ icalcomponent *icalcomp,
+ gboolean assign);
+ECalModelComponent *
+ e_calendar_table_get_selected_comp
+ (ECalendarTable *cal_table);
+void e_calendar_table_hide_completed_tasks
+ (ECalendarTable *table,
+ GList *clients_list,
+ gboolean config_changed);
+void e_calendar_table_process_completed_tasks
+ (ECalendarTable *table,
+ GList *clients_list,
+ gboolean config_changed);
G_END_DECLS
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index c8be57c49d..b1c34bf8d4 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -35,7 +35,7 @@
#include <e-util/e-error.h>
#include <e-util/e-dialog-utils.h>
#include <e-util/e-icon-factory.h>
-#include "e-calendar-marshal.h"
+#include <e-util/e-util.h>
#include <libecal/e-cal-time-util.h>
#include <libecal/e-cal-component.h>
@@ -82,7 +82,6 @@ static void e_calendar_view_destroy (GtkObject *object);
static void open_event_with_flags (ECalendarView *cal_view, ECal *client, icalcomponent *icalcomp, guint32 flags);
static GdkAtom clipboard_atom = GDK_NONE;
-extern ECompEditorRegistry *comp_editor_registry;
/* Property IDs */
enum props {
@@ -194,7 +193,7 @@ e_calendar_view_class_init (ECalendarViewClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ECalendarViewClass, timezone_changed),
NULL, NULL,
- e_calendar_marshal_VOID__POINTER_POINTER,
+ e_marshal_VOID__POINTER_POINTER,
G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
e_calendar_view_signals[EVENT_CHANGED] =
diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c
index a311d8da42..019b2642ff 100644
--- a/calendar/gui/e-meeting-time-sel.c
+++ b/calendar/gui/e-meeting-time-sel.c
@@ -46,7 +46,6 @@
#include <e-util/e-cursor.h>
#include <e-util/e-util.h>
-#include "calendar-component.h"
#include "calendar-config.h"
#include "e-meeting-utils.h"
#include "e-meeting-list-view.h"
diff --git a/calendar/gui/e-cal-component-memo-preview.c b/calendar/gui/e-memo-preview.c
index f4107efe84..f5b725c02f 100644
--- a/calendar/gui/e-cal-component-memo-preview.c
+++ b/calendar/gui/e-memo-preview.c
@@ -23,53 +23,53 @@
* Nathan Owens <pianocomp81@yahoo.com>
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "e-memo-preview.h"
#include <string.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <libgnome/gnome-url.h>
#include <libecal/e-cal-time-util.h>
#include <libedataserver/e-categories.h>
-#include <gtkhtml/gtkhtml.h>
#include <gtkhtml/gtkhtml-stream.h>
#include <libedataserver/e-time-utils.h>
#include <e-util/e-categories-config.h>
#include "calendar-config.h"
-#include "e-cal-component-memo-preview.h"
#include "e-cal-component-preview.h"
#include <camel/camel-mime-filter-tohtml.h>
-struct _ECalComponentMemoPreviewPrivate {
- GtkWidget *html;
+#define E_MEMO_PREVIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MEMO_PREVIEW, EMemoPreviewPrivate))
+struct _EMemoPreviewPrivate {
icaltimezone *zone;
};
-G_DEFINE_TYPE (ECalComponentMemoPreview, e_cal_component_memo_preview, GTK_TYPE_TABLE)
-
+static gpointer parent_class;
static void
-on_link_clicked (GtkHTML *html, const char *url, gpointer data)
+memo_preview_link_clicked (GtkHTML *html,
+ const gchar *url)
{
- GError *err = NULL;
+ GdkScreen *screen;
+ GError *error = NULL;
- gnome_url_show (url, &err);
+ screen = gtk_widget_get_screen (GTK_WIDGET (html));
+ gtk_show_uri (screen, url, GDK_CURRENT_TIME, &error);
- if (err) {
- g_warning ("gnome_url_show: %s", err->message);
- g_error_free (err);
+ if (error != NULL) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
}
}
static void
-on_url_cb (GtkHTML *html, const char *url, gpointer data)
+memo_preview_on_url (GtkHTML *html,
+ const gchar *url)
{
#if 0
char *msg;
- ECalComponentMemoPreview *preview = data;
+ EMemoPreview *preview = data;
if (url && *url) {
msg = g_strdup_printf (_("Click to open %s"), url);
@@ -82,7 +82,9 @@ on_url_cb (GtkHTML *html, const char *url, gpointer data)
/* Converts a time_t to a string, relative to the specified timezone */
static char *
-timet_to_str_with_zone (ECalComponentDateTime *dt, ECal *ecal, icaltimezone *default_zone)
+timet_to_str_with_zone (ECalComponentDateTime *dt,
+ ECal *ecal,
+ icaltimezone *default_zone)
{
struct icaltimetype itt;
icaltimezone *zone;
@@ -112,7 +114,10 @@ timet_to_str_with_zone (ECalComponentDateTime *dt, ECal *ecal, icaltimezone *def
}
static void
-write_html (GtkHTMLStream *stream, ECal *ecal, ECalComponent *comp, icaltimezone *default_zone)
+memo_preview_write_html (GtkHTMLStream *stream,
+ ECal *ecal,
+ ECalComponent *comp,
+ icaltimezone *default_zone)
{
ECalComponentText text;
ECalComponentDateTime dt;
@@ -232,135 +237,120 @@ write_html (GtkHTMLStream *stream, ECal *ecal, ECalComponent *comp, icaltimezone
}
static void
-e_cal_component_memo_preview_init (ECalComponentMemoPreview *preview)
+memo_preview_finalize (GObject *object)
{
- ECalComponentMemoPreviewPrivate *priv;
- GtkWidget *scroll;
-
- priv = g_new0 (ECalComponentMemoPreviewPrivate, 1);
- preview->priv = priv;
+ EMemoPreviewPrivate *priv;
- priv->html = gtk_html_new ();
- gtk_html_set_default_content_type (GTK_HTML (priv->html), "charset=utf-8");
- gtk_html_load_empty (GTK_HTML (priv->html));
+ priv = E_MEMO_PREVIEW_GET_PRIVATE (object);
- g_signal_connect (G_OBJECT (priv->html), "url_requested",
- G_CALLBACK (e_cal_comp_preview_url_requested_cb), NULL);
- g_signal_connect (G_OBJECT (priv->html), "link_clicked",
- G_CALLBACK (on_link_clicked), preview);
- g_signal_connect (G_OBJECT (priv->html), "on_url",
- G_CALLBACK (on_url_cb), preview);
+ /* XXX Nothing to do? */
- scroll = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll), GTK_SHADOW_IN);
-
- gtk_container_add (GTK_CONTAINER (scroll), priv->html);
- gtk_container_add (GTK_CONTAINER (preview), scroll);
- gtk_widget_show_all (scroll);
-
- priv->zone = icaltimezone_get_utc_timezone ();
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
-e_cal_component_memo_preview_destroy (GtkObject *object)
+memo_preview_class_init (EMemoPreviewClass *class)
{
- ECalComponentMemoPreview *preview;
- ECalComponentMemoPreviewPrivate *priv;
+ GObjectClass *object_class;
+ GtkHTMLClass *gtkhtml_class;
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_CAL_COMPONENT_MEMO_PREVIEW (object));
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMemoPreviewPrivate));
- preview = E_CAL_COMPONENT_MEMO_PREVIEW (object);
- priv = preview->priv;
+ object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = memo_preview_finalize;
- if (priv) {
-
- g_free (priv);
- preview->priv = NULL;
- }
-
- if (GTK_OBJECT_CLASS (e_cal_component_memo_preview_parent_class)->destroy)
- (* GTK_OBJECT_CLASS (e_cal_component_memo_preview_parent_class)->destroy) (object);
+ gtkhtml_class = GTK_HTML_CLASS (class);
+ gtkhtml_class->link_clicked = memo_preview_link_clicked;
+ gtkhtml_class->on_url = memo_preview_on_url;
}
static void
-e_cal_component_memo_preview_class_init (ECalComponentMemoPreviewClass *klass)
+memo_preview_init (EMemoPreview *preview)
{
- GtkObjectClass *object_class;
+ EMemoPreviewPrivate *priv;
+ GtkHTML *html;
- object_class = (GtkObjectClass *) klass;
+ preview->priv = E_MEMO_PREVIEW_GET_PRIVATE (preview);
- object_class->destroy = e_cal_component_memo_preview_destroy;
+ html = GTK_HTML (preview);
+ gtk_html_set_default_content_type (html, "charset=utf-8");
+ gtk_html_load_empty (html);
+
+ priv->zone = icaltimezone_get_utc_timezone ();
}
-GtkWidget *
-e_cal_component_memo_preview_new (void)
+GType
+e_memo_preview_get_type (void)
{
- ECalComponentMemoPreview *preview;
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMemoPreviewClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) memo_preview_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMemoPreview),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) memo_preview_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_HTML, "EMemoPreview", &type_info, 0);
+ }
- preview = g_object_new (e_cal_component_memo_preview_get_type (), NULL);
+ return type;
+}
- return GTK_WIDGET (preview);
+GtkWidget *
+e_memo_preview_new (void)
+{
+ return g_object_new (E_TYPE_MEMO_PREVIEW, NULL);
}
icaltimezone *
-e_cal_component_memo_preview_get_default_timezone (ECalComponentMemoPreview *preview)
+e_memo_preview_get_default_timezone (EMemoPreview *preview)
{
- ECalComponentMemoPreviewPrivate *priv;
-
- g_return_val_if_fail (preview != NULL, NULL);
- g_return_val_if_fail (E_IS_CAL_COMPONENT_MEMO_PREVIEW (preview), NULL);
-
- priv = preview->priv;
+ g_return_val_if_fail (E_IS_MEMO_PREVIEW (preview), NULL);
- return priv->zone;
+ return preview->priv->zone;
}
void
-e_cal_component_memo_preview_set_default_timezone (ECalComponentMemoPreview *preview, icaltimezone *zone)
+e_memo_preview_set_default_timezone (EMemoPreview *preview,
+ icaltimezone *zone)
{
- ECalComponentMemoPreviewPrivate *priv;
-
- g_return_if_fail (preview != NULL);
- g_return_if_fail (E_IS_CAL_COMPONENT_MEMO_PREVIEW (preview));
+ g_return_if_fail (E_IS_MEMO_PREVIEW (preview));
g_return_if_fail (zone != NULL);
- priv = preview->priv;
-
- priv->zone = zone;
+ preview->priv->zone = zone;
}
void
-e_cal_component_memo_preview_display (ECalComponentMemoPreview *preview, ECal *ecal, ECalComponent *comp)
+e_memo_preview_display (EMemoPreview *preview,
+ ECal *ecal,
+ ECalComponent *comp)
{
- ECalComponentMemoPreviewPrivate *priv;
GtkHTMLStream *stream;
- g_return_if_fail (preview != NULL);
- g_return_if_fail (E_IS_CAL_COMPONENT_MEMO_PREVIEW (preview));
- g_return_if_fail (comp != NULL);
+ g_return_if_fail (E_IS_MEMO_PREVIEW (preview));
g_return_if_fail (E_IS_CAL_COMPONENT (comp));
- priv = preview->priv;
-
- stream = gtk_html_begin (GTK_HTML (priv->html));
- write_html (stream, ecal, comp, priv->zone);
+ stream = gtk_html_begin (GTK_HTML (preview));
+ memo_preview_write_html (stream, ecal, comp, preview->priv->zone);
gtk_html_stream_close (stream, GTK_HTML_STREAM_OK);
}
void
-e_cal_component_memo_preview_clear (ECalComponentMemoPreview *preview)
+e_memo_preview_clear (EMemoPreview *preview)
{
- ECalComponentMemoPreviewPrivate *priv;
-
- g_return_if_fail (preview != NULL);
- g_return_if_fail (E_IS_CAL_COMPONENT_MEMO_PREVIEW (preview));
-
- priv = preview->priv;
+ g_return_if_fail (E_IS_MEMO_PREVIEW (preview));
- gtk_html_load_empty (GTK_HTML (priv->html));
+ gtk_html_load_empty (GTK_HTML (preview));
}
diff --git a/calendar/gui/e-memo-preview.h b/calendar/gui/e-memo-preview.h
new file mode 100644
index 0000000000..50d509e705
--- /dev/null
+++ b/calendar/gui/e-memo-preview.h
@@ -0,0 +1,84 @@
+/*
+ * 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/>
+ *
+ *
+ * Authors:
+ * Federico Mena Quintero <federico@ximian.com>
+ * Damon Chaplin <damon@ximian.com>
+ * Nathan Owens <pianocomp81@yahoo.com>
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MEMO_PREVIEW_H
+#define E_MEMO_PREVIEW_H
+
+#include <gtk/gtk.h>
+#include <libecal/e-cal.h>
+#include <gtkhtml/gtkhtml.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MEMO_PREVIEW \
+ (e_memo_preview_get_type ())
+#define E_MEMO_PREVIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MEMO_PREVIEW, EMemoPreview))
+#define E_MEMO_PREVIEW_CLASS(cls) \
+ (G_TYPE_CHECK_INSTANCE_CAST_CLASS \
+ ((cls), E_TYPE_MEMO_PREVIEW, EMemoPreviewClass))
+#define E_IS_MEMO_PREVIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MEMO_PREVIEW))
+#define E_IS_MEMO_PREVIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MEMO_PREVIEW))
+#define E_MEMO_PREVIEW_GET_CLASS \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MEMO_PREVIEW, EMemoPreviewClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMemoPreview EMemoPreview;
+typedef struct _EMemoPreviewClass EMemoPreviewClass;
+typedef struct _EMemoPreviewPrivate EMemoPreviewPrivate;
+
+struct _EMemoPreview {
+ GtkHTML parent;
+ EMemoPreviewPrivate *priv;
+};
+
+struct _EMemoPreviewClass {
+ GtkHTMLClass parent_class;
+
+ /* Notification signals */
+ void (*selection_changed) (EMemoPreview *preview, int n_selected);
+};
+
+
+GType e_memo_preview_get_type (void);
+GtkWidget * e_memo_preview_new (void);
+icaltimezone * e_memo_preview_get_default_timezone
+ (EMemoPreview *preview);
+void e_memo_preview_set_default_timezone
+ (EMemoPreview *preview,
+ icaltimezone *zone);
+void e_memo_preview_display (EMemoPreview *preview,
+ ECal *ecal,
+ ECalComponent *comp);
+void e_memo_preview_clear (EMemoPreview *preview);
+
+G_END_DECLS
+
+#endif /* E_MEMO_PREVIEW_H */
diff --git a/calendar/gui/e-memo-shell-view-private.c b/calendar/gui/e-memo-shell-view-private.c
deleted file mode 100644
index 36defa31af..0000000000
--- a/calendar/gui/e-memo-shell-view-private.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-memo-shell-view-private.c
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "e-memo-shell-view-private.h"
-
-void
-e_memo_shell_view_private_init (EMemoShellView *memo_shell_view,
- EShellViewClass *shell_view_class)
-{
- EMemoShellViewPrivate *priv = memo_shell_view->priv;
- ESourceList *source_list;
- GObject *object;
-
- object = G_OBJECT (shell_view_class->type_module);
- source_list = g_object_get_data (object, "source-list");
- g_return_if_fail (E_IS_SOURCE_LIST (source_list));
-
- priv->source_list = g_object_ref (source_list);
- priv->memo_actions = gtk_action_group_new ("memos");
- priv->activity_handler = e_activity_handler_new ();
-}
-
-void
-e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view)
-{
- EMemoShellViewPrivate *priv = memo_shell_view->priv;
- EShellContent *shell_content;
- EShellTaskbar *shell_taskbar;
- EShellView *shell_view;
- GtkWidget *container;
- GtkWidget *widget;
-
- shell_view = E_SHELL_VIEW (memo_shell_view);
-
- /* Construct view widgets. */
-
- widget = e_memos_new ();
- shell_content = e_shell_view_get_content (shell_view);
- gtk_container_add (GTK_CONTAINER (shell_content), widget);
- priv->memos = g_object_ref (widget);
- gtk_widget_show (widget);
-
- shell_taskbar = e_shell_view_get_taskbar (shell_view);
- e_activity_handler_attach_task_bar (
- priv->activity_handler, shell_taskbar);
-
- e_memo_shell_view_actions_update (memo_shell_view);
-}
-
-void
-e_memo_shell_view_private_dispose (EMemoShellView *memo_shell_view)
-{
- EMemoShellViewPrivate *priv = memo_shell_view->priv;
-
- DISPOSE (priv->source_list);
-
- DISPOSE (priv->memo_actions);
-
- DISPOSE (priv->memos);
-
- DISPOSE (priv->activity_handler);
-}
-
-void
-e_memo_shell_view_private_finalize (EMemoShellView *memo_shell_view)
-{
- EMemoShellViewPrivate *priv = memo_shell_view->priv;
-}
diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c
index 98f17a7121..8f495a000d 100644
--- a/calendar/gui/e-memo-table.c
+++ b/calendar/gui/e-memo-table.c
@@ -54,12 +54,26 @@
#include "e-cal-model-memos.h"
#include "e-memo-table.h"
#include "e-cell-date-edit-text.h"
-#include "e-comp-editor-registry.h"
#include "print.h"
#include <e-util/e-icon-factory.h>
#include <e-util/e-util-private.h>
#include "e-cal-popup.h"
+#define E_MEMO_TABLE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MEMO_TABLE, EMemoTablePrivate))
+
+struct _EMemoTablePrivate {
+ gpointer shell_view; /* weak pointer */
+
+ EActivity *activity;
+};
+
+enum {
+ PROP_0,
+ PROP_SHELL_VIEW
+};
+
enum TargetType{
TARGET_TYPE_VCALENDAR
};
@@ -72,12 +86,6 @@ static GtkTargetEntry target_types[] = {
static guint n_target_types = G_N_ELEMENTS (target_types);
-extern ECompEditorRegistry *comp_editor_registry;
-
-static void e_memo_table_class_init (EMemoTableClass *klass);
-static void e_memo_table_init (EMemoTable *memo_table);
-static void e_memo_table_destroy (GtkObject *object);
-
static void e_memo_table_on_double_click (ETable *table,
gint row,
gint col,
@@ -111,7 +119,8 @@ enum {
LAST_SIGNAL
};
-static guint signals[LAST_SIGNAL] = { 0 };
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
/* The icons to represent the task. */
#define E_MEMO_MODEL_NUM_ICONS 2
@@ -122,35 +131,14 @@ static GdkPixbuf* icon_pixbufs[E_MEMO_MODEL_NUM_ICONS] = { NULL };
static GdkAtom clipboard_atom = GDK_NONE;
-G_DEFINE_TYPE (EMemoTable, e_memo_table, GTK_TYPE_TABLE)
-
-
static void
-e_memo_table_class_init (EMemoTableClass *klass)
+memo_table_emit_user_created (EMemoTable *memo_table)
{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *) klass;
-
- /* Method override */
- object_class->destroy = e_memo_table_destroy;
-
- signals[USER_CREATED] =
- g_signal_new ("user_created",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EMemoTableClass, user_created),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- /* clipboard atom */
- if (!clipboard_atom)
- clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
+ g_signal_emit (memo_table, signals[USER_CREATED], 0);
}
static gint
-date_compare_cb (gconstpointer a, gconstpointer b)
+memo_table_date_compare_cb (gconstpointer a, gconstpointer b)
{
ECellDateEditValue *dv1 = (ECellDateEditValue *) a;
ECellDateEditValue *dv2 = (ECellDateEditValue *) b;
@@ -178,13 +166,102 @@ date_compare_cb (gconstpointer a, gconstpointer b)
}
static void
-row_appended_cb (ECalModel *model, EMemoTable *memo_table)
+memo_table_set_shell_view (EMemoTable *memo_table,
+ EShellView *shell_view)
{
- g_signal_emit (memo_table, signals[USER_CREATED], 0);
+ g_return_if_fail (memo_table->priv->shell_view == NULL);
+
+ memo_table->priv->shell_view = shell_view;
+
+ g_object_add_weak_pointer (
+ G_OBJECT (shell_view),
+ &memo_table->priv->shell_view);
+}
+
+static void
+memo_table_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SHELL_VIEW:
+ memo_table_set_shell_view (
+ E_MEMO_TABLE (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+memo_table_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SHELL_VIEW:
+ g_value_set_object (
+ value, e_memo_table_get_shell_view (
+ E_MEMO_TABLE (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
-e_memo_table_init (EMemoTable *memo_table)
+memo_table_dispose (GObject *object)
+{
+ EMemoTable *memo_table;
+
+ memo_table = E_MEMO_TABLE (object);
+
+ if (memo_table->model != NULL) {
+ g_object_unref (memo_table->model);
+ memo_table->model = NULL;
+ }
+
+ if (memo_table->priv->activity != NULL) {
+ /* XXX Activity is not cancellable. */
+ e_activity_complete (memo_table->priv->activity);
+ g_object_unref (memo_table->priv->activity);
+ memo_table->priv->activity = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+memo_table_class_init (EMemoTableClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMemoTablePrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = memo_table_set_property;
+ object_class->get_property = memo_table_get_property;
+ object_class->dispose = memo_table_dispose;
+
+ signals[USER_CREATED] =
+ g_signal_new ("user_created",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EMemoTableClass, user_created),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
+}
+
+static void
+memo_table_init (EMemoTable *memo_table)
{
GtkWidget *table;
ETable *e_table;
@@ -194,16 +271,18 @@ e_memo_table_init (EMemoTable *memo_table)
AtkObject *a11y;
gchar *etspecfile;
+ memo_table->priv = E_MEMO_TABLE_GET_PRIVATE (memo_table);
+
/* Create the model */
memo_table->model = (ECalModel *) e_cal_model_memos_new ();
- g_signal_connect (memo_table->model, "row_appended", G_CALLBACK (row_appended_cb), memo_table);
-
- memo_table->user_created_cal = NULL;
+ g_signal_connect_swapped (
+ memo_table->model, "row_appended",
+ G_CALLBACK (memo_table_emit_user_created), memo_table);
/* Create the header columns */
- extras = e_table_extras_new();
+ extras = e_table_extras_new ();
/*
* Normal string fields.
@@ -235,7 +314,7 @@ e_memo_table_init (EMemoTable *memo_table)
/* Sorting */
e_table_extras_add_compare (extras, "date-compare",
- date_compare_cb);
+ memo_table_date_compare_cb);
/* Create pixmaps */
@@ -280,23 +359,57 @@ e_memo_table_init (EMemoTable *memo_table)
atk_object_set_name (a11y, _("Memos"));
}
+GType
+e_memo_table_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMemoTableClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) memo_table_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMemoTable),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) memo_table_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_TABLE, "EMemoTable", &type_info, 0);
+ }
+
+ return type;
+}
/**
* e_memo_table_new:
- * @Returns: a new #EMemoTable.
+ * @shell_view: an #EShellView
+ *
+ * Returns a new #EMemoTable.
*
- * Creates a new #EMemoTable.
+ * Returns: a new #EMemoTable
**/
GtkWidget *
-e_memo_table_new (void)
+e_memo_table_new (EShellView *shell_view)
{
- GtkWidget *memo_table;
-
- memo_table = GTK_WIDGET (g_object_new (e_memo_table_get_type (), NULL));
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
- return memo_table;
+ return g_object_new (
+ E_TYPE_MEMO_TABLE,
+ "shell-view", shell_view, NULL);
}
+EShellView *
+e_memo_table_get_shell_view (EMemoTable *memo_table)
+{
+ g_return_val_if_fail (E_IS_MEMO_TABLE (memo_table), NULL);
+
+ return memo_table->priv->shell_view;
+}
/**
* e_memo_table_get_model:
@@ -316,21 +429,6 @@ e_memo_table_get_model (EMemoTable *memo_table)
}
-static void
-e_memo_table_destroy (GtkObject *object)
-{
- EMemoTable *memo_table;
-
- memo_table = E_MEMO_TABLE (object);
-
- if (memo_table->model) {
- g_object_unref (memo_table->model);
- memo_table->model = NULL;
- }
-
- GTK_OBJECT_CLASS (e_memo_table_parent_class)->destroy (object);
-}
-
/**
* e_memo_table_get_table:
* @memo_table: A calendar table.
@@ -749,7 +847,7 @@ open_memo (EMemoTable *memo_table, ECalModelComponent *comp_data)
uid = icalcomponent_get_uid (comp_data->icalcomp);
- medit = e_comp_editor_registry_find (comp_editor_registry, uid);
+ medit = comp_editor_find_instance (uid);
if (medit == NULL) {
ECalComponent *comp;
CompEditorFlags flags = 0;
@@ -767,8 +865,6 @@ open_memo (EMemoTable *memo_table, ECalModelComponent *comp_data)
comp_editor_edit_comp (medit, comp);
g_object_unref (comp);
-
- e_comp_editor_registry_add (comp_editor_registry, medit, FALSE);
}
gtk_window_present (GTK_WINDOW (medit));
@@ -1096,34 +1192,29 @@ static char *test[] = {
#endif
void
-e_memo_table_set_activity_handler (EMemoTable *memo_table, EActivityHandler *activity_handler)
+e_memo_table_set_status_message (EMemoTable *memo_table,
+ const gchar *message)
{
- g_return_if_fail (E_IS_MEMO_TABLE (memo_table));
+ EActivity *activity;
+ EShellView *shell_view;
- memo_table->activity_handler = activity_handler;
-}
-
-void
-e_memo_table_set_status_message (EMemoTable *memo_table, const gchar *message)
-{
g_return_if_fail (E_IS_MEMO_TABLE (memo_table));
- if (!memo_table->activity_handler)
- return;
+ activity = memo_table->priv->activity;
+ shell_view = e_memo_table_get_shell_view (memo_table);
- if (!message || !*message) {
- if (memo_table->activity_id != 0) {
- e_activity_handler_operation_finished (memo_table->activity_handler, memo_table->activity_id);
- memo_table->activity_id = 0;
+ if (message == NULL || *message == '\0') {
+ if (activity != NULL) {
+ e_activity_complete (activity);
+ g_object_unref (activity);
+ memo_table->priv->activity = NULL;
}
- } else if (memo_table->activity_id == 0) {
- char *client_id = g_strdup_printf ("%p", memo_table);
- memo_table->activity_id = e_activity_handler_operation_started (
- memo_table->activity_handler, client_id, message, TRUE);
+ } else if (activity == NULL) {
+ activity = e_activity_new (message);
+ memo_table->priv->activity = activity;
+ e_shell_view_add_activity (shell_view, activity);
- g_free (client_id);
- } else {
- e_activity_handler_operation_progressing (memo_table->activity_handler, memo_table->activity_id, message, -1.0);
- }
+ } else
+ e_activity_set_primary_text (activity, message);
}
diff --git a/calendar/gui/e-memo-table.h b/calendar/gui/e-memo-table.h
index 58f398bfb5..2c31ee5b02 100644
--- a/calendar/gui/e-memo-table.h
+++ b/calendar/gui/e-memo-table.h
@@ -25,31 +25,43 @@
#ifndef _E_MEMO_TABLE_H_
#define _E_MEMO_TABLE_H_
-#include <gtk/gtk.h>
-#include <table/e-table-scrolled.h>
+#include <shell/e-shell-view.h>
+#include <widgets/table/e-table-scrolled.h>
#include <widgets/misc/e-cell-date-edit.h>
-#include "e-activity-handler.h"
#include "e-cal-model.h"
-G_BEGIN_DECLS
-
/*
* EMemoTable - displays the iCalendar objects in a table (an ETable).
* Used for memo events and tasks.
*/
+/* Standard GObject macros */
+#define E_TYPE_MEMO_TABLE \
+ (e_memo_table_get_type ())
+#define E_MEMO_TABLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MEMO_TABLE, EMemoTable))
+#define E_MEMO_TABLE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MEMO_TABLE, EMemoTableClass))
+#define E_IS_MEMO_TABLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MEMO_TABLE))
+#define E_IS_MEMO_TABLE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MEMO_TABLE))
+#define E_MEMO_TABLE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MEMO_TABLE, EMemoTableClass))
-#define E_MEMO_TABLE(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, e_memo_table_get_type (), EMemoTable)
-#define E_MEMO_TABLE_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, e_memo_table_get_type (), EMemoTableClass)
-#define E_IS_MEMO_TABLE(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, e_memo_table_get_type ())
-
-
-typedef struct _EMemoTable EMemoTable;
-typedef struct _EMemoTableClass EMemoTableClass;
+G_BEGIN_DECLS
+typedef struct _EMemoTable EMemoTable;
+typedef struct _EMemoTableClass EMemoTableClass;
+typedef struct _EMemoTablePrivate EMemoTablePrivate;
struct _EMemoTable {
- GtkTable table;
+ GtkTable parent;
/* The model that we use */
ECalModel *model;
@@ -62,13 +74,12 @@ struct _EMemoTable {
/* Fields used for cut/copy/paste */
icalcomponent *tmp_vcal;
- /* Activity ID for the EActivityHandler (i.e. the status bar). */
- EActivityHandler *activity_handler;
- guint activity_id;
-
- /* We should know which calendar has been used to create object, so store it here
- before emitting "user_created" signal and make it NULL just after the emit. */
+ /* We should know which calendar has been used to create object,
+ * so store it here before emitting "user_created" signal and make
+ * it NULL just after the emit. */
ECal *user_created_cal;
+
+ EMemoTablePrivate *priv;
};
struct _EMemoTableClass {
@@ -79,34 +90,29 @@ struct _EMemoTableClass {
};
-GType e_memo_table_get_type (void);
-GtkWidget* e_memo_table_new (void);
-
-ECalModel *e_memo_table_get_model (EMemoTable *memo_table);
-
-ETable *e_memo_table_get_table (EMemoTable *memo_table);
-
-void e_memo_table_open_selected (EMemoTable *memo_table);
-void e_memo_table_delete_selected (EMemoTable *memo_table);
-
-GSList *e_memo_table_get_selected (EMemoTable *memo_table);
+GType e_memo_table_get_type (void);
+GtkWidget * e_memo_table_new (EShellView *shell_view);
+ECalModel * e_memo_table_get_model (EMemoTable *memo_table);
+ETable * e_memo_table_get_table (EMemoTable *memo_table);
+EShellView * e_memo_table_get_shell_view (EMemoTable *memo_table);
+void e_memo_table_open_selected (EMemoTable *memo_table);
+void e_memo_table_delete_selected (EMemoTable *memo_table);
+GSList * e_memo_table_get_selected (EMemoTable *memo_table);
/* Clipboard related functions */
-void e_memo_table_cut_clipboard (EMemoTable *memo_table);
-void e_memo_table_copy_clipboard (EMemoTable *memo_table);
-void e_memo_table_paste_clipboard (EMemoTable *memo_table);
+void e_memo_table_cut_clipboard (EMemoTable *memo_table);
+void e_memo_table_copy_clipboard (EMemoTable *memo_table);
+void e_memo_table_paste_clipboard (EMemoTable *memo_table);
/* These load and save the state of the table (headers shown etc.) to/from
the given file. */
-void e_memo_table_load_state (EMemoTable *memo_table,
- gchar *filename);
-void e_memo_table_save_state (EMemoTable *memo_table,
- gchar *filename);
-
-void e_memo_table_set_activity_handler (EMemoTable *memo_table,
- EActivityHandler *activity_handler);
-void e_memo_table_set_status_message (EMemoTable *memo_table,
- const gchar *message);
+void e_memo_table_load_state (EMemoTable *memo_table,
+ gchar *filename);
+void e_memo_table_save_state (EMemoTable *memo_table,
+ gchar *filename);
+
+void e_memo_table_set_status_message (EMemoTable *memo_table,
+ const gchar *message);
G_END_DECLS
diff --git a/calendar/gui/e-memos.c b/calendar/gui/e-memos.c
index cc033942b4..5e162f8a28 100644
--- a/calendar/gui/e-memos.c
+++ b/calendar/gui/e-memos.c
@@ -69,9 +69,6 @@ struct _EMemosPrivate {
/* Calendar search bar for memos */
GtkWidget *search_bar;
- /* Paned widget */
- GtkWidget *paned;
-
/* The preview */
GtkWidget *preview;
@@ -90,7 +87,6 @@ static void e_memos_destroy (GtkObject *object);
static void update_view (EMemos *memos);
static void categories_changed_cb (gpointer object, gpointer user_data);
-static void backend_error_cb (ECal *client, const char *message, gpointer data);
/* Signal IDs */
enum {
@@ -100,100 +96,10 @@ enum {
LAST_SIGNAL
};
-enum DndTargetType {
- TARGET_VCALENDAR
-};
-
-static GtkTargetEntry list_drag_types[] = {
- { "text/calendar", 0, TARGET_VCALENDAR },
- { "text/x-calendar", 0, TARGET_VCALENDAR }
-};
-static const int num_list_drag_types = sizeof (list_drag_types) / sizeof (list_drag_types[0]);
-
static guint e_memos_signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (EMemos, e_memos, GTK_TYPE_TABLE)
-/* Callback used when the cursor changes in the table */
-static void
-table_cursor_change_cb (ETable *etable, int row, gpointer data)
-{
- EMemos *memos;
- EMemosPrivate *priv;
- ECalModel *model;
- ECalModelComponent *comp_data;
- ECalComponent *comp;
- const char *uid;
-
- int n_selected;
-
- memos = E_MEMOS (data);
- priv = memos->priv;
-
- n_selected = e_table_selected_count (etable);
-
- /* update the HTML widget */
- if (n_selected != 1) {
- e_cal_component_memo_preview_clear (E_CAL_COMPONENT_MEMO_PREVIEW (priv->preview));
-
- return;
- }
-
- model = e_memo_table_get_model (E_MEMO_TABLE (priv->memos_view));
-
- comp_data = e_cal_model_get_component_at (model, e_table_get_cursor_row (etable));
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
-
- e_cal_component_memo_preview_display (E_CAL_COMPONENT_MEMO_PREVIEW (priv->preview), comp_data->client, comp);
-
- e_cal_component_get_uid (comp, &uid);
- if (priv->current_uid)
- g_free (priv->current_uid);
- priv->current_uid = g_strdup (uid);
-
- g_object_unref (comp);
-}
-
-/* Callback used when the selection changes in the table. */
-static void
-table_selection_change_cb (ETable *etable, gpointer data)
-{
- EMemos *memos;
- int n_selected;
-
- memos = E_MEMOS (data);
-
- n_selected = e_table_selected_count (etable);
- g_signal_emit (memos, e_memos_signals[SELECTION_CHANGED], 0, n_selected);
-
- if (n_selected != 1)
- e_cal_component_memo_preview_clear (E_CAL_COMPONENT_MEMO_PREVIEW (memos->priv->preview));
-
-}
-
-static void
-user_created_cb (GtkWidget *view, EMemos *memos)
-{
- EMemosPrivate *priv;
- EMemoTable *memo_table;
- ECal *ecal;
-
- priv = memos->priv;
- memo_table = E_MEMO_TABLE (priv->memos_view);
-
- if (memo_table->user_created_cal)
- ecal = memo_table->user_created_cal;
- else {
- ECalModel *model;
-
- model = e_memo_table_get_model (E_MEMO_TABLE (priv->memos_view));
- ecal = e_cal_model_get_default_client (model);
- }
-
- e_memos_add_memo_source (memos, e_cal_get_source (ecal));
-}
-
/* Callback used when the sexp in the search bar changes */
static void
search_bar_sexp_changed_cb (CalSearchBar *cal_search, const char *sexp, gpointer data)
@@ -227,14 +133,6 @@ search_bar_category_changed_cb (CalSearchBar *cal_search, const char *category,
e_cal_model_set_default_category (model, category);
}
-static gboolean
-vpaned_resized_cb (GtkWidget *widget, GdkEventButton *event, EMemos *memos)
-{
- calendar_config_set_task_vpane_pos (gtk_paned_get_position (GTK_PANED (widget)));
-
- return FALSE;
-}
-
static void
set_timezone (EMemos *memos)
{
@@ -285,33 +183,6 @@ update_view (EMemos *memos)
}
static void
-model_row_changed_cb (ETableModel *etm, int row, gpointer data)
-{
- EMemos *memos;
- EMemosPrivate *priv;
- ECalModelComponent *comp_data;
-
- memos = E_MEMOS (data);
- priv = memos->priv;
-
- if (priv->current_uid) {
- const char *uid;
-
- comp_data = e_cal_model_get_component_at (E_CAL_MODEL (etm), row);
- if (comp_data) {
- uid = icalcomponent_get_uid (comp_data->icalcomp);
- if (!strcmp (uid ? uid : "", priv->current_uid)) {
- ETable *etable;
-
- etable = e_table_scrolled_get_table (
- E_TABLE_SCROLLED (E_MEMO_TABLE (priv->memos_view)->etable));
- table_cursor_change_cb (etable, 0, memos);
- }
- }
- }
-}
-
-static void
setup_config (EMemos *memos)
{
EMemosPrivate *priv;
@@ -447,35 +318,6 @@ table_drag_data_get (ETable *table,
}
static void
-table_drag_data_delete (ETable *table,
- int row,
- int col,
- GdkDragContext *context,
- EMemos *memos)
-{
- /* Moved components are deleted from source immediately when moved,
- because some of them can be part of destination source, and we
- don't want to delete not-moved tasks. There is no such information
- which event has been moved and which not, so skip this method.
- */
-}
-
-#define E_MEMOS_TABLE_DEFAULT_STATE \
- "<?xml version=\"1.0\"?>" \
- "<ETableState>" \
- "<column source=\"1\"/>" \
- "<column source=\"0\"/>" \
- "<column source=\"2\"/>" \
- "<grouping></grouping>" \
- "</ETableState>"
-
-static void
-pane_realized (GtkWidget *widget, EMemos *memos)
-{
- gtk_paned_set_position ((GtkPaned *)widget, calendar_config_get_task_vpane_pos ());
-}
-
-static void
setup_widgets (EMemos *memos)
{
EMemosPrivate *priv;
@@ -496,51 +338,12 @@ setup_widgets (EMemos *memos)
GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0, 0);
gtk_widget_show (priv->search_bar);
- /* add the paned widget for the memo list and memo detail areas */
- priv->paned = gtk_vpaned_new ();
- g_signal_connect (priv->paned, "realize", G_CALLBACK (pane_realized), memos);
-
- g_signal_connect (G_OBJECT (priv->paned), "button_release_event",
- G_CALLBACK (vpaned_resized_cb), memos);
- gtk_table_attach (GTK_TABLE (memos), priv->paned, 0, 1, 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (priv->paned);
-
/* create the memo list */
priv->memos_view = e_memo_table_new ();
priv->memos_view_config = e_memo_table_config_new (E_MEMO_TABLE (priv->memos_view));
- g_signal_connect (priv->memos_view, "user_created", G_CALLBACK (user_created_cb), memos);
-
- etable = e_table_scrolled_get_table (
- E_TABLE_SCROLLED (E_MEMO_TABLE (priv->memos_view)->etable));
- e_table_set_state (etable, E_MEMOS_TABLE_DEFAULT_STATE);
-
- gtk_paned_add1 (GTK_PANED (priv->paned), priv->memos_view);
- gtk_widget_show (priv->memos_view);
-
-
- e_table_drag_source_set (etable, GDK_BUTTON1_MASK,
- list_drag_types, num_list_drag_types,
- GDK_ACTION_MOVE|GDK_ACTION_COPY|GDK_ACTION_ASK);
-
g_signal_connect (etable, "table_drag_data_get",
G_CALLBACK(table_drag_data_get), memos);
- g_signal_connect (etable, "table_drag_data_delete",
- G_CALLBACK(table_drag_data_delete), memos);
-
- g_signal_connect (etable, "cursor_change", G_CALLBACK (table_cursor_change_cb), memos);
- g_signal_connect (etable, "selection_change", G_CALLBACK (table_selection_change_cb), memos);
-
- /* create the memo detail */
- priv->preview = e_cal_component_memo_preview_new ();
- e_cal_component_memo_preview_set_default_timezone (E_CAL_COMPONENT_MEMO_PREVIEW (priv->preview), calendar_config_get_icaltimezone ());
- gtk_paned_add2 (GTK_PANED (priv->paned), priv->preview);
- gtk_widget_show (priv->preview);
-
- model = e_memo_table_get_model (E_MEMO_TABLE (priv->memos_view));
- g_signal_connect (G_OBJECT (model), "model_row_changed",
- G_CALLBACK (model_row_changed_cb), memos);
}
/* Class initialization function for the gnome calendar */
@@ -675,10 +478,6 @@ e_memos_destroy (GtkObject *object)
g_hash_table_destroy (priv->clients);
g_list_free (priv->clients_list);
- if (priv->default_client)
- g_object_unref (priv->default_client);
- priv->default_client = NULL;
-
if (priv->current_uid) {
g_free (priv->current_uid);
priv->current_uid = NULL;
@@ -725,56 +524,6 @@ set_status_message (EMemos *memos, const char *message, ...)
e_memo_table_set_status_message (E_MEMO_TABLE (priv->memos_view), msg_string);
}
-/* Callback from the calendar client when an error occurs in the backend */
-static void
-backend_error_cb (ECal *client, const char *message, gpointer data)
-{
- EMemos *memos;
- GtkWidget *dialog;
- char *urinopwd;
-
- memos = E_MEMOS (data);
-
- urinopwd = get_uri_without_password (e_cal_get_uri (client));
-
- dialog = gtk_message_dialog_new (
- GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (memos))),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Error on %s:\n %s"), urinopwd, message);
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
-
- g_free (urinopwd);
-}
-
-/* Callback from the calendar client when the backend dies */
-static void
-backend_died_cb (ECal *client, gpointer data)
-{
- EMemos *memos;
- EMemosPrivate *priv;
- ESource *source;
-
- memos = E_MEMOS (data);
- priv = memos->priv;
-
- source = g_object_ref (e_cal_get_source (client));
-
- priv->clients_list = g_list_remove (priv->clients_list, client);
- g_hash_table_remove (priv->clients, e_source_peek_uid (source));
-
- g_signal_emit (memos, e_memos_signals[SOURCE_REMOVED], 0, source);
-
- e_memo_table_set_status_message (E_MEMO_TABLE (e_memos_get_calendar_table (memos)), NULL);
-
- e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (memos))),
- "calendar:memos-crashed", NULL);
-
- g_object_unref (source);
-}
-
/* Callback from the calendar client when the calendar is opened */
static void
client_cal_opened_cb (ECal *ecal, ECalendarStatus status, EMemos *memos)
@@ -880,21 +629,6 @@ open_ecal (EMemos *memos, ECal *cal, gboolean only_if_exists, open_func of)
return TRUE;
}
-void
-e_memos_open_memo (EMemos *memos)
-{
- EMemoTable *cal_table;
-
- cal_table = e_memos_get_calendar_table (memos);
- e_memo_table_open_selected (cal_table);
-}
-
-void
-e_memos_new_memo (EMemos *memos)
-{
- /* used for click_to_add ?? Can't figure out anything else it's used for */
-}
-
gboolean
e_memos_add_memo_source (EMemos *memos, ESource *source)
{
@@ -1024,173 +758,3 @@ e_memos_get_default_client (EMemos *memos)
return e_cal_model_get_default_client (e_memo_table_get_model (E_MEMO_TABLE (priv->memos_view)));
}
-
-
-/**
- * e_memos_delete_selected:
- * @memos: A memos control widget.
- *
- * Deletes the selected memos in the memo list.
- **/
-void
-e_memos_delete_selected (EMemos *memos)
-{
- EMemosPrivate *priv;
- EMemoTable *cal_table;
-
- g_return_if_fail (memos != NULL);
- g_return_if_fail (E_IS_MEMOS (memos));
-
- priv = memos->priv;
-
- cal_table = E_MEMO_TABLE (priv->memos_view);
- set_status_message (memos, _("Deleting selected objects..."));
- e_memo_table_delete_selected (cal_table);
- set_status_message (memos, NULL);
-
- e_cal_component_memo_preview_clear (E_CAL_COMPONENT_MEMO_PREVIEW (priv->preview));
-}
-
-
-/* Callback used from the view collection when we need to display a new view */
-static void
-display_view_cb (GalViewInstance *instance, GalView *view, gpointer data)
-{
- EMemos *memos;
-
- memos = E_MEMOS (data);
-
- if (GAL_IS_VIEW_ETABLE (view)) {
- gal_view_etable_attach_table (GAL_VIEW_ETABLE (view), e_table_scrolled_get_table (E_TABLE_SCROLLED (E_MEMO_TABLE (memos->priv->memos_view)->etable)));
- }
-
- gtk_paned_set_position ((GtkPaned *)memos->priv->paned, calendar_config_get_task_vpane_pos ());
-}
-
-/**
- * e_memos_setup_view_menus:
- * @memos: A memos widget.
- * @uic: UI controller to use for the menus.
- *
- * Sets up the #GalView menus for a memos control. This function should be
- * called from the Bonobo control activation callback for this memos control.
- * Also, the menus should be discarded using e_memos_discard_view_menus().
- */
-void
-e_memos_setup_view_menus (EMemos *memos, BonoboUIComponent *uic)
-{
- EMemosPrivate *priv;
- GalViewFactory *factory;
- ETableSpecification *spec;
- char *dir0, *dir1, *filename;
- static GalViewCollection *collection = NULL;
-
- g_return_if_fail (memos != NULL);
- g_return_if_fail (E_IS_MEMOS (memos));
- g_return_if_fail (uic != NULL);
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (uic));
-
- priv = memos->priv;
-
- g_return_if_fail (priv->view_instance == NULL);
-
- g_return_if_fail (priv->view_instance == NULL);
- g_return_if_fail (priv->view_menus == NULL);
-
- /* Create the view instance */
-
- if (collection == NULL) {
- collection = gal_view_collection_new ();
-
- gal_view_collection_set_title (collection, _("Memos"));
-
- dir0 = g_build_filename (EVOLUTION_GALVIEWSDIR,
- "memos",
- NULL);
- dir1 = g_build_filename (memos_component_peek_base_directory (memos_component_peek ()),
- "views", NULL);
- gal_view_collection_set_storage_directories (collection,
- dir0,
- dir1);
- g_free (dir1);
- g_free (dir0);
-
- /* Create the views */
-
- spec = e_table_specification_new ();
- filename = g_build_filename (EVOLUTION_ETSPECDIR,
- "e-memo-table.etspec",
- NULL);
- if (!e_table_specification_load_from_file (spec, filename))
- g_error ("Unable to load ETable specification file "
- "for memos");
- g_free (filename);
-
- factory = gal_view_factory_etable_new (spec);
- g_object_unref (spec);
- gal_view_collection_add_factory (collection, factory);
- g_object_unref (factory);
-
- /* Load the collection and create the menus */
-
- gal_view_collection_load (collection);
- }
-
- priv->view_instance = gal_view_instance_new (collection, NULL);
-
- priv->view_menus = gal_view_menus_new (priv->view_instance);
- gal_view_menus_apply (priv->view_menus, uic, NULL);
- g_signal_connect (priv->view_instance, "display_view", G_CALLBACK (display_view_cb), memos);
- display_view_cb (priv->view_instance, gal_view_instance_get_current_view (priv->view_instance), memos);
-}
-
-/**
- * e_memos_discard_view_menus:
- * @memos: A memos widget.
- *
- * Discards the #GalView menus used by a memos control. This function should be
- * called from the Bonobo control deactivation callback for this memos control.
- * The menus should have been set up with e_memos_setup_view_menus().
- **/
-void
-e_memos_discard_view_menus (EMemos *memos)
-{
- EMemosPrivate *priv;
-
- g_return_if_fail (memos != NULL);
- g_return_if_fail (E_IS_MEMOS (memos));
-
- priv = memos->priv;
-
- g_return_if_fail (priv->view_instance != NULL);
-
- g_return_if_fail (priv->view_instance != NULL);
- g_return_if_fail (priv->view_menus != NULL);
-
- g_object_unref (priv->view_instance);
- priv->view_instance = NULL;
-
- g_object_unref (priv->view_menus);
- priv->view_menus = NULL;
-}
-
-/**
- * e_memos_get_calendar_table:
- * @memos: A memos widget.
- *
- * Queries the #EMemoTable contained in a memos widget.
- *
- * Return value: The #EMemoTable that the memos widget uses to display its
- * information.
- **/
-EMemoTable *
-e_memos_get_calendar_table (EMemos *memos)
-{
- EMemosPrivate *priv;
-
- g_return_val_if_fail (memos != NULL, NULL);
- g_return_val_if_fail (E_IS_MEMOS (memos), NULL);
-
- priv = memos->priv;
- return E_MEMO_TABLE (priv->memos_view);
-}
diff --git a/calendar/gui/e-select-names-renderer.c b/calendar/gui/e-select-names-renderer.c
index fb742bf5c7..357eba4c5b 100644
--- a/calendar/gui/e-select-names-renderer.c
+++ b/calendar/gui/e-select-names-renderer.c
@@ -22,7 +22,7 @@
#include <config.h>
-#include "e-calendar-marshal.h"
+#include "e-util/e-util.h"
#include "e-select-names-editable.h"
#include "e-select-names-renderer.h"
@@ -192,7 +192,7 @@ e_select_names_renderer_class_init (ESelectNamesRendererClass *class)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ESelectNamesRendererClass, cell_edited),
NULL, NULL,
- e_calendar_marshal_VOID__STRING_POINTER_POINTER,
+ e_marshal_VOID__STRING_POINTER_POINTER,
G_TYPE_NONE, 3,
G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_POINTER);
}
diff --git a/calendar/gui/e-task-shell-view-private.c b/calendar/gui/e-task-shell-view-private.c
deleted file mode 100644
index e41b1fb5bc..0000000000
--- a/calendar/gui/e-task-shell-view-private.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-task-shell-view-private.c
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "e-task-shell-view-private.h"
-
-void
-e_task_shell_view_private_init (ETaskShellView *task_shell_view,
- EShellViewClass *shell_view_class)
-{
- ETaskShellViewPrivate *priv = task_shell_view->priv;
- ESourceList *source_list;
- GObject *object;
-
- object = G_OBJECT (shell_view_class->type_module);
- source_list = g_object_get_data (object, "source-list");
- g_return_if_fail (E_IS_SOURCE_LIST (source_list));
-
- priv->source_list = g_object_ref (source_list);
- priv->task_actions = gtk_action_group_new ("tasks");
-}
-
-void
-e_task_shell_view_private_constructed (ETaskShellView *task_shell_view)
-{
- ETaskShellViewPrivate *priv = task_shell_view->priv;
-}
-
-void
-e_task_shell_view_private_dispose (ETaskShellView *task_shell_view)
-{
- ETaskShellViewPrivate *priv = task_shell_view->priv;
-
- DISPOSE (priv->source_list);
-
- DISPOSE (priv->task_actions);
-}
-
-void
-e_task_shell_view_private_finalize (ETaskShellView *task_shell_view)
-{
- ETaskShellViewPrivate *priv = task_shell_view->priv;
-}
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index b866439413..732f031c1c 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -109,16 +109,6 @@ enum {
LAST_SIGNAL
};
-enum DndTargetType {
- TARGET_VCALENDAR
-};
-
-static GtkTargetEntry list_drag_types[] = {
- { "text/calendar", 0, TARGET_VCALENDAR },
- { "text/x-calendar", 0, TARGET_VCALENDAR }
-};
-static const int num_list_drag_types = sizeof (list_drag_types) / sizeof (list_drag_types[0]);
-
static guint e_tasks_signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (ETasks, e_tasks, GTK_TYPE_TABLE)
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 4d65f094b8..b20781186f 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -44,12 +44,10 @@
#include <libedataserver/e-url.h>
#include <libedataserverui/e-passwords.h>
-#include "shell/e-user-creatable-items-handler.h"
#include <libecal/e-cal-time-util.h>
#include <widgets/menus/gal-view-factory-etable.h>
#include <widgets/menus/gal-view-etable.h>
#include <widgets/menus/gal-define-views-dialog.h>
-#include "widgets/menus/gal-view-menus.h"
#include "e-util/e-error.h"
#include "e-util/e-util-private.h"
#include "e-comp-editor-registry.h"
@@ -57,7 +55,6 @@
#include "dialogs/event-editor.h"
#include "dialogs/task-editor.h"
#include "comp-util.h"
-#include "e-calendar-marshal.h"
#include "e-cal-model-calendar.h"
#include "e-day-view.h"
#include "e-day-view-config.h"
@@ -69,10 +66,7 @@
#include "e-mini-calendar-config.h"
#include "e-calendar-table-config.h"
#include "e-memo-table-config.h"
-#include "evolution-calendar.h"
#include "gnome-cal.h"
-#include "calendar-component.h"
-#include "memos-component.h"
#include "cal-search-bar.h"
#include "calendar-commands.h"
#include "calendar-config.h"
@@ -86,11 +80,6 @@
#include "e-cal-menu.h"
#include "e-cal-model-tasks.h"
-/* FIXME glib 2.4 and above has this */
-#ifndef G_MAXINT32
-#define G_MAXINT32 ((gint32) 0x7fffffff)
-#endif
-
#define d(x) x
/* Private part of the GnomeCalendar structure */
@@ -369,7 +358,7 @@ gnome_calendar_class_init (GnomeCalendarClass *class)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GnomeCalendarClass, source_added),
NULL, NULL,
- e_calendar_marshal_VOID__INT_OBJECT,
+ e_marshal_VOID__INT_OBJECT,
G_TYPE_NONE,
2,
G_TYPE_INT, G_TYPE_OBJECT);
@@ -380,7 +369,7 @@ gnome_calendar_class_init (GnomeCalendarClass *class)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GnomeCalendarClass, source_removed),
NULL, NULL,
- e_calendar_marshal_VOID__INT_OBJECT,
+ e_marshal_VOID__INT_OBJECT,
G_TYPE_NONE,
2,
G_TYPE_INT, G_TYPE_OBJECT);
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index 820c29c9f9..2a3fab8b42 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -62,8 +62,6 @@
#define CONFIG_CONTROL_ID "OAFIID:GNOME_Evolution_Calendar_ConfigControl:" BASE_VERSION
#define COMP_EDITOR_FACTORY_ID "OAFIID:GNOME_Evolution_Calendar_CompEditorFactory:" BASE_VERSION
-ECompEditorRegistry *comp_editor_registry = NULL;
-
/* The component editor factory */
static CompEditorFactory *comp_editor_factory = NULL;
diff --git a/calendar/gui/memos-component.c b/calendar/gui/memos-component.c
index 4927dde9db..fb3bb451d9 100644
--- a/calendar/gui/memos-component.c
+++ b/calendar/gui/memos-component.c
@@ -65,10 +65,6 @@
static BonoboObjectClass *parent_class = NULL;
-/* Memos should have their own registry */
-extern ECompEditorRegistry *comp_editor_registry;
-
-
typedef struct _MemosComponentView
{
ESourceList *source_list;
@@ -79,7 +75,6 @@ typedef struct _MemosComponentView
ETable *table;
ETableModel *model;
- EInfoLabel *info_label;
GtkWidget *source_selector;
BonoboControl *view_control;
@@ -88,9 +83,6 @@ typedef struct _MemosComponentView
GList *notifications;
- EUserCreatableItemsHandler *creatable_items_handler;
-
- EActivityHandler *activity_handler;
} MemosComponentView;
struct _MemosComponentPrivate {
@@ -733,15 +725,6 @@ create_local_item_cb (EUserCreatableItemsHandler *handler, const char *item_type
priv = memos_component->priv;
- for (l = priv->views; l; l = l->next) {
- component_view = l->data;
-
- if (component_view->creatable_items_handler == handler)
- break;
-
- component_view = NULL;
- }
-
if (strcmp (item_type_name, CREATE_MEMO_ID) == 0) {
create_new_memo (memos_component, FALSE, component_view);
} else if (strcmp (item_type_name, CREATE_SHARED_MEMO_ID) == 0) {
@@ -787,8 +770,6 @@ create_component_view (MemosComponent *memos_component)
g_signal_connect (component_view->memos, "source_removed",
G_CALLBACK (source_removed_cb), component_view);
- e_memo_table_set_activity_handler (e_memos_get_calendar_table (component_view->memos), component_view->activity_handler);
-
/* connect after setting the initial selections, or we'll get unwanted calls
to calendar_control_sensitize_calendar_commands */
g_signal_connect (component_view->source_selector, "selection_changed",
@@ -820,69 +801,10 @@ destroy_component_view (MemosComponentView *component_view)
calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
g_list_free (component_view->notifications);
- if (component_view->creatable_items_handler)
- g_object_unref (component_view->creatable_items_handler);
-
- if (component_view->activity_handler)
- g_object_unref (component_view->activity_handler);
-
g_free (component_view);
}
static void
-view_destroyed_cb (gpointer data, GObject *where_the_object_was)
-{
- MemosComponent *memos_component = data;
- MemosComponentPrivate *priv;
- GList *l;
-
- priv = memos_component->priv;
-
- for (l = priv->views; l; l = l->next) {
- MemosComponentView *component_view = l->data;
-
- if (G_OBJECT (component_view->view_control) == where_the_object_was) {
- priv->views = g_list_remove (priv->views, component_view);
- destroy_component_view (component_view);
-
- break;
- }
- }
-}
-
-static GNOME_Evolution_ComponentView
-impl_createView (PortableServer_Servant servant,
- GNOME_Evolution_ShellView parent,
- CORBA_boolean select_item,
- CORBA_Environment *ev)
-{
- MemosComponent *component = MEMOS_COMPONENT (bonobo_object_from_servant (servant));
- MemosComponentPrivate *priv;
- MemosComponentView *component_view;
- EComponentView *ecv;
-
- priv = component->priv;
-
- /* Create the calendar component view */
- component_view = create_component_view (component);
- if (!component_view) {
- /* FIXME Should we describe the problem in a control? */
- bonobo_exception_set (ev, ex_GNOME_Evolution_Component_Failed);
-
- return CORBA_OBJECT_NIL;
- }
-
- g_object_weak_ref (G_OBJECT (component_view->view_control), view_destroyed_cb, component);
- priv->views = g_list_append (priv->views, component_view);
-
- /* TODO: Make CalendarComponentView just subclass EComponentView */
- ecv = e_component_view_new_controls (parent, "memos", component_view->sidebar_control,
- component_view->view_control, component_view->statusbar_control);
-
- return BONOBO_OBJREF(ecv);
-}
-
-static void
impl_requestCreateItem (PortableServer_Servant servant,
const CORBA_char *item_type_name,
CORBA_Environment *ev)
@@ -928,14 +850,6 @@ impl_dispose (GObject *object)
priv->create_ecal = NULL;
}
- for (l = priv->views; l; l = l->next) {
- MemosComponentView *component_view = l->data;
-
- g_object_weak_unref (G_OBJECT (component_view->view_control), view_destroyed_cb, memos_component);
- }
- g_list_free (priv->views);
- priv->views = NULL;
-
for (l = priv->notifications; l; l = l->next)
calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
g_list_free (priv->notifications);
@@ -945,24 +859,6 @@ impl_dispose (GObject *object)
}
static void
-impl_finalize (GObject *object)
-{
- MemosComponentPrivate *priv = MEMOS_COMPONENT (object)->priv;
- GList *l;
-
- for (l = priv->views; l; l = l->next) {
- MemosComponentView *component_view = l->data;
-
- destroy_component_view (component_view);
- }
- g_list_free (priv->views);
-
- g_free (priv);
-
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-static void
memos_component_class_init (MemosComponentClass *klass)
{
POA_GNOME_Evolution_Component__epv *epv = &klass->epv;
@@ -971,21 +867,7 @@ memos_component_class_init (MemosComponentClass *klass)
parent_class = g_type_class_peek_parent (klass);
epv->upgradeFromVersion = impl_upgradeFromVersion;
- epv->createView = impl_createView;
epv->requestCreateItem = impl_requestCreateItem;
object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalize;
}
-
-static void
-memos_component_init (MemosComponent *component, MemosComponentClass *klass)
-{
- MemosComponentPrivate *priv;
-
- priv = g_new0 (MemosComponentPrivate, 1);
-
- component->priv = priv;
-}
-
-BONOBO_TYPE_FUNC_FULL (MemosComponent, GNOME_Evolution_Component, PARENT_TYPE, memos_component)
diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c
index 9100183048..83e65d4966 100644
--- a/calendar/gui/tasks-component.c
+++ b/calendar/gui/tasks-component.c
@@ -64,10 +64,6 @@
static BonoboObjectClass *parent_class = NULL;
-/* Tasks should have their own registry */
-extern ECompEditorRegistry *comp_editor_registry;
-
-
typedef struct
{
ESourceList *source_list;
diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c
index 40e5c1e107..fbd1f6676a 100644
--- a/calendar/gui/tasks-control.c
+++ b/calendar/gui/tasks-control.c
@@ -56,36 +56,15 @@
static void tasks_control_activate_cb (BonoboControl *control,
gboolean activate,
gpointer user_data);
-static void tasks_control_open_task_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
static void tasks_control_new_task_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path);
-static void tasks_control_cut_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path);
-static void tasks_control_copy_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path);
-static void tasks_control_paste_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path);
-static void tasks_control_delete_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
static void tasks_control_complete_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path);
static void tasks_control_purge_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path);
-static void tasks_control_print_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
-static void tasks_control_print_preview_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
static void tasks_control_assign_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path);
@@ -94,12 +73,6 @@ static void tasks_control_forward_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path);
-static void tasks_control_view_preview (BonoboUIComponent *uic,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- void *data);
-
BonoboControl *
tasks_control_new (void)
{
@@ -234,16 +207,9 @@ selection_changed_cb (ETasks *tasks, int n_selected, gpointer data)
}
static BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("TasksOpenTask", tasks_control_open_task_cmd),
BONOBO_UI_VERB ("TasksNewTask", tasks_control_new_task_cmd),
- BONOBO_UI_VERB ("TasksCut", tasks_control_cut_cmd),
- BONOBO_UI_VERB ("TasksCopy", tasks_control_copy_cmd),
- BONOBO_UI_VERB ("TasksPaste", tasks_control_paste_cmd),
- BONOBO_UI_VERB ("TasksDelete", tasks_control_delete_cmd),
BONOBO_UI_VERB ("TasksMarkComplete", tasks_control_complete_cmd),
BONOBO_UI_VERB ("TasksPurge", tasks_control_purge_cmd),
- BONOBO_UI_VERB ("TasksPrint", tasks_control_print_cmd),
- BONOBO_UI_VERB ("TasksPrintPreview", tasks_control_print_preview_cmd),
BONOBO_UI_VERB ("TasksAssign", tasks_control_assign_cmd),
BONOBO_UI_VERB ("TasksForward", tasks_control_forward_cmd),
BONOBO_UI_VERB_END
@@ -329,16 +295,6 @@ tasks_control_deactivate (BonoboControl *control, ETasks *tasks)
bonobo_ui_component_unset_container (uic, NULL);
}
-static void tasks_control_open_task_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks;
-
- tasks = E_TASKS (data);
- e_tasks_open_task (tasks);
-}
-
static void
tasks_control_new_task_cmd (BonoboUIComponent *uic,
gpointer data,
@@ -351,56 +307,6 @@ tasks_control_new_task_cmd (BonoboUIComponent *uic,
}
static void
-tasks_control_cut_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks;
- ECalendarTable *cal_table;
-
- tasks = E_TASKS (data);
- cal_table = e_tasks_get_calendar_table (tasks);
- e_calendar_table_cut_clipboard (cal_table);
-}
-
-static void
-tasks_control_copy_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks;
- ECalendarTable *cal_table;
-
- tasks = E_TASKS (data);
- cal_table = e_tasks_get_calendar_table (tasks);
- e_calendar_table_copy_clipboard (cal_table);
-}
-
-static void
-tasks_control_paste_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks;
- ECalendarTable *cal_table;
-
- tasks = E_TASKS (data);
- cal_table = e_tasks_get_calendar_table (tasks);
- e_calendar_table_paste_clipboard (cal_table);
-}
-
-static void
-tasks_control_delete_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks;
-
- tasks = E_TASKS (data);
- e_tasks_delete_selected (tasks);
-}
-
-static void
tasks_control_complete_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path)
@@ -457,39 +363,6 @@ tasks_control_purge_cmd (BonoboUIComponent *uic,
e_tasks_delete_completed (tasks);
}
-/* File/Print callback */
-static void
-tasks_control_print_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks = E_TASKS (data);
- ETable *table;
-
- table = e_calendar_table_get_table (
- E_CALENDAR_TABLE (e_tasks_get_calendar_table (tasks)));
-
- print_table (
- table, _("Print Tasks"), _("Tasks"),
- GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
-}
-
-static void
-tasks_control_print_preview_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks = E_TASKS (data);
- ETable *table;
-
- table = e_calendar_table_get_table (
- E_CALENDAR_TABLE (e_tasks_get_calendar_table (tasks)));
-
- print_table (
- table, _("Print Tasks"), _("Tasks"),
- GTK_PRINT_OPERATION_ACTION_PREVIEW);
-}
-
static void
tasks_control_assign_cmd (BonoboUIComponent *uic,
gpointer data,
@@ -526,17 +399,3 @@ tasks_control_forward_cmd (BonoboUIComponent *uic,
g_object_unref (comp);
}
}
-
-static void
-tasks_control_view_preview (BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data)
-{
- ETasks *tasks;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
-
- tasks = E_TASKS (data);
-
- calendar_config_set_preview_state (state[0] != '0');
- e_tasks_show_preview (tasks, state[0] != '0');
-}
diff --git a/calendar/gui/e-cal-shell-module.c b/calendar/modules/e-cal-shell-module.c
index 7df23a92f3..7df23a92f3 100644
--- a/calendar/gui/e-cal-shell-module.c
+++ b/calendar/modules/e-cal-shell-module.c
diff --git a/calendar/gui/e-cal-shell-sidebar.c b/calendar/modules/e-cal-shell-sidebar.c
index 5d14f589f0..5d14f589f0 100644
--- a/calendar/gui/e-cal-shell-sidebar.c
+++ b/calendar/modules/e-cal-shell-sidebar.c
diff --git a/calendar/gui/e-cal-shell-sidebar.h b/calendar/modules/e-cal-shell-sidebar.h
index 89eaee7613..89eaee7613 100644
--- a/calendar/gui/e-cal-shell-sidebar.h
+++ b/calendar/modules/e-cal-shell-sidebar.h
diff --git a/calendar/gui/e-cal-shell-view-actions.c b/calendar/modules/e-cal-shell-view-actions.c
index e4f9d351c5..e4f9d351c5 100644
--- a/calendar/gui/e-cal-shell-view-actions.c
+++ b/calendar/modules/e-cal-shell-view-actions.c
diff --git a/calendar/gui/e-cal-shell-view-actions.h b/calendar/modules/e-cal-shell-view-actions.h
index 9d935e4263..9d935e4263 100644
--- a/calendar/gui/e-cal-shell-view-actions.h
+++ b/calendar/modules/e-cal-shell-view-actions.h
diff --git a/calendar/gui/e-cal-shell-view-private.c b/calendar/modules/e-cal-shell-view-private.c
index 2e7619cadc..262e31497c 100644
--- a/calendar/gui/e-cal-shell-view-private.c
+++ b/calendar/modules/e-cal-shell-view-private.c
@@ -40,6 +40,17 @@ void
e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
{
ECalShellViewPrivate *priv = cal_shell_view->priv;
+ EShellContent *shell_content;
+ EShellSidebar *shell_sidebar;
+ EShellView *shell_view;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+
+ /* Cache these to avoid lots of awkward casting. */
+ priv->cal_shell_content = g_object_ref (shell_content);
+ priv->cal_shell_sidebar = g_object_ref (shell_sidebar);
}
void
@@ -50,6 +61,9 @@ e_cal_shell_view_private_dispose (ECalShellView *cal_shell_view)
DISPOSE (priv->source_list);
DISPOSE (priv->calendar_actions);
+
+ DISPOSE (priv->cal_shell_content);
+ DISPOSE (priv->cal_shell_sidebar);
}
void
diff --git a/calendar/gui/e-cal-shell-view-private.h b/calendar/modules/e-cal-shell-view-private.h
index 553dc5246c..d80d0d2f27 100644
--- a/calendar/gui/e-cal-shell-view-private.h
+++ b/calendar/modules/e-cal-shell-view-private.h
@@ -29,6 +29,7 @@
#include <shell/e-shell-content.h>
#include <gnome-cal.h>
+#include <e-cal-shell-content.h>
#include <e-cal-shell-sidebar.h>
#include <e-cal-shell-view-actions.h>
@@ -59,6 +60,10 @@ struct _ECalShellViewPrivate {
/*** UI Management ***/
GtkActionGroup *calendar_actions;
+
+ /* These are just for convenience. */
+ ECalShellContent *cal_shell_content;
+ ECalShellSidebar *cal_shell_sidebar;
};
void e_cal_shell_view_private_init
diff --git a/calendar/gui/e-cal-shell-view.c b/calendar/modules/e-cal-shell-view.c
index 4ca7df1848..67d32de362 100644
--- a/calendar/gui/e-cal-shell-view.c
+++ b/calendar/modules/e-cal-shell-view.c
@@ -82,7 +82,7 @@ cal_shell_view_changed (EShellView *shell_view)
priv = E_CAL_SHELL_VIEW_GET_PRIVATE (shell_view);
action_group = priv->calendar_actions;
- visible = e_shell_view_is_selected (shell_view);
+ visible = e_shell_view_is_active (shell_view);
gtk_action_group_set_visible (action_group, visible);
}
@@ -105,9 +105,10 @@ cal_shell_view_class_init (ECalShellView *class,
shell_view_class = E_SHELL_VIEW_CLASS (class);
shell_view_class->label = N_("Cals");
shell_view_class->icon_name = "evolution-cals";
+ shell_view_class->search_options = "/calendar-search-options";
shell_view_class->type_module = type_module;
- shell_view_class->changed = cal_shell_view_changed;
shell_view_class->new_shell_sidebar = e_cal_shell_sidebar_new;
+ shell_view_class->changed = cal_shell_view_changed;
g_object_class_install_property (
object_class,
diff --git a/calendar/gui/e-cal-shell-view.h b/calendar/modules/e-cal-shell-view.h
index 404446f22b..404446f22b 100644
--- a/calendar/gui/e-cal-shell-view.h
+++ b/calendar/modules/e-cal-shell-view.h
diff --git a/calendar/modules/e-memo-shell-content.c b/calendar/modules/e-memo-shell-content.c
new file mode 100644
index 0000000000..a3a3104b47
--- /dev/null
+++ b/calendar/modules/e-memo-shell-content.c
@@ -0,0 +1,550 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-memo-shell-content.h
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "e-memo-shell-content.h"
+
+#include <glib/gi18n.h>
+
+#include "e-util/gconf-bridge.h"
+
+#include "calendar/gui/calendar-config.h"
+#include "calendar/gui/e-memo-table.h"
+#include "calendar/gui/e-memo-table-config.h"
+
+#include "widgets/menus/gal-view-etable.h"
+
+#define E_MEMO_SHELL_CONTENT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MEMO_SHELL_CONTENT, EMemoShellContentPrivate))
+
+#define E_MEMO_TABLE_DEFAULT_STATE \
+ "<?xml version=\"1.0\"?>" \
+ "<ETableState>" \
+ " <column source=\"1\"/>" \
+ " <column source=\"0\"/>" \
+ " <column source=\"2\"/>" \
+ " <grouping/>" \
+ "</ETableState>"
+
+struct _EMemoShellContentPrivate {
+ GtkWidget *paned;
+ GtkWidget *memo_table;
+ GtkWidget *memo_preview;
+
+ EMemoTableConfig *table_config;
+ GalViewInstance *view_instance;
+
+ gchar *current_uid;
+};
+
+enum {
+ PROP_0,
+ PROP_PREVIEW_VISIBLE
+};
+
+enum {
+ TARGET_VCALENDAR
+};
+
+static GtkTargetEntry drag_types[] = {
+ { "text/calendar", 0, TARGET_VCALENDAR },
+ { "text/x-calendar", 0, TARGET_VCALENDAR }
+};
+
+static gpointer parent_class;
+
+static void
+memo_shell_content_changed_cb (EMemoShellContent *memo_shell_content,
+ GalViewInstance *view_instance)
+{
+ EShellView *shell_view;
+ EShellContent *shell_content;
+ gchar *view_id;
+
+ shell_content = E_SHELL_CONTENT (memo_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
+memo_shell_content_display_view_cb (EMemoShellContent *memo_shell_content,
+ GalView *gal_view)
+{
+ EMemoTable *memo_table;
+ ETableScrolled *table_scrolled;
+ ETable *table;
+
+ if (!GAL_IS_VIEW_ETABLE (gal_view))
+ return;
+
+ memo_table = E_MEMO_TABLE (memo_shell_content->priv->memo_table);
+ table_scrolled = E_TABLE_SCROLLED (memo_table->etable);
+ table = e_table_scrolled_get_table (table_scrolled);
+
+ gal_view_etable_attach_table (GAL_VIEW_ETABLE (gal_view), table);
+}
+
+static void
+memo_shell_content_table_drag_data_get_cb (EMemoShellContent *memo_shell_content,
+ gint row,
+ gint col,
+ GdkDragContext *context,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time)
+{
+ /* FIXME */
+}
+
+static void
+memo_shell_content_table_drag_data_delete_cb (EMemoShellContent *memo_shell_content,
+ gint row,
+ gint col,
+ GdkDragContext *context)
+{
+ /* Moved components are deleted from source immediately when moved,
+ * because some of them can be part of destination source, and we
+ * don't want to delete not-moved tasks. There is no such information
+ * which event has been moved and which not, so skip this method. */
+}
+
+static void
+memo_shell_content_cursor_change_cb (EMemoShellContent *memo_shell_content,
+ gint row,
+ ETable *table)
+{
+ EMemoPreview *memo_preview;
+ EMemoTable *memo_table;
+ ECalModel *model;
+ ECalModelComponent *comp_data;
+ ECalComponent *comp;
+ const gchar *uid;
+
+ memo_preview = E_MEMO_PREVIEW (memo_shell_content->priv->memo_preview);
+ memo_table = E_MEMO_TABLE (memo_shell_content->priv->memo_table);
+
+ if (e_table_selected_count (table) != 1) {
+ e_memo_preview_clear (memo_preview);
+ return;
+ }
+
+ model = e_memo_table_get_model (memo_table);
+ row = e_table_get_cursor_row (table);
+ comp_data = e_cal_model_get_component_at (model, row);
+
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (
+ comp, icalcomponent_new_clone (comp_data->icalcomp));
+ e_memo_preview_display (memo_preview, comp_data->client, comp);
+
+ e_cal_component_get_uid (comp, &uid);
+ g_free (memo_shell_content->priv->current_uid);
+ memo_shell_content->priv->current_uid = g_strdup (uid);
+
+ g_object_unref (comp);
+}
+
+static void
+memo_shell_content_selection_change_cb (EMemoShellContent *memo_shell_content,
+ ETable *table)
+{
+ EMemoPreview *memo_preview;
+
+ memo_preview = E_MEMO_PREVIEW (memo_shell_content->priv->memo_preview);
+
+ /* XXX Old code emits a "selection-changed" signal here. */
+
+ if (e_table_selected_count (table) != 1)
+ e_memo_preview_clear (memo_preview);
+}
+
+static void
+memo_shell_content_model_row_changed_cb (EMemoShellContent *memo_shell_content,
+ gint row,
+ ETableModel *model)
+{
+ ECalModelComponent *comp_data;
+ EMemoTable *memo_table;
+ ETableScrolled *table_scrolled;
+ ETable *table;
+ const gchar *current_uid;
+ const gchar *uid;
+
+ current_uid = memo_shell_content->priv->current_uid;
+ if (current_uid == NULL)
+ return;
+
+ comp_data = e_cal_model_get_component_at (E_CAL_MODEL (model), row);
+ if (comp_data == NULL)
+ return;
+
+ uid = icalcomponent_get_uid (comp_data->icalcomp);
+ if (g_strcmp0 (uid, current_uid) != 0)
+ return;
+
+ memo_table = E_MEMO_TABLE (memo_shell_content->priv->memo_table);
+ table_scrolled = E_TABLE_SCROLLED (memo_table->etable);
+ table = e_table_scrolled_get_table (table_scrolled);
+
+ memo_shell_content_cursor_change_cb (memo_shell_content, 0, table);
+}
+
+static void
+memo_shell_content_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_PREVIEW_VISIBLE:
+ e_memo_shell_content_set_preview_visible (
+ E_MEMO_SHELL_CONTENT (object),
+ g_value_get_boolean (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+memo_shell_content_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_PREVIEW_VISIBLE:
+ g_value_set_boolean (
+ value, e_memo_shell_content_get_preview_visible (
+ E_MEMO_SHELL_CONTENT (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+memo_shell_content_dispose (GObject *object)
+{
+ EMemoShellContentPrivate *priv;
+
+ priv = E_MEMO_SHELL_CONTENT_GET_PRIVATE (object);
+
+ if (priv->paned != NULL) {
+ g_object_unref (priv->paned);
+ priv->paned = NULL;
+ }
+
+ if (priv->memo_table != NULL) {
+ g_object_unref (priv->memo_table);
+ priv->memo_table = NULL;
+ }
+
+ if (priv->memo_preview != NULL) {
+ g_object_unref (priv->memo_preview);
+ priv->memo_preview = NULL;
+ }
+
+ if (priv->table_config != NULL) {
+ g_object_unref (priv->table_config);
+ priv->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);
+}
+
+static void
+memo_shell_content_finalize (GObject *object)
+{
+ EMemoShellContentPrivate *priv;
+
+ priv = E_MEMO_SHELL_CONTENT_GET_PRIVATE (object);
+
+ g_free (priv->current_uid);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+memo_shell_content_constructed (GObject *object)
+{
+ EMemoShellContentPrivate *priv;
+ EShellContent *shell_content;
+ EShellView *shell_view;
+ EShellViewClass *shell_view_class;
+ GalViewCollection *view_collection;
+ GalViewInstance *view_instance;
+ ECalModel *model;
+ ETable *table;
+ GConfBridge *bridge;
+ GtkWidget *container;
+ GtkWidget *widget;
+ const gchar *key;
+
+ priv = E_MEMO_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;
+
+ /* Load the view instance. */
+
+ view_instance = gal_view_instance_new (view_collection, NULL);
+ g_signal_connect_swapped (
+ view_instance, "changed",
+ G_CALLBACK (memo_shell_content_changed_cb),
+ object);
+ g_signal_connect_swapped (
+ view_instance, "display-view",
+ G_CALLBACK (memo_shell_content_display_view_cb),
+ object);
+ gal_view_instance_load (view_instance);
+ priv->view_instance = view_instance;
+
+ /* Build content widgets. */
+
+ container = GTK_WIDGET (object);
+
+ widget = gtk_vpaned_new ();
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->paned = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = e_memo_table_new (shell_view);
+ gtk_paned_add1 (GTK_PANED (container), widget);
+ priv->memo_table = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_paned_add2 (GTK_PANED (container), widget);
+
+ container = widget;
+
+ widget = e_memo_preview_new ();
+ e_memo_preview_set_default_timezone (
+ E_MEMO_PREVIEW (widget),
+ calendar_config_get_icaltimezone ());
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->memo_preview = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* Configure the memo table. */
+
+ widget = E_MEMO_TABLE (priv->memo_table)->etable;
+ table = e_table_scrolled_get_table (E_TABLE_SCROLLED (widget));
+ model = e_memo_table_get_model (E_MEMO_TABLE (priv->memo_table));
+
+ priv->table_config = e_memo_table_config_new (
+ E_MEMO_TABLE (priv->memo_table));
+
+ e_table_set_state (table, E_MEMO_TABLE_DEFAULT_STATE);
+
+ e_table_drag_source_set (
+ table, GDK_BUTTON1_MASK,
+ drag_types, G_N_ELEMENTS (drag_types),
+ GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_ASK);
+
+ g_signal_connect_swapped (
+ table, "table-drag-data-get",
+ G_CALLBACK (memo_shell_content_table_drag_data_get_cb),
+ object);
+
+ g_signal_connect_swapped (
+ table, "table-drag-data-delete",
+ G_CALLBACK (memo_shell_content_table_drag_data_delete_cb),
+ object);
+
+ g_signal_connect_swapped (
+ table, "cursor-change",
+ G_CALLBACK (memo_shell_content_cursor_change_cb),
+ object);
+
+ g_signal_connect_swapped (
+ table, "selection-change",
+ G_CALLBACK (memo_shell_content_selection_change_cb),
+ object);
+
+ g_signal_connect_swapped (
+ model, "model-row-changed",
+ G_CALLBACK (memo_shell_content_model_row_changed_cb),
+ object);
+
+ /* Bind GObject properties to GConf keys. */
+
+ bridge = gconf_bridge_get ();
+
+ object = G_OBJECT (priv->paned);
+ key = "/apps/evolution/calendar/display/memo_vpane_position";
+ gconf_bridge_bind_property_delayed (bridge, key, object, "position");
+}
+
+static void
+memo_shell_content_class_init (EMemoShellContentClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMemoShellContentPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = memo_shell_content_set_property;
+ object_class->get_property = memo_shell_content_get_property;
+ object_class->dispose = memo_shell_content_dispose;
+ object_class->finalize = memo_shell_content_finalize;
+ object_class->constructed = memo_shell_content_constructed;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_PREVIEW_VISIBLE,
+ g_param_spec_boolean (
+ "preview-visible",
+ _("Preview is Visible"),
+ _("Whether the preview pane is visible"),
+ TRUE,
+ G_PARAM_READWRITE));
+}
+
+static void
+memo_shell_content_init (EMemoShellContent *memo_shell_content)
+{
+ memo_shell_content->priv =
+ E_MEMO_SHELL_CONTENT_GET_PRIVATE (memo_shell_content);
+
+ /* Postpone widget construction until we have a shell view. */
+}
+
+GType
+e_memo_shell_content_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMemoShellContentClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) memo_shell_content_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMemoShellContent),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) memo_shell_content_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ E_TYPE_SHELL_CONTENT, "EMemoShellContent",
+ &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_memo_shell_content_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_MEMO_SHELL_CONTENT,
+ "shell-view", shell_view, NULL);
+}
+
+EMemoPreview *
+e_memo_shell_content_get_memo_preview (EMemoShellContent *memo_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_MEMO_SHELL_CONTENT (memo_shell_content), NULL);
+
+ return E_MEMO_PREVIEW (memo_shell_content->priv->memo_preview);
+}
+
+EMemoTable *
+e_memo_shell_content_get_memo_table (EMemoShellContent *memo_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_MEMO_SHELL_CONTENT (memo_shell_content), NULL);
+
+ return E_MEMO_TABLE (memo_shell_content->priv->memo_table);
+}
+
+GalViewInstance *
+e_memo_shell_content_get_view_instance (EMemoShellContent *memo_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_MEMO_SHELL_CONTENT (memo_shell_content), NULL);
+
+ return memo_shell_content->priv->view_instance;
+}
+
+gboolean
+e_memo_shell_content_get_preview_visible (EMemoShellContent *memo_shell_content)
+{
+ GtkPaned *paned;
+ GtkWidget *child;
+
+ g_return_val_if_fail (
+ E_IS_MEMO_SHELL_CONTENT (memo_shell_content), FALSE);
+
+ paned = GTK_PANED (memo_shell_content->priv->paned);
+ child = gtk_paned_get_child2 (paned);
+
+ return GTK_WIDGET_VISIBLE (child);
+}
+
+void
+e_memo_shell_content_set_preview_visible (EMemoShellContent *memo_shell_content,
+ gboolean preview_visible)
+{
+ GtkPaned *paned;
+ GtkWidget *child;
+
+ g_return_if_fail (E_IS_MEMO_SHELL_CONTENT (memo_shell_content));
+
+ paned = GTK_PANED (memo_shell_content->priv->paned);
+ child = gtk_paned_get_child2 (paned);
+
+ if (preview_visible)
+ gtk_widget_show (child);
+ else
+ gtk_widget_hide (child);
+
+ g_object_notify (G_OBJECT (memo_shell_content), "preview-visible");
+}
diff --git a/calendar/modules/e-memo-shell-content.h b/calendar/modules/e-memo-shell-content.h
new file mode 100644
index 0000000000..3b8bb341f1
--- /dev/null
+++ b/calendar/modules/e-memo-shell-content.h
@@ -0,0 +1,83 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-memo-shell-content.h
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef E_MEMO_SHELL_CONTENT_H
+#define E_MEMO_SHELL_CONTENT_H
+
+#include <shell/e-shell-content.h>
+#include <shell/e-shell-view.h>
+
+#include <calendar/gui/e-memo-preview.h>
+#include <calendar/gui/e-memo-table.h>
+
+#include <widgets/menus/gal-view-instance.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MEMO_SHELL_CONTENT \
+ (e_memo_shell_content_get_type ())
+#define E_MEMO_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MEMO_SHELL_CONTENT, EMemoShellContent))
+#define E_MEMO_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MEMO_SHELL_CONTENT, EMemoShellContentClass))
+#define E_IS_MEMO_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MEMO_SHELL_CONTENT))
+#define E_IS_MEMO_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MEMO_SHELL_CONTENT))
+#define E_MEMO_SHELL_CONTENT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MEMO_SHELL_CONTENT, EMemoShellContentClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMemoShellContent EMemoShellContent;
+typedef struct _EMemoShellContentClass EMemoShellContentClass;
+typedef struct _EMemoShellContentPrivate EMemoShellContentPrivate;
+
+struct _EMemoShellContent {
+ EShellContent parent;
+ EMemoShellContentPrivate *priv;
+};
+
+struct _EMemoShellContentClass {
+ EShellContentClass parent_class;
+};
+
+GType e_memo_shell_content_get_type (void);
+GtkWidget * e_memo_shell_content_new (EShellView *shell_view);
+EMemoPreview * e_memo_shell_content_get_memo_preview
+ (EMemoShellContent *memo_shell_content);
+EMemoTable * e_memo_shell_content_get_memo_table
+ (EMemoShellContent *memo_shell_content);
+GalViewInstance *
+ e_memo_shell_content_get_view_instance
+ (EMemoShellContent *memo_shell_content);
+gboolean e_memo_shell_content_get_preview_visible
+ (EMemoShellContent *memo_shell_content);
+void e_memo_shell_content_set_preview_visible
+ (EMemoShellContent *memo_shell_content,
+ gboolean preview_visible);
+
+G_END_DECLS
+
+#endif /* E_MEMO_SHELL_CONTENT_H */
diff --git a/calendar/gui/e-memo-shell-module.c b/calendar/modules/e-memo-shell-module.c
index 05781d478f..fe8c8fe35a 100644
--- a/calendar/gui/e-memo-shell-module.c
+++ b/calendar/modules/e-memo-shell-module.c
@@ -25,13 +25,14 @@
#include <libedataserver/e-source-list.h>
#include <libedataserver/e-source-group.h>
-#include <e-shell.h>
-#include <e-shell-module.h>
-#include <e-shell-window.h>
+#include "shell/e-shell.h"
+#include "shell/e-shell-module.h"
+#include "shell/e-shell-window.h"
-#include <calendar-config.h>
-#include <e-memo-shell-view.h>
-#include <dialogs/calendar-setup.h>
+#include "calendar/gui/calendar-config.h"
+#include "calendar/gui/dialogs/calendar-setup.h"
+
+#include "e-memo-shell-view.h"
#define MODULE_NAME "memos"
#define MODULE_ALIASES ""
diff --git a/calendar/gui/e-memo-shell-sidebar.c b/calendar/modules/e-memo-shell-sidebar.c
index 43e61edef9..23ab9491fa 100644
--- a/calendar/gui/e-memo-shell-sidebar.c
+++ b/calendar/modules/e-memo-shell-sidebar.c
@@ -21,11 +21,10 @@
#include "e-memo-shell-sidebar.h"
#include <glib/gi18n.h>
-#include <libedataserverui/e-source-selector.h>
-#include <e-memos.h>
-#include <e-memo-shell-view.h>
-#include <e-calendar-selector.h>
+#include "calendar/gui/e-calendar-selector.h"
+
+#include "e-memo-shell-view.h"
#define E_MEMO_SHELL_SIDEBAR_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -42,6 +41,7 @@ enum {
static gpointer parent_class;
+#if 0 /* MOVE THIS TO EMemoShellView */
static void
memo_shell_sidebar_update (EShellSidebar *shell_sidebar)
{
@@ -79,6 +79,7 @@ memo_shell_sidebar_update (EShellSidebar *shell_sidebar)
g_string_free (string, TRUE);
}
+#endif
static void
memo_shell_sidebar_get_property (GObject *object,
@@ -123,10 +124,6 @@ memo_shell_sidebar_constructed (GObject *object)
ESourceList *source_list;
GtkContainer *container;
GtkWidget *widget;
- EMemos *memos;
- ETable *table;
- ECalModel *model;
- EMemoTable *memo_table;
priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (object);
@@ -154,6 +151,8 @@ memo_shell_sidebar_constructed (GObject *object)
priv->selector = g_object_ref (widget);
gtk_widget_show (widget);
+#if 0 /* MOVE THIS TO EMemoShellView */
+
/* Setup signal handlers. */
memos = e_memo_shell_view_get_memos (memo_shell_view);
@@ -182,6 +181,8 @@ memo_shell_sidebar_constructed (GObject *object)
shell_sidebar);
memo_shell_sidebar_update (shell_sidebar);
+
+#endif
}
static void
@@ -254,11 +255,11 @@ e_memo_shell_sidebar_new (EShellView *shell_view)
"shell-view", shell_view, NULL);
}
-GtkWidget *
+ESourceSelector *
e_memo_shell_sidebar_get_selector (EMemoShellSidebar *memo_shell_sidebar)
{
g_return_val_if_fail (
E_IS_MEMO_SHELL_SIDEBAR (memo_shell_sidebar), NULL);
- return memo_shell_sidebar->priv->selector;
+ return E_SOURCE_SELECTOR (memo_shell_sidebar->priv->selector);
}
diff --git a/calendar/gui/e-memo-shell-sidebar.h b/calendar/modules/e-memo-shell-sidebar.h
index ee487b07cb..47985d3402 100644
--- a/calendar/gui/e-memo-shell-sidebar.h
+++ b/calendar/modules/e-memo-shell-sidebar.h
@@ -21,8 +21,10 @@
#ifndef E_MEMO_SHELL_SIDEBAR_H
#define E_MEMO_SHELL_SIDEBAR_H
-#include <e-shell-sidebar.h>
-#include <e-shell-view.h>
+#include <libedataserverui/e-source-selector.h>
+
+#include <shell/e-shell-sidebar.h>
+#include <shell/e-shell-view.h>
/* Standard GObject macros */
#define E_TYPE_MEMO_SHELL_SIDEBAR \
@@ -60,7 +62,8 @@ struct _EMemoShellSidebarClass {
GType e_memo_shell_sidebar_get_type (void);
GtkWidget * e_memo_shell_sidebar_new (EShellView *shell_view);
-GtkWidget * e_memo_shell_sidebar_get_selector
+ESourceSelector *
+ e_memo_shell_sidebar_get_selector
(EMemoShellSidebar *memo_shell_sidebar);
G_END_DECLS
diff --git a/calendar/gui/e-memo-shell-view-actions.c b/calendar/modules/e-memo-shell-view-actions.c
index 1835cd144f..e20ec46949 100644
--- a/calendar/gui/e-memo-shell-view-actions.c
+++ b/calendar/modules/e-memo-shell-view-actions.c
@@ -20,19 +20,19 @@
#include "e-memo-shell-view-private.h"
-#include <e-util/gconf-bridge.h>
+#include "e-util/gconf-bridge.h"
-#include "print.h"
+#include "calendar/gui/print.h"
static void
action_memo_clipboard_copy_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
- EMemos *memos;
+ EMemoShellContent *memo_shell_content;
EMemoTable *memo_table;
- memos = E_MEMOS (memo_shell_view->priv->memos);
- memo_table = e_memos_get_calendar_table (memos);
+ 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);
}
@@ -40,11 +40,11 @@ static void
action_memo_clipboard_cut_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
- EMemos *memos;
+ EMemoShellContent *memo_shell_content;
EMemoTable *memo_table;
- memos = E_MEMOS (memo_shell_view->priv->memos);
- memo_table = e_memos_get_calendar_table (memos);
+ 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);
}
@@ -52,11 +52,11 @@ static void
action_memo_clipboard_paste_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
- EMemos *memos;
+ EMemoShellContent *memo_shell_content;
EMemoTable *memo_table;
- memos = E_MEMOS (memo_shell_view->priv->memos);
- memo_table = e_memos_get_calendar_table (memos);
+ 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);
}
@@ -64,10 +64,21 @@ static void
action_memo_delete_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
- EMemos *memos;
+ EMemoShellContent *memo_shell_content;
+ EMemoPreview *memo_preview;
+ EMemoTable *memo_table;
+ const gchar *status_message;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+ memo_preview = e_memo_shell_content_get_memo_preview (memo_shell_content);
+
+ status_message = _("Deleting selected memos...");
+ e_memo_shell_view_set_status_message (memo_shell_view, status_message);
+ e_memo_table_delete_selected (memo_table);
+ e_memo_shell_view_set_status_message (memo_shell_view, NULL);
- memos = E_MEMOS (memo_shell_view->priv->memos);
- e_memos_delete_selected (memos);
+ e_memo_preview_clear (memo_preview);
}
static void
@@ -100,6 +111,7 @@ static void
action_memo_list_properties_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
+ EMemoShellSidebar *memo_shell_sidebar;
EShellView *shell_view;
EShellWindow *shell_window;
ESource *source;
@@ -108,7 +120,8 @@ action_memo_list_properties_cb (GtkAction *action,
shell_view = E_SHELL_VIEW (memo_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- selector = E_SOURCE_SELECTOR (memo_shell_view->priv->selector);
+ memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
+ selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
source = e_source_selector_peek_primary_selection (selector);
g_return_if_fail (source != NULL);
@@ -119,29 +132,36 @@ static void
action_memo_open_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
- EMemos *memos;
+ EMemoShellContent *memo_shell_content;
+ EMemoTable *memo_table;
- memos = E_MEMOS (memo_shell_view->priv->memos);
- e_memos_open_memo (memos);
+ 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_open_selected (memo_table);
}
static void
action_memo_preview_cb (GtkToggleAction *action,
EMemoShellView *memo_shell_view)
{
- /* FIXME */
+ EMemoShellContent *memo_shell_content;
+ gboolean visible;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ visible = gtk_toggle_action_get_active (action);
+ e_memo_shell_content_set_preview_visible (memo_shell_content, visible);
}
static void
action_memo_print_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
- EMemos *memos;
- ETable *table;
+ EMemoShellContent *memo_shell_content;
EMemoTable *memo_table;
+ ETable *table;
- memos = E_MEMOS (memo_shell_view->priv->memos);
- memo_table = e_memos_get_calendar_table (memos);
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
table = e_memo_table_get_table (memo_table);
print_table (
@@ -153,12 +173,12 @@ static void
action_memo_print_preview_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
- EMemos *memos;
- ETable *table;
+ EMemoShellContent *memo_shell_content;
EMemoTable *memo_table;
+ ETable *table;
- memos = E_MEMOS (memo_shell_view->priv->memos);
- memo_table = e_memos_get_calendar_table (memos);
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
table = e_memo_table_get_table (memo_table);
print_table (
@@ -298,8 +318,8 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view)
void
e_memo_shell_view_actions_update (EMemoShellView *memo_shell_view)
{
- ECal *cal;
- EMemos *memos;
+ EMemoShellContent *memo_shell_content;
+ ECal *client;
ETable *table;
ECalModel *model;
EMemoTable *memo_table;
@@ -313,17 +333,17 @@ e_memo_shell_view_actions_update (EMemoShellView *memo_shell_view)
shell_view = E_SHELL_VIEW (memo_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- memos = E_MEMOS (memo_shell_view->priv->memos);
- memo_table = e_memos_get_calendar_table (memos);
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
model = e_memo_table_get_model (memo_table);
- cal = e_cal_model_get_default_client (model);
+ client = e_cal_model_get_default_client (model);
table = e_memo_table_get_table (memo_table);
n_selected = e_table_selected_count (table);
- if (cal != NULL)
- e_cal_is_read_only (cal, &read_only, NULL);
+ if (client != NULL)
+ e_cal_is_read_only (client, &read_only, NULL);
action = ACTION (MEMO_OPEN);
sensitive = (n_selected == 1);
diff --git a/calendar/gui/e-memo-shell-view-actions.h b/calendar/modules/e-memo-shell-view-actions.h
index 4ac71c2083..4ac71c2083 100644
--- a/calendar/gui/e-memo-shell-view-actions.h
+++ b/calendar/modules/e-memo-shell-view-actions.h
diff --git a/calendar/modules/e-memo-shell-view-private.c b/calendar/modules/e-memo-shell-view-private.c
new file mode 100644
index 0000000000..a6ce81a560
--- /dev/null
+++ b/calendar/modules/e-memo-shell-view-private.c
@@ -0,0 +1,316 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-memo-shell-view-private.c
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "e-memo-shell-view-private.h"
+
+#include <widgets/menus/gal-view-factory-etable.h>
+
+static void
+memo_shell_view_backend_died_cb (EMemoShellView *memo_shell_view,
+ ECal *client)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ GHashTable *client_table;
+ ESource *source;
+ const gchar *uid;
+
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ source = e_cal_get_source (client);
+ uid = e_source_peek_uid (source);
+
+ g_object_ref (source);
+
+ g_hash_table_remove (client_table, uid);
+ e_memo_shell_view_set_status_message (memo_shell_view, NULL);
+
+ e_error_run (
+ GTK_WINDOW (shell_window),
+ "calendar:memos-crashed", NULL);
+
+ g_object_unref (source);
+}
+
+static void
+memo_shell_view_backend_error_cb (EMemoShellView *memo_shell_view,
+ const gchar *message,
+ ECal *client)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ GtkWidget *dialog;
+ const gchar *uri;
+ gchar *uri_no_passwd;
+
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ uri = e_cal_get_uri (client);
+ uri_no_passwd = get_uri_without_password (uri);
+
+ dialog = gtk_message_dialog_new (
+ GTK_WINDOW (shell_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+ _("Error on %s:\n%s"),
+ uri_no_passwd, message);
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+
+ g_free (uri_no_passwd);
+}
+
+static void
+memo_shell_view_client_opened_cb (EMemoShellView *memo_shell_view,
+ ECalendarStatus status,
+ ECal *client)
+{
+ /* FIXME */
+}
+
+static gboolean
+memo_shell_view_add_source (EMemoShellView *memo_shell_view,
+ ESource *source)
+{
+ GHashTable *client_table;
+ ECal *default_client;
+ ECal *client;
+ const gchar *uid;
+ const gchar *uri;
+ gchar *status_message;
+
+ client_table = memo_shell_view->priv->client_table;
+ default_client = memo_shell_view->priv->default_client;
+
+ uid = e_source_peek_uid (source);
+ client = g_hash_table_lookup (client_table, uid);
+
+ if (client != NULL)
+ return TRUE;
+
+ if (default_client != NULL) {
+ ESource *default_source;
+ const gchar *default_uid;
+
+ default_source = e_cal_get_source (default_client);
+ default_uid = e_source_peek_uid (default_source);
+
+ if (strcmp (uid, default_uid) == 0)
+ client = g_object_ref (default_client);
+ }
+
+ if (client == NULL)
+ client = auth_new_cal_from_source (
+ source, E_CAL_SOURCE_TYPE_JOURNAL);
+
+ if (client == NULL)
+ return FALSE;
+
+ g_signal_connect_swapped (
+ client, "backend-died",
+ G_CALLBACK (memo_shell_view_backend_died_cb),
+ memo_shell_view);
+
+ g_signal_connect_swapped (
+ client, "backend-error",
+ G_CALLBACK (memo_shell_view_backend_error_cb),
+ memo_shell_view);
+
+ g_hash_table_insert (client_table, g_strdup (uid), client);
+
+ uri = e_cal_get_uri (client);
+
+ status_message = g_strdup_printf (_("Opening memos at %s"), uri);
+ e_memo_shell_view_set_status_message (memo_shell_view, status_message);
+ g_free (status_message);
+
+ g_signal_connect_swapped (
+ client, "cal-opened",
+ G_CALLBACK (memo_shell_view_client_opened_cb),
+ memo_shell_view);
+
+ e_cal_open_async (client, FALSE);
+
+ return TRUE;
+}
+
+static void
+memo_shell_view_user_created_cb (EMemoShellView *memo_shell_view,
+ EMemoTable *memo_table)
+{
+ ECal *client;
+ ESource *source;
+
+ if (memo_table->user_created_cal != NULL)
+ client = memo_table->user_created_cal;
+ else {
+ ECalModel *model;
+
+ model = e_memo_table_get_model (memo_table);
+ client = e_cal_model_get_default_client (model);
+ }
+
+ source = e_cal_get_source (client);
+ memo_shell_view_add_source (memo_shell_view, source);
+}
+
+static void
+memo_shell_view_load_view_collection (EShellViewClass *shell_view_class)
+{
+ GalViewCollection *collection;
+ GalViewFactory *factory;
+ ETableSpecification *spec;
+ const gchar *base_dir;
+ gchar *filename;
+
+ collection = shell_view_class->view_collection;
+
+ base_dir = EVOLUTION_ETSPECDIR;
+ spec = e_table_specification_new ();
+ filename = g_build_filename (base_dir, ETSPEC_FILENAME, NULL);
+ if (!e_table_specification_load_from_file (spec, filename))
+ g_critical ("Unable to load ETable specification file "
+ "for memos");
+ g_free (filename);
+
+ factory = gal_view_factory_etable_new (spec);
+ gal_view_collection_add_factory (collection, factory);
+ g_object_unref (factory);
+ g_object_unref (spec);
+
+ gal_view_collection_load (collection);
+}
+
+static void
+memo_shell_view_notify_view_id_cb (EMemoShellView *memo_shell_view)
+{
+ EMemoShellContent *memo_shell_content;
+ GalViewInstance *view_instance;
+ const gchar *view_id;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ view_instance =
+ e_memo_shell_content_get_view_instance (memo_shell_content);
+ view_id = e_shell_view_get_view_id (E_SHELL_VIEW (memo_shell_view));
+
+ /* A NULL view ID implies we're in a custom view. But you can
+ * only get to a custom view via the "Define Views" dialog, which
+ * would have already modified the view instance appropriately.
+ * Furthermore, there's no way to refer to a custom view by ID
+ * anyway, since custom views have no IDs. */
+ if (view_id == NULL)
+ return;
+
+ gal_view_instance_set_current_view_id (view_instance, view_id);
+}
+
+void
+e_memo_shell_view_private_init (EMemoShellView *memo_shell_view,
+ EShellViewClass *shell_view_class)
+{
+ EMemoShellViewPrivate *priv = memo_shell_view->priv;
+ ESourceList *source_list;
+ GHashTable *client_table;
+ GObject *object;
+
+ object = G_OBJECT (shell_view_class->type_module);
+ source_list = g_object_get_data (object, "source-list");
+ g_return_if_fail (E_IS_SOURCE_LIST (source_list));
+
+ client_table = g_hash_table_new_full (
+ g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) g_object_unref);
+
+ priv->source_list = g_object_ref (source_list);
+ priv->memo_actions = gtk_action_group_new ("memos");
+ priv->client_table = client_table;
+
+ if (!gal_view_collection_loaded (shell_view_class->view_collection))
+ memo_shell_view_load_view_collection (shell_view_class);
+
+ g_signal_connect (
+ memo_shell_view, "notify::view-id",
+ G_CALLBACK (memo_shell_view_notify_view_id_cb), NULL);
+}
+
+void
+e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view)
+{
+ EMemoShellViewPrivate *priv = memo_shell_view->priv;
+ EShellContent *shell_content;
+ EShellSidebar *shell_sidebar;
+ EShellView *shell_view;
+ EMemoTable *memo_table;
+
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+
+ /* Cache these to avoid lots of awkward casting. */
+ priv->memo_shell_content = g_object_ref (shell_content);
+ priv->memo_shell_sidebar = g_object_ref (shell_sidebar);
+
+ memo_table = e_memo_shell_content_get_memo_table (
+ priv->memo_shell_content);
+
+ g_signal_connect_swapped (
+ memo_table, "user-created",
+ G_CALLBACK (memo_shell_view_user_created_cb),
+ memo_shell_view);
+
+ e_memo_shell_view_actions_update (memo_shell_view);
+}
+
+void
+e_memo_shell_view_private_dispose (EMemoShellView *memo_shell_view)
+{
+ EMemoShellViewPrivate *priv = memo_shell_view->priv;
+
+ DISPOSE (priv->source_list);
+
+ DISPOSE (priv->memo_actions);
+
+ DISPOSE (priv->memo_shell_content);
+ DISPOSE (priv->memo_shell_sidebar);
+
+ g_hash_table_remove_all (priv->client_table);
+ DISPOSE (priv->default_client);
+}
+
+void
+e_memo_shell_view_private_finalize (EMemoShellView *memo_shell_view)
+{
+ EMemoShellViewPrivate *priv = memo_shell_view->priv;
+
+ g_hash_table_destroy (priv->client_table);
+}
+
+void
+e_memo_shell_view_set_status_message (EMemoShellView *memo_shell_view,
+ const gchar *status_message)
+{
+ g_return_if_fail (E_IS_MEMO_SHELL_VIEW (memo_shell_view));
+
+ /* FIXME */
+}
diff --git a/calendar/gui/e-memo-shell-view-private.h b/calendar/modules/e-memo-shell-view-private.h
index c53e55c487..1fb44c12a6 100644
--- a/calendar/gui/e-memo-shell-view-private.h
+++ b/calendar/modules/e-memo-shell-view-private.h
@@ -23,17 +23,21 @@
#include "e-memo-shell-view.h"
+#include <string.h>
#include <glib/gi18n.h>
-#include <e-util/e-util.h>
-#include <shell/e-shell-content.h>
-#include <shell/e-activity-handler.h>
+#include "e-util/e-error.h"
+#include "e-util/e-util.h"
-#include <e-memos.h>
-#include <e-calendar-selector.h>
-#include <e-memo-shell-sidebar.h>
-#include <e-memo-shell-view-actions.h>
-#include <dialogs/calendar-setup.h>
+#include "calendar/gui/misc.h"
+#include "calendar/gui/e-calendar-selector.h"
+#include "calendar/gui/e-memo-preview.h"
+#include "calendar/common/authentication.h"
+#include "calendar/gui/dialogs/calendar-setup.h"
+
+#include "e-memo-shell-content.h"
+#include "e-memo-shell-sidebar.h"
+#include "e-memo-shell-view-actions.h"
#define E_MEMO_SHELL_VIEW_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -51,6 +55,9 @@
if ((obj) != NULL) { g_object_unref (obj); (obj) = NULL; } \
} G_STMT_END
+/* ETable Specifications */
+#define ETSPEC_FILENAME "e-memo-table.etspec"
+
G_BEGIN_DECLS
struct _EMemoShellViewPrivate {
@@ -65,9 +72,13 @@ struct _EMemoShellViewPrivate {
/*** Other Stuff ***/
- GtkWidget *memos;
+ /* These are just for convenience. */
+ EMemoShellContent *memo_shell_content;
+ EMemoShellSidebar *memo_shell_sidebar;
- EActivityHandler *activity_handler;
+ /* UID -> ECal */
+ GHashTable *client_table;
+ ECal *default_client;
};
void e_memo_shell_view_private_init
@@ -86,6 +97,9 @@ void e_memo_shell_view_actions_init
(EMemoShellView *memo_shell_view);
void e_memo_shell_view_actions_update
(EMemoShellView *memo_shell_view);
+void e_memo_shell_view_set_status_message
+ (EMemoShellView *memo_shell_view,
+ const gchar *status_message);
G_END_DECLS
diff --git a/calendar/gui/e-memo-shell-view.c b/calendar/modules/e-memo-shell-view.c
index 2f083ea23e..f50c877c9a 100644
--- a/calendar/gui/e-memo-shell-view.c
+++ b/calendar/modules/e-memo-shell-view.c
@@ -82,7 +82,7 @@ memo_shell_view_changed (EShellView *shell_view)
priv = E_MEMO_SHELL_VIEW_GET_PRIVATE (shell_view);
action_group = priv->memo_actions;
- visible = e_shell_view_is_selected (shell_view);
+ visible = e_shell_view_is_active (shell_view);
gtk_action_group_set_visible (action_group, visible);
}
@@ -105,9 +105,11 @@ memo_shell_view_class_init (EMemoShellView *class,
shell_view_class = E_SHELL_VIEW_CLASS (class);
shell_view_class->label = N_("Memos");
shell_view_class->icon_name = "evolution-memos";
+ shell_view_class->search_options = "/memo-search-options";
shell_view_class->type_module = type_module;
- shell_view_class->changed = memo_shell_view_changed;
+ shell_view_class->new_shell_content = e_memo_shell_content_new;
shell_view_class->new_shell_sidebar = e_memo_shell_sidebar_new;
+ shell_view_class->changed = memo_shell_view_changed;
g_object_class_install_property (
object_class,
diff --git a/calendar/gui/e-memo-shell-view.h b/calendar/modules/e-memo-shell-view.h
index c6faa8382c..dc41d5f9f0 100644
--- a/calendar/gui/e-memo-shell-view.h
+++ b/calendar/modules/e-memo-shell-view.h
@@ -21,7 +21,7 @@
#ifndef E_MEMO_SHELL_VIEW_H
#define E_MEMO_SHELL_VIEW_H
-#include <e-shell-view.h>
+#include <shell/e-shell-view.h>
#include <libedataserver/e-source-list.h>
/* Standard GObject macros */
diff --git a/calendar/modules/e-task-shell-content.c b/calendar/modules/e-task-shell-content.c
new file mode 100644
index 0000000000..8f7e45f175
--- /dev/null
+++ b/calendar/modules/e-task-shell-content.c
@@ -0,0 +1,550 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-task-shell-content.h
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "e-task-shell-content.h"
+
+#include <glib/gi18n.h>
+
+#include "e-util/gconf-bridge.h"
+
+#include "calendar/gui/e-calendar-table.h"
+#include "calendar/gui/e-calendar-table-config.h"
+
+#include "widgets/menus/gal-view-etable.h"
+
+#define E_TASK_SHELL_CONTENT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TASK_SHELL_CONTENT, ETaskShellContentPrivate))
+
+#define E_TASK_TABLE_DEFAULT_STATE \
+ "<?xml version=\"1.0\"?>" \
+ "<ETableState>" \
+ " <column source=\"13\"/>" \
+ " <column source=\"14\"/>" \
+ " <column source=\"9\"/>" \
+ " <column source=\"5\"/>" \
+ " <grouping/>
+ "</ETableState>"
+
+struct _ETaskShellContentPrivate {
+ GtkWidget *paned;
+ GtkWidget *task_table;
+ GtkWidget *task_preview;
+
+ ETaskTableConfig *table_config;
+ GalViewInstance *view_instance;
+
+ gchar *current_uid;
+};
+
+enum {
+ PROP_0,
+ PROP_PREVIEW_VISIBLE
+};
+
+enum {
+ TARGET_VCALENDAR
+};
+
+static GtkTargetEntry drag_types[] = {
+ { "text/calendar", 0, TARGET_VCALENDAR },
+ { "text/x-calendar", 0, TARGET_VCALENDAR }
+};
+
+static gpointer parent_class;
+
+static void
+task_shell_content_changed_cb (ETaskShellContent *task_shell_content,
+ GalViewInstance *view_instance)
+{
+ EShellView *shell_view;
+ EShellContent *shell_content;
+ gchar *view_id;
+
+ shell_content = E_SHELL_CONTENT (task_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
+task_shell_content_display_view_cb (ETaskShellContent *task_shell_content,
+ GalView *gal_view)
+{
+ ECalendarTable *task_table;
+ ETableScrolled *table_scrolled;
+ ETable *table;
+
+ if (!GAL_IS_VIEW_ETABLE (gal_view))
+ return;
+
+ task_table = E_CALENDAR_TABLE (task_shell_content->priv->task_table);
+ table_scrolled = E_TABLE_SCROLLED (task_table->etable);
+ table = e_table_scrolled_get_table (table_scrolled);
+
+ gal_view_etable_attach_table (GAL_VIEW_ETABLE (gal_view), table);
+}
+
+static void
+task_shell_content_table_drag_data_get_cb (ETaskShellContent *task_shell_content,
+ gint row,
+ gint col,
+ GdkDragContext *context,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time)
+{
+ /* FIXME */
+}
+
+static void
+task_shell_content_table_drag_data_delete_cb (ETaskShellContent *task_shell_content,
+ gint row,
+ gint col,
+ GdkDragContext *context)
+{
+ /* Moved components are deleted from source immediately when moved,
+ * because some of them can be part of destination source, and we
+ * don't want to delete not-moved tasks. There is no such information
+ * which event has been moved and which not, so skip this method. */
+}
+
+static void
+task_shell_content_cursor_change_cb (ETaskShellContent *task_shell_content,
+ gint row,
+ ETable *table)
+{
+ ETaskPreview *task_preview;
+ ETaskTable *task_table;
+ ECalModel *model;
+ ECalModelComponent *comp_data;
+ ECalComponent *comp;
+ const gchar *uid;
+
+ task_preview = E_TASK_PREVIEW (task_shell_content->priv->task_preview);
+ task_table = E_TASK_TABLE (task_shell_content->priv->task_table);
+
+ if (e_table_selected_count (table) != 1) {
+ e_task_preview_clear (task_preview);
+ return;
+ }
+
+ model = e_task_table_get_model (task_table);
+ row = e_table_get_cursor_row (table);
+ comp_data = e_cal_model_get_component_at (model, row);
+
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (
+ comp, icalcomponent_new_clone (comp_data->icalcomp));
+ e_task_preview_display (task_preview, comp_data->client, comp);
+
+ e_cal_component_get_uid (comp, &uid);
+ g_free (task_shell_content->priv->current_uid);
+ task_shell_content->priv->current_uid = g_strdup (uid);
+
+ g_object_unref (comp);
+}
+
+static void
+task_shell_content_selection_change_cb (ETaskShellContent *task_shell_content,
+ ETable *table)
+{
+ ETaskPreview *task_preview;
+
+ task_preview = E_TASK_PREVIEW (task_shell_content->priv->task_preview);
+
+ /* XXX Old code emits a "selection-changed" signal here. */
+
+ if (e_table_selected_count (table) != 1)
+ e_task_preview_clear (task_preview);
+}
+
+static void
+task_shell_content_model_row_changed_cb (ETaskShellContent *task_shell_content,
+ gint row,
+ ETableModel *model)
+{
+ ECalModelComponent *comp_data;
+ ETaskTable *task_table;
+ ETableScrolled *table_scrolled;
+ ETable *table;
+ const gchar *current_uid;
+ const gchar *uid;
+
+ current_uid = task_shell_content->priv->current_uid;
+ if (current_uid == NULL)
+ return;
+
+ comp_data = e_cal_model_get_component_at (E_CAL_MODEL (model), row);
+ if (comp_data == NULL)
+ return;
+
+ uid = icalcomponent_get_uid (comp_data->icalcomp);
+ if (g_strcmp0 (uid, current_uid) != 0)
+ return;
+
+ task_table = E_TASK_TABLE (task_shell_content->priv->task_table);
+ table_scrolled = E_TABLE_SCROLLED (task_table->etable);
+ table = e_table_scrolled_get_table (table_scrolled);
+
+ task_shell_content_cursor_change_cb (task_shell_content, 0, table);
+}
+
+static void
+task_shell_content_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_PREVIEW_VISIBLE:
+ e_task_shell_content_set_preview_visible (
+ E_TASK_SHELL_CONTENT (object),
+ g_value_get_boolean (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+task_shell_content_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_PREVIEW_VISIBLE:
+ g_value_set_boolean (
+ value, e_task_shell_content_get_preview_visible (
+ E_TASK_SHELL_CONTENT (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+task_shell_content_dispose (GObject *object)
+{
+ ETaskShellContentPrivate *priv;
+
+ priv = E_TASK_SHELL_CONTENT_GET_PRIVATE (object);
+
+ if (priv->paned != NULL) {
+ g_object_unref (priv->paned);
+ priv->paned = NULL;
+ }
+
+ if (priv->task_table != NULL) {
+ g_object_unref (priv->task_table);
+ priv->task_table = NULL;
+ }
+
+ if (priv->task_preview != NULL) {
+ g_object_unref (priv->task_preview);
+ priv->task_preview = NULL;
+ }
+
+ if (priv->table_config != NULL) {
+ g_object_unref (priv->table_config);
+ priv->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);
+}
+
+static void
+task_shell_content_finalize (GObject *object)
+{
+ ETaskShellContentPrivate *priv;
+
+ priv = E_TASK_SHELL_CONTENT_GET_PRIVATE (object);
+
+ g_free (priv->current_uid);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+task_shell_content_constructed (GObject *object)
+{
+ ETaskShellContentPrivate *priv;
+ EShellContent *shell_content;
+ EShellView *shell_view;
+ EShellViewClass *shell_view_class;
+ GalViewCollection *view_collection;
+ GalViewInstance *view_instance;
+ ECalModel *model;
+ ETable *table;
+ GConfBridge *bridge;
+ GtkWidget *container;
+ GtkWidget *widget;
+ const gchar *key;
+
+ priv = E_TASK_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;
+
+ /* Load the view instance. */
+
+ view_instance = gal_view_instance_new (view_collection, NULL);
+ g_signal_connect_swapped (
+ view_instance, "changed",
+ G_CALLBACK (task_shell_content_changed_cb),
+ object);
+ g_signal_connect_swapped (
+ view_instance, "display-view",
+ G_CALLBACK (task_shell_content_display_view_cb),
+ object);
+ gal_view_instance_load (view_instance);
+ priv->view_instance = view_instance;
+
+ /* Build content widgets. */
+
+ container = GTK_WIDGET (object);
+
+ widget = gtk_vpaned_new ();
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->paned = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = e_task_table_new (shell_view);
+ gtk_paned_add1 (GTK_PANED (container), widget);
+ priv->task_table = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_paned_add2 (GTK_PANED (container), widget);
+
+ container = widget;
+
+ widget = e_task_preview_new ();
+ e_task_preview_set_default_timezone (
+ E_TASK_PREVIEW (widget),
+ calendar_config_get_icaltimezone ());
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->task_preview = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* Configure the task table. */
+
+ widget = E_TASK_TABLE (priv->task_table)->etable;
+ table = e_table_scrolled_get_table (E_TABLE_SCROLLED (widget));
+ model = e_task_table_get_model (E_TASK_TABLE (priv->task_table));
+
+ priv->table_config = e_task_table_config_new (
+ E_TASK_TABLE (priv->task_table));
+
+ e_table_set_state (table, E_TASK_TABLE_DEFAULT_STATE);
+
+ e_table_drag_source_set (
+ table, GDK_BUTTON1_MASK,
+ drag_types, G_N_ELEMENTS (drag_types),
+ GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_ASK);
+
+ g_signal_connect_swapped (
+ table, "table-drag-data-get",
+ G_CALLBACK (task_shell_content_table_drag_data_get_cb),
+ object);
+
+ g_signal_connect_swapped (
+ table, "table-drag-data-delete",
+ G_CALLBACK (task_shell_content_table_drag_data_delete_cb),
+ object);
+
+ g_signal_connect_swapped (
+ table, "cursor-change",
+ G_CALLBACK (task_shell_content_cursor_change_cb),
+ object);
+
+ g_signal_connect_swapped (
+ table, "selection-change",
+ G_CALLBACK (task_shell_content_selection_change_cb),
+ object);
+
+ g_signal_connect_swapped (
+ model, "model-row-changed",
+ G_CALLBACK (task_shell_content_model_row_changed_cb),
+ object);
+
+ /* Bind GObject properties to GConf keys. */
+
+ bridge = gconf_bridge_get ();
+
+ object = G_OBJECT (priv->paned);
+ key = "/apps/evolution/calendar/display/task_vpane_position";
+ gconf_bridge_bind_property_delayed (bridge, key, object, "position");
+}
+
+static void
+task_shell_content_class_init (ETaskShellContentClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ETaskShellContentPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = task_shell_content_set_property;
+ object_class->get_property = task_shell_content_get_property;
+ object_class->dispose = task_shell_content_dispose;
+ object_class->finalize = task_shell_content_finalize;
+ object_class->constructed = task_shell_content_constructed;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_PREVIEW_VISIBLE,
+ g_param_spec_boolean (
+ "preview-visible",
+ _("Preview is Visible"),
+ _("Whether the preview pane is visible"),
+ TRUE,
+ G_PARAM_READWRITE));
+}
+
+static void
+task_shell_content_init (ETaskShellContent *task_shell_content)
+{
+ task_shell_content->priv =
+ E_TASK_SHELL_CONTENT_GET_PRIVATE (task_shell_content);
+
+ /* Postpone widget construction until we have a shell view. */
+}
+
+GType
+e_task_shell_content_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (ETaskShellContentClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) task_shell_content_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ETaskShellContent),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) task_shell_content_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ E_TYPE_SHELL_CONTENT, "ETaskShellContent",
+ &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_task_shell_content_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_TASK_SHELL_CONTENT,
+ "shell-view", shell_view, NULL);
+}
+
+ETaskPreview *
+e_task_shell_content_get_task_preview (ETaskShellContent *task_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_TASK_SHELL_CONTENT (task_shell_content), NULL);
+
+ return E_TASK_PREVIEW (task_shell_content->priv->task_preview);
+}
+
+ETaskTable *
+e_task_shell_content_get_task_table (ETaskShellContent *task_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_TASK_SHELL_CONTENT (task_shell_content), NULL);
+
+ return E_TASK_TABLE (task_shell_content->priv->task_table);
+}
+
+GalViewInstance *
+e_task_shell_content_get_view_instance (ETaskShellContent *task_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_TASK_SHELL_CONTENT (task_shell_content), NULL);
+
+ return task_shell_content->priv->view_instance;
+}
+
+gboolean
+e_task_shell_content_get_preview_visible (ETaskShellContent *task_shell_content)
+{
+ GtkPaned *paned;
+ GtkWidget *child;
+
+ g_return_val_if_fail (
+ E_IS_TASK_SHELL_CONTENT (task_shell_content), FALSE);
+
+ paned = GTK_PANED (task_shell_content->priv->paned);
+ child = gtk_paned_get_child2 (paned);
+
+ return GTK_WIDGET_VISIBLE (child);
+}
+
+void
+e_task_shell_content_set_preview_visible (ETaskShellContent *task_shell_content,
+ gboolean preview_visible)
+{
+ GtkPaned *paned;
+ GtkWidget *child;
+
+ g_return_if_fail (E_IS_TASK_SHELL_CONTENT (task_shell_content));
+
+ paned = GTK_PANED (task_shell_content->priv->paned);
+ child = gtk_paned_get_child2 (paned);
+
+ if (preview_visible)
+ gtk_widget_show (child);
+ else
+ gtk_widget_hide (child);
+
+ g_object_notify (G_OBJECT (task_shell_content), "preview-visible");
+}
diff --git a/calendar/modules/e-task-shell-content.h b/calendar/modules/e-task-shell-content.h
new file mode 100644
index 0000000000..0bf91254c1
--- /dev/null
+++ b/calendar/modules/e-task-shell-content.h
@@ -0,0 +1,76 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-task-shell-content.h
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef E_TASK_SHELL_CONTENT_H
+#define E_TASK_SHELL_CONTENT_H
+
+#include <shell/e-shell-content.h>
+#include <shell/e-shell-view.h>
+
+#include <widgets/menus/gal-view-instance.h>
+
+/* Standard GObject macros */
+#define E_TYPE_TASK_SHELL_CONTENT \
+ (e_task_shell_content_get_type ())
+#define E_TASK_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_TASK_SHELL_CONTENT, ETaskShellContent))
+#define E_TASK_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_TASK_SHELL_CONTENT, ETaskShellContentClass))
+#define E_IS_TASK_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_TASK_SHELL_CONTENT))
+#define E_IS_TASK_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_TASK_SHELL_CONTENT))
+#define E_TASK_SHELL_CONTENT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_TASK_SHELL_CONTENT, ETaskShellContentClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ETaskShellContent ETaskShellContent;
+typedef struct _ETaskShellContentClass ETaskShellContentClass;
+typedef struct _ETaskShellContentPrivate ETaskShellContentPrivate;
+
+struct _ETaskShellContent {
+ EShellContent parent;
+ ETaskShellContentPrivate *priv;
+};
+
+struct _ETaskShellContentClass {
+ EShellContentClass parent_class;
+};
+
+GType e_task_shell_content_get_type (void);
+GtkWidget * e_task_shell_content_new (EShellView *shell_view);
+GalViewInstance *
+ e_task_shell_content_get_view_instance
+ (ETaskShellContent *task_shell_content);
+gboolean e_task_shell_content_get_preview_visible
+ (ETaskShellContent *task_shell_content);
+void e_task_shell_content_set_preview_visible
+ (ETaskShellContent *task_shell_content,
+ gboolean preview_visible);
+
+G_END_DECLS
+
+#endif /* E_TASK_SHELL_CONTENT_H */
diff --git a/calendar/gui/e-task-shell-module.c b/calendar/modules/e-task-shell-module.c
index 7dee36a9cc..93b3871581 100644
--- a/calendar/gui/e-task-shell-module.c
+++ b/calendar/modules/e-task-shell-module.c
@@ -25,12 +25,13 @@
#include <libedataserver/e-source-list.h>
#include <libedataserver/e-source-group.h>
-#include <e-shell.h>
-#include <e-shell-module.h>
-#include <e-shell-window.h>
+#include "shell/e-shell.h"
+#include "shell/e-shell-module.h"
+#include "shell/e-shell-window.h"
-#include <calendar-config.h>
-#include <e-task-shell-view.h>
+#include "calendar/gui/calendar-config.h"
+
+#include "e-task-shell-view.h"
#define MODULE_NAME "tasks"
#define MODULE_ALIASES ""
diff --git a/calendar/gui/e-task-shell-sidebar.c b/calendar/modules/e-task-shell-sidebar.c
index 0b0668df86..b3d0c487bc 100644
--- a/calendar/gui/e-task-shell-sidebar.c
+++ b/calendar/modules/e-task-shell-sidebar.c
@@ -21,11 +21,10 @@
#include "e-task-shell-sidebar.h"
#include <glib/gi18n.h>
-#include <libedataserverui/e-source-selector.h>
-#include <e-tasks.h>
-#include <e-task-shell-view.h>
-#include <e-calendar-selector.h>
+#include "calendar/gui/e-calendar-selector.h"
+
+#include "e-task-shell-view.h"
#define E_TASK_SHELL_SIDEBAR_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -42,6 +41,7 @@ enum {
static gpointer parent_class;
+#if 0 /* MOVE THIS TO ETaskShellView */
static void
task_shell_sidebar_update (EShellSidebar *shell_sidebar)
{
@@ -79,6 +79,7 @@ task_shell_sidebar_update (EShellSidebar *shell_sidebar)
g_string_free (string, TRUE);
}
+#endif
static void
task_shell_sidebar_get_property (GObject *object,
@@ -123,10 +124,6 @@ task_shell_sidebar_constructed (GObject *object)
ESourceList *source_list;
GtkContainer *container;
GtkWidget *widget;
- ETasks *tasks;
- ETable *table;
- ECalModel *model;
- ECalendarTable *cal_table;
priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (object);
@@ -154,6 +151,8 @@ task_shell_sidebar_constructed (GObject *object)
priv->selector = g_object_ref (widget);
gtk_widget_show (widget);
+#if 0 /* MOVE THIS TO ETaskShellView */
+
/* Setup signal handlers. */
tasks = e_task_shell_view_get_tasks (task_shell_view);
@@ -182,6 +181,8 @@ task_shell_sidebar_constructed (GObject *object)
shell_sidebar);
task_shell_sidebar_update (shell_sidebar);
+
+#endif
}
static void
diff --git a/calendar/gui/e-task-shell-sidebar.h b/calendar/modules/e-task-shell-sidebar.h
index c50fde5d3c..2d992dbc82 100644
--- a/calendar/gui/e-task-shell-sidebar.h
+++ b/calendar/modules/e-task-shell-sidebar.h
@@ -21,8 +21,8 @@
#ifndef E_TASK_SHELL_SIDEBAR_H
#define E_TASK_SHELL_SIDEBAR_H
-#include <e-shell-sidebar.h>
-#include <e-shell-view.h>
+#include <shell/e-shell-sidebar.h>
+#include <shell/e-shell-view.h>
/* Standard GObject macros */
#define E_TYPE_TASK_SHELL_SIDEBAR \
diff --git a/calendar/gui/e-task-shell-view-actions.c b/calendar/modules/e-task-shell-view-actions.c
index ccdf86cdd1..2668522aee 100644
--- a/calendar/gui/e-task-shell-view-actions.c
+++ b/calendar/modules/e-task-shell-view-actions.c
@@ -30,24 +30,57 @@ static void
action_task_clipboard_copy_cb (GtkAction *action,
ETaskShellView *task_shell_view)
{
+ ETaskShellContent *task_shell_content;
+ ETaskTable *task_table;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ e_task_table_copy_clipboard (task_table);
}
static void
action_task_clipboard_cut_cb (GtkAction *action,
ETaskShellView *task_shell_view)
{
+ ETaskShellContent *task_shell_content;
+ ETaskTable *task_table;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ e_task_table_cut_clipboard (task_table);
}
static void
action_task_clipboard_paste_cb (GtkAction *action,
ETaskShellView *task_shell_view)
{
+ ETaskShellContent *task_shell_content;
+ ETaskTable *task_table;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ e_task_table_paste_clipboard (task_table);
}
static void
action_task_delete_cb (GtkAction *action,
ETaskShellView *task_shell_view)
{
+ ETaskShellContent *task_shell_content;
+ ETaskPreview *task_preview;
+ ETaskTable *task_table;
+ const gchar *status_message;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ task_preview = e_task_shell_content_get_task_preview (task_shell_content);
+
+ status_message = _("Deleting selected tasks...");
+ e_task_shell_view_set_status_message (task_shell_view, status_message);
+ e_task_table_delete_selected (task_table);
+ e_task_shell_view_set_status_message (task_shell_view, NULL);
+
+ e_task_preview_clear (task_preview);
}
static void
@@ -60,12 +93,14 @@ static void
action_task_list_copy_cb (GtkAction *action,
ETaskShellView *task_shell_view)
{
+ /* FIXME */
}
static void
action_task_list_delete_cb (GtkAction *action,
ETaskShellView *task_shell_view)
{
+ /* FIXME */
}
static void
@@ -90,24 +125,58 @@ static void
action_task_open_cb (GtkAction *action,
ETaskShellView *task_shell_view)
{
+ ETaskShellContent *task_shell_content;
+ ETaskTable *task_table;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ e_task_table_open_selected (task_table);
}
static void
action_task_preview_cb (GtkToggleAction *action,
ETaskShellView *task_shell_view)
{
+ ETaskShellContent *task_shell_content;
+ gboolean visible;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ visible = gtk_toggle_action_get_active (action);
+ e_task_shell_content_set_preview_visible (task_shell_content, visible);
}
static void
action_task_print_cb (GtkAction *action,
ETaskShellView *task_shell_view)
{
+ ETaskShellContent *task_shell_content;
+ ETaskTable *task_table;
+ ETable *table;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ table = e_task_table_get_table (task_table);
+
+ print_table (
+ table, _("Print Tasks"), _("Tasks"),
+ GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
}
static void
action_task_print_preview_cb (GtkAction *action,
ETaskShellView *task_shell_view)
{
+ ETaskShellContent *task_shell_content;
+ ETaskTable *task_table;
+ ETable *table;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ table = e_task_table_get_table (task_table);
+
+ print_table (
+ table, _("Print Tasks"), _("Tasks"),
+ GTK_PRINT_OPERATION_ACTION_PREVIEW);
}
static void
diff --git a/calendar/gui/e-task-shell-view-actions.h b/calendar/modules/e-task-shell-view-actions.h
index 9c31590814..9c31590814 100644
--- a/calendar/gui/e-task-shell-view-actions.h
+++ b/calendar/modules/e-task-shell-view-actions.h
diff --git a/calendar/modules/e-task-shell-view-private.c b/calendar/modules/e-task-shell-view-private.c
new file mode 100644
index 0000000000..465f715ecd
--- /dev/null
+++ b/calendar/modules/e-task-shell-view-private.c
@@ -0,0 +1,141 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-task-shell-view-private.c
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "e-task-shell-view-private.h"
+
+#include <widgets/menus/gal-view-factory-etable.h>
+
+static void
+task_shell_view_load_view_collection (EShellViewClass *shell_view_class)
+{
+ GalViewCollection *collection;
+ GalViewFactory *factory;
+ ETableSpecification *spec;
+ const gchar *base_dir;
+ gchar *filename;
+
+ collection = shell_view_class->view_collection;
+
+ base_dir = EVOLUTION_ETSPECDIR;
+ spec = e_table_specification_new ();
+ filename = g_build_filename (base_dir, ETSPEC_FILENAME, NULL);
+ if (!e_table_specification_load_from_file (spec, filename))
+ g_critical ("Unable to load ETable specification file "
+ "for tasks");
+ g_free (filename);
+
+ factory = gal_view_factory_etable_new (spec);
+ gal_view_collection_add_factory (collection, factory);
+ g_object_unref (factory);
+ g_object_unref (spec);
+
+ gal_view_collection_load (collection);
+}
+
+static void
+task_shell_view_notify_view_id_cb (ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ GalViewInstance *view_instance;
+ const gchar *view_id;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ view_instance =
+ e_task_shell_content_get_view_instance (task_shell_content);
+ view_id = e_shell_view_get_view_id (E_SHELL_VIEW (task_shell_view));
+
+ /* A NULL view ID implies we're in a custom view. But you can
+ * only get to a custom view via the "Define Views" dialog, which
+ * would have already modified the view instance appropriately.
+ * Furthermore, there's no way to refer to a custom view by ID
+ * anyway, since custom views have no IDs. */
+ if (view_id == NULL)
+ return;
+
+ gal_view_instance_set_current_view_id (view_instance, view_id);
+}
+
+void
+e_task_shell_view_private_init (ETaskShellView *task_shell_view,
+ EShellViewClass *shell_view_class)
+{
+ ETaskShellViewPrivate *priv = task_shell_view->priv;
+ ESourceList *source_list;
+ GObject *object;
+
+ object = G_OBJECT (shell_view_class->type_module);
+ source_list = g_object_get_data (object, "source-list");
+ g_return_if_fail (E_IS_SOURCE_LIST (source_list));
+
+ priv->source_list = g_object_ref (source_list);
+ priv->task_actions = gtk_action_group_new ("tasks");
+
+ if (!gal_view_collection_loaded (shell_view_class->view_collection))
+ task_shell_view_load_view_collection (shell_view_class);
+
+ g_signal_connect (
+ task_shell_view, "notify::view-id",
+ G_CALLBACK (task_shell_view_notify_view_id_cb), NULL);
+}
+
+void
+e_task_shell_view_private_constructed (ETaskShellView *task_shell_view)
+{
+ ETaskShellViewPrivate *priv = task_shell_view->priv;
+ EShellContent *shell_content;
+ EShellSidebar *shell_sidebar;
+ EShellView *shell_view;
+
+ shell_view = E_SHELL_VIEW (task_shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+
+ /* Cache these to avoid lots of awkward casting. */
+ priv->task_shell_content = g_object_ref (shell_content);
+ priv->task_shell_sidebar = g_object_ref (shell_sidebar);
+}
+
+void
+e_task_shell_view_private_dispose (ETaskShellView *task_shell_view)
+{
+ ETaskShellViewPrivate *priv = task_shell_view->priv;
+
+ DISPOSE (priv->source_list);
+
+ DISPOSE (priv->task_actions);
+
+ DISPOSE (priv->task_shell_content);
+ DISPOSE (priv->task_shell_sidebar);
+}
+
+void
+e_task_shell_view_private_finalize (ETaskShellView *task_shell_view)
+{
+ ETaskShellViewPrivate *priv = task_shell_view->priv;
+}
+
+void
+e_task_shell_view_set_status_message (ETaskShellView *task_shell_view,
+ const gchar *status_message)
+{
+ g_return_if_fail (E_IS_TASK_SHELL_VIEW (task_shell_view));
+
+ /* FIXME */
+}
diff --git a/calendar/gui/e-task-shell-view-private.h b/calendar/modules/e-task-shell-view-private.h
index 0c7f90c3be..697ec7a120 100644
--- a/calendar/gui/e-task-shell-view-private.h
+++ b/calendar/modules/e-task-shell-view-private.h
@@ -23,13 +23,14 @@
#include "e-task-shell-view.h"
+#include <string.h>
#include <glib/gi18n.h>
-#include <e-util/e-util.h>
-#include <shell/e-shell-content.h>
+#include "e-util/e-util.h"
-#include <e-task-shell-sidebar.h>
-#include <e-task-shell-view-actions.h>
+#include "e-task-shell-content.h"
+#include "e-task-shell-sidebar.h"
+#include "e-task-shell-view-actions.h"
#define E_TASK_SHELL_VIEW_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -47,6 +48,9 @@
if ((obj) != NULL) { g_object_unref (obj); (obj) = NULL; } \
} G_STMT_END
+/* ETable Specifications */
+#define ETSPEC_FILENAME "e-calendar-table.etspec"
+
G_BEGIN_DECLS
struct _ETaskShellViewPrivate {
@@ -58,6 +62,12 @@ struct _ETaskShellViewPrivate {
/*** UI Management ***/
GtkActionGroup *task_actions;
+
+ /*** Other Stuff ***/
+
+ /* These are just for convenience. */
+ ETaskShellContent *task_shell_content;
+ ETaskShellSidebar *task_shell_sidebar;
};
void e_task_shell_view_private_init
@@ -74,6 +84,11 @@ void e_task_shell_view_private_finalize
void e_task_shell_view_actions_init
(ETaskShellView *task_shell_view);
+void e_task_shell_view_actions_update
+ (ETaskShellView *task_shell_view);
+void e_task_shell_view_set_status_message
+ (ETaskShellView *task_shell_view,
+ const gchar *status_message);
G_END_DECLS
diff --git a/calendar/gui/e-task-shell-view.c b/calendar/modules/e-task-shell-view.c
index 6be8b48a4c..6b85d1ed45 100644
--- a/calendar/gui/e-task-shell-view.c
+++ b/calendar/modules/e-task-shell-view.c
@@ -82,7 +82,7 @@ task_shell_view_changed (EShellView *shell_view)
priv = E_TASK_SHELL_VIEW_GET_PRIVATE (shell_view);
action_group = priv->task_actions;
- visible = e_shell_view_is_selected (shell_view);
+ visible = e_shell_view_is_active (shell_view);
gtk_action_group_set_visible (action_group, visible);
}
@@ -105,9 +105,10 @@ task_shell_view_class_init (ETaskShellView *class,
shell_view_class = E_SHELL_VIEW_CLASS (class);
shell_view_class->label = N_("Tasks");
shell_view_class->icon_name = "evolution-tasks";
+ shell_view_class->search_options = "/task-search-options";
shell_view_class->type_module = type_module;
- shell_view_class->changed = task_shell_view_changed;
shell_view_class->new_shell_sidebar = e_task_shell_sidebar_new;
+ shell_view_class->changed = task_shell_view_changed;
g_object_class_install_property (
object_class,
diff --git a/calendar/gui/e-task-shell-view.h b/calendar/modules/e-task-shell-view.h
index 785a3585b1..cd58d1b6f8 100644
--- a/calendar/gui/e-task-shell-view.h
+++ b/calendar/modules/e-task-shell-view.h
@@ -21,7 +21,7 @@
#ifndef E_TASK_SHELL_VIEW_H
#define E_TASK_SHELL_VIEW_H
-#include <e-shell-view.h>
+#include <shell/e-shell-view.h>
#include <libedataserver/e-source-list.h>
/* Standard GObject macros */