From ae9db3ed236b0c734fd12c8dc8c99764626bf0b8 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 1 Jul 2011 00:07:26 -0400 Subject: Coding style and whitespace cleanup. --- calendar/gui/dialogs/alarm-list-dialog.c | 6 ++- calendar/gui/dialogs/comp-editor.c | 85 +++++++++++++++++++++---------- calendar/gui/dialogs/copy-source-dialog.c | 35 ++++++++----- calendar/gui/dialogs/recurrence-page.c | 6 ++- calendar/gui/dialogs/schedule-page.c | 3 +- calendar/gui/dialogs/task-editor.c | 4 +- 6 files changed, 93 insertions(+), 46 deletions(-) (limited to 'calendar/gui/dialogs') 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 = " " ""; -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); } -- cgit v1.2.3