aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-12-23 21:58:10 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-06-03 11:00:40 +0800
commit26e7480340ff1bcdeed3692b5046e4d735f185b1 (patch)
tree81bf81a6e9d7ac39299b847209dd1142b9023bf6
parent7894db49b9a161f7b63d90a98e57ad6a1e1dca54 (diff)
downloadgsoc2013-evolution-26e7480340ff1bcdeed3692b5046e4d735f185b1.tar
gsoc2013-evolution-26e7480340ff1bcdeed3692b5046e4d735f185b1.tar.gz
gsoc2013-evolution-26e7480340ff1bcdeed3692b5046e4d735f185b1.tar.bz2
gsoc2013-evolution-26e7480340ff1bcdeed3692b5046e4d735f185b1.tar.lz
gsoc2013-evolution-26e7480340ff1bcdeed3692b5046e4d735f185b1.tar.xz
gsoc2013-evolution-26e7480340ff1bcdeed3692b5046e4d735f185b1.tar.zst
gsoc2013-evolution-26e7480340ff1bcdeed3692b5046e4d735f185b1.zip
Adapt modules/calendar to the new ESource API.
-rw-r--r--modules/calendar/Makefile.am4
-rw-r--r--modules/calendar/e-cal-attachment-handler.c44
-rw-r--r--modules/calendar/e-cal-shell-backend.c378
-rw-r--r--modules/calendar/e-cal-shell-backend.h8
-rw-r--r--modules/calendar/e-cal-shell-content.c4
-rw-r--r--modules/calendar/e-cal-shell-migrate.c223
-rw-r--r--modules/calendar/e-cal-shell-sidebar.c229
-rw-r--r--modules/calendar/e-cal-shell-sidebar.h10
-rw-r--r--modules/calendar/e-cal-shell-view-actions.c164
-rw-r--r--modules/calendar/e-cal-shell-view-memopad.c17
-rw-r--r--modules/calendar/e-cal-shell-view-private.c35
-rw-r--r--modules/calendar/e-cal-shell-view-private.h6
-rw-r--r--modules/calendar/e-cal-shell-view-taskpad.c17
-rw-r--r--modules/calendar/e-cal-shell-view.c39
-rw-r--r--modules/calendar/e-calendar-preferences.c93
-rw-r--r--modules/calendar/e-calendar-preferences.h4
-rw-r--r--modules/calendar/e-memo-shell-backend.c319
-rw-r--r--modules/calendar/e-memo-shell-backend.h8
-rw-r--r--modules/calendar/e-memo-shell-content.c6
-rw-r--r--modules/calendar/e-memo-shell-migrate.c161
-rw-r--r--modules/calendar/e-memo-shell-sidebar.c168
-rw-r--r--modules/calendar/e-memo-shell-sidebar.h8
-rw-r--r--modules/calendar/e-memo-shell-view-actions.c122
-rw-r--r--modules/calendar/e-memo-shell-view-private.c5
-rw-r--r--modules/calendar/e-memo-shell-view-private.h3
-rw-r--r--modules/calendar/e-memo-shell-view.c15
-rw-r--r--modules/calendar/e-memo-shell-view.h1
-rw-r--r--modules/calendar/e-task-shell-backend.c318
-rw-r--r--modules/calendar/e-task-shell-backend.h8
-rw-r--r--modules/calendar/e-task-shell-content.c6
-rw-r--r--modules/calendar/e-task-shell-migrate.c166
-rw-r--r--modules/calendar/e-task-shell-sidebar.c168
-rw-r--r--modules/calendar/e-task-shell-sidebar.h8
-rw-r--r--modules/calendar/e-task-shell-view-actions.c122
-rw-r--r--modules/calendar/e-task-shell-view-private.c5
-rw-r--r--modules/calendar/e-task-shell-view-private.h3
-rw-r--r--modules/calendar/e-task-shell-view.c15
-rw-r--r--modules/calendar/e-task-shell-view.h1
-rw-r--r--widgets/misc/Makefile.am2
-rw-r--r--widgets/misc/e-alarm-selector.h63
40 files changed, 782 insertions, 2194 deletions
diff --git a/modules/calendar/Makefile.am b/modules/calendar/Makefile.am
index 7965f218b0..43465f39fe 100644
--- a/modules/calendar/Makefile.am
+++ b/modules/calendar/Makefile.am
@@ -12,6 +12,8 @@ module_calendar_la_CPPFLAGS = \
module_calendar_la_SOURCES = \
evolution-module-calendar.c \
+ e-calendar-preferences.c \
+ e-calendar-preferences.h \
e-cal-attachment-handler.c \
e-cal-attachment-handler.h \
e-cal-config-calendar-item.c \
@@ -50,8 +52,6 @@ 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 360635e45f..dedab0241d 100644
--- a/modules/calendar/e-cal-attachment-handler.c
+++ b/modules/calendar/e-cal-attachment-handler.c
@@ -29,9 +29,12 @@
#include <libical/ical.h>
#include <libecal/e-cal-client.h>
#include <camel/camel.h>
+#include <libedataserver/e-source-calendar.h>
#include <libedataserverui/e-source-selector.h>
#include <libedataserverui/e-client-utils.h>
+#include <shell/e-shell.h>
+
#define E_CAL_ATTACHMENT_HANDLER_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_CAL_ATTACHMENT_HANDLER, ECalAttachmentHandlerPrivate))
@@ -288,30 +291,32 @@ attachment_handler_run_dialog (GtkWindow *parent,
ECalClientSourceType source_type,
const gchar *title)
{
+ EShell *shell;
GtkWidget *dialog;
GtkWidget *container;
GtkWidget *widget;
+ ESourceRegistry *registry;
ESourceSelector *selector;
- ESourceList *source_list;
ESource *source;
+ const gchar *extension_name;
icalcomponent *component;
- GError *error = NULL;
-
- component = attachment_handler_get_component (attachment);
- g_return_if_fail (component != NULL);
- e_cal_client_get_sources (&source_list, source_type, &error);
-
- if (error != NULL) {
- g_warning (
- "%s: Failed to get cal sources: %s",
- G_STRFUNC, error->message);
- g_clear_error (&error);
- return;
+ switch (source_type) {
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
+ extension_name = E_SOURCE_EXTENSION_CALENDAR;
+ break;
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
+ extension_name = E_SOURCE_EXTENSION_TASK_LIST;
+ break;
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
+ 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,
@@ -340,10 +345,11 @@ attachment_handler_run_dialog (GtkWindow *parent,
container = widget;
- widget = e_source_selector_new (source_list);
+ shell = e_shell_get_default ();
+ registry = e_shell_get_registry (shell);
+ 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);
@@ -362,14 +368,12 @@ attachment_handler_run_dialog (GtkWindow *parent,
case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
e_client_utils_open_new (
source, E_CLIENT_SOURCE_TYPE_EVENTS, FALSE, NULL,
- e_client_utils_authenticate_handler, NULL,
attachment_handler_import_event,
g_object_ref (attachment));
break;
case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
e_client_utils_open_new (
source, E_CLIENT_SOURCE_TYPE_TASKS, FALSE, NULL,
- e_client_utils_authenticate_handler, NULL,
attachment_handler_import_todo,
g_object_ref (attachment));
break;
diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c
index bcc4ade035..c49ad8a571 100644
--- a/modules/calendar/e-cal-shell-backend.c
+++ b/modules/calendar/e-cal-shell-backend.c
@@ -31,7 +31,7 @@
#include <libecal/e-cal-time-util.h>
#include <libedataserver/e-url.h>
#include <libedataserver/e-source.h>
-#include <libedataserver/e-source-group.h>
+#include <libedataserver/e-source-calendar.h>
#include <libedataserverui/e-client-utils.h>
#include "e-util/e-import.h"
@@ -39,10 +39,11 @@
#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/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"
@@ -60,12 +61,7 @@
((obj), E_TYPE_CAL_SHELL_BACKEND, ECalShellBackendPrivate))
struct _ECalShellBackendPrivate {
- ESourceList *source_list;
-};
-
-enum {
- PROP_0,
- PROP_SOURCE_LIST
+ gint placeholder;
};
G_DEFINE_DYNAMIC_TYPE (
@@ -74,172 +70,6 @@ G_DEFINE_DYNAMIC_TYPE (
E_TYPE_SHELL_BACKEND)
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;
- GError *error = NULL;
-
- 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);
-
- e_cal_client_get_sources (
- &cal_shell_backend->priv->source_list,
- E_CAL_CLIENT_SOURCE_TYPE_EVENTS, &error);
-
- if (error != NULL) {
- g_warning (
- "%s: Could not get calendar sources: %s",
- G_STRFUNC, error->message);
- g_error_free (error);
- 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_get_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 if (!e_source_get_property (personal, "name-changed")) {
- /* 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 if (!e_source_get_property (birthdays, "name-changed")) {
- /* 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,
@@ -350,12 +180,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;
EClientSourceType source_type;
const gchar *action_name;
- gchar *uid;
+
+ shell = e_shell_window_get_shell (shell_window);
action_name = gtk_action_get_name (action);
@@ -397,26 +227,10 @@ action_event_new_cb (GtkAction *action,
source_type = E_CLIENT_SOURCE_TYPE_EVENTS;
- 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_shell_get_registry (shell);
+ source = e_source_registry_ref_default_calendar (registry);
+ shell_backend = e_shell_get_backend_by_name (shell, "calendar");
g_object_set (G_OBJECT (shell_backend), "prefer-new-item", action_name, NULL);
/* Use a callback function appropriate for the action.
@@ -424,30 +238,50 @@ action_event_new_cb (GtkAction *action,
if (strcmp (action_name, "event-all-day-new") == 0)
e_client_utils_open_new (
source, source_type, FALSE, NULL,
- e_client_utils_authenticate_handler, GTK_WINDOW (shell_window),
cal_shell_backend_event_all_day_new_cb,
g_object_ref (shell));
else if (strcmp (action_name, "event-meeting-new") == 0)
e_client_utils_open_new (
source, source_type, FALSE, NULL,
- e_client_utils_authenticate_handler, GTK_WINDOW (shell_window),
cal_shell_backend_event_meeting_new_cb,
g_object_ref (shell));
else
e_client_utils_open_new (
source, source_type, FALSE, NULL,
- e_client_utils_authenticate_handler, GTK_WINDOW (shell_window),
cal_shell_backend_event_new_cb,
g_object_ref (shell));
- g_object_unref (source_list);
+ g_object_unref (source);
}
static void
action_calendar_new_cb (GtkAction *action,
EShellWindow *shell_window)
{
- calendar_setup_new_calendar (GTK_WINDOW (shell_window));
+ EShell *shell;
+ ESourceRegistry *registry;
+ ECalClientSourceType source_type;
+ GtkWidget *config;
+ GtkWidget *dialog;
+ const gchar *icon_name;
+
+ shell = e_shell_window_get_shell (shell_window);
+
+ registry = e_shell_get_registry (shell);
+ source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENTS;
+ config = e_cal_source_config_new (registry, NULL, source_type);
+
+ dialog = e_source_config_dialog_new (E_SOURCE_CONFIG (config));
+
+ gtk_window_set_transient_for (
+ GTK_WINDOW (dialog), 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_widget_show (dialog);
}
static GtkActionEntry item_entries[] = {
@@ -524,7 +358,7 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
ECalClient *client;
ECalComponent *comp;
ESource *source;
- ESourceList *source_list;
+ ESourceRegistry *registry;
ECalClientSourceType source_type;
EUri *euri;
icalcomponent *icalcomp;
@@ -621,21 +455,10 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
* we successfully open it is another matter... */
handled = TRUE;
- e_cal_client_get_sources (&source_list, source_type, &error);
-
- if (error != NULL) {
- g_warning (
- "%s: Could not get calendar sources: %s",
- G_STRFUNC, error->message);
- g_error_free (error);
- goto exit;
- }
-
- source = e_source_list_peek_source_by_uid (source_list, source_uid);
-
+ registry = e_shell_get_registry (shell);
+ source = e_source_registry_ref_source (registry, source_uid);
if (source == NULL) {
- g_warning ("%s: No source for UID '%s'", G_STRFUNC, source_uid);
- g_object_unref (source_list);
+ g_printerr ("No source for UID '%s'\n", source_uid);
goto exit;
}
@@ -649,11 +472,16 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
"%s: Failed to create/open client '%s': %s",
G_STRFUNC, e_source_get_display_name (source),
error->message);
- g_object_unref (source_list);
+ if (client != NULL)
+ g_object_unref (client);
+ g_object_unref (source);
g_error_free (error);
goto exit;
}
+ g_object_unref (source);
+ source = NULL;
+
/* XXX Copied from e_cal_shell_view_open_event().
* Clearly a new utility function is needed. */
@@ -669,7 +497,7 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
g_warning (
"%s: Failed to get object from client: %s",
G_STRFUNC, error->message);
- g_object_unref (source_list);
+ g_object_unref (client);
g_error_free (error);
goto exit;
}
@@ -686,10 +514,10 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
if (icalprop != NULL)
flags |= COMP_EDITOR_MEETING;
- if (itip_organizer_is_user (comp, client))
+ if (itip_organizer_is_user (registry, comp, client))
flags |= COMP_EDITOR_USER_ORG;
- if (itip_sentby_is_user (comp, client))
+ if (itip_sentby_is_user (registry, comp, client))
flags |= COMP_EDITOR_USER_ORG;
if (!e_cal_component_has_attendees (comp))
@@ -703,7 +531,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:
@@ -737,40 +564,6 @@ cal_shell_backend_window_added_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 (e_cal_shell_backend_parent_class)->dispose (object);
-}
-
-static void
cal_shell_backend_constructed (GObject *object)
{
EShell *shell;
@@ -780,8 +573,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),
@@ -827,8 +618,6 @@ e_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);
@@ -841,15 +630,8 @@ e_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
@@ -899,64 +681,6 @@ e_cal_shell_backend_type_register (GTypeModule *type_module)
e_cal_shell_backend_register_type (type_module);
}
-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)
-{
- GSettings *settings;
- GSList *selected_calendars = NULL;
- gchar **strv;
- gint ii;
-
- g_return_val_if_fail (
- E_IS_CAL_SHELL_BACKEND (cal_shell_backend), NULL);
-
- settings = g_settings_new ("org.gnome.evolution.calendar");
- strv = g_settings_get_strv (settings, "selected-calendars");
- g_object_unref (settings);
-
- if (strv != NULL) {
- for (ii = 0; strv[ii] != NULL; ii++)
- selected_calendars = g_slist_append (
- selected_calendars, g_strdup (strv[ii]));
-
- g_strfreev (strv);
- }
-
- return selected_calendars;
-}
-
-void
-e_cal_shell_backend_set_selected_calendars (ECalShellBackend *cal_shell_backend,
- GSList *selected_calendars)
-{
- GSettings *settings;
- GSList *link;
- GPtrArray *array = g_ptr_array_new ();
-
- g_return_if_fail (E_IS_CAL_SHELL_BACKEND (cal_shell_backend));
-
- for (link = selected_calendars; link != NULL; link = link->next)
- g_ptr_array_add (array, link->data);
- g_ptr_array_add (array, NULL);
-
- settings = g_settings_new ("org.gnome.evolution.calendar");
- g_settings_set_strv (
- settings, "selected-calendars",
- (const gchar *const *) array->pdata);
- g_object_unref (settings);
-
- g_ptr_array_free (array, FALSE);
-}
-
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 0907c7edee..c3058af53e 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_type_register
(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-content.c b/modules/calendar/e-cal-shell-content.c
index faa6422737..b77bbfe397 100644
--- a/modules/calendar/e-cal-shell-content.c
+++ b/modules/calendar/e-cal-shell-content.c
@@ -333,6 +333,7 @@ cal_shell_content_constructed (GObject *object)
EShellContent *foreign_content;
EShellView *foreign_view;
GnomeCalendar *calendar;
+ ESourceRegistry *registry;
GalViewInstance *view_instance;
GSettings *settings;
GtkWidget *container;
@@ -401,7 +402,8 @@ cal_shell_content_constructed (GObject *object)
/* Add views in the order defined by GnomeCalendarViewType, such
* that the notebook page number corresponds to the view type. */
- priv->calendar = gnome_calendar_new ();
+ registry = e_shell_get_registry (shell);
+ priv->calendar = gnome_calendar_new (registry);
calendar = GNOME_CALENDAR (priv->calendar);
for (ii = 0; ii < GNOME_CAL_LAST_VIEW; ii++) {
diff --git a/modules/calendar/e-cal-shell-migrate.c b/modules/calendar/e-cal-shell-migrate.c
index 7eb69edb85..3b92c996e7 100644
--- a/modules/calendar/e-cal-shell-migrate.c
+++ b/modules/calendar/e-cal-shell-migrate.c
@@ -25,189 +25,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;
- const gchar *data_dir;
- gchar *base_dir, *base_uri;
-
- data_dir = e_shell_backend_get_data_dir (shell_backend);
- base_dir = g_build_filename (data_dir, "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_get_uid (source));
-
- link.data = (gpointer) e_source_get_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,
@@ -215,46 +32,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 468db23c40..5cecc3ca40 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -27,6 +27,7 @@
#include <string.h>
#include <glib/gi18n.h>
+#include <libedataserver/e-source-calendar.h>
#include <libedataserverui/e-client-utils.h>
#include "libevolution-utils/e-alert-dialog.h"
@@ -34,7 +35,6 @@
#include "calendar/gui/e-calendar-selector.h"
#include "calendar/gui/misc.h"
-#include "calendar/gui/dialogs/calendar-setup.h"
#include "e-cal-shell-view.h"
#include "e-cal-shell-backend.h"
@@ -48,6 +48,7 @@ struct _ECalShellSidebarPrivate {
GtkWidget *paned;
GtkWidget *selector;
GtkWidget *date_navigator;
+ GtkWidget *new_calendar_button;
/* UID -> Client */
GHashTable *client_table;
@@ -150,24 +151,43 @@ cal_shell_sidebar_backend_error_cb (ECalShellSidebar *cal_shell_sidebar,
const gchar *message,
ECalClient *client)
{
+ EShell *shell;
EShellView *shell_view;
+ EShellBackend *shell_backend;
EShellContent *shell_content;
EShellSidebar *shell_sidebar;
- ESourceGroup *source_group;
+ ESourceRegistry *registry;
+ ESource *parent;
ESource *source;
+ const gchar *parent_uid;
+ 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_backend = e_shell_view_get_shell_backend (shell_view);
shell_content = e_shell_view_get_shell_content (shell_view);
+ shell = e_shell_backend_get_shell (shell_backend);
+ registry = e_shell_get_registry (shell);
+
source = e_client_get_source (E_CLIENT (client));
- source_group = e_source_peek_group (source);
+
+ parent_uid = e_source_get_parent (source);
+ parent = e_source_registry_ref_source (registry, parent_uid);
+ g_return_if_fail (parent != NULL);
+
+ 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",
- e_source_group_peek_name (source_group),
- e_source_get_display_name (source), message, NULL);
+ parent_display_name,
+ source_display_name,
+ message, NULL);
+
+ g_object_unref (parent);
}
static void
@@ -237,20 +257,6 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object,
return;
}
- if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_FAILED) ||
- g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_REQUIRED))
- e_client_utils_forget_password (E_CLIENT (client));
-
- if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_FAILED)) {
- e_client_open (
- E_CLIENT (client), FALSE,
- cal_shell_sidebar->priv->loading_clients,
- cal_shell_sidebar_client_opened_cb, user_data);
-
- g_clear_error (&error);
- return;
- }
-
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_BUSY)) {
struct RetryOpenData *rod;
@@ -401,8 +407,6 @@ cal_shell_sidebar_set_default (ECalShellSidebar *cal_shell_sidebar,
ESource *source)
{
ECalShellSidebarPrivate *priv;
- EShellView *shell_view;
- EShellWindow *shell_window;
EShellSidebar *shell_sidebar;
ECalClient *client;
const gchar *uid;
@@ -412,8 +416,6 @@ cal_shell_sidebar_set_default (ECalShellSidebar *cal_shell_sidebar,
/* FIXME Sidebar should not be accessing the EShellContent.
* This probably needs to be moved to ECalShellView. */
shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar);
- shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
- shell_window = e_shell_view_get_shell_window (shell_view);
/* Cancel any unfinished previous request. */
if (priv->loading_default_client != NULL) {
@@ -440,8 +442,6 @@ cal_shell_sidebar_set_default (ECalShellSidebar *cal_shell_sidebar,
e_client_utils_open_new (
source, E_CLIENT_SOURCE_TYPE_EVENTS,
FALSE, priv->loading_default_client,
- e_client_utils_authenticate_handler,
- GTK_WINDOW (shell_window),
cal_shell_sidebar_default_loaded_cb,
g_object_ref (shell_sidebar));
}
@@ -475,38 +475,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_get_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)
{
@@ -530,12 +498,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;
GSettings *settings;
GtkTreeModel *model;
- GSList *list, *iter;
GObject *object;
priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar);
@@ -549,8 +515,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_shell_get_registry (shell);
g_signal_connect_swapped (
model, "row-changed",
@@ -569,31 +534,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 settings keys. */
settings = g_settings_new ("org.gnome.evolution.calendar");
@@ -658,6 +601,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;
@@ -695,19 +643,6 @@ cal_shell_sidebar_finalize (GObject *object)
}
static void
-new_calendar_clicked (GtkButton *button,
- EShellSidebar *shell_sidebar)
-{
- EShellView *shell_view;
- EShellWindow *shell_window;
-
- shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
- 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;
@@ -717,7 +652,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;
@@ -736,9 +671,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);
@@ -748,34 +680,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_shell_get_registry (shell);
+ 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);
@@ -817,8 +751,8 @@ cal_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
ECalShellSidebar *cal_shell_sidebar;
ESourceSelector *selector;
ESource *source;
- gboolean can_delete = FALSE;
- gboolean is_system = FALSE;
+ gboolean removable = FALSE;
+ gboolean writable = FALSE;
gboolean refresh_supported = FALSE;
gboolean has_primary_source = FALSE;
guint32 state = 0;
@@ -828,34 +762,30 @@ cal_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
source = e_source_selector_ref_primary_selection (selector);
if (source != NULL) {
- ECalClient *client;
- const gchar *uri;
- const gchar *delete;
+ EClient *client;
+ const gchar *uid;
has_primary_source = TRUE;
- uri = e_source_peek_relative_uri (source);
- is_system = (uri == NULL || strcmp (uri, "system") == 0);
-
- can_delete = !is_system;
- delete = e_source_get_property (source, "delete");
- can_delete &= (delete == NULL || strcmp (delete, "no") != 0);
+ uid = e_source_get_uid (source);
+ removable = e_source_get_removable (source);
+ writable = e_source_get_writable (source);
client = g_hash_table_lookup (
- cal_shell_sidebar->priv->client_table,
- e_source_get_uid (source));
+ cal_shell_sidebar->priv->client_table, uid);
refresh_supported =
- client && e_client_check_refresh_supported (E_CLIENT (client));
+ client != NULL &&
+ e_client_check_refresh_supported (client);
g_object_unref (source);
}
if (has_primary_source)
state |= E_CAL_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE;
- if (can_delete)
- state |= E_CAL_SHELL_SIDEBAR_CAN_DELETE_PRIMARY_SOURCE;
- if (is_system)
- state |= E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_SYSTEM;
+ if (removable)
+ state |= E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE;
+ if (writable)
+ state |= E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE;
if (refresh_supported)
state |= E_CAL_SHELL_SIDEBAR_SOURCE_SUPPORTS_REFRESH;
@@ -1041,6 +971,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)
{
@@ -1065,8 +1004,8 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
ECalClient *default_client;
ECalClient *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));
@@ -1094,13 +1033,8 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
client = g_object_ref (default_client);
}
- if (client == NULL) {
+ if (client == NULL)
client = e_cal_client_new (source, source_type, NULL);
- if (client)
- g_signal_connect (
- client, "authenticate",
- G_CALLBACK (e_client_utils_authenticate_handler), NULL);
- }
g_return_if_fail (client != NULL);
@@ -1117,9 +1051,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_client_get_uri (E_CLIENT (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);
diff --git a/modules/calendar/e-cal-shell-sidebar.h b/modules/calendar/e-cal-shell-sidebar.h
index 016ade2a7b..d687c63c74 100644
--- a/modules/calendar/e-cal-shell-sidebar.h
+++ b/modules/calendar/e-cal-shell-sidebar.h
@@ -55,10 +55,10 @@ typedef struct _ECalShellSidebarClass ECalShellSidebarClass;
typedef struct _ECalShellSidebarPrivate ECalShellSidebarPrivate;
enum {
- E_CAL_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE = 1 << 0,
- E_CAL_SHELL_SIDEBAR_CAN_DELETE_PRIMARY_SOURCE = 1 << 1,
- E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_SYSTEM = 1 << 2,
- E_CAL_SHELL_SIDEBAR_SOURCE_SUPPORTS_REFRESH = 1 << 3
+ E_CAL_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE = 1 << 0,
+ E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE = 1 << 1,
+ E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE = 1 << 2,
+ E_CAL_SHELL_SIDEBAR_SOURCE_SUPPORTS_REFRESH = 1 << 3
};
struct _ECalShellSidebar {
@@ -90,6 +90,8 @@ ECalendar * e_cal_shell_sidebar_get_date_navigator
(ECalShellSidebar *cal_shell_sidebar);
ECalClient * 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 e6ebd26bfc..09ad350b9d 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -36,13 +36,18 @@ action_calendar_copy_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
ECalShellSidebar *cal_shell_sidebar;
- EShellWindow *shell_window;
+ EShell *shell;
EShellView *shell_view;
+ EShellWindow *shell_window;
+ ESourceRegistry *registry;
ESourceSelector *selector;
ESource *source;
shell_view = E_SHELL_VIEW (cal_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+
+ registry = e_shell_get_registry (shell);
cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
@@ -50,7 +55,7 @@ action_calendar_copy_cb (GtkAction *action,
g_return_if_fail (source != NULL);
copy_source_dialog (
- GTK_WINDOW (shell_window),
+ GTK_WINDOW (shell_window), registry,
source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS);
g_object_unref (source);
@@ -60,33 +65,15 @@ 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;
- ECalClient *client;
ESourceSelector *selector;
- ESourceGroup *source_group;
- ESourceList *source_list;
ESource *source;
gint response;
- gchar *uri;
- GError *error = NULL;
shell_view = E_SHELL_VIEW (cal_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- 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);
@@ -98,28 +85,9 @@ action_calendar_delete_cb (GtkAction *action,
GTK_WINDOW (shell_window),
"calendar:prompt-delete-calendar",
e_source_get_display_name (source), NULL);
- if (response != GTK_RESPONSE_YES) {
- g_object_unref (source);
- return;
- }
-
- uri = e_source_get_uri (source);
- client = e_cal_model_get_client_for_uri (model, uri);
- if (client == NULL)
- client = e_cal_client_new_from_uri (
- uri, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
- g_free (uri);
-
- g_return_if_fail (client != NULL);
- e_client_remove_sync (E_CLIENT (client), NULL, &error);
-
- if (error != NULL) {
- g_warning (
- "%s: Failed to remove client: %s",
- G_STRFUNC, error->message);
+ if (response != GTK_RESPONSE_YES) {
g_object_unref (source);
- g_error_free (error);
return;
}
@@ -129,20 +97,7 @@ action_calendar_delete_cb (GtkAction *action,
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));
-
- e_source_list_sync (source_list, &error);
-
- if (error != NULL) {
- g_warning (
- "%s: Failed to sync source list: %s",
- G_STRFUNC, error->message);
- g_error_free (error);
- }
+ e_shell_view_remove_source (shell_view, source);
g_object_unref (source);
}
@@ -208,12 +163,34 @@ static void
action_calendar_new_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+ EShell *shell;
EShellView *shell_view;
EShellWindow *shell_window;
+ ESourceRegistry *registry;
+ ECalClientSourceType 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));
+ shell = e_shell_window_get_shell (shell_window);
+
+ registry = e_shell_get_registry (shell);
+ source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENTS;
+ config = e_cal_source_config_new (registry, NULL, source_type);
+
+ dialog = e_source_config_dialog_new (E_SOURCE_CONFIG (config));
+
+ gtk_window_set_transient_for (
+ GTK_WINDOW (dialog), 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_widget_show (dialog);
}
static void
@@ -278,11 +255,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;
+ ECalClientSourceType 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);
@@ -292,12 +274,23 @@ action_calendar_properties_cb (GtkAction *action,
source = e_source_selector_ref_primary_selection (selector);
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_CLIENT_SOURCE_TYPE_EVENTS;
+ registry = e_source_selector_get_registry (selector);
+ config = e_cal_source_config_new (registry, source, source_type);
g_object_unref (source);
+
+ dialog = e_source_config_dialog_new (E_SOURCE_CONFIG (config));
+
+ gtk_window_set_transient_for (
+ GTK_WINDOW (dialog), 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_widget_show (dialog);
}
static void
@@ -384,7 +377,6 @@ action_calendar_refresh_cb (GtkAction *action,
ECalClient *client;
ECalModel *model;
ESource *source;
- gchar *uri;
GError *error = NULL;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
@@ -396,10 +388,7 @@ action_calendar_refresh_cb (GtkAction *action,
source = e_source_selector_ref_primary_selection (selector);
g_return_if_fail (source != NULL);
- uri = e_source_get_uri (source);
- client = e_cal_model_get_client_for_uri (model, uri);
- g_free (uri);
-
+ client = e_cal_model_get_client_for_source (model, source);
if (client == NULL) {
g_object_unref (source);
return;
@@ -546,7 +535,9 @@ action_event_copy_cb (GtkAction *action,
GnomeCalendarViewType view_type;
GnomeCalendar *calendar;
ECalendarView *calendar_view;
- ESource *source_source = NULL, *destination_source = NULL;
+ ESource *source_source = NULL;
+ ESource *destination_source = NULL;
+ ESourceRegistry *registry;
ECalClient *destination_client = NULL;
GList *selected, *iter;
GError *error = NULL;
@@ -556,6 +547,8 @@ action_event_copy_cb (GtkAction *action,
cal_shell_content = cal_shell_view->priv->cal_shell_content;
calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ registry = gnome_calendar_get_registry (calendar);
+
view_type = gnome_calendar_get_view (calendar);
calendar_view = gnome_calendar_get_calendar_view (calendar, view_type);
@@ -572,7 +565,7 @@ action_event_copy_cb (GtkAction *action,
/* Get a destination source from the user. */
destination_source = select_source_dialog (
- GTK_WINDOW (shell_window),
+ GTK_WINDOW (shell_window), registry,
E_CAL_CLIENT_SOURCE_TYPE_EVENTS, source_source);
if (destination_source == NULL)
return;
@@ -582,9 +575,6 @@ action_event_copy_cb (GtkAction *action,
destination_source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
if (destination_client == NULL)
goto exit;
- g_signal_connect (
- destination_client, "authenticate",
- G_CALLBACK (e_client_utils_authenticate_handler), NULL);
e_client_open_sync (E_CLIENT (destination_client), FALSE, NULL, &error);
@@ -621,6 +611,7 @@ static void
action_event_delegate_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
+ ESourceRegistry *registry;
ECalShellContent *cal_shell_content;
GnomeCalendarViewType view_type;
GnomeCalendar *calendar;
@@ -628,6 +619,7 @@ action_event_delegate_cb (GtkAction *action,
ECalendarViewEvent *event;
ECalComponent *component;
ECalClient *client;
+ ECalModel *model;
GList *selected;
icalcomponent *clone;
icalproperty *property;
@@ -642,6 +634,9 @@ action_event_delegate_cb (GtkAction *action,
selected = e_calendar_view_get_selected_events (calendar_view);
g_return_if_fail (g_list_length (selected) == 1);
+ model = e_calendar_view_get_model (calendar_view);
+ registry = e_cal_model_get_registry (model);
+
event = selected->data;
if (!is_comp_data_valid (event))
@@ -656,7 +651,8 @@ action_event_delegate_cb (GtkAction *action,
e_cal_component_set_icalcomponent (
component, icalcomponent_new_clone (clone));
- attendee = itip_get_comp_attendee (component, client);
+ attendee = itip_get_comp_attendee (
+ registry, component, client);
property = icalcomponent_get_first_property (
clone, ICAL_ATTENDEE_PROPERTY);
@@ -762,6 +758,7 @@ action_event_forward_cb (GtkAction *action,
GnomeCalendarViewType view_type;
ECalendarView *calendar_view;
GnomeCalendar *calendar;
+ ESourceRegistry *registry;
ECalendarViewEvent *event;
ECalComponent *component;
ECalClient *client;
@@ -770,6 +767,8 @@ action_event_forward_cb (GtkAction *action,
cal_shell_content = cal_shell_view->priv->cal_shell_content;
calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ registry = gnome_calendar_get_registry (calendar);
+
view_type = gnome_calendar_get_view (calendar);
calendar_view = gnome_calendar_get_calendar_view (calendar, view_type);
@@ -789,7 +788,7 @@ action_event_forward_cb (GtkAction *action,
e_cal_component_set_icalcomponent (
component, icalcomponent_new_clone (icalcomp));
itip_send_comp (
- E_CAL_COMPONENT_METHOD_PUBLISH,
+ registry, E_CAL_COMPONENT_METHOD_PUBLISH,
component, client, NULL, NULL, NULL, TRUE, FALSE);
g_object_unref (component);
@@ -830,7 +829,9 @@ action_event_move_cb (GtkAction *action,
GnomeCalendarViewType view_type;
GnomeCalendar *calendar;
ECalendarView *calendar_view;
- ESource *source_source = NULL, *destination_source = NULL;
+ ESource *source_source = NULL;
+ ESource *destination_source = NULL;
+ ESourceRegistry *registry;
ECalClient *destination_client = NULL;
GList *selected, *iter;
GError *error = NULL;
@@ -840,6 +841,8 @@ action_event_move_cb (GtkAction *action,
cal_shell_content = cal_shell_view->priv->cal_shell_content;
calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ registry = gnome_calendar_get_registry (calendar);
+
view_type = gnome_calendar_get_view (calendar);
calendar_view = gnome_calendar_get_calendar_view (calendar, view_type);
@@ -856,7 +859,7 @@ action_event_move_cb (GtkAction *action,
/* Get a destination source from the user. */
destination_source = select_source_dialog (
- GTK_WINDOW (shell_window),
+ GTK_WINDOW (shell_window), registry,
E_CAL_CLIENT_SOURCE_TYPE_EVENTS, source_source);
if (destination_source == NULL)
return;
@@ -866,9 +869,6 @@ action_event_move_cb (GtkAction *action,
destination_source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
if (destination_client == NULL)
goto exit;
- g_signal_connect (
- destination_client, "authenticate",
- G_CALLBACK (e_client_utils_authenticate_handler), NULL);
e_client_open_sync (E_CLIENT (destination_client), FALSE, NULL, &error);
@@ -1088,12 +1088,15 @@ action_event_reply_cb (GtkAction *action,
ECalendarViewEvent *event;
ECalComponent *component;
ECalClient *client;
+ ESourceRegistry *registry;
icalcomponent *icalcomp;
GList *selected;
gboolean reply_all = FALSE;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ registry = gnome_calendar_get_registry (calendar);
+
view_type = gnome_calendar_get_view (calendar);
calendar_view = gnome_calendar_get_calendar_view (calendar, view_type);
@@ -1113,7 +1116,7 @@ action_event_reply_cb (GtkAction *action,
e_cal_component_set_icalcomponent (
component, icalcomponent_new_clone (icalcomp));
reply_to_calendar_comp (
- E_CAL_COMPONENT_METHOD_REPLY,
+ registry, E_CAL_COMPONENT_METHOD_REPLY,
component, client, reply_all, NULL, NULL);
g_object_unref (component);
@@ -1132,12 +1135,15 @@ action_event_reply_all_cb (GtkAction *action,
ECalendarViewEvent *event;
ECalComponent *component;
ECalClient *client;
+ ESourceRegistry *registry;
icalcomponent *icalcomp;
GList *selected;
gboolean reply_all = TRUE;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ registry = gnome_calendar_get_registry (calendar);
+
view_type = gnome_calendar_get_view (calendar);
calendar_view = gnome_calendar_get_calendar_view (calendar, view_type);
@@ -1157,7 +1163,7 @@ action_event_reply_all_cb (GtkAction *action,
e_cal_component_set_icalcomponent (
component, icalcomponent_new_clone (icalcomp));
reply_to_calendar_comp (
- E_CAL_COMPONENT_METHOD_REPLY,
+ registry, E_CAL_COMPONENT_METHOD_REPLY,
component, client, reply_all, NULL, NULL);
g_object_unref (component);
diff --git a/modules/calendar/e-cal-shell-view-memopad.c b/modules/calendar/e-cal-shell-view-memopad.c
index eab1254415..f8a0e2da0a 100644
--- a/modules/calendar/e-cal-shell-view-memopad.c
+++ b/modules/calendar/e-cal-shell-view-memopad.c
@@ -32,12 +32,22 @@ action_calendar_memopad_forward_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
ECalShellContent *cal_shell_content;
+ EShell *shell;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ ESourceRegistry *registry;
EMemoTable *memo_table;
ECalModelComponent *comp_data;
ECalComponent *comp;
icalcomponent *clone;
GSList *list;
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+
+ registry = e_shell_get_registry (shell);
+
cal_shell_content = cal_shell_view->priv->cal_shell_content;
memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
@@ -52,7 +62,7 @@ action_calendar_memopad_forward_cb (GtkAction *action,
e_cal_component_set_icalcomponent (comp, clone);
itip_send_comp (
- E_CAL_COMPONENT_METHOD_PUBLISH, comp,
+ registry, E_CAL_COMPONENT_METHOD_PUBLISH, comp,
comp_data->client, NULL, NULL, NULL, TRUE, FALSE);
g_object_unref (comp);
@@ -393,6 +403,7 @@ e_cal_shell_view_memopad_open_memo (ECalShellView *cal_shell_view,
EShell *shell;
EShellView *shell_view;
EShellWindow *shell_window;
+ ESourceRegistry *registry;
CompEditor *editor;
CompEditorFlags flags = 0;
ECalComponent *comp;
@@ -406,6 +417,8 @@ e_cal_shell_view_memopad_open_memo (ECalShellView *cal_shell_view,
shell_window = e_shell_view_get_shell_window (shell_view);
shell = e_shell_window_get_shell (shell_window);
+ registry = e_shell_get_registry (shell);
+
uid = icalcomponent_get_uid (comp_data->icalcomp);
editor = comp_editor_find_instance (uid);
@@ -419,7 +432,7 @@ e_cal_shell_view_memopad_open_memo (ECalShellView *cal_shell_view,
if (e_cal_component_has_organizer (comp))
flags |= COMP_EDITOR_IS_SHARED;
- if (itip_organizer_is_user (comp, comp_data->client))
+ if (itip_organizer_is_user (registry, comp, comp_data->client))
flags |= COMP_EDITOR_USER_ORG;
editor = memo_editor_new (comp_data->client, shell, flags);
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index 5418d6cab9..0f7b0b7a17 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -536,6 +536,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;
@@ -687,6 +688,13 @@ e_cal_shell_view_private_constructed (ECalShellView *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",
@@ -764,6 +772,7 @@ e_cal_shell_view_open_event (ECalShellView *cal_shell_view,
EShell *shell;
EShellView *shell_view;
EShellWindow *shell_window;
+ ESourceRegistry *registry;
CompEditor *editor;
CompEditorFlags flags = 0;
ECalComponent *comp;
@@ -778,6 +787,8 @@ e_cal_shell_view_open_event (ECalShellView *cal_shell_view,
shell_window = e_shell_view_get_shell_window (shell_view);
shell = e_shell_window_get_shell (shell_window);
+ registry = e_shell_get_registry (shell);
+
uid = icalcomponent_get_uid (comp_data->icalcomp);
editor = comp_editor_find_instance (uid);
@@ -793,10 +804,10 @@ e_cal_shell_view_open_event (ECalShellView *cal_shell_view,
if (prop != NULL)
flags |= COMP_EDITOR_MEETING;
- if (itip_organizer_is_user (comp, comp_data->client))
+ if (itip_organizer_is_user (registry, comp, comp_data->client))
flags |= COMP_EDITOR_USER_ORG;
- if (itip_sentby_is_user (comp, comp_data->client))
+ if (itip_sentby_is_user (registry, comp, comp_data->client))
flags |= COMP_EDITOR_USER_ORG;
if (!e_cal_component_has_attendees (comp))
@@ -883,9 +894,6 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view,
icalcomponent *icalcomp_event;
gboolean success;
const gchar *uid;
- EShell *shell;
- EShellContent *shell_content;
- gboolean is_src_local_cal, is_dest_local_cal;
/* XXX This function should be split up into
* smaller, more understandable pieces. */
@@ -897,23 +905,6 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view,
if (!is_comp_data_valid (event))
return;
- /*If not online and
- * source isn't a local calendar and operation is move or destination isn't a local calendar,
- * then Return*/
- is_src_local_cal = g_str_has_prefix (e_client_get_uri(E_CLIENT (event->comp_data->client)), "local:");
- is_dest_local_cal = g_str_has_prefix (e_client_get_uri(E_CLIENT (destination_client)), "local:");
-
- shell = e_shell_get_default ();
- shell_content = e_shell_view_get_shell_content (E_SHELL_VIEW (cal_shell_view));
- if (!e_shell_get_online (shell) && ((!is_src_local_cal && remove) || !is_dest_local_cal))
- {
- e_alert_submit (
- E_ALERT_SINK (shell_content),
- "calendar:online-operation",
- NULL);
- return;
- }
-
icalcomp_event = event->comp_data->icalcomp;
uid = icalcomponent_get_uid (icalcomp_event);
diff --git a/modules/calendar/e-cal-shell-view-private.h b/modules/calendar/e-cal-shell-view-private.h
index 4fc5e24724..2687c74f52 100644
--- a/modules/calendar/e-cal-shell-view-private.h
+++ b/modules/calendar/e-cal-shell-view-private.h
@@ -32,6 +32,7 @@
#include <libedataserver/e-categories.h>
#include <libedataserver/e-data-server-util.h>
#include <libedataserver/e-sexp.h>
+#include <libedataserver/e-source-registry.h>
#include <libedataserverui/e-client-utils.h>
#include <e-util/e-selection.h>
@@ -39,23 +40,22 @@
#include <e-util/e-file-utils.h>
#include <e-util/e-util.h>
-#include <libemail-utils/e-account-utils.h>
-
#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/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>
#include <calendar/gui/gnome-cal.h>
#include <calendar/gui/print.h>
-#include <calendar/gui/dialogs/calendar-setup.h>
#include <calendar/gui/dialogs/copy-source-dialog.h>
#include <calendar/gui/dialogs/event-editor.h>
#include <calendar/gui/dialogs/goto-dialog.h>
diff --git a/modules/calendar/e-cal-shell-view-taskpad.c b/modules/calendar/e-cal-shell-view-taskpad.c
index 5a88c7d92c..ec268775e9 100644
--- a/modules/calendar/e-cal-shell-view-taskpad.c
+++ b/modules/calendar/e-cal-shell-view-taskpad.c
@@ -55,12 +55,22 @@ action_calendar_taskpad_forward_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
ECalShellContent *cal_shell_content;
+ EShell *shell;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ ESourceRegistry *registry;
ECalModelComponent *comp_data;
ETaskTable *task_table;
ECalComponent *comp;
icalcomponent *clone;
GSList *list;
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+
+ registry = e_shell_get_registry (shell);
+
cal_shell_content = cal_shell_view->priv->cal_shell_content;
task_table = e_cal_shell_content_get_task_table (cal_shell_content);
@@ -75,7 +85,7 @@ action_calendar_taskpad_forward_cb (GtkAction *action,
e_cal_component_set_icalcomponent (comp, clone);
itip_send_comp (
- E_CAL_COMPONENT_METHOD_PUBLISH, comp,
+ registry, E_CAL_COMPONENT_METHOD_PUBLISH, comp,
comp_data->client, NULL, NULL, NULL, TRUE, FALSE);
g_object_unref (comp);
@@ -511,6 +521,7 @@ e_cal_shell_view_taskpad_open_task (ECalShellView *cal_shell_view,
EShell *shell;
EShellView *shell_view;
EShellWindow *shell_window;
+ ESourceRegistry *registry;
CompEditor *editor;
CompEditorFlags flags = 0;
ECalComponent *comp;
@@ -525,6 +536,8 @@ e_cal_shell_view_taskpad_open_task (ECalShellView *cal_shell_view,
shell_window = e_shell_view_get_shell_window (shell_view);
shell = e_shell_window_get_shell (shell_window);
+ registry = e_shell_get_registry (shell);
+
uid = icalcomponent_get_uid (comp_data->icalcomp);
editor = comp_editor_find_instance (uid);
@@ -540,7 +553,7 @@ e_cal_shell_view_taskpad_open_task (ECalShellView *cal_shell_view,
if (prop != NULL)
flags |= COMP_EDITOR_IS_ASSIGNED;
- if (itip_organizer_is_user (comp, comp_data->client))
+ if (itip_organizer_is_user (registry, comp, comp_data->client))
flags |= COMP_EDITOR_USER_ORG;
if (!e_cal_component_has_attendees (comp))
diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c
index f6b83104fd..d349882a82 100644
--- a/modules/calendar/e-cal-shell-view.c
+++ b/modules/calendar/e-cal-shell-view.c
@@ -377,6 +377,8 @@ cal_shell_view_update_actions (EShellView *shell_view)
EShellSidebar *shell_sidebar;
EShellWindow *shell_window;
EShell *shell;
+ ESource *source;
+ ESourceRegistry *registry;
GnomeCalendarViewType view_type;
GnomeCalendar *calendar;
ECalModel *model;
@@ -386,14 +388,15 @@ cal_shell_view_update_actions (EShellView *shell_view)
const gchar *model_sexp;
gboolean is_searching;
gboolean sensitive;
- gboolean visible;
guint32 state;
gint n_selected;
/* Be descriptive. */
- gboolean can_delete_primary_source;
gboolean editable = TRUE;
+ gboolean has_mail_identity;
gboolean has_primary_source;
+ gboolean primary_source_is_removable;
+ gboolean primary_source_is_writable;
gboolean recurring = FALSE;
gboolean is_instance = FALSE;
gboolean is_meeting = FALSE;
@@ -424,6 +427,15 @@ cal_shell_view_update_actions (EShellView *shell_view)
gtk_widget_hide (widget);
}
+ registry = e_shell_get_registry (shell);
+ source = e_source_registry_ref_default_mail_identity (registry);
+ if (source != NULL) {
+ has_mail_identity = TRUE;
+ g_object_unref (source);
+ } else {
+ has_mail_identity = FALSE;
+ }
+
cal_shell_content = priv->cal_shell_content;
calendar = e_cal_shell_content_get_calendar (cal_shell_content);
view_type = gnome_calendar_get_view (calendar);
@@ -468,13 +480,14 @@ cal_shell_view_update_actions (EShellView *shell_view)
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (
comp, icalcomponent_new_clone (icalcomp));
- user_email = itip_get_comp_attendee (comp, client);
+ user_email = itip_get_comp_attendee (
+ registry, comp, client);
is_meeting = e_cal_util_component_has_attendee (icalcomp);
user_org =
e_cal_util_component_has_organizer (icalcomp) &&
- itip_organizer_is_user (comp, client);
+ itip_organizer_is_user (registry, comp, client);
is_delegatable =
e_client_check_capability (
@@ -496,8 +509,10 @@ cal_shell_view_update_actions (EShellView *shell_view)
has_primary_source =
(state & E_CAL_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE);
- can_delete_primary_source =
- (state & E_CAL_SHELL_SIDEBAR_CAN_DELETE_PRIMARY_SOURCE);
+ primary_source_is_removable =
+ (state & E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE);
+ primary_source_is_writable =
+ (state & E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE);
refresh_supported =
(state & E_CAL_SHELL_SIDEBAR_SOURCE_SUPPORTS_REFRESH);
@@ -506,11 +521,11 @@ cal_shell_view_update_actions (EShellView *shell_view)
gtk_action_set_sensitive (action, sensitive);
action = ACTION (CALENDAR_DELETE);
- sensitive = can_delete_primary_source;
+ sensitive = primary_source_is_removable;
gtk_action_set_sensitive (action, sensitive);
action = ACTION (CALENDAR_PROPERTIES);
- sensitive = has_primary_source;
+ sensitive = primary_source_is_writable;
gtk_action_set_sensitive (action, sensitive);
action = ACTION (CALENDAR_REFRESH);
@@ -518,7 +533,7 @@ cal_shell_view_update_actions (EShellView *shell_view)
gtk_action_set_sensitive (action, sensitive);
action = ACTION (CALENDAR_RENAME);
- sensitive = can_delete_primary_source;
+ sensitive = primary_source_is_writable;
gtk_action_set_sensitive (action, sensitive);
action = ACTION (CALENDAR_SEARCH_PREV);
@@ -528,7 +543,8 @@ cal_shell_view_update_actions (EShellView *shell_view)
gtk_action_set_sensitive (action, is_searching);
action = ACTION (CALENDAR_SEARCH_STOP);
- gtk_action_set_sensitive (action, is_searching && priv->searching_activity != NULL);
+ sensitive = is_searching && priv->searching_activity != NULL;
+ gtk_action_set_sensitive (action, sensitive);
action = ACTION (EVENT_DELEGATE);
sensitive =
@@ -583,8 +599,7 @@ cal_shell_view_update_actions (EShellView *shell_view)
gtk_action_set_sensitive (action, sensitive);
action = ACTION (EVENT_MEETING_NEW);
- visible = e_get_default_account () != NULL;
- gtk_action_set_visible (action, visible);
+ gtk_action_set_visible (action, has_mail_identity);
}
static void
diff --git a/modules/calendar/e-calendar-preferences.c b/modules/calendar/e-calendar-preferences.c
index 6df9b8bde3..8c5c2796c4 100644
--- a/modules/calendar/e-calendar-preferences.c
+++ b/modules/calendar/e-calendar-preferences.c
@@ -34,6 +34,7 @@
#include "calendar/gui/e-cal-config.h"
#include "calendar/gui/e-timezone-entry.h"
#include "calendar/gui/calendar-config.h"
+#include "widgets/misc/e-alarm-selector.h"
#include "widgets/misc/e-dateedit.h"
#include "e-util/e-util.h"
#include "e-util/e-datetime-format.h"
@@ -125,6 +126,11 @@ calendar_preferences_dispose (GObject *object)
prefs->builder = NULL;
}
+ if (prefs->registry != NULL) {
+ g_object_unref (prefs->registry);
+ prefs->registry = NULL;
+ }
+
if (prefs->shell_settings != NULL) {
g_object_unref (prefs->shell_settings);
prefs->shell_settings = NULL;
@@ -345,50 +351,6 @@ notify_with_tray_toggled (GtkToggleButton *toggle,
}
static void
-alarms_selection_changed (ESourceSelector *selector,
- ECalendarPreferences *prefs)
-{
- ESourceList *source_list = prefs->alarms_list;
- GSList *selection;
- GSList *l;
- GSList *groups;
- ESource *source;
- const gchar *alarm;
-
- /* first we clear all the alarm flags from all sources */
- for (groups = e_source_list_peek_groups (source_list); groups; groups = groups->next) {
- ESourceGroup *group = E_SOURCE_GROUP (groups->data);
- GSList *sources;
- for (sources = e_source_group_peek_sources (group); sources; sources = sources->next) {
- source = E_SOURCE (sources->data);
-
- alarm = e_source_get_property (source, "alarm");
- if (alarm && !g_ascii_strcasecmp (alarm, "never"))
- continue;
-
- e_source_set_property (source, "alarm", "false");
- }
- }
-
- /* then we loop over the selector's selection, setting the
- * property on those sources */
- selection = e_source_selector_get_selection (selector);
- for (l = selection; l; l = l->next) {
- source = E_SOURCE (l->data);
-
- alarm = (gchar *)e_source_get_property (source, "alarm");
- if (alarm && !g_ascii_strcasecmp (alarm, "never"))
- continue;
-
- e_source_set_property (E_SOURCE (l->data), "alarm", "true");
- }
- e_source_selector_free_selection (selection);
-
- /* FIXME show an error if this fails? */
- e_source_list_sync (source_list, NULL);
-}
-
-static void
update_system_tz_widgets (EShellSettings *shell_settings,
GParamSpec *pspec,
ECalendarPreferences *prefs)
@@ -430,45 +392,20 @@ setup_changes (ECalendarPreferences *prefs)
g_signal_connect (
prefs->notify_with_tray, "toggled",
G_CALLBACK (notify_with_tray_toggled), prefs);
-
- g_signal_connect (
- prefs->alarm_list_widget, "selection_changed",
- G_CALLBACK (alarms_selection_changed), prefs);
-}
-
-static void
-initialize_selection (ESourceSelector *selector,
- ESourceList *source_list)
-{
- GSList *groups;
-
- for (groups = e_source_list_peek_groups (source_list); groups; groups = groups->next) {
- ESourceGroup *group = E_SOURCE_GROUP (groups->data);
- GSList *sources;
- for (sources = e_source_group_peek_sources (group); sources; sources = sources->next) {
- ESource *source = E_SOURCE (sources->data);
- const gchar *completion = e_source_get_property (source, "alarm");
- if (!completion || !g_ascii_strcasecmp (completion, "true")) {
- if (!completion)
- e_source_set_property (E_SOURCE (source), "alarm", "true");
- e_source_selector_select_source (selector, source);
- }
- }
- }
}
static void
show_alarms_config (ECalendarPreferences *prefs)
{
GSettings *settings;
+ GtkWidget *widget;
- if (e_cal_client_get_sources (&prefs->alarms_list, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL)) {
- prefs->alarm_list_widget = e_source_selector_new (prefs->alarms_list);
- atk_object_set_name (gtk_widget_get_accessible (prefs->alarm_list_widget), _("Selected Calendars for Reminders"));
- gtk_container_add (GTK_CONTAINER (prefs->scrolled_window), prefs->alarm_list_widget);
- gtk_widget_show (prefs->alarm_list_widget);
- initialize_selection (E_SOURCE_SELECTOR (prefs->alarm_list_widget), prefs->alarms_list);
- }
+ widget = e_alarm_selector_new (prefs->registry);
+ atk_object_set_name (
+ gtk_widget_get_accessible (widget),
+ _("Selected Calendars for Alarms"));
+ gtk_container_add (GTK_CONTAINER (prefs->scrolled_window), widget);
+ gtk_widget_show (widget);
settings = g_settings_new ("org.gnome.evolution.calendar");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->notify_with_tray), g_settings_get_boolean (settings, "notify-with-tray"));
@@ -941,16 +878,20 @@ GtkWidget *
e_calendar_preferences_new (EPreferencesWindow *window)
{
EShell *shell;
+ ESourceRegistry *registry;
EShellSettings *shell_settings;
ECalendarPreferences *preferences;
shell = e_preferences_window_get_shell (window);
+
+ registry = e_shell_get_registry (shell);
shell_settings = e_shell_get_shell_settings (shell);
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
preferences = g_object_new (E_TYPE_CALENDAR_PREFERENCES, NULL);
+ preferences->registry = g_object_ref (registry);
preferences->shell_settings = g_object_ref (shell_settings);
/* FIXME Kill this function. */
diff --git a/modules/calendar/e-calendar-preferences.h b/modules/calendar/e-calendar-preferences.h
index ae96fc1b1f..5cb05e50b4 100644
--- a/modules/calendar/e-calendar-preferences.h
+++ b/modules/calendar/e-calendar-preferences.h
@@ -26,6 +26,7 @@
#include <gtk/gtk.h>
#include <shell/e-shell.h>
+#include <libedataserver/e-source-registry.h>
#include <libedataserverui/e-source-selector.h>
#include <widgets/misc/e-preferences-window.h>
@@ -58,6 +59,7 @@ struct _ECalendarPreferences {
GtkBuilder *builder;
+ ESourceRegistry *registry;
EShellSettings *shell_settings;
/* General tab */
@@ -71,8 +73,6 @@ struct _ECalendarPreferences {
/* Alarms tab */
GtkWidget *notify_with_tray;
GtkWidget *scrolled_window;
- ESourceList *alarms_list;
- GtkWidget *alarm_list_widget;
};
struct _ECalendarPreferencesClass {
diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c
index c34808698e..efafe383f0 100644
--- a/modules/calendar/e-memo-shell-backend.c
+++ b/modules/calendar/e-memo-shell-backend.c
@@ -30,17 +30,17 @@
#include <libecal/e-cal-client.h>
#include <libedataserver/e-url.h>
#include <libedataserver/e-source.h>
-#include <libedataserver/e-source-list.h>
-#include <libedataserver/e-source-group.h>
+#include <libedataserver/e-source-calendar.h>
#include <libedataserverui/e-client-utils.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/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,20 +49,12 @@
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_MEMO_SHELL_BACKEND, EMemoShellBackendPrivate))
-#define WEB_BASE_URI "webcal://"
-#define PERSONAL_RELATIVE_URI "system"
-
#define E_MEMO_SHELL_BACKEND_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_MEMO_SHELL_BACKEND, EMemoShellBackendPrivate))
struct _EMemoShellBackendPrivate {
- ESourceList *source_list;
-};
-
-enum {
- PROP_0,
- PROP_SOURCE_LIST
+ gint placeholder;
};
G_DEFINE_DYNAMIC_TYPE (
@@ -71,110 +63,6 @@ G_DEFINE_DYNAMIC_TYPE (
E_TYPE_SHELL_BACKEND)
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;
- GError *error = NULL;
-
- 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);
-
- e_cal_client_get_sources (
- &memo_shell_backend->priv->source_list,
- E_CAL_CLIENT_SOURCE_TYPE_MEMOS, &error);
-
- if (error != NULL) {
- g_warning (
- "%s: Could not get memo sources: %s",
- G_STRFUNC, error->message);
- g_error_free (error);
- 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_get_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 if (!e_source_get_property (personal, "name-changed")) {
- /* 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,
@@ -250,59 +138,64 @@ 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;
+ EClientSourceType source_type;
const gchar *action_name;
- gchar *uid;
/* This callback is used for both memos and shared memos. */
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_shell_get_registry (shell);
+ source_type = E_CLIENT_SOURCE_TYPE_MEMOS;
+ source = e_source_registry_ref_default_memo_list (registry);
/* Use a callback function appropriate for the action.
* FIXME Need to obtain a better default time zone. */
action_name = gtk_action_get_name (action);
if (g_strcmp0 (action_name, "memo-shared-new") == 0)
e_client_utils_open_new (
- source, E_CLIENT_SOURCE_TYPE_MEMOS, FALSE, NULL,
- e_client_utils_authenticate_handler, GTK_WINDOW (shell_window),
+ source, source_type, FALSE, NULL,
memo_shell_backend_memo_shared_new_cb,
g_object_ref (shell));
else
e_client_utils_open_new (
- source, E_CLIENT_SOURCE_TYPE_MEMOS, FALSE, NULL,
- e_client_utils_authenticate_handler, GTK_WINDOW (shell_window),
+ source, source_type, FALSE, NULL,
memo_shell_backend_memo_new_cb,
g_object_ref (shell));
- g_object_unref (source_list);
+ g_object_unref (source);
}
static void
action_memo_list_new_cb (GtkAction *action,
EShellWindow *shell_window)
{
- calendar_setup_new_memo_list (GTK_WINDOW (shell_window));
+ EShell *shell;
+ ESourceRegistry *registry;
+ ECalClientSourceType source_type;
+ GtkWidget *config;
+ GtkWidget *dialog;
+ const gchar *icon_name;
+
+ shell = e_shell_window_get_shell (shell_window);
+
+ registry = e_shell_get_registry (shell);
+ source_type = E_CAL_CLIENT_SOURCE_TYPE_MEMOS;
+ config = e_cal_source_config_new (registry, NULL, source_type);
+
+ dialog = e_source_config_dialog_new (E_SOURCE_CONFIG (config));
+
+ gtk_window_set_transient_for (
+ GTK_WINDOW (dialog), 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_widget_show (dialog);
}
static GtkActionEntry item_entries[] = {
@@ -342,7 +235,7 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
ECalClient *client;
ECalComponent *comp;
ESource *source;
- ESourceList *source_list;
+ ESourceRegistry *registry;
ECalClientSourceType source_type;
EUri *euri;
icalcomponent *icalcomp;
@@ -406,31 +299,17 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
* we successfully open it is another matter... */
handled = TRUE;
- e_cal_client_get_sources (&source_list, source_type, &error);
-
- if (error != NULL) {
- g_warning (
- "%s: Could not get memo sources: %s",
- G_STRFUNC, error->message);
- g_clear_error (&error);
- goto exit;
- }
-
- source = e_source_list_peek_source_by_uid (source_list, source_uid);
+ registry = e_shell_get_registry (shell);
+ source = e_source_registry_ref_source (registry, source_uid);
if (source == NULL) {
g_printerr ("No source for UID '%s'\n", source_uid);
- g_object_unref (source_list);
goto exit;
}
client = e_cal_client_new (source, source_type, &error);
- if (client != NULL) {
- g_signal_connect (
- client, "authenticate",
- G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+ if (client != NULL)
e_client_open_sync (E_CLIENT (client), TRUE, NULL, &error);
- }
if (error != NULL) {
g_warning (
@@ -438,11 +317,14 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
G_STRFUNC, error->message);
if (client != NULL)
g_object_unref (client);
- g_object_unref (source_list);
+ g_object_unref (source);
g_error_free (error);
goto exit;
}
+ g_object_unref (source);
+ source = NULL;
+
/* XXX Copied from e_memo_shell_view_open_memo().
* Clearly a new utility function is needed. */
@@ -458,7 +340,6 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
g_warning (
"%s: Failed to get object: %s",
G_STRFUNC, error->message);
- g_object_unref (source_list);
g_object_unref (client);
g_error_free (error);
goto exit;
@@ -474,7 +355,7 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
if (e_cal_component_has_organizer (comp))
flags |= COMP_EDITOR_IS_SHARED;
- if (itip_organizer_is_user (comp, client))
+ if (itip_organizer_is_user (registry, comp, client))
flags |= COMP_EDITOR_USER_ORG;
editor = memo_editor_new (client, shell, flags);
@@ -485,7 +366,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:
@@ -519,40 +399,6 @@ memo_shell_backend_window_added_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 (e_memo_shell_backend_parent_class)->dispose (object);
-}
-
-static void
memo_shell_backend_constructed (GObject *object)
{
EShell *shell;
@@ -561,8 +407,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),
@@ -586,8 +430,6 @@ e_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);
@@ -600,15 +442,8 @@ e_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
@@ -631,61 +466,3 @@ e_memo_shell_backend_type_register (GTypeModule *type_module)
* order to register types from a separate compilation unit. */
e_memo_shell_backend_register_type (type_module);
}
-
-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)
-{
- GSettings *settings;
- GSList *selected_memo_lists = NULL;
- gchar **strv;
- gint ii;
-
- g_return_val_if_fail (
- E_IS_MEMO_SHELL_BACKEND (memo_shell_backend), NULL);
-
- settings = g_settings_new ("org.gnome.evolution.calendar");
- strv = g_settings_get_strv (settings, "selected-memos");
- g_object_unref (settings);
-
- if (strv != NULL) {
- for (ii = 0; strv[ii] != NULL; ii++)
- selected_memo_lists = g_slist_append (
- selected_memo_lists, g_strdup (strv[ii]));
-
- g_strfreev (strv);
- }
-
- return selected_memo_lists;
-}
-
-void
-e_memo_shell_backend_set_selected_memo_lists (EMemoShellBackend *memo_shell_backend,
- GSList *selected_memo_lists)
-{
- GSettings *settings;
- GSList *link;
- GPtrArray *array = g_ptr_array_new ();
-
- g_return_if_fail (E_IS_MEMO_SHELL_BACKEND (memo_shell_backend));
-
- for (link = selected_memo_lists; link != NULL; link = link->next)
- g_ptr_array_add (array, link->data);
- g_ptr_array_add (array, NULL);
-
- settings = g_settings_new ("org.gnome.evolution.calendar");
- g_settings_set_strv (
- settings, "selected-memos",
- (const gchar *const *) array->pdata);
- g_object_unref (settings);
-
- g_ptr_array_free (array, FALSE);
-}
diff --git a/modules/calendar/e-memo-shell-backend.h b/modules/calendar/e-memo-shell-backend.h
index 5bf66b37a3..f759e5e138 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_type_register
(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 19dbf8e564..bd9cc09b57 100644
--- a/modules/calendar/e-memo-shell-content.c
+++ b/modules/calendar/e-memo-shell-content.c
@@ -427,10 +427,12 @@ static void
memo_shell_content_constructed (GObject *object)
{
EMemoShellContentPrivate *priv;
+ EShell *shell;
EShellView *shell_view;
EShellContent *shell_content;
EShellTaskbar *shell_taskbar;
EShellWindow *shell_window;
+ ESourceRegistry *registry;
GalViewInstance *view_instance;
GtkTargetList *target_list;
GtkTargetEntry *targets;
@@ -447,8 +449,10 @@ memo_shell_content_constructed (GObject *object)
shell_view = e_shell_content_get_shell_view (shell_content);
shell_taskbar = e_shell_view_get_shell_taskbar (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
- priv->memo_model = e_cal_model_memos_new ();
+ registry = e_shell_get_registry (shell);
+ priv->memo_model = e_cal_model_memos_new (registry);
/* Build content widgets. */
diff --git a/modules/calendar/e-memo-shell-migrate.c b/modules/calendar/e-memo-shell-migrate.c
index efa0716b81..08fe76775e 100644
--- a/modules/calendar/e-memo-shell-migrate.c
+++ b/modules/calendar/e-memo-shell-migrate.c
@@ -25,140 +25,6 @@
#include "e-memo-shell-migrate.h"
-#include <string.h>
-#include <glib/gi18n.h>
-#include <camel/camel.h>
-
-#include <libedataserver/e-source.h>
-#include <libedataserver/e-source-group.h>
-#include <libedataserver/e-source-list.h>
-
-#include <shell/e-shell.h>
-#include <calendar/gui/calendar-config-keys.h>
-#include <libemail-utils/e-account-utils.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;
- const gchar *data_dir;
- gchar *base_dir, *base_uri;
-
- data_dir = e_shell_backend_get_data_dir (shell_backend);
- base_dir = g_build_filename (data_dir, "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_get_uid (source));
-
- link.data = (gpointer) e_source_get_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;
- }
-}
-
gboolean
e_memo_shell_backend_migrate (EShellBackend *shell_backend,
gint major,
@@ -166,30 +32,7 @@ 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);
-
- 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);
+ g_return_val_if_fail (E_IS_SHELL_BACKEND (shell_backend), FALSE);
- return retval;
+ return TRUE;
}
diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c
index 7e209c5d24..c42ce3e3bd 100644
--- a/modules/calendar/e-memo-shell-sidebar.c
+++ b/modules/calendar/e-memo-shell-sidebar.c
@@ -28,6 +28,7 @@
#include <string.h>
#include <glib/gi18n.h>
#include <libecal/e-cal-client.h>
+#include <libedataserver/e-source-calendar.h>
#include <libedataserverui/e-client-utils.h>
#include "libevolution-utils/e-alert-dialog.h"
@@ -146,24 +147,43 @@ memo_shell_sidebar_backend_error_cb (EMemoShellSidebar *memo_shell_sidebar,
const gchar *message,
ECalClient *client)
{
+ EShell *shell;
EShellView *shell_view;
+ EShellBackend *shell_backend;
EShellContent *shell_content;
EShellSidebar *shell_sidebar;
- ESourceGroup *source_group;
+ ESourceRegistry *registry;
+ ESource *parent;
ESource *source;
+ const gchar *parent_uid;
+ 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_backend = e_shell_view_get_shell_backend (shell_view);
shell_content = e_shell_view_get_shell_content (shell_view);
+ shell = e_shell_backend_get_shell (shell_backend);
+ registry = e_shell_get_registry (shell);
+
source = e_client_get_source (E_CLIENT (client));
- source_group = e_source_peek_group (source);
+
+ parent_uid = e_source_get_parent (source);
+ parent = e_source_registry_ref_source (registry, parent_uid);
+ g_return_if_fail (parent != NULL);
+
+ 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",
- e_source_group_peek_name (source_group),
- e_source_get_display_name (source), message, NULL);
+ parent_display_name,
+ source_display_name,
+ message, NULL);
+
+ g_object_unref (parent);
}
static void
@@ -233,19 +253,6 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object,
return;
}
- if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_FAILED) ||
- g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_REQUIRED))
- e_client_utils_forget_password (E_CLIENT (client));
-
- if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_FAILED)) {
- e_client_open (
- E_CLIENT (client), FALSE,
- memo_shell_sidebar->priv->loading_clients,
- memo_shell_sidebar_client_opened_cb, user_data);
- g_clear_error (&error);
- return;
- }
-
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_BUSY)) {
struct RetryOpenData *rod;
@@ -396,8 +403,6 @@ memo_shell_sidebar_set_default (EMemoShellSidebar *memo_shell_sidebar,
ESource *source)
{
EMemoShellSidebarPrivate *priv;
- EShellView *shell_view;
- EShellWindow *shell_window;
EShellSidebar *shell_sidebar;
ECalClient *client;
const gchar *uid;
@@ -407,8 +412,6 @@ memo_shell_sidebar_set_default (EMemoShellSidebar *memo_shell_sidebar,
/* FIXME Sidebar should not be accessing the EShellContent.
* This probably needs to be moved to EMemoShellView. */
shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar);
- shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
- shell_window = e_shell_view_get_shell_window (shell_view);
/* Cancel any unfinished previous request. */
if (priv->loading_default_client != NULL) {
@@ -435,8 +438,6 @@ memo_shell_sidebar_set_default (EMemoShellSidebar *memo_shell_sidebar,
e_client_utils_open_new (
source, E_CLIENT_SOURCE_TYPE_MEMOS,
FALSE, priv->loading_default_client,
- e_client_utils_authenticate_handler,
- GTK_WINDOW (shell_window),
memo_shell_sidebar_default_loaded_cb,
g_object_ref (shell_sidebar));
}
@@ -470,38 +471,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_get_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)
{
@@ -525,11 +494,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);
@@ -542,8 +509,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_shell_get_registry (shell);
g_signal_connect_swapped (
model, "row-changed",
@@ -562,30 +528,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
@@ -665,11 +609,11 @@ static void
memo_shell_sidebar_constructed (GObject *object)
{
EMemoShellSidebarPrivate *priv;
+ EShell *shell;
EShellView *shell_view;
EShellWindow *shell_window;
- EShellBackend *shell_backend;
EShellSidebar *shell_sidebar;
- ESourceList *source_list;
+ ESourceRegistry *registry;
GtkContainer *container;
GtkWidget *widget;
AtkObject *a11y;
@@ -681,11 +625,8 @@ memo_shell_sidebar_constructed (GObject *object)
shell_sidebar = E_SHELL_SIDEBAR (object);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
- shell_backend = e_shell_view_get_shell_backend (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
-
- source_list = e_memo_shell_backend_get_source_list (
- E_MEMO_SHELL_BACKEND (shell_backend));
+ shell = e_shell_window_get_shell (shell_window);
container = GTK_CONTAINER (shell_sidebar);
@@ -700,7 +641,8 @@ memo_shell_sidebar_constructed (GObject *object)
container = GTK_CONTAINER (widget);
- widget = e_memo_list_selector_new (source_list);
+ registry = e_shell_get_registry (shell);
+ 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);
@@ -722,8 +664,8 @@ memo_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
EMemoShellSidebar *memo_shell_sidebar;
ESourceSelector *selector;
ESource *source;
- gboolean can_delete = FALSE;
- gboolean is_system = FALSE;
+ gboolean removable = FALSE;
+ gboolean writable = FALSE;
gboolean refresh_supported = FALSE;
gboolean has_primary_source = FALSE;
guint32 state = 0;
@@ -733,34 +675,30 @@ memo_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
source = e_source_selector_ref_primary_selection (selector);
if (source != NULL) {
- ECalClient *client;
- const gchar *uri;
- const gchar *delete;
+ EClient *client;
+ const gchar *uid;
has_primary_source = TRUE;
- uri = e_source_peek_relative_uri (source);
- is_system = (uri == NULL || strcmp (uri, "system") == 0);
-
- can_delete = !is_system;
- delete = e_source_get_property (source, "delete");
- can_delete &= (delete == NULL || strcmp (delete, "no") != 0);
+ uid = e_source_get_uid (source);
+ removable = e_source_get_removable (source);
+ writable = e_source_get_writable (source);
client = g_hash_table_lookup (
- memo_shell_sidebar->priv->client_table,
- e_source_get_uid (source));
+ memo_shell_sidebar->priv->client_table, uid);
refresh_supported =
- client && e_client_check_refresh_supported (E_CLIENT (client));
+ client != NULL &&
+ e_client_check_refresh_supported (client);
g_object_unref (source);
}
if (has_primary_source)
state |= E_MEMO_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE;
- if (can_delete)
- state |= E_MEMO_SHELL_SIDEBAR_CAN_DELETE_PRIMARY_SOURCE;
- if (is_system)
- state |= E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_SYSTEM;
+ if (removable)
+ state |= E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE;
+ if (writable)
+ state |= E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE;
if (refresh_supported)
state |= E_MEMO_SHELL_SIDEBAR_SOURCE_SUPPORTS_REFRESH;
@@ -952,8 +890,8 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar,
ECalClient *default_client;
ECalClient *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));
@@ -981,13 +919,8 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar,
client = g_object_ref (default_client);
}
- if (client == NULL) {
+ if (client == NULL)
client = e_cal_client_new (source, source_type, NULL);
- if (client)
- g_signal_connect (
- client, "authenticate",
- G_CALLBACK (e_client_utils_authenticate_handler), NULL);
- }
g_return_if_fail (client != NULL);
@@ -1004,9 +937,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_client_get_uri (E_CLIENT (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);
diff --git a/modules/calendar/e-memo-shell-sidebar.h b/modules/calendar/e-memo-shell-sidebar.h
index f233aef290..298673c2fa 100644
--- a/modules/calendar/e-memo-shell-sidebar.h
+++ b/modules/calendar/e-memo-shell-sidebar.h
@@ -54,10 +54,10 @@ typedef struct _EMemoShellSidebarClass EMemoShellSidebarClass;
typedef struct _EMemoShellSidebarPrivate EMemoShellSidebarPrivate;
enum {
- E_MEMO_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE = 1 << 0,
- E_MEMO_SHELL_SIDEBAR_CAN_DELETE_PRIMARY_SOURCE = 1 << 1,
- E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_SYSTEM = 1 << 2,
- E_MEMO_SHELL_SIDEBAR_SOURCE_SUPPORTS_REFRESH = 1 << 3
+ E_MEMO_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE = 1 << 0,
+ E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE = 1 << 1,
+ E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE = 1 << 2,
+ E_MEMO_SHELL_SIDEBAR_SOURCE_SUPPORTS_REFRESH = 1 << 3
};
struct _EMemoShellSidebar {
diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c
index 44625ad670..689d65c796 100644
--- a/modules/calendar/e-memo-shell-view-actions.c
+++ b/modules/calendar/e-memo-shell-view-actions.c
@@ -77,12 +77,22 @@ action_memo_forward_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
EMemoShellContent *memo_shell_content;
+ EShell *shell;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ ESourceRegistry *registry;
EMemoTable *memo_table;
ECalModelComponent *comp_data;
ECalComponent *comp;
icalcomponent *clone;
GSList *list;
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+
+ registry = e_shell_get_registry (shell);
+
memo_shell_content = memo_shell_view->priv->memo_shell_content;
memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
@@ -97,7 +107,7 @@ action_memo_forward_cb (GtkAction *action,
e_cal_component_set_icalcomponent (comp, clone);
itip_send_comp (
- E_CAL_COMPONENT_METHOD_PUBLISH, comp,
+ registry, E_CAL_COMPONENT_METHOD_PUBLISH, comp,
comp_data->client, NULL, NULL, NULL, TRUE, FALSE);
g_object_unref (comp);
@@ -108,13 +118,18 @@ action_memo_list_copy_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
EMemoShellSidebar *memo_shell_sidebar;
- EShellWindow *shell_window;
+ EShell *shell;
EShellView *shell_view;
+ EShellWindow *shell_window;
+ ESourceRegistry *registry;
ESourceSelector *selector;
ESource *source;
shell_view = E_SHELL_VIEW (memo_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+
+ registry = e_shell_get_registry (shell);
memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
@@ -122,7 +137,7 @@ action_memo_list_copy_cb (GtkAction *action,
g_return_if_fail (source != NULL);
copy_source_dialog (
- GTK_WINDOW (shell_window),
+ GTK_WINDOW (shell_window), registry,
source, E_CAL_CLIENT_SOURCE_TYPE_MEMOS);
g_object_unref (source);
@@ -132,32 +147,16 @@ 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;
- ECalClient *client;
- ECalModel *model;
ESourceSelector *selector;
- ESourceGroup *source_group;
- ESourceList *source_list;
ESource *source;
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_ref_primary_selection (selector);
@@ -174,43 +173,13 @@ action_memo_list_delete_cb (GtkAction *action,
return;
}
- uri = e_source_get_uri (source);
- client = e_cal_model_get_client_for_uri (model, uri);
- if (client == NULL)
- client = e_cal_client_new_from_uri (
- uri, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL);
- g_free (uri);
-
- g_return_if_fail (client != NULL);
-
- e_client_remove_sync (E_CLIENT (client), NULL, &error);
-
- if (error != NULL) {
- g_warning (
- "%s: Failed to remove client: %s",
- G_STRFUNC, error->message);
- g_object_unref (source);
- g_error_free (error);
- 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);
-
- e_source_list_sync (source_list, &error);
-
- if (error != NULL) {
- g_warning (
- "%s: Failed to sync source list: %s",
- G_STRFUNC, error->message);
- g_error_free (error);
- }
+ e_shell_view_remove_source (shell_view, source);
g_object_unref (source);
}
@@ -219,12 +188,34 @@ static void
action_memo_list_new_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
+ EShell *shell;
EShellView *shell_view;
EShellWindow *shell_window;
+ ESourceRegistry *registry;
+ ECalClientSourceType 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));
+ shell = e_shell_window_get_shell (shell_window);
+
+ registry = e_shell_get_registry (shell);
+ source_type = E_CAL_CLIENT_SOURCE_TYPE_MEMOS;
+ config = e_cal_source_config_new (registry, NULL, source_type);
+
+ dialog = e_source_config_dialog_new (E_SOURCE_CONFIG (config));
+
+ gtk_window_set_transient_for (
+ GTK_WINDOW (dialog), 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_widget_show (dialog);
}
static void
@@ -261,11 +252,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;
+ ECalClientSourceType 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);
@@ -275,9 +271,23 @@ action_memo_list_properties_cb (GtkAction *action,
source = e_source_selector_ref_primary_selection (selector);
g_return_if_fail (source != NULL);
- calendar_setup_edit_memo_list (GTK_WINDOW (shell_window), source);
+ source_type = E_CAL_CLIENT_SOURCE_TYPE_MEMOS;
+ registry = e_source_selector_get_registry (selector);
+ config = e_cal_source_config_new (registry, source, source_type);
g_object_unref (source);
+
+ dialog = e_source_config_dialog_new (E_SOURCE_CONFIG (config));
+
+ gtk_window_set_transient_for (
+ GTK_WINDOW (dialog), 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_widget_show (dialog);
}
static void
@@ -290,7 +300,6 @@ action_memo_list_refresh_cb (GtkAction *action,
ECalClient *client;
ECalModel *model;
ESource *source;
- gchar *uri;
GError *error = NULL;
memo_shell_content = memo_shell_view->priv->memo_shell_content;
@@ -302,10 +311,7 @@ action_memo_list_refresh_cb (GtkAction *action,
source = e_source_selector_ref_primary_selection (selector);
g_return_if_fail (source != NULL);
- uri = e_source_get_uri (source);
- client = e_cal_model_get_client_for_uri (model, uri);
- g_free (uri);
-
+ client = e_cal_model_get_client_for_source (model, source);
if (client == NULL) {
g_object_unref (source);
return;
diff --git a/modules/calendar/e-memo-shell-view-private.c b/modules/calendar/e-memo-shell-view-private.c
index 74d042e193..f87c91ff79 100644
--- a/modules/calendar/e-memo-shell-view-private.c
+++ b/modules/calendar/e-memo-shell-view-private.c
@@ -321,6 +321,7 @@ e_memo_shell_view_open_memo (EMemoShellView *memo_shell_view,
EShell *shell;
EShellView *shell_view;
EShellWindow *shell_window;
+ ESourceRegistry *registry;
CompEditor *editor;
CompEditorFlags flags = 0;
ECalComponent *comp;
@@ -334,6 +335,8 @@ e_memo_shell_view_open_memo (EMemoShellView *memo_shell_view,
shell_window = e_shell_view_get_shell_window (shell_view);
shell = e_shell_window_get_shell (shell_window);
+ registry = e_shell_get_registry (shell);
+
uid = icalcomponent_get_uid (comp_data->icalcomp);
editor = comp_editor_find_instance (uid);
@@ -347,7 +350,7 @@ e_memo_shell_view_open_memo (EMemoShellView *memo_shell_view,
if (e_cal_component_has_organizer (comp))
flags |= COMP_EDITOR_IS_SHARED;
- if (itip_organizer_is_user (comp, comp_data->client))
+ if (itip_organizer_is_user (registry, comp, comp_data->client))
flags |= COMP_EDITOR_USER_ORG;
editor = memo_editor_new (comp_data->client, shell, flags);
diff --git a/modules/calendar/e-memo-shell-view-private.h b/modules/calendar/e-memo-shell-view-private.h
index 85b2418439..c232901008 100644
--- a/modules/calendar/e-memo-shell-view-private.h
+++ b/modules/calendar/e-memo-shell-view-private.h
@@ -35,12 +35,13 @@
#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"
#include "calendar/gui/dialogs/copy-source-dialog.h"
#include "calendar/gui/dialogs/memo-editor.h"
diff --git a/modules/calendar/e-memo-shell-view.c b/modules/calendar/e-memo-shell-view.c
index acf95e92f3..930ac6bcb0 100644
--- a/modules/calendar/e-memo-shell-view.c
+++ b/modules/calendar/e-memo-shell-view.c
@@ -182,9 +182,10 @@ memo_shell_view_update_actions (EShellView *shell_view)
/* Be descriptive. */
gboolean any_memos_selected;
- gboolean can_delete_primary_source;
gboolean has_primary_source;
gboolean multiple_memos_selected;
+ gboolean primary_source_is_removable;
+ gboolean primary_source_is_writable;
gboolean selection_has_url;
gboolean single_memo_selected;
gboolean sources_are_editable;
@@ -212,8 +213,10 @@ memo_shell_view_update_actions (EShellView *shell_view)
has_primary_source =
(state & E_MEMO_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE);
- can_delete_primary_source =
- (state & E_MEMO_SHELL_SIDEBAR_CAN_DELETE_PRIMARY_SOURCE);
+ primary_source_is_removable =
+ (state & E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE);
+ primary_source_is_writable =
+ (state & E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE);
refresh_supported =
(state & E_MEMO_SHELL_SIDEBAR_SOURCE_SUPPORTS_REFRESH);
@@ -242,11 +245,11 @@ memo_shell_view_update_actions (EShellView *shell_view)
gtk_action_set_sensitive (action, sensitive);
action = ACTION (MEMO_LIST_DELETE);
- sensitive = can_delete_primary_source;
+ sensitive = primary_source_is_removable;
gtk_action_set_sensitive (action, sensitive);
action = ACTION (MEMO_LIST_PROPERTIES);
- sensitive = has_primary_source;
+ sensitive = primary_source_is_writable;
gtk_action_set_sensitive (action, sensitive);
action = ACTION (MEMO_LIST_REFRESH);
@@ -254,7 +257,7 @@ memo_shell_view_update_actions (EShellView *shell_view)
gtk_action_set_sensitive (action, sensitive);
action = ACTION (MEMO_LIST_RENAME);
- sensitive = can_delete_primary_source;
+ sensitive = primary_source_is_writable;
gtk_action_set_sensitive (action, sensitive);
action = ACTION (MEMO_OPEN);
diff --git a/modules/calendar/e-memo-shell-view.h b/modules/calendar/e-memo-shell-view.h
index 686ae734c9..753836858d 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 0bcf95d31d..f8c21a8e41 100644
--- a/modules/calendar/e-task-shell-backend.c
+++ b/modules/calendar/e-task-shell-backend.c
@@ -30,17 +30,17 @@
#include <libecal/e-cal-client.h>
#include <libedataserver/e-url.h>
#include <libedataserver/e-source.h>
-#include <libedataserver/e-source-list.h>
-#include <libedataserver/e-source-group.h>
+#include <libedataserver/e-source-calendar.h>
#include <libedataserverui/e-client-utils.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/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"
@@ -52,12 +52,7 @@
((obj), E_TYPE_TASK_SHELL_BACKEND, ETaskShellBackendPrivate))
struct _ETaskShellBackendPrivate {
- ESourceList *source_list;
-};
-
-enum {
- PROP_0,
- PROP_SOURCE_LIST
+ gint placeholder;
};
G_DEFINE_DYNAMIC_TYPE (
@@ -66,111 +61,6 @@ G_DEFINE_DYNAMIC_TYPE (
E_TYPE_SHELL_BACKEND)
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;
- GError *error = NULL;
-
- 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);
-
- e_cal_client_get_sources (
- &task_shell_backend->priv->source_list,
- E_CAL_CLIENT_SOURCE_TYPE_TASKS, &error);
-
- if (error != NULL) {
- g_warning (
- "%s: Could not get task sources: %s",
- G_STRFUNC, error->message);
- g_error_free (error);
- 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_get_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 if (!e_source_get_property (personal, "name-changed")) {
- /* 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,
@@ -245,59 +135,64 @@ 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;
+ EClientSourceType source_type;
const gchar *action_name;
- gchar *uid;
/* This callback is used for both tasks and assigned tasks. */
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_shell_get_registry (shell);
+ source_type = E_CLIENT_SOURCE_TYPE_TASKS;
+ source = e_source_registry_ref_default_task_list (registry);
/* Use a callback function appropriate for the action.
* FIXME Need to obtain a better default time zone. */
action_name = gtk_action_get_name (action);
if (strcmp (action_name, "task-assigned-new") == 0)
e_client_utils_open_new (
- source, E_CLIENT_SOURCE_TYPE_TASKS, FALSE, NULL,
- e_client_utils_authenticate_handler, GTK_WINDOW (shell_window),
+ source, source_type, FALSE, NULL,
task_shell_backend_task_assigned_new_cb,
g_object_ref (shell));
else
e_client_utils_open_new (
- source, E_CLIENT_SOURCE_TYPE_TASKS, FALSE, NULL,
- e_client_utils_authenticate_handler, GTK_WINDOW (shell_window),
+ source, source_type, FALSE, NULL,
task_shell_backend_task_new_cb,
g_object_ref (shell));
- g_object_unref (source_list);
+ g_object_unref (source);
}
static void
action_task_list_new_cb (GtkAction *action,
EShellWindow *shell_window)
{
- calendar_setup_new_task_list (GTK_WINDOW (shell_window));
+ EShell *shell;
+ ESourceRegistry *registry;
+ ECalClientSourceType source_type;
+ GtkWidget *config;
+ GtkWidget *dialog;
+ const gchar *icon_name;
+
+ shell = e_shell_window_get_shell (shell_window);
+
+ registry = e_shell_get_registry (shell);
+ source_type = E_CAL_CLIENT_SOURCE_TYPE_TASKS;
+ config = e_cal_source_config_new (registry, NULL, source_type);
+
+ dialog = e_source_config_dialog_new (E_SOURCE_CONFIG (config));
+
+ gtk_window_set_transient_for (
+ GTK_WINDOW (dialog), 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_widget_show (dialog);
}
static GtkActionEntry item_entries[] = {
@@ -337,7 +232,7 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
ECalClient *client;
ECalComponent *comp;
ESource *source;
- ESourceList *source_list;
+ ESourceRegistry *registry;
ECalClientSourceType source_type;
EUri *euri;
icalcomponent *icalcomp;
@@ -402,43 +297,32 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
* we successfully open it is another matter... */
handled = TRUE;
- e_cal_client_get_sources (&source_list, source_type, &error);
-
- if (error != NULL) {
- g_warning (
- "%s: Could not get task sources: %s",
- G_STRFUNC, error->message);
- g_error_free (error);
- goto exit;
- }
-
- source = e_source_list_peek_source_by_uid (source_list, source_uid);
+ registry = e_shell_get_registry (shell);
+ source = e_source_registry_ref_source (registry, source_uid);
if (source == NULL) {
g_printerr ("No source for UID '%s'\n", source_uid);
- g_object_unref (source_list);
goto exit;
}
client = e_cal_client_new (source, source_type, &error);
- if (client != NULL) {
- g_signal_connect (
- client, "authenticate",
- G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+ if (client != NULL)
e_client_open_sync (E_CLIENT (client), TRUE, NULL, &error);
- }
if (error != NULL) {
g_warning (
"%s: Failed to create/open client: %s",
G_STRFUNC, error->message);
- if (client)
+ if (client != NULL)
g_object_unref (client);
- g_object_unref (source_list);
+ g_object_unref (source);
g_error_free (error);
goto exit;
}
+ g_object_unref (source);
+ source = NULL;
+
/* XXX Copied from e_task_shell_view_open_task().
* Clearly a new utility function is needed. */
@@ -454,7 +338,6 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
g_warning (
"%s: Failed to get object: %s",
G_STRFUNC, error->message);
- g_object_unref (source_list);
g_object_unref (client);
g_error_free (error);
goto exit;
@@ -472,7 +355,7 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
if (icalprop != NULL)
flags |= COMP_EDITOR_IS_ASSIGNED;
- if (itip_organizer_is_user (comp, client))
+ if (itip_organizer_is_user (registry, comp, client))
flags |= COMP_EDITOR_USER_ORG;
if (!e_cal_component_has_attendees (comp))
@@ -486,7 +369,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:
@@ -520,40 +402,6 @@ task_shell_backend_window_added_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 (e_task_shell_backend_parent_class)->dispose (object);
-}
-
-static void
task_shell_backend_constructed (GObject *object)
{
EShell *shell;
@@ -562,8 +410,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),
@@ -587,8 +433,6 @@ e_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);
@@ -600,16 +444,6 @@ e_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
@@ -632,61 +466,3 @@ e_task_shell_backend_type_register (GTypeModule *type_module)
* order to register types from a separate compilation unit. */
e_task_shell_backend_register_type (type_module);
}
-
-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)
-{
- GSettings *settings;
- GSList *selected_task_lists = NULL;
- gchar **strv;
- gint ii;
-
- g_return_val_if_fail (
- E_IS_TASK_SHELL_BACKEND (task_shell_backend), NULL);
-
- settings = g_settings_new ("org.gnome.evolution.calendar");
- strv = g_settings_get_strv (settings, "selected-tasks");
- g_object_unref (G_OBJECT (settings));
-
- if (strv != NULL) {
- for (ii = 0; strv[ii] != NULL; ii++)
- selected_task_lists = g_slist_append (
- selected_task_lists, g_strdup (strv[ii]));
-
- g_strfreev (strv);
- }
-
- return selected_task_lists;
-}
-
-void
-e_task_shell_backend_set_selected_task_lists (ETaskShellBackend *task_shell_backend,
- GSList *selected_task_lists)
-{
- GSettings *settings;
- GSList *link;
- GPtrArray *array = g_ptr_array_new ();
-
- g_return_if_fail (E_IS_TASK_SHELL_BACKEND (task_shell_backend));
-
- for (link = selected_task_lists; link != NULL; link = link->next)
- g_ptr_array_add (array, link->data);
- g_ptr_array_add (array, NULL);
-
- settings = g_settings_new ("org.gnome.evolution.calendar");
- g_settings_set_strv (
- settings, "selected-tasks",
- (const gchar *const *) array->pdata);
- g_object_unref (settings);
-
- g_ptr_array_free (array, FALSE);
-}
diff --git a/modules/calendar/e-task-shell-backend.h b/modules/calendar/e-task-shell-backend.h
index 3b489a7ceb..043623592c 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_type_register
(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 73351d0cf0..16b97311f4 100644
--- a/modules/calendar/e-task-shell-content.c
+++ b/modules/calendar/e-task-shell-content.c
@@ -427,10 +427,12 @@ static void
task_shell_content_constructed (GObject *object)
{
ETaskShellContentPrivate *priv;
+ EShell *shell;
EShellView *shell_view;
EShellWindow *shell_window;
EShellContent *shell_content;
EShellTaskbar *shell_taskbar;
+ ESourceRegistry *registry;
GalViewInstance *view_instance;
GtkTargetList *target_list;
GtkTargetEntry *targets;
@@ -447,8 +449,10 @@ task_shell_content_constructed (GObject *object)
shell_view = e_shell_content_get_shell_view (shell_content);
shell_taskbar = e_shell_view_get_shell_taskbar (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
- priv->task_model = e_cal_model_tasks_new ();
+ registry = e_shell_get_registry (shell);
+ priv->task_model = e_cal_model_tasks_new (registry);
/* Build content widgets. */
diff --git a/modules/calendar/e-task-shell-migrate.c b/modules/calendar/e-task-shell-migrate.c
index c24f52d97c..40b731a0d0 100644
--- a/modules/calendar/e-task-shell-migrate.c
+++ b/modules/calendar/e-task-shell-migrate.c
@@ -25,149 +25,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;
- const gchar *data_dir;
- gchar *base_dir, *base_uri;
-
- data_dir = e_shell_backend_get_data_dir (shell_backend);
- base_dir = g_build_filename (data_dir, "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_get_uid (source));
-
- link.data = (gpointer) e_source_get_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,
@@ -175,28 +32,7 @@ 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);
+ g_return_val_if_fail (E_IS_SHELL_BACKEND (shell_backend), FALSE);
return TRUE;
}
diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c
index 3a9a09ad16..d8969aa85c 100644
--- a/modules/calendar/e-task-shell-sidebar.c
+++ b/modules/calendar/e-task-shell-sidebar.c
@@ -28,6 +28,7 @@
#include <string.h>
#include <glib/gi18n.h>
#include <libecal/e-cal-client.h>
+#include <libedataserver/e-source-calendar.h>
#include <libedataserverui/e-client-utils.h>
#include "libevolution-utils/e-alert-dialog.h"
@@ -146,24 +147,43 @@ task_shell_sidebar_backend_error_cb (ETaskShellSidebar *task_shell_sidebar,
const gchar *message,
ECalClient *client)
{
+ EShell *shell;
EShellView *shell_view;
+ EShellBackend *shell_backend;
EShellContent *shell_content;
EShellSidebar *shell_sidebar;
- ESourceGroup *source_group;
+ ESourceRegistry *registry;
+ ESource *parent;
ESource *source;
+ const gchar *parent_uid;
+ 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_backend = e_shell_view_get_shell_backend (shell_view);
shell_content = e_shell_view_get_shell_content (shell_view);
+ shell = e_shell_backend_get_shell (shell_backend);
+ registry = e_shell_get_registry (shell);
+
source = e_client_get_source (E_CLIENT (client));
- source_group = e_source_peek_group (source);
+
+ parent_uid = e_source_get_parent (source);
+ parent = e_source_registry_ref_source (registry, parent_uid);
+ g_return_if_fail (parent != NULL);
+
+ 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",
- e_source_group_peek_name (source_group),
- e_source_get_display_name (source), message, NULL);
+ parent_display_name,
+ source_display_name,
+ message, NULL);
+
+ g_object_unref (parent);
}
static void
@@ -233,19 +253,6 @@ task_shell_sidebar_client_opened_cb (GObject *source_object,
return;
}
- if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_FAILED) ||
- g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_REQUIRED))
- e_client_utils_forget_password (E_CLIENT (client));
-
- if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_FAILED)) {
- e_client_open (
- E_CLIENT (client), FALSE,
- task_shell_sidebar->priv->loading_clients,
- task_shell_sidebar_client_opened_cb, user_data);
- g_clear_error (&error);
- return;
- }
-
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_BUSY)) {
struct RetryOpenData *rod;
@@ -396,8 +403,6 @@ task_shell_sidebar_set_default (ETaskShellSidebar *task_shell_sidebar,
ESource *source)
{
ETaskShellSidebarPrivate *priv;
- EShellView *shell_view;
- EShellWindow *shell_window;
EShellSidebar *shell_sidebar;
ECalClient *client;
const gchar *uid;
@@ -407,8 +412,6 @@ task_shell_sidebar_set_default (ETaskShellSidebar *task_shell_sidebar,
/* FIXME Sidebar should not be accessing the EShellContent.
* This probably needs to be moved to ETaskShellView. */
shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar);
- shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
- shell_window = e_shell_view_get_shell_window (shell_view);
/* Cancel any unfinished previous request. */
if (priv->loading_default_client != NULL) {
@@ -435,8 +438,6 @@ task_shell_sidebar_set_default (ETaskShellSidebar *task_shell_sidebar,
e_client_utils_open_new (
source, E_CLIENT_SOURCE_TYPE_TASKS,
FALSE, priv->loading_default_client,
- e_client_utils_authenticate_handler,
- GTK_WINDOW (shell_window),
task_shell_sidebar_default_loaded_cb,
g_object_ref (shell_sidebar));
}
@@ -470,38 +471,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_get_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)
{
@@ -525,11 +494,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);
@@ -542,8 +509,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_shell_get_registry (shell);
g_signal_connect_swapped (
model, "row-changed",
@@ -562,30 +528,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
@@ -665,11 +609,11 @@ static void
task_shell_sidebar_constructed (GObject *object)
{
ETaskShellSidebarPrivate *priv;
+ EShell *shell;
EShellView *shell_view;
EShellWindow *shell_window;
- EShellBackend *shell_backend;
EShellSidebar *shell_sidebar;
- ESourceList *source_list;
+ ESourceRegistry *registry;
GtkContainer *container;
GtkWidget *widget;
AtkObject *a11y;
@@ -681,11 +625,8 @@ task_shell_sidebar_constructed (GObject *object)
shell_sidebar = E_SHELL_SIDEBAR (object);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
- shell_backend = e_shell_view_get_shell_backend (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
-
- source_list = e_task_shell_backend_get_source_list (
- E_TASK_SHELL_BACKEND (shell_backend));
+ shell = e_shell_window_get_shell (shell_window);
container = GTK_CONTAINER (shell_sidebar);
@@ -700,7 +641,8 @@ task_shell_sidebar_constructed (GObject *object)
container = GTK_CONTAINER (widget);
- widget = e_task_list_selector_new (source_list);
+ registry = e_shell_get_registry (shell);
+ 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);
@@ -722,8 +664,8 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
ETaskShellSidebar *task_shell_sidebar;
ESourceSelector *selector;
ESource *source;
- gboolean can_delete = FALSE;
- gboolean is_system = FALSE;
+ gboolean removable = FALSE;
+ gboolean writable = FALSE;
gboolean refresh_supported = FALSE;
gboolean has_primary_source = FALSE;
guint32 state = 0;
@@ -733,36 +675,30 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
source = e_source_selector_ref_primary_selection (selector);
if (source != NULL) {
- ECalClient *client;
- const gchar *uri;
- const gchar *delete_prop;
+ EClient *client;
+ const gchar *uid;
has_primary_source = TRUE;
- uri = e_source_peek_relative_uri (source);
- is_system = (uri == NULL || strcmp (uri, "system") == 0);
-
- can_delete = !is_system;
- delete_prop = e_source_get_property (source, "delete");
- can_delete = can_delete &&
- (delete_prop == NULL || strcmp (delete_prop, "no") != 0);
+ uid = e_source_get_uid (source);
+ removable = e_source_get_removable (source);
+ writable = e_source_get_writable (source);
client = g_hash_table_lookup (
- task_shell_sidebar->priv->client_table,
- e_source_get_uid (source));
+ task_shell_sidebar->priv->client_table, uid);
refresh_supported =
client != NULL &&
- e_client_check_refresh_supported (E_CLIENT (client));
+ e_client_check_refresh_supported (client);
g_object_unref (source);
}
if (has_primary_source)
state |= E_TASK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE;
- if (can_delete)
- state |= E_TASK_SHELL_SIDEBAR_CAN_DELETE_PRIMARY_SOURCE;
- if (is_system)
- state |= E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_SYSTEM;
+ if (removable)
+ state |= E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE;
+ if (writable)
+ state |= E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE;
if (refresh_supported)
state |= E_TASK_SHELL_SIDEBAR_SOURCE_SUPPORTS_REFRESH;
@@ -954,8 +890,8 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar,
ECalClient *default_client;
ECalClient *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));
@@ -983,13 +919,8 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar,
client = g_object_ref (default_client);
}
- if (client == NULL) {
+ if (client == NULL)
client = e_cal_client_new (source, source_type, NULL);
- if (client)
- g_signal_connect (
- client, "authenticate",
- G_CALLBACK (e_client_utils_authenticate_handler), NULL);
- }
g_return_if_fail (client != NULL);
@@ -1006,9 +937,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_client_get_uri (E_CLIENT (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);
diff --git a/modules/calendar/e-task-shell-sidebar.h b/modules/calendar/e-task-shell-sidebar.h
index 07b9df38ad..a2cc92ac0e 100644
--- a/modules/calendar/e-task-shell-sidebar.h
+++ b/modules/calendar/e-task-shell-sidebar.h
@@ -54,10 +54,10 @@ typedef struct _ETaskShellSidebarClass ETaskShellSidebarClass;
typedef struct _ETaskShellSidebarPrivate ETaskShellSidebarPrivate;
enum {
- E_TASK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE = 1 << 0,
- E_TASK_SHELL_SIDEBAR_CAN_DELETE_PRIMARY_SOURCE = 1 << 1,
- E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_SYSTEM = 1 << 2,
- E_TASK_SHELL_SIDEBAR_SOURCE_SUPPORTS_REFRESH = 1 << 3
+ E_TASK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE = 1 << 0,
+ E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE = 1 << 1,
+ E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE = 1 << 2,
+ E_TASK_SHELL_SIDEBAR_SOURCE_SUPPORTS_REFRESH = 1 << 3
};
struct _ETaskShellSidebar {
diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c
index c15597b082..e29db39d11 100644
--- a/modules/calendar/e-task-shell-view-actions.c
+++ b/modules/calendar/e-task-shell-view-actions.c
@@ -100,12 +100,22 @@ action_task_forward_cb (GtkAction *action,
ETaskShellView *task_shell_view)
{
ETaskShellContent *task_shell_content;
+ EShell *shell;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ ESourceRegistry *registry;
ECalModelComponent *comp_data;
ETaskTable *task_table;
ECalComponent *comp;
icalcomponent *clone;
GSList *list;
+ shell_view = E_SHELL_VIEW (task_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+
+ registry = e_shell_get_registry (shell);
+
task_shell_content = task_shell_view->priv->task_shell_content;
task_table = e_task_shell_content_get_task_table (task_shell_content);
@@ -120,7 +130,7 @@ action_task_forward_cb (GtkAction *action,
e_cal_component_set_icalcomponent (comp, clone);
itip_send_comp (
- E_CAL_COMPONENT_METHOD_PUBLISH, comp,
+ registry, E_CAL_COMPONENT_METHOD_PUBLISH, comp,
comp_data->client, NULL, NULL, NULL, TRUE, FALSE);
g_object_unref (comp);
@@ -131,13 +141,18 @@ action_task_list_copy_cb (GtkAction *action,
ETaskShellView *task_shell_view)
{
ETaskShellSidebar *task_shell_sidebar;
- EShellWindow *shell_window;
+ EShell *shell;
EShellView *shell_view;
+ EShellWindow *shell_window;
+ ESourceRegistry *registry;
ESourceSelector *selector;
ESource *source;
shell_view = E_SHELL_VIEW (task_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+
+ registry = e_shell_get_registry (shell);
task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
@@ -145,7 +160,7 @@ action_task_list_copy_cb (GtkAction *action,
g_return_if_fail (source != NULL);
copy_source_dialog (
- GTK_WINDOW (shell_window),
+ GTK_WINDOW (shell_window), registry,
source, E_CAL_CLIENT_SOURCE_TYPE_TASKS);
g_object_unref (source);
@@ -155,32 +170,16 @@ 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;
- ECalClient *client;
- ECalModel *model;
ESourceSelector *selector;
- ESourceGroup *source_group;
- ESourceList *source_list;
ESource *source;
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_ref_primary_selection (selector);
@@ -197,43 +196,13 @@ action_task_list_delete_cb (GtkAction *action,
return;
}
- uri = e_source_get_uri (source);
- client = e_cal_model_get_client_for_uri (model, uri);
- if (client == NULL)
- client = e_cal_client_new_from_uri (
- uri, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL);
- g_free (uri);
-
- g_return_if_fail (client != NULL);
-
- e_client_remove_sync (E_CLIENT (client), NULL, &error);
-
- if (error != NULL) {
- g_warning (
- "%s: Failed to remove client: %s",
- G_STRFUNC, error->message);
- g_object_unref (source);
- g_error_free (error);
- 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);
-
- e_source_list_sync (source_list, &error);
-
- if (error != NULL) {
- g_warning (
- "%s: Failed to sync srouce list: %s",
- G_STRFUNC, error->message);
- g_error_free (error);
- }
+ e_shell_view_remove_source (shell_view, source);
g_object_unref (source);
}
@@ -242,12 +211,34 @@ static void
action_task_list_new_cb (GtkAction *action,
ETaskShellView *task_shell_view)
{
+ EShell *shell;
EShellView *shell_view;
EShellWindow *shell_window;
+ ESourceRegistry *registry;
+ ECalClientSourceType 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));
+ shell = e_shell_window_get_shell (shell_window);
+
+ registry = e_shell_get_registry (shell);
+ source_type = E_CAL_CLIENT_SOURCE_TYPE_TASKS;
+ config = e_cal_source_config_new (registry, NULL, source_type);
+
+ dialog = e_source_config_dialog_new (E_SOURCE_CONFIG (config));
+
+ gtk_window_set_transient_for (
+ GTK_WINDOW (dialog), 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_widget_show (dialog);
}
static void
@@ -284,11 +275,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;
+ ECalClientSourceType 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);
@@ -298,9 +294,23 @@ action_task_list_properties_cb (GtkAction *action,
source = e_source_selector_ref_primary_selection (selector);
g_return_if_fail (source != NULL);
- calendar_setup_edit_task_list (GTK_WINDOW (shell_window), source);
+ source_type = E_CAL_CLIENT_SOURCE_TYPE_TASKS;
+ registry = e_source_selector_get_registry (selector);
+ config = e_cal_source_config_new (registry, source, source_type);
g_object_unref (source);
+
+ dialog = e_source_config_dialog_new (E_SOURCE_CONFIG (config));
+
+ gtk_window_set_transient_for (
+ GTK_WINDOW (dialog), 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_widget_show (dialog);
}
static void
@@ -313,7 +323,6 @@ action_task_list_refresh_cb (GtkAction *action,
ECalClient *client;
ECalModel *model;
ESource *source;
- gchar *uri;
GError *error = NULL;
task_shell_content = task_shell_view->priv->task_shell_content;
@@ -325,10 +334,7 @@ action_task_list_refresh_cb (GtkAction *action,
source = e_source_selector_ref_primary_selection (selector);
g_return_if_fail (source != NULL);
- uri = e_source_get_uri (source);
- client = e_cal_model_get_client_for_uri (model, uri);
- g_free (uri);
-
+ client = e_cal_model_get_client_for_source (model, source);
if (client == NULL) {
g_object_unref (source);
return;
diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c
index 560ce01940..f9a36c69f5 100644
--- a/modules/calendar/e-task-shell-view-private.c
+++ b/modules/calendar/e-task-shell-view-private.c
@@ -433,6 +433,7 @@ e_task_shell_view_open_task (ETaskShellView *task_shell_view,
EShell *shell;
EShellView *shell_view;
EShellWindow *shell_window;
+ ESourceRegistry *registry;
CompEditor *editor;
CompEditorFlags flags = 0;
ECalComponent *comp;
@@ -447,6 +448,8 @@ e_task_shell_view_open_task (ETaskShellView *task_shell_view,
shell_window = e_shell_view_get_shell_window (shell_view);
shell = e_shell_window_get_shell (shell_window);
+ registry = e_shell_get_registry (shell);
+
uid = icalcomponent_get_uid (comp_data->icalcomp);
editor = comp_editor_find_instance (uid);
@@ -462,7 +465,7 @@ e_task_shell_view_open_task (ETaskShellView *task_shell_view,
if (prop != NULL)
flags |= COMP_EDITOR_IS_ASSIGNED;
- if (itip_organizer_is_user (comp, comp_data->client))
+ if (itip_organizer_is_user (registry, comp, comp_data->client))
flags |= COMP_EDITOR_USER_ORG;
if (!e_cal_component_has_attendees (comp))
diff --git a/modules/calendar/e-task-shell-view-private.h b/modules/calendar/e-task-shell-view-private.h
index cf890c5c27..d76ee1cab6 100644
--- a/modules/calendar/e-task-shell-view-private.h
+++ b/modules/calendar/e-task-shell-view-private.h
@@ -37,14 +37,15 @@
#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/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"
#include "calendar/gui/dialogs/copy-source-dialog.h"
#include "calendar/gui/dialogs/task-editor.h"
diff --git a/modules/calendar/e-task-shell-view.c b/modules/calendar/e-task-shell-view.c
index 0654ef3eea..6186df92d5 100644
--- a/modules/calendar/e-task-shell-view.c
+++ b/modules/calendar/e-task-shell-view.c
@@ -302,9 +302,10 @@ task_shell_view_update_actions (EShellView *shell_view)
/* Be descriptive. */
gboolean any_tasks_selected;
- gboolean can_delete_primary_source;
gboolean has_primary_source;
gboolean multiple_tasks_selected;
+ gboolean primary_source_is_removable;
+ gboolean primary_source_is_writable;
gboolean selection_has_url;
gboolean selection_is_assignable;
gboolean single_task_selected;
@@ -341,8 +342,10 @@ task_shell_view_update_actions (EShellView *shell_view)
has_primary_source =
(state & E_TASK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE);
- can_delete_primary_source =
- (state & E_TASK_SHELL_SIDEBAR_CAN_DELETE_PRIMARY_SOURCE);
+ primary_source_is_removable =
+ (state & E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE);
+ primary_source_is_writable =
+ (state & E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE);
refresh_supported =
(state & E_TASK_SHELL_SIDEBAR_SOURCE_SUPPORTS_REFRESH);
@@ -377,11 +380,11 @@ task_shell_view_update_actions (EShellView *shell_view)
gtk_action_set_sensitive (action, sensitive);
action = ACTION (TASK_LIST_DELETE);
- sensitive = can_delete_primary_source;
+ sensitive = primary_source_is_removable;
gtk_action_set_sensitive (action, sensitive);
action = ACTION (TASK_LIST_PROPERTIES);
- sensitive = has_primary_source;
+ sensitive = primary_source_is_writable;
gtk_action_set_sensitive (action, sensitive);
action = ACTION (TASK_LIST_REFRESH);
@@ -389,7 +392,7 @@ task_shell_view_update_actions (EShellView *shell_view)
gtk_action_set_sensitive (action, sensitive);
action = ACTION (TASK_LIST_RENAME);
- sensitive = can_delete_primary_source;
+ sensitive = primary_source_is_writable;
gtk_action_set_sensitive (action, sensitive);
action = ACTION (TASK_MARK_COMPLETE);
diff --git a/modules/calendar/e-task-shell-view.h b/modules/calendar/e-task-shell-view.h
index 853d90cac1..d756c10345 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/widgets/misc/Makefile.am b/widgets/misc/Makefile.am
index 6aed9f013b..175906b03d 100644
--- a/widgets/misc/Makefile.am
+++ b/widgets/misc/Makefile.am
@@ -8,6 +8,7 @@ widgetsinclude_HEADERS = \
e-action-combo-box.h \
e-activity-bar.h \
e-activity-proxy.h \
+ e-alarm-selector.h \
e-alert-bar.h \
e-attachment.h \
e-attachment-button.h \
@@ -96,6 +97,7 @@ libemiscwidgets_la_SOURCES = \
e-action-combo-box.c \
e-activity-bar.c \
e-activity-proxy.c \
+ e-alarm-selector.c \
e-alert-bar.c \
e-attachment.c \
e-attachment-button.c \
diff --git a/widgets/misc/e-alarm-selector.h b/widgets/misc/e-alarm-selector.h
new file mode 100644
index 0000000000..2ad9c49dfc
--- /dev/null
+++ b/widgets/misc/e-alarm-selector.h
@@ -0,0 +1,63 @@
+/*
+ * e-alarm-selector.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef E_ALARM_SELECTOR_H
+#define E_ALARM_SELECTOR_H
+
+#include <libedataserverui/e-source-selector.h>
+
+/* Standard GObject macros */
+#define E_TYPE_ALARM_SELECTOR \
+ (e_alarm_selector_get_type ())
+#define E_ALARM_SELECTOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_ALARM_SELECTOR, EAlarmSelector))
+#define E_ALARM_SELECTOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_ALARM_SELECTOR, EAlarmSelectorClass))
+#define E_IS_ALARM_SELECTOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_ALARM_SELECTOR))
+#define E_IS_ALARM_SELECTOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_ALARM_SELECTOR))
+#define E_ALARM_SELECTOR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_ALARM_SELECTOR, EAlarmSelectorClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EAlarmSelector EAlarmSelector;
+typedef struct _EAlarmSelectorClass EAlarmSelectorClass;
+typedef struct _EAlarmSelectorPrivate EAlarmSelectorPrivate;
+
+struct _EAlarmSelector {
+ ESourceSelector parent;
+ EAlarmSelectorPrivate *priv;
+};
+
+struct _EAlarmSelectorClass {
+ ESourceSelectorClass parent_class;
+};
+
+GType e_alarm_selector_get_type (void) G_GNUC_CONST;
+GtkWidget * e_alarm_selector_new (ESourceRegistry *registry);
+
+G_END_DECLS
+
+#endif /* E_ALARM_SELECTOR_H */