[evolution/webkit-composer] Minor coding style update
- From: Dan VrÃtil <dvratil src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/webkit-composer] Minor coding style update
- Date: Tue, 11 Sep 2012 11:36:28 +0000 (UTC)
commit 9750a80b27096473886fe1860ab2787b31b8a930
Author: Dan VrÃtil <dvratil redhat com>
Date: Tue Sep 11 11:47:57 2012 +0200
Minor coding style update
composer/e-composer-actions.c | 18 +-
composer/e-composer-private.c | 21 ++-
composer/e-msg-composer.c | 366 ++++++++++++++++++++++++-------------
widgets/editor/e-editor-actions.c | 4 +-
4 files changed, 268 insertions(+), 141 deletions(-)
---
diff --git a/composer/e-composer-actions.c b/composer/e-composer-actions.c
index c736e63..1692e44 100644
--- a/composer/e-composer-actions.c
+++ b/composer/e-composer-actions.c
@@ -47,8 +47,9 @@ action_charset_cb (GtkRadioAction *action,
{
const gchar *charset;
- if (action != current)
+ if (action != current) {
return;
+ }
charset = g_object_get_data (G_OBJECT (action), "charset");
@@ -60,8 +61,9 @@ static void
action_close_cb (GtkAction *action,
EMsgComposer *composer)
{
- if (e_msg_composer_can_close (composer, TRUE))
+ if (e_msg_composer_can_close (composer, TRUE)) {
gtk_widget_destroy (GTK_WIDGET (composer));
+ }
}
static void
@@ -121,12 +123,13 @@ action_preferences_cb (GtkAction *action,
GTK_WIN_POS_CENTER_ON_PARENT);
gtk_window_present (GTK_WINDOW (preferences_window));
- if (e_shell_get_express_mode (shell))
+ if (e_shell_get_express_mode (shell)) {
e_preferences_window_filter_page (
E_PREFERENCES_WINDOW (preferences_window), page_name);
- else
+ } else {
e_preferences_window_show_page (
E_PREFERENCES_WINDOW (preferences_window), page_name);
+ }
}
static void
@@ -228,8 +231,9 @@ action_save_as_cb (GtkAction *action,
response = gtk_dialog_run (GTK_DIALOG (dialog));
- if (response != GTK_RESPONSE_OK)
+ if (response != GTK_RESPONSE_OK) {
goto exit;
+ }
editor = e_editor_window_get_editor (E_EDITOR_WINDOW (composer));
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
@@ -259,9 +263,9 @@ action_send_cb (GtkAction *action,
/* If we're online, send the message now.
* Otherwise write the message to Outbox. */
- if (camel_session_get_online (session))
+ if (camel_session_get_online (session)) {
e_msg_composer_send (composer);
- else {
+ } else {
/* Inform the user. */
e_alert_run_dialog_for_args (
GTK_WINDOW (composer),
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index 7faa39a..2f9cc5f 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -519,14 +519,16 @@ e_composer_find_data_file (const gchar *basename)
/* Support running directly from the source tree. */
filename = g_build_filename (".", basename, NULL);
- if (g_file_test (filename, G_FILE_TEST_EXISTS))
+ if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
return filename;
+ }
g_free (filename);
/* XXX This is kinda broken. */
filename = g_build_filename (EVOLUTION_UIDIR, basename, NULL);
- if (g_file_test (filename, G_FILE_TEST_EXISTS))
+ if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
return filename;
+ }
g_free (filename);
g_critical ("Could not locate '%s'", basename);
@@ -558,11 +560,13 @@ e_composer_get_default_charset (void)
g_object_unref (settings);
- if (charset == NULL)
+ if (charset == NULL) {
charset = g_strdup (camel_iconv_locale_charset ());
+ }
- if (charset == NULL)
+ if (charset == NULL) {
charset = g_strdup ("us-ascii");
+ }
return charset;
}
@@ -709,13 +713,15 @@ e_composer_paste_image (EMsgComposer *composer,
}
/* Save the pixbuf as a temporary file in image/png format. */
- if (!gdk_pixbuf_save (pixbuf, filename, "png", &error, NULL))
+ if (!gdk_pixbuf_save (pixbuf, filename, "png", &error, NULL)) {
goto exit;
+ }
/* Convert the filename to a URI. */
uri = g_filename_to_uri (filename, NULL, &error);
- if (uri == NULL)
+ if (uri == NULL) {
goto exit;
+ }
/* In HTML mode, paste the image into the message body.
* In text mode, add the image to the attachment store. */
@@ -824,8 +830,9 @@ e_composer_selection_is_image_uris (EMsgComposer *composer,
uris = gtk_selection_data_get_uris (selection);
- if (uris == NULL)
+ if (uris == NULL) {
return FALSE;
+ }
for (ii = 0; uris[ii] != NULL; ii++) {
GFile *file;
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index ccadb02..4179f98 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -228,8 +228,9 @@ emcu_part_to_html (CamelSession *session,
g_object_unref (mem);
text = (gchar *) buf->data;
- if (len)
+ if (len) {
*len = buf->len - 1;
+ }
g_byte_array_free (buf, FALSE);
return text;
@@ -241,12 +242,15 @@ emcu_remove_xevolution_headers (CamelMimeMessage *message)
{
struct _camel_header_raw *scan, *list = NULL;
- for (scan = ((CamelMimePart *) message)->headers; scan; scan = scan->next)
- if (!strncmp (scan->name, "X-Evolution", 11))
+ for (scan = ((CamelMimePart *) message)->headers; scan; scan = scan->next) {
+ if (!strncmp (scan->name, "X-Evolution", 11)) {
camel_header_raw_append (&list, scan->name, scan->value, scan->offset);
+ }
+ }
- for (scan = list; scan; scan = scan->next)
+ for (scan = list; scan; scan = scan->next) {
camel_medium_remove_header ((CamelMedium *) message, scan->name);
+ }
return list;
}
@@ -258,11 +262,13 @@ destination_list_to_vector_sized (GList *list,
EDestination **destv;
gint i = 0;
- if (n == -1)
+ if (n == -1) {
n = g_list_length (list);
+ }
- if (n == 0)
+ if (n == 0) {
return NULL;
+ }
destv = g_new (EDestination *, n + 1);
while (list != NULL && i < n) {
@@ -291,18 +297,22 @@ text_requires_quoted_printable (const gchar *text,
const gchar *p;
gsize pos;
- if (!text)
+ if (!text) {
return FALSE;
+ }
- if (len == -1)
+ if (len == -1) {
len = strlen (text);
+ }
- if (len >= 5 && strncmp (text, "From ", 5) == 0)
+ if (len >= 5 && strncmp (text, "From ", 5) == 0) {
return TRUE;
+ }
for (p = text, pos = 0; pos + 6 <= len; pos++, p++) {
- if (*p == '\n' && strncmp (p + 1, "From ", 5) == 0)
+ if (*p == '\n' && strncmp (p + 1, "From ", 5) == 0) {
return TRUE;
+ }
}
return FALSE;
@@ -317,12 +327,14 @@ best_encoding (GByteArray *buf,
gint status, count = 0;
iconv_t cd;
- if (!charset)
+ if (!charset) {
return -1;
+ }
cd = camel_iconv_open (charset, "utf-8");
- if (cd == (iconv_t) -1)
+ if (cd == (iconv_t) -1) {
return -1;
+ }
in = (gchar *) buf->data;
inlen = buf->len;
@@ -331,23 +343,26 @@ best_encoding (GByteArray *buf,
outlen = sizeof (outbuf);
status = camel_iconv (cd, (const gchar **) &in, &inlen, &out, &outlen);
for (ch = out - 1; ch >= outbuf; ch--) {
- if ((guchar) *ch > 127)
+ if ((guchar) *ch > 127) {
count++;
+ }
}
} while (status == (gsize) -1 && errno == E2BIG);
camel_iconv_close (cd);
- if (status == (gsize) -1 || status > 0)
+ if (status == (gsize) -1 || status > 0) {
return -1;
+ }
if ((count == 0) && (buf->len < LINE_LEN) &&
!text_requires_quoted_printable (
- (const gchar *) buf->data, buf->len))
+ (const gchar *) buf->data, buf->len)) {
return CAMEL_TRANSFER_ENCODING_7BIT;
- else if (count <= buf->len * 0.17)
+ } else if (count <= buf->len * 0.17) {
return CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE;
- else
+ } else {
return CAMEL_TRANSFER_ENCODING_BASE64;
+ }
}
static gchar *
@@ -459,8 +474,9 @@ set_recipients_from_destv (CamelMimeMessage *msg,
seen_hidden_list = TRUE;
}
- if (camel_address_decode (CAMEL_ADDRESS (target), text_addr) <= 0)
+ if (camel_address_decode (CAMEL_ADDRESS (target), text_addr) <= 0) {
camel_internet_address_add (target, "", text_addr);
+ }
}
}
@@ -474,23 +490,26 @@ set_recipients_from_destv (CamelMimeMessage *msg,
seen_hidden_list = TRUE;
}
- if (camel_address_decode (CAMEL_ADDRESS (target), text_addr) <= 0)
+ if (camel_address_decode (CAMEL_ADDRESS (target), text_addr) <= 0) {
camel_internet_address_add (target, "", text_addr);
+ }
}
}
for (i = 0; bcc_destv != NULL && bcc_destv[i] != NULL; ++i) {
text_addr = e_destination_get_address (bcc_destv[i]);
if (text_addr && *text_addr) {
- if (camel_address_decode (CAMEL_ADDRESS (bcc_addr), text_addr) <= 0)
+ if (camel_address_decode (CAMEL_ADDRESS (bcc_addr), text_addr) <= 0) {
camel_internet_address_add (bcc_addr, "", text_addr);
+ }
}
}
- if (redirect)
+ if (redirect) {
header = CAMEL_RECIPIENT_TYPE_RESENT_TO;
- else
+ } else {
header = CAMEL_RECIPIENT_TYPE_TO;
+ }
if (camel_address_length (CAMEL_ADDRESS (to_addr)) > 0) {
camel_mime_message_set_recipients (msg, header, to_addr);
@@ -574,8 +593,9 @@ build_message_headers (EMsgComposer *composer,
value = camel_address_encode (CAMEL_ADDRESS (addr));
camel_medium_set_header (medium, "Resent-From", value);
g_free (value);
- } else
+ } else {
camel_mime_message_set_from (message, addr);
+ }
g_object_unref (addr);
/* X-Evolution-Identity */
@@ -600,8 +620,9 @@ build_message_headers (EMsgComposer *composer,
addr = camel_internet_address_new ();
- if (camel_address_unformat (CAMEL_ADDRESS (addr), reply_to) > 0)
+ if (camel_address_unformat (CAMEL_ADDRESS (addr), reply_to) > 0) {
camel_mime_message_set_reply_to (message, addr);
+ }
g_object_unref (addr);
}
@@ -708,8 +729,9 @@ composer_build_message_pgp (AsyncContext *context,
gboolean encrypt_to_self;
/* Return silently if we're not signing or encrypting with PGP. */
- if (!context->pgp_sign && !context->pgp_encrypt)
+ if (!context->pgp_sign && !context->pgp_encrypt) {
return TRUE;
+ }
extension_name = E_SOURCE_EXTENSION_OPENPGP;
extension = e_source_get_extension (context->source, extension_name);
@@ -725,16 +747,18 @@ composer_build_message_pgp (AsyncContext *context,
CAMEL_MEDIUM (mime_part),
context->top_level_part);
- if (context->top_level_part == context->text_plain_part)
+ if (context->top_level_part == context->text_plain_part) {
camel_mime_part_set_encoding (
mime_part, context->plain_encoding);
+ }
g_object_unref (context->top_level_part);
context->top_level_part = NULL;
- if (pgp_key_id == NULL || *pgp_key_id == '\0')
+ if (pgp_key_id == NULL || *pgp_key_id == '\0') {
camel_internet_address_get (
context->from, 0, NULL, &pgp_key_id);
+ }
if (context->pgp_sign) {
CamelMimePart *npart;
@@ -771,10 +795,11 @@ composer_build_message_pgp (AsyncContext *context,
/* Check to see if we should encrypt to self.
* NB: Gets removed immediately after use. */
- if (encrypt_to_self && pgp_key_id != NULL)
+ if (encrypt_to_self && pgp_key_id != NULL) {
g_ptr_array_add (
context->recipients,
g_strdup (pgp_key_id));
+ }
cipher = camel_gpg_context_new (context->session);
camel_gpg_context_set_always_trust (
@@ -786,10 +811,11 @@ composer_build_message_pgp (AsyncContext *context,
g_object_unref (cipher);
- if (encrypt_to_self && pgp_key_id != NULL)
+ if (encrypt_to_self && pgp_key_id != NULL) {
g_ptr_array_set_size (
context->recipients,
context->recipients->len - 1);
+ }
g_object_unref (mime_part);
@@ -827,8 +853,9 @@ composer_build_message_smime (AsyncContext *context,
gboolean have_encryption_certificate;
/* Return silently if we're not signing or encrypting with S/MIME. */
- if (!context->smime_sign && !context->smime_encrypt)
+ if (!context->smime_sign && !context->smime_encrypt) {
return TRUE;
+ }
extension_name = E_SOURCE_EXTENSION_SMIME;
extension = e_source_get_extension (context->source, extension_name);
@@ -877,9 +904,10 @@ composer_build_message_smime (AsyncContext *context,
CAMEL_MEDIUM (mime_part),
context->top_level_part);
- if (context->top_level_part == context->text_plain_part)
+ if (context->top_level_part == context->text_plain_part) {
camel_mime_part_set_encoding (
mime_part, context->plain_encoding);
+ }
g_object_unref (context->top_level_part);
context->top_level_part = NULL;
@@ -928,10 +956,11 @@ composer_build_message_smime (AsyncContext *context,
/* Check to see if we should encrypt to self.
* NB: Gets removed immediately after use. */
- if (encrypt_to_self)
+ if (encrypt_to_self) {
g_ptr_array_add (
context->recipients, g_strdup (
encryption_certificate));
+ }
cipher = camel_smime_context_new (context->session);
camel_smime_context_set_encrypt_key (
@@ -949,10 +978,11 @@ composer_build_message_smime (AsyncContext *context,
if (!success)
return FALSE;
- if (encrypt_to_self)
+ if (encrypt_to_self) {
g_ptr_array_set_size (
context->recipients,
context->recipients->len - 1);
+ }
}
/* we replaced the message directly, we don't want to do reparenting foo */
@@ -1028,22 +1058,27 @@ composer_add_evolution_format_header (CamelMedium *medium,
string = g_string_sized_new (128);
- if (flags & COMPOSER_FLAG_HTML_CONTENT)
+ if (flags & COMPOSER_FLAG_HTML_CONTENT) {
g_string_append (string, "text/html");
- else
+ } else {
g_string_append (string, "text/plain");
+ }
- if (flags & COMPOSER_FLAG_PGP_SIGN)
+ if (flags & COMPOSER_FLAG_PGP_SIGN) {
g_string_append (string, ", pgp-sign");
+ }
- if (flags & COMPOSER_FLAG_PGP_ENCRYPT)
+ if (flags & COMPOSER_FLAG_PGP_ENCRYPT) {
g_string_append (string, ", pgp-encrypt");
+ }
- if (flags & COMPOSER_FLAG_SMIME_SIGN)
+ if (flags & COMPOSER_FLAG_SMIME_SIGN) {
g_string_append (string, ", smime-sign");
+ }
- if (flags & COMPOSER_FLAG_SMIME_ENCRYPT)
+ if (flags & COMPOSER_FLAG_SMIME_ENCRYPT) {
g_string_append (string, ", smime-encrypt");
+ }
camel_medium_add_header (
medium, "X-Evolution-Format", string->str);
@@ -1102,17 +1137,21 @@ composer_build_message (EMsgComposer *composer,
context->session = g_object_ref (session);
context->from = e_msg_composer_get_from (composer);
- if (flags & COMPOSER_FLAG_PGP_SIGN)
+ if (flags & COMPOSER_FLAG_PGP_SIGN) {
context->pgp_sign = TRUE;
+ }
- if (flags & COMPOSER_FLAG_PGP_ENCRYPT)
+ if (flags & COMPOSER_FLAG_PGP_ENCRYPT) {
context->pgp_encrypt = TRUE;
+ }
- if (flags & COMPOSER_FLAG_SMIME_SIGN)
+ if (flags & COMPOSER_FLAG_SMIME_SIGN) {
context->smime_sign = TRUE;
+ }
- if (flags & COMPOSER_FLAG_SMIME_ENCRYPT)
+ if (flags & COMPOSER_FLAG_SMIME_ENCRYPT) {
context->smime_encrypt = TRUE;
+ }
context->need_thread =
context->pgp_sign || context->pgp_encrypt ||
@@ -1160,19 +1199,22 @@ composer_build_message (EMsgComposer *composer,
const gchar *mdn_address;
mdn_address = e_source_mail_identity_get_reply_to (mi);
- if (mdn_address == NULL)
+ if (mdn_address == NULL) {
mdn_address = e_source_mail_identity_get_address (mi);
- if (mdn_address != NULL)
+ }
+ if (mdn_address != NULL) {
camel_medium_add_header (
CAMEL_MEDIUM (context->message),
"Disposition-Notification-To", mdn_address);
+ }
}
/* X-Priority */
- if (flags & COMPOSER_FLAG_PRIORITIZE_MESSAGE)
+ if (flags & COMPOSER_FLAG_PRIORITIZE_MESSAGE) {
camel_medium_add_header (
CAMEL_MEDIUM (context->message),
"X-Priority", "1");
+ }
/* Organization */
if (organization != NULL && *organization != '\0') {
@@ -1240,12 +1282,14 @@ composer_build_message (EMsgComposer *composer,
g_object_unref (mem_stream);
/* Convert the stream to the appropriate charset. */
- if (iconv_charset && g_ascii_strcasecmp (iconv_charset, "UTF-8") != 0)
+ if (iconv_charset && g_ascii_strcasecmp (iconv_charset, "UTF-8") != 0) {
composer_add_charset_filter (stream, iconv_charset);
+ }
/* Encode the stream to quoted-printable if necessary. */
- if (context->plain_encoding == CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE)
+ if (context->plain_encoding == CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE) {
composer_add_quoted_printable_filter (stream);
+ }
/* Construct the content object. This does not block since
* we're constructing the data wrapper from a memory stream. */
@@ -1257,8 +1301,9 @@ composer_build_message (EMsgComposer *composer,
context->text_plain_part = g_object_ref (context->top_level_part);
/* Avoid re-encoding the data when adding it to a MIME part. */
- if (context->plain_encoding == CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE)
+ if (context->plain_encoding == CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE) {
context->top_level_part->encoding = context->plain_encoding;
+ }
camel_data_wrapper_set_mime_type_field (
context->top_level_part, type);
@@ -1303,8 +1348,9 @@ composer_build_message (EMsgComposer *composer,
stream = camel_stream_filter_new (mem_stream);
g_object_unref (mem_stream);
- if (pre_encode)
+ if (pre_encode) {
composer_add_quoted_printable_filter (stream);
+ }
/* Construct the content object. This does not block since
* we're constructing the data wrapper from a memory stream. */
@@ -1317,9 +1363,10 @@ composer_build_message (EMsgComposer *composer,
html, "text/html; charset=utf-8");
/* Avoid re-encoding the data when adding it to a MIME part. */
- if (pre_encode)
+ if (pre_encode) {
html->encoding =
CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE;
+ }
/* Build the multipart/alternative */
body = camel_multipart_new ();
@@ -1372,9 +1419,10 @@ composer_build_message (EMsgComposer *composer,
context->top_level_part =
CAMEL_DATA_WRAPPER (html_with_images);
- } else
+ } else {
context->top_level_part =
CAMEL_DATA_WRAPPER (body);
+ }
}
/* If there are attachments, wrap what we've built so far
@@ -1389,9 +1437,10 @@ composer_build_message (EMsgComposer *composer,
camel_medium_set_content (
CAMEL_MEDIUM (part),
context->top_level_part);
- if (context->top_level_part == context->text_plain_part)
+ if (context->top_level_part == context->text_plain_part) {
camel_mime_part_set_encoding (
part, context->plain_encoding);
+ }
camel_multipart_add_part (multipart, part);
g_object_unref (part);
@@ -1403,13 +1452,14 @@ composer_build_message (EMsgComposer *composer,
}
/* Run any blocking operations in a separate thread. */
- if (context->need_thread)
+ if (context->need_thread) {
g_simple_async_result_run_in_thread (
simple, (GSimpleAsyncThreadFunc)
composer_build_message_thread,
io_priority, cancellable);
- else
+ } else {
g_simple_async_result_complete (simple);
+ }
g_object_unref (simple);
}
@@ -1429,20 +1479,23 @@ composer_build_message_finish (EMsgComposer *composer,
simple = G_SIMPLE_ASYNC_RESULT (result);
context = g_simple_async_result_get_op_res_gpointer (simple);
- if (g_simple_async_result_propagate_error (simple, error))
+ if (g_simple_async_result_propagate_error (simple, error)) {
return NULL;
+ }
/* Finalize some details before returning. */
- if (!context->skip_content)
+ if (!context->skip_content) {
camel_medium_set_content (
CAMEL_MEDIUM (context->message),
context->top_level_part);
+ }
- if (context->top_level_part == context->text_plain_part)
+ if (context->top_level_part == context->text_plain_part) {
camel_mime_part_set_encoding (
CAMEL_MIME_PART (context->message),
context->plain_encoding);
+ }
return g_object_ref (context->message);
}
@@ -1462,8 +1515,9 @@ use_top_signature (EMsgComposer *composer)
* signature placement is either there already, or pt it at the
* bottom regardless of a preferences (which is for reply anyway,
* not for Edit as new) */
- if (priv->is_from_message)
+ if (priv->is_from_message) {
return FALSE;
+ }
shell = e_msg_composer_get_shell (composer);
shell_settings = e_shell_get_shell_settings (shell);
@@ -1521,8 +1575,9 @@ set_editor_text (EMsgComposer *composer,
editor_widget = e_editor_get_editor_widget (editor);
e_editor_widget_set_text_html (editor_widget, body);
- if (set_signature)
+ if (set_signature) {
e_composer_update_signature (composer);
+ }
g_free (body);
}
@@ -1551,8 +1606,9 @@ msg_composer_subject_changed_cb (EMsgComposer *composer)
table = e_msg_composer_get_header_table (composer);
subject = e_composer_header_table_get_subject (table);
- if (subject == NULL || *subject == '\0')
+ if (subject == NULL || *subject == '\0') {
subject = _("Compose Message");
+ }
gtk_window_set_title (GTK_WINDOW (composer), subject);
}
@@ -1583,8 +1639,9 @@ msg_composer_mail_identity_changed_cb (EMsgComposer *composer)
uid = e_composer_header_table_get_identity_uid (table);
/* Silently return if no identity is selected. */
- if (uid == NULL)
+ if (uid == NULL) {
return;
+ }
source = e_source_registry_ref_source (registry, uid);
g_return_if_fail (source != NULL);
@@ -1752,14 +1809,16 @@ msg_composer_drag_data_received_cb (GtkWidget *widget,
/* If we're receiving an image, we want the image to be
* inserted in the message body. Let GtkHtml handle it. */
- if (gtk_selection_data_targets_include_image (selection, TRUE))
+ if (gtk_selection_data_targets_include_image (selection, TRUE)) {
return;
+ }
/* If we're receiving URIs and -all- the URIs point to
* image files, we want the image(s) to be inserted in
* the message body. Let GtkHtml handle it. */
- if (e_composer_selection_is_image_uris (composer, selection))
+ if (e_composer_selection_is_image_uris (composer, selection)) {
return;
+ }
}
view = e_msg_composer_get_attachment_view (composer);
@@ -1800,8 +1859,9 @@ msg_composer_delete_event_cb (EMsgComposer *composer)
/* If the "async" action group is insensitive, it means an
* asynchronous operation is in progress. Block the event. */
- if (!gtk_action_group_get_sensitive (composer->priv->async_actions))
+ if (!gtk_action_group_get_sensitive (composer->priv->async_actions)) {
return TRUE;
+ }
application = GTK_APPLICATION (shell);
windows = gtk_application_get_windows (application);
@@ -1932,8 +1992,9 @@ msg_composer_gallery_drag_data_get (GtkIconView *icon_view,
GdkAtom target;
gchar *str_data;
- if (!gtk_icon_view_get_cursor (icon_view, &path, &cell))
+ if (!gtk_icon_view_get_cursor (icon_view, &path, &cell)) {
return;
+ }
target = gtk_selection_data_get_target (selection_data);
@@ -2294,24 +2355,27 @@ msg_composer_image_uri (EMsgComposer *composer,
hash_table = composer->priv->inline_images_by_url;
part = g_hash_table_lookup (hash_table, uri);
- if (part == NULL && g_str_has_prefix (uri, "file:"))
+ if (part == NULL && g_str_has_prefix (uri, "file:")) {
part = e_msg_composer_add_inline_image_from_file (
composer, uri + 5);
+ }
if (part == NULL && g_str_has_prefix (uri, "cid:")) {
hash_table = composer->priv->inline_images;
part = g_hash_table_lookup (hash_table, uri);
}
- if (part == NULL)
+ if (part == NULL) {
return NULL;
+ }
composer->priv->current_images =
g_list_prepend (composer->priv->current_images, part);
cid = camel_mime_part_get_content_id (part);
- if (cid == NULL)
+ if (cid == NULL) {
return NULL;
+ }
return g_strconcat ("cid:", cid, NULL);
}
@@ -2518,8 +2582,9 @@ e_msg_composer_flush_pending_body (EMsgComposer *composer)
body = g_object_get_data (G_OBJECT (composer), "body:text");
- if (body != NULL)
+ if (body != NULL) {
set_editor_text (composer, body, FALSE);
+ }
g_object_set_data (G_OBJECT (composer), "body:text", NULL);
}
@@ -2534,8 +2599,9 @@ add_attachments_handle_mime_part (EMsgComposer *composer,
CamelContentType *content_type;
CamelDataWrapper *wrapper;
- if (!mime_part)
+ if (!mime_part) {
return;
+ }
content_type = camel_mime_part_get_content_type (mime_part);
wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
@@ -2613,8 +2679,9 @@ e_msg_composer_add_message_attachments (EMsgComposer *composer,
CamelDataWrapper *wrapper;
wrapper = camel_medium_get_content (CAMEL_MEDIUM (message));
- if (!CAMEL_IS_MULTIPART (wrapper))
+ if (!CAMEL_IS_MULTIPART (wrapper)) {
return;
+ }
add_attachments_from_multipart (
composer, (CamelMultipart *) wrapper, just_inlines, 0);
@@ -2641,21 +2708,24 @@ handle_multipart_signed (EMsgComposer *composer,
content_type = camel_data_wrapper_get_mime_type_field (content);
protocol = camel_content_type_param (content_type, "protocol");
- if (protocol == NULL)
+ if (protocol == NULL) {
action = NULL;
- else if (g_ascii_strcasecmp (protocol, "application/pgp-signature") == 0)
+ } else if (g_ascii_strcasecmp (protocol, "application/pgp-signature") == 0) {
action = GTK_TOGGLE_ACTION (ACTION (PGP_SIGN));
- else if (g_ascii_strcasecmp (protocol, "application/x-pkcs7-signature") == 0)
+ } else if (g_ascii_strcasecmp (protocol, "application/x-pkcs7-signature") == 0) {
action = GTK_TOGGLE_ACTION (ACTION (SMIME_SIGN));
+ }
- if (action)
+ if (action) {
gtk_toggle_action_set_active (action, TRUE);
+ }
mime_part = camel_multipart_get_part (
multipart, CAMEL_MULTIPART_SIGNED_CONTENT);
- if (mime_part == NULL)
+ if (mime_part == NULL) {
return;
+ }
content_type = camel_mime_part_get_content_type (mime_part);
content = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
@@ -2724,15 +2794,17 @@ handle_multipart_encrypted (EMsgComposer *composer,
protocol = camel_content_type_param (content_type, "protocol");
editor = e_editor_window_get_editor (E_EDITOR_WINDOW (composer));
- if (protocol && g_ascii_strcasecmp (protocol, "application/pgp-encrypted") == 0)
+ if (protocol && g_ascii_strcasecmp (protocol, "application/pgp-encrypted") == 0) {
action = GTK_TOGGLE_ACTION (ACTION (PGP_ENCRYPT));
- else if (content_type && (
+ } else if (content_type && (
camel_content_type_is (content_type, "application", "x-pkcs7-mime")
- || camel_content_type_is (content_type, "application", "pkcs7-mime")))
+ || camel_content_type_is (content_type, "application", "pkcs7-mime"))) {
action = GTK_TOGGLE_ACTION (ACTION (SMIME_ENCRYPT));
+ }
- if (action)
+ if (action) {
gtk_toggle_action_set_active (action, TRUE);
+ }
session = e_msg_composer_get_session (composer);
cipher = camel_gpg_context_new (session);
@@ -2741,8 +2813,9 @@ handle_multipart_encrypted (EMsgComposer *composer,
cipher, multipart, mime_part, cancellable, NULL);
g_object_unref (cipher);
- if (valid == NULL)
+ if (valid == NULL) {
return;
+ }
camel_cipher_validity_free (valid);
@@ -2818,8 +2891,9 @@ handle_multipart_alternative (EMsgComposer *composer,
mime_part = camel_multipart_get_part (multipart, i);
- if (!mime_part)
+ if (!mime_part) {
continue;
+ }
content_type = camel_mime_part_get_content_type (mime_part);
content = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
@@ -2893,8 +2967,9 @@ handle_multipart (EMsgComposer *composer,
mime_part = camel_multipart_get_part (multipart, i);
- if (!mime_part)
+ if (!mime_part) {
continue;
+ }
content_type = camel_mime_part_get_content_type (mime_part);
content = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
@@ -2997,8 +3072,9 @@ composer_add_auto_recipients (ESource *source,
g_object_get (extension, property_name, &addr_array, NULL);
- if (addr_array == NULL)
+ if (addr_array == NULL) {
return;
+ }
inet_addr = camel_internet_address_new ();
comma_separated_addrs = g_strjoinv (", ", addr_array);
@@ -3009,8 +3085,9 @@ composer_add_auto_recipients (ESource *source,
g_free (comma_separated_addrs);
g_strfreev (addr_array);
- if (retval == -1)
+ if (retval == -1) {
return;
+ }
length = camel_address_length (CAMEL_ADDRESS (inet_addr));
@@ -3018,11 +3095,12 @@ composer_add_auto_recipients (ESource *source,
const gchar *name;
const gchar *addr;
- if (camel_internet_address_get (inet_addr, ii, &name, &addr))
+ if (camel_internet_address_get (inet_addr, ii, &name, &addr)) {
g_hash_table_insert (
hash_table,
g_strdup (addr),
GINT_TO_POINTER (1));
+ }
}
g_object_unref (inet_addr);
@@ -3151,8 +3229,9 @@ e_msg_composer_new_with_message (EShell *shell,
e_destination_set_name (dest, name);
e_destination_set_email (dest, addr);
- if (g_hash_table_lookup (auto_cc, addr))
+ if (g_hash_table_lookup (auto_cc, addr)) {
e_destination_set_auto_recipient (dest, TRUE);
+ }
Cc = g_list_append (Cc, dest);
}
@@ -3171,8 +3250,9 @@ e_msg_composer_new_with_message (EShell *shell,
e_destination_set_name (dest, name);
e_destination_set_email (dest, addr);
- if (g_hash_table_lookup (auto_bcc, addr))
+ if (g_hash_table_lookup (auto_bcc, addr)) {
e_destination_set_auto_recipient (dest, TRUE);
+ }
Bcc = g_list_append (Bcc, dest);
}
@@ -3187,8 +3267,9 @@ e_msg_composer_new_with_message (EShell *shell,
Bccv = NULL;
}
- if (source != NULL)
+ if (source != NULL) {
g_object_unref (source);
+ }
subject = camel_mime_message_get_subject (message);
@@ -3318,10 +3399,12 @@ e_msg_composer_new_with_message (EShell *shell,
camel_content_type_is (
content_type, "application", "x-pkcs7-mime") ||
camel_content_type_is (
- content_type, "application", "pkcs7-mime")))
+ content_type, "application", "pkcs7-mime"))) {
+
gtk_toggle_action_set_active (
GTK_TOGGLE_ACTION (
ACTION (SMIME_ENCRYPT)), TRUE);
+ }
html = emcu_part_to_html (
session, CAMEL_MIME_PART (message),
@@ -3599,8 +3682,9 @@ msg_composer_save_to_drafts_cb (EMsgComposer *composer,
g_object_unref (message);
- if (e_msg_composer_is_exiting (composer))
+ if (e_msg_composer_is_exiting (composer)) {
g_object_weak_ref (G_OBJECT (context->activity), (GWeakNotify) gtk_widget_destroy, composer);
+ }
async_context_free (context);
}
@@ -3708,8 +3792,9 @@ e_msg_composer_save_to_outbox (EMsgComposer *composer)
/* This gives the user a chance to abort the save. */
g_signal_emit (composer, signals[PRESEND], 0, &proceed_with_save);
- if (!proceed_with_save)
+ if (!proceed_with_save) {
return;
+ }
context = g_slice_new0 (AsyncContext);
context->activity = e_composer_activity_new (composer);
@@ -3842,8 +3927,9 @@ list_contains_addr (const GList *list,
g_return_val_if_fail (dest != NULL, FALSE);
while (list != NULL) {
- if (e_destination_equal (dest, list->data))
+ if (e_destination_equal (dest, list->data)) {
return TRUE;
+ }
list = list->next;
}
@@ -3863,9 +3949,10 @@ merge_cc_bcc (EDestination **addrv,
for (ii = 0; addrv && addrv[ii]; ii++) {
if (!list_contains_addr (to, addrv[ii]) &&
!list_contains_addr (cc, addrv[ii]) &&
- !list_contains_addr (bcc, addrv[ii]))
+ !list_contains_addr (bcc, addrv[ii])) {
*merge_into = g_list_append (
*merge_into, g_object_ref (addrv[ii]));
+ }
}
}
@@ -3907,8 +3994,9 @@ file_is_blacklisted (const gchar *argument)
filename = g_file_get_path (file);
g_object_unref (file);
- if (filename == NULL)
+ if (filename == NULL) {
return FALSE;
+ }
parts = g_strsplit (filename, G_DIR_SEPARATOR_S, -1);
n_parts = g_strv_length (parts);
@@ -3926,25 +4014,30 @@ file_is_blacklisted (const gchar *argument)
gchar *base_dir;
/* Don't blacklist files in trusted base directories. */
- if (g_str_has_prefix (filename, g_get_user_data_dir ()))
+ if (g_str_has_prefix (filename, g_get_user_data_dir ())) {
blacklisted = FALSE;
- if (g_str_has_prefix (filename, g_get_user_cache_dir ()))
+ }
+ if (g_str_has_prefix (filename, g_get_user_cache_dir ())) {
blacklisted = FALSE;
- if (g_str_has_prefix (filename, g_get_user_config_dir ()))
+ }
+ if (g_str_has_prefix (filename, g_get_user_config_dir ())) {
blacklisted = FALSE;
+ }
/* Apparently KDE still uses ~/.kde heavily, and some
* distributions use ~/.kde4 to distinguish KDE4 data
* from KDE3 data. Trust these directories as well. */
base_dir = g_build_filename (g_get_home_dir (), ".kde", NULL);
- if (g_str_has_prefix (filename, base_dir))
+ if (g_str_has_prefix (filename, base_dir)) {
blacklisted = FALSE;
+ }
g_free (base_dir);
base_dir = g_build_filename (g_get_home_dir (), ".kde4", NULL);
- if (g_str_has_prefix (filename, base_dir))
+ if (g_str_has_prefix (filename, base_dir)) {
blacklisted = FALSE;
+ }
g_free (base_dir);
}
@@ -4053,10 +4146,11 @@ handle_mailto (EMsgComposer *composer,
E_ALERT_SINK (composer),
"mail:blacklisted-file",
content, NULL);
- if (g_ascii_strncasecmp (content, "file:", 5) == 0)
+ if (g_ascii_strncasecmp (content, "file:", 5) == 0) {
attachment = e_attachment_new_for_uri (content);
- else
+ } else {
attachment = e_attachment_new_for_path (content);
+ }
e_attachment_store_add_attachment (store, attachment);
e_attachment_load_async (
attachment, (GAsyncReadyCallback)
@@ -4077,8 +4171,9 @@ handle_mailto (EMsgComposer *composer,
p += clen;
if (*p == '&') {
p++;
- if (!g_ascii_strncasecmp (p, "amp;", 4))
+ if (!g_ascii_strncasecmp (p, "amp;", 4)) {
p += 4;
+ }
}
}
}
@@ -4440,13 +4535,15 @@ e_msg_composer_add_inline_image_from_file (EMsgComposer *composer,
dec_file_name = g_strdup (filename);
camel_url_decode (dec_file_name);
- if (!g_file_test (dec_file_name, G_FILE_TEST_IS_REGULAR))
+ if (!g_file_test (dec_file_name, G_FILE_TEST_IS_REGULAR)) {
return NULL;
+ }
stream = camel_stream_fs_new_with_name (
dec_file_name, O_RDONLY, 0, NULL);
- if (!stream)
+ if (!stream) {
return NULL;
+ }
wrapper = camel_data_wrapper_new ();
camel_data_wrapper_construct_from_stream_sync (
@@ -4454,8 +4551,9 @@ e_msg_composer_add_inline_image_from_file (EMsgComposer *composer,
g_object_unref (CAMEL_OBJECT (stream));
mime_type = e_util_guess_mime_type (dec_file_name, TRUE);
- if (mime_type == NULL)
+ if (mime_type == NULL) {
mime_type = g_strdup ("application/octet-stream");
+ }
camel_data_wrapper_set_mime_type (wrapper, mime_type);
g_free (mime_type);
@@ -4509,10 +4607,11 @@ e_msg_composer_add_inline_image_from_mime_part (EMsgComposer *composer,
g_object_ref (part);
location = camel_mime_part_get_content_location (part);
- if (location != NULL)
+ if (location != NULL) {
g_hash_table_insert (
p->inline_images_by_url,
g_strdup (location), part);
+ }
}
static void
@@ -4525,9 +4624,10 @@ composer_get_message_ready (EMsgComposer *composer,
message = composer_build_message_finish (composer, result, &error);
- if (message != NULL)
+ if (message != NULL) {
g_simple_async_result_set_op_res_gpointer (
simple, message, (GDestroyNotify) g_object_unref);
+ }
if (error != NULL) {
g_warn_if_fail (message == NULL);
@@ -4571,33 +4671,40 @@ e_msg_composer_get_message (EMsgComposer *composer,
g_simple_async_result_set_check_cancellable (simple, cancellable);
- if (e_editor_widget_get_mode (editor_widget) == E_EDITOR_WIDGET_MODE_HTML)
+ if (e_editor_widget_get_mode (editor_widget) == E_EDITOR_WIDGET_MODE_HTML) {
flags |= COMPOSER_FLAG_HTML_CONTENT;
+ }
action = ACTION (PRIORITIZE_MESSAGE);
- if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
+ if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
flags |= COMPOSER_FLAG_PRIORITIZE_MESSAGE;
+ }
action = ACTION (REQUEST_READ_RECEIPT);
- if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
+ if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
flags |= COMPOSER_FLAG_REQUEST_READ_RECEIPT;
+ }
action = ACTION (PGP_SIGN);
- if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
+ if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
flags |= COMPOSER_FLAG_PGP_SIGN;
+ }
action = ACTION (PGP_ENCRYPT);
- if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
+ if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
flags |= COMPOSER_FLAG_PGP_ENCRYPT;
+ }
#ifdef HAVE_NSS
action = ACTION (SMIME_SIGN);
- if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
+ if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
flags |= COMPOSER_FLAG_SMIME_SIGN;
+ }
action = ACTION (SMIME_ENCRYPT);
- if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
+ if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
flags |= COMPOSER_FLAG_SMIME_ENCRYPT;
+ }
#endif
composer_build_message (
@@ -4622,8 +4729,9 @@ e_msg_composer_get_message_finish (EMsgComposer *composer,
simple = G_SIMPLE_ASYNC_RESULT (result);
message = g_simple_async_result_get_op_res_gpointer (simple);
- if (g_simple_async_result_propagate_error (simple, error))
+ if (g_simple_async_result_propagate_error (simple, error)) {
return NULL;
+ }
g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL);
@@ -4673,8 +4781,9 @@ e_msg_composer_get_message_print_finish (EMsgComposer *composer,
simple = G_SIMPLE_ASYNC_RESULT (result);
message = g_simple_async_result_get_op_res_gpointer (simple);
- if (g_simple_async_result_propagate_error (simple, error))
+ if (g_simple_async_result_propagate_error (simple, error)) {
return NULL;
+ }
g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL);
@@ -4703,8 +4812,9 @@ e_msg_composer_get_message_draft (EMsgComposer *composer,
editor = e_editor_window_get_editor (E_EDITOR_WINDOW (composer));
editor_widget = e_editor_get_editor_widget (editor);
- if (e_editor_widget_get_mode (editor_widget) == E_EDITOR_WIDGET_MODE_HTML)
+ if (e_editor_widget_get_mode (editor_widget) == E_EDITOR_WIDGET_MODE_HTML) {
flags |= COMPOSER_FLAG_HTML_CONTENT;
+ }
composer_build_message (
composer, flags, io_priority,
@@ -4728,8 +4838,9 @@ e_msg_composer_get_message_draft_finish (EMsgComposer *composer,
simple = G_SIMPLE_ASYNC_RESULT (result);
message = g_simple_async_result_get_op_res_gpointer (simple);
- if (g_simple_async_result_propagate_error (simple, error))
+ if (g_simple_async_result_propagate_error (simple, error)) {
return NULL;
+ }
g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL);
@@ -4789,8 +4900,9 @@ e_msg_composer_get_reply_to (EMsgComposer *composer)
table = e_msg_composer_get_header_table (composer);
reply_to = e_composer_header_table_get_reply_to (table);
- if (reply_to == NULL || *reply_to == '\0')
+ if (reply_to == NULL || *reply_to == '\0') {
return NULL;
+ }
address = camel_internet_address_new ();
if (camel_address_unformat (CAMEL_ADDRESS (address), reply_to) == -1) {
@@ -4868,11 +4980,13 @@ e_msg_composer_can_close (EMsgComposer *composer,
/* this means that there is an async operation running,
* in which case the composer cannot be closed */
- if (!gtk_action_group_get_sensitive (composer->priv->async_actions))
+ if (!gtk_action_group_get_sensitive (composer->priv->async_actions)) {
return FALSE;
+ }
- if (!e_editor_widget_get_changed (editor_widget))
+ if (!e_editor_widget_get_changed (editor_widget)) {
return TRUE;
+ }
window = gtk_widget_get_window (widget);
gdk_window_raise (window);
@@ -4880,8 +4994,9 @@ e_msg_composer_can_close (EMsgComposer *composer,
table = e_msg_composer_get_header_table (composer);
subject = e_composer_header_table_get_subject (table);
- if (subject == NULL || *subject == '\0')
+ if (subject == NULL || *subject == '\0') {
subject = _("Untitled Message");
+ }
response = e_alert_run_dialog_for_args (
GTK_WINDOW (composer),
@@ -4971,9 +5086,10 @@ e_load_spell_languages (ESpellChecker *spell_checker)
ESpellDictionary *dict;
dict = e_spell_checker_lookup_dictionary (spell_checker, language_code);
- if (dict != NULL)
+ if (dict != NULL) {
spell_dicts = g_list_prepend (
spell_dicts, (gpointer) dict);
+ }
}
g_strfreev (strv);
diff --git a/widgets/editor/e-editor-actions.c b/widgets/editor/e-editor-actions.c
index f556165..03b9275 100644
--- a/widgets/editor/e-editor-actions.c
+++ b/widgets/editor/e-editor-actions.c
@@ -592,11 +592,11 @@ action_language_cb (GtkToggleAction *action,
/* Update the list of active dictionaries */
list = editor->priv->active_dictionaries;
- if (active)
+ if (active) {
list = g_list_insert_sorted (
list, (EnchantDict *) dictionary,
(GCompareFunc) e_spell_dictionary_compare);
- else {
+ } else {
GList *link;
link = g_list_find (list, dictionary);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]