diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-07-01 12:07:26 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-09-14 20:08:48 +0800 |
commit | ae9db3ed236b0c734fd12c8dc8c99764626bf0b8 (patch) | |
tree | bd45389467f43a96c36172d8a925dd5df041cf5b /mail | |
parent | db969c7f664d0a1d901bedd794b0c7e0762ede33 (diff) | |
download | gsoc2013-evolution-ae9db3ed236b0c734fd12c8dc8c99764626bf0b8.tar gsoc2013-evolution-ae9db3ed236b0c734fd12c8dc8c99764626bf0b8.tar.gz gsoc2013-evolution-ae9db3ed236b0c734fd12c8dc8c99764626bf0b8.tar.bz2 gsoc2013-evolution-ae9db3ed236b0c734fd12c8dc8c99764626bf0b8.tar.lz gsoc2013-evolution-ae9db3ed236b0c734fd12c8dc8c99764626bf0b8.tar.xz gsoc2013-evolution-ae9db3ed236b0c734fd12c8dc8c99764626bf0b8.tar.zst gsoc2013-evolution-ae9db3ed236b0c734fd12c8dc8c99764626bf0b8.zip |
Coding style and whitespace cleanup.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-migrate.c | 17 | ||||
-rw-r--r-- | mail/e-mail-notebook-view.c | 2 | ||||
-rw-r--r-- | mail/e-mail-reader-utils.c | 108 | ||||
-rw-r--r-- | mail/e-mail-session-utils.c | 4 | ||||
-rw-r--r-- | mail/em-account-editor.c | 24 | ||||
-rw-r--r-- | mail/em-composer-utils.c | 101 | ||||
-rw-r--r-- | mail/em-format-html-display.c | 44 | ||||
-rw-r--r-- | mail/em-format-html.c | 3 | ||||
-rw-r--r-- | mail/em-format-html.h | 2 | ||||
-rw-r--r-- | mail/em-utils.c | 46 | ||||
-rw-r--r-- | mail/importers/pine-importer.c | 31 | ||||
-rw-r--r-- | mail/mail-ops.c | 6 | ||||
-rw-r--r-- | mail/message-list.h | 7 |
13 files changed, 250 insertions, 145 deletions
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? */ |