diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-09-08 00:31:19 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-09-08 07:08:54 +0800 |
commit | 3da4948c0fc1f2c21b163f0ec456b2d99c881258 (patch) | |
tree | 479d6153d31e03cb7a65990683b5271402e5ec29 /calendar/gui/dialogs | |
parent | 2e5031cb4538b4819e5fce5d717668c3445df80a (diff) | |
download | gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.tar gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.tar.gz gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.tar.bz2 gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.tar.lz gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.tar.xz gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.tar.zst gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.zip |
Miscellaneous cleanups.
Diffstat (limited to 'calendar/gui/dialogs')
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 62 | ||||
-rw-r--r-- | calendar/gui/dialogs/copy-source-dialog.c | 38 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.c | 17 | ||||
-rw-r--r-- | calendar/gui/dialogs/memo-page.c | 3 | ||||
-rw-r--r-- | calendar/gui/dialogs/recurrence-page.c | 10 | ||||
-rw-r--r-- | calendar/gui/dialogs/send-comp.c | 15 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-page.c | 10 |
7 files changed, 84 insertions, 71 deletions
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 39ca3a81e1..0459e4797a 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -390,12 +390,14 @@ changes_view_ready_cb (GObject *source_object, G_STRFUNC, error->message); g_error_free (error); } - } else if (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_warning ( - "%s: Failed to get view: %s", - G_STRFUNC, error->message); + + } else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_error_free (error); + + } else if (error != NULL) { + g_warning ( + "%s: Failed to get view: %s", + G_STRFUNC, error->message); g_error_free (error); } } @@ -619,7 +621,7 @@ save_comp (CompEditor *editor) gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); - if (error) + if (error != NULL) g_error_free (error); g_free (orig_uid_copy); @@ -1055,35 +1057,23 @@ save_and_close_editor (CompEditor *editor, rid = e_cal_component_get_recurid_as_string (priv->comp); source_type = e_cal_client_get_source_type (priv->cal_client); - if (!e_cal_client_get_object_sync (priv->cal_client, uid, rid, &icalcomp, NULL, &error)) { - if (error != NULL) { - switch (source_type) { - case (E_CAL_CLIENT_SOURCE_TYPE_TASKS): - g_warning ("Unable to retrieve saved component from the task list, returned error was: %s", error->message); - break; - case (E_CAL_CLIENT_SOURCE_TYPE_MEMOS): - g_warning ("Unable to retrieve saved component from the memo list, returned error was: %s", error->message); - break; - case (E_CAL_CLIENT_SOURCE_TYPE_EVENTS): - default: - g_warning ("Unable to retrieve saved component from the calendar, returned error was: %s", error->message); - break; - } - g_clear_error (&error); - } else { - switch (source_type) { - case (E_CAL_CLIENT_SOURCE_TYPE_TASKS): - g_warning ("Unable to retrieve saved component from the task list"); + e_cal_client_get_object_sync ( + priv->cal_client, uid, rid, + &icalcomp, NULL, &error); + if (error != NULL) { + switch (source_type) { + case (E_CAL_CLIENT_SOURCE_TYPE_TASKS): + g_warning ("Unable to retrieve saved component from the task list, returned error was: %s", error->message); + break; + case (E_CAL_CLIENT_SOURCE_TYPE_MEMOS): + g_warning ("Unable to retrieve saved component from the memo list, returned error was: %s", error->message); + break; + case (E_CAL_CLIENT_SOURCE_TYPE_EVENTS): + default: + g_warning ("Unable to retrieve saved component from the calendar, returned error was: %s", error->message); break; - case (E_CAL_CLIENT_SOURCE_TYPE_MEMOS): - g_warning ("Unable to retrieve saved component from the memo list"); - break; - case (E_CAL_CLIENT_SOURCE_TYPE_EVENTS): - default: - g_warning ("Unable to retrieve saved component from the calendar"); - break; - } } + g_clear_error (&error); e_notice ( GTK_WINDOW (editor), GTK_MESSAGE_ERROR, @@ -3438,7 +3428,9 @@ real_send_comp (CompEditor *editor, const gchar *uid = NULL; e_cal_component_get_uid (priv->comp, &uid); - if (e_cal_client_get_object_sync (priv->cal_client, uid, NULL, &icalcomp, NULL, NULL) && icalcomp) { + e_cal_client_get_object_sync ( + priv->cal_client, uid, NULL, &icalcomp, NULL, NULL); + if (icalcomp != NULL) { send_comp = e_cal_component_new (); if (!e_cal_component_set_icalcomponent (send_comp, icalcomp)) { icalcomponent_free (icalcomp); diff --git a/calendar/gui/dialogs/copy-source-dialog.c b/calendar/gui/dialogs/copy-source-dialog.c index 0f0dc0545e..e9e35b892c 100644 --- a/calendar/gui/dialogs/copy-source-dialog.c +++ b/calendar/gui/dialogs/copy-source-dialog.c @@ -77,8 +77,11 @@ add_timezone_to_cal_cb (icalparameter *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); + e_cal_client_get_timezone_sync ( + ftd->source_client, tzid, &tz, NULL, NULL); + if (tz != NULL) + e_cal_client_add_timezone_sync ( + ftd->dest_client, tz, NULL, NULL); } static void @@ -128,7 +131,10 @@ dest_source_connected_cb (GObject *source_object, show_error (csdd, _("Destination is read only"), NULL); } else { GSList *obj_list = NULL; - if (e_cal_client_get_object_list_sync (csdd->source_client, "#t", &obj_list, NULL, NULL)) { + + e_cal_client_get_object_list_sync ( + csdd->source_client, "#t", &obj_list, NULL, NULL); + if (obj_list != NULL) { GSList *l; icalcomponent *icalcomp; struct ForeachTzidData ftd; @@ -139,12 +145,16 @@ dest_source_connected_cb (GObject *source_object, for (l = obj_list; l != NULL; l = l->next) { /* FIXME: process recurrences */ /* FIXME: process errors */ - if (e_cal_client_get_object_sync (csdd->dest_client, icalcomponent_get_uid (l->data), NULL, - &icalcomp, NULL, NULL)) { - e_cal_client_modify_object_sync (csdd->dest_client, l->data, CALOBJ_MOD_ALL, NULL, NULL); + e_cal_client_get_object_sync ( + csdd->dest_client, + icalcomponent_get_uid (l->data), + NULL, &icalcomp, NULL, NULL); + if (icalcomp != NULL) { + e_cal_client_modify_object_sync ( + csdd->dest_client, l->data, + CALOBJ_MOD_ALL, NULL, NULL); icalcomponent_free (icalcomp); } else { - gchar *uid = NULL; GError *error = NULL; icalcomp = l->data; @@ -155,13 +165,13 @@ dest_source_connected_cb (GObject *source_object, icalcomp, add_timezone_to_cal_cb, &ftd); - if (e_cal_client_create_object_sync (csdd->dest_client, icalcomp, &uid, NULL, &error)) { - g_free (uid); - } else { - if (error) { - show_error (csdd, _("Cannot create object"), error); - g_error_free (error); - } + e_cal_client_create_object_sync ( + csdd->dest_client, + icalcomp, NULL, NULL, &error); + + if (error != NULL) { + show_error (csdd, _("Cannot create object"), error); + g_error_free (error); break; } } diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index f1f7c05e89..f4d9658ccb 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -992,8 +992,10 @@ event_page_load_locations_list (CompEditorPage *page, error = NULL; g_file_get_contents (file_name, &contents, NULL, &error); - if (error) { - g_warning ("%s: Failed to load locations list: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to load locations list: %s", + G_STRFUNC, error->message); g_error_free (error); g_free (file_name); return; @@ -1081,8 +1083,10 @@ event_page_save_locations_list (CompEditorPage *page, error = NULL; g_file_set_contents (file_name, contents->str, -1, &error); - if (error) { - g_warning ("%s: Failed to save locations: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to save locations: %s", + G_STRFUNC, error->message); g_error_free (error); } @@ -2997,8 +3001,7 @@ epage_get_client_cb (GObject *source_object, ((client != NULL) && (error == NULL)) || ((client == NULL) && (error != NULL))); - if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || - g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { g_clear_error (&error); return; } @@ -3006,7 +3009,7 @@ epage_get_client_cb (GObject *source_object, editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage)); priv = epage->priv; - if (error) { + if (error != NULL) { GtkWidget *dialog; ECalClient *old_client; diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index c202444a2b..1fd9221a54 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -946,8 +946,7 @@ mpage_get_client_cb (GObject *source_object, ((client != NULL) && (error == NULL)) || ((client == NULL) && (error != NULL))); - if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || - g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { g_clear_error (&error); return; } diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 3ceb08476e..4fcd34794b 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -234,7 +234,9 @@ preview_recur (RecurrencePage *rpage) e_cal_component_get_dtstart (priv->comp, &cdt); if (cdt.tzid != NULL) { /* FIXME Will e_cal_client_get_timezone_sync really not return builtin zones? */ - if (!e_cal_client_get_timezone_sync (client, cdt.tzid, &zone, NULL, NULL)) + e_cal_client_get_timezone_sync ( + client, cdt.tzid, &zone, NULL, NULL); + if (zone == NULL) zone = icaltimezone_get_builtin_timezone_from_tzid (cdt.tzid); } e_cal_component_set_dtstart (comp, &cdt); @@ -630,8 +632,7 @@ rpage_get_objects_for_uid_cb (GObject *source_object, if (result && !e_cal_client_get_objects_for_uid_finish (client, result, &ecalcomps, &error)) { ecalcomps = NULL; - if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || - g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { g_clear_error (&error); return; } @@ -658,8 +659,7 @@ rpage_get_object_cb (GObject *source_object, if (result && !e_cal_client_get_object_finish (client, result, &icalcomp, &error)) { icalcomp = NULL; - if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || - g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { g_clear_error (&error); return; } diff --git a/calendar/gui/dialogs/send-comp.c b/calendar/gui/dialogs/send-comp.c index 9be9406965..b71c46427d 100644 --- a/calendar/gui/dialogs/send-comp.c +++ b/calendar/gui/dialogs/send-comp.c @@ -121,7 +121,10 @@ send_component_dialog (GtkWindow *parent, if (strip_alarms) *strip_alarms = TRUE; - if (e_cal_client_check_save_schedules (client) || !itip_component_has_recipients (comp)) + if (e_cal_client_check_save_schedules (client)) + return FALSE; + + if (!itip_component_has_recipients (comp)) return FALSE; vtype = e_cal_component_get_vtype (comp); @@ -210,15 +213,19 @@ send_dragged_or_resized_component_dialog (GtkWindow *parent, if (strip_alarms) *strip_alarms = TRUE; - if (e_cal_client_check_save_schedules (client) || !itip_component_has_recipients (comp)) + if (e_cal_client_check_save_schedules (client)) + save_schedules = TRUE; + + if (!itip_component_has_recipients (comp)) save_schedules = TRUE; vtype = e_cal_component_get_vtype (comp); switch (vtype) { case E_CAL_COMPONENT_EVENT: - id = save_schedules ? "calendar:prompt-save-meeting-dragged-or-resized" : - "calendar:prompt-send-updated-meeting-info-dragged-or-resized"; + id = save_schedules ? + "calendar:prompt-save-meeting-dragged-or-resized" : + "calendar:prompt-send-updated-meeting-info-dragged-or-resized"; break; default: g_message ( diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index b1f68d3381..084e519c28 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -718,7 +718,9 @@ task_page_fill_widgets (CompEditorPage *page, comp_editor_set_classification (editor, cl); e_cal_component_get_uid (comp, &uid); - if (e_cal_client_get_object_sync (client, uid, NULL, &icalcomp, NULL, NULL)) { + e_cal_client_get_object_sync ( + client, uid, NULL, &icalcomp, NULL, NULL); + if (icalcomp != NULL) { icalcomponent_free (icalcomp); task_page_hide_options (tpage); } @@ -2056,15 +2058,15 @@ tpage_get_client_cb (GObject *source_object, ((client != NULL) && (error == NULL)) || ((client == NULL) && (error != NULL))); - if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || - g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { g_clear_error (&error); return; } editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage)); priv = tpage->priv; - if (error) { + + if (error != NULL) { GtkWidget *dialog; ECalClient *old_client; |