aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-07-01 12:07:26 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-08-13 23:27:51 +0800
commitf59681796df8fe0138a1754abbe8ec781bc1535e (patch)
tree0ced0c119ffed095713d7f64732686df9b2d9152 /plugins
parentbf4a1a13e3295deefc4031a446627ff9b1c95c7a (diff)
downloadgsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.gz
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.bz2
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.lz
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.xz
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.zst
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.zip
Coding style and whitespace cleanup.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/bbdb/gaimbuddies.c28
-rw-r--r--plugins/caldav/caldav-source.c5
-rw-r--r--plugins/google-account-setup/google-source.c12
-rw-r--r--plugins/itip-formatter/itip-formatter.c119
-rw-r--r--plugins/pst-import/pst-importer.c8
-rw-r--r--plugins/publish-calendar/publish-location.c4
-rw-r--r--plugins/save-calendar/csv-format.c4
-rw-r--r--plugins/vcard-inline/vcard-inline.c20
8 files changed, 124 insertions, 76 deletions
diff --git a/plugins/bbdb/gaimbuddies.c b/plugins/bbdb/gaimbuddies.c
index 1becdee0ac..7e42066638 100644
--- a/plugins/bbdb/gaimbuddies.c
+++ b/plugins/bbdb/gaimbuddies.c
@@ -61,18 +61,24 @@ typedef struct {
} GaimBuddy;
/* Forward declarations for this file. */
-static gboolean bbdb_merge_buddy_to_contact (EBookClient *client, GaimBuddy *b, EContact *c);
-static GList *bbdb_get_gaim_buddy_list (void);
-static gchar *get_node_text (xmlNodePtr node);
-static gchar *get_buddy_icon_from_setting (xmlNodePtr setting);
-static void free_buddy_list (GList *blist);
-static void parse_buddy_group (xmlNodePtr group, GList **buddies, GSList *blocked);
-static EContactField proto_to_contact_field (const gchar *proto);
+static gboolean bbdb_merge_buddy_to_contact (EBookClient *client,
+ GaimBuddy *buddy,
+ EContact *contact);
+static GList * bbdb_get_gaim_buddy_list (void);
+static gchar * get_node_text (xmlNodePtr node);
+static gchar * get_buddy_icon_from_setting (xmlNodePtr setting);
+static void free_buddy_list (GList *blist);
+static void parse_buddy_group (xmlNodePtr group,
+ GList **buddies,
+ GSList *blocked);
+static EContactField
+ proto_to_contact_field (const gchar *proto);
static gchar *
get_buddy_filename (void)
{
- return g_build_path ("/", g_get_home_dir (), ".purple/blist.xml", NULL);
+ return g_build_filename (
+ g_get_home_dir (), ".purple", "blist.xml", NULL);
}
static gchar *
@@ -229,10 +235,12 @@ bbdb_sync_buddy_list_in_thread (gpointer data)
}
/* Look for an exact match full name == buddy alias */
- query = e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_IS, b->alias);
+ query = e_book_query_field_test (
+ E_CONTACT_FULL_NAME, E_BOOK_QUERY_IS, b->alias);
query_string = e_book_query_to_string (query);
e_book_query_unref (query);
- if (!e_book_client_get_contacts_sync (std->client, query_string, &contacts, NULL, NULL)) {
+ if (!e_book_client_get_contacts_sync (
+ std->client, query_string, &contacts, NULL, NULL)) {
g_free (query_string);
continue;
}
diff --git a/plugins/caldav/caldav-source.c b/plugins/caldav/caldav-source.c
index dea4ddf5a6..c9c44fb470 100644
--- a/plugins/caldav/caldav-source.c
+++ b/plugins/caldav/caldav-source.c
@@ -59,9 +59,8 @@ ensure_caldav_source_group (ECalClientSourceType source_type)
GError *error = NULL;
if (!e_cal_client_get_sources (&slist, source_type, &error)) {
- g_warning ("Could not get calendar sources: %s", error ? error->message : "Unknown error");
- if (error)
- g_error_free (error);
+ g_warning ("Could not get calendar sources: %s", error->message);
+ g_error_free (error);
return;
}
diff --git a/plugins/google-account-setup/google-source.c b/plugins/google-account-setup/google-source.c
index 5643c4f0ba..5b12759f08 100644
--- a/plugins/google-account-setup/google-source.c
+++ b/plugins/google-account-setup/google-source.c
@@ -73,10 +73,14 @@ ensure_google_source_group (void)
ESourceList *slist;
GError *error = NULL;
- if (!e_cal_client_get_sources (&slist, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, &error)) {
- g_debug ("%s: Could not get calendar source list: %s", G_STRFUNC, error ? error->message : "Unknown error");
- if (error)
- g_error_free (error);
+ e_cal_client_get_sources (
+ &slist, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Could not get calendar source list: %s",
+ G_STRFUNC, error->message);
+ g_error_free (error);
return;
}
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index 3b10c38933..37fcb21fd5 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -495,56 +495,66 @@ add_failed_to_load_msg (ItipView *view, ESource *source, const GError *error)
}
static void
-cal_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+cal_opened_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
+ ESource *source = E_SOURCE (source_object);
struct _itip_puri *pitip = user_data;
- ESource *source;
ECalClientSourceType source_type;
EClient *client = NULL;
ECalClient *cal_client;
+ const gchar *uid;
GError *error = NULL;
- source = E_SOURCE (source_object);
-
- if (!e_client_utils_open_new_finish (source, result, &client, &error)) {
- client = NULL;
- 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);
- return;
- }
- }
+ e_client_utils_open_new_finish (source, result, &client, &error);
- if (error) {
- d(printf ("Failed opening itip formatter calendar '%s' during non-search opening\n", e_source_peek_name (source)));
-
- add_failed_to_load_msg (ITIP_VIEW (pitip->view), source, 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);
+ return;
+ } else if (error != NULL) {
+ g_warn_if_fail (client == NULL);
+ add_failed_to_load_msg (
+ ITIP_VIEW (pitip->view), source, error);
g_error_free (error);
return;
}
+ g_return_if_fail (E_IS_CAL_CLIENT (client));
+
cal_client = E_CAL_CLIENT (client);
g_return_if_fail (cal_client != NULL);
+ uid = e_source_peek_uid (source);
source_type = e_cal_client_get_source_type (cal_client);
- g_hash_table_insert (pitip->clients[source_type], g_strdup (e_source_peek_uid (source)), cal_client);
+ g_hash_table_insert (
+ pitip->clients[source_type], g_strdup (uid), cal_client);
if (e_cal_client_check_recurrences_no_master (cal_client)) {
- icalcomponent *icalcomp = e_cal_component_get_icalcomponent (pitip->comp);
+ icalcomponent *icalcomp;
+ gboolean show_recur_check;
- if (check_is_instance (icalcomp))
- itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), TRUE);
- else
- itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), FALSE);
+ icalcomp = e_cal_component_get_icalcomponent (pitip->comp);
+
+ show_recur_check = check_is_instance (icalcomp);
+ itip_view_set_show_recur_check (
+ ITIP_VIEW (pitip->view), show_recur_check);
}
if (pitip->type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS) {
- if (e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING))
- itip_view_set_needs_decline (ITIP_VIEW (pitip->view), TRUE);
- else
- itip_view_set_needs_decline (ITIP_VIEW (pitip->view), FALSE);
- itip_view_set_mode (ITIP_VIEW (pitip->view), ITIP_VIEW_MODE_PUBLISH);
+ gboolean needs_decline;
+
+ needs_decline = e_client_check_capability (
+ E_CLIENT (client),
+ CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING);
+ itip_view_set_needs_decline (
+ ITIP_VIEW (pitip->view), needs_decline);
+ itip_view_set_mode (
+ ITIP_VIEW (pitip->view), ITIP_VIEW_MODE_PUBLISH);
}
pitip->current_client = cal_client;
@@ -553,7 +563,11 @@ cal_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
}
static void
-start_calendar_server (struct _itip_puri *pitip, ESource *source, ECalClientSourceType type, GAsyncReadyCallback func, gpointer data)
+start_calendar_server (struct _itip_puri *pitip,
+ ESource *source,
+ ECalClientSourceType type,
+ GAsyncReadyCallback func,
+ gpointer data)
{
ECalClient *client;
@@ -792,7 +806,9 @@ decrease_find_data (FormatItipFindData *fd)
}
static void
-get_object_without_rid_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+get_object_without_rid_ready_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
ECalClient *cal_client = E_CAL_CLIENT (source_object);
FormatItipFindData *fd = user_data;
@@ -833,7 +849,9 @@ get_object_without_rid_ready_cb (GObject *source_object, GAsyncResult *result, g
}
static void
-get_object_with_rid_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+get_object_with_rid_ready_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
ECalClient *cal_client = E_CAL_CLIENT (source_object);
FormatItipFindData *fd = user_data;
@@ -879,7 +897,9 @@ get_object_with_rid_ready_cb (GObject *source_object, GAsyncResult *result, gpoi
}
static void
-get_object_list_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+get_object_list_ready_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
ECalClient *cal_client = E_CAL_CLIENT (source_object);
FormatItipFindData *fd = user_data;
@@ -913,25 +933,28 @@ get_object_list_ready_cb (GObject *source_object, GAsyncResult *result, gpointer
}
static void
-find_cal_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+find_cal_opened_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
+ ESource *source = E_SOURCE (source_object);
FormatItipFindData *fd = user_data;
struct _itip_puri *pitip = fd->puri;
- ESource *source;
ECalClientSourceType source_type;
EClient *client = NULL;
ECalClient *cal_client;
+ const gchar *uid;
GError *error = NULL;
- source = E_SOURCE (source_object);
+ e_client_utils_open_new_finish (source, result, &client, &error);
- if (!e_client_utils_open_new_finish (source, result, &client, &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_error_free (error);
- decrease_find_data (fd);
- return;
- }
+ /* 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);
+ decrease_find_data (fd);
+ g_error_free (error);
+ return;
}
if (g_cancellable_is_cancelled (fd->cancellable)) {
@@ -944,18 +967,22 @@ find_cal_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_
/* FIXME Do we really want to warn here? If we fail
* to find the item, this won't be cleared but the
* selector might be shown */
- d(printf ("Failed opening itip formatter calendar '%s' during search opening... ", e_source_peek_name (source)));
- add_failed_to_load_msg (ITIP_VIEW (pitip->view), source, error);
-
- g_error_free (error);
+ g_warn_if_fail (client == NULL);
+ add_failed_to_load_msg (
+ ITIP_VIEW (pitip->view), source, error);
decrease_find_data (fd);
+ g_error_free (error);
return;
}
+ g_return_if_fail (E_IS_CAL_CLIENT (client));
+
cal_client = E_CAL_CLIENT (client);
source_type = e_cal_client_get_source_type (cal_client);
- g_hash_table_insert (pitip->clients[source_type], g_strdup (e_source_peek_uid (source)), cal_client);
+ uid = e_source_peek_uid (source);
+ g_hash_table_insert (
+ pitip->clients[source_type], g_strdup (uid), cal_client);
/* Check for conflicts */
/* If the query fails, we'll just ignore it */
diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c
index 0bb1aaf6ad..3f14ce0f9b 100644
--- a/plugins/pst-import/pst-importer.c
+++ b/plugins/pst-import/pst-importer.c
@@ -682,7 +682,7 @@ pst_import_folders (PstImporter *m, pst_desc_tree *topitem)
if (topitem)
g_hash_table_insert (node_to_folderuri, topitem, g_strdup (m->folder_uri));
-
+
/* Walk through folder tree */
while (d_ptr != NULL && (camel_operation_cancel_check (co) == FALSE)) {
gchar *previous_folder = NULL;
@@ -1444,8 +1444,10 @@ pst_process_contact (PstImporter *m, pst_item *item)
g_object_unref (ec);
g_free (uid);
- if (error) {
- g_debug ("%s: Failed to add contact: %s", G_STRFUNC, error->message);
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to add contact: %s",
+ G_STRFUNC, error->message);
g_error_free (error);
}
}
diff --git a/plugins/publish-calendar/publish-location.c b/plugins/publish-calendar/publish-location.c
index 9089561ccf..f864d8a9ae 100644
--- a/plugins/publish-calendar/publish-location.c
+++ b/plugins/publish-calendar/publish-location.c
@@ -88,9 +88,9 @@ migrateURI (const gchar *xml, xmlDocPtr doc)
uri->publish_frequency = atoi ((gchar *) frequency);
uri->publish_format = URI_PUBLISH_AS_FB;
- password = e_passwords_get_password (NULL, (gchar *)location);
+ password = e_passwords_get_password (NULL, (gchar *) location);
if (password) {
- e_passwords_forget_password (NULL, (gchar *)location);
+ e_passwords_forget_password (NULL, (gchar *) location);
e_passwords_add_password (uri->location, password);
e_passwords_remember_password (NULL, uri->location);
}
diff --git a/plugins/save-calendar/csv-format.c b/plugins/save-calendar/csv-format.c
index cbbfa6691c..b4e95bbef7 100644
--- a/plugins/save-calendar/csv-format.c
+++ b/plugins/save-calendar/csv-format.c
@@ -331,7 +331,9 @@ do_save_calendar_csv (FormatHandler *handler,
/* open source client */
source_client = e_cal_client_new (primary_source, type, &error);
if (source_client)
- g_signal_connect (source_client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+ g_signal_connect (
+ source_client, "authenticate",
+ G_CALLBACK (e_client_utils_authenticate_handler), NULL);
if (!source_client || !e_client_open_sync (E_CLIENT (source_client), TRUE, NULL, &error)) {
display_error_message (
diff --git a/plugins/vcard-inline/vcard-inline.c b/plugins/vcard-inline/vcard-inline.c
index 78818f328b..24e551afe9 100644
--- a/plugins/vcard-inline/vcard-inline.c
+++ b/plugins/vcard-inline/vcard-inline.c
@@ -118,23 +118,29 @@ org_gnome_vcard_inline_decode (VCardInlinePObject *vcard_object,
}
static void
-org_gnome_vcard_inline_client_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+org_gnome_vcard_inline_client_loaded_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
+ ESource *source = E_SOURCE (source_object);
EClient *client = NULL;
EBookClient *book_client;
GSList *contact_list = user_data, *iter;
GError *error = NULL;
- 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 == NULL) {
- g_debug ("%s: Failed to open book client: %s", G_STRFUNC, error ? error->message : "Unknown error");
- if (error)
- g_error_free (error);
+ if (error != NULL) {
+ g_warn_if_fail (client == NULL);
+ g_warning (
+ "%s: Failed to open book client: %s",
+ G_STRFUNC, error->message);
+ g_error_free (error);
goto exit;
}
+ g_return_if_fail (E_IS_BOOK_CLIENT (client));
+
book_client = E_BOOK_CLIENT (client);
for (iter = contact_list; iter != NULL; iter = iter->next) {