[evolution/account-mgmt: 20/25] Adapt modules/calendar to the new ESource API.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/account-mgmt: 20/25] Adapt modules/calendar to the new ESource API.
- Date: Tue, 18 Jan 2011 18:48:55 +0000 (UTC)
commit 66410b6e53bc0506e2134451304ce6159af9571f
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Dec 23 08:58:10 2010 -0500
Adapt modules/calendar to the new ESource API.
modules/Makefile.am | 4 +-
modules/calendar/Makefile.am | 6 +-
modules/calendar/e-cal-attachment-handler.c | 35 ++--
modules/calendar/e-cal-shell-backend.c | 345 ++++----------------------
modules/calendar/e-cal-shell-backend.h | 8 -
modules/calendar/e-cal-shell-migrate.c | 221 ----------------
modules/calendar/e-cal-shell-sidebar.c | 197 ++++++---------
modules/calendar/e-cal-shell-sidebar.h | 2 +
modules/calendar/e-cal-shell-view-actions.c | 106 ++++----
modules/calendar/e-cal-shell-view-private.c | 28 ++-
modules/calendar/e-cal-shell-view-private.h | 2 +
modules/calendar/e-calendar-preferences.h | 2 +
modules/calendar/e-memo-shell-backend.c | 268 +++-----------------
modules/calendar/e-memo-shell-backend.h | 8 -
modules/calendar/e-memo-shell-content.c | 2 +-
modules/calendar/e-memo-shell-migrate.c | 248 +------------------
modules/calendar/e-memo-shell-sidebar.c | 162 ++++--------
modules/calendar/e-memo-shell-view-actions.c | 99 ++++----
modules/calendar/e-memo-shell-view-private.h | 2 +
modules/calendar/e-memo-shell-view.h | 1 -
modules/calendar/e-task-shell-backend.c | 268 +++-----------------
modules/calendar/e-task-shell-backend.h | 8 -
modules/calendar/e-task-shell-content.c | 2 +-
modules/calendar/e-task-shell-migrate.c | 164 ------------
modules/calendar/e-task-shell-sidebar.c | 162 ++++--------
modules/calendar/e-task-shell-view-actions.c | 99 ++++----
modules/calendar/e-task-shell-view-private.h | 2 +
modules/calendar/e-task-shell-view.h | 1 -
modules/calendar/evolution-module-calendar.c | 4 +
29 files changed, 508 insertions(+), 1948 deletions(-)
---
diff --git a/modules/Makefile.am b/modules/Makefile.am
index 5c95034..ae95614 100644
--- a/modules/Makefile.am
+++ b/modules/Makefile.am
@@ -18,11 +18,9 @@ if ENABLE_WINDOWS_SENS
WINDOWS_SENS_DIR = windows-sens
endif
-# ACCOUNT_MGMT: Disable SUBDIRS
-# calendar (comes after addressbook)
-
SUBDIRS = \
addressbook \
+ calendar \
mail \
composer-autosave \
mailto-handler \
diff --git a/modules/calendar/Makefile.am b/modules/calendar/Makefile.am
index c725ded..e8b703a 100644
--- a/modules/calendar/Makefile.am
+++ b/modules/calendar/Makefile.am
@@ -11,6 +11,10 @@ libevolution_module_calendar_la_CPPFLAGS = \
$(GNOME_PLATFORM_CFLAGS) \
$(EVOLUTION_CALENDAR_CFLAGS)
+# ACCOUNT_MGMT: Disabled sources:
+# e-calendar-preferences.c
+# e-calendar-preferences.h
+
libevolution_module_calendar_la_SOURCES = \
evolution-module-calendar.c \
e-cal-attachment-handler.c \
@@ -51,8 +55,6 @@ libevolution_module_calendar_la_SOURCES = \
e-cal-shell-view-private.c \
e-cal-shell-view-private.h \
e-cal-shell-view-taskpad.c \
- e-calendar-preferences.c \
- e-calendar-preferences.h \
e-memo-shell-backend.c \
e-memo-shell-backend.h \
e-memo-shell-content.c \
diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c
index a9f5237..c959d51 100644
--- a/modules/calendar/e-cal-attachment-handler.c
+++ b/modules/calendar/e-cal-attachment-handler.c
@@ -25,6 +25,7 @@
#include <libical/ical.h>
#include <libecal/e-cal.h>
#include <camel/camel.h>
+#include <libecal/e-source-calendar.h>
#include <libedataserverui/e-source-selector.h>
#include "calendar/common/authentication.h"
@@ -232,25 +233,29 @@ attachment_handler_run_dialog (GtkWindow *parent,
GtkWidget *container;
GtkWidget *widget;
GCallback callback;
+ ESourceRegistry *registry;
ESourceSelector *selector;
- ESourceList *source_list;
ESource *source;
ECal *client;
+ const gchar *extension_name;
icalcomponent *component;
- GError *error = NULL;
-
- component = attachment_handler_get_component (attachment);
- g_return_if_fail (component != NULL);
- e_cal_get_sources (&source_list, source_type, &error);
- if (error != NULL) {
- g_warning ("%s", error->message);
- g_error_free (error);
- return;
+ switch (source_type) {
+ case E_CAL_SOURCE_TYPE_EVENT:
+ extension_name = E_SOURCE_EXTENSION_CALENDAR;
+ break;
+ case E_CAL_SOURCE_TYPE_TODO:
+ extension_name = E_SOURCE_EXTENSION_TASK_LIST;
+ break;
+ case E_CAL_SOURCE_TYPE_JOURNAL:
+ extension_name = E_SOURCE_EXTENSION_MEMO_LIST;
+ break;
+ default:
+ g_return_if_reached ();
}
- source = e_source_list_peek_source_any (source_list);
- g_return_if_fail (source != NULL);
+ component = attachment_handler_get_component (attachment);
+ g_return_if_fail (component != NULL);
dialog = gtk_dialog_new_with_buttons (
title, parent, GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -282,10 +287,10 @@ attachment_handler_run_dialog (GtkWindow *parent,
container = widget;
- widget = e_source_selector_new (source_list);
+ registry = e_source_registry_get_default ();
+ widget = e_source_selector_new (registry, extension_name);
selector = E_SOURCE_SELECTOR (widget);
- e_source_selector_set_primary_selection (selector, source);
- e_source_selector_show_selection (selector, FALSE);
+ e_source_selector_set_show_toggles (selector, FALSE);
gtk_container_add (GTK_CONTAINER (container), widget);
gtk_widget_show (widget);
diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c
index 960b6c6..b7ebc41 100644
--- a/modules/calendar/e-cal-shell-backend.c
+++ b/modules/calendar/e-cal-shell-backend.c
@@ -25,20 +25,21 @@
#include <glib/gi18n.h>
#include <libecal/e-cal.h>
#include <libecal/e-cal-time-util.h>
+#include <libecal/e-source-calendar.h>
#include <libedataserver/e-url.h>
#include <libedataserver/e-source.h>
-#include <libedataserver/e-source-group.h>
#include "e-util/e-import.h"
#include "shell/e-shell.h"
#include "shell/e-shell-backend.h"
#include "shell/e-shell-window.h"
#include "widgets/misc/e-preferences-window.h"
+#include "widgets/misc/e-source-config-dialog.h"
#include "calendar/common/authentication.h"
#include "calendar/gui/comp-util.h"
-#include "calendar/gui/dialogs/calendar-setup.h"
#include "calendar/gui/dialogs/event-editor.h"
+#include "calendar/gui/e-cal-source-config.h"
#include "calendar/gui/e-calendar-view.h"
#include "calendar/gui/gnome-cal.h"
#include "calendar/importers/evolution-calendar-importer.h"
@@ -56,178 +57,13 @@
((obj), E_TYPE_CAL_SHELL_BACKEND, ECalShellBackendPrivate))
struct _ECalShellBackendPrivate {
- ESourceList *source_list;
-};
-
-enum {
- PROP_0,
- PROP_SOURCE_LIST
+ gint placeholder;
};
static gpointer parent_class;
static GType cal_shell_backend_type;
static void
-cal_shell_backend_ensure_sources (EShellBackend *shell_backend)
-{
- /* XXX This is basically the same algorithm across all backends.
- * Maybe we could somehow integrate this into EShellBackend? */
-
- ECalShellBackend *cal_shell_backend;
- ESourceGroup *on_this_computer;
- ESourceGroup *contacts;
- ESourceList *source_list;
- ESource *birthdays;
- ESource *personal;
- EShell *shell;
- EShellSettings *shell_settings;
- GSList *sources, *iter;
- const gchar *name;
- gchar *property;
- gboolean save_list = FALSE;
-
- birthdays = NULL;
- personal = NULL;
-
- cal_shell_backend = E_CAL_SHELL_BACKEND (shell_backend);
-
- shell = e_shell_backend_get_shell (shell_backend);
- shell_settings = e_shell_get_shell_settings (shell);
-
- if (!e_cal_get_sources (
- &cal_shell_backend->priv->source_list,
- E_CAL_SOURCE_TYPE_EVENT, NULL)) {
- g_warning ("Could not get calendar sources from GConf!");
- return;
- }
-
- source_list = cal_shell_backend->priv->source_list;
-
- on_this_computer = e_source_list_ensure_group (
- source_list, _("On This Computer"), "local:", TRUE);
- contacts = e_source_list_ensure_group (
- source_list, _("Contacts"), "contacts://", TRUE);
- e_source_list_ensure_group (
- source_list, _("On The Web"), "webcal://", FALSE);
- e_source_list_ensure_group (
- source_list, _("Weather"), "weather://", FALSE);
-
- g_return_if_fail (on_this_computer != NULL);
- g_return_if_fail (contacts != NULL);
-
- sources = e_source_group_peek_sources (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 (g_strcmp0 (relative_uri, "system") == 0) {
- personal = source;
- break;
- }
- }
-
- name = _("Personal");
-
- if (personal == NULL) {
- ESource *source;
- GSList *selected;
- gchar *primary;
-
- source = e_source_new (name, "system");
- e_source_set_color_spec (source, "#BECEDD");
- e_source_group_add_source (on_this_computer, source, -1);
- g_object_unref (source);
- save_list = TRUE;
-
- primary = e_shell_settings_get_string (
- shell_settings, "cal-primary-calendar");
-
- selected = e_cal_shell_backend_get_selected_calendars (
- cal_shell_backend);
-
- if (primary == NULL && selected == NULL) {
- const gchar *uid;
-
- uid = e_source_peek_uid (source);
- selected = g_slist_prepend (NULL, g_strdup (uid));
-
- e_shell_settings_set_string (
- shell_settings, "cal-primary-calendar", uid);
- e_cal_shell_backend_set_selected_calendars (
- cal_shell_backend, selected);
- }
-
- g_slist_foreach (selected, (GFunc) g_free, NULL);
- g_slist_free (selected);
- g_free (primary);
- } else {
- /* Force the source name to the current locale. */
- e_source_set_name (personal, name);
- }
-
- 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);
- save_list = TRUE;
- }
- }
-
- /* 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);
-
- name = _("Birthdays & Anniversaries");
-
- if (birthdays == NULL) {
- ESource *source;
-
- source = e_source_new (name, "/");
- e_source_group_add_source (contacts, source, -1);
- g_object_unref (source);
- save_list = TRUE;
-
- /* This is now a borrowed reference. */
- birthdays = source;
- } else {
- /* Force the source name to the current locale. */
- e_source_set_name (birthdays, name);
- }
-
- 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");
-
- g_object_unref (on_this_computer);
- g_object_unref (contacts);
-
- if (save_list)
- e_source_list_sync (source_list, NULL);
-}
-
-static void
cal_shell_backend_new_event (ESource *source,
GAsyncResult *result,
EShell *shell,
@@ -238,10 +74,16 @@ cal_shell_backend_new_event (ESource *source,
ECalComponent *comp;
EShellSettings *shell_settings;
CompEditor *editor;
+ GError *error = NULL;
/* XXX Handle errors better. */
- cal = e_load_cal_source_finish (source, result, NULL);
- g_return_if_fail (E_IS_CAL (cal));
+ cal = e_load_cal_source_finish (source, result, &error);
+ if (error != NULL) {
+ g_warn_if_fail (cal == NULL);
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ return;
+ }
shell_settings = e_shell_get_shell_settings (shell);
@@ -320,13 +162,12 @@ action_event_new_cb (GtkAction *action,
{
EShell *shell;
EShellView *shell_view;
- EShellBackend *shell_backend;
- EShellSettings *shell_settings;
- ESource *source = NULL;
- ESourceList *source_list;
+ ESource *source;
+ ESourceRegistry *registry;
ECalSourceType source_type;
const gchar *action_name;
- gchar *uid;
+
+ shell = e_shell_window_get_shell (shell_window);
/* With a 'calendar' active shell view pass the new appointment
* request to it, thus the event will inherit selected time from
@@ -363,25 +204,8 @@ action_event_new_cb (GtkAction *action,
source_type = E_CAL_SOURCE_TYPE_EVENT;
- shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
- shell_backend = e_shell_get_backend_by_name (shell, "calendar");
-
- g_object_get (shell_backend, "source-list", &source_list, NULL);
- g_return_if_fail (E_IS_SOURCE_LIST (source_list));
-
- uid = e_shell_settings_get_string (
- shell_settings, "cal-primary-calendar");
-
- if (uid != NULL) {
- source = e_source_list_peek_source_by_uid (source_list, uid);
- g_free (uid);
- }
-
- if (source == NULL)
- source = e_source_list_peek_default_source (source_list);
-
- g_return_if_fail (E_IS_SOURCE (source));
+ registry = e_source_registry_get_default ();
+ source = e_source_registry_get_default_calendar (registry);
/* Use a callback function appropriate for the action.
* FIXME Need to obtain a better default time zone. */
@@ -407,15 +231,33 @@ action_event_new_cb (GtkAction *action,
NULL, (GAsyncReadyCallback)
cal_shell_backend_event_new_cb,
g_object_ref (shell));
-
- g_object_unref (source_list);
}
static void
action_calendar_new_cb (GtkAction *action,
EShellWindow *shell_window)
{
- calendar_setup_new_calendar (GTK_WINDOW (shell_window));
+ ECalSourceType source_type;
+ ESourceRegistry *registry;
+ GtkWidget *config;
+ GtkWidget *dialog;
+ const gchar *icon_name;
+
+ source_type = E_CAL_SOURCE_TYPE_EVENT;
+ registry = e_source_registry_get_default ();
+ config = e_cal_source_config_new (registry, NULL, source_type);
+
+ dialog = e_source_config_dialog_new (
+ E_SOURCE_CONFIG (config), GTK_WINDOW (shell_window));
+
+ icon_name = gtk_action_get_icon_name (action);
+ gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), _("New Calendar"));
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+
+ gtk_widget_destroy (dialog);
}
static GtkActionEntry item_entries[] = {
@@ -492,7 +334,7 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
ECal *client;
ECalComponent *comp;
ESource *source;
- ESourceList *source_list;
+ ESourceRegistry *registry;
ECalSourceType source_type;
EUri *euri;
icalcomponent *icalcomp;
@@ -589,15 +431,10 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
* we successfully open it is another matter... */
handled = TRUE;
- if (!e_cal_get_sources (&source_list, source_type, NULL)) {
- g_printerr ("Could not get calendar sources from GConf!\n");
- goto exit;
- }
-
- source = e_source_list_peek_source_by_uid (source_list, source_uid);
+ registry = e_source_registry_get_default ();
+ source = e_source_registry_lookup_by_uid (registry, source_uid);
if (source == NULL) {
g_printerr ("No source for UID '%s'\n", source_uid);
- g_object_unref (source_list);
goto exit;
}
@@ -607,7 +444,6 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
g_printerr ("%s\n", error->message);
g_error_free (error);
}
- g_object_unref (source_list);
goto exit;
}
@@ -621,7 +457,6 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
if (!e_cal_get_object (client, comp_uid, comp_rid, &icalcomp, &error)) {
g_printerr ("%s\n", error->message);
- g_object_unref (source_list);
g_error_free (error);
goto exit;
}
@@ -651,7 +486,6 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
present:
gtk_window_present (GTK_WINDOW (editor));
- g_object_unref (source_list);
g_object_unref (client);
exit:
@@ -685,40 +519,6 @@ cal_shell_backend_window_created_cb (EShellBackend *shell_backend,
}
static void
-cal_shell_backend_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_backend_get_source_list (
- E_CAL_SHELL_BACKEND (object)));
- return;
- }
-
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-
-static void
-cal_shell_backend_dispose (GObject *object)
-{
- ECalShellBackendPrivate *priv;
-
- priv = E_CAL_SHELL_BACKEND_GET_PRIVATE (object);
-
- if (priv->source_list != NULL) {
- g_object_unref (priv->source_list);
- priv->source_list = NULL;
- }
-
- /* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
cal_shell_backend_constructed (GObject *object)
{
EShell *shell;
@@ -728,8 +528,6 @@ cal_shell_backend_constructed (GObject *object)
shell_backend = E_SHELL_BACKEND (object);
shell = e_shell_backend_get_shell (shell_backend);
- cal_shell_backend_ensure_sources (shell_backend);
-
g_signal_connect_swapped (
shell, "handle-uri",
G_CALLBACK (cal_shell_backend_handle_uri_cb),
@@ -747,6 +545,7 @@ cal_shell_backend_constructed (GObject *object)
/* Setup preference widget factories */
preferences_window = e_shell_get_preferences_window (shell);
+#if 0 /* ACCOUNT_MGMT */
e_preferences_window_add_page (
E_PREFERENCES_WINDOW (preferences_window),
"calendar-and-tasks",
@@ -754,6 +553,7 @@ cal_shell_backend_constructed (GObject *object)
_("Calendar and Tasks"),
e_calendar_preferences_new,
600);
+#endif /* ACCOUNT_MGMT */
if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
@@ -769,8 +569,6 @@ cal_shell_backend_class_init (ECalShellBackendClass *class)
g_type_class_add_private (class, sizeof (ECalShellBackendPrivate));
object_class = G_OBJECT_CLASS (class);
- object_class->get_property = cal_shell_backend_get_property;
- object_class->dispose = cal_shell_backend_dispose;
object_class->constructed = cal_shell_backend_constructed;
shell_backend_class = E_SHELL_BACKEND_CLASS (class);
@@ -783,15 +581,8 @@ cal_shell_backend_class_init (ECalShellBackendClass *class)
shell_backend_class->start = NULL;
shell_backend_class->migrate = e_cal_shell_backend_migrate;
- 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));
+ /* Register relevant ESource extensions. */
+ E_TYPE_SOURCE_CALENDAR;
}
static void
@@ -854,50 +645,6 @@ e_cal_shell_backend_register_type (GTypeModule *type_module)
"ECalShellBackend", &type_info, 0);
}
-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;
-}
-
-GSList *
-e_cal_shell_backend_get_selected_calendars (ECalShellBackend *cal_shell_backend)
-{
- GConfClient *client;
- GSList *selected_calendars;
- const gchar *key;
-
- g_return_val_if_fail (
- E_IS_CAL_SHELL_BACKEND (cal_shell_backend), NULL);
-
- client = gconf_client_get_default ();
- key = "/apps/evolution/calendar/display/selected_calendars";
- selected_calendars = gconf_client_get_list (
- client, key, GCONF_VALUE_STRING, NULL);
- g_object_unref (client);
-
- return selected_calendars;
-}
-
-void
-e_cal_shell_backend_set_selected_calendars (ECalShellBackend *cal_shell_backend,
- GSList *selected_calendars)
-{
- GConfClient *client;
- const gchar *key;
-
- g_return_if_fail (E_IS_CAL_SHELL_BACKEND (cal_shell_backend));
-
- client = gconf_client_get_default ();
- key = "/apps/evolution/calendar/display/selected_calendars";
- gconf_client_set_list (
- client, key, GCONF_VALUE_STRING, selected_calendars, NULL);
- g_object_unref (client);
-}
-
void
e_cal_shell_backend_open_date_range (ECalShellBackend *cal_shell_backend,
const GDate *start_date,
diff --git a/modules/calendar/e-cal-shell-backend.h b/modules/calendar/e-cal-shell-backend.h
index 32fca7f..400d769 100644
--- a/modules/calendar/e-cal-shell-backend.h
+++ b/modules/calendar/e-cal-shell-backend.h
@@ -23,7 +23,6 @@
#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 \
@@ -62,13 +61,6 @@ struct _ECalShellBackendClass {
GType e_cal_shell_backend_get_type (void);
void e_cal_shell_backend_register_type
(GTypeModule *type_module);
-ESourceList * e_cal_shell_backend_get_source_list
- (ECalShellBackend *cal_shell_backend);
-GSList * e_cal_shell_backend_get_selected_calendars
- (ECalShellBackend *cal_shell_backend);
-void e_cal_shell_backend_set_selected_calendars
- (ECalShellBackend *cal_shell_backend,
- GSList *selected_calendars);
void e_cal_shell_backend_open_date_range
(ECalShellBackend *cal_shell_backend,
const GDate *start_date,
diff --git a/modules/calendar/e-cal-shell-migrate.c b/modules/calendar/e-cal-shell-migrate.c
index 3ef6e55..589948e 100644
--- a/modules/calendar/e-cal-shell-migrate.c
+++ b/modules/calendar/e-cal-shell-migrate.c
@@ -21,187 +21,6 @@
#include "e-cal-shell-migrate.h"
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#include <glib/gi18n.h>
-#include <glib/gstdio.h>
-#include <libebackend/e-dbhash.h>
-#include <libedataserver/e-source.h>
-#include <libedataserver/e-source-group.h>
-#include <libedataserver/e-source-list.h>
-#include <libedataserver/e-xml-hash-utils.h>
-
-#include "e-util/e-util-private.h"
-#include "calendar/gui/calendar-config-keys.h"
-#include "calendar/gui/e-cal-event.h"
-#include "shell/e-shell.h"
-
-#include "e-cal-shell-backend.h"
-
-#define LOCAL_BASE_URI "local:"
-#define WEBCAL_BASE_URI "webcal://"
-#define CONTACTS_BASE_URI "contacts://"
-#define BAD_CONTACTS_BASE_URI "contact://"
-#define PERSONAL_RELATIVE_URI "system"
-
-static ESourceGroup *
-create_calendar_contact_source (ESourceList *source_list)
-{
- ESourceGroup *group;
- ESource *source;
-
- /* Create the contacts group */
- group = e_source_group_new (_("Contacts"), CONTACTS_BASE_URI);
- e_source_list_add_group (source_list, group, -1);
-
- source = e_source_new (_("Birthdays & Anniversaries"), "/");
- e_source_group_add_source (group, source, -1);
- g_object_unref (source);
-
- e_source_set_color_spec (source, "#FED4D3");
- e_source_group_set_readonly (group, TRUE);
-
- return group;
-}
-
-static void
-create_calendar_sources (EShellBackend *shell_backend,
- ESourceList *source_list,
- ESourceGroup **on_this_computer,
- ESource **personal_source,
- ESourceGroup **on_the_web,
- ESourceGroup **contacts)
-{
- EShell *shell;
- EShellSettings *shell_settings;
- GSList *groups;
- ESourceGroup *group;
-
- *on_this_computer = NULL;
- *on_the_web = NULL;
- *contacts = NULL;
- *personal_source = NULL;
-
- shell = e_shell_backend_get_shell (shell_backend);
- shell_settings = e_shell_get_shell_settings (shell);
-
- groups = e_source_list_peek_groups (source_list);
- if (groups) {
- /* groups are already there, we need to search for things... */
- GSList *g;
- gchar *base_dir, *base_uri;
-
- base_dir = g_build_filename (e_shell_backend_get_data_dir (shell_backend), "local", NULL);
- base_uri = g_filename_to_uri (base_dir, NULL, NULL);
-
- for (g = groups; g; g = g->next) {
-
- group = E_SOURCE_GROUP (g->data);
-
- if (!strcmp (BAD_CONTACTS_BASE_URI, e_source_group_peek_base_uri (group)))
- e_source_group_set_base_uri (group, CONTACTS_BASE_URI);
-
- if (!strcmp (base_uri, e_source_group_peek_base_uri (group)))
- e_source_group_set_base_uri (group, LOCAL_BASE_URI);
-
- if (!*on_this_computer && !strcmp (LOCAL_BASE_URI,
- e_source_group_peek_base_uri (group)))
- *on_this_computer = g_object_ref (group);
-
- else if (!*on_the_web && !strcmp (WEBCAL_BASE_URI,
- e_source_group_peek_base_uri (group)))
- *on_the_web = g_object_ref (group);
-
- else if (!*contacts && !strcmp (CONTACTS_BASE_URI,
- e_source_group_peek_base_uri (group)))
- *contacts = g_object_ref (group);
- }
-
- g_free (base_dir);
- g_free (base_uri);
- }
-
- if (*on_this_computer) {
- /* make sure "Personal" shows up as a source under
- this group */
- GSList *sources = e_source_group_peek_sources (*on_this_computer);
- GSList *s;
- for (s = sources; s; s = s->next) {
- ESource *source = E_SOURCE (s->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)) {
- *personal_source = g_object_ref (source);
- break;
- }
- }
- } else {
- /* create the local source group */
- group = e_source_group_new (_("On This Computer"), LOCAL_BASE_URI);
- e_source_list_add_group (source_list, group, -1);
-
- *on_this_computer = group;
- }
-
- if (!*personal_source) {
- GSList *selected;
- gchar *primary_calendar;
-
- /* Create the default Person calendar */
- ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
- e_source_group_add_source (*on_this_computer, source, -1);
-
- primary_calendar = e_shell_settings_get_string (
- shell_settings, "cal-primary-calendar");
-
- selected = e_cal_shell_backend_get_selected_calendars (
- E_CAL_SHELL_BACKEND (shell_backend));
-
- if (primary_calendar == NULL && selected == NULL) {
- GSList link;
-
- e_shell_settings_set_string (
- shell_settings, "cal-primary-calendar",
- e_source_peek_uid (source));
-
- link.data = (gpointer)e_source_peek_uid (source);
- link.next = NULL;
-
- e_cal_shell_backend_set_selected_calendars (
- E_CAL_SHELL_BACKEND (shell_backend), &link);
- }
-
- g_slist_foreach (selected, (GFunc) g_free, NULL);
- g_slist_free (selected);
-
- g_free (primary_calendar);
- e_source_set_color_spec (source, "#BECEDD");
- *personal_source = source;
- }
-
- if (!*on_the_web) {
- /* Create the Webcal source group */
- group = e_source_group_new (_("On The Web"), WEBCAL_BASE_URI);
- e_source_list_add_group (source_list, group, -1);
-
- *on_the_web = group;
- }
-
- if (!*contacts) {
- group = create_calendar_contact_source (source_list);
-
- *contacts = group;
- }
-}
-
gboolean
e_cal_shell_backend_migrate (EShellBackend *shell_backend,
gint major,
@@ -209,46 +28,6 @@ e_cal_shell_backend_migrate (EShellBackend *shell_backend,
gint micro,
GError **error)
{
- ESourceGroup *on_this_computer = NULL, *on_the_web = NULL, *contacts = NULL;
- ESource *personal_source = NULL;
- ESourceList *source_list;
- ECalEvent *ece;
- ECalEventTargetBackend *target;
-
- g_object_get (shell_backend, "source-list", &source_list, NULL);
-
- /* we call this unconditionally now - create_groups either
- creates the groups/sources or it finds the necessary
- groups/sources. */
- create_calendar_sources (
- shell_backend, source_list, &on_this_computer,
- &personal_source, &on_the_web, &contacts);
-
- e_source_list_sync (source_list, NULL);
-
- /** @Event: component.migration
- * @Title: Migration step in component initialization
- * @Target: ECalEventTargetComponent
- *
- * component.migration is emitted during the calendar component
- * initialization process. This allows new calendar backend types
- * to be distributed as an e-d-s backend and a plugin without
- * reaching their grubby little fingers into migration.c
- */
- /* Fire off migration event */
- ece = e_cal_event_peek ();
- target = e_cal_event_target_new_module (ece, shell_backend, source_list, 0);
- e_event_emit ((EEvent *) ece, "module.migration", (EEventTarget *) target);
-
- if (on_this_computer)
- g_object_unref (on_this_computer);
- if (on_the_web)
- g_object_unref (on_the_web);
- if (contacts)
- g_object_unref (contacts);
- if (personal_source)
- g_object_unref (personal_source);
-
return TRUE;
}
diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c
index 45bb5a3..70e34b0 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -45,6 +45,7 @@ struct _ECalShellSidebarPrivate {
GtkWidget *paned;
GtkWidget *selector;
GtkWidget *date_navigator;
+ GtkWidget *new_calendar_button;
/* UID -> Client */
GHashTable *client_table;
@@ -122,7 +123,7 @@ cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar,
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
source = e_cal_get_source (client);
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
g_object_ref (source);
@@ -141,18 +142,32 @@ cal_shell_sidebar_backend_error_cb (ECalShellSidebar *cal_shell_sidebar,
ECal *client)
{
EShellView *shell_view;
+ EShellContent *shell_content;
EShellSidebar *shell_sidebar;
- ESourceGroup *source_group;
+ ESource *parent;
ESource *source;
+ GNode *node;
+ const gchar *parent_display_name;
+ const gchar *source_display_name;
shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
source = e_cal_get_source (client);
- source_group = e_source_peek_group (source);
- e_alert_submit (E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)),
- "calendar:backend-error", e_source_group_peek_name (source_group), e_source_peek_name (source), message, NULL);
+ node = e_source_get_node (source);
+ g_return_if_fail (node != NULL);
+ g_return_if_fail (node->parent != NULL);
+
+ parent = E_SOURCE (node->parent->data);
+
+ parent_display_name = e_source_get_display_name (parent);
+ source_display_name = e_source_get_display_name (source);
+
+ e_alert_submit (
+ E_ALERT_SINK (shell_content), "calendar:backend-error",
+ parent_display_name, source_display_name, message, NULL);
}
static void
@@ -294,7 +309,7 @@ cal_shell_sidebar_set_default (ECalShellSidebar *cal_shell_sidebar,
priv->loading_default_client = NULL;
}
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
client = g_hash_table_lookup (priv->client_table, uid);
/* If we already have an open connection for
@@ -325,15 +340,8 @@ cal_shell_sidebar_row_changed_cb (ECalShellSidebar *cal_shell_sidebar,
ESourceSelector *selector;
ESource *source;
- /* XXX ESourceSelector's underlying tree store has only one
- * column: ESource objects. While we're not supposed to
- * know this, listening for "row-changed" signals from
- * the model is easier to deal with than the selector's
- * "selection-changed" signal, which doesn't tell you
- * _which_ row changed. */
-
selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
- gtk_tree_model_get (tree_model, tree_iter, 0, &source, -1);
+ source = e_source_selector_get_source_by_path (selector, tree_path);
/* XXX This signal gets emitted a lot while the model is being
* rebuilt, during which time we won't get a valid ESource.
@@ -350,38 +358,6 @@ cal_shell_sidebar_row_changed_cb (ECalShellSidebar *cal_shell_sidebar,
}
static void
-cal_shell_sidebar_selection_changed_cb (ECalShellSidebar *cal_shell_sidebar,
- ESourceSelector *selector)
-{
- EShellView *shell_view;
- EShellBackend *shell_backend;
- EShellSidebar *shell_sidebar;
- GSList *list, *iter;
-
- /* This signal is emitted less frequently than "row-changed",
- * especially when the model is being rebuilt. So we'll take
- * it easy on poor GConf. */
-
- shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar);
- shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
- shell_backend = e_shell_view_get_shell_backend (shell_view);
-
- list = e_source_selector_get_selection (selector);
-
- for (iter = list; iter != NULL; iter = iter->next) {
- ESource *source = iter->data;
-
- iter->data = (gpointer) e_source_peek_uid (source);
- g_object_unref (source);
- }
-
- e_cal_shell_backend_set_selected_calendars (
- E_CAL_SHELL_BACKEND (shell_backend), list);
-
- g_slist_free (list);
-}
-
-static void
cal_shell_sidebar_primary_selection_changed_cb (ECalShellSidebar *cal_shell_sidebar,
ESourceSelector *selector)
{
@@ -403,12 +379,10 @@ cal_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
EShell *shell;
EShellBackend *shell_backend;
EShellSettings *shell_settings;
+ ESourceRegistry *registry;
ESourceSelector *selector;
- ESourceList *source_list;
- ESource *source;
GConfBridge *bridge;
GtkTreeModel *model;
- GSList *list, *iter;
GObject *object;
const gchar *key;
@@ -423,8 +397,7 @@ cal_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
selector = E_SOURCE_SELECTOR (priv->selector);
model = gtk_tree_view_get_model (GTK_TREE_VIEW (selector));
- source_list = e_cal_shell_backend_get_source_list (
- E_CAL_SHELL_BACKEND (shell_backend));
+ registry = e_source_registry_get_default ();
g_signal_connect_swapped (
model, "row-changed",
@@ -443,31 +416,9 @@ cal_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
G_BINDING_SYNC_CREATE,
(GBindingTransformFunc) e_binding_transform_uid_to_source,
(GBindingTransformFunc) e_binding_transform_source_to_uid,
- g_object_ref (source_list),
+ g_object_ref (registry),
(GDestroyNotify) g_object_unref);
- list = e_cal_shell_backend_get_selected_calendars (
- E_CAL_SHELL_BACKEND (shell_backend));
-
- for (iter = list; iter != NULL; iter = iter->next) {
- const gchar *uid = iter->data;
-
- source = e_source_list_peek_source_by_uid (source_list, uid);
-
- if (source != NULL)
- e_source_selector_select_source (selector, source);
- }
-
- g_slist_foreach (list, (GFunc) g_free, NULL);
- g_slist_free (list);
-
- /* Listen for subsequent changes to the selector. */
-
- g_signal_connect_swapped (
- selector, "selection-changed",
- G_CALLBACK (cal_shell_sidebar_selection_changed_cb),
- shell_sidebar);
-
/* Bind GObject properties to GConf keys. */
bridge = gconf_bridge_get ();
@@ -531,6 +482,11 @@ cal_shell_sidebar_dispose (GObject *object)
priv->date_navigator = NULL;
}
+ if (priv->new_calendar_button != NULL) {
+ g_object_unref (priv->new_calendar_button);
+ priv->new_calendar_button = NULL;
+ }
+
if (priv->default_client != NULL) {
g_object_unref (priv->default_client);
priv->default_client = NULL;
@@ -562,21 +518,6 @@ cal_shell_sidebar_finalize (GObject *object)
}
static void
-new_calendar_clicked (GtkButton *button,
- EShellSidebar *shell_sidebar)
-{
- EShellView *shell_view;
- EShellWindow *shell_window;
- EShellBackend *shell_backend;
-
- 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);
-
- calendar_setup_new_calendar (GTK_WINDOW (shell_window));
-}
-
-static void
cal_shell_sidebar_constructed (GObject *object)
{
ECalShellSidebarPrivate *priv;
@@ -586,7 +527,7 @@ cal_shell_sidebar_constructed (GObject *object)
EShellBackend *shell_backend;
EShellSidebar *shell_sidebar;
EShellSettings *shell_settings;
- ESourceList *source_list;
+ ESourceRegistry *registry;
ECalendarItem *calitem;
GtkWidget *container;
GtkWidget *widget;
@@ -605,9 +546,6 @@ cal_shell_sidebar_constructed (GObject *object)
shell = e_shell_backend_get_shell (shell_backend);
shell_settings = e_shell_get_shell_settings (shell);
- source_list = e_cal_shell_backend_get_source_list (
- E_CAL_SHELL_BACKEND (shell_backend));
-
container = GTK_WIDGET (shell_sidebar);
widget = e_paned_new (GTK_ORIENTATION_VERTICAL);
@@ -617,34 +555,36 @@ cal_shell_sidebar_constructed (GObject *object)
container = widget;
+ widget = gtk_vbox_new (FALSE, 6);
+ gtk_paned_pack1 (GTK_PANED (container), widget, TRUE, TRUE);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ /* "New Calendar" button is only shown in express mode.
+ * ECalShellView will bind the button to an appropriate
+ * GtkAction so we don't have to reimplement it here. */
+ if (e_shell_get_express_mode (shell)) {
+ widget = gtk_button_new ();
+ gtk_box_pack_end (
+ GTK_BOX (container), widget, FALSE, FALSE, 0);
+ priv->new_calendar_button = g_object_ref (widget);
+ gtk_widget_show (widget);
+ }
+
widget = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (
GTK_SCROLLED_WINDOW (widget),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (
GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
- if (!e_shell_get_express_mode (shell)) {
- gtk_paned_pack1 (GTK_PANED (container), widget, TRUE, TRUE);
- } else {
- GtkWidget *button;
-
- container = gtk_vbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
-
- button = gtk_button_new_with_mnemonic (_("_New Calendar..."));
- gtk_box_pack_start (GTK_BOX (container), button, FALSE, FALSE, 0);
- g_signal_connect (
- button, "clicked",
- G_CALLBACK (new_calendar_clicked), shell_sidebar);
-
- gtk_paned_pack1 (GTK_PANED (priv->paned), container, TRUE, TRUE);
- gtk_widget_show_all (container);
- }
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
gtk_widget_show (widget);
container = widget;
- widget = e_calendar_selector_new (source_list);
+ registry = e_source_registry_get_default ();
+ widget = e_calendar_selector_new (registry);
e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE);
gtk_container_add (GTK_CONTAINER (container), widget);
a11y = gtk_widget_get_accessible (widget);
@@ -697,19 +637,20 @@ cal_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
if (source != NULL) {
ECal *client;
- const gchar *uri;
+ const gchar *uid;
const gchar *delete;
- uri = e_source_peek_relative_uri (source);
- is_system = (uri == NULL || strcmp (uri, "system") == 0);
+ uid = e_source_get_uid (source);
+ is_system = (g_strcmp0 (uid, "system") == 0);
can_delete = !is_system;
+#if 0 /* ACCOUNT_MGMT */
delete = e_source_get_property (source, "delete");
can_delete &= (delete == NULL || strcmp (delete, "no") != 0);
+#endif /* ACCOUNT_MGMT */
client = g_hash_table_lookup (
- cal_shell_sidebar->priv->client_table,
- e_source_peek_uid (source));
+ cal_shell_sidebar->priv->client_table, uid);
refresh_supported =
client && e_cal_get_refresh_supported (client);
}
@@ -743,7 +684,7 @@ cal_shell_sidebar_client_removed (ECalShellSidebar *cal_shell_sidebar,
NULL, NULL, cal_shell_sidebar);
source = e_cal_get_source (client);
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
g_hash_table_remove (client_table, uid);
e_source_selector_unselect_source (selector, source);
@@ -918,6 +859,15 @@ e_cal_shell_sidebar_get_default_client (ECalShellSidebar *cal_shell_sidebar)
return cal_shell_sidebar->priv->default_client;
}
+GtkWidget *
+e_cal_shell_sidebar_get_new_calendar_button (ECalShellSidebar *cal_shell_sidebar)
+{
+ g_return_val_if_fail (
+ E_IS_CAL_SHELL_SIDEBAR (cal_shell_sidebar), NULL);
+
+ return cal_shell_sidebar->priv->new_calendar_button;
+}
+
ESourceSelector *
e_cal_shell_sidebar_get_selector (ECalShellSidebar *cal_shell_sidebar)
{
@@ -942,8 +892,8 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
ECal *default_client;
ECal *client;
icaltimezone *timezone;
+ const gchar *display_name;
const gchar *uid;
- const gchar *uri;
gchar *message;
g_return_if_fail (E_IS_CAL_SHELL_SIDEBAR (cal_shell_sidebar));
@@ -954,7 +904,7 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
default_client = cal_shell_sidebar->priv->default_client;
selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
client = g_hash_table_lookup (client_table, uid);
if (client != NULL)
@@ -965,7 +915,7 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
const gchar *default_uid;
default_source = e_cal_get_source (default_client);
- default_uid = e_source_peek_uid (default_source);
+ default_uid = e_source_get_uid (default_source);
if (g_strcmp0 (uid, default_uid) == 0)
client = g_object_ref (default_client);
@@ -989,9 +939,8 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
g_hash_table_insert (client_table, g_strdup (uid), client);
e_source_selector_select_source (selector, source);
- uri = e_cal_get_uri (client);
- /* Translators: The string field is a URI. */
- message = g_strdup_printf (_("Opening calendar at %s"), uri);
+ display_name = e_source_get_display_name (source);
+ message = g_strdup_printf (_("Opening calendar '%s'"), display_name);
cal_shell_sidebar_emit_status_message (cal_shell_sidebar, message);
g_free (message);
@@ -1027,7 +976,7 @@ e_cal_shell_sidebar_remove_source (ECalShellSidebar *cal_shell_sidebar,
client_table = cal_shell_sidebar->priv->client_table;
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
client = g_hash_table_lookup (client_table, uid);
if (client == NULL)
diff --git a/modules/calendar/e-cal-shell-sidebar.h b/modules/calendar/e-cal-shell-sidebar.h
index 6919d7a..c9b6945 100644
--- a/modules/calendar/e-cal-shell-sidebar.h
+++ b/modules/calendar/e-cal-shell-sidebar.h
@@ -88,6 +88,8 @@ ECalendar * e_cal_shell_sidebar_get_date_navigator
(ECalShellSidebar *cal_shell_sidebar);
ECal * e_cal_shell_sidebar_get_default_client
(ECalShellSidebar *cal_shell_sidebar);
+GtkWidget * e_cal_shell_sidebar_get_new_calendar_button
+ (ECalShellSidebar *cal_shell_sidebar);
ESourceSelector *
e_cal_shell_sidebar_get_selector
(ECalShellSidebar *cal_shell_sidebar);
diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c
index 3417875..c0b0a01 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -54,33 +54,16 @@ static void
action_calendar_delete_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
- ECalShellContent *cal_shell_content;
ECalShellSidebar *cal_shell_sidebar;
- EShellBackend *shell_backend;
EShellWindow *shell_window;
EShellView *shell_view;
- ECalendarView *calendar_view;
- GnomeCalendarViewType view_type;
- GnomeCalendar *calendar;
- ECalModel *model;
- ECal *client;
ESourceSelector *selector;
- ESourceGroup *source_group;
- ESourceList *source_list;
ESource *source;
+ GFile *file;
gint response;
- gchar *uri;
- GError *error = NULL;
shell_view = E_SHELL_VIEW (cal_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- shell_backend = e_shell_view_get_shell_backend (shell_view);
-
- cal_shell_content = cal_shell_view->priv->cal_shell_content;
- calendar = e_cal_shell_content_get_calendar (cal_shell_content);
- view_type = gnome_calendar_get_view (calendar);
- calendar_view = gnome_calendar_get_calendar_view (calendar, view_type);
- model = e_calendar_view_get_model (calendar_view);
cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
@@ -91,39 +74,14 @@ action_calendar_delete_cb (GtkAction *action,
response = e_alert_run_dialog_for_args (
GTK_WINDOW (shell_window),
"calendar:prompt-delete-calendar",
- e_source_peek_name (source), NULL);
- if (response != GTK_RESPONSE_YES)
- return;
+ e_source_get_display_name (source), NULL);
- uri = e_source_get_uri (source);
- client = e_cal_model_get_client_for_uri (model, uri);
- if (client == NULL)
- client = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_EVENT);
- g_free (uri);
-
- g_return_if_fail (client != NULL);
-
- if (!e_cal_remove (client, &error)) {
- g_warning ("%s", error->message);
- g_error_free (error);
+ if (response != GTK_RESPONSE_YES)
return;
- }
-
- if (e_source_selector_source_is_selected (selector, source)) {
- e_cal_shell_sidebar_remove_source (
- cal_shell_sidebar, source);
- e_source_selector_unselect_source (selector, source);
- }
- source_group = e_source_peek_group (source);
- e_source_group_remove_source (source_group, source);
-
- source_list = e_cal_shell_backend_get_source_list (
- E_CAL_SHELL_BACKEND (shell_backend));
- if (!e_source_list_sync (source_list, &error)) {
- g_warning ("%s", error->message);
- g_error_free (error);
- }
+ /* FIXME Handle errors. */
+ file = e_source_get_file (source);
+ g_file_delete (file, NULL, NULL);
}
static void
@@ -189,10 +147,30 @@ action_calendar_new_cb (GtkAction *action,
{
EShellView *shell_view;
EShellWindow *shell_window;
+ ESourceRegistry *registry;
+ ECalSourceType source_type;
+ GtkWidget *config;
+ GtkWidget *dialog;
+ const gchar *icon_name;
shell_view = E_SHELL_VIEW (cal_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- calendar_setup_new_calendar (GTK_WINDOW (shell_window));
+
+ source_type = E_CAL_SOURCE_TYPE_EVENT;
+ registry = e_source_registry_get_default ();
+ config = e_cal_source_config_new (registry, NULL, source_type);
+
+ dialog = e_source_config_dialog_new (
+ E_SOURCE_CONFIG (config), GTK_WINDOW (shell_window));
+
+ icon_name = gtk_action_get_icon_name (action);
+ gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), _("New Calendar"));
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+
+ gtk_widget_destroy (dialog);
}
static void
@@ -257,11 +235,16 @@ static void
action_calendar_properties_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
- ECalShellSidebar *cal_shell_sidebar;
EShellView *shell_view;
EShellWindow *shell_window;
+ ECalShellSidebar *cal_shell_sidebar;
+ ECalSourceType source_type;
ESource *source;
ESourceSelector *selector;
+ ESourceRegistry *registry;
+ GtkWidget *config;
+ GtkWidget *dialog;
+ const gchar *icon_name;
shell_view = E_SHELL_VIEW (cal_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
@@ -269,12 +252,23 @@ action_calendar_properties_cb (GtkAction *action,
cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
source = e_source_selector_get_primary_selection (selector);
- g_return_if_fail (E_IS_SOURCE (source));
+ g_return_if_fail (source != NULL);
- /* XXX Does this -really- need a source group parameter? */
- calendar_setup_edit_calendar (
- GTK_WINDOW (shell_window), source,
- e_source_peek_group (source));
+ source_type = E_CAL_SOURCE_TYPE_EVENT;
+ registry = e_source_selector_get_registry (selector);
+ config = e_cal_source_config_new (registry, source, source_type);
+
+ dialog = e_source_config_dialog_new (
+ E_SOURCE_CONFIG (config), GTK_WINDOW (shell_window));
+
+ icon_name = gtk_action_get_icon_name (action);
+ gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Calendar Properties"));
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+
+ gtk_widget_destroy (dialog);
}
static void
@@ -355,6 +349,7 @@ static void
action_calendar_refresh_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+#if 0 /* ACCOUNT_MGMT */
ECalShellContent *cal_shell_content;
ECalShellSidebar *cal_shell_sidebar;
ESourceSelector *selector;
@@ -389,6 +384,7 @@ action_calendar_refresh_cb (GtkAction *action,
error->message);
g_error_free (error);
}
+#endif /* ACCOUNT_MGMT */
}
static void
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index 571f355..ece1df7 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -503,6 +503,7 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
EMemoTable *memo_table;
ETaskTable *task_table;
ESourceSelector *selector;
+ GtkWidget *widget;
ECalModel *model;
gint ii;
@@ -530,10 +531,13 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
date_navigator = e_cal_shell_sidebar_get_date_navigator (cal_shell_sidebar);
- /* Give GnomeCalendar a handle to the date navigator, memo and task table. */
gnome_calendar_set_date_navigator (calendar, date_navigator);
- gnome_calendar_set_memo_table (calendar, memo_table ? GTK_WIDGET (memo_table) : NULL);
- gnome_calendar_set_task_table (calendar, task_table ? GTK_WIDGET (task_table) : NULL);
+ if (memo_table != NULL)
+ gnome_calendar_set_memo_table (
+ calendar, GTK_WIDGET (memo_table));
+ if (task_table != NULL)
+ gnome_calendar_set_task_table (
+ calendar, GTK_WIDGET (task_table));
e_calendar_item_set_get_time_callback (
date_navigator->calitem, (ECalendarItemGetTimeCallback)
@@ -649,9 +653,16 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
init_timezone_monitors (cal_shell_view);
e_cal_shell_view_actions_init (cal_shell_view);
e_cal_shell_view_update_sidebar (cal_shell_view);
- e_cal_shell_view_update_search_filter (cal_shell_view);
+ e_cal_shell_view_update_search_filter (cal_shell_view);
e_cal_shell_view_update_timezone (cal_shell_view);
+ /* Express mode only: Bind the "New Calendar"
+ * sidebar button to the appropriate action. */
+ widget = e_cal_shell_sidebar_get_new_calendar_button (cal_shell_sidebar);
+ if (widget != NULL)
+ gtk_activatable_set_related_action (
+ GTK_ACTIVATABLE (widget), ACTION (CALENDAR_NEW));
+
/* Keep the ECalModel in sync with the sidebar. */
g_object_bind_property (
shell_sidebar, "default-client",
@@ -675,12 +686,9 @@ e_cal_shell_view_private_dispose (ECalShellView *cal_shell_view)
ECalShellViewPrivate *priv = cal_shell_view->priv;
gint i;
- /* Calling calendar's save state from here, because it is too late in its dispose */
- if (priv->cal_shell_content)
- e_cal_shell_content_save_state (priv->cal_shell_content);
-
- /* Calling calendar's save state from here, because it is too late in its dispose */
- if (priv->cal_shell_content)
+ /* Calling ECalShellContent's save state from here,
+ * because it is too late in its own dispose(). */
+ if (priv->cal_shell_content != NULL)
e_cal_shell_content_save_state (priv->cal_shell_content);
DISPOSE (priv->cal_shell_backend);
diff --git a/modules/calendar/e-cal-shell-view-private.h b/modules/calendar/e-cal-shell-view-private.h
index d6f37ba..a3d586c 100644
--- a/modules/calendar/e-cal-shell-view-private.h
+++ b/modules/calendar/e-cal-shell-view-private.h
@@ -39,12 +39,14 @@
#include "shell/e-shell-utils.h"
#include "misc/e-popup-action.h"
#include "misc/e-selectable.h"
+#include "misc/e-source-config-dialog.h"
#include "calendar/common/authentication.h"
#include "calendar/gui/calendar-config.h"
#include "calendar/gui/comp-util.h"
#include "calendar/gui/e-cal-list-view.h"
#include "calendar/gui/e-cal-model-tasks.h"
+#include "calendar/gui/e-cal-source-config.h"
#include "calendar/gui/e-calendar-view.h"
#include "calendar/gui/e-day-view.h"
#include "calendar/gui/e-week-view.h"
diff --git a/modules/calendar/e-calendar-preferences.h b/modules/calendar/e-calendar-preferences.h
index ae96fc1..1da05e6 100644
--- a/modules/calendar/e-calendar-preferences.h
+++ b/modules/calendar/e-calendar-preferences.h
@@ -71,7 +71,9 @@ struct _ECalendarPreferences {
/* Alarms tab */
GtkWidget *notify_with_tray;
GtkWidget *scrolled_window;
+#if 0 /* ACCOUNT_MGMT */
ESourceList *alarms_list;
+#endif /* ACCOUNT_MGMT */
GtkWidget *alarm_list_widget;
};
diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c
index 5ce48a6..dc1b066 100644
--- a/modules/calendar/e-memo-shell-backend.c
+++ b/modules/calendar/e-memo-shell-backend.c
@@ -24,19 +24,19 @@
#include <string.h>
#include <glib/gi18n.h>
#include <libecal/e-cal.h>
+#include <libecal/e-source-calendar.h>
#include <libedataserver/e-url.h>
#include <libedataserver/e-source.h>
-#include <libedataserver/e-source-list.h>
-#include <libedataserver/e-source-group.h>
#include "shell/e-shell.h"
#include "shell/e-shell-backend.h"
#include "shell/e-shell-window.h"
+#include "widgets/misc/e-source-config-dialog.h"
#include "calendar/common/authentication.h"
#include "calendar/gui/comp-util.h"
-#include "calendar/gui/dialogs/calendar-setup.h"
#include "calendar/gui/dialogs/memo-editor.h"
+#include "calendar/gui/e-cal-source-config.h"
#include "e-memo-shell-migrate.h"
#include "e-memo-shell-view.h"
@@ -49,116 +49,13 @@
#define PERSONAL_RELATIVE_URI "system"
struct _EMemoShellBackendPrivate {
- ESourceList *source_list;
-};
-
-enum {
- PROP_0,
- PROP_SOURCE_LIST
+ gint placeholder;
};
static gpointer parent_class;
static GType memo_shell_backend_type;
static void
-memo_shell_backend_ensure_sources (EShellBackend *shell_backend)
-{
- /* XXX This is basically the same algorithm across all modules.
- * Maybe we could somehow integrate this into EShellBackend? */
-
- EMemoShellBackend *memo_shell_backend;
- ESourceGroup *on_this_computer;
- ESourceList *source_list;
- ESource *personal;
- EShell *shell;
- EShellSettings *shell_settings;
- GSList *sources, *iter;
- const gchar *name;
- gboolean save_list = FALSE;
-
- personal = NULL;
-
- memo_shell_backend = E_MEMO_SHELL_BACKEND (shell_backend);
-
- shell = e_shell_backend_get_shell (shell_backend);
- shell_settings = e_shell_get_shell_settings (shell);
-
- if (!e_cal_get_sources (
- &memo_shell_backend->priv->source_list,
- E_CAL_SOURCE_TYPE_JOURNAL, NULL)) {
- g_warning ("Could not get memo sources from GConf!");
- return;
- }
-
- source_list = memo_shell_backend->priv->source_list;
-
- on_this_computer = e_source_list_ensure_group (
- source_list, _("On This Computer"), "local:", TRUE);
- e_source_list_ensure_group (
- source_list, _("On The Web"), "webcal://", FALSE);
-
- g_return_if_fail (on_this_computer);
-
- sources = e_source_group_peek_sources (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 (g_strcmp0 (relative_uri, "system") == 0) {
- personal = source;
- break;
- }
- }
-
- name = _("Personal");
-
- if (personal == NULL) {
- ESource *source;
- GSList *selected;
- gchar *primary;
-
- source = e_source_new (name, "system");
- e_source_set_color_spec (source, "#BECEDD");
- e_source_group_add_source (on_this_computer, source, -1);
- g_object_unref (source);
- save_list = TRUE;
-
- primary = e_shell_settings_get_string (
- shell_settings, "cal-primary-memo-list");
-
- selected = e_memo_shell_backend_get_selected_memo_lists (
- memo_shell_backend);
-
- if (primary == NULL && selected == NULL) {
- const gchar *uid;
-
- uid = e_source_peek_uid (source);
- selected = g_slist_prepend (NULL, g_strdup (uid));
-
- e_shell_settings_set_string (
- shell_settings, "cal-primary-memo-list", uid);
- e_memo_shell_backend_set_selected_memo_lists (
- memo_shell_backend, selected);
- }
-
- g_slist_foreach (selected, (GFunc) g_free, NULL);
- g_slist_free (selected);
- g_free (primary);
- } else {
- /* Force the source name to the current locale. */
- e_source_set_name (personal, name);
- }
-
- g_object_unref (on_this_computer);
-
- if (save_list)
- e_source_list_sync (source_list, NULL);
-}
-
-static void
memo_shell_backend_new_memo (ESource *source,
GAsyncResult *result,
EShell *shell,
@@ -218,37 +115,19 @@ action_memo_new_cb (GtkAction *action,
EShellWindow *shell_window)
{
EShell *shell;
- EShellBackend *shell_backend;
- EShellSettings *shell_settings;
- ESource *source = NULL;
- ESourceList *source_list;
+ ESource *source;
+ ESourceRegistry *registry;
ECalSourceType source_type;
const gchar *action_name;
- gchar *uid;
/* This callback is used for both memos and shared memos. */
source_type = E_CAL_SOURCE_TYPE_JOURNAL;
shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
- shell_backend = e_shell_get_backend_by_name (shell, "memos");
-
- g_object_get (shell_backend, "source-list", &source_list, NULL);
- g_return_if_fail (E_IS_SOURCE_LIST (source_list));
- uid = e_shell_settings_get_string (
- shell_settings, "cal-primary-memo-list");
-
- if (uid != NULL) {
- source = e_source_list_peek_source_by_uid (source_list, uid);
- g_free (uid);
- }
-
- if (source == NULL)
- source = e_source_list_peek_default_source (source_list);
-
- g_return_if_fail (E_IS_SOURCE (source));
+ registry = e_source_registry_get_default ();
+ source = e_source_registry_get_default_memo_list (registry);
/* Use a callback function appropriate for the action.
* FIXME Need to obtain a better default time zone. */
@@ -267,15 +146,33 @@ action_memo_new_cb (GtkAction *action,
NULL, (GAsyncReadyCallback)
memo_shell_backend_memo_new_cb,
g_object_ref (shell));
-
- g_object_unref (source_list);
}
static void
action_memo_list_new_cb (GtkAction *action,
EShellWindow *shell_window)
{
- calendar_setup_new_memo_list (GTK_WINDOW (shell_window));
+ ECalSourceType source_type;
+ ESourceRegistry *registry;
+ GtkWidget *config;
+ GtkWidget *dialog;
+ const gchar *icon_name;
+
+ source_type = E_CAL_SOURCE_TYPE_JOURNAL;
+ registry = e_source_registry_get_default ();
+ config = e_cal_source_config_new (registry, NULL, source_type);
+
+ dialog = e_source_config_dialog_new (
+ E_SOURCE_CONFIG (config), GTK_WINDOW (shell_window));
+
+ icon_name = gtk_action_get_icon_name (action);
+ gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), _("New Memo List"));
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+
+ gtk_widget_destroy (dialog);
}
static GtkActionEntry item_entries[] = {
@@ -315,7 +212,7 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
ECal *client;
ECalComponent *comp;
ESource *source;
- ESourceList *source_list;
+ ESourceRegistry *registry;
ECalSourceType source_type;
EUri *euri;
icalcomponent *icalcomp;
@@ -379,15 +276,10 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
* we successfully open it is another matter... */
handled = TRUE;
- if (!e_cal_get_sources (&source_list, source_type, NULL)) {
- g_printerr ("Could not get memo sources from GConf!\n");
- goto exit;
- }
-
- source = e_source_list_peek_source_by_uid (source_list, source_uid);
+ registry = e_source_registry_get_default ();
+ source = e_source_registry_lookup_by_uid (registry, source_uid);
if (source == NULL) {
g_printerr ("No source for UID '%s'\n", source_uid);
- g_object_unref (source_list);
goto exit;
}
@@ -397,7 +289,6 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
g_printerr ("%s\n", error->message);
g_error_free (error);
}
- g_object_unref (source_list);
goto exit;
}
@@ -411,7 +302,6 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
if (!e_cal_get_object (client, comp_uid, comp_rid, &icalcomp, &error)) {
g_printerr ("%s\n", error->message);
- g_object_unref (source_list);
g_error_free (error);
goto exit;
}
@@ -433,7 +323,6 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
present:
gtk_window_present (GTK_WINDOW (editor));
- g_object_unref (source_list);
g_object_unref (client);
exit:
@@ -467,40 +356,6 @@ memo_shell_backend_window_created_cb (EShellBackend *shell_backend,
}
static void
-memo_shell_backend_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_backend_get_source_list (
- E_MEMO_SHELL_BACKEND (object)));
- return;
- }
-
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-
-static void
-memo_shell_backend_dispose (GObject *object)
-{
- EMemoShellBackendPrivate *priv;
-
- priv = E_MEMO_SHELL_BACKEND_GET_PRIVATE (object);
-
- if (priv->source_list != NULL) {
- g_object_unref (priv->source_list);
- priv->source_list = NULL;
- }
-
- /* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
memo_shell_backend_constructed (GObject *object)
{
EShell *shell;
@@ -509,8 +364,6 @@ memo_shell_backend_constructed (GObject *object)
shell_backend = E_SHELL_BACKEND (object);
shell = e_shell_backend_get_shell (shell_backend);
- memo_shell_backend_ensure_sources (shell_backend);
-
g_signal_connect_swapped (
shell, "handle-uri",
G_CALLBACK (memo_shell_backend_handle_uri_cb),
@@ -535,8 +388,6 @@ memo_shell_backend_class_init (EMemoShellBackendClass *class)
g_type_class_add_private (class, sizeof (EMemoShellBackendPrivate));
object_class = G_OBJECT_CLASS (class);
- object_class->get_property = memo_shell_backend_get_property;
- object_class->dispose = memo_shell_backend_dispose;
object_class->constructed = memo_shell_backend_constructed;
shell_backend_class = E_SHELL_BACKEND_CLASS (class);
@@ -549,15 +400,8 @@ memo_shell_backend_class_init (EMemoShellBackendClass *class)
shell_backend_class->start = NULL;
shell_backend_class->migrate = e_memo_shell_backend_migrate;
- 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));
+ /* Register relevant ESource extensions. */
+ E_TYPE_SOURCE_MEMO_LIST;
}
static void
@@ -593,47 +437,3 @@ e_memo_shell_backend_register_type (GTypeModule *type_module)
type_module, E_TYPE_SHELL_BACKEND,
"EMemoShellBackend", &type_info, 0);
}
-
-ESourceList *
-e_memo_shell_backend_get_source_list (EMemoShellBackend *memo_shell_backend)
-{
- g_return_val_if_fail (
- E_IS_MEMO_SHELL_BACKEND (memo_shell_backend), NULL);
-
- return memo_shell_backend->priv->source_list;
-}
-
-GSList *
-e_memo_shell_backend_get_selected_memo_lists (EMemoShellBackend *memo_shell_backend)
-{
- GConfClient *client;
- GSList *selected_memo_lists;
- const gchar *key;
-
- g_return_val_if_fail (
- E_IS_MEMO_SHELL_BACKEND (memo_shell_backend), NULL);
-
- client = gconf_client_get_default ();
- key = "/apps/evolution/calendar/memos/selected_memos";
- selected_memo_lists = gconf_client_get_list (
- client, key, GCONF_VALUE_STRING, NULL);
- g_object_unref (client);
-
- return selected_memo_lists;
-}
-
-void
-e_memo_shell_backend_set_selected_memo_lists (EMemoShellBackend *memo_shell_backend,
- GSList *selected_memo_lists)
-{
- GConfClient *client;
- const gchar *key;
-
- g_return_if_fail (E_IS_MEMO_SHELL_BACKEND (memo_shell_backend));
-
- client = gconf_client_get_default ();
- key = "/apps/evolution/calendar/memos/selected_memos";
- gconf_client_set_list (
- client, key, GCONF_VALUE_STRING, selected_memo_lists, NULL);
- g_object_unref (client);
-}
diff --git a/modules/calendar/e-memo-shell-backend.h b/modules/calendar/e-memo-shell-backend.h
index 8a005c4..44b0384 100644
--- a/modules/calendar/e-memo-shell-backend.h
+++ b/modules/calendar/e-memo-shell-backend.h
@@ -23,7 +23,6 @@
#define E_MEMO_SHELL_BACKEND_H
#include <shell/e-shell-backend.h>
-#include <libedataserver/e-source-list.h>
/* Standard GObject macros */
#define E_TYPE_MEMO_SHELL_BACKEND \
@@ -62,13 +61,6 @@ struct _EMemoShellBackendClass {
GType e_memo_shell_backend_get_type (void);
void e_memo_shell_backend_register_type
(GTypeModule *type_module);
-ESourceList * e_memo_shell_backend_get_source_list
- (EMemoShellBackend *memo_shell_backend);
-GSList * e_memo_shell_backend_get_selected_memo_lists
- (EMemoShellBackend *memo_shell_backend);
-void e_memo_shell_backend_set_selected_memo_lists
- (EMemoShellBackend *memo_shell_backend,
- GSList *selected_memo_lists);
G_END_DECLS
diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c
index a9d299e..2ad23f4 100644
--- a/modules/calendar/e-memo-shell-content.c
+++ b/modules/calendar/e-memo-shell-content.c
@@ -116,7 +116,7 @@ memo_shell_content_table_foreach_cb (gint model_row,
const gchar *source_uid;
source = e_cal_get_source (comp_data->client);
- source_uid = e_source_peek_uid (source);
+ source_uid = e_source_get_uid (source);
foreach_data->list = g_slist_prepend (
foreach_data->list,
diff --git a/modules/calendar/e-memo-shell-migrate.c b/modules/calendar/e-memo-shell-migrate.c
index c64b8b0..c0fab42 100644
--- a/modules/calendar/e-memo-shell-migrate.c
+++ b/modules/calendar/e-memo-shell-migrate.c
@@ -21,205 +21,6 @@
#include "e-memo-shell-migrate.h"
-#include <string.h>
-#include <glib/gi18n.h>
-#include <camel/camel.h>
-#include <libedataserver/e-account.h>
-#include <libedataserver/e-account-list.h>
-#include <libedataserver/e-source.h>
-#include <libedataserver/e-source-group.h>
-#include <libedataserver/e-source-list.h>
-
-#include "calendar/gui/calendar-config-keys.h"
-#include "shell/e-shell.h"
-
-#include "e-memo-shell-backend.h"
-
-#define LOCAL_BASE_URI "local:"
-#define WEBCAL_BASE_URI "webcal://"
-#define PERSONAL_RELATIVE_URI "system"
-#define GROUPWISE_BASE_URI "groupwise://"
-
-static void
-create_memo_sources (EShellBackend *shell_backend,
- ESourceList *source_list,
- ESourceGroup **on_this_computer,
- ESourceGroup **on_the_web,
- ESource **personal_source)
-{
- EShell *shell;
- EShellSettings *shell_settings;
- GSList *groups;
- ESourceGroup *group;
-
- *on_this_computer = NULL;
- *on_the_web = NULL;
- *personal_source = NULL;
-
- shell = e_shell_backend_get_shell (shell_backend);
- shell_settings = e_shell_get_shell_settings (shell);
-
- groups = e_source_list_peek_groups (source_list);
- if (groups) {
- /* groups are already there, we need to search for things... */
- GSList *g;
- gchar *base_dir, *base_uri;
-
- base_dir = g_build_filename (e_shell_backend_get_data_dir (shell_backend), "local", NULL);
- base_uri = g_filename_to_uri (base_dir, NULL, NULL);
-
- for (g = groups; g; g = g->next) {
- group = E_SOURCE_GROUP (g->data);
-
- if (strcmp (base_uri, e_source_group_peek_base_uri (group)) == 0)
- e_source_group_set_base_uri (group, LOCAL_BASE_URI);
-
- if (!*on_this_computer && !strcmp (LOCAL_BASE_URI, e_source_group_peek_base_uri (group)))
- *on_this_computer = g_object_ref (group);
- else if (!*on_the_web && !strcmp (WEBCAL_BASE_URI, e_source_group_peek_base_uri (group)))
- *on_the_web = g_object_ref (group);
- }
-
- g_free (base_dir);
- g_free (base_uri);
- }
-
- if (*on_this_computer) {
- /* make sure "Personal" shows up as a source under
- this group */
- GSList *sources = e_source_group_peek_sources (*on_this_computer);
- GSList *s;
- for (s = sources; s; s = s->next) {
- ESource *source = E_SOURCE (s->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)) {
- *personal_source = g_object_ref (source);
- break;
- }
- }
- } else {
- /* create the local source group */
- group = e_source_group_new (_("On This Computer"), LOCAL_BASE_URI);
- e_source_list_add_group (source_list, group, -1);
-
- *on_this_computer = group;
- }
-
- if (!*personal_source) {
- GSList *selected;
- gchar *primary_memo_list;
-
- /* Create the default Person memo list */
- ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
- e_source_group_add_source (*on_this_computer, source, -1);
-
- primary_memo_list = e_shell_settings_get_string (
- shell_settings, "cal-primary-memo-list");
-
- selected = e_memo_shell_backend_get_selected_memo_lists (
- E_MEMO_SHELL_BACKEND (shell_backend));
-
- if (primary_memo_list == NULL && selected == NULL) {
- GSList link;
-
- e_shell_settings_set_string (
- shell_settings, "cal-primary-memo-list",
- e_source_peek_uid (source));
-
- link.data = (gpointer)e_source_peek_uid (source);
- link.next = NULL;
-
- e_memo_shell_backend_set_selected_memo_lists (
- E_MEMO_SHELL_BACKEND (shell_backend), &link);
- }
-
- g_slist_foreach (selected, (GFunc) g_free, NULL);
- g_slist_free (selected);
-
- e_source_set_color_spec (source, "#BECEDD");
- *personal_source = source;
- }
-
- if (!*on_the_web) {
- /* Create the Webcal source group */
- group = e_source_group_new (_("On The Web"), WEBCAL_BASE_URI);
- e_source_list_add_group (source_list, group, -1);
-
- *on_the_web = group;
- }
-}
-
-static gboolean
-is_groupwise_account (EAccount *account)
-{
- if (account->source->url != NULL) {
- return g_str_has_prefix (account->source->url, GROUPWISE_BASE_URI);
- } else {
- return FALSE;
- }
-}
-
-static void
-add_gw_esource (ESourceList *source_list, const gchar *group_name, const gchar *source_name, CamelURL *url, GConfClient *client)
-{
- ESourceGroup *group;
- ESource *source;
- GSList *ids, *temp;
- GError *error = NULL;
- gchar *relative_uri;
- const gchar *soap_port;
- const gchar * use_ssl;
- const gchar *poa_address;
- const gchar *offline_sync;
-
- poa_address = url->host;
- if (!poa_address || strlen (poa_address) ==0)
- return;
- soap_port = camel_url_get_param (url, "soap_port");
-
- if (soap_port == NULL || *soap_port == '\0')
- soap_port = "7191";
-
- use_ssl = camel_url_get_param (url, "use_ssl");
- offline_sync = camel_url_get_param (url, "offline_sync");
-
- group = e_source_group_new (group_name, GROUPWISE_BASE_URI);
- if (!e_source_list_add_group (source_list, group, -1))
- return;
- relative_uri = g_strdup_printf ("%s %s/", url->user, poa_address);
-
- source = e_source_new (source_name, relative_uri);
- e_source_set_property (source, "auth", "1");
- e_source_set_property (source, "username", url->user);
- e_source_set_property (source, "port", soap_port);
- e_source_set_property (source, "auth-domain", "Groupwise");
- e_source_set_property (source, "use_ssl", use_ssl);
- e_source_set_property (source, "offline_sync", offline_sync ? "1" : "0" );
-
- e_source_set_color_spec (source, "#EEBC60");
- e_source_group_add_source (group, source, -1);
-
- ids = gconf_client_get_list (client, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, &error);
- if (error != NULL) {
- g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
- g_error_free (error);
- }
- ids = g_slist_append (ids, g_strdup (e_source_peek_uid (source)));
- gconf_client_set_list (client, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, ids, NULL);
- temp = ids;
- for (; temp != NULL; temp = g_slist_next (temp))
- g_free (temp->data);
-
- g_slist_free (ids);
- g_object_unref (source);
- g_object_unref (group);
- g_free (relative_uri);
-}
-
gboolean
e_memo_shell_backend_migrate (EShellBackend *shell_backend,
gint major,
@@ -227,52 +28,5 @@ e_memo_shell_backend_migrate (EShellBackend *shell_backend,
gint revision,
GError **error)
{
- ESourceGroup *on_this_computer = NULL;
- ESourceGroup *on_the_web = NULL;
- ESource *personal_source = NULL;
- ESourceList *source_list = NULL;
- gboolean retval = FALSE;
-
- g_object_get (shell_backend, "source-list", &source_list, NULL);
-
- /* we call this unconditionally now - create_groups either
- creates the groups/sources or it finds the necessary
- groups/sources. */
- create_memo_sources (
- shell_backend, source_list, &on_this_computer,
- &on_the_web, &personal_source);
-
- /* Migration for Gw accounts between versions < 2.8 */
- if (major == 2 && minor < 8) {
- EAccountList *al;
- EAccount *a;
- CamelURL *url;
- EIterator *it;
- GConfClient *gconf_client = gconf_client_get_default ();
- al = e_account_list_new (gconf_client);
- for (it = e_list_get_iterator ((EList *)al);
- e_iterator_is_valid (it);
- e_iterator_next (it)) {
- a = (EAccount *) e_iterator_get (it);
- if (!a->enabled || !is_groupwise_account (a))
- continue;
- url = camel_url_new (a->source->url, NULL);
- add_gw_esource (source_list, a->name, _("Notes"), url, gconf_client);
- camel_url_free (url);
- }
- g_object_unref (al);
- g_object_unref (gconf_client);
- }
-
- e_source_list_sync (source_list, NULL);
- retval = TRUE;
-
- if (on_this_computer)
- g_object_unref (on_this_computer);
- if (on_the_web)
- g_object_unref (on_the_web);
- if (personal_source)
- g_object_unref (personal_source);
-
- return retval;
+ return TRUE;
}
diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c
index c22cff3..b79bae9 100644
--- a/modules/calendar/e-memo-shell-sidebar.c
+++ b/modules/calendar/e-memo-shell-sidebar.c
@@ -101,24 +101,12 @@ memo_shell_sidebar_emit_status_message (EMemoShellSidebar *memo_shell_sidebar,
g_signal_emit (memo_shell_sidebar, signal_id, 0, status_message, -1.0);
}
-static EAlertSink *
-get_alert_sink (EShellView *shell_view)
-{
- EShellWindow *shell_window;
-
- shell_window = e_shell_view_get_shell_window (shell_view);
-
- if (g_strcmp0 (e_shell_window_get_active_view (shell_window), "calendar") == 0)
- shell_view = e_shell_window_peek_shell_view (shell_window, "calendar");
-
- return E_ALERT_SINK (e_shell_view_get_shell_content (shell_view));
-}
-
static void
memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar,
ECal *client)
{
EShellView *shell_view;
+ EShellContent *shell_content;
EShellSidebar *shell_sidebar;
GHashTable *client_table;
ESource *source;
@@ -128,16 +116,18 @@ memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar,
shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
source = e_cal_get_source (client);
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
g_object_ref (source);
g_hash_table_remove (client_table, uid);
memo_shell_sidebar_emit_status_message (memo_shell_sidebar, NULL);
- e_alert_submit (get_alert_sink (shell_view),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:memos-crashed", NULL);
g_object_unref (source);
@@ -149,18 +139,32 @@ memo_shell_sidebar_backend_error_cb (EMemoShellSidebar *memo_shell_sidebar,
ECal *client)
{
EShellView *shell_view;
+ EShellContent *shell_content;
EShellSidebar *shell_sidebar;
- ESourceGroup *source_group;
+ ESource *parent;
ESource *source;
+ GNode *node;
+ const gchar *parent_display_name;
+ const gchar *source_display_name;
shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
source = e_cal_get_source (client);
- source_group = e_source_peek_group (source);
- e_alert_submit (get_alert_sink (shell_view),
- "calendar:backend-error", e_source_group_peek_name (source_group), e_source_peek_name (source), message, NULL);
+ node = e_source_get_node (source);
+ g_return_if_fail (node != NULL);
+ g_return_if_fail (node->parent != NULL);
+
+ parent = E_SOURCE (node->parent->data);
+
+ parent_display_name = e_source_get_display_name (parent);
+ source_display_name = e_source_get_display_name (source);
+
+ e_alert_submit (
+ E_ALERT_SINK (shell_content), "calendar:backend-error",
+ parent_display_name, source_display_name, message, NULL);
}
static void
@@ -169,11 +173,13 @@ memo_shell_sidebar_client_opened_cb (EMemoShellSidebar *memo_shell_sidebar,
ECal *client)
{
EShellView *shell_view;
+ EShellContent *shell_content;
EShellSidebar *shell_sidebar;
const gchar *message;
shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
if (g_error_matches (error, E_CALENDAR_ERROR,
E_CALENDAR_STATUS_AUTHENTICATION_FAILED) ||
@@ -194,14 +200,16 @@ memo_shell_sidebar_client_opened_cb (EMemoShellSidebar *memo_shell_sidebar,
return;
case E_CALENDAR_STATUS_REPOSITORY_OFFLINE:
- e_alert_submit (get_alert_sink (shell_view),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:prompt-no-contents-offline-memos",
NULL);
/* fall through */
default:
if (error->code != E_CALENDAR_STATUS_REPOSITORY_OFFLINE) {
- e_alert_submit (get_alert_sink (shell_view),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:failed-open-memos",
error->message, NULL);
}
@@ -230,6 +238,7 @@ memo_shell_sidebar_default_loaded_cb (ESource *source,
EShellSidebar *shell_sidebar)
{
EMemoShellSidebarPrivate *priv;
+ EShellContent *shell_content;
EShellView *shell_view;
ECal *client;
GError *error = NULL;
@@ -237,6 +246,7 @@ memo_shell_sidebar_default_loaded_cb (ESource *source,
priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
client = e_load_cal_source_finish (source, result, &error);
@@ -245,7 +255,8 @@ memo_shell_sidebar_default_loaded_cb (ESource *source,
goto exit;
} else if (error != NULL) {
- e_alert_submit (get_alert_sink (shell_view),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:failed-open-memos",
error->message, NULL);
g_error_free (error);
@@ -302,7 +313,7 @@ memo_shell_sidebar_set_default (EMemoShellSidebar *memo_shell_sidebar,
priv->loading_default_client = NULL;
}
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
client = g_hash_table_lookup (priv->client_table, uid);
/* If we already have an open connection for
@@ -333,15 +344,8 @@ memo_shell_sidebar_row_changed_cb (EMemoShellSidebar *memo_shell_sidebar,
ESourceSelector *selector;
ESource *source;
- /* XXX ESourceSelector's underlying tree store has only one
- * column: ESource objects. While we're not supposed to
- * know this, listening for "row-changed" signals from
- * the model is easier to deal with than the selector's
- * "selection-changed" signal, which doesn't tell you
- * _which_ row changed. */
-
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
- gtk_tree_model_get (tree_model, tree_iter, 0, &source, -1);
+ source = e_source_selector_get_source_by_path (selector, tree_path);
/* XXX This signal gets emitted a lot while the model is being
* rebuilt, during which time we won't get a valid ESource.
@@ -358,38 +362,6 @@ memo_shell_sidebar_row_changed_cb (EMemoShellSidebar *memo_shell_sidebar,
}
static void
-memo_shell_sidebar_selection_changed_cb (EMemoShellSidebar *memo_shell_sidebar,
- ESourceSelector *selector)
-{
- EShellView *shell_view;
- EShellBackend *shell_backend;
- EShellSidebar *shell_sidebar;
- GSList *list, *iter;
-
- /* This signal is emitted less frequently than "row-changed",
- * especially when the model is being rebuilt. So we'll take
- * it easy on poor GConf. */
-
- shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar);
- shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
- shell_backend = e_shell_view_get_shell_backend (shell_view);
-
- list = e_source_selector_get_selection (selector);
-
- for (iter = list; iter != NULL; iter = iter->next) {
- ESource *source = iter->data;
-
- iter->data = (gpointer) e_source_peek_uid (source);
- g_object_unref (source);
- }
-
- e_memo_shell_backend_set_selected_memo_lists (
- E_MEMO_SHELL_BACKEND (shell_backend), list);
-
- g_slist_free (list);
-}
-
-static void
memo_shell_sidebar_primary_selection_changed_cb (EMemoShellSidebar *memo_shell_sidebar,
ESourceSelector *selector)
{
@@ -411,11 +383,9 @@ memo_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
EShell *shell;
EShellBackend *shell_backend;
EShellSettings *shell_settings;
+ ESourceRegistry *registry;
ESourceSelector *selector;
- ESourceList *source_list;
- ESource *source;
GtkTreeModel *model;
- GSList *list, *iter;
priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar);
@@ -428,8 +398,7 @@ memo_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
selector = E_SOURCE_SELECTOR (priv->selector);
model = gtk_tree_view_get_model (GTK_TREE_VIEW (selector));
- source_list = e_memo_shell_backend_get_source_list (
- E_MEMO_SHELL_BACKEND (shell_backend));
+ registry = e_source_registry_get_default ();
g_signal_connect_swapped (
model, "row-changed",
@@ -448,30 +417,8 @@ memo_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
G_BINDING_SYNC_CREATE,
(GBindingTransformFunc) e_binding_transform_uid_to_source,
(GBindingTransformFunc) e_binding_transform_source_to_uid,
- g_object_ref (source_list),
+ g_object_ref (registry),
(GDestroyNotify) g_object_unref);
-
- list = e_memo_shell_backend_get_selected_memo_lists (
- E_MEMO_SHELL_BACKEND (shell_backend));
-
- for (iter = list; iter != NULL; iter = iter->next) {
- const gchar *uid = iter->data;
-
- source = e_source_list_peek_source_by_uid (source_list, uid);
-
- if (source != NULL)
- e_source_selector_select_source (selector, source);
- }
-
- g_slist_foreach (list, (GFunc) g_free, NULL);
- g_slist_free (list);
-
- /* Listen for subsequent changes to the selector. */
-
- g_signal_connect_swapped (
- selector, "selection-changed",
- G_CALLBACK (memo_shell_sidebar_selection_changed_cb),
- shell_sidebar);
}
static void
@@ -549,7 +496,7 @@ memo_shell_sidebar_constructed (GObject *object)
EShellWindow *shell_window;
EShellBackend *shell_backend;
EShellSidebar *shell_sidebar;
- ESourceList *source_list;
+ ESourceRegistry *registry;
GtkContainer *container;
GtkWidget *widget;
AtkObject *a11y;
@@ -564,9 +511,6 @@ memo_shell_sidebar_constructed (GObject *object)
shell_backend = e_shell_view_get_shell_backend (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- source_list = e_memo_shell_backend_get_source_list (
- E_MEMO_SHELL_BACKEND (shell_backend));
-
container = GTK_CONTAINER (shell_sidebar);
widget = gtk_scrolled_window_new (NULL, NULL);
@@ -580,7 +524,8 @@ memo_shell_sidebar_constructed (GObject *object)
container = GTK_CONTAINER (widget);
- widget = e_memo_list_selector_new (source_list);
+ registry = e_source_registry_get_default ();
+ widget = e_memo_list_selector_new (registry);
e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE);
gtk_container_add (container, widget);
a11y = gtk_widget_get_accessible (widget);
@@ -613,19 +558,21 @@ memo_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
if (source != NULL) {
ECal *client;
- const gchar *uri;
+ const gchar *uid;
const gchar *delete;
- uri = e_source_peek_relative_uri (source);
- is_system = (uri == NULL || strcmp (uri, "system") == 0);
+ uid = e_source_get_uid (source);
+ is_system = (g_strcmp0 (uid, "system") == 0);
can_delete = !is_system;
+#if 0 /* ACCOUNT_MGMT */
delete = e_source_get_property (source, "delete");
can_delete &= (delete == NULL || strcmp (delete, "no") != 0);
+#endif /* ACCOUNT_MGMT */
client = g_hash_table_lookup (
memo_shell_sidebar->priv->client_table,
- e_source_peek_uid (source));
+ e_source_get_uid (source));
refresh_supported =
client && e_cal_get_refresh_supported (client);
}
@@ -659,7 +606,7 @@ memo_shell_sidebar_client_removed (EMemoShellSidebar *memo_shell_sidebar,
NULL, NULL, memo_shell_sidebar);
source = e_cal_get_source (client);
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
g_hash_table_remove (client_table, uid);
e_source_selector_unselect_source (selector, source);
@@ -840,8 +787,8 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar,
ECal *default_client;
ECal *client;
icaltimezone *timezone;
+ const gchar *display_name;
const gchar *uid;
- const gchar *uri;
gchar *message;
g_return_if_fail (E_IS_MEMO_SHELL_SIDEBAR (memo_shell_sidebar));
@@ -852,7 +799,7 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar,
default_client = memo_shell_sidebar->priv->default_client;
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
client = g_hash_table_lookup (client_table, uid);
if (client != NULL)
@@ -863,7 +810,7 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar,
const gchar *default_uid;
default_source = e_cal_get_source (default_client);
- default_uid = e_source_peek_uid (default_source);
+ default_uid = e_source_get_uid (default_source);
if (g_strcmp0 (uid, default_uid) == 0)
client = g_object_ref (default_client);
@@ -887,9 +834,8 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar,
g_hash_table_insert (client_table, g_strdup (uid), client);
e_source_selector_select_source (selector, source);
- uri = e_cal_get_uri (client);
- /* Translators: The string field is a URI. */
- message = g_strdup_printf (_("Opening memos at %s"), uri);
+ display_name = e_source_get_display_name (source);
+ message = g_strdup_printf (_("Opening memo list '%s'"), display_name);
memo_shell_sidebar_emit_status_message (memo_shell_sidebar, message);
g_free (message);
@@ -925,7 +871,7 @@ e_memo_shell_sidebar_remove_source (EMemoShellSidebar *memo_shell_sidebar,
client_table = memo_shell_sidebar->priv->client_table;
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
client = g_hash_table_lookup (client_table, uid);
if (client == NULL)
diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c
index a55eab1..711d114 100644
--- a/modules/calendar/e-memo-shell-view-actions.c
+++ b/modules/calendar/e-memo-shell-view-actions.c
@@ -124,32 +124,17 @@ static void
action_memo_list_delete_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
- EMemoShellBackend *memo_shell_backend;
- EMemoShellContent *memo_shell_content;
EMemoShellSidebar *memo_shell_sidebar;
EShellWindow *shell_window;
EShellView *shell_view;
- EMemoTable *memo_table;
- ECal *client;
- ECalModel *model;
ESourceSelector *selector;
- ESourceGroup *source_group;
- ESourceList *source_list;
ESource *source;
+ GFile *file;
gint response;
- gchar *uri;
- GError *error = NULL;
shell_view = E_SHELL_VIEW (memo_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- memo_shell_backend = memo_shell_view->priv->memo_shell_backend;
- source_list = e_memo_shell_backend_get_source_list (memo_shell_backend);
-
- memo_shell_content = memo_shell_view->priv->memo_shell_content;
- memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
- model = e_memo_table_get_model (memo_table);
-
memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
source = e_source_selector_get_primary_selection (selector);
@@ -159,37 +144,14 @@ action_memo_list_delete_cb (GtkAction *action,
response = e_alert_run_dialog_for_args (
GTK_WINDOW (shell_window),
"calendar:prompt-delete-memo-list",
- e_source_peek_name (source), NULL);
- if (response != GTK_RESPONSE_YES)
- return;
+ e_source_get_display_name (source), NULL);
- uri = e_source_get_uri (source);
- client = e_cal_model_get_client_for_uri (model, uri);
- if (client == NULL)
- client = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_JOURNAL);
- g_free (uri);
-
- g_return_if_fail (client != NULL);
-
- if (!e_cal_remove (client, &error)) {
- g_warning ("%s", error->message);
- g_error_free (error);
+ if (response != GTK_RESPONSE_YES)
return;
- }
-
- if (e_source_selector_source_is_selected (selector, source)) {
- e_memo_shell_sidebar_remove_source (
- memo_shell_sidebar, source);
- e_source_selector_unselect_source (selector, source);
- }
-
- source_group = e_source_peek_group (source);
- e_source_group_remove_source (source_group, source);
- if (!e_source_list_sync (source_list, &error)) {
- g_warning ("%s", error->message);
- g_error_free (error);
- }
+ /* FIXME Handle errors. */
+ file = e_source_get_file (source);
+ g_file_delete (file, NULL, NULL);
}
static void
@@ -198,10 +160,30 @@ action_memo_list_new_cb (GtkAction *action,
{
EShellView *shell_view;
EShellWindow *shell_window;
+ ESourceRegistry *registry;
+ ECalSourceType source_type;
+ GtkWidget *config;
+ GtkWidget *dialog;
+ const gchar *icon_name;
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));
+
+ source_type = E_CAL_SOURCE_TYPE_JOURNAL;
+ registry = e_source_registry_get_default ();
+ config = e_cal_source_config_new (registry, NULL, source_type);
+
+ dialog = e_source_config_dialog_new (
+ E_SOURCE_CONFIG (config), GTK_WINDOW (shell_window));
+
+ icon_name = gtk_action_get_icon_name (action);
+ gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), _("New Memo List"));
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+
+ gtk_widget_destroy (dialog);
}
static void
@@ -238,11 +220,16 @@ static void
action_memo_list_properties_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
- EMemoShellSidebar *memo_shell_sidebar;
EShellView *shell_view;
EShellWindow *shell_window;
+ EMemoShellSidebar *memo_shell_sidebar;
+ ECalSourceType source_type;
ESource *source;
ESourceSelector *selector;
+ ESourceRegistry *registry;
+ GtkWidget *config;
+ GtkWidget *dialog;
+ const gchar *icon_name;
shell_view = E_SHELL_VIEW (memo_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
@@ -250,15 +237,30 @@ action_memo_list_properties_cb (GtkAction *action,
memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
source = e_source_selector_get_primary_selection (selector);
- g_return_if_fail (E_IS_SOURCE (source));
+ g_return_if_fail (source != NULL);
+
+ source_type = E_CAL_SOURCE_TYPE_JOURNAL;
+ registry = e_source_selector_get_registry (selector);
+ config = e_cal_source_config_new (registry, source, source_type);
+
+ dialog = e_source_config_dialog_new (
+ E_SOURCE_CONFIG (config), GTK_WINDOW (shell_window));
+
+ icon_name = gtk_action_get_icon_name (action);
+ gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Memo List Properties"));
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
- calendar_setup_edit_memo_list (GTK_WINDOW (shell_window), source);
+ gtk_widget_destroy (dialog);
}
static void
action_memo_list_refresh_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
+#if 0 /* ACCOUNT_MGMT */
EMemoShellContent *memo_shell_content;
EMemoShellSidebar *memo_shell_sidebar;
ESourceSelector *selector;
@@ -293,6 +295,7 @@ action_memo_list_refresh_cb (GtkAction *action,
error->message);
g_error_free (error);
}
+#endif /* ACCOUNT_MGMT */
}
static void
diff --git a/modules/calendar/e-memo-shell-view-private.h b/modules/calendar/e-memo-shell-view-private.h
index 0b8867a..49e065a 100644
--- a/modules/calendar/e-memo-shell-view-private.h
+++ b/modules/calendar/e-memo-shell-view-private.h
@@ -36,9 +36,11 @@
#include "shell/e-shell-utils.h"
#include "misc/e-popup-action.h"
#include "misc/e-selectable.h"
+#include "misc/e-source-config-dialog.h"
#include "calendar/gui/comp-util.h"
#include "calendar/gui/e-cal-component-preview.h"
+#include "calendar/gui/e-cal-source-config.h"
#include "calendar/gui/e-calendar-selector.h"
#include "calendar/gui/print.h"
#include "calendar/gui/dialogs/calendar-setup.h"
diff --git a/modules/calendar/e-memo-shell-view.h b/modules/calendar/e-memo-shell-view.h
index 686ae73..7538368 100644
--- a/modules/calendar/e-memo-shell-view.h
+++ b/modules/calendar/e-memo-shell-view.h
@@ -23,7 +23,6 @@
#define E_MEMO_SHELL_VIEW_H
#include <shell/e-shell-view.h>
-#include <libedataserver/e-source-list.h>
/* Standard GObject macros */
#define E_TYPE_MEMO_SHELL_VIEW \
diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c
index 8bb3f47..84cac47 100644
--- a/modules/calendar/e-task-shell-backend.c
+++ b/modules/calendar/e-task-shell-backend.c
@@ -24,19 +24,20 @@
#include <string.h>
#include <glib/gi18n.h>
#include <libecal/e-cal.h>
+#include <libecal/e-source-calendar.h>
#include <libedataserver/e-url.h>
#include <libedataserver/e-source.h>
-#include <libedataserver/e-source-list.h>
-#include <libedataserver/e-source-group.h>
#include "shell/e-shell.h"
#include "shell/e-shell-backend.h"
#include "shell/e-shell-window.h"
+#include "widgets/misc/e-source-config-dialog.h"
#include "calendar/common/authentication.h"
#include "calendar/gui/comp-util.h"
#include "calendar/gui/dialogs/calendar-setup.h"
#include "calendar/gui/dialogs/task-editor.h"
+#include "calendar/gui/e-cal-source-config.h"
#include "e-task-shell-content.h"
#include "e-task-shell-migrate.h"
@@ -48,117 +49,13 @@
((obj), E_TYPE_TASK_SHELL_BACKEND, ETaskShellBackendPrivate))
struct _ETaskShellBackendPrivate {
- ESourceList *source_list;
-};
-
-enum {
- PROP_0,
- PROP_SOURCE_LIST
+ gint placeholder;
};
static gpointer parent_class;
static GType task_shell_backend_type;
static void
-task_shell_backend_ensure_sources (EShellBackend *shell_backend)
-{
- /* XXX This is basically the same algorithm across all modules.
- * Maybe we could somehow integrate this into EShellBackend? */
-
- ETaskShellBackend *task_shell_backend;
- ESourceGroup *on_this_computer;
- ESourceList *source_list;
- ESource *personal;
- EShell *shell;
- EShellSettings *shell_settings;
- GSList *sources, *iter;
- const gchar *name;
- gboolean save_list = FALSE;
-
- on_this_computer = NULL;
- personal = NULL;
-
- task_shell_backend = E_TASK_SHELL_BACKEND (shell_backend);
-
- shell = e_shell_backend_get_shell (shell_backend);
- shell_settings = e_shell_get_shell_settings (shell);
-
- if (!e_cal_get_sources (
- &task_shell_backend->priv->source_list,
- E_CAL_SOURCE_TYPE_TODO, NULL)) {
- g_warning ("Could not get task sources from GConf!");
- return;
- }
-
- source_list = task_shell_backend->priv->source_list;
-
- on_this_computer = e_source_list_ensure_group (
- source_list, _("On This Computer"), "local:", TRUE);
- e_source_list_ensure_group (
- source_list, _("On The Web"), "webcal://", FALSE);
-
- g_return_if_fail (on_this_computer);
-
- sources = e_source_group_peek_sources (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 (g_strcmp0 (relative_uri, "system") == 0) {
- personal = source;
- break;
- }
- }
-
- name = _("Personal");
-
- if (personal == NULL) {
- ESource *source;
- GSList *selected;
- gchar *primary;
-
- source = e_source_new (name, "system");
- e_source_set_color_spec (source, "#BECEDD");
- e_source_group_add_source (on_this_computer, source, -1);
- g_object_unref (source);
- save_list = TRUE;
-
- primary = e_shell_settings_get_string (
- shell_settings, "cal-primary-task-list");
-
- selected = e_task_shell_backend_get_selected_task_lists (
- task_shell_backend);
-
- if (primary == NULL && selected == NULL) {
- const gchar *uid;
-
- uid = e_source_peek_uid (source);
- selected = g_slist_prepend (NULL, g_strdup (uid));
-
- e_shell_settings_set_string (
- shell_settings, "cal-primary-task-list", uid);
- e_task_shell_backend_set_selected_task_lists (
- task_shell_backend, selected);
- }
-
- g_slist_foreach (selected, (GFunc) g_free, NULL);
- g_slist_free (selected);
- g_free (primary);
- } else {
- /* Force the source name to the current locale. */
- e_source_set_name (personal, name);
- }
-
- g_object_unref (on_this_computer);
-
- if (save_list)
- e_source_list_sync (source_list, NULL);
-}
-
-static void
task_shell_backend_new_task (ESource *source,
GAsyncResult *result,
EShell *shell,
@@ -217,37 +114,19 @@ action_task_new_cb (GtkAction *action,
EShellWindow *shell_window)
{
EShell *shell;
- EShellBackend *shell_backend;
- EShellSettings *shell_settings;
- ESource *source = NULL;
- ESourceList *source_list;
+ ESource *source;
+ ESourceRegistry *registry;
ECalSourceType source_type;
const gchar *action_name;
- gchar *uid;
/* This callback is used for both tasks and assigned tasks. */
source_type = E_CAL_SOURCE_TYPE_TODO;
shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
- shell_backend = e_shell_get_backend_by_name (shell, "tasks");
-
- g_object_get (shell_backend, "source-list", &source_list, NULL);
- g_return_if_fail (E_IS_SOURCE_LIST (source_list));
- uid = e_shell_settings_get_string (
- shell_settings, "cal-primary-task-list");
-
- if (uid != NULL) {
- source = e_source_list_peek_source_by_uid (source_list, uid);
- g_free (uid);
- }
-
- if (source == NULL)
- source = e_source_list_peek_default_source (source_list);
-
- g_return_if_fail (E_IS_SOURCE (source));
+ registry = e_source_registry_get_default ();
+ source = e_source_registry_get_default_task_list (registry);
/* Use a callback function appropriate for the action.
* FIXME Need to obtain a better default time zone. */
@@ -266,15 +145,33 @@ action_task_new_cb (GtkAction *action,
NULL, (GAsyncReadyCallback)
task_shell_backend_task_new_cb,
g_object_ref (shell));
-
- g_object_unref (source_list);
}
static void
action_task_list_new_cb (GtkAction *action,
EShellWindow *shell_window)
{
- calendar_setup_new_task_list (GTK_WINDOW (shell_window));
+ ECalSourceType source_type;
+ ESourceRegistry *registry;
+ GtkWidget *config;
+ GtkWidget *dialog;
+ const gchar *icon_name;
+
+ source_type = E_CAL_SOURCE_TYPE_TODO;
+ registry = e_source_registry_get_default ();
+ config = e_cal_source_config_new (registry, NULL, source_type);
+
+ dialog = e_source_config_dialog_new (
+ E_SOURCE_CONFIG (config), GTK_WINDOW (shell_window));
+
+ icon_name = gtk_action_get_icon_name (action);
+ gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), _("New Task List"));
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+
+ gtk_widget_destroy (dialog);
}
static GtkActionEntry item_entries[] = {
@@ -314,7 +211,7 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
ECal *client;
ECalComponent *comp;
ESource *source;
- ESourceList *source_list;
+ ESourceRegistry *registry;
ECalSourceType source_type;
EUri *euri;
icalcomponent *icalcomp;
@@ -379,15 +276,10 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
* we successfully open it is another matter... */
handled = TRUE;
- if (!e_cal_get_sources (&source_list, source_type, NULL)) {
- g_printerr ("Could not get task sources from GConf!\n");
- goto exit;
- }
-
- source = e_source_list_peek_source_by_uid (source_list, source_uid);
+ registry = e_source_registry_get_default ();
+ source = e_source_registry_lookup_by_uid (registry, source_uid);
if (source == NULL) {
g_printerr ("No source for UID '%s'\n", source_uid);
- g_object_unref (source_list);
goto exit;
}
@@ -397,7 +289,6 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
g_printerr ("%s\n", error->message);
g_error_free (error);
}
- g_object_unref (source_list);
goto exit;
}
@@ -411,7 +302,6 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
if (!e_cal_get_object (client, comp_uid, comp_rid, &icalcomp, &error)) {
g_printerr ("%s\n", error->message);
- g_object_unref (source_list);
g_error_free (error);
goto exit;
}
@@ -438,7 +328,6 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
present:
gtk_window_present (GTK_WINDOW (editor));
- g_object_unref (source_list);
g_object_unref (client);
exit:
@@ -472,40 +361,6 @@ task_shell_backend_window_created_cb (EShellBackend *shell_backend,
}
static void
-task_shell_backend_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_backend_get_source_list (
- E_TASK_SHELL_BACKEND (object)));
- return;
- }
-
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-
-static void
-task_shell_backend_dispose (GObject *object)
-{
- ETaskShellBackendPrivate *priv;
-
- priv = E_TASK_SHELL_BACKEND_GET_PRIVATE (object);
-
- if (priv->source_list != NULL) {
- g_object_unref (priv->source_list);
- priv->source_list = NULL;
- }
-
- /* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
task_shell_backend_constructed (GObject *object)
{
EShell *shell;
@@ -514,8 +369,6 @@ task_shell_backend_constructed (GObject *object)
shell_backend = E_SHELL_BACKEND (object);
shell = e_shell_backend_get_shell (shell_backend);
- task_shell_backend_ensure_sources (shell_backend);
-
g_signal_connect_swapped (
shell, "handle-uri",
G_CALLBACK (task_shell_backend_handle_uri_cb),
@@ -540,8 +393,6 @@ task_shell_backend_class_init (ETaskShellBackendClass *class)
g_type_class_add_private (class, sizeof (ETaskShellBackendPrivate));
object_class = G_OBJECT_CLASS (class);
- object_class->get_property = task_shell_backend_get_property;
- object_class->dispose = task_shell_backend_dispose;
object_class->constructed = task_shell_backend_constructed;
shell_backend_class = E_SHELL_BACKEND_CLASS (class);
@@ -553,16 +404,6 @@ task_shell_backend_class_init (ETaskShellBackendClass *class)
shell_backend_class->preferences_page = "calendar-and-tasks";
shell_backend_class->start = NULL;
shell_backend_class->migrate = e_task_shell_backend_migrate;
-
- 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
@@ -597,48 +438,7 @@ e_task_shell_backend_register_type (GTypeModule *type_module)
task_shell_backend_type = g_type_module_register_type (
type_module, E_TYPE_SHELL_BACKEND,
"ETaskShellBackend", &type_info, 0);
-}
-
-ESourceList *
-e_task_shell_backend_get_source_list (ETaskShellBackend *task_shell_backend)
-{
- g_return_val_if_fail (
- E_IS_TASK_SHELL_BACKEND (task_shell_backend), NULL);
-
- return task_shell_backend->priv->source_list;
-}
-
-GSList *
-e_task_shell_backend_get_selected_task_lists (ETaskShellBackend *task_shell_backend)
-{
- GConfClient *client;
- GSList *selected_task_lists;
- const gchar *key;
-
- g_return_val_if_fail (
- E_IS_TASK_SHELL_BACKEND (task_shell_backend), NULL);
-
- client = gconf_client_get_default ();
- key = "/apps/evolution/calendar/tasks/selected_tasks";
- selected_task_lists = gconf_client_get_list (
- client, key, GCONF_VALUE_STRING, NULL);
- g_object_unref (client);
-
- return selected_task_lists;
-}
-void
-e_task_shell_backend_set_selected_task_lists (ETaskShellBackend *task_shell_backend,
- GSList *selected_task_lists)
-{
- GConfClient *client;
- const gchar *key;
-
- g_return_if_fail (E_IS_TASK_SHELL_BACKEND (task_shell_backend));
-
- client = gconf_client_get_default ();
- key = "/apps/evolution/calendar/tasks/selected_tasks";
- gconf_client_set_list (
- client, key, GCONF_VALUE_STRING, selected_task_lists, NULL);
- g_object_unref (client);
+ /* Register relevant ESource extensions. */
+ E_TYPE_SOURCE_TASK_LIST;
}
diff --git a/modules/calendar/e-task-shell-backend.h b/modules/calendar/e-task-shell-backend.h
index ba56e91..a9f1085 100644
--- a/modules/calendar/e-task-shell-backend.h
+++ b/modules/calendar/e-task-shell-backend.h
@@ -23,7 +23,6 @@
#define E_TASK_SHELL_BACKEND_H
#include <shell/e-shell-backend.h>
-#include <libedataserver/e-source-list.h>
/* Standard GObject macros */
#define E_TYPE_TASK_SHELL_BACKEND \
@@ -62,13 +61,6 @@ struct _ETaskShellBackendClass {
GType e_task_shell_backend_get_type (void);
void e_task_shell_backend_register_type
(GTypeModule *type_module);
-ESourceList * e_task_shell_backend_get_source_list
- (ETaskShellBackend *task_shell_backend);
-GSList * e_task_shell_backend_get_selected_task_lists
- (ETaskShellBackend *task_shell_backend);
-void e_task_shell_backend_set_selected_task_lists
- (ETaskShellBackend *task_shell_backend,
- GSList *selected_task_lists);
G_END_DECLS
diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c
index 9cc9246..0d3e16b 100644
--- a/modules/calendar/e-task-shell-content.c
+++ b/modules/calendar/e-task-shell-content.c
@@ -116,7 +116,7 @@ task_shell_content_table_foreach_cb (gint model_row,
const gchar *source_uid;
source = e_cal_get_source (comp_data->client);
- source_uid = e_source_peek_uid (source);
+ source_uid = e_source_get_uid (source);
foreach_data->list = g_slist_prepend (
foreach_data->list,
diff --git a/modules/calendar/e-task-shell-migrate.c b/modules/calendar/e-task-shell-migrate.c
index f57ac7e..33b2aeb 100644
--- a/modules/calendar/e-task-shell-migrate.c
+++ b/modules/calendar/e-task-shell-migrate.c
@@ -21,147 +21,6 @@
#include "e-task-shell-migrate.h"
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#include <glib/gi18n.h>
-#include <glib/gstdio.h>
-#include <libebackend/e-dbhash.h>
-#include <libedataserver/e-source.h>
-#include <libedataserver/e-source-group.h>
-#include <libedataserver/e-source-list.h>
-#include <libedataserver/e-xml-hash-utils.h>
-#include <libedataserver/e-xml-utils.h>
-
-#include "e-util/e-util-private.h"
-#include "calendar/gui/calendar-config-keys.h"
-#include "shell/e-shell.h"
-
-#include "e-task-shell-backend.h"
-
-#define LOCAL_BASE_URI "local:"
-#define WEBCAL_BASE_URI "webcal://"
-#define PERSONAL_RELATIVE_URI "system"
-
-static void
-create_task_sources (EShellBackend *shell_backend,
- ESourceList *source_list,
- ESourceGroup **on_this_computer,
- ESourceGroup **on_the_web,
- ESource **personal_source)
-{
- EShell *shell;
- EShellSettings *shell_settings;
- GSList *groups;
- ESourceGroup *group;
-
- *on_this_computer = NULL;
- *on_the_web = NULL;
- *personal_source = NULL;
-
- shell = e_shell_backend_get_shell (shell_backend);
- shell_settings = e_shell_get_shell_settings (shell);
-
- groups = e_source_list_peek_groups (source_list);
- if (groups) {
- /* groups are already there, we need to search for things... */
- GSList *g;
- gchar *base_dir, *base_uri;
-
- base_dir = g_build_filename (e_shell_backend_get_data_dir (shell_backend), "local", NULL);
- base_uri = g_filename_to_uri (base_dir, NULL, NULL);
-
- for (g = groups; g; g = g->next) {
- group = E_SOURCE_GROUP (g->data);
-
- if (strcmp (base_uri, e_source_group_peek_base_uri (group)) == 0)
- e_source_group_set_base_uri (group, LOCAL_BASE_URI);
-
- if (!*on_this_computer && !strcmp (LOCAL_BASE_URI,
- e_source_group_peek_base_uri (group)))
- *on_this_computer = g_object_ref (group);
- else if (!*on_the_web && !strcmp (WEBCAL_BASE_URI,
- e_source_group_peek_base_uri (group)))
- *on_the_web = g_object_ref (group);
- }
-
- g_free (base_dir);
- g_free (base_uri);
- }
-
- if (*on_this_computer) {
- /* make sure "Personal" shows up as a source under
- this group */
- GSList *sources = e_source_group_peek_sources (*on_this_computer);
- GSList *s;
- for (s = sources; s; s = s->next) {
- ESource *source = E_SOURCE (s->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)) {
- *personal_source = g_object_ref (source);
- break;
- }
- }
- } else {
- /* create the local source group */
- group = e_source_group_new (_("On This Computer"), LOCAL_BASE_URI);
- e_source_list_add_group (source_list, group, -1);
-
- *on_this_computer = group;
- }
-
- if (!*personal_source) {
- GSList *selected;
- gchar *primary_task_list;
-
- /* Create the default Person task list */
- ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
- e_source_group_add_source (*on_this_computer, source, -1);
-
- primary_task_list = e_shell_settings_get_string (
- shell_settings, "cal-primary-task-list");
-
- selected = e_task_shell_backend_get_selected_task_lists (
- E_TASK_SHELL_BACKEND (shell_backend));
-
- if (primary_task_list == NULL && selected == NULL) {
- GSList link;
-
- e_shell_settings_set_string (
- shell_settings, "cal-primary-task-list",
- e_source_peek_uid (source));
-
- link.data = (gpointer)e_source_peek_uid (source);
- link.next = NULL;
-
- e_task_shell_backend_set_selected_task_lists (
- E_TASK_SHELL_BACKEND (shell_backend), &link);
- }
-
- g_slist_foreach (selected, (GFunc) g_free, NULL);
- g_slist_free (selected);
-
- e_source_set_color_spec (source, "#BECEDD");
- *personal_source = source;
- }
-
- if (!*on_the_web) {
- /* Create the Webcal source group */
- group = e_source_group_new (_("On The Web"), WEBCAL_BASE_URI);
- e_source_list_add_group (source_list, group, -1);
-
- *on_the_web = group;
- }
-}
-
gboolean
e_task_shell_backend_migrate (EShellBackend *shell_backend,
gint major,
@@ -169,28 +28,5 @@ e_task_shell_backend_migrate (EShellBackend *shell_backend,
gint micro,
GError **error)
{
- ESourceGroup *on_this_computer = NULL;
- ESourceGroup *on_the_web = NULL;
- ESource *personal_source = NULL;
- ESourceList *source_list;
-
- g_object_get (shell_backend, "source-list", &source_list, NULL);
-
- /* we call this unconditionally now - create_groups either
- creates the groups/sources or it finds the necessary
- groups/sources. */
- create_task_sources (
- shell_backend, source_list, &on_this_computer,
- &on_the_web, &personal_source);
-
- e_source_list_sync (source_list, NULL);
-
- if (on_this_computer)
- g_object_unref (on_this_computer);
- if (on_the_web)
- g_object_unref (on_the_web);
- if (personal_source)
- g_object_unref (personal_source);
-
return TRUE;
}
diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c
index a688da4..bbc8d93 100644
--- a/modules/calendar/e-task-shell-sidebar.c
+++ b/modules/calendar/e-task-shell-sidebar.c
@@ -101,24 +101,12 @@ task_shell_sidebar_emit_status_message (ETaskShellSidebar *task_shell_sidebar,
g_signal_emit (task_shell_sidebar, signal_id, 0, status_message, -1.0);
}
-static EAlertSink *
-get_alert_sink (EShellView *shell_view)
-{
- EShellWindow *shell_window;
-
- shell_window = e_shell_view_get_shell_window (shell_view);
-
- if (g_strcmp0 (e_shell_window_get_active_view (shell_window), "calendar") == 0)
- shell_view = e_shell_window_peek_shell_view (shell_window, "calendar");
-
- return E_ALERT_SINK (e_shell_view_get_shell_content (shell_view));
-}
-
static void
task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar,
ECal *client)
{
EShellView *shell_view;
+ EShellContent *shell_content;
EShellSidebar *shell_sidebar;
GHashTable *client_table;
ESource *source;
@@ -128,16 +116,18 @@ task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar,
shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
source = e_cal_get_source (client);
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
g_object_ref (source);
g_hash_table_remove (client_table, uid);
task_shell_sidebar_emit_status_message (task_shell_sidebar, NULL);
- e_alert_submit (get_alert_sink (shell_view),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:tasks-crashed", NULL);
g_object_unref (source);
@@ -149,18 +139,32 @@ task_shell_sidebar_backend_error_cb (ETaskShellSidebar *task_shell_sidebar,
ECal *client)
{
EShellView *shell_view;
+ EShellContent *shell_content;
EShellSidebar *shell_sidebar;
- ESourceGroup *source_group;
+ ESource *parent;
ESource *source;
+ GNode *node;
+ const gchar *parent_display_name;
+ const gchar *source_display_name;
shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
source = e_cal_get_source (client);
- source_group = e_source_peek_group (source);
- e_alert_submit (get_alert_sink (shell_view),
- "calendar:backend-error", e_source_group_peek_name (source_group), e_source_peek_name (source), message, NULL);
+ node = e_source_get_node (source);
+ g_return_if_fail (node != NULL);
+ g_return_if_fail (node->parent != NULL);
+
+ parent = E_SOURCE (node->parent->data);
+
+ parent_display_name = e_source_get_display_name (parent);
+ source_display_name = e_source_get_display_name (source);
+
+ e_alert_submit (
+ E_ALERT_SINK (shell_content), "calendar:backend-error",
+ parent_display_name, source_display_name, message, NULL);
}
static void
@@ -169,11 +173,13 @@ task_shell_sidebar_client_opened_cb (ETaskShellSidebar *task_shell_sidebar,
ECal *client)
{
EShellView *shell_view;
+ EShellContent *shell_content;
EShellSidebar *shell_sidebar;
const gchar *message;
shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
if (g_error_matches (error, E_CALENDAR_ERROR,
E_CALENDAR_STATUS_AUTHENTICATION_FAILED) ||
@@ -194,14 +200,16 @@ task_shell_sidebar_client_opened_cb (ETaskShellSidebar *task_shell_sidebar,
return;
case E_CALENDAR_STATUS_REPOSITORY_OFFLINE:
- e_alert_submit (get_alert_sink (shell_view),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:prompt-no-contents-offline-tasks",
NULL);
/* fall through */
default:
if (error->code != E_CALENDAR_STATUS_REPOSITORY_OFFLINE) {
- e_alert_submit (get_alert_sink (shell_view),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:failed-open-tasks",
error->message, NULL);
}
@@ -230,6 +238,7 @@ task_shell_sidebar_default_loaded_cb (ESource *source,
EShellSidebar *shell_sidebar)
{
ETaskShellSidebarPrivate *priv;
+ EShellContent *shell_content;
EShellView *shell_view;
ECal *client;
GError *error = NULL;
@@ -237,6 +246,7 @@ task_shell_sidebar_default_loaded_cb (ESource *source,
priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
client = e_load_cal_source_finish (source, result, &error);
@@ -245,7 +255,8 @@ task_shell_sidebar_default_loaded_cb (ESource *source,
goto exit;
} else if (error != NULL) {
- e_alert_submit (get_alert_sink (shell_view),
+ e_alert_submit (
+ E_ALERT_SINK (shell_content),
"calendar:failed-open-tasks",
error->message, NULL);
g_error_free (error);
@@ -302,7 +313,7 @@ task_shell_sidebar_set_default (ETaskShellSidebar *task_shell_sidebar,
priv->loading_default_client = NULL;
}
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
client = g_hash_table_lookup (priv->client_table, uid);
/* If we already have an open connection for
@@ -333,15 +344,8 @@ task_shell_sidebar_row_changed_cb (ETaskShellSidebar *task_shell_sidebar,
ESourceSelector *selector;
ESource *source;
- /* XXX ESourceSelector's underlying tree store has only one
- * column: ESource objects. While we're not supposed to
- * know this, listening for "row-changed" signals from
- * the model is easier to deal with than the selector's
- * "selection-changed" signal, which doesn't tell you
- * _which_ row changed. */
-
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
- gtk_tree_model_get (tree_model, tree_iter, 0, &source, -1);
+ source = e_source_selector_get_source_by_path (selector, tree_path);
/* XXX This signal gets emitted a lot while the model is being
* rebuilt, during which time we won't get a valid ESource.
@@ -358,38 +362,6 @@ task_shell_sidebar_row_changed_cb (ETaskShellSidebar *task_shell_sidebar,
}
static void
-task_shell_sidebar_selection_changed_cb (ETaskShellSidebar *task_shell_sidebar,
- ESourceSelector *selector)
-{
- EShellView *shell_view;
- EShellBackend *shell_backend;
- EShellSidebar *shell_sidebar;
- GSList *list, *iter;
-
- /* This signal is emitted less frequently than "row-changed",
- * especially when the model is being rebuilt. So we'll take
- * it easy on poor GConf. */
-
- shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar);
- shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
- shell_backend = e_shell_view_get_shell_backend (shell_view);
-
- list = e_source_selector_get_selection (selector);
-
- for (iter = list; iter != NULL; iter = iter->next) {
- ESource *source = iter->data;
-
- iter->data = (gpointer) e_source_peek_uid (source);
- g_object_unref (source);
- }
-
- e_task_shell_backend_set_selected_task_lists (
- E_TASK_SHELL_BACKEND (shell_backend), list);
-
- g_slist_free (list);
-}
-
-static void
task_shell_sidebar_primary_selection_changed_cb (ETaskShellSidebar *task_shell_sidebar,
ESourceSelector *selector)
{
@@ -411,11 +383,9 @@ task_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
EShell *shell;
EShellBackend *shell_backend;
EShellSettings *shell_settings;
+ ESourceRegistry *registry;
ESourceSelector *selector;
- ESourceList *source_list;
- ESource *source;
GtkTreeModel *model;
- GSList *list, *iter;
priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar);
@@ -428,8 +398,7 @@ task_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
selector = E_SOURCE_SELECTOR (priv->selector);
model = gtk_tree_view_get_model (GTK_TREE_VIEW (selector));
- source_list = e_task_shell_backend_get_source_list (
- E_TASK_SHELL_BACKEND (shell_backend));
+ registry = e_source_registry_get_default ();
g_signal_connect_swapped (
model, "row-changed",
@@ -448,30 +417,8 @@ task_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
G_BINDING_SYNC_CREATE,
(GBindingTransformFunc) e_binding_transform_uid_to_source,
(GBindingTransformFunc) e_binding_transform_source_to_uid,
- g_object_ref (source_list),
+ g_object_ref (registry),
(GDestroyNotify) g_object_unref);
-
- list = e_task_shell_backend_get_selected_task_lists (
- E_TASK_SHELL_BACKEND (shell_backend));
-
- for (iter = list; iter != NULL; iter = iter->next) {
- const gchar *uid = iter->data;
-
- source = e_source_list_peek_source_by_uid (source_list, uid);
-
- if (source != NULL)
- e_source_selector_select_source (selector, source);
- }
-
- g_slist_foreach (list, (GFunc) g_free, NULL);
- g_slist_free (list);
-
- /* Listen for subsequent changes to the selector. */
-
- g_signal_connect_swapped (
- selector, "selection-changed",
- G_CALLBACK (task_shell_sidebar_selection_changed_cb),
- shell_sidebar);
}
static void
@@ -549,7 +496,7 @@ task_shell_sidebar_constructed (GObject *object)
EShellWindow *shell_window;
EShellBackend *shell_backend;
EShellSidebar *shell_sidebar;
- ESourceList *source_list;
+ ESourceRegistry *registry;
GtkContainer *container;
GtkWidget *widget;
AtkObject *a11y;
@@ -564,9 +511,6 @@ task_shell_sidebar_constructed (GObject *object)
shell_backend = e_shell_view_get_shell_backend (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- source_list = e_task_shell_backend_get_source_list (
- E_TASK_SHELL_BACKEND (shell_backend));
-
container = GTK_CONTAINER (shell_sidebar);
widget = gtk_scrolled_window_new (NULL, NULL);
@@ -580,7 +524,8 @@ task_shell_sidebar_constructed (GObject *object)
container = GTK_CONTAINER (widget);
- widget = e_task_list_selector_new (source_list);
+ registry = e_source_registry_get_default ();
+ widget = e_task_list_selector_new (registry);
e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE);
gtk_container_add (container, widget);
a11y = gtk_widget_get_accessible (widget);
@@ -613,19 +558,21 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
if (source != NULL) {
ECal *client;
- const gchar *uri;
+ const gchar *uid;
const gchar *delete;
- uri = e_source_peek_relative_uri (source);
- is_system = (uri == NULL || strcmp (uri, "system") == 0);
+ uid = e_source_get_uid (source);
+ is_system = (g_strcmp0 (uid, "system") == 0);
can_delete = !is_system;
+#if 0 /* ACCOUNT_MGMT */
delete = e_source_get_property (source, "delete");
can_delete &= (delete == NULL || strcmp (delete, "no") != 0);
+#endif /* ACCOUNT_MGMT */
client = g_hash_table_lookup (
task_shell_sidebar->priv->client_table,
- e_source_peek_uid (source));
+ e_source_get_uid (source));
refresh_supported =
client && e_cal_get_refresh_supported (client);
}
@@ -659,7 +606,7 @@ task_shell_sidebar_client_removed (ETaskShellSidebar *task_shell_sidebar,
NULL, NULL, task_shell_sidebar);
source = e_cal_get_source (client);
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
g_hash_table_remove (client_table, uid);
e_source_selector_unselect_source (selector, source);
@@ -840,8 +787,8 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar,
ECal *default_client;
ECal *client;
icaltimezone *timezone;
+ const gchar *display_name;
const gchar *uid;
- const gchar *uri;
gchar *message;
g_return_if_fail (E_IS_TASK_SHELL_SIDEBAR (task_shell_sidebar));
@@ -852,7 +799,7 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar,
default_client = task_shell_sidebar->priv->default_client;
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
client = g_hash_table_lookup (client_table, uid);
if (client != NULL)
@@ -863,7 +810,7 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar,
const gchar *default_uid;
default_source = e_cal_get_source (default_client);
- default_uid = e_source_peek_uid (default_source);
+ default_uid = e_source_get_uid (default_source);
if (g_strcmp0 (uid, default_uid) == 0)
client = g_object_ref (default_client);
@@ -887,9 +834,8 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar,
g_hash_table_insert (client_table, g_strdup (uid), client);
e_source_selector_select_source (selector, source);
- uri = e_cal_get_uri (client);
- /* Translators: The string field is a URI. */
- message = g_strdup_printf (_("Opening tasks at %s"), uri);
+ display_name = e_source_get_display_name (source);
+ message = g_strdup_printf (_("Opening task list '%s'"), display_name);
task_shell_sidebar_emit_status_message (task_shell_sidebar, message);
g_free (message);
@@ -925,7 +871,7 @@ e_task_shell_sidebar_remove_source (ETaskShellSidebar *task_shell_sidebar,
client_table = task_shell_sidebar->priv->client_table;
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
client = g_hash_table_lookup (client_table, uid);
if (client == NULL)
diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c
index d353124..922029a 100644
--- a/modules/calendar/e-task-shell-view-actions.c
+++ b/modules/calendar/e-task-shell-view-actions.c
@@ -147,32 +147,17 @@ static void
action_task_list_delete_cb (GtkAction *action,
ETaskShellView *task_shell_view)
{
- ETaskShellBackend *task_shell_backend;
- ETaskShellContent *task_shell_content;
ETaskShellSidebar *task_shell_sidebar;
EShellWindow *shell_window;
EShellView *shell_view;
- ETaskTable *task_table;
- ECal *client;
- ECalModel *model;
ESourceSelector *selector;
- ESourceGroup *source_group;
- ESourceList *source_list;
ESource *source;
+ GFile *file;
gint response;
- gchar *uri;
- GError *error = NULL;
shell_view = E_SHELL_VIEW (task_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- task_shell_backend = task_shell_view->priv->task_shell_backend;
- source_list = e_task_shell_backend_get_source_list (task_shell_backend);
-
- task_shell_content = task_shell_view->priv->task_shell_content;
- task_table = e_task_shell_content_get_task_table (task_shell_content);
- model = e_task_table_get_model (task_table);
-
task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
source = e_source_selector_get_primary_selection (selector);
@@ -182,37 +167,14 @@ action_task_list_delete_cb (GtkAction *action,
response = e_alert_run_dialog_for_args (
GTK_WINDOW (shell_window),
"calendar:prompt-delete-task-list",
- e_source_peek_name (source), NULL);
- if (response != GTK_RESPONSE_YES)
- return;
-
- uri = e_source_get_uri (source);
- client = e_cal_model_get_client_for_uri (model, uri);
- if (client == NULL)
- client = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_JOURNAL);
- g_free (uri);
-
- g_return_if_fail (client != NULL);
+ e_source_get_display_name (source), NULL);
- if (!e_cal_remove (client, &error)) {
- g_warning ("%s", error->message);
- g_error_free (error);
+ if (response != GTK_RESPONSE_YES)
return;
- }
- if (e_source_selector_source_is_selected (selector, source)) {
- e_task_shell_sidebar_remove_source (
- task_shell_sidebar, source);
- e_source_selector_unselect_source (selector, source);
- }
-
- source_group = e_source_peek_group (source);
- e_source_group_remove_source (source_group, source);
-
- if (!e_source_list_sync (source_list, &error)) {
- g_warning ("%s", error->message);
- g_error_free (error);
- }
+ /* FIXME Handle errors. */
+ file = e_source_get_file (source);
+ g_file_delete (file, NULL, NULL);
}
static void
@@ -221,10 +183,30 @@ action_task_list_new_cb (GtkAction *action,
{
EShellView *shell_view;
EShellWindow *shell_window;
+ ESourceRegistry *registry;
+ ECalSourceType source_type;
+ GtkWidget *config;
+ GtkWidget *dialog;
+ const gchar *icon_name;
shell_view = E_SHELL_VIEW (task_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- calendar_setup_new_task_list (GTK_WINDOW (shell_window));
+
+ source_type = E_CAL_SOURCE_TYPE_TODO;
+ registry = e_source_registry_get_default ();
+ config = e_cal_source_config_new (registry, NULL, source_type);
+
+ dialog = e_source_config_dialog_new (
+ E_SOURCE_CONFIG (config), GTK_WINDOW (shell_window));
+
+ icon_name = gtk_action_get_icon_name (action);
+ gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), _("New Task List"));
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+
+ gtk_widget_destroy (dialog);
}
static void
@@ -261,11 +243,16 @@ static void
action_task_list_properties_cb (GtkAction *action,
ETaskShellView *task_shell_view)
{
- ETaskShellSidebar *task_shell_sidebar;
EShellView *shell_view;
EShellWindow *shell_window;
+ ETaskShellSidebar *task_shell_sidebar;
+ ECalSourceType source_type;
ESource *source;
ESourceSelector *selector;
+ ESourceRegistry *registry;
+ GtkWidget *config;
+ GtkWidget *dialog;
+ const gchar *icon_name;
shell_view = E_SHELL_VIEW (task_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
@@ -273,15 +260,30 @@ action_task_list_properties_cb (GtkAction *action,
task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
source = e_source_selector_get_primary_selection (selector);
- g_return_if_fail (E_IS_SOURCE (source));
+ g_return_if_fail (source != NULL);
+
+ source_type = E_CAL_SOURCE_TYPE_TODO;
+ registry = e_source_selector_get_registry (selector);
+ config = e_cal_source_config_new (registry, source, source_type);
- calendar_setup_edit_task_list (GTK_WINDOW (shell_window), source);
+ dialog = e_source_config_dialog_new (
+ E_SOURCE_CONFIG (config), GTK_WINDOW (shell_window));
+
+ icon_name = gtk_action_get_icon_name (action);
+ gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Task List Properties"));
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+
+ gtk_widget_destroy (dialog);
}
static void
action_task_list_refresh_cb (GtkAction *action,
ETaskShellView *task_shell_view)
{
+#if 0 /* ACCOUNT_MGMT */
ETaskShellContent *task_shell_content;
ETaskShellSidebar *task_shell_sidebar;
ESourceSelector *selector;
@@ -316,6 +318,7 @@ action_task_list_refresh_cb (GtkAction *action,
error->message);
g_error_free (error);
}
+#endif /* ACCOUNT_MGMT */
}
static void
diff --git a/modules/calendar/e-task-shell-view-private.h b/modules/calendar/e-task-shell-view-private.h
index b95c0d5..dcd4f3a 100644
--- a/modules/calendar/e-task-shell-view-private.h
+++ b/modules/calendar/e-task-shell-view-private.h
@@ -37,12 +37,14 @@
#include "shell/e-shell-utils.h"
#include "misc/e-popup-action.h"
#include "misc/e-selectable.h"
+#include "misc/e-source-config-dialog.h"
#include "calendar/common/authentication.h"
#include "calendar/gui/calendar-config.h"
#include "calendar/gui/comp-util.h"
#include "calendar/gui/e-cal-component-preview.h"
#include "calendar/gui/e-cal-model-tasks.h"
+#include "calendar/gui/e-cal-source-config.h"
#include "calendar/gui/e-calendar-selector.h"
#include "calendar/gui/print.h"
#include "calendar/gui/dialogs/calendar-setup.h"
diff --git a/modules/calendar/e-task-shell-view.h b/modules/calendar/e-task-shell-view.h
index 853d90c..d756c10 100644
--- a/modules/calendar/e-task-shell-view.h
+++ b/modules/calendar/e-task-shell-view.h
@@ -23,7 +23,6 @@
#define E_TASK_SHELL_VIEW_H
#include <shell/e-shell-view.h>
-#include <libedataserver/e-source-list.h>
/* Standard GObject macros */
#define E_TYPE_TASK_SHELL_VIEW \
diff --git a/modules/calendar/evolution-module-calendar.c b/modules/calendar/evolution-module-calendar.c
index af972cf..db87bb2 100644
--- a/modules/calendar/evolution-module-calendar.c
+++ b/modules/calendar/evolution-module-calendar.c
@@ -47,7 +47,9 @@
#include "e-cal-config-model.h"
#include "e-cal-config-view.h"
+#if 0 /* ACCOUNT_MGMT */
#include "e-calendar-preferences.h"
+#endif /* ACCOUNT_MGMT */
/* Module Entry Points */
void e_module_load (GTypeModule *type_module);
@@ -86,7 +88,9 @@ e_module_load (GTypeModule *type_module)
e_cal_config_model_register_type (type_module);
e_cal_config_view_register_type (type_module);
+#if 0 /* ACCOUNT_MGMT */
e_calendar_preferences_type_register (type_module);
+#endif /* ACCOUNT_MGMT */
}
G_MODULE_EXPORT void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]