diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-12-23 21:58:10 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-06-03 11:00:40 +0800 |
commit | 26e7480340ff1bcdeed3692b5046e4d735f185b1 (patch) | |
tree | 81bf81a6e9d7ac39299b847209dd1142b9023bf6 /modules/calendar/e-cal-attachment-handler.c | |
parent | 7894db49b9a161f7b63d90a98e57ad6a1e1dca54 (diff) | |
download | gsoc2013-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.
Diffstat (limited to 'modules/calendar/e-cal-attachment-handler.c')
-rw-r--r-- | modules/calendar/e-cal-attachment-handler.c | 44 |
1 files changed, 24 insertions, 20 deletions
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; |