aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/publish-calendar/publish-calendar.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-09-08 00:31:19 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-09-08 07:08:54 +0800
commit3da4948c0fc1f2c21b163f0ec456b2d99c881258 (patch)
tree479d6153d31e03cb7a65990683b5271402e5ec29 /plugins/publish-calendar/publish-calendar.c
parent2e5031cb4538b4819e5fce5d717668c3445df80a (diff)
downloadgsoc2013-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 'plugins/publish-calendar/publish-calendar.c')
-rw-r--r--plugins/publish-calendar/publish-calendar.c71
1 files changed, 43 insertions, 28 deletions
diff --git a/plugins/publish-calendar/publish-calendar.c b/plugins/publish-calendar/publish-calendar.c
index 2f1480187e..2713f00dd2 100644
--- a/plugins/publish-calendar/publish-calendar.c
+++ b/plugins/publish-calendar/publish-calendar.c
@@ -200,41 +200,48 @@ publish_online (EPublishUri *uri,
GOutputStream *stream;
GError *error = NULL;
- stream = G_OUTPUT_STREAM (g_file_replace (file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &error));
+ stream = G_OUTPUT_STREAM (g_file_replace (
+ file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &error));
- if (!stream || error) {
- if (stream)
- g_object_unref (stream);
+ /* Sanity check. */
+ g_return_if_fail (
+ ((stream != NULL) && (error == NULL)) ||
+ ((stream == NULL) && (error != NULL)));
- if (perror) {
+ if (error != NULL) {
+ if (perror != NULL) {
*perror = error;
- } else if (error) {
-
- error_queue_add (g_strdup_printf (_("Could not open %s:"), uri->location), error);
} else {
- error_queue_add (g_strdup_printf (_("Could not open %s: Unknown error"), uri->location), NULL);
+ error_queue_add (
+ g_strdup_printf (
+ _("Could not open %s:"),
+ uri->location),
+ error);
}
return;
}
switch (uri->publish_format) {
- case URI_PUBLISH_AS_ICAL:
- publish_calendar_as_ical (stream, uri, &error);
- break;
- case URI_PUBLISH_AS_FB:
- publish_calendar_as_fb (stream, uri, &error);
- break;
- /*
- case URI_PUBLISH_AS_HTML:
- publish_calendar_as_html (handle, uri);
- break;
- */
+ case URI_PUBLISH_AS_ICAL:
+ publish_calendar_as_ical (stream, uri, &error);
+ break;
+ case URI_PUBLISH_AS_FB:
+ publish_calendar_as_fb (stream, uri, &error);
+ break;
}
- if (error)
- error_queue_add (g_strdup_printf (_("There was an error while publishing to %s:"), uri->location), error);
+ if (error != NULL)
+ error_queue_add (
+ g_strdup_printf (
+ _("There was an error while publishing to %s:"),
+ uri->location),
+ error);
else if (can_report_success)
- error_queue_add (g_strdup_printf (_("Publishing to %s finished successfully"), uri->location), NULL);
+ error_queue_add (
+ g_strdup_printf (
+ _("Publishing to %s finished successfully"),
+ uri->location),
+ NULL);
update_timestamp (uri);
@@ -251,7 +258,7 @@ unmount_done_cb (GObject *source_object,
g_mount_unmount_with_operation_finish (G_MOUNT (source_object), result, &error);
- if (error) {
+ if (error != NULL) {
g_warning ("Unmount failed: %s", error->message);
g_error_free (error);
}
@@ -277,8 +284,12 @@ mount_ready_cb (GObject *source_object,
g_file_mount_enclosing_volume_finish (G_FILE (source_object), result, &error);
- if (error) {
- error_queue_add (g_strdup_printf (_("Mount of %s failed:"), ms ? ms->uri->location : "???"), error);
+ if (error != NULL) {
+ error_queue_add (
+ g_strdup_printf (
+ _("Mount of %s failed:"),
+ ms ? ms->uri->location : "???"),
+ error);
if (ms)
g_object_unref (ms->mount_op);
@@ -467,8 +478,12 @@ publish (EPublishUri *uri,
mount_first (uri, file, can_report_success);
}
- if (error)
- error_queue_add (g_strdup_printf (_("Could not open %s:"), uri->location), error);
+ if (error != NULL)
+ error_queue_add (
+ g_strdup_printf (
+ _("Could not open %s:"),
+ uri->location),
+ error);
g_object_unref (file);
} else {