aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-memo-list-selector.c
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 /calendar/gui/e-memo-list-selector.c
parentbf4a1a13e3295deefc4031a446627ff9b1c95c7a (diff)
downloadgsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.gz
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.zst
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.zip
Coding style and whitespace cleanup.
Diffstat (limited to 'calendar/gui/e-memo-list-selector.c')
-rw-r--r--calendar/gui/e-memo-list-selector.c104
1 files changed, 62 insertions, 42 deletions
diff --git a/calendar/gui/e-memo-list-selector.c b/calendar/gui/e-memo-list-selector.c
index cbcd0025e1..5fff33d188 100644
--- a/calendar/gui/e-memo-list-selector.c
+++ b/calendar/gui/e-memo-list-selector.c
@@ -48,7 +48,8 @@ memo_list_selector_update_single_object (ECalClient *client,
if (e_cal_client_get_object_sync (client, uid, NULL, &tmp_icalcomp, NULL, NULL)) {
icalcomponent_free (tmp_icalcomp);
- return e_cal_client_modify_object_sync (client, icalcomp, CALOBJ_MOD_ALL, NULL, NULL);
+ return e_cal_client_modify_object_sync (
+ client, icalcomp, CALOBJ_MOD_ALL, NULL, NULL);
}
if (!e_cal_client_create_object_sync (client, icalcomp, &uid, NULL, NULL))
@@ -89,12 +90,13 @@ memo_list_selector_update_objects (ECalClient *client,
zone = icaltimezone_new ();
icaltimezone_set_component (zone, subcomp);
- success = e_cal_client_add_timezone_sync (client, zone, NULL, &error);
+ e_cal_client_add_timezone_sync (client, zone, NULL, &error);
icaltimezone_free (zone, 1);
- if (!success) {
- g_debug ("%s: Failed to add timezone: %s", G_STRFUNC, error ? error->message : "Unknown error");
- if (error)
- g_error_free (error);
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to add timezone: %s",
+ G_STRFUNC, error->message);
+ g_error_free (error);
return FALSE;
}
} else if (kind == ICAL_VJOURNAL_COMPONENT) {
@@ -112,29 +114,38 @@ memo_list_selector_update_objects (ECalClient *client,
}
static void
-client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+client_opened_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
- gchar *uid = user_data;
+ ESource *source = E_SOURCE (source_object);
EClient *client = NULL;
+ gchar *uid = user_data;
GError *error = NULL;
g_return_if_fail (uid != 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 (error) {
- g_debug ("%s: Failed to open memo list: %s", G_STRFUNC, error->message);
+ if (error != NULL) {
+ g_warn_if_fail (client == NULL);
+ g_warning (
+ "%s: Failed to open memo list: %s",
+ G_STRFUNC, error->message);
g_error_free (error);
+ goto exit;
}
- if (client) {
- if (!e_client_is_readonly (client))
- e_cal_client_remove_object_sync (E_CAL_CLIENT (client), uid, NULL, CALOBJ_MOD_THIS, NULL, NULL);
+ g_return_if_fail (E_IS_CLIENT (client));
- g_object_unref (client);
- }
+ if (!e_client_is_readonly (client))
+ e_cal_client_remove_object_sync (
+ E_CAL_CLIENT (client), uid, NULL,
+ CALOBJ_MOD_THIS, NULL, NULL);
+ g_object_unref (client);
+
+exit:
g_free (uid);
}
@@ -210,50 +221,59 @@ struct DropData
};
static void
-client_opened_for_drop_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+client_opened_for_drop_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
+ ESource *source = E_SOURCE (source_object);
struct DropData *dd = user_data;
EClient *client = NULL;
+ ECalClient *cal_client;
+ GSList *iter;
GError *error = NULL;
g_return_if_fail (dd != 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 (error) {
- g_debug ("%s: Failed to open memo list: %s", G_STRFUNC, error->message);
+ if (error != NULL) {
+ g_warn_if_fail (client == NULL);
+ g_warning (
+ "%s: Failed to open memo list: %s",
+ G_STRFUNC, error->message);
g_error_free (error);
+ goto exit;
}
- if (client) {
- ECalClient *cal_client = E_CAL_CLIENT (client);
- GSList *iter;
+ g_return_if_fail (E_IS_CLIENT (client));
- for (iter = dd->list; iter != NULL; iter = iter->next) {
- gchar *source_uid = iter->data;
- icalcomponent *icalcomp;
- gchar *component_string;
+ cal_client = E_CAL_CLIENT (client);
- /* Each string is "source_uid\ncomponent_string". */
- component_string = strchr (source_uid, '\n');
- if (component_string == NULL)
- continue;
+ for (iter = dd->list; iter != NULL; iter = iter->next) {
+ gchar *source_uid = iter->data;
+ icalcomponent *icalcomp;
+ gchar *component_string;
- *component_string++ = '\0';
- icalcomp = icalparser_parse_string (component_string);
- if (icalcomp == NULL)
- continue;
+ /* Each string is "source_uid\ncomponent_string". */
+ component_string = strchr (source_uid, '\n');
+ if (component_string == NULL)
+ continue;
- memo_list_selector_process_data (
- dd->selector, cal_client, source_uid, icalcomp, dd->action);
+ *component_string++ = '\0';
+ icalcomp = icalparser_parse_string (component_string);
+ if (icalcomp == NULL)
+ continue;
- icalcomponent_free (icalcomp);
- }
+ memo_list_selector_process_data (
+ dd->selector, cal_client, source_uid,
+ icalcomp, dd->action);
- g_object_unref (client);
+ icalcomponent_free (icalcomp);
}
+ g_object_unref (client);
+
+exit:
g_slist_foreach (dd->list, (GFunc) g_free, NULL);
g_slist_free (dd->list);
g_object_unref (dd->selector);