aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/bbdb/bbdb.c22
-rw-r--r--plugins/bbdb/gaimbuddies.c21
-rw-r--r--plugins/face/face.c2
-rw-r--r--plugins/mail-notification/mail-notification.c4
-rw-r--r--plugins/mail-to-task/mail-to-task.c27
-rw-r--r--plugins/pst-import/pst-importer.c49
-rw-r--r--plugins/publish-calendar/publish-calendar.c71
-rw-r--r--plugins/publish-calendar/publish-format-fb.c14
-rw-r--r--plugins/publish-calendar/publish-format-ical.c16
-rw-r--r--plugins/save-calendar/csv-format.c4
-rw-r--r--plugins/save-calendar/ical-format.c31
-rw-r--r--plugins/save-calendar/rdf-format.c7
12 files changed, 163 insertions, 105 deletions
diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c
index bfb6959047..31aebceff2 100644
--- a/plugins/bbdb/bbdb.c
+++ b/plugins/bbdb/bbdb.c
@@ -272,7 +272,7 @@ bbdb_do_it (EBookClient *client,
const gchar *name,
const gchar *email)
{
- gchar *query_string, *delim, *temp_name = NULL, *uid;
+ gchar *query_string, *delim, *temp_name = NULL;
GSList *contacts = NULL;
gboolean status;
EContact *contact;
@@ -334,8 +334,14 @@ bbdb_do_it (EBookClient *client,
contact = (EContact *) contacts->data;
add_email_to_contact (contact, email);
- if (!e_book_client_modify_contact_sync (client, contact, NULL, &error)) {
- g_warning ("bbdb: Could not modify contact: %s\n", error->message);
+
+ e_book_client_modify_contact_sync (
+ client, contact, NULL, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "bbdb: Could not modify contact: %s\n",
+ error->message);
g_error_free (error);
}
@@ -350,14 +356,16 @@ bbdb_do_it (EBookClient *client,
add_email_to_contact (contact, email);
g_free (temp_name);
- uid = NULL;
- if (!e_book_client_add_contact_sync (client, contact, &uid, NULL, &error)) {
- g_warning ("bbdb: Failed to add new contact: %s", error->message);
+ e_book_client_add_contact_sync (client, contact, NULL, NULL, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "bbdb: Failed to add new contact: %s",
+ error->message);
g_error_free (error);
}
g_object_unref (contact);
- g_free (uid);
}
EBookClient *
diff --git a/plugins/bbdb/gaimbuddies.c b/plugins/bbdb/gaimbuddies.c
index 7f55c18fde..d0f2a066cf 100644
--- a/plugins/bbdb/gaimbuddies.c
+++ b/plugins/bbdb/gaimbuddies.c
@@ -224,7 +224,7 @@ bbdb_sync_buddy_list_in_thread (gpointer data)
for (link = head; link != NULL; link = g_list_next (link)) {
GaimBuddy *b = link->data;
EBookQuery *query;
- gchar *query_string, *uid;
+ gchar *query_string;
GSList *contacts = NULL;
EContact *c;
@@ -268,8 +268,13 @@ bbdb_sync_buddy_list_in_thread (gpointer data)
}
/* Write it out to the addressbook */
- if (!e_book_client_modify_contact_sync (client, c, NULL, &error)) {
- g_warning ("bbdb: Could not modify contact: %s", error->message);
+ e_book_client_modify_contact_sync (
+ client, c, NULL, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "bbdb: Could not modify contact: %s",
+ error->message);
g_clear_error (&error);
}
@@ -287,15 +292,17 @@ bbdb_sync_buddy_list_in_thread (gpointer data)
continue;
}
- uid = NULL;
- if (!e_book_client_add_contact_sync (client, c, &uid, NULL, &error)) {
- g_warning ("bbdb: Failed to add new contact: %s", error->message);
+ e_book_client_add_contact_sync (client, c, NULL, NULL, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "bbdb: Failed to add new contact: %s",
+ error->message);
g_clear_error (&error);
goto exit;
}
g_object_unref (c);
- g_free (uid);
}
g_idle_add (store_last_sync_idle_cb, NULL);
diff --git a/plugins/face/face.c b/plugins/face/face.c
index 06a6bc675b..7ebfcf67a3 100644
--- a/plugins/face/face.c
+++ b/plugins/face/face.c
@@ -176,7 +176,7 @@ prepare_image (const gchar *image_filename,
if (can_claim)
e_alert_run_dialog_for_args (NULL, "org.gnome.evolution.plugins.face:not-an-image", err, NULL);
- if (error)
+ if (error != NULL)
g_error_free (error);
} else {
gint width, height;
diff --git a/plugins/mail-notification/mail-notification.c b/plugins/mail-notification/mail-notification.c
index 99abfdec20..f68cf35c41 100644
--- a/plugins/mail-notification/mail-notification.c
+++ b/plugins/mail-notification/mail-notification.c
@@ -163,7 +163,7 @@ send_dbus_message (const gchar *name,
/* Frees the message */
g_object_unref (message);
- if (error) {
+ if (error != NULL) {
g_warning ("%s: %s", G_STRFUNC, error->message);
g_error_free (error);
}
@@ -202,7 +202,7 @@ init_gdbus (void)
return TRUE;
connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
- if (error) {
+ if (error != NULL) {
g_warning ("could not get system bus: %s\n", error->message);
g_error_free (error);
diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c
index be27242544..28ce0b1d50 100644
--- a/plugins/mail-to-task/mail-to-task.c
+++ b/plugins/mail-to-task/mail-to-task.c
@@ -120,8 +120,7 @@ get_component_editor (EShell *shell,
editor = memo_editor_new (client, shell, flags);
break;
default:
- if (error)
- *error = e_client_error_create (E_CLIENT_ERROR_INVALID_ARG, NULL);
+ g_warn_if_reached ();
break;
}
@@ -382,7 +381,7 @@ attachment_save_finished (EAttachmentStore *store,
GError *error = NULL;
uris = e_attachment_store_save_finish (store, result, &error);
- if (error)
+ if (error != NULL)
data->uris = NULL;
else
data->uris = uris;
@@ -811,12 +810,16 @@ do_manage_comp_idle (struct _manage_comp *mc)
g_cond_signal (&mc->cond);
}
} else {
- /* User canceled editing already existing event, so treat it as if he just closed the editor window */
+ /* User canceled editing already existing event, so
+ * treat it as if he just closed the editor window. */
comp_editor_closed (NULL, FALSE, mc);
}
- if (error) {
- e_notice (NULL, GTK_MESSAGE_ERROR, _("An error occurred during processing: %s"), error->message);
+ if (error != NULL) {
+ e_notice (
+ NULL, GTK_MESSAGE_ERROR,
+ _("An error occurred during processing: %s"),
+ error->message);
g_clear_error (&error);
}
@@ -1008,8 +1011,10 @@ do_mail_to_event (AsyncData *data)
break;
}
- if (!e_cal_client_get_object_sync (E_CAL_CLIENT (client), icalcomponent_get_uid (icalcomp), NULL, &(mc->stored_comp), NULL, NULL))
- mc->stored_comp = NULL;
+ e_cal_client_get_object_sync (
+ E_CAL_CLIENT (client),
+ icalcomponent_get_uid (icalcomp),
+ NULL, &mc->stored_comp, NULL, NULL);
/* Prioritize ahead of GTK+ redraws. */
g_idle_add_full (
@@ -1193,9 +1198,11 @@ mail_to_event (ECalClientSourceType source_type,
} else if (!source && default_source) {
source = default_source;
} else if (!source) {
- e_notice (NULL, GTK_MESSAGE_ERROR, _("No writable calendar is available."));
+ e_notice (
+ NULL, GTK_MESSAGE_ERROR,
+ _("No writable calendar is available."));
- if (error)
+ if (error != NULL)
g_error_free (error);
goto exit;
}
diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c
index 25ce9217fb..f5d4d5ada8 100644
--- a/plugins/pst-import/pst-importer.c
+++ b/plugins/pst-import/pst-importer.c
@@ -614,16 +614,18 @@ pst_get_client_cb (GObject *source_object,
((client != NULL) && (error == NULL)) ||
((client == NULL) && (error != NULL)));
- if (error)
- g_debug ("%s: %s", G_STRFUNC, error->message);
- g_clear_error (&error);
-
- if (client) {
- if (E_IS_BOOK_CLIENT (client)) {
- m->addressbook = E_BOOK_CLIENT (client);
- } else if (E_IS_CAL_CLIENT (client)) {
- ECalClient *cal_client = E_CAL_CLIENT (client);
- switch (e_cal_client_get_source_type (cal_client)) {
+ if (error != NULL) {
+ g_warning ("%s: %s", G_STRFUNC, error->message);
+ g_error_free (error);
+ }
+
+ if (E_IS_BOOK_CLIENT (client))
+ m->addressbook = E_BOOK_CLIENT (client);
+
+ if (E_IS_CAL_CLIENT (client)) {
+ ECalClient *cal_client = E_CAL_CLIENT (client);
+
+ switch (e_cal_client_get_source_type (cal_client)) {
case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
m->calendar = cal_client;
break;
@@ -634,13 +636,8 @@ pst_get_client_cb (GObject *source_object,
m->journal = cal_client;
break;
default:
- g_object_unref (client);
g_warn_if_reached ();
break;
- }
- } else {
- g_object_unref (client);
- g_warn_if_reached ();
}
}
@@ -1518,7 +1515,6 @@ pst_process_contact (PstImporter *m,
pst_item_contact *c;
EContact *ec;
GString *notes;
- gchar *uid = NULL;
GError *error = NULL;
c = item->contact;
@@ -1659,11 +1655,10 @@ pst_process_contact (PstImporter *m,
contact_set_string (ec, E_CONTACT_NOTE, notes->str);
g_string_free (notes, TRUE);
- if (!e_book_client_add_contact_sync (m->addressbook, ec, &uid, NULL, &error))
- uid = NULL;
+ e_book_client_add_contact_sync (
+ m->addressbook, ec, NULL, NULL, &error);
g_object_unref (ec);
- g_free (uid);
if (error != NULL) {
g_warning (
@@ -2008,7 +2003,6 @@ pst_process_component (PstImporter *m,
ECalClient *cal)
{
ECalComponent *ec;
- gchar *uid = NULL;
GError *error = NULL;
g_return_if_fail (item->appointment != NULL);
@@ -2019,15 +2013,18 @@ pst_process_component (PstImporter *m,
fill_calcomponent (m, item, ec, comp_type);
set_cal_attachments (cal, ec, m, item->attach);
- if (!e_cal_client_create_object_sync (cal, e_cal_component_get_icalcomponent (ec), &uid, NULL, &error)) {
- uid = NULL;
- g_warning ("Creation of %s failed: %s", comp_type, error ? error->message : "Unknown error");
+ e_cal_client_create_object_sync (
+ cal, e_cal_component_get_icalcomponent (ec),
+ NULL, NULL, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "Creation of %s failed: %s",
+ comp_type, error->message);
+ g_error_free (error);
}
g_object_unref (ec);
- g_free (uid);
- if (error)
- g_error_free (error);
}
static void
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 {
diff --git a/plugins/publish-calendar/publish-format-fb.c b/plugins/publish-calendar/publish-format-fb.c
index 28393040da..e343445ece 100644
--- a/plugins/publish-calendar/publish-format-fb.c
+++ b/plugins/publish-calendar/publish-format-fb.c
@@ -66,7 +66,7 @@ write_calendar (const gchar *uid,
icalcomponent *top_level;
gchar *email = NULL;
GSList *users = NULL;
- gboolean res = FALSE;
+ gboolean success = FALSE;
utc = icaltimezone_get_utc_timezone ();
start = time_day_begin_with_zone (start, utc);
@@ -114,7 +114,9 @@ write_calendar (const gchar *uid,
client, "free-busy-data",
G_CALLBACK (free_busy_data_cb), &objects);
- if (e_cal_client_get_free_busy_sync (E_CAL_CLIENT (client), start, end, users, NULL, error)) {
+ success = e_cal_client_get_free_busy_sync (
+ E_CAL_CLIENT (client), start, end, users, NULL, error);
+ if (success) {
gchar *ical_string;
GSList *iter;
gboolean done = FALSE;
@@ -135,7 +137,11 @@ write_calendar (const gchar *uid,
}
ical_string = icalcomponent_as_ical_string_r (top_level);
- res = g_output_stream_write_all (stream, ical_string, strlen (ical_string), NULL, NULL, error);
+
+ success = g_output_stream_write_all (
+ stream, ical_string,
+ strlen (ical_string),
+ NULL, NULL, error);
e_cal_client_free_ecalcomp_slist (objects);
g_free (ical_string);
@@ -148,7 +154,7 @@ write_calendar (const gchar *uid,
g_object_unref (client);
icalcomponent_free (top_level);
- return res;
+ return success;
}
void
diff --git a/plugins/publish-calendar/publish-format-ical.c b/plugins/publish-calendar/publish-format-ical.c
index 95e5dd8aef..c875904495 100644
--- a/plugins/publish-calendar/publish-format-ical.c
+++ b/plugins/publish-calendar/publish-format-ical.c
@@ -51,8 +51,13 @@ insert_tz_comps (icalparameter *param,
if (g_hash_table_lookup (tdata->zones, tzid))
return;
- if (!e_cal_client_get_timezone_sync (tdata->client, tzid, &zone, NULL, &error)) {
- g_warning ("Could not get the timezone information for %s : %s \n", tzid, error->message);
+ e_cal_client_get_timezone_sync (
+ tdata->client, tzid, &zone, NULL, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "Could not get the timezone information for %s: %s",
+ tzid, error->message);
g_error_free (error);
return;
}
@@ -78,7 +83,7 @@ write_calendar (const gchar *uid,
ESource *source;
ESourceRegistry *registry;
EClient *client = NULL;
- GSList *objects;
+ GSList *objects = NULL;
icalcomponent *top_level;
gboolean res = FALSE;
@@ -103,7 +108,10 @@ write_calendar (const gchar *uid,
top_level = e_cal_util_new_top_level ();
- if (e_cal_client_get_object_list_sync (E_CAL_CLIENT (client), "#t", &objects, NULL, error)) {
+ e_cal_client_get_object_list_sync (
+ E_CAL_CLIENT (client), "#t", &objects, NULL, error);
+
+ if (objects != NULL) {
GSList *iter;
gchar *ical_string;
CompTzData tdata;
diff --git a/plugins/save-calendar/csv-format.c b/plugins/save-calendar/csv-format.c
index 1e1bf4a7e1..4374d98143 100644
--- a/plugins/save-calendar/csv-format.c
+++ b/plugins/save-calendar/csv-format.c
@@ -548,14 +548,12 @@ do_save_calendar_csv (FormatHandler *handler,
g_free (config->newline);
g_free (config);
- if (error) {
+ if (error != NULL) {
display_error_message (
gtk_widget_get_toplevel (GTK_WIDGET (selector)),
error);
g_error_free (error);
}
-
- return;
}
static GtkWidget *
diff --git a/plugins/save-calendar/ical-format.c b/plugins/save-calendar/ical-format.c
index a007811708..10f71f1507 100644
--- a/plugins/save-calendar/ical-format.c
+++ b/plugins/save-calendar/ical-format.c
@@ -36,7 +36,10 @@ display_error_message (GtkWidget *parent,
{
GtkWidget *dialog;
- dialog = gtk_message_dialog_new (GTK_WINDOW (parent), 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", message);
+ dialog = gtk_message_dialog_new (
+ GTK_WINDOW (parent), 0,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ "%s", message);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
@@ -61,8 +64,13 @@ insert_tz_comps (icalparameter *param,
if (g_hash_table_lookup (tdata->zones, tzid))
return;
- if (!e_cal_client_get_timezone_sync (tdata->client, tzid, &zone, NULL, &error)) {
- g_warning ("Could not get the timezone information for %s : %s \n", tzid, error->message);
+ e_cal_client_get_timezone_sync (
+ tdata->client, tzid, &zone, NULL, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "Could not get the timezone information for %s: %s",
+ tzid, error->message);
g_error_free (error);
return;
}
@@ -105,7 +113,7 @@ do_save_calendar_ical (FormatHandler *handler,
((source_client != NULL) && (error == NULL)) ||
((source_client == NULL) && (error != NULL)));
- if (source_client == NULL) {
+ if (error != NULL) {
display_error_message (
gtk_widget_get_toplevel (GTK_WIDGET (selector)),
error->message);
@@ -116,8 +124,10 @@ do_save_calendar_ical (FormatHandler *handler,
/* create destination file */
top_level = e_cal_util_new_top_level ();
- error = NULL;
- if (e_cal_client_get_object_list_sync (E_CAL_CLIENT (source_client), "#t", &objects, NULL, &error)) {
+ e_cal_client_get_object_list_sync (
+ E_CAL_CLIENT (source_client), "#t", &objects, NULL, &error);
+
+ if (objects != NULL) {
CompTzData tdata;
GOutputStream *stream;
GSList *iter;
@@ -153,8 +163,10 @@ do_save_calendar_ical (FormatHandler *handler,
e_cal_client_free_icalcomp_slist (objects);
}
- if (error) {
- display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), error->message);
+ if (error != NULL) {
+ display_error_message (
+ gtk_widget_get_toplevel (GTK_WIDGET (selector)),
+ error->message);
g_error_free (error);
}
@@ -163,7 +175,8 @@ do_save_calendar_ical (FormatHandler *handler,
icalcomponent_free (top_level);
}
-FormatHandler *ical_format_handler_new (void)
+FormatHandler *
+ical_format_handler_new (void)
{
FormatHandler *handler = g_new (FormatHandler, 1);
diff --git a/plugins/save-calendar/rdf-format.c b/plugins/save-calendar/rdf-format.c
index 391f60cfa7..c261083986 100644
--- a/plugins/save-calendar/rdf-format.c
+++ b/plugins/save-calendar/rdf-format.c
@@ -368,17 +368,16 @@ do_save_calendar_rdf (FormatHandler *handler,
g_object_unref (source_client);
- if (error) {
+ if (error != NULL) {
display_error_message (
gtk_widget_get_toplevel (GTK_WIDGET (selector)),
error->message);
g_error_free (error);
}
-
- return;
}
-FormatHandler *rdf_format_handler_new (void)
+FormatHandler *
+rdf_format_handler_new (void)
{
FormatHandler *handler = g_new (FormatHandler, 1);