diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-07-01 12:07:26 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-09-14 20:08:48 +0800 |
commit | ae9db3ed236b0c734fd12c8dc8c99764626bf0b8 (patch) | |
tree | bd45389467f43a96c36172d8a925dd5df041cf5b /calendar | |
parent | db969c7f664d0a1d901bedd794b0c7e0762ede33 (diff) | |
download | gsoc2013-evolution-ae9db3ed236b0c734fd12c8dc8c99764626bf0b8.tar gsoc2013-evolution-ae9db3ed236b0c734fd12c8dc8c99764626bf0b8.tar.gz gsoc2013-evolution-ae9db3ed236b0c734fd12c8dc8c99764626bf0b8.tar.bz2 gsoc2013-evolution-ae9db3ed236b0c734fd12c8dc8c99764626bf0b8.tar.lz gsoc2013-evolution-ae9db3ed236b0c734fd12c8dc8c99764626bf0b8.tar.xz gsoc2013-evolution-ae9db3ed236b0c734fd12c8dc8c99764626bf0b8.tar.zst gsoc2013-evolution-ae9db3ed236b0c734fd12c8dc8c99764626bf0b8.zip |
Coding style and whitespace cleanup.
Diffstat (limited to 'calendar')
22 files changed, 748 insertions, 410 deletions
diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index 0de79effed..9a4a76aa46 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -126,7 +126,8 @@ alarm_notify_list_changed_cb (ESourceList *source_list, gchar *uri; const gchar *alarm = e_source_get_property (source, "alarm"); - if (alarm && (!g_ascii_strcasecmp (alarm, "false") || !g_ascii_strcasecmp (alarm, "never"))) + if (alarm && (!g_ascii_strcasecmp (alarm, "false") || + !g_ascii_strcasecmp (alarm, "never"))) continue; uri = e_source_get_uri (source); @@ -142,7 +143,9 @@ alarm_notify_list_changed_cb (ESourceList *source_list, prd.an = an; prd.source_list = an->priv->source_lists[source_type]; prd.removals = NULL; - g_hash_table_foreach (an->priv->uri_client_hash[source_type], (GHFunc) process_removal_in_hash, &prd); + g_hash_table_foreach ( + an->priv->uri_client_hash[source_type], + (GHFunc) process_removal_in_hash, &prd); for (l = prd.removals; l; l = l->next) { debug (("Removing Calendar %s", (gchar *)l->data)); @@ -313,31 +316,35 @@ alarm_notify_new (void) } static void -client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +client_opened_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { - AlarmNotifyPrivate *priv; + ESource *source = E_SOURCE (source_object); AlarmNotify *an = ALARM_NOTIFY (user_data); EClient *client = NULL; - GError *error = NULL; + ECalClient *cal_client; + ECalClientSourceType source_type; + const gchar *uri; - 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, NULL); - priv = an->priv; + if (client == NULL) + return; - debug (("%s - Calendar Status %d%s%s%s", e_client_get_uri (client), error ? error->code : 0, error ? " (" : "", error ? error->message : "", error ? ")" : "")); + cal_client = E_CAL_CLIENT (client); + source_type = e_cal_client_get_source_type (cal_client); + uri = e_client_get_uri (client); - if (!error) { - ECalClient *cal_client = E_CAL_CLIENT (client); + g_hash_table_insert ( + an->priv->uri_client_hash[source_type], + g_strdup (uri), cal_client); - g_hash_table_insert (priv->uri_client_hash[e_cal_client_get_source_type (cal_client)], g_strdup (e_client_get_uri (client)), cal_client); - /* to resolve floating DATE-TIME properly */ - e_cal_client_set_default_timezone (cal_client, config_data_get_timezone ()); + /* to resolve floating DATE-TIME properly */ + e_cal_client_set_default_timezone ( + cal_client, config_data_get_timezone ()); - alarm_queue_add_client (cal_client); - } else { - g_error_free (error); - } + alarm_queue_add_client (cal_client); } /** @@ -352,16 +359,21 @@ client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_da * that it can be loaded in the future when the alarm daemon starts up. **/ void -alarm_notify_add_calendar (AlarmNotify *an, ECalClientSourceType source_type, ESource *source, gboolean load_afterwards) +alarm_notify_add_calendar (AlarmNotify *an, + ECalClientSourceType source_type, + ESource *source, + gboolean load_afterwards) { AlarmNotifyPrivate *priv; + EClientSourceType client_source_type; EUri *e_uri; gchar *str_uri; gchar *pass_key; g_return_if_fail (an != NULL); g_return_if_fail (IS_ALARM_NOTIFY (an)); - /* Make sure the key used in for getting password is properly generated for all types of backends */ + /* Make sure the key used in for getting password is + * properly generated for all types of backends. */ priv = an->priv; str_uri = e_source_get_uri (source); e_uri = e_uri_new (str_uri); @@ -379,8 +391,11 @@ alarm_notify_add_calendar (AlarmNotify *an, ECalClientSourceType source_type, E g_free (pass_key); return; } - /* if loading of this requires password and password is not currently availble in e-password - session skip this source loading. we do not really want to prompt for auth from alarm dameon*/ + + /* If loading of this requires password and password is not + * currently availble in e-password session, skip this source + * loading. We do not really want to prompt for auth from + * the alarm dameon. */ if (e_source_get_property (source, "auth")) { @@ -395,12 +410,23 @@ alarm_notify_add_calendar (AlarmNotify *an, ECalClientSourceType source_type, E debug (("%s - Calendar Open Async... %p", str_uri, source)); - e_client_utils_open_new (source, - source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS ? E_CLIENT_SOURCE_TYPE_EVENTS : - source_type == E_CAL_CLIENT_SOURCE_TYPE_TASKS ? E_CLIENT_SOURCE_TYPE_TASKS : - source_type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS ? E_CLIENT_SOURCE_TYPE_MEMOS : - E_CLIENT_SOURCE_TYPE_LAST, - TRUE, NULL, + switch (source_type) { + case E_CAL_CLIENT_SOURCE_TYPE_EVENTS: + client_source_type = E_CLIENT_SOURCE_TYPE_EVENTS; + break; + case E_CAL_CLIENT_SOURCE_TYPE_TASKS: + client_source_type = E_CLIENT_SOURCE_TYPE_TASKS; + break; + case E_CAL_CLIENT_SOURCE_TYPE_MEMOS: + client_source_type = E_CLIENT_SOURCE_TYPE_MEMOS; + break; + default: + g_warn_if_reached (); + client_source_type = E_CLIENT_SOURCE_TYPE_LAST; + } + + e_client_utils_open_new ( + source, client_source_type, TRUE, NULL, e_client_utils_authenticate_handler, NULL, client_opened_cb, an); @@ -410,14 +436,17 @@ alarm_notify_add_calendar (AlarmNotify *an, ECalClientSourceType source_type, E } void -alarm_notify_remove_calendar (AlarmNotify *an, ECalClientSourceType source_type, const gchar *str_uri) +alarm_notify_remove_calendar (AlarmNotify *an, + ECalClientSourceType source_type, + const gchar *str_uri) { AlarmNotifyPrivate *priv; ECalClient *cal_client; priv = an->priv; - cal_client = g_hash_table_lookup (priv->uri_client_hash[source_type], str_uri); + cal_client = g_hash_table_lookup ( + priv->uri_client_hash[source_type], str_uri); if (cal_client) { debug (("Removing Client %p", cal_client)); alarm_queue_remove_client (cal_client, FALSE); diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index 7ba2ff9005..c143429f8f 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -150,15 +150,21 @@ static void query_objects_removed_cb (ECalClientView *view, const GSList *uids, gpointer data); -static void update_cqa (CompQueuedAlarms *cqa, ECalComponent *comp); -static void update_qa (ECalComponentAlarms *alarms, QueuedAlarm *qa); -static void tray_list_remove_cqa (CompQueuedAlarms *cqa); -static void on_dialog_objs_removed_cb (ECalClientView *view, const GSList *uids, gpointer data); +static void update_cqa (CompQueuedAlarms *cqa, + ECalComponent *comp); +static void update_qa (ECalComponentAlarms *alarms, + QueuedAlarm *qa); +static void tray_list_remove_cqa (CompQueuedAlarms *cqa); +static void on_dialog_objs_removed_cb (ECalClientView *view, + const GSList *uids, + gpointer data); /* Alarm queue engine */ -static void load_alarms_for_today (ClientAlarms *ca); -static void midnight_refresh_cb (gpointer alarm_id, time_t trigger, gpointer data); +static void load_alarms_for_today (ClientAlarms *ca); +static void midnight_refresh_cb (gpointer alarm_id, + time_t trigger, + gpointer data); /* Simple asynchronous message dispatcher */ @@ -224,9 +230,8 @@ e_ctime (const time_t *timep) return ret; } -/* Queues an alarm trigger for midnight so that we can load the next day's worth - * of alarms. - */ +/* Queues an alarm trigger for midnight so that we can load the next + * day's worth of alarms. */ static void queue_midnight_refresh (void) { @@ -242,7 +247,8 @@ queue_midnight_refresh (void) debug (("Refresh at %s", e_ctime (&midnight))); - midnight_refresh_id = alarm_add (midnight, midnight_refresh_cb, NULL, NULL); + midnight_refresh_id = alarm_add ( + midnight, midnight_refresh_cb, NULL, NULL); if (!midnight_refresh_id) { debug (("Could not setup the midnight refresh alarm")); /* FIXME: what to do? */ @@ -251,7 +257,9 @@ queue_midnight_refresh (void) /* Loads a client's alarms; called from g_hash_table_foreach() */ static void -add_client_alarms_cb (gpointer key, gpointer value, gpointer data) +add_client_alarms_cb (gpointer key, + gpointer value, + gpointer data) { ClientAlarms *ca = (ClientAlarms *) value; @@ -287,7 +295,9 @@ midnight_refresh_async (struct _midnight_refresh_msg *msg) } static void -midnight_refresh_cb (gpointer alarm_id, time_t trigger, gpointer data) +midnight_refresh_cb (gpointer alarm_id, + time_t trigger, + gpointer data) { struct _midnight_refresh_msg *msg; @@ -307,7 +317,8 @@ lookup_client (ECalClient *cal_client) /* Looks up a queued alarm based on its alarm ID */ static QueuedAlarm * -lookup_queued_alarm (CompQueuedAlarms *cqa, gpointer alarm_id) +lookup_queued_alarm (CompQueuedAlarms *cqa, + gpointer alarm_id) { GSList *l; QueuedAlarm *qa; @@ -328,8 +339,10 @@ lookup_queued_alarm (CompQueuedAlarms *cqa, gpointer alarm_id) * the last one listed for the component, it removes the component itself. */ static gboolean -remove_queued_alarm (CompQueuedAlarms *cqa, gpointer alarm_id, - gboolean free_object, gboolean remove_alarm) +remove_queued_alarm (CompQueuedAlarms *cqa, + gpointer alarm_id, + gboolean free_object, + gboolean remove_alarm) { QueuedAlarm *qa=NULL; GSList *l; @@ -349,16 +362,21 @@ remove_queued_alarm (CompQueuedAlarms *cqa, gpointer alarm_id, if (remove_alarm) { GError *error = NULL; - ECalComponentId *id = e_cal_component_get_id (cqa->alarms->comp); + ECalComponentId *id; + + id = e_cal_component_get_id (cqa->alarms->comp); if (id) { cqa->expecting_update = TRUE; - e_cal_client_discard_alarm_sync (cqa->parent_client->cal_client, id->uid, id->rid, - qa->instance->auid, NULL, &error); + e_cal_client_discard_alarm_sync ( + cqa->parent_client->cal_client, id->uid, + id->rid, qa->instance->auid, NULL, &error); cqa->expecting_update = FALSE; if (error) { if (!g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_NOT_SUPPORTED)) - g_debug ("%s: Failed to discard alarm: %s", G_STRFUNC, error->message); + g_warning ( + "%s: Failed to discard alarm: %s", + G_STRFUNC, error->message); g_error_free (error); } e_cal_component_free_id (id); @@ -397,7 +415,8 @@ remove_queued_alarm (CompQueuedAlarms *cqa, gpointer alarm_id, * Returns: %TRUE when we know the notification type, %FALSE otherwise. */ static gboolean -has_known_notification (ECalComponent *comp, const gchar *alarm_uid) +has_known_notification (ECalComponent *comp, + const gchar *alarm_uid) { ECalComponentAlarm *alarm; ECalComponentAlarmAction action; @@ -413,20 +432,23 @@ has_known_notification (ECalComponent *comp, const gchar *alarm_uid) e_cal_component_alarm_free (alarm); switch (action) { - case E_CAL_COMPONENT_ALARM_AUDIO: - case E_CAL_COMPONENT_ALARM_DISPLAY: - case E_CAL_COMPONENT_ALARM_EMAIL: - case E_CAL_COMPONENT_ALARM_PROCEDURE: - return TRUE; - default: - break; + case E_CAL_COMPONENT_ALARM_AUDIO: + case E_CAL_COMPONENT_ALARM_DISPLAY: + case E_CAL_COMPONENT_ALARM_EMAIL: + case E_CAL_COMPONENT_ALARM_PROCEDURE: + return TRUE; + default: + break; } + return FALSE; } /* Callback used when an alarm triggers */ static void -alarm_trigger_cb (gpointer alarm_id, time_t trigger, gpointer data) +alarm_trigger_cb (gpointer alarm_id, + time_t trigger, + gpointer data) { CompQueuedAlarms *cqa; ECalComponent *comp; @@ -437,7 +459,8 @@ alarm_trigger_cb (gpointer alarm_id, time_t trigger, gpointer data) cqa = data; comp = cqa->alarms->comp; - config_data_set_last_notification_time (cqa->parent_client->cal_client, trigger); + config_data_set_last_notification_time ( + cqa->parent_client->cal_client, trigger); debug (("Setting Last notification time to %s", e_ctime (&trigger))); qa = lookup_queued_alarm (cqa, alarm_id); @@ -487,7 +510,8 @@ alarm_trigger_cb (gpointer alarm_id, time_t trigger, gpointer data) * particular client. Also puts the triggers in the alarm timer queue. */ static void -add_component_alarms (ClientAlarms *ca, ECalComponentAlarms *alarms) +add_component_alarms (ClientAlarms *ca, + ECalComponentAlarms *alarms) { ECalComponentId *id; CompQueuedAlarms *cqa; @@ -584,10 +608,14 @@ load_alarms (ClientAlarms *ca, time_t start, time_t end) ca->view = NULL; } - if (!e_cal_client_get_view_sync (ca->cal_client, str_query, &ca->view, NULL, &error)) { - g_debug ("%s: Could not get query for client: %s", error ? error->message : "Unknown error", G_STRFUNC); - if (error) - g_error_free (error); + e_cal_client_get_view_sync ( + ca->cal_client, str_query, &ca->view, NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Could not get query for client: %s", + G_STRFUNC, error->message); + g_error_free (error); } else { debug (("Setting Call backs")); @@ -602,8 +630,11 @@ load_alarms (ClientAlarms *ca, time_t start, time_t end) G_CALLBACK (query_objects_removed_cb), ca); e_cal_client_view_start (ca->view, &error); - if (error) { - g_debug ("%s: Failed to start view: %s", G_STRFUNC, error->message); + + if (error != NULL) { + g_warning ( + "%s: Failed to start view: %s", + G_STRFUNC, error->message); g_error_free (error); } } @@ -638,13 +669,15 @@ load_alarms_for_today (ClientAlarms *ca) /* Looks up a component's queued alarm structure in a client alarms structure */ static CompQueuedAlarms * -lookup_comp_queued_alarms (ClientAlarms *ca, const ECalComponentId *id) +lookup_comp_queued_alarms (ClientAlarms *ca, + const ECalComponentId *id) { return g_hash_table_lookup (ca->uid_alarms_hash, id); } static void -remove_alarms (CompQueuedAlarms *cqa, gboolean free_object) +remove_alarms (CompQueuedAlarms *cqa, + gboolean free_object) { GSList *l; @@ -663,12 +696,12 @@ remove_alarms (CompQueuedAlarms *cqa, gboolean free_object) alarm_remove (qa->alarm_id); remove_queued_alarm (cqa, qa->alarm_id, free_object, FALSE); } - } /* Removes a component an its alarms */ static void -remove_comp (ClientAlarms *ca, ECalComponentId *id) +remove_comp (ClientAlarms *ca, + ECalComponentId *id) { CompQueuedAlarms *cqa; @@ -707,7 +740,8 @@ duplicate_ical (const GSList *in_list) const GSList *l; GSList *out_list = NULL; for (l = in_list; l; l = l->next) { - out_list = g_slist_prepend (out_list, icalcomponent_new_clone (l->data)); + out_list = g_slist_prepend ( + out_list, icalcomponent_new_clone (l->data)); } return g_slist_reverse (out_list); @@ -731,7 +765,11 @@ duplicate_ecal (const GSList *in_list) } static gboolean -get_alarms_for_object (ECalClient *cal_client, const ECalComponentId *id, time_t start, time_t end, ECalComponentAlarms **alarms) +get_alarms_for_object (ECalClient *cal_client, + const ECalComponentId *id, + time_t start, + time_t end, + ECalComponentAlarms **alarms) { icalcomponent *icalcomp; ECalComponent *comp; @@ -743,7 +781,8 @@ get_alarms_for_object (ECalClient *cal_client, const ECalComponentId *id, time_t g_return_val_if_fail (start >= 0 && end >= 0, FALSE); g_return_val_if_fail (start <= end, FALSE); - if (!e_cal_client_get_object_sync (cal_client, id->uid, id->rid, &icalcomp, NULL, NULL)) + if (!e_cal_client_get_object_sync ( + cal_client, id->uid, id->rid, &icalcomp, NULL, NULL)) return FALSE; if (!icalcomp) @@ -756,8 +795,9 @@ get_alarms_for_object (ECalClient *cal_client, const ECalComponentId *id, time_t return FALSE; } - *alarms = e_cal_util_generate_alarms_for_comp (comp, start, end, omit, e_cal_client_resolve_tzid_cb, - cal_client, e_cal_client_get_default_timezone (cal_client)); + *alarms = e_cal_util_generate_alarms_for_comp ( + comp, start, end, omit, e_cal_client_resolve_tzid_cb, + cal_client, e_cal_client_get_default_timezone (cal_client)); g_object_unref (comp); @@ -872,7 +912,9 @@ query_objects_changed_async (struct _query_msg *msg) } static void -query_objects_modified_cb (ECalClientView *view, const GSList *objects, gpointer data) +query_objects_modified_cb (ECalClientView *view, + const GSList *objects, + gpointer data) { struct _query_msg *msg; @@ -913,7 +955,9 @@ query_objects_removed_async (struct _query_msg *msg) } static void -query_objects_removed_cb (ECalClientView *view, const GSList *uids, gpointer data) +query_objects_removed_cb (ECalClientView *view, + const GSList *uids, + gpointer data) { struct _query_msg *msg; @@ -932,7 +976,9 @@ query_objects_removed_cb (ECalClientView *view, const GSList *uids, gpointer dat * compued with respect to the current time. */ static void -create_snooze (CompQueuedAlarms *cqa, gpointer alarm_id, gint snooze_mins) +create_snooze (CompQueuedAlarms *cqa, + gpointer alarm_id, + gint snooze_mins) { QueuedAlarm *orig_qa; time_t t; @@ -959,7 +1005,8 @@ create_snooze (CompQueuedAlarms *cqa, gpointer alarm_id, gint snooze_mins) /* Launches a component editor for a component */ static void -edit_component (ECalClient *cal_client, ECalComponent *comp) +edit_component (ECalClient *cal_client, + ECalComponent *comp) { ESource *source; gchar *command_line; @@ -1042,8 +1089,9 @@ free_tray_icon_data (TrayIconData *tray_data) g_object_unref (tray_data->cal_client); tray_data->cal_client = NULL; - g_signal_handlers_disconnect_matched (tray_data->view, G_SIGNAL_MATCH_FUNC, - 0, 0, NULL, on_dialog_objs_removed_cb, NULL); + g_signal_handlers_disconnect_matched ( + tray_data->view, G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, on_dialog_objs_removed_cb, NULL); g_object_unref (tray_data->view); tray_data->view = NULL; @@ -1094,7 +1142,9 @@ on_dialog_objs_removed_async (struct _query_msg *msg) } static void -on_dialog_objs_removed_cb (ECalClientView *view, const GSList *uids, gpointer data) +on_dialog_objs_removed_cb (ECalClientView *view, + const GSList *uids, + gpointer data) { struct _query_msg *msg; @@ -1256,14 +1306,17 @@ tray_list_remove_data (TrayIconData *data) } static void -notify_dialog_cb (AlarmNotifyResult result, gint snooze_mins, gpointer data) +notify_dialog_cb (AlarmNotifyResult result, + gint snooze_mins, + gpointer data) { TrayIconData *tray_data = data; debug (("Received from dialog")); - g_signal_handlers_disconnect_matched (tray_data->view, G_SIGNAL_MATCH_FUNC, - 0, 0, NULL, on_dialog_objs_removed_cb, NULL); + g_signal_handlers_disconnect_matched ( + tray_data->view, G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, on_dialog_objs_removed_cb, NULL); switch (result) { case ALARM_NOTIFY_SNOOZE: @@ -1378,17 +1431,18 @@ open_alarm_dialog (TrayIconData *tray_data) GTK_TREE_VIEW (alarm_notifications_dialog->treeview)); tray_data->iter = add_alarm_to_notified_alarms_dialog ( - alarm_notifications_dialog, - tray_data->trigger, - qa->instance->occur_start, - qa->instance->occur_end, - e_cal_component_get_vtype (tray_data->comp), - tray_data->summary, - tray_data->description, - tray_data->location, - notify_dialog_cb, tray_data); - - gtk_tree_selection_select_iter (selection, &tray_data->iter); + alarm_notifications_dialog, + tray_data->trigger, + qa->instance->occur_start, + qa->instance->occur_end, + e_cal_component_get_vtype (tray_data->comp), + tray_data->summary, + tray_data->description, + tray_data->location, + notify_dialog_cb, tray_data); + + gtk_tree_selection_select_iter ( + selection, &tray_data->iter); } @@ -1400,7 +1454,9 @@ open_alarm_dialog (TrayIconData *tray_data) } static gint -tray_icon_clicked_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data) +tray_icon_clicked_cb (GtkWidget *widget, + GdkEventButton *event, + gpointer user_data) { if (event->type == GDK_BUTTON_PRESS) { debug (("left click and %d alarms", g_list_length (tray_icons_list))); @@ -1425,17 +1481,19 @@ tray_icon_clicked_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_da static void icon_activated (GtkStatusIcon *icon) { - GdkEventButton event; + GdkEventButton event; - event.type = GDK_BUTTON_PRESS; - event.button = 1; - event.time = gtk_get_current_event_time (); + event.type = GDK_BUTTON_PRESS; + event.button = 1; + event.time = gtk_get_current_event_time (); - tray_icon_clicked_cb (NULL, &event, NULL); + tray_icon_clicked_cb (NULL, &event, NULL); } static void -popup_menu (GtkStatusIcon *icon, guint button, guint activate_time) +popup_menu (GtkStatusIcon *icon, + guint button, + guint activate_time) { if (button == 3) { /* right click */ @@ -1496,8 +1554,10 @@ tray_list_add_new (TrayIconData *data) /* Performs notification of a display alarm */ static void -display_notification (time_t trigger, CompQueuedAlarms *cqa, - gpointer alarm_id, gboolean use_description) +display_notification (time_t trigger, + CompQueuedAlarms *cqa, + gpointer alarm_id, + gboolean use_description) { QueuedAlarm *qa; ECalComponent *comp; @@ -1621,8 +1681,10 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa, #ifdef HAVE_LIBNOTIFY static void -popup_notification (time_t trigger, CompQueuedAlarms *cqa, - gpointer alarm_id, gboolean use_description) +popup_notification (time_t trigger, + CompQueuedAlarms *cqa, + gpointer alarm_id, + gboolean use_description) { QueuedAlarm *qa; ECalComponent *comp; @@ -1706,8 +1768,9 @@ popup_notification (time_t trigger, CompQueuedAlarms *cqa, /* Performs notification of an audio alarm */ static void -audio_notification (time_t trigger, CompQueuedAlarms *cqa, - gpointer alarm_id) +audio_notification (time_t trigger, + CompQueuedAlarms *cqa, + gpointer alarm_id) { QueuedAlarm *qa; ECalComponent *comp; @@ -1764,7 +1827,9 @@ audio_notification (time_t trigger, CompQueuedAlarms *cqa, /* Performs notification of a mail alarm */ static void -mail_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id) +mail_notification (time_t trigger, + CompQueuedAlarms *cqa, + gpointer alarm_id) { GtkWidget *container; GtkWidget *dialog; @@ -1774,17 +1839,20 @@ mail_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id) debug (("...")); - if (!e_client_check_capability (E_CLIENT (cqa->parent_client->cal_client), CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS)) + if (!e_client_check_capability ( + E_CLIENT (cqa->parent_client->cal_client), + CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS)) return; - dialog = gtk_dialog_new_with_buttons (_("Warning"), - NULL, 0, - GTK_STOCK_OK, GTK_RESPONSE_CANCEL, - NULL); - label = gtk_label_new (_("Evolution does not support calendar reminders with\n" - "email notifications yet, but this reminder was\n" - "configured to send an email. Evolution will display\n" - "a normal reminder dialog box instead.")); + dialog = gtk_dialog_new_with_buttons ( + _("Warning"), NULL, 0, + GTK_STOCK_OK, GTK_RESPONSE_CANCEL, + NULL); + label = gtk_label_new ( + _("Evolution does not support calendar reminders with\n" + "email notifications yet, but this reminder was\n" + "configured to send an email. Evolution will display\n" + "a normal reminder dialog box instead.")); gtk_widget_show (label); container = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); @@ -1810,17 +1878,18 @@ procedure_notification_dialog (const gchar *cmd, const gchar *url) if (config_data_is_blessed_program (url)) return TRUE; - dialog = gtk_dialog_new_with_buttons (_("Warning"), - NULL, 0, - GTK_STOCK_NO, GTK_RESPONSE_CANCEL, - GTK_STOCK_YES, GTK_RESPONSE_OK, - NULL); - - str = g_strdup_printf (_("An Evolution Calendar reminder is about to trigger. " - "This reminder is configured to run the following program:\n\n" - " %s\n\n" - "Are you sure you want to run this program?"), - cmd); + dialog = gtk_dialog_new_with_buttons ( + _("Warning"), NULL, 0, + GTK_STOCK_NO, GTK_RESPONSE_CANCEL, + GTK_STOCK_YES, GTK_RESPONSE_OK, + NULL); + + str = g_strdup_printf ( + _("An Evolution Calendar reminder is about to trigger. " + "This reminder is configured to run the following program:\n\n" + " %s\n\n" + "Are you sure you want to run this program?"), + cmd); label = gtk_label_new (str); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); @@ -1846,7 +1915,9 @@ procedure_notification_dialog (const gchar *cmd, const gchar *url) } static void -procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id) +procedure_notification (time_t trigger, + CompQueuedAlarms *cqa, + gpointer alarm_id) { QueuedAlarm *qa; ECalComponent *comp; @@ -2123,7 +2194,9 @@ alarm_queue_add_client (ECalClient *cal_client) /* Removes a component an its alarms */ static void -remove_cqa (ClientAlarms *ca, ECalComponentId *id, CompQueuedAlarms *cqa) +remove_cqa (ClientAlarms *ca, + ECalComponentId *id, + CompQueuedAlarms *cqa) { /* If a component is present, then it means we must have alarms queued @@ -2136,7 +2209,10 @@ remove_cqa (ClientAlarms *ca, ECalComponentId *id, CompQueuedAlarms *cqa) } static gboolean -remove_comp_by_id (gpointer key, gpointer value, gpointer userdata) { +remove_comp_by_id (gpointer key, + gpointer value, + gpointer userdata) +{ ClientAlarms *ca = (ClientAlarms *) userdata; @@ -2222,7 +2298,8 @@ alarm_queue_remove_async (struct _alarm_client_msg *msg) */ void -alarm_queue_remove_client (ECalClient *cal_client, gboolean immediately) +alarm_queue_remove_client (ECalClient *cal_client, + gboolean immediately) { struct _alarm_client_msg *msg; @@ -2239,7 +2316,8 @@ alarm_queue_remove_client (ECalClient *cal_client, gboolean immediately) /* Update non-time related variables for various structures on modification * of an existing component to be called only from query_objects_changed_cb */ static void -update_cqa (CompQueuedAlarms *cqa, ECalComponent *newcomp) +update_cqa (CompQueuedAlarms *cqa, + ECalComponent *newcomp) { ECalComponent *oldcomp; ECalComponentAlarms *alarms = NULL; @@ -2255,8 +2333,9 @@ update_cqa (CompQueuedAlarms *cqa, ECalComponent *newcomp) to = time_day_end_with_zone (time (NULL), zone); debug (("Generating alarms between %s and %s", e_ctime (&from), e_ctime (&to))); - alarms = e_cal_util_generate_alarms_for_comp (newcomp, from, to, omit, - e_cal_client_resolve_tzid_cb, cqa->parent_client->cal_client, zone); + alarms = e_cal_util_generate_alarms_for_comp ( + newcomp, from, to, omit, e_cal_client_resolve_tzid_cb, + cqa->parent_client->cal_client, zone); /* Update auids in Queued Alarms*/ for (qa_list = cqa->queued_alarms; qa_list; qa_list = qa_list->next) { diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c index d44914fb46..43f87f7fa1 100644 --- a/calendar/gui/comp-util.c +++ b/calendar/gui/comp-util.c @@ -626,13 +626,16 @@ datetime_to_zone (ECalClient *client, ECalComponentDateTime *date, const gchar * if (!from) { GError *error = NULL; - if (!e_cal_client_get_timezone_sync (client, date->tzid, &from, NULL, &error)) + e_cal_client_get_timezone_sync ( + client, date->tzid, &from, NULL, &error); + + if (error != NULL) { g_warning ( "%s: Could not get timezone '%s' from server: %s", - G_STRFUNC, date->tzid ? date->tzid : "", error ? error->message : "Unknown error"); - - if (error) + G_STRFUNC, date->tzid ? date->tzid : "", + error->message); g_error_free (error); + } } to = icaltimezone_get_builtin_timezone_from_tzid (tzid); @@ -714,10 +717,15 @@ comp_util_sanitize_recurrence_master (ECalComponent *comp, /* Get the master component */ e_cal_component_get_uid (comp, &uid); - if (!e_cal_client_get_object_sync (client, uid, NULL, &icalcomp, NULL, &error)) { - g_warning ("Unable to get the master component: %s", error ? error->message : "Unknown error"); - if (error) - g_error_free (error); + + e_cal_client_get_object_sync ( + client, uid, NULL, &icalcomp, NULL, &error); + + if (error != NULL) { + g_warning ( + "Unable to get the master component: %s", + error->message); + g_error_free (error); return; } diff --git a/calendar/gui/dialogs/alarm-list-dialog.c b/calendar/gui/dialogs/alarm-list-dialog.c index 3e854da751..c83dde429d 100644 --- a/calendar/gui/dialogs/alarm-list-dialog.c +++ b/calendar/gui/dialogs/alarm-list-dialog.c @@ -100,7 +100,7 @@ sensitize_buttons (Dialog *dialog) selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->list)); have_selected = gtk_tree_selection_get_selected (selection, NULL, &iter); - if ((e_cal_client_check_one_alarm_only (dialog->cal_client) && have_selected) || read_only) + if ((e_cal_client_check_one_alarm_only (dialog->cal_client) &&have_selected) || read_only) gtk_widget_set_sensitive (dialog->add, FALSE); else gtk_widget_set_sensitive (dialog->add, TRUE); @@ -262,7 +262,9 @@ init_widgets (Dialog *dialog) } gboolean -alarm_list_dialog_run (GtkWidget *parent, ECalClient *cal_client, EAlarmList *list_store) +alarm_list_dialog_run (GtkWidget *parent, + ECalClient *cal_client, + EAlarmList *list_store) { Dialog dialog; GtkWidget *container; diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 1269e61cc5..55980cbc9e 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -191,21 +191,27 @@ static const gchar *ui = " </toolbar>" "</ui>"; -static void comp_editor_show_help (CompEditor *editor); +static void comp_editor_show_help (CompEditor *editor); -static void real_edit_comp (CompEditor *editor, ECalComponent *comp); +static void real_edit_comp (CompEditor *editor, + ECalComponent *comp); static gboolean real_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean strip_alarms); -static gboolean prompt_and_save_changes (CompEditor *editor, gboolean send); -static void close_dialog (CompEditor *editor); +static gboolean prompt_and_save_changes (CompEditor *editor, + gboolean send); +static void close_dialog (CompEditor *editor); static void page_dates_changed_cb (CompEditor *editor, CompEditorPageDates *dates, CompEditorPage *page); -static void obj_modified_cb (ECalClientView *view, const GSList *objs, CompEditor *editor); -static void obj_removed_cb (ECalClientView *view, const GSList *uids, CompEditor *editor); +static void obj_modified_cb (ECalClientView *view, + const GSList *objs, + CompEditor *editor); +static void obj_removed_cb (ECalClientView *view, + const GSList *uids, + CompEditor *editor); G_DEFINE_TYPE_WITH_CODE ( CompEditor, comp_editor, GTK_TYPE_WINDOW, @@ -351,15 +357,21 @@ commit_all_fields (CompEditor *editor) } static void -changes_view_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +changes_view_ready_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { CompEditor *editor = user_data; ECalClientView *view = NULL; + gboolean success; GError *error = NULL; g_return_if_fail (editor != NULL); - if (!e_cal_client_get_view_finish (E_CAL_CLIENT (source_object), result, &view, &error)) + success = e_cal_client_get_view_finish ( + E_CAL_CLIENT (source_object), result, &view, &error); + + if (!success) view = NULL; if (view) { @@ -373,14 +385,18 @@ changes_view_ready_cb (GObject *source_object, GAsyncResult *result, gpointer us e_cal_client_view_start (view, &error); - if (error) { - g_debug ("%s: Failed to stat view: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to start view: %s", + 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_debug ("%s: Failed to get view: %s", G_STRFUNC, error->message); + g_warning ( + "%s: Failed to get view: %s", + G_STRFUNC, error->message); g_error_free (error); } } @@ -401,10 +417,9 @@ listen_for_changes (CompEditor *editor) } if (priv->view) { - g_signal_handlers_disconnect_matched (G_OBJECT (priv->view), - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, - editor); + g_signal_handlers_disconnect_matched ( + priv->view, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, editor); g_object_unref (priv->view); priv->view = NULL; @@ -419,7 +434,10 @@ listen_for_changes (CompEditor *editor) priv->view_cancellable = g_cancellable_new (); query = g_strdup_printf ("(uid? \"%s\")", uid); - e_cal_client_get_view (priv->source_client, query, priv->view_cancellable, changes_view_ready_cb, editor); + e_cal_client_get_view ( + priv->source_client, + query, priv->view_cancellable, + changes_view_ready_cb, editor); g_free (query); } } @@ -433,8 +451,10 @@ send_timezone (gpointer key, gpointer value, gpointer user_data) e_cal_client_add_timezone_sync (editor->priv->cal_client, zone, NULL, &error); - if (error) { - g_debug ("%s: Failed to add timezone: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to add timezone: %s", + G_STRFUNC, error->message); g_error_free (error); } } @@ -518,7 +538,8 @@ save_comp (CompEditor *editor) /* send the component to the server */ if (!cal_comp_is_on_server (priv->comp, priv->cal_client)) { gchar *uid = NULL; - result = e_cal_client_create_object_sync (priv->cal_client, icalcomp, &uid, NULL, &error); + result = e_cal_client_create_object_sync ( + priv->cal_client, icalcomp, &uid, NULL, &error); if (result) { icalcomponent_set_uid (icalcomp, uid); g_free (uid); @@ -540,7 +561,8 @@ save_comp (CompEditor *editor) e_cal_component_set_exdate_list (priv->comp, NULL); e_cal_component_set_exrule_list (priv->comp, NULL); } - result = e_cal_client_modify_object_sync (priv->cal_client, icalcomp, priv->mod, NULL, &error); + result = e_cal_client_modify_object_sync ( + priv->cal_client, icalcomp, priv->mod, NULL, &error); if (priv->mod == CALOBJ_MOD_THIS) { if (result && ((flags & COMP_EDITOR_DELEGATE) || @@ -614,8 +636,10 @@ save_comp (CompEditor *editor) priv->source_client, orig_uid_copy, NULL, CALOBJ_MOD_THIS, NULL, &error); - if (error) { - g_debug ("%s: Failed to remove object: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to remove object: %s", + G_STRFUNC, error->message); g_error_free (error); } @@ -964,10 +988,14 @@ action_save_cb (GtkAction *action, e_cal_component_has_recurrences (priv->comp)) { gchar *rid; rid = e_cal_component_get_recurid_as_string (priv->comp); - e_cal_client_remove_object_sync (priv->cal_client, uid, rid, priv->mod, NULL, &error); + e_cal_client_remove_object_sync ( + priv->cal_client, uid, rid, + priv->mod, NULL, &error); g_free (rid); } else - e_cal_client_remove_object_sync (priv->cal_client, uid, NULL, CALOBJ_MOD_THIS, NULL, &error); + e_cal_client_remove_object_sync ( + priv->cal_client, uid, NULL, + CALOBJ_MOD_THIS, NULL, &error); g_clear_error (&error); } @@ -3350,10 +3378,13 @@ comp_editor_delete_comp (CompEditor *editor) e_cal_component_get_uid (priv->comp, &uid); if (e_cal_component_is_instance (priv->comp) || e_cal_component_has_recurrences (priv->comp)) - e_cal_client_remove_object_sync (priv->cal_client, uid, NULL, - CALOBJ_MOD_ALL, NULL, NULL); + e_cal_client_remove_object_sync ( + priv->cal_client, uid, NULL, + CALOBJ_MOD_ALL, NULL, NULL); else - e_cal_client_remove_object_sync (priv->cal_client, uid, NULL, CALOBJ_MOD_THIS, NULL, NULL); + e_cal_client_remove_object_sync ( + priv->cal_client, uid, NULL, + CALOBJ_MOD_THIS, NULL, NULL); close_dialog (editor); } diff --git a/calendar/gui/dialogs/copy-source-dialog.c b/calendar/gui/dialogs/copy-source-dialog.c index 7b75624a56..31e7cef1b5 100644 --- a/calendar/gui/dialogs/copy-source-dialog.c +++ b/calendar/gui/dialogs/copy-source-dialog.c @@ -95,23 +95,27 @@ free_copy_data (CopySourceDialogData *csdd) } static void -dest_source_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +dest_source_opened_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); CopySourceDialogData *csdd = user_data; EClient *client = NULL; 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) { + if (error != NULL) { + g_warn_if_fail (client == NULL); show_error (csdd, _("Could not open destination"), error); - if (error) - g_error_free (error); + g_error_free (error); free_copy_data (csdd); return; } + g_return_if_fail (E_IS_CLIENT (client)); + csdd->dest_client = E_CAL_CLIENT (client); e_client_utils_open_new (csdd->selected_source, csdd->obj_type, FALSE, NULL, @@ -170,26 +174,31 @@ dest_source_opened_cb (GObject *source_object, GAsyncResult *result, gpointer us } static void -orig_source_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +orig_source_opened_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); CopySourceDialogData *csdd = user_data; EClient *client = NULL; 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) { + if (error != NULL) { + g_warn_if_fail (client == NULL); show_error (csdd, _("Could not open source"), error); - if (error) - g_error_free (error); + g_error_free (error); free_copy_data (csdd); return; } + g_return_if_fail (E_IS_CLIENT (client)); + csdd->source_client = E_CAL_CLIENT (client); - e_client_utils_open_new (csdd->selected_source, csdd->obj_type, FALSE, NULL, + e_client_utils_open_new ( + csdd->selected_source, csdd->obj_type, FALSE, NULL, e_client_utils_authenticate_handler, csdd->parent, dest_source_opened_cb, csdd); } diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 8e52250dfa..c22138f6b9 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -1526,8 +1526,10 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r) /* FIXME Error checking? */ e_cal_client_get_timezone_sync (client, dt.tzid, &to_zone, NULL, &error); - if (error) { - g_debug ("%s: Failed to get timezone: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to get timezone: %s", + G_STRFUNC, error->message); g_error_free (error); } } diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index c4191e68dc..0b78f55c7b 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -73,7 +73,8 @@ sensitize_widgets (SchedulePage *spage) editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (spage)); client = comp_editor_get_client (editor); - e_meeting_time_selector_set_read_only (priv->sel, e_client_is_readonly (E_CLIENT (client))); + e_meeting_time_selector_set_read_only ( + priv->sel, e_client_is_readonly (E_CLIENT (client))); } /* Set date/time */ diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 1e859cb293..ee31eb0a1c 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -168,7 +168,9 @@ task_editor_constructor (GType type, gtk_action_group_set_visible (action_group, is_assigned); if (is_assigned) { - if (e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS)) + if (e_client_check_capability ( + E_CLIENT (client), + CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS)) task_page_show_options (priv->task_page); comp_editor_set_group_item (editor, TRUE); } diff --git a/calendar/gui/e-cal-component-preview.c b/calendar/gui/e-cal-component-preview.c index d2c979151f..f5b8322fa7 100644 --- a/calendar/gui/e-cal-component-preview.c +++ b/calendar/gui/e-cal-component-preview.c @@ -85,6 +85,7 @@ update_comp_info (ECalComponentPreview *preview, changed = !priv->cal_uid; clear_comp_info (preview); } else { + ESource *source; const gchar *uid; gchar *cal_uid; gchar *comp_uid; @@ -92,7 +93,8 @@ update_comp_info (ECalComponentPreview *preview, gint *sequence = NULL; gint comp_sequence; - cal_uid = g_strdup (e_source_peek_uid (e_client_get_source (E_CLIENT (client)))); + source = e_client_get_source (E_CLIENT (client)); + cal_uid = g_strdup (e_source_peek_uid (source)); e_cal_component_get_uid (comp, &uid); comp_uid = g_strdup (uid); e_cal_component_get_last_modified (comp, &itm); diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 457455b88d..7a00fdb7dd 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -2564,7 +2564,7 @@ get_view_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) g_signal_connect (gvd->client_data->view, "complete", G_CALLBACK (client_view_complete_cb), gvd->model); e_cal_client_view_start (gvd->client_data->view, &error); - + if (error) { g_debug ("%s: Failed to start view: %s", G_STRFUNC, error->message); g_error_free (error); @@ -2651,7 +2651,9 @@ backend_died_cb (ECalClient *client, gpointer user_data) } static void -cal_model_retrieve_capabilies_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +cal_model_retrieve_capabilies_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *client = E_CAL_CLIENT (source_object); ECalModel *model = user_data; @@ -2661,7 +2663,8 @@ cal_model_retrieve_capabilies_cb (GObject *source_object, GAsyncResult *result, g_return_if_fail (client != NULL); g_return_if_fail (model != NULL); - e_client_retrieve_capabilities_finish (E_CLIENT (client), result, &capabilities, NULL); + e_client_retrieve_capabilities_finish ( + E_CLIENT (client), result, &capabilities, NULL); g_free (capabilities); e_cal_model_update_status_message (model, NULL, -1.0); @@ -2695,7 +2698,9 @@ free_retry_open_data (gpointer data) static gboolean cal_model_retry_open_timeout_cb (gpointer user_data); static void -client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +client_opened_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *client = E_CAL_CLIENT (source_object); ECalModel *model = (ECalModel *) user_data; @@ -2718,23 +2723,33 @@ client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_da rod->cancellable = g_object_ref (model->priv->loading_clients); /* postpone for 1/2 of a second, backend is busy now */ - g_timeout_add_full (G_PRIORITY_DEFAULT, 500, cal_model_retry_open_timeout_cb, rod, free_retry_open_data); + g_timeout_add_full ( + G_PRIORITY_DEFAULT, 500, + cal_model_retry_open_timeout_cb, + rod, free_retry_open_data); g_error_free (error); return; } - if (error) { + if (error != NULL) { + const gchar *uri; + + uri = e_client_get_uri (E_CLIENT (client)); e_cal_model_remove_client (model, client); - g_debug ("%s: Failed to open '%s': %s", G_STRFUNC, e_client_get_uri (E_CLIENT (client)), error->message); + g_warning ( + "%s: Failed to open '%s': %s", + G_STRFUNC, uri, error->message); g_error_free (error); e_cal_model_update_status_message (model, NULL, -1.0); return; } /* to have them ready for later use */ - e_client_retrieve_capabilities (E_CLIENT (client), model->priv->loading_clients, cal_model_retrieve_capabilies_cb, model); + e_client_retrieve_capabilities ( + E_CLIENT (client), model->priv->loading_clients, + cal_model_retrieve_capabilies_cb, model); } static gboolean @@ -2746,7 +2761,9 @@ cal_model_retry_open_timeout_cb (gpointer user_data) g_return_val_if_fail (rod->client != NULL, FALSE); g_return_val_if_fail (rod->model != NULL, FALSE); - e_client_open (rod->client, TRUE, rod->cancellable, client_opened_cb, rod->model); + e_client_open ( + rod->client, TRUE, rod->cancellable, + client_opened_cb, rod->model); return FALSE; } diff --git a/calendar/gui/e-calendar-selector.c b/calendar/gui/e-calendar-selector.c index 1a70ebb387..c71e3b99aa 100644 --- a/calendar/gui/e-calendar-selector.c +++ b/calendar/gui/e-calendar-selector.c @@ -46,7 +46,8 @@ calendar_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); } uid = NULL; @@ -87,12 +88,14 @@ calendar_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 ass 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_VTODO_COMPONENT || @@ -111,27 +114,32 @@ calendar_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) { + ESource *source = E_SOURCE (source_object); EClient *client = NULL; icalcomponent *icalcomp = user_data; GError *error = NULL; g_return_if_fail (icalcomp != NULL); - if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) - client = NULL; - - if (client) { - calendar_selector_update_objects (E_CAL_CLIENT (client), icalcomp); - g_object_unref (client); - } + e_client_utils_open_new_finish (source, result, &client, &error); - if (error) { - g_debug ("%s: Failed to open client: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open client: %s", + G_STRFUNC, error->message); g_error_free (error); } + g_return_if_fail (E_IS_CLIENT (client)); + + calendar_selector_update_objects (E_CAL_CLIENT (client), icalcomp); + g_object_unref (client); + icalcomponent_free (icalcomp); } diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index e7e44bab46..11378cc25a 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -6725,11 +6725,15 @@ e_day_view_on_editing_stopped (EDayView *day_view, gchar *uid = NULL; GError *error = NULL; - if (!e_cal_client_create_object_sync (client, icalcomp, &uid, NULL, &error)) { + e_cal_client_create_object_sync ( + client, icalcomp, &uid, NULL, &error); + + if (error != NULL) { uid = NULL; - g_debug (G_STRLOC ": Could not create the object! %s", error ? error->message : "Unknown error"); - if (error) - g_error_free (error); + g_warning ( + "%s: Could not create the object! %s", + G_STRFUNC, error->message); + g_error_free (error); } else { icalcomponent_set_uid (icalcomp, uid); e_calendar_view_emit_user_created ( diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c index 539580320c..5a9176a094 100644 --- a/calendar/gui/e-meeting-store.c +++ b/calendar/gui/e-meeting-store.c @@ -1470,7 +1470,9 @@ typedef struct { #define DOMAIN_SUB "%d" static void -client_free_busy_data_cb (ECalClient *client, const GSList *ecalcomps, FreeBusyAsyncData *fbd) +client_free_busy_data_cb (ECalClient *client, + const GSList *ecalcomps, + FreeBusyAsyncData *fbd) { const GSList *iter; @@ -1479,8 +1481,9 @@ client_free_busy_data_cb (ECalClient *client, const GSList *ecalcomps, FreeBusyA for (iter = ecalcomps; iter != NULL; iter = iter->next) { ECalComponent *comp = iter->data; - if (comp) - fbd->fb_data = g_slist_prepend (fbd->fb_data, g_object_ref (comp)); + if (comp != NULL) + fbd->fb_data = g_slist_prepend ( + fbd->fb_data, g_object_ref (comp)); } } @@ -1501,8 +1504,12 @@ freebusy_async (gpointer data) * get free busy asynchronously. */ g_static_mutex_lock (&mutex); priv->num_queries++; - sigid = g_signal_connect (fbd->client, "free-busy-data", G_CALLBACK (client_free_busy_data_cb), fbd); - e_cal_client_get_free_busy_sync (fbd->client, fbd->startt, fbd->endt, fbd->users, NULL, NULL); + sigid = g_signal_connect ( + fbd->client, "free-busy-data", + G_CALLBACK (client_free_busy_data_cb), fbd); + e_cal_client_get_free_busy_sync ( + fbd->client, fbd->startt, + fbd->endt, fbd->users, NULL, NULL); g_signal_handler_disconnect (fbd->client, sigid); priv->num_queries--; g_static_mutex_unlock (&mutex); 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); diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c index e6396427da..ec6862199f 100644 --- a/calendar/gui/e-memo-table.c +++ b/calendar/gui/e-memo-table.c @@ -163,9 +163,9 @@ memo_table_model_cal_view_progress_cb (EMemoTable *memo_table, } static void -memo_table_model_cal_view_complete_cb ( EMemoTable *memo_table, - const GError *error, - ECalClientSourceType type) +memo_table_model_cal_view_complete_cb (EMemoTable *memo_table, + const GError *error, + ECalClientSourceType type) { memo_table_emit_status_message (memo_table, NULL, -1.0); } @@ -186,8 +186,10 @@ delete_selected_components (EMemoTable *memo_table) ECalModelComponent *comp_data = (ECalModelComponent *) l->data; GError *error = NULL; - e_cal_client_remove_object_sync (comp_data->client, - icalcomponent_get_uid (comp_data->icalcomp), NULL, CALOBJ_MOD_THIS, NULL, &error); + e_cal_client_remove_object_sync ( + comp_data->client, + icalcomponent_get_uid (comp_data->icalcomp), + NULL, CALOBJ_MOD_THIS, NULL, &error); delete_error_dialog (error, E_CAL_COMPONENT_JOURNAL); g_clear_error (&error); } @@ -703,7 +705,8 @@ memo_table_update_actions (ESelectable *selectable, for (iter = list; iter != NULL && sources_are_editable; iter = iter->next) { ECalModelComponent *comp_data = iter->data; - sources_are_editable = sources_are_editable && !e_client_is_readonly (E_CLIENT (comp_data->client)); + sources_are_editable = sources_are_editable && + !e_client_is_readonly (E_CLIENT (comp_data->client)); } g_slist_free (list); @@ -885,8 +888,10 @@ clipboard_get_calendar_data (EMemoTable *memo_table, g_free (uid); g_object_unref (tmp_comp); - if (error) { - g_debug ("%s: Failed to create object: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to create object: %s", + G_STRFUNC, error->message); g_error_free (error); } } @@ -909,8 +914,10 @@ clipboard_get_calendar_data (EMemoTable *memo_table, g_free (uid); g_object_unref (comp); - if (error) { - g_debug ("%s: Failed to create object: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to create object: %s", + G_STRFUNC, error->message); g_error_free (error); } } diff --git a/calendar/gui/e-task-list-selector.c b/calendar/gui/e-task-list-selector.c index ff4e187877..7e091599cf 100644 --- a/calendar/gui/e-task-list-selector.c +++ b/calendar/gui/e-task-list-selector.c @@ -48,7 +48,8 @@ task_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 @@ task_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_VTODO_COMPONENT || @@ -113,29 +115,38 @@ task_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 task list: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open task 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); } @@ -212,50 +223,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 task list: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open task 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; - task_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); - } + task_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); diff --git a/calendar/gui/e-task-table.c b/calendar/gui/e-task-table.c index 38b1d9ece5..c77c0a8a52 100644 --- a/calendar/gui/e-task-table.c +++ b/calendar/gui/e-task-table.c @@ -241,9 +241,9 @@ task_table_model_cal_view_progress_cb (ETaskTable *task_table, } static void -task_table_model_cal_view_complete_cb ( ETaskTable *task_table, - const GError *error, - ECalClientSourceType type) +task_table_model_cal_view_complete_cb (ETaskTable *task_table, + const GError *error, + ECalClientSourceType type) { task_table_emit_status_message (task_table, NULL, -1.0); } @@ -264,7 +264,10 @@ delete_selected_components (ETaskTable *task_table) ECalModelComponent *comp_data = (ECalModelComponent *) l->data; GError *error = NULL; - e_cal_client_remove_object_sync (comp_data->client, icalcomponent_get_uid (comp_data->icalcomp), NULL, CALOBJ_MOD_THIS, NULL, &error); + e_cal_client_remove_object_sync ( + comp_data->client, + icalcomponent_get_uid (comp_data->icalcomp), + NULL, CALOBJ_MOD_THIS, NULL, &error); delete_error_dialog (error, E_CAL_COMPONENT_TODO); g_clear_error (&error); } @@ -933,7 +936,8 @@ task_table_update_actions (ESelectable *selectable, for (iter = list; iter != NULL && sources_are_editable; iter = iter->next) { ECalModelComponent *comp_data = iter->data; - sources_are_editable = sources_are_editable && !e_client_is_readonly (E_CLIENT (comp_data->client)); + sources_are_editable = sources_are_editable && + !e_client_is_readonly (E_CLIENT (comp_data->client)); } g_slist_free (list); @@ -1112,8 +1116,10 @@ clipboard_get_calendar_data (ETaskTable *task_table, if (!e_cal_client_create_object_sync (client, e_cal_component_get_icalcomponent (tmp_comp), &uid, NULL, &error)) uid = NULL; - if (error) { - g_debug ("%s: Failed to create object: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to create object: %s", + G_STRFUNC, error->message); g_error_free (error); } @@ -1136,8 +1142,10 @@ clipboard_get_calendar_data (ETaskTable *task_table, if (!e_cal_client_create_object_sync (client, e_cal_component_get_icalcomponent (comp), &uid, NULL, &error)) uid = NULL; - if (error) { - g_debug ("%s: Failed to create object: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to create object: %s", + G_STRFUNC, error->message); g_error_free (error); } @@ -1255,9 +1263,11 @@ check_for_retract (ECalComponent *comp, ECalClient *client) e_cal_component_get_organizer (comp, &org); strip = itip_strip_mailto (org.value); - ret_val = - e_client_get_backend_property_sync (E_CLIENT (client), CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &email, NULL, NULL) && - email && g_ascii_strcasecmp (email, strip) == 0; + ret_val = e_client_get_backend_property_sync ( + E_CLIENT (client), + CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, + &email, NULL, NULL) && email != NULL && + g_ascii_strcasecmp (email, strip) == 0; g_free (email); @@ -1617,10 +1627,14 @@ hide_completed_rows (ECalModel *model, client = l->data; - if (!e_cal_client_get_object_list_sync (client, hide_sexp, &objects, NULL, &error)) { - g_debug ("%s: Could not get the objects: %s", G_STRFUNC, error ? error->message : "Unknown error"); - if (error) - g_error_free (error); + e_cal_client_get_object_list_sync ( + client, hide_sexp, &objects, NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Could not get the objects: %s", + G_STRFUNC, error->message); + g_error_free (error); continue; } @@ -1675,10 +1689,14 @@ show_completed_rows (ECalModel *model, client = l->data; - if (!e_cal_client_get_object_list_sync (client, show_sexp, &objects, NULL, &error)) { - g_debug ("%s: Could not get the objects: %s", G_STRFUNC, error ? error->message : "Unknown error"); - if (error) - g_error_free (error); + e_cal_client_get_object_list_sync ( + client, show_sexp, &objects, NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Could not get the objects: %s", + G_STRFUNC, error->message); + g_error_free (error); continue; } diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 03b5b6bfa6..aca2d05068 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -754,7 +754,9 @@ ensure_dates_are_in_default_zone (GnomeCalendar *gcal, /* Callback used when the calendar query reports of an updated object */ static void -dn_client_view_objects_added_cb (ECalClientView *view, const GSList *objects, gpointer data) +dn_client_view_objects_added_cb (ECalClientView *view, + const GSList *objects, + gpointer data) { GnomeCalendar *gcal; GnomeCalendarPrivate *priv; @@ -783,7 +785,9 @@ dn_client_view_objects_added_cb (ECalClientView *view, const GSList *objects, gp } static void -dn_client_view_objects_modified_cb (ECalClientView *view, const GSList *objects, gpointer data) +dn_client_view_objects_modified_cb (ECalClientView *view, + const GSList *objects, + gpointer data) { GnomeCalendar *gcal; @@ -791,14 +795,15 @@ dn_client_view_objects_modified_cb (ECalClientView *view, const GSList *objects, /* We have to retag the whole thing: an event may change dates * and the tag_calendar_by_comp() below would not know how to - * untag the old dates. - */ + * untag the old dates. */ gnome_calendar_update_query (gcal); } /* Callback used when the calendar query reports of a removed object */ static void -dn_client_view_objects_removed_cb (ECalClientView *view, const GSList *ids, gpointer data) +dn_client_view_objects_removed_cb (ECalClientView *view, + const GSList *ids, + gpointer data) { GnomeCalendar *gcal; @@ -810,11 +815,15 @@ dn_client_view_objects_removed_cb (ECalClientView *view, const GSList *ids, gpoi /* Callback used when the calendar query is done */ static void -dn_client_view_complete_cb (ECalClientView *query, const GError *error, gpointer data) +dn_client_view_complete_cb (ECalClientView *query, + const GError *error, + gpointer data) { /* FIXME Better error reporting */ - if (error) - g_debug ("%s: Query did not complete successfully: %s", G_STRFUNC, error->message); + if (error != NULL) + g_warning ( + "%s: Query did not complete successfully: %s", + G_STRFUNC, error->message); } ECalendarView * @@ -1054,7 +1063,8 @@ free_dn_queries (GnomeCalendar *gcal) for (l = priv->dn_queries; l != NULL; l = l->next) { if (!l->data) continue; - g_signal_handlers_disconnect_matched (l->data, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, gcal); + g_signal_handlers_disconnect_matched ( + l->data, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, gcal); g_object_unref (l->data); } @@ -1117,20 +1127,26 @@ update_query_async (struct _date_query_msg *msg) continue; } - g_signal_connect (new_view, "objects-added", - G_CALLBACK (dn_client_view_objects_added_cb), gcal); - g_signal_connect (new_view, "objects-modified", - G_CALLBACK (dn_client_view_objects_modified_cb), gcal); - g_signal_connect (new_view, "objects-removed", - G_CALLBACK (dn_client_view_objects_removed_cb), gcal); - g_signal_connect (new_view, "complete", - G_CALLBACK (dn_client_view_complete_cb), gcal); + g_signal_connect ( + new_view, "objects-added", + G_CALLBACK (dn_client_view_objects_added_cb), gcal); + g_signal_connect ( + new_view, "objects-modified", + G_CALLBACK (dn_client_view_objects_modified_cb), gcal); + g_signal_connect ( + new_view, "objects-removed", + G_CALLBACK (dn_client_view_objects_removed_cb), gcal); + g_signal_connect ( + new_view, "complete", + G_CALLBACK (dn_client_view_complete_cb), gcal); g_mutex_lock (priv->dn_query_lock); priv->dn_queries = g_list_append (priv->dn_queries, new_view); e_cal_client_view_start (new_view, &error); - if (error) { - g_debug ("%s: Failed to start view: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to start view: %s", + G_STRFUNC, error->message); g_clear_error (&error); } g_mutex_unlock (priv->dn_query_lock); @@ -2228,11 +2244,14 @@ gnome_calendar_purge (GnomeCalendar *gcal, time_t older_than) if (e_client_is_readonly (E_CLIENT (client))) continue; - if (!e_cal_client_get_object_list_sync (client, sexp, &objects, NULL, &error)) { - g_warning (G_STRLOC ": Could not get the objects: %s", error ? error->message : "Unknown error"); - if (error) - g_error_free (error); + e_cal_client_get_object_list_sync ( + client, sexp, &objects, NULL, &error); + if (error != NULL) { + g_warning ( + "%s: Could not get the objects: %s", + G_STRFUNC, error->message); + g_error_free (error); continue; } @@ -2271,14 +2290,20 @@ gnome_calendar_purge (GnomeCalendar *gcal, time_t older_than) if (!icaltime_is_null_time (recur_id) ) rid = icaltime_as_ical_string_r (recur_id); - e_cal_client_remove_object_sync (client, uid, rid, CALOBJ_MOD_ALL, NULL, &error); + e_cal_client_remove_object_sync ( + client, uid, rid, + CALOBJ_MOD_ALL, NULL, &error); g_free (rid); } else { - e_cal_client_remove_object_sync (client, uid, NULL, CALOBJ_MOD_THIS, NULL, &error); + e_cal_client_remove_object_sync ( + client, uid, NULL, + CALOBJ_MOD_THIS, NULL, &error); } - if (error) { - g_debug ("%s: Unable to purge events: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Unable to purge events: %s", + G_STRFUNC, error->message); g_error_free (error); } } diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index d095d4ecbe..02042d29a9 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -289,13 +289,18 @@ itip_get_comp_attendee (ECalComponent *comp, al = e_get_account_list (); if (cal_client) - e_client_get_backend_property_sync (E_CLIENT (cal_client), CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &address, NULL, NULL); + e_client_get_backend_property_sync ( + E_CLIENT (cal_client), + CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, + &address, NULL, NULL); if (address && *address) { attendee = get_attendee (attendees, address); if (attendee) { - gchar *user_email = g_strdup (itip_strip_mailto (attendee->value)); + gchar *user_email; + + user_email = g_strdup (itip_strip_mailto (attendee->value)); e_cal_component_free_attendee_list (attendees); g_free (address); @@ -305,7 +310,9 @@ itip_get_comp_attendee (ECalComponent *comp, attendee = get_attendee_if_attendee_sentby_is_user (attendees, address); if (attendee) { - gchar *user_email = g_strdup (itip_strip_mailto (attendee->sentby)); + gchar *user_email; + + user_email = g_strdup (itip_strip_mailto (attendee->sentby)); e_cal_component_free_attendee_list (attendees); g_free (address); @@ -1250,7 +1257,9 @@ comp_compliant (ECalComponentItipMethod method, from_zone = icaltimezone_get_builtin_timezone_from_tzid (dt.tzid); if (from_zone == NULL && client != NULL) /* FIXME Error checking */ - e_cal_client_get_timezone_sync (client, dt.tzid, &from_zone, NULL, NULL); + e_cal_client_get_timezone_sync ( + client, dt.tzid, + &from_zone, NULL, NULL); } to_zone = icaltimezone_get_utc_timezone (); @@ -1704,12 +1713,18 @@ reply_to_calendar_comp (ECalComponentItipMethod method, if (!start_zone && dtstart.tzid) { GError *error = NULL; - if (!e_cal_client_get_timezone_sync (cal_client, dtstart.tzid, &start_zone, NULL, &error)) - g_debug ("%s: Couldn't get timezone '%s' from server: %s", G_STRFUNC, - dtstart.tzid ? dtstart.tzid : "", error ? error->message : "Unknown error"); + e_cal_client_get_timezone_sync ( + cal_client, dtstart.tzid, + &start_zone, NULL, &error); - if (error) + if (error != NULL) { + g_warning ( + "%s: Couldn't get timezone '%s' from server: %s", + G_STRFUNC, + dtstart.tzid ? dtstart.tzid : "", + error->message); g_error_free (error); + } } if (!start_zone || dtstart.value->is_date) diff --git a/calendar/gui/tag-calendar.c b/calendar/gui/tag-calendar.c index affe2a3633..82eae30c83 100644 --- a/calendar/gui/tag-calendar.c +++ b/calendar/gui/tag-calendar.c @@ -202,10 +202,14 @@ resolve_tzid_cb (const gchar *tzid, /* FIXME: Handle errors. */ GError *error = NULL; - if (!e_cal_client_get_timezone_sync (client, tzid, &zone, NULL, &error)) { - g_debug ("%s: Failed to get timezone '%s': %s", G_STRFUNC, tzid, error->message); - if (error) - g_error_free (error); + e_cal_client_get_timezone_sync ( + client, tzid, &zone, NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to get timezone '%s': %s", + G_STRFUNC, tzid, error->message); + g_error_free (error); } } @@ -233,8 +237,8 @@ tag_calendar_by_comp (ECalendar *ecal, icaltimezone *display_zone, gboolean clear_first, gboolean comp_is_on_server, - gboolean can_recur_events_italic, - GCancellable *cancellable) + gboolean can_recur_events_italic, + GCancellable *cancellable) { struct calendar_tag_closure c; diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c index 6f3b2d9a98..585d423921 100644 --- a/calendar/importers/icalendar-importer.c +++ b/calendar/importers/icalendar-importer.c @@ -178,7 +178,9 @@ struct UpdateObjectsData }; static void -receive_objects_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +receive_objects_ready_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *cal_client = E_CAL_CLIENT (source_object); struct UpdateObjectsData *uod = user_data; @@ -188,8 +190,10 @@ receive_objects_ready_cb (GObject *source_object, GAsyncResult *result, gpointer e_cal_client_receive_objects_finish (cal_client, result, &error); - if (error) { - g_debug ("%s: Failed to receive objects: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to receive objects: %s", + G_STRFUNC, error->message); g_error_free (error); } @@ -367,29 +371,35 @@ ivcal_import_items (gpointer d) } static void -ivcal_opened (GObject *source_object, GAsyncResult *result, gpointer user_data) +ivcal_opened (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); EClient *client = NULL; ICalImporter *ici = user_data; GError *error = NULL; g_return_if_fail (ici != 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); - ici->cal_client = client ? E_CAL_CLIENT (client) : NULL; - - if (!g_cancellable_is_cancelled (ici->cancellable) && !error) { - e_import_status(ici->import, ici->target, _("Importing..."), 0); - ici->idle_id = g_idle_add (ivcal_import_items, ici); - } else - ivcal_import_done (ici); - - if (error) { - g_debug ("%s: Failed to open calendar: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open calendar: %s", + G_STRFUNC, error->message); g_error_free (error); + ivcal_import_done (ici); + return; } + + g_return_if_fail (E_IS_CLIENT (client)); + + ici->cal_client = E_CAL_CLIENT (client); + + e_import_status(ici->import, ici->target, _("Importing..."), 0); + ici->idle_id = g_idle_add (ivcal_import_items, ici); } static void @@ -763,8 +773,11 @@ struct OpenDefaultSourceData }; static void -default_source_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +default_source_opened_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); EClient *client = NULL; struct OpenDefaultSourceData *odsd = user_data; GError *error = NULL; @@ -773,10 +786,10 @@ default_source_opened_cb (GObject *source_object, GAsyncResult *result, gpointer g_return_if_fail (odsd->ici != NULL); g_return_if_fail (odsd->opened_cb != 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); - odsd->opened_cb (client ? E_CAL_CLIENT (client) : NULL, error, odsd->ici); + /* Client may be NULL; don't use a type cast macro. */ + odsd->opened_cb ((ECalClient *) client, error, odsd->ici); if (client) g_object_unref (client); @@ -838,12 +851,16 @@ continue_done_cb (gpointer user_data) } static void -gc_import_tasks (ECalClient *cal_client, const GError *error, ICalIntelligentImporter *ici) +gc_import_tasks (ECalClient *cal_client, + const GError *error, + ICalIntelligentImporter *ici) { g_return_if_fail (ici != NULL); - if (!cal_client) { - g_debug ("%s: Failed to open tasks: %s", G_STRFUNC, error ? error->message : "Unknown error"); + if (error != NULL) { + g_warning ( + "%s: Failed to open tasks: %s", + G_STRFUNC, error->message); e_import_complete (ici->ei, ici->target); return; } @@ -851,7 +868,10 @@ gc_import_tasks (ECalClient *cal_client, const GError *error, ICalIntelligentImp e_import_status (ici->ei, ici->target, _("Importing..."), 0); prepare_tasks (ici->icalcomp, ici->tasks); - update_objects (cal_client, ici->icalcomp, ici->cancellable, continue_done_cb, ici); + + update_objects ( + cal_client, ici->icalcomp, + ici->cancellable, continue_done_cb, ici); } static void @@ -865,14 +885,20 @@ continue_tasks_cb (gpointer user_data) } static void -gc_import_events (ECalClient *cal_client, const GError *error, ICalIntelligentImporter *ici) +gc_import_events (ECalClient *cal_client, + const GError *error, + ICalIntelligentImporter *ici) { g_return_if_fail (ici != NULL); - if (!cal_client) { - g_debug ("%s: Failed to open events calendar: %s", G_STRFUNC, error ? error->message : "Unknown error"); + if (error != NULL) { + g_warning ( + "%s: Failed to open events calendar: %s", + G_STRFUNC, error->message); if (ici->tasks) - open_default_source (ici, E_CAL_CLIENT_SOURCE_TYPE_TASKS, gc_import_tasks); + open_default_source ( + ici, E_CAL_CLIENT_SOURCE_TYPE_TASKS, + gc_import_tasks); else e_import_complete (ici->ei, ici->target); return; @@ -880,7 +906,9 @@ gc_import_events (ECalClient *cal_client, const GError *error, ICalIntelligentIm e_import_status (ici->ei, ici->target, _("Importing..."), 0); - update_objects (cal_client, ici->icalcomp, ici->cancellable, ici->tasks ? continue_tasks_cb : continue_done_cb, ici); + update_objects ( + cal_client, ici->icalcomp, ici->cancellable, + ici->tasks ? continue_tasks_cb : continue_done_cb, ici); } static void |