diff options
Diffstat (limited to 'calendar')
27 files changed, 505 insertions, 273 deletions
diff --git a/calendar/gui/e-cal-event.c b/calendar/gui/e-cal-event.c index ecd1ea5b7e..3bccd137f7 100644 --- a/calendar/gui/e-cal-event.c +++ b/calendar/gui/e-cal-event.c @@ -45,8 +45,8 @@ ece_target_free (EEvent *ev, EEventTarget *t) switch (t->type) { case E_CAL_EVENT_TARGET_MODULE: { ECalEventTargetModule *s = (ECalEventTargetModule *) t; - if (s->shell_module) - g_object_unref (s->shell_module); + if (s->shell_backend) + g_object_unref (s->shell_backend); break; } } @@ -93,11 +93,11 @@ e_cal_event_peek (void) } ECalEventTargetModule * -e_cal_event_target_new_module (ECalEvent *ece, EShellModule *shell_module, guint32 flags) +e_cal_event_target_new_module (ECalEvent *ece, EShellBackend *shell_backend, guint32 flags) { ECalEventTargetModule *t = e_event_target_new (&ece->event, E_CAL_EVENT_TARGET_MODULE, sizeof (*t)); - t->shell_module = g_object_ref (shell_module); + t->shell_backend = g_object_ref (shell_backend); t->target.mask = ~flags; return t; diff --git a/calendar/gui/e-cal-event.h b/calendar/gui/e-cal-event.h index 6aade251aa..9c2897c62f 100644 --- a/calendar/gui/e-cal-event.h +++ b/calendar/gui/e-cal-event.h @@ -27,7 +27,7 @@ #include <glib-object.h> #include "e-util/e-event.h" -#include "shell/e-shell-module.h" +#include "shell/e-shell-backend.h" #ifdef __cplusplus extern "C" { @@ -50,7 +50,7 @@ typedef struct _ECalEventTargetModule ECalEventTargetModule; struct _ECalEventTargetModule { EEventTarget target; - EShellModule *shell_module; + EShellBackend *shell_backend; }; struct _ECalEvent { @@ -65,7 +65,7 @@ struct _ECalEventClass { GType e_cal_event_get_type (void); ECalEvent* e_cal_event_peek (void); -ECalEventTargetModule* e_cal_event_target_new_module (ECalEvent *ece, EShellModule *shell_module, guint32 flags); +ECalEventTargetModule* e_cal_event_target_new_module (ECalEvent *ece, EShellBackend *shell_backend, guint32 flags); /* ********************************************************************** */ diff --git a/calendar/modules/Makefile.am b/calendar/modules/Makefile.am index 9a90c99794..f96ea2b8b3 100644 --- a/calendar/modules/Makefile.am +++ b/calendar/modules/Makefile.am @@ -15,13 +15,14 @@ module_LTLIBRARIES = \ libevolution-module-tasks.la libevolution_module_calendars_la_SOURCES = \ - e-cal-shell-module.c \ - e-cal-shell-module-migrate.c \ - e-cal-shell-module-migrate.h \ - e-cal-shell-module-settings.c \ - e-cal-shell-module-settings.h \ + e-cal-shell-backend.c \ + e-cal-shell-backend.h \ e-cal-shell-content.c \ e-cal-shell-content.h \ + e-cal-shell-migrate.c \ + e-cal-shell-migrate.h \ + e-cal-shell-settings.c \ + e-cal-shell-settings.h \ e-cal-shell-sidebar.c \ e-cal-shell-sidebar.h \ e-cal-shell-view.c \ @@ -34,11 +35,12 @@ libevolution_module_calendars_la_SOURCES = \ e-cal-shell-view-taskpad.c libevolution_module_memos_la_SOURCES = \ - e-memo-shell-module.c \ - e-memo-shell-module-migrate.c \ - e-memo-shell-module-migrate.h \ + e-memo-shell-backend.c \ + e-memo-shell-backend.h \ e-memo-shell-content.c \ e-memo-shell-content.h \ + e-memo-shell-migrate.c \ + e-memo-shell-migrate.h \ e-memo-shell-sidebar.c \ e-memo-shell-sidebar.h \ e-memo-shell-view.c \ @@ -49,11 +51,12 @@ libevolution_module_memos_la_SOURCES = \ e-memo-shell-view-private.h libevolution_module_tasks_la_SOURCES = \ - e-task-shell-module.c \ - e-task-shell-module-migrate.c \ - e-task-shell-module-migrate.h \ + e-task-shell-backend.c \ + e-task-shell-backend.h \ e-task-shell-content.c \ e-task-shell-content.h \ + e-task-shell-migrate.c \ + e-task-shell-migrate.h \ e-task-shell-sidebar.c \ e-task-shell-sidebar.h \ e-task-shell-view.c \ diff --git a/calendar/modules/e-cal-shell-module.c b/calendar/modules/e-cal-shell-backend.c index a73f0b5960..8efade4a7c 100644 --- a/calendar/modules/e-cal-shell-module.c +++ b/calendar/modules/e-cal-shell-backend.c @@ -1,5 +1,5 @@ /* - * e-cal-shell-module.c + * e-cal-shell-backend.c * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,17 +19,18 @@ * */ +#include "e-cal-shell-backend.h" + #include <string.h> #include <glib/gi18n.h> #include <libecal/e-cal.h> #include <libedataserver/e-url.h> #include <libedataserver/e-source.h> -#include <libedataserver/e-source-list.h> #include <libedataserver/e-source-group.h> #include "e-util/e-import.h" #include "shell/e-shell.h" -#include "shell/e-shell-module.h" +#include "shell/e-shell-backend.h" #include "shell/e-shell-window.h" #include "widgets/misc/e-preferences-window.h" @@ -45,29 +46,36 @@ #include "calendar/importers/evolution-calendar-importer.h" #include "e-cal-shell-view.h" -#include "e-cal-shell-module-migrate.h" -#include "e-cal-shell-module-settings.h" +#include "e-cal-shell-migrate.h" +#include "e-cal-shell-settings.h" -#define MODULE_NAME "calendar" -#define MODULE_ALIASES "" -#define MODULE_SCHEMES "calendar" -#define MODULE_SORT_ORDER 400 +#define E_CAL_SHELL_BACKEND_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CAL_SHELL_BACKEND, ECalShellBackendPrivate)) #define CONTACTS_BASE_URI "contacts://" #define WEATHER_BASE_URI "weather://" #define WEB_BASE_URI "webcal://" #define PERSONAL_RELATIVE_URI "system" +struct _ECalShellBackendPrivate { + ESourceList *source_list; +}; + /* Module Entry Point */ -void e_shell_module_init (GTypeModule *type_module); +void e_module_load (GTypeModule *type_module); +void e_module_unload (GTypeModule *type_module); + +GType e_cal_shell_backend_type = 0; +static gpointer parent_class; static void -cal_shell_module_ensure_sources (EShellModule *shell_module) +cal_shell_backend_ensure_sources (EShellBackend *shell_backend) { - /* XXX This is basically the same algorithm across all modules. - * Maybe we could somehow integrate this into EShellModule? */ + /* XXX This is basically the same algorithm across all backends. + * Maybe we could somehow integrate this into EShellBackend? */ - ESourceList *source_list; + ECalShellBackendPrivate *priv; ESourceGroup *on_this_computer; ESourceGroup *on_the_web; ESourceGroup *contacts; @@ -90,31 +98,22 @@ cal_shell_module_ensure_sources (EShellModule *shell_module) birthdays = NULL; personal = NULL; - shell = e_shell_module_get_shell (shell_module); + priv = E_CAL_SHELL_BACKEND_GET_PRIVATE (shell_backend); + + shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - if (!e_cal_get_sources (&source_list, E_CAL_SOURCE_TYPE_EVENT, NULL)) { + if (!e_cal_get_sources (&priv->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); + data_dir = e_shell_backend_get_data_dir (shell_backend); 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); + groups = e_source_list_peek_groups (priv->source_list); for (iter = groups; iter != NULL; iter = iter->next) { ESourceGroup *source_group = iter->data; const gchar *group_base_uri; @@ -179,14 +178,14 @@ cal_shell_module_ensure_sources (EShellModule *shell_module) * 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); + e_source_list_sync (priv->source_list, NULL); } } else { ESourceGroup *source_group; source_group = e_source_group_new (name, base_uri); - e_source_list_add_group (source_list, source_group, -1); + e_source_list_add_group (priv->source_list, source_group, -1); g_object_unref (source_group); } @@ -231,7 +230,7 @@ cal_shell_module_ensure_sources (EShellModule *shell_module) ESourceGroup *source_group; source_group = e_source_group_new (name, WEB_BASE_URI); - e_source_list_add_group (source_list, source_group, -1); + e_source_list_add_group (priv->source_list, source_group, -1); g_object_unref (source_group); } else { /* Force the group name to the current locale. */ @@ -270,7 +269,7 @@ cal_shell_module_ensure_sources (EShellModule *shell_module) ESourceGroup *source_group; source_group = e_source_group_new (name, CONTACTS_BASE_URI); - e_source_list_add_group (source_list, source_group, -1); + e_source_list_add_group (priv->source_list, source_group, -1); g_object_unref (source_group); /* This is now a borrowed reference. */ @@ -315,7 +314,7 @@ cal_shell_module_ensure_sources (EShellModule *shell_module) ESourceGroup *source_group; source_group = e_source_group_new (name, WEATHER_BASE_URI); - e_source_list_add_group (source_list, source_group, -1); + e_source_list_add_group (priv->source_list, source_group, -1); g_object_unref (source_group); } else { /* Force the group name to the current locale. */ @@ -326,7 +325,7 @@ cal_shell_module_ensure_sources (EShellModule *shell_module) } static void -cal_shell_module_cal_opened_cb (ECal *cal, +cal_shell_backend_cal_opened_cb (ECal *cal, ECalendarStatus status, GtkAction *action) { @@ -405,7 +404,7 @@ action_event_new_cb (GtkAction *action, g_signal_connect ( cal, "cal-opened", - G_CALLBACK (cal_shell_module_cal_opened_cb), action); + G_CALLBACK (cal_shell_backend_cal_opened_cb), action); e_cal_open_async (cal, FALSE); } @@ -452,14 +451,14 @@ static GtkActionEntry source_entries[] = { }; static void -cal_shell_module_init_hooks (void) +cal_shell_backend_init_hooks (void) { e_plugin_hook_register_type (e_cal_config_hook_get_type ()); e_plugin_hook_register_type (e_cal_event_hook_get_type ()); } static void -cal_shell_module_init_importers (void) +cal_shell_backend_init_importers (void) { EImportClass *import_class; EImportImporter *importer; @@ -477,7 +476,7 @@ cal_shell_module_init_importers (void) } static void -cal_shell_module_init_preferences (EShell *shell) +cal_shell_backend_init_preferences (EShell *shell) { GtkWidget *preferences_window; @@ -493,7 +492,7 @@ cal_shell_module_init_preferences (EShell *shell) } static gboolean -cal_shell_module_handle_uri_cb (EShellModule *shell_module, +cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend, const gchar *uri) { /* FIXME */ @@ -501,70 +500,148 @@ cal_shell_module_handle_uri_cb (EShellModule *shell_module, } static void -cal_shell_module_window_created_cb (EShellModule *shell_module, +cal_shell_backend_window_created_cb (EShellBackend *shell_backend, GtkWindow *window) { - const gchar *module_name; + const gchar *backend_name; if (!E_IS_SHELL_WINDOW (window)) return; - module_name = G_TYPE_MODULE (shell_module)->name; + backend_name = G_TYPE_MODULE (shell_backend)->name; e_shell_window_register_new_item_actions ( - E_SHELL_WINDOW (window), module_name, + E_SHELL_WINDOW (window), backend_name, item_entries, G_N_ELEMENTS (item_entries)); e_shell_window_register_new_source_actions ( - E_SHELL_WINDOW (window), module_name, + E_SHELL_WINDOW (window), backend_name, source_entries, G_N_ELEMENTS (source_entries)); } -static EShellModuleInfo module_info = { +static void +cal_shell_backend_dispose (GObject *object) +{ + ECalShellBackendPrivate *priv; - MODULE_NAME, - MODULE_ALIASES, - MODULE_SCHEMES, - MODULE_SORT_ORDER, + priv = E_CAL_SHELL_BACKEND_GET_PRIVATE (object); - /* start */ NULL, - /* is_busy */ NULL, - /* shutdown */ NULL, - e_cal_shell_module_migrate -}; + if (priv->source_list != NULL) { + g_object_unref (priv->source_list); + priv->source_list = NULL; + } -void -e_shell_module_init (GTypeModule *type_module) + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +static void +cal_shell_backend_constructed (GObject *object) { EShell *shell; - EShellModule *shell_module; - - shell_module = E_SHELL_MODULE (type_module); - shell = e_shell_module_get_shell (shell_module); + EShellBackend *shell_backend; - e_shell_module_set_info ( - shell_module, &module_info, - e_cal_shell_view_get_type (type_module)); + shell_backend = E_SHELL_BACKEND (object); + shell = e_shell_backend_get_shell (shell_backend); - cal_shell_module_ensure_sources (shell_module); + cal_shell_backend_ensure_sources (shell_backend); g_signal_connect_swapped ( shell, "handle-uri", - G_CALLBACK (cal_shell_module_handle_uri_cb), - shell_module); + G_CALLBACK (cal_shell_backend_handle_uri_cb), + shell_backend); g_signal_connect_swapped ( shell, "window-created", - G_CALLBACK (cal_shell_module_window_created_cb), - shell_module); + G_CALLBACK (cal_shell_backend_window_created_cb), + shell_backend); - cal_shell_module_init_hooks (); - cal_shell_module_init_importers (); + cal_shell_backend_init_hooks (); + cal_shell_backend_init_importers (); /* Initialize settings before initializing preferences, * since the preferences bind to the shell settings. */ - e_cal_shell_module_init_settings (shell); - cal_shell_module_init_preferences (shell); + e_cal_shell_backend_init_settings (shell); + cal_shell_backend_init_preferences (shell); e_attachment_handler_calendar_get_type (); } + +static void +cal_shell_backend_class_init (ECalShellBackendClass *class) +{ + GObjectClass *object_class; + EShellBackendClass *shell_backend_class; + + parent_class = g_type_class_peek_parent (class); + g_type_class_add_private (class, sizeof (ECalShellBackendPrivate)); + + object_class = G_OBJECT_CLASS (class); + object_class->dispose = cal_shell_backend_dispose; + object_class->constructed = cal_shell_backend_constructed; + + shell_backend_class = E_SHELL_BACKEND_CLASS (class); + shell_backend_class->name = "calendar"; + shell_backend_class->aliases = ""; + shell_backend_class->schemes = "calendar"; + shell_backend_class->sort_order = 400; + shell_backend_class->view_type = E_TYPE_CAL_SHELL_VIEW; + shell_backend_class->start = NULL; + shell_backend_class->is_busy = NULL; + shell_backend_class->shutdown = NULL; + shell_backend_class->migrate = e_cal_shell_backend_migrate; +} + +static void +cal_shell_backend_init (ECalShellBackend *cal_shell_backend) +{ + cal_shell_backend->priv = + E_CAL_SHELL_BACKEND_GET_PRIVATE (cal_shell_backend); +} + +GType +e_cal_shell_backend_get_type (GTypeModule *type_module) +{ + if (e_cal_shell_backend_type == 0) { + const GTypeInfo type_info = { + sizeof (ECalShellBackendClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) cal_shell_backend_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (ECalShellBackend), + 0, /* n_preallocs */ + (GInstanceInitFunc) cal_shell_backend_init, + NULL /* value_table */ + }; + + e_cal_shell_backend_type = + g_type_module_register_type ( + type_module, E_TYPE_SHELL_BACKEND, + "ECalShellBackend", &type_info, 0); + } + + return e_cal_shell_backend_type; +} + +ESourceList * +e_cal_shell_backend_get_source_list (ECalShellBackend *cal_shell_backend) +{ + g_return_val_if_fail ( + E_IS_CAL_SHELL_BACKEND (cal_shell_backend), NULL); + + return cal_shell_backend->priv->source_list; +} + +void +e_module_load (GTypeModule *type_module) +{ + e_cal_shell_backend_get_type (type_module); + e_cal_shell_view_get_type (type_module); +} + +void +e_module_unload (GTypeModule *type_module) +{ +} diff --git a/calendar/modules/e-cal-shell-backend.h b/calendar/modules/e-cal-shell-backend.h new file mode 100644 index 0000000000..5e176007f8 --- /dev/null +++ b/calendar/modules/e-cal-shell-backend.h @@ -0,0 +1,71 @@ +/* + * e-cal-shell-backend.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef E_CAL_SHELL_BACKEND_H +#define E_CAL_SHELL_BACKEND_H + +#include <shell/e-shell-backend.h> +#include <libedataserver/e-source-list.h> + +/* Standard GObject macros */ +#define E_TYPE_CAL_SHELL_BACKEND \ + (e_cal_shell_backend_type) +#define E_CAL_SHELL_BACKEND(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_CAL_SHELL_BACKEND, ECalShellBackend)) +#define E_CAL_SHELL_BACKEND_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_CAL_SHELL_BACKEND, ECalShellBackendClass)) +#define E_IS_CAL_SHELL_BACKEND(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_CAL_SHELL_BACKEND)) +#define E_IS_CAL_SHELL_BACKEND_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_CAL_SHELL_BACKEND)) +#define E_CAL_SHELL_BACKEND_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_CAL_SHELL_BACKEND, ECalShellBackendClass)) + +G_BEGIN_DECLS + +extern GType e_cal_shell_backend_type; + +typedef struct _ECalShellBackend ECalShellBackend; +typedef struct _ECalShellBackendClass ECalShellBackendClass; +typedef struct _ECalShellBackendPrivate ECalShellBackendPrivate; + +struct _ECalShellBackend { + EShellBackend parent; + ECalShellBackendPrivate *priv; +}; + +struct _ECalShellBackendClass { + EShellBackendClass parent_class; +}; + +GType e_cal_shell_backend_get_type + (GTypeModule *type_module); +ESourceList * e_cal_shell_backend_get_source_list + (ECalShellBackend *cal_shell_backend); + +G_END_DECLS + +#endif /* E_CAL_SHELL_BACKEND_H */ diff --git a/calendar/modules/e-cal-shell-content.c b/calendar/modules/e-cal-shell-content.c index f0d2024f9b..5a73ed6823 100644 --- a/calendar/modules/e-cal-shell-content.c +++ b/calendar/modules/e-cal-shell-content.c @@ -327,7 +327,7 @@ cal_shell_content_constructed (GObject *object) ECalModel *memo_model; ECalModel *task_model; EShellContent *shell_content; - EShellModule *shell_module; + EShellBackend *shell_backend; EShellView *shell_view; EShellWindow *shell_window; EShellContent *foreign_content; @@ -351,8 +351,8 @@ cal_shell_content_constructed (GObject *object) shell_view = e_shell_content_get_shell_view (shell_content); shell_window = e_shell_view_get_shell_window (shell_view); - shell_module = e_shell_view_get_shell_module (shell_view); - config_dir = e_shell_module_get_config_dir (shell_module); + shell_backend = e_shell_view_get_shell_backend (shell_view); + config_dir = e_shell_backend_get_config_dir (shell_backend); /* Calendar model for the views. */ cal_model = e_cal_model_calendar_new (); diff --git a/calendar/modules/e-cal-shell-module-migrate.c b/calendar/modules/e-cal-shell-migrate.c index 5ebb6af54f..bdcca08ce2 100644 --- a/calendar/modules/e-cal-shell-module-migrate.c +++ b/calendar/modules/e-cal-shell-migrate.c @@ -1,5 +1,5 @@ /* - * e-cal-shell-module-migrate.c + * e-cal-shell-backend-migrate.c * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,7 +19,7 @@ * */ -#include "e-cal-shell-module-migrate.h" +#include "e-cal-shell-migrate.h" #include <string.h> #include <sys/types.h> @@ -492,7 +492,7 @@ create_calendar_contact_source (ESourceList *source_list) } static void -create_calendar_sources (EShellModule *shell_module, +create_calendar_sources (EShellBackend *shell_backend, ESourceList *source_list, ESourceGroup **on_this_computer, ESource **personal_source, @@ -511,10 +511,10 @@ create_calendar_sources (EShellModule *shell_module, *contacts = NULL; *personal_source = NULL; - shell = e_shell_module_get_shell (shell_module); + shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - base_dir = e_shell_module_get_config_dir (shell_module); + base_dir = e_shell_backend_get_config_dir (shell_backend); base_uri = g_build_filename (base_dir, "local", NULL); base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL); @@ -614,7 +614,7 @@ create_calendar_sources (EShellModule *shell_module, } gboolean -e_cal_shell_module_migrate (EShellModule *shell_module, +e_cal_shell_backend_migrate (EShellBackend *shell_backend, gint major, gint minor, gint micro, @@ -628,13 +628,13 @@ e_cal_shell_module_migrate (EShellModule *shell_module, gboolean retval = FALSE; source_list = g_object_get_data ( - G_OBJECT (shell_module), "source-list"); + G_OBJECT (shell_backend), "source-list"); /* we call this unconditionally now - create_groups either creates the groups/sources or it finds the necessary groups/sources. */ create_calendar_sources ( - shell_module, source_list, &on_this_computer, + shell_backend, source_list, &on_this_computer, &personal_source, &on_the_web, &contacts); #ifndef G_OS_WIN32 @@ -735,7 +735,7 @@ e_cal_shell_module_migrate (EShellModule *shell_module, char *old_path, *new_path; old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Calendar", NULL); - new_path = g_build_filename (e_shell_module_get_config_dir (shell_module), + new_path = g_build_filename (e_shell_backend_get_config_dir (shell_backend), "local", "system", NULL); migrate_pilot_data ("calendar", "calendar", old_path, new_path); g_free (new_path); @@ -777,7 +777,7 @@ e_cal_shell_module_migrate (EShellModule *shell_module, */ /* Fire off migration event */ ece = e_cal_event_peek (); - target = e_cal_event_target_new_module (ece, shell_module, 0); + target = e_cal_event_target_new_module (ece, shell_backend, 0); e_event_emit ((EEvent *) ece, "module.migration", (EEventTarget *) target); retval = TRUE; diff --git a/calendar/modules/e-memo-shell-module-migrate.h b/calendar/modules/e-cal-shell-migrate.h index e40e2ff00f..44cbf68ee1 100644 --- a/calendar/modules/e-memo-shell-module-migrate.h +++ b/calendar/modules/e-cal-shell-migrate.h @@ -1,5 +1,5 @@ /* - * e-memo-shell-module-migrate.h + * e-cal-shell-backend-migrate.h * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,15 +19,15 @@ * */ -#ifndef E_MEMO_SHELL_MODULE_MIGRATE_H -#define E_MEMO_SHELL_MODULE_MIGRATE_H +#ifndef E_CAL_SHELL_BACKEND_MIGRATE_H +#define E_CAL_SHELL_BACKEND_MIGRATE_H #include <glib.h> -#include <shell/e-shell-module.h> +#include <shell/e-shell-backend.h> G_BEGIN_DECLS -gboolean e_memo_shell_module_migrate (EShellModule *shell_module, +gboolean e_cal_shell_backend_migrate (EShellBackend *shell_backend, gint major, gint minor, gint micro, @@ -35,4 +35,4 @@ gboolean e_memo_shell_module_migrate (EShellModule *shell_module, G_END_DECLS -#endif /* E_MEMO_SHELL_MODULE_MIGRATE_H */ +#endif /* E_CAL_SHELL_BACKEND_MIGRATE_H */ diff --git a/calendar/modules/e-cal-shell-module-settings.c b/calendar/modules/e-cal-shell-settings.c index ff6bd8e500..639622fec1 100644 --- a/calendar/modules/e-cal-shell-module-settings.c +++ b/calendar/modules/e-cal-shell-settings.c @@ -1,5 +1,5 @@ /* - * e-cal-shell-module-settings.c + * e-cal-shell-backend-settings.c * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,12 +19,12 @@ * */ -#include "e-cal-shell-module-settings.h" +#include "e-cal-shell-settings.h" #include <gconf/gconf-client.h> void -e_cal_shell_module_init_settings (EShell *shell) +e_cal_shell_backend_init_settings (EShell *shell) { EShellSettings *shell_settings; diff --git a/calendar/modules/e-cal-shell-module-settings.h b/calendar/modules/e-cal-shell-settings.h index 92be6da749..7382130f2d 100644 --- a/calendar/modules/e-cal-shell-module-settings.h +++ b/calendar/modules/e-cal-shell-settings.h @@ -1,5 +1,5 @@ /* - * e-cal-shell-module-settings.h + * e-cal-shell-backend-settings.h * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,15 +19,15 @@ * */ -#ifndef E_CAL_SHELL_MODULE_SETTINGS_H -#define E_CAL_SHELL_MODULE_SETTINGS_H +#ifndef E_CAL_SHELL_BACKEND_SETTINGS_H +#define E_CAL_SHELL_BACKEND_SETTINGS_H #include <shell/e-shell.h> G_BEGIN_DECLS -void e_cal_shell_module_init_settings (EShell *shell); +void e_cal_shell_backend_init_settings (EShell *shell); G_END_DECLS -#endif /* E_CAL_SHELL_MODULE_SETTINGS_H */ +#endif /* E_CAL_SHELL_BACKEND_SETTINGS_H */ diff --git a/calendar/modules/e-cal-shell-sidebar.c b/calendar/modules/e-cal-shell-sidebar.c index 61a1a727e6..b338c98f53 100644 --- a/calendar/modules/e-cal-shell-sidebar.c +++ b/calendar/modules/e-cal-shell-sidebar.c @@ -32,6 +32,7 @@ #include "calendar/gui/e-mini-calendar-config.h" #include "calendar/gui/misc.h" +#include "e-cal-shell-backend.h" #include "e-cal-shell-view.h" #define E_CAL_SHELL_SIDEBAR_GET_PRIVATE(obj) \ @@ -374,9 +375,9 @@ cal_shell_sidebar_constructed (GObject *object) EShell *shell; EShellView *shell_view; EShellWindow *shell_window; + EShellBackend *shell_backend; EShellSidebar *shell_sidebar; EShellSettings *shell_settings; - ECalShellView *cal_shell_view; ESourceSelector *selector; ESourceList *source_list; ESource *source; @@ -397,13 +398,14 @@ cal_shell_sidebar_constructed (GObject *object) shell_sidebar = E_SHELL_SIDEBAR (object); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_backend = e_shell_view_get_shell_backend (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); shell = e_shell_window_get_shell (shell_window); shell_settings = e_shell_get_shell_settings (shell); - cal_shell_view = E_CAL_SHELL_VIEW (shell_view); - source_list = e_cal_shell_view_get_source_list (cal_shell_view); + source_list = e_cal_shell_backend_get_source_list ( + E_CAL_SHELL_BACKEND (shell_view)); container = GTK_WIDGET (shell_sidebar); diff --git a/calendar/modules/e-cal-shell-view-memopad.c b/calendar/modules/e-cal-shell-view-memopad.c index dbde52d1eb..d9adf23098 100644 --- a/calendar/modules/e-cal-shell-view-memopad.c +++ b/calendar/modules/e-cal-shell-view-memopad.c @@ -496,12 +496,12 @@ e_cal_shell_view_memopad_set_status_message (ECalShellView *cal_shell_view, { EActivity *activity; EShellView *shell_view; - EShellModule *shell_module; + EShellBackend *shell_backend; g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view)); shell_view = E_SHELL_VIEW (cal_shell_view); - shell_module = e_shell_view_get_shell_module (shell_view); + shell_backend = e_shell_view_get_shell_backend (shell_view); activity = cal_shell_view->priv->memopad_activity; @@ -515,7 +515,7 @@ e_cal_shell_view_memopad_set_status_message (ECalShellView *cal_shell_view, } else if (activity == NULL) { activity = e_activity_new (status_message); e_activity_set_percent (activity, percent); - e_shell_module_add_activity (shell_module, activity); + e_shell_backend_add_activity (shell_backend, activity); } else { e_activity_set_percent (activity, percent); diff --git a/calendar/modules/e-cal-shell-view-private.c b/calendar/modules/e-cal-shell-view-private.c index f344333598..aa7b6e336e 100644 --- a/calendar/modules/e-cal-shell-view-private.c +++ b/calendar/modules/e-cal-shell-view-private.c @@ -219,17 +219,6 @@ 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; - guint notification_id; - - 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); - if (!gal_view_collection_loaded (shell_view_class->view_collection)) cal_shell_view_load_view_collection (shell_view_class); @@ -244,6 +233,7 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view) ECalShellViewPrivate *priv = cal_shell_view->priv; ECalShellContent *cal_shell_content; ECalShellSidebar *cal_shell_sidebar; + EShellBackend *shell_backend; EShellContent *shell_content; EShellSidebar *shell_sidebar; EShellWindow *shell_window; @@ -256,6 +246,7 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view) guint id; shell_view = E_SHELL_VIEW (cal_shell_view); + shell_backend = e_shell_view_get_shell_backend (shell_view); shell_content = e_shell_view_get_shell_content (shell_view); shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); @@ -264,6 +255,7 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view) e_shell_window_add_action_group (shell_window, "calendar-filter"); /* Cache these to avoid lots of awkward casting. */ + priv->cal_shell_backend = g_object_ref (shell_backend); priv->cal_shell_content = g_object_ref (shell_content); priv->cal_shell_sidebar = g_object_ref (shell_sidebar); @@ -361,8 +353,7 @@ e_cal_shell_view_private_dispose (ECalShellView *cal_shell_view) ECalShellViewPrivate *priv = cal_shell_view->priv; GList *iter; - DISPOSE (priv->source_list); - + DISPOSE (priv->cal_shell_backend); DISPOSE (priv->cal_shell_content); DISPOSE (priv->cal_shell_sidebar); @@ -468,12 +459,12 @@ e_cal_shell_view_set_status_message (ECalShellView *cal_shell_view, { EActivity *activity; EShellView *shell_view; - EShellModule *shell_module; + EShellBackend *shell_backend; g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view)); shell_view = E_SHELL_VIEW (cal_shell_view); - shell_module = e_shell_view_get_shell_module (shell_view); + shell_backend = e_shell_view_get_shell_backend (shell_view); activity = cal_shell_view->priv->calendar_activity; @@ -487,7 +478,7 @@ e_cal_shell_view_set_status_message (ECalShellView *cal_shell_view, } else if (activity == NULL) { activity = e_activity_new (status_message); e_activity_set_percent (activity, percent); - e_shell_module_add_activity (shell_module, activity); + e_shell_backend_add_activity (shell_backend, activity); } else { e_activity_set_percent (activity, percent); diff --git a/calendar/modules/e-cal-shell-view-private.h b/calendar/modules/e-cal-shell-view-private.h index af492618e9..16a06ccd9b 100644 --- a/calendar/modules/e-cal-shell-view-private.h +++ b/calendar/modules/e-cal-shell-view-private.h @@ -47,6 +47,7 @@ #include "calendar/gui/dialogs/memo-editor.h" #include "calendar/gui/dialogs/task-editor.h" +#include "e-cal-shell-backend.h" #include "e-cal-shell-content.h" #include "e-cal-shell-sidebar.h" #include "e-cal-shell-view-actions.h" @@ -90,11 +91,8 @@ enum { struct _ECalShellViewPrivate { - /*** Module Data ***/ - - ESourceList *source_list; - /* These are just for convenience. */ + ECalShellBackend *cal_shell_backend; ECalShellContent *cal_shell_content; ECalShellSidebar *cal_shell_sidebar; diff --git a/calendar/modules/e-cal-shell-view-taskpad.c b/calendar/modules/e-cal-shell-view-taskpad.c index 92fcdba69f..6d00eb542b 100644 --- a/calendar/modules/e-cal-shell-view-taskpad.c +++ b/calendar/modules/e-cal-shell-view-taskpad.c @@ -624,12 +624,12 @@ e_cal_shell_view_taskpad_set_status_message (ECalShellView *cal_shell_view, { EActivity *activity; EShellView *shell_view; - EShellModule *shell_module; + EShellBackend *shell_backend; g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view)); shell_view = E_SHELL_VIEW (cal_shell_view); - shell_module = e_shell_view_get_shell_module (shell_view); + shell_backend = e_shell_view_get_shell_backend (shell_view); activity = cal_shell_view->priv->taskpad_activity; @@ -643,7 +643,7 @@ e_cal_shell_view_taskpad_set_status_message (ECalShellView *cal_shell_view, } else if (activity == NULL) { activity = e_activity_new (status_message); e_activity_set_percent (activity, percent); - e_shell_module_add_activity (shell_module, activity); + e_shell_backend_add_activity (shell_backend, activity); } else { e_activity_set_percent (activity, percent); diff --git a/calendar/modules/e-cal-shell-view.c b/calendar/modules/e-cal-shell-view.c index 67f7d788a4..1e494edc8a 100644 --- a/calendar/modules/e-cal-shell-view.c +++ b/calendar/modules/e-cal-shell-view.c @@ -21,32 +21,10 @@ #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)); @@ -185,7 +163,6 @@ cal_shell_view_class_init (ECalShellViewClass *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; @@ -197,20 +174,9 @@ cal_shell_view_class_init (ECalShellViewClass *class, shell_view_class->ui_manager_id = "org.gnome.evolution.calendars"; shell_view_class->search_options = "/calendar-search-options"; shell_view_class->search_rules = "caltypes.xml"; - shell_view_class->type_module = type_module; shell_view_class->new_shell_content = e_cal_shell_content_new; shell_view_class->new_shell_sidebar = e_cal_shell_sidebar_new; shell_view_class->update_actions = cal_shell_view_update_actions; - - 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 @@ -257,11 +223,3 @@ e_cal_shell_view_get_calendar (ECalShellView *cal_shell_view) /* 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/modules/e-cal-shell-view.h b/calendar/modules/e-cal-shell-view.h index a301572972..cdbd93845a 100644 --- a/calendar/modules/e-cal-shell-view.h +++ b/calendar/modules/e-cal-shell-view.h @@ -66,8 +66,6 @@ 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 diff --git a/calendar/modules/e-memo-shell-module.c b/calendar/modules/e-memo-shell-backend.c index 913d5b3a26..fb0296f8c8 100644 --- a/calendar/modules/e-memo-shell-module.c +++ b/calendar/modules/e-memo-shell-backend.c @@ -1,5 +1,5 @@ /* - * e-memo-shell-module.c + * e-memo-shell-backend.c * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -28,7 +28,7 @@ #include <libedataserver/e-source-group.h> #include "shell/e-shell.h" -#include "shell/e-shell-module.h" +#include "shell/e-shell-backend.h" #include "shell/e-shell-window.h" #include "calendar/common/authentication.h" @@ -38,7 +38,7 @@ #include "calendar/gui/dialogs/memo-editor.h" #include "e-memo-shell-view.h" -#include "e-memo-shell-module-migrate.h" +#include "e-memo-shell-backend-migrate.h" #define MODULE_NAME "memos" #define MODULE_ALIASES "" @@ -49,13 +49,13 @@ #define PERSONAL_RELATIVE_URI "system" /* Module Entry Point */ -void e_shell_module_init (GTypeModule *type_module); +void e_shell_backend_init (GTypeModule *type_module); static void -memo_module_ensure_sources (EShellModule *shell_module) +memo_module_ensure_sources (EShellBackend *shell_backend) { /* XXX This is basically the same algorithm across all modules. - * Maybe we could somehow integrate this into EShellModule? */ + * Maybe we could somehow integrate this into EShellBackend? */ ESourceList *source_list; ESourceGroup *on_this_computer; @@ -78,16 +78,16 @@ memo_module_ensure_sources (EShellModule *shell_module) /* 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. + * Note: EShellBackend 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 + * EShellBackend API for this. The mail module would * not use it. */ g_object_set_data_full ( - G_OBJECT (shell_module), "source-list", + G_OBJECT (shell_backend), "source-list", source_list, (GDestroyNotify) g_object_unref); - data_dir = e_shell_module_get_data_dir (shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); filename = g_build_filename (data_dir, "local", NULL); base_uri = g_filename_to_uri (filename, NULL, NULL); g_free (filename); @@ -320,7 +320,7 @@ static GtkActionEntry source_entries[] = { }; static gboolean -memo_module_handle_uri_cb (EShellModule *shell_module, +memo_module_handle_uri_cb (EShellBackend *shell_backend, const gchar *uri) { EShell *shell; @@ -341,7 +341,7 @@ memo_module_handle_uri_cb (EShellModule *shell_module, GError *error = NULL; source_type = E_CAL_SOURCE_TYPE_JOURNAL; - shell = e_shell_module_get_shell (shell_module); + shell = e_shell_backend_get_shell (shell_backend); if (strncmp (uri, "memo:", 5) != 0) return FALSE; @@ -459,7 +459,7 @@ exit: } static void -memo_module_window_created_cb (EShellModule *shell_module, +memo_module_window_created_cb (EShellBackend *shell_backend, GtkWindow *window) { const gchar *module_name; @@ -467,7 +467,7 @@ memo_module_window_created_cb (EShellModule *shell_module, if (!E_IS_SHELL_WINDOW (window)) return; - module_name = G_TYPE_MODULE (shell_module)->name; + module_name = G_TYPE_MODULE (shell_backend)->name; e_shell_window_register_new_item_actions ( E_SHELL_WINDOW (window), module_name, @@ -478,7 +478,7 @@ memo_module_window_created_cb (EShellModule *shell_module, source_entries, G_N_ELEMENTS (source_entries)); } -static EShellModuleInfo module_info = { +static EShellBackendInfo module_info = { MODULE_NAME, MODULE_ALIASES, @@ -488,29 +488,29 @@ static EShellModuleInfo module_info = { /* start */ NULL, /* is_busy */ NULL, /* shutdown */ NULL, - e_memo_shell_module_migrate + e_memo_shell_backend_migrate }; void -e_shell_module_init (GTypeModule *type_module) +e_shell_backend_init (GTypeModule *type_module) { EShell *shell; - EShellModule *shell_module; + EShellBackend *shell_backend; - shell_module = E_SHELL_MODULE (type_module); - shell = e_shell_module_get_shell (shell_module); + shell_backend = E_SHELL_BACKEND (type_module); + shell = e_shell_backend_get_shell (shell_backend); - e_shell_module_set_info ( - shell_module, &module_info, + e_shell_backend_set_info ( + shell_backend, &module_info, e_memo_shell_view_get_type (type_module)); - memo_module_ensure_sources (shell_module); + memo_module_ensure_sources (shell_backend); g_signal_connect_swapped ( shell, "handle-uri", - G_CALLBACK (memo_module_handle_uri_cb), shell_module); + G_CALLBACK (memo_module_handle_uri_cb), shell_backend); g_signal_connect_swapped ( shell, "window-created", - G_CALLBACK (memo_module_window_created_cb), shell_module); + G_CALLBACK (memo_module_window_created_cb), shell_backend); } diff --git a/calendar/modules/e-memo-shell-backend.h b/calendar/modules/e-memo-shell-backend.h new file mode 100644 index 0000000000..a7bf63e0d8 --- /dev/null +++ b/calendar/modules/e-memo-shell-backend.h @@ -0,0 +1,67 @@ +/* + * e-memo-shell-backend.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef E_MEMO_SHELL_BACKEND_H +#define E_MEMO_SHELL_BACKEND_H + +#include <shell/e-shell-backend.h> + +/* Standard GObject macros */ +#define E_TYPE_MEMO_SHELL_BACKEND \ + (e_memo_shell_backend_type) +#define E_MEMO_SHELL_BACKEND(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_MEMO_SHELL_BACKEND, EMemoShellBackend)) +#define E_MEMO_SHELL_BACKEND_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_MEMO_SHELL_BACKEND, EMemoShellBackendClass)) +#define E_IS_MEMO_SHELL_BACKEND(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_MEMO_SHELL_BACKEND)) +#define E_IS_MEMO_SHELL_BACKEND_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_MEMO_SHELL_BACKEND)) +#define E_MEMO_SHELL_BACKEND_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_MEMO_SHELL_BACKEND, EMemoShellBackendClass)) + +G_BEGIN_DECLS + +extern GType e_memo_shell_backend_type; + +typedef struct _EMemoShellBackend EMemoShellBackend; +typedef struct _EMemoShellBackendClass EMemoShellBackendClass; +typedef struct _EMemoShellBackendPrivate EMemoShellBackendPrivate; + +struct _EMemoShellBackend { + EShellBackend parent; + EMemoShellBackendPrivate *priv; +}; + +struct _EMemoShellBackendClass { + EShellBackendClass parent_class; +}; + +GType e_memo_shell_backend_get_type (GTypeModule *type_module); + +G_END_DECLS + +#endif /* E_MEMO_SHELL_BACKEND_H */ diff --git a/calendar/modules/e-memo-shell-module-migrate.c b/calendar/modules/e-memo-shell-migrate.c index 7fe9442d5e..8bdf08fe4e 100644 --- a/calendar/modules/e-memo-shell-module-migrate.c +++ b/calendar/modules/e-memo-shell-migrate.c @@ -1,5 +1,5 @@ /* - * e-memo-shell-module-migrate.c + * e-memo-shell-backend-migrate.c * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,7 +19,7 @@ * */ -#include "e-memo-shell-module-migrate.h" +#include "e-memo-shell-backend-migrate.h" #include <string.h> #include <glib/gi18n.h> @@ -38,7 +38,7 @@ #define GROUPWISE_BASE_URI "groupwise://" static void -create_memo_sources (EShellModule *shell_module, +create_memo_sources (EShellBackend *shell_backend, ESourceList *source_list, ESourceGroup **on_this_computer, ESourceGroup **on_the_web, @@ -53,7 +53,7 @@ create_memo_sources (EShellModule *shell_module, *on_the_web = NULL; *personal_source = NULL; - base_dir = e_shell_module_get_config_dir (shell_module); + base_dir = e_shell_backend_get_config_dir (shell_backend); base_uri = g_build_filename (base_dir, "local", NULL); base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL); @@ -199,7 +199,7 @@ add_gw_esource (ESourceList *source_list, const char *group_name, const char *s } gboolean -e_memo_shell_module_migrate (EShellModule *shell_module, +e_memo_shell_backend_migrate (EShellBackend *shell_backend, gint major, gint minor, gint revision, @@ -212,13 +212,13 @@ e_memo_shell_module_migrate (EShellModule *shell_module, gboolean retval = FALSE; source_list = g_object_get_data ( - G_OBJECT (shell_module), "source-list"); + G_OBJECT (shell_backend), "source-list"); /* we call this unconditionally now - create_groups either creates the groups/sources or it finds the necessary groups/sources. */ create_memo_sources ( - shell_module, source_list, &on_this_computer, + shell_backend, source_list, &on_this_computer, &on_the_web, &personal_source); /* Migration for Gw accounts between versions < 2.8 */ diff --git a/calendar/modules/e-cal-shell-module-migrate.h b/calendar/modules/e-memo-shell-migrate.h index afef469df8..26139edeb8 100644 --- a/calendar/modules/e-cal-shell-module-migrate.h +++ b/calendar/modules/e-memo-shell-migrate.h @@ -1,5 +1,5 @@ /* - * e-cal-shell-module-migrate.h + * e-memo-shell-backend-migrate.h * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,15 +19,15 @@ * */ -#ifndef E_CAL_SHELL_MODULE_MIGRATE_H -#define E_CAL_SHELL_MODULE_MIGRATE_H +#ifndef E_MEMO_SHELL_BACKEND_MIGRATE_H +#define E_MEMO_SHELL_BACKEND_MIGRATE_H #include <glib.h> -#include <shell/e-shell-module.h> +#include <shell/e-shell-backend.h> G_BEGIN_DECLS -gboolean e_cal_shell_module_migrate (EShellModule *shell_module, +gboolean e_memo_shell_backend_migrate (EShellBackend *shell_backend, gint major, gint minor, gint micro, @@ -35,4 +35,4 @@ gboolean e_cal_shell_module_migrate (EShellModule *shell_module, G_END_DECLS -#endif /* E_CAL_SHELL_MODULE_MIGRATE_H */ +#endif /* E_MEMO_SHELL_BACKEND_MIGRATE_H */ diff --git a/calendar/modules/e-memo-shell-view-private.c b/calendar/modules/e-memo-shell-view-private.c index 113def55ad..2fcd5ddd9a 100644 --- a/calendar/modules/e-memo-shell-view-private.c +++ b/calendar/modules/e-memo-shell-view-private.c @@ -461,13 +461,13 @@ e_memo_shell_view_set_status_message (EMemoShellView *memo_shell_view, { EActivity *activity; EShellView *shell_view; - EShellModule *shell_module; + EShellBackend *shell_backend; g_return_if_fail (E_IS_MEMO_SHELL_VIEW (memo_shell_view)); activity = memo_shell_view->priv->activity; shell_view = E_SHELL_VIEW (memo_shell_view); - shell_module = e_shell_view_get_shell_module (shell_view); + shell_backend = e_shell_view_get_shell_backend (shell_view); if (status_message == NULL || *status_message == '\0') { if (activity != NULL) { @@ -479,7 +479,7 @@ e_memo_shell_view_set_status_message (EMemoShellView *memo_shell_view, } else if (activity == NULL) { activity = e_activity_new (status_message); e_activity_set_percent (activity, percent); - e_shell_module_add_activity (shell_module, activity); + e_shell_backend_add_activity (shell_backend, activity); } else { e_activity_set_percent (activity, percent); diff --git a/calendar/modules/e-task-shell-module.c b/calendar/modules/e-task-shell-backend.c index 5e35008541..1dba011c96 100644 --- a/calendar/modules/e-task-shell-module.c +++ b/calendar/modules/e-task-shell-backend.c @@ -1,5 +1,5 @@ /* - * e-task-shell-module.c + * e-task-shell-backend.c * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -28,7 +28,7 @@ #include <libedataserver/e-source-group.h> #include "shell/e-shell.h" -#include "shell/e-shell-module.h" +#include "shell/e-shell-backend.h" #include "shell/e-shell-window.h" #include "calendar/common/authentication.h" @@ -38,7 +38,7 @@ #include "calendar/gui/dialogs/task-editor.h" #include "e-task-shell-view.h" -#include "e-task-shell-module-migrate.h" +#include "e-task-shell-backend-migrate.h" #define MODULE_NAME "tasks" #define MODULE_ALIASES "" @@ -49,13 +49,13 @@ #define PERSONAL_RELATIVE_URI "system" /* Module Entry Point */ -void e_shell_module_init (GTypeModule *type_module); +void e_shell_backend_init (GTypeModule *type_module); static void -task_module_ensure_sources (EShellModule *shell_module) +task_module_ensure_sources (EShellBackend *shell_backend) { /* XXX This is basically the same algorithm across all modules. - * Maybe we could somehow integrate this into EShellModule? */ + * Maybe we could somehow integrate this into EShellBackend? */ ESourceList *source_list; ESourceGroup *on_this_computer; @@ -78,16 +78,16 @@ task_module_ensure_sources (EShellModule *shell_module) /* 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. + * Note: EShellBackend 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 + * EShellBackend API for this. The mail module would * not use it. */ g_object_set_data_full ( - G_OBJECT (shell_module), "source-list", + G_OBJECT (shell_backend), "source-list", source_list, (GDestroyNotify) g_object_unref); - data_dir = e_shell_module_get_data_dir (shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); filename = g_build_filename (data_dir, "local", NULL); base_uri = g_filename_to_uri (filename, NULL, NULL); g_free (filename); @@ -320,7 +320,7 @@ static GtkActionEntry source_entries[] = { }; static gboolean -task_module_handle_uri_cb (EShellModule *shell_module, +task_module_handle_uri_cb (EShellBackend *shell_backend, const gchar *uri) { EShell *shell; @@ -342,7 +342,7 @@ task_module_handle_uri_cb (EShellModule *shell_module, GError *error = NULL; source_type = E_CAL_SOURCE_TYPE_TODO; - shell = e_shell_module_get_shell (shell_module); + shell = e_shell_backend_get_shell (shell_backend); if (strncmp (uri, "task:", 5) != 0) return FALSE; @@ -465,7 +465,7 @@ exit: } static void -task_module_window_created_cb (EShellModule *shell_module, +task_module_window_created_cb (EShellBackend *shell_backend, GtkWindow *window) { const gchar *module_name; @@ -473,7 +473,7 @@ task_module_window_created_cb (EShellModule *shell_module, if (!E_IS_SHELL_WINDOW (window)) return; - module_name = G_TYPE_MODULE (shell_module)->name; + module_name = G_TYPE_MODULE (shell_backend)->name; e_shell_window_register_new_item_actions ( E_SHELL_WINDOW (window), module_name, @@ -484,7 +484,7 @@ task_module_window_created_cb (EShellModule *shell_module, source_entries, G_N_ELEMENTS (source_entries)); } -static EShellModuleInfo module_info = { +static EShellBackendInfo module_info = { MODULE_NAME, MODULE_ALIASES, @@ -494,29 +494,29 @@ static EShellModuleInfo module_info = { /* start */ NULL, /* is_busy */ NULL, /* shutdown */ NULL, - e_task_shell_module_migrate + e_task_shell_backend_migrate }; void -e_shell_module_init (GTypeModule *type_module) +e_shell_backend_init (GTypeModule *type_module) { EShell *shell; - EShellModule *shell_module; + EShellBackend *shell_backend; - shell_module = E_SHELL_MODULE (type_module); - shell = e_shell_module_get_shell (shell_module); + shell_backend = E_SHELL_BACKEND (type_module); + shell = e_shell_backend_get_shell (shell_backend); - e_shell_module_set_info ( - shell_module, &module_info, + e_shell_backend_set_info ( + shell_backend, &module_info, e_task_shell_view_get_type (type_module)); - task_module_ensure_sources (shell_module); + task_module_ensure_sources (shell_backend); g_signal_connect_swapped ( shell, "handle-uri", - G_CALLBACK (task_module_handle_uri_cb), shell_module); + G_CALLBACK (task_module_handle_uri_cb), shell_backend); g_signal_connect_swapped ( shell, "window-created", - G_CALLBACK (task_module_window_created_cb), shell_module); + G_CALLBACK (task_module_window_created_cb), shell_backend); } diff --git a/calendar/modules/e-task-shell-backend.h b/calendar/modules/e-task-shell-backend.h new file mode 100644 index 0000000000..d57eb12fd1 --- /dev/null +++ b/calendar/modules/e-task-shell-backend.h @@ -0,0 +1,67 @@ +/* + * e-task-shell-backend.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef E_TASK_SHELL_BACKEND_H +#define E_TASK_SHELL_BACKEND_H + +#include <shell/e-shell-backend.h> + +/* Standard GObject macros */ +#define E_TYPE_TASK_SHELL_BACKEND \ + (e_task_shell_backend_type) +#define E_TASK_SHELL_BACKEND(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TASK_SHELL_BACKEND, ETaskShellBackend)) +#define E_TASK_SHELL_BACKEND_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TASK_SHELL_BACKEND, ETaskShellBackendClass)) +#define E_IS_TASK_SHELL_BACKEND(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TASK_SHELL_BACKEND)) +#define E_IS_TASK_SHELL_BACKEND_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TASK_SHELL_BACKEND)) +#define E_TASK_SHELL_BACKEND_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TASK_SHELL_BACKEND, ETaskShellBackendClass)) + +G_BEGIN_DECLS + +extern GType e_task_shell_backend_type; + +typedef struct _ETaskShellBackend ETaskShellBackend; +typedef struct _ETaskShellBackendClass ETaskShellBackendClass; +typedef struct _ETaskShellBackendPrivate ETaskShellBackendPrivate; + +struct _ETaskShellBackend { + EShellBackend parent; + ETaskShellBackendPrivate *priv; +}; + +struct _ETaskShellBackendClass { + EShellBackendClass parent_class; +}; + +GType e_task_shell_backend_get_type (GTypeModule *type_module); + +G_END_DECLS + +#endif /* E_TASK_SHELL_BACKEND_H */ diff --git a/calendar/modules/e-task-shell-module-migrate.c b/calendar/modules/e-task-shell-migrate.c index 2bd34e89a9..4658215f06 100644 --- a/calendar/modules/e-task-shell-module-migrate.c +++ b/calendar/modules/e-task-shell-migrate.c @@ -1,5 +1,5 @@ /* - * e-task-shell-module-migrate.c + * e-task-shell-backend-migrate.c * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,7 +19,7 @@ * */ -#include "e-task-shell-module-migrate.h" +#include "e-task-shell-backend-migrate.h" #include <string.h> #include <sys/types.h> @@ -438,7 +438,7 @@ migrate_pilot_data (const char *component, const char *conduit, const char *old_ #endif static void -create_task_sources (EShellModule *shell_module, +create_task_sources (EShellBackend *shell_backend, ESourceList *source_list, ESourceGroup **on_this_computer, ESourceGroup **on_the_web, @@ -453,7 +453,7 @@ create_task_sources (EShellModule *shell_module, *on_the_web = NULL; *personal_source = NULL; - base_dir = e_shell_module_get_config_dir (shell_module); + base_dir = e_shell_backend_get_config_dir (shell_backend); base_uri = g_build_filename (base_dir, "local", NULL); base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL); @@ -531,7 +531,7 @@ create_task_sources (EShellModule *shell_module, } gboolean -e_task_shell_module_migrate (EShellModule *shell_module, +e_task_shell_backend_migrate (EShellBackend *shell_backend, gint major, gint minor, gint micro, @@ -550,7 +550,7 @@ e_task_shell_module_migrate (EShellModule *shell_module, creates the groups/sources or it finds the necessary groups/sources. */ create_task_sources ( - shell_module, source_list, &on_this_computer, + shell_backend, source_list, &on_this_computer, &on_the_web, &personal_source); #ifndef G_OS_WIN32 @@ -623,7 +623,7 @@ e_task_shell_module_migrate (EShellModule *shell_module, char *old_path, *new_path; old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Tasks", NULL); - new_path = g_build_filename (e_shell_module_get_config_dir (shell_module), + new_path = g_build_filename (e_shell_backend_get_config_dir (shell_backend), "local", "system", NULL); migrate_pilot_data ("tasks", "todo", old_path, new_path); g_free (new_path); diff --git a/calendar/modules/e-task-shell-module-migrate.h b/calendar/modules/e-task-shell-migrate.h index b20a342e0d..6853dd818c 100644 --- a/calendar/modules/e-task-shell-module-migrate.h +++ b/calendar/modules/e-task-shell-migrate.h @@ -1,5 +1,5 @@ /* - * e-task-shell-module-migrate.h + * e-task-shell-backend-migrate.h * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,15 +19,15 @@ * */ -#ifndef E_TASK_SHELL_MODULE_MIGRATE_H -#define E_TASK_SHELL_MODULE_MIGRATE_H +#ifndef E_TASK_SHELL_BACKEND_MIGRATE_H +#define E_TASK_SHELL_BACKEND_MIGRATE_H #include <glib.h> -#include <shell/e-shell-module.h> +#include <shell/e-shell-backend.h> G_BEGIN_DECLS -gboolean e_task_shell_module_migrate (EShellModule *shell_module, +gboolean e_task_shell_backend_migrate (EShellBackend *shell_backend, gint major, gint minor, gint micro, @@ -35,4 +35,4 @@ gboolean e_task_shell_module_migrate (EShellModule *shell_module, G_END_DECLS -#endif /* E_TASK_SHELL_MODULE_MIGRATE_H */ +#endif /* E_TASK_SHELL_BACKEND_MIGRATE_H */ diff --git a/calendar/modules/e-task-shell-view-private.c b/calendar/modules/e-task-shell-view-private.c index 9c6a3a94bb..bdafe6862c 100644 --- a/calendar/modules/e-task-shell-view-private.c +++ b/calendar/modules/e-task-shell-view-private.c @@ -652,13 +652,13 @@ e_task_shell_view_set_status_message (ETaskShellView *task_shell_view, { EActivity *activity; EShellView *shell_view; - EShellModule *shell_module; + EShellBackend *shell_backend; g_return_if_fail (E_IS_TASK_SHELL_VIEW (task_shell_view)); activity = task_shell_view->priv->activity; shell_view = E_SHELL_VIEW (task_shell_view); - shell_module = e_shell_view_get_shell_module (shell_view); + shell_backend = e_shell_view_get_shell_backend (shell_view); if (status_message == NULL || *status_message == '\0') { if (activity != NULL) { @@ -670,7 +670,7 @@ e_task_shell_view_set_status_message (ETaskShellView *task_shell_view, } else if (activity == NULL) { activity = e_activity_new (status_message); e_activity_set_percent (activity, percent); - e_shell_module_add_activity (shell_module, activity); + e_shell_backend_add_activity (shell_backend, activity); } else { e_activity_set_percent (activity, percent); |