diff options
Diffstat (limited to 'calendar/gui')
53 files changed, 1321 insertions, 6128 deletions
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-cal-shell-module.c b/calendar/gui/e-cal-shell-module.c deleted file mode 100644 index 7df23a92f3..0000000000 --- a/calendar/gui/e-cal-shell-module.c +++ /dev/null @@ -1,399 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-cal-shell-module.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 <string.h> -#include <glib/gi18n.h> -#include <libecal/e-cal.h> -#include <libedataserver/e-source.h> -#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 <calendar-config.h> -#include <e-cal-shell-view.h> - -#define MODULE_NAME "calendar" -#define MODULE_ALIASES "" -#define MODULE_SCHEMES "calendar" -#define MODULE_SEARCHES "caltypes.xml" -#define MODULE_SORT_ORDER 400 - -#define CONTACTS_BASE_URI "contacts://" -#define WEATHER_BASE_URI "weather://" -#define WEB_BASE_URI "webcal://" -#define PERSONAL_RELATIVE_URI "system" - -/* Module Entry Point */ -void e_shell_module_init (GTypeModule *type_module); - -static void -cal_module_ensure_sources (EShellModule *shell_module) -{ - /* XXX This is basically the same algorithm across all modules. - * Maybe we could somehow integrate this into EShellModule? */ - - ESourceList *source_list; - ESourceGroup *on_this_computer; - ESourceGroup *on_the_web; - ESourceGroup *contacts; - ESourceGroup *weather; - ESource *birthdays; - ESource *personal; - GSList *groups, *iter; - const gchar *data_dir; - gchar *base_uri; - gchar *filename; - gchar *property; - - on_this_computer = NULL; - on_the_web = NULL; - contacts = NULL; - weather = NULL; - birthdays = NULL; - personal = NULL; - - if (!e_cal_get_sources (&source_list, E_CAL_SOURCE_TYPE_EVENT, NULL)) { - g_warning ("Could not get calendar sources from GConf!"); - return; - } - - /* Share the source list with all calendar views. This - * is accessible via e_cal_shell_view_get_source_list(). - * Note: EShellModule takes ownership of the reference. - * - * XXX I haven't yet decided if I want to add a proper - * EShellModule API for this. The mail module would - * not use it. */ - g_object_set_data_full ( - G_OBJECT (shell_module), "source-list", - source_list, (GDestroyNotify) g_object_unref); - - data_dir = e_shell_module_get_data_dir (shell_module); - filename = g_build_filename (data_dir, "local", NULL); - base_uri = g_filename_to_uri (filename, NULL, NULL); - g_free (filename); - - groups = e_source_list_peek_groups (source_list); - for (iter = groups; iter != NULL; iter = iter->next) { - ESourceGroup *source_group = iter->data; - const gchar *group_base_uri; - - group_base_uri = e_source_group_peek_base_uri (source_group); - - /* Compare only "file://" part. if the user's home - * changes, we do not want to create another group. */ - if (on_this_computer == NULL && - strncmp (base_uri, group_base_uri, 7) == 0) - on_this_computer = source_group; - - else if (on_the_web == NULL && - strcmp (WEB_BASE_URI, group_base_uri) == 0) - on_the_web = source_group; - - else if (contacts == NULL && - strcmp (CONTACTS_BASE_URI, group_base_uri) == 0) - contacts = source_group; - - else if (weather == NULL && - strcmp (WEATHER_BASE_URI, group_base_uri) == 0) - weather = source_group; - } - - if (on_this_computer != NULL) { - GSList *sources; - const gchar *group_base_uri; - - sources = e_source_group_peek_sources (on_this_computer); - group_base_uri = e_source_group_peek_base_uri (on_this_computer); - - /* Make sure this group includes a "Personal" source. */ - for (iter = sources; iter != NULL; iter = iter->next) { - ESource *source = iter->data; - const gchar *relative_uri; - - relative_uri = e_source_peek_relative_uri (source); - if (relative_uri == NULL) - continue; - - if (strcmp (PERSONAL_RELATIVE_URI, relative_uri) != 0) - continue; - - personal = source; - break; - } - - /* Make sure we have the correct base URI. This can - * change when the user's home directory changes. */ - if (strcmp (base_uri, group_base_uri) != 0) { - e_source_group_set_base_uri ( - on_this_computer, base_uri); - - /* XXX We shouldn't need this sync call here as - * set_base_uri() results in synching to GConf, - * but that happens in an idle loop and too late - * to prevent the user from seeing a "Cannot - * Open ... because of invalid URI" error. */ - e_source_list_sync (source_list, NULL); - } - - } else { - ESourceGroup *source_group; - const gchar *name; - - name = _("On This Computer"); - source_group = e_source_group_new (name, base_uri); - e_source_list_add_group (source_list, source_group, -1); - g_object_unref (source_group); - } - - if (personal == NULL) { - ESource *source; - GSList *selected; - const gchar *name; - gchar *primary; - - name = _("Personal"); - source = e_source_new (name, PERSONAL_RELATIVE_URI); - e_source_group_add_source (on_this_computer, source, -1); - g_object_unref (source); - - primary = calendar_config_get_primary_calendar (); - selected = calendar_config_get_calendars_selected (); - - if (primary == NULL && selected == NULL) { - const gchar *uid; - - uid = e_source_peek_uid (source); - selected = g_slist_prepend (NULL, g_strdup (uid)); - - calendar_config_set_primary_calendar (uid); - calendar_config_set_calendars_selected (selected); - } - - g_slist_foreach (selected, (GFunc) g_free, NULL); - g_slist_free (selected); - g_free (primary); - } - - if (on_the_web == NULL) { - ESourceGroup *source_group; - const gchar *name; - - name = _("On The Web"); - source_group = e_source_group_new (name, WEB_BASE_URI); - e_source_list_add_group (source_list, source_group, -1); - g_object_unref (source_group); - } - - if (contacts != NULL) { - GSList *sources; - - sources = e_source_group_peek_sources (contacts); - - if (sources != NULL) { - GSList *trash; - - /* There is only one source under Contacts. */ - birthdays = E_SOURCE (sources->data); - sources = g_slist_next (sources); - - /* Delete any other sources in this group. - * Earlier versions allowed you to create - * additional sources under Contacts. */ - trash = g_slist_copy (sources); - while (trash != NULL) { - ESource *source = trash->data; - e_source_group_remove_source (contacts, source); - trash = g_slist_delete_link (trash, trash); - } - - } - } else { - ESourceGroup *source_group; - const gchar *name; - - name = _("Contacts"); - source_group = e_source_group_new (name, CONTACTS_BASE_URI); - e_source_list_add_group (source_list, source_group, -1); - g_object_unref (source_group); - - /* This is now a borrowed reference. */ - contacts = source_group; - } - - /* XXX e_source_group_get_property() returns a newly-allocated - * string when it could just as easily return a const string. - * Unfortunately, fixing that would break the API. */ - property = e_source_group_get_property (contacts, "create_source"); - if (property == NULL) - e_source_group_set_property (contacts, "create_source", "no"); - g_free (property); - - if (birthdays == NULL) { - ESource *source; - const gchar *name; - - name = _("Birthdays & Anniversaries"); - source = e_source_new (name, "/"); - e_source_group_add_source (contacts, source, -1); - g_object_unref (source); - - /* This is now a borrowed reference. */ - birthdays = source; - } - - if (e_source_get_property (birthdays, "delete") == NULL) - e_source_set_property (birthdays, "delete", "no"); - - if (e_source_peek_color_spec (birthdays) == NULL) - e_source_set_color_spec (birthdays, "#DDBECE"); - - if (weather == NULL) { - ESourceGroup *source_group; - const gchar *name; - - name = _("Weather"); - source_group = e_source_group_new (name, WEATHER_BASE_URI); - e_source_list_add_group (source_list, source_group, -1); - g_object_unref (source_group); - } - - g_free (base_uri); -} - -static void -action_appointment_new_cb (GtkAction *action, - EShellWindow *shell_window) -{ -} - -static void -action_appointment_all_day_new_cb (GtkAction *action, - EShellWindow *shell_window) -{ -} - -static void -action_meeting_new_cb (GtkAction *action, - EShellWindow *shell_window) -{ -} - -static void -action_calendar_new_cb (GtkAction *action, - EShellWindow *shell_window) -{ -} - -static GtkActionEntry item_entries[] = { - - { "appointment-new", - "appointment-new", - N_("_Appointment"), /* XXX Need C_() here */ - "<Control>a", - N_("Create a new appointment"), - G_CALLBACK (action_appointment_new_cb) }, - - { "appointment-all-day-new", - "stock_new-24h-appointment", - N_("All Day A_ppointment"), - NULL, - N_("Create a new all-day appointment"), - G_CALLBACK (action_appointment_all_day_new_cb) }, - - { "meeting-new", - "stock_new-meeting", - N_("M_eeting"), - "<Control>e", - N_("Create a new meeting request"), - G_CALLBACK (action_meeting_new_cb) } -}; - -static GtkActionEntry source_entries[] = { - - { "calendar-new", - "x-office-calendar", - N_("Cale_ndar"), - NULL, - N_("Create a new calendar"), - G_CALLBACK (action_calendar_new_cb) } -}; - -static gboolean -cal_module_handle_uri (EShellModule *shell_module, - const gchar *uri) -{ - /* FIXME */ - return FALSE; -} - -static void -cal_module_window_created (EShellModule *shell_module, - EShellWindow *shell_window) -{ - const gchar *module_name; - - module_name = G_TYPE_MODULE (shell_module)->name; - - e_shell_window_register_new_item_actions ( - shell_window, module_name, - item_entries, G_N_ELEMENTS (item_entries)); - - e_shell_window_register_new_source_actions ( - shell_window, module_name, - source_entries, G_N_ELEMENTS (source_entries)); -} - -static EShellModuleInfo module_info = { - - MODULE_NAME, - MODULE_ALIASES, - MODULE_SCHEMES, - MODULE_SEARCHES, - MODULE_SORT_ORDER -}; - -void -e_shell_module_init (GTypeModule *type_module) -{ - EShell *shell; - EShellModule *shell_module; - - shell_module = E_SHELL_MODULE (type_module); - shell = e_shell_module_get_shell (shell_module); - - /* Register the GType for ECalShellView. */ - e_cal_shell_view_get_type (type_module); - - e_shell_module_set_info (shell_module, &module_info); - - cal_module_ensure_sources (shell_module); - - g_signal_connect_swapped ( - shell, "handle-uri", - G_CALLBACK (cal_module_handle_uri), shell_module); - - g_signal_connect_swapped ( - shell, "window-created", - G_CALLBACK (cal_module_window_created), shell_module); -} diff --git a/calendar/gui/e-cal-shell-sidebar.c b/calendar/gui/e-cal-shell-sidebar.c deleted file mode 100644 index 5d14f589f0..0000000000 --- a/calendar/gui/e-cal-shell-sidebar.c +++ /dev/null @@ -1,331 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-cal-shell-sidebar.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-cal-shell-sidebar.h" - -#include <string.h> -#include <glib/gi18n.h> -#include <libecal/e-cal-time-util.h> -#include <libedataserver/e-data-server-util.h> -#include <libedataserverui/e-source-selector.h> - -#include <e-util/e-util.h> - -#include <gnome-cal.h> -#include <e-cal-shell-view.h> -#include <e-calendar-selector.h> - -#define E_CAL_SHELL_SIDEBAR_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_CAL_SHELL_SIDEBAR, ECalShellSidebarPrivate)) - -struct _ECalShellSidebarPrivate { - GtkWidget *selector; -}; - -enum { - PROP_0, - PROP_SELECTOR -}; - -static gpointer parent_class; - -static void -cal_shell_sidebar_update (EShellSidebar *shell_sidebar) -{ - EShellView *shell_view; - GnomeCalendar *calendar; - GnomeCalendarViewType view; - time_t start_time, end_time; - struct tm start_tm, end_tm; - struct icaltimetype start_tt, end_tt; - icaltimezone *timezone; - gchar buffer[512]; - gchar end_buffer[512]; - - shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - calendar = e_cal_shell_view_get_calendar ( - E_CAL_SHELL_VIEW (shell_view)); - - gnome_calendar_get_visible_time_range ( - calendar, &start_time, &end_time); - timezone = gnome_calendar_get_timezone (calendar); - view = gnome_calendar_get_view (calendar); - - start_tt = icaltime_from_timet_with_zone (start_time, FALSE, timezone); - start_tm.tm_year = start_tt.year - 1900; - start_tm.tm_mon = start_tt.month - 1; - start_tm.tm_mday = start_tt.day; - start_tm.tm_hour = start_tt.hour; - start_tm.tm_min = start_tt.minute; - start_tm.tm_sec = start_tt.second; - start_tm.tm_isdst = -1; - start_tm.tm_wday = time_day_of_week ( - start_tt.day, start_tt.month - 1, start_tt.year); - - /* Subtract one from end_time so we don't get an extra day. */ - end_tt = icaltime_from_timet_with_zone (end_time - 1, FALSE, timezone); - end_tm.tm_year = end_tt.year - 1900; - end_tm.tm_mon = end_tt.month - 1; - end_tm.tm_mday = end_tt.day; - end_tm.tm_hour = end_tt.hour; - end_tm.tm_min = end_tt.minute; - end_tm.tm_sec = end_tt.second; - end_tm.tm_isdst = -1; - end_tm.tm_wday = time_day_of_week ( - end_tt.day, end_tt.month - 1, end_tt.year); - - switch (view) { - case GNOME_CAL_DAY_VIEW: - case GNOME_CAL_WORK_WEEK_VIEW: - case GNOME_CAL_WEEK_VIEW: - if (start_tm.tm_year == end_tm.tm_year && - start_tm.tm_mon == end_tm.tm_mon && - start_tm.tm_mday == end_tm.tm_mday) { - e_utf8_strftime ( - buffer, sizeof (buffer), - _("%A %d %b %Y"), &start_tm); - } else if (start_tm.tm_year == end_tm.tm_year) { - e_utf8_strftime ( - buffer, sizeof (buffer), - _("%a %d %b"), &start_tm); - e_utf8_strftime ( - end_buffer, sizeof (end_buffer), - _("%a %d %b %Y"), &end_tm); - strcat (buffer, " - "); - strcat (buffer, end_buffer); - } else { - e_utf8_strftime ( - buffer, sizeof (buffer), - _("%a %d %b %Y"), &start_tm); - e_utf8_strftime ( - end_buffer, sizeof (end_buffer), - _("%a %d %b %Y"), &end_tm); - strcat (buffer, " - "); - strcat (buffer, end_buffer); - } - break; - - case GNOME_CAL_MONTH_VIEW: - case GNOME_CAL_LIST_VIEW: - if (start_tm.tm_year == end_tm.tm_year) { - if (start_tm.tm_mon == end_tm.tm_mon) { - e_utf8_strftime ( - buffer, - sizeof (buffer), - "%d", &start_tm); - e_utf8_strftime ( - end_buffer, - sizeof (end_buffer), - _("%d %b %Y"), &end_tm); - strcat (buffer, " - "); - strcat (buffer, end_buffer); - } else { - e_utf8_strftime ( - buffer, - sizeof (buffer), - _("%d %b"), &start_tm); - e_utf8_strftime ( - end_buffer, - sizeof (end_buffer), - _("%d %b %Y"), &end_tm); - strcat (buffer, " - "); - strcat (buffer, end_buffer); - } - } else { - e_utf8_strftime ( - buffer, sizeof (buffer), - _("%d %b %Y"), &start_tm); - e_utf8_strftime ( - end_buffer, sizeof (end_buffer), - _("%d %b %Y"), &end_tm); - strcat (buffer, " - "); - strcat (buffer, end_buffer); - } - break; - - default: - g_return_if_reached (); - } - - e_shell_sidebar_set_secondary_text (shell_sidebar, buffer); -} - -static void -cal_shell_sidebar_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - switch (property_id) { - case PROP_SELECTOR: - g_value_set_object ( - value, e_cal_shell_sidebar_get_selector ( - E_CAL_SHELL_SIDEBAR (object))); - return; - } - - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); -} - -static void -cal_shell_sidebar_dispose (GObject *object) -{ - ECalShellSidebarPrivate *priv; - - priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (object); - - if (priv->selector != NULL) { - g_object_unref (priv->selector); - priv->selector = NULL; - } - - /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -cal_shell_sidebar_constructed (GObject *object) -{ - ECalShellSidebarPrivate *priv; - EShellView *shell_view; - EShellSidebar *shell_sidebar; - ECalShellView *cal_shell_view; - ESourceList *source_list; - GtkContainer *container; - GtkWidget *widget; - GnomeCalendar *calendar; - - priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (object); - - shell_sidebar = E_SHELL_SIDEBAR (object); - shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - cal_shell_view = E_CAL_SHELL_VIEW (shell_view); - source_list = e_cal_shell_view_get_source_list (cal_shell_view); - - container = GTK_CONTAINER (shell_sidebar); - - 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_container_add (container, widget); - gtk_widget_show (widget); - - container = GTK_CONTAINER (widget); - - widget = e_calendar_selector_new (source_list); - e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE); - gtk_container_add (container, widget); - priv->selector = g_object_ref (widget); - gtk_widget_show (widget); - - /* Setup signal handlers. */ - - calendar = e_cal_shell_view_get_calendar (cal_shell_view); - - g_signal_connect_swapped ( - calendar, "dates-shown-changed", - G_CALLBACK (cal_shell_sidebar_update), - shell_sidebar); - - cal_shell_sidebar_update (shell_sidebar); -} - -static void -cal_shell_sidebar_class_init (ECalShellSidebarClass *class) -{ - GObjectClass *object_class; - - parent_class = g_type_class_peek_parent (class); - g_type_class_add_private (class, sizeof (ECalShellSidebarPrivate)); - - object_class = G_OBJECT_CLASS (class); - object_class->get_property = cal_shell_sidebar_get_property; - object_class->dispose = cal_shell_sidebar_dispose; - object_class->constructed = cal_shell_sidebar_constructed; - - g_object_class_install_property ( - object_class, - PROP_SELECTOR, - g_param_spec_object ( - "selector", - _("Source Selector Widget"), - _("This widget displays groups of calendars"), - E_TYPE_SOURCE_SELECTOR, - G_PARAM_READABLE)); -} - -static void -cal_shell_sidebar_init (ECalShellSidebar *cal_shell_sidebar) -{ - cal_shell_sidebar->priv = - E_CAL_SHELL_SIDEBAR_GET_PRIVATE (cal_shell_sidebar); - - /* Postpone widget construction until we have a shell view. */ -} - -GType -e_cal_shell_sidebar_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ECalShellSidebarClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) cal_shell_sidebar_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ECalShellSidebar), - 0, /* n_preallocs */ - (GInstanceInitFunc) cal_shell_sidebar_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_SHELL_SIDEBAR, "ECalShellSidebar", - &type_info, 0); - } - - return type; -} - -GtkWidget * -e_cal_shell_sidebar_new (EShellView *shell_view) -{ - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); - - return g_object_new ( - E_TYPE_CAL_SHELL_SIDEBAR, - "shell-view", shell_view, NULL); -} - -GtkWidget * -e_cal_shell_sidebar_get_selector (ECalShellSidebar *cal_shell_sidebar) -{ - g_return_val_if_fail ( - E_IS_CAL_SHELL_SIDEBAR (cal_shell_sidebar), NULL); - - return cal_shell_sidebar->priv->selector; -} diff --git a/calendar/gui/e-cal-shell-sidebar.h b/calendar/gui/e-cal-shell-sidebar.h deleted file mode 100644 index 89eaee7613..0000000000 --- a/calendar/gui/e-cal-shell-sidebar.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-cal-shell-sidebar.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_CAL_SHELL_SIDEBAR_H -#define E_CAL_SHELL_SIDEBAR_H - -#include <e-shell-sidebar.h> -#include <e-shell-view.h> - -/* Standard GObject macros */ -#define E_TYPE_CAL_SHELL_SIDEBAR \ - (e_cal_shell_sidebar_get_type ()) -#define E_CAL_SHELL_SIDEBAR(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST \ - ((obj), E_TYPE_CAL_SHELL_SIDEBAR, ECalShellSidebar)) -#define E_CAL_SHELL_SIDEBAR_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_CAST \ - ((cls), E_TYPE_CAL_SHELL_SIDEBAR, ECalShellSidebarClass)) -#define E_IS_CAL_SHELL_SIDEBAR(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE \ - ((obj), E_TYPE_CAL_SHELL_SIDEBAR)) -#define E_IS_CAL_SHELL_SIDEBAR_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_TYPE \ - ((cls), E_TYPE_CAL_SHELL_SIDEBAR)) -#define E_CAL_SHELL_SIDEBAR_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS \ - ((obj), E_TYPE_CAL_SHELL_SIDEBAR, ECalShellSidebarClass)) - -G_BEGIN_DECLS - -typedef struct _ECalShellSidebar ECalShellSidebar; -typedef struct _ECalShellSidebarClass ECalShellSidebarClass; -typedef struct _ECalShellSidebarPrivate ECalShellSidebarPrivate; - -struct _ECalShellSidebar { - EShellSidebar parent; - ECalShellSidebarPrivate *priv; -}; - -struct _ECalShellSidebarClass { - EShellSidebarClass parent_class; -}; - -GType e_cal_shell_sidebar_get_type (void); -GtkWidget * e_cal_shell_sidebar_new (EShellView *shell_view); -GtkWidget * e_cal_shell_sidebar_get_selector(ECalShellSidebar *cal_shell_sidebar); - -G_END_DECLS - -#endif /* E_CAL_SHELL_SIDEBAR_H */ diff --git a/calendar/gui/e-cal-shell-view-actions.c b/calendar/gui/e-cal-shell-view-actions.c deleted file mode 100644 index e4f9d351c5..0000000000 --- a/calendar/gui/e-cal-shell-view-actions.c +++ /dev/null @@ -1,331 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-cal-shell-view-actions.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-cal-shell-view-private.h" - -static void -action_calendar_copy_cb (GtkAction *action, - ECalShellView *cal_shell_view) -{ -} - -static void -action_calendar_delete_cb (GtkAction *action, - ECalShellView *cal_shell_view) -{ -} - -static void -action_calendar_go_back_cb (GtkAction *action, - ECalShellView *cal_shell_view) -{ -} - -static void -action_calendar_go_forward_cb (GtkAction *action, - ECalShellView *cal_shell_view) -{ -} - -static void -action_calendar_go_today_cb (GtkAction *action, - ECalShellView *cal_shell_view) -{ -} - -static void -action_calendar_jump_to_cb (GtkAction *action, - ECalShellView *cal_shell_view) -{ -} - -static void -action_calendar_new_cb (GtkAction *action, - ECalShellView *cal_shell_view) -{ -} - -static void -action_calendar_print_cb (GtkAction *action, - ECalShellView *cal_shell_view) -{ -} - -static void -action_calendar_print_preview_cb (GtkAction *action, - ECalShellView *cal_shell_view) -{ -} - -static void -action_calendar_properties_cb (GtkAction *action, - ECalShellView *cal_shell_view) -{ -} - -static void -action_calendar_purge_cb (GtkAction *action, - ECalShellView *cal_shell_view) -{ -} - -static void -action_calendar_view_cb (GtkRadioAction *action, - GtkRadioAction *current, - ECalShellView *cal_shell_view) -{ -} - -static void -action_event_clipboard_copy_cb (GtkAction *action, - ECalShellView *cal_shell_view) -{ -} - -static void -action_event_clipboard_cut_cb (GtkAction *action, - ECalShellView *cal_shell_view) -{ -} - -static void -action_event_clipboard_paste_cb (GtkAction *action, - ECalShellView *cal_shell_view) -{ -} - -static void -action_event_delete_cb (GtkAction *action, - ECalShellView *cal_shell_view) -{ -} - -static void -action_event_delete_occurrence_cb (GtkAction *action, - ECalShellView *cal_shell_view) -{ -} - -static void -action_event_delete_occurrence_all_cb (GtkAction *action, - ECalShellView *cal_shell_view) -{ -} - -static void -action_event_open_cb (GtkAction *action, - ECalShellView *cal_shell_view) -{ -} - -static GtkActionEntry calendar_entries[] = { - - { "calendar-copy", - GTK_STOCK_COPY, - N_("_Copy..."), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_calendar_copy_cb) }, - - { "calendar-delete", - GTK_STOCK_DELETE, - NULL, - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_calendar_delete_cb) }, - - { "calendar-go-back", - GTK_STOCK_GO_BACK, - N_("Previous"), - NULL, - N_("Go Back"), - G_CALLBACK (action_calendar_go_back_cb) }, - - { "calendar-go-forward", - GTK_STOCK_GO_FORWARD, - N_("Next"), - NULL, - N_("Go Forward"), - G_CALLBACK (action_calendar_go_forward_cb) }, - - { "calendar-go-today", - "go-today", - N_("Select _Today"), - "<Control>t", - N_("Select today"), - G_CALLBACK (action_calendar_go_today_cb) }, - - { "calendar-jump-to", - GTK_STOCK_JUMP_TO, - N_("Select _Date"), - "<Control>g", - N_("Select a specific date"), - G_CALLBACK (action_calendar_jump_to_cb) }, - - { "calendar-new", - "x-office-calendar", - N_("_New Calendar"), - NULL, - N_("Create a new calendar"), - G_CALLBACK (action_calendar_new_cb) }, - - { "calendar-print", - GTK_STOCK_PRINT, - NULL, - NULL, - N_("Print this calendar"), - G_CALLBACK (action_calendar_print_cb) }, - - { "calendar-print-preview", - GTK_STOCK_PRINT_PREVIEW, - NULL, - NULL, - N_("Preview the calendar to be printed"), - G_CALLBACK (action_calendar_print_preview_cb) }, - - { "calendar-properties", - GTK_STOCK_PROPERTIES, - NULL, - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_calendar_properties_cb) }, - - { "calendar-purge", - NULL, - N_("Purg_e"), - "<Control>e", - N_("Purge old appointments and meetings"), - G_CALLBACK (action_calendar_purge_cb) }, - - { "event-clipboard-copy", - GTK_STOCK_COPY, - NULL, - NULL, - N_("Copy the selection"), - G_CALLBACK (action_event_clipboard_copy_cb) }, - - { "event-clipboard-cut", - GTK_STOCK_CUT, - NULL, - NULL, - N_("Cut the selection"), - G_CALLBACK (action_event_clipboard_cut_cb) }, - - { "event-clipboard-paste", - GTK_STOCK_PASTE, - NULL, - NULL, - N_("Paste the clipboard"), - G_CALLBACK (action_event_clipboard_paste_cb) }, - - { "event-delete", - GTK_STOCK_DELETE, - NULL, - NULL, - N_("Delete the appointment"), - G_CALLBACK (action_event_delete_cb) }, - - { "event-delete-occurrence", - GTK_STOCK_DELETE, - N_("Delete This _Occurrence"), - NULL, - N_("Delete this occurrence"), - G_CALLBACK (action_event_delete_occurrence_cb) }, - - { "event-delete-occurrence-all", - GTK_STOCK_DELETE, - N_("Delete _All Occurrences"), - NULL, - N_("Delete all occurrences"), - G_CALLBACK (action_event_delete_occurrence_all_cb) }, - - { "event-open", - NULL, - N_("_Open Appointment"), - "<Control>o", - N_("View the current appointment"), - G_CALLBACK (action_event_open_cb) } -}; - -static GtkRadioActionEntry calendar_view_entries[] = { - - { "calendar-view-day", - "view-calendar-day", - N_("Day"), - NULL, - N_("Show one day"), - GNOME_CAL_DAY_VIEW }, - - { "calendar-view-list", - "view-calendar-list", - N_("List"), - NULL, - N_("Show as list"), - GNOME_CAL_LIST_VIEW }, - - { "calendar-view-month", - "view-calendar-month", - N_("Month"), - NULL, - N_("Show one month"), - GNOME_CAL_MONTH_VIEW }, - - { "calendar-view-week", - "view-calendar-week", - N_("Week"), - NULL, - N_("Show one week"), - GNOME_CAL_WEEK_VIEW }, - - { "calendar-view-workweek", - "view-calendar-workweek", - N_("Work Week"), - NULL, - N_("Show one work week"), - GNOME_CAL_WORK_WEEK_VIEW } -}; - -void -e_cal_shell_view_actions_init (ECalShellView *cal_shell_view) -{ - EShellView *shell_view; - EShellWindow *shell_window; - GtkActionGroup *action_group; - GtkUIManager *manager; - const gchar *domain; - - shell_view = E_SHELL_VIEW (cal_shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - manager = e_shell_window_get_ui_manager (shell_window); - domain = GETTEXT_PACKAGE; - - e_load_ui_definition (manager, "evolution-calendars.ui"); - - action_group = cal_shell_view->priv->calendar_actions; - gtk_action_group_set_translation_domain (action_group, domain); - gtk_action_group_add_actions ( - action_group, calendar_entries, - G_N_ELEMENTS (calendar_entries), cal_shell_view); - gtk_action_group_add_radio_actions ( - action_group, calendar_view_entries, - G_N_ELEMENTS (calendar_view_entries), GNOME_CAL_DAY_VIEW, - G_CALLBACK (action_calendar_view_cb), cal_shell_view); - gtk_ui_manager_insert_action_group (manager, action_group, 0); -} diff --git a/calendar/gui/e-cal-shell-view-actions.h b/calendar/gui/e-cal-shell-view-actions.h deleted file mode 100644 index 9d935e4263..0000000000 --- a/calendar/gui/e-cal-shell-view-actions.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-cal-shell-view-actions.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_CAL_SHELL_VIEW_ACTIONS_H -#define E_CAL_SHELL_VIEW_ACTIONS_H - -#include <shell/e-shell-window-actions.h> - -/* Action Groups */ -#define E_SHELL_WINDOW_ACTION_GROUP_CALS(window) \ - E_SHELL_WINDOW_ACTION_GROUP ((window), "cals") - -#endif /* E_CAL_SHELL_VIEW_ACTIONS_H */ diff --git a/calendar/gui/e-cal-shell-view-private.c b/calendar/gui/e-cal-shell-view-private.c deleted file mode 100644 index 2e7619cadc..0000000000 --- a/calendar/gui/e-cal-shell-view-private.c +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-cal-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-cal-shell-view-private.h" - -void -e_cal_shell_view_private_init (ECalShellView *cal_shell_view, - EShellViewClass *shell_view_class) -{ - ECalShellViewPrivate *priv = cal_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->calendar_actions = gtk_action_group_new ("calendars"); -} - -void -e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view) -{ - ECalShellViewPrivate *priv = cal_shell_view->priv; -} - -void -e_cal_shell_view_private_dispose (ECalShellView *cal_shell_view) -{ - ECalShellViewPrivate *priv = cal_shell_view->priv; - - DISPOSE (priv->source_list); - - DISPOSE (priv->calendar_actions); -} - -void -e_cal_shell_view_private_finalize (ECalShellView *cal_shell_view) -{ - ECalShellViewPrivate *priv = cal_shell_view->priv; -} diff --git a/calendar/gui/e-cal-shell-view-private.h b/calendar/gui/e-cal-shell-view-private.h deleted file mode 100644 index 553dc5246c..0000000000 --- a/calendar/gui/e-cal-shell-view-private.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-cal-shell-view-private.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_CAL_SHELL_VIEW_PRIVATE_H -#define E_CAL_SHELL_VIEW_PRIVATE_H - -#include "e-cal-shell-view.h" - -#include <glib/gi18n.h> - -#include <e-util/e-util.h> -#include <shell/e-shell-content.h> - -#include <gnome-cal.h> -#include <e-cal-shell-sidebar.h> -#include <e-cal-shell-view-actions.h> - -#define E_CAL_SHELL_VIEW_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_CAL_SHELL_VIEW, ECalShellViewPrivate)) - -/* Shorthand, requires a variable named "shell_window". */ -#define ACTION(name) \ - (E_SHELL_WINDOW_ACTION_##name (shell_window)) -#define ACTION_GROUP(name) \ - (E_SHELL_WINDOW_ACTION_GROUP_##name (shell_window)) - -/* For use in dispose() methods. */ -#define DISPOSE(obj) \ - G_STMT_START { \ - if ((obj) != NULL) { g_object_unref (obj); (obj) = NULL; } \ - } G_STMT_END - -G_BEGIN_DECLS - -struct _ECalShellViewPrivate { - - /*** Module Data ***/ - - ESourceList *source_list; - - /*** UI Management ***/ - - GtkActionGroup *calendar_actions; -}; - -void e_cal_shell_view_private_init - (ECalShellView *cal_shell_view, - EShellViewClass *shell_view_class); -void e_cal_shell_view_private_constructed - (ECalShellView *cal_shell_view); -void e_cal_shell_view_private_dispose - (ECalShellView *cal_shell_view); -void e_cal_shell_view_private_finalize - (ECalShellView *cal_shell_view); - -/* Private Utilities */ - -void e_cal_shell_view_actions_init - (ECalShellView *cal_shell_view); - -G_END_DECLS - -#endif /* E_CAL_SHELL_VIEW_PRIVATE_H */ diff --git a/calendar/gui/e-cal-shell-view.c b/calendar/gui/e-cal-shell-view.c deleted file mode 100644 index 4ca7df1848..0000000000 --- a/calendar/gui/e-cal-shell-view.c +++ /dev/null @@ -1,174 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-cal-shell-view.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-cal-shell-view-private.h" - -enum { - PROP_0, - PROP_SOURCE_LIST -}; - -GType e_cal_shell_view_type = 0; -static gpointer parent_class; - -static void -cal_shell_view_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - switch (property_id) { - case PROP_SOURCE_LIST: - g_value_set_object ( - value, e_cal_shell_view_get_source_list ( - E_CAL_SHELL_VIEW (object))); - return; - } - - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); -} - -static void -cal_shell_view_dispose (GObject *object) -{ - e_cal_shell_view_private_dispose (E_CAL_SHELL_VIEW (object)); - - /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -cal_shell_view_finalize (GObject *object) -{ - e_cal_shell_view_private_finalize (E_CAL_SHELL_VIEW (object)); - - /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -cal_shell_view_constructed (GObject *object) -{ - /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); - - e_cal_shell_view_private_constructed (E_CAL_SHELL_VIEW (object)); -} - -static void -cal_shell_view_changed (EShellView *shell_view) -{ - ECalShellViewPrivate *priv; - GtkActionGroup *action_group; - gboolean visible; - - priv = E_CAL_SHELL_VIEW_GET_PRIVATE (shell_view); - - action_group = priv->calendar_actions; - visible = e_shell_view_is_selected (shell_view); - gtk_action_group_set_visible (action_group, visible); -} - -static void -cal_shell_view_class_init (ECalShellView *class, - GTypeModule *type_module) -{ - GObjectClass *object_class; - EShellViewClass *shell_view_class; - - parent_class = g_type_class_peek_parent (class); - g_type_class_add_private (class, sizeof (ECalShellViewPrivate)); - - object_class = G_OBJECT_CLASS (class); - object_class->get_property = cal_shell_view_get_property; - object_class->dispose = cal_shell_view_dispose; - object_class->finalize = cal_shell_view_finalize; - object_class->constructed = cal_shell_view_constructed; - - shell_view_class = E_SHELL_VIEW_CLASS (class); - shell_view_class->label = N_("Cals"); - shell_view_class->icon_name = "evolution-cals"; - 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; - - g_object_class_install_property ( - object_class, - PROP_SOURCE_LIST, - g_param_spec_object ( - "source-list", - _("Source List"), - _("The registry of calendars"), - E_TYPE_SOURCE_LIST, - G_PARAM_READABLE)); -} - -static void -cal_shell_view_init (ECalShellView *cal_shell_view, - EShellViewClass *shell_view_class) -{ - cal_shell_view->priv = - E_CAL_SHELL_VIEW_GET_PRIVATE (cal_shell_view); - - e_cal_shell_view_private_init (cal_shell_view, shell_view_class); -} - -GType -e_cal_shell_view_get_type (GTypeModule *type_module) -{ - if (e_cal_shell_view_type == 0) { - const GTypeInfo type_info = { - sizeof (ECalShellViewClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) cal_shell_view_class_init, - (GClassFinalizeFunc) NULL, - type_module, - sizeof (ECalShellView), - 0, /* n_preallocs */ - (GInstanceInitFunc) cal_shell_view_init, - NULL /* value_table */ - }; - - e_cal_shell_view_type = - g_type_module_register_type ( - type_module, E_TYPE_SHELL_VIEW, - "ECalShellView", &type_info, 0); - } - - return e_cal_shell_view_type; -} - -GnomeCalendar * -e_cal_shell_view_get_calendar (ECalShellView *cal_shell_view) -{ - g_return_val_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view), NULL); - - /* FIXME */ - return NULL; -} - -ESourceList * -e_cal_shell_view_get_source_list (ECalShellView *cal_shell_view) -{ - g_return_val_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view), NULL); - - return cal_shell_view->priv->source_list; -} diff --git a/calendar/gui/e-cal-shell-view.h b/calendar/gui/e-cal-shell-view.h deleted file mode 100644 index 404446f22b..0000000000 --- a/calendar/gui/e-cal-shell-view.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-cal-shell-view.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_CAL_SHELL_VIEW_H -#define E_CAL_SHELL_VIEW_H - -#include <gnome-cal.h> -#include <e-shell-view.h> -#include <libedataserver/e-source-list.h> - -/* Standard GObject macros */ -#define E_TYPE_CAL_SHELL_VIEW \ - (e_cal_shell_view_type) -#define E_CAL_SHELL_VIEW(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST \ - ((obj), E_TYPE_CAL_SHELL_VIEW, ECalShellView)) -#define E_CAL_SHELL_VIEW_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_CAST \ - ((cls), E_TYPE_CAL_SHELL_VIEW, ECalShellViewClass)) -#define E_IS_CAL_SHELL_VIEW(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE \ - ((obj), E_TYPE_CAL_SHELL_VIEW)) -#define E_IS_CAL_SHELL_VIEW_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_TYPE \ - ((cls), E_TYPE_CAL_SHELL_VIEW)) -#define E_CAL_SHELL_VIEW_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS \ - ((obj), E_TYPE_CAL_SHELL_VIEW, ECalShellViewClass)) - -G_BEGIN_DECLS - -extern GType e_cal_shell_view_type; - -typedef struct _ECalShellView ECalShellView; -typedef struct _ECalShellViewClass ECalShellViewClass; -typedef struct _ECalShellViewPrivate ECalShellViewPrivate; - -struct _ECalShellView { - EShellView parent; - ECalShellViewPrivate *priv; -}; - -struct _ECalShellViewClass { - EShellViewClass parent_class; -}; - -GType e_cal_shell_view_get_type - (GTypeModule *type_module); -GnomeCalendar * e_cal_shell_view_get_calendar - (ECalShellView *cal_shell_view); -ESourceList * e_cal_shell_view_get_source_list - (ECalShellView *cal_shell_view); - -G_END_DECLS - -#endif /* E_CAL_SHELL_VIEW_H */ 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-module.c b/calendar/gui/e-memo-shell-module.c deleted file mode 100644 index 05781d478f..0000000000 --- a/calendar/gui/e-memo-shell-module.c +++ /dev/null @@ -1,298 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-memo-shell-module.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 <string.h> -#include <glib/gi18n.h> -#include <libecal/e-cal.h> -#include <libedataserver/e-source.h> -#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 <calendar-config.h> -#include <e-memo-shell-view.h> -#include <dialogs/calendar-setup.h> - -#define MODULE_NAME "memos" -#define MODULE_ALIASES "" -#define MODULE_SCHEMES "memo" -#define MODULE_SEARCHES "memotypes.xml" -#define MODULE_SORT_ORDER 500 - -#define WEB_BASE_URI "webcal://" -#define PERSONAL_RELATIVE_URI "system" - -/* Module Entry Point */ -void e_shell_module_init (GTypeModule *type_module); - -static void -memo_module_ensure_sources (EShellModule *shell_module) -{ - /* XXX This is basically the same algorithm across all modules. - * Maybe we could somehow integrate this into EShellModule? */ - - ESourceList *source_list; - ESourceGroup *on_this_computer; - ESourceGroup *on_the_web; - ESource *personal; - GSList *groups, *iter; - const gchar *data_dir; - gchar *base_uri; - gchar *filename; - - on_this_computer = NULL; - on_the_web = NULL; - personal = NULL; - - if (!e_cal_get_sources (&source_list, E_CAL_SOURCE_TYPE_JOURNAL, NULL)) { - g_warning ("Could not get memo sources from GConf!"); - return; - } - - /* Share the source list with all memo views. This is - * accessible via e_memo_shell_view_get_source_list(). - * Note: EShellModule takes ownership of the reference. - * - * XXX I haven't yet decided if I want to add a proper - * EShellModule API for this. The mail module would - * not use it. */ - g_object_set_data_full ( - G_OBJECT (shell_module), "source-list", - source_list, (GDestroyNotify) g_object_unref); - - data_dir = e_shell_module_get_data_dir (shell_module); - filename = g_build_filename (data_dir, "local", NULL); - base_uri = g_filename_to_uri (filename, NULL, NULL); - g_free (filename); - - groups = e_source_list_peek_groups (source_list); - for (iter = groups; iter != NULL; iter = iter->next) { - ESourceGroup *source_group = iter->data; - const gchar *group_base_uri; - - group_base_uri = e_source_group_peek_base_uri (source_group); - - /* Compare only "file://" part. If the user's home - * changes, we do not want to create another group. */ - if (on_this_computer == NULL && - strncmp (base_uri, group_base_uri, 7) == 0) - on_this_computer = source_group; - - else if (on_the_web == NULL && - strcmp (WEB_BASE_URI, group_base_uri) == 0) - on_the_web = source_group; - } - - if (on_this_computer != NULL) { - GSList *sources; - const gchar *group_base_uri; - - sources = e_source_group_peek_sources (on_this_computer); - group_base_uri = e_source_group_peek_base_uri (on_this_computer); - - /* Make sure this group includes a "Personal" source. */ - for (iter = sources; iter != NULL; iter = iter->next) { - ESource *source = iter->data; - const gchar *relative_uri; - - relative_uri = e_source_peek_relative_uri (source); - if (relative_uri == NULL) - continue; - - if (strcmp (PERSONAL_RELATIVE_URI, relative_uri) != 0) - continue; - - personal = source; - break; - } - - /* Make sure we have the correct base URI. This can - * change when the user's home directory changes. */ - if (strcmp (base_uri, group_base_uri) != 0) { - e_source_group_set_base_uri ( - on_this_computer, base_uri); - - /* XXX We shouldn't need this sync call here as - * set_base_uri() results in synching to GConf, - * but that happens in an idle loop and too late - * to prevent the user from seeing a "Cannot - * Open ... because of invalid URI" error. */ - e_source_list_sync (source_list, NULL); - } - - } else { - ESourceGroup *source_group; - const gchar *name; - - name = _("On This Computer"); - source_group = e_source_group_new (name, base_uri); - e_source_list_add_group (source_list, source_group, -1); - g_object_unref (source_group); - } - - if (personal == NULL) { - ESource *source; - GSList *selected; - const gchar *name; - gchar *primary; - - name = _("Personal"); - source = e_source_new (name, PERSONAL_RELATIVE_URI); - e_source_group_add_source (on_this_computer, source, -1); - g_object_unref (source); - - primary = calendar_config_get_primary_memos (); - selected = calendar_config_get_memos_selected (); - - if (primary == NULL && selected == NULL) { - const gchar *uid; - - uid = e_source_peek_uid (source); - selected = g_slist_prepend (NULL, g_strdup (uid)); - - calendar_config_set_primary_memos (uid); - calendar_config_set_memos_selected (selected); - } - - g_slist_foreach (selected, (GFunc) g_free, NULL); - g_slist_free (selected); - g_free (primary); - } - - if (on_the_web == NULL) { - ESourceGroup *source_group; - const gchar *name; - - name = _("On The Web"); - source_group = e_source_group_new (name, WEB_BASE_URI); - e_source_list_add_group (source_list, source_group, -1); - g_object_unref (source_group); - } - - g_free (base_uri); -} - -static void -action_memo_new_cb (GtkAction *action, - EShellWindow *shell_window) -{ -} - -static void -action_memo_shared_new_cb (GtkAction *action, - EShellWindow *shell_window) -{ -} - -static void -action_memo_list_new_cb (GtkAction *action, - EShellWindow *shell_window) -{ - calendar_setup_new_memo_list (NULL); -} - -static GtkActionEntry item_entries[] = { - - { "memo-new", - "stock_insert-note", - N_("Mem_o"), /* XXX Need C_() here */ - "<Control>o", - N_("Create a new memo"), - G_CALLBACK (action_memo_new_cb) }, - - { "memo-shared-new", - "stock_insert-note", - N_("_Shared Memo"), - "<Control>h", - N_("Create a new shared memo"), - G_CALLBACK (action_memo_shared_new_cb) } -}; - -static GtkActionEntry source_entries[] = { - - { "memo-list-new", - "stock_notes", - N_("Memo Li_st"), - NULL, - N_("Create a new memo list"), - G_CALLBACK (action_memo_list_new_cb) } -}; - -static gboolean -memo_module_handle_uri (EShellModule *shell_module, - const gchar *uri) -{ - /* FIXME */ - return FALSE; -} - -static void -memo_module_window_created (EShellModule *shell_module, - EShellWindow *shell_window) -{ - const gchar *module_name; - - module_name = G_TYPE_MODULE (shell_module)->name; - - e_shell_window_register_new_item_actions ( - shell_window, module_name, - item_entries, G_N_ELEMENTS (item_entries)); - - e_shell_window_register_new_source_actions ( - shell_window, module_name, - source_entries, G_N_ELEMENTS (source_entries)); -} - -static EShellModuleInfo module_info = { - - MODULE_NAME, - MODULE_ALIASES, - MODULE_SCHEMES, - MODULE_SEARCHES, - MODULE_SORT_ORDER -}; - -void -e_shell_module_init (GTypeModule *type_module) -{ - EShell *shell; - EShellModule *shell_module; - - shell_module = E_SHELL_MODULE (type_module); - shell = e_shell_module_get_shell (shell_module); - - /* Register the GType for EMemoShellView. */ - e_memo_shell_view_get_type (type_module); - - e_shell_module_set_info (shell_module, &module_info); - - memo_module_ensure_sources (shell_module); - - g_signal_connect_swapped ( - shell, "handle-uri", - G_CALLBACK (memo_module_handle_uri), shell_module); - - g_signal_connect_swapped ( - shell, "window-created", - G_CALLBACK (memo_module_window_created), shell_module); -} diff --git a/calendar/gui/e-memo-shell-sidebar.c b/calendar/gui/e-memo-shell-sidebar.c deleted file mode 100644 index 43e61edef9..0000000000 --- a/calendar/gui/e-memo-shell-sidebar.c +++ /dev/null @@ -1,264 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-memo-shell-sidebar.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-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> - -#define E_MEMO_SHELL_SIDEBAR_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_MEMO_SHELL_SIDEBAR, EMemoShellSidebarPrivate)) - -struct _EMemoShellSidebarPrivate { - GtkWidget *selector; -}; - -enum { - PROP_0, - PROP_SELECTOR -}; - -static gpointer parent_class; - -static void -memo_shell_sidebar_update (EShellSidebar *shell_sidebar) -{ - EShellView *shell_view; - EMemos *memos; - ETable *table; - ECalModel *model; - EMemoTable *memo_table; - GString *string; - const gchar *format; - gint n_rows; - gint n_selected; - - shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - memos = e_memo_shell_view_get_memos (E_MEMO_SHELL_VIEW (shell_view)); - memo_table = e_memos_get_calendar_table (memos); - model = e_memo_table_get_model (memo_table); - table = e_memo_table_get_table (memo_table); - - n_rows = e_table_model_get_row_count (model); - n_selected = e_table_selected_count (table); - - string = g_string_sized_new (64); - - format = ngettext ("%d memo", "%d memos", n_rows); - g_string_append_printf (string, format, n_rows); - - if (n_selected > 0) { - format = _("%d selected"); - g_string_append_len (string, ", ", 2); - g_string_append_printf (string, format, n_selected); - } - - e_shell_sidebar_set_secondary_text (shell_sidebar, string->str); - - g_string_free (string, TRUE); -} - -static void -memo_shell_sidebar_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - switch (property_id) { - case PROP_SELECTOR: - g_value_set_object ( - value, e_memo_shell_sidebar_get_selector ( - E_MEMO_SHELL_SIDEBAR (object))); - return; - } - - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); -} - -static void -memo_shell_sidebar_dispose (GObject *object) -{ - EMemoShellSidebarPrivate *priv; - - priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (object); - - if (priv->selector != NULL) { - g_object_unref (priv->selector); - priv->selector = NULL; - } - - /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -memo_shell_sidebar_constructed (GObject *object) -{ - EMemoShellSidebarPrivate *priv; - EShellView *shell_view; - EShellSidebar *shell_sidebar; - EMemoShellView *memo_shell_view; - ESourceList *source_list; - GtkContainer *container; - GtkWidget *widget; - EMemos *memos; - ETable *table; - ECalModel *model; - EMemoTable *memo_table; - - priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (object); - - shell_sidebar = E_SHELL_SIDEBAR (object); - shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - memo_shell_view = E_MEMO_SHELL_VIEW (shell_view); - source_list = e_memo_shell_view_get_source_list (memo_shell_view); - - container = GTK_CONTAINER (shell_sidebar); - - 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_container_add (container, widget); - gtk_widget_show (widget); - - container = GTK_CONTAINER (widget); - - widget = e_calendar_selector_new (source_list); - e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE); - gtk_container_add (container, widget); - priv->selector = g_object_ref (widget); - gtk_widget_show (widget); - - /* Setup signal handlers. */ - - memos = e_memo_shell_view_get_memos (memo_shell_view); - memo_table = e_memos_get_calendar_table (memos); - model = e_memo_table_get_model (memo_table); - table = e_memo_table_get_table (memo_table); - - g_signal_connect_swapped ( - model, "model-changed", - G_CALLBACK (memo_shell_sidebar_update), - shell_sidebar); - - g_signal_connect_swapped ( - model, "model-rows-deleted", - G_CALLBACK (memo_shell_sidebar_update), - shell_sidebar); - - g_signal_connect_swapped ( - model, "model-rows-inserted", - G_CALLBACK (memo_shell_sidebar_update), - shell_sidebar); - - g_signal_connect_swapped ( - model, "selection-change", - G_CALLBACK (memo_shell_sidebar_update), - shell_sidebar); - - memo_shell_sidebar_update (shell_sidebar); -} - -static void -memo_shell_sidebar_class_init (EMemoShellSidebarClass *class) -{ - GObjectClass *object_class; - - parent_class = g_type_class_peek_parent (class); - g_type_class_add_private (class, sizeof (EMemoShellSidebarPrivate)); - - object_class = G_OBJECT_CLASS (class); - object_class->get_property = memo_shell_sidebar_get_property; - object_class->dispose = memo_shell_sidebar_dispose; - object_class->constructed = memo_shell_sidebar_constructed; - - g_object_class_install_property ( - object_class, - PROP_SELECTOR, - g_param_spec_object ( - "selector", - _("Source Selector Widget"), - _("This widget displays groups of memo lists"), - E_TYPE_SOURCE_SELECTOR, - G_PARAM_READABLE)); -} - -static void -memo_shell_sidebar_init (EMemoShellSidebar *memo_shell_sidebar) -{ - memo_shell_sidebar->priv = - E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (memo_shell_sidebar); - - /* Postpone widget construction until we have a shell view. */ -} - -GType -e_memo_shell_sidebar_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EMemoShellSidebarClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) memo_shell_sidebar_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMemoShellSidebar), - 0, /* n_preallocs */ - (GInstanceInitFunc) memo_shell_sidebar_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_SHELL_SIDEBAR, "EMemoShellSidebar", - &type_info, 0); - } - - return type; -} - -GtkWidget * -e_memo_shell_sidebar_new (EShellView *shell_view) -{ - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); - - return g_object_new ( - E_TYPE_MEMO_SHELL_SIDEBAR, - "shell-view", shell_view, NULL); -} - -GtkWidget * -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; -} diff --git a/calendar/gui/e-memo-shell-sidebar.h b/calendar/gui/e-memo-shell-sidebar.h deleted file mode 100644 index ee487b07cb..0000000000 --- a/calendar/gui/e-memo-shell-sidebar.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-memo-shell-sidebar.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_SIDEBAR_H -#define E_MEMO_SHELL_SIDEBAR_H - -#include <e-shell-sidebar.h> -#include <e-shell-view.h> - -/* Standard GObject macros */ -#define E_TYPE_MEMO_SHELL_SIDEBAR \ - (e_memo_shell_sidebar_get_type ()) -#define E_MEMO_SHELL_SIDEBAR(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST \ - ((obj), E_TYPE_MEMO_SHELL_SIDEBAR, EMemoShellSidebar)) -#define E_MEMO_SHELL_SIDEBAR_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_CAST \ - ((cls), E_TYPE_MEMO_SHELL_SIDEBAR, EMemoShellSidebarClass)) -#define E_IS_MEMO_SHELL_SIDEBAR(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE \ - ((obj), E_TYPE_MEMO_SHELL_SIDEBAR)) -#define E_IS_MEMO_SHELL_SIDEBAR_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_TYPE \ - ((cls), E_TYPE_MEMO_SHELL_SIDEBAR)) -#define E_MEMO_SHELL_SIDEBAR_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS \ - ((obj), E_TYPE_MEMO_SHELL_SIDEBAR, EMemoShellSidebarClass)) - -G_BEGIN_DECLS - -typedef struct _EMemoShellSidebar EMemoShellSidebar; -typedef struct _EMemoShellSidebarClass EMemoShellSidebarClass; -typedef struct _EMemoShellSidebarPrivate EMemoShellSidebarPrivate; - -struct _EMemoShellSidebar { - EShellSidebar parent; - EMemoShellSidebarPrivate *priv; -}; - -struct _EMemoShellSidebarClass { - EShellSidebarClass parent_class; -}; - -GType e_memo_shell_sidebar_get_type (void); -GtkWidget * e_memo_shell_sidebar_new (EShellView *shell_view); -GtkWidget * e_memo_shell_sidebar_get_selector - (EMemoShellSidebar *memo_shell_sidebar); - -G_END_DECLS - -#endif /* E_MEMO_SHELL_SIDEBAR_H */ diff --git a/calendar/gui/e-memo-shell-view-actions.c b/calendar/gui/e-memo-shell-view-actions.c deleted file mode 100644 index 1835cd144f..0000000000 --- a/calendar/gui/e-memo-shell-view-actions.c +++ /dev/null @@ -1,347 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-memo-shell-view-actions.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 <e-util/gconf-bridge.h> - -#include "print.h" - -static void -action_memo_clipboard_copy_cb (GtkAction *action, - EMemoShellView *memo_shell_view) -{ - EMemos *memos; - EMemoTable *memo_table; - - memos = E_MEMOS (memo_shell_view->priv->memos); - memo_table = e_memos_get_calendar_table (memos); - e_memo_table_copy_clipboard (memo_table); -} - -static void -action_memo_clipboard_cut_cb (GtkAction *action, - EMemoShellView *memo_shell_view) -{ - EMemos *memos; - EMemoTable *memo_table; - - memos = E_MEMOS (memo_shell_view->priv->memos); - memo_table = e_memos_get_calendar_table (memos); - e_memo_table_cut_clipboard (memo_table); -} - -static void -action_memo_clipboard_paste_cb (GtkAction *action, - EMemoShellView *memo_shell_view) -{ - EMemos *memos; - EMemoTable *memo_table; - - memos = E_MEMOS (memo_shell_view->priv->memos); - memo_table = e_memos_get_calendar_table (memos); - e_memo_table_paste_clipboard (memo_table); -} - -static void -action_memo_delete_cb (GtkAction *action, - EMemoShellView *memo_shell_view) -{ - EMemos *memos; - - memos = E_MEMOS (memo_shell_view->priv->memos); - e_memos_delete_selected (memos); -} - -static void -action_memo_list_copy_cb (GtkAction *action, - EMemoShellView *memo_shell_view) -{ - /* FIXME */ -} - -static void -action_memo_list_delete_cb (GtkAction *action, - EMemoShellView *memo_shell_view) -{ - /* FIXME */ -} - -static void -action_memo_list_new_cb (GtkAction *action, - EMemoShellView *memo_shell_view) -{ - EShellView *shell_view; - EShellWindow *shell_window; - - shell_view = E_SHELL_VIEW (memo_shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - calendar_setup_new_memo_list (GTK_WINDOW (shell_window)); -} - -static void -action_memo_list_properties_cb (GtkAction *action, - EMemoShellView *memo_shell_view) -{ - EShellView *shell_view; - EShellWindow *shell_window; - ESource *source; - ESourceSelector *selector; - - 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); - source = e_source_selector_peek_primary_selection (selector); - g_return_if_fail (source != NULL); - - calendar_setup_edit_memo_list (GTK_WINDOW (shell_window), source); -} - -static void -action_memo_open_cb (GtkAction *action, - EMemoShellView *memo_shell_view) -{ - EMemos *memos; - - memos = E_MEMOS (memo_shell_view->priv->memos); - e_memos_open_memo (memos); -} - -static void -action_memo_preview_cb (GtkToggleAction *action, - EMemoShellView *memo_shell_view) -{ - /* FIXME */ -} - -static void -action_memo_print_cb (GtkAction *action, - EMemoShellView *memo_shell_view) -{ - EMemos *memos; - ETable *table; - EMemoTable *memo_table; - - memos = E_MEMOS (memo_shell_view->priv->memos); - memo_table = e_memos_get_calendar_table (memos); - table = e_memo_table_get_table (memo_table); - - print_table ( - table, _("Print Memos"), _("Memos"), - GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG); -} - -static void -action_memo_print_preview_cb (GtkAction *action, - EMemoShellView *memo_shell_view) -{ - EMemos *memos; - ETable *table; - EMemoTable *memo_table; - - memos = E_MEMOS (memo_shell_view->priv->memos); - memo_table = e_memos_get_calendar_table (memos); - table = e_memo_table_get_table (memo_table); - - print_table ( - table, _("Print Memos"), _("Memos"), - GTK_PRINT_OPERATION_ACTION_PREVIEW); -} - -static GtkActionEntry memo_entries[] = { - - { "memo-clipboard-copy", - GTK_STOCK_COPY, - NULL, - NULL, - N_("Copy selected memo"), - G_CALLBACK (action_memo_clipboard_copy_cb) }, - - { "memo-clipboard-cut", - GTK_STOCK_CUT, - NULL, - NULL, - N_("Cut selected memo"), - G_CALLBACK (action_memo_clipboard_cut_cb) }, - - { "memo-clipboard-paste", - GTK_STOCK_PASTE, - NULL, - NULL, - N_("Paste memo from the clipboard"), - G_CALLBACK (action_memo_clipboard_paste_cb) }, - - { "memo-delete", - GTK_STOCK_DELETE, - NULL, - NULL, - N_("Delete selected memos"), - G_CALLBACK (action_memo_delete_cb) }, - - { "memo-list-copy", - GTK_STOCK_COPY, - N_("_Copy..."), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_memo_list_copy_cb) }, - - { "memo-list-delete", - GTK_STOCK_DELETE, - N_("_Delete"), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_memo_list_delete_cb) }, - - { "memo-list-new", - "stock_notes", - N_("_New Memo List"), - NULL, - N_("Create a new memo list"), - G_CALLBACK (action_memo_list_new_cb) }, - - { "memo-list-properties", - GTK_STOCK_PROPERTIES, - NULL, - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_memo_list_properties_cb) }, - - { "memo-open", - NULL, - N_("Open Memo"), - "<Control>o", - N_("View the selected memo"), - G_CALLBACK (action_memo_open_cb) }, - - { "memo-print", - GTK_STOCK_PRINT, - NULL, - NULL, - N_("Print the list of memos"), - G_CALLBACK (action_memo_print_cb) }, - - { "memo-print-preview", - GTK_STOCK_PRINT_PREVIEW, - NULL, - NULL, - N_("Preview the list of memos to be printed"), - G_CALLBACK (action_memo_print_preview_cb) }, -}; - -static GtkToggleActionEntry memo_toggle_entries[] = { - - { "memo-preview", - NULL, - N_("Memo _Preview"), - "<Control>m", - N_("Show memo preview pane"), - G_CALLBACK (action_memo_preview_cb), - TRUE } -}; - -void -e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view) -{ - EShellView *shell_view; - EShellWindow *shell_window; - GtkActionGroup *action_group; - GtkUIManager *manager; - GConfBridge *bridge; - GObject *object; - const gchar *domain; - const gchar *key; - - shell_view = E_SHELL_VIEW (memo_shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - manager = e_shell_window_get_ui_manager (shell_window); - domain = GETTEXT_PACKAGE; - - e_load_ui_definition (manager, "evolution-memos.ui"); - - action_group = memo_shell_view->priv->memo_actions; - gtk_action_group_set_translation_domain (action_group, domain); - gtk_action_group_add_actions ( - action_group, memo_entries, - G_N_ELEMENTS (memo_entries), memo_shell_view); - gtk_action_group_add_toggle_actions ( - action_group, memo_toggle_entries, - G_N_ELEMENTS (memo_toggle_entries), memo_shell_view); - gtk_ui_manager_insert_action_group (manager, action_group, 0); - - /* Bind GObject properties to GConf keys. */ - - bridge = gconf_bridge_get (); - - object = G_OBJECT (ACTION (MEMO_PREVIEW)); - key = "/apps/evolution/calendar/display/show_memo_preview"; - gconf_bridge_bind_property (bridge, key, object, "active"); -} - -void -e_memo_shell_view_actions_update (EMemoShellView *memo_shell_view) -{ - ECal *cal; - EMemos *memos; - ETable *table; - ECalModel *model; - EMemoTable *memo_table; - EShellView *shell_view; - EShellWindow *shell_window; - GtkAction *action; - gboolean read_only = TRUE; - gboolean sensitive; - gint n_selected; - - 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); - - model = e_memo_table_get_model (memo_table); - cal = 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); - - action = ACTION (MEMO_OPEN); - sensitive = (n_selected == 1); - gtk_action_set_sensitive (action, sensitive); - - action = ACTION (MEMO_CLIPBOARD_COPY); - sensitive = (n_selected > 0); - gtk_action_set_sensitive (action, sensitive); - - action = ACTION (MEMO_CLIPBOARD_CUT); - sensitive = (n_selected > 0); - gtk_action_set_sensitive (action, sensitive); - - action = ACTION (MEMO_CLIPBOARD_PASTE); - sensitive = !read_only; - gtk_action_set_sensitive (action, sensitive); - - action = ACTION (MEMO_DELETE); - sensitive = (n_selected > 0) && !read_only; - gtk_action_set_sensitive (action, sensitive); -} diff --git a/calendar/gui/e-memo-shell-view-actions.h b/calendar/gui/e-memo-shell-view-actions.h deleted file mode 100644 index 4ac71c2083..0000000000 --- a/calendar/gui/e-memo-shell-view-actions.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-memo-shell-view-actions.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_VIEW_ACTIONS_H -#define E_MEMO_SHELL_VIEW_ACTIONS_H - -#include <shell/e-shell-window-actions.h> - -/* Memo Actions */ -#define E_SHELL_WINDOW_ACTION_MEMO_CLIPBOARD_COPY(window) \ - E_SHELL_WINDOW_ACTION ((window), "memo-clipboard-copy") -#define E_SHELL_WINDOW_ACTION_MEMO_CLIPBOARD_CUT(window) \ - E_SHELL_WINDOW_ACTION ((window), "memo-clipboard-cut") -#define E_SHELL_WINDOW_ACTION_MEMO_CLIPBOARD_PASTE(window) \ - E_SHELL_WINDOW_ACTION ((window), "memo-clipboard-paste") -#define E_SHELL_WINDOW_ACTION_MEMO_DELETE(window) \ - E_SHELL_WINDOW_ACTION ((window), "memo-delete") -#define E_SHELL_WINDOW_ACTION_MEMO_OPEN(window) \ - E_SHELL_WINDOW_ACTION ((window), "memo-open") -#define E_SHELL_WINDOW_ACTION_MEMO_PREVIEW(window) \ - E_SHELL_WINDOW_ACTION ((window), "memo-preview") -#define E_SHELL_WINDOW_ACTION_MEMO_PRINT(window) \ - E_SHELL_WINDOW_ACTION ((window), "memo-print") -#define E_SHELL_WINDOW_ACTION_MEMO_PRINT_PREVIEW(window) \ - E_SHELL_WINDOW_ACTION ((window), "memo-print-preview") - -/* Action Groups */ -#define E_SHELL_WINDOW_ACTION_GROUP_MEMOS(window) \ - E_SHELL_WINDOW_ACTION_GROUP ((window), "memos") - -#endif /* E_MEMO_SHELL_VIEW_ACTIONS_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-shell-view-private.h b/calendar/gui/e-memo-shell-view-private.h deleted file mode 100644 index c53e55c487..0000000000 --- a/calendar/gui/e-memo-shell-view-private.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-memo-shell-view-private.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_VIEW_PRIVATE_H -#define E_MEMO_SHELL_VIEW_PRIVATE_H - -#include "e-memo-shell-view.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-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> - -#define E_MEMO_SHELL_VIEW_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_MEMO_SHELL_VIEW, EMemoShellViewPrivate)) - -/* Shorthand, requires a variable named "shell_window". */ -#define ACTION(name) \ - (E_SHELL_WINDOW_ACTION_##name (shell_window)) -#define ACTION_GROUP(name) \ - (E_SHELL_WINDOW_ACTION_GROUP_##name (shell_window)) - -/* For use in dispose() methods. */ -#define DISPOSE(obj) \ - G_STMT_START { \ - if ((obj) != NULL) { g_object_unref (obj); (obj) = NULL; } \ - } G_STMT_END - -G_BEGIN_DECLS - -struct _EMemoShellViewPrivate { - - /*** Module Data ***/ - - ESourceList *source_list; - - /*** UI Management ***/ - - GtkActionGroup *memo_actions; - - /*** Other Stuff ***/ - - GtkWidget *memos; - - EActivityHandler *activity_handler; -}; - -void e_memo_shell_view_private_init - (EMemoShellView *memo_shell_view, - EShellViewClass *shell_view_class); -void e_memo_shell_view_private_constructed - (EMemoShellView *memo_shell_view); -void e_memo_shell_view_private_dispose - (EMemoShellView *memo_shell_view); -void e_memo_shell_view_private_finalize - (EMemoShellView *memo_shell_view); - -/* Private Utilities */ - -void e_memo_shell_view_actions_init - (EMemoShellView *memo_shell_view); -void e_memo_shell_view_actions_update - (EMemoShellView *memo_shell_view); - -G_END_DECLS - -#endif /* E_MEMO_SHELL_VIEW_PRIVATE_H */ diff --git a/calendar/gui/e-memo-shell-view.c b/calendar/gui/e-memo-shell-view.c deleted file mode 100644 index 2f083ea23e..0000000000 --- a/calendar/gui/e-memo-shell-view.c +++ /dev/null @@ -1,165 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-memo-shell-view.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" - -enum { - PROP_0, - PROP_SOURCE_LIST -}; - -GType e_memo_shell_view_type = 0; -static gpointer parent_class; - -static void -memo_shell_view_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - switch (property_id) { - case PROP_SOURCE_LIST: - g_value_set_object ( - value, e_memo_shell_view_get_source_list ( - E_MEMO_SHELL_VIEW (object))); - return; - } - - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); -} - -static void -memo_shell_view_dispose (GObject *object) -{ - e_memo_shell_view_private_dispose (E_MEMO_SHELL_VIEW (object)); - - /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -memo_shell_view_finalize (GObject *object) -{ - e_memo_shell_view_private_finalize (E_MEMO_SHELL_VIEW (object)); - - /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -memo_shell_view_constructed (GObject *object) -{ - /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); - - e_memo_shell_view_private_constructed (E_MEMO_SHELL_VIEW (object)); -} - -static void -memo_shell_view_changed (EShellView *shell_view) -{ - EMemoShellViewPrivate *priv; - GtkActionGroup *action_group; - gboolean visible; - - priv = E_MEMO_SHELL_VIEW_GET_PRIVATE (shell_view); - - action_group = priv->memo_actions; - visible = e_shell_view_is_selected (shell_view); - gtk_action_group_set_visible (action_group, visible); -} - -static void -memo_shell_view_class_init (EMemoShellView *class, - GTypeModule *type_module) -{ - GObjectClass *object_class; - EShellViewClass *shell_view_class; - - parent_class = g_type_class_peek_parent (class); - g_type_class_add_private (class, sizeof (EMemoShellViewPrivate)); - - object_class = G_OBJECT_CLASS (class); - object_class->get_property = memo_shell_view_get_property; - object_class->dispose = memo_shell_view_dispose; - object_class->finalize = memo_shell_view_finalize; - object_class->constructed = memo_shell_view_constructed; - - shell_view_class = E_SHELL_VIEW_CLASS (class); - shell_view_class->label = N_("Memos"); - shell_view_class->icon_name = "evolution-memos"; - shell_view_class->type_module = type_module; - shell_view_class->changed = memo_shell_view_changed; - shell_view_class->new_shell_sidebar = e_memo_shell_sidebar_new; - - g_object_class_install_property ( - object_class, - PROP_SOURCE_LIST, - g_param_spec_object ( - "source-list", - _("Source List"), - _("The registry of memo lists"), - E_TYPE_SOURCE_LIST, - G_PARAM_READABLE)); -} - -static void -memo_shell_view_init (EMemoShellView *memo_shell_view, - EShellViewClass *shell_view_class) -{ - memo_shell_view->priv = - E_MEMO_SHELL_VIEW_GET_PRIVATE (memo_shell_view); - - e_memo_shell_view_private_init (memo_shell_view, shell_view_class); -} - -GType -e_memo_shell_view_get_type (GTypeModule *type_module) -{ - if (e_memo_shell_view_type == 0) { - const GTypeInfo type_info = { - sizeof (EMemoShellViewClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) memo_shell_view_class_init, - (GClassFinalizeFunc) NULL, - type_module, - sizeof (EMemoShellView), - 0, /* n_preallocs */ - (GInstanceInitFunc) memo_shell_view_init, - NULL /* value_table */ - }; - - e_memo_shell_view_type = - g_type_module_register_type ( - type_module, E_TYPE_SHELL_VIEW, - "EMemoShellView", &type_info, 0); - } - - return e_memo_shell_view_type; -} - -ESourceList * -e_memo_shell_view_get_source_list (EMemoShellView *memo_shell_view) -{ - g_return_val_if_fail (E_IS_MEMO_SHELL_VIEW (memo_shell_view), NULL); - - return memo_shell_view->priv->source_list; -} diff --git a/calendar/gui/e-memo-shell-view.h b/calendar/gui/e-memo-shell-view.h deleted file mode 100644 index c6faa8382c..0000000000 --- a/calendar/gui/e-memo-shell-view.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-memo-shell-view.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_VIEW_H -#define E_MEMO_SHELL_VIEW_H - -#include <e-shell-view.h> -#include <libedataserver/e-source-list.h> - -/* Standard GObject macros */ -#define E_TYPE_MEMO_SHELL_VIEW \ - (e_memo_shell_view_type) -#define E_MEMO_SHELL_VIEW(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST \ - ((obj), E_TYPE_MEMO_SHELL_VIEW, EMemoShellView)) -#define E_MEMO_SHELL_VIEW_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_CAST \ - ((cls), E_TYPE_MEMO_SHELL_VIEW, EMemoShellViewClass)) -#define E_IS_MEMO_SHELL_VIEW(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE \ - ((obj), E_TYPE_MEMO_SHELL_VIEW)) -#define E_IS_MEMO_SHELL_VIEW_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_TYPE \ - ((cls), E_TYPE_MEMO_SHELL_VIEW)) -#define E_MEMO_SHELL_VIEW_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS \ - ((obj), E_TYPE_MEMO_SHELL_VIEW, EMemoShellViewClass)) - -G_BEGIN_DECLS - -extern GType e_memo_shell_view_type; - -typedef struct _EMemoShellView EMemoShellView; -typedef struct _EMemoShellViewClass EMemoShellViewClass; -typedef struct _EMemoShellViewPrivate EMemoShellViewPrivate; - -struct _EMemoShellView { - EShellView parent; - EMemoShellViewPrivate *priv; -}; - -struct _EMemoShellViewClass { - EShellViewClass parent_class; -}; - -GType e_memo_shell_view_get_type - (GTypeModule *type_module); -ESourceList * e_memo_shell_view_get_source_list - (EMemoShellView *memo_shell_view); - -G_END_DECLS - -#endif /* E_MEMO_SHELL_VIEW_H */ 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-module.c b/calendar/gui/e-task-shell-module.c deleted file mode 100644 index 7dee36a9cc..0000000000 --- a/calendar/gui/e-task-shell-module.c +++ /dev/null @@ -1,296 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-task-shell-module.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 <string.h> -#include <glib/gi18n.h> -#include <libecal/e-cal.h> -#include <libedataserver/e-source.h> -#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 <calendar-config.h> -#include <e-task-shell-view.h> - -#define MODULE_NAME "tasks" -#define MODULE_ALIASES "" -#define MODULE_SCHEMES "task" -#define MODULE_SEARCHES "tasktypes.xml" -#define MODULE_SORT_ORDER 600 - -#define WEB_BASE_URI "webcal://" -#define PERSONAL_RELATIVE_URI "system" - -/* Module Entry Point */ -void e_shell_module_init (GTypeModule *type_module); - -static void -task_module_ensure_sources (EShellModule *shell_module) -{ - /* XXX This is basically the same algorithm across all modules. - * Maybe we could somehow integrate this into EShellModule? */ - - ESourceList *source_list; - ESourceGroup *on_this_computer; - ESourceGroup *on_the_web; - ESource *personal; - GSList *groups, *iter; - const gchar *data_dir; - gchar *base_uri; - gchar *filename; - - on_this_computer = NULL; - on_the_web = NULL; - personal = NULL; - - if (!e_cal_get_sources (&source_list, E_CAL_SOURCE_TYPE_TODO, NULL)) { - g_warning ("Could not get task sources from GConf!"); - return; - } - - /* Share the source list with all task views. This is - * accessible via e_task_shell_view_get_source_list(). - * Note: EShellModule takes ownership of the reference. - * - * XXX I haven't yet decided if I want to add a proper - * EShellModule API for this. The mail module would - * not use it. */ - g_object_set_data_full ( - G_OBJECT (shell_module), "source-list", - source_list, (GDestroyNotify) g_object_unref); - - data_dir = e_shell_module_get_data_dir (shell_module); - filename = g_build_filename (data_dir, "local", NULL); - base_uri = g_filename_to_uri (filename, NULL, NULL); - g_free (filename); - - groups = e_source_list_peek_groups (source_list); - for (iter = groups; iter != NULL; iter = iter->next) { - ESourceGroup *source_group = iter->data; - const gchar *group_base_uri; - - group_base_uri = e_source_group_peek_base_uri (source_group); - - /* Compare only "file://" part. If the user's home - * changes, we do not want to create another group. */ - if (on_this_computer == NULL && - strncmp (base_uri, group_base_uri, 7) == 0) - on_this_computer = source_group; - - else if (on_the_web == NULL && - strcmp (WEB_BASE_URI, group_base_uri) == 0) - on_the_web = source_group; - } - - if (on_this_computer != NULL) { - GSList *sources; - const gchar *group_base_uri; - - sources = e_source_group_peek_sources (on_this_computer); - group_base_uri = e_source_group_peek_base_uri (on_this_computer); - - /* Make sure this group includes a "Personal" source. */ - for (iter = sources; iter != NULL; iter = iter->next) { - ESource *source = iter->data; - const gchar *relative_uri; - - relative_uri = e_source_peek_relative_uri (source); - if (relative_uri == NULL) - continue; - - if (strcmp (PERSONAL_RELATIVE_URI, relative_uri) != 0) - continue; - - personal = source; - break; - } - - /* Make sure we have the correct base URI. This can - * change when the user's home directory changes. */ - if (strcmp (base_uri, group_base_uri) != 0) { - e_source_group_set_base_uri ( - on_this_computer, base_uri); - - /* XXX We shouldn't need this sync call here as - * set_base_uri() results in synching to GConf, - * but that happens in an idle loop and too late - * to prevent the user from seeing a "Cannot - * Open ... because of invalid URI" error. */ - e_source_list_sync (source_list, NULL); - } - - } else { - ESourceGroup *source_group; - const gchar *name; - - name = _("On This Computer"); - source_group = e_source_group_new (name, base_uri); - e_source_list_add_group (source_list, source_group, -1); - g_object_unref (source_group); - } - - if (personal == NULL) { - ESource *source; - GSList *selected; - const gchar *name; - gchar *primary; - - name = _("Personal"); - source = e_source_new (name, PERSONAL_RELATIVE_URI); - e_source_group_add_source (on_this_computer, source, -1); - g_object_unref (source); - - primary = calendar_config_get_primary_tasks (); - selected = calendar_config_get_tasks_selected (); - - if (primary == NULL && selected == NULL) { - const gchar *uid; - - uid = e_source_peek_uid (source); - selected = g_slist_prepend (NULL, g_strdup (uid)); - - calendar_config_set_primary_tasks (uid); - calendar_config_set_tasks_selected (selected); - } - - g_slist_foreach (selected, (GFunc) g_free, NULL); - g_slist_free (selected); - g_free (primary); - } - - if (on_the_web == NULL) { - ESourceGroup *source_group; - const gchar *name; - - name = _("On The Web"); - source_group = e_source_group_new (name, WEB_BASE_URI); - e_source_list_add_group (source_list, source_group, -1); - g_object_unref (source_group); - } - - g_free (base_uri); -} - -static void -action_task_new_cb (GtkAction *action, - EShellWindow *shell_window) -{ -} - -static void -action_task_assigned_new_cb (GtkAction *action, - EShellWindow *shell_window) -{ -} - -static void -action_task_list_new_cb (GtkAction *action, - EShellWindow *shell_window) -{ -} - -static GtkActionEntry item_entries[] = { - - { "task-new", - "stock_task", - N_("_Task"), /* XXX Need C_() here */ - "<Control>t", - N_("Create a new task"), - G_CALLBACK (action_task_new_cb) }, - - { "task-assigned-new", - "stock_task", - N_("Assigne_d Task"), - NULL, - N_("Create a new assigned task"), - G_CALLBACK (action_task_assigned_new_cb) } -}; - -static GtkActionEntry source_entries[] = { - - { "task-list-new", - "stock_todo", - N_("Tas_k List"), - NULL, - N_("Create a new task list"), - G_CALLBACK (action_task_list_new_cb) } -}; - -static gboolean -task_module_handle_uri (EShellModule *shell_module, - const gchar *uri) -{ - /* FIXME */ - return FALSE; -} - -static void -task_module_window_created (EShellModule *shell_module, - EShellWindow *shell_window) -{ - const gchar *module_name; - - module_name = G_TYPE_MODULE (shell_module)->name; - - e_shell_window_register_new_item_actions ( - shell_window, module_name, - item_entries, G_N_ELEMENTS (item_entries)); - - e_shell_window_register_new_source_actions ( - shell_window, module_name, - source_entries, G_N_ELEMENTS (source_entries)); -} - -static EShellModuleInfo module_info = { - - MODULE_NAME, - MODULE_ALIASES, - MODULE_SCHEMES, - MODULE_SEARCHES, - MODULE_SORT_ORDER -}; - -void -e_shell_module_init (GTypeModule *type_module) -{ - EShell *shell; - EShellModule *shell_module; - - shell_module = E_SHELL_MODULE (type_module); - shell = e_shell_module_get_shell (shell_module); - - /* Register the GType for ETaskShellView. */ - e_task_shell_view_get_type (type_module); - - e_shell_module_set_info (shell_module, &module_info); - - task_module_ensure_sources (shell_module); - - g_signal_connect_swapped ( - shell, "handle-uri", - G_CALLBACK (task_module_handle_uri), shell_module); - - g_signal_connect_swapped ( - shell, "window-created", - G_CALLBACK (task_module_window_created), shell_module); -} diff --git a/calendar/gui/e-task-shell-sidebar.c b/calendar/gui/e-task-shell-sidebar.c deleted file mode 100644 index 0b0668df86..0000000000 --- a/calendar/gui/e-task-shell-sidebar.c +++ /dev/null @@ -1,264 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-task-shell-sidebar.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-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> - -#define E_TASK_SHELL_SIDEBAR_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_TASK_SHELL_SIDEBAR, ETaskShellSidebarPrivate)) - -struct _ETaskShellSidebarPrivate { - GtkWidget *selector; -}; - -enum { - PROP_0, - PROP_SELECTOR -}; - -static gpointer parent_class; - -static void -task_shell_sidebar_update (EShellSidebar *shell_sidebar) -{ - EShellView *shell_view; - ETasks *tasks; - ETable *table; - ECalModel *model; - ECalendarTable *cal_table; - GString *string; - const gchar *format; - gint n_rows; - gint n_selected; - - shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - tasks = e_task_shell_view_get_tasks (E_TASK_SHELL_VIEW (shell_view)); - cal_table = e_tasks_get_calendar_table (tasks); - model = e_calendar_table_get_model (cal_table); - table = e_calendar_table_get_table (cal_table); - - n_rows = e_table_model_get_row_count (model); - n_selected = e_table_selected_count (table); - - string = g_string_sized_new (64); - - format = ngettext ("%d task", "%d tasks", n_rows); - g_string_append_printf (string, format, n_rows); - - if (n_selected > 0) { - format = _("%d selected"); - g_string_append_len (string, ", ", 2); - g_string_append_printf (string, format, n_selected); - } - - e_shell_sidebar_set_secondary_text (shell_sidebar, string->str); - - g_string_free (string, TRUE); -} - -static void -task_shell_sidebar_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - switch (property_id) { - case PROP_SELECTOR: - g_value_set_object ( - value, e_task_shell_sidebar_get_selector ( - E_TASK_SHELL_SIDEBAR (object))); - return; - } - - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); -} - -static void -task_shell_sidebar_dispose (GObject *object) -{ - ETaskShellSidebarPrivate *priv; - - priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (object); - - if (priv->selector != NULL) { - g_object_unref (priv->selector); - priv->selector = NULL; - } - - /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -task_shell_sidebar_constructed (GObject *object) -{ - ETaskShellSidebarPrivate *priv; - EShellView *shell_view; - EShellSidebar *shell_sidebar; - ETaskShellView *task_shell_view; - ESourceList *source_list; - GtkContainer *container; - GtkWidget *widget; - ETasks *tasks; - ETable *table; - ECalModel *model; - ECalendarTable *cal_table; - - priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (object); - - shell_sidebar = E_SHELL_SIDEBAR (object); - shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - task_shell_view = E_TASK_SHELL_VIEW (shell_view); - source_list = e_task_shell_view_get_source_list (task_shell_view); - - container = GTK_CONTAINER (shell_sidebar); - - 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_container_add (container, widget); - gtk_widget_show (widget); - - container = GTK_CONTAINER (widget); - - widget = e_calendar_selector_new (source_list); - e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE); - gtk_container_add (container, widget); - priv->selector = g_object_ref (widget); - gtk_widget_show (widget); - - /* Setup signal handlers. */ - - tasks = e_task_shell_view_get_tasks (task_shell_view); - cal_table = e_tasks_get_calendar_table (tasks); - model = e_calendar_table_get_model (cal_table); - table = e_calendar_table_get_table (cal_table); - - g_signal_connect_swapped ( - model, "model-changed", - G_CALLBACK (task_shell_sidebar_update), - shell_sidebar); - - g_signal_connect_swapped ( - model, "model-rows-deleted", - G_CALLBACK (task_shell_sidebar_update), - shell_sidebar); - - g_signal_connect_swapped ( - model, "model-rows-inserted", - G_CALLBACK (task_shell_sidebar_update), - shell_sidebar); - - g_signal_connect_swapped ( - model, "selection-change", - G_CALLBACK (task_shell_sidebar_update), - shell_sidebar); - - task_shell_sidebar_update (shell_sidebar); -} - -static void -task_shell_sidebar_class_init (ETaskShellSidebarClass *class) -{ - GObjectClass *object_class; - - parent_class = g_type_class_peek_parent (class); - g_type_class_add_private (class, sizeof (ETaskShellSidebarPrivate)); - - object_class = G_OBJECT_CLASS (class); - object_class->get_property = task_shell_sidebar_get_property; - object_class->dispose = task_shell_sidebar_dispose; - object_class->constructed = task_shell_sidebar_constructed; - - g_object_class_install_property ( - object_class, - PROP_SELECTOR, - g_param_spec_object ( - "selector", - _("Source Selector Widget"), - _("This widget displays groups of task lists"), - E_TYPE_SOURCE_SELECTOR, - G_PARAM_READABLE)); -} - -static void -task_shell_sidebar_init (ETaskShellSidebar *task_shell_sidebar) -{ - task_shell_sidebar->priv = - E_TASK_SHELL_SIDEBAR_GET_PRIVATE (task_shell_sidebar); - - /* Postpone widget construction until we have a shell view. */ -} - -GType -e_task_shell_sidebar_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ETaskShellSidebarClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) task_shell_sidebar_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ETaskShellSidebar), - 0, /* n_preallocs */ - (GInstanceInitFunc) task_shell_sidebar_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_SHELL_SIDEBAR, "ETaskShellSidebar", - &type_info, 0); - } - - return type; -} - -GtkWidget * -e_task_shell_sidebar_new (EShellView *shell_view) -{ - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); - - return g_object_new ( - E_TYPE_TASK_SHELL_SIDEBAR, - "shell-view", shell_view, NULL); -} - -GtkWidget * -e_task_shell_sidebar_get_selector (ETaskShellSidebar *task_shell_sidebar) -{ - g_return_val_if_fail ( - E_IS_TASK_SHELL_SIDEBAR (task_shell_sidebar), NULL); - - return task_shell_sidebar->priv->selector; -} diff --git a/calendar/gui/e-task-shell-sidebar.h b/calendar/gui/e-task-shell-sidebar.h deleted file mode 100644 index c50fde5d3c..0000000000 --- a/calendar/gui/e-task-shell-sidebar.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-task-shell-sidebar.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_SIDEBAR_H -#define E_TASK_SHELL_SIDEBAR_H - -#include <e-shell-sidebar.h> -#include <e-shell-view.h> - -/* Standard GObject macros */ -#define E_TYPE_TASK_SHELL_SIDEBAR \ - (e_task_shell_sidebar_get_type ()) -#define E_TASK_SHELL_SIDEBAR(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST \ - ((obj), E_TYPE_TASK_SHELL_SIDEBAR, ETaskShellSidebar)) -#define E_TASK_SHELL_SIDEBAR_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_CAST \ - ((cls), E_TYPE_TASK_SHELL_SIDEBAR, ETaskShellSidebarClass)) -#define E_IS_TASK_SHELL_SIDEBAR(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE \ - ((obj), E_TYPE_TASK_SHELL_SIDEBAR)) -#define E_IS_TASK_SHELL_SIDEBAR_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_TYPE \ - ((cls), E_TYPE_TASK_SHELL_SIDEBAR)) -#define E_TASK_SHELL_SIDEBAR_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS \ - ((obj), E_TYPE_TASK_SHELL_SIDEBAR, ETaskShellSidebarClass)) - -G_BEGIN_DECLS - -typedef struct _ETaskShellSidebar ETaskShellSidebar; -typedef struct _ETaskShellSidebarClass ETaskShellSidebarClass; -typedef struct _ETaskShellSidebarPrivate ETaskShellSidebarPrivate; - -struct _ETaskShellSidebar { - EShellSidebar parent; - ETaskShellSidebarPrivate *priv; -}; - -struct _ETaskShellSidebarClass { - EShellSidebarClass parent_class; -}; - -GType e_task_shell_sidebar_get_type (void); -GtkWidget * e_task_shell_sidebar_new (EShellView *shell_view); -GtkWidget * e_task_shell_sidebar_get_selector - (ETaskShellSidebar *task_shell_sidebar); - -G_END_DECLS - -#endif /* E_TASK_SHELL_SIDEBAR_H */ diff --git a/calendar/gui/e-task-shell-view-actions.c b/calendar/gui/e-task-shell-view-actions.c deleted file mode 100644 index ccdf86cdd1..0000000000 --- a/calendar/gui/e-task-shell-view-actions.c +++ /dev/null @@ -1,263 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-task-shell-view-actions.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" - -static void -action_task_assign_cb (GtkAction *action, - ETaskShellView *task_shell_view) -{ -} - -static void -action_task_clipboard_copy_cb (GtkAction *action, - ETaskShellView *task_shell_view) -{ -} - -static void -action_task_clipboard_cut_cb (GtkAction *action, - ETaskShellView *task_shell_view) -{ -} - -static void -action_task_clipboard_paste_cb (GtkAction *action, - ETaskShellView *task_shell_view) -{ -} - -static void -action_task_delete_cb (GtkAction *action, - ETaskShellView *task_shell_view) -{ -} - -static void -action_task_forward_cb (GtkAction *action, - ETaskShellView *task_shell_view) -{ -} - -static void -action_task_list_copy_cb (GtkAction *action, - ETaskShellView *task_shell_view) -{ -} - -static void -action_task_list_delete_cb (GtkAction *action, - ETaskShellView *task_shell_view) -{ -} - -static void -action_task_list_new_cb (GtkAction *action, - ETaskShellView *task_shell_view) -{ -} - -static void -action_task_list_properties_cb (GtkAction *action, - ETaskShellView *task_shell_view) -{ -} - -static void -action_task_mark_complete_cb (GtkAction *action, - ETaskShellView *task_shell_view) -{ -} - -static void -action_task_open_cb (GtkAction *action, - ETaskShellView *task_shell_view) -{ -} - -static void -action_task_preview_cb (GtkToggleAction *action, - ETaskShellView *task_shell_view) -{ -} - -static void -action_task_print_cb (GtkAction *action, - ETaskShellView *task_shell_view) -{ -} - -static void -action_task_print_preview_cb (GtkAction *action, - ETaskShellView *task_shell_view) -{ -} - -static void -action_task_purge_cb (GtkAction *action, - ETaskShellView *task_shell_view) -{ -} - -static GtkActionEntry task_entries[] = { - - { "task-assign", - NULL, - N_("_Assign Task"), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_task_assign_cb) }, - - { "task-clipboard-copy", - GTK_STOCK_COPY, - NULL, - NULL, - N_("Copy selected tasks"), - G_CALLBACK (action_task_clipboard_copy_cb) }, - - { "task-clipboard-cut", - GTK_STOCK_CUT, - NULL, - NULL, - N_("Cut selected tasks"), - G_CALLBACK (action_task_clipboard_cut_cb) }, - - { "task-clipboard-paste", - GTK_STOCK_PASTE, - NULL, - NULL, - N_("Paste tasks from the clipboard"), - G_CALLBACK (action_task_clipboard_paste_cb) }, - - { "task-delete", - GTK_STOCK_DELETE, - NULL, - NULL, - N_("Delete selected tasks"), - G_CALLBACK (action_task_delete_cb) }, - - { "task-forward", - "mail-forward", - N_("_Forward as iCalendar"), - "<Control>f", - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_task_forward_cb) }, - - { "task-list-copy", - GTK_STOCK_COPY, - N_("Copy..."), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_task_list_copy_cb) }, - - { "task-list-delete", - GTK_STOCK_DELETE, - N_("_Delete"), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_task_list_delete_cb) }, - - { "task-list-new", - "stock_todo", - N_("_New Task List"), - NULL, - N_("Create a new task list"), - G_CALLBACK (action_task_list_new_cb) }, - - { "task-list-properties", - GTK_STOCK_PROPERTIES, - NULL, - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_task_list_properties_cb) }, - - { "task-mark-complete", - NULL, - N_("Mar_k as Complete"), - "<Control>k", - N_("Mark selected tasks as complete"), - G_CALLBACK (action_task_mark_complete_cb) }, - - { "task-open", - NULL, - N_("_Open Task"), - "<Control>o", - N_("View the selected task"), - G_CALLBACK (action_task_open_cb) }, - - { "task-print", - GTK_STOCK_PRINT, - NULL, - NULL, - N_("Print the list of tasks"), - G_CALLBACK (action_task_print_cb) }, - - { "task-print-preview", - GTK_STOCK_PRINT_PREVIEW, - NULL, - NULL, - N_("Preview the list of tasks to be printed"), - G_CALLBACK (action_task_print_preview_cb) }, - - { "task-purge", - NULL, - N_("Purg_e"), - "<Control>e", - N_("Delete completed tasks"), - G_CALLBACK (action_task_purge_cb) } -}; - -static GtkToggleActionEntry task_toggle_entries[] = { - - { "task-preview", - NULL, - N_("Task _Preview"), - "<Control>m", - N_("Show task preview pane"), - G_CALLBACK (action_task_preview_cb), - TRUE } -}; - -void -e_task_shell_view_actions_init (ETaskShellView *task_shell_view) -{ - EShellView *shell_view; - EShellWindow *shell_window; - GtkActionGroup *action_group; - GtkUIManager *manager; - const gchar *domain; - - shell_view = E_SHELL_VIEW (task_shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - manager = e_shell_window_get_ui_manager (shell_window); - domain = GETTEXT_PACKAGE; - - e_load_ui_definition (manager, "evolution-tasks.ui"); - - action_group = task_shell_view->priv->task_actions; - gtk_action_group_set_translation_domain (action_group, domain); - gtk_action_group_add_actions ( - action_group, task_entries, - G_N_ELEMENTS (task_entries), task_shell_view); - gtk_action_group_add_toggle_actions ( - action_group, task_toggle_entries, - G_N_ELEMENTS (task_toggle_entries), task_shell_view); - gtk_ui_manager_insert_action_group (manager, action_group, 0); -} diff --git a/calendar/gui/e-task-shell-view-actions.h b/calendar/gui/e-task-shell-view-actions.h deleted file mode 100644 index 9c31590814..0000000000 --- a/calendar/gui/e-task-shell-view-actions.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-task-shell-view-actions.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_VIEW_ACTIONS_H -#define E_TASK_SHELL_VIEW_ACTIONS_H - -#include <shell/e-shell-window-actions.h> - -/* Task Actions */ -#define E_SHELL_WINDOW_ACTION_TASK_ASSIGN(window) \ - E_SHELL_WINDOW_ACTION ((window), "task-assign") -#define E_SHELL_WINDOW_ACTION_TASK_CLIPBOARD_COPY(window) \ - E_SHELL_WINDOW_ACTION ((window), "task-clipboard-copy") -#define E_SHELL_WINDOW_ACTION_TASK_CLIPBOARD_CUT(window) \ - E_SHELL_WINDOW_ACTION ((window), "task-clibpard-cut") -#define E_SHELL_WINDOW_ACTION_TASK_CLIPBOARD_PASTE(window) \ - E_SHELL_WINDOW_ACTION ((window), "task-clipboard-paste") -#define E_SHELL_WINDOW_ACTION_TASK_DELETE(window) \ - E_SHELL_WINDOW_ACTION ((window), "task-delete") -#define E_SHELL_WINDOW_ACTION_TASK_FORWARD(window) \ - E_SHELL_WINDOW_ACTION ((window), "task-forward") -#define E_SHELL_WINDOW_ACTION_TASK_MARK_COMPLETE(window) \ - E_SHELL_WINDOW_ACTION ((window), "task-mark-complete") -#define E_SHELL_WINDOW_ACTION_TASK_OPEN(window) \ - E_SHELL_WINDOW_ACTION ((window), "task-open") -#define E_SHELL_WINDOW_ACTION_TASK_PREVIEW(window) \ - E_SHELL_WINDOW_ACTION ((window), "task-preview") -#define E_SHELL_WINDOW_ACTION_TASK_PRINT(window) \ - E_SHELL_WINDOW_ACTION ((window), "task-print") -#define E_SHELL_WINDOW_ACTION_TASK_PRINT_PREVIEW(window) \ - E_SHELL_WINDOW_ACTION ((window), "task-print-preview") -#define E_SHELL_WINDOW_ACTION_TASK_PURGE(window) \ - E_SHELL_WINDOW_ACTION ((window), "task-purge") - -/* Action Groups */ -#define E_SHELL_WINDOW_ACTION_GROUP_TASKS(window) \ - E_SHELL_WINDOW_ACTION_GROUP ((window), "tasks") - -#endif /* E_TASK_SHELL_VIEW_ACTIONS_H */ 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-task-shell-view-private.h b/calendar/gui/e-task-shell-view-private.h deleted file mode 100644 index 0c7f90c3be..0000000000 --- a/calendar/gui/e-task-shell-view-private.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-task-shell-view-private.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_VIEW_PRIVATE_H -#define E_TASK_SHELL_VIEW_PRIVATE_H - -#include "e-task-shell-view.h" - -#include <glib/gi18n.h> - -#include <e-util/e-util.h> -#include <shell/e-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 \ - ((obj), E_TYPE_TASK_SHELL_VIEW, ETaskShellViewPrivate)) - -/* Shorthand, requires a variable named "shell_window". */ -#define ACTION(name) \ - (E_SHELL_WINDOW_ACTION_##name (shell_window)) -#define ACTION_GROUP(name) \ - (E_SHELL_WINDOW_ACTION_GROUP_##name (shell_window)) - -/* For use in dispose() methods. */ -#define DISPOSE(obj) \ - G_STMT_START { \ - if ((obj) != NULL) { g_object_unref (obj); (obj) = NULL; } \ - } G_STMT_END - -G_BEGIN_DECLS - -struct _ETaskShellViewPrivate { - - /*** Module Data ***/ - - ESourceList *source_list; - - /*** UI Management ***/ - - GtkActionGroup *task_actions; -}; - -void e_task_shell_view_private_init - (ETaskShellView *task_shell_view, - EShellViewClass *shell_view_class); -void e_task_shell_view_private_constructed - (ETaskShellView *task_shell_view); -void e_task_shell_view_private_dispose - (ETaskShellView *task_shell_view); -void e_task_shell_view_private_finalize - (ETaskShellView *task_shell_view); - -/* Private Utilities */ - -void e_task_shell_view_actions_init - (ETaskShellView *task_shell_view); - -G_END_DECLS - -#endif /* E_TASK_SHELL_VIEW_PRIVATE_H */ diff --git a/calendar/gui/e-task-shell-view.c b/calendar/gui/e-task-shell-view.c deleted file mode 100644 index 6be8b48a4c..0000000000 --- a/calendar/gui/e-task-shell-view.c +++ /dev/null @@ -1,165 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-task-shell-view.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" - -enum { - PROP_0, - PROP_SOURCE_LIST -}; - -GType e_task_shell_view_type = 0; -static gpointer parent_class; - -static void -task_shell_view_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - switch (property_id) { - case PROP_SOURCE_LIST: - g_value_set_object ( - value, e_task_shell_view_get_source_list ( - E_TASK_SHELL_VIEW (object))); - return; - } - - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); -} - -static void -task_shell_view_dispose (GObject *object) -{ - e_task_shell_view_private_dispose (E_TASK_SHELL_VIEW (object)); - - /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -task_shell_view_finalize (GObject *object) -{ - e_task_shell_view_private_finalize (E_TASK_SHELL_VIEW (object)); - - /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -task_shell_view_constructed (GObject *object) -{ - /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); - - e_task_shell_view_private_constructed (E_TASK_SHELL_VIEW (object)); -} - -static void -task_shell_view_changed (EShellView *shell_view) -{ - ETaskShellViewPrivate *priv; - GtkActionGroup *action_group; - gboolean visible; - - priv = E_TASK_SHELL_VIEW_GET_PRIVATE (shell_view); - - action_group = priv->task_actions; - visible = e_shell_view_is_selected (shell_view); - gtk_action_group_set_visible (action_group, visible); -} - -static void -task_shell_view_class_init (ETaskShellView *class, - GTypeModule *type_module) -{ - GObjectClass *object_class; - EShellViewClass *shell_view_class; - - parent_class = g_type_class_peek_parent (class); - g_type_class_add_private (class, sizeof (ETaskShellViewPrivate)); - - object_class = G_OBJECT_CLASS (class); - object_class->get_property = task_shell_view_get_property; - object_class->dispose = task_shell_view_dispose; - object_class->finalize = task_shell_view_finalize; - object_class->constructed = task_shell_view_constructed; - - shell_view_class = E_SHELL_VIEW_CLASS (class); - shell_view_class->label = N_("Tasks"); - shell_view_class->icon_name = "evolution-tasks"; - 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; - - g_object_class_install_property ( - object_class, - PROP_SOURCE_LIST, - g_param_spec_object ( - "source-list", - _("Source List"), - _("The registry of task lists"), - E_TYPE_SOURCE_LIST, - G_PARAM_READABLE)); -} - -static void -task_shell_view_init (ETaskShellView *task_shell_view, - EShellViewClass *shell_view_class) -{ - task_shell_view->priv = - E_TASK_SHELL_VIEW_GET_PRIVATE (task_shell_view); - - e_task_shell_view_private_init (task_shell_view, shell_view_class); -} - -GType -e_task_shell_view_get_type (GTypeModule *type_module) -{ - if (e_task_shell_view_type == 0) { - const GTypeInfo type_info = { - sizeof (ETaskShellViewClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) task_shell_view_class_init, - (GClassFinalizeFunc) NULL, - type_module, - sizeof (ETaskShellView), - 0, /* n_preallocs */ - (GInstanceInitFunc) task_shell_view_init, - NULL /* value_table */ - }; - - e_task_shell_view_type = - g_type_module_register_type ( - type_module, E_TYPE_SHELL_VIEW, - "ETaskShellView", &type_info, 0); - } - - return e_task_shell_view_type; -} - -ESourceList * -e_task_shell_view_get_source_list (ETaskShellView *task_shell_view) -{ - g_return_val_if_fail (E_IS_TASK_SHELL_VIEW (task_shell_view), NULL); - - return task_shell_view->priv->source_list; -} diff --git a/calendar/gui/e-task-shell-view.h b/calendar/gui/e-task-shell-view.h deleted file mode 100644 index 785a3585b1..0000000000 --- a/calendar/gui/e-task-shell-view.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-task-shell-view.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_VIEW_H -#define E_TASK_SHELL_VIEW_H - -#include <e-shell-view.h> -#include <libedataserver/e-source-list.h> - -/* Standard GObject macros */ -#define E_TYPE_TASK_SHELL_VIEW \ - (e_task_shell_view_type) -#define E_TASK_SHELL_VIEW(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST \ - ((obj), E_TYPE_TASK_SHELL_VIEW, ETaskShellView)) -#define E_TASK_SHELL_VIEW_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_CAST \ - ((cls), E_TYPE_TASK_SHELL_VIEW, ETaskShellViewClass)) -#define E_IS_TASK_SHELL_VIEW(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE \ - ((obj), E_TYPE_TASK_SHELL_VIEW)) -#define E_IS_TASK_SHELL_VIEW_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_TYPE \ - ((cls), E_TYPE_TASK_SHELL_VIEW)) -#define E_TASK_SHELL_VIEW_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS \ - ((obj), E_TYPE_TASK_SHELL_VIEW, ETaskShellViewClass)) - -G_BEGIN_DECLS - -extern GType e_task_shell_view_type; - -typedef struct _ETaskShellView ETaskShellView; -typedef struct _ETaskShellViewClass ETaskShellViewClass; -typedef struct _ETaskShellViewPrivate ETaskShellViewPrivate; - -struct _ETaskShellView { - EShellView parent; - ETaskShellViewPrivate *priv; -}; - -struct _ETaskShellViewClass { - EShellViewClass parent_class; -}; - -GType e_task_shell_view_get_type - (GTypeModule *type_module); -ESourceList * e_task_shell_view_get_source_list - (ETaskShellView *task_shell_view); - -G_END_DECLS - -#endif /* E_TASK_SHELL_VIEW_H */ 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'); -} |