diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-07-01 12:07:26 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-08-13 23:27:51 +0800 |
commit | f59681796df8fe0138a1754abbe8ec781bc1535e (patch) | |
tree | 0ced0c119ffed095713d7f64732686df9b2d9152 | |
parent | bf4a1a13e3295deefc4031a446627ff9b1c95c7a (diff) | |
download | gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.gz gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.zst gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.zip |
Coding style and whitespace cleanup.
88 files changed, 2681 insertions, 1438 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index 7730f17a53..3d76a401eb 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -393,7 +393,8 @@ entry_activated (EContactEditor *editor) /* FIXME: Linear time... */ static gboolean -is_field_supported (EContactEditor *editor, EContactField field_id) +is_field_supported (EContactEditor *editor, + EContactField field_id) { GSList *fields, *iter; const gchar *field; @@ -421,7 +422,9 @@ is_field_supported (EContactEditor *editor, EContactField field_id) /* This function tells you whether name_to_style will make sense. */ static gboolean -style_makes_sense (const EContactName *name, const gchar *company, gint style) +style_makes_sense (const EContactName *name, + const gchar *company, + gint style) { switch (style) { case 0: /* Fall Through */ @@ -453,7 +456,9 @@ style_makes_sense (const EContactName *name, const gchar *company, gint style) } static gchar * -name_to_style (const EContactName *name, const gchar *company, gint style) +name_to_style (const EContactName *name, + const gchar *company, + gint style) { gchar *string; gchar *strings[4], **stringptr; @@ -628,7 +633,8 @@ file_as_set_style (EContactEditor *editor, gint style) } static void -name_entry_changed (GtkWidget *widget, EContactEditor *editor) +name_entry_changed (GtkWidget *widget, + EContactEditor *editor) { gint style = 0; const gchar *string; @@ -643,11 +649,13 @@ name_entry_changed (GtkWidget *widget, EContactEditor *editor) sensitize_ok (editor); if (string && !*string) - gtk_window_set_title (GTK_WINDOW (editor->app), _("Contact Editor")); + gtk_window_set_title ( + GTK_WINDOW (editor->app), _("Contact Editor")); } static void -file_as_combo_changed (GtkWidget *widget, EContactEditor *editor) +file_as_combo_changed (GtkWidget *widget, + EContactEditor *editor) { GtkWidget *entry; gchar *string = NULL; @@ -663,7 +671,8 @@ file_as_combo_changed (GtkWidget *widget, EContactEditor *editor) g_free (title); } else { - gtk_window_set_title (GTK_WINDOW (editor->app), _("Contact Editor")); + gtk_window_set_title ( + GTK_WINDOW (editor->app), _("Contact Editor")); } sensitize_ok (editor); @@ -671,7 +680,8 @@ file_as_combo_changed (GtkWidget *widget, EContactEditor *editor) } static void -company_entry_changed (GtkWidget *widget, EContactEditor *editor) +company_entry_changed (GtkWidget *widget, + EContactEditor *editor) { gint style = 0; @@ -735,7 +745,8 @@ sensitize_ok (EContactEditor *ce) } static void -object_changed (GObject *object, EContactEditor *editor) +object_changed (GObject *object, + EContactEditor *editor) { if (!editor->target_editable) { g_warning ("non-editable contact editor has an editable field in it."); @@ -762,14 +773,17 @@ object_changed (GObject *object, EContactEditor *editor) } static void -image_chooser_changed (GtkWidget *widget, EContactEditor *editor) +image_chooser_changed (GtkWidget *widget, + EContactEditor *editor) { editor->image_set = TRUE; editor->image_changed = TRUE; } static void -set_entry_text (EContactEditor *editor, GtkEntry *entry, const gchar *string) +set_entry_text (EContactEditor *editor, + GtkEntry *entry, + const gchar *string) { const gchar *oldstring = gtk_entry_get_text (entry); @@ -786,7 +800,9 @@ set_entry_text (EContactEditor *editor, GtkEntry *entry, const gchar *string) } static void -set_combo_box_active (EContactEditor *editor, GtkComboBox *combo_box, gint active) +set_combo_box_active (EContactEditor *editor, + GtkComboBox *combo_box, + gint active) { g_signal_handlers_block_matched ( combo_box, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, editor); @@ -796,7 +812,8 @@ set_combo_box_active (EContactEditor *editor, GtkComboBox *combo_box, gint activ } static void -init_email_record_location (EContactEditor *editor, gint record) +init_email_record_location (EContactEditor *editor, + gint record) { GtkComboBox *location_combo_box; GtkWidget *email_entry; @@ -899,7 +916,9 @@ im_index_to_location (gint index) } static void -phone_index_to_type (gint index, const gchar **type_1, const gchar **type_2) +phone_index_to_type (gint index, + const gchar **type_1, + const gchar **type_2) { *type_1 = phones [index].type_1; *type_2 = phones [index].type_2; @@ -1153,7 +1172,9 @@ extract_email (EContactEditor *editor) } static void -sensitize_email_record (EContactEditor *editor, gint record, gboolean enabled) +sensitize_email_record (EContactEditor *editor, + gint record, + gboolean enabled) { GtkWidget *location_combo_box; GtkWidget *email_entry; @@ -1287,7 +1308,8 @@ expand_widget_list (EContactEditor *editor, } static void -expand_web (EContactEditor *editor, gboolean expanded) +expand_web (EContactEditor *editor, + gboolean expanded) { const gchar *names[] = { "label-videourl", "label-fburl", @@ -1299,7 +1321,8 @@ expand_web (EContactEditor *editor, gboolean expanded) } static void -expand_phone (EContactEditor *editor, gboolean expanded) +expand_phone (EContactEditor *editor, + gboolean expanded) { const gchar *names[] = { "entry-phone-2", "combobox-phone-2", @@ -1311,7 +1334,8 @@ expand_phone (EContactEditor *editor, gboolean expanded) } static void -expand_mail (EContactEditor *editor, gboolean expanded) +expand_mail (EContactEditor *editor, + gboolean expanded) { GtkTable *table; GtkWidget *check; @@ -1559,7 +1583,8 @@ init_phone (EContactEditor *editor) } static void -sensitize_phone_types (EContactEditor *editor, GtkWidget *combo_box) +sensitize_phone_types (EContactEditor *editor, + GtkWidget *combo_box) { GtkTreeModel *model; GtkTreeIter iter; @@ -1585,7 +1610,9 @@ sensitize_phone_types (EContactEditor *editor, GtkWidget *combo_box) } static void -sensitize_phone_record (EContactEditor *editor, gint record, gboolean enabled) +sensitize_phone_record (EContactEditor *editor, + gint record, + gboolean enabled) { GtkWidget *phone_type_combo_box; GtkWidget *phone_entry; @@ -1621,7 +1648,8 @@ sensitize_phone (EContactEditor *editor) } static void -init_im_record_location (EContactEditor *editor, gint record) +init_im_record_location (EContactEditor *editor, + gint record) { #ifdef ENABLE_IM_LOCATION @@ -1658,7 +1686,8 @@ init_im_record_location (EContactEditor *editor, gint record) } static void -init_im_record_service (EContactEditor *editor, gint record) +init_im_record_service (EContactEditor *editor, + gint record) { GtkWidget *service_combo_box; GtkListStore *store; @@ -1914,6 +1943,7 @@ extract_im (EContactEditor *editor) g_free (service_attr_list); } + static void sensitize_im_types (EContactEditor *editor, GtkWidget *combo_box) { @@ -2109,7 +2139,8 @@ fill_in_address_label_textview (EContactEditor *editor, GtkWidget *textview; GtkTextBuffer *text_buffer; - textview_name = g_strdup_printf ("textview-%s-address", address_name [record]); + textview_name = g_strdup_printf ( + "textview-%s-address", address_name [record]); textview = e_builder_get_widget (editor->builder, textview_name); g_free (textview_name); @@ -2498,27 +2529,33 @@ init_simple_field (EContactEditor *editor, GtkWidget *widget) g_signal_connect_swapped ( widget, "activate", G_CALLBACK (entry_activated), editor); + } else if (GTK_IS_COMBO_BOX (widget)) { changed_object = G_OBJECT (widget); g_signal_connect_swapped ( gtk_bin_get_child (GTK_BIN (widget)), "activate", G_CALLBACK (entry_activated), editor); + } else if (GTK_IS_TEXT_VIEW (widget)) { changed_object = G_OBJECT ( gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget))); + } else if (E_IS_URL_ENTRY (widget)) { changed_object = G_OBJECT ( e_url_entry_get_entry (E_URL_ENTRY (widget))); g_signal_connect_swapped ( changed_object, "activate", G_CALLBACK (entry_activated), editor); + } else if (E_IS_DATE_EDIT (widget)) { changed_object = G_OBJECT (widget); + } else if (E_IS_IMAGE_CHOOSER (widget)) { changed_object = G_OBJECT (widget); g_signal_connect ( widget, "changed", G_CALLBACK (image_chooser_changed), editor); + } else if (GTK_IS_TOGGLE_BUTTON (widget)) { g_signal_connect ( widget, "toggled", @@ -2545,27 +2582,27 @@ fill_in_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id) gchar *text = e_contact_get (contact, field_id); gtk_entry_set_text (GTK_ENTRY (widget), STRING_MAKE_NON_NULL (text)); g_free (text); - } - else if (GTK_IS_COMBO_BOX (widget)) { + + } else if (GTK_IS_COMBO_BOX (widget)) { gchar *text = e_contact_get (contact, field_id); gtk_entry_set_text ( GTK_ENTRY (gtk_bin_get_child (GTK_BIN (widget))), STRING_MAKE_NON_NULL (text)); g_free (text); - } - else if (GTK_IS_TEXT_VIEW (widget)) { + + } else if (GTK_IS_TEXT_VIEW (widget)) { GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); gchar *text = e_contact_get (contact, field_id); gtk_text_buffer_set_text (buffer, STRING_MAKE_NON_NULL (text), -1); g_free (text); - } - else if (E_IS_URL_ENTRY (widget)) { + + } else if (E_IS_URL_ENTRY (widget)) { GtkWidget *entry = e_url_entry_get_entry (E_URL_ENTRY (widget)); gchar *text = e_contact_get (contact, field_id); gtk_entry_set_text (GTK_ENTRY (entry), STRING_MAKE_NON_NULL (text)); g_free (text); - } - else if (E_IS_DATE_EDIT (widget)) { + + } else if (E_IS_DATE_EDIT (widget)) { EContactDate *date = e_contact_get (contact, field_id); if (date) e_date_edit_set_date ( @@ -2575,8 +2612,8 @@ fill_in_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id) e_date_edit_set_time (E_DATE_EDIT (widget), -1); e_contact_date_free (date); - } - else if (E_IS_IMAGE_CHOOSER (widget)) { + + } else if (E_IS_IMAGE_CHOOSER (widget)) { EContactPhoto *photo = e_contact_get (contact, field_id); if (photo && photo->type == E_CONTACT_PHOTO_TYPE_INLINED) { e_image_chooser_set_image_data ( @@ -2597,13 +2634,13 @@ fill_in_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id) } editor->image_changed = FALSE; e_contact_photo_free (photo); - } - else if (GTK_IS_TOGGLE_BUTTON (widget)) { + + } else if (GTK_IS_TOGGLE_BUTTON (widget)) { gboolean val = e_contact_get (contact, field_id) != NULL; gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), val); - } - else { + + } else { g_warning (G_STRLOC ": Unhandled widget class in mappings!"); } @@ -2612,7 +2649,9 @@ fill_in_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id) } static void -extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id) +extract_simple_field (EContactEditor *editor, + GtkWidget *widget, + gint field_id) { EContact *contact; @@ -2621,15 +2660,14 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id) if (GTK_IS_ENTRY (widget)) { const gchar *text = gtk_entry_get_text (GTK_ENTRY (widget)); e_contact_set (contact, field_id, (gchar *) text); - } - else if (GTK_IS_COMBO_BOX_TEXT (widget)) { + + } else if (GTK_IS_COMBO_BOX_TEXT (widget)) { gchar *text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (widget)); e_contact_set (contact, field_id, text); g_free (text); - } - else if (GTK_IS_COMBO_BOX (widget)) { + } else if (GTK_IS_COMBO_BOX (widget)) { GtkTreeIter iter; gchar *text = NULL; @@ -2648,8 +2686,8 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id) e_contact_set (contact, field_id, text); g_free (text); - } - else if (GTK_IS_TEXT_VIEW (widget)) { + + } else if (GTK_IS_TEXT_VIEW (widget)) { GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); GtkTextIter start, end; gchar *text; @@ -2659,13 +2697,13 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id) text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE); e_contact_set (contact, field_id, text); g_free (text); - } - else if (E_IS_URL_ENTRY (widget)) { + + } else if (E_IS_URL_ENTRY (widget)) { GtkWidget *entry = e_url_entry_get_entry (E_URL_ENTRY (widget)); const gchar *text = gtk_entry_get_text (GTK_ENTRY (entry)); e_contact_set (contact, field_id, (gchar *) text); - } - else if (E_IS_DATE_EDIT (widget)) { + + } else if (E_IS_DATE_EDIT (widget)) { EContactDate date; if (e_date_edit_get_date ( E_DATE_EDIT (widget), @@ -2675,13 +2713,12 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id) e_contact_set (contact, field_id, &date); else e_contact_set (contact, field_id, NULL); - } - else if (E_IS_IMAGE_CHOOSER (widget)) { + + } else if (E_IS_IMAGE_CHOOSER (widget)) { EContactPhoto photo; photo.type = E_CONTACT_PHOTO_TYPE_INLINED; photo.data.inlined.mime_type = NULL; - if (editor->image_changed) - { + if (editor->image_changed) { gchar *img_buff = NULL; if (editor->image_set && e_image_chooser_get_image_data ( @@ -2739,8 +2776,7 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id) g_free (format_name); g_object_unref (new); } - } - else if (prompt_response == GTK_RESPONSE_CANCEL) { + } else if (prompt_response == GTK_RESPONSE_CANCEL) { g_object_unref (pixbuf); g_object_unref (loader); return; @@ -2755,19 +2791,19 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id) g_free (photo.data.inlined.data); - } - else { + } else { editor->image_changed = FALSE; e_contact_set (contact, E_CONTACT_PHOTO, NULL); } } - } - else if (GTK_IS_TOGGLE_BUTTON (widget)) { - gboolean val = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); - e_contact_set (contact, field_id, val?(gpointer) 1:NULL); - } - else { + } else if (GTK_IS_TOGGLE_BUTTON (widget)) { + gboolean val; + + val = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); + e_contact_set (contact, field_id, val ? (gpointer) 1 : NULL); + + } else { g_warning (G_STRLOC ": Unhandled widget class in mappings!"); } } @@ -2809,12 +2845,20 @@ init_simple (EContactEditor *editor) /* Update file_as */ widget = e_builder_get_widget (editor->builder, "entry-fullname"); - g_signal_connect (widget, "changed", G_CALLBACK (name_entry_changed), editor); + g_signal_connect ( + widget, "changed", + G_CALLBACK (name_entry_changed), editor); + widget = e_builder_get_widget (editor->builder, "combo-file-as"); gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (widget), 0); - g_signal_connect (widget, "changed", G_CALLBACK (file_as_combo_changed), editor); + g_signal_connect ( + widget, "changed", + G_CALLBACK (file_as_combo_changed), editor); + widget = e_builder_get_widget (editor->builder, "entry-company"); - g_signal_connect (widget, "changed", G_CALLBACK (company_entry_changed), editor); + g_signal_connect ( + widget, "changed", + G_CALLBACK (company_entry_changed), editor); } static void @@ -2836,7 +2880,8 @@ fill_in_simple (EContactEditor *editor) if (!widget) continue; - fill_in_simple_field (editor, widget, simple_field_map[i].field_id); + fill_in_simple_field ( + editor, widget, simple_field_map[i].field_id); } /* --- Special cases --- */ @@ -2860,9 +2905,9 @@ fill_in_simple (EContactEditor *editor) gtk_window_set_title (GTK_WINDOW (editor->app), title); g_free (title); g_free (filename); - } - else - gtk_window_set_title (GTK_WINDOW (editor->app), _("Contact Editor")); + } else + gtk_window_set_title ( + GTK_WINDOW (editor->app), _("Contact Editor")); /* Update file_as combo options */ @@ -2886,7 +2931,8 @@ extract_simple (EContactEditor *editor) if (!widget) continue; - extract_simple_field (editor, widget, simple_field_map[i].field_id); + extract_simple_field ( + editor, widget, simple_field_map[i].field_id); } /* Special cases */ @@ -2956,6 +3002,7 @@ static void init_all (EContactEditor *editor) { GtkRequisition tab_req; + GtkWidget *widget; init_simple (editor); init_email (editor); @@ -2966,11 +3013,13 @@ init_all (EContactEditor *editor) /* with so many scrolled windows, we need to * do some manual sizing */ - gtk_widget_get_preferred_size ( - e_builder_get_widget (editor->builder, "vbox-size-leader"), &tab_req, NULL); + widget = e_builder_get_widget (editor->builder, "vbox-size-leader"); + gtk_widget_get_preferred_size (widget, &tab_req, NULL); + + widget = e_builder_get_widget ( + editor->builder, "scrolledwindow-size-leader"), gtk_widget_set_size_request ( - e_builder_get_widget (editor->builder, "scrolledwindow-size-leader"), - tab_req.width, tab_req.height + 8); + widget, tab_req.width, tab_req.height + 8); } static void @@ -2983,13 +3032,14 @@ contact_editor_book_loaded_cb (GObject *source_object, EClient *client = NULL; GError *error = NULL; - if (!e_client_utils_open_new_finish (source, result, &client, &error)) - client = NULL; + e_client_utils_open_new_finish (source, result, &client, &error); if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { g_warn_if_fail (client == NULL); g_error_free (error); + goto exit; + } else if (error != NULL) { GtkWidget *source_combo_box; GtkWindow *parent; @@ -3005,24 +3055,26 @@ contact_editor_book_loaded_cb (GObject *source_object, E_SOURCE_COMBO_BOX (source_combo_box), source); g_error_free (error); - } else { - EBookClient *book_client; + goto exit; + } - book_client = E_BOOK_CLIENT (client); - g_return_if_fail (book_client != NULL); + g_return_if_fail (E_IS_CLIENT (client)); - /* FIXME Write a private contact_editor_set_target_client(). */ - g_object_set (editor, "target_client", book_client, NULL); + /* FIXME Write a private contact_editor_set_target_client(). */ + g_object_set (editor, "target_client", client, NULL); - g_object_unref (book_client); - } + g_object_unref (client); +exit: g_object_unref (editor); } static void -source_changed (ESourceComboBox *source_combo_box, EContactEditor *editor) +source_changed (ESourceComboBox *source_combo_box, + EContactEditor *editor) { + ESource *target_source; + ESource *source_source; ESource *source; GtkWindow *parent; @@ -3035,23 +3087,32 @@ source_changed (ESourceComboBox *source_combo_box, EContactEditor *editor) editor->cancellable = NULL; } - if (e_source_equal (e_client_get_source (E_CLIENT (editor->target_client)), source)) + target_source = e_client_get_source (E_CLIENT (editor->target_client)); + source_source = e_client_get_source (E_CLIENT (editor->source_client)); + + if (e_source_equal (target_source, source)) return; - if (e_source_equal (e_client_get_source (E_CLIENT (editor->source_client)), source)) { - g_object_set (editor, "target_client", editor->source_client, NULL); + if (e_source_equal (source_source, source)) { + g_object_set ( + editor, "target_client", + editor->source_client, NULL); return; } editor->cancellable = g_cancellable_new (); - e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, editor->cancellable, + e_client_utils_open_new ( + source, E_CLIENT_SOURCE_TYPE_CONTACTS, + FALSE, editor->cancellable, e_client_utils_authenticate_handler, parent, contact_editor_book_loaded_cb, g_object_ref (editor)); } static void -full_name_response (GtkDialog *dialog, gint response, EContactEditor *editor) +full_name_response (GtkDialog *dialog, + gint response, + EContactEditor *editor) { EContactName *name; GtkWidget *fname_widget; @@ -3065,13 +3126,19 @@ full_name_response (GtkDialog *dialog, gint response, EContactEditor *editor) style = file_as_get_style (editor); - fname_widget = e_builder_get_widget(editor->builder, "entry-fullname"); - if (fname_widget && GTK_IS_ENTRY (fname_widget)) { + fname_widget = e_builder_get_widget ( + editor->builder, "entry-fullname"); + + if (GTK_IS_ENTRY (fname_widget)) { + GtkEntry *entry; gchar *full_name = e_contact_name_to_string (name); - const gchar *old_full_name = gtk_entry_get_text (GTK_ENTRY (fname_widget)); + const gchar *old_full_name; + + entry = GTK_ENTRY (fname_widget); + old_full_name = gtk_entry_get_text (entry); if (strcmp (full_name, old_full_name)) - gtk_entry_set_text (GTK_ENTRY (fname_widget), full_name); + gtk_entry_set_text (entry, full_name); g_free (full_name); } @@ -3080,22 +3147,25 @@ full_name_response (GtkDialog *dialog, gint response, EContactEditor *editor) file_as_set_style (editor, style); } + gtk_widget_destroy (GTK_WIDGET (dialog)); editor->fullname_dialog = NULL; } static gint -full_name_editor_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) +full_name_editor_delete_event_cb (GtkWidget *widget, + GdkEvent *event, + gpointer data) { - if (widget) { - if (GTK_IS_WIDGET (widget)) - gtk_widget_destroy (widget); - } + if (GTK_IS_WIDGET (widget)) + gtk_widget_destroy (widget); + return TRUE; } static void -full_name_clicked (GtkWidget *button, EContactEditor *editor) +full_name_clicked (GtkWidget *button, + EContactEditor *editor) { GtkDialog *dialog; gboolean fullname_supported; @@ -3112,8 +3182,9 @@ full_name_clicked (GtkWidget *button, EContactEditor *editor) dialog, "editable", fullname_supported & editor->target_editable, NULL); - g_signal_connect(dialog, "response", - G_CALLBACK (full_name_response), editor); + g_signal_connect ( + dialog, "response", + G_CALLBACK (full_name_response), editor); /* Close the fullname dialog if the editor is closed */ g_signal_connect_swapped ( @@ -3125,7 +3196,9 @@ full_name_clicked (GtkWidget *button, EContactEditor *editor) } static void -categories_response (GtkDialog *dialog, gint response, EContactEditor *editor) +categories_response (GtkDialog *dialog, + gint response, + EContactEditor *editor) { const gchar *categories; GtkWidget *entry; @@ -3150,17 +3223,19 @@ categories_response (GtkDialog *dialog, gint response, EContactEditor *editor) } static gint -categories_editor_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) +categories_editor_delete_event_cb (GtkWidget *widget, + GdkEvent *event, + gpointer data) { - if (widget) { - if (GTK_IS_WIDGET (widget)) - gtk_widget_destroy (widget); - } + if (GTK_IS_WIDGET (widget)) + gtk_widget_destroy (widget); + return TRUE; } static void -categories_clicked (GtkWidget *button, EContactEditor *editor) +categories_clicked (GtkWidget *button, + EContactEditor *editor) { gchar *categories = NULL; GtkDialog *dialog; @@ -3211,9 +3286,12 @@ image_selected (EContactEditor *editor) image_chooser = e_builder_get_widget (editor->builder, "image-chooser"); - g_signal_handlers_block_by_func (image_chooser, image_chooser_changed, editor); - e_image_chooser_set_from_file (E_IMAGE_CHOOSER (image_chooser), file_name); - g_signal_handlers_unblock_by_func (image_chooser, image_chooser_changed, editor); + g_signal_handlers_block_by_func ( + image_chooser, image_chooser_changed, editor); + e_image_chooser_set_from_file ( + E_IMAGE_CHOOSER (image_chooser), file_name); + g_signal_handlers_unblock_by_func ( + image_chooser, image_chooser_changed, editor); editor->image_set = TRUE; editor->image_changed = TRUE; @@ -3247,7 +3325,9 @@ image_cleared (EContactEditor *editor) } static void -file_chooser_response (GtkWidget *widget, gint response, EContactEditor *editor) +file_chooser_response (GtkWidget *widget, + gint response, + EContactEditor *editor) { if (response == GTK_RESPONSE_ACCEPT) image_selected (editor); @@ -3265,7 +3345,8 @@ file_selector_deleted (GtkWidget *widget) } static void -update_preview_cb (GtkFileChooser *file_chooser, gpointer data) +update_preview_cb (GtkFileChooser *file_chooser, + gpointer data) { GtkWidget *preview; gchar *filename = NULL; @@ -3296,7 +3377,8 @@ update_preview_cb (GtkFileChooser *file_chooser, gpointer data) } static void -image_clicked (GtkWidget *button, EContactEditor *editor) +image_clicked (GtkWidget *button, + EContactEditor *editor) { const gchar *title = _("Please select an image for this contact"); const gchar *no_image = _("_No image"); @@ -3348,7 +3430,9 @@ typedef struct { } EditorCloseStruct; static void -contact_removed_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +contact_removed_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { EBookClient *book_client = E_BOOK_CLIENT (source_object); EditorCloseStruct *ecs = user_data; @@ -3388,7 +3472,10 @@ contact_removed_cb (GObject *source_object, GAsyncResult *result, gpointer user_ } static void -contact_added_cb (EBookClient *book_client, const GError *error, const gchar *id, gpointer closure) +contact_added_cb (EBookClient *book_client, + const GError *error, + const gchar *id, + gpointer closure) { EditorCloseStruct *ecs = closure; EContactEditor *ce = ecs->ce; @@ -3425,7 +3512,9 @@ contact_added_cb (EBookClient *book_client, const GError *error, const gchar *id } static void -contact_modified_cb (EBookClient *book_client, const GError *error, gpointer closure) +contact_modified_cb (EBookClient *book_client, + const GError *error, + gpointer closure) { EditorCloseStruct *ecs = closure; EContactEditor *ce = ecs->ce; @@ -3451,7 +3540,9 @@ contact_modified_cb (EBookClient *book_client, const GError *error, gpointer clo } static void -contact_modified_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +contact_modified_ready_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { EBookClient *book_client = E_BOOK_CLIENT (source_object); GError *error = NULL; @@ -3466,7 +3557,8 @@ contact_modified_ready_cb (GObject *source_object, GAsyncResult *result, gpointe /* Emits the signal to request saving a contact */ static void -real_save_contact (EContactEditor *ce, gboolean should_close) +real_save_contact (EContactEditor *ce, + gboolean should_close) { EditorCloseStruct *ecs; @@ -3501,10 +3593,13 @@ real_save_contact (EContactEditor *ce, gboolean should_close) } static void -save_contact (EContactEditor *ce, gboolean should_close) +save_contact (EContactEditor *ce, + gboolean should_close) { gchar *uid; - const gchar *name_entry_string, *file_as_entry_string, *company_name_string; + const gchar *name_entry_string; + const gchar *file_as_entry_string; + const gchar *company_name_string; GtkWidget *entry_fullname, *entry_file_as, *company_name; if (!ce->target_client) @@ -3528,9 +3623,13 @@ save_contact (EContactEditor *ce, gboolean should_close) if (strcmp (company_name_string , "")) { if (!strcmp (name_entry_string, "")) - gtk_entry_set_text (GTK_ENTRY (entry_fullname), company_name_string); + gtk_entry_set_text ( + GTK_ENTRY (entry_fullname), + company_name_string); if (!strcmp (file_as_entry_string, "")) - gtk_entry_set_text (GTK_ENTRY (entry_file_as), company_name_string); + gtk_entry_set_text ( + GTK_ENTRY (entry_file_as), + company_name_string); } extract_all (ce); @@ -3616,16 +3715,18 @@ e_contact_editor_is_valid (EABEditor *editor) widget = e_builder_get_widget (ce->builder, "dateedit-birthday"); if (!(e_date_edit_date_is_valid (E_DATE_EDIT (widget)))) { - g_string_append_printf (errmsg, _("'%s' has an invalid format"), - e_contact_pretty_name (E_CONTACT_BIRTH_DATE)); + g_string_append_printf ( + errmsg, _("'%s' has an invalid format"), + e_contact_pretty_name (E_CONTACT_BIRTH_DATE)); validation_error = TRUE; } widget = e_builder_get_widget (ce->builder, "dateedit-anniversary"); if (!(e_date_edit_date_is_valid (E_DATE_EDIT (widget)))) { - g_string_append_printf (errmsg, _("%s'%s' has an invalid format"), - validation_error ? ",\n" : "", - e_contact_pretty_name (E_CONTACT_ANNIVERSARY)); + g_string_append_printf ( + errmsg, _("%s'%s' has an invalid format"), + validation_error ? ",\n" : "", + e_contact_pretty_name (E_CONTACT_ANNIVERSARY)); validation_error = TRUE; } @@ -3635,20 +3736,24 @@ e_contact_editor_is_valid (EABEditor *editor) if (is_non_string_field (field_id)) { if (e_contact_get_const (ce->contact, field_id) == NULL) { - g_string_append_printf (errmsg, _("%s'%s' is empty"), - validation_error ? ",\n" : "", - e_contact_pretty_name (field_id)); + g_string_append_printf ( + errmsg, _("%s'%s' is empty"), + validation_error ? ",\n" : "", + e_contact_pretty_name (field_id)); validation_error = TRUE; break; } } else { - const gchar *text = e_contact_get_const (ce->contact, field_id); + const gchar *text; + + text = e_contact_get_const (ce->contact, field_id); if (STRING_IS_EMPTY (text)) { - g_string_append_printf (errmsg, _("%s'%s' is empty"), - validation_error ? ",\n" : "", - e_contact_pretty_name (field_id)); + g_string_append_printf ( + errmsg, _("%s'%s' is empty"), + validation_error ? ",\n" : "", + e_contact_pretty_name (field_id)); validation_error = TRUE; break; } @@ -3684,25 +3789,24 @@ e_contact_editor_get_window (EABEditor *editor) } static void -file_save_and_close_cb (GtkWidget *widget, gpointer data) +file_save_and_close_cb (GtkWidget *widget, + EContactEditor *ce) { - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); save_contact (ce, TRUE); } static void -file_cancel_cb (GtkWidget *widget, gpointer data) +file_cancel_cb (GtkWidget *widget, + EContactEditor *ce) { - EContactEditor *ce = E_CONTACT_EDITOR (data); - eab_editor_close (EAB_EDITOR (ce)); } /* Callback used when the dialog box is destroyed */ static gint -app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) +app_delete_event_cb (GtkWidget *widget, + GdkEvent *event, + gpointer data) { EContactEditor *ce; @@ -3833,7 +3937,8 @@ expand_phone_toggle (EContactEditor *ce) { GtkWidget *phone_ext_table; - phone_ext_table = e_builder_get_widget (ce->builder, "table-phone-extended"); + phone_ext_table = e_builder_get_widget ( + ce->builder, "table-phone-extended"); expand_phone (ce, !gtk_widget_get_visible (phone_ext_table)); } @@ -3879,7 +3984,8 @@ e_contact_editor_init (EContactEditor *e_contact_editor) setup_tab_order (builder); - e_contact_editor->app = e_builder_get_widget (builder, "contact editor"); + e_contact_editor->app = + e_builder_get_widget (builder, "contact editor"); widget = e_contact_editor->app; gtk_widget_ensure_style (widget); @@ -3948,11 +4054,13 @@ e_contact_editor_init (EContactEditor *e_contact_editor) widget, "clicked", G_CALLBACK (expand_mail_toggle), e_contact_editor); - widget = e_builder_get_widget (e_contact_editor->builder, "entry-fullname"); + widget = e_builder_get_widget ( + e_contact_editor->builder, "entry-fullname"); if (widget) gtk_widget_grab_focus (widget); - widget = e_builder_get_widget (e_contact_editor->builder, "entry-categories"); + widget = e_builder_get_widget ( + e_contact_editor->builder, "entry-categories"); completion = e_category_completion_new (); gtk_entry_set_completion (GTK_ENTRY (widget), completion); g_object_unref (completion); @@ -3964,7 +4072,8 @@ e_contact_editor_init (EContactEditor *e_contact_editor) G_CALLBACK (app_delete_event_cb), e_contact_editor); /* set the icon */ - gtk_window_set_icon_name (GTK_WINDOW (e_contact_editor->app), "contact-editor"); + gtk_window_set_icon_name ( + GTK_WINDOW (e_contact_editor->app), "contact-editor"); /* show window */ gtk_widget_show (e_contact_editor->app); @@ -3983,13 +4092,17 @@ e_contact_editor_dispose (GObject *object) } if (e_contact_editor->writable_fields) { - e_client_util_free_string_slist (e_contact_editor->writable_fields); + e_client_util_free_string_slist ( + e_contact_editor->writable_fields); e_contact_editor->writable_fields = NULL; } + if (e_contact_editor->required_fields) { - e_client_util_free_string_slist (e_contact_editor->required_fields); + e_client_util_free_string_slist ( + e_contact_editor->required_fields); e_contact_editor->required_fields = NULL; } + if (e_contact_editor->contact) { g_object_unref (e_contact_editor->contact); e_contact_editor->contact = NULL; @@ -4028,19 +4141,27 @@ e_contact_editor_dispose (GObject *object) } static void -supported_fields_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +supported_fields_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { EBookClient *book_client = E_BOOK_CLIENT (source_object); EContactEditor *ce = user_data; gchar *prop_value = NULL; GSList *fields; + gboolean success; GError *error = NULL; - if (!e_client_get_backend_property_finish (E_CLIENT (book_client), result, &prop_value, &error)) + success = e_client_get_backend_property_finish ( + E_CLIENT (book_client), result, &prop_value, &error); + + if (!success) prop_value = NULL; - if (error) { - g_debug ("%s: Failed to get supported fields: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to get supported fields: %s", + G_STRFUNC, error->message); g_error_free (error); } @@ -4065,19 +4186,27 @@ supported_fields_cb (GObject *source_object, GAsyncResult *result, gpointer user } static void -required_fields_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +required_fields_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { EBookClient *book_client = E_BOOK_CLIENT (source_object); EContactEditor *ce = user_data; gchar *prop_value = NULL; GSList *fields; + gboolean success; GError *error = NULL; - if (!e_client_get_backend_property_finish (E_CLIENT (book_client), result, &prop_value, &error)) + success = e_client_get_backend_property_finish ( + E_CLIENT (book_client), result, &prop_value, &error); + + if (!success) prop_value = NULL; - if (error) { - g_debug ("%s: Failed to get supported fields: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to get supported fields: %s", + G_STRFUNC, error->message); g_error_free (error); } @@ -4175,8 +4304,15 @@ e_contact_editor_set_property (GObject *object, editor->target_client, "notify::readonly", G_CALLBACK (notify_readonly_cb), editor); - e_client_get_backend_property (E_CLIENT (editor->target_client), BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS, NULL, supported_fields_cb, editor); - e_client_get_backend_property (E_CLIENT (editor->target_client), BOOK_BACKEND_PROPERTY_REQUIRED_FIELDS, NULL, required_fields_cb, editor); + e_client_get_backend_property ( + E_CLIENT (editor->target_client), + BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS, + NULL, supported_fields_cb, editor); + + e_client_get_backend_property ( + E_CLIENT (editor->target_client), + BOOK_BACKEND_PROPERTY_REQUIRED_FIELDS, + NULL, required_fields_cb, editor); } writable = !e_client_is_readonly (E_CLIENT (editor->target_client)); @@ -4202,7 +4338,9 @@ e_contact_editor_set_property (GObject *object, break; if (editor->target_client) { - g_signal_handler_disconnect (editor->target_client, editor->target_editable_id); + g_signal_handler_disconnect ( + editor->target_client, + editor->target_editable_id); g_object_unref (editor->target_client); } @@ -4213,8 +4351,15 @@ e_contact_editor_set_property (GObject *object, editor->target_client, "notify::readonly", G_CALLBACK (notify_readonly_cb), editor); - e_client_get_backend_property (E_CLIENT (editor->target_client), BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS, NULL, supported_fields_cb, editor); - e_client_get_backend_property (E_CLIENT (editor->target_client), BOOK_BACKEND_PROPERTY_REQUIRED_FIELDS, NULL, required_fields_cb, editor); + e_client_get_backend_property ( + E_CLIENT (editor->target_client), + BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS, + NULL, supported_fields_cb, editor); + + e_client_get_backend_property ( + E_CLIENT (editor->target_client), + BOOK_BACKEND_PROPERTY_REQUIRED_FIELDS, + NULL, required_fields_cb, editor); if (!editor->is_new_contact) editor->changed = TRUE; @@ -4235,7 +4380,8 @@ e_contact_editor_set_property (GObject *object, case PROP_CONTACT: if (editor->contact) g_object_unref (editor->contact); - editor->contact = e_contact_duplicate (E_CONTACT (g_value_get_object (value))); + editor->contact = e_contact_duplicate ( + E_CONTACT (g_value_get_object (value))); fill_in_all (editor); editor->changed = FALSE; break; @@ -4269,14 +4415,18 @@ e_contact_editor_set_property (GObject *object, if (editor->writable_fields) e_client_util_free_string_slist (editor->writable_fields); - editor->writable_fields = e_client_util_copy_string_slist (NULL, g_value_get_pointer (value)); + editor->writable_fields = + e_client_util_copy_string_slist ( + NULL, g_value_get_pointer (value)); sensitize_all (editor); break; case PROP_REQUIRED_FIELDS: if (editor->required_fields) e_client_util_free_string_slist (editor->required_fields); - editor->required_fields = e_client_util_copy_string_slist (NULL, g_value_get_pointer (value)); + editor->required_fields = + e_client_util_copy_string_slist ( + NULL, g_value_get_pointer (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c index 4de9060f60..0b33f8aa79 100644 --- a/addressbook/gui/contact-editor/e-contact-quick-add.c +++ b/addressbook/gui/contact-editor/e-contact-quick-add.c @@ -121,44 +121,51 @@ quick_add_set_vcard (QuickAdd *qa, const gchar *vcard) } static void -merge_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +merge_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ESource *source = E_SOURCE (source_object); QuickAdd *qa = user_data; EClient *client = NULL; GError *error = NULL; - if (!e_client_utils_open_new_finish (source, result, &client, &error)) - client = NULL; + e_client_utils_open_new_finish (source, result, &client, &error); /* Ignore cancellations. */ if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_warn_if_fail (client == NULL); g_error_free (error); return; } - if (!error) { - if (!e_client_is_readonly (client)) - eab_merging_book_add_contact (E_BOOK_CLIENT (client), qa->contact, NULL, NULL); - else - e_alert_run_dialog_for_args (e_shell_get_active_window (NULL), - "addressbook:error-read-only", - e_source_peek_name (e_client_get_source (client)), - NULL); - - if (qa->cb) - qa->cb (qa->contact, qa->closure); - g_object_unref (client); - } else { - /* Something went wrong. */ - if (client) - g_object_unref (client); + if (error != NULL) { + g_warn_if_fail (client == NULL); if (qa->cb) qa->cb (NULL, qa->closure); g_error_free (error); + quick_add_unref (qa); + return; } + g_return_if_fail (E_IS_CLIENT (client)); + + if (!e_client_is_readonly (client)) + eab_merging_book_add_contact ( + E_BOOK_CLIENT (client), qa->contact, NULL, NULL); + else + e_alert_run_dialog_for_args ( + e_shell_get_active_window (NULL), + "addressbook:error-read-only", + e_source_peek_name (source), + NULL); + + if (qa->cb) + qa->cb (qa->contact, qa->closure); + + g_object_unref (client); + quick_add_unref (qa); } @@ -172,7 +179,9 @@ quick_add_merge_contact (QuickAdd *qa) qa->cancellable = g_cancellable_new (); - e_client_utils_open_new (qa->source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, qa->cancellable, + e_client_utils_open_new ( + qa->source, E_CLIENT_SOURCE_TYPE_CONTACTS, + FALSE, qa->cancellable, e_client_utils_authenticate_handler, NULL, merge_cb, qa); } @@ -186,10 +195,11 @@ contact_added_cb (EContactEditor *ce, EContact *contact, gpointer closure) { - QuickAdd *qa = (QuickAdd *) g_object_get_data (G_OBJECT (ce), "quick_add"); + QuickAdd *qa; - if (qa) { + qa = g_object_get_data (G_OBJECT (ce), "quick_add"); + if (qa) { if (qa->cb) qa->cb (qa->contact, qa->closure); @@ -199,9 +209,12 @@ contact_added_cb (EContactEditor *ce, } static void -editor_closed_cb (GtkWidget *w, gpointer closure) +editor_closed_cb (GtkWidget *w, + gpointer closure) { - QuickAdd *qa = (QuickAdd *) g_object_get_data (G_OBJECT (w), "quick_add"); + QuickAdd *qa; + + qa = g_object_get_data (G_OBJECT (w), "quick_add"); if (qa) /* We don't need to unref qa because we set_data_full below */ @@ -252,46 +265,51 @@ ce_have_contact (EBookClient *book_client, G_OBJECT (contact_editor), "quick_add", qa, (GDestroyNotify) quick_add_unref); - g_signal_connect (contact_editor, - "contact_added", - G_CALLBACK (contact_added_cb), - NULL); - g_signal_connect (contact_editor, - "editor_closed", - G_CALLBACK (editor_closed_cb), - NULL); + g_signal_connect ( + contact_editor, "contact_added", + G_CALLBACK (contact_added_cb), NULL); + g_signal_connect ( + contact_editor, "editor_closed", + G_CALLBACK (editor_closed_cb), NULL); g_object_unref (book_client); } } static void -ce_have_book (GObject *source_object, GAsyncResult *result, gpointer user_data) +ce_have_book (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ESource *source = E_SOURCE (source_object); QuickAdd *qa = user_data; EClient *client = NULL; GError *error = NULL; - if (!e_client_utils_open_new_finish (source, result, &client, &error)) - client = NULL; + e_client_utils_open_new_finish (source, result, &client, &error); /* Ignore cancellations. */ if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_warn_if_fail (client == NULL); g_error_free (error); return; } - if (error) { - if (client) - g_object_unref (client); - g_warning ("Couldn't open local address book (%s).", error->message); + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "Couldn't open local address book (%s).", + error->message); quick_add_unref (qa); g_error_free (error); - } else { - eab_merging_book_find_contact (E_BOOK_CLIENT (client), qa->contact, ce_have_contact, qa); + return; } + + g_return_if_fail (E_IS_CLIENT (client)); + + eab_merging_book_find_contact ( + E_BOOK_CLIENT (client), qa->contact, ce_have_contact, qa); } static void @@ -304,7 +322,9 @@ edit_contact (QuickAdd *qa) qa->cancellable = g_cancellable_new (); - e_client_utils_open_new (qa->source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, qa->cancellable, + e_client_utils_open_new ( + qa->source, E_CLIENT_SOURCE_TYPE_CONTACTS, + FALSE, qa->cancellable, e_client_utils_authenticate_handler, NULL, ce_have_book, qa); } diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c index e1106a2fee..7ad6c124cc 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c +++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c @@ -187,7 +187,7 @@ contact_list_editor_notify_cb (EContactListEditor *editor, static gboolean contact_list_editor_add_destination (GtkWidget *widget, - EDestination *dest) + EDestination *dest) { EContactListEditor *editor = contact_list_editor_extract (widget); EContactListModel *model = E_CONTACT_LIST_MODEL (editor->priv->model); @@ -200,20 +200,26 @@ contact_list_editor_add_destination (GtkWidget *widget, const gchar *name = e_destination_get_name (dest); if (e_contact_list_model_has_uid (model, id)) { - if (e_alert_run_dialog_for_args (GTK_WINDOW (WIDGET (DIALOG)), - "addressbook:ask-list-add-list-exists", name, NULL) != GTK_RESPONSE_YES) + gint response; + + response = e_alert_run_dialog_for_args ( + GTK_WINDOW (WIDGET (DIALOG)), + "addressbook:ask-list-add-list-exists", + name, NULL); + if (response != GTK_RESPONSE_YES) return FALSE; } else { const GList *l_dests, *l_dest; gint reply; - /* Check the new list mail-by-mail for conflicts and eventually ask user what to do - with all conflicts */ + /* Check the new list mail-by-mail for conflicts and + * eventually ask user what to do with all conflicts. */ l_dests = e_destination_list_get_dests (dest); for (l_dest = l_dests; l_dest; l_dest = l_dest->next) { if (e_contact_list_model_has_email (model, e_destination_get_email (l_dest->data))) { - reply = e_alert_run_dialog_for_args (GTK_WINDOW (WIDGET (DIALOG)), - "addressbook:ask-list-add-some-mails-exist", NULL); + reply = e_alert_run_dialog_for_args ( + GTK_WINDOW (WIDGET (DIALOG)), + "addressbook:ask-list-add-some-mails-exist", NULL); if (reply == GTK_RESPONSE_YES) { ignore_conflicts = TRUE; break; @@ -237,7 +243,8 @@ contact_list_editor_add_destination (GtkWidget *widget, } /* always add to the root level */ - path = e_contact_list_model_add_destination (model, dest, NULL, ignore_conflicts); + path = e_contact_list_model_add_destination ( + model, dest, NULL, ignore_conflicts); if (path) { contact_list_editor_scroll_to_end (editor); gtk_tree_view_expand_to_path (treeview, path); @@ -268,7 +275,8 @@ contact_list_editor_add_email (EContactListEditor *editor, } g_object_unref (addr); - priv->changed = contact_list_editor_add_destination (WIDGET (DIALOG), dest) || priv->changed; + priv->changed = contact_list_editor_add_destination ( + WIDGET (DIALOG), dest) || priv->changed; contact_list_editor_update (editor); } @@ -292,6 +300,8 @@ contact_list_editor_book_loaded_cb (GObject *source_object, if (error != NULL) { GtkWindow *parent; + g_warn_if_fail (client == NULL); + parent = eab_editor_get_window (EAB_EDITOR (editor)); eab_load_error_dialog (GTK_WIDGET (parent), NULL, source, error); @@ -303,15 +313,16 @@ contact_list_editor_book_loaded_cb (GObject *source_object, goto exit; } + g_return_if_fail (E_IS_CLIENT (client)); + book_client = E_BOOK_CLIENT (client); - g_return_if_fail (E_IS_BOOK_CLIENT (book_client)); entry = E_NAME_SELECTOR_ENTRY (WIDGET (EMAIL_ENTRY)); contact_store = e_name_selector_entry_peek_contact_store (entry); e_contact_store_add_client (contact_store, book_client); e_contact_list_editor_set_client (editor, book_client); - g_object_unref (book_client); + g_object_unref (client); exit: g_object_unref (editor); @@ -905,9 +916,12 @@ contact_list_editor_source_menu_changed_cb (GtkWidget *widget) if (e_source_equal (e_client_get_source (E_CLIENT (editor->priv->book_client)), source)) return; - e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL, - e_client_utils_authenticate_handler, eab_editor_get_window (EAB_EDITOR (editor)), - contact_list_editor_book_loaded_cb, g_object_ref (editor)); + e_client_utils_open_new ( + source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL, + e_client_utils_authenticate_handler, + eab_editor_get_window (EAB_EDITOR (editor)), + contact_list_editor_book_loaded_cb, + g_object_ref (editor)); } gboolean @@ -1148,7 +1162,9 @@ setup_custom_widgets (EContactListEditor *editor) g_object_unref (source_list); if (error) { - g_debug ("%s: Failed to get sources: %s", G_STRFUNC, error->message); + g_warning ( + "%s: Failed to get sources: %s", + G_STRFUNC, error->message); g_error_free (error); } @@ -1650,7 +1666,7 @@ e_contact_list_editor_get_client (EContactListEditor *editor) void e_contact_list_editor_set_client (EContactListEditor *editor, - EBookClient *book_client) + EBookClient *book_client) { g_return_if_fail (E_IS_CONTACT_LIST_EDITOR (editor)); g_return_if_fail (E_IS_BOOK_CLIENT (book_client)); @@ -1659,7 +1675,8 @@ e_contact_list_editor_set_client (EContactListEditor *editor, g_object_unref (editor->priv->book_client); editor->priv->book_client = g_object_ref (book_client); - editor->priv->allows_contact_lists = e_client_check_capability (E_CLIENT (editor->priv->book_client), "contact-lists"); + editor->priv->allows_contact_lists = e_client_check_capability ( + E_CLIENT (editor->priv->book_client), "contact-lists"); contact_list_editor_update (editor); @@ -1667,7 +1684,10 @@ e_contact_list_editor_set_client (EContactListEditor *editor, } static void -save_contact_list (GtkTreeModel *model, GtkTreeIter *iter, GSList **attrs, gint *parent_id) +save_contact_list (GtkTreeModel *model, + GtkTreeIter *iter, + GSList **attrs, + gint *parent_id) { EDestination *dest; EVCardAttribute *attr; @@ -1704,7 +1724,6 @@ save_contact_list (GtkTreeModel *model, GtkTreeIter *iter, GSList **attrs, gint e_vcard_attribute_add_param_with_value (attr, e_vcard_attribute_param_new (EVC_PARENT_CL), pid_str); - *attrs = g_slist_prepend (*attrs, attr); g_object_unref (dest); @@ -1788,8 +1807,10 @@ e_contact_list_editor_set_contact (EContactListEditor *editor, /* The root destination */ EDestination *list_dest = e_destination_new (); - file_as = e_contact_get_const (priv->contact, E_CONTACT_FILE_AS); - show_addresses = GPOINTER_TO_INT (e_contact_get (priv->contact, E_CONTACT_LIST_SHOW_ADDRESSES)); + file_as = e_contact_get_const ( + priv->contact, E_CONTACT_FILE_AS); + show_addresses = GPOINTER_TO_INT (e_contact_get ( + priv->contact, E_CONTACT_LIST_SHOW_ADDRESSES)); if (file_as == NULL) file_as = ""; @@ -1810,7 +1831,9 @@ e_contact_list_editor_set_contact (EContactListEditor *editor, dests = e_destination_list_get_root_dests (list_dest); for (dest = dests; dest; dest = dest->next) { GtkTreePath *path; - path = e_contact_list_model_add_destination (E_CONTACT_LIST_MODEL (priv->model), dest->data, NULL, TRUE); + path = e_contact_list_model_add_destination ( + E_CONTACT_LIST_MODEL (priv->model), + dest->data, NULL, TRUE); gtk_tree_path_free (path); } diff --git a/addressbook/gui/contact-list-editor/e-contact-list-model.c b/addressbook/gui/contact-list-editor/e-contact-list-model.c index b94e8e79c3..e4eee15cb1 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-model.c +++ b/addressbook/gui/contact-list-editor/e-contact-list-model.c @@ -132,7 +132,7 @@ e_contact_list_model_has_email (EContactListModel *model, gboolean e_contact_list_model_has_uid (EContactListModel *model, - const gchar* uid) + const gchar *uid) { return (g_hash_table_lookup (model->priv->uids_table, uid) != NULL); } diff --git a/addressbook/gui/merging/eab-contact-compare.c b/addressbook/gui/merging/eab-contact-compare.c index 8295b77e7e..fd6ad8c012 100644 --- a/addressbook/gui/merging/eab-contact-compare.c +++ b/addressbook/gui/merging/eab-contact-compare.c @@ -573,7 +573,9 @@ match_search_info_free (MatchSearchInfo *info) } static void -query_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +query_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { MatchSearchInfo *info = (MatchSearchInfo *) user_data; EABContactMatchType best_match = EAB_CONTACT_MATCH_NONE; @@ -584,12 +586,21 @@ query_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) GError *error = NULL; const GSList *ii; - if (result && !e_book_client_get_contacts_finish (book_client, result, &contacts, &error)) { - g_debug ("%s: Failed to get contacts: %s\n", G_STRFUNC, error ? error->message : "Unknown error"); - if (error) - g_error_free (error); + if (result != NULL) + e_book_client_get_contacts_finish ( + book_client, result, &contacts, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to get contacts: %s\n", + G_STRFUNC, error->message); + g_error_free (error); + + info->cb ( + info->contact, NULL, + EAB_CONTACT_MATCH_NONE, + info->closure); - info->cb (info->contact, NULL, EAB_CONTACT_MATCH_NONE, info->closure); match_search_info_free (info); g_object_unref (book_client); return; @@ -751,10 +762,10 @@ book_loaded_cb (GObject *source_object, MatchSearchInfo *info = user_data; EClient *client = NULL; - if (!e_client_utils_open_new_finish (source, result, &client, NULL)) - client = NULL; + e_client_utils_open_new_finish (source, result, &client, NULL); - use_common_book_client (client ? E_BOOK_CLIENT (client): NULL, info); + /* Client may be NULL; don't use a type cast macro. */ + use_common_book_client ((EBookClient *) client, info); } void diff --git a/addressbook/gui/merging/eab-contact-merging.c b/addressbook/gui/merging/eab-contact-merging.c index 99bb2d39fb..557af481bb 100644 --- a/addressbook/gui/merging/eab-contact-merging.c +++ b/addressbook/gui/merging/eab-contact-merging.c @@ -96,7 +96,9 @@ finished_lookup (void) merging_queue = g_list_remove_link (merging_queue, merging_queue); running_merge_requests++; - eab_contact_locate_match_full (lookup->book_client, lookup->contact, lookup->avoid, match_query_callback, lookup); + eab_contact_locate_match_full ( + lookup->book_client, lookup->contact, + lookup->avoid, match_query_callback, lookup); } } @@ -112,7 +114,10 @@ free_lookup (EContactMergingLookup *lookup) } static void -final_id_cb (EBookClient *book_client, const GError *error, const gchar *id, gpointer closure) +final_id_cb (EBookClient *book_client, + const GError *error, + const gchar *id, + gpointer closure) { EContactMergingLookup *lookup = closure; @@ -125,12 +130,19 @@ final_id_cb (EBookClient *book_client, const GError *error, const gchar *id, gpo } static void -final_cb_as_id (EBookClient *book_client, const GError *error, gpointer closure) +final_cb_as_id (EBookClient *book_client, + const GError *error, + gpointer closure) { EContactMergingLookup *lookup = closure; if (lookup->id_cb) - lookup->id_cb (lookup->book_client, error, lookup->contact ? e_contact_get_const (lookup->contact, E_CONTACT_UID) : NULL, lookup->closure); + lookup->id_cb ( + lookup->book_client, error, + lookup->contact ? + e_contact_get_const ( + lookup->contact, E_CONTACT_UID) : NULL, + lookup->closure); free_lookup (lookup); @@ -138,7 +150,9 @@ final_cb_as_id (EBookClient *book_client, const GError *error, gpointer closure) } static void -final_cb (EBookClient *book_client, const GError *error, gpointer closure) +final_cb (EBookClient *book_client, + const GError *error, + gpointer closure) { EContactMergingLookup *lookup = closure; @@ -151,7 +165,9 @@ final_cb (EBookClient *book_client, const GError *error, gpointer closure) } static void -modify_contact_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +modify_contact_ready_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { EBookClient *book_client = E_BOOK_CLIENT (source_object); EContactMergingLookup *lookup = user_data; @@ -172,7 +188,9 @@ modify_contact_ready_cb (GObject *source_object, GAsyncResult *result, gpointer } static void -add_contact_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +add_contact_ready_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { EBookClient *book_client = E_BOOK_CLIENT (source_object); EContactMergingLookup *lookup = user_data; @@ -251,7 +269,9 @@ dropdown_changed (GtkWidget *dropdown, dropdown_data *data) } static void -remove_contact_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +remove_contact_ready_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { EBookClient *book_client = E_BOOK_CLIENT (source_object); EContactMergingLookup *lookup = user_data; @@ -262,12 +282,16 @@ remove_contact_ready_cb (GObject *source_object, GAsyncResult *result, gpointer e_book_client_remove_contact_finish (book_client, result, &error); - if (error) { - g_debug ("%s: Failed to remove contact: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to remove contact: %s", + G_STRFUNC, error->message); g_error_free (error); } - e_book_client_add_contact (book_client, lookup->contact, NULL, add_contact_ready_cb, lookup); + e_book_client_add_contact ( + book_client, lookup->contact, NULL, + add_contact_ready_cb, lookup); } static gint diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c index 497b8fe353..2a34ccf3c0 100644 --- a/addressbook/gui/widgets/e-addressbook-model.c +++ b/addressbook/gui/widgets/e-addressbook-model.c @@ -130,8 +130,11 @@ remove_book_view (EAddressbookModel *model) GError *error = NULL; e_book_client_view_stop (model->priv->client_view, &error); - if (error) { - g_debug ("%s: Failed to stop client view: %s", G_STRFUNC, error->message); + + if (error != NULL) { + g_warning ( + "%s: Failed to stop client view: %s", + G_STRFUNC, error->message); g_error_free (error); } @@ -166,7 +169,9 @@ update_folder_bar_message (EAddressbookModel *model) } static void -view_create_contact_cb (EBookClientView *client_view, const GSList *contact_list, EAddressbookModel *model) +view_create_contact_cb (EBookClientView *client_view, + const GSList *contact_list, + EAddressbookModel *model) { GPtrArray *array; guint count; @@ -198,7 +203,9 @@ sort_descending (gconstpointer ca, } static void -view_remove_contact_cb (EBookClientView *client_view, const GSList *ids, EAddressbookModel *model) +view_remove_contact_cb (EBookClientView *client_view, + const GSList *ids, + EAddressbookModel *model) { /* XXX we should keep a hash around instead of this O(n*m) loop */ const GSList *iter; @@ -252,7 +259,9 @@ view_remove_contact_cb (EBookClientView *client_view, const GSList *ids, EAddres } static void -view_modify_contact_cb (EBookClientView *client_view, const GSList *contact_list, EAddressbookModel *model) +view_modify_contact_cb (EBookClientView *client_view, + const GSList *contact_list, + EAddressbookModel *model) { GPtrArray *array; @@ -291,7 +300,10 @@ view_modify_contact_cb (EBookClientView *client_view, const GSList *contact_list } static void -view_progress_cb (EBookClientView *client_view, guint percent, const gchar *message, EAddressbookModel *model) +view_progress_cb (EBookClientView *client_view, + guint percent, + const gchar *message, + EAddressbookModel *model) { if (model->priv->remove_status_id) g_source_remove (model->priv->remove_status_id); @@ -301,7 +313,9 @@ view_progress_cb (EBookClientView *client_view, guint percent, const gchar *mess } static void -view_complete_cb (EBookClientView *client_view, const GError *error, EAddressbookModel *model) +view_complete_cb (EBookClientView *client_view, + const GError *error, + EAddressbookModel *model) { model->priv->search_in_progress = FALSE; view_progress_cb (client_view, -1, NULL, model); @@ -310,23 +324,30 @@ view_complete_cb (EBookClientView *client_view, const GError *error, EAddressboo } static void -readonly_cb (EBookClient *book_client, EAddressbookModel *model) +readonly_cb (EBookClient *book_client, + EAddressbookModel *model) { if (!model->priv->editable_set) { - model->priv->editable = !e_client_is_readonly (E_CLIENT (book_client)); + model->priv->editable = + !e_client_is_readonly (E_CLIENT (book_client)); - g_signal_emit (model, signals[WRITABLE_STATUS], 0, model->priv->editable); + g_signal_emit ( + model, signals[WRITABLE_STATUS], 0, + model->priv->editable); } } static void -backend_died_cb (EBookClient *book_client, EAddressbookModel *model) +backend_died_cb (EBookClient *book_client, + EAddressbookModel *model) { g_signal_emit (model, signals[BACKEND_DIED], 0); } static void -client_view_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +client_view_ready_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { EBookClient *book_client = E_BOOK_CLIENT (source_object); EBookClientView *client_view = NULL; @@ -372,8 +393,11 @@ client_view_ready_cb (GObject *source_object, GAsyncResult *result, gpointer use if (model->priv->client_view) { e_book_client_view_start (model->priv->client_view, &error); - if (error) { - g_debug ("%s: Failed to start client view: %s", G_STRFUNC, error->message); + + if (error != NULL) { + g_warning ( + "%s: Failed to start client view: %s", + G_STRFUNC, error->message); g_error_free (error); } } @@ -383,7 +407,7 @@ static gboolean addressbook_model_idle_cb (EAddressbookModel *model) { model->priv->client_view_idle_id = 0; - + if (model->priv->book_client && model->priv->query_str) { remove_book_view (model); @@ -826,7 +850,7 @@ e_addressbook_model_get_client (EAddressbookModel *model) void e_addressbook_model_set_client (EAddressbookModel *model, - EBookClient *book_client) + EBookClient *book_client) { g_return_if_fail (E_IS_ADDRESSBOOK_MODEL (model)); g_return_if_fail (E_IS_BOOK_CLIENT (book_client)); @@ -862,7 +886,8 @@ e_addressbook_model_set_client (EAddressbookModel *model, G_CALLBACK (backend_died_cb), model); if (!model->priv->editable_set) { - model->priv->editable = !e_client_is_readonly (E_CLIENT (book_client)); + model->priv->editable = + !e_client_is_readonly (E_CLIENT (book_client)); g_signal_emit ( model, signals[WRITABLE_STATUS], 0, model->priv->editable); diff --git a/addressbook/gui/widgets/e-addressbook-selector.c b/addressbook/gui/widgets/e-addressbook-selector.c index 954b1e19b9..b6bfa01537 100644 --- a/addressbook/gui/widgets/e-addressbook-selector.c +++ b/addressbook/gui/widgets/e-addressbook-selector.c @@ -104,15 +104,20 @@ merge_context_free (MergeContext *merge_context) } static void -addressbook_selector_removed_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +addressbook_selector_removed_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { EBookClient *book_client = E_BOOK_CLIENT (source_object); MergeContext *merge_context = user_data; GError *error = NULL; e_book_client_remove_contact_finish (book_client, result, &error); - if (error) { - g_debug ("%s: Failed to remove contact: %s", G_STRFUNC, error->message); + + if (error != NULL) { + g_warning ( + "%s: Failed to remove contact: %s", + G_STRFUNC, error->message); g_error_free (error); } @@ -252,7 +257,9 @@ addressbook_selector_constructed (GObject *object) } static void -target_client_open_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +target_client_open_ready_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ESource *source = E_SOURCE (source_object); MergeContext *merge_context = user_data; @@ -261,18 +268,24 @@ target_client_open_ready_cb (GObject *source_object, GAsyncResult *result, gpoin g_return_if_fail (merge_context != NULL); - if (!e_client_utils_open_new_finish (source, result, &client, &error)) - client = NULL; + e_client_utils_open_new_finish (source, result, &client, &error); - if (error) { - g_debug ("%s: Failed to open targer client: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open targer client: %s", + G_STRFUNC, error->message); g_error_free (error); } + g_return_if_fail (E_IS_CLIENT (client)); + merge_context->target_client = client ? E_BOOK_CLIENT (client) : NULL; if (!merge_context->target_client) { - g_slist_foreach (merge_context->remaining_contacts, (GFunc) g_object_unref, NULL); + g_slist_foreach ( + merge_context->remaining_contacts, + (GFunc) g_object_unref, NULL); g_slist_free (merge_context->remaining_contacts); merge_context_free (merge_context); diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 1de028c9fa..55310949b0 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -1266,9 +1266,9 @@ report_and_free_error_if_any (GError *error) } if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_PERMISSION_DENIED)) { - e_alert_run_dialog_for_args (e_shell_get_active_window (NULL), - "addressbook:contact-delete-error-perm", - NULL); + e_alert_run_dialog_for_args ( + e_shell_get_active_window (NULL), + "addressbook:contact-delete-error-perm", NULL); } else { eab_error_dialog (NULL, _("Failed to delete contact"), error); } @@ -1280,7 +1280,9 @@ report_and_free_error_if_any (GError *error) * which a user doesnt have write permission */ static void -remove_contacts_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +remove_contacts_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { EBookClient *book_client = E_BOOK_CLIENT (source_object); GError *error = NULL; @@ -1291,7 +1293,9 @@ remove_contacts_cb (GObject *source_object, GAsyncResult *result, gpointer user_ } static void -remove_contact_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +remove_contact_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { EBookClient *book_client = E_BOOK_CLIENT (source_object); GError *error = NULL; @@ -1415,13 +1419,17 @@ e_addressbook_view_delete_selection (EAddressbookView *view, gboolean is_delete) GSList *ids = NULL; for (l = list; l; l = g_slist_next (l)) { + const gchar *uid; + contact = l->data; - ids = g_slist_prepend (ids, (gpointer) e_contact_get_const (contact, E_CONTACT_UID)); + uid = e_contact_get_const (contact, E_CONTACT_UID); + ids = g_slist_prepend (ids, (gpointer) uid); } /* Remove the cards all at once. */ - e_book_client_remove_contacts (book_client, ids, NULL, remove_contacts_cb, NULL); + e_book_client_remove_contacts ( + book_client, ids, NULL, remove_contacts_cb, NULL); g_slist_free (ids); } else { @@ -1429,7 +1437,9 @@ e_addressbook_view_delete_selection (EAddressbookView *view, gboolean is_delete) contact = l->data; /* Remove the card. */ - e_book_client_remove_contact (book_client, contact, NULL, remove_contact_cb, NULL); + e_book_client_remove_contact ( + book_client, contact, NULL, + remove_contact_cb, NULL); } } @@ -1531,11 +1541,14 @@ struct TransferContactsData }; static void -all_contacts_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +all_contacts_ready_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { EBookClient *book_client = E_BOOK_CLIENT (source_object); struct TransferContactsData *tcd = user_data; EShellView *shell_view; + EShellContent *shell_content; EAlertSink *alert_sink; GSList *contacts = NULL; GError *error = NULL; @@ -1547,7 +1560,8 @@ all_contacts_ready_cb (GObject *source_object, GAsyncResult *result, gpointer us contacts = NULL; shell_view = e_addressbook_view_get_shell_view (tcd->view); - alert_sink = E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)); + shell_content = e_shell_view_get_shell_content (shell_view); + alert_sink = E_ALERT_SINK (shell_content); if (error) { e_alert_submit ( @@ -1555,7 +1569,9 @@ all_contacts_ready_cb (GObject *source_object, GAsyncResult *result, gpointer us error->message, NULL); g_error_free (error); } else if (contacts) { - eab_transfer_contacts (book_client, contacts, tcd->delete_from_source, alert_sink); + eab_transfer_contacts ( + book_client, contacts, + tcd->delete_from_source, alert_sink); } g_object_unref (tcd->view); @@ -1584,17 +1600,23 @@ view_transfer_contacts (EAddressbookView *view, tcd->delete_from_source = delete_from_source; tcd->view = g_object_ref (view); - e_book_client_get_contacts (book_client, query_str, NULL, all_contacts_ready_cb, tcd); + e_book_client_get_contacts ( + book_client, query_str, NULL, + all_contacts_ready_cb, tcd); } else { GSList *contacts = NULL; EShellView *shell_view; + EShellContent *shell_content; EAlertSink *alert_sink; shell_view = e_addressbook_view_get_shell_view (view); - alert_sink = E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)); + shell_content = e_shell_view_get_shell_content (shell_view); + alert_sink = E_ALERT_SINK (shell_content); + contacts = e_addressbook_view_get_selected (view); - eab_transfer_contacts (book_client, contacts, delete_from_source, alert_sink); + eab_transfer_contacts ( + book_client, contacts, delete_from_source, alert_sink); } } diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c index ab66e8d554..76516fc119 100644 --- a/addressbook/gui/widgets/eab-contact-display.c +++ b/addressbook/gui/widgets/eab-contact-display.c @@ -505,8 +505,8 @@ render_contact_list_row (GString *buffer, static void render_contact_list_vertical (GString *buffer, - EContact *contact, - EABContactDisplay *display) + EContact *contact, + EABContactDisplay *display) { EDestination *destination; const GList *dest, *dests; @@ -523,7 +523,7 @@ render_contact_list_vertical (GString *buffer, for (dest = dests; dest; dest = dest->next) { render_contact_list_row (buffer, dest->data, display); - } + } g_string_append (buffer, "</table>"); g_string_append (buffer, "</td></tr></table>"); @@ -533,8 +533,8 @@ render_contact_list_vertical (GString *buffer, static void render_contact_list_horizontal (GString *buffer, - EContact *contact, - EABContactDisplay *display) + EContact *contact, + EABContactDisplay *display) { EDestination *destination; const GList *dest, *dests; @@ -549,9 +549,8 @@ render_contact_list_horizontal (GString *buffer, "<tr><td with=" IMAGE_COL_WIDTH "></td><td>", _("List Members:")); g_string_append (buffer, "<table border=\"0\" cellspacing=\"1\">"); - for (dest = dests; dest; dest = dest->next) { + for (dest = dests; dest; dest = dest->next) render_contact_list_row (buffer, dest->data, display); - } g_string_append (buffer, "</table>"); g_string_append (buffer, "</td></tr></table>"); @@ -562,7 +561,7 @@ render_contact_list_horizontal (GString *buffer, static void render_contact_list (GString *buffer, EContact *contact, - EABContactDisplay *display) + EABContactDisplay *display) { if (display->priv->orientation == GTK_ORIENTATION_VERTICAL) diff --git a/addressbook/gui/widgets/eab-contact-display.h b/addressbook/gui/widgets/eab-contact-display.h index f7561f8779..610714800b 100644 --- a/addressbook/gui/widgets/eab-contact-display.h +++ b/addressbook/gui/widgets/eab-contact-display.h @@ -92,9 +92,11 @@ GtkOrientation eab_contact_display_get_orientation void eab_contact_display_set_orientation (EABContactDisplay *display, GtkOrientation orientation); - -gboolean eab_contact_display_get_show_maps (EABContactDisplay *display); -void eab_contact_display_set_show_maps (EABContactDisplay *display, gboolean display_maps); +gboolean eab_contact_display_get_show_maps + (EABContactDisplay *display); +void eab_contact_display_set_show_maps + (EABContactDisplay *display, + gboolean display_maps); G_END_DECLS diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c index 7b94c85233..d910b339b4 100644 --- a/addressbook/gui/widgets/eab-gui-util.c +++ b/addressbook/gui/widgets/eab-gui-util.c @@ -374,7 +374,9 @@ struct ContactCopyProcess_ { static void process_unref (ContactCopyProcess *process); static void -remove_contact_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +remove_contact_ready_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { EBookClient *book_client = E_BOOK_CLIENT (source_object); ContactCopyProcess *process = user_data; @@ -382,8 +384,10 @@ remove_contact_ready_cb (GObject *source_object, GAsyncResult *result, gpointer e_book_client_remove_contact_by_uid_finish (book_client, result, &error); - if (error) { - g_debug ("%s: Remove contact by uid failed: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Remove contact by uid failed: %s", + G_STRFUNC, error->message); g_error_free (error); } @@ -474,29 +478,33 @@ do_copy (gpointer data, gpointer user_data) } static void -book_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +book_loaded_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ESource *destination = E_SOURCE (source_object); ContactCopyProcess *process = user_data; EClient *client = NULL; - EBookClient *book_client; GError *error = NULL; - if (!e_client_utils_open_new_finish (destination, result, &client, &error)) - client = NULL; - - book_client = client ? E_BOOK_CLIENT (client) : NULL; + e_client_utils_open_new_finish (destination, result, &client, &error); - if (book_client != NULL) { - g_warn_if_fail (error == NULL); - process->destination = book_client; - process->book_status = TRUE; - g_slist_foreach (process->contacts, do_copy, process); - } else if (error != NULL) { - g_debug ("%s: Failed to open destination client: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open destination client: %s", + G_STRFUNC, error->message); g_error_free (error); + goto exit; } + g_return_if_fail (E_IS_CLIENT (client)); + + process->destination = E_BOOK_CLIENT (client); + process->book_status = TRUE; + g_slist_foreach (process->contacts, do_copy, process); + +exit: process_unref (process); } diff --git a/addressbook/importers/evolution-csv-importer.c b/addressbook/importers/evolution-csv-importer.c index 76607f342e..43e9339a81 100644 --- a/addressbook/importers/evolution-csv-importer.c +++ b/addressbook/importers/evolution-csv-importer.c @@ -716,7 +716,8 @@ getNextCSVEntry (CSVImporter *gci, FILE *f) { } static gboolean -csv_import_contacts (gpointer d) { +csv_import_contacts (gpointer d) +{ CSVImporter *gci = d; EContact *contact = NULL; @@ -855,16 +856,14 @@ book_loaded_cb (GObject *source_object, CSVImporter *gci = user_data; EClient *client = NULL; - if (!e_client_utils_open_new_finish (source, result, &client, NULL)) - client = NULL; - - gci->book_client = client ? E_BOOK_CLIENT (client) : NULL; + e_client_utils_open_new_finish (source, result, &client, NULL); - if (gci->book_client == NULL) { + if (client == NULL) { csv_import_done (gci); return; } + gci->book_client = E_BOOK_CLIENT (client); gci->idle_id = g_idle_add (csv_import_contacts, gci); } diff --git a/addressbook/importers/evolution-ldif-importer.c b/addressbook/importers/evolution-ldif-importer.c index 79d446cdaa..72776bf2a5 100644 --- a/addressbook/importers/evolution-ldif-importer.c +++ b/addressbook/importers/evolution-ldif-importer.c @@ -650,16 +650,14 @@ book_loaded_cb (GObject *source_object, LDIFImporter *gci = user_data; EClient *client = NULL; - if (!e_client_utils_open_new_finish (source, result, &client, NULL)) - client = NULL; + e_client_utils_open_new_finish (source, result, &client, NULL); - gci->book_client = client ? E_BOOK_CLIENT (client) : NULL; - - if (gci->book_client == NULL) { + if (client == NULL) { ldif_import_done (gci); return; } + gci->book_client = E_BOOK_CLIENT (client); gci->idle_id = g_idle_add (ldif_import_contacts, gci); } diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c index 09ad3d1f7f..59168d883b 100644 --- a/addressbook/importers/evolution-vcard-importer.c +++ b/addressbook/importers/evolution-vcard-importer.c @@ -486,16 +486,15 @@ book_loaded_cb (GObject *source_object, VCardImporter *gci = user_data; EClient *client = NULL; - if (!e_client_utils_open_new_finish (source, result, &client, NULL)) - client = NULL; + e_client_utils_open_new_finish (source, result, &client, NULL); - gci->book_client = client ? E_BOOK_CLIENT (client) : NULL; - - if (gci->book_client == NULL) { + if (client == NULL) { vcard_import_done (gci); return; } + gci->book_client = E_BOOK_CLIENT (client); + if (gci->encoding == VCARD_ENCODING_UTF16) { gchar *tmp; @@ -503,6 +502,7 @@ book_loaded_cb (GObject *source_object, tmp = utf16_to_utf8 (contents_utf16); g_free (gci->contents); gci->contents = tmp; + } else if (gci->encoding == VCARD_ENCODING_LOCALE) { gchar *tmp; tmp = g_locale_to_utf8 (gci->contents, -1, NULL, NULL, NULL); diff --git a/addressbook/printing/e-contact-print.c b/addressbook/printing/e-contact-print.c index 8057192f77..7719533fdd 100644 --- a/addressbook/printing/e-contact-print.c +++ b/addressbook/printing/e-contact-print.c @@ -410,8 +410,10 @@ view_complete (EBookClientView *client_view, g_return_if_fail (ctxt != NULL); e_book_client_view_stop (client_view, NULL); - g_signal_handlers_disconnect_by_func (client_view, G_CALLBACK (contacts_added), ctxt); - g_signal_handlers_disconnect_by_func (client_view, G_CALLBACK (view_complete), operation); + g_signal_handlers_disconnect_by_func ( + client_view, G_CALLBACK (contacts_added), ctxt); + g_signal_handlers_disconnect_by_func ( + client_view, G_CALLBACK (view_complete), operation); g_object_unref (client_view); @@ -780,7 +782,9 @@ contact_end_print (GtkPrintOperation *operation, } static void -get_view_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +get_view_ready_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { GtkPrintOperation *operation = user_data; EBookClient *book_client = E_BOOK_CLIENT (source_object); @@ -793,20 +797,28 @@ get_view_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_d ctxt = g_object_get_data (G_OBJECT (operation), "contact-print-ctx"); g_return_if_fail (ctxt != NULL); - if (error) { - g_debug ("%s: Failed to get view: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to get view: %s", + G_STRFUNC, error->message); g_error_free (error); gtk_print_operation_run (operation, ctxt->action, NULL, NULL); g_object_unref (operation); } else { - g_signal_connect (client_view, "objects-added", G_CALLBACK (contacts_added), ctxt); - g_signal_connect (client_view, "complete", G_CALLBACK (view_complete), operation); + g_signal_connect ( + client_view, "objects-added", + G_CALLBACK (contacts_added), ctxt); + g_signal_connect ( + client_view, "complete", + G_CALLBACK (view_complete), operation); e_book_client_view_start (client_view, &error); - if (error) { - g_debug ("%s: Failed to start view: %s\n", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to start view: %s", + G_STRFUNC, error->message); g_error_free (error); gtk_print_operation_run (operation, ctxt->action, NULL, NULL); @@ -834,7 +846,8 @@ e_contact_print (EBookClient *book_client, operation = e_print_operation_new (); gtk_print_operation_set_n_pages (operation, 1); - g_object_set_data_full (G_OBJECT (operation), "contact-print-ctx", ctxt, g_free); + g_object_set_data_full ( + G_OBJECT (operation), "contact-print-ctx", ctxt, g_free); g_signal_connect ( operation, "begin-print", @@ -849,7 +862,9 @@ e_contact_print (EBookClient *book_client, if (book_client) { gchar *query_str = e_book_query_to_string (query); - e_book_client_get_view (book_client, query_str, NULL, get_view_ready_cb, operation); + e_book_client_get_view ( + book_client, query_str, NULL, + get_view_ready_cb, operation); g_free (query_str); } else { diff --git a/addressbook/util/eab-book-util.c b/addressbook/util/eab-book-util.c index de6900d1d0..5c8d3350fd 100644 --- a/addressbook/util/eab-book-util.c +++ b/addressbook/util/eab-book-util.c @@ -31,7 +31,8 @@ /* Copied from camel_strstrcase */ static gchar * -eab_strstrcase (const gchar *haystack, const gchar *needle) +eab_strstrcase (const gchar *haystack, + const gchar *needle) { /* find the needle in the haystack neglecting case */ const gchar *ptr; @@ -132,7 +133,10 @@ eab_contact_list_to_string (const GSList *contacts) for (l = contacts; l; l = l->next) { EContact *contact = l->data; - gchar *vcard_str = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30); + gchar *vcard_str; + + vcard_str = e_vcard_to_string ( + E_VCARD (contact), EVC_FORMAT_VCARD_30); g_string_append (str, vcard_str); if (l->next) @@ -143,7 +147,9 @@ eab_contact_list_to_string (const GSList *contacts) } gboolean -eab_book_and_contact_list_from_string (const gchar *str, EBookClient **book_client, GSList **contacts) +eab_book_and_contact_list_from_string (const gchar *str, + EBookClient **book_client, + GSList **contacts) { const gchar *s0, *s1; gchar *uri; @@ -178,7 +184,8 @@ eab_book_and_contact_list_from_string (const gchar *str, EBookClient **book_clie } gchar * -eab_book_and_contact_list_to_string (EBookClient *book_client, const GSList *contacts) +eab_book_and_contact_list_to_string (EBookClient *book_client, + const GSList *contacts) { gchar *s0, *s1; @@ -187,7 +194,9 @@ eab_book_and_contact_list_to_string (EBookClient *book_client, const GSList *con s0 = g_strdup (""); if (book_client) - s1 = g_strconcat ("Book: ", e_client_get_uri (E_CLIENT (book_client)), "\r\n", s0, NULL); + s1 = g_strconcat ( + "Book: ", e_client_get_uri ( + E_CLIENT (book_client)), "\r\n", s0, NULL); else s1 = g_strdup (s0); @@ -197,7 +206,9 @@ eab_book_and_contact_list_to_string (EBookClient *book_client, const GSList *con /* bad place for this i know. */ gint -e_utf8_casefold_collate_len (const gchar *str1, const gchar *str2, gint len) +e_utf8_casefold_collate_len (const gchar *str1, + const gchar *str2, + gint len) { gchar *s1 = g_utf8_casefold (str1, len); gchar *s2 = g_utf8_casefold (str2, len); @@ -212,7 +223,8 @@ e_utf8_casefold_collate_len (const gchar *str1, const gchar *str2, gint len) } gint -e_utf8_casefold_collate (const gchar *str1, const gchar *str2) +e_utf8_casefold_collate (const gchar *str1, + const gchar *str2) { return e_utf8_casefold_collate_len (str1, str2, -1); } 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 diff --git a/capplet/settings/mail-account-view.c b/capplet/settings/mail-account-view.c index 0290cd739e..d1c5246702 100644 --- a/capplet/settings/mail-account-view.c +++ b/capplet/settings/mail-account-view.c @@ -413,20 +413,17 @@ setup_google_accounts (MailAccountView *mav) sgrp = e_source_list_ensure_group (slist, _("Google"), "google://", TRUE); sources = e_source_group_peek_sources (sgrp); - for (; sources; sources = sources->next) - { + for (; sources; sources = sources->next) { ESource *existing = (ESource*) sources->data; if (!g_strcmp0 (e_source_peek_relative_uri (existing), - mav->priv->username)) - { + mav->priv->username)) { source_already_exists = TRUE; break; } } - if (!source_already_exists) - { + if (!source_already_exists) { ESource *abook; gchar *rel_uri; diff --git a/capplet/settings/mail-capplet-shell.c b/capplet/settings/mail-capplet-shell.c index ebcb5cd355..75e2e11fff 100644 --- a/capplet/settings/mail-capplet-shell.c +++ b/capplet/settings/mail-capplet-shell.c @@ -313,10 +313,13 @@ setup_abooks (void) ESource *personal_source = NULL; GError *error = NULL; - if (!e_book_client_get_sources (&list, &error)) { - g_debug ("%s: Unable to get books: %s", G_STRFUNC, error ? error->message : "Unknown error"); - if (error) - g_error_free (error); + e_book_client_get_sources (&list, &error); + + if (error != NULL) { + g_warning ( + "%s: Unable to get books: %s", + G_STRFUNC, error->message); + g_error_free (error); return; } @@ -326,7 +329,8 @@ setup_abooks (void) GSList *g; gchar *base_dir, *base_uri; - base_dir = g_build_filename (e_get_user_data_dir (), "addressbook", "local", NULL); + base_dir = g_build_filename ( + e_get_user_data_dir (), "addressbook", "local", NULL); base_uri = g_filename_to_uri (base_dir, NULL, NULL); for (g = groups; g; g = g->next) { diff --git a/composer/e-composer-header-table.c b/composer/e-composer-header-table.c index c87abcf307..7fe1399dbe 100644 --- a/composer/e-composer-header-table.c +++ b/composer/e-composer-header-table.c @@ -997,7 +997,8 @@ composer_header_table_realize_cb (EComposerHeaderTable *table) g_return_if_fail (table != NULL); g_return_if_fail (table->priv != NULL); - g_signal_handlers_disconnect_by_func (table, composer_header_table_realize_cb, NULL); + g_signal_handlers_disconnect_by_func ( + table, composer_header_table_realize_cb, NULL); e_name_selector_load_books (table->priv->name_selector); } @@ -1078,7 +1079,9 @@ e_composer_header_table_init (EComposerHeaderTable *table) } /* postpone name_selector loading, do that only when really needed */ - g_signal_connect (table, "realize", G_CALLBACK (composer_header_table_realize_cb), NULL); + g_signal_connect ( + table, "realize", + G_CALLBACK (composer_header_table_realize_cb), NULL); } GtkWidget * diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 5b799309a6..6f608ab302 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -3934,22 +3934,27 @@ add_recipients (GList *list, const gchar *recips) } static gboolean -list_contains_addr (const GList *lst, EDestination *dest) +list_contains_addr (const GList *list, + EDestination *dest) { g_return_val_if_fail (dest != NULL, FALSE); - while (lst) { - if (e_destination_equal (dest, lst->data)) + while (list != NULL) { + if (e_destination_equal (dest, list->data)) return TRUE; - lst = lst->next; + list = list->next; } return FALSE; } static void -merge_cc_bcc (EDestination **addrv, GList **merge_into, const GList *to, const GList *cc, const GList *bcc) +merge_cc_bcc (EDestination **addrv, + GList **merge_into, + const GList *to, + const GList *cc, + const GList *bcc) { gint ii; @@ -3957,12 +3962,16 @@ merge_cc_bcc (EDestination **addrv, GList **merge_into, const GList *to, const G if (!list_contains_addr (to, addrv[ii]) && !list_contains_addr (cc, addrv[ii]) && !list_contains_addr (bcc, addrv[ii])) - *merge_into = g_list_append (*merge_into, g_object_ref (addrv[ii])); + *merge_into = g_list_append ( + *merge_into, g_object_ref (addrv[ii])); } } static void -merge_always_cc_and_bcc (EComposerHeaderTable *table, const GList *to, GList **cc, GList **bcc) +merge_always_cc_and_bcc (EComposerHeaderTable *table, + const GList *to, + GList **cc, + GList **bcc) { EDestination **addrv; @@ -3980,7 +3989,8 @@ merge_always_cc_and_bcc (EComposerHeaderTable *table, const GList *to, GList **c } static void -handle_mailto (EMsgComposer *composer, const gchar *mailto) +handle_mailto (EMsgComposer *composer, + const gchar *mailto) { EAttachmentView *view; EAttachmentStore *store; diff --git a/e-util/e-config.h b/e-util/e-config.h index f7484e7947..c2bdffb080 100644 --- a/e-util/e-config.h +++ b/e-util/e-config.h @@ -57,20 +57,20 @@ typedef struct _EConfigItem EConfigItem; typedef struct _EConfigFactory EConfigFactory; typedef struct _EConfigTarget EConfigTarget; -typedef void (*EConfigFactoryFunc) (EConfig *ec, +typedef void (*EConfigFactoryFunc) (EConfig *config, gpointer data); typedef gboolean - (*EConfigCheckFunc) (EConfig *ec, + (*EConfigCheckFunc) (EConfig *config, const gchar *pageid, gpointer data); -typedef void (*EConfigItemsFunc) (EConfig *ec, +typedef void (*EConfigItemsFunc) (EConfig *config, GSList *items, gpointer data); typedef GtkWidget * - (*EConfigItemFactoryFunc) (EConfig *ec, + (*EConfigItemFactoryFunc) (EConfig *config, EConfigItem *item, GtkWidget *parent, GtkWidget *old, @@ -170,7 +170,8 @@ enum _e_config_t { **/ struct _EConfigItem { enum _e_config_t type; - gchar *path; /* absolute path, must sort ascii-lexographically into the right spot */ + gchar *path; /* absolute path, must sort + * ascii-lexographically into the right spot */ gchar *label; EConfigItemFactoryFunc factory; gpointer user_data; @@ -257,35 +258,60 @@ struct _EConfigClass { void (*commit) (EConfig *config); }; -GType e_config_get_type (void); +GType e_config_get_type (void); /* Static class methods */ -EConfigFactory *e_config_class_add_factory (EConfigClass *klass, const gchar *id, EConfigFactoryFunc func, gpointer user_data); -void e_config_class_remove_factory (EConfigClass *klass, EConfigFactory *f); - -EConfig *e_config_construct (EConfig *, gint type, const gchar *id); - -void e_config_add_items (EConfig *, GSList *items, EConfigItemsFunc freefunc, gpointer data); -void e_config_add_page_check (EConfig *, const gchar *pageid, EConfigCheckFunc, gpointer data); -void e_config_set_page_is_finish (EConfig *ec, const gchar *pageid, gboolean is_finish); +EConfigFactory *e_config_class_add_factory (EConfigClass *klass, + const gchar *id, + EConfigFactoryFunc func, + gpointer user_data); +void e_config_class_remove_factory (EConfigClass *klass, + EConfigFactory *f); + +EConfig * e_config_construct (EConfig *config, + gint type, + const gchar *id); + +void e_config_add_items (EConfig *config, + GSList *items, + EConfigItemsFunc freefunc, + gpointer data); +void e_config_add_page_check (EConfig *config, + const gchar *pageid, + EConfigCheckFunc func, + gpointer data); +void e_config_set_page_is_finish (EConfig *config, + const gchar *pageid, + gboolean is_finish); -void e_config_set_target (EConfig *emp, EConfigTarget *target); -GtkWidget *e_config_create_widget (EConfig *); -GtkWidget *e_config_create_window (EConfig *emp, GtkWindow *parent, const gchar *title); +void e_config_set_target (EConfig *config, + EConfigTarget *target); +GtkWidget * e_config_create_widget (EConfig *config); +GtkWidget * e_config_create_window (EConfig *config, + GtkWindow *parent, + const gchar *title); -void e_config_target_changed (EConfig *emp, e_config_target_change_t how); +void e_config_target_changed (EConfig *config, + e_config_target_change_t how); -gboolean e_config_page_check (EConfig *, const gchar *); +gboolean e_config_page_check (EConfig *config, + const gchar *pageid); -GtkWidget *e_config_page_get (EConfig *ec, const gchar *pageid); -const gchar *e_config_page_next (EConfig *ec, const gchar *pageid); -const gchar *e_config_page_prev (EConfig *ec, const gchar *pageid); +GtkWidget * e_config_page_get (EConfig *config, + const gchar *pageid); +const gchar * e_config_page_next (EConfig *config, + const gchar *pageid); +const gchar * e_config_page_prev (EConfig *config, + const gchar *pageid); -void e_config_abort (EConfig *); -void e_config_commit (EConfig *); +void e_config_abort (EConfig *config); +void e_config_commit (EConfig *config); -gpointer e_config_target_new (EConfig *, gint type, gsize size); -void e_config_target_free (EConfig *, gpointer ); +gpointer e_config_target_new (EConfig *config, + gint type, + gsize size); +void e_config_target_free (EConfig *config, + gpointer); /* ********************************************************************** */ @@ -416,7 +442,9 @@ struct _EConfigHookClass { GType e_config_hook_get_type (void); /* for implementors */ -void e_config_hook_class_add_target_map (EConfigHookClass *klass, const EConfigHookTargetMap *); +void e_config_hook_class_add_target_map + (EConfigHookClass *klass, + const EConfigHookTargetMap *map); G_END_DECLS diff --git a/e-util/gconf-bridge.c b/e-util/gconf-bridge.c index 46bc1d7288..9b0e609560 100644 --- a/e-util/gconf-bridge.c +++ b/e-util/gconf-bridge.c @@ -734,15 +734,22 @@ window_binding_state_event_cb (GtkWindow *window, width and height is the one user stored before maximization */ gint width, height; - width = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "binding-premax-width")); - height = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "binding-premax-height")); + width = GPOINTER_TO_INT (g_object_get_data ( + G_OBJECT (window), "binding-premax-width")); + height = GPOINTER_TO_INT (g_object_get_data ( + G_OBJECT (window), "binding-premax-height")); if (width && height) { gtk_window_resize (window, width, height); - /* do this only once, as it is restore after loading maximized state */ - g_object_set_data (G_OBJECT (window), "binding-premax-width", NULL); - g_object_set_data (G_OBJECT (window), "binding-premax-height", NULL); + /* Do this only once, as it is restored + * after loading maximized state. */ + g_object_set_data ( + G_OBJECT (window), + "binding-premax-width", NULL); + g_object_set_data ( + G_OBJECT (window), + "binding-premax-height", NULL); } } @@ -861,16 +868,23 @@ gconf_bridge_bind_window (GConfBridge *bridge, if (maximized_val) { if (gconf_value_get_bool (maximized_val)) { - /* maximize is not done immediately, but to count with proper - window size, resize it before. The previous size is restored - after the maximization is changed, in window_binding_state_event_cb () - */ + /* Maximize is not done immediately, but to + * count with proper window size, resize it + * before. The previous size is restored + * after the maximization is changed, + * in window_binding_state_event_cb(). */ gint width = 0, height = 0; GdkScreen *screen; gtk_window_get_size (window, &width, &height); - g_object_set_data (G_OBJECT (window), "binding-premax-width", GINT_TO_POINTER (width)); - g_object_set_data (G_OBJECT (window), "binding-premax-height", GINT_TO_POINTER (height)); + g_object_set_data ( + G_OBJECT (window), + "binding-premax-width", + GINT_TO_POINTER (width)); + g_object_set_data ( + G_OBJECT (window), + "binding-premax-height", + GINT_TO_POINTER (height)); screen = gtk_window_get_screen (window); gtk_window_resize (window, diff --git a/em-format/em-format.c b/em-format/em-format.c index 1c2624f1f6..f1aea4b00d 100644 --- a/em-format/em-format.c +++ b/em-format/em-format.c @@ -1656,7 +1656,9 @@ emf_multipart_mixed (EMFormat *emf, } } -static gboolean related_display_part_is_attachment (EMFormat *emf, CamelMimePart *part); +static gboolean related_display_part_is_attachment + (EMFormat *emf, + CamelMimePart *part); /* RFC 1740 */ static void diff --git a/mail/e-mail-migrate.c b/mail/e-mail-migrate.c index 4dad4d15d7..7f3af7619f 100644 --- a/mail/e-mail-migrate.c +++ b/mail/e-mail-migrate.c @@ -1130,7 +1130,8 @@ change_sent_and_drafts_local_folders (EShellBackend *shell_backend) camel_url_free (url); - for (iter = e_list_get_iterator ((EList *) accounts); e_iterator_is_valid (iter); e_iterator_next (iter)) { + for (iter = e_list_get_iterator ((EList *) accounts); + e_iterator_is_valid (iter); e_iterator_next (iter)) { EAccount *account = (EAccount *) e_iterator_get (iter); const gchar *uri; @@ -1140,13 +1141,19 @@ change_sent_and_drafts_local_folders (EShellBackend *shell_backend) uri = e_account_get_string (account, E_ACCOUNT_DRAFTS_FOLDER_URI); if (g_strcmp0 (uri, drafts_uri) == 0 || g_strcmp0 (uri, old_drafts_uri) == 0) { changed = TRUE; - e_account_set_string (account, E_ACCOUNT_DRAFTS_FOLDER_URI, e_mail_local_get_folder_uri (E_MAIL_LOCAL_FOLDER_DRAFTS)); + e_account_set_string ( + account, E_ACCOUNT_DRAFTS_FOLDER_URI, + e_mail_local_get_folder_uri ( + E_MAIL_LOCAL_FOLDER_DRAFTS)); } uri = e_account_get_string (account, E_ACCOUNT_SENT_FOLDER_URI); - if (g_strcmp0 (uri, sent_uri) == 0 || g_strcmp0 (uri, old_sent_uri) == 0 ) { + if (g_strcmp0 (uri, sent_uri) == 0 || g_strcmp0 (uri, old_sent_uri) == 0) { changed = TRUE; - e_account_set_string (account, E_ACCOUNT_SENT_FOLDER_URI, e_mail_local_get_folder_uri (E_MAIL_LOCAL_FOLDER_SENT)); + e_account_set_string ( + account, E_ACCOUNT_SENT_FOLDER_URI, + e_mail_local_get_folder_uri ( + E_MAIL_LOCAL_FOLDER_SENT)); } } @@ -1299,7 +1306,7 @@ e_mail_migrate (EShellBackend *shell_backend, } #else if (major < 2 || (major == 2 && minor < 24)) - g_debug ( + g_warning ( "Upgrading from ancient versions %d.%d " "not supported on Windows", major, minor); #endif diff --git a/mail/e-mail-notebook-view.c b/mail/e-mail-notebook-view.c index c4e0ed3fd1..1d158fd398 100644 --- a/mail/e-mail-notebook-view.c +++ b/mail/e-mail-notebook-view.c @@ -374,7 +374,7 @@ adjust_label_size_request (GtkWidget *view, GtkWidget *label) { GtkRequisition requisition; - int max_width = allocation->width / 2; + gint max_width = allocation->width / 2; /* We make sure the label is not over-ellipisized, but doesn't * get too big to cause the tab to not fit either. */ diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index af137a2aac..adc5110851 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -56,8 +56,11 @@ struct _AsyncContext { EActivity *activity; CamelFolder *folder; EMailReader *reader; + CamelInternetAddress *address; gchar *message_uid; + EMailReplyType reply_type; + EMailReplyStyle reply_style; GtkPrintOperationAction print_action; const gchar *filter_source; gint filter_type; @@ -75,6 +78,9 @@ async_context_free (AsyncContext *context) if (context->reader != NULL) g_object_unref (context->reader); + if (context->address != NULL) + g_object_unref (context->address); + g_free (context->message_uid); g_slice_free (AsyncContext, context); @@ -776,58 +782,56 @@ html_contains_nonwhitespace (const gchar *html, return cp - html < len - 1 && uc != 0; } -struct GetSrcMessageData -{ - EMailReader *reader; - EMailReplyType reply_type; - EMailReplyStyle reply_style; - CamelFolder *folder; - gchar *message_uid; - CamelInternetAddress *address; -}; - static void -get_message_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +mail_reader_get_message_ready_cb (CamelFolder *folder, + GAsyncResult *result, + AsyncContext *context) { - CamelFolder *folder = CAMEL_FOLDER (source_object); - struct GetSrcMessageData *data = user_data; + EShell *shell; + EMailBackend *backend; + EAlertSink *alert_sink; + EMFormatHTML *formatter; CamelMimeMessage *message; GError *error = NULL; - g_return_if_fail (folder != NULL); - g_return_if_fail (result != NULL); - g_return_if_fail (data != NULL); - g_return_if_fail (data->folder == folder); + alert_sink = e_mail_reader_get_alert_sink (context->reader); message = camel_folder_get_message_finish (folder, result, &error); - if (message) { - EShell *shell; - EMailBackend *backend; - - backend = e_mail_reader_get_backend (data->reader); - shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend)); - em_utils_reply_to_message ( - shell, message, data->folder, data->message_uid, - data->reply_type, data->reply_style, EM_FORMAT (e_mail_reader_get_formatter (data->reader)), data->address); - } else if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { - EAlertSink *alert_sink; - - alert_sink = e_mail_reader_get_alert_sink (data->reader); + if (e_activity_handle_cancellation (context->activity, error)) { + g_warn_if_fail (message == NULL); + async_context_free (context); + g_error_free (error); + return; + } else if (error != NULL) { + g_warn_if_fail (message == NULL); e_alert_submit ( alert_sink, "mail:no-retrieve-message", error->message, NULL); + async_context_free (context); + g_error_free (error); + return; } - g_clear_error (&error); + g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message)); + + backend = e_mail_reader_get_backend (context->reader); + shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend)); + + formatter = e_mail_reader_get_formatter (context->reader); + + em_utils_reply_to_message ( + shell, message, + context->folder, context->message_uid, + context->reply_type, context->reply_style, + EM_FORMAT (formatter), context->address); + + g_object_unref (message); - g_object_unref (data->reader); - g_object_unref (data->folder); - g_free (data->message_uid); - if (data->address) - g_object_unref (data->address); - g_free (data); + e_activity_set_state (context->activity, E_ACTIVITY_COMPLETED); + + async_context_free (context); } void @@ -951,20 +955,28 @@ e_mail_reader_reply_to_message (EMailReader *reader, return; whole_message: - if (!src_message) { - struct GetSrcMessageData *data; + if (src_message == NULL) { + EActivity *activity; + AsyncContext *context; + GCancellable *cancellable; - data = g_new0 (struct GetSrcMessageData, 1); - data->reader = g_object_ref (reader); - data->reply_type = reply_type; - data->reply_style = reply_style; - data->folder = g_object_ref (folder); - data->message_uid = g_strdup (uid); - data->address = address; /* takes ownership of it, if set */ + activity = e_mail_reader_new_activity (reader); + cancellable = e_activity_get_cancellable (activity); + + context = g_slice_new0 (AsyncContext); + context->activity = activity; + context->folder = g_object_ref (folder); + context->reader = g_object_ref (reader); + context->address = address; /* takes ownership of it, if set */ + context->message_uid = g_strdup (uid); + context->reply_type = reply_type; + context->reply_style = reply_style; camel_folder_get_message ( - data->folder, data->message_uid, G_PRIORITY_DEFAULT, - NULL, get_message_ready_cb, data); + context->folder, context->message_uid, + G_PRIORITY_DEFAULT, cancellable, + (GAsyncReadyCallback) mail_reader_get_message_ready_cb, + context); return; } diff --git a/mail/e-mail-session-utils.c b/mail/e-mail-session-utils.c index 823852ed21..2922e3c69a 100644 --- a/mail/e-mail-session-utils.c +++ b/mail/e-mail-session-utils.c @@ -443,7 +443,9 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple, context->recipients, cancellable, &error); if (did_connect) - em_utils_disconnect_service_sync (service, error == NULL, cancellable, error ? NULL : &error); + em_utils_disconnect_service_sync ( + service, error == NULL, + cancellable, error ? NULL : &error); if (error != NULL) { g_simple_async_result_set_from_error (simple, error); diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index 3a391eae0e..a6a0ced595 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -1954,7 +1954,10 @@ emae_check_authtype_done (CamelService *camel_service, } else if (error != NULL) { g_warn_if_fail (auth_types == NULL); - e_alert_run_dialog_for_args (GTK_WINDOW (service->check_dialog), "mail:checking-service-error", error->message, NULL); + e_alert_run_dialog_for_args ( + GTK_WINDOW (service->check_dialog), + "mail:checking-service-error", + error->message, NULL); g_error_free (error); } else { @@ -1973,7 +1976,9 @@ emae_check_authtype_done (CamelService *camel_service, session = e_mail_backend_get_session (backend); /* drop the temporary CamelService */ - camel_session_remove_service (CAMEL_SESSION (session), camel_service_get_uid (camel_service)); + camel_session_remove_service ( + CAMEL_SESSION (session), + camel_service_get_uid (camel_service)); g_object_unref (service->emae); } @@ -2007,10 +2012,13 @@ emae_check_authtype (GtkWidget *w, session = e_mail_backend_get_session (backend); uid = g_strdup_printf ("emae-check-authtype-%p", service); - url_string = e_account_get_string (account, emae_service_info[service->type].account_uri_key); + url_string = e_account_get_string ( + account, emae_service_info[service->type].account_uri_key); /* to test on actual data, not on previously used */ - camel_service = camel_session_add_service (CAMEL_SESSION (session), uid, url_string, service->type, &error); + camel_service = camel_session_add_service ( + CAMEL_SESSION (session), uid, + url_string, service->type, &error); g_free (uid); @@ -2020,7 +2028,9 @@ emae_check_authtype (GtkWidget *w, parent = gtk_widget_get_toplevel (w); if (error) { - e_alert_run_dialog_for_args (parent, "mail:checking-service-error", error->message, NULL); + e_alert_run_dialog_for_args ( + parent, "mail:checking-service-error", + error->message, NULL); g_clear_error (&error); return; } @@ -2056,7 +2066,9 @@ emae_check_authtype (GtkWidget *w, } static void -emae_setup_service (EMAccountEditor *emae, EMAccountEditorService *service, GtkBuilder *builder) +emae_setup_service (EMAccountEditor *emae, + EMAccountEditorService *service, + GtkBuilder *builder) { EAccount *account; struct _service_info *info = &emae_service_info[service->type]; diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 529c9c5a1d..161eb5b613 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -593,17 +593,20 @@ composer_set_no_change (EMsgComposer *composer) /* delete original messages from Outbox folder */ static void -manage_x_evolution_replace_outbox (EMsgComposer *composer, CamelMimeMessage *message, GCancellable *cancellable) +manage_x_evolution_replace_outbox (EMsgComposer *composer, + CamelMimeMessage *message, + GCancellable *cancellable) { const gchar *message_uid; + const gchar *header; CamelFolder *outbox; g_return_if_fail (composer != NULL); - g_return_if_fail (message != NULL); g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message)); - message_uid = camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Replace-Outbox-UID"); - e_msg_composer_remove_header (composer, "X-Evolution-Replace-Outbox-UID"); + header = "X-Evolution-Replace-Outbox-UID"; + message_uid = camel_medium_get_header (CAMEL_MEDIUM (message), header); + e_msg_composer_remove_header (composer, header); if (!message_uid) return; @@ -617,7 +620,8 @@ manage_x_evolution_replace_outbox (EMsgComposer *composer, CamelMimeMessage *mes CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN); /* ignore errors here */ - camel_folder_synchronize_message_sync (outbox, message_uid, cancellable, NULL); + camel_folder_synchronize_message_sync ( + outbox, message_uid, cancellable, NULL); } static void @@ -717,7 +721,9 @@ composer_save_to_drafts_append_mail (AsyncContext *context, camel_message_info_set_flags ( info, CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_SEEN, ~0); - camel_medium_remove_header (CAMEL_MEDIUM (context->message), "X-Evolution-Replace-Outbox-UID"); + camel_medium_remove_header ( + CAMEL_MEDIUM (context->message), + "X-Evolution-Replace-Outbox-UID"); e_mail_folder_append_message ( drafts_folder, context->message, @@ -845,7 +851,9 @@ composer_save_to_outbox_completed (CamelFolder *outbox_folder, } /* special processing for Outbox folder */ - manage_x_evolution_replace_outbox (context->composer, context->message, e_activity_get_cancellable (context->activity)); + manage_x_evolution_replace_outbox ( + context->composer, context->message, + e_activity_get_cancellable (context->activity)); e_activity_set_state (context->activity, E_ACTIVITY_COMPLETED); @@ -2323,7 +2331,6 @@ get_reply_sender (CamelMimeMessage *message, { CamelInternetAddress *reply_to; CamelMedium *medium; - const gchar *name, *addr; const gchar *posthdr = NULL; medium = CAMEL_MEDIUM (message); @@ -2343,6 +2350,8 @@ get_reply_sender (CamelMimeMessage *message, reply_to = get_reply_to (message); if (reply_to != NULL) { + const gchar *name; + const gchar *addr; gint ii = 0; while (camel_internet_address_get (reply_to, ii++, &name, &addr)) @@ -2394,23 +2403,33 @@ get_reply_from (CamelMimeMessage *message, static void get_reply_recipient (CamelMimeMessage *message, - CamelInternetAddress *to, - CamelNNTPAddress *postto, - CamelInternetAddress *address) + CamelInternetAddress *to, + CamelNNTPAddress *postto, + CamelInternetAddress *address) { - const gchar *name, *addr, *posthdr; - gint i; - + CamelMedium *medium; + const gchar *posthdr = NULL; + + medium = CAMEL_MEDIUM (message); + /* check whether there is a 'Newsgroups: ' header in there */ - if (postto - && ((posthdr = camel_medium_get_header((CamelMedium *)message, "Followup-To")) - || (posthdr = camel_medium_get_header((CamelMedium *)message, "Newsgroups")))) { - camel_address_decode ((CamelAddress *)postto, posthdr); + if (postto != NULL && posthdr == NULL) + posthdr = camel_medium_get_header (medium, "Followup-To"); + + if (postto != NULL && posthdr == NULL) + posthdr = camel_medium_get_header (medium, "Newsgroups"); + + if (postto != NULL && posthdr != NULL) { + camel_address_decode (CAMEL_ADDRESS (postto), posthdr); return; } - if (address) { - for (i = 0; camel_internet_address_get (address, i, &name, &addr); i++) + if (address != NULL) { + const gchar *name; + const gchar *addr; + gint ii = 0; + + while (camel_internet_address_get (address, ii++, &name, &addr)) camel_internet_address_add (to, name, addr); } @@ -2439,17 +2458,22 @@ get_reply_all (CamelMimeMessage *message, CamelNNTPAddress *postto) { CamelInternetAddress *reply_to, *to_addrs, *cc_addrs; - const gchar *name, *addr, *posthdr; + CamelMedium *medium; + const gchar *name, *addr; + const gchar *posthdr = NULL; GHashTable *rcpt_hash; - gint i; + + medium = CAMEL_MEDIUM (message); /* check whether there is a 'Newsgroups: ' header in there */ - if (postto) { - if ((posthdr = camel_medium_get_header((CamelMedium *)message, "Followup-To"))) - camel_address_decode ((CamelAddress *) postto, posthdr); - if ((posthdr = camel_medium_get_header((CamelMedium *)message, "Newsgroups"))) - camel_address_decode ((CamelAddress *) postto, posthdr); - } + if (postto != NULL && posthdr == NULL) + posthdr = camel_medium_get_header (medium, "Followup-To"); + + if (postto != NULL && posthdr == NULL) + posthdr = camel_medium_get_header (medium, "Newsgroups"); + + if (postto != NULL && posthdr != NULL) + camel_address_decode (CAMEL_ADDRESS (postto), posthdr); rcpt_hash = em_utils_generate_account_hash (); @@ -2457,16 +2481,21 @@ get_reply_all (CamelMimeMessage *message, to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC); - if (reply_to) { - for (i = 0; camel_internet_address_get (reply_to, i, &name, &addr); i++) { - /* ignore references to the Reply-To address in the To and Cc lists */ - if (addr && !g_hash_table_lookup (rcpt_hash, addr)) { - /* In the case that we are doing a Reply-To-All, we do not want - to include the user's email address because replying to oneself - is kinda silly. */ + if (reply_to != NULL) { + gint ii = 0; + while (camel_internet_address_get (reply_to, ii++, &name, &addr)) { + /* Ignore references to the Reply-To address + * in the To and Cc lists. */ + if (addr && !g_hash_table_lookup (rcpt_hash, addr)) { + /* In the case we are doing a Reply-To-All, + * we do not want to include the user's email + * address because replying to oneself is + * kinda silly. */ camel_internet_address_add (to, name, addr); - g_hash_table_insert (rcpt_hash, (gchar *) addr, GINT_TO_POINTER (1)); + g_hash_table_insert ( + rcpt_hash, (gchar *) addr, + GINT_TO_POINTER (1)); } } } diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index 8a4077998d..65fa9e522f 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -680,7 +680,8 @@ attachment_load_finish (EAttachment *attachment, } static void -action_image_save_cb (GtkAction *actions, EMFormatHTMLDisplay *efhd) +action_image_save_cb (GtkAction *action, + EMFormatHTMLDisplay *efhd) { EWebView *web_view; EMFormat *emf; @@ -701,7 +702,8 @@ action_image_save_cb (GtkAction *actions, EMFormatHTMLDisplay *efhd) g_return_if_fail (emf->message != NULL); if (g_str_has_prefix (image_src, "cid:")) { - part = camel_mime_message_get_part_by_content_id (emf->message, image_src + 4); + part = camel_mime_message_get_part_by_content_id ( + emf->message, image_src + 4); g_return_if_fail (part != NULL); g_object_ref (part); @@ -710,7 +712,8 @@ action_image_save_cb (GtkAction *actions, EMFormatHTMLDisplay *efhd) CamelDataWrapper *dw; const gchar *filename; - image_stream = em_format_html_get_cached_image (EM_FORMAT_HTML (efhd), image_src); + image_stream = em_format_html_get_cached_image ( + EM_FORMAT_HTML (efhd), image_src); if (!image_stream) return; @@ -723,14 +726,17 @@ action_image_save_cb (GtkAction *actions, EMFormatHTMLDisplay *efhd) part = camel_mime_part_new (); if (filename) camel_mime_part_set_filename (part, filename); - + dw = camel_data_wrapper_new (); - camel_data_wrapper_set_mime_type (dw, "application/octet-stream"); - camel_data_wrapper_construct_from_stream_sync (dw, image_stream, NULL, NULL); + camel_data_wrapper_set_mime_type ( + dw, "application/octet-stream"); + camel_data_wrapper_construct_from_stream_sync ( + dw, image_stream, NULL, NULL); camel_medium_set_content (CAMEL_MEDIUM (part), dw); g_object_unref (dw); - camel_mime_part_set_encoding (part, CAMEL_TRANSFER_ENCODING_BASE64); + camel_mime_part_set_encoding ( + part, CAMEL_TRANSFER_ENCODING_BASE64); g_object_unref (image_stream); } @@ -755,7 +761,8 @@ action_image_save_cb (GtkAction *actions, EMFormatHTMLDisplay *efhd) } static void -efhd_web_view_update_actions_cb (EWebView *web_view, EMFormatHTMLDisplay *efhd) +efhd_web_view_update_actions_cb (EWebView *web_view, + EMFormatHTMLDisplay *efhd) { const gchar *image_src; gboolean visible; @@ -768,7 +775,8 @@ efhd_web_view_update_actions_cb (EWebView *web_view, EMFormatHTMLDisplay *efhd) if (!visible && image_src) { CamelStream *image_stream; - image_stream = em_format_html_get_cached_image (EM_FORMAT_HTML (efhd), image_src); + image_stream = em_format_html_get_cached_image ( + EM_FORMAT_HTML (efhd), image_src); visible = image_stream != NULL; if (image_stream) @@ -807,11 +815,14 @@ efhd_finalize (GObject *object) g_return_if_fail (efhd != NULL); if (efhd->priv->attachment_views) { - g_hash_table_foreach (efhd->priv->attachment_views, weak_unref_attachment_view_cb, efhd); + g_hash_table_foreach ( + efhd->priv->attachment_views, + weak_unref_attachment_view_cb, efhd); g_hash_table_destroy (efhd->priv->attachment_views); efhd->priv->attachment_views = NULL; } + /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -870,14 +881,17 @@ efhd_init (EMFormatHTMLDisplay *efhd) image_actions, image_entries, G_N_ELEMENTS (image_entries), efhd); + /* Because we are loading from a hard-coded string, there is + * no chance of I/O errors. Failure here implies a malformed + * UI definition. Full stop. */ ui_manager = e_web_view_get_ui_manager (web_view); gtk_ui_manager_add_ui_from_string (ui_manager, image_ui, -1, &error); + if (error != NULL) + g_error ("%s", error->message); - if (error) - g_debug ("%s: Failed to add image_ui: %s", G_STRFUNC, error->message); - g_clear_error (&error); - - g_signal_connect (web_view, "update-actions", G_CALLBACK (efhd_web_view_update_actions_cb), efhd); + g_signal_connect ( + web_view, "update-actions", + G_CALLBACK (efhd_web_view_update_actions_cb), efhd); } GType diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 745c275d8b..797f7194d9 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -3339,5 +3339,6 @@ em_format_html_get_cached_image (EMFormatHTML *efh, const gchar *image_uri) if (!emfh_http_cache) return NULL; - return camel_data_cache_get (emfh_http_cache, EMFH_HTTP_CACHE_PATH, image_uri, NULL); + return camel_data_cache_get ( + emfh_http_cache, EMFH_HTTP_CACHE_PATH, image_uri, NULL); } diff --git a/mail/em-format-html.h b/mail/em-format-html.h index 7704cb640a..d544201df0 100644 --- a/mail/em-format-html.h +++ b/mail/em-format-html.h @@ -311,7 +311,7 @@ void em_format_html_set_headers_collapsable gchar * em_format_html_format_cert_infos (CamelCipherCertInfo *first_cinfo); -CamelStream * em_format_html_get_cached_image (EMFormatHTML *efh, +CamelStream * em_format_html_get_cached_image (EMFormatHTML *efh, const gchar *image_uri); G_END_DECLS diff --git a/mail/em-utils.c b/mail/em-utils.c index a106a0ce04..33e664976b 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -1473,7 +1473,9 @@ struct TryOpenEBookStruct { }; static void -try_open_book_client_cb (GObject *source_object, GAsyncResult *result, gpointer closure) +try_open_book_client_cb (GObject *source_object, + GAsyncResult *result, + gpointer closure) { EBookClient *book_client = E_BOOK_CLIENT (source_object); struct TryOpenEBookStruct *data = (struct TryOpenEBookStruct *) closure; @@ -1502,7 +1504,10 @@ try_open_book_client_cb (GObject *source_object, GAsyncResult *result, gpointer * result FALSE. Otherwise returns same as e_client_open() */ static gboolean -try_open_book_client (EBookClient *book_client, gboolean only_if_exists, GCancellable *cancellable, GError **error) +try_open_book_client (EBookClient *book_client, + gboolean only_if_exists, + GCancellable *cancellable, + GError **error) { struct TryOpenEBookStruct data; gboolean canceled = FALSE; @@ -1512,7 +1517,9 @@ try_open_book_client (EBookClient *book_client, gboolean only_if_exists, GCancel data.flag = flag; data.result = FALSE; - e_client_open (E_CLIENT (book_client), only_if_exists, cancellable, try_open_book_client_cb, &data); + e_client_open ( + E_CLIENT (book_client), only_if_exists, + cancellable, try_open_book_client_cb, &data); while (canceled = camel_operation_cancel_check (NULL), !canceled && !e_flag_is_set (flag)) { @@ -1528,7 +1535,9 @@ try_open_book_client (EBookClient *book_client, gboolean only_if_exists, GCancel g_cancellable_cancel (cancellable); g_clear_error (error); - g_propagate_error (error, e_client_error_create (E_CLIENT_ERROR_CANCELLED, NULL)); + g_propagate_error ( + error, e_client_error_create ( + E_CLIENT_ERROR_CANCELLED, NULL)); } e_flag_wait (flag); @@ -2291,25 +2300,29 @@ em_utils_is_local_delivery_mbox_file (CamelURL *url) } static void -cancel_service_connect_cb (GCancellable *cancellable, CamelService *service) +cancel_service_connect_cb (GCancellable *cancellable, + CamelService *service) { - g_return_if_fail (service != NULL); g_return_if_fail (CAMEL_IS_SERVICE (service)); camel_service_cancel_connect (service); } gboolean -em_utils_connect_service_sync (CamelService *service, GCancellable *cancellable, GError **error) +em_utils_connect_service_sync (CamelService *service, + GCancellable *cancellable, + GError **error) { gboolean res; gulong handler_id = 0; - g_return_val_if_fail (service != NULL, FALSE); g_return_val_if_fail (CAMEL_IS_SERVICE (service), FALSE); - if (cancellable) - handler_id = g_cancellable_connect (cancellable, G_CALLBACK (cancel_service_connect_cb), service, NULL); + if (cancellable != NULL) + handler_id = g_cancellable_connect ( + cancellable, + G_CALLBACK (cancel_service_connect_cb), + service, NULL); res = camel_service_connect_sync (service, error); @@ -2320,16 +2333,21 @@ em_utils_connect_service_sync (CamelService *service, GCancellable *cancellable, } gboolean -em_utils_disconnect_service_sync (CamelService *service, gboolean clean, GCancellable *cancellable, GError **error) +em_utils_disconnect_service_sync (CamelService *service, + gboolean clean, + GCancellable *cancellable, + GError **error) { gboolean res; gulong handler_id = 0; - g_return_val_if_fail (service != NULL, FALSE); g_return_val_if_fail (CAMEL_IS_SERVICE (service), FALSE); - if (cancellable) - handler_id = g_cancellable_connect (cancellable, G_CALLBACK (cancel_service_connect_cb), service, NULL); + if (cancellable != NULL) + handler_id = g_cancellable_connect ( + cancellable, + G_CALLBACK (cancel_service_connect_cb), + service, NULL); res = camel_service_disconnect_sync (service, clean, error); diff --git a/mail/importers/pine-importer.c b/mail/importers/pine-importer.c index c75a78a332..9be96ba182 100644 --- a/mail/importers/pine-importer.c +++ b/mail/importers/pine-importer.c @@ -153,11 +153,14 @@ import_contact (EBookClient *book_client, gchar *line) if (strings[3] && strings[4]) e_contact_set (card, E_CONTACT_NOTE, strings[4]); - if (!e_book_client_add_contact_sync (book_client, card, &new_uid, NULL, &error)) { - g_debug ("%s: Failed to add contact: %s", G_STRFUNC, error ? error->message : "Unknown error"); - if (error) - g_error_free (error); - error = NULL; + e_book_client_add_contact_sync ( + book_client, card, &new_uid, NULL, &error); + + if (error != NULL) { + g_error ( + "%s: Failed to add contact: %s", + G_STRFUNC, error->message); + g_error_free (error); } else { g_free (new_uid); } @@ -181,11 +184,13 @@ import_contacts (void) printf("importing pine addressbook\n"); - if (!e_book_client_get_sources (&source_list, &error)) { - if (error) { - g_debug ("%s: Failed to get book sources: %s", G_STRFUNC, error->message); - g_error_free (error); - } + e_book_client_get_sources (&source_list, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to get book sources: %s", + G_STRFUNC, error->message); + g_error_free (error); return; } @@ -199,7 +204,7 @@ import_contacts (void) /* FIXME Better error handling */ if ((book_client = e_book_client_new (primary, &error)) == NULL) { fclose (fp); - g_warning ("Could not create EBook: %s", error ? error->message : "Unknown error"); + g_warning ("Could not create EBook: %s", error->message); if (error) g_error_free (error); return; @@ -210,7 +215,9 @@ import_contacts (void) g_object_unref (source_list); fclose (fp); - g_warning ("%s: Failed to open book client: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_warning ( + "%s: Failed to open book client: %s", + G_STRFUNC, error->message); if (error) g_error_free (error); return; diff --git a/mail/mail-ops.c b/mail/mail-ops.c index cf8453a953..1132271e08 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -339,7 +339,8 @@ fail: /* also disconnect if not a local delivery mbox; there is no need to keep the connection alive forever */ if (!is_local_delivery) - em_utils_disconnect_service_sync (CAMEL_SERVICE (m->store), TRUE, cancellable, NULL); + em_utils_disconnect_service_sync ( + CAMEL_SERVICE (m->store), TRUE, cancellable, NULL); } static void @@ -1597,7 +1598,8 @@ disconnect_service_exec (struct _disconnect_msg *m, GCancellable *cancellable, GError **error) { - em_utils_disconnect_service_sync (CAMEL_SERVICE (m->store), TRUE, cancellable, error); + em_utils_disconnect_service_sync ( + CAMEL_SERVICE (m->store), TRUE, cancellable, error); } static void diff --git a/mail/message-list.h b/mail/message-list.h index 6223c49ad8..f4a8150e1f 100644 --- a/mail/message-list.h +++ b/mail/message-list.h @@ -114,11 +114,12 @@ struct _MessageList { /* Current search string, or %NULL */ gchar *search; - /* which message uid should be left in the list even not in a search after rebuild; - rebuild will clear the value to NULL */ + /* which message uid should be left in the list even not in a + * search after rebuild; rebuild will clear the value to NULL */ gchar *ensure_uid; - /* are we regenerating the message_list because set_folder was just called? */ + /* are we regenerating the message_list because set_folder + * was just called? */ guint just_set_folder : 1; /* Are we displaying threaded view? */ diff --git a/modules/addressbook/e-book-shell-backend.c b/modules/addressbook/e-book-shell-backend.c index d80d9554a0..c52b39b9fa 100644 --- a/modules/addressbook/e-book-shell-backend.c +++ b/modules/addressbook/e-book-shell-backend.c @@ -86,9 +86,13 @@ book_shell_backend_ensure_sources (EShellBackend *shell_backend) priv = E_BOOK_SHELL_BACKEND (shell_backend)->priv; - if (!e_book_client_get_sources (&priv->source_list, &error)) { - g_warning ("Could not get addressbook sources: %s", error ? error->message : "Unknown error"); - g_clear_error (&error); + e_book_client_get_sources (&priv->source_list, &error); + + if (error != NULL) { + g_warning ( + "Could not get addressbook sources: %s", + error->message); + g_error_free (error); return; } @@ -156,68 +160,82 @@ book_shell_backend_init_importers (void) } static void -book_shell_backend_new_contact_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +book_shell_backend_new_contact_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); EShell *shell = user_data; EClient *client = NULL; + EContact *contact; + EABEditor *editor; 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); /* XXX Handle errors better. */ - if (client == NULL) { - g_debug ("%s: Failed to open book: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); - } else { - EBookClient *book_client = E_BOOK_CLIENT (client); - EContact *contact; - EABEditor *editor; + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open book: %s", + G_STRFUNC, error->message); + g_error_free (error); + goto exit; + } - contact = e_contact_new (); + g_return_if_fail (E_IS_CLIENT (client)); - editor = e_contact_editor_new ( - shell, book_client, contact, TRUE, TRUE); + contact = e_contact_new (); - eab_editor_show (editor); + editor = e_contact_editor_new ( + shell, E_BOOK_CLIENT (client), contact, TRUE, TRUE); - g_object_unref (contact); - g_object_unref (book_client); - } + eab_editor_show (editor); + + g_object_unref (contact); + g_object_unref (client); +exit: g_object_unref (shell); } static void -book_shell_backend_new_contact_list_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +book_shell_backend_new_contact_list_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); EShell *shell = user_data; EClient *client = NULL; + EContact *contact; + EABEditor *editor; 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); /* XXX Handle errors better. */ - if (client == NULL) { - g_debug ("%s: Failed to open book: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); - } else { - EBookClient *book_client = E_BOOK_CLIENT (client); - EContact *contact; - EABEditor *editor; + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open book: %s", + G_STRFUNC, error->message); + g_error_free (error); + goto exit; + } - contact = e_contact_new (); + g_return_if_fail (E_IS_CLIENT (client)); - editor = e_contact_list_editor_new ( - shell, book_client, contact, TRUE, TRUE); + contact = e_contact_new (); - eab_editor_show (editor); + editor = e_contact_list_editor_new ( + shell, E_BOOK_CLIENT (client), contact, TRUE, TRUE); - g_object_unref (contact); - g_object_unref (book_client); - } + eab_editor_show (editor); + + g_object_unref (contact); + g_object_unref (client); +exit: g_object_unref (shell); } diff --git a/modules/addressbook/e-book-shell-view-private.c b/modules/addressbook/e-book-shell-view-private.c index c9a233df9f..20fd278f66 100644 --- a/modules/addressbook/e-book-shell-view-private.c +++ b/modules/addressbook/e-book-shell-view-private.c @@ -184,40 +184,48 @@ contacts_removed (EBookShellView *book_shell_view, } static void -book_shell_view_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +book_shell_view_loaded_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ESource *source = E_SOURCE (source_object); EAddressbookView *view = user_data; EClient *client = NULL; - EBookClient *book; + EAddressbookModel *model; GError *error = NULL; - if (!e_client_utils_open_new_finish (source, result, &client, &error)) - client = NULL; - - book = client ? E_BOOK_CLIENT (client) : NULL; - - if (book != NULL) { - EAddressbookModel *model; + e_client_utils_open_new_finish (source, result, &client, &error); - g_warn_if_fail (error == NULL); - model = e_addressbook_view_get_model (view); - e_addressbook_model_set_client (model, book); - e_addressbook_model_force_folder_bar_message (model); + /* Ignore cancellations. */ + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_warn_if_fail (client == NULL); + g_error_free (error); + goto exit; - } else if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + } else if (error != NULL) { EShellView *shell_view; + EShellContent *shell_content; EAlertSink *alert_sink; + g_warn_if_fail (client == NULL); + shell_view = e_addressbook_view_get_shell_view (view); - alert_sink = E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)); + shell_content = e_shell_view_get_shell_content (shell_view); + alert_sink = E_ALERT_SINK (shell_content); eab_load_error_dialog (NULL, alert_sink, source, error); - } - if (error != NULL) g_error_free (error); + goto exit; + } + + g_return_if_fail (E_IS_CLIENT (client)); + + model = e_addressbook_view_get_model (view); + e_addressbook_model_set_client (model, E_BOOK_CLIENT (client)); + e_addressbook_model_force_folder_bar_message (model); +exit: g_object_unref (view); } @@ -260,9 +268,13 @@ book_shell_view_activate_selected_source (EBookShellView *book_shell_view, if (e_addressbook_model_get_client (model) == NULL) /* XXX No way to cancel this? */ - e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL, - e_client_utils_authenticate_handler, GTK_WINDOW (shell_window), - book_shell_view_loaded_cb, g_object_ref (view)); + e_client_utils_open_new ( + source, E_CLIENT_SOURCE_TYPE_CONTACTS, + FALSE, NULL, + e_client_utils_authenticate_handler, + GTK_WINDOW (shell_window), + book_shell_view_loaded_cb, + g_object_ref (view)); } else { /* Create a view for this UID. */ diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c index a2932a0d17..24a73f6d1a 100644 --- a/modules/calendar/e-cal-attachment-handler.c +++ b/modules/calendar/e-cal-attachment-handler.c @@ -141,10 +141,15 @@ attachment_handler_update_objects (ECalClient *client, return FALSE; } - success = e_cal_client_receive_objects_sync (client, vcalendar, NULL, &error); - if (error) - g_debug ("%s: Failed to receive objects: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + success = e_cal_client_receive_objects_sync ( + client, vcalendar, NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to receive objects: %s", + G_STRFUNC, error->message); + g_error_free (error); + } icalcomponent_free (vcalendar); @@ -152,8 +157,11 @@ attachment_handler_update_objects (ECalClient *client, } static void -attachment_handler_import_event (GObject *source_object, GAsyncResult *result, gpointer user_data) +attachment_handler_import_event (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); EAttachment *attachment = user_data; EClient *client = NULL; GError *error = NULL; @@ -161,15 +169,21 @@ attachment_handler_import_event (GObject *source_object, GAsyncResult *result, g icalcomponent *subcomponent; icalcompiter iter; - 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) { - g_debug ("%s: Failed to open '%s': %s", G_STRFUNC, e_source_peek_name (E_SOURCE (source_object)), error ? error->message : "Unknown error"); + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open '%s': %s", + G_STRFUNC, e_source_peek_name (source), + error->message); g_object_unref (attachment); + g_error_free (error); return; } + g_return_if_fail (E_IS_CLIENT (client)); + component = attachment_handler_get_component (attachment); g_return_if_fail (component != NULL); @@ -199,8 +213,11 @@ attachment_handler_import_event (GObject *source_object, GAsyncResult *result, g } static void -attachment_handler_import_todo (GObject *source_object, GAsyncResult *result, gpointer user_data) +attachment_handler_import_todo (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); EAttachment *attachment = user_data; EClient *client = NULL; GError *error = NULL; @@ -208,15 +225,21 @@ attachment_handler_import_todo (GObject *source_object, GAsyncResult *result, gp icalcomponent *subcomponent; icalcompiter iter; - 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) { - g_debug ("%s: Failed to open '%s': %s", G_STRFUNC, e_source_peek_name (E_SOURCE (source_object)), error ? error->message : "Unknown error"); + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open '%s': %s", + G_STRFUNC, e_source_peek_name (source), + error->message); g_object_unref (attachment); + g_error_free (error); return; } + g_return_if_fail (E_IS_CLIENT (client)); + component = attachment_handler_get_component (attachment); g_return_if_fail (component != NULL); @@ -270,8 +293,11 @@ attachment_handler_run_dialog (GtkWindow *parent, g_return_if_fail (component != NULL); e_cal_client_get_sources (&source_list, source_type, &error); + if (error != NULL) { - g_debug ("%s: Faield to get cal sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_warning ( + "%s: Failed to get cal sources: %s", + G_STRFUNC, error->message); g_clear_error (&error); return; } diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 744cd60b18..96077cf19e 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -95,11 +95,15 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend) shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - if (!e_cal_client_get_sources ( + e_cal_client_get_sources ( &cal_shell_backend->priv->source_list, - E_CAL_CLIENT_SOURCE_TYPE_EVENTS, &error)) { - g_debug ("%s: Could not get calendar sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + E_CAL_CLIENT_SOURCE_TYPE_EVENTS, &error); + + if (error != NULL) { + g_warning ( + "%s: Could not get calendar sources: %s", + G_STRFUNC, error->message); + g_error_free (error); return; } @@ -244,12 +248,15 @@ cal_shell_backend_new_event (ESource *source, GError *error = NULL; /* XXX Handle errors better. */ - if (!e_client_utils_open_new_finish (source, result, &client, &error)) - client = NULL; - - if (!client) { - g_debug ("%s: Failed to open '%s': %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); - g_clear_error (&error); + e_client_utils_open_new_finish (source, result, &client, &error); + + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open '%s': %s", + G_STRFUNC, e_source_peek_name (source), + error->message); + g_error_free (error); return; } @@ -279,7 +286,9 @@ cal_shell_backend_new_event (ESource *source, } static void -cal_shell_backend_event_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) +cal_shell_backend_event_new_cb (GObject *source_object, + GAsyncResult *result, + gpointer shell) { CompEditorFlags flags = 0; gboolean all_day = FALSE; @@ -287,13 +296,16 @@ cal_shell_backend_event_new_cb (GObject *source_object, GAsyncResult *result, gp flags |= COMP_EDITOR_NEW_ITEM; flags |= COMP_EDITOR_USER_ORG; - cal_shell_backend_new_event (E_SOURCE (source_object), result, shell, flags, all_day); + cal_shell_backend_new_event ( + E_SOURCE (source_object), result, shell, flags, all_day); g_object_unref (shell); } static void -cal_shell_backend_event_all_day_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) +cal_shell_backend_event_all_day_new_cb (GObject *source_object, + GAsyncResult *result, + gpointer shell) { CompEditorFlags flags = 0; gboolean all_day = TRUE; @@ -301,13 +313,16 @@ cal_shell_backend_event_all_day_new_cb (GObject *source_object, GAsyncResult *re flags |= COMP_EDITOR_NEW_ITEM; flags |= COMP_EDITOR_USER_ORG; - cal_shell_backend_new_event (E_SOURCE (source_object), result, shell, flags, all_day); + cal_shell_backend_new_event ( + E_SOURCE (source_object), result, shell, flags, all_day); g_object_unref (shell); } static void -cal_shell_backend_event_meeting_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) +cal_shell_backend_event_meeting_new_cb (GObject *source_object, + GAsyncResult *result, + gpointer shell) { CompEditorFlags flags = 0; gboolean all_day = FALSE; @@ -316,7 +331,8 @@ cal_shell_backend_event_meeting_new_cb (GObject *source_object, GAsyncResult *re flags |= COMP_EDITOR_USER_ORG; flags |= COMP_EDITOR_MEETING; - cal_shell_backend_new_event (E_SOURCE (source_object), result, shell, flags, all_day); + cal_shell_backend_new_event ( + E_SOURCE (source_object), result, shell, flags, all_day); g_object_unref (shell); } @@ -587,24 +603,36 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend, * we successfully open it is another matter... */ handled = TRUE; - if (!e_cal_client_get_sources (&source_list, source_type, &error)) { - g_debug ("%s: Could not get calendar sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + e_cal_client_get_sources (&source_list, source_type, &error); + + if (error != NULL) { + g_warning ( + "%s: Could not get calendar sources: %s", + G_STRFUNC, error->message); + g_error_free (error); goto exit; } source = e_source_list_peek_source_by_uid (source_list, source_uid); + if (source == NULL) { - g_debug ("%s: No source for UID '%s'", G_STRFUNC, source_uid); + g_warning ("%s: No source for UID '%s'", G_STRFUNC, source_uid); g_object_unref (source_list); goto exit; } client = e_cal_client_new (source, source_type, &error); - if (client == NULL || !e_client_open_sync (E_CLIENT (client), TRUE, NULL, &error)) { - g_debug ("%s: Failed to create/open client '%s': %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); - g_clear_error (&error); + + if (client != NULL) + e_client_open_sync (E_CLIENT (client), TRUE, NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to create/open client '%s': %s", + G_STRFUNC, e_source_peek_name (source), + error->message); g_object_unref (source_list); + g_error_free (error); goto exit; } @@ -616,16 +644,21 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend, if (editor != NULL) goto present; - if (!e_cal_client_get_object_sync (client, comp_uid, comp_rid, &icalcomp, NULL, &error)) { - g_debug ("%s: Failed to get object from client: %s", G_STRFUNC, error ? error->message : "Unknown error"); + e_cal_client_get_object_sync ( + client, comp_uid, comp_rid, &icalcomp, NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to get object from client: %s", + G_STRFUNC, error->message); g_object_unref (source_list); - g_clear_error (&error); + g_error_free (error); goto exit; } comp = e_cal_component_new (); if (!e_cal_component_set_icalcomponent (comp, icalcomp)) { - g_debug ("%s: Failed to set icalcomp to comp\n", G_STRFUNC); + g_warning ("%s: Failed to set icalcomp to comp\n", G_STRFUNC); icalcomponent_free (icalcomp); icalcomp = NULL; } diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index e296f6ff31..77c5639a78 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -165,7 +165,9 @@ cal_shell_sidebar_backend_error_cb (ECalShellSidebar *cal_shell_sidebar, } static void -cal_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +cal_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *client = E_CAL_CLIENT (source_object); ECalShellSidebar *cal_shell_sidebar = user_data; @@ -174,10 +176,12 @@ cal_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult * g_return_if_fail (client != NULL); g_return_if_fail (cal_shell_sidebar != 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); - cal_shell_sidebar_emit_status_message (cal_shell_sidebar, _("Loading calendars")); + cal_shell_sidebar_emit_status_message ( + cal_shell_sidebar, _("Loading calendars")); cal_shell_sidebar_emit_client_added (cal_shell_sidebar, client); cal_shell_sidebar_emit_status_message (cal_shell_sidebar, NULL); } @@ -205,15 +209,20 @@ free_retry_open_data (gpointer data) } static void -cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +cal_shell_sidebar_client_opened_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *client = E_CAL_CLIENT (source_object); ECalShellSidebar *cal_shell_sidebar = user_data; + ESource *source; EShellView *shell_view; EShellContent *shell_content; EShellSidebar *shell_sidebar; GError *error = NULL; + source = e_client_get_source (E_CLIENT (client)); + e_client_open_finish (E_CLIENT (client), result, &error); if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || @@ -227,7 +236,10 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result e_client_utils_forget_password (E_CLIENT (client)); if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_FAILED)) { - e_client_open (E_CLIENT (client), FALSE, cal_shell_sidebar->priv->loading_clients, cal_shell_sidebar_client_opened_cb, user_data); + e_client_open ( + E_CLIENT (client), FALSE, + cal_shell_sidebar->priv->loading_clients, + cal_shell_sidebar_client_opened_cb, user_data); g_clear_error (&error); return; @@ -242,7 +254,10 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result rod->cancellable = g_object_ref (cal_shell_sidebar->priv->loading_clients); /* postpone for 1/2 of a second, backend is busy now */ - g_timeout_add_full (G_PRIORITY_DEFAULT, 500, cal_shell_sidebar_retry_open_timeout_cb, rod, free_retry_open_data); + g_timeout_add_full ( + G_PRIORITY_DEFAULT, 500, + cal_shell_sidebar_retry_open_timeout_cb, + rod, free_retry_open_data); g_clear_error (&error); return; @@ -258,7 +273,10 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result break; case E_CLIENT_ERROR_BUSY: - g_debug ("%s: Cannot open '%s', it's busy (%s)", G_STRFUNC, e_source_peek_name (e_client_get_source (E_CLIENT (client))), error->message); + g_warning ( + "%s: Cannot open '%s', it's busy (%s)", + G_STRFUNC, e_source_peek_name (source), + error->message); g_clear_error (&error); return; @@ -287,7 +305,10 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result g_clear_error (&error); /* to have them ready for later use */ - e_client_retrieve_capabilities (E_CLIENT (client), NULL, cal_shell_sidebar_retrieve_capabilies_cb, cal_shell_sidebar); + e_client_retrieve_capabilities ( + E_CLIENT (client), NULL, + cal_shell_sidebar_retrieve_capabilies_cb, + cal_shell_sidebar); } static gboolean @@ -303,14 +324,21 @@ cal_shell_sidebar_retry_open_timeout_cb (gpointer user_data) if (g_cancellable_is_cancelled (rod->cancellable)) return FALSE; - e_client_open (rod->client, FALSE, rod->cal_shell_sidebar->priv->loading_clients, cal_shell_sidebar_client_opened_cb, rod->cal_shell_sidebar); + e_client_open ( + rod->client, FALSE, + rod->cal_shell_sidebar->priv->loading_clients, + cal_shell_sidebar_client_opened_cb, + rod->cal_shell_sidebar); return FALSE; } static void -cal_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +cal_shell_sidebar_default_loaded_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); EShellSidebar *shell_sidebar = user_data; ECalShellSidebarPrivate *priv; EShellContent *shell_content; @@ -322,21 +350,22 @@ cal_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resul priv = E_CAL_SHELL_SIDEBAR (shell_sidebar)->priv; - if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) - client = NULL; + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); + cal_shell_content = E_CAL_SHELL_CONTENT (shell_content); + model = e_cal_shell_content_get_model (cal_shell_content); + + e_client_utils_open_new_finish (source, result, &client, &error); + /* Ignore cancellations. */ if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_warn_if_fail (client == NULL); g_error_free (error); goto exit; - } - - shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_content = e_shell_view_get_shell_content (shell_view); - cal_shell_content = E_CAL_SHELL_CONTENT (shell_content); - model = e_cal_shell_content_get_model (cal_shell_content); - if (error != NULL) { + } else if (error != NULL) { + g_warn_if_fail (client == NULL); e_alert_submit ( E_ALERT_SINK (shell_content), "calendar:failed-open-calendar", @@ -352,7 +381,8 @@ cal_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resul priv->default_client = E_CAL_CLIENT (client); - e_cal_client_set_default_timezone (priv->default_client, e_cal_model_get_timezone (model)); + e_cal_client_set_default_timezone ( + priv->default_client, e_cal_model_get_timezone (model)); g_object_notify (G_OBJECT (shell_sidebar), "default-client"); @@ -401,9 +431,13 @@ cal_shell_sidebar_set_default (ECalShellSidebar *cal_shell_sidebar, priv->loading_default_client = g_cancellable_new (); - e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_EVENTS, FALSE, priv->loading_default_client, - e_client_utils_authenticate_handler, GTK_WINDOW (shell_window), - cal_shell_sidebar_default_loaded_cb, g_object_ref (shell_sidebar)); + e_client_utils_open_new ( + source, E_CLIENT_SOURCE_TYPE_EVENTS, + FALSE, priv->loading_default_client, + e_client_utils_authenticate_handler, + GTK_WINDOW (shell_window), + cal_shell_sidebar_default_loaded_cb, + g_object_ref (shell_sidebar)); } static void @@ -1064,7 +1098,9 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar, if (client == NULL) { client = e_cal_client_new (source, source_type, NULL); if (client) - g_signal_connect (client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL); + g_signal_connect ( + client, "authenticate", + G_CALLBACK (e_client_utils_authenticate_handler), NULL); } g_return_if_fail (client != NULL); @@ -1099,7 +1135,11 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar, timezone = e_cal_model_get_timezone (model); e_cal_client_set_default_timezone (client, timezone); - e_client_open (E_CLIENT (client), FALSE, cal_shell_sidebar->priv->loading_clients, cal_shell_sidebar_client_opened_cb, cal_shell_sidebar); + + e_client_open ( + E_CLIENT (client), FALSE, + cal_shell_sidebar->priv->loading_clients, + cal_shell_sidebar_client_opened_cb, cal_shell_sidebar); } void diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c index 6537cde8b4..f8b426c6f2 100644 --- a/modules/calendar/e-cal-shell-view-actions.c +++ b/modules/calendar/e-cal-shell-view-actions.c @@ -102,14 +102,19 @@ action_calendar_delete_cb (GtkAction *action, uri = e_source_get_uri (source); client = e_cal_model_get_client_for_uri (model, uri); if (client == NULL) - client = e_cal_client_new_from_uri (uri, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL); + client = e_cal_client_new_from_uri ( + uri, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL); g_free (uri); g_return_if_fail (client != NULL); - if (!e_client_remove_sync (E_CLIENT (client), NULL, &error)) { - g_debug ("%s: Failed to remove client: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + e_client_remove_sync (E_CLIENT (client), NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to remove client: %s", + G_STRFUNC, error->message); + g_error_free (error); return; } @@ -124,9 +129,14 @@ action_calendar_delete_cb (GtkAction *action, source_list = e_cal_shell_backend_get_source_list ( E_CAL_SHELL_BACKEND (shell_backend)); - if (!e_source_list_sync (source_list, &error)) { - g_debug ("%s: Failed to sync source list: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + + e_source_list_sync (source_list, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to sync source list: %s", + G_STRFUNC, error->message); + g_error_free (error); } } @@ -386,9 +396,14 @@ action_calendar_refresh_cb (GtkAction *action, g_return_if_fail (e_client_check_refresh_supported (E_CLIENT (client))); - if (!e_client_refresh_sync (E_CLIENT (client), NULL, &error)) { - g_debug ("%s: Failed to refresh '%s', %s\n", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); - g_clear_error (&error); + e_client_refresh_sync (E_CLIENT (client), NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to refresh '%s', %s", + G_STRFUNC, e_source_peek_name (source), + error->message); + g_error_free (error); } } @@ -515,12 +530,14 @@ action_event_copy_cb (GtkAction *action, ECalendarViewEvent *event = selected->data; if (is_comp_data_valid (event) && event->comp_data->client) - source_source = e_client_get_source (E_CLIENT (event->comp_data->client)); + source_source = e_client_get_source ( + E_CLIENT (event->comp_data->client)); } /* Get a destination source from the user. */ destination_source = select_source_dialog ( - GTK_WINDOW (shell_window), E_CAL_CLIENT_SOURCE_TYPE_EVENTS, source_source); + GTK_WINDOW (shell_window), + E_CAL_CLIENT_SOURCE_TYPE_EVENTS, source_source); if (destination_source == NULL) return; @@ -529,11 +546,17 @@ action_event_copy_cb (GtkAction *action, destination_source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL); if (destination_client == NULL) goto exit; - g_signal_connect (destination_client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL); + g_signal_connect ( + destination_client, "authenticate", + G_CALLBACK (e_client_utils_authenticate_handler), NULL); - if (!e_client_open_sync (E_CLIENT (destination_client), FALSE, NULL, &error)) { - g_debug ("%s: Failed to open destination client: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + e_client_open_sync (E_CLIENT (destination_client), FALSE, NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to open destination client: %s", + G_STRFUNC, error->message); + g_error_free (error); goto exit; } @@ -791,23 +814,32 @@ action_event_move_cb (GtkAction *action, ECalendarViewEvent *event = selected->data; if (is_comp_data_valid (event) && event->comp_data->client) - source_source = e_client_get_source (E_CLIENT (event->comp_data->client)); + source_source = e_client_get_source ( + E_CLIENT (event->comp_data->client)); } /* Get a destination source from the user. */ destination_source = select_source_dialog ( - GTK_WINDOW (shell_window), E_CAL_CLIENT_SOURCE_TYPE_EVENTS, source_source); + GTK_WINDOW (shell_window), + E_CAL_CLIENT_SOURCE_TYPE_EVENTS, source_source); if (destination_source == NULL) return; /* Open the destination calendar. */ - destination_client = e_cal_client_new (destination_source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL); + destination_client = e_cal_client_new ( + destination_source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL); if (destination_client == NULL) goto exit; - g_signal_connect (destination_client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL); + g_signal_connect ( + destination_client, "authenticate", + G_CALLBACK (e_client_utils_authenticate_handler), NULL); + + e_client_open_sync (E_CLIENT (destination_client), FALSE, NULL, &error); - if (!e_client_open_sync (E_CLIENT (destination_client), FALSE, NULL, &error)) { - g_debug ("%s: Failed to open destination client: %s", G_STRFUNC, error ? error->message : "Unknown error"); + if (error != NULL) { + g_warning ( + "%s: Failed to open destination client: %s", + G_STRFUNC, error->message); g_clear_error (&error); goto exit; } diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c index 01ae23cc1c..7a9fdaac69 100644 --- a/modules/calendar/e-cal-shell-view-private.c +++ b/modules/calendar/e-cal-shell-view-private.c @@ -933,12 +933,17 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view, } new_uid = NULL; - icalcomponent_foreach_tzid (icalcomp_clone, add_timezone_to_cal_cb, &ftd); + icalcomponent_foreach_tzid ( + icalcomp_clone, add_timezone_to_cal_cb, &ftd); success = e_cal_client_create_object_sync ( - destination_client, icalcomp_clone, &new_uid, NULL, &error); + destination_client, icalcomp_clone, + &new_uid, NULL, &error); if (!success) { icalcomponent_free (icalcomp_clone); - g_debug ("%s: Failed to create object: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_warning ( + "%s: Failed to create object: %s", + G_STRFUNC, error->message); + g_error_free (error); return; } @@ -962,10 +967,13 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view, else rid = NULL; e_cal_client_remove_object_sync ( - source_client, uid, rid, CALOBJ_MOD_ALL, NULL, NULL); + source_client, uid, rid, + CALOBJ_MOD_ALL, NULL, NULL); g_free (rid); } else - e_cal_client_remove_object_sync (source_client, uid, NULL, CALOBJ_MOD_THIS, NULL, NULL); + e_cal_client_remove_object_sync ( + source_client, uid, NULL, + CALOBJ_MOD_THIS, NULL, NULL); } } diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index 2249bf96e4..03914f1793 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -391,9 +391,13 @@ cal_shell_view_update_actions (EShellView *shell_view) itip_organizer_is_user (comp, client); is_delegatable = - e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED) && - (e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY) || - (!user_org && !is_delegated (icalcomp, user_email))); + e_client_check_capability ( + E_CLIENT (client), + CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED) && + (e_client_check_capability ( + E_CLIENT (client), + CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY) || + (!user_org && !is_delegated (icalcomp, user_email))); g_free (user_email); g_object_unref (comp); diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c index 2be78895f6..6f8070094e 100644 --- a/modules/calendar/e-memo-shell-backend.c +++ b/modules/calendar/e-memo-shell-backend.c @@ -84,11 +84,15 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend) shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - if (!e_cal_client_get_sources ( + e_cal_client_get_sources ( &memo_shell_backend->priv->source_list, - E_CAL_CLIENT_SOURCE_TYPE_MEMOS, &error)) { - g_debug ("%s: Could not get memo sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + E_CAL_CLIENT_SOURCE_TYPE_MEMOS, &error); + + if (error != NULL) { + g_warning ( + "%s: Could not get memo sources: %s", + G_STRFUNC, error->message); + g_error_free (error); return; } @@ -172,13 +176,16 @@ memo_shell_backend_new_memo (ESource *source, CompEditor *editor; GError *error = NULL; - if (!e_client_utils_open_new_finish (source, result, &client, &error)) - client = NULL; + e_client_utils_open_new_finish (source, result, &client, &error); /* XXX Handle errors better. */ - if (!client) { - g_debug ("%s: Failed to open '%s': %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); - g_clear_error (&error); + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open '%s': %s", + G_STRFUNC, e_source_peek_name (source), + error->message); + g_error_free (error); return; } @@ -197,19 +204,24 @@ memo_shell_backend_new_memo (ESource *source, } static void -memo_shell_backend_memo_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) +memo_shell_backend_memo_new_cb (GObject *source_object, + GAsyncResult *result, + gpointer shell) { CompEditorFlags flags = 0; flags |= COMP_EDITOR_NEW_ITEM; - memo_shell_backend_new_memo (E_SOURCE (source_object), result, shell, flags); + memo_shell_backend_new_memo ( + E_SOURCE (source_object), result, shell, flags); g_object_unref (shell); } static void -memo_shell_backend_memo_shared_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) +memo_shell_backend_memo_shared_new_cb (GObject *source_object, + GAsyncResult *result, + gpointer shell) { CompEditorFlags flags = 0; @@ -217,7 +229,8 @@ memo_shell_backend_memo_shared_new_cb (GObject *source_object, GAsyncResult *res flags |= COMP_EDITOR_IS_SHARED; flags |= COMP_EDITOR_USER_ORG; - memo_shell_backend_new_memo (E_SOURCE (source_object), result, shell, flags); + memo_shell_backend_new_memo ( + E_SOURCE (source_object), result, shell, flags); g_object_unref (shell); } @@ -379,8 +392,12 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend, * we successfully open it is another matter... */ handled = TRUE; - if (!e_cal_client_get_sources (&source_list, source_type, &error)) { - g_debug ("%s: Could not get memo sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); + e_cal_client_get_sources (&source_list, source_type, &error); + + if (error != NULL) { + g_warning ( + "%s: Could not get memo sources: %s", + G_STRFUNC, error->message); g_clear_error (&error); goto exit; } @@ -393,13 +410,20 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend, } client = e_cal_client_new (source, source_type, &error); - if (client) - g_signal_connect (client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL); - if (client == NULL || !e_client_open_sync (E_CLIENT (client), TRUE, NULL, &error)) { - g_debug ("%s: Failed to create/open client: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + if (client != NULL) { + g_signal_connect ( + client, "authenticate", + G_CALLBACK (e_client_utils_authenticate_handler), NULL); + e_client_open_sync (E_CLIENT (client), TRUE, NULL, &error); + } + + if (error != NULL) { + g_warning ( + "%s: Failed to create/open client: %s", + G_STRFUNC, error->message); g_object_unref (source_list); + g_error_free (error); goto exit; } @@ -411,16 +435,21 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend, if (editor != NULL) goto present; - if (!e_cal_client_get_object_sync (client, comp_uid, comp_rid, &icalcomp, NULL, &error)) { - g_debug ("%s: Failed to get object: %s", G_STRFUNC, error ? error->message : "Unknown error"); + e_cal_client_get_object_sync ( + client, comp_uid, comp_rid, &icalcomp, NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to get object: %s", + G_STRFUNC, error->message); g_object_unref (source_list); - g_clear_error (&error); + g_error_free (error); goto exit; } comp = e_cal_component_new (); if (!e_cal_component_set_icalcomponent (comp, icalcomp)) { - g_debug ("%s: Failed to set icalcomp to comp\n", G_STRFUNC); + g_warning ("%s: Failed to set icalcomp to comp\n", G_STRFUNC); icalcomponent_free (icalcomp); icalcomp = NULL; } diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index cf38c219b5..df9ea9a59a 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -160,7 +160,9 @@ memo_shell_sidebar_backend_error_cb (EMemoShellSidebar *memo_shell_sidebar, } static void -memo_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +memo_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *client = E_CAL_CLIENT (source_object); EMemoShellSidebar *memo_shell_sidebar = user_data; @@ -169,10 +171,12 @@ memo_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult g_return_if_fail (client != NULL); g_return_if_fail (memo_shell_sidebar != 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); - memo_shell_sidebar_emit_status_message (memo_shell_sidebar, _("Loading memos")); + memo_shell_sidebar_emit_status_message ( + memo_shell_sidebar, _("Loading memos")); memo_shell_sidebar_emit_client_added (memo_shell_sidebar, client); memo_shell_sidebar_emit_status_message (memo_shell_sidebar, NULL); } @@ -200,15 +204,20 @@ free_retry_open_data (gpointer data) } static void -memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +memo_shell_sidebar_client_opened_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *client = E_CAL_CLIENT (source_object); EMemoShellSidebar *memo_shell_sidebar = user_data; + ESource *source; EShellView *shell_view; EShellContent *shell_content; EShellSidebar *shell_sidebar; GError *error = NULL; + source = e_client_get_source (E_CLIENT (client)); + e_client_open_finish (E_CLIENT (client), result, &error); if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || @@ -222,7 +231,10 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul e_client_utils_forget_password (E_CLIENT (client)); if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_FAILED)) { - e_client_open (E_CLIENT (client), FALSE, memo_shell_sidebar->priv->loading_clients, memo_shell_sidebar_client_opened_cb, user_data); + e_client_open ( + E_CLIENT (client), FALSE, + memo_shell_sidebar->priv->loading_clients, + memo_shell_sidebar_client_opened_cb, user_data); g_clear_error (&error); return; } @@ -236,7 +248,10 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul rod->cancellable = g_object_ref (memo_shell_sidebar->priv->loading_clients); /* postpone for 1/2 of a second, backend is busy now */ - g_timeout_add_full (G_PRIORITY_DEFAULT, 500, memo_shell_sidebar_retry_open_timeout_cb, rod, free_retry_open_data); + g_timeout_add_full ( + G_PRIORITY_DEFAULT, 500, + memo_shell_sidebar_retry_open_timeout_cb, + rod, free_retry_open_data); g_clear_error (&error); return; @@ -252,7 +267,10 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul break; case E_CLIENT_ERROR_BUSY: - g_debug ("%s: Cannot open '%s', it's busy (%s)", G_STRFUNC, e_source_peek_name (e_client_get_source (E_CLIENT (client))), error->message); + g_warning ( + "%s: Cannot open '%s', it's busy (%s)", + G_STRFUNC, e_source_peek_name (source), + error->message); g_clear_error (&error); return; @@ -281,7 +299,10 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul g_clear_error (&error); /* to have them ready for later use */ - e_client_retrieve_capabilities (E_CLIENT (client), NULL, memo_shell_sidebar_retrieve_capabilies_cb, memo_shell_sidebar); + e_client_retrieve_capabilities ( + E_CLIENT (client), NULL, + memo_shell_sidebar_retrieve_capabilies_cb, + memo_shell_sidebar); } static gboolean @@ -297,14 +318,21 @@ memo_shell_sidebar_retry_open_timeout_cb (gpointer user_data) if (g_cancellable_is_cancelled (rod->cancellable)) return FALSE; - e_client_open (rod->client, FALSE, rod->memo_shell_sidebar->priv->loading_clients, memo_shell_sidebar_client_opened_cb, rod->memo_shell_sidebar); + e_client_open ( + rod->client, FALSE, + rod->memo_shell_sidebar->priv->loading_clients, + memo_shell_sidebar_client_opened_cb, + rod->memo_shell_sidebar); return FALSE; } static void -memo_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +memo_shell_sidebar_default_loaded_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); EShellSidebar *shell_sidebar = user_data; EMemoShellSidebarPrivate *priv; EShellContent *shell_content; @@ -316,21 +344,22 @@ memo_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu priv = E_MEMO_SHELL_SIDEBAR (shell_sidebar)->priv; - if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) - client = NULL; + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); + memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content); + model = e_memo_shell_content_get_memo_model (memo_shell_content); + + e_client_utils_open_new_finish (source, result, &client, &error); + /* Ignore cancellations. */ if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_warn_if_fail (client == NULL); g_error_free (error); goto exit; - } - - shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_content = e_shell_view_get_shell_content (shell_view); - memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content); - model = e_memo_shell_content_get_memo_model (memo_shell_content); - if (error != NULL) { + } else if (error != NULL) { + g_warn_if_fail (client == NULL); e_alert_submit ( E_ALERT_SINK (shell_content), "calendar:failed-open-memos", @@ -346,7 +375,8 @@ memo_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu priv->default_client = E_CAL_CLIENT (client); - e_cal_client_set_default_timezone (priv->default_client, e_cal_model_get_timezone (model)); + e_cal_client_set_default_timezone ( + priv->default_client, e_cal_model_get_timezone (model)); g_object_notify (G_OBJECT (shell_sidebar), "default-client"); @@ -395,9 +425,13 @@ memo_shell_sidebar_set_default (EMemoShellSidebar *memo_shell_sidebar, priv->loading_default_client = g_cancellable_new (); - e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_MEMOS, FALSE, priv->loading_default_client, - e_client_utils_authenticate_handler, GTK_WINDOW (shell_window), - memo_shell_sidebar_default_loaded_cb, g_object_ref (shell_sidebar)); + e_client_utils_open_new ( + source, E_CLIENT_SOURCE_TYPE_MEMOS, + FALSE, priv->loading_default_client, + e_client_utils_authenticate_handler, + GTK_WINDOW (shell_window), + memo_shell_sidebar_default_loaded_cb, + g_object_ref (shell_sidebar)); } static void @@ -950,7 +984,9 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar, if (client == NULL) { client = e_cal_client_new (source, source_type, NULL); if (client) - g_signal_connect (client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL); + g_signal_connect ( + client, "authenticate", + G_CALLBACK (e_client_utils_authenticate_handler), NULL); } g_return_if_fail (client != NULL); @@ -985,7 +1021,11 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar, timezone = e_cal_model_get_timezone (model); e_cal_client_set_default_timezone (client, timezone); - e_client_open (E_CLIENT (client), FALSE, memo_shell_sidebar->priv->loading_clients, memo_shell_sidebar_client_opened_cb, memo_shell_sidebar); + + e_client_open ( + E_CLIENT (client), FALSE, + memo_shell_sidebar->priv->loading_clients, + memo_shell_sidebar_client_opened_cb, memo_shell_sidebar); } void diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c index 75d957c684..eacb5c1da7 100644 --- a/modules/calendar/e-memo-shell-view-actions.c +++ b/modules/calendar/e-memo-shell-view-actions.c @@ -170,14 +170,19 @@ action_memo_list_delete_cb (GtkAction *action, uri = e_source_get_uri (source); client = e_cal_model_get_client_for_uri (model, uri); if (client == NULL) - client = e_cal_client_new_from_uri (uri, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL); + client = e_cal_client_new_from_uri ( + uri, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL); g_free (uri); g_return_if_fail (client != NULL); - if (!e_client_remove_sync (E_CLIENT (client), NULL, &error)) { - g_debug ("%s: Failed to remove client: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + e_client_remove_sync (E_CLIENT (client), NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to remove client: %s", + G_STRFUNC, error->message); + g_error_free (error); return; } @@ -190,9 +195,13 @@ action_memo_list_delete_cb (GtkAction *action, source_group = e_source_peek_group (source); e_source_group_remove_source (source_group, source); - if (!e_source_list_sync (source_list, &error)) { - g_debug ("%s: Failed to sync source list: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + e_source_list_sync (source_list, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to sync source list: %s", + G_STRFUNC, error->message); + g_error_free (error); } } @@ -290,9 +299,14 @@ action_memo_list_refresh_cb (GtkAction *action, g_return_if_fail (e_client_check_refresh_supported (E_CLIENT (client))); - if (!e_client_refresh_sync (E_CLIENT (client), NULL, &error)) { - g_debug ("%s: Failed to refresh '%s', %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); - g_clear_error (&error); + e_client_refresh_sync (E_CLIENT (client), NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to refresh '%s', %s", + G_STRFUNC, e_source_peek_name (source), + error->message); + g_error_free (error); } } diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c index ebee92479b..bb296fd5c2 100644 --- a/modules/calendar/e-task-shell-backend.c +++ b/modules/calendar/e-task-shell-backend.c @@ -84,11 +84,15 @@ task_shell_backend_ensure_sources (EShellBackend *shell_backend) shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - if (!e_cal_client_get_sources ( + e_cal_client_get_sources ( &task_shell_backend->priv->source_list, - E_CAL_CLIENT_SOURCE_TYPE_TASKS, &error)) { - g_debug ("%s: Could not get task sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + E_CAL_CLIENT_SOURCE_TYPE_TASKS, &error); + + if (error != NULL) { + g_warning ( + "%s: Could not get task sources: %s", + G_STRFUNC, error->message); + g_error_free (error); return; } @@ -172,13 +176,16 @@ task_shell_backend_new_task (ESource *source, CompEditor *editor; GError *error = NULL; - if (!e_client_utils_open_new_finish (source, result, &client, &error)) - client = NULL; + e_client_utils_open_new_finish (source, result, &client, &error); /* XXX Handle errors better. */ - if (!client) { - g_debug ("%s: Failed to open '%s': %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); - g_clear_error (&error); + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open '%s': %s", + G_STRFUNC, e_source_peek_name (source), + error->message); + g_error_free (error); return; } @@ -196,19 +203,24 @@ task_shell_backend_new_task (ESource *source, } static void -task_shell_backend_task_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) +task_shell_backend_task_new_cb (GObject *source_object, + GAsyncResult *result, + gpointer shell) { CompEditorFlags flags = 0; flags |= COMP_EDITOR_NEW_ITEM; - task_shell_backend_new_task (E_SOURCE (source_object), result, shell, flags); + task_shell_backend_new_task ( + E_SOURCE (source_object), result, shell, flags); g_object_unref (shell); } static void -task_shell_backend_task_assigned_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell) +task_shell_backend_task_assigned_new_cb (GObject *source_object, + GAsyncResult *result, + gpointer shell) { CompEditorFlags flags = 0; @@ -216,7 +228,8 @@ task_shell_backend_task_assigned_new_cb (GObject *source_object, GAsyncResult *r flags |= COMP_EDITOR_IS_ASSIGNED; flags |= COMP_EDITOR_USER_ORG; - task_shell_backend_new_task (E_SOURCE (source_object), result, shell, flags); + task_shell_backend_new_task ( + E_SOURCE (source_object), result, shell, flags); g_object_unref (shell); } @@ -379,9 +392,13 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend, * we successfully open it is another matter... */ handled = TRUE; - if (!e_cal_client_get_sources (&source_list, source_type, &error)) { - g_debug ("%s: Could not get task sources: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + e_cal_client_get_sources (&source_list, source_type, &error); + + if (error != NULL) { + g_warning ( + "%s: Could not get task sources: %s", + G_STRFUNC, error->message); + g_error_free (error); goto exit; } @@ -393,13 +410,20 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend, } client = e_cal_client_new (source, source_type, &error); - if (client) - g_signal_connect (client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL); - if (client == NULL || !e_client_open_sync (E_CLIENT (client), TRUE, NULL, &error)) { - g_debug ("%s: Failed to create/open client: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + if (client != NULL) { + g_signal_connect ( + client, "authenticate", + G_CALLBACK (e_client_utils_authenticate_handler), NULL); + e_client_open_sync (E_CLIENT (client), TRUE, NULL, &error); + } + + if (error != NULL) { + g_warning ( + "%s: Failed to create/open client: %s", + G_STRFUNC, error->message); g_object_unref (source_list); + g_error_free (error); goto exit; } @@ -411,8 +435,13 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend, if (editor != NULL) goto present; - if (!e_cal_client_get_object_sync (client, comp_uid, comp_rid, &icalcomp, NULL, &error)) { - g_debug ("%s: Failed to get object: %s", G_STRFUNC, error ? error->message : "Unknown error"); + e_cal_client_get_object_sync ( + client, comp_uid, comp_rid, &icalcomp, NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to get object: %s", + G_STRFUNC, error->message); g_object_unref (source_list); g_error_free (error); goto exit; @@ -420,7 +449,7 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend, comp = e_cal_component_new (); if (!e_cal_component_set_icalcomponent (comp, icalcomp)) { - g_debug ("%s: Failed to set icalcomp to comp\n", G_STRFUNC); + g_warning ("%s: Failed to set icalcomp to comp\n", G_STRFUNC); icalcomponent_free (icalcomp); icalcomp = NULL; } diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index 3e693afd7e..7987071eb8 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -160,7 +160,9 @@ task_shell_sidebar_backend_error_cb (ETaskShellSidebar *task_shell_sidebar, } static void -task_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +task_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *client = E_CAL_CLIENT (source_object); ETaskShellSidebar *task_shell_sidebar = user_data; @@ -169,10 +171,12 @@ task_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult g_return_if_fail (client != NULL); g_return_if_fail (task_shell_sidebar != 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); - task_shell_sidebar_emit_status_message (task_shell_sidebar, _("Loading tasks")); + task_shell_sidebar_emit_status_message ( + task_shell_sidebar, _("Loading tasks")); task_shell_sidebar_emit_client_added (task_shell_sidebar, client); task_shell_sidebar_emit_status_message (task_shell_sidebar, NULL); } @@ -200,15 +204,20 @@ free_retry_open_data (gpointer data) } static void -task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +task_shell_sidebar_client_opened_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *client = E_CAL_CLIENT (source_object); ETaskShellSidebar *task_shell_sidebar = user_data; + ESource *source; EShellView *shell_view; EShellContent *shell_content; EShellSidebar *shell_sidebar; GError *error = NULL; + source = e_client_get_source (E_CLIENT (client)); + e_client_open_finish (E_CLIENT (client), result, &error); if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || @@ -222,7 +231,10 @@ task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul e_client_utils_forget_password (E_CLIENT (client)); if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_FAILED)) { - e_client_open (E_CLIENT (client), FALSE, task_shell_sidebar->priv->loading_clients, task_shell_sidebar_client_opened_cb, user_data); + e_client_open ( + E_CLIENT (client), FALSE, + task_shell_sidebar->priv->loading_clients, + task_shell_sidebar_client_opened_cb, user_data); g_clear_error (&error); return; } @@ -236,7 +248,10 @@ task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul rod->cancellable = g_object_ref (task_shell_sidebar->priv->loading_clients); /* postpone for 1/2 of a second, backend is busy now */ - g_timeout_add_full (G_PRIORITY_DEFAULT, 500, task_shell_sidebar_retry_open_timeout_cb, rod, free_retry_open_data); + g_timeout_add_full ( + G_PRIORITY_DEFAULT, 500, + task_shell_sidebar_retry_open_timeout_cb, + rod, free_retry_open_data); g_clear_error (&error); return; @@ -252,7 +267,10 @@ task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul break; case E_CLIENT_ERROR_BUSY: - g_debug ("%s: Cannot open '%s', it's busy (%s)", G_STRFUNC, e_source_peek_name (e_client_get_source (E_CLIENT (client))), error->message); + g_warning ( + "%s: Cannot open '%s', it's busy (%s)", + G_STRFUNC, e_source_peek_name (source), + error->message); g_clear_error (&error); return; @@ -281,7 +299,10 @@ task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul g_clear_error (&error); /* to have them ready for later use */ - e_client_retrieve_capabilities (E_CLIENT (client), NULL, task_shell_sidebar_retrieve_capabilies_cb, task_shell_sidebar); + e_client_retrieve_capabilities ( + E_CLIENT (client), NULL, + task_shell_sidebar_retrieve_capabilies_cb, + task_shell_sidebar); } static gboolean @@ -297,14 +318,21 @@ task_shell_sidebar_retry_open_timeout_cb (gpointer user_data) if (g_cancellable_is_cancelled (rod->cancellable)) return FALSE; - e_client_open (rod->client, FALSE, rod->task_shell_sidebar->priv->loading_clients, task_shell_sidebar_client_opened_cb, rod->task_shell_sidebar); + e_client_open ( + rod->client, FALSE, + rod->task_shell_sidebar->priv->loading_clients, + task_shell_sidebar_client_opened_cb, + rod->task_shell_sidebar); return FALSE; } static void -task_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +task_shell_sidebar_default_loaded_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); EShellSidebar *shell_sidebar = user_data; ETaskShellSidebarPrivate *priv; EShellContent *shell_content; @@ -316,21 +344,22 @@ task_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu priv = E_TASK_SHELL_SIDEBAR (shell_sidebar)->priv; - if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) - client = NULL; + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); + task_shell_content = E_TASK_SHELL_CONTENT (shell_content); + model = e_task_shell_content_get_task_model (task_shell_content); + + e_client_utils_open_new_finish (source, result, &client, &error); + /* Ignore cancellations. */ if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_warn_if_fail (client == NULL); g_error_free (error); goto exit; - } - - shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_content = e_shell_view_get_shell_content (shell_view); - task_shell_content = E_TASK_SHELL_CONTENT (shell_content); - model = e_task_shell_content_get_task_model (task_shell_content); - if (error != NULL) { + } else if (error != NULL) { + g_warn_if_fail (client == NULL); e_alert_submit ( E_ALERT_SINK (shell_content), "calendar:failed-open-tasks", @@ -346,7 +375,8 @@ task_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu priv->default_client = E_CAL_CLIENT (client); - e_cal_client_set_default_timezone (priv->default_client, e_cal_model_get_timezone (model)); + e_cal_client_set_default_timezone ( + priv->default_client, e_cal_model_get_timezone (model)); g_object_notify (G_OBJECT (shell_sidebar), "default-client"); @@ -395,9 +425,13 @@ task_shell_sidebar_set_default (ETaskShellSidebar *task_shell_sidebar, priv->loading_default_client = g_cancellable_new (); - e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_TASKS, FALSE, priv->loading_default_client, - e_client_utils_authenticate_handler, GTK_WINDOW (shell_window), - task_shell_sidebar_default_loaded_cb, g_object_ref (shell_sidebar)); + e_client_utils_open_new ( + source, E_CLIENT_SOURCE_TYPE_TASKS, + FALSE, priv->loading_default_client, + e_client_utils_authenticate_handler, + GTK_WINDOW (shell_window), + task_shell_sidebar_default_loaded_cb, + g_object_ref (shell_sidebar)); } static void @@ -696,13 +730,14 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar) can_delete = !is_system; delete_prop = e_source_get_property (source, "delete"); - can_delete = can_delete && (delete_prop == NULL || strcmp (delete_prop, "no") != 0); + can_delete = can_delete && + (delete_prop == NULL || strcmp (delete_prop, "no") != 0); client = g_hash_table_lookup ( task_shell_sidebar->priv->client_table, e_source_peek_uid (source)); - refresh_supported = - client && e_client_check_refresh_supported (E_CLIENT (client)); + refresh_supported = client && + e_client_check_refresh_supported (E_CLIENT (client)); } if (source != NULL) @@ -950,7 +985,9 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar, if (client == NULL) { client = e_cal_client_new (source, source_type, NULL); if (client) - g_signal_connect (client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL); + g_signal_connect ( + client, "authenticate", + G_CALLBACK (e_client_utils_authenticate_handler), NULL); } g_return_if_fail (client != NULL); @@ -985,7 +1022,11 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar, timezone = e_cal_model_get_timezone (model); e_cal_client_set_default_timezone (client, timezone); - e_client_open (E_CLIENT (client), FALSE, task_shell_sidebar->priv->loading_clients, task_shell_sidebar_client_opened_cb, task_shell_sidebar); + + e_client_open ( + E_CLIENT (client), FALSE, + task_shell_sidebar->priv->loading_clients, + task_shell_sidebar_client_opened_cb, task_shell_sidebar); } void diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c index 4938452309..1fb4867205 100644 --- a/modules/calendar/e-task-shell-view-actions.c +++ b/modules/calendar/e-task-shell-view-actions.c @@ -193,14 +193,19 @@ action_task_list_delete_cb (GtkAction *action, uri = e_source_get_uri (source); client = e_cal_model_get_client_for_uri (model, uri); if (client == NULL) - client = e_cal_client_new_from_uri (uri, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL); + client = e_cal_client_new_from_uri ( + uri, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL); g_free (uri); g_return_if_fail (client != NULL); - if (!e_client_remove_sync (E_CLIENT (client), NULL, &error)) { - g_debug ("%s: Failed to remove client: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + e_client_remove_sync (E_CLIENT (client), NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to remove client: %s", + G_STRFUNC, error->message); + g_error_free (error); return; } @@ -213,9 +218,13 @@ action_task_list_delete_cb (GtkAction *action, source_group = e_source_peek_group (source); e_source_group_remove_source (source_group, source); - if (!e_source_list_sync (source_list, &error)) { - g_debug ("%s: Failed to sync srouce list: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + e_source_list_sync (source_list, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to sync srouce list: %s", + G_STRFUNC, error->message); + g_error_free (error); } } @@ -313,9 +322,14 @@ action_task_list_refresh_cb (GtkAction *action, g_return_if_fail (e_client_check_refresh_supported (E_CLIENT (client))); - if (!e_client_refresh_sync (E_CLIENT (client), NULL, &error)) { - g_debug ("%s: Failed to refresh '%s', %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error"); - g_clear_error (&error); + e_client_refresh_sync (E_CLIENT (client), NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to refresh '%s', %s", + G_STRFUNC, e_source_peek_name (source), + error->message); + g_error_free (error); } } diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c index 77e4beae1e..b8122786f2 100644 --- a/modules/calendar/e-task-shell-view-private.c +++ b/modules/calendar/e-task-shell-view-private.c @@ -479,8 +479,13 @@ e_task_shell_view_delete_completed (ETaskShellView *task_shell_view) if (e_client_is_readonly (E_CLIENT (client))) continue; - if (!e_cal_client_get_object_list_sync (client, sexp, &objects, NULL, &error)) { - g_debug ("%s: Failed to get object list: %s", G_STRFUNC, error ? error->message : "Unknown error"); + e_cal_client_get_object_list_sync ( + client, sexp, &objects, NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to get object list: %s", + G_STRFUNC, error->message); g_clear_error (&error); continue; } @@ -490,8 +495,15 @@ e_task_shell_view_delete_completed (ETaskShellView *task_shell_view) const gchar *uid; uid = icalcomponent_get_uid (component); - if (!e_cal_client_remove_object_sync (client, uid, NULL, CALOBJ_MOD_THIS, NULL, &error)) { - g_debug ("%s: Failed to remove object: %s", G_STRFUNC, error ? error->message : "Unknown error"); + + e_cal_client_remove_object_sync ( + client, uid, NULL, + CALOBJ_MOD_THIS, NULL, &error); + + if (error != NULL) { + g_warning ( + "%s: Failed to remove object: %s", + G_STRFUNC, error->message); g_clear_error (&error); } diff --git a/modules/mail/em-account-prefs.c b/modules/mail/em-account-prefs.c index 9a89cae1ee..b43f1fbe35 100644 --- a/modules/mail/em-account-prefs.c +++ b/modules/mail/em-account-prefs.c @@ -386,6 +386,8 @@ em_account_prefs_new (EPreferencesWindow *window) EShell *shell; EShellBackend *shell_backend; EAccountList *account_list; + EMailSession *session; + const gchar *data_dir; account_list = e_get_account_list (); g_return_val_if_fail (E_IS_ACCOUNT_LIST (account_list), NULL); @@ -394,8 +396,11 @@ em_account_prefs_new (EPreferencesWindow *window) shell = e_preferences_window_get_shell (window); shell_backend = e_shell_get_backend_by_name (shell, "mail"); - /* make sure the e-mail-local is initialized */ - e_mail_local_init (e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend)), e_shell_backend_get_data_dir (shell_backend)); + session = e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend)); + data_dir = e_shell_backend_get_data_dir (shell_backend); + + /* Make sure the e-mail-local is initialized. */ + e_mail_local_init (session, data_dir); return g_object_new ( EM_TYPE_ACCOUNT_PREFS, diff --git a/modules/online-accounts/camel-sasl-xoauth.c b/modules/online-accounts/camel-sasl-xoauth.c index 9ce391214d..14ecb29bc4 100644 --- a/modules/online-accounts/camel-sasl-xoauth.c +++ b/modules/online-accounts/camel-sasl-xoauth.c @@ -73,7 +73,7 @@ hmac_sha1 (const gchar *key, guchar inner[SHA1_LENGTH]; guchar digest[SHA1_LENGTH]; gsize key_length, inner_length, digest_length; - int i; + gint i; g_return_val_if_fail (key, NULL); g_return_val_if_fail (message, NULL); @@ -86,7 +86,7 @@ hmac_sha1 (const gchar *key, key_length = sizeof (new_key); - g_checksum_update (checksum, (guchar*)key, strlen (key)); + g_checksum_update (checksum, (guchar *) key, strlen (key)); g_checksum_get_digest (checksum, new_key, &key_length); g_checksum_reset (checksum); @@ -117,7 +117,7 @@ hmac_sha1 (const gchar *key, /* Stage 3 and 4 */ g_checksum_update (checksum, ipad, sizeof (ipad)); - g_checksum_update (checksum, (guchar*)message, strlen (message)); + g_checksum_update (checksum, (guchar *) message, strlen (message)); inner_length = sizeof (inner); g_checksum_get_digest (checksum, inner, &inner_length); g_checksum_reset (checksum); @@ -135,7 +135,7 @@ hmac_sha1 (const gchar *key, return g_base64_encode (digest, digest_length); } -static char * +static gchar * sign_plaintext (const gchar *consumer_secret, const gchar *token_secret) { @@ -153,7 +153,7 @@ sign_plaintext (const gchar *consumer_secret, return rv; } -static char * +static gchar * sign_hmac (const gchar *consumer_secret, const gchar *token_secret, const gchar *http_method, diff --git a/plugins/bbdb/gaimbuddies.c b/plugins/bbdb/gaimbuddies.c index 1becdee0ac..7e42066638 100644 --- a/plugins/bbdb/gaimbuddies.c +++ b/plugins/bbdb/gaimbuddies.c @@ -61,18 +61,24 @@ typedef struct { } GaimBuddy; /* Forward declarations for this file. */ -static gboolean bbdb_merge_buddy_to_contact (EBookClient *client, GaimBuddy *b, EContact *c); -static GList *bbdb_get_gaim_buddy_list (void); -static gchar *get_node_text (xmlNodePtr node); -static gchar *get_buddy_icon_from_setting (xmlNodePtr setting); -static void free_buddy_list (GList *blist); -static void parse_buddy_group (xmlNodePtr group, GList **buddies, GSList *blocked); -static EContactField proto_to_contact_field (const gchar *proto); +static gboolean bbdb_merge_buddy_to_contact (EBookClient *client, + GaimBuddy *buddy, + EContact *contact); +static GList * bbdb_get_gaim_buddy_list (void); +static gchar * get_node_text (xmlNodePtr node); +static gchar * get_buddy_icon_from_setting (xmlNodePtr setting); +static void free_buddy_list (GList *blist); +static void parse_buddy_group (xmlNodePtr group, + GList **buddies, + GSList *blocked); +static EContactField + proto_to_contact_field (const gchar *proto); static gchar * get_buddy_filename (void) { - return g_build_path ("/", g_get_home_dir (), ".purple/blist.xml", NULL); + return g_build_filename ( + g_get_home_dir (), ".purple", "blist.xml", NULL); } static gchar * @@ -229,10 +235,12 @@ bbdb_sync_buddy_list_in_thread (gpointer data) } /* Look for an exact match full name == buddy alias */ - query = e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_IS, b->alias); + query = e_book_query_field_test ( + E_CONTACT_FULL_NAME, E_BOOK_QUERY_IS, b->alias); query_string = e_book_query_to_string (query); e_book_query_unref (query); - if (!e_book_client_get_contacts_sync (std->client, query_string, &contacts, NULL, NULL)) { + if (!e_book_client_get_contacts_sync ( + std->client, query_string, &contacts, NULL, NULL)) { g_free (query_string); continue; } diff --git a/plugins/caldav/caldav-source.c b/plugins/caldav/caldav-source.c index dea4ddf5a6..c9c44fb470 100644 --- a/plugins/caldav/caldav-source.c +++ b/plugins/caldav/caldav-source.c @@ -59,9 +59,8 @@ ensure_caldav_source_group (ECalClientSourceType source_type) GError *error = NULL; if (!e_cal_client_get_sources (&slist, source_type, &error)) { - g_warning ("Could not get calendar sources: %s", error ? error->message : "Unknown error"); - if (error) - g_error_free (error); + g_warning ("Could not get calendar sources: %s", error->message); + g_error_free (error); return; } diff --git a/plugins/google-account-setup/google-source.c b/plugins/google-account-setup/google-source.c index 5643c4f0ba..5b12759f08 100644 --- a/plugins/google-account-setup/google-source.c +++ b/plugins/google-account-setup/google-source.c @@ -73,10 +73,14 @@ ensure_google_source_group (void) ESourceList *slist; GError *error = NULL; - if (!e_cal_client_get_sources (&slist, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, &error)) { - g_debug ("%s: Could not get calendar source list: %s", G_STRFUNC, error ? error->message : "Unknown error"); - if (error) - g_error_free (error); + e_cal_client_get_sources ( + &slist, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, &error); + + if (error != NULL) { + g_warning ( + "%s: Could not get calendar source list: %s", + G_STRFUNC, error->message); + g_error_free (error); return; } diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c index 3b10c38933..37fcb21fd5 100644 --- a/plugins/itip-formatter/itip-formatter.c +++ b/plugins/itip-formatter/itip-formatter.c @@ -495,56 +495,66 @@ add_failed_to_load_msg (ItipView *view, ESource *source, const GError *error) } static void -cal_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +cal_opened_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); struct _itip_puri *pitip = user_data; - ESource *source; ECalClientSourceType source_type; EClient *client = NULL; ECalClient *cal_client; + const gchar *uid; GError *error = NULL; - source = E_SOURCE (source_object); - - if (!e_client_utils_open_new_finish (source, result, &client, &error)) { - client = NULL; - if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || - g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { - g_error_free (error); - return; - } - } + e_client_utils_open_new_finish (source, result, &client, &error); - if (error) { - d(printf ("Failed opening itip formatter calendar '%s' during non-search opening\n", e_source_peek_name (source))); - - add_failed_to_load_msg (ITIP_VIEW (pitip->view), source, error); + /* Ignore cancellations. */ + if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || + g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_warn_if_fail (client == NULL); + g_error_free (error); + return; + } else if (error != NULL) { + g_warn_if_fail (client == NULL); + add_failed_to_load_msg ( + ITIP_VIEW (pitip->view), source, error); g_error_free (error); return; } + g_return_if_fail (E_IS_CAL_CLIENT (client)); + cal_client = E_CAL_CLIENT (client); g_return_if_fail (cal_client != NULL); + uid = e_source_peek_uid (source); source_type = e_cal_client_get_source_type (cal_client); - g_hash_table_insert (pitip->clients[source_type], g_strdup (e_source_peek_uid (source)), cal_client); + g_hash_table_insert ( + pitip->clients[source_type], g_strdup (uid), cal_client); if (e_cal_client_check_recurrences_no_master (cal_client)) { - icalcomponent *icalcomp = e_cal_component_get_icalcomponent (pitip->comp); + icalcomponent *icalcomp; + gboolean show_recur_check; - if (check_is_instance (icalcomp)) - itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), TRUE); - else - itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), FALSE); + icalcomp = e_cal_component_get_icalcomponent (pitip->comp); + + show_recur_check = check_is_instance (icalcomp); + itip_view_set_show_recur_check ( + ITIP_VIEW (pitip->view), show_recur_check); } if (pitip->type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS) { - if (e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING)) - itip_view_set_needs_decline (ITIP_VIEW (pitip->view), TRUE); - else - itip_view_set_needs_decline (ITIP_VIEW (pitip->view), FALSE); - itip_view_set_mode (ITIP_VIEW (pitip->view), ITIP_VIEW_MODE_PUBLISH); + gboolean needs_decline; + + needs_decline = e_client_check_capability ( + E_CLIENT (client), + CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING); + itip_view_set_needs_decline ( + ITIP_VIEW (pitip->view), needs_decline); + itip_view_set_mode ( + ITIP_VIEW (pitip->view), ITIP_VIEW_MODE_PUBLISH); } pitip->current_client = cal_client; @@ -553,7 +563,11 @@ cal_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) } static void -start_calendar_server (struct _itip_puri *pitip, ESource *source, ECalClientSourceType type, GAsyncReadyCallback func, gpointer data) +start_calendar_server (struct _itip_puri *pitip, + ESource *source, + ECalClientSourceType type, + GAsyncReadyCallback func, + gpointer data) { ECalClient *client; @@ -792,7 +806,9 @@ decrease_find_data (FormatItipFindData *fd) } static void -get_object_without_rid_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +get_object_without_rid_ready_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *cal_client = E_CAL_CLIENT (source_object); FormatItipFindData *fd = user_data; @@ -833,7 +849,9 @@ get_object_without_rid_ready_cb (GObject *source_object, GAsyncResult *result, g } static void -get_object_with_rid_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +get_object_with_rid_ready_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *cal_client = E_CAL_CLIENT (source_object); FormatItipFindData *fd = user_data; @@ -879,7 +897,9 @@ get_object_with_rid_ready_cb (GObject *source_object, GAsyncResult *result, gpoi } static void -get_object_list_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +get_object_list_ready_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *cal_client = E_CAL_CLIENT (source_object); FormatItipFindData *fd = user_data; @@ -913,25 +933,28 @@ get_object_list_ready_cb (GObject *source_object, GAsyncResult *result, gpointer } static void -find_cal_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +find_cal_opened_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); FormatItipFindData *fd = user_data; struct _itip_puri *pitip = fd->puri; - ESource *source; ECalClientSourceType source_type; EClient *client = NULL; ECalClient *cal_client; + const gchar *uid; GError *error = NULL; - source = E_SOURCE (source_object); + e_client_utils_open_new_finish (source, result, &client, &error); - if (!e_client_utils_open_new_finish (source, result, &client, &error)) { - if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || - g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { - g_error_free (error); - decrease_find_data (fd); - return; - } + /* Ignore cancellations. */ + if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || + g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_warn_if_fail (client == NULL); + decrease_find_data (fd); + g_error_free (error); + return; } if (g_cancellable_is_cancelled (fd->cancellable)) { @@ -944,18 +967,22 @@ find_cal_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_ /* FIXME Do we really want to warn here? If we fail * to find the item, this won't be cleared but the * selector might be shown */ - d(printf ("Failed opening itip formatter calendar '%s' during search opening... ", e_source_peek_name (source))); - add_failed_to_load_msg (ITIP_VIEW (pitip->view), source, error); - - g_error_free (error); + g_warn_if_fail (client == NULL); + add_failed_to_load_msg ( + ITIP_VIEW (pitip->view), source, error); decrease_find_data (fd); + g_error_free (error); return; } + g_return_if_fail (E_IS_CAL_CLIENT (client)); + cal_client = E_CAL_CLIENT (client); source_type = e_cal_client_get_source_type (cal_client); - g_hash_table_insert (pitip->clients[source_type], g_strdup (e_source_peek_uid (source)), cal_client); + uid = e_source_peek_uid (source); + g_hash_table_insert ( + pitip->clients[source_type], g_strdup (uid), cal_client); /* Check for conflicts */ /* If the query fails, we'll just ignore it */ diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c index 0bb1aaf6ad..3f14ce0f9b 100644 --- a/plugins/pst-import/pst-importer.c +++ b/plugins/pst-import/pst-importer.c @@ -682,7 +682,7 @@ pst_import_folders (PstImporter *m, pst_desc_tree *topitem) if (topitem) g_hash_table_insert (node_to_folderuri, topitem, g_strdup (m->folder_uri)); - + /* Walk through folder tree */ while (d_ptr != NULL && (camel_operation_cancel_check (co) == FALSE)) { gchar *previous_folder = NULL; @@ -1444,8 +1444,10 @@ pst_process_contact (PstImporter *m, pst_item *item) g_object_unref (ec); g_free (uid); - if (error) { - g_debug ("%s: Failed to add contact: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to add contact: %s", + G_STRFUNC, error->message); g_error_free (error); } } diff --git a/plugins/publish-calendar/publish-location.c b/plugins/publish-calendar/publish-location.c index 9089561ccf..f864d8a9ae 100644 --- a/plugins/publish-calendar/publish-location.c +++ b/plugins/publish-calendar/publish-location.c @@ -88,9 +88,9 @@ migrateURI (const gchar *xml, xmlDocPtr doc) uri->publish_frequency = atoi ((gchar *) frequency); uri->publish_format = URI_PUBLISH_AS_FB; - password = e_passwords_get_password (NULL, (gchar *)location); + password = e_passwords_get_password (NULL, (gchar *) location); if (password) { - e_passwords_forget_password (NULL, (gchar *)location); + e_passwords_forget_password (NULL, (gchar *) location); e_passwords_add_password (uri->location, password); e_passwords_remember_password (NULL, uri->location); } diff --git a/plugins/save-calendar/csv-format.c b/plugins/save-calendar/csv-format.c index cbbfa6691c..b4e95bbef7 100644 --- a/plugins/save-calendar/csv-format.c +++ b/plugins/save-calendar/csv-format.c @@ -331,7 +331,9 @@ do_save_calendar_csv (FormatHandler *handler, /* open source client */ source_client = e_cal_client_new (primary_source, type, &error); if (source_client) - g_signal_connect (source_client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL); + g_signal_connect ( + source_client, "authenticate", + G_CALLBACK (e_client_utils_authenticate_handler), NULL); if (!source_client || !e_client_open_sync (E_CLIENT (source_client), TRUE, NULL, &error)) { display_error_message ( diff --git a/plugins/vcard-inline/vcard-inline.c b/plugins/vcard-inline/vcard-inline.c index 78818f328b..24e551afe9 100644 --- a/plugins/vcard-inline/vcard-inline.c +++ b/plugins/vcard-inline/vcard-inline.c @@ -118,23 +118,29 @@ org_gnome_vcard_inline_decode (VCardInlinePObject *vcard_object, } static void -org_gnome_vcard_inline_client_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +org_gnome_vcard_inline_client_loaded_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); EClient *client = NULL; EBookClient *book_client; GSList *contact_list = user_data, *iter; GError *error = NULL; - if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) - client = NULL; + e_client_utils_open_new_finish (source, result, &client, &error); - if (client == NULL) { - g_debug ("%s: Failed to open book client: %s", G_STRFUNC, error ? error->message : "Unknown error"); - if (error) - g_error_free (error); + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open book client: %s", + G_STRFUNC, error->message); + g_error_free (error); goto exit; } + g_return_if_fail (E_IS_BOOK_CLIENT (client)); + book_client = E_BOOK_CLIENT (client); for (iter = contact_list; iter != NULL; iter = iter->next) { diff --git a/smime/gui/certificate-manager.c b/smime/gui/certificate-manager.c index 81644bcfbc..3795c20923 100644 --- a/smime/gui/certificate-manager.c +++ b/smime/gui/certificate-manager.c @@ -64,8 +64,8 @@ enum { typedef struct { GType type; const gchar *column_title; - const gchar* (*get_cert_data_func) (ECert *cert); /* Prototype to e_cert_get_* functions */ - gboolean visible; /* Default visibility of column */ + const gchar * (*get_cert_data_func) (ECert *cert); /* Prototype to e_cert_get_* functions */ + gboolean visible; /* Default visibility of column */ } CertTreeColumn; static CertTreeColumn yourcerts_columns[] = { @@ -164,7 +164,6 @@ static void import_cert (GtkWidget *button, CertPage *cp); static void load_certs (CertPage *cp); static void unload_certs (CertPage *cp); - static void save_treeview_state (GtkTreeView *treeview) { @@ -318,8 +317,8 @@ report_and_free_error (CertPage *cp, const gchar *where, GError *error) static gboolean treeview_header_clicked (GtkWidget *widget, - GdkEventButton *event, - gpointer user_data) + GdkEventButton *event, + gpointer user_data) { GtkMenu *menu = user_data; @@ -334,7 +333,7 @@ treeview_header_clicked (GtkWidget *widget, static void header_popup_item_toggled (GtkCheckMenuItem *item, - gpointer user_data) + gpointer user_data) { GtkTreeViewColumn *column = user_data; @@ -344,8 +343,8 @@ header_popup_item_toggled (GtkCheckMenuItem *item, static void treeview_column_visibility_changed (GtkTreeViewColumn *column, - GParamSpec *pspec, - gpointer user_data) + GParamSpec *pspec, + gpointer user_data) { GtkCheckMenuItem *menu_item = user_data; @@ -356,7 +355,7 @@ treeview_column_visibility_changed (GtkTreeViewColumn *column, static void treeview_selection_changed (GtkTreeSelection *selection, - CertPage *cp) + CertPage *cp) { GtkTreeIter iter; gboolean cert_selected = FALSE; @@ -383,10 +382,9 @@ treeview_selection_changed (GtkTreeSelection *selection, gtk_widget_set_sensitive (cp->view_button, cert_selected); } - static void treeview_add_column (CertPage *cp, - gint column_index) + gint column_index) { GtkCellRenderer *cell; GtkTreeViewColumn *column; @@ -425,7 +423,6 @@ treeview_add_column (CertPage *cp, G_CALLBACK (treeview_column_visibility_changed), item); } - struct find_cert_data { ECert *cert; GtkTreePath *path; @@ -457,7 +454,7 @@ find_cert_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointe static void select_certificate (CertPage *cp, - ECert *cert) + ECert *cert) { GtkTreeModel *model; GtkTreeSelection *selection; @@ -481,7 +478,6 @@ select_certificate (CertPage *cp, selection = gtk_tree_view_get_selection (cp->treeview); gtk_tree_selection_select_path (selection, fcd.path); - gtk_tree_view_scroll_to_cell (cp->treeview, fcd.path, NULL, FALSE, 0.0, 0.0); gtk_tree_path_free (fcd.path); } @@ -489,7 +485,7 @@ select_certificate (CertPage *cp, static void view_cert (GtkWidget *button, - CertPage *cp) + CertPage *cp) { GtkTreeIter iter; @@ -511,7 +507,7 @@ view_cert (GtkWidget *button, static void edit_cert (GtkWidget *button, - CertPage *cp) + CertPage *cp) { GtkTreeIter iter; @@ -565,7 +561,7 @@ edit_cert (GtkWidget *button, static void import_cert (GtkWidget *button, - CertPage *cp) + CertPage *cp) { GtkWidget *filesel; GtkFileFilter *filter; @@ -631,7 +627,7 @@ import_cert (GtkWidget *button, static void delete_cert (GtkWidget *button, - CertPage *cp) + CertPage *cp) { GtkTreeIter iter; @@ -687,7 +683,7 @@ add_cert (CertPage *cp, ECert *cert) gtk_tree_store_append (GTK_TREE_STORE (model), &iter, parent_iter); for (i = 0; i < cp->columns_count; i++) { - const gchar* (*get_cert_data_func) (ECert *cert); + const gchar * (*get_cert_data_func) (ECert *cert); /* When e_cert_get_cn() is empty, use _get_nickname() */ if ((cp->columns[i].get_cert_data_func == e_cert_get_cn) && (!e_cert_get_cn (cert))) { @@ -828,7 +824,7 @@ initialize_ui (CertPage *cp) static void cert_manager_config_window_hide (ECertManagerConfig *ecmc, - EPreferencesWindow *epw) + EPreferencesWindow *epw) { g_return_if_fail (ecmc); @@ -839,9 +835,9 @@ cert_manager_config_window_hide (ECertManagerConfig *ecmc, static void free_cert (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer user_data) + GtkTreePath *path, + GtkTreeIter *iter, + gpointer user_data) { CertPage *cp = user_data; ECert *cert; @@ -912,12 +908,11 @@ cert_manager_config_dispose (GObject *object) G_OBJECT_CLASS (e_cert_manager_config_parent_class)->dispose (object); } - static void cert_manager_config_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) + guint property_id, + const GValue *value, + GParamSpec *pspec) { ECertManagerConfig *ecmc = E_CERT_MANAGER_CONFIG (object); diff --git a/widgets/misc/e-contact-map-window.c b/widgets/misc/e-contact-map-window.c index 1618086a1b..41570ee748 100644 --- a/widgets/misc/e-contact-map-window.c +++ b/widgets/misc/e-contact-map-window.c @@ -64,17 +64,23 @@ enum { static gint signals[LAST_SIGNAL] = {0}; static void -marker_doubleclick_cb (ClutterActor *marker, - gpointer user_data) +marker_doubleclick_cb (ClutterActor *actor, + gpointer user_data) { EContactMapWindow *window = user_data; - const gchar *contact_uid = e_contact_marker_get_contact_uid (E_CONTACT_MARKER (marker)); + EContactMarker *marker; + const gchar *contact_uid; + + marker = E_CONTACT_MARKER (actor); + contact_uid = e_contact_marker_get_contact_uid (marker); g_signal_emit (window, signals[SHOW_CONTACT_EDITOR], 0, contact_uid); } static void -book_contacts_received_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +book_contacts_received_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { EContactMapWindow *window = user_data; EBookClient *client = E_BOOK_CLIENT (source_object); @@ -84,14 +90,16 @@ book_contacts_received_cb (GObject *source_object, GAsyncResult *result, gpointe if (!e_book_client_get_contacts_finish (client, result, &contacts, &error)) contacts = NULL; - if (error) { - g_debug ("%s: Failed to get contacts: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); + if (error != NULL) { + g_warning ( + "%s: Failed to get contacts: %s", + G_STRFUNC, error->message); + g_error_free (error); } - for (p = contacts; p; p = p->next) { - e_contact_map_add_contact (window->priv->map, (EContact*) p->data); - } + for (p = contacts; p; p = p->next) + e_contact_map_add_contact ( + window->priv->map, (EContact*) p->data); e_client_util_free_object_slist (contacts); g_object_unref (client); @@ -99,7 +107,7 @@ book_contacts_received_cb (GObject *source_object, GAsyncResult *result, gpointe static void contact_map_window_zoom_in_cb (GtkButton *button, - gpointer user_data) + gpointer user_data) { EContactMapWindow *window = user_data; ChamplainView *view; @@ -111,7 +119,7 @@ contact_map_window_zoom_in_cb (GtkButton *button, static void contact_map_window_zoom_out_cb (GtkButton *button, - gpointer user_data) + gpointer user_data) { EContactMapWindow *window = user_data; ChamplainView *view; @@ -122,8 +130,8 @@ contact_map_window_zoom_out_cb (GtkButton *button, } static void zoom_level_changed_cb (ChamplainView *view, - gint bzoom_level, - gpointer user_data) + gint bzoom_level, + gpointer user_data) { EContactMapWindow *window = user_data; gint zoom_level = champlain_view_get_zoom_level (view); @@ -141,8 +149,8 @@ zoom_level_changed_cb (ChamplainView *view, */ static void map_contact_added_cb (EContactMap *map, - ClutterActor *marker, - gpointer user_data) + ClutterActor *marker, + gpointer user_data) { EContactMapWindowPrivate *priv = E_CONTACT_MAP_WINDOW (user_data)->priv; const gchar *name; @@ -169,8 +177,8 @@ map_contact_added_cb (EContactMap *map, static void map_contact_removed_cb (EContactMap *map, - const gchar *name, - gpointer user_data) + const gchar *name, + gpointer user_data) { EContactMapWindowPrivate *priv = E_CONTACT_MAP_WINDOW (user_data)->priv; GtkTreeIter iter; @@ -193,8 +201,8 @@ map_contact_removed_cb (EContactMap *map, static void map_contact_geocoding_started_cb (EContactMap *map, - ClutterActor *marker, - gpointer user_data) + ClutterActor *marker, + gpointer user_data) { EContactMapWindowPrivate *priv = E_CONTACT_MAP_WINDOW (user_data)->priv; @@ -206,8 +214,8 @@ map_contact_geocoding_started_cb (EContactMap *map, static void map_contact_geocoding_failed_cb (EContactMap *map, - const gchar *name, - gpointer user_data) + const gchar *name, + gpointer user_data) { EContactMapWindowPrivate *priv = E_CONTACT_MAP_WINDOW (user_data)->priv; @@ -221,7 +229,7 @@ map_contact_geocoding_failed_cb (EContactMap *map, static void contact_map_window_find_contact_cb (GtkButton *button, - gpointer user_data) + gpointer user_data) { EContactMapWindowPrivate *priv = E_CONTACT_MAP_WINDOW (user_data)->priv; ClutterActor *marker; @@ -235,8 +243,8 @@ contact_map_window_find_contact_cb (GtkButton *button, static gboolean contact_map_window_entry_key_pressed_cb (GtkWidget *entry, - GdkEventKey *event, - gpointer user_data) + GdkEventKey *event, + gpointer user_data) { if (event->keyval == GDK_KEY_Return) contact_map_window_find_contact_cb (NULL, user_data); @@ -246,9 +254,9 @@ contact_map_window_entry_key_pressed_cb (GtkWidget *entry, static gboolean entry_completion_match_selected_cb (GtkEntryCompletion *widget, - GtkTreeModel* model, - GtkTreeIter *iter, - gpointer user_data) + GtkTreeModel* model, + GtkTreeIter *iter, + gpointer user_data) { GValue name_val = {0}; EContactMapWindowPrivate *priv = E_CONTACT_MAP_WINDOW (user_data)->priv; @@ -393,7 +401,8 @@ e_contact_map_window_init (EContactMapWindow *window) /* Entry completion */ entry_completion = gtk_entry_completion_new (); - gtk_entry_completion_set_model (entry_completion, GTK_TREE_MODEL (completion_model)); + gtk_entry_completion_set_model ( + entry_completion, GTK_TREE_MODEL (completion_model)); gtk_entry_completion_set_text_column (entry_completion, 0); g_signal_connect (entry_completion, "match-selected", G_CALLBACK (entry_completion_match_selected_cb), window); @@ -438,7 +447,7 @@ e_contact_map_window_new (void) */ void e_contact_map_window_load_addressbook (EContactMapWindow *map, - EBookClient *book_client) + EBookClient *book_client) { EBookQuery *book_query; gchar *query_string; @@ -446,7 +455,6 @@ e_contact_map_window_load_addressbook (EContactMapWindow *map, g_return_if_fail (E_IS_CONTACT_MAP_WINDOW (map)); g_return_if_fail (E_IS_BOOK_CLIENT (book_client)); - /* Reference book, so that it does not get deleted before the callback is involved. The book is unrefed in the callback */ g_object_ref (book_client); @@ -455,7 +463,9 @@ e_contact_map_window_load_addressbook (EContactMapWindow *map, query_string = e_book_query_to_string (book_query); e_book_query_unref (book_query); - e_book_client_get_contacts (book_client, query_string, NULL, book_contacts_received_cb, map); + e_book_client_get_contacts ( + book_client, query_string, NULL, + book_contacts_received_cb, map); g_free (query_string); } diff --git a/widgets/misc/e-contact-marker.c b/widgets/misc/e-contact-marker.c index 3a871eaf6f..b5781c8c3b 100644 --- a/widgets/misc/e-contact-marker.c +++ b/widgets/misc/e-contact-marker.c @@ -123,7 +123,9 @@ contact_photo_to_texture (EContactPhoto *photo) GError *error = NULL; GdkPixbufLoader *loader = gdk_pixbuf_loader_new (); - gdk_pixbuf_loader_write (loader, photo->data.inlined.data, photo->data.inlined.length, NULL); + gdk_pixbuf_loader_write ( + loader, photo->data.inlined.data, + photo->data.inlined.length, NULL); gdk_pixbuf_loader_close (loader, NULL); pixbuf = gdk_pixbuf_loader_get_pixbuf (loader); if (pixbuf) @@ -295,7 +297,9 @@ draw_marker (EContactMarker *marker) if (priv->image) { clutter_actor_set_position (priv->image, 2*PADDING, 2*PADDING); if (clutter_actor_get_parent (priv->image) == NULL) - clutter_container_add_actor (CLUTTER_CONTAINER (priv->content_group), priv->image); + clutter_container_add_actor ( + CLUTTER_CONTAINER (priv->content_group), + priv->image); } if (priv->text_actor == NULL) { @@ -342,7 +346,9 @@ draw_marker (EContactMarker *marker) champlain_marker_get_selection_text_color () : champlain_label_get_text_color (CHAMPLAIN_LABEL (marker)))); if (clutter_actor_get_parent (priv->text_actor) == NULL) - clutter_container_add_actor (CLUTTER_CONTAINER (priv->content_group), priv->text_actor); + clutter_container_add_actor ( + CLUTTER_CONTAINER (priv->content_group), + priv->text_actor); if (priv->text_actor == NULL && priv->image == NULL) { total_width = 6 * PADDING; @@ -552,7 +558,8 @@ e_contact_marker_init (EContactMarker *marker) priv->content_group = CLUTTER_GROUP (clutter_group_new ()); priv->redraw_id = 0; - clutter_actor_set_parent (CLUTTER_ACTOR (priv->content_group), CLUTTER_ACTOR (marker)); + clutter_actor_set_parent ( + CLUTTER_ACTOR (priv->content_group), CLUTTER_ACTOR (marker)); clutter_actor_queue_relayout (CLUTTER_ACTOR (marker)); priv->total_width = 0; diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c index f0eb3a64ba..18529b603e 100644 --- a/widgets/misc/e-web-view.c +++ b/widgets/misc/e-web-view.c @@ -75,6 +75,8 @@ enum { PROP_ANIMATE, PROP_CARET_MODE, PROP_COPY_TARGET_LIST, + PROP_CURSOR_IMAGE, + PROP_CURSOR_IMAGE_SRC, PROP_DISABLE_PRINTING, PROP_DISABLE_SAVE_TO_DISK, PROP_EDITABLE, @@ -85,9 +87,7 @@ enum { PROP_PASTE_TARGET_LIST, PROP_PRINT_PROXY, PROP_SAVE_AS_PROXY, - PROP_SELECTED_URI, - PROP_CURSOR_IMAGE, - PROP_CURSOR_IMAGE_SRC + PROP_SELECTED_URI }; enum { @@ -490,7 +490,8 @@ web_view_button_press_event_cb (EWebView *web_view, if (anim != NULL) g_object_unref (anim); - image_src = gtk_html_get_image_src_at (frame, event->x, event->y); + image_src = gtk_html_get_image_src_at ( + frame, event->x, event->y); e_web_view_set_cursor_image_src (web_view, image_src); g_free (image_src); } @@ -578,6 +579,18 @@ web_view_set_property (GObject *object, g_value_get_boolean (value)); return; + case PROP_CURSOR_IMAGE: + e_web_view_set_cursor_image ( + E_WEB_VIEW (object), + g_value_get_object (value)); + return; + + case PROP_CURSOR_IMAGE_SRC: + e_web_view_set_cursor_image_src ( + E_WEB_VIEW (object), + g_value_get_string (value)); + return; + case PROP_DISABLE_PRINTING: e_web_view_set_disable_printing ( E_WEB_VIEW (object), @@ -637,16 +650,6 @@ web_view_set_property (GObject *object, E_WEB_VIEW (object), g_value_get_string (value)); return; - case PROP_CURSOR_IMAGE: - e_web_view_set_cursor_image ( - E_WEB_VIEW (object), - g_value_get_object (value)); - return; - case PROP_CURSOR_IMAGE_SRC: - e_web_view_set_cursor_image_src ( - E_WEB_VIEW (object), - g_value_get_string (value)); - return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -677,6 +680,18 @@ web_view_get_property (GObject *object, E_WEB_VIEW (object))); return; + case PROP_CURSOR_IMAGE: + g_value_set_object ( + value, e_web_view_get_cursor_image ( + E_WEB_VIEW (object))); + return; + + case PROP_CURSOR_IMAGE_SRC: + g_value_set_string ( + value, e_web_view_get_cursor_image_src ( + E_WEB_VIEW (object))); + return; + case PROP_DISABLE_PRINTING: g_value_set_boolean ( value, e_web_view_get_disable_printing ( @@ -742,17 +757,6 @@ web_view_get_property (GObject *object, value, e_web_view_get_selected_uri ( E_WEB_VIEW (object))); return; - - case PROP_CURSOR_IMAGE: - g_value_set_object ( - value, e_web_view_get_cursor_image ( - E_WEB_VIEW (object))); - return; - case PROP_CURSOR_IMAGE_SRC: - g_value_set_string ( - value, e_web_view_get_cursor_image_src ( - E_WEB_VIEW (object))); - return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -1406,6 +1410,26 @@ e_web_view_class_init (EWebViewClass *class) g_object_class_install_property ( object_class, + PROP_CURSOR_IMAGE, + g_param_spec_object ( + "cursor-image", + "Image animation at the mouse cursor", + NULL, + GDK_TYPE_PIXBUF_ANIMATION, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_CURSOR_IMAGE_SRC, + g_param_spec_string ( + "cursor-image-src", + "Image source uri at the mouse cursor", + NULL, + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, PROP_DISABLE_PRINTING, g_param_spec_boolean ( "disable-printing", @@ -1512,26 +1536,6 @@ e_web_view_class_init (EWebViewClass *class) NULL, G_PARAM_READWRITE)); - g_object_class_install_property ( - object_class, - PROP_CURSOR_IMAGE, - g_param_spec_object ( - "cursor-image", - "Image animation at the mouse cursor", - NULL, - GDK_TYPE_PIXBUF_ANIMATION, - G_PARAM_READWRITE)); - - g_object_class_install_property ( - object_class, - PROP_CURSOR_IMAGE_SRC, - g_param_spec_string ( - "cursor-image-src", - "Image source uri at the mouse cursor", - NULL, - NULL, - G_PARAM_READWRITE)); - signals[COPY_CLIPBOARD] = g_signal_new ( "copy-clipboard", G_TYPE_FROM_CLASS (class), |