From 855ae5eed1eeae0cfe271a5a47d6fb8abf21d691 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 31 Oct 2010 11:31:10 -0400 Subject: Bug 628139 - Thread-safety issues in libical time zone loading --- modules/calendar/e-cal-shell-backend.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 134f706054..749dd7ec19 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -769,8 +769,34 @@ cal_shell_backend_class_init (ECalShellBackendClass *class) static void cal_shell_backend_init (ECalShellBackend *cal_shell_backend) { + icalarray *builtin_timezones; + gint ii; + cal_shell_backend->priv = E_CAL_SHELL_BACKEND_GET_PRIVATE (cal_shell_backend); + + /* XXX Pre-load all built-in timezones in libical. + * + * Built-in time zones in libical 0.43 are loaded on demand, + * but not in a thread-safe manner, resulting in a race when + * multiple threads call icaltimezone_load_builtin_timezone() + * on the same time zone. Until built-in time zone loading + * in libical is made thread-safe, work around the issue by + * loading all built-in time zones now, so libical's internal + * time zone array will be fully populated before any threads + * are spawned. + */ + builtin_timezones = icaltimezone_get_builtin_timezones (); + for (ii = 0; ii < builtin_timezones->num_elements; ii++) { + icaltimezone *zone; + + zone = icalarray_element_at (builtin_timezones, ii); + + /* We don't care about the component right now, + * we just need some function that will trigger + * icaltimezone_load_builtin_timezone(). */ + icaltimezone_get_component (zone); + } } GType -- cgit v1.2.3 From 7d20b8fd5fd28a90852c737f35cef7ba03a2c116 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 1 Nov 2010 14:44:23 -0400 Subject: Utilize the new ESourceSelector:primary-selection property. --- modules/calendar/e-cal-attachment-handler.c | 2 +- modules/calendar/e-cal-shell-sidebar.c | 45 ++++++++-------------------- modules/calendar/e-cal-shell-view-actions.c | 10 +++---- modules/calendar/e-memo-shell-sidebar.c | 45 ++++++++-------------------- modules/calendar/e-memo-shell-view-actions.c | 10 +++---- modules/calendar/e-task-shell-sidebar.c | 45 ++++++++-------------------- modules/calendar/e-task-shell-view-actions.c | 10 +++---- 7 files changed, 55 insertions(+), 112 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c index 8fd2080769..a9f5237ecc 100644 --- a/modules/calendar/e-cal-attachment-handler.c +++ b/modules/calendar/e-cal-attachment-handler.c @@ -296,7 +296,7 @@ attachment_handler_run_dialog (GtkWindow *parent, if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK) goto exit; - source = e_source_selector_peek_primary_selection (selector); + source = e_source_selector_get_primary_selection (selector); if (source == NULL) goto exit; diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index 965cc9fa60..66a1102cb7 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -406,31 +406,12 @@ static void cal_shell_sidebar_primary_selection_changed_cb (ECalShellSidebar *cal_shell_sidebar, ESourceSelector *selector) { - EShell *shell; - EShellView *shell_view; - EShellWindow *shell_window; - EShellSidebar *shell_sidebar; - EShellSettings *shell_settings; ESource *source; - /* XXX ESourceSelector needs a "primary-selection-uid" property - * so we can just bind the property with GConfBridge. */ - - source = e_source_selector_peek_primary_selection (selector); + source = e_source_selector_get_primary_selection (selector); if (source == NULL) return; - 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); - - shell = e_shell_window_get_shell (shell_window); - shell_settings = e_shell_get_shell_settings (shell); - - e_shell_settings_set_string ( - shell_settings, "cal-primary-calendar", - e_source_peek_uid (source)); - cal_shell_sidebar_set_default (cal_shell_sidebar, source); } @@ -451,7 +432,6 @@ cal_shell_sidebar_restore_state_cb (EShellWindow *shell_window, GSList *list, *iter; GObject *object; const gchar *key; - gchar *uid; priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); @@ -477,19 +457,20 @@ cal_shell_sidebar_restore_state_cb (EShellWindow *shell_window, G_CALLBACK (cal_shell_sidebar_primary_selection_changed_cb), shell_sidebar); - source = NULL; - 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); - if (source == NULL) - source = e_source_list_peek_source_any (source_list); - if (source != NULL) - e_source_selector_set_primary_selection (selector, source); - g_free (uid); + g_object_bind_property_full ( + shell_settings, "cal-primary-calendar", + selector, "primary-selection", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE, + (GBindingTransformFunc) e_binding_transform_uid_to_source, + (GBindingTransformFunc) e_binding_transform_source_to_uid, + g_object_ref (source_list), + (GDestroyNotify) g_object_unref); list = calendar_config_get_calendars_selected (); for (iter = list; iter != NULL; iter = iter->next) { + gchar *uid; + uid = iter->data; source = e_source_list_peek_source_by_uid (source_list, uid); g_free (uid); @@ -733,7 +714,7 @@ cal_shell_sidebar_check_state (EShellSidebar *shell_sidebar) cal_shell_sidebar = E_CAL_SHELL_SIDEBAR (shell_sidebar); selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar); - source = e_source_selector_peek_primary_selection (selector); + source = e_source_selector_get_primary_selection (selector); if (source != NULL) { ECal *client; diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c index 16b5ecfb34..bce4fc4266 100644 --- a/modules/calendar/e-cal-shell-view-actions.c +++ b/modules/calendar/e-cal-shell-view-actions.c @@ -42,7 +42,7 @@ action_calendar_copy_cb (GtkAction *action, cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar; selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar); - source = e_source_selector_peek_primary_selection (selector); + source = e_source_selector_get_primary_selection (selector); g_return_if_fail (E_IS_SOURCE (source)); copy_source_dialog ( @@ -84,7 +84,7 @@ action_calendar_delete_cb (GtkAction *action, cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar; selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar); - source = e_source_selector_peek_primary_selection (selector); + source = e_source_selector_get_primary_selection (selector); g_return_if_fail (E_IS_SOURCE (source)); /* Ask for confirmation. */ @@ -268,7 +268,7 @@ action_calendar_properties_cb (GtkAction *action, cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar; selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar); - source = e_source_selector_peek_primary_selection (selector); + source = e_source_selector_get_primary_selection (selector); g_return_if_fail (E_IS_SOURCE (source)); /* XXX Does this -really- need a source group parameter? */ @@ -370,7 +370,7 @@ action_calendar_refresh_cb (GtkAction *action, model = e_cal_shell_content_get_model (cal_shell_content); selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar); - source = e_source_selector_peek_primary_selection (selector); + source = e_source_selector_get_primary_selection (selector); g_return_if_fail (E_IS_SOURCE (source)); uri = e_source_get_uri (source); @@ -415,7 +415,7 @@ action_calendar_select_one_cb (GtkAction *action, cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar; selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar); - primary = e_source_selector_peek_primary_selection (selector); + primary = e_source_selector_get_primary_selection (selector); g_return_if_fail (primary != NULL); e_source_selector_select_exclusive (selector, primary); diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index f463394fbd..04292af2fd 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -400,31 +400,12 @@ static void memo_shell_sidebar_primary_selection_changed_cb (EMemoShellSidebar *memo_shell_sidebar, ESourceSelector *selector) { - EShell *shell; - EShellView *shell_view; - EShellWindow *shell_window; - EShellSidebar *shell_sidebar; - EShellSettings *shell_settings; ESource *source; - /* XXX ESourceSelector needs a "primary-selection-uid" property - * so we can just bind the property with GConfBridge. */ - - source = e_source_selector_peek_primary_selection (selector); + source = e_source_selector_get_primary_selection (selector); if (source == NULL) return; - 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); - - shell = e_shell_window_get_shell (shell_window); - shell_settings = e_shell_get_shell_settings (shell); - - e_shell_settings_set_string ( - shell_settings, "cal-primary-memo-list", - e_source_peek_uid (source)); - memo_shell_sidebar_set_default (memo_shell_sidebar, source); } @@ -442,7 +423,6 @@ memo_shell_sidebar_restore_state_cb (EShellWindow *shell_window, ESource *source; GtkTreeModel *model; GSList *list, *iter; - gchar *uid; priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); @@ -468,19 +448,20 @@ memo_shell_sidebar_restore_state_cb (EShellWindow *shell_window, G_CALLBACK (memo_shell_sidebar_primary_selection_changed_cb), shell_sidebar); - source = NULL; - 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); - if (source == NULL) - source = e_source_list_peek_source_any (source_list); - if (source != NULL) - e_source_selector_set_primary_selection (selector, source); - g_free (uid); + g_object_bind_property_full ( + shell_settings, "cal-primary-memo-list", + selector, "primary-selection", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE, + (GBindingTransformFunc) e_binding_transform_uid_to_source, + (GBindingTransformFunc) e_binding_transform_source_to_uid, + g_object_ref (source_list), + (GDestroyNotify) g_object_unref); list = calendar_config_get_memos_selected (); for (iter = list; iter != NULL; iter = iter->next) { + gchar *uid; + uid = iter->data; source = e_source_list_peek_source_by_uid (source_list, uid); g_free (uid); @@ -635,7 +616,7 @@ memo_shell_sidebar_check_state (EShellSidebar *shell_sidebar) memo_shell_sidebar = E_MEMO_SHELL_SIDEBAR (shell_sidebar); selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar); - source = e_source_selector_peek_primary_selection (selector); + source = e_source_selector_get_primary_selection (selector); if (source != NULL) { ECal *client; diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c index a30d0f1b1f..bebeba1110 100644 --- a/modules/calendar/e-memo-shell-view-actions.c +++ b/modules/calendar/e-memo-shell-view-actions.c @@ -112,7 +112,7 @@ action_memo_list_copy_cb (GtkAction *action, memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar; selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar); - source = e_source_selector_peek_primary_selection (selector); + source = e_source_selector_get_primary_selection (selector); g_return_if_fail (E_IS_SOURCE (source)); copy_source_dialog ( @@ -152,7 +152,7 @@ action_memo_list_delete_cb (GtkAction *action, memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar; selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar); - source = e_source_selector_peek_primary_selection (selector); + source = e_source_selector_get_primary_selection (selector); g_return_if_fail (E_IS_SOURCE (source)); /* Ask for confirmation. */ @@ -249,7 +249,7 @@ action_memo_list_properties_cb (GtkAction *action, memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar; selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar); - source = e_source_selector_peek_primary_selection (selector); + source = e_source_selector_get_primary_selection (selector); g_return_if_fail (E_IS_SOURCE (source)); calendar_setup_edit_memo_list (GTK_WINDOW (shell_window), source); @@ -274,7 +274,7 @@ action_memo_list_refresh_cb (GtkAction *action, model = e_memo_shell_content_get_memo_model (memo_shell_content); selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar); - source = e_source_selector_peek_primary_selection (selector); + source = e_source_selector_get_primary_selection (selector); g_return_if_fail (E_IS_SOURCE (source)); uri = e_source_get_uri (source); @@ -319,7 +319,7 @@ action_memo_list_select_one_cb (GtkAction *action, memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar; selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar); - primary = e_source_selector_peek_primary_selection (selector); + primary = e_source_selector_get_primary_selection (selector); g_return_if_fail (primary != NULL); e_source_selector_select_exclusive (selector, primary); diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index b50e463e8a..580cee286f 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -400,31 +400,12 @@ static void task_shell_sidebar_primary_selection_changed_cb (ETaskShellSidebar *task_shell_sidebar, ESourceSelector *selector) { - EShell *shell; - EShellView *shell_view; - EShellWindow *shell_window; - EShellSidebar *shell_sidebar; - EShellSettings *shell_settings; ESource *source; - /* XXX ESourceSelector needs a "primary-selection-uid" property - * so we can just bind the property with GConfBridge. */ - - source = e_source_selector_peek_primary_selection (selector); + source = e_source_selector_get_primary_selection (selector); if (source == NULL) return; - 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); - - shell = e_shell_window_get_shell (shell_window); - shell_settings = e_shell_get_shell_settings (shell); - - e_shell_settings_set_string ( - shell_settings, "cal-primary-task-list", - e_source_peek_uid (source)); - task_shell_sidebar_set_default (task_shell_sidebar, source); } @@ -442,7 +423,6 @@ task_shell_sidebar_restore_state_cb (EShellWindow *shell_window, ESource *source; GtkTreeModel *model; GSList *list, *iter; - gchar *uid; priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); @@ -468,19 +448,20 @@ task_shell_sidebar_restore_state_cb (EShellWindow *shell_window, G_CALLBACK (task_shell_sidebar_primary_selection_changed_cb), shell_sidebar); - source = NULL; - 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); - if (source == NULL) - source = e_source_list_peek_source_any (source_list); - if (source != NULL) - e_source_selector_set_primary_selection (selector, source); - g_free (uid); + g_object_bind_property_full ( + shell_settings, "cal-primary-task-list", + selector, "primary-selection", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE, + (GBindingTransformFunc) e_binding_transform_uid_to_source, + (GBindingTransformFunc) e_binding_transform_source_to_uid, + g_object_ref (source_list), + (GDestroyNotify) g_object_unref); list = calendar_config_get_tasks_selected (); for (iter = list; iter != NULL; iter = iter->next) { + gchar *uid; + uid = iter->data; source = e_source_list_peek_source_by_uid (source_list, uid); g_free (uid); @@ -635,7 +616,7 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar) task_shell_sidebar = E_TASK_SHELL_SIDEBAR (shell_sidebar); selector = e_task_shell_sidebar_get_selector (task_shell_sidebar); - source = e_source_selector_peek_primary_selection (selector); + source = e_source_selector_get_primary_selection (selector); if (source != NULL) { ECal *client; diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c index b792c829bc..8ab9082ee0 100644 --- a/modules/calendar/e-task-shell-view-actions.c +++ b/modules/calendar/e-task-shell-view-actions.c @@ -135,7 +135,7 @@ action_task_list_copy_cb (GtkAction *action, task_shell_sidebar = task_shell_view->priv->task_shell_sidebar; selector = e_task_shell_sidebar_get_selector (task_shell_sidebar); - source = e_source_selector_peek_primary_selection (selector); + source = e_source_selector_get_primary_selection (selector); g_return_if_fail (E_IS_SOURCE (source)); copy_source_dialog ( @@ -175,7 +175,7 @@ action_task_list_delete_cb (GtkAction *action, task_shell_sidebar = task_shell_view->priv->task_shell_sidebar; selector = e_task_shell_sidebar_get_selector (task_shell_sidebar); - source = e_source_selector_peek_primary_selection (selector); + source = e_source_selector_get_primary_selection (selector); g_return_if_fail (E_IS_SOURCE (source)); /* Ask for confirmation. */ @@ -272,7 +272,7 @@ action_task_list_properties_cb (GtkAction *action, task_shell_sidebar = task_shell_view->priv->task_shell_sidebar; selector = e_task_shell_sidebar_get_selector (task_shell_sidebar); - source = e_source_selector_peek_primary_selection (selector); + source = e_source_selector_get_primary_selection (selector); g_return_if_fail (E_IS_SOURCE (source)); calendar_setup_edit_task_list (GTK_WINDOW (shell_window), source); @@ -297,7 +297,7 @@ action_task_list_refresh_cb (GtkAction *action, model = e_task_shell_content_get_task_model (task_shell_content); selector = e_task_shell_sidebar_get_selector (task_shell_sidebar); - source = e_source_selector_peek_primary_selection (selector); + source = e_source_selector_get_primary_selection (selector); g_return_if_fail (E_IS_SOURCE (source)); uri = e_source_get_uri (source); @@ -342,7 +342,7 @@ action_task_list_select_one_cb (GtkAction *action, task_shell_sidebar = task_shell_view->priv->task_shell_sidebar; selector = e_task_shell_sidebar_get_selector (task_shell_sidebar); - primary = e_source_selector_peek_primary_selection (selector); + primary = e_source_selector_get_primary_selection (selector); g_return_if_fail (primary != NULL); e_source_selector_select_exclusive (selector, primary); -- cgit v1.2.3 From bad8aff04f274c58c584bd5f7e8a396918aa9fb4 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 3 Nov 2010 16:35:02 +0100 Subject: Bug #612181 - Show recurring events in italic in date navigator --- modules/calendar/e-cal-shell-settings.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-settings.c b/modules/calendar/e-cal-shell-settings.c index 0ab35ebfee..524157c5a9 100644 --- a/modules/calendar/e-cal-shell-settings.c +++ b/modules/calendar/e-cal-shell-settings.c @@ -550,6 +550,10 @@ e_cal_shell_backend_init_settings (EShell *shell) "cal-primary-task-list", "/apps/evolution/calendar/tasks/primary_tasks"); + e_shell_settings_install_property_for_key ( + "cal-recur-events-italic", + "/apps/evolution/calendar/display/recur_events_italic"); + e_shell_settings_install_property_for_key ( "cal-show-event-end-times", "/apps/evolution/calendar/display/show_event_end"); -- cgit v1.2.3 From 1f17dab6b0d9c5413dea38dcc95e7a7bb5b4bd9b Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 2 Nov 2010 11:49:38 -0400 Subject: Move calendar preferences to the calendar module. Continue replacing the use of calendar-config functions with GObject property bindings to EShellSettings properties. --- modules/calendar/Makefile.am | 39 + .../calendar/apps_evolution_calendar.schemas.in | 834 ++++++++++++ modules/calendar/e-cal-config-comp-editor.c | 100 ++ modules/calendar/e-cal-config-comp-editor.h | 30 + modules/calendar/e-cal-config-meeting-store.c | 15 + modules/calendar/e-cal-config-model.c | 45 + modules/calendar/e-cal-config-view.c | 31 +- modules/calendar/e-cal-shell-backend.c | 98 +- modules/calendar/e-cal-shell-backend.h | 5 + modules/calendar/e-cal-shell-migrate.c | 30 +- modules/calendar/e-cal-shell-settings.c | 95 +- modules/calendar/e-cal-shell-sidebar.c | 27 +- modules/calendar/e-cal-shell-view-actions.c | 7 +- modules/calendar/e-cal-shell-view-memopad.c | 12 +- modules/calendar/e-cal-shell-view-taskpad.c | 12 +- modules/calendar/e-calendar-preferences.c | 905 ++++++++++++ modules/calendar/e-calendar-preferences.h | 89 ++ modules/calendar/e-calendar-preferences.ui | 1440 ++++++++++++++++++++ modules/calendar/e-memo-shell-backend.c | 59 +- modules/calendar/e-memo-shell-backend.h | 5 + modules/calendar/e-memo-shell-content.c | 13 +- modules/calendar/e-memo-shell-migrate.c | 38 +- modules/calendar/e-memo-shell-sidebar.c | 27 +- modules/calendar/e-memo-shell-view-actions.c | 12 +- modules/calendar/e-memo-shell-view-private.c | 2 - modules/calendar/e-task-shell-backend.c | 59 +- modules/calendar/e-task-shell-backend.h | 5 + modules/calendar/e-task-shell-content.c | 12 +- modules/calendar/e-task-shell-migrate.c | 38 +- modules/calendar/e-task-shell-sidebar.c | 27 +- modules/calendar/e-task-shell-view-actions.c | 12 +- modules/calendar/e-task-shell-view-private.c | 2 - modules/calendar/evolution-module-calendar.c | 6 + 33 files changed, 3962 insertions(+), 169 deletions(-) create mode 100644 modules/calendar/apps_evolution_calendar.schemas.in create mode 100644 modules/calendar/e-cal-config-comp-editor.c create mode 100644 modules/calendar/e-cal-config-comp-editor.h create mode 100644 modules/calendar/e-calendar-preferences.c create mode 100644 modules/calendar/e-calendar-preferences.h create mode 100644 modules/calendar/e-calendar-preferences.ui (limited to 'modules/calendar') diff --git a/modules/calendar/Makefile.am b/modules/calendar/Makefile.am index 0beb1285fa..c725dedb1c 100644 --- a/modules/calendar/Makefile.am +++ b/modules/calendar/Makefile.am @@ -17,6 +17,8 @@ libevolution_module_calendar_la_SOURCES = \ e-cal-attachment-handler.h \ e-cal-config-calendar-item.c \ e-cal-config-calendar-item.h \ + e-cal-config-comp-editor.c \ + e-cal-config-comp-editor.h \ e-cal-config-date-edit.c \ e-cal-config-date-edit.h \ e-cal-config-hook.c \ @@ -49,6 +51,8 @@ libevolution_module_calendar_la_SOURCES = \ e-cal-shell-view-private.c \ e-cal-shell-view-private.h \ e-cal-shell-view-taskpad.c \ + e-calendar-preferences.c \ + e-calendar-preferences.h \ e-memo-shell-backend.c \ e-memo-shell-backend.h \ e-memo-shell-content.c \ @@ -97,4 +101,39 @@ libevolution_module_calendar_la_LIBADD = \ libevolution_module_calendar_la_LDFLAGS = \ -module -avoid-version $(NO_UNDEFINED) +schemadir = $(GCONF_SCHEMA_FILE_DIR) +schema_in_files = apps_evolution_calendar.schemas.in +schema_DATA = $(schema_in_files:.schemas.in=.schemas) +@INTLTOOL_SCHEMAS_RULE@ + +ui_DATA = e-calendar-preferences.ui + +EXTRA_DIST = \ + $(schema_in_files) \ + $(ui_DATA) + +DISTCLEANFILES = $(schema_DATA) + +if GCONF_SCHEMAS_INSTALL +if OS_WIN32 +install-data-local: + if test -z "$(DESTDIR)" ; then \ + for p in $(schema_DATA) ; do \ + (echo set GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE); \ + echo $(GCONFTOOL) --makefile-install-rule $$p) >_temp.bat; \ + cmd /c _temp.bat; \ + rm _temp.bat; \ + done \ + fi +else +install-data-local: + if test -z "$(DESTDIR)" ; then \ + for p in $(schema_DATA) ; do \ + GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \ + $(GCONFTOOL) --makefile-install-rule $$p; \ + done \ + fi +endif +endif + -include $(top_srcdir)/git.mk diff --git a/modules/calendar/apps_evolution_calendar.schemas.in b/modules/calendar/apps_evolution_calendar.schemas.in new file mode 100644 index 0000000000..5f946d12ef --- /dev/null +++ b/modules/calendar/apps_evolution_calendar.schemas.in @@ -0,0 +1,834 @@ + + + + + + + /schemas/apps/evolution/calendar/display/primary_calendar + /apps/evolution/calendar/display/primary_calendar + evolution-calendar + string + + Primary calendar + + The UID of the selected (or "primary") calendar in the + sidebar of the "Calendar" view. + + + + + + /schemas/apps/evolution/calendar/display/timezone + /apps/evolution/calendar/display/timezone + evolution-calendar + string + UTC + + Timezone + The default timezone to use for dates and times in the calendar, as an untranslated Olsen timezone database location like "America/New York". + + + + + /schemas/apps/evolution/calendar/display/use_system_timezone + /apps/evolution/calendar/display/use_system_timezone + evolution-calendar + bool + true + + Use system timezone + Use the system timezone instead of the timezone selected + in Evolution. + + + + + /schemas/apps/evolution/calendar/display/day_second_zone + /apps/evolution/calendar/display/day_second_zone + evolution-calendar + string + + + The second timezone for a Day View + Shows the second time zone in a Day View, if set. Value is similar to one used in a 'timezone' key. + + + + + /schemas/apps/evolution/calendar/display/day_second_zones + /apps/evolution/calendar/display/day_second_zones + evolution-calendar + list + string + [] + + Recently used second time zones in a Day View + List of recently used second time zones in a Day View. + + + + + /schemas/apps/evolution/calendar/display/day_second_zones_max + /apps/evolution/calendar/display/day_second_zones_max + evolution-calendar + int + 5 + + Maximum number of recently used timezones to remember. + Maximum number of recently used timezones to remember in a 'day_second_zones' list. + + + + + /schemas/apps/evolution/calendar/display/use_24hour_format + /apps/evolution/calendar/display/use_24hour_format + evolution-calendar + bool + false + + Twenty four hour time format + Whether to show times in twenty four hour format instead of using am/pm. + + + + + /schemas/apps/evolution/calendar/display/show_role + /apps/evolution/calendar/display/show_role + evolution-calendar + bool + true + + Show Role field in the event/task/meeting editor + Whether to show role field in the event/task/meeting editor + + + + + /schemas/apps/evolution/calendar/display/show_status + /apps/evolution/calendar/display/show_status + evolution-calendar + bool + false + + Show status field in the event/task/meeting editor + Whether to show status field in the event/task/meeting editor + + + + + /schemas/apps/evolution/calendar/display/show_type + /apps/evolution/calendar/display/show_type + evolution-calendar + bool + false + + Show type field in the event/task/meeting editor + Whether to show type field in the event/task/meeting editor + + + + + /schemas/apps/evolution/calendar/display/show_rsvp + /apps/evolution/calendar/display/show_rsvp + evolution-calendar + bool + false + + Show RSVP field in the event/task/meeting editor + Whether to show RSVP field in the event/task/meeting editor + + + + + /schemas/apps/evolution/calendar/display/show_timezone + /apps/evolution/calendar/display/show_timezone + evolution-calendar + bool + false + + Show timezone field in the event/meeting editor + Whether to show timezone field in the event/meeting editor + + + + + /schemas/apps/evolution/calendar/display/show_categories + /apps/evolution/calendar/display/show_categories + evolution-calendar + bool + false + + Show categories field in the event/meeting/task editor + Whether to show categories field in the event/meeting editor + + + + + /schemas/apps/evolution/calendar/display/week_start_day + /apps/evolution/calendar/display/week_start_day + evolution-calendar + int + 1 + + Week start + Weekday the week starts on, from Sunday (0) to Saturday (6). + + + + + /schemas/apps/evolution/calendar/display/day_start_hour + /apps/evolution/calendar/display/day_start_hour + evolution-calendar + int + 9 + + Workday start hour + Hour the workday starts on, in twenty four hour format, 0 to 23. + + + + + /schemas/apps/evolution/calendar/display/day_start_minute + /apps/evolution/calendar/display/day_start_minute + evolution-calendar + int + 0 + + Workday start minute + Minute the workday starts on, 0 to 59. + + + + + /schemas/apps/evolution/calendar/display/day_end_hour + /apps/evolution/calendar/display/day_end_hour + evolution-calendar + int + 17 + + Workday end hour + Hour the workday ends on, in twenty four hour format, 0 to 23. + + + + + /schemas/apps/evolution/calendar/display/day_end_minute + /apps/evolution/calendar/display/day_end_minute + evolution-calendar + int + 0 + + Workday end minute + Minute the workday ends on, 0 to 59. + + + + + /schemas/apps/evolution/calendar/display/time_divisions + /apps/evolution/calendar/display/time_divisions + evolution-calendar + int + 30 + + Time divisions + Intervals shown in Day and Work Week views, in minutes. + + + + + /schemas/apps/evolution/calendar/display/hpane_position + /apps/evolution/calendar/display/hpane_position + evolution-calendar + int + 400 + + Horizontal pane position + Position of the horizontal pane, between the date navigator calendar and the task list when not in the month view, in pixels. + + + + + /schemas/apps/evolution/calendar/display/vpane_position + /apps/evolution/calendar/display/vpane_position + evolution-calendar + int + 150 + + Vertical pane position + Position of the vertical pane, between the view and the date navigator calendar and task list when not in the month view, in pixels. + + + + + /schemas/apps/evolution/calendar/display/month_hpane_position + /apps/evolution/calendar/display/month_hpane_position + evolution-calendar + int + 32000 + + Month view horizontal pane position + Position of the horizontal pane, between the view and the date navigator calendar and task list in the month view, in pixels. + + + + + /schemas/apps/evolution/calendar/display/month_vpane_position + /apps/evolution/calendar/display/month_vpane_position + evolution-calendar + int + 150 + + Month view vertical pane position + Position of the vertical pane, between the view and the date navigator calendar and task list in the month view, in pixels. + + + + /schemas/apps/evolution/calendar/display/date_navigator_pane_position + /apps/evolution/calendar/display/date_navigator_pane_position + evolution-calendar + int + 150 + + Month view vertical pane position + Position of the vertical pane, between the calendar lists and the date navigator calendar. + + + + + /schemas/apps/evolution/calendar/display/memo_layout + /apps/evolution/calendar/display/memo_layout + int + 0 + + Memo layout style + + The layout style determines where to place the preview pane + in relation to the memo list. "0" (Classic View) places the + preview pane below the memo list. "1" (Vertical View) places + the preview pane next to the memo list. + + + + + + /schemas/apps/evolution/calendar/display/show_memo_preview + /apps/evolution/calendar/display/show_memo_preview + evolution-calendar + bool + true + + Show the memo preview pane + + If "true", show the memo preview pane in the main window. + + + + + + /schemas/apps/evolution/calendar/display/memo_hpane_position + /apps/evolution/calendar/display/memo_hpane_position + evolution-calendar + int + 200 + + Memo preview pane position (horizontal) + + Position of the task preview pane when oriented horizontally. + + + + + + /schemas/apps/evolution/calendar/display/memo_vpane_position + /apps/evolution/calendar/display/memo_vpane_position + evolution-calendar + int + 400 + + Memo preview pane position (vertical) + + Position of the memo preview pane when oriented vertically. + + + + + + /schemas/apps/evolution/calendar/display/task_layout + /apps/evolution/calendar/display/task_layout + int + 0 + + Task layout style + + The layout style determines where to place the preview pane + in relation to the task list. "0" (Classic View) places the + preview pane below the task list. "1" (Vertical View) places + the preview pane next to the task list. + + + + + + /schemas/apps/evolution/calendar/display/show_task_preview + /apps/evolution/calendar/display/show_task_preview + evolution-calendar + bool + true + + Show the task preview pane + + If "true", show the task preview pane in the main window. + + + + + + /schemas/apps/evolution/calendar/display/task_hpane_position + /apps/evolution/calendar/display/task_hpane_position + evolution-calendar + int + 200 + + Task preview pane position (horizontal) + + Position of the task preview pane when oriented horizontally. + + + + + + /schemas/apps/evolution/calendar/display/task_vpane_position + /apps/evolution/calendar/display/task_vpane_position + evolution-calendar + int + 400 + + Task preview pane position (vertical) + + Position of the task preview pane when oriented vertically. + + + + + + /schemas/apps/evolution/calendar/display/compress_weekend + /apps/evolution/calendar/display/compress_weekend + evolution-calendar + bool + true + + Compress weekends in month view + Whether to compress weekends in the month view, which puts Saturday and Sunday in the space of one weekday. + + + + + /schemas/apps/evolution/calendar/display/show_event_end + /apps/evolution/calendar/display/show_event_end + evolution-calendar + bool + true + + Show appointment end times in week and month views + Whether to display the end time of events in the week and month views. + + + + + /schemas/apps/evolution/calendar/display/working_days + /apps/evolution/calendar/display/working_days + evolution-calendar + int + 62 + + Work days + Days on which the start and end of work hours should be indicated. + + + + + /schemas/apps/evolution/calendar/display/marcus_bains_line + /apps/evolution/calendar/display/marcus_bains_line + evolution-calendar + bool + true + + Marcus Bains Line + Whether to draw the Marcus Bains Line (line at current time) in the calendar. + + + + + /schemas/apps/evolution/calendar/display/marcus_bains_color_dayview + /apps/evolution/calendar/display/marcus_bains_color_dayview + evolution-calendar + string + #ff0000 + + Marcus Bains Line Color - Day View + Color to draw the Marcus Bains line in the Day View. + + + + + /schemas/apps/evolution/calendar/display/marcus_bains_color_timebar + /apps/evolution/calendar/display/marcus_bains_color_timebar + evolution-calendar + string + #ff0000 + + Marcus Bains Line Color - Time bar + Color to draw the Marcus Bains Line in the Time bar (empty for default). + + + + + /schemas/apps/evolution/calendar/display/recur_events_italic + /apps/evolution/calendar/display/recur_events_italic + evolution-calendar + bool + false + + Recurrent Events in Italic + Show days with recurrent events in italic font in bottom left calendar. + + + + + + + /schemas/apps/evolution/calendar/memos/primary_memos + /apps/evolution/calendar/memos/primary_memos + evolution-calendar + string + + Primary memo list + + The UID of the selected (or "primary") memo list in the + sidebar of the "Memos" view. + + + + + + + + /schemas/apps/evolution/calendar/tasks/primary_tasks + /apps/evolution/calendar/tasks/primary_tasks + evolution-calendar + string + + Primary task list + + The UID of the selected (or "primary") task list in the + sidebar of the "Tasks" view. + + + + + + /schemas/apps/evolution/calendar/tasks/hide_completed + /apps/evolution/calendar/tasks/hide_completed + evolution-calendar + bool + false + + Hide completed tasks + Whether to hide completed tasks in the tasks view. + + + + + /schemas/apps/evolution/calendar/tasks/hide_completed_units + /apps/evolution/calendar/tasks/hide_completed_units + evolution-calendar + string + days + + Hide task units + Units for determining when to hide tasks, "minutes", "hours" or "days". + + + + + /schemas/apps/evolution/calendar/tasks/hide_completed_value + /apps/evolution/calendar/tasks/hide_completed_value + evolution-calendar + int + 1 + + Hide task value + Number of units for determining when to hide tasks. + + + + + + + /schemas/apps/evolution/calendar/tasks/colors/due_today + /apps/evolution/calendar/tasks/colors/due_today + evolution-calendar + string + #1e90ff + + Tasks due today color + Background color of tasks that are due today, in "#rrggbb" format. + + + + + /schemas/apps/evolution/calendar/tasks/colors/overdue + /apps/evolution/calendar/tasks/colors/overdue + evolution-calendar + string + #ff0000 + + Overdue tasks color + Background color of tasks that are overdue, in "#rrggbb" format. + + + + + + + /schemas/apps/evolution/calendar/prompts/confirm_delete + /apps/evolution/calendar/prompts/confirm_delete + evolution-calendar + bool + true + + Ask for confirmation when deleting items + Whether to ask for confirmation when deleting an appointment or task. + + + + + /schemas/apps/evolution/calendar/prompts/confirm_purge + /apps/evolution/calendar/prompts/confirm_purge + evolution-calendar + bool + true + + Confirm expunge + Whether to ask for confirmation when expunging appointments and tasks. + + + + + /schemas/apps/evolution/calendar/other/use_default_reminder + /apps/evolution/calendar/other/use_default_reminder + evolution-calendar + bool + false + + Default appointment reminder + Whether to set a default reminder for appointments. + + + + + /schemas/apps/evolution/calendar/other/default_reminder_interval + /apps/evolution/calendar/other/default_reminder_interval + evolution-calendar + int + 15 + + Default reminder value + Number of units for determining a default reminder. + + + + + /schemas/apps/evolution/calendar/other/default_reminder_units + /apps/evolution/calendar/other/default_reminder_units + evolution-calendar + string + minutes + + Default reminder units + Units for a default reminder, "minutes", "hours" or "days". + + + + + /schemas/apps/evolution/calendar/other/use_ba_reminder + /apps/evolution/calendar/other/use_ba_reminder + evolution-calendar + bool + false + + Birthday and anniversary reminder + + Whether to set a reminder for birthdays and anniversaries. + + + + + + /schemas/apps/evolution/calendar/other/ba_reminder_interval + /apps/evolution/calendar/other/ba_reminder_interval + evolution-calendar + int + 15 + + Birthday and anniversary reminder value + + Number of units for determining a birthday or anniversary reminder. + + + + + + /schemas/apps/evolution/calendar/other/ba_reminder_units + /apps/evolution/calendar/other/ba_reminder_units + evolution-calendar + string + minutes + + Birthday and anniversary reminder units + + Units for a birthday or anniversary reminder, "minutes", "hours" + or "days". + + + + + + /schemas/apps/evolution/calendar/display/show_week_numbers + /apps/evolution/calendar/display/show_week_numbers + evolution-calendar + bool + false + + Show week numbers in Day View, Work Week View, and Date Navigator + Whether to show week numbers in various places in the Calendar. + + + + + /schemas/apps/evolution/calendar/display/month_scroll_by_week + /apps/evolution/calendar/display/month_scroll_by_week + evolution-calendar + bool + true + + Scroll Month View by a week + Whether to scroll a Month View by a week, not by a month. + + + + + + + /schemas/apps/evolution/calendar/notify/last_notification_time + /apps/evolution/calendar/notify/last_notification_time + evolution-calendar + int + -1 + + Last alarm time + Time the last alarm ran, in time_t. + + + + + /schemas/apps/evolution/calendar/notify/calendars + /apps/evolution/calendar/notify/calendars + evolution-calendar + list + string + [] + + Calendars to run alarms for + + + + + /schemas/apps/evolution/calendar/notify/programs + /apps/evolution/calendar/notify/programs + evolution-calendar + list + string + [] + + Alarm programs + Programs that are allowed to be run by alarms. + + + + + /schemas/apps/evolution/calendar/notify/notify_with_tray + /apps/evolution/calendar/notify/notify_with_tray + evolution-calendar + bool + false + + Show display alarms in notification tray + Whether or not to use the notification tray for display alarms. + + + + + /schemas/apps/evolution/calendar/publish/uris + /apps/evolution/calendar/publish/uris + evolution-calendar + list + string + [] + + Free/busy server URLs + List of server URLs for free/busy publishing. + + + + + /schemas/apps/evolution/calendar/publish/template + /apps/evolution/calendar/publish/template + evolution-calendar + string + + Free/busy template URL + The URL template to use as a free/busy data fallback, %u is replaced by the user part of the mail address and %d is replaced by the domain. + + + + + /schemas/apps/evolution/calendar/audio_dir + /apps/evolution/calendar/audio_dir + evolution-calendar + string + + Save directory for alarm audio + + Directory for saving alarm audio files + + + + + + /schemas/apps/evolution/calendar/display/error_timeout + /apps/evolution/calendar/display/error_timeout + evolution-calendar + int + 60 + + Amount of time in seconds the error should be shown on the status bar. + Amount of time in seconds the error should be shown on the status bar. + + + + + /schemas/apps/evolution/calendar/display/error_level + /apps/evolution/calendar/display/error_level + evolution-calendar + int + 0 + + Level beyond which the message should be logged. + This can have three possible values. 0 for errors. 1 for warnings. + 2 for debug messages. + + + + + diff --git a/modules/calendar/e-cal-config-comp-editor.c b/modules/calendar/e-cal-config-comp-editor.c new file mode 100644 index 0000000000..327bcd4518 --- /dev/null +++ b/modules/calendar/e-cal-config-comp-editor.c @@ -0,0 +1,100 @@ +/* + * e-cal-config-comp-editor.c + * + * 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 + * + */ + +#include "e-cal-config-comp-editor.h" + +#include +#include +#include + +static void +cal_config_comp_editor_constructed (GObject *object) +{ + EExtension *extension; + EExtensible *extensible; + EShellSettings *shell_settings; + EShell *shell; + + extension = E_EXTENSION (object); + extensible = e_extension_get_extensible (extension); + + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + g_object_bind_property ( + shell_settings, "cal-timezone", + extensible, "timezone", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-use-24-hour-format", + extensible, "use-24-hour-format", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-work-day-end-hour", + extensible, "work-day-end-hour", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-work-day-end-minute", + extensible, "work-day-end-minute", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-work-day-start-hour", + extensible, "work-day-start-hour", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-work-day-start-minute", + extensible, "work-day-start-minute", + G_BINDING_SYNC_CREATE); +} + +static void +cal_config_comp_editor_class_init (EExtensionClass *class) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (class); + object_class->constructed = cal_config_comp_editor_constructed; + + class->extensible_type = TYPE_COMP_EDITOR; +} + +void +e_cal_config_comp_editor_register_type (GTypeModule *type_module) +{ + static const GTypeInfo type_info = { + sizeof (EExtensionClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) cal_config_comp_editor_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (EExtension), + 0, /* n_preallocs */ + (GInstanceInitFunc) NULL, + NULL /* value_table */ + }; + + g_type_module_register_type ( + type_module, E_TYPE_EXTENSION, + "ECalConfigCompEditor", &type_info, 0); +} diff --git a/modules/calendar/e-cal-config-comp-editor.h b/modules/calendar/e-cal-config-comp-editor.h new file mode 100644 index 0000000000..124547a4dd --- /dev/null +++ b/modules/calendar/e-cal-config-comp-editor.h @@ -0,0 +1,30 @@ +/* + * e-cal-config-comp-editor.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 + * + */ + +#ifndef E_CAL_CONFIG_COMP_EDITOR_H +#define E_CAL_CONFIG_COMP_EDITOR_H + +#include + +G_BEGIN_DECLS + +void e_cal_config_comp_editor_register_type (GTypeModule *type_module); + +G_END_DECLS + +#endif /* E_CAL_CONFIG_COMP_EDITOR_H */ diff --git a/modules/calendar/e-cal-config-meeting-store.c b/modules/calendar/e-cal-config-meeting-store.c index 72f103bbec..f9babc53bf 100644 --- a/modules/calendar/e-cal-config-meeting-store.c +++ b/modules/calendar/e-cal-config-meeting-store.c @@ -36,6 +36,16 @@ cal_config_meeting_store_constructed (GObject *object) shell = e_shell_get_default (); shell_settings = e_shell_get_shell_settings (shell); + g_object_bind_property ( + shell_settings, "cal-default-reminder-interval", + extensible, "default-reminder-interval", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-default-reminder-units", + extensible, "default-reminder-units", + G_BINDING_SYNC_CREATE); + g_object_bind_property ( shell_settings, "cal-free-busy-template", extensible, "free-busy-template", @@ -45,6 +55,11 @@ cal_config_meeting_store_constructed (GObject *object) shell_settings, "cal-timezone", extensible, "timezone", G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-week-start-day", + extensible, "week-start-day", + G_BINDING_SYNC_CREATE); } static void diff --git a/modules/calendar/e-cal-config-model.c b/modules/calendar/e-cal-config-model.c index 62ff9b57b6..9dd5ee9b8d 100644 --- a/modules/calendar/e-cal-config-model.c +++ b/modules/calendar/e-cal-config-model.c @@ -39,6 +39,26 @@ cal_config_model_constructed (GObject *object) /*** ECalModel ***/ + g_object_bind_property ( + shell_settings, "cal-compress-weekend", + extensible, "compress-weekend", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-confirm-delete", + extensible, "confirm-delete", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-default-reminder-interval", + extensible, "default-reminder-interval", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-default-reminder-units", + extensible, "default-reminder-units", + G_BINDING_SYNC_CREATE); + g_object_bind_property ( shell_settings, "cal-timezone", extensible, "timezone", @@ -49,11 +69,36 @@ cal_config_model_constructed (GObject *object) extensible, "use-24-hour-format", G_BINDING_SYNC_CREATE); + g_object_bind_property ( + shell_settings, "cal-use-default-reminder", + extensible, "use-default-reminder", + G_BINDING_SYNC_CREATE); + g_object_bind_property ( shell_settings, "cal-week-start-day", extensible, "week-start-day", G_BINDING_SYNC_CREATE); + g_object_bind_property ( + shell_settings, "cal-work-day-end-hour", + extensible, "work-day-end-hour", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-work-day-end-minute", + extensible, "work-day-end-minute", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-work-day-start-hour", + extensible, "work-day-start-hour", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "cal-work-day-start-minute", + extensible, "work-day-start-minute", + G_BINDING_SYNC_CREATE); + /*** ECalModelTasks ***/ if (E_IS_CAL_MODEL_TASKS (extensible)) { diff --git a/modules/calendar/e-cal-config-view.c b/modules/calendar/e-cal-config-view.c index c1630223eb..e2f769c501 100644 --- a/modules/calendar/e-cal-config-view.c +++ b/modules/calendar/e-cal-config-view.c @@ -37,6 +37,12 @@ cal_config_view_constructed (GObject *object) shell = e_shell_get_default (); shell_settings = e_shell_get_shell_settings (shell); + g_object_bind_property ( + shell_settings, "cal-time-divisions", + extensible, "time-divisions", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + /*** EDayView ***/ if (E_IS_DAY_VIEW (extensible)) { @@ -61,31 +67,6 @@ cal_config_view_constructed (GObject *object) extensible, "marcus-bains-time-bar-color", G_BINDING_SYNC_CREATE); - g_object_bind_property ( - shell_settings, "cal-time-divisions", - extensible, "mins-per-row", - G_BINDING_SYNC_CREATE); - - g_object_bind_property ( - shell_settings, "cal-work-day-end-hour", - extensible, "work-day-end-hour", - G_BINDING_SYNC_CREATE); - - g_object_bind_property ( - shell_settings, "cal-work-day-end-minute", - extensible, "work-day-end-minute", - G_BINDING_SYNC_CREATE); - - g_object_bind_property ( - shell_settings, "cal-work-day-start-hour", - extensible, "work-day-start-hour", - G_BINDING_SYNC_CREATE); - - g_object_bind_property ( - shell_settings, "cal-work-day-start-minute", - extensible, "work-day-start-minute", - G_BINDING_SYNC_CREATE); - g_object_bind_property ( shell_settings, "cal-working-days-bitset", extensible, "working-days", diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 749dd7ec19..fa4c2db0de 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -36,9 +36,7 @@ #include "widgets/misc/e-preferences-window.h" #include "calendar/common/authentication.h" -#include "calendar/gui/calendar-config.h" #include "calendar/gui/comp-util.h" -#include "calendar/gui/dialogs/cal-prefs-dialog.h" #include "calendar/gui/dialogs/calendar-setup.h" #include "calendar/gui/dialogs/event-editor.h" #include "calendar/gui/e-calendar-view.h" @@ -51,6 +49,8 @@ #include "e-cal-shell-sidebar.h" #include "e-cal-shell-view.h" +#include "e-calendar-preferences.h" + #define E_CAL_SHELL_BACKEND_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), E_TYPE_CAL_SHELL_BACKEND, ECalShellBackendPrivate)) @@ -73,9 +73,10 @@ 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? */ - ECalShellBackendPrivate *priv; + ECalShellBackend *cal_shell_backend; ESourceGroup *on_this_computer; ESourceGroup *contacts; + ESourceList *source_list; ESource *birthdays; ESource *personal; EShell *shell; @@ -88,24 +89,28 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend) birthdays = NULL; personal = NULL; - priv = E_CAL_SHELL_BACKEND_GET_PRIVATE (shell_backend); + cal_shell_backend = E_CAL_SHELL_BACKEND (shell_backend); shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - if (!e_cal_get_sources (&priv->source_list, E_CAL_SOURCE_TYPE_EVENT, NULL)) { + if (!e_cal_get_sources ( + &cal_shell_backend->priv->source_list, + E_CAL_SOURCE_TYPE_EVENT, NULL)) { g_warning ("Could not get calendar sources from GConf!"); return; } + source_list = cal_shell_backend->priv->source_list; + on_this_computer = e_source_list_ensure_group ( - priv->source_list, _("On This Computer"), "local:", TRUE); + source_list, _("On This Computer"), "local:", TRUE); contacts = e_source_list_ensure_group ( - priv->source_list, _("Contacts"), "contacts://", TRUE); + source_list, _("Contacts"), "contacts://", TRUE); e_source_list_ensure_group ( - priv->source_list, _("On The Web"), "webcal://", FALSE); + source_list, _("On The Web"), "webcal://", FALSE); e_source_list_ensure_group ( - priv->source_list, _("Weather"), "weather://", FALSE); + source_list, _("Weather"), "weather://", FALSE); g_return_if_fail (on_this_computer != NULL); g_return_if_fail (contacts != NULL); @@ -140,7 +145,8 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend) primary = e_shell_settings_get_string ( shell_settings, "cal-primary-calendar"); - selected = calendar_config_get_calendars_selected (); + selected = e_cal_shell_backend_get_selected_calendars ( + cal_shell_backend); if (primary == NULL && selected == NULL) { const gchar *uid; @@ -150,7 +156,8 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend) e_shell_settings_set_string ( shell_settings, "cal-primary-calendar", uid); - calendar_config_set_calendars_selected (selected); + e_cal_shell_backend_set_selected_calendars ( + cal_shell_backend, selected); } g_slist_foreach (selected, (GFunc) g_free, NULL); @@ -217,7 +224,7 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend) g_object_unref (contacts); if (save_list) - e_source_list_sync (priv->source_list, NULL); + e_source_list_sync (source_list, NULL); } static void @@ -229,14 +236,26 @@ cal_shell_backend_new_event (ESource *source, { ECal *cal; ECalComponent *comp; + EShellSettings *shell_settings; CompEditor *editor; /* XXX Handle errors better. */ cal = e_load_cal_source_finish (source, result, NULL); g_return_if_fail (E_IS_CAL (cal)); + shell_settings = e_shell_get_shell_settings (shell); + editor = event_editor_new (cal, shell, flags); - comp = cal_comp_event_new_with_current_time (cal, all_day); + comp = cal_comp_event_new_with_current_time ( + cal, all_day, + e_shell_settings_get_pointer ( + shell_settings, "cal-timezone"), + e_shell_settings_get_boolean ( + shell_settings, "cal-use-default-reminder"), + e_shell_settings_get_int ( + shell_settings, "cal-default-reminder-interval"), + e_shell_settings_get_int ( /* enum, actually */ + shell_settings, "cal-default-reminder-units")); e_cal_component_commit_sequence (comp); comp_editor_edit_comp (editor, comp); @@ -452,10 +471,9 @@ cal_shell_backend_init_importers (void) } static time_t -utc_to_user_zone (time_t utc_time) +utc_to_user_zone (time_t utc_time, + icaltimezone *zone) { - icaltimezone *zone = calendar_config_get_icaltimezone (); - if (!zone || (int) utc_time == -1) return utc_time; @@ -468,6 +486,7 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend, const gchar *uri) { EShell *shell; + EShellSettings *shell_settings; CompEditor *editor; CompEditorFlags flags = 0; ECal *client; @@ -484,11 +503,15 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend, gchar *comp_rid = NULL; GDate start_date; GDate end_date; + icaltimezone *zone; gboolean handled = FALSE; GError *error = NULL; source_type = E_CAL_SOURCE_TYPE_EVENT; shell = e_shell_backend_get_shell (shell_backend); + shell_settings = e_shell_get_shell_settings (shell); + + zone = e_shell_settings_get_pointer (shell_settings, "cal-timezone"); if (strncmp (uri, "calendar:", 9) != 0) return FALSE; @@ -522,10 +545,12 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend, content = g_strndup (cp, content_len); if (g_ascii_strcasecmp (header, "startdate") == 0) g_date_set_time_t ( - &start_date, utc_to_user_zone (time_from_isodate (content))); + &start_date, utc_to_user_zone ( + time_from_isodate (content), zone)); else if (g_ascii_strcasecmp (header, "enddate") == 0) g_date_set_time_t ( - &end_date, utc_to_user_zone (time_from_isodate (content))); + &end_date, utc_to_user_zone ( + time_from_isodate (content), zone)); else if (g_ascii_strcasecmp (header, "source-uid") == 0) source_uid = g_strdup (content); else if (g_ascii_strcasecmp (header, "comp-uid") == 0) @@ -727,7 +752,7 @@ cal_shell_backend_constructed (GObject *object) "calendar-and-tasks", "preferences-calendar-and-tasks", _("Calendar and Tasks"), - calendar_prefs_dialog_new, + e_calendar_preferences_new, 600); } @@ -835,6 +860,41 @@ e_cal_shell_backend_get_source_list (ECalShellBackend *cal_shell_backend) return cal_shell_backend->priv->source_list; } +GSList * +e_cal_shell_backend_get_selected_calendars (ECalShellBackend *cal_shell_backend) +{ + GConfClient *client; + GSList *selected_calendars; + const gchar *key; + + g_return_val_if_fail ( + E_IS_CAL_SHELL_BACKEND (cal_shell_backend), NULL); + + client = gconf_client_get_default (); + key = "/apps/evolution/calendar/display/selected_calendars"; + selected_calendars = gconf_client_get_list ( + client, key, GCONF_VALUE_STRING, NULL); + g_object_unref (client); + + return selected_calendars; +} + +void +e_cal_shell_backend_set_selected_calendars (ECalShellBackend *cal_shell_backend, + GSList *selected_calendars) +{ + GConfClient *client; + const gchar *key; + + g_return_if_fail (E_IS_CAL_SHELL_BACKEND (cal_shell_backend)); + + client = gconf_client_get_default (); + key = "/apps/evolution/calendar/display/selected_calendars"; + gconf_client_set_list ( + client, key, GCONF_VALUE_STRING, selected_calendars, NULL); + g_object_unref (client); +} + void e_cal_shell_backend_open_date_range (ECalShellBackend *cal_shell_backend, const GDate *start_date, diff --git a/modules/calendar/e-cal-shell-backend.h b/modules/calendar/e-cal-shell-backend.h index 4b19275b79..32fca7f53b 100644 --- a/modules/calendar/e-cal-shell-backend.h +++ b/modules/calendar/e-cal-shell-backend.h @@ -64,6 +64,11 @@ void e_cal_shell_backend_register_type (GTypeModule *type_module); ESourceList * e_cal_shell_backend_get_source_list (ECalShellBackend *cal_shell_backend); +GSList * e_cal_shell_backend_get_selected_calendars + (ECalShellBackend *cal_shell_backend); +void e_cal_shell_backend_set_selected_calendars + (ECalShellBackend *cal_shell_backend, + GSList *selected_calendars); void e_cal_shell_backend_open_date_range (ECalShellBackend *cal_shell_backend, const GDate *start_date, diff --git a/modules/calendar/e-cal-shell-migrate.c b/modules/calendar/e-cal-shell-migrate.c index c1a7221597..d25228d98f 100644 --- a/modules/calendar/e-cal-shell-migrate.c +++ b/modules/calendar/e-cal-shell-migrate.c @@ -37,11 +37,12 @@ #include #include "e-util/e-util-private.h" -#include "calendar/gui/calendar-config.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 WEBCAL_BASE_URI "webcal://" #define CONTACTS_BASE_URI "contacts://" #define BAD_CONTACTS_BASE_URI "contact://" @@ -150,6 +151,7 @@ create_calendar_sources (EShellBackend *shell_backend, } if (!*personal_source) { + GSList *selected; gchar *primary_calendar; /* Create the default Person calendar */ @@ -159,18 +161,26 @@ create_calendar_sources (EShellBackend *shell_backend, primary_calendar = e_shell_settings_get_string ( shell_settings, "cal-primary-calendar"); - if (!primary_calendar && !calendar_config_get_calendars_selected ()) { - GSList selected; + selected = e_cal_shell_backend_get_selected_calendars ( + E_CAL_SHELL_BACKEND (shell_backend)); + + if (primary_calendar == NULL && selected == NULL) { + GSList link; e_shell_settings_set_string ( shell_settings, "cal-primary-calendar", e_source_peek_uid (source)); - selected.data = (gpointer)e_source_peek_uid (source); - selected.next = NULL; - calendar_config_set_calendars_selected (&selected); + link.data = (gpointer)e_source_peek_uid (source); + link.next = NULL; + + e_cal_shell_backend_set_selected_calendars ( + E_CAL_SHELL_BACKEND (shell_backend), &link); } + g_slist_foreach (selected, (GFunc) g_free, NULL); + g_slist_free (selected); + g_free (primary_calendar); e_source_set_color_spec (source, "#BECEDD"); *personal_source = source; @@ -196,10 +206,10 @@ create_calendar_sources (EShellBackend *shell_backend, gboolean e_cal_shell_backend_migrate (EShellBackend *shell_backend, - gint major, - gint minor, - gint micro, - GError **error) + gint major, + gint minor, + gint micro, + GError **error) { ESourceGroup *on_this_computer = NULL, *on_the_web = NULL, *contacts = NULL; ESource *personal_source = NULL; diff --git a/modules/calendar/e-cal-shell-settings.c b/modules/calendar/e-cal-shell-settings.c index 524157c5a9..30fc1c4fa7 100644 --- a/modules/calendar/e-cal-shell-settings.c +++ b/modules/calendar/e-cal-shell-settings.c @@ -24,6 +24,9 @@ #include #include +#include +#include + static gboolean transform_string_to_icaltimezone (GBinding *binding, const GValue *source_value, @@ -494,6 +497,14 @@ e_cal_shell_backend_init_settings (EShell *shell) shell_settings = e_shell_get_shell_settings (shell); + e_shell_settings_install_property_for_key ( + "cal-ba-reminder-interval", + "/apps/evolution/calendar/other/ba_reminder_interval"); + + e_shell_settings_install_property_for_key ( + "cal-ba-reminder-units-string", + "/apps/evolution/calendar/other/ba_reminder_units"); + e_shell_settings_install_property_for_key ( "cal-compress-weekend", "/apps/evolution/calendar/display/compress_weekend"); @@ -507,8 +518,14 @@ e_cal_shell_backend_init_settings (EShell *shell) "/apps/evolution/calendar/prompts/confirm_purge"); e_shell_settings_install_property_for_key ( - "cal-show-week-numbers", - "/apps/evolution/calendar/display/show_week_numbers"); + "cal-default-reminder-interval", + "/apps/evolution/calendar/other/default_reminder_interval"); + + /* Do not bind to this. + * Use "cal-default-reminder-units" instead. */ + e_shell_settings_install_property_for_key ( + "cal-default-reminder-units-string", + "/apps/evolution/calendar/other/default_reminder_units"); e_shell_settings_install_property_for_key ( "cal-free-busy-template", @@ -518,8 +535,10 @@ e_cal_shell_backend_init_settings (EShell *shell) "cal-hide-completed-tasks", "/apps/evolution/calendar/tasks/hide_completed"); + /* Do not bind to this. + * Use "cal-hide-completed-tasks-units" instead. */ e_shell_settings_install_property_for_key ( - "cal-hide-completed-tasks-units", + "cal-hide-completed-tasks-units-string", "/apps/evolution/calendar/tasks/hide_completed_units"); e_shell_settings_install_property_for_key ( @@ -538,6 +557,10 @@ e_cal_shell_backend_init_settings (EShell *shell) "cal-marcus-bains-show-line", "/apps/evolution/calendar/display/marcus_bains_line"); + e_shell_settings_install_property_for_key ( + "cal-month-scroll-by-week", + "/apps/evolution/calendar/display/month_scroll_by_week"); + e_shell_settings_install_property_for_key ( "cal-primary-calendar", "/apps/evolution/calendar/display/primary_calendar"); @@ -558,6 +581,10 @@ e_cal_shell_backend_init_settings (EShell *shell) "cal-show-event-end-times", "/apps/evolution/calendar/display/show_event_end"); + e_shell_settings_install_property_for_key ( + "cal-show-week-numbers", + "/apps/evolution/calendar/display/show_week_numbers"); + e_shell_settings_install_property_for_key ( "cal-tasks-color-due-today", "/apps/evolution/calendar/tasks/colors/due_today"); @@ -579,6 +606,14 @@ e_cal_shell_backend_init_settings (EShell *shell) "cal-use-24-hour-format", "/apps/evolution/calendar/display/use_24hour_format"); + e_shell_settings_install_property_for_key ( + "cal-use-ba-reminder", + "/apps/evolution/calendar/other/use_ba_reminder"); + + e_shell_settings_install_property_for_key ( + "cal-use-default-reminder", + "/apps/evolution/calendar/other/use_default_reminder"); + e_shell_settings_install_property_for_key ( "cal-use-system-timezone", "/apps/evolution/calendar/display/use_system_timezone"); @@ -615,6 +650,60 @@ e_cal_shell_backend_init_settings (EShell *shell) * is backward-compatibility cruft for poorly designed * GConf schemas. */ + e_shell_settings_install_property ( + g_param_spec_enum ( + "cal-ba-reminder-units", + NULL, + NULL, + E_TYPE_DURATION_TYPE, + E_DURATION_MINUTES, + G_PARAM_READWRITE)); + + g_object_bind_property_full ( + shell_settings, "cal-ba-reminder-units-string", + shell_settings, "cal-ba-reminder-units", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE, + e_binding_transform_enum_nick_to_value, + e_binding_transform_enum_value_to_nick, + NULL, (GDestroyNotify) NULL); + + e_shell_settings_install_property ( + g_param_spec_enum ( + "cal-default-reminder-units", + NULL, + NULL, + E_TYPE_DURATION_TYPE, + E_DURATION_MINUTES, + G_PARAM_READWRITE)); + + g_object_bind_property_full ( + shell_settings, "cal-default-reminder-units-string", + shell_settings, "cal-default-reminder-units", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE, + e_binding_transform_enum_nick_to_value, + e_binding_transform_enum_value_to_nick, + NULL, (GDestroyNotify) NULL); + + e_shell_settings_install_property ( + g_param_spec_enum ( + "cal-hide-completed-tasks-units", + NULL, + NULL, + E_TYPE_DURATION_TYPE, + E_DURATION_MINUTES, + G_PARAM_READWRITE)); + + g_object_bind_property_full ( + shell_settings, "cal-hide-completed-tasks-units-string", + shell_settings, "cal-hide-completed-tasks-units", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE, + e_binding_transform_enum_nick_to_value, + e_binding_transform_enum_value_to_nick, + NULL, (GDestroyNotify) NULL); + e_shell_settings_install_property ( g_param_spec_pointer ( "cal-timezone", diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index 66a1102cb7..1e291989cf 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -29,7 +29,6 @@ #include "widgets/misc/e-paned.h" #include "calendar/common/authentication.h" -#include "calendar/gui/calendar-config.h" #include "calendar/gui/e-calendar-selector.h" #include "calendar/gui/misc.h" #include "calendar/gui/dialogs/calendar-setup.h" @@ -382,12 +381,19 @@ 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) { @@ -397,7 +403,8 @@ cal_shell_sidebar_selection_changed_cb (ECalShellSidebar *cal_shell_sidebar, g_object_unref (source); } - calendar_config_set_calendars_selected (list); + e_cal_shell_backend_set_selected_calendars ( + E_CAL_SHELL_BACKEND (shell_backend), list); g_slist_free (list); } @@ -467,19 +474,19 @@ cal_shell_sidebar_restore_state_cb (EShellWindow *shell_window, g_object_ref (source_list), (GDestroyNotify) g_object_unref); - list = calendar_config_get_calendars_selected (); + list = e_cal_shell_backend_get_selected_calendars ( + E_CAL_SHELL_BACKEND (shell_backend)); + for (iter = list; iter != NULL; iter = iter->next) { - gchar *uid; + const gchar *uid = iter->data; - uid = iter->data; source = e_source_list_peek_source_by_uid (source_list, uid); - g_free (uid); - if (source == NULL) - continue; - - e_source_selector_select_source (selector, source); + 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. */ diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c index bce4fc4266..7b9d88fc73 100644 --- a/modules/calendar/e-cal-shell-view-actions.c +++ b/modules/calendar/e-cal-shell-view-actions.c @@ -960,6 +960,7 @@ action_event_print_cb (GtkAction *action, ECalendarView *calendar_view; ECalendarViewEvent *event; ECalComponent *component; + ECalModel *model; ECal *client; icalcomponent *icalcomp; GList *selected; @@ -968,6 +969,7 @@ action_event_print_cb (GtkAction *action, 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); selected = e_calendar_view_get_selected_events (calendar_view); g_return_if_fail (g_list_length (selected) == 1); @@ -985,7 +987,10 @@ action_event_print_cb (GtkAction *action, e_cal_component_set_icalcomponent ( component, icalcomponent_new_clone (icalcomp)); print_comp ( - component, client, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG); + component, client, + e_cal_model_get_timezone (model), + e_cal_model_get_use_24_hour_format (model), + GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG); 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 11e1bcd3dc..c4b67a88f4 100644 --- a/modules/calendar/e-cal-shell-view-memopad.c +++ b/modules/calendar/e-cal-shell-view-memopad.c @@ -153,12 +153,13 @@ action_calendar_memopad_print_cb (GtkAction *action, EMemoTable *memo_table; ECalModelComponent *comp_data; ECalComponent *comp; + ECalModel *model; icalcomponent *clone; - GtkPrintOperationAction print_action; GSList *list; cal_shell_content = cal_shell_view->priv->cal_shell_content; memo_table = e_cal_shell_content_get_memo_table (cal_shell_content); + model = e_memo_table_get_model (memo_table); list = e_memo_table_get_selected (memo_table); g_return_if_fail (list != NULL); @@ -168,9 +169,14 @@ action_calendar_memopad_print_cb (GtkAction *action, /* XXX We only print the first selected memo. */ comp = e_cal_component_new (); clone = icalcomponent_new_clone (comp_data->icalcomp); - print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG; e_cal_component_set_icalcomponent (comp, clone); - print_comp (comp, comp_data->client, print_action); + + print_comp ( + comp, comp_data->client, + e_cal_model_get_timezone (model), + e_cal_model_get_use_24_hour_format (model), + GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG); + g_object_unref (comp); } diff --git a/modules/calendar/e-cal-shell-view-taskpad.c b/modules/calendar/e-cal-shell-view-taskpad.c index 6dae14465d..ead28ae351 100644 --- a/modules/calendar/e-cal-shell-view-taskpad.c +++ b/modules/calendar/e-cal-shell-view-taskpad.c @@ -220,12 +220,13 @@ action_calendar_taskpad_print_cb (GtkAction *action, ECalModelComponent *comp_data; ETaskTable *task_table; ECalComponent *comp; + ECalModel *model; icalcomponent *clone; - GtkPrintOperationAction print_action; GSList *list; cal_shell_content = cal_shell_view->priv->cal_shell_content; task_table = e_cal_shell_content_get_task_table (cal_shell_content); + model = e_task_table_get_model (task_table); list = e_task_table_get_selected (task_table); g_return_if_fail (list != NULL); @@ -235,9 +236,14 @@ action_calendar_taskpad_print_cb (GtkAction *action, /* XXX We only print the first selected task. */ comp = e_cal_component_new (); clone = icalcomponent_new_clone (comp_data->icalcomp); - print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG; e_cal_component_set_icalcomponent (comp, clone); - print_comp (comp, comp_data->client, print_action); + + print_comp ( + comp, comp_data->client, + e_cal_model_get_timezone (model), + e_cal_model_get_use_24_hour_format (model), + GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG); + g_object_unref (comp); } diff --git a/modules/calendar/e-calendar-preferences.c b/modules/calendar/e-calendar-preferences.c new file mode 100644 index 0000000000..9db9f4538b --- /dev/null +++ b/modules/calendar/e-calendar-preferences.c @@ -0,0 +1,905 @@ +/* + * 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 + * + * + * Authors: + * Damon Chaplin + * Ettore Perazzoli + * David Trowbridge + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#include "e-calendar-preferences.h" + +#include +#include +#include + +#include "calendar/gui/e-cal-config.h" +#include "calendar/gui/e-timezone-entry.h" +#include "calendar/gui/calendar-config.h" +#include "widgets/misc/e-dateedit.h" +#include "e-util/e-util.h" +#include "e-util/e-datetime-format.h" +#include "e-util/e-dialog-widgets.h" +#include "e-util/e-util-private.h" +#include "shell/e-shell-utils.h" + +/* same is used for Birthdays & Anniversaries calendar */ +static const gint default_reminder_units_map[] = { + E_DURATION_MINUTES, E_DURATION_HOURS, E_DURATION_DAYS, -1 +}; + +G_DEFINE_DYNAMIC_TYPE ( + ECalendarPreferences, + e_calendar_preferences, + GTK_TYPE_VBOX) + +static gboolean +transform_time_divisions_to_index (GBinding *binding, + const GValue *source_value, + GValue *target_value, + gpointer not_used) +{ + gboolean success = TRUE; + + g_return_val_if_fail (G_IS_BINDING (binding), FALSE); + + switch (g_value_get_int (source_value)) { + case 60: + g_value_set_int (target_value, 0); + break; + case 30: + g_value_set_int (target_value, 1); + break; + case 15: + g_value_set_int (target_value, 2); + break; + case 10: + g_value_set_int (target_value, 3); + break; + case 5: + g_value_set_int (target_value, 4); + break; + default: + success = FALSE; + } + + return success; +} + +static gboolean +transform_index_to_time_divisions (GBinding *binding, + const GValue *source_value, + GValue *target_value, + gpointer not_used) +{ + gboolean success = TRUE; + + switch (g_value_get_int (source_value)) { + case 0: + g_value_set_int (target_value, 60); + break; + case 1: + g_value_set_int (target_value, 30); + break; + case 2: + g_value_set_int (target_value, 15); + break; + case 3: + g_value_set_int (target_value, 10); + break; + case 4: + g_value_set_int (target_value, 5); + break; + default: + success = FALSE; + } + + return success; +} + +static void +calendar_preferences_dispose (GObject *object) +{ + ECalendarPreferences *prefs = (ECalendarPreferences *) object; + + if (prefs->builder != NULL) { + g_object_unref (prefs->builder); + prefs->builder = NULL; + } + + if (prefs->shell_settings != NULL) { + g_object_unref (prefs->shell_settings); + prefs->shell_settings = NULL; + } + + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (e_calendar_preferences_parent_class)->dispose (object); +} + +static void +e_calendar_preferences_class_init (ECalendarPreferencesClass *class) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (class); + object_class->dispose = calendar_preferences_dispose; +} + +static void +e_calendar_preferences_class_finalize (ECalendarPreferencesClass *class) +{ +} + +static void +e_calendar_preferences_init (ECalendarPreferences *preferences) +{ +} + +static GtkWidget * +calendar_preferences_get_config_widget (EConfig *ec, + EConfigItem *item, + GtkWidget *parent, + GtkWidget *old, + gpointer data) +{ + ECalendarPreferences *preferences = data; + + return e_builder_get_widget (preferences->builder, item->label); +} + +static void +update_day_second_zone_caption (ECalendarPreferences *prefs) +{ + gchar *location; + const gchar *caption; + icaltimezone *zone; + + g_return_if_fail (prefs != NULL); + + /* Translators: "None" indicates no second time zone set for a day view */ + caption = C_("cal-second-zone", "None"); + + location = calendar_config_get_day_second_zone (); + if (location && *location) { + zone = icaltimezone_get_builtin_timezone (location); + if (zone && icaltimezone_get_display_name (zone)) { + caption = icaltimezone_get_display_name (zone); + } + } + g_free (location); + + gtk_button_set_label (GTK_BUTTON (prefs->day_second_zone), caption); +} + +static void +on_set_day_second_zone (GtkWidget *item, ECalendarPreferences *prefs) +{ + if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item))) + return; + + calendar_config_set_day_second_zone (g_object_get_data (G_OBJECT (item), "timezone")); + update_day_second_zone_caption (prefs); +} + +static void +on_select_day_second_zone (GtkWidget *item, ECalendarPreferences *prefs) +{ + g_return_if_fail (prefs != NULL); + + calendar_config_select_day_second_zone (); + update_day_second_zone_caption (prefs); +} + +static void +day_second_zone_clicked (GtkWidget *widget, ECalendarPreferences *prefs) +{ + GtkWidget *menu, *item; + GSList *group = NULL, *recent_zones, *s; + gchar *location; + icaltimezone *zone, *second_zone = NULL; + + menu = gtk_menu_new (); + + location = calendar_config_get_day_second_zone (); + if (location && *location) + second_zone = icaltimezone_get_builtin_timezone (location); + g_free (location); + + group = NULL; + item = gtk_radio_menu_item_new_with_label (group, C_("cal-second-zone", "None")); + group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item)); + if (!second_zone) + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + g_signal_connect (item, "toggled", G_CALLBACK (on_set_day_second_zone), prefs); + + recent_zones = calendar_config_get_day_second_zones (); + for (s = recent_zones; s != NULL; s = s->next) { + zone = icaltimezone_get_builtin_timezone (s->data); + if (!zone) + continue; + + item = gtk_radio_menu_item_new_with_label (group, icaltimezone_get_display_name (zone)); + group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item)); + /* both comes from builtin, thus no problem to compare pointers */ + if (zone == second_zone) + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + g_object_set_data_full (G_OBJECT (item), "timezone", g_strdup (s->data), g_free); + g_signal_connect (item, "toggled", G_CALLBACK (on_set_day_second_zone), prefs); + } + calendar_config_free_day_second_zones (recent_zones); + + item = gtk_separator_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + + item = gtk_menu_item_new_with_label (_("Select...")); + g_signal_connect (item, "activate", G_CALLBACK (on_select_day_second_zone), prefs); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + + gtk_widget_show_all (menu); + + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, + 0, gtk_get_current_event_time ()); +} + +static void +start_of_day_changed (GtkWidget *widget, ECalendarPreferences *prefs) +{ + gint start_hour, start_minute, end_hour, end_minute; + EDateEdit *start, *end; + + start = E_DATE_EDIT (prefs->start_of_day); + end = E_DATE_EDIT (prefs->end_of_day); + + e_date_edit_get_time_of_day (start, &start_hour, &start_minute); + e_date_edit_get_time_of_day (end, &end_hour, &end_minute); + + if ((start_hour > end_hour) || (start_hour == end_hour && start_minute > end_minute)) { + if (start_hour < 23) + e_date_edit_set_time_of_day (end, start_hour + 1, start_minute); + else + e_date_edit_set_time_of_day (end, 23, 59); + + return; + } + + e_shell_settings_set_int ( + prefs->shell_settings, + "cal-work-day-start-hour", start_hour); + e_shell_settings_set_int ( + prefs->shell_settings, + "cal-work-day-start-minute", start_minute); +} + +static void +end_of_day_changed (GtkWidget *widget, ECalendarPreferences *prefs) +{ + gint start_hour, start_minute, end_hour, end_minute; + EDateEdit *start, *end; + + start = E_DATE_EDIT (prefs->start_of_day); + end = E_DATE_EDIT (prefs->end_of_day); + + e_date_edit_get_time_of_day (start, &start_hour, &start_minute); + e_date_edit_get_time_of_day (end, &end_hour, &end_minute); + + if ((end_hour < start_hour) || (end_hour == start_hour && end_minute < start_minute)) { + if (end_hour < 1) + e_date_edit_set_time_of_day (start, 0, 0); + else + e_date_edit_set_time_of_day (start, end_hour - 1, end_minute); + + return; + } + + e_shell_settings_set_int ( + prefs->shell_settings, + "cal-work-day-end-hour", end_hour); + e_shell_settings_set_int ( + prefs->shell_settings, + "cal-work-day-end-minute", end_minute); +} + +static void +notify_with_tray_toggled (GtkToggleButton *toggle, ECalendarPreferences *prefs) +{ + GConfClient *gconf; + + g_return_if_fail (toggle != NULL); + + gconf = gconf_client_get_default (); + gconf_client_set_bool (gconf, "/apps/evolution/calendar/notify/notify_with_tray", gtk_toggle_button_get_active (toggle), NULL); + g_object_unref (gconf); +} + +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) +{ + GtkWidget *widget; + icaltimezone *zone; + const gchar *display_name; + gchar *text; + + widget = e_builder_get_widget (prefs->builder, "system-tz-label"); + g_return_if_fail (GTK_IS_LABEL (widget)); + + zone = e_cal_util_get_system_timezone (); + if (zone != NULL) + display_name = gettext (icaltimezone_get_display_name (zone)); + else + display_name = "UTC"; + + text = g_strdup_printf ("(%s)", display_name); + gtk_label_set_text (GTK_LABEL (widget), text); + g_free (text); +} + +static void +setup_changes (ECalendarPreferences *prefs) +{ + g_signal_connect (G_OBJECT (prefs->day_second_zone), "clicked", G_CALLBACK (day_second_zone_clicked), prefs); + + g_signal_connect (G_OBJECT (prefs->start_of_day), "changed", G_CALLBACK (start_of_day_changed), prefs); + g_signal_connect (G_OBJECT (prefs->end_of_day), "changed", G_CALLBACK (end_of_day_changed), prefs); + + g_signal_connect (G_OBJECT (prefs->notify_with_tray), "toggled", G_CALLBACK (notify_with_tray_toggled), prefs); + g_signal_connect (G_OBJECT (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) +{ + GConfClient *gconf; + + if (e_cal_get_sources (&prefs->alarms_list, E_CAL_SOURCE_TYPE_EVENT, 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 Alarms")); + 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); + } + + gconf = gconf_client_get_default (); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->notify_with_tray), gconf_client_get_bool (gconf, "/apps/evolution/calendar/notify/notify_with_tray", NULL)); + g_object_unref (gconf); +} + +/* Shows the current config settings in the dialog. */ +static void +show_config (ECalendarPreferences *prefs) +{ + EShellSettings *shell_settings; + + shell_settings = prefs->shell_settings; + + /* Day's second zone */ + update_day_second_zone_caption (prefs); + + /* Start of Day. */ + e_date_edit_set_time_of_day ( + E_DATE_EDIT (prefs->start_of_day), + e_shell_settings_get_int ( + shell_settings, "cal-work-day-start-hour"), + e_shell_settings_get_int ( + shell_settings, "cal-work-day-start-minute")); + + /* End of Day. */ + e_date_edit_set_time_of_day ( + E_DATE_EDIT (prefs->end_of_day), + e_shell_settings_get_int ( + shell_settings, "cal-work-day-end-hour"), + e_shell_settings_get_int ( + shell_settings, "cal-work-day-end-minute")); + + /* Alarms list */ + show_alarms_config (prefs); +} + +/* plugin meta-data */ +static ECalConfigItem eccp_items[] = { + { E_CONFIG_BOOK, (gchar *) "", (gchar *) "toplevel-notebook", calendar_preferences_get_config_widget }, + { E_CONFIG_PAGE, (gchar *) "00.general", (gchar *) "general", calendar_preferences_get_config_widget }, + { E_CONFIG_SECTION_TABLE, (gchar *) "00.general/00.time", (gchar *) "time", calendar_preferences_get_config_widget }, + { E_CONFIG_SECTION_TABLE, (gchar *) "00.general/10.workWeek", (gchar *) "workWeek", calendar_preferences_get_config_widget }, + { E_CONFIG_SECTION, (gchar *) "00.general/20.alerts", (gchar *) "alerts", calendar_preferences_get_config_widget }, + { E_CONFIG_PAGE, (gchar *) "10.display", (gchar *) "display", calendar_preferences_get_config_widget }, + { E_CONFIG_SECTION, (gchar *) "10.display/00.general", (gchar *) "displayGeneral", calendar_preferences_get_config_widget }, + { E_CONFIG_SECTION, (gchar *) "10.display/10.taskList", (gchar *) "taskList", calendar_preferences_get_config_widget }, + { E_CONFIG_PAGE, (gchar *) "15.alarms", (gchar *) "alarms", calendar_preferences_get_config_widget }, + { E_CONFIG_PAGE, (gchar *) "20.freeBusy", (gchar *) "freebusy", calendar_preferences_get_config_widget }, + { E_CONFIG_SECTION, (gchar *) "20.freeBusy/00.defaultServer", (gchar *) "default-freebusy-vbox", calendar_preferences_get_config_widget }, +}; + +static void +eccp_free (EConfig *ec, GSList *items, gpointer data) +{ + g_slist_free (items); +} + +static void +calendar_preferences_construct (ECalendarPreferences *prefs, + EShell *shell) +{ + ECalConfig *ec; + ECalConfigTargetPrefs *target; + EShellSettings *shell_settings; + gboolean locale_supports_12_hour_format; + gint i; + GtkWidget *toplevel; + GtkWidget *widget; + GtkWidget *table; + GSList *l; + + shell_settings = prefs->shell_settings; + + locale_supports_12_hour_format = + calendar_config_locale_supports_12_hour_format (); + + /* Force 24 hour format for locales which don't support 12 hour format */ + if (!locale_supports_12_hour_format + && !e_shell_settings_get_boolean (shell_settings, "cal-use-24-hour-format")) + e_shell_settings_set_boolean (shell_settings, "cal-use-24-hour-format", TRUE); + + /* Make sure our custom widget classes are registered with + * GType before we load the GtkBuilder definition file. */ + E_TYPE_DATE_EDIT; + E_TYPE_TIMEZONE_ENTRY; + + prefs->builder = gtk_builder_new (); + e_load_ui_builder_definition (prefs->builder, "e-calendar-preferences.ui"); + + /** @HookPoint-ECalConfig: Calendar Preferences Page + * @Id: org.gnome.evolution.calendar.prefs + * @Type: E_CONFIG_BOOK + * @Class: org.gnome.evolution.calendar.config:1.0 + * @Target: ECalConfigTargetPrefs + * + * The mail calendar preferences page + */ + ec = e_cal_config_new (E_CONFIG_BOOK, "org.gnome.evolution.calendar.prefs"); + l = NULL; + for (i = 0; i < G_N_ELEMENTS (eccp_items); i++) + l = g_slist_prepend (l, &eccp_items[i]); + e_config_add_items ((EConfig *) ec, l, NULL, NULL, eccp_free, prefs); + + widget = e_builder_get_widget (prefs->builder, "use-system-tz-check"); + g_object_bind_property ( + shell_settings, "cal-use-system-timezone", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + g_signal_connect ( + shell_settings, "notify::cal-use-system-timezone", + G_CALLBACK (update_system_tz_widgets), prefs); + g_object_notify (G_OBJECT (shell_settings), "cal-use-system-timezone"); + + widget = e_builder_get_widget (prefs->builder, "timezone"); + g_object_bind_property ( + shell_settings, "cal-timezone", + widget, "timezone", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + g_object_bind_property ( + shell_settings, "cal-use-system-timezone", + widget, "sensitive", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE | + G_BINDING_INVERT_BOOLEAN); + + /* General tab */ + prefs->day_second_zone = e_builder_get_widget (prefs->builder, "day_second_zone"); + + widget = e_builder_get_widget (prefs->builder, "sun_button"); + g_object_bind_property ( + shell_settings, "cal-working-days-sunday", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "mon_button"); + g_object_bind_property ( + shell_settings, "cal-working-days-monday", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "tue_button"); + g_object_bind_property ( + shell_settings, "cal-working-days-tuesday", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "wed_button"); + g_object_bind_property ( + shell_settings, "cal-working-days-wednesday", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "thu_button"); + g_object_bind_property ( + shell_settings, "cal-working-days-thursday", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "fri_button"); + g_object_bind_property ( + shell_settings, "cal-working-days-friday", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "sat_button"); + g_object_bind_property ( + shell_settings, "cal-working-days-saturday", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "week_start_day"); + g_object_bind_property ( + shell_settings, "cal-week-start-day", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "start_of_day"); + prefs->start_of_day = widget; /* XXX delete this */ + if (locale_supports_12_hour_format) + g_object_bind_property ( + shell_settings, "cal-use-24-hour-format", + widget, "use-24-hour-format", + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "end_of_day"); + prefs->end_of_day = widget; /* XXX delete this */ + if (locale_supports_12_hour_format) + g_object_bind_property ( + shell_settings, "cal-use-24-hour-format", + widget, "use-24-hour-format", + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "use_12_hour"); + gtk_widget_set_sensitive (widget, locale_supports_12_hour_format); + g_object_bind_property ( + shell_settings, "cal-use-24-hour-format", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE | + G_BINDING_INVERT_BOOLEAN); + + widget = e_builder_get_widget (prefs->builder, "use_24_hour"); + gtk_widget_set_sensitive (widget, locale_supports_12_hour_format); + g_object_bind_property ( + shell_settings, "cal-use-24-hour-format", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "confirm_delete"); + g_object_bind_property ( + shell_settings, "cal-confirm-delete", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "default_reminder"); + g_object_bind_property ( + shell_settings, "cal-use-default-reminder", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "default_reminder_interval"); + g_object_bind_property ( + shell_settings, "cal-default-reminder-interval", + widget, "value", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + g_object_bind_property ( + shell_settings, "cal-use-default-reminder", + widget, "sensitive", + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "default_reminder_units"); + g_object_bind_property ( + shell_settings, "cal-default-reminder-units", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + g_object_bind_property ( + shell_settings, "cal-use-default-reminder", + widget, "sensitive", + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "ba_reminder"); + g_object_bind_property ( + shell_settings, "cal-use-ba-reminder", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "ba_reminder_interval"); + g_object_bind_property ( + shell_settings, "cal-ba-reminder-interval", + widget, "value", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + g_object_bind_property ( + shell_settings, "cal-use-ba-reminder", + widget, "sensitive", + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "ba_reminder_units"); + g_object_bind_property ( + shell_settings, "cal-ba-reminder-units", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + g_object_bind_property ( + shell_settings, "cal-use-ba-reminder", + widget, "sensitive", + G_BINDING_SYNC_CREATE); + + /* Display tab */ + widget = e_builder_get_widget (prefs->builder, "time_divisions"); + g_object_bind_property_full ( + shell_settings, "cal-time-divisions", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE, + transform_time_divisions_to_index, + transform_index_to_time_divisions, + NULL, (GDestroyNotify) NULL); + + widget = e_builder_get_widget (prefs->builder, "show_end_times"); + g_object_bind_property ( + shell_settings, "cal-show-event-end-times", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "compress_weekend"); + g_object_bind_property ( + shell_settings, "cal-compress-weekend", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "show_week_numbers"); + g_object_bind_property ( + shell_settings, "cal-show-week-numbers", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "recur_events_italic"); + g_object_bind_property ( + shell_settings, "cal-recur-events-italic", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "month_scroll_by_week"); + g_object_bind_property ( + shell_settings, "cal-month-scroll-by-week", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "tasks_due_today_color"); + g_object_bind_property_full ( + shell_settings, "cal-tasks-color-due-today", + widget, "color", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE, + e_binding_transform_string_to_color, + e_binding_transform_color_to_string, + NULL, (GDestroyNotify) NULL); + + widget = e_builder_get_widget (prefs->builder, "tasks_overdue_color"); + g_object_bind_property_full ( + shell_settings, "cal-tasks-color-overdue", + widget, "color", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE, + e_binding_transform_string_to_color, + e_binding_transform_color_to_string, + (GDestroyNotify) NULL, NULL); + + widget = e_builder_get_widget (prefs->builder, "tasks_hide_completed"); + g_object_bind_property ( + shell_settings, "cal-hide-completed-tasks", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "tasks_hide_completed_interval"); + g_object_bind_property ( + shell_settings, "cal-hide-completed-tasks-value", + widget, "value", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + g_object_bind_property ( + shell_settings, "cal-hide-completed-tasks", + widget, "sensitive", + G_BINDING_SYNC_CREATE); + + widget = e_builder_get_widget (prefs->builder, "tasks_hide_completed_units"); + g_object_bind_property ( + shell_settings, "cal-hide-completed-tasks-units", + widget, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + g_object_bind_property ( + shell_settings, "cal-hide-completed-tasks", + widget, "sensitive", + G_BINDING_SYNC_CREATE); + + /* Alarms tab */ + prefs->notify_with_tray = e_builder_get_widget (prefs->builder, "notify_with_tray"); + prefs->scrolled_window = e_builder_get_widget (prefs->builder, "calendar-source-scrolled-window"); + + /* Free/Busy tab */ + widget = e_builder_get_widget (prefs->builder, "template_url"); + g_object_bind_property ( + shell_settings, "cal-free-busy-template", + widget, "text", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + + /* date/time format */ + table = e_builder_get_widget (prefs->builder, "datetime_format_table"); + e_datetime_format_add_setup_widget (table, 0, "calendar", "table", DTFormatKindDateTime, _("Ti_me and date:")); + e_datetime_format_add_setup_widget (table, 1, "calendar", "table", DTFormatKindDate, _("_Date only:")); + + /* Hide senseless preferences when running in Express mode */ + e_shell_hide_widgets_for_express_mode (shell, prefs->builder, + "label_second_zone", + "hbox_second_zone", + "timezone", + "timezone_label", + "hbox_use_system_timezone", + "hbox_time_divisions", + "show_end_times", + "month_scroll_by_week", + NULL); + + /* HACK: GTK+ 2.18 and 2.20 has a GtkTable which includes + * row/column spacing even for empty rows/columns. + * When Evo runs in Express mode, we hide all the rows in + * the Time section of the calendar's General preferences + * page. However, due to that behavior in GTK+, we get a + * lot of extra spacing in that section. Since we know that + * in Express mode we only leave a single row visible, we'll + * make the table's row spacing equal to 0 in that case. */ + if (e_shell_get_express_mode (shell)) { + widget = e_builder_get_widget (prefs->builder, "time"); + gtk_table_set_row_spacings (GTK_TABLE (widget), 0); + } + + /* Hook up and add the toplevel widget */ + + target = e_cal_config_target_new_prefs (ec); + e_config_set_target ((EConfig *)ec, (EConfigTarget *) target); + toplevel = e_config_create_widget ((EConfig *)ec); + gtk_container_add (GTK_CONTAINER (prefs), toplevel); + + show_config (prefs); + /* FIXME: weakref? */ + setup_changes (prefs); +} + +void +e_calendar_preferences_type_register (GTypeModule *type_module) +{ + /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration + * function, so we have to wrap it with a public function in + * order to register types from a separate compilation unit. */ + e_calendar_preferences_register_type (type_module); +} + +GtkWidget * +e_calendar_preferences_new (EPreferencesWindow *window) +{ + EShell *shell; + EShellSettings *shell_settings; + ECalendarPreferences *preferences; + + shell = e_preferences_window_get_shell (window); + 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->shell_settings = g_object_ref (shell_settings); + + /* FIXME Kill this function. */ + calendar_preferences_construct (preferences, shell); + + return GTK_WIDGET (preferences); +} diff --git a/modules/calendar/e-calendar-preferences.h b/modules/calendar/e-calendar-preferences.h new file mode 100644 index 0000000000..ae96fc1b1f --- /dev/null +++ b/modules/calendar/e-calendar-preferences.h @@ -0,0 +1,89 @@ +/* + * 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 + * + * + * Authors: + * David Trowbridge + * Damon Chaplin + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef CAL_PREFERENCES_H +#define CAL_PREFERENCES_H + +#include +#include +#include +#include + +/* Standard GObject macros */ +#define E_TYPE_CALENDAR_PREFERENCES \ + (e_calendar_preferences_get_type ()) +#define E_CALENDAR_PREFERENCES(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_CALENDAR_PREFERENCES, ECalendarPreferences)) +#define E_CALENDAR_PREFERENCES_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_CALENDAR_PREFERENCES, ECalendarPreferencesClass)) +#define E_CALENDAR_IS_PREFERENCES(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_CALENDAR_PREFERENCES)) +#define E_CALENDAR_IS_PREFERENCES_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_CALENDAR_PREFERENCES)) +#define E_CALENDAR_PREFERENCES_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_CALENDAR_PREFERENCES, ECalendarPreferencesClass)) + +G_BEGIN_DECLS + +typedef struct _ECalendarPreferences ECalendarPreferences; +typedef struct _ECalendarPreferencesClass ECalendarPreferencesClass; + +struct _ECalendarPreferences { + GtkVBox parent; + + GtkBuilder *builder; + + EShellSettings *shell_settings; + + /* General tab */ + GtkWidget *day_second_zone; + GtkWidget *start_of_day; + GtkWidget *end_of_day; + GtkWidget *ba_reminder; + GtkWidget *ba_reminder_interval; + GtkWidget *ba_reminder_units; + + /* Alarms tab */ + GtkWidget *notify_with_tray; + GtkWidget *scrolled_window; + ESourceList *alarms_list; + GtkWidget *alarm_list_widget; +}; + +struct _ECalendarPreferencesClass { + GtkVBoxClass parent; +}; + +GType e_calendar_preferences_get_type (void); +void e_calendar_preferences_type_register + (GTypeModule *type_module); +GtkWidget * e_calendar_preferences_new (EPreferencesWindow *window); + +G_END_DECLS + +#endif /* CAL_PREFERENCES_H */ diff --git a/modules/calendar/e-calendar-preferences.ui b/modules/calendar/e-calendar-preferences.ui new file mode 100644 index 0000000000..7e581cf4ad --- /dev/null +++ b/modules/calendar/e-calendar-preferences.ui @@ -0,0 +1,1440 @@ + + + + + + + 9999 + 1 + 10 + + + 9999 + 1 + 10 + + + 1 + 9999 + 1 + 10 + + + + + + + + + Monday + + + Tuesday + + + Wednesday + + + Thursday + + + Friday + + + Saturday + + + Sunday + + + + + + + + + + + Minutes + + + Hours + + + Days + + + + + + + + + + + Minutes + + + Hours + + + Days + + + + + + + + + + + 60 minutes + + + 30 minutes + + + 15 minutes + + + 10 minutes + + + 05 minutes + + + + + + + + + + + Minutes + + + Hours + + + Days + + + + + True + True + + + True + 12 + 12 + + + True + 0 + Time + + + + + + False + False + 0 + + + + + True + 12 + + + True + + + False + False + 0 + + + + + True + 4 + 2 + 6 + 6 + + + True + 0 + Se_cond zone: + True + day_second_zone + + + 3 + 4 + GTK_FILL + + + + + + True + + + None + True + True + False + True + + + 0 + + + + + True + 6 + (Shown in a Day View) + + + False + False + 1 + + + + + 1 + 2 + 3 + 4 + GTK_FILL + GTK_FILL + + + + + True + + + + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + True + 0 + Time _zone: + True + timezone + + + 1 + 2 + GTK_FILL + + + + + + True + + + Use s_ystem time zone + True + True + False + True + True + + + False + 0 + + + + + True + 5 + (system/tz) + + + False + False + 1 + + + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + 0 + Time format: + + + GTK_FILL + + + + + + True + 6 + + + _12 hour (AM/PM) + True + True + False + True + True + True + + + False + False + 0 + + + + + _24 hour + True + True + False + True + True + use_12_hour + + + False + False + 1 + + + + + 1 + 2 + GTK_FILL + GTK_FILL + + + + + + + + 1 + + + + + False + 1 + + + + + True + 0 + Work Week + + + + + + False + False + 2 + + + + + True + 12 + + + True + + + False + False + 0 + + + + + True + 3 + 2 + 6 + 6 + + + True + 0 + Wee_k starts on: + True + week_start_day + + + GTK_FILL + + + + + + True + 0 + Work days: + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + _Day begins: + True + + + 2 + 3 + GTK_FILL + + + + + + True + 6 + + + _Mon + True + True + False + True + True + + + Monday + + + + + False + False + 0 + + + + + _Tue + True + True + False + True + True + + + Tuesday + + + + + False + False + 1 + + + + + _Wed + True + True + False + True + True + + + Wednesday + + + + + False + False + 2 + + + + + T_hu + True + True + False + True + True + + + Thursday + + + + + False + False + 3 + + + + + _Fri + True + True + False + True + True + + + Friday + + + + + False + False + 4 + + + + + _Sat + True + True + False + True + True + + + Saturday + + + + + False + False + 5 + + + + + S_un + True + True + False + True + True + + + Sunday + + + + + False + False + 6 + + + + + 1 + 2 + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + model1 + + + + 0 + + + + + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + 12 + + + True + False + False + + + False + False + 0 + + + + + True + 0 + Day _ends: + True + + + False + end + 2 + + + + + True + False + False + + + False + False + end + 1 + + + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + 1 + + + + + False + 3 + + + + + True + 0 + Alerts + + + + + + False + False + 4 + + + + + True + 12 + + + True + + + False + False + 0 + + + + + True + 6 + + + _Ask for confirmation when deleting items + True + True + False + True + True + + + False + False + 0 + + + + + True + 4 + + + Sh_ow a reminder + True + True + False + True + True + + + False + False + 0 + + + + + True + True + adjustment1 + 1 + + + 1 + + + + + True + model2 + + + + 0 + + + + + 2 + + + + + True + before every appointment + + + False + False + 3 + + + + + 1 + + + + + True + 4 + + + Show a _reminder + True + True + False + True + True + + + False + False + 0 + + + + + True + True + adjustment2 + 1 + + + 1 + + + + + True + model3 + + + + 0 + + + + + 2 + + + + + True + before every anniversary/birthday + + + False + False + 3 + + + + + 2 + + + + + 1 + + + + + False + 5 + + + + + + + True + General + + + False + + + + + True + 12 + 12 + + + True + 0 + General + + + + + + False + False + 0 + + + + + True + 12 + + + True + + + False + False + 0 + + + + + True + 6 + + + True + 6 + + + True + _Time divisions: + True + time_divisions + + + False + False + 0 + + + + + True + model4 + + + + 0 + + + + + 1 + + + + + 0 + + + + + _Show appointment end times in week and month view + True + True + False + True + True + + + False + False + 1 + + + + + _Compress weekends in month view + True + True + False + True + True + + + False + False + 2 + + + + + Show week _numbers + True + True + False + True + True + + + False + False + 3 + + + + + Show r_ecurring events in italic in bottom left calendar + True + True + False + True + True + + + False + False + 4 + + + + + Sc_roll Month View by a week + True + True + False + True + True + + + False + False + 5 + + + + + 1 + + + + + False + 1 + + + + + True + 0 + Task List + + + + + + False + False + 2 + + + + + True + 12 + + + True + + + False + False + 0 + + + + + True + 6 + + + True + 12 + + + True + 0 + T_asks due today: + True + tasks_due_today_color + + + False + False + 0 + + + + + True + True + True + Pick a color + #000000000000 + + + False + False + 1 + + + + + True + 0 + _Overdue tasks: + True + tasks_overdue_color + + + False + False + end + 3 + + + + + True + True + True + Pick a color + #000000000000 + + + False + False + end + 2 + + + + + False + False + 0 + + + + + True + 6 + + + _Hide completed tasks after + True + True + False + True + True + + + False + False + 0 + + + + + True + True + adjustment3 + 1 + + + 1 + + + + + True + model5 + + + + 0 + + + + + 2 + + + + + 1 + + + + + 1 + + + + + False + 3 + + + + + True + 0 + Date/Time Format + + + + + + False + False + 4 + + + + + True + 12 + + + True + + + False + False + 0 + + + + + True + 3 + + + + + + + + + + + + 1 + + + + + 5 + + + + + 1 + + + + + True + Display + + + 1 + False + + + + + True + 12 + vertical + 6 + + + True + 0 + Alarms + + + + + + False + False + 0 + + + + + True + 10 + + + Display alarms in _notification area only + True + True + False + True + True + + + + + False + 1 + + + + + True + 0 + Select the calendars for alarm notification + + + False + False + 2 + + + + + True + True + automatic + automatic + in + + + + + + 3 + + + + + 2 + + + + + True + Alarms + + + 2 + False + + + + + True + 12 + vertical + 12 + + + True + 0 + Default Free/Busy Server + + + + + + False + False + 0 + + + + + True + 12 + + + True + vertical + 6 + + + True + 6 + + + True + Template: + + + False + False + 0 + + + + + True + True + + + + 1 + + + + + 0 + + + + + True + %u and %d will be replaced by user and domain from the email address. + True + + + + + + False + False + 1 + + + + + + + False + False + 1 + + + + + 3 + + + + + True + Free/Busy + + + 3 + False + + + + + + + + + + diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c index d54c32f98e..e6658ed6cd 100644 --- a/modules/calendar/e-memo-shell-backend.c +++ b/modules/calendar/e-memo-shell-backend.c @@ -34,7 +34,6 @@ #include "shell/e-shell-window.h" #include "calendar/common/authentication.h" -#include "calendar/gui/calendar-config.h" #include "calendar/gui/comp-util.h" #include "calendar/gui/dialogs/calendar-setup.h" #include "calendar/gui/dialogs/memo-editor.h" @@ -67,8 +66,9 @@ 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? */ - EMemoShellBackendPrivate *priv; + EMemoShellBackend *memo_shell_backend; ESourceGroup *on_this_computer; + ESourceList *source_list; ESource *personal; EShell *shell; EShellSettings *shell_settings; @@ -78,20 +78,24 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend) personal = NULL; - priv = E_MEMO_SHELL_BACKEND_GET_PRIVATE (shell_backend); + memo_shell_backend = E_MEMO_SHELL_BACKEND (shell_backend); shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - if (!e_cal_get_sources (&priv->source_list, E_CAL_SOURCE_TYPE_JOURNAL, NULL)) { + if (!e_cal_get_sources ( + &memo_shell_backend->priv->source_list, + E_CAL_SOURCE_TYPE_JOURNAL, NULL)) { g_warning ("Could not get memo sources from GConf!"); return; } + source_list = memo_shell_backend->priv->source_list; + on_this_computer = e_source_list_ensure_group ( - priv->source_list, _("On This Computer"), "local:", TRUE); + source_list, _("On This Computer"), "local:", TRUE); e_source_list_ensure_group ( - priv->source_list, _("On The Web"), "webcal://", FALSE); + source_list, _("On The Web"), "webcal://", FALSE); g_return_if_fail (on_this_computer); @@ -125,7 +129,8 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend) primary = e_shell_settings_get_string ( shell_settings, "cal-primary-memo-list"); - selected = calendar_config_get_memos_selected (); + selected = e_memo_shell_backend_get_selected_memo_lists ( + memo_shell_backend); if (primary == NULL && selected == NULL) { const gchar *uid; @@ -135,7 +140,8 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend) e_shell_settings_set_string ( shell_settings, "cal-primary-memo-list", uid); - calendar_config_set_memos_selected (selected); + e_memo_shell_backend_set_selected_memo_lists ( + memo_shell_backend, selected); } g_slist_foreach (selected, (GFunc) g_free, NULL); @@ -149,7 +155,7 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend) g_object_unref (on_this_computer); if (save_list) - e_source_list_sync (priv->source_list, NULL); + e_source_list_sync (source_list, NULL); } static void @@ -593,3 +599,38 @@ e_memo_shell_backend_get_source_list (EMemoShellBackend *memo_shell_backend) return memo_shell_backend->priv->source_list; } + +GSList * +e_memo_shell_backend_get_selected_memo_lists (EMemoShellBackend *memo_shell_backend) +{ + GConfClient *client; + GSList *selected_memo_lists; + const gchar *key; + + g_return_val_if_fail ( + E_IS_MEMO_SHELL_BACKEND (memo_shell_backend), NULL); + + client = gconf_client_get_default (); + key = "/apps/evolution/calendar/memos/selected_memos"; + selected_memo_lists = gconf_client_get_list ( + client, key, GCONF_VALUE_STRING, NULL); + g_object_unref (client); + + return selected_memo_lists; +} + +void +e_memo_shell_backend_set_selected_memo_lists (EMemoShellBackend *memo_shell_backend, + GSList *selected_memo_lists) +{ + GConfClient *client; + const gchar *key; + + g_return_if_fail (E_IS_MEMO_SHELL_BACKEND (memo_shell_backend)); + + client = gconf_client_get_default (); + key = "/apps/evolution/calendar/memos/selected_memos"; + gconf_client_set_list ( + client, key, GCONF_VALUE_STRING, selected_memo_lists, NULL); + g_object_unref (client); +} diff --git a/modules/calendar/e-memo-shell-backend.h b/modules/calendar/e-memo-shell-backend.h index 37fe41a784..8a005c4385 100644 --- a/modules/calendar/e-memo-shell-backend.h +++ b/modules/calendar/e-memo-shell-backend.h @@ -64,6 +64,11 @@ void e_memo_shell_backend_register_type (GTypeModule *type_module); ESourceList * e_memo_shell_backend_get_source_list (EMemoShellBackend *memo_shell_backend); +GSList * e_memo_shell_backend_get_selected_memo_lists + (EMemoShellBackend *memo_shell_backend); +void e_memo_shell_backend_set_selected_memo_lists + (EMemoShellBackend *memo_shell_backend, + GSList *selected_memo_lists); G_END_DECLS diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c index 476460761c..a9d299e221 100644 --- a/modules/calendar/e-memo-shell-content.c +++ b/modules/calendar/e-memo-shell-content.c @@ -209,7 +209,9 @@ memo_shell_content_cursor_change_cb (EMemoShellContent *memo_shell_content, e_cal_component_set_icalcomponent ( comp, icalcomponent_new_clone (comp_data->icalcomp)); e_cal_component_preview_display ( - memo_preview, comp_data->client, comp); + memo_preview, comp_data->client, comp, + e_cal_model_get_timezone (memo_model), + e_cal_model_get_use_24_hour_format (memo_model)); e_cal_component_get_uid (comp, &uid); g_free (memo_shell_content->priv->current_uid); @@ -415,13 +417,11 @@ memo_shell_content_constructed (GObject *object) EMemoShellContentPrivate *priv; EShell *shell; EShellView *shell_view; - EShellSettings *shell_settings; EShellBackend *shell_backend; EShellContent *shell_content; EShellTaskbar *shell_taskbar; EShellWindow *shell_window; GalViewInstance *view_instance; - icaltimezone *timezone; GtkTargetList *target_list; GtkTargetEntry *targets; GtkWidget *container; @@ -438,15 +438,10 @@ memo_shell_content_constructed (GObject *object) shell_backend = e_shell_view_get_shell_backend (shell_view); shell_taskbar = e_shell_view_get_shell_taskbar (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - shell = e_shell_backend_get_shell (shell_backend); - shell_settings = e_shell_get_shell_settings (shell); priv->memo_model = e_cal_model_memos_new (); - timezone = e_shell_settings_get_pointer ( - shell_settings, "cal-timezone"); - /* Build content widgets. */ container = GTK_WIDGET (object); @@ -482,8 +477,6 @@ memo_shell_content_constructed (GObject *object) container = priv->paned; widget = e_cal_component_preview_new (); - e_cal_component_preview_set_default_timezone ( - E_CAL_COMPONENT_PREVIEW (widget), timezone); e_shell_configure_web_view (shell, E_WEB_VIEW (widget)); gtk_widget_show (widget); diff --git a/modules/calendar/e-memo-shell-migrate.c b/modules/calendar/e-memo-shell-migrate.c index d85824767f..e4b5697c38 100644 --- a/modules/calendar/e-memo-shell-migrate.c +++ b/modules/calendar/e-memo-shell-migrate.c @@ -30,20 +30,21 @@ #include #include -#include "calendar/gui/calendar-config.h" #include "calendar/gui/calendar-config-keys.h" #include "shell/e-shell.h" +#include "e-memo-shell-backend.h" + #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) + ESourceList *source_list, + ESourceGroup **on_this_computer, + ESourceGroup **on_the_web, + ESource **personal_source) { EShell *shell; EShellSettings *shell_settings; @@ -106,6 +107,7 @@ create_memo_sources (EShellBackend *shell_backend, } if (!*personal_source) { + GSList *selected; gchar *primary_memo_list; /* Create the default Person memo list */ @@ -115,18 +117,26 @@ create_memo_sources (EShellBackend *shell_backend, primary_memo_list = e_shell_settings_get_string ( shell_settings, "cal-primary-memo-list"); - if (!primary_memo_list && !calendar_config_get_memos_selected ()) { - GSList selected; + selected = e_memo_shell_backend_get_selected_memo_lists ( + E_MEMO_SHELL_BACKEND (shell_backend)); + + if (primary_memo_list == NULL && selected == NULL) { + GSList link; e_shell_settings_set_string ( shell_settings, "cal-primary-memo-list", e_source_peek_uid (source)); - selected.data = (gpointer)e_source_peek_uid (source); - selected.next = NULL; - calendar_config_set_memos_selected (&selected); + link.data = (gpointer)e_source_peek_uid (source); + link.next = NULL; + + e_memo_shell_backend_set_selected_memo_lists ( + E_MEMO_SHELL_BACKEND (shell_backend), &link); } + g_slist_foreach (selected, (GFunc) g_free, NULL); + g_slist_free (selected); + e_source_set_color_spec (source, "#BECEDD"); *personal_source = source; } @@ -212,10 +222,10 @@ add_gw_esource (ESourceList *source_list, const gchar *group_name, const gchar gboolean e_memo_shell_backend_migrate (EShellBackend *shell_backend, - gint major, - gint minor, - gint revision, - GError **error) + gint major, + gint minor, + gint revision, + GError **error) { ESourceGroup *on_this_computer = NULL; ESourceGroup *on_the_web = NULL; diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index 04292af2fd..5bc5dfd132 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -28,7 +28,6 @@ #include "e-util/e-alert-dialog.h" #include "e-util/e-util.h" #include "calendar/common/authentication.h" -#include "calendar/gui/calendar-config.h" #include "calendar/gui/e-memo-list-selector.h" #include "calendar/gui/misc.h" @@ -376,12 +375,19 @@ 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) { @@ -391,7 +397,8 @@ memo_shell_sidebar_selection_changed_cb (EMemoShellSidebar *memo_shell_sidebar, g_object_unref (source); } - calendar_config_set_memos_selected (list); + e_memo_shell_backend_set_selected_memo_lists ( + E_MEMO_SHELL_BACKEND (shell_backend), list); g_slist_free (list); } @@ -458,19 +465,19 @@ memo_shell_sidebar_restore_state_cb (EShellWindow *shell_window, g_object_ref (source_list), (GDestroyNotify) g_object_unref); - list = calendar_config_get_memos_selected (); + list = e_memo_shell_backend_get_selected_memo_lists ( + E_MEMO_SHELL_BACKEND (shell_backend)); + for (iter = list; iter != NULL; iter = iter->next) { - gchar *uid; + const gchar *uid = iter->data; - uid = iter->data; source = e_source_list_peek_source_by_uid (source_list, uid); - g_free (uid); - if (source == NULL) - continue; - - e_source_selector_select_source (selector, source); + 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. */ diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c index bebeba1110..a55eab1c10 100644 --- a/modules/calendar/e-memo-shell-view-actions.c +++ b/modules/calendar/e-memo-shell-view-actions.c @@ -447,12 +447,13 @@ action_memo_print_cb (GtkAction *action, EMemoTable *memo_table; ECalModelComponent *comp_data; ECalComponent *comp; + ECalModel *model; icalcomponent *clone; - GtkPrintOperationAction print_action; GSList *list; 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); list = e_memo_table_get_selected (memo_table); g_return_if_fail (list != NULL); @@ -462,9 +463,14 @@ action_memo_print_cb (GtkAction *action, /* XXX We only print the first selected memo. */ comp = e_cal_component_new (); clone = icalcomponent_new_clone (comp_data->icalcomp); - print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG; e_cal_component_set_icalcomponent (comp, clone); - print_comp (comp, comp_data->client, print_action); + + print_comp ( + comp, comp_data->client, + e_cal_model_get_timezone (model), + e_cal_model_get_use_24_hour_format (model), + GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG); + g_object_unref (comp); } diff --git a/modules/calendar/e-memo-shell-view-private.c b/modules/calendar/e-memo-shell-view-private.c index 4fe6a259e2..0880750828 100644 --- a/modules/calendar/e-memo-shell-view-private.c +++ b/modules/calendar/e-memo-shell-view-private.c @@ -461,7 +461,5 @@ e_memo_shell_view_update_timezone (EMemoShellView *memo_shell_view) e_cal_set_default_timezone (client, timezone, NULL); } - e_cal_component_preview_set_default_timezone (memo_preview, timezone); - g_list_free (clients); } diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c index be085afa8d..6982d48c4a 100644 --- a/modules/calendar/e-task-shell-backend.c +++ b/modules/calendar/e-task-shell-backend.c @@ -34,7 +34,6 @@ #include "shell/e-shell-window.h" #include "calendar/common/authentication.h" -#include "calendar/gui/calendar-config.h" #include "calendar/gui/comp-util.h" #include "calendar/gui/dialogs/calendar-setup.h" #include "calendar/gui/dialogs/task-editor.h" @@ -66,8 +65,9 @@ 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? */ - ETaskShellBackendPrivate *priv; + ETaskShellBackend *task_shell_backend; ESourceGroup *on_this_computer; + ESourceList *source_list; ESource *personal; EShell *shell; EShellSettings *shell_settings; @@ -78,20 +78,24 @@ task_shell_backend_ensure_sources (EShellBackend *shell_backend) on_this_computer = NULL; personal = NULL; - priv = E_TASK_SHELL_BACKEND_GET_PRIVATE (shell_backend); + task_shell_backend = E_TASK_SHELL_BACKEND (shell_backend); shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - if (!e_cal_get_sources (&priv->source_list, E_CAL_SOURCE_TYPE_TODO, NULL)) { + if (!e_cal_get_sources ( + &task_shell_backend->priv->source_list, + E_CAL_SOURCE_TYPE_TODO, NULL)) { g_warning ("Could not get task sources from GConf!"); return; } + source_list = task_shell_backend->priv->source_list; + on_this_computer = e_source_list_ensure_group ( - priv->source_list, _("On This Computer"), "local:", TRUE); + source_list, _("On This Computer"), "local:", TRUE); e_source_list_ensure_group ( - priv->source_list, _("On The Web"), "webcal://", FALSE); + source_list, _("On The Web"), "webcal://", FALSE); g_return_if_fail (on_this_computer); @@ -125,7 +129,8 @@ task_shell_backend_ensure_sources (EShellBackend *shell_backend) primary = e_shell_settings_get_string ( shell_settings, "cal-primary-task-list"); - selected = calendar_config_get_tasks_selected (); + selected = e_task_shell_backend_get_selected_task_lists ( + task_shell_backend); if (primary == NULL && selected == NULL) { const gchar *uid; @@ -135,7 +140,8 @@ task_shell_backend_ensure_sources (EShellBackend *shell_backend) e_shell_settings_set_string ( shell_settings, "cal-primary-task-list", uid); - calendar_config_set_tasks_selected (selected); + e_task_shell_backend_set_selected_task_lists ( + task_shell_backend, selected); } g_slist_foreach (selected, (GFunc) g_free, NULL); @@ -149,7 +155,7 @@ task_shell_backend_ensure_sources (EShellBackend *shell_backend) g_object_unref (on_this_computer); if (save_list) - e_source_list_sync (priv->source_list, NULL); + e_source_list_sync (source_list, NULL); } static void @@ -598,3 +604,38 @@ e_task_shell_backend_get_source_list (ETaskShellBackend *task_shell_backend) return task_shell_backend->priv->source_list; } + +GSList * +e_task_shell_backend_get_selected_task_lists (ETaskShellBackend *task_shell_backend) +{ + GConfClient *client; + GSList *selected_task_lists; + const gchar *key; + + g_return_val_if_fail ( + E_IS_TASK_SHELL_BACKEND (task_shell_backend), NULL); + + client = gconf_client_get_default (); + key = "/apps/evolution/calendar/tasks/selected_tasks"; + selected_task_lists = gconf_client_get_list ( + client, key, GCONF_VALUE_STRING, NULL); + g_object_unref (client); + + return selected_task_lists; +} + +void +e_task_shell_backend_set_selected_task_lists (ETaskShellBackend *task_shell_backend, + GSList *selected_task_lists) +{ + GConfClient *client; + const gchar *key; + + g_return_if_fail (E_IS_TASK_SHELL_BACKEND (task_shell_backend)); + + client = gconf_client_get_default (); + key = "/apps/evolution/calendar/tasks/selected_tasks"; + gconf_client_set_list ( + client, key, GCONF_VALUE_STRING, selected_task_lists, NULL); + g_object_unref (client); +} diff --git a/modules/calendar/e-task-shell-backend.h b/modules/calendar/e-task-shell-backend.h index 63b157ad85..ba56e91dd9 100644 --- a/modules/calendar/e-task-shell-backend.h +++ b/modules/calendar/e-task-shell-backend.h @@ -64,6 +64,11 @@ void e_task_shell_backend_register_type (GTypeModule *type_module); ESourceList * e_task_shell_backend_get_source_list (ETaskShellBackend *task_shell_backend); +GSList * e_task_shell_backend_get_selected_task_lists + (ETaskShellBackend *task_shell_backend); +void e_task_shell_backend_set_selected_task_lists + (ETaskShellBackend *task_shell_backend, + GSList *selected_task_lists); G_END_DECLS diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c index f0af66fa93..9cc924642c 100644 --- a/modules/calendar/e-task-shell-content.c +++ b/modules/calendar/e-task-shell-content.c @@ -209,7 +209,9 @@ task_shell_content_cursor_change_cb (ETaskShellContent *task_shell_content, e_cal_component_set_icalcomponent ( comp, icalcomponent_new_clone (comp_data->icalcomp)); e_cal_component_preview_display ( - task_preview, comp_data->client, comp); + task_preview, comp_data->client, comp, + e_cal_model_get_timezone (task_model), + e_cal_model_get_use_24_hour_format (task_model)); e_cal_component_get_uid (comp, &uid); g_free (task_shell_content->priv->current_uid); @@ -412,13 +414,11 @@ task_shell_content_constructed (GObject *object) { ETaskShellContentPrivate *priv; EShell *shell; - EShellSettings *shell_settings; EShellContent *shell_content; EShellTaskbar *shell_taskbar; EShellWindow *shell_window; EShellView *shell_view; GalViewInstance *view_instance; - icaltimezone *timezone; GtkTargetList *target_list; GtkTargetEntry *targets; GtkWidget *container; @@ -435,13 +435,9 @@ task_shell_content_constructed (GObject *object) 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); - shell_settings = e_shell_get_shell_settings (shell); priv->task_model = e_cal_model_tasks_new (); - timezone = e_shell_settings_get_pointer ( - shell_settings, "cal-timezone"); - /* Build content widgets. */ container = GTK_WIDGET (object); @@ -477,8 +473,6 @@ task_shell_content_constructed (GObject *object) container = priv->paned; widget = e_cal_component_preview_new (); - e_cal_component_preview_set_default_timezone ( - E_CAL_COMPONENT_PREVIEW (widget), timezone); e_shell_configure_web_view (shell, E_WEB_VIEW (widget)); gtk_widget_show (widget); diff --git a/modules/calendar/e-task-shell-migrate.c b/modules/calendar/e-task-shell-migrate.c index 91da8f45ef..fbfedb0617 100644 --- a/modules/calendar/e-task-shell-migrate.c +++ b/modules/calendar/e-task-shell-migrate.c @@ -38,19 +38,20 @@ #include #include "e-util/e-util-private.h" -#include "calendar/gui/calendar-config.h" #include "calendar/gui/calendar-config-keys.h" #include "shell/e-shell.h" +#include "e-task-shell-backend.h" + #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) + ESourceList *source_list, + ESourceGroup **on_this_computer, + ESourceGroup **on_the_web, + ESource **personal_source) { EShell *shell; EShellSettings *shell_settings; @@ -115,6 +116,7 @@ create_task_sources (EShellBackend *shell_backend, } if (!*personal_source) { + GSList *selected; gchar *primary_task_list; /* Create the default Person task list */ @@ -124,18 +126,26 @@ create_task_sources (EShellBackend *shell_backend, primary_task_list = e_shell_settings_get_string ( shell_settings, "cal-primary-task-list"); - if (!primary_task_list && !calendar_config_get_tasks_selected ()) { - GSList selected; + selected = e_task_shell_backend_get_selected_task_lists ( + E_TASK_SHELL_BACKEND (shell_backend)); + + if (primary_task_list == NULL && selected == NULL) { + GSList link; e_shell_settings_set_string ( shell_settings, "cal-primary-task-list", e_source_peek_uid (source)); - selected.data = (gpointer)e_source_peek_uid (source); - selected.next = NULL; - calendar_config_set_tasks_selected (&selected); + link.data = (gpointer)e_source_peek_uid (source); + link.next = NULL; + + e_task_shell_backend_set_selected_task_lists ( + E_TASK_SHELL_BACKEND (shell_backend), &link); } + g_slist_foreach (selected, (GFunc) g_free, NULL); + g_slist_free (selected); + e_source_set_color_spec (source, "#BECEDD"); *personal_source = source; } @@ -154,10 +164,10 @@ create_task_sources (EShellBackend *shell_backend, gboolean e_task_shell_backend_migrate (EShellBackend *shell_backend, - gint major, - gint minor, - gint micro, - GError **error) + gint major, + gint minor, + gint micro, + GError **error) { ESourceGroup *on_this_computer = NULL; ESourceGroup *on_the_web = NULL; diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index 580cee286f..52887faf03 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -28,7 +28,6 @@ #include "e-util/e-alert-dialog.h" #include "e-util/e-util.h" #include "calendar/common/authentication.h" -#include "calendar/gui/calendar-config.h" #include "calendar/gui/e-task-list-selector.h" #include "calendar/gui/misc.h" @@ -376,12 +375,19 @@ 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) { @@ -391,7 +397,8 @@ task_shell_sidebar_selection_changed_cb (ETaskShellSidebar *task_shell_sidebar, g_object_unref (source); } - calendar_config_set_tasks_selected (list); + e_task_shell_backend_set_selected_task_lists ( + E_TASK_SHELL_BACKEND (shell_backend), list); g_slist_free (list); } @@ -458,19 +465,19 @@ task_shell_sidebar_restore_state_cb (EShellWindow *shell_window, g_object_ref (source_list), (GDestroyNotify) g_object_unref); - list = calendar_config_get_tasks_selected (); + list = e_task_shell_backend_get_selected_task_lists ( + E_TASK_SHELL_BACKEND (shell_backend)); + for (iter = list; iter != NULL; iter = iter->next) { - gchar *uid; + const gchar *uid = iter->data; - uid = iter->data; source = e_source_list_peek_source_by_uid (source_list, uid); - g_free (uid); - if (source == NULL) - continue; - - e_source_selector_select_source (selector, source); + 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. */ diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c index 8ab9082ee0..d3531244d9 100644 --- a/modules/calendar/e-task-shell-view-actions.c +++ b/modules/calendar/e-task-shell-view-actions.c @@ -513,13 +513,14 @@ action_task_print_cb (GtkAction *action, ETaskShellContent *task_shell_content; ECalModelComponent *comp_data; ECalComponent *comp; + ECalModel *model; ETaskTable *task_table; icalcomponent *clone; - GtkPrintOperationAction print_action; GSList *list; 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); list = e_task_table_get_selected (task_table); g_return_if_fail (list != NULL); @@ -529,9 +530,14 @@ action_task_print_cb (GtkAction *action, /* XXX We only print the first selected task. */ comp = e_cal_component_new (); clone = icalcomponent_new_clone (comp_data->icalcomp); - print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG; e_cal_component_set_icalcomponent (comp, clone); - print_comp (comp, comp_data->client, print_action); + + print_comp ( + comp, comp_data->client, + e_cal_model_get_timezone (model), + e_cal_model_get_use_24_hour_format (model), + GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG); + g_object_unref (comp); } diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c index 9f833e9542..83b0e9408f 100644 --- a/modules/calendar/e-task-shell-view-private.c +++ b/modules/calendar/e-task-shell-view-private.c @@ -612,7 +612,5 @@ e_task_shell_view_update_timezone (ETaskShellView *task_shell_view) e_cal_set_default_timezone (client, timezone, NULL); } - e_cal_component_preview_set_default_timezone (task_preview, timezone); - g_list_free (clients); } diff --git a/modules/calendar/evolution-module-calendar.c b/modules/calendar/evolution-module-calendar.c index b54f6439a3..af972cfc7b 100644 --- a/modules/calendar/evolution-module-calendar.c +++ b/modules/calendar/evolution-module-calendar.c @@ -40,12 +40,15 @@ #include "e-task-shell-view.h" #include "e-cal-config-calendar-item.h" +#include "e-cal-config-comp-editor.h" #include "e-cal-config-date-edit.h" #include "e-cal-config-meeting-store.h" #include "e-cal-config-meeting-time-selector.h" #include "e-cal-config-model.h" #include "e-cal-config-view.h" +#include "e-calendar-preferences.h" + /* Module Entry Points */ void e_module_load (GTypeModule *type_module); void e_module_unload (GTypeModule *type_module); @@ -76,11 +79,14 @@ e_module_load (GTypeModule *type_module) e_task_shell_view_register_type (type_module); e_cal_config_calendar_item_register_type (type_module); + e_cal_config_comp_editor_register_type (type_module); e_cal_config_date_edit_register_type (type_module); e_cal_config_meeting_store_register_type (type_module); e_cal_config_meeting_time_selector_register_type (type_module); e_cal_config_model_register_type (type_module); e_cal_config_view_register_type (type_module); + + e_calendar_preferences_type_register (type_module); } G_MODULE_EXPORT void -- cgit v1.2.3 From a891b81cfb3430a764dab0d5644114c4dab22297 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 7 Nov 2010 21:13:03 -0500 Subject: Coding style and whitespace cleanup. --- modules/calendar/e-cal-shell-backend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index fa4c2db0de..4988ab4617 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -474,7 +474,7 @@ static time_t utc_to_user_zone (time_t utc_time, icaltimezone *zone) { - if (!zone || (int) utc_time == -1) + if (!zone || (gint) utc_time == -1) return utc_time; return icaltime_as_timet ( -- cgit v1.2.3 From 51d17b48e4ba74c17cc0ac30f9e956cdb380be9b Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 24 Nov 2010 13:37:15 +0100 Subject: Bug #632962 - Duplicate "On this computer" sources after update --- modules/calendar/e-cal-shell-migrate.c | 24 +++++++++++------------- modules/calendar/e-memo-shell-migrate.c | 26 +++++++++++++------------- modules/calendar/e-task-shell-migrate.c | 26 +++++++++++++------------- 3 files changed, 37 insertions(+), 39 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-migrate.c b/modules/calendar/e-cal-shell-migrate.c index d25228d98f..3ef6e554ad 100644 --- a/modules/calendar/e-cal-shell-migrate.c +++ b/modules/calendar/e-cal-shell-migrate.c @@ -43,6 +43,7 @@ #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://" @@ -80,8 +81,6 @@ create_calendar_sources (EShellBackend *shell_backend, EShellSettings *shell_settings; GSList *groups; ESourceGroup *group; - gchar *base_uri, *base_uri_proto; - const gchar *base_dir; *on_this_computer = NULL; *on_the_web = NULL; @@ -91,15 +90,14 @@ create_calendar_sources (EShellBackend *shell_backend, shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - base_dir = e_shell_backend_get_data_dir (shell_backend); - base_uri = g_build_filename (base_dir, "local", NULL); - - base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL); - groups = e_source_list_peek_groups (source_list); if (groups) { /* groups are already there, we need to search for things... */ GSList *g; + gchar *base_dir, *base_uri; + + base_dir = g_build_filename (e_shell_backend_get_data_dir (shell_backend), "local", NULL); + base_uri = g_filename_to_uri (base_dir, NULL, NULL); for (g = groups; g; g = g->next) { @@ -109,9 +107,9 @@ create_calendar_sources (EShellBackend *shell_backend, 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, base_uri_proto); + e_source_group_set_base_uri (group, LOCAL_BASE_URI); - if (!*on_this_computer && !strcmp (base_uri_proto, + if (!*on_this_computer && !strcmp (LOCAL_BASE_URI, e_source_group_peek_base_uri (group))) *on_this_computer = g_object_ref (group); @@ -123,6 +121,9 @@ create_calendar_sources (EShellBackend *shell_backend, e_source_group_peek_base_uri (group))) *contacts = g_object_ref (group); } + + g_free (base_dir); + g_free (base_uri); } if (*on_this_computer) { @@ -144,7 +145,7 @@ create_calendar_sources (EShellBackend *shell_backend, } } else { /* create the local source group */ - group = e_source_group_new (_("On This Computer"), base_uri_proto); + group = e_source_group_new (_("On This Computer"), LOCAL_BASE_URI); e_source_list_add_group (source_list, group, -1); *on_this_computer = group; @@ -199,9 +200,6 @@ create_calendar_sources (EShellBackend *shell_backend, *contacts = group; } - - g_free (base_uri_proto); - g_free (base_uri); } gboolean diff --git a/modules/calendar/e-memo-shell-migrate.c b/modules/calendar/e-memo-shell-migrate.c index e4b5697c38..c64b8b086f 100644 --- a/modules/calendar/e-memo-shell-migrate.c +++ b/modules/calendar/e-memo-shell-migrate.c @@ -35,6 +35,7 @@ #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://" @@ -50,8 +51,6 @@ create_memo_sources (EShellBackend *shell_backend, EShellSettings *shell_settings; GSList *groups; ESourceGroup *group; - gchar *base_uri, *base_uri_proto; - const gchar *base_dir; *on_this_computer = NULL; *on_the_web = NULL; @@ -60,25 +59,29 @@ create_memo_sources (EShellBackend *shell_backend, shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - base_dir = e_shell_backend_get_data_dir (shell_backend); - base_uri = g_build_filename (base_dir, "local", NULL); - - base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL); - groups = e_source_list_peek_groups (source_list); if (groups) { /* groups are already there, we need to search for things... */ GSList *g; + gchar *base_dir, *base_uri; - for (g = groups; g; g = g->next) { + base_dir = g_build_filename (e_shell_backend_get_data_dir (shell_backend), "local", NULL); + base_uri = g_filename_to_uri (base_dir, NULL, NULL); + for (g = groups; g; g = g->next) { group = E_SOURCE_GROUP (g->data); - if (!*on_this_computer && !strcmp (base_uri_proto, e_source_group_peek_base_uri (group))) + 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) { @@ -100,7 +103,7 @@ create_memo_sources (EShellBackend *shell_backend, } } else { /* create the local source group */ - group = e_source_group_new (_("On This Computer"), base_uri_proto); + group = e_source_group_new (_("On This Computer"), LOCAL_BASE_URI); e_source_list_add_group (source_list, group, -1); *on_this_computer = group; @@ -148,9 +151,6 @@ create_memo_sources (EShellBackend *shell_backend, *on_the_web = group; } - - g_free (base_uri_proto); - g_free (base_uri); } static gboolean diff --git a/modules/calendar/e-task-shell-migrate.c b/modules/calendar/e-task-shell-migrate.c index fbfedb0617..f57ac7e75a 100644 --- a/modules/calendar/e-task-shell-migrate.c +++ b/modules/calendar/e-task-shell-migrate.c @@ -43,6 +43,7 @@ #include "e-task-shell-backend.h" +#define LOCAL_BASE_URI "local:" #define WEBCAL_BASE_URI "webcal://" #define PERSONAL_RELATIVE_URI "system" @@ -57,8 +58,6 @@ create_task_sources (EShellBackend *shell_backend, EShellSettings *shell_settings; GSList *groups; ESourceGroup *group; - gchar *base_uri, *base_uri_proto; - const gchar *base_dir; *on_this_computer = NULL; *on_the_web = NULL; @@ -67,27 +66,31 @@ create_task_sources (EShellBackend *shell_backend, shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - base_dir = e_shell_backend_get_data_dir (shell_backend); - base_uri = g_build_filename (base_dir, "local", NULL); - - base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL); - groups = e_source_list_peek_groups (source_list); if (groups) { /* groups are already there, we need to search for things... */ GSList *g; + gchar *base_dir, *base_uri; - for (g = groups; g; g = g->next) { + base_dir = g_build_filename (e_shell_backend_get_data_dir (shell_backend), "local", NULL); + base_uri = g_filename_to_uri (base_dir, NULL, NULL); + for (g = groups; g; g = g->next) { group = E_SOURCE_GROUP (g->data); - if (!*on_this_computer && !strcmp (base_uri_proto, + 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) { @@ -109,7 +112,7 @@ create_task_sources (EShellBackend *shell_backend, } } else { /* create the local source group */ - group = e_source_group_new (_("On This Computer"), base_uri_proto); + group = e_source_group_new (_("On This Computer"), LOCAL_BASE_URI); e_source_list_add_group (source_list, group, -1); *on_this_computer = group; @@ -157,9 +160,6 @@ create_task_sources (EShellBackend *shell_backend, *on_the_web = group; } - - g_free (base_uri_proto); - g_free (base_uri); } gboolean -- cgit v1.2.3 From ab0430a3f37b01f104d8a4556fdb527c0bd92116 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 3 Dec 2010 21:33:01 +0100 Subject: Show calendar backend errors in an alert sink --- modules/calendar/e-cal-shell-sidebar.c | 27 ++---------------- modules/calendar/e-memo-shell-sidebar.c | 49 ++++++++++++++------------------- modules/calendar/e-task-shell-sidebar.c | 49 ++++++++++++++------------------- 3 files changed, 45 insertions(+), 80 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index 1e291989cf..81ab858186 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -111,7 +111,6 @@ cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar, ECal *client) { EShellView *shell_view; - EShellWindow *shell_window; EShellSidebar *shell_sidebar; GHashTable *client_table; ESource *source; @@ -121,7 +120,6 @@ cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar, 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); source = e_cal_get_source (client); uid = e_source_peek_uid (source); @@ -131,8 +129,7 @@ cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar, g_hash_table_remove (client_table, uid); cal_shell_sidebar_emit_status_message (cal_shell_sidebar, NULL); - e_alert_run_dialog_for_args ( - GTK_WINDOW (shell_window), + e_alert_submit (E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)), "calendar:calendar-crashed", NULL); g_object_unref (source); @@ -144,36 +141,18 @@ cal_shell_sidebar_backend_error_cb (ECalShellSidebar *cal_shell_sidebar, ECal *client) { EShellView *shell_view; - EShellWindow *shell_window; EShellSidebar *shell_sidebar; ESourceGroup *source_group; ESource *source; - GtkWidget *dialog; 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); source = e_cal_get_source (client); source_group = e_source_peek_group (source); - /* Translators: This string is displayed in a message dialog when - * our connection to the calendar service detects an - * out-of-band error. The first string is a name of - * group in which calendar for the source of error is - * defined and the second string is name of calendar - * and the third string is the error message. */ - dialog = gtk_message_dialog_new ( - GTK_WINDOW (shell_window), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - _("Error on %s: %s\n%s"), - e_source_group_peek_name (source_group), - e_source_peek_name (source), message); - - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - + e_alert_submit (E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)), + "calendar:backend-error", e_source_group_peek_name (source_group), e_source_peek_name (source), message, NULL); } static void diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index 5bc5dfd132..14d4b36e11 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -101,12 +101,24 @@ memo_shell_sidebar_emit_status_message (EMemoShellSidebar *memo_shell_sidebar, g_signal_emit (memo_shell_sidebar, signal_id, 0, status_message, -1.0); } +static EAlertSink * +get_alert_sink (EShellView *shell_view) +{ + EShellWindow *shell_window; + + shell_window = e_shell_view_get_shell_window (shell_view); + + if (g_strcmp0 (e_shell_window_get_active_view (shell_window), "calendar") == 0) + shell_view = e_shell_window_peek_shell_view (shell_window, "calendar"); + + return E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)); +} + static void memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar, ECal *client) { EShellView *shell_view; - EShellWindow *shell_window; EShellSidebar *shell_sidebar; GHashTable *client_table; ESource *source; @@ -116,7 +128,6 @@ memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar, shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_window = e_shell_view_get_shell_window (shell_view); source = e_cal_get_source (client); uid = e_source_peek_uid (source); @@ -126,8 +137,7 @@ memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar, g_hash_table_remove (client_table, uid); memo_shell_sidebar_emit_status_message (memo_shell_sidebar, NULL); - e_alert_run_dialog_for_args ( - GTK_WINDOW (shell_window), + e_alert_submit (get_alert_sink (shell_view), "calendar:memos-crashed", NULL); g_object_unref (source); @@ -139,35 +149,18 @@ memo_shell_sidebar_backend_error_cb (EMemoShellSidebar *memo_shell_sidebar, ECal *client) { EShellView *shell_view; - EShellWindow *shell_window; EShellSidebar *shell_sidebar; - GtkWidget *dialog; - const gchar *uri; - gchar *uri_no_passwd; + ESourceGroup *source_group; + ESource *source; 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); - uri = e_cal_get_uri (client); - uri_no_passwd = get_uri_without_password (uri); - - /* Translators: This string is displayed in a message dialog when - * our connection to the calendar service detects an - * out-of-band error. The first string is a URI for - * the source of the error, the second string is the - * error message. */ - dialog = gtk_message_dialog_new ( - GTK_WINDOW (shell_window), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - _("Error on %s\n%s"), - uri_no_passwd, message); - - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - - g_free (uri_no_passwd); + source = e_cal_get_source (client); + source_group = e_source_peek_group (source); + + e_alert_submit (get_alert_sink (shell_view), + "calendar:backend-error", e_source_group_peek_name (source_group), e_source_peek_name (source), message, NULL); } static void diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index 52887faf03..99bc67f8ad 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -101,12 +101,24 @@ task_shell_sidebar_emit_status_message (ETaskShellSidebar *task_shell_sidebar, g_signal_emit (task_shell_sidebar, signal_id, 0, status_message, -1.0); } +static EAlertSink * +get_alert_sink (EShellView *shell_view) +{ + EShellWindow *shell_window; + + shell_window = e_shell_view_get_shell_window (shell_view); + + if (g_strcmp0 (e_shell_window_get_active_view (shell_window), "calendar") == 0) + shell_view = e_shell_window_peek_shell_view (shell_window, "calendar"); + + return E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)); +} + static void task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar, ECal *client) { EShellView *shell_view; - EShellWindow *shell_window; EShellSidebar *shell_sidebar; GHashTable *client_table; ESource *source; @@ -116,7 +128,6 @@ task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar, shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_window = e_shell_view_get_shell_window (shell_view); source = e_cal_get_source (client); uid = e_source_peek_uid (source); @@ -126,8 +137,7 @@ task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar, g_hash_table_remove (client_table, uid); task_shell_sidebar_emit_status_message (task_shell_sidebar, NULL); - e_alert_run_dialog_for_args ( - GTK_WINDOW (shell_window), + e_alert_submit (get_alert_sink (shell_view), "calendar:tasks-crashed", NULL); g_object_unref (source); @@ -139,35 +149,18 @@ task_shell_sidebar_backend_error_cb (ETaskShellSidebar *task_shell_sidebar, ECal *client) { EShellView *shell_view; - EShellWindow *shell_window; EShellSidebar *shell_sidebar; - GtkWidget *dialog; - const gchar *uri; - gchar *uri_no_passwd; + ESourceGroup *source_group; + ESource *source; 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); - uri = e_cal_get_uri (client); - uri_no_passwd = get_uri_without_password (uri); - - /* Translators: This string is displayed in a message dialog when - * our connection to the calendar service detects an - * out-of-band error. The first string is a URI for - * the source of the error, the second string is the - * error message. */ - dialog = gtk_message_dialog_new ( - GTK_WINDOW (shell_window), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - _("Error on %s\n%s"), - uri_no_passwd, message); - - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - - g_free (uri_no_passwd); + source = e_cal_get_source (client); + source_group = e_source_peek_group (source); + + e_alert_submit (get_alert_sink (shell_view), + "calendar:backend-error", e_source_group_peek_name (source_group), e_source_peek_name (source), message, NULL); } static void -- cgit v1.2.3 From 22b2d26d048476d4909bfcf348ce6567e0d006a0 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 6 Dec 2010 14:23:20 +0100 Subject: Free/busy meeting view doesn't work due to non-working extension --- modules/calendar/e-cal-config-calendar-item.c | 7 +++++++ modules/calendar/e-cal-config-comp-editor.c | 7 +++++++ modules/calendar/e-cal-config-date-edit.c | 7 +++++++ modules/calendar/e-cal-config-meeting-store.c | 7 +++++++ modules/calendar/e-cal-config-meeting-time-selector.c | 7 +++++++ modules/calendar/e-cal-config-model.c | 7 +++++++ modules/calendar/e-cal-config-view.c | 7 +++++++ modules/calendar/e-cal-shell-backend.c | 3 +++ modules/calendar/e-memo-shell-backend.c | 3 +++ modules/calendar/e-task-shell-backend.c | 3 +++ 10 files changed, 58 insertions(+) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-config-calendar-item.c b/modules/calendar/e-cal-config-calendar-item.c index 45d1797714..f2116e63cf 100644 --- a/modules/calendar/e-cal-config-calendar-item.c +++ b/modules/calendar/e-cal-config-calendar-item.c @@ -22,6 +22,8 @@ #include #include +static gpointer parent_class; + static void cal_config_calendar_item_constructed (GObject *object) { @@ -45,6 +47,9 @@ cal_config_calendar_item_constructed (GObject *object) shell_settings, "cal-week-start-day", extensible, "week-start-day", G_BINDING_SYNC_CREATE); + + if (G_OBJECT_CLASS (parent_class)->constructed) + G_OBJECT_CLASS (parent_class)->constructed (object); } static void @@ -52,6 +57,8 @@ cal_config_calendar_item_class_init (EExtensionClass *class) { GObjectClass *object_class; + parent_class = g_type_class_peek_parent (class); + object_class = G_OBJECT_CLASS (class); object_class->constructed = cal_config_calendar_item_constructed; diff --git a/modules/calendar/e-cal-config-comp-editor.c b/modules/calendar/e-cal-config-comp-editor.c index 327bcd4518..ae8753de74 100644 --- a/modules/calendar/e-cal-config-comp-editor.c +++ b/modules/calendar/e-cal-config-comp-editor.c @@ -22,6 +22,8 @@ #include #include +static gpointer parent_class; + static void cal_config_comp_editor_constructed (GObject *object) { @@ -65,6 +67,9 @@ cal_config_comp_editor_constructed (GObject *object) shell_settings, "cal-work-day-start-minute", extensible, "work-day-start-minute", G_BINDING_SYNC_CREATE); + + if (G_OBJECT_CLASS (parent_class)->constructed) + G_OBJECT_CLASS (parent_class)->constructed (object); } static void @@ -72,6 +77,8 @@ cal_config_comp_editor_class_init (EExtensionClass *class) { GObjectClass *object_class; + parent_class = g_type_class_peek_parent (class); + object_class = G_OBJECT_CLASS (class); object_class->constructed = cal_config_comp_editor_constructed; diff --git a/modules/calendar/e-cal-config-date-edit.c b/modules/calendar/e-cal-config-date-edit.c index 594dee7f94..c26db3e2d6 100644 --- a/modules/calendar/e-cal-config-date-edit.c +++ b/modules/calendar/e-cal-config-date-edit.c @@ -22,6 +22,8 @@ #include #include +static gpointer parent_class; + static void cal_config_date_edit_constructed (GObject *object) { @@ -45,6 +47,9 @@ cal_config_date_edit_constructed (GObject *object) shell_settings, "cal-week-start-day", extensible, "week-start-day", G_BINDING_SYNC_CREATE); + + if (G_OBJECT_CLASS (parent_class)->constructed) + G_OBJECT_CLASS (parent_class)->constructed (object); } static void @@ -52,6 +57,8 @@ cal_config_date_edit_class_init (EExtensionClass *class) { GObjectClass *object_class; + parent_class = g_type_class_peek_parent (class); + object_class = G_OBJECT_CLASS (class); object_class->constructed = cal_config_date_edit_constructed; diff --git a/modules/calendar/e-cal-config-meeting-store.c b/modules/calendar/e-cal-config-meeting-store.c index f9babc53bf..1e4dc460b9 100644 --- a/modules/calendar/e-cal-config-meeting-store.c +++ b/modules/calendar/e-cal-config-meeting-store.c @@ -22,6 +22,8 @@ #include #include +static gpointer parent_class; + static void cal_config_meeting_store_constructed (GObject *object) { @@ -60,6 +62,9 @@ cal_config_meeting_store_constructed (GObject *object) shell_settings, "cal-week-start-day", extensible, "week-start-day", G_BINDING_SYNC_CREATE); + + if (G_OBJECT_CLASS (parent_class)->constructed) + G_OBJECT_CLASS (parent_class)->constructed (object); } static void @@ -67,6 +72,8 @@ cal_config_meeting_store_class_init (EExtensionClass *class) { GObjectClass *object_class; + parent_class = g_type_class_peek_parent (class); + object_class = G_OBJECT_CLASS (class); object_class->constructed = cal_config_meeting_store_constructed; diff --git a/modules/calendar/e-cal-config-meeting-time-selector.c b/modules/calendar/e-cal-config-meeting-time-selector.c index c4ae93e0ae..280645d4b9 100644 --- a/modules/calendar/e-cal-config-meeting-time-selector.c +++ b/modules/calendar/e-cal-config-meeting-time-selector.c @@ -22,6 +22,8 @@ #include #include +static gpointer parent_class; + static void cal_config_meeting_time_selector_constructed (GObject *object) { @@ -50,6 +52,9 @@ cal_config_meeting_time_selector_constructed (GObject *object) shell_settings, "cal-week-start-day", extensible, "week-start-day", G_BINDING_SYNC_CREATE); + + if (G_OBJECT_CLASS (parent_class)->constructed) + G_OBJECT_CLASS (parent_class)->constructed (object); } static void @@ -57,6 +62,8 @@ cal_config_meeting_time_selector_class_init (EExtensionClass *class) { GObjectClass *object_class; + parent_class = g_type_class_peek_parent (class); + object_class = G_OBJECT_CLASS (class); object_class->constructed = cal_config_meeting_time_selector_constructed; diff --git a/modules/calendar/e-cal-config-model.c b/modules/calendar/e-cal-config-model.c index 9dd5ee9b8d..5455123c4c 100644 --- a/modules/calendar/e-cal-config-model.c +++ b/modules/calendar/e-cal-config-model.c @@ -23,6 +23,8 @@ #include #include +static gpointer parent_class; + static void cal_config_model_constructed (GObject *object) { @@ -113,6 +115,9 @@ cal_config_model_constructed (GObject *object) extensible, "color-overdue", G_BINDING_SYNC_CREATE); } + + if (G_OBJECT_CLASS (parent_class)->constructed) + G_OBJECT_CLASS (parent_class)->constructed (object); } static void @@ -120,6 +125,8 @@ cal_config_model_class_init (EExtensionClass *class) { GObjectClass *object_class; + parent_class = g_type_class_peek_parent (class); + object_class = G_OBJECT_CLASS (class); object_class->constructed = cal_config_model_constructed; diff --git a/modules/calendar/e-cal-config-view.c b/modules/calendar/e-cal-config-view.c index e2f769c501..898a1d2be2 100644 --- a/modules/calendar/e-cal-config-view.c +++ b/modules/calendar/e-cal-config-view.c @@ -23,6 +23,8 @@ #include #include +static gpointer parent_class; + static void cal_config_view_constructed (GObject *object) { @@ -87,6 +89,9 @@ cal_config_view_constructed (GObject *object) extensible, "show-event-end-times", G_BINDING_SYNC_CREATE); } + + if (G_OBJECT_CLASS (parent_class)->constructed) + G_OBJECT_CLASS (parent_class)->constructed (object); } static void @@ -94,6 +99,8 @@ cal_config_view_class_init (EExtensionClass *class) { GObjectClass *object_class; + parent_class = g_type_class_peek_parent (class); + object_class = G_OBJECT_CLASS (class); object_class->constructed = cal_config_view_constructed; diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 4988ab4617..960b6c6132 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -754,6 +754,9 @@ cal_shell_backend_constructed (GObject *object) _("Calendar and Tasks"), e_calendar_preferences_new, 600); + + if (G_OBJECT_CLASS (parent_class)->constructed) + G_OBJECT_CLASS (parent_class)->constructed (object); } static void diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c index e6658ed6cd..5ce48a60b3 100644 --- a/modules/calendar/e-memo-shell-backend.c +++ b/modules/calendar/e-memo-shell-backend.c @@ -520,6 +520,9 @@ memo_shell_backend_constructed (GObject *object) shell, "window-created", G_CALLBACK (memo_shell_backend_window_created_cb), shell_backend); + + if (G_OBJECT_CLASS (parent_class)->constructed) + G_OBJECT_CLASS (parent_class)->constructed (object); } static void diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c index 6982d48c4a..8bb3f47a66 100644 --- a/modules/calendar/e-task-shell-backend.c +++ b/modules/calendar/e-task-shell-backend.c @@ -525,6 +525,9 @@ task_shell_backend_constructed (GObject *object) shell, "window-created", G_CALLBACK (task_shell_backend_window_created_cb), shell_backend); + + if (G_OBJECT_CLASS (parent_class)->constructed) + G_OBJECT_CLASS (parent_class)->constructed (object); } static void -- cgit v1.2.3 From 0efc5f6217100ce0b35404137629642346b2d51a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 6 Dec 2010 17:17:44 +0100 Subject: Bug #627536 - Open meeting as meeting, not as appointment, in week view --- modules/calendar/e-cal-shell-view-actions.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c index 7b9d88fc73..3417875803 100644 --- a/modules/calendar/e-cal-shell-view-actions.c +++ b/modules/calendar/e-cal-shell-view-actions.c @@ -1216,8 +1216,7 @@ edit_event_as (ECalShellView *cal_shell_view, gboolean as_meeting) } } - e_calendar_view_edit_appointment ( - calendar_view, client, icalcomp, as_meeting); + e_calendar_view_edit_appointment (calendar_view, client, icalcomp, as_meeting ? EDIT_EVENT_FORCE_MEETING : EDIT_EVENT_FORCE_APPOINTMENT); if (!as_meeting && icalcomp) { icalcomponent_free (icalcomp); -- cgit v1.2.3 From a6bce7b74b99cd8ade8280ca52fb968438e6bf78 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 14 Dec 2010 17:44:16 +0100 Subject: Show common addressbook and calendar errors in an alert sink --- modules/calendar/e-cal-shell-sidebar.c | 13 +++---------- modules/calendar/e-memo-shell-sidebar.c | 13 +++---------- modules/calendar/e-task-shell-sidebar.c | 13 +++---------- 3 files changed, 9 insertions(+), 30 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index 81ab858186..45bb5a37fb 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -161,13 +161,11 @@ cal_shell_sidebar_client_opened_cb (ECalShellSidebar *cal_shell_sidebar, ECal *client) { EShellView *shell_view; - EShellWindow *shell_window; EShellSidebar *shell_sidebar; const gchar *message; 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); if (g_error_matches (error, E_CALENDAR_ERROR, E_CALENDAR_STATUS_AUTHENTICATION_FAILED) || @@ -188,16 +186,14 @@ cal_shell_sidebar_client_opened_cb (ECalShellSidebar *cal_shell_sidebar, return; case E_CALENDAR_STATUS_REPOSITORY_OFFLINE: - e_alert_run_dialog_for_args ( - GTK_WINDOW (shell_window), + e_alert_submit (E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)), "calendar:prompt-no-contents-offline-calendar", NULL); /* fall through */ default: if (error->code != E_CALENDAR_STATUS_REPOSITORY_OFFLINE) { - e_alert_run_dialog_for_args ( - GTK_WINDOW (shell_window), + e_alert_submit (E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)), "calendar:failed-open-calendar", error->message, NULL); } @@ -226,7 +222,6 @@ cal_shell_sidebar_default_loaded_cb (ESource *source, EShellSidebar *shell_sidebar) { ECalShellSidebarPrivate *priv; - EShellWindow *shell_window; EShellView *shell_view; ECal *client; GError *error = NULL; @@ -234,7 +229,6 @@ cal_shell_sidebar_default_loaded_cb (ESource *source, priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_window = e_shell_view_get_shell_window (shell_view); client = e_load_cal_source_finish (source, result, &error); @@ -243,8 +237,7 @@ cal_shell_sidebar_default_loaded_cb (ESource *source, goto exit; } else if (error != NULL) { - e_alert_run_dialog_for_args ( - GTK_WINDOW (shell_window), + e_alert_submit (E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)), "calendar:failed-open-calendar", error->message, NULL); g_error_free (error); diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index 14d4b36e11..c22cff35dc 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -169,13 +169,11 @@ memo_shell_sidebar_client_opened_cb (EMemoShellSidebar *memo_shell_sidebar, ECal *client) { EShellView *shell_view; - EShellWindow *shell_window; EShellSidebar *shell_sidebar; const gchar *message; shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_window = e_shell_view_get_shell_window (shell_view); if (g_error_matches (error, E_CALENDAR_ERROR, E_CALENDAR_STATUS_AUTHENTICATION_FAILED) || @@ -196,16 +194,14 @@ memo_shell_sidebar_client_opened_cb (EMemoShellSidebar *memo_shell_sidebar, return; case E_CALENDAR_STATUS_REPOSITORY_OFFLINE: - e_alert_run_dialog_for_args ( - GTK_WINDOW (shell_window), + e_alert_submit (get_alert_sink (shell_view), "calendar:prompt-no-contents-offline-memos", NULL); /* fall through */ default: if (error->code != E_CALENDAR_STATUS_REPOSITORY_OFFLINE) { - e_alert_run_dialog_for_args ( - GTK_WINDOW (shell_window), + e_alert_submit (get_alert_sink (shell_view), "calendar:failed-open-memos", error->message, NULL); } @@ -234,7 +230,6 @@ memo_shell_sidebar_default_loaded_cb (ESource *source, EShellSidebar *shell_sidebar) { EMemoShellSidebarPrivate *priv; - EShellWindow *shell_window; EShellView *shell_view; ECal *client; GError *error = NULL; @@ -242,7 +237,6 @@ memo_shell_sidebar_default_loaded_cb (ESource *source, priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_window = e_shell_view_get_shell_window (shell_view); client = e_load_cal_source_finish (source, result, &error); @@ -251,8 +245,7 @@ memo_shell_sidebar_default_loaded_cb (ESource *source, goto exit; } else if (error != NULL) { - e_alert_run_dialog_for_args ( - GTK_WINDOW (shell_window), + e_alert_submit (get_alert_sink (shell_view), "calendar:failed-open-memos", error->message, NULL); g_error_free (error); diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index 99bc67f8ad..a688da41cd 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -169,13 +169,11 @@ task_shell_sidebar_client_opened_cb (ETaskShellSidebar *task_shell_sidebar, ECal *client) { EShellView *shell_view; - EShellWindow *shell_window; EShellSidebar *shell_sidebar; const gchar *message; shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_window = e_shell_view_get_shell_window (shell_view); if (g_error_matches (error, E_CALENDAR_ERROR, E_CALENDAR_STATUS_AUTHENTICATION_FAILED) || @@ -196,16 +194,14 @@ task_shell_sidebar_client_opened_cb (ETaskShellSidebar *task_shell_sidebar, return; case E_CALENDAR_STATUS_REPOSITORY_OFFLINE: - e_alert_run_dialog_for_args ( - GTK_WINDOW (shell_window), + e_alert_submit (get_alert_sink (shell_view), "calendar:prompt-no-contents-offline-tasks", NULL); /* fall through */ default: if (error->code != E_CALENDAR_STATUS_REPOSITORY_OFFLINE) { - e_alert_run_dialog_for_args ( - GTK_WINDOW (shell_window), + e_alert_submit (get_alert_sink (shell_view), "calendar:failed-open-tasks", error->message, NULL); } @@ -234,7 +230,6 @@ task_shell_sidebar_default_loaded_cb (ESource *source, EShellSidebar *shell_sidebar) { ETaskShellSidebarPrivate *priv; - EShellWindow *shell_window; EShellView *shell_view; ECal *client; GError *error = NULL; @@ -242,7 +237,6 @@ task_shell_sidebar_default_loaded_cb (ESource *source, priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_window = e_shell_view_get_shell_window (shell_view); client = e_load_cal_source_finish (source, result, &error); @@ -251,8 +245,7 @@ task_shell_sidebar_default_loaded_cb (ESource *source, goto exit; } else if (error != NULL) { - e_alert_run_dialog_for_args ( - GTK_WINDOW (shell_window), + e_alert_submit (get_alert_sink (shell_view), "calendar:failed-open-tasks", error->message, NULL); g_error_free (error); -- cgit v1.2.3 From 2878a355805ec60f521ea8816a738a0ae0a75893 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 18 Jan 2011 17:50:55 -0500 Subject: Use e_source_selector_get_source_by_path(). Allows Evolution to not have to know the ESource column number in ESourceSelector tree models. Backported from "account-mgmt" branch. --- modules/calendar/e-cal-shell-sidebar.c | 9 +-------- modules/calendar/e-memo-shell-sidebar.c | 9 +-------- modules/calendar/e-task-shell-sidebar.c | 9 +-------- 3 files changed, 3 insertions(+), 24 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index 45bb5a37fb..1af16b3b8e 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -325,15 +325,8 @@ cal_shell_sidebar_row_changed_cb (ECalShellSidebar *cal_shell_sidebar, ESourceSelector *selector; ESource *source; - /* XXX ESourceSelector's underlying tree store has only one - * column: ESource objects. While we're not supposed to - * know this, listening for "row-changed" signals from - * the model is easier to deal with than the selector's - * "selection-changed" signal, which doesn't tell you - * _which_ row changed. */ - selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar); - gtk_tree_model_get (tree_model, tree_iter, 0, &source, -1); + source = e_source_selector_get_source_by_path (selector, tree_path); /* XXX This signal gets emitted a lot while the model is being * rebuilt, during which time we won't get a valid ESource. diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index c22cff35dc..31304948f9 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -333,15 +333,8 @@ memo_shell_sidebar_row_changed_cb (EMemoShellSidebar *memo_shell_sidebar, ESourceSelector *selector; ESource *source; - /* XXX ESourceSelector's underlying tree store has only one - * column: ESource objects. While we're not supposed to - * know this, listening for "row-changed" signals from - * the model is easier to deal with than the selector's - * "selection-changed" signal, which doesn't tell you - * _which_ row changed. */ - selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar); - gtk_tree_model_get (tree_model, tree_iter, 0, &source, -1); + source = e_source_selector_get_source_by_path (selector, tree_path); /* XXX This signal gets emitted a lot while the model is being * rebuilt, during which time we won't get a valid ESource. diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index a688da41cd..e00159026c 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -333,15 +333,8 @@ task_shell_sidebar_row_changed_cb (ETaskShellSidebar *task_shell_sidebar, ESourceSelector *selector; ESource *source; - /* XXX ESourceSelector's underlying tree store has only one - * column: ESource objects. While we're not supposed to - * know this, listening for "row-changed" signals from - * the model is easier to deal with than the selector's - * "selection-changed" signal, which doesn't tell you - * _which_ row changed. */ - selector = e_task_shell_sidebar_get_selector (task_shell_sidebar); - gtk_tree_model_get (tree_model, tree_iter, 0, &source, -1); + source = e_source_selector_get_source_by_path (selector, tree_path); /* XXX This signal gets emitted a lot while the model is being * rebuilt, during which time we won't get a valid ESource. -- cgit v1.2.3 From 753c60fc67a0a56a5f119c14ffa54ea9af95c208 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 9 Nov 2010 08:48:33 -0500 Subject: Drop backward-compatibility cruft. --- modules/calendar/e-cal-attachment-handler.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c index a9f5237ecc..8fea91ffeb 100644 --- a/modules/calendar/e-cal-attachment-handler.c +++ b/modules/calendar/e-cal-attachment-handler.c @@ -264,9 +264,6 @@ attachment_handler_run_dialog (GtkWindow *parent, GTK_DIALOG (dialog), widget, GTK_RESPONSE_OK); gtk_widget_show (widget); -#if !GTK_CHECK_VERSION(2,90,7) - g_object_set (dialog, "has-separator", FALSE, NULL); -#endif gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 400); container = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); -- cgit v1.2.3 From 21ab8044dab93b6367463593628ec42befda4f67 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 29 Jan 2011 10:50:53 -0500 Subject: Coding style and whitespace cleanup. --- modules/calendar/e-cal-shell-migrate.c | 4 ++- modules/calendar/e-cal-shell-sidebar.c | 27 ++++++++++++++----- modules/calendar/e-cal-shell-view-actions.c | 4 ++- modules/calendar/e-memo-shell-sidebar.c | 40 +++++++++++++++-------------- modules/calendar/e-task-shell-migrate.c | 4 ++- modules/calendar/e-task-shell-sidebar.c | 40 +++++++++++++++-------------- 6 files changed, 72 insertions(+), 47 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-migrate.c b/modules/calendar/e-cal-shell-migrate.c index 3ef6e554ad..710aa8f2a2 100644 --- a/modules/calendar/e-cal-shell-migrate.c +++ b/modules/calendar/e-cal-shell-migrate.c @@ -94,9 +94,11 @@ create_calendar_sources (EShellBackend *shell_backend, if (groups) { /* groups are already there, we need to search for things... */ GSList *g; + const gchar *data_dir; gchar *base_dir, *base_uri; - base_dir = g_build_filename (e_shell_backend_get_data_dir (shell_backend), "local", NULL); + 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) { diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index 1af16b3b8e..f61e0a60a7 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -111,6 +111,7 @@ cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar, ECal *client) { EShellView *shell_view; + EShellContent *shell_content; EShellSidebar *shell_sidebar; GHashTable *client_table; ESource *source; @@ -120,6 +121,7 @@ cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar, shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); source = e_cal_get_source (client); uid = e_source_peek_uid (source); @@ -129,7 +131,8 @@ cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar, g_hash_table_remove (client_table, uid); cal_shell_sidebar_emit_status_message (cal_shell_sidebar, NULL); - e_alert_submit (E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)), + e_alert_submit ( + E_ALERT_SINK (shell_content), "calendar:calendar-crashed", NULL); g_object_unref (source); @@ -141,18 +144,23 @@ cal_shell_sidebar_backend_error_cb (ECalShellSidebar *cal_shell_sidebar, ECal *client) { EShellView *shell_view; + EShellContent *shell_content; EShellSidebar *shell_sidebar; ESourceGroup *source_group; ESource *source; shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); source = e_cal_get_source (client); source_group = e_source_peek_group (source); - e_alert_submit (E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)), - "calendar:backend-error", e_source_group_peek_name (source_group), e_source_peek_name (source), message, NULL); + e_alert_submit ( + E_ALERT_SINK (shell_content), + "calendar:backend-error", + e_source_group_peek_name (source_group), + e_source_peek_name (source), message, NULL); } static void @@ -161,11 +169,13 @@ cal_shell_sidebar_client_opened_cb (ECalShellSidebar *cal_shell_sidebar, ECal *client) { EShellView *shell_view; + EShellContent *shell_content; EShellSidebar *shell_sidebar; const gchar *message; shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); if (g_error_matches (error, E_CALENDAR_ERROR, E_CALENDAR_STATUS_AUTHENTICATION_FAILED) || @@ -186,14 +196,16 @@ cal_shell_sidebar_client_opened_cb (ECalShellSidebar *cal_shell_sidebar, return; case E_CALENDAR_STATUS_REPOSITORY_OFFLINE: - e_alert_submit (E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)), + e_alert_submit ( + E_ALERT_SINK (shell_content), "calendar:prompt-no-contents-offline-calendar", NULL); /* fall through */ default: if (error->code != E_CALENDAR_STATUS_REPOSITORY_OFFLINE) { - e_alert_submit (E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)), + e_alert_submit ( + E_ALERT_SINK (shell_content), "calendar:failed-open-calendar", error->message, NULL); } @@ -222,6 +234,7 @@ cal_shell_sidebar_default_loaded_cb (ESource *source, EShellSidebar *shell_sidebar) { ECalShellSidebarPrivate *priv; + EShellContent *shell_content; EShellView *shell_view; ECal *client; GError *error = NULL; @@ -229,6 +242,7 @@ cal_shell_sidebar_default_loaded_cb (ESource *source, priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); client = e_load_cal_source_finish (source, result, &error); @@ -237,7 +251,8 @@ cal_shell_sidebar_default_loaded_cb (ESource *source, goto exit; } else if (error != NULL) { - e_alert_submit (E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)), + e_alert_submit ( + E_ALERT_SINK (shell_content), "calendar:failed-open-calendar", error->message, NULL); g_error_free (error); diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c index 3417875803..90abf79c3c 100644 --- a/modules/calendar/e-cal-shell-view-actions.c +++ b/modules/calendar/e-cal-shell-view-actions.c @@ -1216,7 +1216,9 @@ edit_event_as (ECalShellView *cal_shell_view, gboolean as_meeting) } } - e_calendar_view_edit_appointment (calendar_view, client, icalcomp, as_meeting ? EDIT_EVENT_FORCE_MEETING : EDIT_EVENT_FORCE_APPOINTMENT); + e_calendar_view_edit_appointment ( + calendar_view, client, icalcomp, as_meeting ? + EDIT_EVENT_FORCE_MEETING : EDIT_EVENT_FORCE_APPOINTMENT); if (!as_meeting && icalcomp) { icalcomponent_free (icalcomp); diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index 31304948f9..b7e52a9095 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -101,24 +101,12 @@ memo_shell_sidebar_emit_status_message (EMemoShellSidebar *memo_shell_sidebar, g_signal_emit (memo_shell_sidebar, signal_id, 0, status_message, -1.0); } -static EAlertSink * -get_alert_sink (EShellView *shell_view) -{ - EShellWindow *shell_window; - - shell_window = e_shell_view_get_shell_window (shell_view); - - if (g_strcmp0 (e_shell_window_get_active_view (shell_window), "calendar") == 0) - shell_view = e_shell_window_peek_shell_view (shell_window, "calendar"); - - return E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)); -} - static void memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar, ECal *client) { EShellView *shell_view; + EShellContent *shell_content; EShellSidebar *shell_sidebar; GHashTable *client_table; ESource *source; @@ -128,6 +116,7 @@ memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar, shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); source = e_cal_get_source (client); uid = e_source_peek_uid (source); @@ -137,7 +126,8 @@ memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar, g_hash_table_remove (client_table, uid); memo_shell_sidebar_emit_status_message (memo_shell_sidebar, NULL); - e_alert_submit (get_alert_sink (shell_view), + e_alert_submit ( + E_ALERT_SINK (shell_content), "calendar:memos-crashed", NULL); g_object_unref (source); @@ -149,18 +139,23 @@ memo_shell_sidebar_backend_error_cb (EMemoShellSidebar *memo_shell_sidebar, ECal *client) { EShellView *shell_view; + EShellContent *shell_content; EShellSidebar *shell_sidebar; ESourceGroup *source_group; ESource *source; shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); source = e_cal_get_source (client); source_group = e_source_peek_group (source); - e_alert_submit (get_alert_sink (shell_view), - "calendar:backend-error", e_source_group_peek_name (source_group), e_source_peek_name (source), message, NULL); + e_alert_submit ( + E_ALERT_SINK (shell_content), + "calendar:backend-error", + e_source_group_peek_name (source_group), + e_source_peek_name (source), message, NULL); } static void @@ -169,11 +164,13 @@ memo_shell_sidebar_client_opened_cb (EMemoShellSidebar *memo_shell_sidebar, ECal *client) { EShellView *shell_view; + EShellContent *shell_content; EShellSidebar *shell_sidebar; const gchar *message; shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); if (g_error_matches (error, E_CALENDAR_ERROR, E_CALENDAR_STATUS_AUTHENTICATION_FAILED) || @@ -194,14 +191,16 @@ memo_shell_sidebar_client_opened_cb (EMemoShellSidebar *memo_shell_sidebar, return; case E_CALENDAR_STATUS_REPOSITORY_OFFLINE: - e_alert_submit (get_alert_sink (shell_view), + e_alert_submit ( + E_ALERT_SINK (shell_content), "calendar:prompt-no-contents-offline-memos", NULL); /* fall through */ default: if (error->code != E_CALENDAR_STATUS_REPOSITORY_OFFLINE) { - e_alert_submit (get_alert_sink (shell_view), + e_alert_submit ( + E_ALERT_SINK (shell_content), "calendar:failed-open-memos", error->message, NULL); } @@ -230,6 +229,7 @@ memo_shell_sidebar_default_loaded_cb (ESource *source, EShellSidebar *shell_sidebar) { EMemoShellSidebarPrivate *priv; + EShellContent *shell_content; EShellView *shell_view; ECal *client; GError *error = NULL; @@ -237,6 +237,7 @@ memo_shell_sidebar_default_loaded_cb (ESource *source, priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); client = e_load_cal_source_finish (source, result, &error); @@ -245,7 +246,8 @@ memo_shell_sidebar_default_loaded_cb (ESource *source, goto exit; } else if (error != NULL) { - e_alert_submit (get_alert_sink (shell_view), + e_alert_submit ( + E_ALERT_SINK (shell_content), "calendar:failed-open-memos", error->message, NULL); g_error_free (error); diff --git a/modules/calendar/e-task-shell-migrate.c b/modules/calendar/e-task-shell-migrate.c index f57ac7e75a..d7daafc91d 100644 --- a/modules/calendar/e-task-shell-migrate.c +++ b/modules/calendar/e-task-shell-migrate.c @@ -70,9 +70,11 @@ create_task_sources (EShellBackend *shell_backend, if (groups) { /* groups are already there, we need to search for things... */ GSList *g; + const gchar *data_dir; gchar *base_dir, *base_uri; - base_dir = g_build_filename (e_shell_backend_get_data_dir (shell_backend), "local", NULL); + 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) { diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index e00159026c..62973d2efc 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -101,24 +101,12 @@ task_shell_sidebar_emit_status_message (ETaskShellSidebar *task_shell_sidebar, g_signal_emit (task_shell_sidebar, signal_id, 0, status_message, -1.0); } -static EAlertSink * -get_alert_sink (EShellView *shell_view) -{ - EShellWindow *shell_window; - - shell_window = e_shell_view_get_shell_window (shell_view); - - if (g_strcmp0 (e_shell_window_get_active_view (shell_window), "calendar") == 0) - shell_view = e_shell_window_peek_shell_view (shell_window, "calendar"); - - return E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)); -} - static void task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar, ECal *client) { EShellView *shell_view; + EShellContent *shell_content; EShellSidebar *shell_sidebar; GHashTable *client_table; ESource *source; @@ -128,6 +116,7 @@ task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar, shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); source = e_cal_get_source (client); uid = e_source_peek_uid (source); @@ -137,7 +126,8 @@ task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar, g_hash_table_remove (client_table, uid); task_shell_sidebar_emit_status_message (task_shell_sidebar, NULL); - e_alert_submit (get_alert_sink (shell_view), + e_alert_submit ( + E_ALERT_SINK (shell_content), "calendar:tasks-crashed", NULL); g_object_unref (source); @@ -149,18 +139,23 @@ task_shell_sidebar_backend_error_cb (ETaskShellSidebar *task_shell_sidebar, ECal *client) { EShellView *shell_view; + EShellContent *shell_content; EShellSidebar *shell_sidebar; ESourceGroup *source_group; ESource *source; shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); source = e_cal_get_source (client); source_group = e_source_peek_group (source); - e_alert_submit (get_alert_sink (shell_view), - "calendar:backend-error", e_source_group_peek_name (source_group), e_source_peek_name (source), message, NULL); + e_alert_submit ( + E_ALERT_SINK (shell_content), + "calendar:backend-error", + e_source_group_peek_name (source_group), + e_source_peek_name (source), message, NULL); } static void @@ -169,11 +164,13 @@ task_shell_sidebar_client_opened_cb (ETaskShellSidebar *task_shell_sidebar, ECal *client) { EShellView *shell_view; + EShellContent *shell_content; EShellSidebar *shell_sidebar; const gchar *message; shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); if (g_error_matches (error, E_CALENDAR_ERROR, E_CALENDAR_STATUS_AUTHENTICATION_FAILED) || @@ -194,14 +191,16 @@ task_shell_sidebar_client_opened_cb (ETaskShellSidebar *task_shell_sidebar, return; case E_CALENDAR_STATUS_REPOSITORY_OFFLINE: - e_alert_submit (get_alert_sink (shell_view), + e_alert_submit ( + E_ALERT_SINK (shell_content), "calendar:prompt-no-contents-offline-tasks", NULL); /* fall through */ default: if (error->code != E_CALENDAR_STATUS_REPOSITORY_OFFLINE) { - e_alert_submit (get_alert_sink (shell_view), + e_alert_submit ( + E_ALERT_SINK (shell_content), "calendar:failed-open-tasks", error->message, NULL); } @@ -230,6 +229,7 @@ task_shell_sidebar_default_loaded_cb (ESource *source, EShellSidebar *shell_sidebar) { ETaskShellSidebarPrivate *priv; + EShellContent *shell_content; EShellView *shell_view; ECal *client; GError *error = NULL; @@ -237,6 +237,7 @@ task_shell_sidebar_default_loaded_cb (ESource *source, priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); client = e_load_cal_source_finish (source, result, &error); @@ -245,7 +246,8 @@ task_shell_sidebar_default_loaded_cb (ESource *source, goto exit; } else if (error != NULL) { - e_alert_submit (get_alert_sink (shell_view), + e_alert_submit ( + E_ALERT_SINK (shell_content), "calendar:failed-open-tasks", error->message, NULL); g_error_free (error); -- cgit v1.2.3 From 0109aa3a92b484ebb85c6481e5a8e39819b1f011 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 30 Jan 2011 11:32:55 -0500 Subject: More whitespace cleanup. --- modules/calendar/e-cal-shell-view-private.c | 4 ++-- modules/calendar/e-memo-shell-migrate.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c index 571f35506a..0a20ea2000 100644 --- a/modules/calendar/e-cal-shell-view-private.c +++ b/modules/calendar/e-cal-shell-view-private.c @@ -427,7 +427,7 @@ system_timezone_monitor_changed (GFileMonitor *handle, GFileMonitorEvent event, gpointer user_data) { - ECalShellView *view = E_CAL_SHELL_VIEW (user_data); + ECalShellView *view = E_CAL_SHELL_VIEW (user_data); ECalShellViewPrivate *priv = view->priv; ECalShellContent *cal_shell_content; icaltimezone *timezone = NULL, *current_zone = NULL; @@ -649,7 +649,7 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view) init_timezone_monitors (cal_shell_view); e_cal_shell_view_actions_init (cal_shell_view); e_cal_shell_view_update_sidebar (cal_shell_view); - e_cal_shell_view_update_search_filter (cal_shell_view); + e_cal_shell_view_update_search_filter (cal_shell_view); e_cal_shell_view_update_timezone (cal_shell_view); /* Keep the ECalModel in sync with the sidebar. */ diff --git a/modules/calendar/e-memo-shell-migrate.c b/modules/calendar/e-memo-shell-migrate.c index c64b8b086f..a41c4e1985 100644 --- a/modules/calendar/e-memo-shell-migrate.c +++ b/modules/calendar/e-memo-shell-migrate.c @@ -274,5 +274,5 @@ e_memo_shell_backend_migrate (EShellBackend *shell_backend, if (personal_source) g_object_unref (personal_source); - return retval; + return retval; } -- cgit v1.2.3 From 2c31a5bc23cf5a092c0621bf34554ffb2b6ae2ec Mon Sep 17 00:00:00 2001 From: Kjartan Maraas Date: Tue, 8 Feb 2011 11:57:50 -0500 Subject: Bug 641756 - Fix warnings from GCC 4.6 GCC learned how to find dead assignments. --- modules/calendar/e-cal-shell-sidebar.c | 4 +--- modules/calendar/e-memo-shell-view-private.c | 7 ------- modules/calendar/e-task-shell-view-private.c | 7 ------- 3 files changed, 1 insertion(+), 17 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index f61e0a60a7..5227df6bcd 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -571,14 +571,12 @@ cal_shell_sidebar_finalize (GObject *object) static void new_calendar_clicked (GtkButton *button, - EShellSidebar *shell_sidebar) + EShellSidebar *shell_sidebar) { EShellView *shell_view; EShellWindow *shell_window; - EShellBackend *shell_backend; shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_backend = e_shell_view_get_shell_backend (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); calendar_setup_new_calendar (GTK_WINDOW (shell_window)); diff --git a/modules/calendar/e-memo-shell-view-private.c b/modules/calendar/e-memo-shell-view-private.c index 0880750828..f4049d7ce4 100644 --- a/modules/calendar/e-memo-shell-view-private.c +++ b/modules/calendar/e-memo-shell-view-private.c @@ -436,24 +436,17 @@ e_memo_shell_view_update_timezone (EMemoShellView *memo_shell_view) { EMemoShellContent *memo_shell_content; EMemoShellSidebar *memo_shell_sidebar; - ECalComponentPreview *memo_preview; - EPreviewPane *preview_pane; - EWebView *web_view; icaltimezone *timezone; ECalModel *model; GList *clients, *iter; memo_shell_content = memo_shell_view->priv->memo_shell_content; - preview_pane = e_memo_shell_content_get_preview_pane (memo_shell_content); model = e_memo_shell_content_get_memo_model (memo_shell_content); timezone = e_cal_model_get_timezone (model); memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar; clients = e_memo_shell_sidebar_get_clients (memo_shell_sidebar); - web_view = e_preview_pane_get_web_view (preview_pane); - memo_preview = E_CAL_COMPONENT_PREVIEW (web_view); - for (iter = clients; iter != NULL; iter = iter->next) { ECal *client = iter->data; diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c index 83b0e9408f..5567cf9c6e 100644 --- a/modules/calendar/e-task-shell-view-private.c +++ b/modules/calendar/e-task-shell-view-private.c @@ -587,24 +587,17 @@ e_task_shell_view_update_timezone (ETaskShellView *task_shell_view) { ETaskShellContent *task_shell_content; ETaskShellSidebar *task_shell_sidebar; - ECalComponentPreview *task_preview; - EPreviewPane *preview_pane; - EWebView *web_view; icaltimezone *timezone; ECalModel *model; GList *clients, *iter; task_shell_content = task_shell_view->priv->task_shell_content; - preview_pane = e_task_shell_content_get_preview_pane (task_shell_content); model = e_task_shell_content_get_task_model (task_shell_content); timezone = e_cal_model_get_timezone (model); task_shell_sidebar = task_shell_view->priv->task_shell_sidebar; clients = e_task_shell_sidebar_get_clients (task_shell_sidebar); - web_view = e_preview_pane_get_web_view (preview_pane); - task_preview = E_CAL_COMPONENT_PREVIEW (web_view); - for (iter = clients; iter != NULL; iter = iter->next) { ECal *client = iter->data; -- cgit v1.2.3 From 7a1677520d439aee68c5ab0268a951d0b411e3a0 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 12 Feb 2011 11:37:05 -0500 Subject: Remove NULL checks for GObject methods. As of GLib 2.28 all GObject virtual methods, including constructed(), are safe to chain up to unconditionally. Remove unnecessary checks. --- modules/calendar/e-cal-config-calendar-item.c | 4 ++-- modules/calendar/e-cal-config-comp-editor.c | 4 ++-- modules/calendar/e-cal-config-date-edit.c | 4 ++-- modules/calendar/e-cal-config-meeting-store.c | 4 ++-- modules/calendar/e-cal-config-meeting-time-selector.c | 4 ++-- modules/calendar/e-cal-config-model.c | 4 ++-- modules/calendar/e-cal-config-view.c | 4 ++-- modules/calendar/e-cal-shell-backend.c | 4 ++-- modules/calendar/e-memo-shell-backend.c | 4 ++-- modules/calendar/e-task-shell-backend.c | 4 ++-- 10 files changed, 20 insertions(+), 20 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-config-calendar-item.c b/modules/calendar/e-cal-config-calendar-item.c index f2116e63cf..fba37b3820 100644 --- a/modules/calendar/e-cal-config-calendar-item.c +++ b/modules/calendar/e-cal-config-calendar-item.c @@ -48,8 +48,8 @@ cal_config_calendar_item_constructed (GObject *object) extensible, "week-start-day", G_BINDING_SYNC_CREATE); - if (G_OBJECT_CLASS (parent_class)->constructed) - G_OBJECT_CLASS (parent_class)->constructed (object); + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (parent_class)->constructed (object); } static void diff --git a/modules/calendar/e-cal-config-comp-editor.c b/modules/calendar/e-cal-config-comp-editor.c index ae8753de74..ba23a051e5 100644 --- a/modules/calendar/e-cal-config-comp-editor.c +++ b/modules/calendar/e-cal-config-comp-editor.c @@ -68,8 +68,8 @@ cal_config_comp_editor_constructed (GObject *object) extensible, "work-day-start-minute", G_BINDING_SYNC_CREATE); - if (G_OBJECT_CLASS (parent_class)->constructed) - G_OBJECT_CLASS (parent_class)->constructed (object); + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (parent_class)->constructed (object); } static void diff --git a/modules/calendar/e-cal-config-date-edit.c b/modules/calendar/e-cal-config-date-edit.c index c26db3e2d6..05a2947d7e 100644 --- a/modules/calendar/e-cal-config-date-edit.c +++ b/modules/calendar/e-cal-config-date-edit.c @@ -48,8 +48,8 @@ cal_config_date_edit_constructed (GObject *object) extensible, "week-start-day", G_BINDING_SYNC_CREATE); - if (G_OBJECT_CLASS (parent_class)->constructed) - G_OBJECT_CLASS (parent_class)->constructed (object); + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (parent_class)->constructed (object); } static void diff --git a/modules/calendar/e-cal-config-meeting-store.c b/modules/calendar/e-cal-config-meeting-store.c index 1e4dc460b9..ba1a1077b3 100644 --- a/modules/calendar/e-cal-config-meeting-store.c +++ b/modules/calendar/e-cal-config-meeting-store.c @@ -63,8 +63,8 @@ cal_config_meeting_store_constructed (GObject *object) extensible, "week-start-day", G_BINDING_SYNC_CREATE); - if (G_OBJECT_CLASS (parent_class)->constructed) - G_OBJECT_CLASS (parent_class)->constructed (object); + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (parent_class)->constructed (object); } static void diff --git a/modules/calendar/e-cal-config-meeting-time-selector.c b/modules/calendar/e-cal-config-meeting-time-selector.c index 280645d4b9..fb03618cc8 100644 --- a/modules/calendar/e-cal-config-meeting-time-selector.c +++ b/modules/calendar/e-cal-config-meeting-time-selector.c @@ -53,8 +53,8 @@ cal_config_meeting_time_selector_constructed (GObject *object) extensible, "week-start-day", G_BINDING_SYNC_CREATE); - if (G_OBJECT_CLASS (parent_class)->constructed) - G_OBJECT_CLASS (parent_class)->constructed (object); + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (parent_class)->constructed (object); } static void diff --git a/modules/calendar/e-cal-config-model.c b/modules/calendar/e-cal-config-model.c index 5455123c4c..47a3ff6463 100644 --- a/modules/calendar/e-cal-config-model.c +++ b/modules/calendar/e-cal-config-model.c @@ -116,8 +116,8 @@ cal_config_model_constructed (GObject *object) G_BINDING_SYNC_CREATE); } - if (G_OBJECT_CLASS (parent_class)->constructed) - G_OBJECT_CLASS (parent_class)->constructed (object); + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (parent_class)->constructed (object); } static void diff --git a/modules/calendar/e-cal-config-view.c b/modules/calendar/e-cal-config-view.c index 898a1d2be2..60ee4a5690 100644 --- a/modules/calendar/e-cal-config-view.c +++ b/modules/calendar/e-cal-config-view.c @@ -90,8 +90,8 @@ cal_config_view_constructed (GObject *object) G_BINDING_SYNC_CREATE); } - if (G_OBJECT_CLASS (parent_class)->constructed) - G_OBJECT_CLASS (parent_class)->constructed (object); + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (parent_class)->constructed (object); } static void diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 960b6c6132..6c80f71965 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -755,8 +755,8 @@ cal_shell_backend_constructed (GObject *object) e_calendar_preferences_new, 600); - if (G_OBJECT_CLASS (parent_class)->constructed) - G_OBJECT_CLASS (parent_class)->constructed (object); + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (parent_class)->constructed (object); } static void diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c index 5ce48a60b3..d60421c49c 100644 --- a/modules/calendar/e-memo-shell-backend.c +++ b/modules/calendar/e-memo-shell-backend.c @@ -521,8 +521,8 @@ memo_shell_backend_constructed (GObject *object) G_CALLBACK (memo_shell_backend_window_created_cb), shell_backend); - if (G_OBJECT_CLASS (parent_class)->constructed) - G_OBJECT_CLASS (parent_class)->constructed (object); + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (parent_class)->constructed (object); } static void diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c index 8bb3f47a66..a55bd75fcc 100644 --- a/modules/calendar/e-task-shell-backend.c +++ b/modules/calendar/e-task-shell-backend.c @@ -526,8 +526,8 @@ task_shell_backend_constructed (GObject *object) G_CALLBACK (task_shell_backend_window_created_cb), shell_backend); - if (G_OBJECT_CLASS (parent_class)->constructed) - G_OBJECT_CLASS (parent_class)->constructed (object); + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (parent_class)->constructed (object); } static void -- cgit v1.2.3 From 1b25ab52f7709a0eae7493fb933fa62376ead288 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 18 Feb 2011 15:13:06 +0100 Subject: Bug #639483 - Category list includes weather information --- modules/calendar/e-cal-shell-view-actions.c | 2 +- modules/calendar/e-cal-shell-view.c | 2 +- modules/calendar/e-memo-shell-view-actions.c | 2 +- modules/calendar/e-memo-shell-view.c | 2 +- modules/calendar/e-task-shell-view-actions.c | 2 +- modules/calendar/e-task-shell-view.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c index 90abf79c3c..5e16b6db5b 100644 --- a/modules/calendar/e-cal-shell-view-actions.c +++ b/modules/calendar/e-cal-shell-view-actions.c @@ -1858,7 +1858,7 @@ e_cal_shell_view_update_search_filter (ECalShellView *cal_shell_view) /* Build the category actions. */ - list = e_categories_get_list (); + list = e_util_get_searchable_categories (); for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) { const gchar *category_name = iter->data; const gchar *filename; diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index 6aafdc82a6..1210d2d267 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -191,7 +191,7 @@ cal_shell_view_execute_search (EShellView *shell_view) GList *categories; const gchar *category_name; - categories = e_categories_get_list (); + categories = e_util_get_searchable_categories (); category_name = g_list_nth_data (categories, value); g_list_free (categories); diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c index a55eab1c10..660ad09f5f 100644 --- a/modules/calendar/e-memo-shell-view-actions.c +++ b/modules/calendar/e-memo-shell-view-actions.c @@ -977,7 +977,7 @@ e_memo_shell_view_update_search_filter (EMemoShellView *memo_shell_view) /* Build the category actions. */ - list = e_categories_get_list (); + list = e_util_get_searchable_categories (); for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) { const gchar *category_name = iter->data; const gchar *filename; diff --git a/modules/calendar/e-memo-shell-view.c b/modules/calendar/e-memo-shell-view.c index 870d5aedc8..219497577c 100644 --- a/modules/calendar/e-memo-shell-view.c +++ b/modules/calendar/e-memo-shell-view.c @@ -139,7 +139,7 @@ memo_shell_view_execute_search (EShellView *shell_view) GList *categories; const gchar *category_name; - categories = e_categories_get_list (); + categories = e_util_get_searchable_categories (); category_name = g_list_nth_data (categories, value); g_list_free (categories); diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c index d3531244d9..dce77b0af7 100644 --- a/modules/calendar/e-task-shell-view-actions.c +++ b/modules/calendar/e-task-shell-view-actions.c @@ -1176,7 +1176,7 @@ e_task_shell_view_update_search_filter (ETaskShellView *task_shell_view) /* Build the category actions. */ - list = e_categories_get_list (); + list = e_util_get_searchable_categories (); for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) { const gchar *category_name = iter->data; const gchar *filename; diff --git a/modules/calendar/e-task-shell-view.c b/modules/calendar/e-task-shell-view.c index b4c6c7db0b..7b575f84d4 100644 --- a/modules/calendar/e-task-shell-view.c +++ b/modules/calendar/e-task-shell-view.c @@ -249,7 +249,7 @@ task_shell_view_execute_search (EShellView *shell_view) GList *categories; const gchar *category_name; - categories = e_categories_get_list (); + categories = e_util_get_searchable_categories (); category_name = g_list_nth_data (categories, value); g_list_free (categories); -- cgit v1.2.3 From 3c516cb10a9ec929143b7b806bcdc5be491c0924 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 22 Feb 2011 13:54:34 +0100 Subject: Bug #608804 - Some attachments make evolution crash in libical --- modules/calendar/e-cal-attachment-handler.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c index 8fea91ffeb..dfc8f58c34 100644 --- a/modules/calendar/e-cal-attachment-handler.c +++ b/modules/calendar/e-cal-attachment-handler.c @@ -83,7 +83,19 @@ attachment_handler_get_component (EAttachment *attachment) camel_data_wrapper_decode_to_stream_sync (wrapper, stream, NULL, NULL); g_object_unref (stream); - component = e_cal_util_parse_ics_string ((gchar *) buffer->data); + if (buffer->len > 0) { + const gchar *str; + + /* ensure string being null-terminated */ + g_byte_array_append (buffer, (const guint8 *) "", 1); + + str = (const gchar *) buffer->data; + while (*str && g_ascii_isspace (*str)) + str++; + + if (g_ascii_strncasecmp (str, "BEGIN:", 6) == 0) + component = e_cal_util_parse_ics_string (str); + } g_byte_array_free (buffer, TRUE); -- cgit v1.2.3 From 1301cf02efdacd20fb5ce3e2554ae15b8f146e8a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 25 Feb 2011 16:20:41 +0100 Subject: Bug #614480 - Avoid using G_TYPE_INSTANCE_GET_PRIVATE repeatedly --- modules/calendar/e-cal-attachment-handler.c | 6 +----- modules/calendar/e-cal-shell-backend.c | 9 ++------- modules/calendar/e-cal-shell-content.c | 15 +++++---------- modules/calendar/e-cal-shell-sidebar.c | 17 ++++++----------- modules/calendar/e-cal-shell-view-private.c | 2 +- modules/calendar/e-cal-shell-view-private.h | 4 ---- modules/calendar/e-cal-shell-view.c | 5 ++--- modules/calendar/e-memo-shell-backend.c | 9 ++------- modules/calendar/e-memo-shell-content.c | 17 ++++++----------- modules/calendar/e-memo-shell-sidebar.c | 17 ++++++----------- modules/calendar/e-memo-shell-view-private.h | 4 ---- modules/calendar/e-memo-shell-view.c | 3 +-- modules/calendar/e-task-shell-backend.c | 9 ++------- modules/calendar/e-task-shell-content.c | 17 ++++++----------- modules/calendar/e-task-shell-sidebar.c | 17 ++++++----------- modules/calendar/e-task-shell-view-private.h | 4 ---- modules/calendar/e-task-shell-view.c | 3 +-- 17 files changed, 47 insertions(+), 111 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c index dfc8f58c34..25677877fc 100644 --- a/modules/calendar/e-cal-attachment-handler.c +++ b/modules/calendar/e-cal-attachment-handler.c @@ -29,10 +29,6 @@ #include "calendar/common/authentication.h" -#define E_CAL_ATTACHMENT_HANDLER_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_CAL_ATTACHMENT_HANDLER, ECalAttachmentHandlerPrivate)) - typedef struct _ImportContext ImportContext; struct _ECalAttachmentHandlerPrivate { @@ -492,7 +488,7 @@ cal_attachment_handler_class_init (ECalAttachmentHandlerClass *class) static void cal_attachment_handler_init (ECalAttachmentHandler *handler) { - handler->priv = E_CAL_ATTACHMENT_HANDLER_GET_PRIVATE (handler); + handler->priv = G_TYPE_INSTANCE_GET_PRIVATE (handler, E_TYPE_CAL_ATTACHMENT_HANDLER, ECalAttachmentHandlerPrivate); } GType diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 6c80f71965..b9cb894c50 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -51,10 +51,6 @@ #include "e-calendar-preferences.h" -#define E_CAL_SHELL_BACKEND_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_CAL_SHELL_BACKEND, ECalShellBackendPrivate)) - struct _ECalShellBackendPrivate { ESourceList *source_list; }; @@ -707,7 +703,7 @@ cal_shell_backend_dispose (GObject *object) { ECalShellBackendPrivate *priv; - priv = E_CAL_SHELL_BACKEND_GET_PRIVATE (object); + priv = E_CAL_SHELL_BACKEND (object)->priv; if (priv->source_list != NULL) { g_object_unref (priv->source_list); @@ -800,8 +796,7 @@ cal_shell_backend_init (ECalShellBackend *cal_shell_backend) icalarray *builtin_timezones; gint ii; - cal_shell_backend->priv = - E_CAL_SHELL_BACKEND_GET_PRIVATE (cal_shell_backend); + cal_shell_backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (cal_shell_backend, E_TYPE_CAL_SHELL_BACKEND, ECalShellBackendPrivate); /* XXX Pre-load all built-in timezones in libical. * diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c index e7a082bc05..1fbedd22b1 100644 --- a/modules/calendar/e-cal-shell-content.c +++ b/modules/calendar/e-cal-shell-content.c @@ -39,10 +39,6 @@ #include "e-cal-shell-view-private.h" -#define E_CAL_SHELL_CONTENT_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_CAL_SHELL_CONTENT, ECalShellContentPrivate)) - struct _ECalShellContentPrivate { GtkWidget *hpaned; GtkWidget *notebook; @@ -202,7 +198,7 @@ e_cal_shell_content_save_state (ECalShellContent *cal_shell_content) g_return_if_fail (cal_shell_content != NULL); g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content)); - priv = E_CAL_SHELL_CONTENT_GET_PRIVATE (cal_shell_content); + priv = cal_shell_content->priv; if (priv->task_table != NULL) cal_shell_content_save_table_state ( @@ -261,7 +257,7 @@ cal_shell_content_dispose (GObject *object) { ECalShellContentPrivate *priv; - priv = E_CAL_SHELL_CONTENT_GET_PRIVATE (object); + priv = E_CAL_SHELL_CONTENT (object)->priv; if (priv->hpaned != NULL) { g_object_unref (priv->hpaned); @@ -339,7 +335,7 @@ cal_shell_content_constructed (GObject *object) gchar *markup; gint ii; - priv = E_CAL_SHELL_CONTENT_GET_PRIVATE (object); + priv = E_CAL_SHELL_CONTENT (object)->priv; /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (parent_class)->constructed (object); @@ -545,7 +541,7 @@ cal_shell_content_map (GtkWidget *widget) * callback in GnomeCalendar that requires the date navigator. * Ordinarily we would do this at the end of constructed(), but * that's too soon in this case. (This feels kind of kludgy.) */ - priv = E_CAL_SHELL_CONTENT_GET_PRIVATE (widget); + priv = E_CAL_SHELL_CONTENT (widget)->priv; gal_view_instance_load (priv->view_instance); /* Chain up to parent's map() method. */ @@ -624,8 +620,7 @@ cal_shell_content_class_init (ECalShellContentClass *class) static void cal_shell_content_init (ECalShellContent *cal_shell_content) { - cal_shell_content->priv = - E_CAL_SHELL_CONTENT_GET_PRIVATE (cal_shell_content); + cal_shell_content->priv = G_TYPE_INSTANCE_GET_PRIVATE (cal_shell_content, E_TYPE_CAL_SHELL_CONTENT, ECalShellContentPrivate); /* Postpone widget construction until we have a shell view. */ } diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index 5227df6bcd..be0a3443e2 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -37,10 +37,6 @@ #include "e-cal-shell-backend.h" #include "e-cal-shell-content.h" -#define E_CAL_SHELL_SIDEBAR_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_CAL_SHELL_SIDEBAR, ECalShellSidebarPrivate)) - struct _ECalShellSidebarPrivate { GtkWidget *paned; GtkWidget *selector; @@ -239,7 +235,7 @@ cal_shell_sidebar_default_loaded_cb (ESource *source, ECal *client; GError *error = NULL; - priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); + priv = E_CAL_SHELL_SIDEBAR (shell_sidebar)->priv; shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_content = e_shell_view_get_shell_content (shell_view); @@ -420,7 +416,7 @@ cal_shell_sidebar_restore_state_cb (EShellWindow *shell_window, GObject *object; const gchar *key; - priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); + priv = E_CAL_SHELL_SIDEBAR (shell_sidebar)->priv; shell = e_shell_window_get_shell (shell_window); shell_settings = e_shell_get_shell_settings (shell); @@ -522,7 +518,7 @@ cal_shell_sidebar_dispose (GObject *object) { ECalShellSidebarPrivate *priv; - priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (object); + priv = E_CAL_SHELL_SIDEBAR (object)->priv; if (priv->paned != NULL) { g_object_unref (priv->paned); @@ -561,7 +557,7 @@ cal_shell_sidebar_finalize (GObject *object) { ECalShellSidebarPrivate *priv; - priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (object); + priv = E_CAL_SHELL_SIDEBAR (object)->priv; g_hash_table_destroy (priv->client_table); @@ -598,7 +594,7 @@ cal_shell_sidebar_constructed (GObject *object) GtkWidget *widget; AtkObject *a11y; - priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (object); + priv = E_CAL_SHELL_SIDEBAR (object)->priv; /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (parent_class)->constructed (object); @@ -848,8 +844,7 @@ cal_shell_sidebar_init (ECalShellSidebar *cal_shell_sidebar) (GDestroyNotify) g_free, (GDestroyNotify) g_object_unref); - cal_shell_sidebar->priv = - E_CAL_SHELL_SIDEBAR_GET_PRIVATE (cal_shell_sidebar); + cal_shell_sidebar->priv = G_TYPE_INSTANCE_GET_PRIVATE (cal_shell_sidebar, E_TYPE_CAL_SHELL_SIDEBAR, ECalShellSidebarPrivate); cal_shell_sidebar->priv->client_table = client_table; diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c index 0a20ea2000..61aff5aa5c 100644 --- a/modules/calendar/e-cal-shell-view-private.c +++ b/modules/calendar/e-cal-shell-view-private.c @@ -239,7 +239,7 @@ cal_shell_view_popup_event_cb (EShellView *shell_view, const gchar *widget_path; gint n_selected; - priv = E_CAL_SHELL_VIEW_GET_PRIVATE (shell_view); + priv = E_CAL_SHELL_VIEW (shell_view)->priv; calendar = e_cal_shell_content_get_calendar (priv->cal_shell_content); diff --git a/modules/calendar/e-cal-shell-view-private.h b/modules/calendar/e-cal-shell-view-private.h index d6f37ba7bf..0f9235046c 100644 --- a/modules/calendar/e-cal-shell-view-private.h +++ b/modules/calendar/e-cal-shell-view-private.h @@ -63,10 +63,6 @@ #include "e-cal-shell-sidebar.h" #include "e-cal-shell-view-actions.h" -#define E_CAL_SHELL_VIEW_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_CAL_SHELL_VIEW, ECalShellViewPrivate)) - /* Shorthand, requires a variable named "shell_window". */ #define ACTION(name) \ (E_SHELL_WINDOW_ACTION_##name (shell_window)) diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index 1210d2d267..72ce261a6a 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -310,7 +310,7 @@ cal_shell_view_update_actions (EShellView *shell_view) /* Chain up to parent's update_actions() method. */ E_SHELL_VIEW_CLASS (parent_class)->update_actions (shell_view); - priv = E_CAL_SHELL_VIEW_GET_PRIVATE (shell_view); + priv = E_CAL_SHELL_VIEW (shell_view)->priv; shell_window = e_shell_view_get_shell_window (shell_view); shell = e_shell_window_get_shell (shell_window); @@ -517,8 +517,7 @@ static void cal_shell_view_init (ECalShellView *cal_shell_view, EShellViewClass *shell_view_class) { - cal_shell_view->priv = - E_CAL_SHELL_VIEW_GET_PRIVATE (cal_shell_view); + cal_shell_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (cal_shell_view, E_TYPE_CAL_SHELL_VIEW, ECalShellViewPrivate); e_cal_shell_view_private_init (cal_shell_view, shell_view_class); } diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c index d60421c49c..5c02cdd98a 100644 --- a/modules/calendar/e-memo-shell-backend.c +++ b/modules/calendar/e-memo-shell-backend.c @@ -41,10 +41,6 @@ #include "e-memo-shell-migrate.h" #include "e-memo-shell-view.h" -#define E_MEMO_SHELL_BACKEND_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_MEMO_SHELL_BACKEND, EMemoShellBackendPrivate)) - #define WEB_BASE_URI "webcal://" #define PERSONAL_RELATIVE_URI "system" @@ -489,7 +485,7 @@ memo_shell_backend_dispose (GObject *object) { EMemoShellBackendPrivate *priv; - priv = E_MEMO_SHELL_BACKEND_GET_PRIVATE (object); + priv = E_MEMO_SHELL_BACKEND (object)->priv; if (priv->source_list != NULL) { g_object_unref (priv->source_list); @@ -563,8 +559,7 @@ memo_shell_backend_class_init (EMemoShellBackendClass *class) static void memo_shell_backend_init (EMemoShellBackend *memo_shell_backend) { - memo_shell_backend->priv = - E_MEMO_SHELL_BACKEND_GET_PRIVATE (memo_shell_backend); + memo_shell_backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (memo_shell_backend, E_TYPE_MEMO_SHELL_BACKEND, EMemoShellBackendPrivate); } GType diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c index a9d299e221..37e96fe47a 100644 --- a/modules/calendar/e-memo-shell-content.c +++ b/modules/calendar/e-memo-shell-content.c @@ -35,10 +35,6 @@ #include "calendar/gui/e-cal-model-memos.h" #include "calendar/gui/e-memo-table.h" -#define E_MEMO_SHELL_CONTENT_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_MEMO_SHELL_CONTENT, EMemoShellContentPrivate)) - #define E_MEMO_TABLE_DEFAULT_STATE \ "" \ "" \ @@ -277,7 +273,7 @@ memo_shell_content_restore_state_cb (EShellWindow *shell_window, GObject *object; const gchar *key; - priv = E_MEMO_SHELL_CONTENT_GET_PRIVATE (shell_content); + priv = E_MEMO_SHELL_CONTENT (shell_content)->priv; /* Bind GObject properties to GConf keys. */ @@ -367,7 +363,7 @@ memo_shell_content_dispose (GObject *object) { EMemoShellContentPrivate *priv; - priv = E_MEMO_SHELL_CONTENT_GET_PRIVATE (object); + priv = E_MEMO_SHELL_CONTENT (object)->priv; if (priv->paned != NULL) { g_object_unref (priv->paned); @@ -403,7 +399,7 @@ memo_shell_content_finalize (GObject *object) { EMemoShellContentPrivate *priv; - priv = E_MEMO_SHELL_CONTENT_GET_PRIVATE (object); + priv = E_MEMO_SHELL_CONTENT (object)->priv; g_free (priv->current_uid); @@ -428,7 +424,7 @@ memo_shell_content_constructed (GObject *object) GtkWidget *widget; gint n_targets; - priv = E_MEMO_SHELL_CONTENT_GET_PRIVATE (object); + priv = E_MEMO_SHELL_CONTENT (object)->priv; /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (parent_class)->constructed (object); @@ -606,7 +602,7 @@ memo_shell_content_focus_search_results (EShellContent *shell_content) { EMemoShellContentPrivate *priv; - priv = E_MEMO_SHELL_CONTENT_GET_PRIVATE (shell_content); + priv = E_MEMO_SHELL_CONTENT (shell_content)->priv; gtk_widget_grab_focus (priv->memo_table); } @@ -659,8 +655,7 @@ memo_shell_content_class_init (EMemoShellContentClass *class) static void memo_shell_content_init (EMemoShellContent *memo_shell_content) { - memo_shell_content->priv = - E_MEMO_SHELL_CONTENT_GET_PRIVATE (memo_shell_content); + memo_shell_content->priv = G_TYPE_INSTANCE_GET_PRIVATE (memo_shell_content, E_TYPE_MEMO_SHELL_CONTENT, EMemoShellContentPrivate); /* Postpone widget construction until we have a shell view. */ } diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index b7e52a9095..612b83126b 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -35,10 +35,6 @@ #include "e-memo-shell-backend.h" #include "e-memo-shell-content.h" -#define E_MEMO_SHELL_SIDEBAR_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_MEMO_SHELL_SIDEBAR, EMemoShellSidebarPrivate)) - struct _EMemoShellSidebarPrivate { GtkWidget *selector; @@ -234,7 +230,7 @@ memo_shell_sidebar_default_loaded_cb (ESource *source, ECal *client; GError *error = NULL; - priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); + priv = E_MEMO_SHELL_SIDEBAR (shell_sidebar)->priv; shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_content = e_shell_view_get_shell_content (shell_view); @@ -412,7 +408,7 @@ memo_shell_sidebar_restore_state_cb (EShellWindow *shell_window, GtkTreeModel *model; GSList *list, *iter; - priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); + priv = E_MEMO_SHELL_SIDEBAR (shell_sidebar)->priv; shell = e_shell_window_get_shell (shell_window); shell_settings = e_shell_get_shell_settings (shell); @@ -499,7 +495,7 @@ memo_shell_sidebar_dispose (GObject *object) { EMemoShellSidebarPrivate *priv; - priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (object); + priv = E_MEMO_SHELL_SIDEBAR (object)->priv; if (priv->selector != NULL) { g_object_unref (priv->selector); @@ -528,7 +524,7 @@ memo_shell_sidebar_finalize (GObject *object) { EMemoShellSidebarPrivate *priv; - priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (object); + priv = E_MEMO_SHELL_SIDEBAR (object)->priv; g_hash_table_destroy (priv->client_table); @@ -549,7 +545,7 @@ memo_shell_sidebar_constructed (GObject *object) GtkWidget *widget; AtkObject *a11y; - priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (object); + priv = E_MEMO_SHELL_SIDEBAR (object)->priv; /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (parent_class)->constructed (object); @@ -744,8 +740,7 @@ memo_shell_sidebar_init (EMemoShellSidebar *memo_shell_sidebar) (GDestroyNotify) g_free, (GDestroyNotify) g_object_unref); - memo_shell_sidebar->priv = - E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (memo_shell_sidebar); + memo_shell_sidebar->priv = G_TYPE_INSTANCE_GET_PRIVATE (memo_shell_sidebar, E_TYPE_MEMO_SHELL_SIDEBAR, EMemoShellSidebarPrivate); memo_shell_sidebar->priv->client_table = client_table; diff --git a/modules/calendar/e-memo-shell-view-private.h b/modules/calendar/e-memo-shell-view-private.h index 0b8867a5b3..0a6a390004 100644 --- a/modules/calendar/e-memo-shell-view-private.h +++ b/modules/calendar/e-memo-shell-view-private.h @@ -50,10 +50,6 @@ #include "e-memo-shell-sidebar.h" #include "e-memo-shell-view-actions.h" -#define E_MEMO_SHELL_VIEW_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_MEMO_SHELL_VIEW, EMemoShellViewPrivate)) - /* Shorthand, requires a variable named "shell_window". */ #define ACTION(name) \ (E_SHELL_WINDOW_ACTION_##name (shell_window)) diff --git a/modules/calendar/e-memo-shell-view.c b/modules/calendar/e-memo-shell-view.c index 219497577c..4cef169ae8 100644 --- a/modules/calendar/e-memo-shell-view.c +++ b/modules/calendar/e-memo-shell-view.c @@ -302,8 +302,7 @@ static void memo_shell_view_init (EMemoShellView *memo_shell_view, EShellViewClass *shell_view_class) { - memo_shell_view->priv = - E_MEMO_SHELL_VIEW_GET_PRIVATE (memo_shell_view); + memo_shell_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (memo_shell_view, E_TYPE_MEMO_SHELL_VIEW, EMemoShellViewPrivate); e_memo_shell_view_private_init (memo_shell_view, shell_view_class); } diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c index a55bd75fcc..9d85dc87b8 100644 --- a/modules/calendar/e-task-shell-backend.c +++ b/modules/calendar/e-task-shell-backend.c @@ -43,10 +43,6 @@ #include "e-task-shell-sidebar.h" #include "e-task-shell-view.h" -#define E_TASK_SHELL_BACKEND_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_TASK_SHELL_BACKEND, ETaskShellBackendPrivate)) - struct _ETaskShellBackendPrivate { ESourceList *source_list; }; @@ -494,7 +490,7 @@ task_shell_backend_dispose (GObject *object) { ETaskShellBackendPrivate *priv; - priv = E_TASK_SHELL_BACKEND_GET_PRIVATE (object); + priv = E_TASK_SHELL_BACKEND (object)->priv; if (priv->source_list != NULL) { g_object_unref (priv->source_list); @@ -568,8 +564,7 @@ task_shell_backend_class_init (ETaskShellBackendClass *class) static void task_shell_backend_init (ETaskShellBackend *task_shell_backend) { - task_shell_backend->priv = - E_TASK_SHELL_BACKEND_GET_PRIVATE (task_shell_backend); + task_shell_backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (task_shell_backend, E_TYPE_TASK_SHELL_BACKEND, ETaskShellBackendPrivate); } GType diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c index 9cc924642c..78680bc307 100644 --- a/modules/calendar/e-task-shell-content.c +++ b/modules/calendar/e-task-shell-content.c @@ -34,10 +34,6 @@ #include "calendar/gui/e-cal-component-preview.h" #include "calendar/gui/e-cal-model-tasks.h" -#define E_TASK_SHELL_CONTENT_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_TASK_SHELL_CONTENT, ETaskShellContentPrivate)) - #define E_TASK_TABLE_DEFAULT_STATE \ "" \ "" \ @@ -275,7 +271,7 @@ task_shell_content_restore_state_cb (EShellWindow *shell_window, GObject *object; const gchar *key; - priv = E_TASK_SHELL_CONTENT_GET_PRIVATE (shell_content); + priv = E_TASK_SHELL_CONTENT (shell_content)->priv; /* Bind GObject properties to GConf keys. */ @@ -365,7 +361,7 @@ task_shell_content_dispose (GObject *object) { ETaskShellContentPrivate *priv; - priv = E_TASK_SHELL_CONTENT_GET_PRIVATE (object); + priv = E_TASK_SHELL_CONTENT (object)->priv; if (priv->paned != NULL) { g_object_unref (priv->paned); @@ -401,7 +397,7 @@ task_shell_content_finalize (GObject *object) { ETaskShellContentPrivate *priv; - priv = E_TASK_SHELL_CONTENT_GET_PRIVATE (object); + priv = E_TASK_SHELL_CONTENT (object)->priv; g_free (priv->current_uid); @@ -425,7 +421,7 @@ task_shell_content_constructed (GObject *object) GtkWidget *widget; gint n_targets; - priv = E_TASK_SHELL_CONTENT_GET_PRIVATE (object); + priv = E_TASK_SHELL_CONTENT (object)->priv; /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (parent_class)->constructed (object); @@ -627,7 +623,7 @@ task_shell_content_focus_search_results (EShellContent *shell_content) { ETaskShellContentPrivate *priv; - priv = E_TASK_SHELL_CONTENT_GET_PRIVATE (shell_content); + priv = E_TASK_SHELL_CONTENT (shell_content)->priv; gtk_widget_grab_focus (priv->task_table); } @@ -680,8 +676,7 @@ task_shell_content_class_init (ETaskShellContentClass *class) static void task_shell_content_init (ETaskShellContent *task_shell_content) { - task_shell_content->priv = - E_TASK_SHELL_CONTENT_GET_PRIVATE (task_shell_content); + task_shell_content->priv = G_TYPE_INSTANCE_GET_PRIVATE (task_shell_content, E_TYPE_TASK_SHELL_CONTENT, ETaskShellContentPrivate); /* Postpone widget construction until we have a shell view. */ } diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index 62973d2efc..c6f6e1526d 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -35,10 +35,6 @@ #include "e-task-shell-backend.h" #include "e-task-shell-content.h" -#define E_TASK_SHELL_SIDEBAR_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_TASK_SHELL_SIDEBAR, ETaskShellSidebarPrivate)) - struct _ETaskShellSidebarPrivate { GtkWidget *selector; @@ -234,7 +230,7 @@ task_shell_sidebar_default_loaded_cb (ESource *source, ECal *client; GError *error = NULL; - priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); + priv = E_TASK_SHELL_SIDEBAR (shell_sidebar)->priv; shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_content = e_shell_view_get_shell_content (shell_view); @@ -412,7 +408,7 @@ task_shell_sidebar_restore_state_cb (EShellWindow *shell_window, GtkTreeModel *model; GSList *list, *iter; - priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar); + priv = E_TASK_SHELL_SIDEBAR (shell_sidebar)->priv; shell = e_shell_window_get_shell (shell_window); shell_settings = e_shell_get_shell_settings (shell); @@ -499,7 +495,7 @@ task_shell_sidebar_dispose (GObject *object) { ETaskShellSidebarPrivate *priv; - priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (object); + priv = E_TASK_SHELL_SIDEBAR (object)->priv; if (priv->selector != NULL) { g_object_unref (priv->selector); @@ -528,7 +524,7 @@ task_shell_sidebar_finalize (GObject *object) { ETaskShellSidebarPrivate *priv; - priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (object); + priv = E_TASK_SHELL_SIDEBAR (object)->priv; g_hash_table_destroy (priv->client_table); @@ -549,7 +545,7 @@ task_shell_sidebar_constructed (GObject *object) GtkWidget *widget; AtkObject *a11y; - priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (object); + priv = E_TASK_SHELL_SIDEBAR (object)->priv; /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (parent_class)->constructed (object); @@ -744,8 +740,7 @@ task_shell_sidebar_init (ETaskShellSidebar *task_shell_sidebar) (GDestroyNotify) g_free, (GDestroyNotify) g_object_unref); - task_shell_sidebar->priv = - E_TASK_SHELL_SIDEBAR_GET_PRIVATE (task_shell_sidebar); + task_shell_sidebar->priv = G_TYPE_INSTANCE_GET_PRIVATE (task_shell_sidebar, E_TYPE_TASK_SHELL_SIDEBAR, ETaskShellSidebarPrivate); task_shell_sidebar->priv->client_table = client_table; diff --git a/modules/calendar/e-task-shell-view-private.h b/modules/calendar/e-task-shell-view-private.h index b95c0d5e5b..b7dace83b7 100644 --- a/modules/calendar/e-task-shell-view-private.h +++ b/modules/calendar/e-task-shell-view-private.h @@ -54,10 +54,6 @@ #include "e-task-shell-sidebar.h" #include "e-task-shell-view-actions.h" -#define E_TASK_SHELL_VIEW_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_TASK_SHELL_VIEW, ETaskShellViewPrivate)) - /* Shorthand, requires a variable named "shell_window". */ #define ACTION(name) \ (E_SHELL_WINDOW_ACTION_##name (shell_window)) diff --git a/modules/calendar/e-task-shell-view.c b/modules/calendar/e-task-shell-view.c index 7b575f84d4..e4b5e03a5b 100644 --- a/modules/calendar/e-task-shell-view.c +++ b/modules/calendar/e-task-shell-view.c @@ -467,8 +467,7 @@ static void task_shell_view_init (ETaskShellView *task_shell_view, EShellViewClass *shell_view_class) { - task_shell_view->priv = - E_TASK_SHELL_VIEW_GET_PRIVATE (task_shell_view); + task_shell_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (task_shell_view, E_TYPE_TASK_SHELL_VIEW, ETaskShellViewPrivate); e_task_shell_view_private_init (task_shell_view, shell_view_class); } -- cgit v1.2.3 From 0be641ea82d61a5967d4f34dde9bc3bbbb9aa7cf Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 3 Mar 2011 07:45:37 -0500 Subject: Bug 637091 - Crash in g_str_hash, task_shell_sidebar_client_removed I don't know how in the world an ESource can wind up not having a UID string, but we saw a case of this in 2.32. Emit a runtime warning and avoid crashing. --- modules/calendar/e-cal-shell-sidebar.c | 1 + modules/calendar/e-memo-shell-sidebar.c | 1 + modules/calendar/e-task-shell-sidebar.c | 1 + 3 files changed, 3 insertions(+) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index be0a3443e2..21c630b549 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -746,6 +746,7 @@ cal_shell_sidebar_client_removed (ECalShellSidebar *cal_shell_sidebar, source = e_cal_get_source (client); uid = e_source_peek_uid (source); + g_return_if_fail (uid != NULL); g_hash_table_remove (client_table, uid); e_source_selector_unselect_source (selector, source); diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index 612b83126b..4c9e2544ba 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -651,6 +651,7 @@ memo_shell_sidebar_client_removed (EMemoShellSidebar *memo_shell_sidebar, source = e_cal_get_source (client); uid = e_source_peek_uid (source); + g_return_if_fail (uid != NULL); g_hash_table_remove (client_table, uid); e_source_selector_unselect_source (selector, source); diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index c6f6e1526d..99df3b6ab5 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -651,6 +651,7 @@ task_shell_sidebar_client_removed (ETaskShellSidebar *task_shell_sidebar, source = e_cal_get_source (client); uid = e_source_peek_uid (source); + g_return_if_fail (uid != NULL); g_hash_table_remove (client_table, uid); e_source_selector_unselect_source (selector, source); -- cgit v1.2.3 From c6fd77460f5baf88528f5da2ffb99e86a2885ff0 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 5 Mar 2011 12:33:49 -0500 Subject: Coding style and whitespace cleanup. --- modules/calendar/e-cal-attachment-handler.c | 4 +++- modules/calendar/e-cal-shell-backend.c | 4 +++- modules/calendar/e-cal-shell-content.c | 4 +++- modules/calendar/e-cal-shell-sidebar.c | 4 +++- modules/calendar/e-cal-shell-view.c | 3 ++- modules/calendar/e-memo-shell-backend.c | 4 +++- modules/calendar/e-memo-shell-content.c | 4 +++- modules/calendar/e-memo-shell-sidebar.c | 4 +++- modules/calendar/e-memo-shell-view.c | 4 +++- modules/calendar/e-task-shell-backend.c | 4 +++- modules/calendar/e-task-shell-content.c | 4 +++- modules/calendar/e-task-shell-sidebar.c | 4 +++- modules/calendar/e-task-shell-view.c | 4 +++- 13 files changed, 38 insertions(+), 13 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c index 25677877fc..14c9efbe4d 100644 --- a/modules/calendar/e-cal-attachment-handler.c +++ b/modules/calendar/e-cal-attachment-handler.c @@ -488,7 +488,9 @@ cal_attachment_handler_class_init (ECalAttachmentHandlerClass *class) static void cal_attachment_handler_init (ECalAttachmentHandler *handler) { - handler->priv = G_TYPE_INSTANCE_GET_PRIVATE (handler, E_TYPE_CAL_ATTACHMENT_HANDLER, ECalAttachmentHandlerPrivate); + handler->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + handler, E_TYPE_CAL_ATTACHMENT_HANDLER, + ECalAttachmentHandlerPrivate); } GType diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index b9cb894c50..d0f97caae2 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -796,7 +796,9 @@ cal_shell_backend_init (ECalShellBackend *cal_shell_backend) icalarray *builtin_timezones; gint ii; - cal_shell_backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (cal_shell_backend, E_TYPE_CAL_SHELL_BACKEND, ECalShellBackendPrivate); + cal_shell_backend->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + cal_shell_backend, E_TYPE_CAL_SHELL_BACKEND, + ECalShellBackendPrivate); /* XXX Pre-load all built-in timezones in libical. * diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c index 1fbedd22b1..e35057bacb 100644 --- a/modules/calendar/e-cal-shell-content.c +++ b/modules/calendar/e-cal-shell-content.c @@ -620,7 +620,9 @@ cal_shell_content_class_init (ECalShellContentClass *class) static void cal_shell_content_init (ECalShellContent *cal_shell_content) { - cal_shell_content->priv = G_TYPE_INSTANCE_GET_PRIVATE (cal_shell_content, E_TYPE_CAL_SHELL_CONTENT, ECalShellContentPrivate); + cal_shell_content->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + cal_shell_content, E_TYPE_CAL_SHELL_CONTENT, + ECalShellContentPrivate); /* Postpone widget construction until we have a shell view. */ } diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index 21c630b549..9f9bc454e1 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -845,7 +845,9 @@ cal_shell_sidebar_init (ECalShellSidebar *cal_shell_sidebar) (GDestroyNotify) g_free, (GDestroyNotify) g_object_unref); - cal_shell_sidebar->priv = G_TYPE_INSTANCE_GET_PRIVATE (cal_shell_sidebar, E_TYPE_CAL_SHELL_SIDEBAR, ECalShellSidebarPrivate); + cal_shell_sidebar->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + cal_shell_sidebar, E_TYPE_CAL_SHELL_SIDEBAR, + ECalShellSidebarPrivate); cal_shell_sidebar->priv->client_table = client_table; diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index 72ce261a6a..ce2e258441 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -517,7 +517,8 @@ static void cal_shell_view_init (ECalShellView *cal_shell_view, EShellViewClass *shell_view_class) { - cal_shell_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (cal_shell_view, E_TYPE_CAL_SHELL_VIEW, ECalShellViewPrivate); + cal_shell_view->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + cal_shell_view, E_TYPE_CAL_SHELL_VIEW, ECalShellViewPrivate); e_cal_shell_view_private_init (cal_shell_view, shell_view_class); } diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c index 5c02cdd98a..488f300340 100644 --- a/modules/calendar/e-memo-shell-backend.c +++ b/modules/calendar/e-memo-shell-backend.c @@ -559,7 +559,9 @@ memo_shell_backend_class_init (EMemoShellBackendClass *class) static void memo_shell_backend_init (EMemoShellBackend *memo_shell_backend) { - memo_shell_backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (memo_shell_backend, E_TYPE_MEMO_SHELL_BACKEND, EMemoShellBackendPrivate); + memo_shell_backend->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + memo_shell_backend, E_TYPE_MEMO_SHELL_BACKEND, + EMemoShellBackendPrivate); } GType diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c index 37e96fe47a..bbf12de7db 100644 --- a/modules/calendar/e-memo-shell-content.c +++ b/modules/calendar/e-memo-shell-content.c @@ -655,7 +655,9 @@ memo_shell_content_class_init (EMemoShellContentClass *class) static void memo_shell_content_init (EMemoShellContent *memo_shell_content) { - memo_shell_content->priv = G_TYPE_INSTANCE_GET_PRIVATE (memo_shell_content, E_TYPE_MEMO_SHELL_CONTENT, EMemoShellContentPrivate); + memo_shell_content->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + memo_shell_content, E_TYPE_MEMO_SHELL_CONTENT, + EMemoShellContentPrivate); /* Postpone widget construction until we have a shell view. */ } diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index 4c9e2544ba..4ad5d44ded 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -741,7 +741,9 @@ memo_shell_sidebar_init (EMemoShellSidebar *memo_shell_sidebar) (GDestroyNotify) g_free, (GDestroyNotify) g_object_unref); - memo_shell_sidebar->priv = G_TYPE_INSTANCE_GET_PRIVATE (memo_shell_sidebar, E_TYPE_MEMO_SHELL_SIDEBAR, EMemoShellSidebarPrivate); + memo_shell_sidebar->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + memo_shell_sidebar, E_TYPE_MEMO_SHELL_SIDEBAR, + EMemoShellSidebarPrivate); memo_shell_sidebar->priv->client_table = client_table; diff --git a/modules/calendar/e-memo-shell-view.c b/modules/calendar/e-memo-shell-view.c index 4cef169ae8..d0986e7a17 100644 --- a/modules/calendar/e-memo-shell-view.c +++ b/modules/calendar/e-memo-shell-view.c @@ -302,7 +302,9 @@ static void memo_shell_view_init (EMemoShellView *memo_shell_view, EShellViewClass *shell_view_class) { - memo_shell_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (memo_shell_view, E_TYPE_MEMO_SHELL_VIEW, EMemoShellViewPrivate); + memo_shell_view->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + memo_shell_view, E_TYPE_MEMO_SHELL_VIEW, + EMemoShellViewPrivate); e_memo_shell_view_private_init (memo_shell_view, shell_view_class); } diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c index 9d85dc87b8..193f3bea23 100644 --- a/modules/calendar/e-task-shell-backend.c +++ b/modules/calendar/e-task-shell-backend.c @@ -564,7 +564,9 @@ task_shell_backend_class_init (ETaskShellBackendClass *class) static void task_shell_backend_init (ETaskShellBackend *task_shell_backend) { - task_shell_backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (task_shell_backend, E_TYPE_TASK_SHELL_BACKEND, ETaskShellBackendPrivate); + task_shell_backend->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + task_shell_backend, E_TYPE_TASK_SHELL_BACKEND, + ETaskShellBackendPrivate); } GType diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c index 78680bc307..f2d10e4a4d 100644 --- a/modules/calendar/e-task-shell-content.c +++ b/modules/calendar/e-task-shell-content.c @@ -676,7 +676,9 @@ task_shell_content_class_init (ETaskShellContentClass *class) static void task_shell_content_init (ETaskShellContent *task_shell_content) { - task_shell_content->priv = G_TYPE_INSTANCE_GET_PRIVATE (task_shell_content, E_TYPE_TASK_SHELL_CONTENT, ETaskShellContentPrivate); + task_shell_content->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + task_shell_content, E_TYPE_TASK_SHELL_CONTENT, + ETaskShellContentPrivate); /* Postpone widget construction until we have a shell view. */ } diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index 99df3b6ab5..f152acf976 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -741,7 +741,9 @@ task_shell_sidebar_init (ETaskShellSidebar *task_shell_sidebar) (GDestroyNotify) g_free, (GDestroyNotify) g_object_unref); - task_shell_sidebar->priv = G_TYPE_INSTANCE_GET_PRIVATE (task_shell_sidebar, E_TYPE_TASK_SHELL_SIDEBAR, ETaskShellSidebarPrivate); + task_shell_sidebar->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + task_shell_sidebar, E_TYPE_TASK_SHELL_SIDEBAR, + ETaskShellSidebarPrivate); task_shell_sidebar->priv->client_table = client_table; diff --git a/modules/calendar/e-task-shell-view.c b/modules/calendar/e-task-shell-view.c index e4b5e03a5b..76410b3184 100644 --- a/modules/calendar/e-task-shell-view.c +++ b/modules/calendar/e-task-shell-view.c @@ -467,7 +467,9 @@ static void task_shell_view_init (ETaskShellView *task_shell_view, EShellViewClass *shell_view_class) { - task_shell_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (task_shell_view, E_TYPE_TASK_SHELL_VIEW, ETaskShellViewPrivate); + task_shell_view->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + task_shell_view, E_TYPE_TASK_SHELL_VIEW, + ETaskShellViewPrivate); e_task_shell_view_private_init (task_shell_view, shell_view_class); } -- cgit v1.2.3 From ba6a2343869f6be82f44261f183cd6925659d5ee Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 27 Mar 2011 15:16:39 -0400 Subject: Restore lockdown integration. With lockdown settings available through GSettings, widgets can handle lockdown integration themselves without having to use EShellSettings. Also fixed a few places where printing or save-to-disk actions were either not properly wired up or not responding to lockdown settings, but much more work needs done. Attachments, for example, are not honoring the disable-save-to-disk setting at all. This too requires the recently-added gsettings-desktop-schemas dependency. --- modules/calendar/e-cal-shell-view-actions.c | 37 ++++++++++++++++++++--------- modules/calendar/e-cal-shell-view-memopad.c | 23 ++++++++++++------ modules/calendar/e-cal-shell-view-taskpad.c | 23 ++++++++++++------ modules/calendar/e-memo-shell-content.c | 1 - modules/calendar/e-task-shell-content.c | 1 - 5 files changed, 58 insertions(+), 27 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c index 5e16b6db5b..ba72a41748 100644 --- a/modules/calendar/e-cal-shell-view-actions.c +++ b/modules/calendar/e-cal-shell-view-actions.c @@ -1467,13 +1467,6 @@ static GtkActionEntry calendar_entries[] = { NULL, /* XXX Add a tooltip! */ G_CALLBACK (action_event_reply_all_cb) }, - { "event-save-as", - GTK_STOCK_SAVE_AS, - N_("Save as iCalendar..."), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_event_save_as_cb) }, - { "event-schedule", NULL, N_("_Schedule Meeting..."), @@ -1587,10 +1580,6 @@ static EPopupActionEntry calendar_popup_entries[] = { NULL, "event-reply-all" }, - { "event-popup-save-as", - NULL, - "event-save-as" }, - { "event-popup-schedule", NULL, "event-schedule" }, @@ -1741,6 +1730,23 @@ static EPopupActionEntry lockdown_printing_popup_entries[] = { "event-print" } }; +static GtkActionEntry lockdown_save_to_disk_entries[] = { + + { "event-save-as", + GTK_STOCK_SAVE_AS, + N_("Save as iCalendar..."), + NULL, + NULL, /* XXX Add a tooltip! */ + G_CALLBACK (action_event_save_as_cb) }, +}; + +static EPopupActionEntry lockdown_save_to_disk_popup_entries[] = { + + { "event-popup-save-as", + NULL, + "event-save-as" }, +}; + void e_cal_shell_view_actions_init (ECalShellView *cal_shell_view) { @@ -1790,6 +1796,15 @@ e_cal_shell_view_actions_init (ECalShellView *cal_shell_view) action_group, lockdown_printing_popup_entries, G_N_ELEMENTS (lockdown_printing_popup_entries)); + /* Lockdown Save-to-Disk Actions */ + action_group = ACTION_GROUP (LOCKDOWN_SAVE_TO_DISK); + gtk_action_group_add_actions ( + action_group, lockdown_save_to_disk_entries, + G_N_ELEMENTS (lockdown_save_to_disk_entries), cal_shell_view); + e_action_group_add_popup_actions ( + action_group, lockdown_save_to_disk_popup_entries, + G_N_ELEMENTS (lockdown_save_to_disk_popup_entries)); + /* Fine tuning. */ action = ACTION (CALENDAR_GO_TODAY); diff --git a/modules/calendar/e-cal-shell-view-memopad.c b/modules/calendar/e-cal-shell-view-memopad.c index c4b67a88f4..2f625df75b 100644 --- a/modules/calendar/e-cal-shell-view-memopad.c +++ b/modules/calendar/e-cal-shell-view-memopad.c @@ -272,13 +272,6 @@ static GtkActionEntry calendar_memopad_entries[] = { NULL, NULL, /* XXX Add a tooltip! */ G_CALLBACK (action_calendar_memopad_open_url_cb) }, - - { "calendar-memopad-save-as", - GTK_STOCK_SAVE_AS, - N_("Save as iCalendar..."), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_calendar_memopad_save_as_cb) } }; static GtkActionEntry lockdown_printing_entries[] = { @@ -291,6 +284,16 @@ static GtkActionEntry lockdown_printing_entries[] = { G_CALLBACK (action_calendar_memopad_print_cb) } }; +static GtkActionEntry lockdown_save_to_disk_entries[] = { + + { "calendar-memopad-save-as", + GTK_STOCK_SAVE_AS, + N_("Save as iCalendar..."), + NULL, + NULL, /* XXX Add a tooltip! */ + G_CALLBACK (action_calendar_memopad_save_as_cb) } +}; + void e_cal_shell_view_memopad_actions_init (ECalShellView *cal_shell_view) { @@ -312,6 +315,12 @@ e_cal_shell_view_memopad_actions_init (ECalShellView *cal_shell_view) gtk_action_group_add_actions ( action_group, lockdown_printing_entries, G_N_ELEMENTS (lockdown_printing_entries), cal_shell_view); + + /* Lockdown Save-to-Disk Actions */ + action_group = ACTION_GROUP (LOCKDOWN_SAVE_TO_DISK); + gtk_action_group_add_actions ( + action_group, lockdown_save_to_disk_entries, + G_N_ELEMENTS (lockdown_save_to_disk_entries), cal_shell_view); } void diff --git a/modules/calendar/e-cal-shell-view-taskpad.c b/modules/calendar/e-cal-shell-view-taskpad.c index ead28ae351..8afff2c767 100644 --- a/modules/calendar/e-cal-shell-view-taskpad.c +++ b/modules/calendar/e-cal-shell-view-taskpad.c @@ -359,13 +359,6 @@ static GtkActionEntry calendar_taskpad_entries[] = { NULL, NULL, /* XXX Add a tooltip! */ G_CALLBACK (action_calendar_taskpad_open_url_cb) }, - - { "calendar-taskpad-save-as", - GTK_STOCK_SAVE_AS, - N_("_Save as iCalendar..."), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_calendar_taskpad_save_as_cb) } }; static GtkActionEntry lockdown_printing_entries[] = { @@ -378,6 +371,16 @@ static GtkActionEntry lockdown_printing_entries[] = { G_CALLBACK (action_calendar_taskpad_print_cb) } }; +static GtkActionEntry lockdown_save_to_disk_entries[] = { + + { "calendar-taskpad-save-as", + GTK_STOCK_SAVE_AS, + N_("_Save as iCalendar..."), + NULL, + NULL, /* XXX Add a tooltip! */ + G_CALLBACK (action_calendar_taskpad_save_as_cb) } +}; + void e_cal_shell_view_taskpad_actions_init (ECalShellView *cal_shell_view) { @@ -399,6 +402,12 @@ e_cal_shell_view_taskpad_actions_init (ECalShellView *cal_shell_view) gtk_action_group_add_actions ( action_group, lockdown_printing_entries, G_N_ELEMENTS (lockdown_printing_entries), cal_shell_view); + + /* Lockdown Save-to-Disk Actions */ + action_group = ACTION_GROUP (LOCKDOWN_SAVE_TO_DISK); + gtk_action_group_add_actions ( + action_group, lockdown_save_to_disk_entries, + G_N_ELEMENTS (lockdown_save_to_disk_entries), cal_shell_view); } void diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c index bbf12de7db..9e280e36ff 100644 --- a/modules/calendar/e-memo-shell-content.c +++ b/modules/calendar/e-memo-shell-content.c @@ -473,7 +473,6 @@ memo_shell_content_constructed (GObject *object) container = priv->paned; widget = e_cal_component_preview_new (); - e_shell_configure_web_view (shell, E_WEB_VIEW (widget)); gtk_widget_show (widget); g_signal_connect_swapped ( diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c index f2d10e4a4d..dbfa5fb7fc 100644 --- a/modules/calendar/e-task-shell-content.c +++ b/modules/calendar/e-task-shell-content.c @@ -469,7 +469,6 @@ task_shell_content_constructed (GObject *object) container = priv->paned; widget = e_cal_component_preview_new (); - e_shell_configure_web_view (shell, E_WEB_VIEW (widget)); gtk_widget_show (widget); g_signal_connect_swapped ( -- cgit v1.2.3 From 63c26d5712c807f65db9c1b0c98ca06aad76171a Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 27 Mar 2011 17:58:32 -0400 Subject: Miscellaneous GtkAction-related cleanups. Prefer the newer GtkAction "set" functions over g_object_set(). --- modules/calendar/e-cal-shell-view-actions.c | 14 +++++++------- modules/calendar/e-memo-shell-view.c | 2 +- modules/calendar/e-task-shell-view.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c index ba72a41748..ceeab0b8c3 100644 --- a/modules/calendar/e-cal-shell-view-actions.c +++ b/modules/calendar/e-cal-shell-view-actions.c @@ -1808,25 +1808,25 @@ e_cal_shell_view_actions_init (ECalShellView *cal_shell_view) /* Fine tuning. */ action = ACTION (CALENDAR_GO_TODAY); - g_object_set (action, "short-label", _("Today"), NULL); + gtk_action_set_short_label (action, _("Today")); action = ACTION (CALENDAR_JUMP_TO); - g_object_set (action, "short-label", _("Go To"), NULL); + gtk_action_set_short_label (action, _("Go To")); action = ACTION (CALENDAR_VIEW_DAY); - g_object_set (action, "is-important", TRUE, NULL); + gtk_action_set_is_important (action, TRUE); action = ACTION (CALENDAR_VIEW_LIST); - g_object_set (action, "is-important", TRUE, NULL); + gtk_action_set_is_important (action, TRUE); action = ACTION (CALENDAR_VIEW_MONTH); - g_object_set (action, "is-important", TRUE, NULL); + gtk_action_set_is_important (action, TRUE); action = ACTION (CALENDAR_VIEW_WEEK); - g_object_set (action, "is-important", TRUE, NULL); + gtk_action_set_is_important (action, TRUE); action = ACTION (CALENDAR_VIEW_WORKWEEK); - g_object_set (action, "is-important", TRUE, NULL); + gtk_action_set_is_important (action, TRUE); g_signal_connect ( ACTION (GAL_SAVE_CUSTOM_VIEW), "activate", diff --git a/modules/calendar/e-memo-shell-view.c b/modules/calendar/e-memo-shell-view.c index d0986e7a17..c6d620dd0d 100644 --- a/modules/calendar/e-memo-shell-view.c +++ b/modules/calendar/e-memo-shell-view.c @@ -223,7 +223,7 @@ memo_shell_view_update_actions (EShellView *shell_view) label = _("Delete Memos"); else label = _("Delete Memo"); - g_object_set (action, "label", label, NULL); + gtk_action_set_label (action, label); action = ACTION (MEMO_FIND); sensitive = single_memo_selected; diff --git a/modules/calendar/e-task-shell-view.c b/modules/calendar/e-task-shell-view.c index 76410b3184..fd4f762bc8 100644 --- a/modules/calendar/e-task-shell-view.c +++ b/modules/calendar/e-task-shell-view.c @@ -358,7 +358,7 @@ task_shell_view_update_actions (EShellView *shell_view) label = _("Delete Tasks"); else label = _("Delete Task"); - g_object_set (action, "label", label, NULL); + gtk_action_set_label (action, label); action = ACTION (TASK_FIND); sensitive = single_task_selected; -- cgit v1.2.3 From 8cd20682159f0e683cdd81af54611b9511f873a1 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 26 Apr 2011 09:20:50 -0400 Subject: Remove redundant EAccountList utilities. Kill itip_addresses_get() and itip_addresses_get_default(), and use e_get_account_list() and e_get_default_account() instead. --- modules/calendar/e-cal-shell-view-private.h | 1 + modules/calendar/e-cal-shell-view.c | 2 +- modules/calendar/e-memo-shell-migrate.c | 9 +++++---- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-view-private.h b/modules/calendar/e-cal-shell-view-private.h index 0f9235046c..b3b4092788 100644 --- a/modules/calendar/e-cal-shell-view-private.h +++ b/modules/calendar/e-cal-shell-view-private.h @@ -32,6 +32,7 @@ #include #include +#include "e-util/e-account-utils.h" #include "e-util/e-selection.h" #include "e-util/e-dialog-utils.h" #include "e-util/e-file-utils.h" diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index ce2e258441..b81b453bb0 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -474,7 +474,7 @@ cal_shell_view_update_actions (EShellView *shell_view) gtk_action_set_sensitive (action, sensitive); action = ACTION (EVENT_MEETING_NEW); - visible = itip_addresses_get_default () != NULL; + visible = e_get_default_account () != NULL; gtk_action_set_visible (action, visible); } diff --git a/modules/calendar/e-memo-shell-migrate.c b/modules/calendar/e-memo-shell-migrate.c index a41c4e1985..b760990f6b 100644 --- a/modules/calendar/e-memo-shell-migrate.c +++ b/modules/calendar/e-memo-shell-migrate.c @@ -24,12 +24,11 @@ #include #include #include -#include -#include #include #include #include +#include "e-util/e-account-utils.h" #include "calendar/gui/calendar-config-keys.h" #include "shell/e-shell.h" @@ -249,7 +248,9 @@ e_memo_shell_backend_migrate (EShellBackend *shell_backend, CamelURL *url; EIterator *it; GConfClient *gconf_client = gconf_client_get_default (); - al = e_account_list_new (gconf_client); + + al = e_get_account_list (); + for (it = e_list_get_iterator ((EList *)al); e_iterator_is_valid (it); e_iterator_next (it)) { @@ -260,7 +261,7 @@ e_memo_shell_backend_migrate (EShellBackend *shell_backend, add_gw_esource (source_list, a->name, _("Notes"), url, gconf_client); camel_url_free (url); } - g_object_unref (al); + g_object_unref (gconf_client); } -- cgit v1.2.3 From b8a932ae1e8b10344525ae2a5a78894e98ac2540 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 3 May 2011 10:45:46 -0400 Subject: Fix compiler warnings. Mostly dead assignments. --- modules/calendar/e-memo-shell-content.c | 4 ---- modules/calendar/e-task-shell-content.c | 2 -- 2 files changed, 6 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c index 9e280e36ff..f9224b1462 100644 --- a/modules/calendar/e-memo-shell-content.c +++ b/modules/calendar/e-memo-shell-content.c @@ -411,9 +411,7 @@ static void memo_shell_content_constructed (GObject *object) { EMemoShellContentPrivate *priv; - EShell *shell; EShellView *shell_view; - EShellBackend *shell_backend; EShellContent *shell_content; EShellTaskbar *shell_taskbar; EShellWindow *shell_window; @@ -431,10 +429,8 @@ memo_shell_content_constructed (GObject *object) shell_content = E_SHELL_CONTENT (object); shell_view = e_shell_content_get_shell_view (shell_content); - shell_backend = e_shell_view_get_shell_backend (shell_view); shell_taskbar = e_shell_view_get_shell_taskbar (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - shell = e_shell_backend_get_shell (shell_backend); priv->memo_model = e_cal_model_memos_new (); diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c index dbfa5fb7fc..b7937fb8f6 100644 --- a/modules/calendar/e-task-shell-content.c +++ b/modules/calendar/e-task-shell-content.c @@ -409,7 +409,6 @@ static void task_shell_content_constructed (GObject *object) { ETaskShellContentPrivate *priv; - EShell *shell; EShellContent *shell_content; EShellTaskbar *shell_taskbar; EShellWindow *shell_window; @@ -430,7 +429,6 @@ 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 (); -- cgit v1.2.3 From 4cfb84c573f21ca7519e24cff1c5742b715355c4 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 7 May 2011 12:22:36 -0400 Subject: Whitespace and coding style cleanups. --- modules/calendar/e-cal-shell-view-private.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c index 61aff5aa5c..412e5a2521 100644 --- a/modules/calendar/e-cal-shell-view-private.c +++ b/modules/calendar/e-cal-shell-view-private.c @@ -532,8 +532,10 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view) /* Give GnomeCalendar a handle to the date navigator, memo and task table. */ gnome_calendar_set_date_navigator (calendar, date_navigator); - gnome_calendar_set_memo_table (calendar, memo_table ? GTK_WIDGET (memo_table) : NULL); - gnome_calendar_set_task_table (calendar, task_table ? GTK_WIDGET (task_table) : NULL); + gnome_calendar_set_memo_table ( + calendar, memo_table ? GTK_WIDGET (memo_table) : NULL); + gnome_calendar_set_task_table ( + calendar, task_table ? GTK_WIDGET (task_table) : NULL); e_calendar_item_set_get_time_callback ( date_navigator->calitem, (ECalendarItemGetTimeCallback) -- cgit v1.2.3 From 8a186c3588d3598857c36e2122fa68d01eba30fd Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 8 May 2011 13:24:42 -0400 Subject: Coding style cleanups. --- modules/calendar/e-cal-shell-migrate.c | 2 +- modules/calendar/e-cal-shell-view.c | 2 +- modules/calendar/e-calendar-preferences.c | 4 ++-- modules/calendar/e-memo-shell-migrate.c | 4 ++-- modules/calendar/e-task-shell-migrate.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-migrate.c b/modules/calendar/e-cal-shell-migrate.c index 710aa8f2a2..791352206e 100644 --- a/modules/calendar/e-cal-shell-migrate.c +++ b/modules/calendar/e-cal-shell-migrate.c @@ -174,7 +174,7 @@ create_calendar_sources (EShellBackend *shell_backend, shell_settings, "cal-primary-calendar", e_source_peek_uid (source)); - link.data = (gpointer)e_source_peek_uid (source); + link.data = (gpointer) e_source_peek_uid (source); link.next = NULL; e_cal_shell_backend_set_selected_calendars ( diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index b81b453bb0..20f30c12c4 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -321,7 +321,7 @@ cal_shell_view_update_actions (EShellView *shell_view) /* Hide the New button on the toolbar. */ widget = e_shell_window_get_managed_widget ( shell_window, "/main-toolbar"); - widget = (GtkWidget *)gtk_toolbar_get_nth_item ( + widget = (GtkWidget *) gtk_toolbar_get_nth_item ( GTK_TOOLBAR (widget), 0); gtk_widget_hide (widget); diff --git a/modules/calendar/e-calendar-preferences.c b/modules/calendar/e-calendar-preferences.c index 9db9f4538b..328fba44f1 100644 --- a/modules/calendar/e-calendar-preferences.c +++ b/modules/calendar/e-calendar-preferences.c @@ -864,8 +864,8 @@ calendar_preferences_construct (ECalendarPreferences *prefs, /* Hook up and add the toplevel widget */ target = e_cal_config_target_new_prefs (ec); - e_config_set_target ((EConfig *)ec, (EConfigTarget *) target); - toplevel = e_config_create_widget ((EConfig *)ec); + e_config_set_target ((EConfig *) ec, (EConfigTarget *) target); + toplevel = e_config_create_widget ((EConfig *) ec); gtk_container_add (GTK_CONTAINER (prefs), toplevel); show_config (prefs); diff --git a/modules/calendar/e-memo-shell-migrate.c b/modules/calendar/e-memo-shell-migrate.c index b760990f6b..efe71f6632 100644 --- a/modules/calendar/e-memo-shell-migrate.c +++ b/modules/calendar/e-memo-shell-migrate.c @@ -129,7 +129,7 @@ create_memo_sources (EShellBackend *shell_backend, shell_settings, "cal-primary-memo-list", e_source_peek_uid (source)); - link.data = (gpointer)e_source_peek_uid (source); + link.data = (gpointer) e_source_peek_uid (source); link.next = NULL; e_memo_shell_backend_set_selected_memo_lists ( @@ -251,7 +251,7 @@ e_memo_shell_backend_migrate (EShellBackend *shell_backend, al = e_get_account_list (); - for (it = e_list_get_iterator ((EList *)al); + for (it = e_list_get_iterator ((EList *) al); e_iterator_is_valid (it); e_iterator_next (it)) { a = (EAccount *) e_iterator_get (it); diff --git a/modules/calendar/e-task-shell-migrate.c b/modules/calendar/e-task-shell-migrate.c index d7daafc91d..d9b5aa7af6 100644 --- a/modules/calendar/e-task-shell-migrate.c +++ b/modules/calendar/e-task-shell-migrate.c @@ -141,7 +141,7 @@ create_task_sources (EShellBackend *shell_backend, shell_settings, "cal-primary-task-list", e_source_peek_uid (source)); - link.data = (gpointer)e_source_peek_uid (source); + link.data = (gpointer) e_source_peek_uid (source); link.next = NULL; e_task_shell_backend_set_selected_task_lists ( -- cgit v1.2.3 From bd86dd54026ddae9d921adefb7055d8271afa89e Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 13 May 2011 16:55:33 +0200 Subject: Bug #243938 - Clicking on week numbers changes work week to week view --- modules/calendar/e-cal-shell-view-private.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c index 412e5a2521..29a743b6e2 100644 --- a/modules/calendar/e-cal-shell-view-private.c +++ b/modules/calendar/e-cal-shell-view-private.c @@ -92,7 +92,7 @@ cal_shell_view_date_navigator_selection_changed_cb (ECalShellView *cal_shell_vie icaltimezone *timezone; time_t start, end, new_time; gboolean starts_on_week_start_day; - gint new_days_shown; + gint new_days_shown, old_days_shown; gint week_start_day; cal_shell_content = cal_shell_view->priv->cal_shell_content; @@ -136,6 +136,9 @@ cal_shell_view_date_navigator_selection_changed_cb (ECalShellView *cal_shell_vie g_date_compare (&end_date, &new_end_date) == 0) return; + old_days_shown = + g_date_get_julian (&end_date) - + g_date_get_julian (&start_date) + 1; new_days_shown = g_date_get_julian (&new_end_date) - g_date_get_julian (&new_start_date) + 1; @@ -156,7 +159,10 @@ cal_shell_view_date_navigator_selection_changed_cb (ECalShellView *cal_shell_vie /* Switch views as appropriate, and change the number of * days or weeks shown. */ - if (new_days_shown > 9) { + if (view_type == GNOME_CAL_WORK_WEEK_VIEW && old_days_shown == new_days_shown) { + /* keep the work week view when has same days shown */ + switch_to = GNOME_CAL_WORK_WEEK_VIEW; + } else if (new_days_shown > 9) { if (view_type != GNOME_CAL_LIST_VIEW) { ECalendarView *calendar_view; -- cgit v1.2.3 From 8e15abac92213f2c8a37fc985a6625bfc1a70e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Vr=C3=A1til?= Date: Mon, 16 May 2011 16:10:00 +0200 Subject: Bug #649392 - Improve calendar's "Goto" dialog and move it to dialogs --- modules/calendar/e-cal-shell-view-private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-view-private.h b/modules/calendar/e-cal-shell-view-private.h index b3b4092788..52ec374295 100644 --- a/modules/calendar/e-cal-shell-view-private.h +++ b/modules/calendar/e-cal-shell-view-private.h @@ -50,11 +50,11 @@ #include "calendar/gui/e-day-view.h" #include "calendar/gui/e-week-view.h" #include "calendar/gui/gnome-cal.h" -#include "calendar/gui/goto.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" #include "calendar/gui/dialogs/memo-editor.h" #include "calendar/gui/dialogs/select-source-dialog.h" #include "calendar/gui/dialogs/task-editor.h" -- cgit v1.2.3 From cb97c2dc8fd97b381af048f206333d5e557892ae Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 21 May 2011 10:02:58 -0400 Subject: Coding style and whitespace cleanup. --- modules/calendar/e-cal-shell-view.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index 20f30c12c4..b325160ded 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -252,27 +252,31 @@ is_delegated (icalcomponent *icalcomp, const gchar *user_email) prop = get_attendee_prop (icalcomp, user_email); - if (prop) { - param = icalproperty_get_first_parameter (prop, ICAL_DELEGATEDTO_PARAMETER); - if (param) + if (prop != NULL) { + param = icalproperty_get_first_parameter ( + prop, ICAL_DELEGATEDTO_PARAMETER); + if (param != NULL) delto = icalparameter_get_delegatedto (param); } else return FALSE; prop = get_attendee_prop (icalcomp, itip_strip_mailto (delto)); - if (prop) { + if (prop != NULL) { const gchar *delfrom = NULL; icalparameter_partstat status = ICAL_PARTSTAT_NONE; - param = icalproperty_get_first_parameter (prop, ICAL_DELEGATEDFROM_PARAMETER); - if (param) + param = icalproperty_get_first_parameter ( + prop, ICAL_DELEGATEDFROM_PARAMETER); + if (param != NULL) delfrom = icalparameter_get_delegatedfrom (param); - param = icalproperty_get_first_parameter (prop, ICAL_PARTSTAT_PARAMETER); - if (param) + param = icalproperty_get_first_parameter ( + prop, ICAL_PARTSTAT_PARAMETER); + if (param != NULL) status = icalparameter_get_partstat (param); - if ((delfrom && *delfrom) && g_str_equal (itip_strip_mailto (delfrom), user_email) - && status != ICAL_PARTSTAT_DECLINED) + if ((delfrom != NULL && *delfrom != '\0') && + g_str_equal (itip_strip_mailto (delfrom), + user_email) && status != ICAL_PARTSTAT_DECLINED) return TRUE; } -- cgit v1.2.3 From 756c8abcb840b8da588031f4a0d7e1fc979fab70 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 27 May 2011 15:23:07 +0200 Subject: Bug #646109 - Fix use of include to make sure translations work --- modules/calendar/e-cal-attachment-handler.c | 4 ++++ modules/calendar/e-cal-config-calendar-item.c | 4 ++++ modules/calendar/e-cal-config-comp-editor.c | 4 ++++ modules/calendar/e-cal-config-date-edit.c | 4 ++++ modules/calendar/e-cal-config-hook.c | 4 ++++ modules/calendar/e-cal-config-meeting-store.c | 4 ++++ modules/calendar/e-cal-config-meeting-time-selector.c | 4 ++++ modules/calendar/e-cal-config-model.c | 4 ++++ modules/calendar/e-cal-config-view.c | 4 ++++ modules/calendar/e-cal-event-hook.c | 4 ++++ modules/calendar/e-cal-shell-backend.c | 4 ++++ modules/calendar/e-cal-shell-content.c | 4 ++++ modules/calendar/e-cal-shell-migrate.c | 4 ++++ modules/calendar/e-cal-shell-settings.c | 4 ++++ modules/calendar/e-cal-shell-sidebar.c | 4 ++++ modules/calendar/e-cal-shell-view-actions.c | 4 ++++ modules/calendar/e-cal-shell-view-memopad.c | 4 ++++ modules/calendar/e-cal-shell-view-private.c | 4 ++++ modules/calendar/e-cal-shell-view-taskpad.c | 4 ++++ modules/calendar/e-cal-shell-view.c | 4 ++++ modules/calendar/e-calendar-preferences.c | 5 ++++- modules/calendar/e-memo-shell-backend.c | 4 ++++ modules/calendar/e-memo-shell-content.c | 4 ++++ modules/calendar/e-memo-shell-migrate.c | 4 ++++ modules/calendar/e-memo-shell-sidebar.c | 4 ++++ modules/calendar/e-memo-shell-view-actions.c | 4 ++++ modules/calendar/e-memo-shell-view-private.c | 4 ++++ modules/calendar/e-memo-shell-view.c | 4 ++++ modules/calendar/e-task-shell-backend.c | 4 ++++ modules/calendar/e-task-shell-content.c | 4 ++++ modules/calendar/e-task-shell-migrate.c | 4 ++++ modules/calendar/e-task-shell-sidebar.c | 4 ++++ modules/calendar/e-task-shell-view-actions.c | 4 ++++ modules/calendar/e-task-shell-view-private.c | 4 ++++ modules/calendar/e-task-shell-view.c | 4 ++++ modules/calendar/evolution-module-calendar.c | 4 ++++ 36 files changed, 144 insertions(+), 1 deletion(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c index 14c9efbe4d..c1b03874ff 100644 --- a/modules/calendar/e-cal-attachment-handler.c +++ b/modules/calendar/e-cal-attachment-handler.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-cal-attachment-handler.h" #include diff --git a/modules/calendar/e-cal-config-calendar-item.c b/modules/calendar/e-cal-config-calendar-item.c index fba37b3820..09895c0a0e 100644 --- a/modules/calendar/e-cal-config-calendar-item.c +++ b/modules/calendar/e-cal-config-calendar-item.c @@ -16,6 +16,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-cal-config-calendar-item.h" #include diff --git a/modules/calendar/e-cal-config-comp-editor.c b/modules/calendar/e-cal-config-comp-editor.c index ba23a051e5..b522975bac 100644 --- a/modules/calendar/e-cal-config-comp-editor.c +++ b/modules/calendar/e-cal-config-comp-editor.c @@ -16,6 +16,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-cal-config-comp-editor.h" #include diff --git a/modules/calendar/e-cal-config-date-edit.c b/modules/calendar/e-cal-config-date-edit.c index 05a2947d7e..d59549764b 100644 --- a/modules/calendar/e-cal-config-date-edit.c +++ b/modules/calendar/e-cal-config-date-edit.c @@ -16,6 +16,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-cal-config-date-edit.h" #include diff --git a/modules/calendar/e-cal-config-hook.c b/modules/calendar/e-cal-config-hook.c index e3d9678168..80050fc0d0 100644 --- a/modules/calendar/e-cal-config-hook.c +++ b/modules/calendar/e-cal-config-hook.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-cal-config-hook.h" #include "e-util/e-config.h" diff --git a/modules/calendar/e-cal-config-meeting-store.c b/modules/calendar/e-cal-config-meeting-store.c index ba1a1077b3..f9a91dacd0 100644 --- a/modules/calendar/e-cal-config-meeting-store.c +++ b/modules/calendar/e-cal-config-meeting-store.c @@ -16,6 +16,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-cal-config-meeting-store.h" #include diff --git a/modules/calendar/e-cal-config-meeting-time-selector.c b/modules/calendar/e-cal-config-meeting-time-selector.c index fb03618cc8..23eef11ef5 100644 --- a/modules/calendar/e-cal-config-meeting-time-selector.c +++ b/modules/calendar/e-cal-config-meeting-time-selector.c @@ -16,6 +16,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-cal-config-meeting-time-selector.h" #include diff --git a/modules/calendar/e-cal-config-model.c b/modules/calendar/e-cal-config-model.c index 47a3ff6463..f42e4a9b66 100644 --- a/modules/calendar/e-cal-config-model.c +++ b/modules/calendar/e-cal-config-model.c @@ -16,6 +16,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-cal-config-model.h" #include diff --git a/modules/calendar/e-cal-config-view.c b/modules/calendar/e-cal-config-view.c index 60ee4a5690..ecc35871ca 100644 --- a/modules/calendar/e-cal-config-view.c +++ b/modules/calendar/e-cal-config-view.c @@ -16,6 +16,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-cal-config-view.h" #include diff --git a/modules/calendar/e-cal-event-hook.c b/modules/calendar/e-cal-event-hook.c index d90162ded7..67db069d82 100644 --- a/modules/calendar/e-cal-event-hook.c +++ b/modules/calendar/e-cal-event-hook.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-cal-event-hook.h" #include "e-util/e-event.h" diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index d0f97caae2..51ed54b810 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-cal-shell-backend.h" #include diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c index e35057bacb..e85f9201cc 100644 --- a/modules/calendar/e-cal-shell-content.c +++ b/modules/calendar/e-cal-shell-content.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-cal-shell-content.h" #include diff --git a/modules/calendar/e-cal-shell-migrate.c b/modules/calendar/e-cal-shell-migrate.c index 791352206e..3c9f79a309 100644 --- a/modules/calendar/e-cal-shell-migrate.c +++ b/modules/calendar/e-cal-shell-migrate.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-cal-shell-migrate.h" #include diff --git a/modules/calendar/e-cal-shell-settings.c b/modules/calendar/e-cal-shell-settings.c index 30fc1c4fa7..4d105bcf3d 100644 --- a/modules/calendar/e-cal-shell-settings.c +++ b/modules/calendar/e-cal-shell-settings.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-cal-shell-settings.h" #include diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index 9f9bc454e1..d49b143eef 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-cal-shell-sidebar.h" #include diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c index ceeab0b8c3..c82f0036f5 100644 --- a/modules/calendar/e-cal-shell-view-actions.c +++ b/modules/calendar/e-cal-shell-view-actions.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-util/e-alert-dialog.h" #include "e-cal-shell-view-private.h" diff --git a/modules/calendar/e-cal-shell-view-memopad.c b/modules/calendar/e-cal-shell-view-memopad.c index 2f625df75b..84d14cf09b 100644 --- a/modules/calendar/e-cal-shell-view-memopad.c +++ b/modules/calendar/e-cal-shell-view-memopad.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-cal-shell-view-private.h" /* Much of this file is based on e-memo-shell-view-actions.c. */ diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c index 29a743b6e2..1ae493c30d 100644 --- a/modules/calendar/e-cal-shell-view-private.c +++ b/modules/calendar/e-cal-shell-view-private.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-util/e-util-private.h" #include "e-cal-shell-view-private.h" diff --git a/modules/calendar/e-cal-shell-view-taskpad.c b/modules/calendar/e-cal-shell-view-taskpad.c index 8afff2c767..48fd850790 100644 --- a/modules/calendar/e-cal-shell-view-taskpad.c +++ b/modules/calendar/e-cal-shell-view-taskpad.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-cal-shell-view-private.h" /* Much of this file is based on e-task-shell-view-actions.c. */ diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index b325160ded..1706fa0a5f 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-cal-shell-view-private.h" static gpointer parent_class; diff --git a/modules/calendar/e-calendar-preferences.c b/modules/calendar/e-calendar-preferences.c index 328fba44f1..ec15e3c2d1 100644 --- a/modules/calendar/e-calendar-preferences.c +++ b/modules/calendar/e-calendar-preferences.c @@ -22,9 +22,12 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-calendar-preferences.h" -#include #include #include diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c index 488f300340..e99e3e2931 100644 --- a/modules/calendar/e-memo-shell-backend.c +++ b/modules/calendar/e-memo-shell-backend.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-memo-shell-backend.h" #include diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c index f9224b1462..5c964fc505 100644 --- a/modules/calendar/e-memo-shell-content.c +++ b/modules/calendar/e-memo-shell-content.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-memo-shell-content.h" #include diff --git a/modules/calendar/e-memo-shell-migrate.c b/modules/calendar/e-memo-shell-migrate.c index efe71f6632..f81af22f10 100644 --- a/modules/calendar/e-memo-shell-migrate.c +++ b/modules/calendar/e-memo-shell-migrate.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-memo-shell-migrate.h" #include diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index 4ad5d44ded..befe60cbc1 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-memo-shell-sidebar.h" #include diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c index 660ad09f5f..593031235d 100644 --- a/modules/calendar/e-memo-shell-view-actions.c +++ b/modules/calendar/e-memo-shell-view-actions.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-util/e-alert-dialog.h" #include "e-memo-shell-view-private.h" diff --git a/modules/calendar/e-memo-shell-view-private.c b/modules/calendar/e-memo-shell-view-private.c index f4049d7ce4..36f09fd954 100644 --- a/modules/calendar/e-memo-shell-view-private.c +++ b/modules/calendar/e-memo-shell-view-private.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-util/e-util-private.h" #include "e-memo-shell-view-private.h" diff --git a/modules/calendar/e-memo-shell-view.c b/modules/calendar/e-memo-shell-view.c index c6d620dd0d..6679b3436b 100644 --- a/modules/calendar/e-memo-shell-view.c +++ b/modules/calendar/e-memo-shell-view.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-memo-shell-view-private.h" static gpointer parent_class; diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c index 193f3bea23..b9f95b3a72 100644 --- a/modules/calendar/e-task-shell-backend.c +++ b/modules/calendar/e-task-shell-backend.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-task-shell-backend.h" #include diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c index b7937fb8f6..2287ee893c 100644 --- a/modules/calendar/e-task-shell-content.c +++ b/modules/calendar/e-task-shell-content.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-task-shell-content.h" #include diff --git a/modules/calendar/e-task-shell-migrate.c b/modules/calendar/e-task-shell-migrate.c index d9b5aa7af6..bf2d07ed8b 100644 --- a/modules/calendar/e-task-shell-migrate.c +++ b/modules/calendar/e-task-shell-migrate.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-task-shell-migrate.h" #include diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index f152acf976..098726af22 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-task-shell-sidebar.h" #include diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c index dce77b0af7..297120e29c 100644 --- a/modules/calendar/e-task-shell-view-actions.c +++ b/modules/calendar/e-task-shell-view-actions.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-util/e-alert-dialog.h" #include "e-task-shell-view-private.h" diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c index 5567cf9c6e..0ce8339849 100644 --- a/modules/calendar/e-task-shell-view-private.c +++ b/modules/calendar/e-task-shell-view-private.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-task-shell-view-private.h" #include "widgets/menus/gal-view-factory-etable.h" diff --git a/modules/calendar/e-task-shell-view.c b/modules/calendar/e-task-shell-view.c index fd4f762bc8..21004cc9ec 100644 --- a/modules/calendar/e-task-shell-view.c +++ b/modules/calendar/e-task-shell-view.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-task-shell-view-private.h" enum { diff --git a/modules/calendar/evolution-module-calendar.c b/modules/calendar/evolution-module-calendar.c index af972cfc7b..ebc11b6117 100644 --- a/modules/calendar/evolution-module-calendar.c +++ b/modules/calendar/evolution-module-calendar.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-cal-attachment-handler.h" #include "e-cal-config-hook.h" -- cgit v1.2.3 From 394e580dfdb04342c2e457ced400908e4dd5c88e Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 28 May 2011 10:18:56 -0400 Subject: Including directly is rarely needed. --- modules/calendar/e-cal-shell-migrate.h | 1 - modules/calendar/e-memo-shell-migrate.h | 1 - modules/calendar/e-task-shell-migrate.h | 1 - 3 files changed, 3 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-migrate.h b/modules/calendar/e-cal-shell-migrate.h index 359ca5ea22..6c021978a0 100644 --- a/modules/calendar/e-cal-shell-migrate.h +++ b/modules/calendar/e-cal-shell-migrate.h @@ -22,7 +22,6 @@ #ifndef E_CAL_SHELL_BACKEND_MIGRATE_H #define E_CAL_SHELL_BACKEND_MIGRATE_H -#include #include G_BEGIN_DECLS diff --git a/modules/calendar/e-memo-shell-migrate.h b/modules/calendar/e-memo-shell-migrate.h index ba163c6950..b75612539f 100644 --- a/modules/calendar/e-memo-shell-migrate.h +++ b/modules/calendar/e-memo-shell-migrate.h @@ -22,7 +22,6 @@ #ifndef E_MEMO_SHELL_BACKEND_MIGRATE_H #define E_MEMO_SHELL_BACKEND_MIGRATE_H -#include #include G_BEGIN_DECLS diff --git a/modules/calendar/e-task-shell-migrate.h b/modules/calendar/e-task-shell-migrate.h index 4cb91c9f4a..f33aa82fcc 100644 --- a/modules/calendar/e-task-shell-migrate.h +++ b/modules/calendar/e-task-shell-migrate.h @@ -22,7 +22,6 @@ #ifndef E_TASK_SHELL_BACKEND_MIGRATE_H #define E_TASK_SHELL_BACKEND_MIGRATE_H -#include #include G_BEGIN_DECLS -- cgit v1.2.3 From f014ab82c81078d60cb1df8c986305c2cc9948c2 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 4 Jun 2011 15:53:10 -0500 Subject: Coding style and whitespace cleanups. --- modules/calendar/e-cal-shell-view-private.c | 9 +++------ modules/calendar/e-cal-shell-view.c | 14 +++++++++----- modules/calendar/e-memo-shell-content.c | 3 ++- modules/calendar/e-task-shell-content.c | 3 ++- 4 files changed, 16 insertions(+), 13 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c index 1ae493c30d..c6c9fa5673 100644 --- a/modules/calendar/e-cal-shell-view-private.c +++ b/modules/calendar/e-cal-shell-view-private.c @@ -687,12 +687,9 @@ e_cal_shell_view_private_dispose (ECalShellView *cal_shell_view) ECalShellViewPrivate *priv = cal_shell_view->priv; gint i; - /* Calling calendar's save state from here, because it is too late in its dispose */ - if (priv->cal_shell_content) - e_cal_shell_content_save_state (priv->cal_shell_content); - - /* Calling calendar's save state from here, because it is too late in its dispose */ - if (priv->cal_shell_content) + /* Calling calendar's save state from here, + * because it is too late in its dispose. */ + if (priv->cal_shell_content != NULL) e_cal_shell_content_save_state (priv->cal_shell_content); DISPOSE (priv->cal_shell_backend); diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index 1706fa0a5f..1d7269cd55 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -235,15 +235,19 @@ get_attendee_prop (icalcomponent *icalcomp, const gchar *address) if (!(address && *address)) return NULL; - for (prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY); - prop; - prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) { + prop = icalcomponent_get_first_property ( + icalcomp, ICAL_ATTENDEE_PROPERTY); + + while (prop != NULL) { const gchar *attendee = icalproperty_get_attendee (prop); - if (g_str_equal (itip_strip_mailto (attendee), address)) { + if (g_str_equal (itip_strip_mailto (attendee), address)) return prop; - } + + prop = icalcomponent_get_next_property ( + icalcomp, ICAL_ATTENDEE_PROPERTY); } + return NULL; } diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c index 5c964fc505..9f7d0768b9 100644 --- a/modules/calendar/e-memo-shell-content.c +++ b/modules/calendar/e-memo-shell-content.c @@ -624,7 +624,8 @@ memo_shell_content_class_init (EMemoShellContentClass *class) shell_content_class = E_SHELL_CONTENT_CLASS (class); shell_content_class->check_state = memo_shell_content_check_state; - shell_content_class->focus_search_results = memo_shell_content_focus_search_results; + shell_content_class->focus_search_results = + memo_shell_content_focus_search_results; g_object_class_install_property ( object_class, diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c index 2287ee893c..0ffa6fb5a3 100644 --- a/modules/calendar/e-task-shell-content.c +++ b/modules/calendar/e-task-shell-content.c @@ -647,7 +647,8 @@ task_shell_content_class_init (ETaskShellContentClass *class) shell_content_class = E_SHELL_CONTENT_CLASS (class); shell_content_class->check_state = task_shell_content_check_state; - shell_content_class->focus_search_results = task_shell_content_focus_search_results; + shell_content_class->focus_search_results = + task_shell_content_focus_search_results; g_object_class_install_property ( object_class, -- cgit v1.2.3 From 38790d8478e906a5c59d0c4a5216f297f305bfeb Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 14 Jun 2011 08:54:20 +0200 Subject: Do not use deprecated EBook/ECal API --- modules/calendar/e-cal-attachment-handler.c | 99 +++++++++------- modules/calendar/e-cal-shell-backend.c | 113 +++++++++--------- modules/calendar/e-cal-shell-sidebar.c | 159 ++++++++++++------------- modules/calendar/e-cal-shell-sidebar.h | 8 +- modules/calendar/e-cal-shell-view-actions.c | 88 +++++++------- modules/calendar/e-cal-shell-view-memopad.c | 6 +- modules/calendar/e-cal-shell-view-private.c | 44 +++---- modules/calendar/e-cal-shell-view-private.h | 4 +- modules/calendar/e-cal-shell-view-taskpad.c | 10 +- modules/calendar/e-cal-shell-view.c | 12 +- modules/calendar/e-calendar-preferences.c | 2 +- modules/calendar/e-memo-shell-backend.c | 98 ++++++++-------- modules/calendar/e-memo-shell-content.c | 4 +- modules/calendar/e-memo-shell-sidebar.c | 161 ++++++++++++-------------- modules/calendar/e-memo-shell-sidebar.h | 8 +- modules/calendar/e-memo-shell-view-actions.c | 33 +++--- modules/calendar/e-memo-shell-view-private.c | 14 +-- modules/calendar/e-task-shell-backend.c | 96 +++++++-------- modules/calendar/e-task-shell-content.c | 8 +- modules/calendar/e-task-shell-sidebar.c | 167 +++++++++++++-------------- modules/calendar/e-task-shell-sidebar.h | 8 +- modules/calendar/e-task-shell-view-actions.c | 33 +++--- modules/calendar/e-task-shell-view-private.c | 44 +++---- modules/calendar/e-task-shell-view-private.h | 2 +- 24 files changed, 606 insertions(+), 615 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c index c1b03874ff..a2932a0d17 100644 --- a/modules/calendar/e-cal-attachment-handler.c +++ b/modules/calendar/e-cal-attachment-handler.c @@ -27,11 +27,10 @@ #include #include -#include +#include #include #include - -#include "calendar/common/authentication.h" +#include typedef struct _ImportContext ImportContext; @@ -40,9 +39,9 @@ struct _ECalAttachmentHandlerPrivate { }; struct _ImportContext { - ECal *client; + ECalClient *client; icalcomponent *component; - ECalSourceType source_type; + ECalClientSourceType source_type; }; static gpointer parent_class; @@ -110,12 +109,13 @@ attachment_handler_get_component (EAttachment *attachment) } static gboolean -attachment_handler_update_objects (ECal *client, +attachment_handler_update_objects (ECalClient *client, icalcomponent *component) { icalcomponent_kind kind; icalcomponent *vcalendar; gboolean success; + GError *error = NULL; kind = icalcomponent_isa (component); @@ -141,7 +141,10 @@ attachment_handler_update_objects (ECal *client, return FALSE; } - success = e_cal_receive_objects (client, vcalendar, NULL); + success = e_cal_client_receive_objects_sync (client, vcalendar, NULL, &error); + if (error) + g_debug ("%s: Failed to receive objects: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); icalcomponent_free (vcalendar); @@ -149,16 +152,23 @@ attachment_handler_update_objects (ECal *client, } static void -attachment_handler_import_event (ECal *client, - const GError *error, - EAttachment *attachment) +attachment_handler_import_event (GObject *source_object, GAsyncResult *result, gpointer user_data) { + EAttachment *attachment = user_data; + EClient *client = NULL; + GError *error = NULL; icalcomponent *component; icalcomponent *subcomponent; icalcompiter iter; - /* FIXME Notify the user somehow. */ - g_return_if_fail (error == NULL); + if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) + client = NULL; + + if (!client) { + g_debug ("%s: Failed to open '%s': %s", G_STRFUNC, e_source_peek_name (E_SOURCE (source_object)), error ? error->message : "Unknown error"); + g_object_unref (attachment); + return; + } component = attachment_handler_get_component (attachment); g_return_if_fail (component != NULL); @@ -182,23 +192,30 @@ attachment_handler_import_event (ECal *client, } /* XXX Do something with the return value. */ - attachment_handler_update_objects (client, component); + attachment_handler_update_objects (E_CAL_CLIENT (client), component); g_object_unref (attachment); g_object_unref (client); } static void -attachment_handler_import_todo (ECal *client, - const GError *error, - EAttachment *attachment) +attachment_handler_import_todo (GObject *source_object, GAsyncResult *result, gpointer user_data) { + EAttachment *attachment = user_data; + EClient *client = NULL; + GError *error = NULL; icalcomponent *component; icalcomponent *subcomponent; icalcompiter iter; - /* FIXME Notify the user somehow. */ - g_return_if_fail (error == NULL); + if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) + client = NULL; + + if (!client) { + g_debug ("%s: Failed to open '%s': %s", G_STRFUNC, e_source_peek_name (E_SOURCE (source_object)), error ? error->message : "Unknown error"); + g_object_unref (attachment); + return; + } component = attachment_handler_get_component (attachment); g_return_if_fail (component != NULL); @@ -222,7 +239,7 @@ attachment_handler_import_todo (ECal *client, } /* XXX Do something with the return value. */ - attachment_handler_update_objects (client, component); + attachment_handler_update_objects (E_CAL_CLIENT (client), component); g_object_unref (attachment); g_object_unref (client); @@ -237,27 +254,25 @@ attachment_handler_row_activated_cb (GtkDialog *dialog) static void attachment_handler_run_dialog (GtkWindow *parent, EAttachment *attachment, - ECalSourceType source_type, + ECalClientSourceType source_type, const gchar *title) { GtkWidget *dialog; GtkWidget *container; GtkWidget *widget; - GCallback callback; ESourceSelector *selector; ESourceList *source_list; ESource *source; - ECal *client; icalcomponent *component; GError *error = NULL; component = attachment_handler_get_component (attachment); g_return_if_fail (component != NULL); - e_cal_get_sources (&source_list, source_type, &error); + e_cal_client_get_sources (&source_list, source_type, &error); if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); + g_debug ("%s: Faield to get cal sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); return; } @@ -309,22 +324,22 @@ attachment_handler_run_dialog (GtkWindow *parent, if (source == NULL) goto exit; - client = e_auth_new_cal_from_source (source, source_type); - if (client == NULL) - goto exit; - - if (source_type == E_CAL_SOURCE_TYPE_EVENT) - callback = G_CALLBACK (attachment_handler_import_event); - else if (source_type == E_CAL_SOURCE_TYPE_TODO) - callback = G_CALLBACK (attachment_handler_import_todo); - else - goto exit; - - g_object_ref (attachment); - g_signal_connect (client, "cal-opened-ex", callback, attachment); - e_cal_open_async (client, FALSE); + switch (source_type) { + 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; + default: + break; + } -exit: + exit: gtk_widget_destroy (dialog); } @@ -348,7 +363,7 @@ attachment_handler_import_to_calendar (GtkAction *action, attachment_handler_run_dialog ( parent, attachment, - E_CAL_SOURCE_TYPE_EVENT, + E_CAL_CLIENT_SOURCE_TYPE_EVENTS, _("Select a Calendar")); g_object_unref (attachment); @@ -375,7 +390,7 @@ attachment_handler_import_to_tasks (GtkAction *action, attachment_handler_run_dialog ( parent, attachment, - E_CAL_SOURCE_TYPE_TODO, + E_CAL_CLIENT_SOURCE_TYPE_TASKS, _("Select a Task List")); g_object_unref (attachment); diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 51ed54b810..8d0c6ef36a 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -27,11 +27,12 @@ #include #include -#include +#include #include #include #include #include +#include #include "e-util/e-import.h" #include "shell/e-shell.h" @@ -39,7 +40,6 @@ #include "shell/e-shell-window.h" #include "widgets/misc/e-preferences-window.h" -#include "calendar/common/authentication.h" #include "calendar/gui/comp-util.h" #include "calendar/gui/dialogs/calendar-setup.h" #include "calendar/gui/dialogs/event-editor.h" @@ -85,6 +85,7 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend) const gchar *name; gchar *property; gboolean save_list = FALSE; + GError *error = NULL; birthdays = NULL; personal = NULL; @@ -94,10 +95,11 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend) shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - if (!e_cal_get_sources ( + if (!e_cal_client_get_sources ( &cal_shell_backend->priv->source_list, - E_CAL_SOURCE_TYPE_EVENT, NULL)) { - g_warning ("Could not get calendar sources from GConf!"); + E_CAL_CLIENT_SOURCE_TYPE_EVENTS, &error)) { + g_debug ("%s: Could not get calendar sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); return; } @@ -234,20 +236,31 @@ cal_shell_backend_new_event (ESource *source, CompEditorFlags flags, gboolean all_day) { - ECal *cal; + EClient *client = NULL; + ECalClient *cal_client; ECalComponent *comp; EShellSettings *shell_settings; CompEditor *editor; + GError *error = NULL; /* XXX Handle errors better. */ - cal = e_load_cal_source_finish (source, result, NULL); - g_return_if_fail (E_IS_CAL (cal)); + if (!e_client_utils_open_new_finish (source, result, &client, &error)) + client = NULL; + + if (!client) { + g_debug ("%s: Failed to open '%s': %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); + g_clear_error (&error); + return; + } + + g_return_if_fail (E_IS_CAL_CLIENT (client)); + cal_client = E_CAL_CLIENT (client); shell_settings = e_shell_get_shell_settings (shell); - editor = event_editor_new (cal, shell, flags); + editor = event_editor_new (cal_client, shell, flags); comp = cal_comp_event_new_with_current_time ( - cal, all_day, + cal_client, all_day, e_shell_settings_get_pointer ( shell_settings, "cal-timezone"), e_shell_settings_get_boolean ( @@ -262,13 +275,11 @@ cal_shell_backend_new_event (ESource *source, gtk_window_present (GTK_WINDOW (editor)); g_object_unref (comp); - g_object_unref (cal); + g_object_unref (client); } static void -cal_shell_backend_event_new_cb (ESource *source, - GAsyncResult *result, - EShell *shell) +cal_shell_backend_event_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) { CompEditorFlags flags = 0; gboolean all_day = FALSE; @@ -276,15 +287,13 @@ cal_shell_backend_event_new_cb (ESource *source, flags |= COMP_EDITOR_NEW_ITEM; flags |= COMP_EDITOR_USER_ORG; - cal_shell_backend_new_event (source, result, shell, flags, all_day); + cal_shell_backend_new_event (E_SOURCE (source_object), result, shell, flags, all_day); g_object_unref (shell); } static void -cal_shell_backend_event_all_day_new_cb (ESource *source, - GAsyncResult *result, - EShell *shell) +cal_shell_backend_event_all_day_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) { CompEditorFlags flags = 0; gboolean all_day = TRUE; @@ -292,15 +301,13 @@ cal_shell_backend_event_all_day_new_cb (ESource *source, flags |= COMP_EDITOR_NEW_ITEM; flags |= COMP_EDITOR_USER_ORG; - cal_shell_backend_new_event (source, result, shell, flags, all_day); + cal_shell_backend_new_event (E_SOURCE (source_object), result, shell, flags, all_day); g_object_unref (shell); } static void -cal_shell_backend_event_meeting_new_cb (ESource *source, - GAsyncResult *result, - EShell *shell) +cal_shell_backend_event_meeting_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) { CompEditorFlags flags = 0; gboolean all_day = FALSE; @@ -309,7 +316,7 @@ cal_shell_backend_event_meeting_new_cb (ESource *source, flags |= COMP_EDITOR_USER_ORG; flags |= COMP_EDITOR_MEETING; - cal_shell_backend_new_event (source, result, shell, flags, all_day); + cal_shell_backend_new_event (E_SOURCE (source_object), result, shell, flags, all_day); g_object_unref (shell); } @@ -324,7 +331,7 @@ action_event_new_cb (GtkAction *action, EShellSettings *shell_settings; ESource *source = NULL; ESourceList *source_list; - ECalSourceType source_type; + EClientSourceType source_type; const gchar *action_name; gchar *uid; @@ -361,7 +368,7 @@ action_event_new_cb (GtkAction *action, /* This callback is used for both appointments and meetings. */ - source_type = E_CAL_SOURCE_TYPE_EVENT; + source_type = E_CLIENT_SOURCE_TYPE_EVENTS; shell = e_shell_window_get_shell (shell_window); shell_settings = e_shell_get_shell_settings (shell); @@ -387,26 +394,17 @@ action_event_new_cb (GtkAction *action, * FIXME Need to obtain a better default time zone. */ action_name = gtk_action_get_name (action); if (strcmp (action_name, "event-all-day-new") == 0) - e_load_cal_source_async ( - source, source_type, NULL, - GTK_WINDOW (shell_window), - NULL, (GAsyncReadyCallback) - cal_shell_backend_event_all_day_new_cb, - g_object_ref (shell)); + 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_load_cal_source_async ( - source, source_type, NULL, - GTK_WINDOW (shell_window), - NULL, (GAsyncReadyCallback) - cal_shell_backend_event_meeting_new_cb, - g_object_ref (shell)); + 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_load_cal_source_async ( - source, source_type, NULL, - GTK_WINDOW (shell_window), - NULL, (GAsyncReadyCallback) - cal_shell_backend_event_new_cb, - g_object_ref (shell)); + 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); } @@ -489,11 +487,11 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend, EShellSettings *shell_settings; CompEditor *editor; CompEditorFlags flags = 0; - ECal *client; + ECalClient *client; ECalComponent *comp; ESource *source; ESourceList *source_list; - ECalSourceType source_type; + ECalClientSourceType source_type; EUri *euri; icalcomponent *icalcomp; icalproperty *icalprop; @@ -507,7 +505,7 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend, gboolean handled = FALSE; GError *error = NULL; - source_type = E_CAL_SOURCE_TYPE_EVENT; + source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENTS; shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); @@ -589,24 +587,23 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend, * we successfully open it is another matter... */ handled = TRUE; - if (!e_cal_get_sources (&source_list, source_type, NULL)) { - g_printerr ("Could not get calendar sources from GConf!\n"); + if (!e_cal_client_get_sources (&source_list, source_type, &error)) { + g_debug ("%s: Could not get calendar sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); goto exit; } source = e_source_list_peek_source_by_uid (source_list, source_uid); if (source == NULL) { - g_printerr ("No source for UID '%s'\n", source_uid); + g_debug ("%s: No source for UID '%s'", G_STRFUNC, source_uid); g_object_unref (source_list); goto exit; } - client = e_auth_new_cal_from_source (source, source_type); - if (client == NULL || !e_cal_open (client, TRUE, &error)) { - if (error != NULL) { - g_printerr ("%s\n", error->message); - g_error_free (error); - } + client = e_cal_client_new (source, source_type, &error); + if (client == NULL || !e_client_open_sync (E_CLIENT (client), TRUE, NULL, &error)) { + g_debug ("%s: Failed to create/open client '%s': %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); + g_clear_error (&error); g_object_unref (source_list); goto exit; } @@ -619,10 +616,10 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend, if (editor != NULL) goto present; - if (!e_cal_get_object (client, comp_uid, comp_rid, &icalcomp, &error)) { - g_printerr ("%s\n", error->message); + if (!e_cal_client_get_object_sync (client, comp_uid, comp_rid, &icalcomp, NULL, &error)) { + g_debug ("%s: Failed to get object from client: %s", G_STRFUNC, error ? error->message : "Unknown error"); g_object_unref (source_list); - g_error_free (error); + g_clear_error (&error); goto exit; } diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index d49b143eef..8e3010ddb7 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -27,12 +27,12 @@ #include #include +#include #include "e-util/e-alert-dialog.h" #include "e-util/gconf-bridge.h" #include "widgets/misc/e-paned.h" -#include "calendar/common/authentication.h" #include "calendar/gui/e-calendar-selector.h" #include "calendar/gui/misc.h" #include "calendar/gui/dialogs/calendar-setup.h" @@ -56,7 +56,7 @@ struct _ECalShellSidebarPrivate { * opened. So the user first highlights a source, then * sometime later we update our default-client property * which is bound by an EBinding to ECalModel. */ - ECal *default_client; + ECalClient *default_client; GCancellable *loading_default_client; }; @@ -81,7 +81,7 @@ static GType cal_shell_sidebar_type; static void cal_shell_sidebar_emit_client_added (ECalShellSidebar *cal_shell_sidebar, - ECal *client) + ECalClient *client) { guint signal_id = signals[CLIENT_ADDED]; @@ -90,7 +90,7 @@ cal_shell_sidebar_emit_client_added (ECalShellSidebar *cal_shell_sidebar, static void cal_shell_sidebar_emit_client_removed (ECalShellSidebar *cal_shell_sidebar, - ECal *client) + ECalClient *client) { guint signal_id = signals[CLIENT_REMOVED]; @@ -108,7 +108,7 @@ cal_shell_sidebar_emit_status_message (ECalShellSidebar *cal_shell_sidebar, static void cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar, - ECal *client) + ECalClient *client) { EShellView *shell_view; EShellContent *shell_content; @@ -123,7 +123,7 @@ cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar, shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_content = e_shell_view_get_shell_content (shell_view); - source = e_cal_get_source (client); + source = e_client_get_source (E_CLIENT (client)); uid = e_source_peek_uid (source); g_object_ref (source); @@ -141,7 +141,7 @@ cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar, static void cal_shell_sidebar_backend_error_cb (ECalShellSidebar *cal_shell_sidebar, const gchar *message, - ECal *client) + ECalClient *client) { EShellView *shell_view; EShellContent *shell_content; @@ -153,7 +153,7 @@ cal_shell_sidebar_backend_error_cb (ECalShellSidebar *cal_shell_sidebar, shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_content = e_shell_view_get_shell_content (shell_view); - source = e_cal_get_source (client); + source = e_client_get_source (E_CLIENT (client)); source_group = e_source_peek_group (source); e_alert_submit ( @@ -164,38 +164,43 @@ cal_shell_sidebar_backend_error_cb (ECalShellSidebar *cal_shell_sidebar, } static void -cal_shell_sidebar_client_opened_cb (ECalShellSidebar *cal_shell_sidebar, - const GError *error, - ECal *client) +cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { + ECalClient *client = E_CAL_CLIENT (source_object); + ECalShellSidebar *cal_shell_sidebar = user_data; EShellView *shell_view; EShellContent *shell_content; EShellSidebar *shell_sidebar; const gchar *message; + GError *error = NULL; shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_content = e_shell_view_get_shell_content (shell_view); - if (g_error_matches (error, E_CALENDAR_ERROR, - E_CALENDAR_STATUS_AUTHENTICATION_FAILED) || - g_error_matches (error, E_CALENDAR_ERROR, - E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED)) - e_auth_cal_forget_password (client); + e_client_open_finish (E_CLIENT (client), result, &error); + + 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, NULL, cal_shell_sidebar_client_opened_cb, user_data); + g_clear_error (&error); + return; + } /* Handle errors. */ - switch (error ? error->code : E_CALENDAR_STATUS_OK) { - case E_CALENDAR_STATUS_OK: + switch ((error && error->domain == E_CLIENT_ERROR) ? error->code : -1) { + case -1: break; - case E_CALENDAR_STATUS_AUTHENTICATION_FAILED: - e_cal_open_async (client, FALSE); - return; - - case E_CALENDAR_STATUS_BUSY: + case E_CLIENT_ERROR_BUSY: + g_debug ("%s: Cannot open '%s', it's busy (%s)", G_STRFUNC, e_source_peek_name (e_client_get_source (E_CLIENT (client))), error->message); + g_clear_error (&error); return; - case E_CALENDAR_STATUS_REPOSITORY_OFFLINE: + case E_CLIENT_ERROR_REPOSITORY_OFFLINE: e_alert_submit ( E_ALERT_SINK (shell_content), "calendar:prompt-no-contents-offline-calendar", @@ -203,7 +208,7 @@ cal_shell_sidebar_client_opened_cb (ECalShellSidebar *cal_shell_sidebar, /* fall through */ default: - if (error->code != E_CALENDAR_STATUS_REPOSITORY_OFFLINE) { + if (error->code != E_CLIENT_ERROR_REPOSITORY_OFFLINE) { e_alert_submit ( E_ALERT_SINK (shell_content), "calendar:failed-open-calendar", @@ -212,15 +217,12 @@ cal_shell_sidebar_client_opened_cb (ECalShellSidebar *cal_shell_sidebar, e_cal_shell_sidebar_remove_source ( cal_shell_sidebar, - e_cal_get_source (client)); + e_client_get_source (E_CLIENT (client))); + g_clear_error (&error); return; } - g_assert (error == NULL); - - g_signal_handlers_disconnect_matched ( - client, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, - cal_shell_sidebar_client_opened_cb, NULL); + g_clear_error (&error); message = _("Loading calendars"); cal_shell_sidebar_emit_status_message (cal_shell_sidebar, message); @@ -229,27 +231,31 @@ cal_shell_sidebar_client_opened_cb (ECalShellSidebar *cal_shell_sidebar, } static void -cal_shell_sidebar_default_loaded_cb (ESource *source, - GAsyncResult *result, - EShellSidebar *shell_sidebar) +cal_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { + EShellSidebar *shell_sidebar = user_data; ECalShellSidebarPrivate *priv; EShellContent *shell_content; EShellView *shell_view; - ECal *client; + ECalShellContent *cal_shell_content; + ECalModel *model; + EClient *client = NULL; GError *error = NULL; priv = E_CAL_SHELL_SIDEBAR (shell_sidebar)->priv; shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_content = e_shell_view_get_shell_content (shell_view); + cal_shell_content = E_CAL_SHELL_CONTENT (shell_content); + model = e_cal_shell_content_get_model (cal_shell_content); - client = e_load_cal_source_finish (source, result, &error); + if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) + client = NULL; - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) || + g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) { g_error_free (error); goto exit; - } else if (error != NULL) { e_alert_submit ( E_ALERT_SINK (shell_content), @@ -259,16 +265,18 @@ cal_shell_sidebar_default_loaded_cb (ESource *source, goto exit; } - g_return_if_fail (E_IS_CAL (client)); + g_return_if_fail (E_IS_CAL_CLIENT (client)); if (priv->default_client != NULL) g_object_unref (priv->default_client); - priv->default_client = client; + priv->default_client = E_CAL_CLIENT (client); + + e_cal_client_set_default_timezone (priv->default_client, e_cal_model_get_timezone (model)); g_object_notify (G_OBJECT (shell_sidebar), "default-client"); -exit: + exit: g_object_unref (shell_sidebar); } @@ -279,29 +287,18 @@ cal_shell_sidebar_set_default (ECalShellSidebar *cal_shell_sidebar, ECalShellSidebarPrivate *priv; EShellView *shell_view; EShellWindow *shell_window; - EShellContent *shell_content; EShellSidebar *shell_sidebar; - ECalShellContent *cal_shell_content; - ECalSourceType source_type; - ECalModel *model; - ECal *client; - icaltimezone *timezone; + ECalClient *client; const gchar *uid; priv = cal_shell_sidebar->priv; - source_type = E_CAL_SOURCE_TYPE_EVENT; /* 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_content = e_shell_view_get_shell_content (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - cal_shell_content = E_CAL_SHELL_CONTENT (shell_content); - model = e_cal_shell_content_get_model (cal_shell_content); - timezone = e_cal_model_get_timezone (model); - /* Cancel any unfinished previous request. */ if (priv->loading_default_client != NULL) { g_cancellable_cancel (priv->loading_default_client); @@ -324,11 +321,9 @@ cal_shell_sidebar_set_default (ECalShellSidebar *cal_shell_sidebar, priv->loading_default_client = g_cancellable_new (); - e_load_cal_source_async ( - source, source_type, timezone, - GTK_WINDOW (shell_window), priv->loading_default_client, - (GAsyncReadyCallback) cal_shell_sidebar_default_loaded_cb, - g_object_ref (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)); } static void @@ -702,7 +697,7 @@ cal_shell_sidebar_check_state (EShellSidebar *shell_sidebar) source = e_source_selector_get_primary_selection (selector); if (source != NULL) { - ECal *client; + ECalClient *client; const gchar *uri; const gchar *delete; @@ -717,7 +712,7 @@ cal_shell_sidebar_check_state (EShellSidebar *shell_sidebar) cal_shell_sidebar->priv->client_table, e_source_peek_uid (source)); refresh_supported = - client && e_cal_get_refresh_supported (client); + client && e_client_check_refresh_supported (E_CLIENT (client)); } if (source != NULL) @@ -734,7 +729,7 @@ cal_shell_sidebar_check_state (EShellSidebar *shell_sidebar) static void cal_shell_sidebar_client_removed (ECalShellSidebar *cal_shell_sidebar, - ECal *client) + ECalClient *client) { ESourceSelector *selector; GHashTable *client_table; @@ -748,7 +743,7 @@ cal_shell_sidebar_client_removed (ECalShellSidebar *cal_shell_sidebar, client, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, cal_shell_sidebar); - source = e_cal_get_source (client); + source = e_client_get_source (E_CLIENT (client)); uid = e_source_peek_uid (source); g_return_if_fail (uid != NULL); @@ -793,9 +788,9 @@ cal_shell_sidebar_class_init (ECalShellSidebarClass *class) PROP_DEFAULT_CLIENT, g_param_spec_object ( "default-client", - "Default Calendar Client", + "Default Calendar ECalClient", "Default client for calendar operations", - E_TYPE_CAL, + E_TYPE_CAL_CLIENT, G_PARAM_READABLE)); g_object_class_install_property ( @@ -816,7 +811,7 @@ cal_shell_sidebar_class_init (ECalShellSidebarClass *class) NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, - E_TYPE_CAL); + E_TYPE_CAL_CLIENT); signals[CLIENT_REMOVED] = g_signal_new ( "client-removed", @@ -826,7 +821,7 @@ cal_shell_sidebar_class_init (ECalShellSidebarClass *class) NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, - E_TYPE_CAL); + E_TYPE_CAL_CLIENT); signals[STATUS_MESSAGE] = g_signal_new ( "status-message", @@ -917,7 +912,7 @@ e_cal_shell_sidebar_get_date_navigator (ECalShellSidebar *cal_shell_sidebar) return E_CALENDAR (cal_shell_sidebar->priv->date_navigator); } -ECal * +ECalClient * e_cal_shell_sidebar_get_default_client (ECalShellSidebar *cal_shell_sidebar) { g_return_val_if_fail ( @@ -943,12 +938,12 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar, EShellContent *shell_content; EShellSidebar *shell_sidebar; ECalShellContent *cal_shell_content; - ECalSourceType source_type; + ECalClientSourceType source_type; ESourceSelector *selector; GHashTable *client_table; ECalModel *model; - ECal *default_client; - ECal *client; + ECalClient *default_client; + ECalClient *client; icaltimezone *timezone; const gchar *uid; const gchar *uri; @@ -957,7 +952,7 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar, g_return_if_fail (E_IS_CAL_SHELL_SIDEBAR (cal_shell_sidebar)); g_return_if_fail (E_IS_SOURCE (source)); - source_type = E_CAL_SOURCE_TYPE_EVENT; + source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENTS; client_table = cal_shell_sidebar->priv->client_table; default_client = cal_shell_sidebar->priv->default_client; selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar); @@ -972,15 +967,18 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar, ESource *default_source; const gchar *default_uid; - default_source = e_cal_get_source (default_client); + default_source = e_client_get_source (E_CLIENT (default_client)); default_uid = e_source_peek_uid (default_source); if (g_strcmp0 (uid, default_uid) == 0) client = g_object_ref (default_client); } - if (client == NULL) - client = e_auth_new_cal_from_source (source, source_type); + 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); @@ -997,17 +995,12 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar, g_hash_table_insert (client_table, g_strdup (uid), client); e_source_selector_select_source (selector, source); - uri = e_cal_get_uri (client); + uri = e_client_get_uri (E_CLIENT (client)); /* Translators: The string field is a URI. */ message = g_strdup_printf (_("Opening calendar at %s"), uri); cal_shell_sidebar_emit_status_message (cal_shell_sidebar, message); g_free (message); - g_signal_connect_swapped ( - client, "cal-opened-ex", - G_CALLBACK (cal_shell_sidebar_client_opened_cb), - 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); @@ -1018,8 +1011,8 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar, model = e_cal_shell_content_get_model (cal_shell_content); timezone = e_cal_model_get_timezone (model); - e_cal_set_default_timezone (client, timezone, NULL); - e_cal_open_async (client, FALSE); + e_cal_client_set_default_timezone (client, timezone); + e_client_open (E_CLIENT (client), FALSE, NULL, cal_shell_sidebar_client_opened_cb, cal_shell_sidebar); } void @@ -1027,7 +1020,7 @@ e_cal_shell_sidebar_remove_source (ECalShellSidebar *cal_shell_sidebar, ESource *source) { GHashTable *client_table; - ECal *client; + ECalClient *client; const gchar *uid; g_return_if_fail (E_IS_CAL_SHELL_SIDEBAR (cal_shell_sidebar)); diff --git a/modules/calendar/e-cal-shell-sidebar.h b/modules/calendar/e-cal-shell-sidebar.h index 6919d7ab52..3e4d00a87f 100644 --- a/modules/calendar/e-cal-shell-sidebar.h +++ b/modules/calendar/e-cal-shell-sidebar.h @@ -22,7 +22,7 @@ #ifndef E_CAL_SHELL_SIDEBAR_H #define E_CAL_SHELL_SIDEBAR_H -#include +#include #include #include @@ -71,9 +71,9 @@ struct _ECalShellSidebarClass { /* Signals */ void (*client_added) (ECalShellSidebar *cal_shell_sidebar, - ECal *client); + ECalClient *client); void (*client_removed) (ECalShellSidebar *cal_shell_sidebar, - ECal *client); + ECalClient *client); void (*status_message) (ECalShellSidebar *cal_shell_sidebar, const gchar *status_message); }; @@ -86,7 +86,7 @@ GList * e_cal_shell_sidebar_get_clients (ECalShellSidebar *cal_shell_sidebar); ECalendar * e_cal_shell_sidebar_get_date_navigator (ECalShellSidebar *cal_shell_sidebar); -ECal * e_cal_shell_sidebar_get_default_client +ECalClient * e_cal_shell_sidebar_get_default_client (ECalShellSidebar *cal_shell_sidebar); ESourceSelector * e_cal_shell_sidebar_get_selector diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c index c82f0036f5..6537cde8b4 100644 --- a/modules/calendar/e-cal-shell-view-actions.c +++ b/modules/calendar/e-cal-shell-view-actions.c @@ -51,7 +51,7 @@ action_calendar_copy_cb (GtkAction *action, copy_source_dialog ( GTK_WINDOW (shell_window), - source, E_CAL_SOURCE_TYPE_EVENT); + source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS); } static void @@ -67,7 +67,7 @@ action_calendar_delete_cb (GtkAction *action, GnomeCalendarViewType view_type; GnomeCalendar *calendar; ECalModel *model; - ECal *client; + ECalClient *client; ESourceSelector *selector; ESourceGroup *source_group; ESourceList *source_list; @@ -102,14 +102,14 @@ action_calendar_delete_cb (GtkAction *action, uri = e_source_get_uri (source); client = e_cal_model_get_client_for_uri (model, uri); if (client == NULL) - client = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_EVENT); + client = e_cal_client_new_from_uri (uri, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL); g_free (uri); g_return_if_fail (client != NULL); - if (!e_cal_remove (client, &error)) { - g_warning ("%s", error->message); - g_error_free (error); + if (!e_client_remove_sync (E_CLIENT (client), NULL, &error)) { + g_debug ("%s: Failed to remove client: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); return; } @@ -125,8 +125,8 @@ action_calendar_delete_cb (GtkAction *action, source_list = e_cal_shell_backend_get_source_list ( E_CAL_SHELL_BACKEND (shell_backend)); if (!e_source_list_sync (source_list, &error)) { - g_warning ("%s", error->message); - g_error_free (error); + g_debug ("%s: Failed to sync source list: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); } } @@ -362,7 +362,7 @@ action_calendar_refresh_cb (GtkAction *action, ECalShellContent *cal_shell_content; ECalShellSidebar *cal_shell_sidebar; ESourceSelector *selector; - ECal *client; + ECalClient *client; ECalModel *model; ESource *source; gchar *uri; @@ -384,14 +384,11 @@ action_calendar_refresh_cb (GtkAction *action, if (client == NULL) return; - g_return_if_fail (e_cal_get_refresh_supported (client)); + g_return_if_fail (e_client_check_refresh_supported (E_CLIENT (client))); - if (!e_cal_refresh (client, &error) && error) { - g_warning ( - "%s: Failed to refresh '%s', %s\n", - G_STRFUNC, e_source_peek_name (source), - error->message); - g_error_free (error); + if (!e_client_refresh_sync (E_CLIENT (client), NULL, &error)) { + g_debug ("%s: Failed to refresh '%s', %s\n", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); + g_clear_error (&error); } } @@ -499,8 +496,9 @@ action_event_copy_cb (GtkAction *action, GnomeCalendar *calendar; ECalendarView *calendar_view; ESource *source_source = NULL, *destination_source = NULL; - ECal *destination_client = NULL; + ECalClient *destination_client = NULL; GList *selected, *iter; + GError *error = NULL; shell_view = E_SHELL_VIEW (cal_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); @@ -517,22 +515,27 @@ action_event_copy_cb (GtkAction *action, ECalendarViewEvent *event = selected->data; if (is_comp_data_valid (event) && event->comp_data->client) - source_source = e_cal_get_source (event->comp_data->client); + source_source = e_client_get_source (E_CLIENT (event->comp_data->client)); } /* Get a destination source from the user. */ destination_source = select_source_dialog ( - GTK_WINDOW (shell_window), E_CAL_SOURCE_TYPE_EVENT, source_source); + GTK_WINDOW (shell_window), E_CAL_CLIENT_SOURCE_TYPE_EVENTS, source_source); if (destination_source == NULL) return; /* Open the destination calendar. */ - destination_client = e_auth_new_cal_from_source ( - destination_source, E_CAL_SOURCE_TYPE_EVENT); + destination_client = e_cal_client_new ( + destination_source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL); if (destination_client == NULL) goto exit; - if (!e_cal_open (destination_client, FALSE, NULL)) + g_signal_connect (destination_client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL); + + if (!e_client_open_sync (E_CLIENT (destination_client), FALSE, NULL, &error)) { + g_debug ("%s: Failed to open destination client: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); goto exit; + } e_cal_shell_view_set_status_message ( cal_shell_view, _("Copying Items"), -1.0); @@ -565,7 +568,7 @@ action_event_delegate_cb (GtkAction *action, ECalendarView *calendar_view; ECalendarViewEvent *event; ECalComponent *component; - ECal *client; + ECalClient *client; GList *selected; icalcomponent *clone; icalproperty *property; @@ -702,7 +705,7 @@ action_event_forward_cb (GtkAction *action, GnomeCalendar *calendar; ECalendarViewEvent *event; ECalComponent *component; - ECal *client; + ECalClient *client; icalcomponent *icalcomp; GList *selected; @@ -769,8 +772,9 @@ action_event_move_cb (GtkAction *action, GnomeCalendar *calendar; ECalendarView *calendar_view; ESource *source_source = NULL, *destination_source = NULL; - ECal *destination_client = NULL; + ECalClient *destination_client = NULL; GList *selected, *iter; + GError *error = NULL; shell_view = E_SHELL_VIEW (cal_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); @@ -787,22 +791,26 @@ action_event_move_cb (GtkAction *action, ECalendarViewEvent *event = selected->data; if (is_comp_data_valid (event) && event->comp_data->client) - source_source = e_cal_get_source (event->comp_data->client); + source_source = e_client_get_source (E_CLIENT (event->comp_data->client)); } /* Get a destination source from the user. */ destination_source = select_source_dialog ( - GTK_WINDOW (shell_window), E_CAL_SOURCE_TYPE_EVENT, source_source); + GTK_WINDOW (shell_window), E_CAL_CLIENT_SOURCE_TYPE_EVENTS, source_source); if (destination_source == NULL) return; /* Open the destination calendar. */ - destination_client = e_auth_new_cal_from_source ( - destination_source, E_CAL_SOURCE_TYPE_EVENT); + destination_client = e_cal_client_new (destination_source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL); if (destination_client == NULL) goto exit; - if (!e_cal_open (destination_client, FALSE, NULL)) + g_signal_connect (destination_client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL); + + if (!e_client_open_sync (E_CLIENT (destination_client), FALSE, NULL, &error)) { + g_debug ("%s: Failed to open destination client: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); goto exit; + } e_cal_shell_view_set_status_message ( cal_shell_view, _("Moving Items"), -1.0); @@ -856,7 +864,7 @@ action_event_occurrence_movable_cb (GtkAction *action, ECalComponent *recurring_component; ECalComponentDateTime date; ECalComponentId *id; - ECal *client; + ECalClient *client; icalcomponent *icalcomp; icaltimetype itt; icaltimezone *timezone; @@ -922,14 +930,14 @@ action_event_occurrence_movable_cb (GtkAction *action, * since at present the updates happend synchronously so our * event may disappear. */ - e_cal_remove_object_with_mod ( - client, id->uid, id->rid, CALOBJ_MOD_THIS, NULL); + e_cal_client_remove_object_sync ( + client, id->uid, id->rid, CALOBJ_MOD_THIS, NULL, NULL); e_cal_component_free_id (id); g_object_unref (recurring_component); icalcomp = e_cal_component_get_icalcomponent (exception_component); - if (e_cal_create_object (client, icalcomp, &uid, NULL)) + if (e_cal_client_create_object_sync (client, icalcomp, &uid, NULL, NULL)) g_free (uid); g_object_unref (exception_component); @@ -965,7 +973,7 @@ action_event_print_cb (GtkAction *action, ECalendarViewEvent *event; ECalComponent *component; ECalModel *model; - ECal *client; + ECalClient *client; icalcomponent *icalcomp; GList *selected; @@ -1011,7 +1019,7 @@ action_event_reply_cb (GtkAction *action, GnomeCalendar *calendar; ECalendarViewEvent *event; ECalComponent *component; - ECal *client; + ECalClient *client; icalcomponent *icalcomp; GList *selected; gboolean reply_all = FALSE; @@ -1055,7 +1063,7 @@ action_event_reply_all_cb (GtkAction *action, GnomeCalendar *calendar; ECalendarViewEvent *event; ECalComponent *component; - ECal *client; + ECalClient *client; icalcomponent *icalcomp; GList *selected; gboolean reply_all = TRUE; @@ -1102,7 +1110,7 @@ action_event_save_as_cb (GtkAction *action, GnomeCalendar *calendar; ECalendarView *calendar_view; ECalendarViewEvent *event; - ECal *client; + ECalClient *client; icalcomponent *icalcomp; EActivity *activity; GList *selected; @@ -1140,7 +1148,7 @@ action_event_save_as_cb (GtkAction *action, if (file == NULL) return; - string = e_cal_get_component_as_string (client, icalcomp); + string = e_cal_client_get_component_as_string (client, icalcomp); if (string == NULL) { g_warning ("Could not convert item to a string"); goto exit; @@ -1172,7 +1180,7 @@ edit_event_as (ECalShellView *cal_shell_view, gboolean as_meeting) GnomeCalendar *calendar; ECalendarView *calendar_view; ECalendarViewEvent *event; - ECal *client; + ECalClient *client; icalcomponent *icalcomp; GList *selected; diff --git a/modules/calendar/e-cal-shell-view-memopad.c b/modules/calendar/e-cal-shell-view-memopad.c index 84d14cf09b..e154667826 100644 --- a/modules/calendar/e-cal-shell-view-memopad.c +++ b/modules/calendar/e-cal-shell-view-memopad.c @@ -66,7 +66,7 @@ action_calendar_memopad_new_cb (GtkAction *action, ECalShellContent *cal_shell_content; EMemoTable *memo_table; ECalModelComponent *comp_data; - ECal *client; + ECalClient *client; ECalComponent *comp; CompEditor *editor; GSList *list; @@ -224,7 +224,7 @@ action_calendar_memopad_save_as_cb (GtkAction *action, return; /* XXX We only save the first selected memo. */ - string = e_cal_get_component_as_string ( + string = e_cal_client_get_component_as_string ( comp_data->client, comp_data->icalcomp); if (string == NULL) { g_warning ("Could not convert memo to a string."); @@ -355,7 +355,7 @@ e_cal_shell_view_memopad_actions_update (ECalShellView *cal_shell_view) icalproperty *prop; gboolean read_only; - e_cal_is_read_only (comp_data->client, &read_only, NULL); + read_only = e_client_is_readonly (E_CLIENT (comp_data->client)); editable &= !read_only; prop = icalcomponent_get_first_property ( diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c index c6c9fa5673..d4cee1a627 100644 --- a/modules/calendar/e-cal-shell-view-private.c +++ b/modules/calendar/e-cal-shell-view-private.c @@ -283,7 +283,7 @@ cal_shell_view_selector_popup_event_cb (EShellView *shell_view, static void cal_shell_view_selector_client_added_cb (ECalShellView *cal_shell_view, - ECal *client) + ECalClient *client) { ECalShellContent *cal_shell_content; GnomeCalendar *calendar; @@ -300,7 +300,7 @@ cal_shell_view_selector_client_added_cb (ECalShellView *cal_shell_view, static void cal_shell_view_selector_client_removed_cb (ECalShellView *cal_shell_view, - ECal *client) + ECalClient *client) { ECalShellContent *cal_shell_content; GnomeCalendar *calendar; @@ -341,12 +341,12 @@ cal_shell_view_user_created_cb (ECalShellView *cal_shell_view, { ECalShellSidebar *cal_shell_sidebar; ECalModel *model; - ECal *client; + ECalClient *client; ESource *source; model = e_calendar_view_get_model (calendar_view); client = e_cal_model_get_default_client (model); - source = e_cal_get_source (client); + source = e_client_get_source (E_CLIENT (client)); cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar; e_cal_shell_sidebar_add_source (cal_shell_sidebar, source); @@ -824,7 +824,7 @@ e_cal_shell_view_set_status_message (ECalShellView *cal_shell_view, void e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view, ECalendarViewEvent *event, - ECal *destination_client, + ECalClient *destination_client, gboolean remove) { icalcomponent *icalcomp; @@ -838,7 +838,7 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view, g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view)); g_return_if_fail (event != NULL); - g_return_if_fail (E_IS_CAL (destination_client)); + g_return_if_fail (E_IS_CAL_CLIENT (destination_client)); if (!is_comp_data_valid (event)) return; @@ -848,25 +848,26 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view, /* Put the new object into the destination calendar. */ - success = e_cal_get_object ( - destination_client, uid, NULL, &icalcomp, NULL); + success = e_cal_client_get_object_sync ( + destination_client, uid, NULL, &icalcomp, NULL, NULL); if (success) { icalcomponent_free (icalcomp); - success = e_cal_modify_object ( + success = e_cal_client_modify_object_sync ( destination_client, icalcomp_event, - CALOBJ_MOD_ALL, NULL); + CALOBJ_MOD_ALL, NULL, NULL); /* do not delete the event when it was found in the calendar */ return; } else { icalproperty *icalprop; gchar *new_uid; + GError *error = NULL; if (e_cal_util_component_is_instance (icalcomp_event)) { - success = e_cal_get_object ( + success = e_cal_client_get_object_sync ( event->comp_data->client, - uid, NULL, &icalcomp, NULL); + uid, NULL, &icalcomp, NULL, NULL); if (success) { /* Use master object when working * with a recurring event ... */ @@ -904,10 +905,11 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view, } new_uid = NULL; - success = e_cal_create_object ( - destination_client, icalcomp_clone, &new_uid, NULL); + success = e_cal_client_create_object_sync ( + destination_client, icalcomp_clone, &new_uid, NULL, &error); if (!success) { icalcomponent_free (icalcomp_clone); + g_debug ("%s: Failed to create object: %s", G_STRFUNC, error ? error->message : "Unknown error"); return; } @@ -916,7 +918,7 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view, } if (remove) { - ECal *source_client = event->comp_data->client; + ECalClient *source_client = event->comp_data->client; /* Remove the item from the source calendar. */ if (e_cal_util_component_is_instance (icalcomp_event) || @@ -930,11 +932,11 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view, rid = icaltime_as_ical_string_r (icaltime); else rid = NULL; - e_cal_remove_object_with_mod ( - source_client, uid, rid, CALOBJ_MOD_ALL, NULL); + e_cal_client_remove_object_sync ( + source_client, uid, rid, CALOBJ_MOD_ALL, NULL, NULL); g_free (rid); } else - e_cal_remove_object (source_client, uid, NULL); + e_cal_client_remove_object_sync (source_client, uid, NULL, CALOBJ_MOD_THIS, NULL, NULL); } } @@ -1091,10 +1093,10 @@ e_cal_shell_view_update_timezone (ECalShellView *cal_shell_view) clients = e_cal_shell_sidebar_get_clients (cal_shell_sidebar); for (iter = clients; iter != NULL; iter = iter->next) { - ECal *client = iter->data; + ECalClient *client = iter->data; - if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED) - e_cal_set_default_timezone (client, timezone, NULL); + if (e_client_is_opened (E_CLIENT (client))) + e_cal_client_set_default_timezone (client, timezone); } g_list_free (clients); diff --git a/modules/calendar/e-cal-shell-view-private.h b/modules/calendar/e-cal-shell-view-private.h index 52ec374295..7c78130fc3 100644 --- a/modules/calendar/e-cal-shell-view-private.h +++ b/modules/calendar/e-cal-shell-view-private.h @@ -31,6 +31,7 @@ #include #include #include +#include #include "e-util/e-account-utils.h" #include "e-util/e-selection.h" @@ -41,7 +42,6 @@ #include "misc/e-popup-action.h" #include "misc/e-selectable.h" -#include "calendar/common/authentication.h" #include "calendar/gui/calendar-config.h" #include "calendar/gui/comp-util.h" #include "calendar/gui/e-cal-list-view.h" @@ -142,7 +142,7 @@ void e_cal_shell_view_set_status_message void e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view, ECalendarViewEvent *event, - ECal *destination_client, + ECalClient *destination_client, gboolean remove); void e_cal_shell_view_update_sidebar (ECalShellView *cal_shell_view); diff --git a/modules/calendar/e-cal-shell-view-taskpad.c b/modules/calendar/e-cal-shell-view-taskpad.c index 48fd850790..48c81ac085 100644 --- a/modules/calendar/e-cal-shell-view-taskpad.c +++ b/modules/calendar/e-cal-shell-view-taskpad.c @@ -135,7 +135,7 @@ action_calendar_taskpad_new_cb (GtkAction *action, ECalShellContent *cal_shell_content; ECalModelComponent *comp_data; ETaskTable *task_table; - ECal *client; + ECalClient *client; ECalComponent *comp; CompEditor *editor; GSList *list; @@ -290,7 +290,7 @@ action_calendar_taskpad_save_as_cb (GtkAction *action, if (file == NULL) return; - string = e_cal_get_component_as_string ( + string = e_cal_client_get_component_as_string ( comp_data->client, comp_data->icalcomp); if (string == NULL) { g_warning ("Could not convert task to a string"); @@ -446,15 +446,15 @@ e_cal_shell_view_taskpad_actions_update (ECalShellView *cal_shell_view) const gchar *cap; gboolean read_only; - e_cal_is_read_only (comp_data->client, &read_only, NULL); + read_only = e_client_is_readonly (E_CLIENT (comp_data->client)); editable &= !read_only; cap = CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT; - if (e_cal_get_static_capability (comp_data->client, cap)) + if (e_client_check_capability (E_CLIENT (comp_data->client), cap)) assignable = FALSE; cap = CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK; - if (e_cal_get_static_capability (comp_data->client, cap)) + if (e_client_check_capability (E_CLIENT (comp_data->client), cap)) assignable = FALSE; prop = icalcomponent_get_first_property ( diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index 1d7269cd55..2249bf96e4 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -353,7 +353,7 @@ cal_shell_view_update_actions (EShellView *shell_view) for (iter = list; iter != NULL; iter = iter->next) { ECalendarViewEvent *event = iter->data; - ECal *client; + ECalClient *client; ECalComponent *comp; icalcomponent *icalcomp; gchar *user_email = NULL; @@ -366,7 +366,7 @@ cal_shell_view_update_actions (EShellView *shell_view) client = event->comp_data->client; icalcomp = event->comp_data->icalcomp; - e_cal_is_read_only (client, &read_only, NULL); + read_only = e_client_is_readonly (E_CLIENT (client)); editable = editable && !read_only; is_instance |= e_cal_util_component_is_instance (icalcomp); @@ -391,11 +391,9 @@ cal_shell_view_update_actions (EShellView *shell_view) itip_organizer_is_user (comp, client); is_delegatable = - e_cal_get_static_capability ( - client, CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED) && - ((e_cal_get_static_capability ( - client, CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY)) || - (!user_org && !is_delegated (icalcomp, user_email))); + e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED) && + (e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY) || + (!user_org && !is_delegated (icalcomp, user_email))); g_free (user_email); g_object_unref (comp); diff --git a/modules/calendar/e-calendar-preferences.c b/modules/calendar/e-calendar-preferences.c index ec15e3c2d1..f35c88a6ed 100644 --- a/modules/calendar/e-calendar-preferences.c +++ b/modules/calendar/e-calendar-preferences.c @@ -435,7 +435,7 @@ show_alarms_config (ECalendarPreferences *prefs) { GConfClient *gconf; - if (e_cal_get_sources (&prefs->alarms_list, E_CAL_SOURCE_TYPE_EVENT, NULL)) { + 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 Alarms")); gtk_container_add (GTK_CONTAINER (prefs->scrolled_window), prefs->alarm_list_widget); diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c index e99e3e2931..8d39843054 100644 --- a/modules/calendar/e-memo-shell-backend.c +++ b/modules/calendar/e-memo-shell-backend.c @@ -27,17 +27,17 @@ #include #include -#include +#include #include #include #include #include +#include #include "shell/e-shell.h" #include "shell/e-shell-backend.h" #include "shell/e-shell-window.h" -#include "calendar/common/authentication.h" #include "calendar/gui/comp-util.h" #include "calendar/gui/dialogs/calendar-setup.h" #include "calendar/gui/dialogs/memo-editor.h" @@ -75,6 +75,7 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend) GSList *sources, *iter; const gchar *name; gboolean save_list = FALSE; + GError *error = NULL; personal = NULL; @@ -83,10 +84,11 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend) shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - if (!e_cal_get_sources ( + if (!e_cal_client_get_sources ( &memo_shell_backend->priv->source_list, - E_CAL_SOURCE_TYPE_JOURNAL, NULL)) { - g_warning ("Could not get memo sources from GConf!"); + E_CAL_CLIENT_SOURCE_TYPE_MEMOS, &error)) { + g_debug ("%s: Could not get memo sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); return; } @@ -164,43 +166,50 @@ memo_shell_backend_new_memo (ESource *source, EShell *shell, CompEditorFlags flags) { - ECal *cal; + EClient *client = NULL; + ECalClient *cal_client; ECalComponent *comp; CompEditor *editor; + GError *error = NULL; + + if (!e_client_utils_open_new_finish (source, result, &client, &error)) + client = NULL; /* XXX Handle errors better. */ - cal = e_load_cal_source_finish (source, result, NULL); - g_return_if_fail (E_IS_CAL (cal)); + if (!client) { + g_debug ("%s: Failed to open '%s': %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); + g_clear_error (&error); + return; + } - comp = cal_comp_memo_new_with_defaults (cal); + g_return_if_fail (E_IS_CAL_CLIENT (client)); + + cal_client = E_CAL_CLIENT (client); + comp = cal_comp_memo_new_with_defaults (cal_client); cal_comp_update_time_by_active_window (comp, shell); - editor = memo_editor_new (cal, shell, flags); + editor = memo_editor_new (cal_client, shell, flags); comp_editor_edit_comp (editor, comp); gtk_window_present (GTK_WINDOW (editor)); g_object_unref (comp); - g_object_unref (cal); + g_object_unref (client); } static void -memo_shell_backend_memo_new_cb (ESource *source, - GAsyncResult *result, - EShell *shell) +memo_shell_backend_memo_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) { CompEditorFlags flags = 0; flags |= COMP_EDITOR_NEW_ITEM; - memo_shell_backend_new_memo (source, result, shell, flags); + memo_shell_backend_new_memo (E_SOURCE (source_object), result, shell, flags); g_object_unref (shell); } static void -memo_shell_backend_memo_shared_new_cb (ESource *source, - GAsyncResult *result, - EShell *shell) +memo_shell_backend_memo_shared_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) { CompEditorFlags flags = 0; @@ -208,7 +217,7 @@ memo_shell_backend_memo_shared_new_cb (ESource *source, flags |= COMP_EDITOR_IS_SHARED; flags |= COMP_EDITOR_USER_ORG; - memo_shell_backend_new_memo (source, result, shell, flags); + memo_shell_backend_new_memo (E_SOURCE (source_object), result, shell, flags); g_object_unref (shell); } @@ -222,14 +231,11 @@ action_memo_new_cb (GtkAction *action, EShellSettings *shell_settings; ESource *source = NULL; ESourceList *source_list; - ECalSourceType source_type; const gchar *action_name; gchar *uid; /* This callback is used for both memos and shared memos. */ - source_type = E_CAL_SOURCE_TYPE_JOURNAL; - shell = e_shell_window_get_shell (shell_window); shell_settings = e_shell_get_shell_settings (shell); shell_backend = e_shell_get_backend_by_name (shell, "memos"); @@ -254,19 +260,13 @@ action_memo_new_cb (GtkAction *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_load_cal_source_async ( - source, source_type, NULL, - GTK_WINDOW (shell_window), - NULL, (GAsyncReadyCallback) - memo_shell_backend_memo_shared_new_cb, - g_object_ref (shell)); + e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_MEMOS, FALSE, NULL, + e_client_utils_authenticate_handler, GTK_WINDOW (shell_window), + memo_shell_backend_memo_shared_new_cb, g_object_ref (shell)); else - e_load_cal_source_async ( - source, source_type, NULL, - GTK_WINDOW (shell_window), - NULL, (GAsyncReadyCallback) - memo_shell_backend_memo_new_cb, - g_object_ref (shell)); + e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_MEMOS, FALSE, NULL, + e_client_utils_authenticate_handler, GTK_WINDOW (shell_window), + memo_shell_backend_memo_new_cb, g_object_ref (shell)); g_object_unref (source_list); } @@ -312,11 +312,11 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend, EShell *shell; CompEditor *editor; CompEditorFlags flags = 0; - ECal *client; + ECalClient *client; ECalComponent *comp; ESource *source; ESourceList *source_list; - ECalSourceType source_type; + ECalClientSourceType source_type; EUri *euri; icalcomponent *icalcomp; const gchar *cp; @@ -326,7 +326,7 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend, gboolean handled = FALSE; GError *error = NULL; - source_type = E_CAL_SOURCE_TYPE_JOURNAL; + source_type = E_CAL_CLIENT_SOURCE_TYPE_MEMOS; shell = e_shell_backend_get_shell (shell_backend); if (strncmp (uri, "memo:", 5) != 0) @@ -379,8 +379,9 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend, * we successfully open it is another matter... */ handled = TRUE; - if (!e_cal_get_sources (&source_list, source_type, NULL)) { - g_printerr ("Could not get memo sources from GConf!\n"); + if (!e_cal_client_get_sources (&source_list, source_type, &error)) { + g_debug ("%s: Could not get memo sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); goto exit; } @@ -391,12 +392,13 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend, goto exit; } - client = e_auth_new_cal_from_source (source, source_type); - if (client == NULL || !e_cal_open (client, TRUE, &error)) { - if (error != NULL) { - g_printerr ("%s\n", error->message); - g_error_free (error); - } + client = e_cal_client_new (source, source_type, &error); + if (client) + 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)) { + g_debug ("%s: Failed to create/open client: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); g_object_unref (source_list); goto exit; } @@ -409,10 +411,10 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend, if (editor != NULL) goto present; - if (!e_cal_get_object (client, comp_uid, comp_rid, &icalcomp, &error)) { - g_printerr ("%s\n", error->message); + if (!e_cal_client_get_object_sync (client, comp_uid, comp_rid, &icalcomp, NULL, &error)) { + g_debug ("%s: Failed to get object: %s", G_STRFUNC, error ? error->message : "Unknown error"); g_object_unref (source_list); - g_error_free (error); + g_clear_error (&error); goto exit; } diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c index 9f7d0768b9..f0f4fe958f 100644 --- a/modules/calendar/e-memo-shell-content.c +++ b/modules/calendar/e-memo-shell-content.c @@ -115,7 +115,7 @@ memo_shell_content_table_foreach_cb (gint model_row, ESource *source; const gchar *source_uid; - source = e_cal_get_source (comp_data->client); + source = e_client_get_source (E_CLIENT (comp_data->client)); source_uid = e_source_peek_uid (source); foreach_data->list = g_slist_prepend ( @@ -575,7 +575,7 @@ memo_shell_content_check_state (EShellContent *shell_content) icalproperty *prop; gboolean read_only; - e_cal_is_read_only (comp_data->client, &read_only, NULL); + read_only = e_client_is_readonly (E_CLIENT (comp_data->client)); editable &= !read_only; prop = icalcomponent_get_first_property ( diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index befe60cbc1..5a28611652 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -27,11 +27,11 @@ #include #include -#include +#include +#include #include "e-util/e-alert-dialog.h" #include "e-util/e-util.h" -#include "calendar/common/authentication.h" #include "calendar/gui/e-memo-list-selector.h" #include "calendar/gui/misc.h" @@ -52,7 +52,7 @@ struct _EMemoShellSidebarPrivate { * opened. So the user first highlights a source, then * sometime later we update our default-client property * which is bound by an EBinding to ECalModel. */ - ECal *default_client; + ECalClient *default_client; GCancellable *loading_default_client; }; @@ -76,7 +76,7 @@ static GType memo_shell_sidebar_type; static void memo_shell_sidebar_emit_client_added (EMemoShellSidebar *memo_shell_sidebar, - ECal *client) + ECalClient *client) { guint signal_id = signals[CLIENT_ADDED]; @@ -85,7 +85,7 @@ memo_shell_sidebar_emit_client_added (EMemoShellSidebar *memo_shell_sidebar, static void memo_shell_sidebar_emit_client_removed (EMemoShellSidebar *memo_shell_sidebar, - ECal *client) + ECalClient *client) { guint signal_id = signals[CLIENT_REMOVED]; @@ -103,7 +103,7 @@ memo_shell_sidebar_emit_status_message (EMemoShellSidebar *memo_shell_sidebar, static void memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar, - ECal *client) + ECalClient *client) { EShellView *shell_view; EShellContent *shell_content; @@ -118,7 +118,7 @@ memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar, shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_content = e_shell_view_get_shell_content (shell_view); - source = e_cal_get_source (client); + source = e_client_get_source (E_CLIENT (client)); uid = e_source_peek_uid (source); g_object_ref (source); @@ -136,7 +136,7 @@ memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar, static void memo_shell_sidebar_backend_error_cb (EMemoShellSidebar *memo_shell_sidebar, const gchar *message, - ECal *client) + ECalClient *client) { EShellView *shell_view; EShellContent *shell_content; @@ -148,7 +148,7 @@ memo_shell_sidebar_backend_error_cb (EMemoShellSidebar *memo_shell_sidebar, shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_content = e_shell_view_get_shell_content (shell_view); - source = e_cal_get_source (client); + source = e_client_get_source (E_CLIENT (client)); source_group = e_source_peek_group (source); e_alert_submit ( @@ -159,38 +159,43 @@ memo_shell_sidebar_backend_error_cb (EMemoShellSidebar *memo_shell_sidebar, } static void -memo_shell_sidebar_client_opened_cb (EMemoShellSidebar *memo_shell_sidebar, - const GError *error, - ECal *client) +memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { + ECalClient *client = E_CAL_CLIENT (source_object); + EMemoShellSidebar *memo_shell_sidebar = user_data; EShellView *shell_view; EShellContent *shell_content; EShellSidebar *shell_sidebar; const gchar *message; + GError *error = NULL; shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_content = e_shell_view_get_shell_content (shell_view); - if (g_error_matches (error, E_CALENDAR_ERROR, - E_CALENDAR_STATUS_AUTHENTICATION_FAILED) || - g_error_matches (error, E_CALENDAR_ERROR, - E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED)) - e_auth_cal_forget_password (client); + e_client_open_finish (E_CLIENT (client), result, &error); + + 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, NULL, memo_shell_sidebar_client_opened_cb, user_data); + g_clear_error (&error); + return; + } /* Handle errors. */ - switch (error ? error->code : E_CALENDAR_STATUS_OK) { - case E_CALENDAR_STATUS_OK: + switch ((error && error->domain == E_CLIENT_ERROR) ? error->code : -1) { + case -1: break; - case E_CALENDAR_STATUS_AUTHENTICATION_FAILED: - e_cal_open_async (client, FALSE); - return; - - case E_CALENDAR_STATUS_BUSY: + case E_CLIENT_ERROR_BUSY: + g_debug ("%s: Cannot open '%s', it's busy (%s)", G_STRFUNC, e_source_peek_name (e_client_get_source (E_CLIENT (client))), error->message); + g_clear_error (&error); return; - case E_CALENDAR_STATUS_REPOSITORY_OFFLINE: + case E_CLIENT_ERROR_REPOSITORY_OFFLINE: e_alert_submit ( E_ALERT_SINK (shell_content), "calendar:prompt-no-contents-offline-memos", @@ -198,7 +203,7 @@ memo_shell_sidebar_client_opened_cb (EMemoShellSidebar *memo_shell_sidebar, /* fall through */ default: - if (error->code != E_CALENDAR_STATUS_REPOSITORY_OFFLINE) { + if (error->code != E_CLIENT_ERROR_REPOSITORY_OFFLINE) { e_alert_submit ( E_ALERT_SINK (shell_content), "calendar:failed-open-memos", @@ -207,15 +212,12 @@ memo_shell_sidebar_client_opened_cb (EMemoShellSidebar *memo_shell_sidebar, e_memo_shell_sidebar_remove_source ( memo_shell_sidebar, - e_cal_get_source (client)); + e_client_get_source (E_CLIENT (client))); + g_clear_error (&error); return; } - g_assert (error == NULL); - - g_signal_handlers_disconnect_matched ( - client, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, - memo_shell_sidebar_client_opened_cb, NULL); + g_clear_error (&error); message = _("Loading memos"); memo_shell_sidebar_emit_status_message (memo_shell_sidebar, message); @@ -224,27 +226,31 @@ memo_shell_sidebar_client_opened_cb (EMemoShellSidebar *memo_shell_sidebar, } static void -memo_shell_sidebar_default_loaded_cb (ESource *source, - GAsyncResult *result, - EShellSidebar *shell_sidebar) +memo_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { + EShellSidebar *shell_sidebar = user_data; EMemoShellSidebarPrivate *priv; EShellContent *shell_content; EShellView *shell_view; - ECal *client; + EMemoShellContent *memo_shell_content; + ECalModel *model; + EClient *client = NULL; GError *error = NULL; priv = E_MEMO_SHELL_SIDEBAR (shell_sidebar)->priv; shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_content = e_shell_view_get_shell_content (shell_view); + memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content); + model = e_memo_shell_content_get_memo_model (memo_shell_content); - client = e_load_cal_source_finish (source, result, &error); + if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) + client = NULL; - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) || + g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) { g_error_free (error); goto exit; - } else if (error != NULL) { e_alert_submit ( E_ALERT_SINK (shell_content), @@ -254,16 +260,18 @@ memo_shell_sidebar_default_loaded_cb (ESource *source, goto exit; } - g_return_if_fail (E_IS_CAL (client)); + g_return_if_fail (E_IS_CAL_CLIENT (client)); if (priv->default_client != NULL) g_object_unref (priv->default_client); - priv->default_client = client; + priv->default_client = E_CAL_CLIENT (client); + + e_cal_client_set_default_timezone (priv->default_client, e_cal_model_get_timezone (model)); g_object_notify (G_OBJECT (shell_sidebar), "default-client"); -exit: + exit: g_object_unref (shell_sidebar); } @@ -274,29 +282,18 @@ memo_shell_sidebar_set_default (EMemoShellSidebar *memo_shell_sidebar, EMemoShellSidebarPrivate *priv; EShellView *shell_view; EShellWindow *shell_window; - EShellContent *shell_content; EShellSidebar *shell_sidebar; - EMemoShellContent *memo_shell_content; - ECalSourceType source_type; - ECalModel *model; - ECal *client; - icaltimezone *timezone; + ECalClient *client; const gchar *uid; priv = memo_shell_sidebar->priv; - source_type = E_CAL_SOURCE_TYPE_JOURNAL; /* 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_content = e_shell_view_get_shell_content (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content); - model = e_memo_shell_content_get_memo_model (memo_shell_content); - timezone = e_cal_model_get_timezone (model); - /* Cancel any unfinished previous request. */ if (priv->loading_default_client != NULL) { g_cancellable_cancel (priv->loading_default_client); @@ -319,11 +316,9 @@ memo_shell_sidebar_set_default (EMemoShellSidebar *memo_shell_sidebar, priv->loading_default_client = g_cancellable_new (); - e_load_cal_source_async ( - source, source_type, timezone, - GTK_WINDOW (shell_window), priv->loading_default_client, - (GAsyncReadyCallback) memo_shell_sidebar_default_loaded_cb, - g_object_ref (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)); } static void @@ -607,7 +602,7 @@ memo_shell_sidebar_check_state (EShellSidebar *shell_sidebar) source = e_source_selector_get_primary_selection (selector); if (source != NULL) { - ECal *client; + ECalClient *client; const gchar *uri; const gchar *delete; @@ -622,7 +617,7 @@ memo_shell_sidebar_check_state (EShellSidebar *shell_sidebar) memo_shell_sidebar->priv->client_table, e_source_peek_uid (source)); refresh_supported = - client && e_cal_get_refresh_supported (client); + client && e_client_check_refresh_supported (E_CLIENT (client)); } if (source != NULL) @@ -639,7 +634,7 @@ memo_shell_sidebar_check_state (EShellSidebar *shell_sidebar) static void memo_shell_sidebar_client_removed (EMemoShellSidebar *memo_shell_sidebar, - ECal *client) + ECalClient *client) { ESourceSelector *selector; GHashTable *client_table; @@ -653,7 +648,7 @@ memo_shell_sidebar_client_removed (EMemoShellSidebar *memo_shell_sidebar, client, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, memo_shell_sidebar); - source = e_cal_get_source (client); + source = e_client_get_source (E_CLIENT (client)); uid = e_source_peek_uid (source); g_return_if_fail (uid != NULL); @@ -688,9 +683,9 @@ memo_shell_sidebar_class_init (EMemoShellSidebarClass *class) PROP_DEFAULT_CLIENT, g_param_spec_object ( "default-client", - "Default Memo Client", + "Default Memo ECalClient", "Default client for memo operations", - E_TYPE_CAL, + E_TYPE_CAL_CLIENT, G_PARAM_READABLE)); g_object_class_install_property ( @@ -711,7 +706,7 @@ memo_shell_sidebar_class_init (EMemoShellSidebarClass *class) NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, - E_TYPE_CAL); + E_TYPE_CAL_CLIENT); signals[CLIENT_REMOVED] = g_signal_new ( "client-removed", @@ -721,7 +716,7 @@ memo_shell_sidebar_class_init (EMemoShellSidebarClass *class) NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, - E_TYPE_CAL); + E_TYPE_CAL_CLIENT); signals[STATUS_MESSAGE] = g_signal_new ( "status-message", @@ -804,7 +799,7 @@ e_memo_shell_sidebar_get_clients (EMemoShellSidebar *memo_shell_sidebar) return g_hash_table_get_values (client_table); } -ECal * +ECalClient * e_memo_shell_sidebar_get_default_client (EMemoShellSidebar *memo_shell_sidebar) { g_return_val_if_fail ( @@ -830,12 +825,12 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar, EShellContent *shell_content; EShellSidebar *shell_sidebar; EMemoShellContent *memo_shell_content; - ECalSourceType source_type; + ECalClientSourceType source_type; ESourceSelector *selector; GHashTable *client_table; ECalModel *model; - ECal *default_client; - ECal *client; + ECalClient *default_client; + ECalClient *client; icaltimezone *timezone; const gchar *uid; const gchar *uri; @@ -844,7 +839,7 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar, g_return_if_fail (E_IS_MEMO_SHELL_SIDEBAR (memo_shell_sidebar)); g_return_if_fail (E_IS_SOURCE (source)); - source_type = E_CAL_SOURCE_TYPE_JOURNAL; + source_type = E_CAL_CLIENT_SOURCE_TYPE_MEMOS; client_table = memo_shell_sidebar->priv->client_table; default_client = memo_shell_sidebar->priv->default_client; selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar); @@ -859,15 +854,18 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar, ESource *default_source; const gchar *default_uid; - default_source = e_cal_get_source (default_client); + default_source = e_client_get_source (E_CLIENT (default_client)); default_uid = e_source_peek_uid (default_source); if (g_strcmp0 (uid, default_uid) == 0) client = g_object_ref (default_client); } - if (client == NULL) - client = e_auth_new_cal_from_source (source, source_type); + 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); @@ -884,17 +882,12 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar, g_hash_table_insert (client_table, g_strdup (uid), client); e_source_selector_select_source (selector, source); - uri = e_cal_get_uri (client); + uri = e_client_get_uri (E_CLIENT (client)); /* Translators: The string field is a URI. */ message = g_strdup_printf (_("Opening memos at %s"), uri); memo_shell_sidebar_emit_status_message (memo_shell_sidebar, message); g_free (message); - g_signal_connect_swapped ( - client, "cal-opened-ex", - G_CALLBACK (memo_shell_sidebar_client_opened_cb), - 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); @@ -905,8 +898,8 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar, model = e_memo_shell_content_get_memo_model (memo_shell_content); timezone = e_cal_model_get_timezone (model); - e_cal_set_default_timezone (client, timezone, NULL); - e_cal_open_async (client, FALSE); + e_cal_client_set_default_timezone (client, timezone); + e_client_open (E_CLIENT (client), FALSE, NULL, memo_shell_sidebar_client_opened_cb, memo_shell_sidebar); } void @@ -914,7 +907,7 @@ e_memo_shell_sidebar_remove_source (EMemoShellSidebar *memo_shell_sidebar, ESource *source) { GHashTable *client_table; - ECal *client; + ECalClient *client; const gchar *uid; g_return_if_fail (E_IS_MEMO_SHELL_SIDEBAR (memo_shell_sidebar)); diff --git a/modules/calendar/e-memo-shell-sidebar.h b/modules/calendar/e-memo-shell-sidebar.h index 91e0ccc618..24e73f11d1 100644 --- a/modules/calendar/e-memo-shell-sidebar.h +++ b/modules/calendar/e-memo-shell-sidebar.h @@ -22,7 +22,7 @@ #ifndef E_MEMO_SHELL_SIDEBAR_H #define E_MEMO_SHELL_SIDEBAR_H -#include +#include #include #include @@ -70,9 +70,9 @@ struct _EMemoShellSidebarClass { /* Signals */ void (*client_added) (EMemoShellSidebar *memo_shell_sidebar, - ECal *client); + ECalClient *client); void (*client_removed) (EMemoShellSidebar *memo_shell_sidebar, - ECal *client); + ECalClient *client); void (*status_message) (EMemoShellSidebar *memo_shell_sidebar, const gchar *status_message, gdouble percent); @@ -85,7 +85,7 @@ GtkWidget * e_memo_shell_sidebar_new (EShellView *shell_view); GList * e_memo_shell_sidebar_get_clients (EMemoShellSidebar *memo_shell_sidebar); -ECal * e_memo_shell_sidebar_get_default_client +ECalClient * e_memo_shell_sidebar_get_default_client (EMemoShellSidebar *memo_shell_sidebar); ESourceSelector * e_memo_shell_sidebar_get_selector diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c index 593031235d..75d957c684 100644 --- a/modules/calendar/e-memo-shell-view-actions.c +++ b/modules/calendar/e-memo-shell-view-actions.c @@ -121,7 +121,7 @@ action_memo_list_copy_cb (GtkAction *action, copy_source_dialog ( GTK_WINDOW (shell_window), - source, E_CAL_SOURCE_TYPE_JOURNAL); + source, E_CAL_CLIENT_SOURCE_TYPE_MEMOS); } static void @@ -134,7 +134,7 @@ action_memo_list_delete_cb (GtkAction *action, EShellWindow *shell_window; EShellView *shell_view; EMemoTable *memo_table; - ECal *client; + ECalClient *client; ECalModel *model; ESourceSelector *selector; ESourceGroup *source_group; @@ -170,14 +170,14 @@ action_memo_list_delete_cb (GtkAction *action, uri = e_source_get_uri (source); client = e_cal_model_get_client_for_uri (model, uri); if (client == NULL) - client = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_JOURNAL); + client = e_cal_client_new_from_uri (uri, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL); g_free (uri); g_return_if_fail (client != NULL); - if (!e_cal_remove (client, &error)) { - g_warning ("%s", error->message); - g_error_free (error); + if (!e_client_remove_sync (E_CLIENT (client), NULL, &error)) { + g_debug ("%s: Failed to remove client: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); return; } @@ -191,8 +191,8 @@ action_memo_list_delete_cb (GtkAction *action, e_source_group_remove_source (source_group, source); if (!e_source_list_sync (source_list, &error)) { - g_warning ("%s", error->message); - g_error_free (error); + g_debug ("%s: Failed to sync source list: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); } } @@ -266,7 +266,7 @@ action_memo_list_refresh_cb (GtkAction *action, EMemoShellContent *memo_shell_content; EMemoShellSidebar *memo_shell_sidebar; ESourceSelector *selector; - ECal *client; + ECalClient *client; ECalModel *model; ESource *source; gchar *uri; @@ -288,14 +288,11 @@ action_memo_list_refresh_cb (GtkAction *action, if (client == NULL) return; - g_return_if_fail (e_cal_get_refresh_supported (client)); + g_return_if_fail (e_client_check_refresh_supported (E_CLIENT (client))); - if (!e_cal_refresh (client, &error) && error) { - g_warning ( - "%s: Failed to refresh '%s', %s\n", - G_STRFUNC, e_source_peek_name (source), - error->message); - g_error_free (error); + if (!e_client_refresh_sync (E_CLIENT (client), NULL, &error)) { + g_debug ("%s: Failed to refresh '%s', %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); + g_clear_error (&error); } } @@ -338,7 +335,7 @@ action_memo_new_cb (GtkAction *action, EShellWindow *shell_window; EMemoShellContent *memo_shell_content; EMemoTable *memo_table; - ECal *client; + ECalClient *client; ECalComponent *comp; CompEditor *editor; GSList *list; @@ -518,7 +515,7 @@ action_memo_save_as_cb (GtkAction *action, return; /* XXX We only save the first selected memo. */ - string = e_cal_get_component_as_string ( + string = e_cal_client_get_component_as_string ( comp_data->client, comp_data->icalcomp); if (string == NULL) { g_warning ("Could not convert memo to a string"); diff --git a/modules/calendar/e-memo-shell-view-private.c b/modules/calendar/e-memo-shell-view-private.c index 36f09fd954..c1278cb46e 100644 --- a/modules/calendar/e-memo-shell-view-private.c +++ b/modules/calendar/e-memo-shell-view-private.c @@ -34,13 +34,13 @@ memo_shell_view_model_row_appended_cb (EMemoShellView *memo_shell_view, ECalModel *model) { EMemoShellSidebar *memo_shell_sidebar; - ECal *client; + ECalClient *client; ESource *source; /* This is the "Click to Add" handler. */ client = e_cal_model_get_default_client (model); - source = e_cal_get_source (client); + source = e_client_get_source (E_CLIENT (client)); memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar; e_memo_shell_sidebar_add_source (memo_shell_sidebar, source); @@ -58,7 +58,7 @@ memo_shell_view_table_popup_event_cb (EShellView *shell_view, static void memo_shell_view_selector_client_added_cb (EMemoShellView *memo_shell_view, - ECal *client) + ECalClient *client) { EMemoShellContent *memo_shell_content; EMemoTable *memo_table; @@ -74,7 +74,7 @@ memo_shell_view_selector_client_added_cb (EMemoShellView *memo_shell_view, static void memo_shell_view_selector_client_removed_cb (EMemoShellView *memo_shell_view, - ECal *client) + ECalClient *client) { EMemoShellContent *memo_shell_content; EMemoTable *memo_table; @@ -452,10 +452,10 @@ e_memo_shell_view_update_timezone (EMemoShellView *memo_shell_view) clients = e_memo_shell_sidebar_get_clients (memo_shell_sidebar); for (iter = clients; iter != NULL; iter = iter->next) { - ECal *client = iter->data; + ECalClient *client = iter->data; - if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED) - e_cal_set_default_timezone (client, timezone, NULL); + if (e_client_is_opened (E_CLIENT (client))) + e_cal_client_set_default_timezone (client, timezone); } g_list_free (clients); diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c index b9f95b3a72..768f46fd28 100644 --- a/modules/calendar/e-task-shell-backend.c +++ b/modules/calendar/e-task-shell-backend.c @@ -27,17 +27,17 @@ #include #include -#include +#include #include #include #include #include +#include #include "shell/e-shell.h" #include "shell/e-shell-backend.h" #include "shell/e-shell-window.h" -#include "calendar/common/authentication.h" #include "calendar/gui/comp-util.h" #include "calendar/gui/dialogs/calendar-setup.h" #include "calendar/gui/dialogs/task-editor.h" @@ -74,6 +74,7 @@ task_shell_backend_ensure_sources (EShellBackend *shell_backend) GSList *sources, *iter; const gchar *name; gboolean save_list = FALSE; + GError *error = NULL; on_this_computer = NULL; personal = NULL; @@ -83,10 +84,11 @@ task_shell_backend_ensure_sources (EShellBackend *shell_backend) shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - if (!e_cal_get_sources ( + if (!e_cal_client_get_sources ( &task_shell_backend->priv->source_list, - E_CAL_SOURCE_TYPE_TODO, NULL)) { - g_warning ("Could not get task sources from GConf!"); + E_CAL_CLIENT_SOURCE_TYPE_TASKS, &error)) { + g_debug ("%s: Could not get task sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); return; } @@ -164,42 +166,49 @@ task_shell_backend_new_task (ESource *source, EShell *shell, CompEditorFlags flags) { - ECal *cal; + EClient *client = NULL; + ECalClient *cal_client; ECalComponent *comp; CompEditor *editor; + GError *error = NULL; + + if (!e_client_utils_open_new_finish (source, result, &client, &error)) + client = NULL; /* XXX Handle errors better. */ - cal = e_load_cal_source_finish (source, result, NULL); - g_return_if_fail (E_IS_CAL (cal)); + if (!client) { + g_debug ("%s: Failed to open '%s': %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); + g_clear_error (&error); + return; + } - editor = task_editor_new (cal, shell, flags); - comp = cal_comp_task_new_with_defaults (cal); + g_return_if_fail (E_IS_CAL_CLIENT (client)); + + cal_client = E_CAL_CLIENT (client); + editor = task_editor_new (cal_client, shell, flags); + comp = cal_comp_task_new_with_defaults (cal_client); comp_editor_edit_comp (editor, comp); gtk_window_present (GTK_WINDOW (editor)); g_object_unref (comp); - g_object_unref (cal); + g_object_unref (client); } static void -task_shell_backend_task_new_cb (ESource *source, - GAsyncResult *result, - EShell *shell) +task_shell_backend_task_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) { CompEditorFlags flags = 0; flags |= COMP_EDITOR_NEW_ITEM; - task_shell_backend_new_task (source, result, shell, flags); + task_shell_backend_new_task (E_SOURCE (source_object), result, shell, flags); g_object_unref (shell); } static void -task_shell_backend_task_assigned_new_cb (ESource *source, - GAsyncResult *result, - EShell *shell) +task_shell_backend_task_assigned_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) { CompEditorFlags flags = 0; @@ -207,7 +216,7 @@ task_shell_backend_task_assigned_new_cb (ESource *source, flags |= COMP_EDITOR_IS_ASSIGNED; flags |= COMP_EDITOR_USER_ORG; - task_shell_backend_new_task (source, result, shell, flags); + task_shell_backend_new_task (E_SOURCE (source_object), result, shell, flags); g_object_unref (shell); } @@ -221,14 +230,11 @@ action_task_new_cb (GtkAction *action, EShellSettings *shell_settings; ESource *source = NULL; ESourceList *source_list; - ECalSourceType source_type; const gchar *action_name; gchar *uid; /* This callback is used for both tasks and assigned tasks. */ - source_type = E_CAL_SOURCE_TYPE_TODO; - shell = e_shell_window_get_shell (shell_window); shell_settings = e_shell_get_shell_settings (shell); shell_backend = e_shell_get_backend_by_name (shell, "tasks"); @@ -253,19 +259,13 @@ action_task_new_cb (GtkAction *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_load_cal_source_async ( - source, source_type, NULL, - GTK_WINDOW (shell_window), - NULL, (GAsyncReadyCallback) - task_shell_backend_task_assigned_new_cb, - g_object_ref (shell)); + e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_TASKS, FALSE, NULL, + e_client_utils_authenticate_handler, GTK_WINDOW (shell_window), + task_shell_backend_task_assigned_new_cb, g_object_ref (shell)); else - e_load_cal_source_async ( - source, source_type, NULL, - GTK_WINDOW (shell_window), - NULL, (GAsyncReadyCallback) - task_shell_backend_task_new_cb, - g_object_ref (shell)); + e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_TASKS, FALSE, NULL, + e_client_utils_authenticate_handler, GTK_WINDOW (shell_window), + task_shell_backend_task_new_cb, g_object_ref (shell)); g_object_unref (source_list); } @@ -311,11 +311,11 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend, EShell *shell; CompEditor *editor; CompEditorFlags flags = 0; - ECal *client; + ECalClient *client; ECalComponent *comp; ESource *source; ESourceList *source_list; - ECalSourceType source_type; + ECalClientSourceType source_type; EUri *euri; icalcomponent *icalcomp; icalproperty *icalprop; @@ -326,7 +326,7 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend, gboolean handled = FALSE; GError *error = NULL; - source_type = E_CAL_SOURCE_TYPE_TODO; + source_type = E_CAL_CLIENT_SOURCE_TYPE_TASKS; shell = e_shell_backend_get_shell (shell_backend); if (strncmp (uri, "task:", 5) != 0) @@ -379,8 +379,9 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend, * we successfully open it is another matter... */ handled = TRUE; - if (!e_cal_get_sources (&source_list, source_type, NULL)) { - g_printerr ("Could not get task sources from GConf!\n"); + if (!e_cal_client_get_sources (&source_list, source_type, &error)) { + g_debug ("%s: Could not get task sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); goto exit; } @@ -391,12 +392,13 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend, goto exit; } - client = e_auth_new_cal_from_source (source, source_type); - if (client == NULL || !e_cal_open (client, TRUE, &error)) { - if (error != NULL) { - g_printerr ("%s\n", error->message); - g_error_free (error); - } + client = e_cal_client_new (source, source_type, &error); + if (client) + 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)) { + g_debug ("%s: Failed to create/open client: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); g_object_unref (source_list); goto exit; } @@ -409,8 +411,8 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend, if (editor != NULL) goto present; - if (!e_cal_get_object (client, comp_uid, comp_rid, &icalcomp, &error)) { - g_printerr ("%s\n", error->message); + if (!e_cal_client_get_object_sync (client, comp_uid, comp_rid, &icalcomp, NULL, &error)) { + g_debug ("%s: Failed to get object: %s", G_STRFUNC, error ? error->message : "Unknown error"); g_object_unref (source_list); g_error_free (error); goto exit; diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c index 0ffa6fb5a3..743bb937e7 100644 --- a/modules/calendar/e-task-shell-content.c +++ b/modules/calendar/e-task-shell-content.c @@ -115,7 +115,7 @@ task_shell_content_table_foreach_cb (gint model_row, ESource *source; const gchar *source_uid; - source = e_cal_get_source (comp_data->client); + source = e_client_get_source (E_CLIENT (comp_data->client)); source_uid = e_source_peek_uid (source); foreach_data->list = g_slist_prepend ( @@ -577,15 +577,15 @@ task_shell_content_check_state (EShellContent *shell_content) const gchar *cap; gboolean read_only; - e_cal_is_read_only (comp_data->client, &read_only, NULL); + read_only = e_client_is_readonly (E_CLIENT (comp_data->client)); editable &= !read_only; cap = CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT; - if (e_cal_get_static_capability (comp_data->client, cap)) + if (e_client_check_capability (E_CLIENT (comp_data->client), cap)) assignable = FALSE; cap = CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK; - if (e_cal_get_static_capability (comp_data->client, cap)) + if (e_client_check_capability (E_CLIENT (comp_data->client), cap)) assignable = FALSE; prop = icalcomponent_get_first_property ( diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index 098726af22..b37ab6dec6 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -27,11 +27,11 @@ #include #include -#include +#include +#include #include "e-util/e-alert-dialog.h" #include "e-util/e-util.h" -#include "calendar/common/authentication.h" #include "calendar/gui/e-task-list-selector.h" #include "calendar/gui/misc.h" @@ -52,7 +52,7 @@ struct _ETaskShellSidebarPrivate { * opened. So the user first highlights a source, then * sometime later we update our default-client property * which is bound by an EBinding to ECalModel. */ - ECal *default_client; + ECalClient *default_client; GCancellable *loading_default_client; }; @@ -76,7 +76,7 @@ static GType task_shell_sidebar_type; static void task_shell_sidebar_emit_client_added (ETaskShellSidebar *task_shell_sidebar, - ECal *client) + ECalClient *client) { guint signal_id = signals[CLIENT_ADDED]; @@ -85,7 +85,7 @@ task_shell_sidebar_emit_client_added (ETaskShellSidebar *task_shell_sidebar, static void task_shell_sidebar_emit_client_removed (ETaskShellSidebar *task_shell_sidebar, - ECal *client) + ECalClient *client) { guint signal_id = signals[CLIENT_REMOVED]; @@ -103,7 +103,7 @@ task_shell_sidebar_emit_status_message (ETaskShellSidebar *task_shell_sidebar, static void task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar, - ECal *client) + ECalClient *client) { EShellView *shell_view; EShellContent *shell_content; @@ -118,7 +118,7 @@ task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar, shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_content = e_shell_view_get_shell_content (shell_view); - source = e_cal_get_source (client); + source = e_client_get_source (E_CLIENT (client)); uid = e_source_peek_uid (source); g_object_ref (source); @@ -136,7 +136,7 @@ task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar, static void task_shell_sidebar_backend_error_cb (ETaskShellSidebar *task_shell_sidebar, const gchar *message, - ECal *client) + ECalClient *client) { EShellView *shell_view; EShellContent *shell_content; @@ -148,7 +148,7 @@ task_shell_sidebar_backend_error_cb (ETaskShellSidebar *task_shell_sidebar, shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_content = e_shell_view_get_shell_content (shell_view); - source = e_cal_get_source (client); + source = e_client_get_source (E_CLIENT (client)); source_group = e_source_peek_group (source); e_alert_submit ( @@ -159,38 +159,43 @@ task_shell_sidebar_backend_error_cb (ETaskShellSidebar *task_shell_sidebar, } static void -task_shell_sidebar_client_opened_cb (ETaskShellSidebar *task_shell_sidebar, - const GError *error, - ECal *client) +task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { + ECalClient *client = E_CAL_CLIENT (source_object); + ETaskShellSidebar *task_shell_sidebar = user_data; EShellView *shell_view; EShellContent *shell_content; EShellSidebar *shell_sidebar; const gchar *message; + GError *error = NULL; shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_content = e_shell_view_get_shell_content (shell_view); - if (g_error_matches (error, E_CALENDAR_ERROR, - E_CALENDAR_STATUS_AUTHENTICATION_FAILED) || - g_error_matches (error, E_CALENDAR_ERROR, - E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED)) - e_auth_cal_forget_password (client); + e_client_open_finish (E_CLIENT (client), result, &error); + + 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, NULL, task_shell_sidebar_client_opened_cb, user_data); + g_clear_error (&error); + return; + } /* Handle errors. */ - switch (error ? error->code : E_CALENDAR_STATUS_OK) { - case E_CALENDAR_STATUS_OK: + switch ((error && error->domain == E_CLIENT_ERROR) ? error->code : -1) { + case -1: break; - case E_CALENDAR_STATUS_AUTHENTICATION_FAILED: - e_cal_open_async (client, FALSE); - return; - - case E_CALENDAR_STATUS_BUSY: + case E_CLIENT_ERROR_BUSY: + g_debug ("%s: Cannot open '%s', it's busy (%s)", G_STRFUNC, e_source_peek_name (e_client_get_source (E_CLIENT (client))), error->message); + g_clear_error (&error); return; - case E_CALENDAR_STATUS_REPOSITORY_OFFLINE: + case E_CLIENT_ERROR_REPOSITORY_OFFLINE: e_alert_submit ( E_ALERT_SINK (shell_content), "calendar:prompt-no-contents-offline-tasks", @@ -198,7 +203,7 @@ task_shell_sidebar_client_opened_cb (ETaskShellSidebar *task_shell_sidebar, /* fall through */ default: - if (error->code != E_CALENDAR_STATUS_REPOSITORY_OFFLINE) { + if (error->code != E_CLIENT_ERROR_REPOSITORY_OFFLINE) { e_alert_submit ( E_ALERT_SINK (shell_content), "calendar:failed-open-tasks", @@ -207,15 +212,12 @@ task_shell_sidebar_client_opened_cb (ETaskShellSidebar *task_shell_sidebar, e_task_shell_sidebar_remove_source ( task_shell_sidebar, - e_cal_get_source (client)); + e_client_get_source (E_CLIENT (client))); + g_clear_error (&error); return; } - g_assert (error == NULL); - - g_signal_handlers_disconnect_matched ( - client, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, - task_shell_sidebar_client_opened_cb, NULL); + g_clear_error (&error); message = _("Loading tasks"); task_shell_sidebar_emit_status_message (task_shell_sidebar, message); @@ -224,27 +226,31 @@ task_shell_sidebar_client_opened_cb (ETaskShellSidebar *task_shell_sidebar, } static void -task_shell_sidebar_default_loaded_cb (ESource *source, - GAsyncResult *result, - EShellSidebar *shell_sidebar) +task_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { + EShellSidebar *shell_sidebar = user_data; ETaskShellSidebarPrivate *priv; EShellContent *shell_content; EShellView *shell_view; - ECal *client; + ETaskShellContent *task_shell_content; + ECalModel *model; + EClient *client = NULL; GError *error = NULL; priv = E_TASK_SHELL_SIDEBAR (shell_sidebar)->priv; shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_content = e_shell_view_get_shell_content (shell_view); + task_shell_content = E_TASK_SHELL_CONTENT (shell_content); + model = e_task_shell_content_get_task_model (task_shell_content); - client = e_load_cal_source_finish (source, result, &error); + if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) + client = NULL; - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) || + g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) { g_error_free (error); goto exit; - } else if (error != NULL) { e_alert_submit ( E_ALERT_SINK (shell_content), @@ -254,16 +260,18 @@ task_shell_sidebar_default_loaded_cb (ESource *source, goto exit; } - g_return_if_fail (E_IS_CAL (client)); + g_return_if_fail (E_IS_CAL_CLIENT (client)); if (priv->default_client != NULL) g_object_unref (priv->default_client); - priv->default_client = client; + priv->default_client = E_CAL_CLIENT (client); + + e_cal_client_set_default_timezone (priv->default_client, e_cal_model_get_timezone (model)); g_object_notify (G_OBJECT (shell_sidebar), "default-client"); -exit: + exit: g_object_unref (shell_sidebar); } @@ -274,29 +282,18 @@ task_shell_sidebar_set_default (ETaskShellSidebar *task_shell_sidebar, ETaskShellSidebarPrivate *priv; EShellView *shell_view; EShellWindow *shell_window; - EShellContent *shell_content; EShellSidebar *shell_sidebar; - ETaskShellContent *task_shell_content; - ECalSourceType source_type; - ECalModel *model; - ECal *client; - icaltimezone *timezone; + ECalClient *client; const gchar *uid; priv = task_shell_sidebar->priv; - source_type = E_CAL_SOURCE_TYPE_TODO; /* 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_content = e_shell_view_get_shell_content (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - task_shell_content = E_TASK_SHELL_CONTENT (shell_content); - model = e_task_shell_content_get_task_model (task_shell_content); - timezone = e_cal_model_get_timezone (model); - /* Cancel any unfinished previous request. */ if (priv->loading_default_client != NULL) { g_cancellable_cancel (priv->loading_default_client); @@ -319,11 +316,9 @@ task_shell_sidebar_set_default (ETaskShellSidebar *task_shell_sidebar, priv->loading_default_client = g_cancellable_new (); - e_load_cal_source_async ( - source, source_type, timezone, - GTK_WINDOW (shell_window), priv->loading_default_client, - (GAsyncReadyCallback) task_shell_sidebar_default_loaded_cb, - g_object_ref (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)); } static void @@ -607,22 +602,22 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar) source = e_source_selector_get_primary_selection (selector); if (source != NULL) { - ECal *client; + ECalClient *client; const gchar *uri; - const gchar *delete; + const gchar *delete_prop; 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); + delete_prop = e_source_get_property (source, "delete"); + can_delete = can_delete && (delete_prop == NULL || strcmp (delete_prop, "no") != 0); client = g_hash_table_lookup ( task_shell_sidebar->priv->client_table, e_source_peek_uid (source)); refresh_supported = - client && e_cal_get_refresh_supported (client); + client && e_client_check_refresh_supported (E_CLIENT (client)); } if (source != NULL) @@ -639,7 +634,7 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar) static void task_shell_sidebar_client_removed (ETaskShellSidebar *task_shell_sidebar, - ECal *client) + ECalClient *client) { ESourceSelector *selector; GHashTable *client_table; @@ -653,7 +648,7 @@ task_shell_sidebar_client_removed (ETaskShellSidebar *task_shell_sidebar, client, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, task_shell_sidebar); - source = e_cal_get_source (client); + source = e_client_get_source (E_CLIENT (client)); uid = e_source_peek_uid (source); g_return_if_fail (uid != NULL); @@ -688,9 +683,9 @@ task_shell_sidebar_class_init (ETaskShellSidebarClass *class) PROP_DEFAULT_CLIENT, g_param_spec_object ( "default-client", - "Default Task Client", + "Default Task ECalClient", "Default client for task operations", - E_TYPE_CAL, + E_TYPE_CAL_CLIENT, G_PARAM_READABLE)); g_object_class_install_property ( @@ -711,7 +706,7 @@ task_shell_sidebar_class_init (ETaskShellSidebarClass *class) NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, - E_TYPE_CAL); + E_TYPE_CAL_CLIENT); signals[CLIENT_REMOVED] = g_signal_new ( "client-removed", @@ -721,7 +716,7 @@ task_shell_sidebar_class_init (ETaskShellSidebarClass *class) NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, - E_TYPE_CAL); + E_TYPE_CAL_CLIENT); signals[STATUS_MESSAGE] = g_signal_new ( "status-message", @@ -804,7 +799,7 @@ e_task_shell_sidebar_get_clients (ETaskShellSidebar *task_shell_sidebar) return g_hash_table_get_values (client_table); } -ECal * +ECalClient * e_task_shell_sidebar_get_default_client (ETaskShellSidebar *task_shell_sidebar) { g_return_val_if_fail ( @@ -830,12 +825,12 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar, EShellContent *shell_content; EShellSidebar *shell_sidebar; ETaskShellContent *task_shell_content; - ECalSourceType source_type; + ECalClientSourceType source_type; ESourceSelector *selector; GHashTable *client_table; ECalModel *model; - ECal *default_client; - ECal *client; + ECalClient *default_client; + ECalClient *client; icaltimezone *timezone; const gchar *uid; const gchar *uri; @@ -844,7 +839,7 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar, g_return_if_fail (E_IS_TASK_SHELL_SIDEBAR (task_shell_sidebar)); g_return_if_fail (E_IS_SOURCE (source)); - source_type = E_CAL_SOURCE_TYPE_TODO; + source_type = E_CAL_CLIENT_SOURCE_TYPE_TASKS; client_table = task_shell_sidebar->priv->client_table; default_client = task_shell_sidebar->priv->default_client; selector = e_task_shell_sidebar_get_selector (task_shell_sidebar); @@ -859,15 +854,18 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar, ESource *default_source; const gchar *default_uid; - default_source = e_cal_get_source (default_client); + default_source = e_client_get_source (E_CLIENT (default_client)); default_uid = e_source_peek_uid (default_source); if (g_strcmp0 (uid, default_uid) == 0) client = g_object_ref (default_client); } - if (client == NULL) - client = e_auth_new_cal_from_source (source, source_type); + 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); @@ -884,17 +882,12 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar, g_hash_table_insert (client_table, g_strdup (uid), client); e_source_selector_select_source (selector, source); - uri = e_cal_get_uri (client); + uri = e_client_get_uri (E_CLIENT (client)); /* Translators: The string field is a URI. */ message = g_strdup_printf (_("Opening tasks at %s"), uri); task_shell_sidebar_emit_status_message (task_shell_sidebar, message); g_free (message); - g_signal_connect_swapped ( - client, "cal-opened-ex", - G_CALLBACK (task_shell_sidebar_client_opened_cb), - 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); @@ -905,8 +898,8 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar, model = e_task_shell_content_get_task_model (task_shell_content); timezone = e_cal_model_get_timezone (model); - e_cal_set_default_timezone (client, timezone, NULL); - e_cal_open_async (client, FALSE); + e_cal_client_set_default_timezone (client, timezone); + e_client_open (E_CLIENT (client), FALSE, NULL, task_shell_sidebar_client_opened_cb, task_shell_sidebar); } void @@ -914,7 +907,7 @@ e_task_shell_sidebar_remove_source (ETaskShellSidebar *task_shell_sidebar, ESource *source) { GHashTable *client_table; - ECal *client; + ECalClient *client; const gchar *uid; g_return_if_fail (E_IS_TASK_SHELL_SIDEBAR (task_shell_sidebar)); diff --git a/modules/calendar/e-task-shell-sidebar.h b/modules/calendar/e-task-shell-sidebar.h index 17e50f8239..24c64cf2af 100644 --- a/modules/calendar/e-task-shell-sidebar.h +++ b/modules/calendar/e-task-shell-sidebar.h @@ -22,7 +22,7 @@ #ifndef E_TASK_SHELL_SIDEBAR_H #define E_TASK_SHELL_SIDEBAR_H -#include +#include #include #include @@ -70,9 +70,9 @@ struct _ETaskShellSidebarClass { /* Signals */ void (*client_added) (ETaskShellSidebar *task_shell_sidebar, - ECal *client); + ECalClient *client); void (*client_removed) (ETaskShellSidebar *task_shell_sidebar, - ECal *client); + ECalClient *client); void (*status_message) (ETaskShellSidebar *task_shell_sidebar, const gchar *status_message, gdouble percent); @@ -85,7 +85,7 @@ GtkWidget * e_task_shell_sidebar_new (EShellView *shell_view); GList * e_task_shell_sidebar_get_clients (ETaskShellSidebar *task_shell_sidebar); -ECal * e_task_shell_sidebar_get_default_client +ECalClient * e_task_shell_sidebar_get_default_client (ETaskShellSidebar *task_shell_sidebar); ESourceSelector * e_task_shell_sidebar_get_selector diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c index 297120e29c..4938452309 100644 --- a/modules/calendar/e-task-shell-view-actions.c +++ b/modules/calendar/e-task-shell-view-actions.c @@ -144,7 +144,7 @@ action_task_list_copy_cb (GtkAction *action, copy_source_dialog ( GTK_WINDOW (shell_window), - source, E_CAL_SOURCE_TYPE_TODO); + source, E_CAL_CLIENT_SOURCE_TYPE_TASKS); } static void @@ -157,7 +157,7 @@ action_task_list_delete_cb (GtkAction *action, EShellWindow *shell_window; EShellView *shell_view; ETaskTable *task_table; - ECal *client; + ECalClient *client; ECalModel *model; ESourceSelector *selector; ESourceGroup *source_group; @@ -193,14 +193,14 @@ action_task_list_delete_cb (GtkAction *action, uri = e_source_get_uri (source); client = e_cal_model_get_client_for_uri (model, uri); if (client == NULL) - client = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_JOURNAL); + client = e_cal_client_new_from_uri (uri, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL); g_free (uri); g_return_if_fail (client != NULL); - if (!e_cal_remove (client, &error)) { - g_warning ("%s", error->message); - g_error_free (error); + if (!e_client_remove_sync (E_CLIENT (client), NULL, &error)) { + g_debug ("%s: Failed to remove client: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); return; } @@ -214,8 +214,8 @@ action_task_list_delete_cb (GtkAction *action, e_source_group_remove_source (source_group, source); if (!e_source_list_sync (source_list, &error)) { - g_warning ("%s", error->message); - g_error_free (error); + g_debug ("%s: Failed to sync srouce list: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); } } @@ -289,7 +289,7 @@ action_task_list_refresh_cb (GtkAction *action, ETaskShellContent *task_shell_content; ETaskShellSidebar *task_shell_sidebar; ESourceSelector *selector; - ECal *client; + ECalClient *client; ECalModel *model; ESource *source; gchar *uri; @@ -311,14 +311,11 @@ action_task_list_refresh_cb (GtkAction *action, if (client == NULL) return; - g_return_if_fail (e_cal_get_refresh_supported (client)); + g_return_if_fail (e_client_check_refresh_supported (E_CLIENT (client))); - if (!e_cal_refresh (client, &error) && error) { - g_warning ( - "%s: Failed to refresh '%s', %s\n", - G_STRFUNC, e_source_peek_name (source), - error->message); - g_error_free (error); + if (!e_client_refresh_sync (E_CLIENT (client), NULL, &error)) { + g_debug ("%s: Failed to refresh '%s', %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); + g_clear_error (&error); } } @@ -407,7 +404,7 @@ action_task_new_cb (GtkAction *action, EShellWindow *shell_window; ETaskShellContent *task_shell_content; ETaskTable *task_table; - ECal *client; + ECalClient *client; ECalComponent *comp; CompEditor *editor; GSList *list; @@ -635,7 +632,7 @@ action_task_save_as_cb (GtkAction *action, return; /* XXX We only save the first selected task. */ - string = e_cal_get_component_as_string ( + string = e_cal_client_get_component_as_string ( comp_data->client, comp_data->icalcomp); if (string == NULL) { g_warning ("Could not convert task to a string"); diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c index 0ce8339849..77e4beae1e 100644 --- a/modules/calendar/e-task-shell-view-private.c +++ b/modules/calendar/e-task-shell-view-private.c @@ -34,13 +34,13 @@ task_shell_view_model_row_appended_cb (ETaskShellView *task_shell_view, ECalModel *model) { ETaskShellSidebar *task_shell_sidebar; - ECal *client; + ECalClient *client; ESource *source; /* This is the "Click to Add" handler. */ client = e_cal_model_get_default_client (model); - source = e_cal_get_source (client); + source = e_client_get_source (E_CLIENT (client)); task_shell_sidebar = task_shell_view->priv->task_shell_sidebar; e_task_shell_sidebar_add_source (task_shell_sidebar, source); @@ -81,7 +81,7 @@ task_shell_view_table_popup_event_cb (EShellView *shell_view, static void task_shell_view_selector_client_added_cb (ETaskShellView *task_shell_view, - ECal *client) + ECalClient *client) { ETaskShellContent *task_shell_content; ETaskTable *task_table; @@ -97,7 +97,7 @@ task_shell_view_selector_client_added_cb (ETaskShellView *task_shell_view, static void task_shell_view_selector_client_removed_cb (ETaskShellView *task_shell_view, - ECal *client) + ECalClient *client) { ETaskShellContent *task_shell_content; ETaskTable *task_table; @@ -472,39 +472,33 @@ e_task_shell_view_delete_completed (ETaskShellView *task_shell_view) task_shell_view, _("Expunging"), -1.0); for (iter = list; iter != NULL; iter = iter->next) { - ECal *client = E_CAL (iter->data); - GList *objects; - gboolean read_only = TRUE; + ECalClient *client = E_CAL_CLIENT (iter->data); + GSList *objects, *obj; GError *error = NULL; - if (!e_cal_is_read_only (client, &read_only, &error)) { - g_warning ("%s", error->message); - g_error_free (error); - continue; - } - - if (read_only) + if (e_client_is_readonly (E_CLIENT (client))) continue; - if (!e_cal_get_object_list (client, sexp, &objects, &error)) { - g_warning ("%s", error->message); - g_error_free (error); + if (!e_cal_client_get_object_list_sync (client, sexp, &objects, NULL, &error)) { + g_debug ("%s: Failed to get object list: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); continue; } - while (objects != NULL) { - icalcomponent *component = objects->data; + for (obj = objects; obj != NULL; obj = obj->next) { + icalcomponent *component = obj->data; const gchar *uid; uid = icalcomponent_get_uid (component); - if (!e_cal_remove_object (client, uid, &error)) { - g_warning ("%s", error->message); + if (!e_cal_client_remove_object_sync (client, uid, NULL, CALOBJ_MOD_THIS, NULL, &error)) { + g_debug ("%s: Failed to remove object: %s", G_STRFUNC, error ? error->message : "Unknown error"); g_clear_error (&error); } icalcomponent_free (component); - objects = g_list_delete_link (objects, objects); } + + e_cal_client_free_icalcomp_slist (objects); } e_task_shell_view_set_status_message (task_shell_view, NULL, -1.0); @@ -603,10 +597,10 @@ e_task_shell_view_update_timezone (ETaskShellView *task_shell_view) clients = e_task_shell_sidebar_get_clients (task_shell_sidebar); for (iter = clients; iter != NULL; iter = iter->next) { - ECal *client = iter->data; + ECalClient *client = iter->data; - if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED) - e_cal_set_default_timezone (client, timezone, NULL); + if (e_client_is_opened (E_CLIENT (client))) + e_cal_client_set_default_timezone (client, timezone); } g_list_free (clients); diff --git a/modules/calendar/e-task-shell-view-private.h b/modules/calendar/e-task-shell-view-private.h index b7dace83b7..ec2173f201 100644 --- a/modules/calendar/e-task-shell-view-private.h +++ b/modules/calendar/e-task-shell-view-private.h @@ -29,6 +29,7 @@ #include #include #include +#include #include "e-util/e-dialog-utils.h" #include "e-util/e-file-utils.h" @@ -38,7 +39,6 @@ #include "misc/e-popup-action.h" #include "misc/e-selectable.h" -#include "calendar/common/authentication.h" #include "calendar/gui/calendar-config.h" #include "calendar/gui/comp-util.h" #include "calendar/gui/e-cal-component-preview.h" -- cgit v1.2.3 From 46eec90c098d5b239035568ae5c25ae9127a8373 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 27 Jun 2011 11:31:32 +0200 Subject: Bug #653154 - Crash when constructing calendar view --- modules/calendar/e-cal-shell-sidebar.c | 25 ++++++++++++++++++++----- modules/calendar/e-memo-shell-sidebar.c | 25 ++++++++++++++++++++----- modules/calendar/e-task-shell-sidebar.c | 25 ++++++++++++++++++++----- 3 files changed, 60 insertions(+), 15 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index 8e3010ddb7..e33a7dcd06 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -163,6 +163,24 @@ cal_shell_sidebar_backend_error_cb (ECalShellSidebar *cal_shell_sidebar, e_source_peek_name (source), message, NULL); } +static void +cal_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +{ + ECalClient *client = E_CAL_CLIENT (source_object); + ECalShellSidebar *cal_shell_sidebar = user_data; + gchar *capabilities = NULL; + + g_return_if_fail (client != NULL); + g_return_if_fail (cal_shell_sidebar != NULL); + + e_client_retrieve_capabilities_finish (E_CLIENT (client), result, &capabilities, NULL); + g_free (capabilities); + + cal_shell_sidebar_emit_status_message (cal_shell_sidebar, _("Loading calendars")); + cal_shell_sidebar_emit_client_added (cal_shell_sidebar, client); + cal_shell_sidebar_emit_status_message (cal_shell_sidebar, NULL); +} + static void cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { @@ -171,7 +189,6 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result EShellView *shell_view; EShellContent *shell_content; EShellSidebar *shell_sidebar; - const gchar *message; GError *error = NULL; shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar); @@ -224,10 +241,8 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result g_clear_error (&error); - message = _("Loading calendars"); - cal_shell_sidebar_emit_status_message (cal_shell_sidebar, message); - cal_shell_sidebar_emit_client_added (cal_shell_sidebar, client); - cal_shell_sidebar_emit_status_message (cal_shell_sidebar, NULL); + /* to have them ready for later use */ + e_client_retrieve_capabilities (E_CLIENT (client), NULL, cal_shell_sidebar_retrieve_capabilies_cb, cal_shell_sidebar); } static void diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index 5a28611652..213179cc3a 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -158,6 +158,24 @@ memo_shell_sidebar_backend_error_cb (EMemoShellSidebar *memo_shell_sidebar, e_source_peek_name (source), message, NULL); } +static void +memo_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +{ + ECalClient *client = E_CAL_CLIENT (source_object); + EMemoShellSidebar *memo_shell_sidebar = user_data; + gchar *capabilities = NULL; + + g_return_if_fail (client != NULL); + g_return_if_fail (memo_shell_sidebar != NULL); + + e_client_retrieve_capabilities_finish (E_CLIENT (client), result, &capabilities, NULL); + g_free (capabilities); + + memo_shell_sidebar_emit_status_message (memo_shell_sidebar, _("Loading memos")); + memo_shell_sidebar_emit_client_added (memo_shell_sidebar, client); + memo_shell_sidebar_emit_status_message (memo_shell_sidebar, NULL); +} + static void memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { @@ -166,7 +184,6 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul EShellView *shell_view; EShellContent *shell_content; EShellSidebar *shell_sidebar; - const gchar *message; GError *error = NULL; shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar); @@ -219,10 +236,8 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul g_clear_error (&error); - message = _("Loading memos"); - memo_shell_sidebar_emit_status_message (memo_shell_sidebar, message); - memo_shell_sidebar_emit_client_added (memo_shell_sidebar, client); - memo_shell_sidebar_emit_status_message (memo_shell_sidebar, NULL); + /* to have them ready for later use */ + e_client_retrieve_capabilities (E_CLIENT (client), NULL, memo_shell_sidebar_retrieve_capabilies_cb, memo_shell_sidebar); } static void diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index b37ab6dec6..04d2c25342 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -158,6 +158,24 @@ task_shell_sidebar_backend_error_cb (ETaskShellSidebar *task_shell_sidebar, e_source_peek_name (source), message, NULL); } +static void +task_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +{ + ECalClient *client = E_CAL_CLIENT (source_object); + ETaskShellSidebar *task_shell_sidebar = user_data; + gchar *capabilities = NULL; + + g_return_if_fail (client != NULL); + g_return_if_fail (task_shell_sidebar != NULL); + + e_client_retrieve_capabilities_finish (E_CLIENT (client), result, &capabilities, NULL); + g_free (capabilities); + + task_shell_sidebar_emit_status_message (task_shell_sidebar, _("Loading tasks")); + task_shell_sidebar_emit_client_added (task_shell_sidebar, client); + task_shell_sidebar_emit_status_message (task_shell_sidebar, NULL); +} + static void task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { @@ -166,7 +184,6 @@ task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul EShellView *shell_view; EShellContent *shell_content; EShellSidebar *shell_sidebar; - const gchar *message; GError *error = NULL; shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar); @@ -219,10 +236,8 @@ task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul g_clear_error (&error); - message = _("Loading tasks"); - task_shell_sidebar_emit_status_message (task_shell_sidebar, message); - task_shell_sidebar_emit_client_added (task_shell_sidebar, client); - task_shell_sidebar_emit_status_message (task_shell_sidebar, NULL); + /* to have them ready for later use */ + e_client_retrieve_capabilities (E_CLIENT (client), NULL, task_shell_sidebar_retrieve_capabilies_cb, task_shell_sidebar); } static void -- cgit v1.2.3 From 05933ef483635b84514eb285d4d839b87c3b3afb Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 27 Jun 2011 15:23:31 +0200 Subject: Keep opening EClient-s till they report busy error --- modules/calendar/e-cal-shell-content.c | 1 - modules/calendar/e-cal-shell-sidebar.c | 96 ++++++++++++++++++++++++++++----- modules/calendar/e-memo-shell-sidebar.c | 95 +++++++++++++++++++++++++++----- modules/calendar/e-task-shell-sidebar.c | 95 +++++++++++++++++++++++++++----- 4 files changed, 250 insertions(+), 37 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c index e85f9201cc..b4297b9fcd 100644 --- a/modules/calendar/e-cal-shell-content.c +++ b/modules/calendar/e-cal-shell-content.c @@ -279,7 +279,6 @@ cal_shell_content_dispose (GObject *object) } if (priv->calendar != NULL) { - gnome_calendar_dispose (GNOME_CALENDAR (priv->calendar)); g_object_unref (priv->calendar); priv->calendar = NULL; } diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index e33a7dcd06..efa233e019 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -59,6 +59,7 @@ struct _ECalShellSidebarPrivate { ECalClient *default_client; GCancellable *loading_default_client; + GCancellable *loading_clients; }; enum { @@ -181,6 +182,28 @@ cal_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult * cal_shell_sidebar_emit_status_message (cal_shell_sidebar, NULL); } +static gboolean cal_shell_sidebar_retry_open_timeout_cb (gpointer user_data); + +struct RetryOpenData +{ + EClient *client; + ECalShellSidebar *cal_shell_sidebar; + GCancellable *cancellable; +}; + +static void +free_retry_open_data (gpointer data) +{ + struct RetryOpenData *rod = data; + + if (!rod) + return; + + g_object_unref (rod->client); + g_object_unref (rod->cancellable); + g_free (rod); +} + static void cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { @@ -191,22 +214,44 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result EShellSidebar *shell_sidebar; GError *error = NULL; - shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar); - shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_content = e_shell_view_get_shell_content (shell_view); - e_client_open_finish (E_CLIENT (client), result, &error); + if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || + g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_clear_error (&error); + 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, NULL, cal_shell_sidebar_client_opened_cb, user_data); + 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; + + rod = g_new0 (struct RetryOpenData, 1); + rod->client = g_object_ref (client); + rod->cal_shell_sidebar = cal_shell_sidebar; + rod->cancellable = g_object_ref (cal_shell_sidebar->priv->loading_clients); + + /* postpone for 1/2 of a second, backend is busy now */ + g_timeout_add_full (G_PRIORITY_DEFAULT, 500, cal_shell_sidebar_retry_open_timeout_cb, rod, free_retry_open_data); + + g_clear_error (&error); + return; + } + + shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar); + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); + /* Handle errors. */ switch ((error && error->domain == E_CLIENT_ERROR) ? error->code : -1) { case -1: @@ -245,6 +290,24 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result e_client_retrieve_capabilities (E_CLIENT (client), NULL, cal_shell_sidebar_retrieve_capabilies_cb, cal_shell_sidebar); } +static gboolean +cal_shell_sidebar_retry_open_timeout_cb (gpointer user_data) +{ + struct RetryOpenData *rod = user_data; + + g_return_val_if_fail (rod != NULL, FALSE); + g_return_val_if_fail (rod->client != NULL, FALSE); + g_return_val_if_fail (rod->cal_shell_sidebar != NULL, FALSE); + g_return_val_if_fail (rod->cancellable != NULL, FALSE); + + if (g_cancellable_is_cancelled (rod->cancellable)) + return FALSE; + + e_client_open (rod->client, FALSE, rod->cal_shell_sidebar->priv->loading_clients, cal_shell_sidebar_client_opened_cb, rod->cal_shell_sidebar); + + return FALSE; +} + static void cal_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { @@ -259,11 +322,6 @@ cal_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resul priv = E_CAL_SHELL_SIDEBAR (shell_sidebar)->priv; - shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_content = e_shell_view_get_shell_content (shell_view); - cal_shell_content = E_CAL_SHELL_CONTENT (shell_content); - model = e_cal_shell_content_get_model (cal_shell_content); - if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) client = NULL; @@ -271,7 +329,14 @@ cal_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resul g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) { g_error_free (error); goto exit; - } else if (error != NULL) { + } + + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); + cal_shell_content = E_CAL_SHELL_CONTENT (shell_content); + model = e_cal_shell_content_get_model (cal_shell_content); + + if (error != NULL) { e_alert_submit ( E_ALERT_SINK (shell_content), "calendar:failed-open-calendar", @@ -560,6 +625,12 @@ cal_shell_sidebar_dispose (GObject *object) priv->loading_default_client = NULL; } + if (priv->loading_clients != NULL) { + g_cancellable_cancel (priv->loading_clients); + g_object_unref (priv->loading_clients); + priv->loading_clients = NULL; + } + g_hash_table_remove_all (priv->client_table); /* Chain up to parent's dispose() method. */ @@ -864,6 +935,7 @@ cal_shell_sidebar_init (ECalShellSidebar *cal_shell_sidebar) ECalShellSidebarPrivate); cal_shell_sidebar->priv->client_table = client_table; + cal_shell_sidebar->priv->loading_clients = g_cancellable_new (); /* Postpone widget construction until we have a shell view. */ } @@ -1027,7 +1099,7 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar, timezone = e_cal_model_get_timezone (model); e_cal_client_set_default_timezone (client, timezone); - e_client_open (E_CLIENT (client), FALSE, NULL, cal_shell_sidebar_client_opened_cb, cal_shell_sidebar); + e_client_open (E_CLIENT (client), FALSE, cal_shell_sidebar->priv->loading_clients, cal_shell_sidebar_client_opened_cb, cal_shell_sidebar); } void diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index 213179cc3a..01806199bb 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -55,6 +55,7 @@ struct _EMemoShellSidebarPrivate { ECalClient *default_client; GCancellable *loading_default_client; + GCancellable *loading_clients; }; enum { @@ -176,6 +177,28 @@ memo_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult memo_shell_sidebar_emit_status_message (memo_shell_sidebar, NULL); } +static gboolean memo_shell_sidebar_retry_open_timeout_cb (gpointer user_data); + +struct RetryOpenData +{ + EClient *client; + EMemoShellSidebar *memo_shell_sidebar; + GCancellable *cancellable; +}; + +static void +free_retry_open_data (gpointer data) +{ + struct RetryOpenData *rod = data; + + if (!rod) + return; + + g_object_unref (rod->client); + g_object_unref (rod->cancellable); + g_free (rod); +} + static void memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { @@ -186,22 +209,43 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul EShellSidebar *shell_sidebar; GError *error = NULL; - shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar); - shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_content = e_shell_view_get_shell_content (shell_view); - e_client_open_finish (E_CLIENT (client), result, &error); + if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || + g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_clear_error (&error); + 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, NULL, memo_shell_sidebar_client_opened_cb, user_data); + 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; + + rod = g_new0 (struct RetryOpenData, 1); + rod->client = g_object_ref (client); + rod->memo_shell_sidebar = memo_shell_sidebar; + rod->cancellable = g_object_ref (memo_shell_sidebar->priv->loading_clients); + + /* postpone for 1/2 of a second, backend is busy now */ + g_timeout_add_full (G_PRIORITY_DEFAULT, 500, memo_shell_sidebar_retry_open_timeout_cb, rod, free_retry_open_data); + g_clear_error (&error); return; } + shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar); + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); + /* Handle errors. */ switch ((error && error->domain == E_CLIENT_ERROR) ? error->code : -1) { case -1: @@ -240,6 +284,24 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul e_client_retrieve_capabilities (E_CLIENT (client), NULL, memo_shell_sidebar_retrieve_capabilies_cb, memo_shell_sidebar); } +static gboolean +memo_shell_sidebar_retry_open_timeout_cb (gpointer user_data) +{ + struct RetryOpenData *rod = user_data; + + g_return_val_if_fail (rod != NULL, FALSE); + g_return_val_if_fail (rod->client != NULL, FALSE); + g_return_val_if_fail (rod->memo_shell_sidebar != NULL, FALSE); + g_return_val_if_fail (rod->cancellable != NULL, FALSE); + + if (g_cancellable_is_cancelled (rod->cancellable)) + return FALSE; + + e_client_open (rod->client, FALSE, rod->memo_shell_sidebar->priv->loading_clients, memo_shell_sidebar_client_opened_cb, rod->memo_shell_sidebar); + + return FALSE; +} + static void memo_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { @@ -254,11 +316,6 @@ memo_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu priv = E_MEMO_SHELL_SIDEBAR (shell_sidebar)->priv; - shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_content = e_shell_view_get_shell_content (shell_view); - memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content); - model = e_memo_shell_content_get_memo_model (memo_shell_content); - if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) client = NULL; @@ -266,7 +323,14 @@ memo_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) { g_error_free (error); goto exit; - } else if (error != NULL) { + } + + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); + memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content); + model = e_memo_shell_content_get_memo_model (memo_shell_content); + + if (error != NULL) { e_alert_submit ( E_ALERT_SINK (shell_content), "calendar:failed-open-memos", @@ -527,6 +591,12 @@ memo_shell_sidebar_dispose (GObject *object) priv->loading_default_client = NULL; } + if (priv->loading_clients != NULL) { + g_cancellable_cancel (priv->loading_clients); + g_object_unref (priv->loading_clients); + priv->loading_clients = NULL; + } + g_hash_table_remove_all (priv->client_table); /* Chain up to parent's dispose() method. */ @@ -760,6 +830,7 @@ memo_shell_sidebar_init (EMemoShellSidebar *memo_shell_sidebar) EMemoShellSidebarPrivate); memo_shell_sidebar->priv->client_table = client_table; + memo_shell_sidebar->priv->loading_clients = g_cancellable_new (); /* Postpone widget construction until we have a shell view. */ } @@ -914,7 +985,7 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar, timezone = e_cal_model_get_timezone (model); e_cal_client_set_default_timezone (client, timezone); - e_client_open (E_CLIENT (client), FALSE, NULL, memo_shell_sidebar_client_opened_cb, memo_shell_sidebar); + e_client_open (E_CLIENT (client), FALSE, memo_shell_sidebar->priv->loading_clients, memo_shell_sidebar_client_opened_cb, memo_shell_sidebar); } void diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index 04d2c25342..dbb1ba9014 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -55,6 +55,7 @@ struct _ETaskShellSidebarPrivate { ECalClient *default_client; GCancellable *loading_default_client; + GCancellable *loading_clients; }; enum { @@ -176,6 +177,28 @@ task_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult task_shell_sidebar_emit_status_message (task_shell_sidebar, NULL); } +static gboolean task_shell_sidebar_retry_open_timeout_cb (gpointer user_data); + +struct RetryOpenData +{ + EClient *client; + ETaskShellSidebar *task_shell_sidebar; + GCancellable *cancellable; +}; + +static void +free_retry_open_data (gpointer data) +{ + struct RetryOpenData *rod = data; + + if (!rod) + return; + + g_object_unref (rod->client); + g_object_unref (rod->cancellable); + g_free (rod); +} + static void task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { @@ -186,22 +209,43 @@ task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul EShellSidebar *shell_sidebar; GError *error = NULL; - shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar); - shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_content = e_shell_view_get_shell_content (shell_view); - e_client_open_finish (E_CLIENT (client), result, &error); + if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || + g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_clear_error (&error); + 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, NULL, task_shell_sidebar_client_opened_cb, user_data); + 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; + + rod = g_new0 (struct RetryOpenData, 1); + rod->client = g_object_ref (client); + rod->task_shell_sidebar = task_shell_sidebar; + rod->cancellable = g_object_ref (task_shell_sidebar->priv->loading_clients); + + /* postpone for 1/2 of a second, backend is busy now */ + g_timeout_add_full (G_PRIORITY_DEFAULT, 500, task_shell_sidebar_retry_open_timeout_cb, rod, free_retry_open_data); + g_clear_error (&error); return; } + shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar); + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); + /* Handle errors. */ switch ((error && error->domain == E_CLIENT_ERROR) ? error->code : -1) { case -1: @@ -240,6 +284,24 @@ task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul e_client_retrieve_capabilities (E_CLIENT (client), NULL, task_shell_sidebar_retrieve_capabilies_cb, task_shell_sidebar); } +static gboolean +task_shell_sidebar_retry_open_timeout_cb (gpointer user_data) +{ + struct RetryOpenData *rod = user_data; + + g_return_val_if_fail (rod != NULL, FALSE); + g_return_val_if_fail (rod->client != NULL, FALSE); + g_return_val_if_fail (rod->task_shell_sidebar != NULL, FALSE); + g_return_val_if_fail (rod->cancellable != NULL, FALSE); + + if (g_cancellable_is_cancelled (rod->cancellable)) + return FALSE; + + e_client_open (rod->client, FALSE, rod->task_shell_sidebar->priv->loading_clients, task_shell_sidebar_client_opened_cb, rod->task_shell_sidebar); + + return FALSE; +} + static void task_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { @@ -254,11 +316,6 @@ task_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu priv = E_TASK_SHELL_SIDEBAR (shell_sidebar)->priv; - shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_content = e_shell_view_get_shell_content (shell_view); - task_shell_content = E_TASK_SHELL_CONTENT (shell_content); - model = e_task_shell_content_get_task_model (task_shell_content); - if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) client = NULL; @@ -266,7 +323,14 @@ task_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) { g_error_free (error); goto exit; - } else if (error != NULL) { + } + + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); + task_shell_content = E_TASK_SHELL_CONTENT (shell_content); + model = e_task_shell_content_get_task_model (task_shell_content); + + if (error != NULL) { e_alert_submit ( E_ALERT_SINK (shell_content), "calendar:failed-open-tasks", @@ -527,6 +591,12 @@ task_shell_sidebar_dispose (GObject *object) priv->loading_default_client = NULL; } + if (priv->loading_clients != NULL) { + g_cancellable_cancel (priv->loading_clients); + g_object_unref (priv->loading_clients); + priv->loading_clients = NULL; + } + g_hash_table_remove_all (priv->client_table); /* Chain up to parent's dispose() method. */ @@ -760,6 +830,7 @@ task_shell_sidebar_init (ETaskShellSidebar *task_shell_sidebar) ETaskShellSidebarPrivate); task_shell_sidebar->priv->client_table = client_table; + task_shell_sidebar->priv->loading_clients = g_cancellable_new (); /* Postpone widget construction until we have a shell view. */ } @@ -914,7 +985,7 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar, timezone = e_cal_model_get_timezone (model); e_cal_client_set_default_timezone (client, timezone); - e_client_open (E_CLIENT (client), FALSE, NULL, task_shell_sidebar_client_opened_cb, task_shell_sidebar); + e_client_open (E_CLIENT (client), FALSE, task_shell_sidebar->priv->loading_clients, task_shell_sidebar_client_opened_cb, task_shell_sidebar); } void -- cgit v1.2.3 From 566d861915da77e93b097a927a79f0130de8c535 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 27 Jun 2011 18:04:57 +0200 Subject: Check for cancelled GIO operation error code too --- modules/calendar/e-cal-shell-sidebar.c | 4 ++-- modules/calendar/e-memo-shell-sidebar.c | 4 ++-- modules/calendar/e-task-shell-sidebar.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index efa233e019..e296f6ff31 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -325,8 +325,8 @@ cal_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resul if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) client = NULL; - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) || - g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) { + if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || + g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { g_error_free (error); goto exit; } diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index 01806199bb..cf38c219b5 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -319,8 +319,8 @@ memo_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) client = NULL; - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) || - g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) { + if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || + g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { g_error_free (error); goto exit; } diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index dbb1ba9014..3e693afd7e 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -319,8 +319,8 @@ task_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) client = NULL; - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) || - g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) { + if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || + g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { g_error_free (error); goto exit; } -- cgit v1.2.3 From 87c04cfc2ccd7ffea028ee4e1d7a7e5d554ca056 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 29 Jun 2011 23:08:37 +0200 Subject: Add a bit more error checking and do not leak icalcomponent-s --- modules/calendar/e-cal-shell-backend.c | 10 +++++++--- modules/calendar/e-cal-shell-view-private.c | 3 +-- modules/calendar/e-memo-shell-backend.c | 6 +++++- modules/calendar/e-task-shell-backend.c | 10 +++++++--- 4 files changed, 20 insertions(+), 9 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 8d0c6ef36a..4b2692e420 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -624,10 +624,14 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend, } comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (comp, icalcomp); + if (!e_cal_component_set_icalcomponent (comp, icalcomp)) { + g_debug ("%s: Failed to set icalcomp to comp\n", G_STRFUNC); + icalcomponent_free (icalcomp); + icalcomp = NULL; + } - icalprop = icalcomponent_get_first_property ( - icalcomp, ICAL_ATTENDEE_PROPERTY); + icalprop = icalcomp ? icalcomponent_get_first_property ( + icalcomp, ICAL_ATTENDEE_PROPERTY) : NULL; if (icalprop != NULL) flags |= COMP_EDITOR_MEETING; diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c index d4cee1a627..0ca3f344ec 100644 --- a/modules/calendar/e-cal-shell-view-private.c +++ b/modules/calendar/e-cal-shell-view-private.c @@ -871,8 +871,7 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view, if (success) { /* Use master object when working * with a recurring event ... */ - icalcomp_clone = - icalcomponent_new_clone (icalcomp); + icalcomp_clone = icalcomponent_new_clone (icalcomp); icalcomponent_free (icalcomp); } else { /* ... or remove the recurrence ID ... */ diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c index 8d39843054..2be78895f6 100644 --- a/modules/calendar/e-memo-shell-backend.c +++ b/modules/calendar/e-memo-shell-backend.c @@ -419,7 +419,11 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend, } comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (comp, icalcomp); + if (!e_cal_component_set_icalcomponent (comp, icalcomp)) { + g_debug ("%s: Failed to set icalcomp to comp\n", G_STRFUNC); + icalcomponent_free (icalcomp); + icalcomp = NULL; + } if (e_cal_component_has_organizer (comp)) flags |= COMP_EDITOR_IS_SHARED; diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c index 768f46fd28..ebee92479b 100644 --- a/modules/calendar/e-task-shell-backend.c +++ b/modules/calendar/e-task-shell-backend.c @@ -419,10 +419,14 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend, } comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (comp, icalcomp); + if (!e_cal_component_set_icalcomponent (comp, icalcomp)) { + g_debug ("%s: Failed to set icalcomp to comp\n", G_STRFUNC); + icalcomponent_free (icalcomp); + icalcomp = NULL; + } - icalprop = icalcomponent_get_first_property ( - icalcomp, ICAL_ATTENDEE_PROPERTY); + icalprop = icalcomp ? icalcomponent_get_first_property ( + icalcomp, ICAL_ATTENDEE_PROPERTY) : NULL; if (icalprop != NULL) flags |= COMP_EDITOR_IS_ASSIGNED; -- cgit v1.2.3 From 1b1697630caf05f1831f6d9a1dd5e8c3f3def429 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 30 Jun 2011 14:19:59 -0400 Subject: Bug 652958 - Evolution Account Assistant jumps steps The GTK+ patch in bug 653705 is also required for the Account Assistant to work properly under the new GtkAssistant design in GTK+ 3.1. This commit only deals with sidebar ordering issues. --- modules/calendar/e-calendar-preferences.c | 1 + 1 file changed, 1 insertion(+) (limited to 'modules/calendar') diff --git a/modules/calendar/e-calendar-preferences.c b/modules/calendar/e-calendar-preferences.c index f35c88a6ed..40ba9c7937 100644 --- a/modules/calendar/e-calendar-preferences.c +++ b/modules/calendar/e-calendar-preferences.c @@ -158,6 +158,7 @@ calendar_preferences_get_config_widget (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, + gint position, gpointer data) { ECalendarPreferences *preferences = data; -- cgit v1.2.3 From 44e007e171208094f5d763f5826064fc71071b51 Mon Sep 17 00:00:00 2001 From: Chenthill Palanisamy Date: Fri, 15 Jul 2011 11:27:49 +0530 Subject: Make "open_calendar" function as expected. --- modules/calendar/e-cal-shell-backend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 4b2692e420..744cd60b18 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -536,7 +536,7 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend, header = (gchar *) cp; header[header_len] = '\0'; - cp += header_len + 1; + cp += header_len + 2; content_len = strcspn (cp, "&"); @@ -557,7 +557,7 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend, comp_rid = g_strdup (content); g_free (content); - cp += content_len; + cp += content_len + 1; if (*cp == '&') { cp++; if (strcmp (cp, "amp;") == 0) -- cgit v1.2.3 From 5583c88321df3cc36a82befaa050e5c9322bc1af Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 28 Jul 2011 09:45:31 +0200 Subject: Bug #655444 - Alarm/reminder settings split in two tabs in Settings --- modules/calendar/e-calendar-preferences.ui | 314 +++++++++++++++++------------ 1 file changed, 184 insertions(+), 130 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-calendar-preferences.ui b/modules/calendar/e-calendar-preferences.ui index 7e581cf4ad..c01f568273 100644 --- a/modules/calendar/e-calendar-preferences.ui +++ b/modules/calendar/e-calendar-preferences.ui @@ -352,6 +352,7 @@ False + False 1 @@ -662,6 +663,7 @@ False + False 3 @@ -713,128 +715,6 @@ 0 - - - True - 4 - - - Sh_ow a reminder - True - True - False - True - True - - - False - False - 0 - - - - - True - True - adjustment1 - 1 - - - 1 - - - - - True - model2 - - - - 0 - - - - - 2 - - - - - True - before every appointment - - - False - False - 3 - - - - - 1 - - - - - True - 4 - - - Show a _reminder - True - True - False - True - True - - - False - False - 0 - - - - - True - True - adjustment2 - 1 - - - 1 - - - - - True - model3 - - - - 0 - - - - - 2 - - - - - True - before every anniversary/birthday - - - False - False - 3 - - - - - 2 - - 1 @@ -843,10 +723,26 @@ False + False 5 + + + True + + + True + True + 6 + + + + False + False + 0 + @@ -855,6 +751,8 @@ False + False + 0 @@ -1235,6 +1133,8 @@ + False + False 1 @@ -1273,18 +1173,166 @@ True 10 + 10 - - Display alarms in _notification area only + True - True - False - True - True + False + 4 + + + Display alarms in _notification area only + True + True + False + True + True + + + False + False + 1 + + + + + True + 4 + + + Sh_ow a reminder + True + True + False + True + True + + + False + False + 0 + + + + + True + True + adjustment1 + 1 + + + False + False + 1 + + + + + True + model2 + + + + 0 + + + + + False + False + 2 + + + + + True + before every appointment + + + False + False + 3 + + + + + False + False + 1 + + + + + True + 4 + + + Show a _reminder + True + True + False + True + True + + + False + False + 0 + + + + + True + True + adjustment2 + 1 + + + False + False + 1 + + + + + True + model3 + + + + 0 + + + + + False + False + 2 + + + + + True + before every anniversary/birthday + + + False + False + 3 + + + + + False + False + 2 + + + False False 1 @@ -1318,6 +1366,8 @@ + False + False 2 @@ -1327,8 +1377,9 @@ Alarms - 2 False + False + 2 @@ -1417,6 +1468,8 @@ + False + False 3 @@ -1426,8 +1479,9 @@ Free/Busy - 3 + False False + 3 -- cgit v1.2.3 From 444011c99f83b1b3afde86862e7efe7fc348744d Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Tue, 2 Aug 2011 11:29:12 +0200 Subject: Replace alarm by reminder for UI consistency. Fixes bug #340614 --- modules/calendar/apps_evolution_calendar.schemas.in | 18 +++++++++--------- modules/calendar/e-calendar-preferences.c | 2 +- modules/calendar/e-calendar-preferences.ui | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/apps_evolution_calendar.schemas.in b/modules/calendar/apps_evolution_calendar.schemas.in index 5f946d12ef..7df4f95271 100644 --- a/modules/calendar/apps_evolution_calendar.schemas.in +++ b/modules/calendar/apps_evolution_calendar.schemas.in @@ -726,8 +726,8 @@ int -1 - Last alarm time - Time the last alarm ran, in time_t. + Last reminder time + Time the last reminder ran, in time_t. @@ -739,7 +739,7 @@ string [] - Calendars to run alarms for + Calendars to run reminders for @@ -751,8 +751,8 @@ string [] - Alarm programs - Programs that are allowed to be run by alarms. + Reminder programs + Programs that are allowed to be run by reminders. @@ -763,8 +763,8 @@ bool false - Show display alarms in notification tray - Whether or not to use the notification tray for display alarms. + Show display reminders in notification tray + Whether or not to use the notification tray for display reminders. @@ -798,9 +798,9 @@ evolution-calendar string - Save directory for alarm audio + Save directory for reminder audio - Directory for saving alarm audio files + Directory for saving reminder audio files diff --git a/modules/calendar/e-calendar-preferences.c b/modules/calendar/e-calendar-preferences.c index 40ba9c7937..ad04d307cf 100644 --- a/modules/calendar/e-calendar-preferences.c +++ b/modules/calendar/e-calendar-preferences.c @@ -438,7 +438,7 @@ show_alarms_config (ECalendarPreferences *prefs) 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 Alarms")); + 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); diff --git a/modules/calendar/e-calendar-preferences.ui b/modules/calendar/e-calendar-preferences.ui index c01f568273..96f0d70e43 100644 --- a/modules/calendar/e-calendar-preferences.ui +++ b/modules/calendar/e-calendar-preferences.ui @@ -1158,7 +1158,7 @@ True 0 - Alarms + Reminders @@ -1181,7 +1181,7 @@ 4 - Display alarms in _notification area only + Display reminders in _notification area only True True False @@ -1341,7 +1341,7 @@ True 0 - Select the calendars for alarm notification + Select the calendars for reminder notification False -- cgit v1.2.3 From 15376b6657c77d4f701367c4f14bed653201fe26 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 10 Aug 2011 15:58:39 -0400 Subject: EConfig: Broadcast abort/commit events by way of signals. Remove the clumsy abortfunc and commitfunc callback arguments from e_config_add_items(). --- modules/calendar/e-calendar-preferences.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-calendar-preferences.c b/modules/calendar/e-calendar-preferences.c index ad04d307cf..a3dd435910 100644 --- a/modules/calendar/e-calendar-preferences.c +++ b/modules/calendar/e-calendar-preferences.c @@ -545,7 +545,7 @@ calendar_preferences_construct (ECalendarPreferences *prefs, l = NULL; for (i = 0; i < G_N_ELEMENTS (eccp_items); i++) l = g_slist_prepend (l, &eccp_items[i]); - e_config_add_items ((EConfig *) ec, l, NULL, NULL, eccp_free, prefs); + e_config_add_items ((EConfig *) ec, l, eccp_free, prefs); widget = e_builder_get_widget (prefs->builder, "use-system-tz-check"); g_object_bind_property ( -- cgit v1.2.3 From 84b566863ec2c8d462db645b19a871837e85c989 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Thu, 11 Aug 2011 13:46:11 +0200 Subject: Bug #655843 - Copy to calendar doesn't add timezone information --- modules/calendar/e-cal-shell-view-private.c | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c index 0ca3f344ec..01ae23cc1c 100644 --- a/modules/calendar/e-cal-shell-view-private.c +++ b/modules/calendar/e-cal-shell-view-private.c @@ -821,6 +821,31 @@ e_cal_shell_view_set_status_message (ECalShellView *cal_shell_view, cal_shell_view->priv->calendar_activity = activity; } +struct ForeachTzidData +{ + ECalClient *source_client; + ECalClient *dest_client; +}; + +static void +add_timezone_to_cal_cb (icalparameter *param, gpointer data) +{ + struct ForeachTzidData *ftd = data; + icaltimezone *tz = NULL; + const gchar *tzid; + + g_return_if_fail (ftd != NULL); + g_return_if_fail (ftd->source_client != NULL); + g_return_if_fail (ftd->dest_client != NULL); + + tzid = icalparameter_get_tzid (param); + if (!tzid || !*tzid) + return; + + if (e_cal_client_get_timezone_sync (ftd->source_client, tzid, &tz, NULL, NULL) && tz) + e_cal_client_add_timezone_sync (ftd->dest_client, tz, NULL, NULL); +} + void e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view, ECalendarViewEvent *event, @@ -863,6 +888,10 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view, icalproperty *icalprop; gchar *new_uid; GError *error = NULL; + struct ForeachTzidData ftd; + + ftd.source_client = event->comp_data->client; + ftd.dest_client = destination_client; if (e_cal_util_component_is_instance (icalcomp_event)) { success = e_cal_client_get_object_sync ( @@ -904,6 +933,7 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view, } new_uid = NULL; + icalcomponent_foreach_tzid (icalcomp_clone, add_timezone_to_cal_cb, &ftd); success = e_cal_client_create_object_sync ( destination_client, icalcomp_clone, &new_uid, NULL, &error); if (!success) { -- cgit v1.2.3 From f59681796df8fe0138a1754abbe8ec781bc1535e Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 1 Jul 2011 00:07:26 -0400 Subject: Coding style and whitespace cleanup. --- modules/calendar/e-cal-attachment-handler.c | 56 +++++++++++----- modules/calendar/e-cal-shell-backend.c | 87 +++++++++++++++++-------- modules/calendar/e-cal-shell-sidebar.c | 90 +++++++++++++++++++------- modules/calendar/e-cal-shell-view-actions.c | 76 +++++++++++++++------- modules/calendar/e-cal-shell-view-private.c | 18 ++++-- modules/calendar/e-cal-shell-view.c | 10 ++- modules/calendar/e-memo-shell-backend.c | 77 +++++++++++++++------- modules/calendar/e-memo-shell-sidebar.c | 90 +++++++++++++++++++------- modules/calendar/e-memo-shell-view-actions.c | 34 +++++++--- modules/calendar/e-task-shell-backend.c | 77 +++++++++++++++------- modules/calendar/e-task-shell-sidebar.c | 97 ++++++++++++++++++++-------- modules/calendar/e-task-shell-view-actions.c | 34 +++++++--- modules/calendar/e-task-shell-view-private.c | 20 ++++-- 13 files changed, 544 insertions(+), 222 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c index a2932a0d17..24a73f6d1a 100644 --- a/modules/calendar/e-cal-attachment-handler.c +++ b/modules/calendar/e-cal-attachment-handler.c @@ -141,10 +141,15 @@ attachment_handler_update_objects (ECalClient *client, return FALSE; } - success = e_cal_client_receive_objects_sync (client, vcalendar, NULL, &error); - if (error) - g_debug ("%s: Failed to receive objects: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + success = e_cal_client_receive_objects_sync ( + client, vcalendar, NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to receive objects: %s", + G_STRFUNC, error->message); + g_error_free (error); + } icalcomponent_free (vcalendar); @@ -152,8 +157,11 @@ attachment_handler_update_objects (ECalClient *client, } static void -attachment_handler_import_event (GObject *source_object, GAsyncResult *result, gpointer user_data) +attachment_handler_import_event (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); EAttachment *attachment = user_data; EClient *client = NULL; GError *error = NULL; @@ -161,15 +169,21 @@ attachment_handler_import_event (GObject *source_object, GAsyncResult *result, g icalcomponent *subcomponent; icalcompiter iter; - if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) - client = NULL; + e_client_utils_open_new_finish (source, result, &client, &error); - if (!client) { - g_debug ("%s: Failed to open '%s': %s", G_STRFUNC, e_source_peek_name (E_SOURCE (source_object)), error ? error->message : "Unknown error"); + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open '%s': %s", + G_STRFUNC, e_source_peek_name (source), + error->message); g_object_unref (attachment); + g_error_free (error); return; } + g_return_if_fail (E_IS_CLIENT (client)); + component = attachment_handler_get_component (attachment); g_return_if_fail (component != NULL); @@ -199,8 +213,11 @@ attachment_handler_import_event (GObject *source_object, GAsyncResult *result, g } static void -attachment_handler_import_todo (GObject *source_object, GAsyncResult *result, gpointer user_data) +attachment_handler_import_todo (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); EAttachment *attachment = user_data; EClient *client = NULL; GError *error = NULL; @@ -208,15 +225,21 @@ attachment_handler_import_todo (GObject *source_object, GAsyncResult *result, gp icalcomponent *subcomponent; icalcompiter iter; - if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) - client = NULL; + e_client_utils_open_new_finish (source, result, &client, &error); - if (!client) { - g_debug ("%s: Failed to open '%s': %s", G_STRFUNC, e_source_peek_name (E_SOURCE (source_object)), error ? error->message : "Unknown error"); + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open '%s': %s", + G_STRFUNC, e_source_peek_name (source), + error->message); g_object_unref (attachment); + g_error_free (error); return; } + g_return_if_fail (E_IS_CLIENT (client)); + component = attachment_handler_get_component (attachment); g_return_if_fail (component != NULL); @@ -270,8 +293,11 @@ attachment_handler_run_dialog (GtkWindow *parent, g_return_if_fail (component != NULL); e_cal_client_get_sources (&source_list, source_type, &error); + if (error != NULL) { - g_debug ("%s: Faield to get cal sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_warning ( + "%s: Failed to get cal sources: %s", + G_STRFUNC, error->message); g_clear_error (&error); return; } diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 744cd60b18..96077cf19e 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -95,11 +95,15 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend) shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - if (!e_cal_client_get_sources ( + e_cal_client_get_sources ( &cal_shell_backend->priv->source_list, - E_CAL_CLIENT_SOURCE_TYPE_EVENTS, &error)) { - g_debug ("%s: Could not get calendar sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + 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; } @@ -244,12 +248,15 @@ cal_shell_backend_new_event (ESource *source, GError *error = NULL; /* XXX Handle errors better. */ - if (!e_client_utils_open_new_finish (source, result, &client, &error)) - client = NULL; - - if (!client) { - g_debug ("%s: Failed to open '%s': %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); - g_clear_error (&error); + e_client_utils_open_new_finish (source, result, &client, &error); + + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open '%s': %s", + G_STRFUNC, e_source_peek_name (source), + error->message); + g_error_free (error); return; } @@ -279,7 +286,9 @@ cal_shell_backend_new_event (ESource *source, } static void -cal_shell_backend_event_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) +cal_shell_backend_event_new_cb (GObject *source_object, + GAsyncResult *result, + gpointer shell) { CompEditorFlags flags = 0; gboolean all_day = FALSE; @@ -287,13 +296,16 @@ cal_shell_backend_event_new_cb (GObject *source_object, GAsyncResult *result, gp flags |= COMP_EDITOR_NEW_ITEM; flags |= COMP_EDITOR_USER_ORG; - cal_shell_backend_new_event (E_SOURCE (source_object), result, shell, flags, all_day); + cal_shell_backend_new_event ( + E_SOURCE (source_object), result, shell, flags, all_day); g_object_unref (shell); } static void -cal_shell_backend_event_all_day_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) +cal_shell_backend_event_all_day_new_cb (GObject *source_object, + GAsyncResult *result, + gpointer shell) { CompEditorFlags flags = 0; gboolean all_day = TRUE; @@ -301,13 +313,16 @@ cal_shell_backend_event_all_day_new_cb (GObject *source_object, GAsyncResult *re flags |= COMP_EDITOR_NEW_ITEM; flags |= COMP_EDITOR_USER_ORG; - cal_shell_backend_new_event (E_SOURCE (source_object), result, shell, flags, all_day); + cal_shell_backend_new_event ( + E_SOURCE (source_object), result, shell, flags, all_day); g_object_unref (shell); } static void -cal_shell_backend_event_meeting_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) +cal_shell_backend_event_meeting_new_cb (GObject *source_object, + GAsyncResult *result, + gpointer shell) { CompEditorFlags flags = 0; gboolean all_day = FALSE; @@ -316,7 +331,8 @@ cal_shell_backend_event_meeting_new_cb (GObject *source_object, GAsyncResult *re flags |= COMP_EDITOR_USER_ORG; flags |= COMP_EDITOR_MEETING; - cal_shell_backend_new_event (E_SOURCE (source_object), result, shell, flags, all_day); + cal_shell_backend_new_event ( + E_SOURCE (source_object), result, shell, flags, all_day); g_object_unref (shell); } @@ -587,24 +603,36 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend, * we successfully open it is another matter... */ handled = TRUE; - if (!e_cal_client_get_sources (&source_list, source_type, &error)) { - g_debug ("%s: Could not get calendar sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + 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); + if (source == NULL) { - g_debug ("%s: No source for UID '%s'", G_STRFUNC, source_uid); + g_warning ("%s: No source for UID '%s'", G_STRFUNC, source_uid); g_object_unref (source_list); goto exit; } client = e_cal_client_new (source, source_type, &error); - if (client == NULL || !e_client_open_sync (E_CLIENT (client), TRUE, NULL, &error)) { - g_debug ("%s: Failed to create/open client '%s': %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); - g_clear_error (&error); + + 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': %s", + G_STRFUNC, e_source_peek_name (source), + error->message); g_object_unref (source_list); + g_error_free (error); goto exit; } @@ -616,16 +644,21 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend, if (editor != NULL) goto present; - if (!e_cal_client_get_object_sync (client, comp_uid, comp_rid, &icalcomp, NULL, &error)) { - g_debug ("%s: Failed to get object from client: %s", G_STRFUNC, error ? error->message : "Unknown error"); + e_cal_client_get_object_sync ( + client, comp_uid, comp_rid, &icalcomp, NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to get object from client: %s", + G_STRFUNC, error->message); g_object_unref (source_list); - g_clear_error (&error); + g_error_free (error); goto exit; } comp = e_cal_component_new (); if (!e_cal_component_set_icalcomponent (comp, icalcomp)) { - g_debug ("%s: Failed to set icalcomp to comp\n", G_STRFUNC); + g_warning ("%s: Failed to set icalcomp to comp\n", G_STRFUNC); icalcomponent_free (icalcomp); icalcomp = NULL; } diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index e296f6ff31..77c5639a78 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -165,7 +165,9 @@ cal_shell_sidebar_backend_error_cb (ECalShellSidebar *cal_shell_sidebar, } static void -cal_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +cal_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *client = E_CAL_CLIENT (source_object); ECalShellSidebar *cal_shell_sidebar = user_data; @@ -174,10 +176,12 @@ cal_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult * g_return_if_fail (client != NULL); g_return_if_fail (cal_shell_sidebar != NULL); - e_client_retrieve_capabilities_finish (E_CLIENT (client), result, &capabilities, NULL); + e_client_retrieve_capabilities_finish ( + E_CLIENT (client), result, &capabilities, NULL); g_free (capabilities); - cal_shell_sidebar_emit_status_message (cal_shell_sidebar, _("Loading calendars")); + cal_shell_sidebar_emit_status_message ( + cal_shell_sidebar, _("Loading calendars")); cal_shell_sidebar_emit_client_added (cal_shell_sidebar, client); cal_shell_sidebar_emit_status_message (cal_shell_sidebar, NULL); } @@ -205,15 +209,20 @@ free_retry_open_data (gpointer data) } static void -cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +cal_shell_sidebar_client_opened_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *client = E_CAL_CLIENT (source_object); ECalShellSidebar *cal_shell_sidebar = user_data; + ESource *source; EShellView *shell_view; EShellContent *shell_content; EShellSidebar *shell_sidebar; GError *error = NULL; + source = e_client_get_source (E_CLIENT (client)); + e_client_open_finish (E_CLIENT (client), result, &error); if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || @@ -227,7 +236,10 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result 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); + 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; @@ -242,7 +254,10 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result rod->cancellable = g_object_ref (cal_shell_sidebar->priv->loading_clients); /* postpone for 1/2 of a second, backend is busy now */ - g_timeout_add_full (G_PRIORITY_DEFAULT, 500, cal_shell_sidebar_retry_open_timeout_cb, rod, free_retry_open_data); + g_timeout_add_full ( + G_PRIORITY_DEFAULT, 500, + cal_shell_sidebar_retry_open_timeout_cb, + rod, free_retry_open_data); g_clear_error (&error); return; @@ -258,7 +273,10 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result break; case E_CLIENT_ERROR_BUSY: - g_debug ("%s: Cannot open '%s', it's busy (%s)", G_STRFUNC, e_source_peek_name (e_client_get_source (E_CLIENT (client))), error->message); + g_warning ( + "%s: Cannot open '%s', it's busy (%s)", + G_STRFUNC, e_source_peek_name (source), + error->message); g_clear_error (&error); return; @@ -287,7 +305,10 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result g_clear_error (&error); /* to have them ready for later use */ - e_client_retrieve_capabilities (E_CLIENT (client), NULL, cal_shell_sidebar_retrieve_capabilies_cb, cal_shell_sidebar); + e_client_retrieve_capabilities ( + E_CLIENT (client), NULL, + cal_shell_sidebar_retrieve_capabilies_cb, + cal_shell_sidebar); } static gboolean @@ -303,14 +324,21 @@ cal_shell_sidebar_retry_open_timeout_cb (gpointer user_data) if (g_cancellable_is_cancelled (rod->cancellable)) return FALSE; - e_client_open (rod->client, FALSE, rod->cal_shell_sidebar->priv->loading_clients, cal_shell_sidebar_client_opened_cb, rod->cal_shell_sidebar); + e_client_open ( + rod->client, FALSE, + rod->cal_shell_sidebar->priv->loading_clients, + cal_shell_sidebar_client_opened_cb, + rod->cal_shell_sidebar); return FALSE; } static void -cal_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +cal_shell_sidebar_default_loaded_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); EShellSidebar *shell_sidebar = user_data; ECalShellSidebarPrivate *priv; EShellContent *shell_content; @@ -322,21 +350,22 @@ cal_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resul priv = E_CAL_SHELL_SIDEBAR (shell_sidebar)->priv; - if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) - client = NULL; + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); + cal_shell_content = E_CAL_SHELL_CONTENT (shell_content); + model = e_cal_shell_content_get_model (cal_shell_content); + + e_client_utils_open_new_finish (source, result, &client, &error); + /* Ignore cancellations. */ if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_warn_if_fail (client == NULL); g_error_free (error); goto exit; - } - - shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_content = e_shell_view_get_shell_content (shell_view); - cal_shell_content = E_CAL_SHELL_CONTENT (shell_content); - model = e_cal_shell_content_get_model (cal_shell_content); - if (error != NULL) { + } else if (error != NULL) { + g_warn_if_fail (client == NULL); e_alert_submit ( E_ALERT_SINK (shell_content), "calendar:failed-open-calendar", @@ -352,7 +381,8 @@ cal_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resul priv->default_client = E_CAL_CLIENT (client); - e_cal_client_set_default_timezone (priv->default_client, e_cal_model_get_timezone (model)); + e_cal_client_set_default_timezone ( + priv->default_client, e_cal_model_get_timezone (model)); g_object_notify (G_OBJECT (shell_sidebar), "default-client"); @@ -401,9 +431,13 @@ cal_shell_sidebar_set_default (ECalShellSidebar *cal_shell_sidebar, priv->loading_default_client = g_cancellable_new (); - 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)); + 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)); } static void @@ -1064,7 +1098,9 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar, 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_signal_connect ( + client, "authenticate", + G_CALLBACK (e_client_utils_authenticate_handler), NULL); } g_return_if_fail (client != NULL); @@ -1099,7 +1135,11 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar, timezone = e_cal_model_get_timezone (model); e_cal_client_set_default_timezone (client, timezone); - e_client_open (E_CLIENT (client), FALSE, cal_shell_sidebar->priv->loading_clients, cal_shell_sidebar_client_opened_cb, cal_shell_sidebar); + + e_client_open ( + E_CLIENT (client), FALSE, + cal_shell_sidebar->priv->loading_clients, + cal_shell_sidebar_client_opened_cb, cal_shell_sidebar); } void diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c index 6537cde8b4..f8b426c6f2 100644 --- a/modules/calendar/e-cal-shell-view-actions.c +++ b/modules/calendar/e-cal-shell-view-actions.c @@ -102,14 +102,19 @@ action_calendar_delete_cb (GtkAction *action, 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); + client = e_cal_client_new_from_uri ( + uri, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL); g_free (uri); g_return_if_fail (client != NULL); - if (!e_client_remove_sync (E_CLIENT (client), NULL, &error)) { - g_debug ("%s: Failed to remove client: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + 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_error_free (error); return; } @@ -124,9 +129,14 @@ action_calendar_delete_cb (GtkAction *action, source_list = e_cal_shell_backend_get_source_list ( E_CAL_SHELL_BACKEND (shell_backend)); - if (!e_source_list_sync (source_list, &error)) { - g_debug ("%s: Failed to sync source list: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + + 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); } } @@ -386,9 +396,14 @@ action_calendar_refresh_cb (GtkAction *action, g_return_if_fail (e_client_check_refresh_supported (E_CLIENT (client))); - if (!e_client_refresh_sync (E_CLIENT (client), NULL, &error)) { - g_debug ("%s: Failed to refresh '%s', %s\n", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); - g_clear_error (&error); + e_client_refresh_sync (E_CLIENT (client), NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to refresh '%s', %s", + G_STRFUNC, e_source_peek_name (source), + error->message); + g_error_free (error); } } @@ -515,12 +530,14 @@ action_event_copy_cb (GtkAction *action, ECalendarViewEvent *event = selected->data; if (is_comp_data_valid (event) && event->comp_data->client) - source_source = e_client_get_source (E_CLIENT (event->comp_data->client)); + source_source = e_client_get_source ( + E_CLIENT (event->comp_data->client)); } /* Get a destination source from the user. */ destination_source = select_source_dialog ( - GTK_WINDOW (shell_window), E_CAL_CLIENT_SOURCE_TYPE_EVENTS, source_source); + GTK_WINDOW (shell_window), + E_CAL_CLIENT_SOURCE_TYPE_EVENTS, source_source); if (destination_source == NULL) return; @@ -529,11 +546,17 @@ 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); + g_signal_connect ( + destination_client, "authenticate", + G_CALLBACK (e_client_utils_authenticate_handler), NULL); - if (!e_client_open_sync (E_CLIENT (destination_client), FALSE, NULL, &error)) { - g_debug ("%s: Failed to open destination client: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + e_client_open_sync (E_CLIENT (destination_client), FALSE, NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to open destination client: %s", + G_STRFUNC, error->message); + g_error_free (error); goto exit; } @@ -791,23 +814,32 @@ action_event_move_cb (GtkAction *action, ECalendarViewEvent *event = selected->data; if (is_comp_data_valid (event) && event->comp_data->client) - source_source = e_client_get_source (E_CLIENT (event->comp_data->client)); + source_source = e_client_get_source ( + E_CLIENT (event->comp_data->client)); } /* Get a destination source from the user. */ destination_source = select_source_dialog ( - GTK_WINDOW (shell_window), E_CAL_CLIENT_SOURCE_TYPE_EVENTS, source_source); + GTK_WINDOW (shell_window), + E_CAL_CLIENT_SOURCE_TYPE_EVENTS, source_source); if (destination_source == NULL) return; /* Open the destination calendar. */ - destination_client = e_cal_client_new (destination_source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL); + destination_client = e_cal_client_new ( + 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); + 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); - if (!e_client_open_sync (E_CLIENT (destination_client), FALSE, NULL, &error)) { - g_debug ("%s: Failed to open destination client: %s", G_STRFUNC, error ? error->message : "Unknown error"); + if (error != NULL) { + g_warning ( + "%s: Failed to open destination client: %s", + G_STRFUNC, error->message); g_clear_error (&error); goto exit; } diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c index 01ae23cc1c..7a9fdaac69 100644 --- a/modules/calendar/e-cal-shell-view-private.c +++ b/modules/calendar/e-cal-shell-view-private.c @@ -933,12 +933,17 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view, } new_uid = NULL; - icalcomponent_foreach_tzid (icalcomp_clone, add_timezone_to_cal_cb, &ftd); + icalcomponent_foreach_tzid ( + icalcomp_clone, add_timezone_to_cal_cb, &ftd); success = e_cal_client_create_object_sync ( - destination_client, icalcomp_clone, &new_uid, NULL, &error); + destination_client, icalcomp_clone, + &new_uid, NULL, &error); if (!success) { icalcomponent_free (icalcomp_clone); - g_debug ("%s: Failed to create object: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_warning ( + "%s: Failed to create object: %s", + G_STRFUNC, error->message); + g_error_free (error); return; } @@ -962,10 +967,13 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view, else rid = NULL; e_cal_client_remove_object_sync ( - source_client, uid, rid, CALOBJ_MOD_ALL, NULL, NULL); + source_client, uid, rid, + CALOBJ_MOD_ALL, NULL, NULL); g_free (rid); } else - e_cal_client_remove_object_sync (source_client, uid, NULL, CALOBJ_MOD_THIS, NULL, NULL); + e_cal_client_remove_object_sync ( + source_client, uid, NULL, + CALOBJ_MOD_THIS, NULL, NULL); } } diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index 2249bf96e4..03914f1793 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -391,9 +391,13 @@ cal_shell_view_update_actions (EShellView *shell_view) itip_organizer_is_user (comp, client); is_delegatable = - e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED) && - (e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY) || - (!user_org && !is_delegated (icalcomp, user_email))); + e_client_check_capability ( + E_CLIENT (client), + CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED) && + (e_client_check_capability ( + E_CLIENT (client), + CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY) || + (!user_org && !is_delegated (icalcomp, user_email))); g_free (user_email); g_object_unref (comp); diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c index 2be78895f6..6f8070094e 100644 --- a/modules/calendar/e-memo-shell-backend.c +++ b/modules/calendar/e-memo-shell-backend.c @@ -84,11 +84,15 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend) shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - if (!e_cal_client_get_sources ( + e_cal_client_get_sources ( &memo_shell_backend->priv->source_list, - E_CAL_CLIENT_SOURCE_TYPE_MEMOS, &error)) { - g_debug ("%s: Could not get memo sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + 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; } @@ -172,13 +176,16 @@ memo_shell_backend_new_memo (ESource *source, CompEditor *editor; GError *error = NULL; - if (!e_client_utils_open_new_finish (source, result, &client, &error)) - client = NULL; + e_client_utils_open_new_finish (source, result, &client, &error); /* XXX Handle errors better. */ - if (!client) { - g_debug ("%s: Failed to open '%s': %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); - g_clear_error (&error); + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open '%s': %s", + G_STRFUNC, e_source_peek_name (source), + error->message); + g_error_free (error); return; } @@ -197,19 +204,24 @@ memo_shell_backend_new_memo (ESource *source, } static void -memo_shell_backend_memo_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) +memo_shell_backend_memo_new_cb (GObject *source_object, + GAsyncResult *result, + gpointer shell) { CompEditorFlags flags = 0; flags |= COMP_EDITOR_NEW_ITEM; - memo_shell_backend_new_memo (E_SOURCE (source_object), result, shell, flags); + memo_shell_backend_new_memo ( + E_SOURCE (source_object), result, shell, flags); g_object_unref (shell); } static void -memo_shell_backend_memo_shared_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) +memo_shell_backend_memo_shared_new_cb (GObject *source_object, + GAsyncResult *result, + gpointer shell) { CompEditorFlags flags = 0; @@ -217,7 +229,8 @@ memo_shell_backend_memo_shared_new_cb (GObject *source_object, GAsyncResult *res flags |= COMP_EDITOR_IS_SHARED; flags |= COMP_EDITOR_USER_ORG; - memo_shell_backend_new_memo (E_SOURCE (source_object), result, shell, flags); + memo_shell_backend_new_memo ( + E_SOURCE (source_object), result, shell, flags); g_object_unref (shell); } @@ -379,8 +392,12 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend, * we successfully open it is another matter... */ handled = TRUE; - if (!e_cal_client_get_sources (&source_list, source_type, &error)) { - g_debug ("%s: Could not get memo sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); + 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; } @@ -393,13 +410,20 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend, } client = e_cal_client_new (source, source_type, &error); - if (client) - 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)) { - g_debug ("%s: Failed to create/open client: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + if (client != NULL) { + g_signal_connect ( + client, "authenticate", + G_CALLBACK (e_client_utils_authenticate_handler), 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); g_object_unref (source_list); + g_error_free (error); goto exit; } @@ -411,16 +435,21 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend, if (editor != NULL) goto present; - if (!e_cal_client_get_object_sync (client, comp_uid, comp_rid, &icalcomp, NULL, &error)) { - g_debug ("%s: Failed to get object: %s", G_STRFUNC, error ? error->message : "Unknown error"); + e_cal_client_get_object_sync ( + client, comp_uid, comp_rid, &icalcomp, NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to get object: %s", + G_STRFUNC, error->message); g_object_unref (source_list); - g_clear_error (&error); + g_error_free (error); goto exit; } comp = e_cal_component_new (); if (!e_cal_component_set_icalcomponent (comp, icalcomp)) { - g_debug ("%s: Failed to set icalcomp to comp\n", G_STRFUNC); + g_warning ("%s: Failed to set icalcomp to comp\n", G_STRFUNC); icalcomponent_free (icalcomp); icalcomp = NULL; } diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index cf38c219b5..df9ea9a59a 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -160,7 +160,9 @@ memo_shell_sidebar_backend_error_cb (EMemoShellSidebar *memo_shell_sidebar, } static void -memo_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +memo_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *client = E_CAL_CLIENT (source_object); EMemoShellSidebar *memo_shell_sidebar = user_data; @@ -169,10 +171,12 @@ memo_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult g_return_if_fail (client != NULL); g_return_if_fail (memo_shell_sidebar != NULL); - e_client_retrieve_capabilities_finish (E_CLIENT (client), result, &capabilities, NULL); + e_client_retrieve_capabilities_finish ( + E_CLIENT (client), result, &capabilities, NULL); g_free (capabilities); - memo_shell_sidebar_emit_status_message (memo_shell_sidebar, _("Loading memos")); + memo_shell_sidebar_emit_status_message ( + memo_shell_sidebar, _("Loading memos")); memo_shell_sidebar_emit_client_added (memo_shell_sidebar, client); memo_shell_sidebar_emit_status_message (memo_shell_sidebar, NULL); } @@ -200,15 +204,20 @@ free_retry_open_data (gpointer data) } static void -memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +memo_shell_sidebar_client_opened_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *client = E_CAL_CLIENT (source_object); EMemoShellSidebar *memo_shell_sidebar = user_data; + ESource *source; EShellView *shell_view; EShellContent *shell_content; EShellSidebar *shell_sidebar; GError *error = NULL; + source = e_client_get_source (E_CLIENT (client)); + e_client_open_finish (E_CLIENT (client), result, &error); if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || @@ -222,7 +231,10 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul 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); + 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; } @@ -236,7 +248,10 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul rod->cancellable = g_object_ref (memo_shell_sidebar->priv->loading_clients); /* postpone for 1/2 of a second, backend is busy now */ - g_timeout_add_full (G_PRIORITY_DEFAULT, 500, memo_shell_sidebar_retry_open_timeout_cb, rod, free_retry_open_data); + g_timeout_add_full ( + G_PRIORITY_DEFAULT, 500, + memo_shell_sidebar_retry_open_timeout_cb, + rod, free_retry_open_data); g_clear_error (&error); return; @@ -252,7 +267,10 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul break; case E_CLIENT_ERROR_BUSY: - g_debug ("%s: Cannot open '%s', it's busy (%s)", G_STRFUNC, e_source_peek_name (e_client_get_source (E_CLIENT (client))), error->message); + g_warning ( + "%s: Cannot open '%s', it's busy (%s)", + G_STRFUNC, e_source_peek_name (source), + error->message); g_clear_error (&error); return; @@ -281,7 +299,10 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul g_clear_error (&error); /* to have them ready for later use */ - e_client_retrieve_capabilities (E_CLIENT (client), NULL, memo_shell_sidebar_retrieve_capabilies_cb, memo_shell_sidebar); + e_client_retrieve_capabilities ( + E_CLIENT (client), NULL, + memo_shell_sidebar_retrieve_capabilies_cb, + memo_shell_sidebar); } static gboolean @@ -297,14 +318,21 @@ memo_shell_sidebar_retry_open_timeout_cb (gpointer user_data) if (g_cancellable_is_cancelled (rod->cancellable)) return FALSE; - e_client_open (rod->client, FALSE, rod->memo_shell_sidebar->priv->loading_clients, memo_shell_sidebar_client_opened_cb, rod->memo_shell_sidebar); + e_client_open ( + rod->client, FALSE, + rod->memo_shell_sidebar->priv->loading_clients, + memo_shell_sidebar_client_opened_cb, + rod->memo_shell_sidebar); return FALSE; } static void -memo_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +memo_shell_sidebar_default_loaded_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); EShellSidebar *shell_sidebar = user_data; EMemoShellSidebarPrivate *priv; EShellContent *shell_content; @@ -316,21 +344,22 @@ memo_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu priv = E_MEMO_SHELL_SIDEBAR (shell_sidebar)->priv; - if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) - client = NULL; + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); + memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content); + model = e_memo_shell_content_get_memo_model (memo_shell_content); + + e_client_utils_open_new_finish (source, result, &client, &error); + /* Ignore cancellations. */ if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_warn_if_fail (client == NULL); g_error_free (error); goto exit; - } - - shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_content = e_shell_view_get_shell_content (shell_view); - memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content); - model = e_memo_shell_content_get_memo_model (memo_shell_content); - if (error != NULL) { + } else if (error != NULL) { + g_warn_if_fail (client == NULL); e_alert_submit ( E_ALERT_SINK (shell_content), "calendar:failed-open-memos", @@ -346,7 +375,8 @@ memo_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu priv->default_client = E_CAL_CLIENT (client); - e_cal_client_set_default_timezone (priv->default_client, e_cal_model_get_timezone (model)); + e_cal_client_set_default_timezone ( + priv->default_client, e_cal_model_get_timezone (model)); g_object_notify (G_OBJECT (shell_sidebar), "default-client"); @@ -395,9 +425,13 @@ memo_shell_sidebar_set_default (EMemoShellSidebar *memo_shell_sidebar, priv->loading_default_client = g_cancellable_new (); - 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)); + 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)); } static void @@ -950,7 +984,9 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar, 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_signal_connect ( + client, "authenticate", + G_CALLBACK (e_client_utils_authenticate_handler), NULL); } g_return_if_fail (client != NULL); @@ -985,7 +1021,11 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar, timezone = e_cal_model_get_timezone (model); e_cal_client_set_default_timezone (client, timezone); - e_client_open (E_CLIENT (client), FALSE, memo_shell_sidebar->priv->loading_clients, memo_shell_sidebar_client_opened_cb, memo_shell_sidebar); + + e_client_open ( + E_CLIENT (client), FALSE, + memo_shell_sidebar->priv->loading_clients, + memo_shell_sidebar_client_opened_cb, memo_shell_sidebar); } void diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c index 75d957c684..eacb5c1da7 100644 --- a/modules/calendar/e-memo-shell-view-actions.c +++ b/modules/calendar/e-memo-shell-view-actions.c @@ -170,14 +170,19 @@ action_memo_list_delete_cb (GtkAction *action, 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); + client = e_cal_client_new_from_uri ( + uri, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL); g_free (uri); g_return_if_fail (client != NULL); - if (!e_client_remove_sync (E_CLIENT (client), NULL, &error)) { - g_debug ("%s: Failed to remove client: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + 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_error_free (error); return; } @@ -190,9 +195,13 @@ action_memo_list_delete_cb (GtkAction *action, source_group = e_source_peek_group (source); e_source_group_remove_source (source_group, source); - if (!e_source_list_sync (source_list, &error)) { - g_debug ("%s: Failed to sync source list: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + 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); } } @@ -290,9 +299,14 @@ action_memo_list_refresh_cb (GtkAction *action, g_return_if_fail (e_client_check_refresh_supported (E_CLIENT (client))); - if (!e_client_refresh_sync (E_CLIENT (client), NULL, &error)) { - g_debug ("%s: Failed to refresh '%s', %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); - g_clear_error (&error); + e_client_refresh_sync (E_CLIENT (client), NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to refresh '%s', %s", + G_STRFUNC, e_source_peek_name (source), + error->message); + g_error_free (error); } } diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c index ebee92479b..bb296fd5c2 100644 --- a/modules/calendar/e-task-shell-backend.c +++ b/modules/calendar/e-task-shell-backend.c @@ -84,11 +84,15 @@ task_shell_backend_ensure_sources (EShellBackend *shell_backend) shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - if (!e_cal_client_get_sources ( + e_cal_client_get_sources ( &task_shell_backend->priv->source_list, - E_CAL_CLIENT_SOURCE_TYPE_TASKS, &error)) { - g_debug ("%s: Could not get task sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + 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; } @@ -172,13 +176,16 @@ task_shell_backend_new_task (ESource *source, CompEditor *editor; GError *error = NULL; - if (!e_client_utils_open_new_finish (source, result, &client, &error)) - client = NULL; + e_client_utils_open_new_finish (source, result, &client, &error); /* XXX Handle errors better. */ - if (!client) { - g_debug ("%s: Failed to open '%s': %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); - g_clear_error (&error); + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open '%s': %s", + G_STRFUNC, e_source_peek_name (source), + error->message); + g_error_free (error); return; } @@ -196,19 +203,24 @@ task_shell_backend_new_task (ESource *source, } static void -task_shell_backend_task_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) +task_shell_backend_task_new_cb (GObject *source_object, + GAsyncResult *result, + gpointer shell) { CompEditorFlags flags = 0; flags |= COMP_EDITOR_NEW_ITEM; - task_shell_backend_new_task (E_SOURCE (source_object), result, shell, flags); + task_shell_backend_new_task ( + E_SOURCE (source_object), result, shell, flags); g_object_unref (shell); } static void -task_shell_backend_task_assigned_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) +task_shell_backend_task_assigned_new_cb (GObject *source_object, + GAsyncResult *result, + gpointer shell) { CompEditorFlags flags = 0; @@ -216,7 +228,8 @@ task_shell_backend_task_assigned_new_cb (GObject *source_object, GAsyncResult *r flags |= COMP_EDITOR_IS_ASSIGNED; flags |= COMP_EDITOR_USER_ORG; - task_shell_backend_new_task (E_SOURCE (source_object), result, shell, flags); + task_shell_backend_new_task ( + E_SOURCE (source_object), result, shell, flags); g_object_unref (shell); } @@ -379,9 +392,13 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend, * we successfully open it is another matter... */ handled = TRUE; - if (!e_cal_client_get_sources (&source_list, source_type, &error)) { - g_debug ("%s: Could not get task sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + 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; } @@ -393,13 +410,20 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend, } client = e_cal_client_new (source, source_type, &error); - if (client) - 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)) { - g_debug ("%s: Failed to create/open client: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + if (client != NULL) { + g_signal_connect ( + client, "authenticate", + G_CALLBACK (e_client_utils_authenticate_handler), 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); g_object_unref (source_list); + g_error_free (error); goto exit; } @@ -411,8 +435,13 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend, if (editor != NULL) goto present; - if (!e_cal_client_get_object_sync (client, comp_uid, comp_rid, &icalcomp, NULL, &error)) { - g_debug ("%s: Failed to get object: %s", G_STRFUNC, error ? error->message : "Unknown error"); + e_cal_client_get_object_sync ( + client, comp_uid, comp_rid, &icalcomp, NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to get object: %s", + G_STRFUNC, error->message); g_object_unref (source_list); g_error_free (error); goto exit; @@ -420,7 +449,7 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend, comp = e_cal_component_new (); if (!e_cal_component_set_icalcomponent (comp, icalcomp)) { - g_debug ("%s: Failed to set icalcomp to comp\n", G_STRFUNC); + g_warning ("%s: Failed to set icalcomp to comp\n", G_STRFUNC); icalcomponent_free (icalcomp); icalcomp = NULL; } diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index 3e693afd7e..7987071eb8 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -160,7 +160,9 @@ task_shell_sidebar_backend_error_cb (ETaskShellSidebar *task_shell_sidebar, } static void -task_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +task_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *client = E_CAL_CLIENT (source_object); ETaskShellSidebar *task_shell_sidebar = user_data; @@ -169,10 +171,12 @@ task_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult g_return_if_fail (client != NULL); g_return_if_fail (task_shell_sidebar != NULL); - e_client_retrieve_capabilities_finish (E_CLIENT (client), result, &capabilities, NULL); + e_client_retrieve_capabilities_finish ( + E_CLIENT (client), result, &capabilities, NULL); g_free (capabilities); - task_shell_sidebar_emit_status_message (task_shell_sidebar, _("Loading tasks")); + task_shell_sidebar_emit_status_message ( + task_shell_sidebar, _("Loading tasks")); task_shell_sidebar_emit_client_added (task_shell_sidebar, client); task_shell_sidebar_emit_status_message (task_shell_sidebar, NULL); } @@ -200,15 +204,20 @@ free_retry_open_data (gpointer data) } static void -task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +task_shell_sidebar_client_opened_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *client = E_CAL_CLIENT (source_object); ETaskShellSidebar *task_shell_sidebar = user_data; + ESource *source; EShellView *shell_view; EShellContent *shell_content; EShellSidebar *shell_sidebar; GError *error = NULL; + source = e_client_get_source (E_CLIENT (client)); + e_client_open_finish (E_CLIENT (client), result, &error); if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || @@ -222,7 +231,10 @@ task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul 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); + 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; } @@ -236,7 +248,10 @@ task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul rod->cancellable = g_object_ref (task_shell_sidebar->priv->loading_clients); /* postpone for 1/2 of a second, backend is busy now */ - g_timeout_add_full (G_PRIORITY_DEFAULT, 500, task_shell_sidebar_retry_open_timeout_cb, rod, free_retry_open_data); + g_timeout_add_full ( + G_PRIORITY_DEFAULT, 500, + task_shell_sidebar_retry_open_timeout_cb, + rod, free_retry_open_data); g_clear_error (&error); return; @@ -252,7 +267,10 @@ task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul break; case E_CLIENT_ERROR_BUSY: - g_debug ("%s: Cannot open '%s', it's busy (%s)", G_STRFUNC, e_source_peek_name (e_client_get_source (E_CLIENT (client))), error->message); + g_warning ( + "%s: Cannot open '%s', it's busy (%s)", + G_STRFUNC, e_source_peek_name (source), + error->message); g_clear_error (&error); return; @@ -281,7 +299,10 @@ task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul g_clear_error (&error); /* to have them ready for later use */ - e_client_retrieve_capabilities (E_CLIENT (client), NULL, task_shell_sidebar_retrieve_capabilies_cb, task_shell_sidebar); + e_client_retrieve_capabilities ( + E_CLIENT (client), NULL, + task_shell_sidebar_retrieve_capabilies_cb, + task_shell_sidebar); } static gboolean @@ -297,14 +318,21 @@ task_shell_sidebar_retry_open_timeout_cb (gpointer user_data) if (g_cancellable_is_cancelled (rod->cancellable)) return FALSE; - e_client_open (rod->client, FALSE, rod->task_shell_sidebar->priv->loading_clients, task_shell_sidebar_client_opened_cb, rod->task_shell_sidebar); + e_client_open ( + rod->client, FALSE, + rod->task_shell_sidebar->priv->loading_clients, + task_shell_sidebar_client_opened_cb, + rod->task_shell_sidebar); return FALSE; } static void -task_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +task_shell_sidebar_default_loaded_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); EShellSidebar *shell_sidebar = user_data; ETaskShellSidebarPrivate *priv; EShellContent *shell_content; @@ -316,21 +344,22 @@ task_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu priv = E_TASK_SHELL_SIDEBAR (shell_sidebar)->priv; - if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) - client = NULL; + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); + task_shell_content = E_TASK_SHELL_CONTENT (shell_content); + model = e_task_shell_content_get_task_model (task_shell_content); + + e_client_utils_open_new_finish (source, result, &client, &error); + /* Ignore cancellations. */ if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_warn_if_fail (client == NULL); g_error_free (error); goto exit; - } - - shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_content = e_shell_view_get_shell_content (shell_view); - task_shell_content = E_TASK_SHELL_CONTENT (shell_content); - model = e_task_shell_content_get_task_model (task_shell_content); - if (error != NULL) { + } else if (error != NULL) { + g_warn_if_fail (client == NULL); e_alert_submit ( E_ALERT_SINK (shell_content), "calendar:failed-open-tasks", @@ -346,7 +375,8 @@ task_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu priv->default_client = E_CAL_CLIENT (client); - e_cal_client_set_default_timezone (priv->default_client, e_cal_model_get_timezone (model)); + e_cal_client_set_default_timezone ( + priv->default_client, e_cal_model_get_timezone (model)); g_object_notify (G_OBJECT (shell_sidebar), "default-client"); @@ -395,9 +425,13 @@ task_shell_sidebar_set_default (ETaskShellSidebar *task_shell_sidebar, priv->loading_default_client = g_cancellable_new (); - 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)); + 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)); } static void @@ -696,13 +730,14 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar) can_delete = !is_system; delete_prop = e_source_get_property (source, "delete"); - can_delete = can_delete && (delete_prop == NULL || strcmp (delete_prop, "no") != 0); + can_delete = can_delete && + (delete_prop == NULL || strcmp (delete_prop, "no") != 0); client = g_hash_table_lookup ( task_shell_sidebar->priv->client_table, e_source_peek_uid (source)); - refresh_supported = - client && e_client_check_refresh_supported (E_CLIENT (client)); + refresh_supported = client && + e_client_check_refresh_supported (E_CLIENT (client)); } if (source != NULL) @@ -950,7 +985,9 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar, 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_signal_connect ( + client, "authenticate", + G_CALLBACK (e_client_utils_authenticate_handler), NULL); } g_return_if_fail (client != NULL); @@ -985,7 +1022,11 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar, timezone = e_cal_model_get_timezone (model); e_cal_client_set_default_timezone (client, timezone); - e_client_open (E_CLIENT (client), FALSE, task_shell_sidebar->priv->loading_clients, task_shell_sidebar_client_opened_cb, task_shell_sidebar); + + e_client_open ( + E_CLIENT (client), FALSE, + task_shell_sidebar->priv->loading_clients, + task_shell_sidebar_client_opened_cb, task_shell_sidebar); } void diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c index 4938452309..1fb4867205 100644 --- a/modules/calendar/e-task-shell-view-actions.c +++ b/modules/calendar/e-task-shell-view-actions.c @@ -193,14 +193,19 @@ action_task_list_delete_cb (GtkAction *action, 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); + client = e_cal_client_new_from_uri ( + uri, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL); g_free (uri); g_return_if_fail (client != NULL); - if (!e_client_remove_sync (E_CLIENT (client), NULL, &error)) { - g_debug ("%s: Failed to remove client: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + 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_error_free (error); return; } @@ -213,9 +218,13 @@ action_task_list_delete_cb (GtkAction *action, source_group = e_source_peek_group (source); e_source_group_remove_source (source_group, source); - if (!e_source_list_sync (source_list, &error)) { - g_debug ("%s: Failed to sync srouce list: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + 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); } } @@ -313,9 +322,14 @@ action_task_list_refresh_cb (GtkAction *action, g_return_if_fail (e_client_check_refresh_supported (E_CLIENT (client))); - if (!e_client_refresh_sync (E_CLIENT (client), NULL, &error)) { - g_debug ("%s: Failed to refresh '%s', %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); - g_clear_error (&error); + e_client_refresh_sync (E_CLIENT (client), NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to refresh '%s', %s", + G_STRFUNC, e_source_peek_name (source), + error->message); + g_error_free (error); } } diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c index 77e4beae1e..b8122786f2 100644 --- a/modules/calendar/e-task-shell-view-private.c +++ b/modules/calendar/e-task-shell-view-private.c @@ -479,8 +479,13 @@ e_task_shell_view_delete_completed (ETaskShellView *task_shell_view) if (e_client_is_readonly (E_CLIENT (client))) continue; - if (!e_cal_client_get_object_list_sync (client, sexp, &objects, NULL, &error)) { - g_debug ("%s: Failed to get object list: %s", G_STRFUNC, error ? error->message : "Unknown error"); + e_cal_client_get_object_list_sync ( + client, sexp, &objects, NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to get object list: %s", + G_STRFUNC, error->message); g_clear_error (&error); continue; } @@ -490,8 +495,15 @@ e_task_shell_view_delete_completed (ETaskShellView *task_shell_view) const gchar *uid; uid = icalcomponent_get_uid (component); - if (!e_cal_client_remove_object_sync (client, uid, NULL, CALOBJ_MOD_THIS, NULL, &error)) { - g_debug ("%s: Failed to remove object: %s", G_STRFUNC, error ? error->message : "Unknown error"); + + e_cal_client_remove_object_sync ( + client, uid, NULL, + CALOBJ_MOD_THIS, NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to remove object: %s", + G_STRFUNC, error->message); g_clear_error (&error); } -- cgit v1.2.3 From 9cc59ac6c37351a8d956d3ac081b473f92100196 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 15 Aug 2011 10:30:39 -0400 Subject: Drop some ancient GroupWise account migration. Not worth the pain of maintaining old cruft to make progress. Breaks GW account migration from versions prior to 2.8 (circa 2006), but you'd be better off starting from a clean slate anyway if you're jumping that many releases. --- modules/calendar/e-memo-shell-migrate.c | 91 --------------------------------- 1 file changed, 91 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-memo-shell-migrate.c b/modules/calendar/e-memo-shell-migrate.c index f81af22f10..55f57996cb 100644 --- a/modules/calendar/e-memo-shell-migrate.c +++ b/modules/calendar/e-memo-shell-migrate.c @@ -156,73 +156,6 @@ create_memo_sources (EShellBackend *shell_backend, } } -static gboolean -is_groupwise_account (EAccount *account) -{ - if (account->source->url != NULL) { - return g_str_has_prefix (account->source->url, GROUPWISE_BASE_URI); - } else { - return FALSE; - } -} - -static void -add_gw_esource (ESourceList *source_list, const gchar *group_name, const gchar *source_name, CamelURL *url, GConfClient *client) -{ - ESourceGroup *group; - ESource *source; - GSList *ids, *temp; - GError *error = NULL; - gchar *relative_uri; - const gchar *soap_port; - const gchar * use_ssl; - const gchar *poa_address; - const gchar *offline_sync; - - poa_address = url->host; - if (!poa_address || strlen (poa_address) ==0) - return; - soap_port = camel_url_get_param (url, "soap_port"); - - if (soap_port == NULL || *soap_port == '\0') - soap_port = "7191"; - - use_ssl = camel_url_get_param (url, "use_ssl"); - offline_sync = camel_url_get_param (url, "offline_sync"); - - group = e_source_group_new (group_name, GROUPWISE_BASE_URI); - if (!e_source_list_add_group (source_list, group, -1)) - return; - relative_uri = g_strdup_printf ("%s@%s/", url->user, poa_address); - - source = e_source_new (source_name, relative_uri); - e_source_set_property (source, "auth", "1"); - e_source_set_property (source, "username", url->user); - e_source_set_property (source, "port", soap_port); - e_source_set_property (source, "auth-domain", "Groupwise"); - e_source_set_property (source, "use_ssl", use_ssl); - e_source_set_property (source, "offline_sync", offline_sync ? "1" : "0" ); - - e_source_set_color_spec (source, "#EEBC60"); - e_source_group_add_source (group, source, -1); - - ids = gconf_client_get_list (client, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, &error); - if (error != NULL) { - g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message); - g_error_free (error); - } - ids = g_slist_append (ids, g_strdup (e_source_peek_uid (source))); - gconf_client_set_list (client, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, ids, NULL); - temp = ids; - for (; temp != NULL; temp = g_slist_next (temp)) - g_free (temp->data); - - g_slist_free (ids); - g_object_unref (source); - g_object_unref (group); - g_free (relative_uri); -} - gboolean e_memo_shell_backend_migrate (EShellBackend *shell_backend, gint major, @@ -245,30 +178,6 @@ e_memo_shell_backend_migrate (EShellBackend *shell_backend, shell_backend, source_list, &on_this_computer, &on_the_web, &personal_source); - /* Migration for Gw accounts between versions < 2.8 */ - if (major == 2 && minor < 8) { - EAccountList *al; - EAccount *a; - CamelURL *url; - EIterator *it; - GConfClient *gconf_client = gconf_client_get_default (); - - al = e_get_account_list (); - - for (it = e_list_get_iterator ((EList *) al); - e_iterator_is_valid (it); - e_iterator_next (it)) { - a = (EAccount *) e_iterator_get (it); - if (!a->enabled || !is_groupwise_account (a)) - continue; - url = camel_url_new (a->source->url, NULL); - add_gw_esource (source_list, a->name, _("Notes"), url, gconf_client); - camel_url_free (url); - } - - g_object_unref (gconf_client); - } - e_source_list_sync (source_list, NULL); retval = TRUE; -- cgit v1.2.3 From a7840ef0ef78bf909deda11c7bb99ce9d5474652 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 23 Aug 2011 16:56:29 +0200 Subject: Bug #655666 - Split task preferences into its own tab --- modules/calendar/e-calendar-preferences.c | 1 + modules/calendar/e-calendar-preferences.ui | 191 +++++++++++++++++------------ 2 files changed, 115 insertions(+), 77 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-calendar-preferences.c b/modules/calendar/e-calendar-preferences.c index a3dd435910..115226dcf3 100644 --- a/modules/calendar/e-calendar-preferences.c +++ b/modules/calendar/e-calendar-preferences.c @@ -490,6 +490,7 @@ static ECalConfigItem eccp_items[] = { { E_CONFIG_PAGE, (gchar *) "10.display", (gchar *) "display", calendar_preferences_get_config_widget }, { E_CONFIG_SECTION, (gchar *) "10.display/00.general", (gchar *) "displayGeneral", calendar_preferences_get_config_widget }, { E_CONFIG_SECTION, (gchar *) "10.display/10.taskList", (gchar *) "taskList", calendar_preferences_get_config_widget }, + { E_CONFIG_PAGE, (gchar *) "12.tasks", (gchar *) "tasks-vbox", calendar_preferences_get_config_widget }, { E_CONFIG_PAGE, (gchar *) "15.alarms", (gchar *) "alarms", calendar_preferences_get_config_widget }, { E_CONFIG_PAGE, (gchar *) "20.freeBusy", (gchar *) "freebusy", calendar_preferences_get_config_widget }, { E_CONFIG_SECTION, (gchar *) "20.freeBusy/00.defaultServer", (gchar *) "default-freebusy-vbox", calendar_preferences_get_config_widget }, diff --git a/modules/calendar/e-calendar-preferences.ui b/modules/calendar/e-calendar-preferences.ui index 96f0d70e43..27de6cc996 100644 --- a/modules/calendar/e-calendar-preferences.ui +++ b/modules/calendar/e-calendar-preferences.ui @@ -823,11 +823,15 @@ 1 + True + True 0 + False + False @@ -916,6 +920,80 @@ 1 + + + True + 0 + Date/Time Format + + + + + + False + False + 2 + + + + + True + 12 + + + True + + + False + False + 0 + + + + + True + 3 + + + + + + + + + + + + 1 + + + + + 3 + + + + + False + False + 1 + + + + + True + Display + + + 1 + False + + + + + True + 12 + 12 True @@ -928,7 +1006,7 @@ False False - 2 + 0 @@ -981,6 +1059,17 @@ 1 + + + False + False + 0 + + + + + True + 12 True @@ -992,8 +1081,7 @@ False False - end - 3 + 0 @@ -1007,15 +1095,14 @@ False False - end - 2 + 1 False False - 0 + 1 @@ -1065,7 +1152,9 @@ - 1 + 2 + False + False @@ -1076,75 +1165,23 @@ False - 3 - - - - - True - 0 - Date/Time Format - - - - - - False - False - 4 - - - - - True - 12 - - - True - - - False - False - 0 - - - - - True - 3 - - - - - - - - - - - - 1 - - - - - 5 + 1 False False - 1 + 2 - + True - Display + Tasks - 1 + 2 False @@ -1368,7 +1405,7 @@ False False - 2 + 3 @@ -1379,14 +1416,13 @@ False False - 2 + 3 True 12 - vertical 12 @@ -1398,9 +1434,9 @@ + 0 False False - 0 @@ -1410,7 +1446,6 @@ True - vertical 6 @@ -1422,9 +1457,9 @@ Template: + 0 False False - 0 @@ -1435,11 +1470,15 @@ 1 + True + True 0 + False + False @@ -1452,36 +1491,34 @@ + 1 False False - 1 + 1 False False - 1 - False + 4 False - 3 True - Free/Busy + Publishing Information - False + 4 False - 3 -- cgit v1.2.3 From cae6068419d73892dfa52cfa03d416c35be9a571 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 25 Aug 2011 18:08:24 +0200 Subject: Bug #655419 - "Save as iCalendar" misses mnemonic --- modules/calendar/e-cal-shell-view-actions.c | 2 +- modules/calendar/e-cal-shell-view-memopad.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c index f8b426c6f2..53b2a0e6c7 100644 --- a/modules/calendar/e-cal-shell-view-actions.c +++ b/modules/calendar/e-cal-shell-view-actions.c @@ -1778,7 +1778,7 @@ static GtkActionEntry lockdown_save_to_disk_entries[] = { { "event-save-as", GTK_STOCK_SAVE_AS, - N_("Save as iCalendar..."), + N_("_Save as iCalendar..."), NULL, NULL, /* XXX Add a tooltip! */ G_CALLBACK (action_event_save_as_cb) }, diff --git a/modules/calendar/e-cal-shell-view-memopad.c b/modules/calendar/e-cal-shell-view-memopad.c index e154667826..bd1e9d5ac8 100644 --- a/modules/calendar/e-cal-shell-view-memopad.c +++ b/modules/calendar/e-cal-shell-view-memopad.c @@ -292,7 +292,7 @@ static GtkActionEntry lockdown_save_to_disk_entries[] = { { "calendar-memopad-save-as", GTK_STOCK_SAVE_AS, - N_("Save as iCalendar..."), + N_("_Save as iCalendar..."), NULL, NULL, /* XXX Add a tooltip! */ G_CALLBACK (action_calendar_memopad_save_as_cb) } -- cgit v1.2.3 From eab1c5b25236e6127bd1f42a87dd2851a40792f8 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 26 Aug 2011 08:47:20 +0200 Subject: Bug #657396 - Rename Alarms tab to Reminders in preferences --- modules/calendar/e-calendar-preferences.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-calendar-preferences.ui b/modules/calendar/e-calendar-preferences.ui index 27de6cc996..44ffc19100 100644 --- a/modules/calendar/e-calendar-preferences.ui +++ b/modules/calendar/e-calendar-preferences.ui @@ -1411,7 +1411,7 @@ True - Alarms + Reminders False -- cgit v1.2.3 From fcbbdfbd18e15b4ee8322a0217cf03a689a5e033 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 16 Aug 2011 11:25:56 -0400 Subject: Coding style and whitespace cleanup. --- modules/calendar/e-cal-shell-content.c | 7 ++-- modules/calendar/e-cal-shell-migrate.c | 16 ++++----- modules/calendar/e-cal-shell-view-actions.c | 3 +- modules/calendar/e-cal-shell-view-private.c | 3 +- modules/calendar/e-cal-shell-view.c | 6 ++-- modules/calendar/e-calendar-preferences.c | 52 ++++++++++++++++++++--------- modules/calendar/e-memo-shell-migrate.c | 6 ++-- modules/calendar/e-task-shell-migrate.c | 6 ++-- 8 files changed, 63 insertions(+), 36 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c index b4297b9fcd..81fc76b3cb 100644 --- a/modules/calendar/e-cal-shell-content.c +++ b/modules/calendar/e-cal-shell-content.c @@ -303,7 +303,8 @@ cal_shell_content_dispose (GObject *object) } static time_t -gc_get_default_time (ECalModel *model, gpointer user_data) +gc_get_default_time (ECalModel *model, + gpointer user_data) { GnomeCalendar *gcal = user_data; time_t res = 0, end; @@ -321,8 +322,8 @@ cal_shell_content_constructed (GObject *object) { ECalShellContentPrivate *priv; ECalendarView *calendar_view; - ECalModel *memo_model=NULL; - ECalModel *task_model=NULL; + ECalModel *memo_model = NULL; + ECalModel *task_model = NULL; EShell *shell; EShellContent *shell_content; EShellView *shell_view; diff --git a/modules/calendar/e-cal-shell-migrate.c b/modules/calendar/e-cal-shell-migrate.c index 3c9f79a309..dd76049171 100644 --- a/modules/calendar/e-cal-shell-migrate.c +++ b/modules/calendar/e-cal-shell-migrate.c @@ -75,11 +75,11 @@ create_calendar_contact_source (ESourceList *source_list) static void create_calendar_sources (EShellBackend *shell_backend, - ESourceList *source_list, - ESourceGroup **on_this_computer, - ESource **personal_source, - ESourceGroup **on_the_web, - ESourceGroup **contacts) + ESourceList *source_list, + ESourceGroup **on_this_computer, + ESource **personal_source, + ESourceGroup **on_the_web, + ESourceGroup **contacts) { EShell *shell; EShellSettings *shell_settings; @@ -134,7 +134,7 @@ create_calendar_sources (EShellBackend *shell_backend, if (*on_this_computer) { /* make sure "Personal" shows up as a source under - this group */ + * this group */ GSList *sources = e_source_group_peek_sources (*on_this_computer); GSList *s; for (s = sources; s; s = s->next) { @@ -224,8 +224,8 @@ e_cal_shell_backend_migrate (EShellBackend *shell_backend, 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. */ + * 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); diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c index 53b2a0e6c7..21472453ef 100644 --- a/modules/calendar/e-cal-shell-view-actions.c +++ b/modules/calendar/e-cal-shell-view-actions.c @@ -1205,7 +1205,8 @@ exit: } static void -edit_event_as (ECalShellView *cal_shell_view, gboolean as_meeting) +edit_event_as (ECalShellView *cal_shell_view, + gboolean as_meeting) { ECalShellContent *cal_shell_content; GnomeCalendarViewType view_type; diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c index 7a9fdaac69..c2f39c5f9b 100644 --- a/modules/calendar/e-cal-shell-view-private.c +++ b/modules/calendar/e-cal-shell-view-private.c @@ -828,7 +828,8 @@ struct ForeachTzidData }; static void -add_timezone_to_cal_cb (icalparameter *param, gpointer data) +add_timezone_to_cal_cb (icalparameter *param, + gpointer data) { struct ForeachTzidData *ftd = data; icaltimezone *tz = NULL; diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index 03914f1793..61a2d9c27a 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -227,7 +227,8 @@ cal_shell_view_execute_search (EShellView *shell_view) } static icalproperty * -get_attendee_prop (icalcomponent *icalcomp, const gchar *address) +get_attendee_prop (icalcomponent *icalcomp, + const gchar *address) { icalproperty *prop; @@ -252,7 +253,8 @@ get_attendee_prop (icalcomponent *icalcomp, const gchar *address) } static gboolean -is_delegated (icalcomponent *icalcomp, const gchar *user_email) +is_delegated (icalcomponent *icalcomp, + const gchar *user_email) { icalproperty *prop; icalparameter *param; diff --git a/modules/calendar/e-calendar-preferences.c b/modules/calendar/e-calendar-preferences.c index 115226dcf3..85eddd9736 100644 --- a/modules/calendar/e-calendar-preferences.c +++ b/modules/calendar/e-calendar-preferences.c @@ -191,7 +191,8 @@ update_day_second_zone_caption (ECalendarPreferences *prefs) } static void -on_set_day_second_zone (GtkWidget *item, ECalendarPreferences *prefs) +on_set_day_second_zone (GtkWidget *item, + ECalendarPreferences *prefs) { if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item))) return; @@ -201,7 +202,8 @@ on_set_day_second_zone (GtkWidget *item, ECalendarPreferences *prefs) } static void -on_select_day_second_zone (GtkWidget *item, ECalendarPreferences *prefs) +on_select_day_second_zone (GtkWidget *item, + ECalendarPreferences *prefs) { g_return_if_fail (prefs != NULL); @@ -210,7 +212,8 @@ on_select_day_second_zone (GtkWidget *item, ECalendarPreferences *prefs) } static void -day_second_zone_clicked (GtkWidget *widget, ECalendarPreferences *prefs) +day_second_zone_clicked (GtkWidget *widget, + ECalendarPreferences *prefs) { GtkWidget *menu, *item; GSList *group = NULL, *recent_zones, *s; @@ -263,7 +266,8 @@ day_second_zone_clicked (GtkWidget *widget, ECalendarPreferences *prefs) } static void -start_of_day_changed (GtkWidget *widget, ECalendarPreferences *prefs) +start_of_day_changed (GtkWidget *widget, + ECalendarPreferences *prefs) { gint start_hour, start_minute, end_hour, end_minute; EDateEdit *start, *end; @@ -292,7 +296,8 @@ start_of_day_changed (GtkWidget *widget, ECalendarPreferences *prefs) } static void -end_of_day_changed (GtkWidget *widget, ECalendarPreferences *prefs) +end_of_day_changed (GtkWidget *widget, + ECalendarPreferences *prefs) { gint start_hour, start_minute, end_hour, end_minute; EDateEdit *start, *end; @@ -321,7 +326,8 @@ end_of_day_changed (GtkWidget *widget, ECalendarPreferences *prefs) } static void -notify_with_tray_toggled (GtkToggleButton *toggle, ECalendarPreferences *prefs) +notify_with_tray_toggled (GtkToggleButton *toggle, + ECalendarPreferences *prefs) { GConfClient *gconf; @@ -333,7 +339,8 @@ notify_with_tray_toggled (GtkToggleButton *toggle, ECalendarPreferences *prefs) } static void -alarms_selection_changed (ESourceSelector *selector, ECalendarPreferences *prefs) +alarms_selection_changed (ESourceSelector *selector, + ECalendarPreferences *prefs) { ESourceList *source_list = prefs->alarms_list; GSList *selection; @@ -358,7 +365,7 @@ alarms_selection_changed (ESourceSelector *selector, ECalendarPreferences *prefs } /* then we loop over the selector's selection, setting the - property on those sources */ + * property on those sources */ selection = e_source_selector_get_selection (selector); for (l = selection; l; l = l->next) { source = E_SOURCE (l->data); @@ -402,17 +409,30 @@ update_system_tz_widgets (EShellSettings *shell_settings, static void setup_changes (ECalendarPreferences *prefs) { - g_signal_connect (G_OBJECT (prefs->day_second_zone), "clicked", G_CALLBACK (day_second_zone_clicked), prefs); + g_signal_connect ( + prefs->day_second_zone, "clicked", + G_CALLBACK (day_second_zone_clicked), prefs); - g_signal_connect (G_OBJECT (prefs->start_of_day), "changed", G_CALLBACK (start_of_day_changed), prefs); - g_signal_connect (G_OBJECT (prefs->end_of_day), "changed", G_CALLBACK (end_of_day_changed), prefs); + g_signal_connect ( + prefs->start_of_day, "changed", + G_CALLBACK (start_of_day_changed), prefs); - g_signal_connect (G_OBJECT (prefs->notify_with_tray), "toggled", G_CALLBACK (notify_with_tray_toggled), prefs); - g_signal_connect (G_OBJECT (prefs->alarm_list_widget), "selection_changed", G_CALLBACK (alarms_selection_changed), prefs); + g_signal_connect ( + prefs->end_of_day, "changed", + G_CALLBACK (end_of_day_changed), 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) +initialize_selection (ESourceSelector *selector, + ESourceList *source_list) { GSList *groups; @@ -497,7 +517,9 @@ static ECalConfigItem eccp_items[] = { }; static void -eccp_free (EConfig *ec, GSList *items, gpointer data) +eccp_free (EConfig *ec, + GSList *items, + gpointer data) { g_slist_free (items); } diff --git a/modules/calendar/e-memo-shell-migrate.c b/modules/calendar/e-memo-shell-migrate.c index 55f57996cb..6402cf1e0a 100644 --- a/modules/calendar/e-memo-shell-migrate.c +++ b/modules/calendar/e-memo-shell-migrate.c @@ -89,7 +89,7 @@ create_memo_sources (EShellBackend *shell_backend, if (*on_this_computer) { /* make sure "Personal" shows up as a source under - this group */ + * this group */ GSList *sources = e_source_group_peek_sources (*on_this_computer); GSList *s; for (s = sources; s; s = s->next) { @@ -172,8 +172,8 @@ e_memo_shell_backend_migrate (EShellBackend *shell_backend, 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. */ + * 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); diff --git a/modules/calendar/e-task-shell-migrate.c b/modules/calendar/e-task-shell-migrate.c index bf2d07ed8b..60499d673f 100644 --- a/modules/calendar/e-task-shell-migrate.c +++ b/modules/calendar/e-task-shell-migrate.c @@ -101,7 +101,7 @@ create_task_sources (EShellBackend *shell_backend, if (*on_this_computer) { /* make sure "Personal" shows up as a source under - this group */ + * this group */ GSList *sources = e_source_group_peek_sources (*on_this_computer); GSList *s; for (s = sources; s; s = s->next) { @@ -183,8 +183,8 @@ e_task_shell_backend_migrate (EShellBackend *shell_backend, 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. */ + * 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); -- cgit v1.2.3 From bd4898c8a01f2fa9a7f6abadf91c2b51fd411695 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 14 Sep 2011 12:36:54 +0200 Subject: Make sure GConf schemas have defined default values --- modules/calendar/apps_evolution_calendar.schemas.in | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'modules/calendar') diff --git a/modules/calendar/apps_evolution_calendar.schemas.in b/modules/calendar/apps_evolution_calendar.schemas.in index 7df4f95271..c34852ed4e 100644 --- a/modules/calendar/apps_evolution_calendar.schemas.in +++ b/modules/calendar/apps_evolution_calendar.schemas.in @@ -8,6 +8,7 @@ /apps/evolution/calendar/display/primary_calendar evolution-calendar string + Primary calendar @@ -501,6 +502,7 @@ /apps/evolution/calendar/memos/primary_memos evolution-calendar string + Primary memo list @@ -517,6 +519,7 @@ /apps/evolution/calendar/tasks/primary_tasks evolution-calendar string + Primary task list @@ -786,6 +789,7 @@ /apps/evolution/calendar/publish/template evolution-calendar string + Free/busy template URL The URL template to use as a free/busy data fallback, %u is replaced by the user part of the mail address and %d is replaced by the domain. @@ -797,6 +801,7 @@ /apps/evolution/calendar/audio_dir evolution-calendar string + Save directory for reminder audio -- cgit v1.2.3 From 6ea72f4fe7cd9ed44660589bf13eb153007cb62e Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 15 Sep 2011 14:54:31 +0200 Subject: Bug #659125 - Reference counting issues in calendar --- modules/calendar/e-cal-shell-view-memopad.c | 1 - modules/calendar/e-cal-shell-view-taskpad.c | 3 +-- modules/calendar/e-memo-shell-backend.c | 3 +++ modules/calendar/e-memo-shell-view-actions.c | 1 - modules/calendar/e-task-shell-backend.c | 3 +++ modules/calendar/e-task-shell-view-actions.c | 1 - modules/calendar/e-task-shell-view-private.c | 2 +- 7 files changed, 8 insertions(+), 6 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-view-memopad.c b/modules/calendar/e-cal-shell-view-memopad.c index bd1e9d5ac8..4978ca2183 100644 --- a/modules/calendar/e-cal-shell-view-memopad.c +++ b/modules/calendar/e-cal-shell-view-memopad.c @@ -92,7 +92,6 @@ action_calendar_memopad_new_cb (GtkAction *action, gtk_window_present (GTK_WINDOW (editor)); g_object_unref (comp); - g_object_unref (client); } static void diff --git a/modules/calendar/e-cal-shell-view-taskpad.c b/modules/calendar/e-cal-shell-view-taskpad.c index 48c81ac085..92263c75e3 100644 --- a/modules/calendar/e-cal-shell-view-taskpad.c +++ b/modules/calendar/e-cal-shell-view-taskpad.c @@ -160,7 +160,6 @@ action_calendar_taskpad_new_cb (GtkAction *action, gtk_window_present (GTK_WINDOW (editor)); g_object_unref (comp); - g_object_unref (client); } static void @@ -548,7 +547,7 @@ e_cal_shell_view_taskpad_open_task (ECalShellView *cal_shell_view, editor = task_editor_new (comp_data->client, shell, flags); comp_editor_edit_comp (editor, comp); - g_object_ref (comp); + g_object_unref (comp); if (flags & COMP_EDITOR_IS_ASSIGNED) task_editor_show_assignment (TASK_EDITOR (editor)); diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c index 6f8070094e..7edb82d6bb 100644 --- a/modules/calendar/e-memo-shell-backend.c +++ b/modules/calendar/e-memo-shell-backend.c @@ -422,6 +422,8 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend, g_warning ( "%s: Failed to create/open client: %s", G_STRFUNC, error->message); + if (client != NULL) + g_object_unref (client); g_object_unref (source_list); g_error_free (error); goto exit; @@ -443,6 +445,7 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend, "%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; } diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c index eacb5c1da7..d71b893fe3 100644 --- a/modules/calendar/e-memo-shell-view-actions.c +++ b/modules/calendar/e-memo-shell-view-actions.c @@ -385,7 +385,6 @@ action_memo_new_cb (GtkAction *action, gtk_window_present (GTK_WINDOW (editor)); g_object_unref (comp); - g_object_unref (client); } static void diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c index bb296fd5c2..f6a5e14588 100644 --- a/modules/calendar/e-task-shell-backend.c +++ b/modules/calendar/e-task-shell-backend.c @@ -422,6 +422,8 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend, g_warning ( "%s: Failed to create/open client: %s", G_STRFUNC, error->message); + if (client) + g_object_unref (client); g_object_unref (source_list); g_error_free (error); goto exit; @@ -443,6 +445,7 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend, "%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; } diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c index 1fb4867205..2fe28494ac 100644 --- a/modules/calendar/e-task-shell-view-actions.c +++ b/modules/calendar/e-task-shell-view-actions.c @@ -453,7 +453,6 @@ action_task_new_cb (GtkAction *action, gtk_window_present (GTK_WINDOW (editor)); g_object_unref (comp); - g_object_unref (client); } static void diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c index b8122786f2..8c02ceccbc 100644 --- a/modules/calendar/e-task-shell-view-private.c +++ b/modules/calendar/e-task-shell-view-private.c @@ -445,7 +445,7 @@ e_task_shell_view_open_task (ETaskShellView *task_shell_view, editor = task_editor_new (comp_data->client, shell, flags); comp_editor_edit_comp (editor, comp); - g_object_ref (comp); + g_object_unref (comp); if (flags & COMP_EDITOR_IS_ASSIGNED) task_editor_show_assignment (TASK_EDITOR (editor)); -- cgit v1.2.3 From 41a504dcc1760e4f1265ffb4b070b1db2cec2c5f Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 26 Sep 2011 11:20:35 +0200 Subject: Bug #659932 - 'Use system time zone' in not honored immediately --- modules/calendar/e-cal-shell-settings.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-settings.c b/modules/calendar/e-cal-shell-settings.c index 4d105bcf3d..456f95707c 100644 --- a/modules/calendar/e-cal-shell-settings.c +++ b/modules/calendar/e-cal-shell-settings.c @@ -69,19 +69,34 @@ transform_icaltimezone_to_string (GBinding *binding, GValue *target_value, gpointer user_data) { + EShellSettings *shell_settings; + gboolean use_system_timezone; const gchar *location = NULL; + gchar *location_str = NULL; icaltimezone *timezone; - timezone = g_value_get_pointer (source_value); + shell_settings = E_SHELL_SETTINGS (user_data); - if (timezone != NULL) - location = icaltimezone_get_location (timezone); + use_system_timezone = e_shell_settings_get_boolean ( + shell_settings, "cal-use-system-timezone"); + + if (use_system_timezone) { + location_str = e_shell_settings_get_string (shell_settings, "cal-timezone-string"); + location = location_str; + } else { + timezone = g_value_get_pointer (source_value); + + if (timezone != NULL) + location = icaltimezone_get_location (timezone); + } if (location == NULL) location = "UTC"; g_value_set_string (target_value, location); + g_free (location_str); + return TRUE; } @@ -494,6 +509,12 @@ transform_working_days_saturday_to_bitset (GBinding *binding, return TRUE; } +static void +cal_use_system_timezone_changed_cb (GObject *shell_settings) +{ + g_object_notify (shell_settings, "cal-timezone-string"); +} + void e_cal_shell_backend_init_settings (EShell *shell) { @@ -872,4 +893,8 @@ e_cal_shell_backend_init_settings (EShell *shell) transform_working_days_saturday_to_bitset, g_object_ref (shell_settings), (GDestroyNotify) g_object_unref); + + g_signal_connect ( + shell_settings, "notify::cal-use-system-timezone", + G_CALLBACK (cal_use_system_timezone_changed_cb), NULL); } -- cgit v1.2.3 From 10d9a80d698479d8c96f0ba46a64a9fb5521edff Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 26 Sep 2011 12:42:47 +0200 Subject: Bug #659568 - One day delay in calendar view --- modules/calendar/e-cal-shell-view.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index 61a2d9c27a..0a9b7701f8 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -70,6 +70,7 @@ cal_shell_view_execute_search (EShellView *shell_view) ECalModel *model; GtkRadioAction *action; icaltimezone *timezone; + const gchar *default_tzloc = NULL; struct icaltimetype current_time; time_t start_range; time_t end_range; @@ -95,6 +96,11 @@ cal_shell_view_execute_search (EShellView *shell_view) current_time = icaltime_current_time_with_zone (timezone); now_time = time_day_begin (icaltime_as_timet (current_time)); + if (timezone && timezone != icaltimezone_get_utc_timezone ()) + default_tzloc = icaltimezone_get_location (timezone); + if (!default_tzloc) + default_tzloc = ""; + action = GTK_RADIO_ACTION (ACTION (CALENDAR_SEARCH_ANY_FIELD_CONTAINS)); value = gtk_radio_action_get_current_value (action); @@ -165,9 +171,8 @@ cal_shell_view_execute_search (EShellView *shell_view) end = isodate_from_time_t (end_range); temp = g_strdup_printf ( - "(and %s (occur-in-time-range? " - "(make-time \"%s\") (make-time \"%s\")))", - query, start, end); + "(and %s (occur-in-time-range? (make-time \"%s\") (make-time \"%s\") \"%s\"))", + query, start, end, default_tzloc); g_free (query); query = temp; @@ -181,9 +186,8 @@ cal_shell_view_execute_search (EShellView *shell_view) end = isodate_from_time_t (end_range); temp = g_strdup_printf ( - "(and %s (occur-in-time-range? " - "(make-time \"%s\") (make-time \"%s\")))", - query, start, end); + "(and %s (occur-in-time-range? (make-time \"%s\") (make-time \"%s\") \"%s\"))", + query, start, end, default_tzloc); g_free (query); query = temp; -- cgit v1.2.3 From 53bc6ffc531d7a7188e15be245a31f301090ee15 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 10 Sep 2011 11:47:15 -0400 Subject: The EExtension framework is now in libebackend. The EModule, EExtensible and EExtension classes as well as the e_type_traverse() function have been moved to Evolution-Data-Server's libebackend library to replace e-data-server-module.c. Now Evolution-Data-Server modules use the same framework as Evolution. --- modules/calendar/e-cal-config-calendar-item.c | 3 ++- modules/calendar/e-cal-config-comp-editor.c | 3 ++- modules/calendar/e-cal-config-date-edit.c | 3 ++- modules/calendar/e-cal-config-meeting-store.c | 3 ++- modules/calendar/e-cal-config-meeting-time-selector.c | 3 ++- modules/calendar/e-cal-config-model.c | 3 ++- modules/calendar/e-cal-config-view.c | 3 ++- 7 files changed, 14 insertions(+), 7 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-config-calendar-item.c b/modules/calendar/e-cal-config-calendar-item.c index 09895c0a0e..d0d6e11b90 100644 --- a/modules/calendar/e-cal-config-calendar-item.c +++ b/modules/calendar/e-cal-config-calendar-item.c @@ -22,8 +22,9 @@ #include "e-cal-config-calendar-item.h" +#include + #include -#include #include static gpointer parent_class; diff --git a/modules/calendar/e-cal-config-comp-editor.c b/modules/calendar/e-cal-config-comp-editor.c index b522975bac..dc37c748c3 100644 --- a/modules/calendar/e-cal-config-comp-editor.c +++ b/modules/calendar/e-cal-config-comp-editor.c @@ -22,8 +22,9 @@ #include "e-cal-config-comp-editor.h" +#include + #include -#include #include static gpointer parent_class; diff --git a/modules/calendar/e-cal-config-date-edit.c b/modules/calendar/e-cal-config-date-edit.c index d59549764b..48a5848f73 100644 --- a/modules/calendar/e-cal-config-date-edit.c +++ b/modules/calendar/e-cal-config-date-edit.c @@ -22,8 +22,9 @@ #include "e-cal-config-date-edit.h" +#include + #include -#include #include static gpointer parent_class; diff --git a/modules/calendar/e-cal-config-meeting-store.c b/modules/calendar/e-cal-config-meeting-store.c index f9a91dacd0..7b4f2dec30 100644 --- a/modules/calendar/e-cal-config-meeting-store.c +++ b/modules/calendar/e-cal-config-meeting-store.c @@ -22,8 +22,9 @@ #include "e-cal-config-meeting-store.h" +#include + #include -#include #include static gpointer parent_class; diff --git a/modules/calendar/e-cal-config-meeting-time-selector.c b/modules/calendar/e-cal-config-meeting-time-selector.c index 23eef11ef5..249d541274 100644 --- a/modules/calendar/e-cal-config-meeting-time-selector.c +++ b/modules/calendar/e-cal-config-meeting-time-selector.c @@ -22,8 +22,9 @@ #include "e-cal-config-meeting-time-selector.h" +#include + #include -#include #include static gpointer parent_class; diff --git a/modules/calendar/e-cal-config-model.c b/modules/calendar/e-cal-config-model.c index f42e4a9b66..9898942bf9 100644 --- a/modules/calendar/e-cal-config-model.c +++ b/modules/calendar/e-cal-config-model.c @@ -22,8 +22,9 @@ #include "e-cal-config-model.h" +#include + #include -#include #include #include diff --git a/modules/calendar/e-cal-config-view.c b/modules/calendar/e-cal-config-view.c index ecc35871ca..afe747dd80 100644 --- a/modules/calendar/e-cal-config-view.c +++ b/modules/calendar/e-cal-config-view.c @@ -22,8 +22,9 @@ #include "e-cal-config-view.h" +#include + #include -#include #include #include -- cgit v1.2.3 From f8e6c60b2facac19916b72323ce78dbfa137d00c Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 29 Sep 2011 14:43:28 +0200 Subject: Bug #632619 - Recurring events can clutter month view --- modules/calendar/e-cal-shell-view-actions.c | 9 ++++++++- modules/calendar/e-cal-shell-view-actions.h | 2 ++ modules/calendar/e-cal-shell-view-private.h | 9 +++++---- modules/calendar/e-cal-shell-view.c | 6 ++++++ 4 files changed, 21 insertions(+), 5 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c index 21472453ef..aa5738e27e 100644 --- a/modules/calendar/e-cal-shell-view-actions.c +++ b/modules/calendar/e-cal-shell-view-actions.c @@ -1705,6 +1705,13 @@ static GtkRadioActionEntry calendar_filter_entries[] = { NULL, /* XXX Add a tooltip! */ CALENDAR_FILTER_NEXT_7_DAYS_APPOINTMENTS }, + { "calendar-filter-occurs-less-than-5-times", + NULL, + N_("Occurs Less Than 5 Times"), + NULL, + NULL, /* XXX Add a tooltip! */ + CALENDAR_FILTER_OCCURS_LESS_THAN_5_TIMES }, + { "calendar-filter-unmatched", NULL, N_("Unmatched"), @@ -1972,7 +1979,7 @@ e_cal_shell_view_update_search_filter (ECalShellView *cal_shell_view) ii = CALENDAR_FILTER_UNMATCHED; e_action_combo_box_add_separator_after (combo_box, ii); - ii = CALENDAR_FILTER_NEXT_7_DAYS_APPOINTMENTS; + ii = CALENDAR_FILTER_OCCURS_LESS_THAN_5_TIMES; e_action_combo_box_add_separator_after (combo_box, ii); e_shell_view_unblock_execute_search (shell_view); diff --git a/modules/calendar/e-cal-shell-view-actions.h b/modules/calendar/e-cal-shell-view-actions.h index b79bc6baaf..fcc77ea011 100644 --- a/modules/calendar/e-cal-shell-view-actions.h +++ b/modules/calendar/e-cal-shell-view-actions.h @@ -133,6 +133,8 @@ E_SHELL_WINDOW_ACTION ((window), "calendar-filter-any-category") #define E_SHELL_WINDOW_ACTION_CALENDAR_FILTER_NEXT_7_DAYS_APPOINTMENTS(window) \ E_SHELL_WINDOW_ACTION ((window), "calendar-filter-next-7-days-appointments") +#define E_SHELL_WINDOW_ACTION_CALENDAR_FILTER_OCCURS_LESS_THAN_5_TIMES(window) \ + E_SHELL_WINDOW_ACTION ((window), "calendar-filter-occurs-less-than-5-times") #define E_SHELL_WINDOW_ACTION_CALENDAR_FILTER_UNMATCHED(window) \ E_SHELL_WINDOW_ACTION ((window), "calendar-filter-unmatched") #define E_SHELL_WINDOW_ACTION_CALENDAR_SEARCH_ADVANCED_HIDDEN(window) \ diff --git a/modules/calendar/e-cal-shell-view-private.h b/modules/calendar/e-cal-shell-view-private.h index 7c78130fc3..6653632662 100644 --- a/modules/calendar/e-cal-shell-view-private.h +++ b/modules/calendar/e-cal-shell-view-private.h @@ -85,10 +85,11 @@ G_BEGIN_DECLS /* Filter items are displayed in ascending order. * Non-negative values are reserved for categories. */ enum { - CALENDAR_FILTER_ANY_CATEGORY = -4, - CALENDAR_FILTER_UNMATCHED = -3, - CALENDAR_FILTER_ACTIVE_APPOINTMENTS = -2, - CALENDAR_FILTER_NEXT_7_DAYS_APPOINTMENTS = -1 + CALENDAR_FILTER_ANY_CATEGORY = -5, + CALENDAR_FILTER_UNMATCHED = -4, + CALENDAR_FILTER_ACTIVE_APPOINTMENTS = -3, + CALENDAR_FILTER_NEXT_7_DAYS_APPOINTMENTS = -2, + CALENDAR_FILTER_OCCURS_LESS_THAN_5_TIMES = -1 }; /* Search items are displayed in ascending order. */ diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index 0a9b7701f8..f644402080 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -194,6 +194,12 @@ cal_shell_view_execute_search (EShellView *shell_view) range_search = TRUE; break; + case CALENDAR_FILTER_OCCURS_LESS_THAN_5_TIMES: + temp = g_strdup_printf ("(and %s (< (occurrences-count?) 5))", query); + g_free (query); + query = temp; + break; + default: { GList *categories; -- cgit v1.2.3 From 1f38f4d92ca8eb97381b2c9a7022830a6d4bcaba Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 4 Oct 2011 21:32:41 -0400 Subject: Simplify library dependency flags. We have a confusing array of nearly-identical CFLAGS/LIBS definitions in configure.ac. Time to simplify. Instead let's just have one definition that includes all the libraries provided by Evolution-Data-Server (incl. Camel). That, in combination with GNOME_PLATFORM, gives us most of what we need for compliation and linking, and we can sprinkle definitions for additional library dependencies in Makefile.am's as needed. --- modules/calendar/Makefile.am | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/Makefile.am b/modules/calendar/Makefile.am index c725dedb1c..4f09f92692 100644 --- a/modules/calendar/Makefile.am +++ b/modules/calendar/Makefile.am @@ -7,9 +7,9 @@ libevolution_module_calendar_la_CPPFLAGS = \ -I$(top_srcdir) \ -I$(top_srcdir)/widgets \ -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \ - $(CAMEL_CFLAGS) \ + $(EVOLUTION_DATA_SERVER_CFLAGS) \ $(GNOME_PLATFORM_CFLAGS) \ - $(EVOLUTION_CALENDAR_CFLAGS) + $(GTKHTML_CFLAGS) libevolution_module_calendar_la_SOURCES = \ evolution-module-calendar.c \ @@ -94,9 +94,9 @@ libevolution_module_calendar_la_LIBADD = \ $(top_builddir)/widgets/menus/libmenus.la \ $(top_builddir)/widgets/misc/libemiscwidgets.la \ $(top_builddir)/widgets/table/libetable.la \ - $(CAMEL_LIBS) \ - $(EVOLUTION_CALENDAR_LIBS) \ - $(GNOME_PLATFORM_LIBS) + $(EVOLUTION_DATA_SERVER_LIBS) \ + $(GNOME_PLATFORM_LIBS) \ + $(GTKHTML_LIBS) libevolution_module_calendar_la_LDFLAGS = \ -module -avoid-version $(NO_UNDEFINED) -- cgit v1.2.3