[balsa/wip/gtk4: 330/351] SendmsgWindow: Take it private, and uncrustify it



commit 214148b102ecb770af151cba1ce8a82292737202
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Thu May 3 19:58:00 2018 -0400

    SendmsgWindow: Take it private, and uncrustify it

 src/ab-window.c      |    5 +-
 src/balsa-index.c    |   10 +-
 src/main-window.c    |    2 +-
 src/main.c           |    2 +-
 src/sendmsg-window.c | 3899 +++++++++++++++++++++++++++++---------------------
 src/sendmsg-window.h |  176 +--
 6 files changed, 2302 insertions(+), 1792 deletions(-)
---
diff --git a/src/ab-window.c b/src/ab-window.c
index 10b6f92..71377cd 100644
--- a/src/ab-window.c
+++ b/src/ab-window.c
@@ -591,7 +591,6 @@ balsa_ab_window_activate_address(GtkTreeView * view,
                                            GTK_TREE_VIEW(ab->
                                                          recipient_list));
     } else {
-        BalsaSendmsg *snd;
         GtkTreeModel *model =
             gtk_tree_view_get_model(GTK_TREE_VIEW(ab->address_list));
         GtkTreeIter iter;
@@ -605,10 +604,8 @@ balsa_ab_window_activate_address(GtkTreeView * view,
                            LIST_COLUMN_WHICH, &which_multiple, -1);
         addr = libbalsa_address_to_gchar(address, which_multiple);
        g_object_unref(G_OBJECT(address));
-        snd = sendmsg_window_compose_with_address(addr);
+        (void) sendmsg_window_compose_with_address(addr);
         g_free(addr);
-
-        gtk_widget_grab_focus(snd->subject[1]);
     }
 }
 
diff --git a/src/balsa-index.c b/src/balsa-index.c
index 558b1b6..4d848af 100644
--- a/src/balsa-index.c
+++ b/src/balsa-index.c
@@ -652,8 +652,8 @@ bndx_row_activated(GtkTreeView * tree_view, GtkTreePath * path,
          * balsa_message_continue: */
         BalsaSendmsg *sm =
             sendmsg_window_continue(mailbox, msgno);
-        if (sm)
-            g_signal_connect(G_OBJECT(sm->window), "destroy",
+        if (sm != NULL)
+            g_signal_connect(sendmsg_window_get_window(sm), "destroy",
                              G_CALLBACK(sendmsg_window_destroy_cb), NULL);
     } else
         message_window_new(mailbox, msgno);
@@ -1532,8 +1532,8 @@ bndx_compose_foreach(BalsaIndex * index, SendType send_type)
             g_assert_not_reached();
             sm = NULL; /** silence invalid warnings */
         }
-        if (sm)
-            g_signal_connect(G_OBJECT(sm->window), "destroy",
+        if (sm != NULL)
+            g_signal_connect(sendmsg_window_get_window(sm), "destroy",
                              G_CALLBACK(sendmsg_window_destroy_cb), NULL);
     }
     balsa_index_selected_msgnos_free(index, selected);
@@ -1579,7 +1579,7 @@ bndx_compose_from_list(BalsaIndex * index, SendType send_type)
                                      selected, send_type);
 
     balsa_index_selected_msgnos_free(index, selected);
-    g_signal_connect(G_OBJECT(sm->window), "destroy",
+    g_signal_connect(sendmsg_window_get_window(sm), "destroy",
                      G_CALLBACK(sendmsg_window_destroy_cb), NULL);
 }
 
diff --git a/src/main-window.c b/src/main-window.c
index cd724b6..cf82241 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -855,7 +855,7 @@ new_message_activated(GSimpleAction * action,
 
     smwindow = sendmsg_window_compose();
 
-    g_signal_connect(G_OBJECT(smwindow->window), "destroy",
+    g_signal_connect(sendmsg_window_get_window(smwindow), "destroy",
                      G_CALLBACK(bw_send_msg_window_destroy_cb), user_data);
 }
 
diff --git a/src/main.c b/src/main.c
index 8c202f1..db8240e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -446,7 +446,7 @@ balsa_check_open_compose_window(void)
         gchar **attach;
 
         snd = sendmsg_window_compose();
-        snd->quit_on_close = FALSE;
+        sendmsg_window_set_quit_on_close(snd, FALSE);
 
         if (opt_compose_email) {
             if (g_ascii_strncasecmp(opt_compose_email, "mailto:";, 7) == 0)
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 1688045..8924782 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -19,11 +19,11 @@
 /* FONT SELECTION DISCUSSION:
    We use pango now.
    Locale data is then used exclusively for the spelling checking.
-*/
+ */
 
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-# include "config.h"
+#   include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "sendmsg-window.h"
 
@@ -38,7 +38,7 @@
 #include <glib.h>
 
 #ifdef HAVE_LOCALE_H
-#include <locale.h>
+#   include <locale.h>
 #endif
 
 #include <sys/wait.h>
@@ -46,7 +46,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #ifdef HAVE_UNISTD_H
-#include <unistd.h>
+#   include <unistd.h>
 #endif
 #include <errno.h>
 #include "application-helpers.h"
@@ -68,80 +68,161 @@
 #include "macosx-helpers.h"
 
 #if !HAVE_GSPELL && !HAVE_GTKSPELL_3_0_3
-#include <enchant/enchant.h>
+#   include <enchant/enchant.h>
 #endif                          /* HAVE_GTKSPELL_3_0_3 */
 #if HAVE_GTKSPELL
-#include "gtkspell/gtkspell.h"
+#   include "gtkspell/gtkspell.h"
 #elif HAVE_GSPELL
-#include "gspell/gspell.h"
+#   include "gspell/gspell.h"
 #else                           /* HAVE_GTKSPELL */
-#include "spell-check.h"
+#   include "spell-check.h"
 #endif                          /* HAVE_GTKSPELL */
 #if HAVE_GTKSOURCEVIEW
-#include <gtksourceview/gtksource.h>
+#   include <gtksourceview/gtksource.h>
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
+typedef enum {
+    SENDMSG_STATE_CLEAN,
+    SENDMSG_STATE_MODIFIED,
+    SENDMSG_STATE_AUTO_SAVED
+} SendmsgState;
+
+struct _BalsaSendmsg {
+    GtkWidget           *window;
+    GtkWidget           *toolbar;
+    LibBalsaAddressView *recipient_view, *replyto_view;
+    GtkWidget           *from[2], *recipients[2], *subject[2], *fcc[2];
+    GtkWidget           *replyto[2];
+    GtkWidget           *tree_view;
+    gchar               *in_reply_to;
+    GList               *references;
+    GtkWidget           *text;
+#if !HAVE_GTKSPELL
+    GtkWidget *spell_checker;
+#endif                          /* HAVE_GTKSPELL */
+    GtkWidget       *notebook;
+    LibBalsaMessage *parent_message;     /* to which we're replying     */
+    LibBalsaMessage *draft_message;      /* where the message was saved */
+    SendType         type;
+    gboolean         is_continue;
+    /* language selection related data */
+    gchar     *spell_check_lang;
+    GtkWidget *current_language_menu;
+    /* identity related data */
+    LibBalsaIdentity *ident;
+    /* fcc mailbox */
+    gchar   *fcc_url;
+    gboolean update_config;     /* is the window being set up or in normal  */
+                                /* operation and user actions should update */
+                                /* the config */
+    gulong delete_sig_id;
+    gulong changed_sig_id;
+#if !HAVE_GTKSOURCEVIEW
+    gulong delete_range_sig_id;
+#endif                          /* HAVE_GTKSOURCEVIEW */
+    gulong       insert_text_sig_id;
+    guint        autosave_timeout_id;
+    SendmsgState state;
+    gulong       identities_changed_id;
+    gboolean     flow;          /* send format=flowed */
+    gboolean     send_mp_alt;   /* send multipart/alternative (plain and html) */
+    gboolean     req_mdn;       /* send a MDN */
+    gboolean     req_dsn;       /* send a delivery status notification */
+    gboolean     quit_on_close; /* quit balsa after the compose window */
+                                /* is closed.                          */
+#ifdef HAVE_GPGME
+    guint    gpg_mode;
+    gboolean attach_pubkey;
+#endif
+
+#if !HAVE_GTKSOURCEVIEW
+    GtkTextBuffer *buffer2;     /* Undo buffer. */
+#endif                          /* HAVE_GTKSOURCEVIEW */
+
+    /* To update cursor after text is inserted. */
+    GtkTextMark *insert_mark;
+
+    GtkWidget *paned;
+    gboolean   ready_to_send;
+};
+
 typedef struct {
-    pid_t pid_editor;
-    gchar *filename;
+    pid_t         pid_editor;
+    gchar        *filename;
     BalsaSendmsg *bsmsg;
 } balsa_edit_with_gnome_data;
 
-typedef enum { QUOTE_HEADERS, QUOTE_ALL, QUOTE_NOPREFIX } QuoteType;
+typedef enum {
+    QUOTE_HEADERS, QUOTE_ALL, QUOTE_NOPREFIX
+} QuoteType;
 
-static gint message_postpone(BalsaSendmsg * bsmsg);
+static gint message_postpone(BalsaSendmsg *bsmsg);
 
-static void balsa_sendmsg_destroy_handler(BalsaSendmsg * bsmsg);
-static void check_readiness(BalsaSendmsg * bsmsg);
+static void balsa_sendmsg_destroy_handler(BalsaSendmsg *bsmsg);
+static void check_readiness(BalsaSendmsg *bsmsg);
 static void init_menus(BalsaSendmsg *);
+
 #ifdef HAVE_GPGME
 static void bsmsg_setup_gpg_ui(BalsaSendmsg *bsmsg);
-static void bsmsg_update_gpg_ui_on_ident_change(BalsaSendmsg *bsmsg,
+static void bsmsg_update_gpg_ui_on_ident_change(BalsaSendmsg     *bsmsg,
                                                 LibBalsaIdentity *new_ident);
-static void bsmsg_setup_gpg_ui_by_mode(BalsaSendmsg *bsmsg, gint mode);
+static void bsmsg_setup_gpg_ui_by_mode(BalsaSendmsg *bsmsg,
+                                       gint          mode);
+
 #endif
 
 #if !HAVE_GSPELL && !HAVE_GTKSPELL_3_0_3
-static void sw_spell_check_weak_notify(BalsaSendmsg * bsmsg);
+static void sw_spell_check_weak_notify(BalsaSendmsg *bsmsg);
+
 #endif                          /* HAVE_GTKSPELL */
 
-static void address_book_cb(LibBalsaAddressView * address_view,
-                            GtkWidget * widget,
-                            BalsaSendmsg * bsmsg);
-static void address_book_response(GtkWidget * ab, gint response,
-                                  LibBalsaAddressView * address_view);
-
-static void set_locale(BalsaSendmsg * bsmsg, const gchar * locale);
-
-static void replace_identity_signature(BalsaSendmsg* bsmsg,
-                                       LibBalsaIdentity* new_ident,
-                                       LibBalsaIdentity* old_ident,
-                                       gint* replace_offset, gint siglen,
-                                       const gchar* new_sig);
-static void update_bsmsg_identity(BalsaSendmsg*, LibBalsaIdentity*);
-
-static void sw_size_alloc_cb(GtkWidget * window);
-static GString *quote_message_body(BalsaSendmsg * bsmsg,
-                                   LibBalsaMessage * message,
-                                   QuoteType type);
-static void set_list_post_address(BalsaSendmsg * bsmsg);
-static gboolean set_list_post_rfc2369(BalsaSendmsg * bsmsg,
-                                      const gchar * url);
-static const gchar *rfc2822_skip_comments(const gchar * str);
-static void sendmsg_window_set_title(BalsaSendmsg * bsmsg);
+static void address_book_cb(LibBalsaAddressView *address_view,
+                            GtkWidget           *widget,
+                            BalsaSendmsg        *bsmsg);
+static void address_book_response(GtkWidget           *ab,
+                                  gint                 response,
+                                  LibBalsaAddressView *address_view);
+
+static void set_locale(BalsaSendmsg *bsmsg,
+                       const gchar  *locale);
+
+static void replace_identity_signature(BalsaSendmsg     *bsmsg,
+                                       LibBalsaIdentity *new_ident,
+                                       LibBalsaIdentity *old_ident,
+                                       gint             *replace_offset,
+                                       gint              siglen,
+                                       const gchar      *new_sig);
+static void update_bsmsg_identity(BalsaSendmsg *,
+                                  LibBalsaIdentity *);
+
+static void     sw_size_alloc_cb(GtkWidget *window);
+static GString *quote_message_body(BalsaSendmsg    *bsmsg,
+                                   LibBalsaMessage *message,
+                                   QuoteType        type);
+static void         set_list_post_address(BalsaSendmsg *bsmsg);
+static gboolean     set_list_post_rfc2369(BalsaSendmsg *bsmsg,
+                                          const gchar  *url);
+static const gchar *rfc2822_skip_comments(const gchar *str);
+static void         sendmsg_window_set_title(BalsaSendmsg *bsmsg);
 
 #if !HAVE_GTKSOURCEVIEW
 /* Undo/Redo buffer helpers. */
-static void sw_buffer_save(BalsaSendmsg * bsmsg);
-static void sw_buffer_swap(BalsaSendmsg * bsmsg, gboolean undo);
+static void sw_buffer_save(BalsaSendmsg *bsmsg);
+static void sw_buffer_swap(BalsaSendmsg *bsmsg,
+                           gboolean      undo);
+
 #endif                          /* HAVE_GTKSOURCEVIEW */
-static void sw_buffer_signals_connect(BalsaSendmsg * bsmsg);
+static void sw_buffer_signals_connect(BalsaSendmsg *bsmsg);
+
 #if !HAVE_GTKSOURCEVIEW || !(HAVE_GSPELL || HAVE_GTKSPELL)
-static void sw_buffer_signals_disconnect(BalsaSendmsg * bsmsg);
+static void sw_buffer_signals_disconnect(BalsaSendmsg *bsmsg);
+
 #endif                          /* !HAVE_GTKSOURCEVIEW || !HAVE_GTKSPELL */
 #if !HAVE_GTKSOURCEVIEW
-static void sw_buffer_set_undo(BalsaSendmsg * bsmsg, gboolean undo,
-                              gboolean redo);
+static void sw_buffer_set_undo(BalsaSendmsg *bsmsg,
+                               gboolean      undo,
+                               gboolean      redo);
+
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
 /* Standard DnD types */
@@ -151,77 +232,79 @@ enum {
     TARGET_STRING
 };
 
-static const gchar * drop_types[] = {
+static const gchar *drop_types[] = {
     "x-application/x-message-list",
     "text/uri-list",
     "STRING",
     "text/plain"
 };
 
-static const gchar * email_field_drop_types[] = {
+static const gchar *email_field_drop_types[] = {
     "STRING",
     "text/plain"
 };
 
-static void lang_set_cb(GtkWidget *widget, BalsaSendmsg *bsmsg);
+static void lang_set_cb(GtkWidget    *widget,
+                        BalsaSendmsg *bsmsg);
 
-static void bsmsg_set_subject_from_body(BalsaSendmsg * bsmsg,
-                                        LibBalsaMessageBody * body,
-                                        LibBalsaIdentity * ident);
+static void bsmsg_set_subject_from_body(BalsaSendmsg        *bsmsg,
+                                        LibBalsaMessageBody *body,
+                                        LibBalsaIdentity    *ident);
 
 /* the array of locale names and charset names included in the MIME
    type information.
    if you add a new encoding here add to SendCharset in libbalsa.c
-*/
+ */
 struct SendLocales {
     const gchar *locale, *charset, *lang_name;
-} locales[] = {
+} locales[] =
     /* Translators: please use the initial letter of each language as
      * its accelerator; this is a long list, and unique accelerators
      * cannot be found. */
-    {"pt_BR", "ISO-8859-1",    N_("_Brazilian Portuguese")},
-    {"ca_ES", "ISO-8859-15",   N_("_Catalan")},
-    {"zh_CN.GB2312", "gb2312", N_("_Chinese Simplified")},
-    {"zh_TW.Big5", "big5",     N_("_Chinese Traditional")},
-    {"cs_CZ", "ISO-8859-2",    N_("_Czech")},
-    {"da_DK", "ISO-8859-1",    N_("_Danish")},
-    {"nl_NL", "ISO-8859-15",   N_("_Dutch")},
-    {"en_US", "ISO-8859-1",    N_("_English (American)")},
-    {"en_GB", "ISO-8859-1",    N_("_English (British)")},
-    {"eo_XX", "UTF-8",         N_("_Esperanto")},
-    {"et_EE", "ISO-8859-15",   N_("_Estonian")},
-    {"fi_FI", "ISO-8859-15",   N_("_Finnish")},
-    {"fr_FR", "ISO-8859-15",   N_("_French")},
-    {"de_DE", "ISO-8859-15",   N_("_German")},
-    {"de_AT", "ISO-8859-15",   N_("_German (Austrian)")},
-    {"de_CH", "ISO-8859-1",    N_("_German (Swiss)")},
-    {"el_GR", "ISO-8859-7",    N_("_Greek")},
-    {"he_IL", "UTF-8",         N_("_Hebrew")},
-    {"hu_HU", "ISO-8859-2",    N_("_Hungarian")},
-    {"it_IT", "ISO-8859-15",   N_("_Italian")},
-    {"ja_JP", "ISO-2022-JP",   N_("_Japanese (JIS)")},
-    {"kk_KZ", "UTF-8",         N_("_Kazakh")},
-    {"ko_KR", "euc-kr",        N_("_Korean")},
-    {"lv_LV", "ISO-8859-13",   N_("_Latvian")},
-    {"lt_LT", "ISO-8859-13",   N_("_Lithuanian")},
-    {"no_NO", "ISO-8859-1",    N_("_Norwegian")},
-    {"pl_PL", "ISO-8859-2",    N_("_Polish")},
-    {"pt_PT", "ISO-8859-15",   N_("_Portuguese")},
-    {"ro_RO", "ISO-8859-2",    N_("_Romanian")},
-    {"ru_RU", "KOI8-R",        N_("_Russian")},
-    {"sr_Cyrl", "ISO-8859-5",  N_("_Serbian")},
-    {"sr_Latn", "ISO-8859-2",  N_("_Serbian (Latin)")},
-    {"sk_SK", "ISO-8859-2",    N_("_Slovak")},
-    {"es_ES", "ISO-8859-15",   N_("_Spanish")},
-    {"sv_SE", "ISO-8859-1",    N_("_Swedish")},
-    {"tt_RU", "UTF-8",         N_("_Tatar")},
-    {"tr_TR", "ISO-8859-9",    N_("_Turkish")},
-    {"uk_UK", "KOI8-U",        N_("_Ukrainian")},
-    {"", "UTF-8",              N_("_Generic UTF-8")}
+{
+    {"pt_BR",        "ISO-8859-1",         N_("_Brazilian Portuguese")                                   },
+    {"ca_ES",        "ISO-8859-15",        N_("_Catalan")                                                },
+    {"zh_CN.GB2312", "gb2312",             N_("_Chinese Simplified")                                     },
+    {"zh_TW.Big5",   "big5",               N_("_Chinese Traditional")                                    },
+    {"cs_CZ",        "ISO-8859-2",         N_("_Czech")                                                  },
+    {"da_DK",        "ISO-8859-1",         N_("_Danish")                                                 },
+    {"nl_NL",        "ISO-8859-15",        N_("_Dutch")                                                  },
+    {"en_US",        "ISO-8859-1",         N_("_English (American)")                                     },
+    {"en_GB",        "ISO-8859-1",         N_("_English (British)")                                      },
+    {"eo_XX",        "UTF-8",              N_("_Esperanto")                                              },
+    {"et_EE",        "ISO-8859-15",        N_("_Estonian")                                               },
+    {"fi_FI",        "ISO-8859-15",        N_("_Finnish")                                                },
+    {"fr_FR",        "ISO-8859-15",        N_("_French")                                                 },
+    {"de_DE",        "ISO-8859-15",        N_("_German")                                                 },
+    {"de_AT",        "ISO-8859-15",        N_("_German (Austrian)")                                      },
+    {"de_CH",        "ISO-8859-1",         N_("_German (Swiss)")                                         },
+    {"el_GR",        "ISO-8859-7",         N_("_Greek")                                                  },
+    {"he_IL",        "UTF-8",              N_("_Hebrew")                                                 },
+    {"hu_HU",        "ISO-8859-2",         N_("_Hungarian")                                              },
+    {"it_IT",        "ISO-8859-15",        N_("_Italian")                                                },
+    {"ja_JP",        "ISO-2022-JP",        N_("_Japanese (JIS)")                                         },
+    {"kk_KZ",        "UTF-8",              N_("_Kazakh")                                                 },
+    {"ko_KR",        "euc-kr",             N_("_Korean")                                                 },
+    {"lv_LV",        "ISO-8859-13",        N_("_Latvian")                                                },
+    {"lt_LT",        "ISO-8859-13",        N_("_Lithuanian")                                             },
+    {"no_NO",        "ISO-8859-1",         N_("_Norwegian")                                              },
+    {"pl_PL",        "ISO-8859-2",         N_("_Polish")                                                 },
+    {"pt_PT",        "ISO-8859-15",        N_("_Portuguese")                                             },
+    {"ro_RO",        "ISO-8859-2",         N_("_Romanian")                                               },
+    {"ru_RU",        "KOI8-R",             N_("_Russian")                                                },
+    {"sr_Cyrl",      "ISO-8859-5",         N_("_Serbian")                                                },
+    {"sr_Latn",      "ISO-8859-2",         N_("_Serbian (Latin)")                                        },
+    {"sk_SK",        "ISO-8859-2",         N_("_Slovak")                                                 },
+    {"es_ES",        "ISO-8859-15",        N_("_Spanish")                                                },
+    {"sv_SE",        "ISO-8859-1",         N_("_Swedish")                                                },
+    {"tt_RU",        "UTF-8",              N_("_Tatar")                                                  },
+    {"tr_TR",        "ISO-8859-9",         N_("_Turkish")                                                },
+    {"uk_UK",        "KOI8-U",             N_("_Ukrainian")                                              },
+    {"",             "UTF-8",              N_("_Generic UTF-8")                                          }
 };
 
 static const gchar *
-sw_preferred_charset(BalsaSendmsg * bsmsg)
+sw_preferred_charset(BalsaSendmsg *bsmsg)
 {
     guint i;
 
@@ -233,12 +316,13 @@ sw_preferred_charset(BalsaSendmsg * bsmsg)
     return NULL;
 }
 
+
 /* ===================================================================
    Balsa menus. Touchpad has some simplified menus which do not
    overlap very much with the default balsa menus. They are here
    because they represent an alternative probably appealing to the all
    proponents of GNOME2 dumbify approach (OK, I am bit unfair here).
-*/
+ */
 
 /*
  * lists of actions that are enabled or disabled as groups
@@ -261,26 +345,28 @@ enum {
     ATTACH_NUM_COLUMNS
 };
 
-static const gchar * const attach_modes[] =
-    {NULL, N_("Attachment"), N_("Inline"), N_("Reference") };
+static const gchar *const attach_modes[] =
+{
+    NULL, N_("Attachment"), N_("Inline"), N_("Reference")
+};
 
 struct _BalsaAttachInfo {
     GObject parent_object;
 
     BalsaSendmsg *bm;                 /* send message back reference */
 
-    GtkWidget *popup_menu;            /* popup menu */
-    LibbalsaVfs *file_uri;            /* file uri of the attachment */
-    gchar *uri_ref;                   /* external body URI reference */
-    gchar *force_mime_type;           /* force using this particular mime type */
-    gchar *charset;                   /* forced character set */
-    gboolean delete_on_destroy;       /* destroy the file when not used any more */
-    gint mode;                        /* LIBBALSA_ATTACH_AS_ATTACHMENT etc. */
-    LibBalsaMessageHeaders *headers;  /* information about a forwarded message */
+    GtkWidget              *popup_menu;        /* popup menu */
+    LibbalsaVfs            *file_uri;          /* file uri of the attachment */
+    gchar                  *uri_ref;           /* external body URI reference */
+    gchar                  *force_mime_type;   /* force using this particular mime type */
+    gchar                  *charset;           /* forced character set */
+    gboolean                delete_on_destroy; /* destroy the file when not used any more */
+    gint                    mode;              /* LIBBALSA_ATTACH_AS_ATTACHMENT etc. */
+    LibBalsaMessageHeaders *headers;           /* information about a forwarded message */
 };
 
 
-static void balsa_attach_info_finalize(GObject * object);
+static void balsa_attach_info_finalize(GObject *object);
 
 
 #define BALSA_MSG_ATTACH_MODEL(x)   gtk_tree_view_get_model(GTK_TREE_VIEW((x)->tree_view))
@@ -308,30 +394,32 @@ balsa_attach_info_class_init(BalsaAttachInfoClass *klass)
 
 
 static void
-balsa_attach_info_init(BalsaAttachInfo * info)
+balsa_attach_info_init(BalsaAttachInfo *info)
 {
-    info->popup_menu = NULL;
-    info->file_uri = NULL;
-    info->force_mime_type = NULL;
-    info->charset = NULL;
+    info->popup_menu        = NULL;
+    info->file_uri          = NULL;
+    info->force_mime_type   = NULL;
+    info->charset           = NULL;
     info->delete_on_destroy = FALSE;
-    info->mode = LIBBALSA_ATTACH_AS_ATTACHMENT;
-    info->headers = NULL;
+    info->mode              = LIBBALSA_ATTACH_AS_ATTACHMENT;
+    info->headers           = NULL;
 }
 
-static BalsaAttachInfo*
+
+static BalsaAttachInfo *
 balsa_attach_info_new(BalsaSendmsg *bm)
 {
-    BalsaAttachInfo * info = g_object_new(BALSA_TYPE_ATTACH_INFO, NULL);
+    BalsaAttachInfo *info = g_object_new(BALSA_TYPE_ATTACH_INFO, NULL);
 
     info->bm = bm;
     return info;
 }
 
+
 static void
-balsa_attach_info_finalize(GObject * object)
+balsa_attach_info_finalize(GObject *object)
 {
-    BalsaAttachInfo * info;
+    BalsaAttachInfo *info;
     GObjectClass *parent_class;
 
     g_return_if_fail(object != NULL);
@@ -340,13 +428,13 @@ balsa_attach_info_finalize(GObject * object)
 
     /* unlink the file if necessary */
     if (info->delete_on_destroy && info->file_uri) {
-        gchar * folder_name;
+        gchar *folder_name;
 
         /* unlink the file */
-       if (balsa_app.debug)
-           fprintf (stderr, "%s:%s: unlink `%s'\n", __FILE__, __FUNCTION__,
-                    libbalsa_vfs_get_uri_utf8(info->file_uri));
-       libbalsa_vfs_file_unlink(info->file_uri, NULL);
+        if (balsa_app.debug)
+            fprintf (stderr, "%s:%s: unlink `%s'\n", __FILE__, __FUNCTION__,
+                     libbalsa_vfs_get_uri_utf8(info->file_uri));
+        libbalsa_vfs_file_unlink(info->file_uri, NULL);
 
         /* remove the folder if possible */
         folder_name = g_filename_from_uri(libbalsa_vfs_get_folder(info->file_uri),
@@ -373,13 +461,15 @@ balsa_attach_info_finalize(GObject * object)
     parent_class->finalize(object);
 }
 
+
 /* ===================================================================
  *                end of attachment related stuff
  * =================================================================== */
 
 
 static void
-append_comma_separated(GtkEditable *editable, const gchar * text)
+append_comma_separated(GtkEditable *editable,
+                       const gchar *text)
 {
     gint position;
 
@@ -394,13 +484,14 @@ append_comma_separated(GtkEditable *editable, const gchar * text)
     gtk_editable_set_position(editable, position);
 }
 
+
 /* the callback handlers */
 #define BALSA_SENDMSG_ADDRESS_BOOK_KEY "balsa-sendmsg-address-book"
 #define BALSA_SENDMSG_BUTTON_KEY       "balsa-sendmsg-button"
 static void
-address_book_cb(LibBalsaAddressView * address_view,
-                GtkWidget * widget,
-                BalsaSendmsg * bsmsg)
+address_book_cb(LibBalsaAddressView *address_view,
+                GtkWidget           *widget,
+                BalsaSendmsg        *bsmsg)
 {
     GtkWidget *ab;
 
@@ -425,10 +516,12 @@ address_book_cb(LibBalsaAddressView * address_view,
     gtk_widget_show(ab);
 }
 
+
 /* Callback for the "response" signal for the address book dialog. */
 static void
-address_book_response(GtkWidget * ab, gint response,
-                      LibBalsaAddressView * address_view)
+address_book_response(GtkWidget           *ab,
+                      gint                 response,
+                      LibBalsaAddressView *address_view)
 {
     GtkWindow *parent = gtk_window_get_transient_for(GTK_WINDOW(ab));
     GtkWidget *button =
@@ -446,8 +539,9 @@ address_book_response(GtkWidget * ab, gint response,
     gtk_widget_set_sensitive(GTK_WIDGET(address_view), TRUE);
 }
 
+
 static void
-sw_delete_draft(BalsaSendmsg * bsmsg)
+sw_delete_draft(BalsaSendmsg *bsmsg)
 {
     LibBalsaMessage *message;
 
@@ -456,20 +550,21 @@ sw_delete_draft(BalsaSendmsg * bsmsg)
         LibBalsaMailbox *mailbox;
 
         mailbox = libbalsa_message_get_mailbox(message);
-        if (mailbox != NULL && !libbalsa_mailbox_get_readonly(mailbox)) {
+        if ((mailbox != NULL) && !libbalsa_mailbox_get_readonly(mailbox)) {
             libbalsa_message_change_flags(message,
                                           LIBBALSA_MESSAGE_FLAG_DELETED, 0);
         }
     }
 }
 
+
 static gboolean
-close_handler(BalsaSendmsg * bsmsg)
+close_handler(BalsaSendmsg *bsmsg)
 {
     InternetAddressList *list;
     InternetAddress *ia;
     const gchar *tmp = NULL;
-    gchar *free_me = NULL;
+    gchar *free_me   = NULL;
     gint reply;
     GtkWidget *d;
 
@@ -480,7 +575,7 @@ close_handler(BalsaSendmsg * bsmsg)
         return FALSE;
 
     list = libbalsa_address_view_get_list(bsmsg->recipient_view, "To:");
-    ia = internet_address_list_get_address(list, 0);
+    ia   = internet_address_list_get_address(list, 0);
     if (ia) {
         tmp = ia->name;
         if (!tmp || !*tmp)
@@ -511,11 +606,14 @@ close_handler(BalsaSendmsg * bsmsg)
         if (bsmsg->state == SENDMSG_STATE_MODIFIED)
             if (!message_postpone(bsmsg))
                 return TRUE;
+
         break;
+
     case GTK_RESPONSE_NO:
         if (!bsmsg->is_continue)
             sw_delete_draft(bsmsg);
         break;
+
     default:
         return TRUE;
     }
@@ -523,31 +621,36 @@ close_handler(BalsaSendmsg * bsmsg)
     return FALSE;
 }
 
+
 static gboolean
-close_request_cb(GtkWidget * widget, gpointer data)
+close_request_cb(GtkWidget *widget,
+                 gpointer   data)
 {
     BalsaSendmsg *bsmsg = data;
 
     return close_handler(bsmsg);
 }
 
+
 static void
-sw_close_activated(GSimpleAction * action,
-                   GVariant      * parameter,
-                   gpointer        data)
+sw_close_activated(GSimpleAction *action,
+                   GVariant      *parameter,
+                   gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
     BALSA_DEBUG_MSG("close_window_cb: start\n");
     g_object_set_data(G_OBJECT(bsmsg->window), "destroying",
                       GINT_TO_POINTER(TRUE));
-    if(!close_handler(bsmsg))
-       gtk_widget_destroy(bsmsg->window);
+    if (!close_handler(bsmsg))
+        gtk_widget_destroy(bsmsg->window);
     BALSA_DEBUG_MSG("close_window_cb: end\n");
 }
 
+
 static gint
-destroy_event_cb(GtkWidget * widget, gpointer data)
+destroy_event_cb(GtkWidget *widget,
+                 gpointer   data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -555,12 +658,13 @@ destroy_event_cb(GtkWidget * widget, gpointer data)
     return TRUE;
 }
 
+
 /* the balsa_sendmsg destructor; copies first the shown headers setting
    to the balsa_app structure.
-*/
+ */
 #define BALSA_SENDMSG_WINDOW_KEY "balsa-sendmsg-window-key"
 static void
-balsa_sendmsg_destroy_handler(BalsaSendmsg * bsmsg)
+balsa_sendmsg_destroy_handler(BalsaSendmsg *bsmsg)
 {
     gboolean quit_on_close;
 
@@ -574,18 +678,18 @@ balsa_sendmsg_destroy_handler(BalsaSendmsg * bsmsg)
         g_object_weak_unref(G_OBJECT(balsa_app.main_window),
                             (GWeakNotify) gtk_widget_destroy, bsmsg->window);
     }
-    if(balsa_app.debug) g_message("balsa_sendmsg_destroy()_handler: Start.");
+    if (balsa_app.debug) g_message("balsa_sendmsg_destroy()_handler: Start.");
 
     if (bsmsg->parent_message != NULL) {
         LibBalsaMailbox *mailbox;
 
         mailbox = libbalsa_message_get_mailbox(bsmsg->parent_message);
-       if (mailbox != NULL) {
-           libbalsa_mailbox_close(mailbox,
-                   /* Respect pref setting: */
-                                  balsa_app.expunge_on_close);
+        if (mailbox != NULL) {
+            libbalsa_mailbox_close(mailbox,
+                                   /* Respect pref setting: */
+                                   balsa_app.expunge_on_close);
         }
-       g_clear_object(&bsmsg->parent_message);
+        g_clear_object(&bsmsg->parent_message);
     }
 
     if (bsmsg->draft_message != NULL) {
@@ -594,16 +698,16 @@ balsa_sendmsg_destroy_handler(BalsaSendmsg * bsmsg)
         g_object_set_data(G_OBJECT(bsmsg->draft_message),
                           BALSA_SENDMSG_WINDOW_KEY, NULL);
         mailbox = libbalsa_message_get_mailbox(bsmsg->draft_message);
-       if (mailbox != NULL) {
-           libbalsa_mailbox_close(mailbox,
-                   /* Respect pref setting: */
-                                  balsa_app.expunge_on_close);
+        if (mailbox != NULL) {
+            libbalsa_mailbox_close(mailbox,
+                                   /* Respect pref setting: */
+                                   balsa_app.expunge_on_close);
         }
-       g_clear_object(&bsmsg->draft_message);
+        g_clear_object(&bsmsg->draft_message);
     }
 
     if (balsa_app.debug)
-       printf("balsa_sendmsg_destroy_handler: Freeing bsmsg\n");
+        printf("balsa_sendmsg_destroy_handler: Freeing bsmsg\n");
     gtk_widget_destroy(bsmsg->window);
     g_free(bsmsg->fcc_url);
     g_free(bsmsg->in_reply_to);
@@ -631,11 +735,12 @@ balsa_sendmsg_destroy_handler(BalsaSendmsg * bsmsg)
 
     if (quit_on_close) {
         libbalsa_wait_for_sending_thread(-1);
-       gtk_main_quit();
+        gtk_main_quit();
     }
-    if(balsa_app.debug) g_message("balsa_sendmsg_destroy(): Stop.");
+    if (balsa_app.debug) g_message("balsa_sendmsg_destroy(): Stop.");
 }
 
+
 /* language menu helper functions */
 /* find_locale_index_by_locale:
    finds the longest fit so the one who has en_GB will gent en_US if en_GB
@@ -644,27 +749,30 @@ balsa_sendmsg_destroy_handler(BalsaSendmsg * bsmsg)
    instead of LC_ALL. But it is simpler to set it here instead of answering
    the questions (OTOH, I am afraid that people will start claiming "but
    balsa can recognize my language!" on failures in other software.
-*/
+ */
 static gint
-find_locale_index_by_locale(const gchar * locale)
+find_locale_index_by_locale(const gchar *locale)
 {
     unsigned i, j, maxfit = 0;
     gint maxpos = -1;
 
-    if (!locale || strcmp(locale, "C") == 0)
+    if (!locale || (strcmp(locale, "C") == 0))
         locale = "en_US";
     for (i = 0; i < G_N_ELEMENTS(locales); i++) {
-       for (j = 0; locale[j] && locales[i].locale[j] == locale[j]; j++);
-       if (j > maxfit) {
-           maxfit = j;
-           maxpos = i;
-       }
+        for (j = 0; locale[j] && locales[i].locale[j] == locale[j]; j++) {
+        }
+        if (j > maxfit) {
+            maxfit = j;
+            maxpos = i;
+        }
     }
     return maxpos;
 }
 
+
 static void
-sw_buffer_signals_block(BalsaSendmsg * bsmsg, GtkTextBuffer * buffer)
+sw_buffer_signals_block(BalsaSendmsg  *bsmsg,
+                        GtkTextBuffer *buffer)
 {
     g_signal_handler_block(buffer, bsmsg->changed_sig_id);
 #if !HAVE_GTKSOURCEVIEW
@@ -673,8 +781,10 @@ sw_buffer_signals_block(BalsaSendmsg * bsmsg, GtkTextBuffer * buffer)
     g_signal_handler_block(buffer, bsmsg->insert_text_sig_id);
 }
 
+
 static void
-sw_buffer_signals_unblock(BalsaSendmsg * bsmsg, GtkTextBuffer * buffer)
+sw_buffer_signals_unblock(BalsaSendmsg  *bsmsg,
+                          GtkTextBuffer *buffer)
 {
     g_signal_handler_unblock(buffer, bsmsg->changed_sig_id);
 #if !HAVE_GTKSOURCEVIEW
@@ -683,11 +793,15 @@ sw_buffer_signals_unblock(BalsaSendmsg * bsmsg, GtkTextBuffer * buffer)
     g_signal_handler_unblock(buffer, bsmsg->insert_text_sig_id);
 }
 
+
 static const gchar *const address_types[] =
-    { N_("To:"), N_("CC:"), N_("BCC:") };
+{
+    N_("To:"), N_("CC:"), N_("BCC:")
+};
 
 static gboolean
-edit_with_gnome_check(gpointer data) {
+edit_with_gnome_check(gpointer data)
+{
     FILE *tmp;
     balsa_edit_with_gnome_data *data_real = (balsa_edit_with_gnome_data *)data;
     GtkTextBuffer *buffer;
@@ -696,13 +810,15 @@ edit_with_gnome_check(gpointer data) {
     gchar line[81]; /* FIXME:All lines should wrap at this line */
     /* Editor not ready */
     pid = waitpid (data_real->pid_editor, NULL, WNOHANG);
-    if(pid == -1) {
+    if (pid == -1) {
         perror("waitpid");
         return TRUE;
-    } else if(pid == 0) return TRUE;
+    } else if (pid == 0) {
+        return TRUE;
+    }
 
     tmp = fopen(data_real->filename, "r");
-    if(tmp == NULL){
+    if (tmp == NULL) {
         perror("fopen");
         return TRUE;
     }
@@ -723,11 +839,12 @@ edit_with_gnome_check(gpointer data) {
                  type < G_N_ELEMENTS(address_types);
                  type++) {
                 const gchar *type_string = _(address_types[type]);
-                if (libbalsa_str_has_prefix(line, type_string))
+                if (libbalsa_str_has_prefix(line, type_string)) {
                     libbalsa_address_view_set_from_string
                         (data_real->bsmsg->recipient_view,
-                         address_types[type],
-                         line + strlen(type_string) + 1);
+                        address_types[type],
+                        line + strlen(type_string) + 1);
+                }
             }
         }
     }
@@ -738,8 +855,9 @@ edit_with_gnome_check(gpointer data) {
 #endif                          /* HAVE_GTKSOURCEVIEW */
     sw_buffer_signals_block(data_real->bsmsg, buffer);
     gtk_text_buffer_set_text(buffer, "", 0);
-    while(fgets(line, sizeof(line), tmp))
+    while (fgets(line, sizeof(line), tmp)) {
         gtk_text_buffer_insert_at_cursor(buffer, line, -1);
+    }
     sw_buffer_signals_unblock(data_real->bsmsg, buffer);
 
     fclose(tmp);
@@ -751,6 +869,7 @@ edit_with_gnome_check(gpointer data) {
     return FALSE;
 }
 
+
 /* Edit the current file with an external editor.
  *
  * We fork twice current process, so we get:
@@ -761,11 +880,11 @@ edit_with_gnome_check(gpointer data) {
  * - New (grandchild) process (executes editor)
  */
 static void
-sw_edit_activated(GSimpleAction * action,
-                  GVariant      * parameter,
-                  gpointer        data)
+sw_edit_activated(GSimpleAction *action,
+                  GVariant      *parameter,
+                  gpointer       data)
 {
-    BalsaSendmsg *bsmsg = data;
+    BalsaSendmsg *bsmsg             = data;
     static const char TMP_PATTERN[] = "/tmp/balsa-edit-XXXXXX";
     gchar filename[sizeof(TMP_PATTERN)];
     balsa_edit_with_gnome_data *edit_data;
@@ -788,8 +907,8 @@ sw_edit_activated(GSimpleAction * action,
         return;
     }
 
-    argc = 2;
-    argv = g_new0 (char *, argc + 1);
+    argc    = 2;
+    argv    = g_new0 (char *, argc + 1);
     argv[0] = g_strdup(g_app_info_get_executable(app));
     strcpy(filename, TMP_PATTERN);
     argv[1] =
@@ -801,9 +920,9 @@ sw_edit_activated(GSimpleAction * action,
     g_object_unref(app);
 
     tmpfd = mkstemp(filename);
-    tmp = fdopen(tmpfd, "w+");
+    tmp   = fdopen(tmpfd, "w+");
 
-    if(balsa_app.edit_headers) {
+    if (balsa_app.edit_headers) {
         guint type;
 
         fprintf(tmp, "%s %s\n", _("Subject:"),
@@ -841,17 +960,18 @@ sw_edit_activated(GSimpleAction * action,
     }
     g_strfreev (argv);
     /* Return immediately. We don't want balsa to 'hang' */
-    edit_data = g_malloc(sizeof(balsa_edit_with_gnome_data));
+    edit_data             = g_malloc(sizeof(balsa_edit_with_gnome_data));
     edit_data->pid_editor = pid;
-    edit_data->filename = g_strdup(filename);
-    edit_data->bsmsg = bsmsg;
+    edit_data->filename   = g_strdup(filename);
+    edit_data->bsmsg      = bsmsg;
     g_timeout_add(200, (GSourceFunc)edit_with_gnome_check, edit_data);
 }
 
+
 static void
-sw_select_ident_activated(GSimpleAction * action,
-                          GVariant      * parameter,
-                          gpointer        data)
+sw_select_ident_activated(GSimpleAction *action,
+                          GVariant      *parameter,
+                          gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -867,9 +987,12 @@ sw_select_ident_activated(GSimpleAction * action,
 
 /* NOTE: replace_offset and siglen are  utf-8 character offsets. */
 static void
-replace_identity_signature(BalsaSendmsg* bsmsg, LibBalsaIdentity* new_ident,
-                           LibBalsaIdentity* old_ident, gint* replace_offset,
-                           gint siglen, const gchar* new_sig)
+replace_identity_signature(BalsaSendmsg     *bsmsg,
+                           LibBalsaIdentity *new_ident,
+                           LibBalsaIdentity *old_ident,
+                           gint             *replace_offset,
+                           gint              siglen,
+                           const gchar      *new_sig)
 {
     gint newsiglen;
     GtkTextBuffer *buffer =
@@ -896,11 +1019,13 @@ replace_identity_signature(BalsaSendmsg* bsmsg, LibBalsaIdentity* new_ident,
     default:
         insert_signature = TRUE;
         break;
+
     case SEND_REPLY:
     case SEND_REPLY_ALL:
     case SEND_REPLY_GROUP:
         insert_signature = libbalsa_identity_get_sig_whenreply(new_ident);
         break;
+
     case SEND_FORWARD_ATTACH:
     case SEND_FORWARD_INLINE:
         insert_signature = libbalsa_identity_get_sig_whenforward(new_ident);
@@ -934,12 +1059,14 @@ replace_identity_signature(BalsaSendmsg* bsmsg, LibBalsaIdentity* new_ident,
     gtk_text_buffer_delete_mark(buffer, mark);
 }
 
+
 /*
  * GAction helpers
  */
 
 static GAction *
-sw_get_action(BalsaSendmsg * bsmsg, const gchar * action_name)
+sw_get_action(BalsaSendmsg *bsmsg,
+              const gchar  *action_name)
 {
     GAction *action;
 
@@ -954,10 +1081,11 @@ sw_get_action(BalsaSendmsg * bsmsg, const gchar * action_name)
     return action;
 }
 
+
 static void
-sw_action_set_enabled(BalsaSendmsg * bsmsg,
-                      const gchar  * action_name,
-                      gboolean       enabled)
+sw_action_set_enabled(BalsaSendmsg *bsmsg,
+                      const gchar  *action_name,
+                      gboolean      enabled)
 {
     GAction *action;
 
@@ -966,39 +1094,44 @@ sw_action_set_enabled(BalsaSendmsg * bsmsg,
         g_simple_action_set_enabled(G_SIMPLE_ACTION(action), enabled);
 }
 
+
 /*
  * Enable or disable a group of actions
  */
 
 static void
-sw_actions_set_enabled(BalsaSendmsg        * bsmsg,
-                       const gchar * const * actions,
-                       guint                 n_actions,
-                       gboolean              enabled)
+sw_actions_set_enabled(BalsaSendmsg       *bsmsg,
+                       const gchar *const *actions,
+                       guint               n_actions,
+                       gboolean            enabled)
 {
     guint i;
 
-    for (i = 0; i < n_actions; i++)
+    for (i = 0; i < n_actions; i++) {
         sw_action_set_enabled(bsmsg, *actions++, enabled);
+    }
 }
 
+
 #if !HAVE_GTKSOURCEVIEW || HAVE_GSPELL || HAVE_GTKSPELL
 static gboolean
-sw_action_get_enabled(BalsaSendmsg * bsmsg,
-                      const gchar  * action_name)
+sw_action_get_enabled(BalsaSendmsg *bsmsg,
+                      const gchar  *action_name)
 {
     GAction *action;
 
     action = sw_get_action(bsmsg, action_name);
     return action ? g_action_get_enabled(action) : FALSE;
 }
+
+
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
 /* Set the state of a toggle-type GAction. */
 static void
-sw_action_set_active(BalsaSendmsg * bsmsg,
-                     const gchar  * action_name,
-                     gboolean       state)
+sw_action_set_active(BalsaSendmsg *bsmsg,
+                     const gchar  *action_name,
+                     gboolean      state)
 {
     GAction *action;
 
@@ -1007,9 +1140,10 @@ sw_action_set_active(BalsaSendmsg * bsmsg,
         g_action_change_state(action, g_variant_new_boolean(state));
 }
 
+
 static gboolean
-sw_action_get_active(BalsaSendmsg * bsmsg,
-                     const gchar  * action_name)
+sw_action_get_active(BalsaSendmsg *bsmsg,
+                     const gchar  *action_name)
 {
     GAction *action;
     gboolean retval = FALSE;
@@ -1018,7 +1152,7 @@ sw_action_get_active(BalsaSendmsg * bsmsg,
     if (action) {
         GVariant *state;
 
-        state = g_action_get_state(action);
+        state  = g_action_get_state(action);
         retval = g_variant_get_boolean(state);
         g_variant_unref(state);
     }
@@ -1026,6 +1160,7 @@ sw_action_get_active(BalsaSendmsg * bsmsg,
     return retval;
 }
 
+
 /*
  * end of GAction helpers
  */
@@ -1037,7 +1172,8 @@ sw_action_get_active(BalsaSendmsg * bsmsg,
  * corresponding fields.
  * */
 static void
-update_bsmsg_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity* ident)
+update_bsmsg_identity(BalsaSendmsg     *bsmsg,
+                      LibBalsaIdentity *ident)
 {
     GtkTextBuffer *buffer =
         gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
@@ -1047,13 +1183,13 @@ update_bsmsg_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity* ident)
     gint siglen;
 
     gboolean found_sig = FALSE;
-    gchar* old_sig;
-    gchar* new_sig;
-    gchar* message_text;
-    gchar* compare_str;
-    gchar** message_split;
-    gchar* tmpstr;
-    const gchar* subject;
+    gchar *old_sig;
+    gchar *new_sig;
+    gchar *message_text;
+    gchar *compare_str;
+    gchar **message_split;
+    gchar *tmpstr;
+    const gchar *subject;
     gint replen, fwdlen;
     const gchar *addr;
     const gchar *reply_string;
@@ -1061,7 +1197,7 @@ update_bsmsg_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity* ident)
     const gchar *forward_string;
     const gchar *old_forward_string;
 
-    LibBalsaIdentity* old_ident;
+    LibBalsaIdentity *old_ident;
     gboolean reply_type = (bsmsg->type == SEND_REPLY ||
                            bsmsg->type == SEND_REPLY_ALL ||
                            bsmsg->type == SEND_REPLY_GROUP);
@@ -1076,7 +1212,7 @@ update_bsmsg_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity* ident)
                              g_list_index(balsa_app.identities, ident));
 
     addr = libbalsa_identity_get_replyto(ident);
-    if (addr != NULL && addr[0] != '\0') {
+    if ((addr != NULL) && (addr[0] != '\0')) {
         libbalsa_address_view_set_from_string(bsmsg->replyto_view,
                                               "Reply To:",
                                               addr);
@@ -1123,7 +1259,7 @@ update_bsmsg_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity* ident)
         }
 
         /* Add the new Bcc addresses, if any: */
-        addr = libbalsa_identity_get_bcc(ident);
+        addr       = libbalsa_identity_get_bcc(ident);
         ident_list = internet_address_list_parse_string(addr);
         if (ident_list) {
             internet_address_list_append(bcc_list, ident_list);
@@ -1152,26 +1288,26 @@ update_bsmsg_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity* ident)
      *    not want it altered
      */
 
-    reply_string = libbalsa_identity_get_reply_string(ident);
+    reply_string   = libbalsa_identity_get_reply_string(ident);
     forward_string = libbalsa_identity_get_forward_string(ident);
 
-    old_ident = bsmsg->ident;
-    old_reply_string = libbalsa_identity_get_reply_string(old_ident);
+    old_ident          = bsmsg->ident;
+    old_reply_string   = libbalsa_identity_get_reply_string(old_ident);
     old_forward_string = libbalsa_identity_get_forward_string(old_ident);
 
     if (((replen = strlen(old_forward_string)) > 0) &&
-       (strncmp(subject, old_reply_string, replen) == 0)) {
-       tmpstr = g_strconcat(reply_string, &(subject[replen]), NULL);
-       gtk_entry_set_text(GTK_ENTRY(bsmsg->subject[1]), tmpstr);
-       g_free(tmpstr);
+        (strncmp(subject, old_reply_string, replen) == 0)) {
+        tmpstr = g_strconcat(reply_string, &(subject[replen]), NULL);
+        gtk_entry_set_text(GTK_ENTRY(bsmsg->subject[1]), tmpstr);
+        g_free(tmpstr);
     } else if (((fwdlen = strlen(old_forward_string)) > 0) &&
-              (strncmp(subject, old_forward_string, fwdlen) == 0)) {
-       tmpstr = g_strconcat(forward_string, &(subject[fwdlen]), NULL);
-       gtk_entry_set_text(GTK_ENTRY(bsmsg->subject[1]), tmpstr);
-       g_free(tmpstr);
+               (strncmp(subject, old_forward_string, fwdlen) == 0)) {
+        tmpstr = g_strconcat(forward_string, &(subject[fwdlen]), NULL);
+        gtk_entry_set_text(GTK_ENTRY(bsmsg->subject[1]), tmpstr);
+        g_free(tmpstr);
     } else {
-        if ( (replen == 0 && reply_type) ||
-             (fwdlen == 0 && forward_type) ) {
+        if (((replen == 0) && reply_type) ||
+            ((fwdlen == 0) && forward_type)) {
             LibBalsaMessage *message = bsmsg->parent_message != NULL ?
                 bsmsg->parent_message : bsmsg->draft_message;
             bsmsg_set_subject_from_body(bsmsg,
@@ -1190,13 +1326,13 @@ update_bsmsg_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity* ident)
     /* switch identities in bsmsg here so we can use read_signature
      * again */
     bsmsg->ident = ident;
-    if ( (reply_type && libbalsa_identity_get_sig_whenreply(ident))
-         || (forward_type && libbalsa_identity_get_sig_whenforward(ident))
-         || (bsmsg->type == SEND_NORMAL && libbalsa_identity_get_sig_sending(ident)))
+    if ((reply_type && libbalsa_identity_get_sig_whenreply(ident))
+        || (forward_type && libbalsa_identity_get_sig_whenforward(ident))
+        || ((bsmsg->type == SEND_NORMAL) && libbalsa_identity_get_sig_sending(ident)))
         new_sig = libbalsa_identity_get_signature(ident, NULL);
     else
         new_sig = NULL;
-    if(!new_sig) new_sig = g_strdup("");
+    if (!new_sig) new_sig = g_strdup("");
 
     gtk_text_buffer_get_bounds(buffer, &start, &end);
     message_text = gtk_text_iter_get_text(&start, &end);
@@ -1208,67 +1344,67 @@ update_bsmsg_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity* ident)
     } else {
         /* split on sig separator */
         message_split = g_strsplit(message_text, "\n-- \n", 0);
-        siglen = g_utf8_strlen(old_sig, -1);
+        siglen        = g_utf8_strlen(old_sig, -1);
 
-       /* check the special case of starting a message with a sig */
-       compare_str = g_strconcat("\n", message_split[0], NULL);
+        /* check the special case of starting a message with a sig */
+        compare_str = g_strconcat("\n", message_split[0], NULL);
 
-       if (g_ascii_strncasecmp(old_sig, compare_str, siglen) == 0) {
-           g_free(compare_str);
-           replace_identity_signature(bsmsg, ident, old_ident,
+        if (g_ascii_strncasecmp(old_sig, compare_str, siglen) == 0) {
+            g_free(compare_str);
+            replace_identity_signature(bsmsg, ident, old_ident,
                                        &replace_offset, siglen - 1, new_sig);
-           found_sig = TRUE;
-       } else {
+            found_sig = TRUE;
+        } else {
             gint i;
 
             g_free(compare_str);
             for (i = 0; message_split[i] != NULL; i++) {
-               /* put sig separator back to search */
-               compare_str = g_strconcat("\n-- \n", message_split[i], NULL);
+                /* put sig separator back to search */
+                compare_str = g_strconcat("\n-- \n", message_split[i], NULL);
 
-               /* try to find occurance of old signature */
-               if (g_ascii_strncasecmp(old_sig, compare_str, siglen) == 0) {
-                   replace_identity_signature(bsmsg, ident, old_ident,
+                /* try to find occurance of old signature */
+                if (g_ascii_strncasecmp(old_sig, compare_str, siglen) == 0) {
+                    replace_identity_signature(bsmsg, ident, old_ident,
                                                &replace_offset, siglen,
                                                new_sig);
-                   found_sig = TRUE;
-               }
+                    found_sig = TRUE;
+                }
 
-               replace_offset +=
-                   g_utf8_strlen(i ? compare_str : message_split[i], -1);
-               g_free(compare_str);
-           }
+                replace_offset +=
+                    g_utf8_strlen(i ? compare_str : message_split[i], -1);
+                g_free(compare_str);
+            }
         }
         /* if no sig seperators found, do a slower brute force
          * approach.  We could have stopped earlier if the message was
          * empty, but we didn't. Now, it is really time to do
          * that... */
         if (*message_text && !found_sig) {
-            compare_str = message_text;
+            compare_str    = message_text;
             replace_offset = 0;
 
-           /* check the special case of starting a message with a sig */
-           tmpstr = g_strconcat("\n", message_text, NULL);
+            /* check the special case of starting a message with a sig */
+            tmpstr = g_strconcat("\n", message_text, NULL);
 
-           if (g_ascii_strncasecmp(old_sig, tmpstr, siglen) == 0) {
-               g_free(tmpstr);
-               replace_identity_signature(bsmsg, ident, old_ident,
+            if (g_ascii_strncasecmp(old_sig, tmpstr, siglen) == 0) {
+                g_free(tmpstr);
+                replace_identity_signature(bsmsg, ident, old_ident,
                                            &replace_offset, siglen - 1,
                                            new_sig);
-           } else {
-               g_free(tmpstr);
-               replace_offset++;
-               compare_str = g_utf8_next_char(compare_str);
-               while (*compare_str) {
-                   if (g_ascii_strncasecmp(old_sig, compare_str, siglen) == 0) {
-                       replace_identity_signature(bsmsg, ident, old_ident,
+            } else {
+                g_free(tmpstr);
+                replace_offset++;
+                compare_str = g_utf8_next_char(compare_str);
+                while (*compare_str) {
+                    if (g_ascii_strncasecmp(old_sig, compare_str, siglen) == 0) {
+                        replace_identity_signature(bsmsg, ident, old_ident,
                                                    &replace_offset, siglen,
                                                    new_sig);
-                   }
-                   replace_offset++;
-                   compare_str = g_utf8_next_char(compare_str);
-               }
-           }
+                    }
+                    replace_offset++;
+                    compare_str = g_utf8_next_char(compare_str);
+                }
+            }
         }
         g_strfreev(message_split);
     }
@@ -1283,7 +1419,8 @@ update_bsmsg_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity* ident)
     g_free(new_sig);
     g_free(message_text);
 
-    libbalsa_address_view_set_domain(bsmsg->recipient_view, libbalsa_identity_get_domain(ident));
+    libbalsa_address_view_set_domain(bsmsg->recipient_view,
+                                     libbalsa_identity_get_domain(ident));
 
     sw_action_set_active(bsmsg, "request-mdn", libbalsa_identity_get_request_mdn(ident));
     sw_action_set_active(bsmsg, "request-dsn", libbalsa_identity_get_request_dsn(ident));
@@ -1291,7 +1428,7 @@ update_bsmsg_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity* ident)
 
 
 static void
-sw_size_alloc_cb(GtkWidget * window)
+sw_size_alloc_cb(GtkWidget *window)
 {
     GdkSurface *surface;
 
@@ -1303,16 +1440,18 @@ sw_size_alloc_cb(GtkWidget * window)
         (gdk_surface_get_state(surface) &
          (GDK_SURFACE_STATE_MAXIMIZED | GDK_SURFACE_STATE_FULLSCREEN)) != 0;
 
-    if (!balsa_app.sw_maximized)
+    if (!balsa_app.sw_maximized) {
         gtk_window_get_size(GTK_WINDOW(window),
-                            & balsa_app.sw_width,
-                            & balsa_app.sw_height);
+                            &balsa_app.sw_width,
+                            &balsa_app.sw_height);
+    }
 }
 
 
 /* remove_attachment - right mouse button callback */
 static void
-remove_attachment(GtkWidget * menu_item, BalsaAttachInfo *info)
+remove_attachment(GtkWidget       *menu_item,
+                  BalsaAttachInfo *info)
 {
     GtkTreeIter iter;
     GtkTreeModel *model;
@@ -1324,14 +1463,14 @@ remove_attachment(GtkWidget * menu_item, BalsaAttachInfo *info)
     /* get the selected element */
     selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(info->bm->tree_view));
     if (!gtk_tree_selection_get_selected(selection, &model, &iter))
-       return;
+        return;
 
     /* make sure we got the right element */
     gtk_tree_model_get(model, &iter, ATTACH_INFO_COLUMN, &test_info, -1);
     if (test_info != info) {
-       if (test_info)
-           g_object_unref(test_info);
-       return;
+        if (test_info)
+            g_object_unref(test_info);
+        return;
     }
     g_object_unref(test_info);
 
@@ -1339,8 +1478,10 @@ remove_attachment(GtkWidget * menu_item, BalsaAttachInfo *info)
     gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
 }
 
+
 static void
-set_attach_menu_sensitivity(GtkWidget * widget, gpointer data)
+set_attach_menu_sensitivity(GtkWidget *widget,
+                            gpointer   data)
 {
     gint mode =
         GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "new-mode"));
@@ -1349,9 +1490,11 @@ set_attach_menu_sensitivity(GtkWidget * widget, gpointer data)
         gtk_widget_set_sensitive(widget, mode != GPOINTER_TO_INT(data));
 }
 
+
 /* change attachment mode - right mouse button callback */
 static void
-change_attach_mode(GtkWidget * menu_item, BalsaAttachInfo *info)
+change_attach_mode(GtkWidget       *menu_item,
+                   BalsaAttachInfo *info)
 {
     gint new_mode =
         GPOINTER_TO_INT(g_object_get_data(G_OBJECT(menu_item),
@@ -1366,63 +1509,64 @@ change_attach_mode(GtkWidget * menu_item, BalsaAttachInfo *info)
     /* get the selected element */
     selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(info->bm->tree_view));
     if (!gtk_tree_selection_get_selected(selection, &model, &iter))
-       return;
+        return;
 
     /* make sure we got the right element */
     gtk_tree_model_get(model, &iter, ATTACH_INFO_COLUMN, &test_info, -1);
     if (test_info != info) {
-       if (test_info)
-           g_object_unref(test_info);
-       return;
+        if (test_info)
+            g_object_unref(test_info);
+        return;
     }
     g_object_unref(test_info);
 
     /* verify that the user *really* wants to attach as reference */
-    if (info->mode != new_mode && new_mode == LIBBALSA_ATTACH_AS_EXTBODY) {
-       GtkWidget *extbody_dialog, *parent;
-       gint result;
-
-       parent = gtk_widget_get_toplevel(menu_item);
-       extbody_dialog =
-           gtk_message_dialog_new(GTK_WINDOW(parent),
-                                  GTK_DIALOG_DESTROY_WITH_PARENT,
-                                  GTK_MESSAGE_QUESTION,
-                                  GTK_BUTTONS_YES_NO,
-                                  _("Saying yes will not send the file "
-                                    "ā€œ%sā€ itself, but just a MIME "
-                                    "message/external-body reference. "
-                                    "Note that the recipient must "
-                                    "have proper permissions to see the "
-                                    "ā€œrealā€ file.\n\n"
-                                    "Do you really want to attach "
-                                    "this file as reference?"),
-                                  libbalsa_vfs_get_uri_utf8(info->file_uri));
+    if ((info->mode != new_mode) && (new_mode == LIBBALSA_ATTACH_AS_EXTBODY)) {
+        GtkWidget *extbody_dialog, *parent;
+        gint result;
+
+        parent         = gtk_widget_get_toplevel(menu_item);
+        extbody_dialog =
+            gtk_message_dialog_new(GTK_WINDOW(parent),
+                                   GTK_DIALOG_DESTROY_WITH_PARENT,
+                                   GTK_MESSAGE_QUESTION,
+                                   GTK_BUTTONS_YES_NO,
+                                   _("Saying yes will not send the file "
+                                     "ā€œ%sā€ itself, but just a MIME "
+                                     "message/external-body reference. "
+                                     "Note that the recipient must "
+                                     "have proper permissions to see the "
+                                     "ā€œrealā€ file.\n\n"
+                                     "Do you really want to attach "
+                                     "this file as reference?"),
+                                   libbalsa_vfs_get_uri_utf8(info->file_uri));
 #if HAVE_MACOSX_DESKTOP
-       libbalsa_macosx_menu_for_parent(extbody_dialog, GTK_WINDOW(parent));
+        libbalsa_macosx_menu_for_parent(extbody_dialog, GTK_WINDOW(parent));
 #endif
-       gtk_window_set_title(GTK_WINDOW(extbody_dialog),
-                            _("Attach as Reference?"));
-       result = gtk_dialog_run(GTK_DIALOG(extbody_dialog));
-       gtk_widget_destroy(extbody_dialog);
-       if (result != GTK_RESPONSE_YES)
-           return;
+        gtk_window_set_title(GTK_WINDOW(extbody_dialog),
+                             _("Attach as Reference?"));
+        result = gtk_dialog_run(GTK_DIALOG(extbody_dialog));
+        gtk_widget_destroy(extbody_dialog);
+        if (result != GTK_RESPONSE_YES)
+            return;
     }
 
     /* change the attachment mode */
     info->mode = new_mode;
     gtk_list_store_set(GTK_LIST_STORE(model), &iter, ATTACH_MODE_COLUMN,
-                      info->mode, -1);
+                       info->mode, -1);
 
     /* set the menu's sensitivities */
     gtk_container_forall(GTK_CONTAINER(gtk_widget_get_parent(menu_item)),
-                        set_attach_menu_sensitivity,
+                         set_attach_menu_sensitivity,
                          GINT_TO_POINTER(info->mode));
 }
 
 
 /* attachment vfs menu - right mouse button callback */
 static void
-attachment_menu_vfs_cb(GtkWidget * menu_item, BalsaAttachInfo * info)
+attachment_menu_vfs_cb(GtkWidget       *menu_item,
+                       BalsaAttachInfo *info)
 {
     GError *err = NULL;
     gboolean result;
@@ -1432,21 +1576,23 @@ attachment_menu_vfs_cb(GtkWidget * menu_item, BalsaAttachInfo * info)
     result = libbalsa_vfs_launch_app(info->file_uri,
                                      G_OBJECT(menu_item),
                                      &err);
-    if (!result)
+    if (!result) {
         balsa_information(LIBBALSA_INFORMATION_WARNING,
                           _("Could not launch application: %s"),
                           err ? err->message : "Unknown error");
+    }
     g_clear_error(&err);
 }
 
 
 /* URL external body - right mouse button callback */
 static void
-on_open_url_cb(GtkWidget * menu_item, BalsaAttachInfo * info)
+on_open_url_cb(GtkWidget       *menu_item,
+               BalsaAttachInfo *info)
 {
     GtkWidget *toplevel;
     GError *err = NULL;
-    const gchar * uri;
+    const gchar *uri;
 
     g_return_if_fail(info != NULL);
     uri = libbalsa_vfs_get_uri(info->file_uri);
@@ -1460,13 +1606,15 @@ on_open_url_cb(GtkWidget * menu_item, BalsaAttachInfo * info)
     }
     if (err) {
         balsa_information(LIBBALSA_INFORMATION_WARNING,
-                         _("Error showing %s: %s\n"),
-                         uri, err->message);
+                          _("Error showing %s: %s\n"),
+                          uri, err->message);
         g_error_free(err);
     }
 }
 
-static GtkWidget * sw_attachment_list(BalsaSendmsg *bsmsg);
+
+static GtkWidget *sw_attachment_list(BalsaSendmsg *bsmsg);
+
 static void
 show_attachment_widget(BalsaSendmsg *bsmsg)
 {
@@ -1474,7 +1622,7 @@ show_attachment_widget(BalsaSendmsg *bsmsg)
     GtkWidget *child;
 
     outer_paned = GTK_PANED(bsmsg->paned);
-    child = gtk_paned_get_child1(outer_paned);
+    child       = gtk_paned_get_child1(outer_paned);
 
     if (!GTK_IS_PANED(child)) {
         gint position;
@@ -1507,22 +1655,26 @@ show_attachment_widget(BalsaSendmsg *bsmsg)
     }
 }
 
+
 /* Ask the user for a charset; returns ((LibBalsaCodeset) -1) on cancel. */
 static void
-sw_charset_combo_box_changed(GtkComboBox * combo_box,
-                             GtkWidget * charset_button)
+sw_charset_combo_box_changed(GtkComboBox *combo_box,
+                             GtkWidget   *charset_button)
 {
     gtk_widget_set_sensitive(charset_button,
                              gtk_combo_box_get_active(combo_box) == 0);
 }
 
+
 static LibBalsaCodeset
-sw_get_user_codeset(BalsaSendmsg * bsmsg, gboolean * change_type,
-                    const gchar * mime_type, const char *fname)
+sw_get_user_codeset(BalsaSendmsg *bsmsg,
+                    gboolean     *change_type,
+                    const gchar  *mime_type,
+                    const char   *fname)
 {
     GtkWidget *combo_box = NULL;
-    gint codeset = -1;
-    GtkWidget *dialog =
+    gint codeset         = -1;
+    GtkWidget *dialog    =
         gtk_dialog_new_with_buttons(_("Choose character set"),
                                     GTK_WINDOW(bsmsg->window),
                                     GTK_DIALOG_DESTROY_WITH_PARENT |
@@ -1531,10 +1683,10 @@ sw_get_user_codeset(BalsaSendmsg * bsmsg, gboolean * change_type,
                                     _("_Cancel"), GTK_RESPONSE_CANCEL,
                                     NULL);
     gchar *msg = g_strdup_printf
-        (_("File\n%s\nis not encoded in US-ASCII or UTF-8.\n"
-           "Please choose the character set used to encode the file."),
-         fname);
-    GtkWidget *info = gtk_label_new(msg);
+            (_("File\n%s\nis not encoded in US-ASCII or UTF-8.\n"
+               "Please choose the character set used to encode the file."),
+            fname);
+    GtkWidget *info           = gtk_label_new(msg);
     GtkWidget *charset_button = libbalsa_charset_button_new();
     GtkBox *content_box;
 
@@ -1552,7 +1704,7 @@ sw_get_user_codeset(BalsaSendmsg * bsmsg, gboolean * change_type,
 
     if (change_type) {
         GtkWidget *label = gtk_label_new(_("Attach as MIME type:"));
-        GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
+        GtkWidget *hbox  = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
         combo_box = gtk_combo_box_text_new();
 
         gtk_widget_set_vexpand(hbox, TRUE);
@@ -1576,17 +1728,20 @@ sw_get_user_codeset(BalsaSendmsg * bsmsg, gboolean * change_type,
             *change_type =
                 gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box)) != 0;
         if (!change_type || !*change_type)
-           codeset = gtk_combo_box_get_active(GTK_COMBO_BOX(charset_button));
+            codeset = gtk_combo_box_get_active(GTK_COMBO_BOX(charset_button));
     }
 
     gtk_widget_destroy(dialog);
     return (LibBalsaCodeset) codeset;
 }
 
+
 static gboolean
-sw_set_charset(BalsaSendmsg * bsmsg, const gchar * filename,
-               const gchar * content_type, gboolean * change_type,
-               gchar ** attach_charset)
+sw_set_charset(BalsaSendmsg *bsmsg,
+               const gchar  *filename,
+               const gchar  *content_type,
+               gboolean     *change_type,
+               gchar       **attach_charset)
 {
     const gchar *charset;
     LibBalsaTextAttribute attr;
@@ -1595,20 +1750,21 @@ sw_set_charset(BalsaSendmsg * bsmsg, const gchar * filename,
     if ((gint) attr < 0)
         return FALSE;
 
-    if (attr == 0)
+    if (attr == 0) {
         charset = "us-ascii";
-    else if (attr & LIBBALSA_TEXT_HI_UTF8)
+    } else if (attr & LIBBALSA_TEXT_HI_UTF8) {
         charset = "UTF-8";
-    else {
+    } else {
         LibBalsaCodesetInfo *info;
         LibBalsaCodeset codeset =
             sw_get_user_codeset(bsmsg, change_type, content_type, filename);
         if (*change_type)
             return TRUE;
+
         if (codeset == (LibBalsaCodeset) (-1))
             return FALSE;
 
-        info = &libbalsa_codeset_info[codeset];
+        info    = &libbalsa_codeset_info[codeset];
         charset = info->std;
         if (info->win && (attr & LIBBALSA_TEXT_HI_CTRL)) {
             charset = info->win;
@@ -1636,10 +1792,11 @@ get_fwd_mail_headers(const gchar *mailfile)
 
     /* try to open the mail file */
     if ((fd = open(mailfile, O_RDONLY)) == -1)
-       return NULL;
+        return NULL;
+
     if ((stream = g_mime_stream_fs_new(fd)) == NULL) {
-       close(fd);
-       return NULL;
+        close(fd);
+        return NULL;
     }
 
     /* parse the file */
@@ -1654,16 +1811,16 @@ get_fwd_mail_headers(const gchar *mailfile)
     headers = g_new0(LibBalsaMessageHeaders, 1);
     libbalsa_message_headers_from_gmime(headers, message);
     if (!headers->subject) {
-       const gchar * subject = g_mime_message_get_subject(message);
+        const gchar *subject = g_mime_message_get_subject(message);
 
-       if (!subject)
-           headers->subject = g_strdup(_("(no subject)"));
-       else
-           headers->subject = g_mime_utils_header_decode_text(subject);
+        if (!subject)
+            headers->subject = g_strdup(_("(no subject)"));
+        else
+            headers->subject = g_mime_utils_header_decode_text(subject);
     }
     libbalsa_utf8_sanitize(&headers->subject,
-                          balsa_app.convert_unknown_8bit,
-                          NULL);
+                           balsa_app.convert_unknown_8bit,
+                           NULL);
 
     /* unref the gmime message and return the information */
     g_object_unref(message);
@@ -1673,12 +1830,14 @@ get_fwd_mail_headers(const gchar *mailfile)
 
 /* add_attachment:
    adds given filename (uri format) to the list.
-*/
+ */
 gboolean
-add_attachment(BalsaSendmsg * bsmsg, const gchar *filename,
-               gboolean is_a_temp_file, const gchar *forced_mime_type)
+add_attachment(BalsaSendmsg *bsmsg,
+               const gchar  *filename,
+               gboolean      is_a_temp_file,
+               const gchar  *forced_mime_type)
 {
-    LibbalsaVfs * file_uri;
+    LibbalsaVfs *file_uri;
     GtkTreeModel *model;
     GtkTreeIter iter;
     BalsaAttachInfo *attach_data;
@@ -1691,7 +1850,7 @@ add_attachment(BalsaSendmsg * bsmsg, const gchar *filename,
     gchar *content_desc;
 
     if (balsa_app.debug)
-       fprintf(stderr, "Trying to attach '%s'\n", filename);
+        fprintf(stderr, "Trying to attach '%s'\n", filename);
     if (!(file_uri = libbalsa_vfs_new_from_uri(filename))) {
         balsa_information_parented(GTK_WINDOW(bsmsg->window),
                                    LIBBALSA_INFORMATION_ERROR,
@@ -1704,63 +1863,63 @@ add_attachment(BalsaSendmsg * bsmsg, const gchar *filename,
                                    LIBBALSA_INFORMATION_ERROR,
                                    "%s: %s", filename,
                                    err && err->message ? err->message : _("unknown error"));
-       g_error_free(err);
-       g_object_unref(file_uri);
-       return FALSE;
+        g_error_free(err);
+        g_object_unref(file_uri);
+        return FALSE;
     }
 
     /* get the pixbuf for the attachment's content type */
     is_fwd_message = forced_mime_type &&
-       !g_ascii_strncasecmp(forced_mime_type, "message/", 8) && is_a_temp_file;
+        !g_ascii_strncasecmp(forced_mime_type, "message/", 8) && is_a_temp_file;
     if (is_fwd_message)
-       content_type = g_strdup(forced_mime_type);
+        content_type = g_strdup(forced_mime_type);
     pixbuf =
         libbalsa_icon_finder(GTK_WIDGET(bsmsg->window), forced_mime_type,
                              file_uri, &content_type, 24);
     if (!content_type)
-       /* Last ditch. */
-       content_type = g_strdup("application/octet-stream");
+        /* Last ditch. */
+        content_type = g_strdup("application/octet-stream");
 
     /* create a new attachment info block */
-    attach_data = balsa_attach_info_new(bsmsg);
+    attach_data          = balsa_attach_info_new(bsmsg);
     attach_data->charset = NULL;
     if (!g_ascii_strncasecmp(content_type, "text/", 5)) {
-       gboolean change_type = FALSE;
-       if (!sw_set_charset(bsmsg, filename, content_type,
-                           &change_type, &attach_data->charset)) {
-           g_free(content_type);
-           g_object_unref(attach_data);
-           return FALSE;
-       }
-       if (change_type) {
-           forced_mime_type = "application/octet-stream";
-           g_free(content_type);
-           content_type = g_strdup(forced_mime_type);
-       }
+        gboolean change_type = FALSE;
+        if (!sw_set_charset(bsmsg, filename, content_type,
+                            &change_type, &attach_data->charset)) {
+            g_free(content_type);
+            g_object_unref(attach_data);
+            return FALSE;
+        }
+        if (change_type) {
+            forced_mime_type = "application/octet-stream";
+            g_free(content_type);
+            content_type = g_strdup(forced_mime_type);
+        }
     }
 
     if (is_fwd_message) {
-       attach_data->headers = get_fwd_mail_headers(filename);
-       if (!attach_data->headers)
-           utf8name = g_strdup(_("forwarded message"));
-       else {
+        attach_data->headers = get_fwd_mail_headers(filename);
+        if (!attach_data->headers) {
+            utf8name = g_strdup(_("forwarded message"));
+        } else {
             gchar *tmp =
                 internet_address_list_to_string(attach_data->headers->from,
                                                 FALSE);
-           utf8name = g_strdup_printf(_("Message from %s, subject: ā€œ%sā€"),
-                                      tmp,
-                                      attach_data->headers->subject);
-           g_free(tmp);
-       }
+            utf8name = g_strdup_printf(_("Message from %s, subject: ā€œ%sā€"),
+                                       tmp,
+                                       attach_data->headers->subject);
+            g_free(tmp);
+        }
     } else {
         const gchar *uri_utf8 = libbalsa_vfs_get_uri_utf8(file_uri);
-       const gchar *home = g_getenv("HOME");
+        const gchar *home     = g_getenv("HOME");
 
-       if (home && !strncmp(uri_utf8, "file://", 7) &&
-            !strncmp(uri_utf8 + 7, home, strlen(home))) {
-           utf8name = g_strdup_printf("~%s", uri_utf8 + 7 + strlen(home));
-       } else
-           utf8name = g_strdup(uri_utf8);
+        if (home && !strncmp(uri_utf8, "file://", 7) &&
+            !strncmp(uri_utf8 + 7, home, strlen(home)))
+            utf8name = g_strdup_printf("~%s", uri_utf8 + 7 + strlen(home));
+        else
+            utf8name = g_strdup(uri_utf8);
     }
 
     show_attachment_widget(bsmsg);
@@ -1768,13 +1927,13 @@ add_attachment(BalsaSendmsg * bsmsg, const gchar *filename,
     model = BALSA_MSG_ATTACH_MODEL(bsmsg);
     gtk_list_store_append(GTK_LIST_STORE(model), &iter);
 
-    attach_data->file_uri = file_uri;
+    attach_data->file_uri        = file_uri;
     attach_data->force_mime_type = g_strdup(forced_mime_type);
 
     attach_data->delete_on_destroy = is_a_temp_file;
-    can_inline = !is_a_temp_file &&
-       (!g_ascii_strncasecmp(content_type, "text/", 5) ||
-        !g_ascii_strncasecmp(content_type, "image/", 6));
+    can_inline                     = !is_a_temp_file &&
+        (!g_ascii_strncasecmp(content_type, "text/", 5) ||
+         !g_ascii_strncasecmp(content_type, "image/", 6));
     attach_data->mode = LIBBALSA_ATTACH_AS_ATTACHMENT;
 
     /* build the attachment's popup menu */
@@ -1782,74 +1941,75 @@ add_attachment(BalsaSendmsg * bsmsg, const gchar *filename,
 
     /* only real text/... and image/... parts may be inlined */
     if (can_inline) {
-       menu_item =
-           gtk_menu_item_new_with_label(_(attach_modes
+        menu_item =
+            gtk_menu_item_new_with_label(_(attach_modes
                                            [LIBBALSA_ATTACH_AS_INLINE]));
-       g_object_set_data(G_OBJECT(menu_item), "new-mode",
-                         GINT_TO_POINTER(LIBBALSA_ATTACH_AS_INLINE));
-       g_signal_connect(G_OBJECT(menu_item), "activate",
-                        G_CALLBACK(change_attach_mode),
-                        (gpointer)attach_data);
-       gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
-                             menu_item);
+        g_object_set_data(G_OBJECT(menu_item), "new-mode",
+                          GINT_TO_POINTER(LIBBALSA_ATTACH_AS_INLINE));
+        g_signal_connect(G_OBJECT(menu_item), "activate",
+                         G_CALLBACK(change_attach_mode),
+                         (gpointer)attach_data);
+        gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
+                              menu_item);
     }
 
     /* all real files can be attachments */
     if (can_inline || !is_a_temp_file) {
-       menu_item =
-           gtk_menu_item_new_with_label(_(attach_modes
+        menu_item =
+            gtk_menu_item_new_with_label(_(attach_modes
                                            [LIBBALSA_ATTACH_AS_ATTACHMENT]));
-       gtk_widget_set_sensitive(menu_item, FALSE);
-       g_object_set_data(G_OBJECT(menu_item), "new-mode",
-                         GINT_TO_POINTER(LIBBALSA_ATTACH_AS_ATTACHMENT));
-       g_signal_connect(G_OBJECT(menu_item), "activate",
-                        G_CALLBACK(change_attach_mode),
-                        (gpointer)attach_data);
-       gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
-                             menu_item);
+        gtk_widget_set_sensitive(menu_item, FALSE);
+        g_object_set_data(G_OBJECT(menu_item), "new-mode",
+                          GINT_TO_POINTER(LIBBALSA_ATTACH_AS_ATTACHMENT));
+        g_signal_connect(G_OBJECT(menu_item), "activate",
+                         G_CALLBACK(change_attach_mode),
+                         (gpointer)attach_data);
+        gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
+                              menu_item);
     }
 
     /* real files may be references (external body) */
     if (!is_a_temp_file) {
-       menu_item =
-           gtk_menu_item_new_with_label(_(attach_modes
+        menu_item =
+            gtk_menu_item_new_with_label(_(attach_modes
                                            [LIBBALSA_ATTACH_AS_EXTBODY]));
-       g_object_set_data(G_OBJECT(menu_item), "new-mode",
-                         GINT_TO_POINTER(LIBBALSA_ATTACH_AS_EXTBODY));
-       g_signal_connect(G_OBJECT(menu_item), "activate",
-                        G_CALLBACK(change_attach_mode),
-                        (gpointer)attach_data);
-       gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
-                             menu_item);
+        g_object_set_data(G_OBJECT(menu_item), "new-mode",
+                          GINT_TO_POINTER(LIBBALSA_ATTACH_AS_EXTBODY));
+        g_signal_connect(G_OBJECT(menu_item), "activate",
+                         G_CALLBACK(change_attach_mode),
+                         (gpointer)attach_data);
+        gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
+                              menu_item);
     }
 
     /* an attachment can be removed */
     menu_item =
-       gtk_menu_item_new_with_label(_("Remove"));
+        gtk_menu_item_new_with_label(_("Remove"));
     g_signal_connect(G_OBJECT (menu_item), "activate",
-                    G_CALLBACK(remove_attachment),
-                    (gpointer)attach_data);
+                     G_CALLBACK(remove_attachment),
+                     (gpointer)attach_data);
     gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
-                         menu_item);
+                          menu_item);
 
     /* add the usual vfs menu so the user can inspect what (s)he actually
        attached... (only for non-message attachments) */
-    if (!is_fwd_message)
-       libbalsa_vfs_fill_menu_by_content_type(GTK_MENU(attach_data->popup_menu),
-                                              content_type,
-                                              G_CALLBACK(attachment_menu_vfs_cb),
-                                              (gpointer)attach_data);
+    if (!is_fwd_message) {
+        libbalsa_vfs_fill_menu_by_content_type(GTK_MENU(attach_data->popup_menu),
+                                               content_type,
+                                               G_CALLBACK(attachment_menu_vfs_cb),
+                                               (gpointer)attach_data);
+    }
 
     /* append to the list store */
-    content_desc =libbalsa_vfs_content_description(content_type);
+    content_desc = libbalsa_vfs_content_description(content_type);
     gtk_list_store_set(GTK_LIST_STORE(model), &iter,
-                      ATTACH_INFO_COLUMN, attach_data,
-                      ATTACH_ICON_COLUMN, pixbuf,
-                      ATTACH_TYPE_COLUMN, content_desc,
-                      ATTACH_MODE_COLUMN, attach_data->mode,
-                      ATTACH_SIZE_COLUMN, libbalsa_vfs_get_size(file_uri),
-                      ATTACH_DESC_COLUMN, utf8name,
-                      -1);
+                       ATTACH_INFO_COLUMN, attach_data,
+                       ATTACH_ICON_COLUMN, pixbuf,
+                       ATTACH_TYPE_COLUMN, content_desc,
+                       ATTACH_MODE_COLUMN, attach_data->mode,
+                       ATTACH_SIZE_COLUMN, libbalsa_vfs_get_size(file_uri),
+                       ATTACH_DESC_COLUMN, utf8name,
+                       -1);
     g_object_unref(attach_data);
     g_object_unref(pixbuf);
     g_free(utf8name);
@@ -1859,21 +2019,23 @@ add_attachment(BalsaSendmsg * bsmsg, const gchar *filename,
     return TRUE;
 }
 
+
 /* add_urlref_attachment:
    adds given url as reference to the to the list.
    frees url.
-*/
+ */
 static gboolean
-add_urlref_attachment(BalsaSendmsg * bsmsg, gchar *url)
+add_urlref_attachment(BalsaSendmsg *bsmsg,
+                      gchar        *url)
 {
     GtkTreeModel *model;
     GtkTreeIter iter;
     BalsaAttachInfo *attach_data;
-    GdkPixbuf * pixbuf;
+    GdkPixbuf *pixbuf;
     GtkWidget *menu_item;
 
     if (balsa_app.debug)
-       fprintf(stderr, "Trying to attach '%s'\n", url);
+        fprintf(stderr, "Trying to attach '%s'\n", url);
 
     /* get the pixbuf for the attachment's content type */
     pixbuf =
@@ -1881,7 +2043,7 @@ add_urlref_attachment(BalsaSendmsg * bsmsg, gchar *url)
                                  "go-jump", 16, 0, NULL);
 
     /* create a new attachment info block */
-    attach_data = balsa_attach_info_new(bsmsg);
+    attach_data          = balsa_attach_info_new(bsmsg);
     attach_data->charset = NULL;
 
     show_attachment_widget(bsmsg);
@@ -1889,42 +2051,42 @@ add_urlref_attachment(BalsaSendmsg * bsmsg, gchar *url)
     model = BALSA_MSG_ATTACH_MODEL(bsmsg);
     gtk_list_store_append(GTK_LIST_STORE(model), &iter);
 
-    attach_data->uri_ref = g_strconcat("URL:", url, NULL);
-    attach_data->force_mime_type = g_strdup("message/external-body");
+    attach_data->uri_ref           = g_strconcat("URL:", url, NULL);
+    attach_data->force_mime_type   = g_strdup("message/external-body");
     attach_data->delete_on_destroy = FALSE;
-    attach_data->mode = LIBBALSA_ATTACH_AS_EXTBODY;
+    attach_data->mode              = LIBBALSA_ATTACH_AS_EXTBODY;
 
     /* build the attachment's popup menu - may only be removed */
     attach_data->popup_menu = gtk_menu_new();
-    menu_item =
-       gtk_menu_item_new_with_label(_("Remove"));
+    menu_item               =
+        gtk_menu_item_new_with_label(_("Remove"));
     g_signal_connect(G_OBJECT (menu_item), "activate",
-                    G_CALLBACK(remove_attachment),
-                    (gpointer)attach_data);
+                     G_CALLBACK(remove_attachment),
+                     (gpointer)attach_data);
     gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
-                         menu_item);
+                          menu_item);
 
     /* add a separator and the usual vfs menu so the user can inspect what
        (s)he actually attached... (only for non-message attachments) */
     gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
-                         gtk_separator_menu_item_new());
+                          gtk_separator_menu_item_new());
     menu_item =
-       gtk_menu_item_new_with_label(_("Openā€¦"));
+        gtk_menu_item_new_with_label(_("Openā€¦"));
     g_signal_connect(G_OBJECT (menu_item), "activate",
-                    G_CALLBACK(on_open_url_cb),
-                    (gpointer)attach_data);
+                     G_CALLBACK(on_open_url_cb),
+                     (gpointer)attach_data);
     gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
-                         menu_item);
+                          menu_item);
 
     /* append to the list store */
     gtk_list_store_set(GTK_LIST_STORE(model), &iter,
-                      ATTACH_INFO_COLUMN, attach_data,
-                      ATTACH_ICON_COLUMN, pixbuf,
-                      ATTACH_TYPE_COLUMN, _("(URL)"),
-                      ATTACH_MODE_COLUMN, attach_data->mode,
-                      ATTACH_SIZE_COLUMN, 0,
-                      ATTACH_DESC_COLUMN, url,
-                      -1);
+                       ATTACH_INFO_COLUMN, attach_data,
+                       ATTACH_ICON_COLUMN, pixbuf,
+                       ATTACH_TYPE_COLUMN, _("(URL)"),
+                       ATTACH_MODE_COLUMN, attach_data->mode,
+                       ATTACH_SIZE_COLUMN, 0,
+                       ATTACH_DESC_COLUMN, url,
+                       -1);
     g_object_unref(attach_data);
     g_object_unref(pixbuf);
     g_free(url);
@@ -1932,15 +2094,17 @@ add_urlref_attachment(BalsaSendmsg * bsmsg, gchar *url)
     return TRUE;
 }
 
+
 /* attach_dialog_ok:
    processes the attachment file selection. Adds them to the list,
    showing the attachment list, if was hidden.
-*/
+ */
 static void
-attach_dialog_response(GtkWidget * dialog, gint response,
-                      BalsaSendmsg * bsmsg)
+attach_dialog_response(GtkWidget    *dialog,
+                       gint          response,
+                       BalsaSendmsg *bsmsg)
 {
-    GtkFileChooser * fc;
+    GtkFileChooser *fc;
     GSList *files, *list;
     int res = 0;
 
@@ -1948,15 +2112,15 @@ attach_dialog_response(GtkWidget * dialog, gint response,
                       "balsa-sendmsg-window-attach-dialog", NULL);
 
     if (response != GTK_RESPONSE_OK) {
-       gtk_widget_destroy(dialog);
-       return;
+        gtk_widget_destroy(dialog);
+        return;
     }
 
-    fc = GTK_FILE_CHOOSER(dialog);
+    fc    = GTK_FILE_CHOOSER(dialog);
     files = gtk_file_chooser_get_uris(fc);
     for (list = files; list; list = list->next) {
-        if(!add_attachment(bsmsg, list->data, FALSE, NULL))
-           res++;
+        if (!add_attachment(bsmsg, list->data, FALSE, NULL))
+            res++;
         g_free(list->data);
     }
 
@@ -1969,8 +2133,9 @@ attach_dialog_response(GtkWidget * dialog, gint response,
         gtk_widget_destroy(dialog);
 }
 
+
 static GtkFileChooser *
-sw_attach_dialog(BalsaSendmsg * bsmsg)
+sw_attach_dialog(BalsaSendmsg *bsmsg)
 {
     GtkWidget *fsw;
     GtkFileChooser *fc;
@@ -1980,7 +2145,7 @@ sw_attach_dialog(BalsaSendmsg * bsmsg)
                                     GTK_WINDOW(bsmsg->window),
                                     GTK_FILE_CHOOSER_ACTION_OPEN,
                                     _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                    _("_OK"),     GTK_RESPONSE_OK,
+                                    _("_OK"), GTK_RESPONSE_OK,
                                     NULL);
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(fsw, GTK_WINDOW(bsmsg->window));
@@ -1992,41 +2157,45 @@ sw_attach_dialog(BalsaSendmsg * bsmsg)
     fc = GTK_FILE_CHOOSER(fsw);
     gtk_file_chooser_set_select_multiple(fc, TRUE);
     if (balsa_app.attach_dir)
-       gtk_file_chooser_set_current_folder_uri(fc, balsa_app.attach_dir);
+        gtk_file_chooser_set_current_folder_uri(fc, balsa_app.attach_dir);
 
     g_signal_connect(G_OBJECT(fc), "response",
-                    G_CALLBACK(attach_dialog_response), bsmsg);
+                     G_CALLBACK(attach_dialog_response), bsmsg);
 
     gtk_widget_show(fsw);
 
     return fc;
 }
 
+
 /* attach_clicked - menu callback */
 static void
-sw_attach_file_activated(GSimpleAction * action,
-                         GVariant      * parameter,
-                         gpointer        data)
+sw_attach_file_activated(GSimpleAction *action,
+                         GVariant      *parameter,
+                         gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
     sw_attach_dialog(bsmsg);
 }
 
+
 /* attach_message:
    returns TRUE on success, FALSE on failure.
-*/
+ */
 static gboolean
-attach_message(BalsaSendmsg *bsmsg, LibBalsaMessage *message)
+attach_message(BalsaSendmsg    *bsmsg,
+               LibBalsaMessage *message)
 {
     gchar *name, *tmp_file_name;
 
     if (libbalsa_mktempdir(&tmp_file_name) == FALSE)
-       return FALSE;
+        return FALSE;
+
     name = g_strdup_printf("%s/forwarded-message", tmp_file_name);
     g_free(tmp_file_name);
 
-    if(!libbalsa_message_save(message, name)) {
+    if (!libbalsa_message_save(message, name)) {
         g_free(name);
         return FALSE;
     }
@@ -2037,32 +2206,35 @@ attach_message(BalsaSendmsg *bsmsg, LibBalsaMessage *message)
     return TRUE;
 }
 
+
 static void
-insert_selected_messages(BalsaSendmsg *bsmsg, QuoteType type)
+insert_selected_messages(BalsaSendmsg *bsmsg,
+                         QuoteType     type)
 {
     GtkTextBuffer *buffer =
         gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
     GtkWidget *index =
-       balsa_window_find_current_index(balsa_app.main_window);
+        balsa_window_find_current_index(balsa_app.main_window);
     GList *l;
 
     if (index && (l = balsa_index_selected_list(BALSA_INDEX(index)))) {
-       GList *node;
+        GList *node;
 
-       for (node = l; node != NULL; node = node->next) {
-           LibBalsaMessage *message = node->data;
-            GString *body = quote_message_body(bsmsg, message, type);
+        for (node = l; node != NULL; node = node->next) {
+            LibBalsaMessage *message = node->data;
+            GString *body            = quote_message_body(bsmsg, message, type);
             gtk_text_buffer_insert_at_cursor(buffer, body->str, body->len);
             g_string_free(body, TRUE);
-       }
-       g_list_free_full(l, g_object_unref);
+        }
+        g_list_free_full(l, g_object_unref);
     }
 }
 
+
 static void
-sw_include_messages_activated(GSimpleAction * action,
-                              GVariant      * parameter,
-                              gpointer        data)
+sw_include_messages_activated(GSimpleAction *action,
+                              GVariant      *parameter,
+                              gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -2071,60 +2243,61 @@ sw_include_messages_activated(GSimpleAction * action,
 
 
 static void
-sw_attach_messages_activated(GSimpleAction * action,
-                             GVariant      * parameter,
-                             gpointer        data)
+sw_attach_messages_activated(GSimpleAction *action,
+                             GVariant      *parameter,
+                             gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
-    GtkWidget *index =
-       balsa_window_find_current_index(balsa_app.main_window);
+    GtkWidget *index    =
+        balsa_window_find_current_index(balsa_app.main_window);
 
     if (index) {
-       GList *node, *l = balsa_index_selected_list(BALSA_INDEX(index));
+        GList *node, *l = balsa_index_selected_list(BALSA_INDEX(index));
 
-       for (node = l; node != NULL; node = node->next) {
-           LibBalsaMessage *message = node->data;
+        for (node = l; node != NULL; node = node->next) {
+            LibBalsaMessage *message = node->data;
 
-           if(!attach_message(bsmsg, message)) {
+            if (!attach_message(bsmsg, message)) {
                 balsa_information_parented(GTK_WINDOW(bsmsg->window),
                                            LIBBALSA_INFORMATION_WARNING,
                                            _("Attaching message failed.\n"
                                              "Possible reason: not enough temporary space"));
                 break;
             }
-       }
-       g_list_free_full(l, g_object_unref);
+        }
+        g_list_free_full(l, g_object_unref);
     }
 }
 
 
 /* attachments_add - attachments field D&D callback */
-static GSList*
+static GSList *
 uri2gslist(const char *uri_list)
 {
-  GSList *list = NULL;
+    GSList *list = NULL;
 
-  while (*uri_list) {
-    char       *linebreak = strchr(uri_list, 13);
-    int        length;
+    while (*uri_list) {
+        char *linebreak = strchr(uri_list, 13);
+        int length;
 
-    if (!linebreak || linebreak[1] != '\n')
-        return list;
+        if (!linebreak || (linebreak[1] != '\n'))
+            return list;
 
-    length = linebreak - uri_list;
+        length = linebreak - uri_list;
 
-    if (length && uri_list[0] != '#') {
-       gchar *this_uri = g_strndup(uri_list, length);
+        if (length && (uri_list[0] != '#')) {
+            gchar *this_uri = g_strndup(uri_list, length);
 
-       if (this_uri)
-           list = g_slist_append(list, this_uri);
-      }
+            if (this_uri)
+                list = g_slist_append(list, this_uri);
+        }
 
-    uri_list = linebreak + 2;
-  }
-  return list;
+        uri_list = linebreak + 2;
+    }
+    return list;
 }
 
+
 /* Helper: check if the passed parameter contains a valid RFC 2396 URI (leading
  * & trailing whitespaces allowed). Return a newly allocated string with the
  * spaces stripped on success or NULL on fail. Note that the URI may still be
@@ -2140,33 +2313,34 @@ rfc2396_uri(const gchar *instr)
 
     /* check that the string starts with ftp[s]:// or http[s]:// */
     if (g_ascii_strncasecmp(uri, "ftp://";, 6) &&
-       g_ascii_strncasecmp(uri, "ftps://", 7) &&
-       g_ascii_strncasecmp(uri, "http://";, 7) &&
-       g_ascii_strncasecmp(uri, "https://";, 8)) {
-       g_free(uri);
-       return NULL;
+        g_ascii_strncasecmp(uri, "ftps://", 7) &&
+        g_ascii_strncasecmp(uri, "http://";, 7) &&
+        g_ascii_strncasecmp(uri, "https://";, 8)) {
+        g_free(uri);
+        return NULL;
     }
 
     /* verify that the string contains only valid chars (see rfc 2396) */
     s1 = uri + 6;   /* skip verified beginning */
     while (*s1 != '\0') {
-       if (!g_ascii_isalnum(*s1) && !strchr(uri_extra, *s1)) {
-           g_free(uri);
-           return NULL;
-       }
-       s1++;
+        if (!g_ascii_isalnum(*s1) && !strchr(uri_extra, *s1)) {
+            g_free(uri);
+            return NULL;
+        }
+        s1++;
     }
 
     /* success... */
     return uri;
 }
 
+
 static void
-attachments_add(GtkWidget        * widget,
-               GdkDragContext   * context,
-               GtkSelectionData * selection_data,
-               guint32 time,
-                BalsaSendmsg     * bsmsg)
+attachments_add(GtkWidget        *widget,
+                GdkDragContext   *context,
+                GtkSelectionData *selection_data,
+                guint32           time,
+                BalsaSendmsg     *bsmsg)
 {
     const gchar *target;
     gboolean drag_result = TRUE;
@@ -2176,25 +2350,26 @@ attachments_add(GtkWidget        * widget,
         printf("attachments_add: target %s\n", target);
 
     if (target == g_intern_static_string("x-application/x-message-list")) {
-       BalsaIndex *index =
+        BalsaIndex *index =
             *(BalsaIndex **) gtk_selection_data_get_data(selection_data);
-       LibBalsaMailbox *mailbox = index->mailbox_node->mailbox;
-        GArray *selected = balsa_index_selected_msgnos_new(index);
-       guint i;
+        LibBalsaMailbox *mailbox = index->mailbox_node->mailbox;
+        GArray *selected         = balsa_index_selected_msgnos_new(index);
+        guint i;
 
         for (i = 0; i < selected->len; i++) {
-           guint msgno = g_array_index(selected, guint, i);
-           LibBalsaMessage *message =
-               libbalsa_mailbox_get_message(mailbox, msgno);
+            guint msgno              = g_array_index(selected, guint, i);
+            LibBalsaMessage *message =
+                libbalsa_mailbox_get_message(mailbox, msgno);
             if (!message)
                 continue;
 
-            if(!attach_message(bsmsg, message))
+            if (!attach_message(bsmsg, message)) {
                 balsa_information_parented(GTK_WINDOW(bsmsg->window),
                                            LIBBALSA_INFORMATION_WARNING,
                                            _("Attaching message failed.\n"
                                              "Possible reason: not enough temporary space"));
-           g_object_unref(message);
+            }
+            g_object_unref(message);
         }
         balsa_index_selected_msgnos_free(index, selected);
     } else if (target == g_intern_static_string("text/uri-list")) {
@@ -2202,29 +2377,30 @@ attachments_add(GtkWidget        * widget,
 
         uri_list = uri2gslist((gchar *) gtk_selection_data_get_data(selection_data));
         for (list = uri_list; list != NULL; list = list->next) {
-           add_attachment(bsmsg, list->data, FALSE, NULL);
+            add_attachment(bsmsg, list->data, FALSE, NULL);
             g_free(list->data);
         }
         g_slist_free(uri_list);
-    } else if (target == g_intern_static_string("STRING") ||
-               target == g_intern_static_string("text/plain")) {
-       gchar *url = rfc2396_uri((gchar *) gtk_selection_data_get_data(selection_data));
+    } else if ((target == g_intern_static_string("STRING")) ||
+               (target == g_intern_static_string("text/plain"))) {
+        gchar *url = rfc2396_uri((gchar *) gtk_selection_data_get_data(selection_data));
 
-       if (url)
-           add_urlref_attachment(bsmsg, url);
-       else
-           drag_result = FALSE;
+        if (url)
+            add_urlref_attachment(bsmsg, url);
+        else
+            drag_result = FALSE;
     }
 
     gtk_drag_finish(context, drag_result, time);
 }
 
+
 /* to_add - address-view D&D callback; we assume it's a To: address */
 static void
-to_add(GtkWidget        * widget,
-       GdkDragContext   * context,
-       GtkSelectionData * selection_data,
-       guint32            time)
+to_add(GtkWidget        *widget,
+       GdkDragContext   *context,
+       GtkSelectionData *selection_data,
+       guint32           time)
 {
     const gchar *target;
     gboolean drag_result = FALSE;
@@ -2237,8 +2413,8 @@ to_add(GtkWidget        * widget,
 
     target = gtk_selection_data_get_target(selection_data);
 
-    if (target == g_intern_static_string("STRING") ||
-        target == g_intern_static_string("text/plain")) {
+    if ((target == g_intern_static_string("STRING")) ||
+        (target == g_intern_static_string("text/plain"))) {
         const gchar *address;
 
         address =
@@ -2249,6 +2425,7 @@ to_add(GtkWidget        * widget,
     gtk_drag_finish(context, drag_result, time);
 }
 
+
 /*
  * static void create_email_or_string_entry()
  *
@@ -2265,11 +2442,11 @@ to_add(GtkWidget        * widget,
 #define BALSA_COMPOSE_ENTRY "balsa-compose-entry"
 
 static void
-create_email_or_string_entry(BalsaSendmsg * bsmsg,
-                             GtkWidget    * grid,
-                             const gchar  * label,
-                             int            y_pos,
-                             GtkWidget    * arr[])
+create_email_or_string_entry(BalsaSendmsg *bsmsg,
+                             GtkWidget    *grid,
+                             const gchar  *label,
+                             int           y_pos,
+                             GtkWidget    *arr[])
 {
     GtkWidget *mnemonic_widget;
 
@@ -2294,7 +2471,7 @@ create_email_or_string_entry(BalsaSendmsg * bsmsg,
         gtk_css_provider_load_from_data(css_provider, css, -1);
         g_free(css);
 
-        gtk_style_context_add_provider(gtk_widget_get_style_context(arr[1]) ,
+        gtk_style_context_add_provider(gtk_widget_get_style_context(arr[1]),
                                        GTK_STYLE_PROVIDER(css_provider),
                                        GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
         g_object_unref(css_provider);
@@ -2318,17 +2495,18 @@ create_email_or_string_entry(BalsaSendmsg * bsmsg,
  *                          - arr[1] will be the entry widget.
  */
 static void
-create_string_entry(BalsaSendmsg * bsmsg,
-                    GtkWidget    * grid,
-                    const gchar  * label,
-                    int            y_pos,
-                    GtkWidget    * arr[])
+create_string_entry(BalsaSendmsg *bsmsg,
+                    GtkWidget    *grid,
+                    const gchar  *label,
+                    int           y_pos,
+                    GtkWidget    *arr[])
 {
     arr[1] = gtk_entry_new();
     gtk_entry_set_max_length(GTK_ENTRY(arr[1]), 2048);
     create_email_or_string_entry(bsmsg, grid, label, y_pos, arr);
 }
 
+
 /*
  * static void create_email_entry()
  *
@@ -2343,14 +2521,14 @@ create_string_entry(BalsaSendmsg * bsmsg,
  */
 
 static void
-create_email_entry(BalsaSendmsg         * bsmsg,
-                   GtkWidget            * grid,
-                   int                    y_pos,
-                   LibBalsaAddressView ** view,
-                   GtkWidget           ** widget,
-                   const gchar          * label,
-                   const gchar * const  * types,
-                   guint                  n_types)
+create_email_entry(BalsaSendmsg         *bsmsg,
+                   GtkWidget            *grid,
+                   int                   y_pos,
+                   LibBalsaAddressView **view,
+                   GtkWidget           **widget,
+                   const gchar          *label,
+                   const gchar *const   *types,
+                   guint                 n_types)
 {
     GtkWidget *scroll;
     GdkContentFormats *formats;
@@ -2361,8 +2539,8 @@ create_email_entry(BalsaSendmsg         * bsmsg,
 
     scroll = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
-                                  GTK_POLICY_AUTOMATIC,
-                                  GTK_POLICY_AUTOMATIC);
+                                   GTK_POLICY_AUTOMATIC,
+                                   GTK_POLICY_AUTOMATIC);
     /* This is a horrible hack, but we need to make sure that the
      * recipient list is more than one line high: */
     gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(scroll),
@@ -2378,13 +2556,13 @@ create_email_entry(BalsaSendmsg         * bsmsg,
     g_signal_connect(*view, "drag_data_received",
                      G_CALLBACK(to_add), NULL);
     g_signal_connect(*view, "open-address-book",
-                    G_CALLBACK(address_book_cb), bsmsg);
+                     G_CALLBACK(address_book_cb), bsmsg);
 
     formats = gdk_content_formats_new(email_field_drop_types,
                                       G_N_ELEMENTS(email_field_drop_types));
     gtk_drag_dest_set(GTK_WIDGET(*view), GTK_DEST_DEFAULT_ALL,
-                     formats,
-                     GDK_ACTION_COPY | GDK_ACTION_MOVE);
+                      formats,
+                      GDK_ACTION_COPY | GDK_ACTION_MOVE);
     gdk_content_formats_unref(formats);
 
     libbalsa_address_view_set_domain(*view, libbalsa_identity_get_domain(bsmsg->ident));
@@ -2392,8 +2570,10 @@ create_email_entry(BalsaSendmsg         * bsmsg,
                              G_CALLBACK(check_readiness), bsmsg);
 }
 
+
 static void
-sw_combo_box_changed(GtkComboBox * combo_box, BalsaSendmsg * bsmsg)
+sw_combo_box_changed(GtkComboBox  *combo_box,
+                     BalsaSendmsg *bsmsg)
 {
     GtkTreeIter iter;
 
@@ -2407,8 +2587,10 @@ sw_combo_box_changed(GtkComboBox * combo_box, BalsaSendmsg * bsmsg)
     }
 }
 
+
 static void
-create_from_entry(GtkWidget * grid, BalsaSendmsg * bsmsg)
+create_from_entry(GtkWidget    *grid,
+                  BalsaSendmsg *bsmsg)
 {
     bsmsg->from[1] =
         libbalsa_identity_combo_box(balsa_app.identities, NULL,
@@ -2416,6 +2598,7 @@ create_from_entry(GtkWidget * grid, BalsaSendmsg * bsmsg)
     create_email_or_string_entry(bsmsg, grid, _("F_rom:"), 0, bsmsg->from);
 }
 
+
 static void
 sw_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
                       gint                  n_press,
@@ -2429,7 +2612,8 @@ sw_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
     GtkTreePath *path;
 
     gesture = GTK_GESTURE(multi_press);
-    event = gtk_gesture_get_last_event(gesture, gtk_gesture_get_last_updated_sequence(gesture));
+    event   =
+        gtk_gesture_get_last_event(gesture, gtk_gesture_get_last_updated_sequence(gesture));
     g_return_if_fail(event != NULL);
     if (!gdk_event_triggers_context_menu(event))
         return;
@@ -2439,25 +2623,25 @@ sw_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
     if (gtk_tree_view_get_path_at_pos(tree_view, (gint) x, (gint) y,
                                       &path, NULL, NULL, NULL)) {
         GtkTreeIter iter;
-        GtkTreeSelection * selection =
+        GtkTreeSelection *selection =
             gtk_tree_view_get_selection(tree_view);
-        GtkTreeModel * model = gtk_tree_view_get_model(tree_view);
-
-       gtk_tree_selection_unselect_all(selection);
-       gtk_tree_selection_select_path(selection, path);
-       gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree_view), path, NULL,
-                                FALSE);
-       if (gtk_tree_model_get_iter (model, &iter, path)) {
-           BalsaAttachInfo *attach_info;
-
-           gtk_tree_model_get(model, &iter, ATTACH_INFO_COLUMN, &attach_info, -1);
-           if (attach_info) {
-               if (attach_info->popup_menu) {
+        GtkTreeModel *model = gtk_tree_view_get_model(tree_view);
+
+        gtk_tree_selection_unselect_all(selection);
+        gtk_tree_selection_select_path(selection, path);
+        gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree_view), path, NULL,
+                                 FALSE);
+        if (gtk_tree_model_get_iter (model, &iter, path)) {
+            BalsaAttachInfo *attach_info;
+
+            gtk_tree_model_get(model, &iter, ATTACH_INFO_COLUMN, &attach_info, -1);
+            if (attach_info) {
+                if (attach_info->popup_menu) {
                     gtk_menu_popup_at_pointer(GTK_MENU(attach_info->popup_menu),
                                               (GdkEvent *) event);
                 }
-               g_object_unref(attach_info);
-           }
+                g_object_unref(attach_info);
+            }
         }
         gtk_tree_path_free(path);
     }
@@ -2465,7 +2649,8 @@ sw_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
 
 
 static gboolean
-attachment_popup_cb(GtkWidget *widget, gpointer user_data)
+attachment_popup_cb(GtkWidget *widget,
+                    gpointer   user_data)
 {
     GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
     GtkTreeModel *model;
@@ -2473,17 +2658,17 @@ attachment_popup_cb(GtkWidget *widget, gpointer user_data)
     BalsaAttachInfo *attach_info;
 
     if (!gtk_tree_selection_get_selected(selection, &model, &iter))
-       return FALSE;
+        return FALSE;
 
     gtk_tree_model_get(model, &iter, ATTACH_INFO_COLUMN, &attach_info, -1);
     if (attach_info) {
-       if (attach_info->popup_menu) {
+        if (attach_info->popup_menu) {
             gtk_menu_popup_at_widget(GTK_MENU(attach_info->popup_menu),
                                      GTK_WIDGET(widget),
                                      GDK_GRAVITY_CENTER, GDK_GRAVITY_CENTER,
                                      NULL);
         }
-       g_object_unref(attach_info);
+        g_object_unref(attach_info);
     }
 
     return TRUE;
@@ -2491,8 +2676,11 @@ attachment_popup_cb(GtkWidget *widget, gpointer user_data)
 
 
 static void
-render_attach_mode(GtkTreeViewColumn *column, GtkCellRenderer *cell,
-                  GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
+render_attach_mode(GtkTreeViewColumn *column,
+                   GtkCellRenderer   *cell,
+                   GtkTreeModel      *model,
+                   GtkTreeIter       *iter,
+                   gpointer           data)
 {
     gint mode;
 
@@ -2502,15 +2690,18 @@ render_attach_mode(GtkTreeViewColumn *column, GtkCellRenderer *cell,
 
 
 static void
-render_attach_size(GtkTreeViewColumn *column, GtkCellRenderer *cell,
-                  GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
+render_attach_size(GtkTreeViewColumn *column,
+                   GtkCellRenderer   *cell,
+                   GtkTreeModel      *model,
+                   GtkTreeIter       *iter,
+                   gpointer           data)
 {
     gint mode;
     guint64 size;
     gchar *sstr;
 
     gtk_tree_model_get(model, iter, ATTACH_MODE_COLUMN, &mode,
-                      ATTACH_SIZE_COLUMN, &size, -1);
+                       ATTACH_SIZE_COLUMN, &size, -1);
     if (mode == LIBBALSA_ATTACH_AS_EXTBODY)
         sstr = g_strdup("-");
     else
@@ -2523,9 +2714,9 @@ render_attach_size(GtkTreeViewColumn *column, GtkCellRenderer *cell,
 /* create_info_pane
    creates upper panel with the message headers: From, To, ... and
    returns it.
-*/
+ */
 static GtkWidget *
-create_info_pane(BalsaSendmsg * bsmsg)
+create_info_pane(BalsaSendmsg *bsmsg)
 {
     guint row = 0;
     GtkWidget *grid;
@@ -2593,6 +2784,7 @@ create_info_pane(BalsaSendmsg * bsmsg)
     return grid;
 }
 
+
 static GtkWidget *
 sw_attachment_list(BalsaSendmsg *bsmsg)
 {
@@ -2621,19 +2813,19 @@ sw_attachment_list(BalsaSendmsg *bsmsg)
 
     sw = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
-                                  GTK_POLICY_AUTOMATIC,
-                                  GTK_POLICY_AUTOMATIC);
+                                   GTK_POLICY_AUTOMATIC,
+                                   GTK_POLICY_AUTOMATIC);
 
     store = gtk_list_store_new(ATTACH_NUM_COLUMNS,
-                              BALSA_TYPE_ATTACH_INFO,
-                              GDK_TYPE_PIXBUF,
-                              G_TYPE_STRING,
-                              G_TYPE_INT,
-                              G_TYPE_UINT64,
-                              G_TYPE_STRING);
+                               BALSA_TYPE_ATTACH_INFO,
+                               GDK_TYPE_PIXBUF,
+                               G_TYPE_STRING,
+                               G_TYPE_INT,
+                               G_TYPE_UINT64,
+                               G_TYPE_STRING);
 
     bsmsg->tree_view = tree_view =
-        gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
+            gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
     gtk_widget_set_vexpand(tree_view, TRUE);
     view = GTK_TREE_VIEW(tree_view);
     gtk_tree_view_set_headers_visible(view, TRUE);
@@ -2643,26 +2835,26 @@ sw_attachment_list(BalsaSendmsg *bsmsg)
     renderer = gtk_cell_renderer_pixbuf_new();
     g_object_set(G_OBJECT(renderer), "xalign", 0.0, NULL);
     gtk_tree_view_insert_column_with_attributes(view,
-                                               -1, NULL, renderer,
-                                               "pixbuf", ATTACH_ICON_COLUMN,
-                                               NULL);
+                                                -1, NULL, renderer,
+                                                "pixbuf", ATTACH_ICON_COLUMN,
+                                                NULL);
 
     /* column for the mime type */
     renderer = gtk_cell_renderer_text_new();
     g_object_set(G_OBJECT(renderer), "xalign", 0.0, NULL);
     gtk_tree_view_insert_column_with_attributes(view,
-                                               -1, _("Type"), renderer,
-                                               "text", ATTACH_TYPE_COLUMN,
-                                               NULL);
+                                                -1, _("Type"), renderer,
+                                                "text", ATTACH_TYPE_COLUMN,
+                                                NULL);
 
     /* column for the attachment mode */
     renderer = gtk_cell_renderer_text_new();
     g_object_set(G_OBJECT(renderer), "xalign", 0.0, NULL);
     column = gtk_tree_view_column_new_with_attributes(_("Mode"), renderer,
-                                                     "text", ATTACH_MODE_COLUMN,
-                                                     NULL);
+                                                      "text", ATTACH_MODE_COLUMN,
+                                                      NULL);
     gtk_tree_view_column_set_cell_data_func(column,
-                                           renderer, render_attach_mode,
+                                            renderer, render_attach_mode,
                                             NULL, NULL);
     gtk_tree_view_append_column(view, column);
 
@@ -2670,10 +2862,10 @@ sw_attachment_list(BalsaSendmsg *bsmsg)
     renderer = gtk_cell_renderer_text_new();
     g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL);
     column = gtk_tree_view_column_new_with_attributes(_("Size"), renderer,
-                                                     "text", ATTACH_SIZE_COLUMN,
-                                                     NULL);
+                                                      "text", ATTACH_SIZE_COLUMN,
+                                                      NULL);
     gtk_tree_view_column_set_cell_data_func(column,
-                                           renderer, render_attach_size,
+                                            renderer, render_attach_size,
                                             NULL, NULL);
     gtk_tree_view_append_column(view, column);
 
@@ -2681,12 +2873,12 @@ sw_attachment_list(BalsaSendmsg *bsmsg)
     renderer = gtk_cell_renderer_text_new();
     g_object_set(G_OBJECT(renderer), "xalign", 0.0, NULL);
     gtk_tree_view_insert_column_with_attributes(view,
-                                               -1, _("Description"), renderer,
-                                               "text", ATTACH_DESC_COLUMN,
-                                               NULL);
+                                                -1, _("Description"), renderer,
+                                                "text", ATTACH_DESC_COLUMN,
+                                                NULL);
 
     gtk_tree_selection_set_mode(gtk_tree_view_get_selection(view),
-                               GTK_SELECTION_SINGLE);
+                                GTK_SELECTION_SINGLE);
 
     gesture = gtk_gesture_multi_press_new();
     gtk_gesture_single_set_button(GTK_GESTURE_SINGLE(gesture), 0);
@@ -2698,12 +2890,12 @@ sw_attachment_list(BalsaSendmsg *bsmsg)
                      G_CALLBACK(attachment_popup_cb), NULL);
 
     g_signal_connect(G_OBJECT(bsmsg->window), "drag_data_received",
-                    G_CALLBACK(attachments_add), bsmsg);
+                     G_CALLBACK(attachments_add), bsmsg);
 
     formats = gdk_content_formats_new(drop_types, G_N_ELEMENTS(drop_types));
     gtk_drag_dest_set(GTK_WIDGET(bsmsg->window), GTK_DEST_DEFAULT_ALL,
-                     formats,
-                     GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
+                      formats,
+                      GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
     gdk_content_formats_unref(formats);
 
     frame = gtk_frame_new(NULL);
@@ -2717,37 +2909,42 @@ sw_attachment_list(BalsaSendmsg *bsmsg)
     return grid;
 }
 
+
 typedef struct {
-    gchar * name;
+    gchar   *name;
     gboolean found;
 } has_file_attached_t;
 
 static gboolean
-has_file_attached(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter,
-                 gpointer data)
+has_file_attached(GtkTreeModel *model,
+                  GtkTreePath  *path,
+                  GtkTreeIter  *iter,
+                  gpointer      data)
 {
     has_file_attached_t *find_file = (has_file_attached_t *)data;
     BalsaAttachInfo *info;
-    const gchar * uri;
+    const gchar *uri;
 
     gtk_tree_model_get(model, iter, ATTACH_INFO_COLUMN, &info, -1);
     if (!info)
-       return FALSE;
+        return FALSE;
+
     uri = libbalsa_vfs_get_uri(info->file_uri);
     if (g_strcmp0(find_file->name, uri) == 0)
-       find_file->found = TRUE;
+        find_file->found = TRUE;
     g_object_unref(info);
 
     return find_file->found;
 }
 
+
 /* drag_data_quote - text area D&D callback */
 static void
-drag_data_quote(GtkWidget        * widget,
-                GdkDragContext   * context,
-                GtkSelectionData * selection_data,
-                guint32            time,
-                BalsaSendmsg     * bsmsg)
+drag_data_quote(GtkWidget        *widget,
+                GdkDragContext   *context,
+                GtkSelectionData *selection_data,
+                guint32           time,
+                BalsaSendmsg     *bsmsg)
 {
     const gchar *target;
     GtkTextBuffer *buffer;
@@ -2759,23 +2956,23 @@ drag_data_quote(GtkWidget        * widget,
     target = gtk_selection_data_get_target(selection_data);
 
     if (target == g_intern_static_string(drop_types[TARGET_MESSAGES])) {
-       index =
+        index =
             *(BalsaIndex **) gtk_selection_data_get_data(selection_data);
-       mailbox = index->mailbox_node->mailbox;
+        mailbox  = index->mailbox_node->mailbox;
         selected = balsa_index_selected_msgnos_new(index);
-       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget));
+        buffer   = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget));
 
         for (i = 0; i < selected->len; i++) {
-           guint msgno = g_array_index(selected, guint, i);
-           LibBalsaMessage *message;
+            guint msgno = g_array_index(selected, guint, i);
+            LibBalsaMessage *message;
             GString *body;
 
-           message = libbalsa_mailbox_get_message(mailbox, msgno);
+            message = libbalsa_mailbox_get_message(mailbox, msgno);
             if (!message)
                 continue;
 
             body = quote_message_body(bsmsg, message, QUOTE_ALL);
-           g_object_unref(message);
+            g_object_unref(message);
             gtk_text_buffer_insert_at_cursor(buffer, body->str, body->len);
             g_string_free(body, TRUE);
         }
@@ -2788,10 +2985,10 @@ drag_data_quote(GtkWidget        * widget,
             /* Since current GtkTextView gets this signal twice for
              * every action (#150141) we need to check for duplicates,
              * which is a good idea anyway. */
-           has_file_attached_t find_file;
+            has_file_attached_t find_file;
 
-           find_file.name = list->data;
-           find_file.found = FALSE;
+            find_file.name  = list->data;
+            find_file.found = FALSE;
             if (bsmsg->tree_view)
                 gtk_tree_model_foreach(BALSA_MSG_ATTACH_MODEL(bsmsg),
                                        has_file_attached, &find_file);
@@ -2805,14 +3002,16 @@ drag_data_quote(GtkWidget        * widget,
     gtk_drag_finish(context, TRUE, time);
 }
 
+
 /* create_text_area
    Creates the text entry part of the compose window.
-*/
+ */
 #ifdef HAVE_GTKSOURCEVIEW
 
 static void
-sw_can_undo_cb(GtkSourceBuffer * source_buffer, GParamSpec *arg1,
-              BalsaSendmsg * bsmsg)
+sw_can_undo_cb(GtkSourceBuffer *source_buffer,
+               GParamSpec      *arg1,
+               BalsaSendmsg    *bsmsg)
 {
     gboolean can_undo;
 
@@ -2820,9 +3019,11 @@ sw_can_undo_cb(GtkSourceBuffer * source_buffer, GParamSpec *arg1,
     sw_action_set_enabled(bsmsg, "undo", can_undo);
 }
 
+
 static void
-sw_can_redo_cb(GtkSourceBuffer * source_buffer, GParamSpec *arg1,
-              BalsaSendmsg * bsmsg)
+sw_can_redo_cb(GtkSourceBuffer *source_buffer,
+               GParamSpec      *arg1,
+               BalsaSendmsg    *bsmsg)
 {
     gboolean can_redo;
 
@@ -2830,19 +3031,20 @@ sw_can_redo_cb(GtkSourceBuffer * source_buffer, GParamSpec *arg1,
     sw_action_set_enabled(bsmsg, "redo", can_redo);
 }
 
+
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
 static GtkWidget *
-create_text_area(BalsaSendmsg * bsmsg)
+create_text_area(BalsaSendmsg *bsmsg)
 {
     GtkTextView *text_view;
     GtkTextBuffer *buffer;
 #if HAVE_GSPELL
     GspellTextBuffer *gspell_buffer;
     GspellChecker *checker;
-#if HAVE_GSPELL_1_2
+#   if HAVE_GSPELL_1_2
     GspellTextView *gspell_view;
-#endif                          /* HAVE_GSPELL_1_2 */
+#   endif                       /* HAVE_GSPELL_1_2 */
 #endif                          /* HAVE_GSPELL */
     GtkWidget *scroll;
     GdkContentFormats *formats;
@@ -2869,7 +3071,7 @@ create_text_area(BalsaSendmsg * bsmsg)
         g_free(css);
 
         gtk_widget_set_name(bsmsg->text, BALSA_COMPOSE_ENTRY);
-        gtk_style_context_add_provider(gtk_widget_get_style_context(bsmsg->text) ,
+        gtk_style_context_add_provider(gtk_widget_get_style_context(bsmsg->text),
                                        GTK_STYLE_PROVIDER(css_provider),
                                        GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
         g_object_unref(css_provider);
@@ -2883,7 +3085,7 @@ create_text_area(BalsaSendmsg * bsmsg)
                      G_CALLBACK(sw_can_redo_cb), bsmsg);
 #else                           /* HAVE_GTKSOURCEVIEW */
     bsmsg->buffer2 =
-         gtk_text_buffer_new(gtk_text_buffer_get_tag_table(buffer));
+        gtk_text_buffer_new(gtk_text_buffer_get_tag_table(buffer));
 #endif                          /* HAVE_GTKSOURCEVIEW */
     gtk_text_buffer_create_tag(buffer, "url", NULL, NULL);
     gtk_text_view_set_editable(text_view, TRUE);
@@ -2892,39 +3094,42 @@ create_text_area(BalsaSendmsg * bsmsg)
 #if HAVE_GSPELL
     if (sw_action_get_enabled(bsmsg, "spell-check")) {
         gspell_buffer = gspell_text_buffer_get_from_gtk_text_buffer(buffer);
-        checker = gspell_checker_new(NULL);
+        checker       = gspell_checker_new(NULL);
         gspell_text_buffer_set_spell_checker(gspell_buffer, checker);
         g_object_unref(checker);
 
-#if HAVE_GSPELL_1_2
+#   if HAVE_GSPELL_1_2
         gspell_view = gspell_text_view_get_from_gtk_text_view(text_view);
         gspell_text_view_set_enable_language_menu(gspell_view, TRUE);
-#endif                          /* HAVE_GSPELL_1_2 */
+#   endif                       /* HAVE_GSPELL_1_2 */
     }
 #endif                          /* HAVE_GSPELL */
 
     scroll = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
-                                  GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
+                                   GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
     gtk_container_add(GTK_CONTAINER(scroll), bsmsg->text);
     g_signal_connect(G_OBJECT(bsmsg->text), "drag_data_received",
-                    G_CALLBACK(drag_data_quote), bsmsg);
+                     G_CALLBACK(drag_data_quote), bsmsg);
 
     formats = gdk_content_formats_new(drop_types, G_N_ELEMENTS(drop_types));
     /* GTK_DEST_DEFAULT_ALL in drag_set would trigger bug 150141 */
     gtk_drag_dest_set(GTK_WIDGET(bsmsg->text), 0,
-                     formats,
-                     GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
+                      formats,
+                      GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
     gdk_content_formats_unref(formats);
 
     return scroll;
 }
 
+
 /* Check whether the string can be converted. */
 static gboolean
-sw_can_convert(const gchar * string, gssize len,
-               const gchar * to_codeset, const gchar * from_codeset,
-               gchar ** result)
+sw_can_convert(const gchar *string,
+               gssize       len,
+               const gchar *to_codeset,
+               const gchar *from_codeset,
+               gchar      **result)
 {
     gsize bytes_read, bytes_written;
     GError *err = NULL;
@@ -2949,67 +3154,69 @@ sw_can_convert(const gchar * string, gssize len,
     return !err;
 }
 
+
 /* continue_body --------------------------------------------------------
    a short-circuit procedure for the 'Continue action'
    basically copies the first text/plain part over to the entry field.
    Attachments (if any) are saved temporarily in subfolders to preserve
    their original names and then attached again.
    NOTE that rbdy == NULL if message has no text parts.
-*/
+ */
 static void
-continue_body(BalsaSendmsg * bsmsg, LibBalsaMessage * message)
+continue_body(BalsaSendmsg    *bsmsg,
+              LibBalsaMessage *message)
 {
     LibBalsaMessageBody *body;
 
     body = libbalsa_message_get_body_list(message);
     if (body) {
-       if (libbalsa_message_body_type(body) == LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART)
-           body = body->parts;
-       /* if the first part is of type text/plain with a NULL filename, it
-          was the message... */
-       if (body && !body->filename) {
-           GString *rbdy;
-           gchar *body_type = libbalsa_message_body_get_mime_type(body);
-            gint llen = -1;
+        if (libbalsa_message_body_type(body) == LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART)
+            body = body->parts;
+        /* if the first part is of type text/plain with a NULL filename, it
+           was the message... */
+        if (body && !body->filename) {
+            GString *rbdy;
+            gchar *body_type      = libbalsa_message_body_get_mime_type(body);
+            gint llen             = -1;
             GtkTextBuffer *buffer =
                 gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
 
             if (bsmsg->flow && libbalsa_message_body_is_flowed(body))
                 llen = balsa_app.wraplength;
-           if (!strcmp(body_type, "text/plain") &&
-               (rbdy = process_mime_part(message, body, NULL, llen, FALSE,
+            if (!strcmp(body_type, "text/plain") &&
+                (rbdy = process_mime_part(message, body, NULL, llen, FALSE,
                                           bsmsg->flow))) {
                 gtk_text_buffer_insert_at_cursor(buffer, rbdy->str, rbdy->len);
-               g_string_free(rbdy, TRUE);
-           }
-           g_free(body_type);
-           body = body->next;
-       }
-       while (body) {
-           gchar *name, *body_type, *tmp_file_name;
-            GError *err = NULL;
+                g_string_free(rbdy, TRUE);
+            }
+            g_free(body_type);
+            body = body->next;
+        }
+        while (body) {
+            gchar *name, *body_type, *tmp_file_name;
+            GError *err  = NULL;
             gboolean res = FALSE;
 
-           if (body->filename) {
-               libbalsa_mktempdir(&tmp_file_name);
-               name = g_strdup_printf("%s/%s", tmp_file_name, body->filename);
-               g_free(tmp_file_name);
-               res = libbalsa_message_body_save(body, name,
+            if (body->filename) {
+                libbalsa_mktempdir(&tmp_file_name);
+                name = g_strdup_printf("%s/%s", tmp_file_name, body->filename);
+                g_free(tmp_file_name);
+                res = libbalsa_message_body_save(body, name,
                                                  LIBBALSA_MESSAGE_BODY_SAFE,
                                                  FALSE, &err);
-           } else {
+            } else {
                 int fd;
 
-               if ((fd = g_file_open_tmp("balsa-continue-XXXXXX", &name, NULL)) > 0) {
-                    GMimeStream * tmp_stream;
+                if ((fd = g_file_open_tmp("balsa-continue-XXXXXX", &name, NULL)) > 0) {
+                    GMimeStream *tmp_stream;
 
                     if ((tmp_stream = g_mime_stream_fs_new(fd)) != NULL)
                         res = libbalsa_message_body_save_stream(body, tmp_stream, FALSE, &err);
                     else
                         close(fd);
                 }
-           }
-            if(!res) {
+            }
+            if (!res) {
                 balsa_information_parented(GTK_WINDOW(bsmsg->window),
                                            LIBBALSA_INFORMATION_ERROR,
                                            _("Could not save attachment: %s"),
@@ -3017,18 +3224,19 @@ continue_body(BalsaSendmsg * bsmsg, LibBalsaMessage * message)
                 g_clear_error(&err);
                 /* FIXME: do not try any further? */
             }
-           body_type = libbalsa_message_body_get_mime_type(body);
+            body_type     = libbalsa_message_body_get_mime_type(body);
             tmp_file_name = g_filename_to_uri(name, NULL, NULL);
             g_free(name);
-           add_attachment(bsmsg, tmp_file_name, TRUE, body_type);
-           g_free(body_type);
-           g_free(tmp_file_name);
-           body = body->next;
-       }
+            add_attachment(bsmsg, tmp_file_name, TRUE, body_type);
+            g_free(body_type);
+            g_free(tmp_file_name);
+            body = body->next;
+        }
     }
 }
 
-static gchar*
+
+static gchar *
 message_part_get_subject(LibBalsaMessageBody *part)
 {
     const gchar *subj = NULL;
@@ -3049,6 +3257,7 @@ message_part_get_subject(LibBalsaMessageBody *part)
     return subject;
 }
 
+
 /* --- stuff for collecting parts for a reply --- */
 
 enum {
@@ -3059,22 +3268,24 @@ enum {
 };
 
 static void
-tree_add_quote_body(LibBalsaMessageBody * body, GtkTreeStore * store, GtkTreeIter * parent)
+tree_add_quote_body(LibBalsaMessageBody *body,
+                    GtkTreeStore        *store,
+                    GtkTreeIter         *parent)
 {
     GtkTreeIter iter;
-    gchar * mime_type = libbalsa_message_body_get_mime_type(body);
-    const gchar * disp_type;
+    gchar *mime_type = libbalsa_message_body_get_mime_type(body);
+    const gchar *disp_type;
     static gboolean preselect;
-    gchar * description;
+    gchar *description;
 
     gtk_tree_store_append(store, &iter, parent);
     if (body->mime_part)
-       disp_type = g_mime_object_get_disposition(body->mime_part);
+        disp_type = g_mime_object_get_disposition(body->mime_part);
     else
-       disp_type = NULL;
+        disp_type = NULL;
     /* cppcheck-suppress nullPointer */
     preselect = !disp_type || *disp_type == '\0' ||
-       !g_ascii_strcasecmp(disp_type, "inline");
+        !g_ascii_strcasecmp(disp_type, "inline");
     if (body->filename && *body->filename) {
         if (preselect)
             description = g_strdup_printf(_("inlined file ā€œ%sā€ (%s)"),
@@ -3090,134 +3301,148 @@ tree_add_quote_body(LibBalsaMessageBody * body, GtkTreeStore * store, GtkTreeIte
     }
     g_free(mime_type);
     gtk_tree_store_set(store, &iter,
-                      QUOTE_INCLUDE, preselect,
-                      QUOTE_DESCRIPTION, description,
-                      QUOTE_BODY, body,
-                      -1);
+                       QUOTE_INCLUDE, preselect,
+                       QUOTE_DESCRIPTION, description,
+                       QUOTE_BODY, body,
+                       -1);
     g_free(description);
 }
 
+
 static gint
-scan_bodies(GtkTreeStore * bodies, GtkTreeIter * parent, LibBalsaMessageBody * body,
-           gboolean ignore_html, gboolean container_mp_alt)
+scan_bodies(GtkTreeStore        *bodies,
+            GtkTreeIter         *parent,
+            LibBalsaMessageBody *body,
+            gboolean             ignore_html,
+            gboolean             container_mp_alt)
 {
-    gchar * mime_type;
+    gchar *mime_type;
     gint count = 0;
 
     while (body) {
-       switch (libbalsa_message_body_type(body)) {
-       case LIBBALSA_MESSAGE_BODY_TYPE_TEXT:
-           {
-               LibBalsaHTMLType html_type;
-
-               mime_type = libbalsa_message_body_get_mime_type(body);
-               html_type = libbalsa_html_type(mime_type);
-               g_free(mime_type);
-
-               /* On a multipart/alternative, ignore_html defines if html or
-                * non-html parts will be added. Eject from the container when
-                * the first part has been found.
-                * Otherwise, select all text parts. */
-               if (container_mp_alt) {
-                   if ((ignore_html && html_type == LIBBALSA_HTML_TYPE_NONE) ||
-                       (!ignore_html && html_type != LIBBALSA_HTML_TYPE_NONE)) {
-                       tree_add_quote_body(body, bodies, parent);
-                       return count + 1;
-                   }
-               } else {
-                   tree_add_quote_body(body, bodies, parent);
-                   count++;
-               }
-               break;
-           }
-
-       case LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART:
-           mime_type = libbalsa_message_body_get_mime_type(body);
-           count += scan_bodies(bodies, parent, body->parts, ignore_html,
-                                !g_ascii_strcasecmp(mime_type, "multipart/alternative"));
-           g_free(mime_type);
-           break;
-
-       case LIBBALSA_MESSAGE_BODY_TYPE_MESSAGE:
-           {
-               GtkTreeIter iter;
-               gchar * description = NULL;
-
-               mime_type = libbalsa_message_body_get_mime_type(body);
-               if (g_ascii_strcasecmp(mime_type, "message/rfc822") == 0 &&
-                   body->embhdrs) {
-                   gchar *from = balsa_message_sender_to_gchar(body->embhdrs->from, 0);
-                   gchar *subj = g_strdup(body->embhdrs->subject);
-
-
-                   libbalsa_utf8_sanitize(&from, balsa_app.convert_unknown_8bit, NULL);
-                   libbalsa_utf8_sanitize(&subj, balsa_app.convert_unknown_8bit, NULL);
-                   description =
-                       g_strdup_printf(_("message from %s, subject ā€œ%sā€"),
-                                       from, subj);
-                   g_free(from);
-                   g_free(subj);
-               } else
-                   description = g_strdup(mime_type);
-
-               gtk_tree_store_append(bodies, &iter, parent);
-               gtk_tree_store_set(bodies, &iter,
-                                  QUOTE_INCLUDE, FALSE,
-                                  QUOTE_DESCRIPTION, description,
-                                  QUOTE_BODY, NULL,
-                                  -1);
-               g_free(mime_type);
-               g_free(description);
-               count += scan_bodies(bodies, &iter, body->parts, ignore_html, 0);
-           }
-
-       default:
-           break;
-       }
-
-       body = body->next;
+        switch (libbalsa_message_body_type(body)) {
+        case LIBBALSA_MESSAGE_BODY_TYPE_TEXT:
+        {
+            LibBalsaHTMLType html_type;
+
+            mime_type = libbalsa_message_body_get_mime_type(body);
+            html_type = libbalsa_html_type(mime_type);
+            g_free(mime_type);
+
+            /* On a multipart/alternative, ignore_html defines if html or
+             * non-html parts will be added. Eject from the container when
+             * the first part has been found.
+             * Otherwise, select all text parts. */
+            if (container_mp_alt) {
+                if ((ignore_html && (html_type == LIBBALSA_HTML_TYPE_NONE)) ||
+                    (!ignore_html && (html_type != LIBBALSA_HTML_TYPE_NONE))) {
+                    tree_add_quote_body(body, bodies, parent);
+                    return count + 1;
+                }
+            } else {
+                tree_add_quote_body(body, bodies, parent);
+                count++;
+            }
+            break;
+        }
+
+        case LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART:
+            mime_type = libbalsa_message_body_get_mime_type(body);
+            count    += scan_bodies(bodies, parent, body->parts, ignore_html,
+                                    !g_ascii_strcasecmp(mime_type, "multipart/alternative"));
+            g_free(mime_type);
+            break;
+
+        case LIBBALSA_MESSAGE_BODY_TYPE_MESSAGE:
+        {
+            GtkTreeIter iter;
+            gchar *description = NULL;
+
+            mime_type = libbalsa_message_body_get_mime_type(body);
+            if ((g_ascii_strcasecmp(mime_type, "message/rfc822") == 0) &&
+                body->embhdrs) {
+                gchar *from = balsa_message_sender_to_gchar(body->embhdrs->from, 0);
+                gchar *subj = g_strdup(body->embhdrs->subject);
+
+
+                libbalsa_utf8_sanitize(&from, balsa_app.convert_unknown_8bit, NULL);
+                libbalsa_utf8_sanitize(&subj, balsa_app.convert_unknown_8bit, NULL);
+                description =
+                    g_strdup_printf(_("message from %s, subject ā€œ%sā€"),
+                                    from, subj);
+                g_free(from);
+                g_free(subj);
+            } else {
+                description = g_strdup(mime_type);
+            }
+
+            gtk_tree_store_append(bodies, &iter, parent);
+            gtk_tree_store_set(bodies, &iter,
+                               QUOTE_INCLUDE, FALSE,
+                               QUOTE_DESCRIPTION, description,
+                               QUOTE_BODY, NULL,
+                               -1);
+            g_free(mime_type);
+            g_free(description);
+            count += scan_bodies(bodies, &iter, body->parts, ignore_html, 0);
+        }
+
+        default:
+            break;
+        }
+
+        body = body->next;
     }
 
     return count;
 }
 
+
 static void
-set_all_cells(GtkTreeModel * model, GtkTreeIter * iter, const gboolean value)
+set_all_cells(GtkTreeModel  *model,
+              GtkTreeIter   *iter,
+              const gboolean value)
 {
     do {
-       GtkTreeIter children;
+        GtkTreeIter children;
 
-       if (gtk_tree_model_iter_children(model, &children, iter))
-           set_all_cells(model, &children, value);
-       gtk_tree_store_set(GTK_TREE_STORE(model), iter, QUOTE_INCLUDE, value, -1);
+        if (gtk_tree_model_iter_children(model, &children, iter))
+            set_all_cells(model, &children, value);
+        gtk_tree_store_set(GTK_TREE_STORE(model), iter, QUOTE_INCLUDE, value, -1);
     } while (gtk_tree_model_iter_next(model, iter));
 }
 
+
 static gboolean
-calculate_expander_toggles(GtkTreeModel * model, GtkTreeIter * iter)
+calculate_expander_toggles(GtkTreeModel *model,
+                           GtkTreeIter  *iter)
 {
     gint count, on;
 
     count = on = 0;
     do {
-       GtkTreeIter children;
-       gboolean value;
-
-       if (gtk_tree_model_iter_children(model, &children, iter)) {
-           value = calculate_expander_toggles(model, &children);
-           gtk_tree_store_set(GTK_TREE_STORE(model), iter, QUOTE_INCLUDE, value, -1);
-       } else
-           gtk_tree_model_get(model, iter, QUOTE_INCLUDE, &value, -1);
-       if (value)
-           on++;
-       count++;
+        GtkTreeIter children;
+        gboolean value;
+
+        if (gtk_tree_model_iter_children(model, &children, iter)) {
+            value = calculate_expander_toggles(model, &children);
+            gtk_tree_store_set(GTK_TREE_STORE(model), iter, QUOTE_INCLUDE, value, -1);
+        } else {
+            gtk_tree_model_get(model, iter, QUOTE_INCLUDE, &value, -1);
+        }
+        if (value)
+            on++;
+        count++;
     } while (gtk_tree_model_iter_next(model, iter));
 
     return count == on;
 }
 
+
 static void
-cell_toggled_cb(GtkCellRendererToggle *cell, gchar *path_str, GtkTreeView *treeview)
+cell_toggled_cb(GtkCellRendererToggle *cell,
+                gchar                 *path_str,
+                GtkTreeView           *treeview)
 {
     GtkTreeModel *model = NULL;
     GtkTreePath *path;
@@ -3227,79 +3452,95 @@ cell_toggled_cb(GtkCellRendererToggle *cell, gchar *path_str, GtkTreeView *treev
 
     g_return_if_fail (GTK_IS_TREE_VIEW (treeview));
     if (!(model = gtk_tree_view_get_model(treeview)))
-       return;
+        return;
 
     path = gtk_tree_path_new_from_string(path_str);
     if (!gtk_tree_model_get_iter(model, &iter, path))
-       return;
+        return;
+
     gtk_tree_path_free(path);
 
     gtk_tree_model_get(model, &iter,
-                      QUOTE_INCLUDE, &active,
-                      -1);
+                       QUOTE_INCLUDE, &active,
+                       -1);
     gtk_tree_store_set(GTK_TREE_STORE (model), &iter,
-                      QUOTE_INCLUDE, !active,
-                      -1);
+                       QUOTE_INCLUDE, !active,
+                       -1);
     if (gtk_tree_model_iter_children(model, &children, &iter))
-       set_all_cells(model, &children, !active);
+        set_all_cells(model, &children, !active);
     gtk_tree_model_get_iter_first(model, &children);
     calculate_expander_toggles(model, &children);
 }
 
+
 static void
-append_parts(GString * q_body, LibBalsaMessage *message, GtkTreeModel * model,
-            GtkTreeIter * iter, const gchar * from_msg, gchar * reply_prefix_str,
-            gint llen, gboolean flow)
+append_parts(GString         *q_body,
+             LibBalsaMessage *message,
+             GtkTreeModel    *model,
+             GtkTreeIter     *iter,
+             const gchar     *from_msg,
+             gchar           *reply_prefix_str,
+             gint             llen,
+             gboolean         flow)
 {
     gboolean used_from_msg = FALSE;
 
     do {
-       GtkTreeIter children;
-
-       if (gtk_tree_model_iter_children(model, &children, iter)) {
-           gchar * description;
-
-           gtk_tree_model_get(model, iter, QUOTE_DESCRIPTION, &description, -1);
-           append_parts(q_body, message, model, &children, description,
-                        reply_prefix_str, llen, flow);
-           g_free(description);
-       } else {
-           gboolean do_include;
-
-           gtk_tree_model_get(model, iter, QUOTE_INCLUDE, &do_include, -1);
-           if (do_include) {
-               LibBalsaMessageBody *this_body;
-
-               gtk_tree_model_get(model, iter, QUOTE_BODY, &this_body, -1);
-               if (this_body) {
-                   GString * this_part;
-                   this_part= process_mime_part(message, this_body,
-                                                 reply_prefix_str, llen,
-                                                 FALSE, flow);
-
-                   if (q_body->len > 0 && q_body->str[q_body->len - 1] != '\n')
-                       g_string_append_c(q_body, '\n');
-                   if (!used_from_msg && from_msg) {
-                       g_string_append_printf(q_body, "\n======%s %s======\n", _("quoted"), from_msg);
-                       used_from_msg = TRUE;
-                   } else if (q_body->len > 0) {
-                       if (this_body->filename)
-                           g_string_append_printf(q_body, "\n------%s ā€œ%sā€------\n",
-                                                  _("quoted attachment"), this_body->filename);
-                       else
-                           g_string_append_printf(q_body, "\n------%s------\n",
-                                                  _("quoted attachment"));
-                   }
-                   g_string_append(q_body, this_part->str);
-                   g_string_free(this_part, TRUE);
-               }
-           }
-       }
+        GtkTreeIter children;
+
+        if (gtk_tree_model_iter_children(model, &children, iter)) {
+            gchar *description;
+
+            gtk_tree_model_get(model, iter, QUOTE_DESCRIPTION, &description, -1);
+            append_parts(q_body, message, model, &children, description,
+                         reply_prefix_str, llen, flow);
+            g_free(description);
+        } else {
+            gboolean do_include;
+
+            gtk_tree_model_get(model, iter, QUOTE_INCLUDE, &do_include, -1);
+            if (do_include) {
+                LibBalsaMessageBody *this_body;
+
+                gtk_tree_model_get(model, iter, QUOTE_BODY, &this_body, -1);
+                if (this_body) {
+                    GString *this_part;
+                    this_part = process_mime_part(message, this_body,
+                                                  reply_prefix_str, llen,
+                                                  FALSE, flow);
+
+                    if ((q_body->len > 0) && (q_body->str[q_body->len - 1] != '\n'))
+                        g_string_append_c(q_body, '\n');
+                    if (!used_from_msg && from_msg) {
+                        g_string_append_printf(q_body, "\n======%s %s======\n", _(
+                                                   "quoted"), from_msg);
+                        used_from_msg = TRUE;
+                    } else if (q_body->len > 0) {
+                        if (this_body->filename)
+                            g_string_append_printf(q_body, "\n------%s ā€œ%sā€------\n",
+                                                   _("quoted attachment"), this_body->filename);
+
+
+
+
+
+
+                        else
+                            g_string_append_printf(q_body, "\n------%s------\n",
+                                                   _("quoted attachment"));
+                    }
+                    g_string_append(q_body, this_part->str);
+                    g_string_free(this_part, TRUE);
+                }
+            }
+        }
     } while (gtk_tree_model_iter_next(model, iter));
 }
 
+
 static gboolean
-quote_parts_select_dlg(GtkTreeStore *tree_store, GtkWindow * parent)
+quote_parts_select_dlg(GtkTreeStore *tree_store,
+                       GtkWindow    *parent)
 {
     GtkWidget *dialog;
     GtkWidget *label;
@@ -3315,12 +3556,12 @@ quote_parts_select_dlg(GtkTreeStore *tree_store, GtkWindow * parent)
     GtkBox *content_box;
 
     dialog = gtk_dialog_new_with_buttons(_("Select parts for quotation"),
-                                        parent,
-                                        GTK_DIALOG_DESTROY_WITH_PARENT |
+                                         parent,
+                                         GTK_DIALOG_DESTROY_WITH_PARENT |
                                          libbalsa_dialog_flags(),
-                                        _("_OK"), GTK_RESPONSE_OK,
-                                        _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                        NULL);
+                                         _("_OK"), GTK_RESPONSE_OK,
+                                         _("_Cancel"), GTK_RESPONSE_CANCEL,
+                                         NULL);
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(dialog, parent);
 #endif
@@ -3366,14 +3607,14 @@ quote_parts_select_dlg(GtkTreeStore *tree_store, GtkWindow * parent)
     gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree_view), FALSE);
     renderer = gtk_cell_renderer_toggle_new();
     g_signal_connect(renderer, "toggled", G_CALLBACK(cell_toggled_cb),
-                    tree_view);
+                     tree_view);
     column = gtk_tree_view_column_new_with_attributes(NULL, renderer,
-                                                     "active", QUOTE_INCLUDE,
+                                                      "active", QUOTE_INCLUDE,
                                                       NULL);
     gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
     gtk_tree_view_set_expander_column(GTK_TREE_VIEW(tree_view), column);
     column = gtk_tree_view_column_new_with_attributes(NULL, gtk_cell_renderer_text_new(),
-                                                     "text", QUOTE_DESCRIPTION,
+                                                      "text", QUOTE_DESCRIPTION,
                                                       NULL);
     gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
     gtk_tree_view_expand_all(GTK_TREE_VIEW(tree_view));
@@ -3387,28 +3628,32 @@ quote_parts_select_dlg(GtkTreeStore *tree_store, GtkWindow * parent)
     return result;
 }
 
+
 static gboolean
-tree_find_single_part(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter,
-                     gpointer data)
+tree_find_single_part(GtkTreeModel *model,
+                      GtkTreePath  *path,
+                      GtkTreeIter  *iter,
+                      gpointer      data)
 {
-    LibBalsaMessageBody ** this_body = (LibBalsaMessageBody **) data;
+    LibBalsaMessageBody **this_body = (LibBalsaMessageBody **) data;
 
     gtk_tree_model_get(model, iter, QUOTE_BODY, this_body, -1);
     if (*this_body)
-       return TRUE;
+        return TRUE;
     else
-       return FALSE;
+        return FALSE;
 }
 
+
 static GString *
-collect_for_quote(BalsaSendmsg        * bsmsg,
-                  LibBalsaMessageBody * root,
-                  gchar               * reply_prefix_str,
-                  gint                  llen,
-                  gboolean              ignore_html,
-                  gboolean              flow)
-{
-    GtkTreeStore * tree_store;
+collect_for_quote(BalsaSendmsg        *bsmsg,
+                  LibBalsaMessageBody *root,
+                  gchar               *reply_prefix_str,
+                  gint                 llen,
+                  gboolean             ignore_html,
+                  gboolean             flow)
+{
+    GtkTreeStore *tree_store;
     gint text_bodies;
     LibBalsaMessage *message;
     GString *q_body = NULL;
@@ -3423,28 +3668,28 @@ collect_for_quote(BalsaSendmsg        * bsmsg,
     /* scan the message and collect text parts which might be included
      * in the reply, and if there is only one return this part */
     tree_store = gtk_tree_store_new(QOUTE_NUM_ELEMS,
-                                   G_TYPE_BOOLEAN, G_TYPE_STRING,
-                                   G_TYPE_POINTER);
+                                    G_TYPE_BOOLEAN, G_TYPE_STRING,
+                                    G_TYPE_POINTER);
     text_bodies = scan_bodies(tree_store, NULL, root, ignore_html, FALSE);
     if (text_bodies == 1) {
-       /* note: the only text body may be buried in an attached message, so
-        * we have to search the tree store... */
-       LibBalsaMessageBody *this_body;
-
-       gtk_tree_model_foreach(GTK_TREE_MODEL(tree_store), tree_find_single_part,
-                              &this_body);
-       if (this_body)
-           q_body = process_mime_part(message, this_body, reply_prefix_str,
-                                      llen, FALSE, flow);
+        /* note: the only text body may be buried in an attached message, so
+         * we have to search the tree store... */
+        LibBalsaMessageBody *this_body;
+
+        gtk_tree_model_foreach(GTK_TREE_MODEL(tree_store), tree_find_single_part,
+                               &this_body);
+        if (this_body)
+            q_body = process_mime_part(message, this_body, reply_prefix_str,
+                                       llen, FALSE, flow);
     } else if (text_bodies > 1) {
-       if (quote_parts_select_dlg(tree_store, GTK_WINDOW(bsmsg->window))) {
-           GtkTreeIter iter;
+        if (quote_parts_select_dlg(tree_store, GTK_WINDOW(bsmsg->window))) {
+            GtkTreeIter iter;
 
-           q_body = g_string_new("");
-           gtk_tree_model_get_iter_first(GTK_TREE_MODEL(tree_store), &iter);
-           append_parts(q_body, message, GTK_TREE_MODEL(tree_store), &iter, NULL,
-                        reply_prefix_str, llen, flow);
-       }
+            q_body = g_string_new("");
+            gtk_tree_model_get_iter_first(GTK_TREE_MODEL(tree_store), &iter);
+            append_parts(q_body, message, GTK_TREE_MODEL(tree_store), &iter, NULL,
+                         reply_prefix_str, llen, flow);
+        }
     }
 
     /* clean up */
@@ -3459,11 +3704,14 @@ collect_for_quote(BalsaSendmsg        * bsmsg,
    Use GString to optimize memory usage.
    Specifying type explicitly allows for later message quoting when
    eg. a new message is composed.
-*/
+ */
 static GString *
-quote_body(BalsaSendmsg * bsmsg, LibBalsaMessageHeaders *headers,
-           const gchar *message_id, GList *references,
-           LibBalsaMessageBody *root, QuoteType qtype)
+quote_body(BalsaSendmsg           *bsmsg,
+           LibBalsaMessageHeaders *headers,
+           const gchar            *message_id,
+           GList                  *references,
+           LibBalsaMessageBody    *root,
+           QuoteType               qtype)
 {
     GString *body;
     gchar *str, *date = NULL;
@@ -3473,98 +3721,101 @@ quote_body(BalsaSendmsg * bsmsg, LibBalsaMessageHeaders *headers,
     g_return_val_if_fail(headers, NULL);
 
     if (headers->from &&
-       (orig_address =
-        libbalsa_address_get_name_from_list(headers->from))) {
+        (orig_address =
+             libbalsa_address_get_name_from_list(headers->from))) {
         personStr = g_strdup(orig_address);
         libbalsa_utf8_sanitize(&personStr,
                                balsa_app.convert_unknown_8bit,
                                NULL);
-    } else
+    } else {
         personStr = g_strdup(_("you"));
+    }
 
     if (headers->date)
         date = libbalsa_message_headers_date_to_utf8(headers,
                                                      balsa_app.date_string);
 
     if (qtype == QUOTE_HEADERS) {
-       gchar *subject;
-
-       str = g_strdup_printf(_("------forwarded message from %s------\n"),
-                             personStr);
-       body = g_string_new(str);
-       g_free(str);
-
-       if (date)
-           g_string_append_printf(body, "%s %s\n", _("Date:"), date);
-
-       subject = message_part_get_subject(root);
-       if (subject)
-           g_string_append_printf(body, "%s %s\n", _("Subject:"), subject);
-       g_free(subject);
-
-       if (headers->from) {
-           gchar *from =
-               internet_address_list_to_string(headers->from,
-                                               FALSE);
-           g_string_append_printf(body, "%s %s\n", _("From:"), from);
-           g_free(from);
-       }
-
-       if (internet_address_list_length(headers->to_list) > 0) {
-           gchar *to_list =
-               internet_address_list_to_string(headers->to_list,
-                                               FALSE);
-           g_string_append_printf(body, "%s %s\n", _("To:"), to_list);
-           g_free(to_list);
-       }
-
-       if (internet_address_list_length(headers->cc_list) > 0) {
-           gchar *cc_list =
-               internet_address_list_to_string(headers->cc_list,
-                                               FALSE);
-           g_string_append_printf(body, "%s %s\n", _("CC:"), cc_list);
-           g_free(cc_list);
-       }
-
-       g_string_append_printf(body, _("Message-ID: %s\n"),
+        gchar *subject;
+
+        str = g_strdup_printf(_("------forwarded message from %s------\n"),
+                              personStr);
+        body = g_string_new(str);
+        g_free(str);
+
+        if (date)
+            g_string_append_printf(body, "%s %s\n", _("Date:"), date);
+
+        subject = message_part_get_subject(root);
+        if (subject)
+            g_string_append_printf(body, "%s %s\n", _("Subject:"), subject);
+        g_free(subject);
+
+        if (headers->from) {
+            gchar *from =
+                internet_address_list_to_string(headers->from,
+                                                FALSE);
+            g_string_append_printf(body, "%s %s\n", _("From:"), from);
+            g_free(from);
+        }
+
+        if (internet_address_list_length(headers->to_list) > 0) {
+            gchar *to_list =
+                internet_address_list_to_string(headers->to_list,
+                                                FALSE);
+            g_string_append_printf(body, "%s %s\n", _("To:"), to_list);
+            g_free(to_list);
+        }
+
+        if (internet_address_list_length(headers->cc_list) > 0) {
+            gchar *cc_list =
+                internet_address_list_to_string(headers->cc_list,
+                                                FALSE);
+            g_string_append_printf(body, "%s %s\n", _("CC:"), cc_list);
+            g_free(cc_list);
+        }
+
+        g_string_append_printf(body, _("Message-ID: %s\n"),
                                message_id);
 
-       if (references) {
-           GList *ref_list;
+        if (references) {
+            GList *ref_list;
 
-           g_string_append(body, _("References:"));
+            g_string_append(body, _("References:"));
 
-           for (ref_list = references; ref_list != NULL;
-                 ref_list = ref_list->next)
-               g_string_append_printf(body, " <%s>",
-                                      (gchar *) ref_list->data);
+            for (ref_list = references; ref_list != NULL;
+                 ref_list = ref_list->next) {
+                g_string_append_printf(body, " <%s>",
+                                       (gchar *) ref_list->data);
+            }
 
-           g_string_append_c(body, '\n');
-       }
+            g_string_append_c(body, '\n');
+        }
     } else {
-       if (date)
-           str = g_strdup_printf(_("On %s, %s wrote:\n"), date, personStr);
-       else
-           str = g_strdup_printf(_("%s wrote:\n"), personStr);
-
-       /* scan the message and collect text parts which might be included
-        * in the reply */
-       body = collect_for_quote(bsmsg, root,
-                                qtype == QUOTE_ALL ? balsa_app.quote_str : NULL,
-                                bsmsg->flow ? -1 : balsa_app.wraplength,
-                                balsa_app.reply_strip_html, bsmsg->flow);
-       if (body) {
-           gchar *buf;
-
-           buf = g_string_free(body, FALSE);
-           libbalsa_utf8_sanitize(&buf, balsa_app.convert_unknown_8bit,
-                                  NULL);
-           body = g_string_new(buf);
-           g_free(buf);
-           g_string_prepend(body, str);
-       } else
-           body = g_string_new(str);
-       g_free(str);
+        if (date)
+            str = g_strdup_printf(_("On %s, %s wrote:\n"), date, personStr);
+        else
+            str = g_strdup_printf(_("%s wrote:\n"), personStr);
+
+        /* scan the message and collect text parts which might be included
+         * in the reply */
+        body = collect_for_quote(bsmsg, root,
+                                 qtype == QUOTE_ALL ? balsa_app.quote_str : NULL,
+                                 bsmsg->flow ? -1 : balsa_app.wraplength,
+                                 balsa_app.reply_strip_html, bsmsg->flow);
+        if (body) {
+            gchar *buf;
+
+            buf = g_string_free(body, FALSE);
+            libbalsa_utf8_sanitize(&buf, balsa_app.convert_unknown_8bit,
+                                   NULL);
+            body = g_string_new(buf);
+            g_free(buf);
+            g_string_prepend(body, str);
+        } else {
+            body = g_string_new(str);
+        }
+        g_free(str);
     }
 
     g_free(date);
@@ -3573,16 +3824,20 @@ quote_body(BalsaSendmsg * bsmsg, LibBalsaMessageHeaders *headers,
     return body;
 }
 
+
 /* fill_body -------------------------------------------------------------
    fills the body of the message to be composed based on the given message.
    First quotes the original one, if autoquote is set,
    and then adds the signature.
    Optionally prepends the signature to quoted text.
-*/
+ */
 static void
-fill_body_from_part(BalsaSendmsg * bsmsg, LibBalsaMessageHeaders *headers,
-                    const gchar *message_id, GList *references,
-                    LibBalsaMessageBody *root, QuoteType qtype)
+fill_body_from_part(BalsaSendmsg           *bsmsg,
+                    LibBalsaMessageHeaders *headers,
+                    const gchar            *message_id,
+                    GList                  *references,
+                    LibBalsaMessageBody    *root,
+                    QuoteType               qtype)
 {
     GString *body;
     GtkTextBuffer *buffer =
@@ -3596,11 +3851,11 @@ fill_body_from_part(BalsaSendmsg * bsmsg, LibBalsaMessageHeaders *headers,
 
     g_return_if_fail(body != NULL);
 
-    if(body->len && body->str[body->len] != '\n')
+    if (body->len && (body->str[body->len] != '\n'))
         g_string_append_c(body, '\n');
     gtk_text_buffer_insert_at_cursor(buffer, body->str, body->len);
 
-    if(qtype == QUOTE_HEADERS)
+    if (qtype == QUOTE_HEADERS)
         gtk_text_buffer_get_end_iter(buffer, &start);
     else
         gtk_text_buffer_get_start_iter(buffer, &start);
@@ -3609,13 +3864,14 @@ fill_body_from_part(BalsaSendmsg * bsmsg, LibBalsaMessageHeaders *headers,
     g_string_free(body, TRUE);
 }
 
-static GString*
-quote_message_body(BalsaSendmsg * bsmsg,
-                   LibBalsaMessage * message,
-                   QuoteType qtype)
+
+static GString *
+quote_message_body(BalsaSendmsg    *bsmsg,
+                   LibBalsaMessage *message,
+                   QuoteType        qtype)
 {
     GString *res;
-    if(libbalsa_message_body_ref(message, FALSE, FALSE)) {
+    if (libbalsa_message_body_ref(message, FALSE, FALSE)) {
         res = quote_body(bsmsg,
                          libbalsa_message_get_headers(message),
                          libbalsa_message_get_message_id(message),
@@ -3623,13 +3879,17 @@ quote_message_body(BalsaSendmsg * bsmsg,
                          libbalsa_message_get_body_list(message),
                          qtype);
         libbalsa_message_body_unref(message);
-    } else res = g_string_new("");
+    } else {
+        res = g_string_new("");
+    }
     return res;
 }
 
+
 static void
-fill_body_from_message(BalsaSendmsg *bsmsg, LibBalsaMessage *message,
-                       QuoteType qtype)
+fill_body_from_message(BalsaSendmsg    *bsmsg,
+                       LibBalsaMessage *message,
+                       QuoteType        qtype)
 {
     fill_body_from_part(bsmsg,
                         libbalsa_message_get_headers(message),
@@ -3641,9 +3901,9 @@ fill_body_from_message(BalsaSendmsg *bsmsg, LibBalsaMessage *message,
 
 
 static void
-sw_insert_sig_activated(GSimpleAction * action,
-                        GVariant      * parameter,
-                        gpointer        data)
+sw_insert_sig_activated(GSimpleAction *action,
+                        GVariant      *parameter,
+                        gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
     gchar *signature;
@@ -3661,7 +3921,7 @@ sw_insert_sig_activated(GSimpleAction * action,
         gtk_text_buffer_insert_at_cursor(buffer, signature, -1);
         sw_buffer_signals_unblock(bsmsg, buffer);
 
-       g_free(signature);
+        g_free(signature);
     } else if (error != NULL) {
         balsa_information_parented(GTK_WINDOW(bsmsg->window),
                                    LIBBALSA_INFORMATION_ERROR,
@@ -3672,9 +3932,9 @@ sw_insert_sig_activated(GSimpleAction * action,
 
 
 static void
-sw_quote_activated(GSimpleAction * action,
-                   GVariant      * parameter,
-                   gpointer        data)
+sw_quote_activated(GSimpleAction *action,
+                   GVariant      *parameter,
+                   gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -3685,8 +3945,8 @@ sw_quote_activated(GSimpleAction * action,
 /** Generates a new subject for forwarded messages based on a message
     being responded to and identity.
  */
-static char*
-generate_forwarded_subject(const char *orig_subject,
+static char *
+generate_forwarded_subject(const char             *orig_subject,
                            LibBalsaMessageHeaders *headers,
                            LibBalsaIdentity       *ident)
 {
@@ -3694,13 +3954,14 @@ generate_forwarded_subject(const char *orig_subject,
     const gchar *forward_string = libbalsa_identity_get_forward_string(ident);
 
     if (!orig_subject) {
-        if (headers && headers->from)
+        if (headers && headers->from) {
             newsubject = g_strdup_printf("%s from %s",
                                          forward_string,
                                          libbalsa_address_get_mailbox_from_list
-                                         (headers->from));
-        else
+                                             (headers->from));
+        } else {
             newsubject = g_strdup(forward_string);
+        }
     } else {
         const char *tmp = orig_subject;
         if (g_ascii_strncasecmp(tmp, "fwd:", 4) == 0) {
@@ -3710,19 +3971,20 @@ generate_forwarded_subject(const char *orig_subject,
             tmp += strlen(_("Fwd:"));
         } else {
             size_t i = strlen(forward_string);
-            if (g_ascii_strncasecmp(tmp, forward_string, i) == 0) {
+            if (g_ascii_strncasecmp(tmp, forward_string, i) == 0)
                 tmp += i;
-            }
         }
-        while( *tmp && isspace((int)*tmp) ) tmp++;
-        if (headers && headers->from)
+        while ( *tmp && isspace((int)*tmp)) {
+            tmp++;
+        }
+        if (headers && headers->from) {
             newsubject =
                 g_strdup_printf("%s %s [%s]",
                                 forward_string,
                                 tmp,
                                 libbalsa_address_get_mailbox_from_list
-                                (headers->from));
-        else {
+                                    (headers->from));
+        } else {
             newsubject =
                 g_strdup_printf("%s %s",
                                 forward_string,
@@ -3732,20 +3994,23 @@ generate_forwarded_subject(const char *orig_subject,
     }
     return newsubject;
 }
+
+
 /* bsmsg_set_subject_from_body:
    set subject entry based on given replied/forwarded/continued message
    and the compose type.
-*/
+ */
 static void
-bsmsg_set_subject_from_body(BalsaSendmsg * bsmsg,
-                            LibBalsaMessageBody * part,
-                            LibBalsaIdentity * ident)
+bsmsg_set_subject_from_body(BalsaSendmsg        *bsmsg,
+                            LibBalsaMessageBody *part,
+                            LibBalsaIdentity    *ident)
 {
     const gchar *reply_string = libbalsa_identity_get_reply_string(ident);
     gchar *subject;
 
     if (!part)
         return;
+
     subject = message_part_get_subject(part);
 
     if (!bsmsg->is_continue) {
@@ -3763,19 +4028,20 @@ bsmsg_set_subject_from_body(BalsaSendmsg * bsmsg,
             }
 
             tmp = subject;
-            if (g_ascii_strncasecmp(tmp, "re:", 3) == 0 ||
-                g_ascii_strncasecmp(tmp, "aw:", 3) == 0)
+            if ((g_ascii_strncasecmp(tmp, "re:", 3) == 0) ||
+                (g_ascii_strncasecmp(tmp, "aw:", 3) == 0)) {
                 tmp += 3;
-            else if (g_ascii_strncasecmp(tmp, _("Re:"), strlen(_("Re:")))
-                       == 0)
+            } else if (g_ascii_strncasecmp(tmp, _("Re:"), strlen(_("Re:")))
+                       == 0) {
                 tmp += strlen(_("Re:"));
-            else {
+            } else {
                 gint len = strlen(reply_string);
                 if (g_ascii_strncasecmp(tmp, reply_string, len) == 0)
                     tmp += len;
             }
-            while (*tmp && isspace((int) *tmp))
+            while (*tmp && isspace((int) *tmp)) {
                 tmp++;
+            }
             newsubject = g_strdup_printf("%s %s", reply_string, tmp);
             g_strchomp(newsubject);
             g_strdelimit(newsubject, "\r\n", ' ');
@@ -3784,11 +4050,12 @@ bsmsg_set_subject_from_body(BalsaSendmsg * bsmsg,
         case SEND_FORWARD_ATTACH:
         case SEND_FORWARD_INLINE:
             headers =
-                part->embhdrs != NULL? part->embhdrs :
+                part->embhdrs != NULL ? part->embhdrs :
                 libbalsa_message_get_headers(part->message);
             newsubject =
                 generate_forwarded_subject(subject, headers, ident);
             break;
+
         default:
             break;
         }
@@ -3803,25 +4070,26 @@ bsmsg_set_subject_from_body(BalsaSendmsg * bsmsg,
     g_free(subject);
 }
 
+
 static gboolean
-sw_save_draft(BalsaSendmsg * bsmsg)
+sw_save_draft(BalsaSendmsg *bsmsg)
 {
     GError *err = NULL;
 
     if (!message_postpone(bsmsg)) {
-       balsa_information_parented(GTK_WINDOW(bsmsg->window),
-                                  LIBBALSA_INFORMATION_MESSAGE,
+        balsa_information_parented(GTK_WINDOW(bsmsg->window),
+                                   LIBBALSA_INFORMATION_MESSAGE,
                                    _("Could not save message."));
         return FALSE;
     }
 
-    if(!libbalsa_mailbox_open(balsa_app.draftbox, &err)) {
-       balsa_information_parented(GTK_WINDOW(bsmsg->window),
-                                  LIBBALSA_INFORMATION_WARNING,
-                                  _("Could not open draftbox: %s"),
-                                  err ? err->message : _("Unknown error"));
-       g_clear_error(&err);
-       return FALSE;
+    if (!libbalsa_mailbox_open(balsa_app.draftbox, &err)) {
+        balsa_information_parented(GTK_WINDOW(bsmsg->window),
+                                   LIBBALSA_INFORMATION_WARNING,
+                                   _("Could not open draftbox: %s"),
+                                   err ? err->message : _("Unknown error"));
+        g_clear_error(&err);
+        return FALSE;
     }
 
     if (bsmsg->draft_message != NULL) {
@@ -3830,19 +4098,19 @@ sw_save_draft(BalsaSendmsg * bsmsg)
         g_object_set_data(G_OBJECT(bsmsg->draft_message),
                           BALSA_SENDMSG_WINDOW_KEY, NULL);
         mailbox = libbalsa_message_get_mailbox(bsmsg->draft_message);
-       if (mailbox != NULL) {
-           libbalsa_mailbox_close(mailbox,
-                   /* Respect pref setting: */
-                                  balsa_app.expunge_on_close);
+        if (mailbox != NULL) {
+            libbalsa_mailbox_close(mailbox,
+                                   /* Respect pref setting: */
+                                   balsa_app.expunge_on_close);
         }
-       g_object_unref(bsmsg->draft_message);
+        g_object_unref(bsmsg->draft_message);
     }
     bsmsg->state = SENDMSG_STATE_CLEAN;
 
     bsmsg->draft_message =
-       libbalsa_mailbox_get_message(balsa_app.draftbox,
-                                    libbalsa_mailbox_total_messages
-                                    (balsa_app.draftbox));
+        libbalsa_mailbox_get_message(balsa_app.draftbox,
+                                     libbalsa_mailbox_total_messages
+                                         (balsa_app.draftbox));
     g_object_set_data(G_OBJECT(bsmsg->draft_message),
                       BALSA_SENDMSG_WINDOW_KEY, bsmsg);
     balsa_information_parented(GTK_WINDOW(bsmsg->window),
@@ -3852,8 +4120,9 @@ sw_save_draft(BalsaSendmsg * bsmsg)
     return TRUE;
 }
 
+
 static gboolean
-sw_autosave_timeout_cb(BalsaSendmsg * bsmsg)
+sw_autosave_timeout_cb(BalsaSendmsg *bsmsg)
 {
     if (bsmsg->state == SENDMSG_STATE_MODIFIED) {
         if (sw_save_draft(bsmsg))
@@ -3863,13 +4132,15 @@ sw_autosave_timeout_cb(BalsaSendmsg * bsmsg)
     return TRUE;                /* do repeat it */
 }
 
+
 static void
-setup_headers_from_message(BalsaSendmsg* bsmsg, LibBalsaMessage *message)
+setup_headers_from_message(BalsaSendmsg    *bsmsg,
+                           LibBalsaMessage *message)
 {
     LibBalsaMessageHeaders *headers;
 
     headers = libbalsa_message_get_headers(message);
-    g_return_if_fail(headers!= NULL);
+    g_return_if_fail(headers != NULL);
 
     /* Try to make the blank line in the address view useful;
      * - never make it a Bcc: line;
@@ -3896,9 +4167,10 @@ setup_headers_from_message(BalsaSendmsg* bsmsg, LibBalsaMessage *message)
  * the message.
  **/
 static gboolean
-set_identity_from_mailbox(BalsaSendmsg * bsmsg, LibBalsaMessage * message)
+set_identity_from_mailbox(BalsaSendmsg    *bsmsg,
+                          LibBalsaMessage *message)
 {
-    if (message != NULL && balsa_app.identities != NULL) {
+    if ((message != NULL) && (balsa_app.identities != NULL)) {
         LibBalsaMailbox *mailbox;
 
         mailbox = libbalsa_message_get_mailbox(message);
@@ -3925,6 +4197,7 @@ set_identity_from_mailbox(BalsaSendmsg * bsmsg, LibBalsaMessage * message)
     return FALSE;               /* use default */
 }
 
+
 /*
  * guess_identity
  *
@@ -3936,8 +4209,9 @@ set_identity_from_mailbox(BalsaSendmsg * bsmsg, LibBalsaMessage * message)
  * From: list. */
 /* Update: RFC 6854 allows groups in "From:" and "Sender:" */
 static gboolean
-guess_identity_from_list(BalsaSendmsg * bsmsg, InternetAddressList * list,
-                         gboolean allow_group)
+guess_identity_from_list(BalsaSendmsg        *bsmsg,
+                         InternetAddressList *list,
+                         gboolean             allow_group)
 {
     gint i;
 
@@ -3971,12 +4245,14 @@ guess_identity_from_list(BalsaSendmsg * bsmsg, InternetAddressList * list,
     return FALSE;
 }
 
+
 static gboolean
-guess_identity(BalsaSendmsg* bsmsg, LibBalsaMessage * message)
+guess_identity(BalsaSendmsg    *bsmsg,
+               LibBalsaMessage *message)
 {
     LibBalsaMessageHeaders *headers;
 
-    if (message == NULL || balsa_app.identities == NULL)
+    if ((message == NULL) || (balsa_app.identities == NULL))
         return FALSE; /* use default */
 
     headers = libbalsa_message_get_headers(message);
@@ -3986,18 +4262,21 @@ guess_identity(BalsaSendmsg* bsmsg, LibBalsaMessage * message)
     if (bsmsg->is_continue)
         return guess_identity_from_list(bsmsg, headers->from, FALSE);
 
-    if (bsmsg->type != SEND_NORMAL)
-       /* bsmsg->type == SEND_REPLY || bsmsg->type == SEND_REPLY_ALL ||
-       *  bsmsg->type == SEND_REPLY_GROUP || bsmsg->type == SEND_FORWARD_ATTACH ||
-       *  bsmsg->type == SEND_FORWARD_INLINE */
+    if (bsmsg->type != SEND_NORMAL) {
+        /* bsmsg->type == SEND_REPLY || bsmsg->type == SEND_REPLY_ALL ||
+         *  bsmsg->type == SEND_REPLY_GROUP || bsmsg->type == SEND_FORWARD_ATTACH ||
+         *  bsmsg->type == SEND_FORWARD_INLINE */
         return guess_identity_from_list(bsmsg, headers->to_list, TRUE)
-            || guess_identity_from_list(bsmsg, headers->cc_list, TRUE);
+               || guess_identity_from_list(bsmsg, headers->cc_list, TRUE);
+    }
 
     return FALSE;
 }
 
+
 static void
-setup_headers_from_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity *ident)
+setup_headers_from_identity(BalsaSendmsg     *bsmsg,
+                            LibBalsaIdentity *ident)
 {
     gtk_combo_box_set_active(GTK_COMBO_BOX(bsmsg->from[1]),
                              g_list_index(balsa_app.identities, ident));
@@ -4007,13 +4286,16 @@ setup_headers_from_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity *ident)
                                           "To:", NULL);
 }
 
+
 static int
-comp_send_locales(const void* a, const void* b)
+comp_send_locales(const void *a,
+                  const void *b)
 {
-    return g_utf8_collate(((struct SendLocales*)a)->lang_name,
-                          ((struct SendLocales*)b)->lang_name);
+    return g_utf8_collate(((struct SendLocales *)a)->lang_name,
+                          ((struct SendLocales *)b)->lang_name);
 }
 
+
 /* create_lang_menu:
    create language menu for the compose window. The order cannot be
    hardcoded because it depends on the current locale.
@@ -4022,30 +4304,33 @@ comp_send_locales(const void* a, const void* b)
    and the menu was created;
    returns NULL if no dictionaries were found,
    in which case spell-checking must be disabled.
-*/
+ */
 #define BALSA_LANGUAGE_MENU_LANG "balsa-language-menu-lang"
 #if !HAVE_GSPELL && !HAVE_GTKSPELL_3_0_3
 static void
-sw_broker_cb(const gchar * lang_tag,
-             const gchar * provider_name,
-             const gchar * provider_desc,
-             const gchar * provider_file,
-             gpointer      data)
+sw_broker_cb(const gchar *lang_tag,
+             const gchar *provider_name,
+             const gchar *provider_desc,
+             const gchar *provider_file,
+             gpointer     data)
 {
     GList **lang_list = data;
 
     *lang_list = g_list_insert_sorted(*lang_list, g_strdup(lang_tag),
                                       (GCompareFunc) strcmp);
 }
+
+
 #endif                          /* HAVE_GTKSPELL_3_0_3 */
 
 static const gchar *
-create_lang_menu(GtkWidget * parent, BalsaSendmsg * bsmsg)
+create_lang_menu(GtkWidget    *parent,
+                 BalsaSendmsg *bsmsg)
 {
     guint i;
     GtkWidget *langs;
     static gboolean locales_sorted = FALSE;
-    GSList *group = NULL;
+    GSList *group                  = NULL;
 #if HAVE_GSPELL
     const GList *lang_list, *l;
 #else
@@ -4062,19 +4347,20 @@ create_lang_menu(GtkWidget * parent, BalsaSendmsg * bsmsg)
 #elif HAVE_GSPELL
     lang_list = gspell_language_get_available();
 #else                           /* HAVE_GTKSPELL_3_0_3 */
-    broker = enchant_broker_init();
+    broker    = enchant_broker_init();
     lang_list = NULL;
     enchant_broker_list_dicts(broker, sw_broker_cb, &lang_list);
     enchant_broker_free(broker);
 #endif                          /* HAVE_GTKSPELL_3_0_3 */
 
-    if (lang_list == NULL) {
+    if (lang_list == NULL)
         return NULL;
-    }
+
 
     if (!locales_sorted) {
-        for (i = 0; i < G_N_ELEMENTS(locales); i++)
+        for (i = 0; i < G_N_ELEMENTS(locales); i++) {
             locales[i].lang_name = _(locales[i].lang_name);
+        }
         qsort(locales, G_N_ELEMENTS(locales), sizeof(struct SendLocales),
               comp_send_locales);
         locales_sorted = TRUE;
@@ -4088,7 +4374,7 @@ create_lang_menu(GtkWidget * parent, BalsaSendmsg * bsmsg)
     for (i = 0; i < G_N_ELEMENTS(locales); i++) {
         gconstpointer found;
 
-        if (locales[i].locale == NULL || locales[i].locale[0] == '\0')
+        if ((locales[i].locale == NULL) || (locales[i].locale[0] == '\0'))
             /* GtkSpell handles NULL lang, but complains about empty
              * lang; in either case, it does not go in the langs menu. */
             continue;
@@ -4112,7 +4398,7 @@ create_lang_menu(GtkWidget * parent, BalsaSendmsg * bsmsg)
                                    g_strdup(locales[i].locale), g_free);
             gtk_menu_shell_append(GTK_MENU_SHELL(langs), w);
 
-            if (!active_item || strcmp(preferred_lang, locales[i].locale) == 0)
+            if (!active_item || (strcmp(preferred_lang, locales[i].locale) == 0))
                 active_item = w;
         }
     }
@@ -4122,17 +4408,17 @@ create_lang_menu(GtkWidget * parent, BalsaSendmsg * bsmsg)
     for (l = lang_list; l; l = l->next) {
 #if HAVE_GSPELL
         const GspellLanguage *language = l->data;
-        const gchar *lang = gspell_language_get_code(language);
+        const gchar *lang              = gspell_language_get_code(language);
 #else                           /* HAVE_GSPELL */
         const gchar *lang = l->data;
 #endif                          /* HAVE_GSPELL */
         gint j;
 
         j = find_locale_index_by_locale(lang);
-        if (j < 0 || strcmp(lang, locales[j].locale) != 0) {
+        if ((j < 0) || (strcmp(lang, locales[j].locale) != 0)) {
             GtkWidget *w;
 
-            w = gtk_radio_menu_item_new_with_label(group, lang);
+            w     = gtk_radio_menu_item_new_with_label(group, lang);
             group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(w));
             g_signal_connect(G_OBJECT(w), "activate",
                              G_CALLBACK(lang_set_cb), bsmsg);
@@ -4140,7 +4426,7 @@ create_lang_menu(GtkWidget * parent, BalsaSendmsg * bsmsg)
                                    g_strdup(lang), g_free);
             gtk_menu_shell_append(GTK_MENU_SHELL(langs), w);
 
-            if (!active_item || strcmp(preferred_lang, lang) == 0)
+            if (!active_item || (strcmp(preferred_lang, lang) == 0))
                 active_item = w;
         }
     }
@@ -4156,36 +4442,41 @@ create_lang_menu(GtkWidget * parent, BalsaSendmsg * bsmsg)
     return g_object_get_data(G_OBJECT(active_item), BALSA_LANGUAGE_MENU_LANG);
 }
 
+
 /* Standard buttons; "" means a separator. */
 static const BalsaToolbarEntry compose_toolbar[] = {
-    { "toolbar-send", BALSA_PIXMAP_SEND       },
-    { "", ""                                  },
-    { "attach-file",  BALSA_PIXMAP_ATTACHMENT },
-    { "", ""                                  },
-    { "save",        "document-save"          },
-    { "", ""                                  },
-    { "undo",        "edit-undo"              },
-    { "redo",        "edit-redo"              },
-    { "", ""                                  },
-    { "select-ident", BALSA_PIXMAP_IDENTITY   },
-    { "", ""                                  },
-    { "spell-check", "tools-check-spelling"   },
-    { "", ""                                  },
-    {"print",        "document-print"         },
-    { "", ""                                  },
-    {"close",        "window-close-symbolic"  }
+    { "toolbar-send",
+      BALSA_PIXMAP_SEND                                                                                      
     },
+    { "",
+      ""                                                                                                     
                  },
+    { "attach-file",
+      BALSA_PIXMAP_ATTACHMENT                                                                                
                                                                                },
+    { "",
+      ""                                                                                                     
                                                                                            },
+    { "save",        "document-save"                                                                         
                                                                                                              
         },
+    { "",            ""                                                                                      
                                                                                                              
         },
+    { "undo",        "edit-undo"                                                                             
                                                                                                              
         },
+    { "redo",        "edit-redo"                                                                             
                                                                                                              
         },
+    { "",            ""                                                                                      
                                                                                                              
         },
+    { "select-ident",BALSA_PIXMAP_IDENTITY                                                                   
                                                                                                              
         },
+    { "",            ""                                                                                      
                                                                                                              
         },
+    { "spell-check", "tools-check-spelling"                                                                  
                                                                                                              
         },
+    { "",            ""                                                                                      
                                                                                                              
         },
+    {"print",        "document-print"                                                                        
                                                                                                              
         },
+    { "",            ""                                                                                      
                                                                                                              
         },
+    {"close",        "window-close-symbolic"                                                                 
                                                                                                              
         }
 };
 
 /* Optional extra buttons */
 static const BalsaToolbarEntry compose_toolbar_extras[] = {
-    { "postpone",    BALSA_PIXMAP_POSTPONE    },
-    { "request-mdn", BALSA_PIXMAP_REQUEST_MDN },
+    { "postpone",    BALSA_PIXMAP_POSTPONE                                                                   
                                           },
+    { "request-mdn", BALSA_PIXMAP_REQUEST_MDN                                                                
                                           },
 #ifdef HAVE_GPGME
-    { "sign",        BALSA_PIXMAP_GPG_SIGN    },
-    { "encrypt",     BALSA_PIXMAP_GPG_ENCRYPT },
+    { "sign",        BALSA_PIXMAP_GPG_SIGN                                                                   
                                           },
+    { "encrypt",     BALSA_PIXMAP_GPG_ENCRYPT                                                                
                                           },
 #endif /* HAVE_GPGME */
-    { "edit",        "gtk-edit"               },
-       { "queue",               BALSA_PIXMAP_QUEUE               }
+    { "edit",        "gtk-edit"                                                                              
                                           },
+    { "queue",       BALSA_PIXMAP_QUEUE                                                                      
                                           }
 };
 
 /* Create the toolbar model for the compose window's toolbar.
@@ -4208,15 +4499,18 @@ sendmsg_window_get_toolbar_model(void)
     return model;
 }
 
+
 static void
-bsmsg_identities_changed_cb(BalsaSendmsg * bsmsg)
+bsmsg_identities_changed_cb(BalsaSendmsg *bsmsg)
 {
     sw_action_set_enabled(bsmsg, "SelectIdentity",
-                     balsa_app.identities->next != NULL);
+                          balsa_app.identities->next != NULL);
 }
 
+
 static void
-sw_cc_add_list(InternetAddressList **new_cc, InternetAddressList * list)
+sw_cc_add_list(InternetAddressList **new_cc,
+               InternetAddressList  *list)
 {
     int i;
 
@@ -4225,22 +4519,23 @@ sw_cc_add_list(InternetAddressList **new_cc, InternetAddressList * list)
 
     for (i = 0; i < internet_address_list_length(list); i++) {
         InternetAddress *ia = internet_address_list_get_address (list, i);
-       GList *ilist;
+        GList *ilist;
 
-       /* do not insert any of my identities into the cc: list */
-       for (ilist = balsa_app.identities; ilist != NULL; ilist = ilist->next) {
-           if (libbalsa_ia_rfc2821_equal
-               (ia, libbalsa_identity_get_address(ilist->data)))
-               break;
+        /* do not insert any of my identities into the cc: list */
+        for (ilist = balsa_app.identities; ilist != NULL; ilist = ilist->next) {
+            if (libbalsa_ia_rfc2821_equal
+                    (ia, libbalsa_identity_get_address(ilist->data)))
+                break;
         }
-       if (ilist == NULL) {
+        if (ilist == NULL) {
             if (*new_cc == NULL)
                 *new_cc = internet_address_list_new();
-           internet_address_list_add(*new_cc, ia);
+            internet_address_list_add(*new_cc, ia);
         }
     }
 }
 
+
 static void
 insert_initial_sig(BalsaSendmsg *bsmsg)
 {
@@ -4248,7 +4543,7 @@ insert_initial_sig(BalsaSendmsg *bsmsg)
     GtkTextBuffer *buffer =
         gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
 
-    if(libbalsa_identity_get_sig_prepend(bsmsg->ident))
+    if (libbalsa_identity_get_sig_prepend(bsmsg->ident))
         gtk_text_buffer_get_start_iter(buffer, &sig_pos);
     else
         gtk_text_buffer_get_end_iter(buffer, &sig_pos);
@@ -4258,6 +4553,7 @@ insert_initial_sig(BalsaSendmsg *bsmsg)
     gtk_text_buffer_place_cursor(buffer, &sig_pos);
 }
 
+
 static void
 bsm_prepare_for_setup(LibBalsaMessage *message)
 {
@@ -4277,10 +4573,12 @@ bsm_prepare_for_setup(LibBalsaMessage *message)
 #endif
 }
 
+
 /* libbalsa_message_body_unref() may destroy the @param part - this is
    why body_unref() is done at the end. */
 static void
-bsm_finish_setup(BalsaSendmsg *bsmsg, LibBalsaMessageBody *part)
+bsm_finish_setup(BalsaSendmsg        *bsmsg,
+                 LibBalsaMessageBody *part)
 {
     g_return_if_fail(part != NULL);
     g_return_if_fail(part->message != NULL);
@@ -4299,8 +4597,9 @@ bsm_finish_setup(BalsaSendmsg *bsmsg, LibBalsaMessageBody *part)
     libbalsa_message_body_unref(part->message);
 }
 
+
 static void
-set_cc_from_all_recipients(BalsaSendmsg* bsmsg,
+set_cc_from_all_recipients(BalsaSendmsg           *bsmsg,
                            LibBalsaMessageHeaders *headers)
 {
     InternetAddressList *new_cc = NULL;
@@ -4315,14 +4614,16 @@ set_cc_from_all_recipients(BalsaSendmsg* bsmsg,
         g_object_unref(new_cc);
 }
 
+
 static void
-set_in_reply_to(BalsaSendmsg *bsmsg, const gchar *message_id,
+set_in_reply_to(BalsaSendmsg           *bsmsg,
+                const gchar            *message_id,
                 LibBalsaMessageHeaders *headers)
 {
     gchar *tmp;
 
     g_assert(message_id);
-    if(message_id[0] == '<')
+    if (message_id[0] == '<')
         tmp = g_strdup(message_id);
     else
         tmp = g_strconcat("<", message_id, ">", NULL);
@@ -4331,19 +4632,22 @@ set_in_reply_to(BalsaSendmsg *bsmsg, const gchar *message_id,
 
         ctime_r(&headers->date, recvtime);
         if (recvtime[0]) /* safety check; remove trailing '\n' */
-            recvtime[strlen(recvtime)-1] = '\0';
+            recvtime[strlen(recvtime) - 1] = '\0';
         bsmsg->in_reply_to =
             g_strconcat(tmp, " (from ",
                         libbalsa_address_get_mailbox_from_list
-                        (headers->from),
+                            (headers->from),
                         " on ", recvtime, ")", NULL);
         g_free(tmp);
-    } else
+    } else {
         bsmsg->in_reply_to = tmp;
+    }
 }
 
+
 static void
-set_to(BalsaSendmsg *bsmsg, LibBalsaMessageHeaders *headers)
+set_to(BalsaSendmsg           *bsmsg,
+       LibBalsaMessageHeaders *headers)
 {
     if (bsmsg->type == SEND_REPLY_GROUP) {
         set_list_post_address(bsmsg);
@@ -4356,22 +4660,26 @@ set_to(BalsaSendmsg *bsmsg, LibBalsaMessageHeaders *headers)
     }
 }
 
+
 static void
-set_references_reply(BalsaSendmsg *bsmsg, GList *references,
-                     const gchar *in_reply_to, const gchar *message_id)
+set_references_reply(BalsaSendmsg *bsmsg,
+                     GList        *references,
+                     const gchar  *in_reply_to,
+                     const gchar  *message_id)
 {
     GList *refs = NULL, *list;
 
-    for (list = references; list; list = list->next)
+    for (list = references; list; list = list->next) {
         refs = g_list_prepend(refs, g_strdup(list->data));
+    }
 
     /* We're replying to parent_message, so construct the
      * references according to RFC 2822. */
     if (!references
         /* Parent message has no References header... */
         && in_reply_to)
-            /* ...but it has an In-Reply-To header with a single
-             * message identifier. */
+        /* ...but it has an In-Reply-To header with a single
+         * message identifier. */
         refs = g_list_prepend(refs, g_strdup(in_reply_to));
     if (message_id)
         refs = g_list_prepend(refs, g_strdup(message_id));
@@ -4379,92 +4687,106 @@ set_references_reply(BalsaSendmsg *bsmsg, GList *references,
     bsmsg->references = g_list_reverse(refs);
 }
 
+
 static void
-set_identity(BalsaSendmsg * bsmsg, LibBalsaMessage * message)
+set_identity(BalsaSendmsg    *bsmsg,
+             LibBalsaMessage *message)
 {
     /* Set up the default identity */
-    if(!set_identity_from_mailbox(bsmsg, message))
+    if (!set_identity_from_mailbox(bsmsg, message))
         /* Get the identity from the To: field of the original message */
         guess_identity(bsmsg, message);
     /* From: */
     setup_headers_from_identity(bsmsg, bsmsg->ident);
 }
 
+
 static gboolean
-sw_grab_focus_to_text(GtkWidget * text)
+sw_grab_focus_to_text(GtkWidget *text)
 {
     gtk_widget_grab_focus(text);
     g_object_unref(text);
     return FALSE;
 }
 
+
 /* decode_and_strdup:
    decodes given URL string up to the delimiter and places the
    eos pointer in newstr if supplied (eos==NULL if end of string was reached)
-*/
-static gchar*
-decode_and_strdup(const gchar*str, int delim, gchar** newstr)
+ */
+static gchar *
+decode_and_strdup(const gchar *str,
+                  int          delim,
+                  gchar      **newstr)
 {
     gchar num[3];
     GString *s = g_string_new(NULL);
     /* eos points to the character after the last to parse */
     gchar *eos = strchr(str, delim);
 
-    if(!eos) eos = (gchar*)str + strlen(str);
-    while(str<eos) {
-       switch(*str) {
-       case '+':
-           g_string_append_c(s, ' ');
-           str++;
-           break;
-       case '%':
-           if(str+2<eos) {
-               strncpy(num, str+1, 2); num[2] = 0;
-               g_string_append_c(s, strtol(num,NULL,16));
-           }
-           str+=3;
-           break;
-       default:
-           g_string_append_c(s, *str++);
-       }
-    }
-    if(newstr) *newstr = *eos ? eos+1 : NULL;
+    if (!eos) eos = (gchar *)str + strlen(str);
+    while (str < eos) {
+        switch (*str) {
+        case '+':
+            g_string_append_c(s, ' ');
+            str++;
+            break;
+
+        case '%':
+            if (str + 2 < eos) {
+                strncpy(num, str + 1, 2);
+                num[2] = 0;
+                g_string_append_c(s, strtol(num, NULL, 16));
+            }
+            str += 3;
+            break;
+
+        default:
+            g_string_append_c(s, *str++);
+        }
+    }
+    if (newstr) *newstr = *eos ? eos + 1 : NULL;
     eos = s->str;
-    g_string_free(s,FALSE);
+    g_string_free(s, FALSE);
     return eos;
 }
 
+
 /* process_url:
    extracts all characters until NUL or question mark; parse later fields
    of format 'key'='value' with ampersands as separators.
-*/
+ */
 void
-sendmsg_window_process_url(const char *url, field_setter func, void *data)
+sendmsg_window_process_url(const char  *url,
+                           field_setter func,
+                           void        *data)
 {
-    gchar * ptr, *to, *key, *val;
+    gchar *ptr, *to, *key, *val;
 
-    to = decode_and_strdup(url,'?', &ptr);
+    to = decode_and_strdup(url, '?', &ptr);
     func(data, "to", to);
     g_free(to);
-    while(ptr) {
-       key = decode_and_strdup(ptr,'=', &ptr);
-       if(ptr) {
-           val = decode_and_strdup(ptr,'&', &ptr);
-           func(data, key, val);
-           g_free(val);
-       }
-       g_free(key);
+    while (ptr) {
+        key = decode_and_strdup(ptr, '=', &ptr);
+        if (ptr) {
+            val = decode_and_strdup(ptr, '&', &ptr);
+            func(data, key, val);
+            g_free(val);
+        }
+        g_free(key);
     }
 }
 
+
 /* sendmsg_window_set_field:
    sets given field of the compose window to the specified value.
-*/
+ */
 
 #define NO_SECURITY_ISSUES_WITH_ATTACHMENTS TRUE
 #if defined(NO_SECURITY_ISSUES_WITH_ATTACHMENTS)
 static void
-sw_attach_file(BalsaSendmsg * bsmsg, const gchar * val)
+sw_attach_file(BalsaSendmsg *bsmsg,
+               const gchar  *val)
 {
     GtkFileChooser *attach;
 
@@ -4524,11 +4846,14 @@ sw_attach_file(BalsaSendmsg * bsmsg, const gchar * val)
     }
     gtk_file_chooser_select_filename(attach, val);
 }
+
+
 #endif
 
 void
-sendmsg_window_set_field(BalsaSendmsg * bsmsg, const gchar * key,
-                         const gchar * val)
+sendmsg_window_set_field(BalsaSendmsg *bsmsg,
+                         const gchar  *key,
+                         const gchar  *val)
 {
     const gchar *type;
     g_return_if_fail(bsmsg);
@@ -4547,29 +4872,29 @@ sendmsg_window_set_field(BalsaSendmsg * bsmsg, const gchar * key,
         return;
     }
 #endif
-    if(g_ascii_strcasecmp(key, "subject") == 0) {
+    if (g_ascii_strcasecmp(key, "subject") == 0) {
         append_comma_separated(GTK_EDITABLE(bsmsg->subject[1]), val);
         return;
     }
 
-    if (g_ascii_strcasecmp(key, "to") == 0)
+    if (g_ascii_strcasecmp(key, "to") == 0) {
         type = "To:";
-    else if(g_ascii_strcasecmp(key, "cc") == 0)
+    } else if (g_ascii_strcasecmp(key, "cc") == 0) {
         type = "CC:";
-    else if(g_ascii_strcasecmp(key, "bcc") == 0) {
+    } else if (g_ascii_strcasecmp(key, "bcc") == 0) {
         type = "BCC:";
         if (!g_object_get_data(G_OBJECT(bsmsg->window),
                                "balsa-sendmsg-window-url-bcc")) {
             GtkWidget *dialog =
                 gtk_message_dialog_new
-                (GTK_WINDOW(bsmsg->window),
-                 GTK_DIALOG_DESTROY_WITH_PARENT,
-                 GTK_MESSAGE_INFO,
-                 GTK_BUTTONS_OK,
-                 _("The link that you selected created\n"
-                   "a ā€œBlind copyā€ (BCC) address.\n"
-                   "Please check that the address\n"
-                   "is appropriate."));
+                    (GTK_WINDOW(bsmsg->window),
+                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                    GTK_MESSAGE_INFO,
+                    GTK_BUTTONS_OK,
+                    _("The link that you selected created\n"
+                      "a ā€œBlind copyā€ (BCC) address.\n"
+                      "Please check that the address\n"
+                      "is appropriate."));
 #if HAVE_MACOSX_DESKTOP
             libbalsa_macosx_menu_for_parent(dialog, GTK_WINDOW(bsmsg->window));
 #endif
@@ -4579,14 +4904,14 @@ sendmsg_window_set_field(BalsaSendmsg * bsmsg, const gchar * key,
                              G_CALLBACK(gtk_widget_destroy), NULL);
             gtk_widget_show(dialog);
         }
-    }
-    else if(g_ascii_strcasecmp(key, "replyto") == 0) {
+    } else if (g_ascii_strcasecmp(key, "replyto") == 0) {
         libbalsa_address_view_add_from_string(bsmsg->replyto_view,
                                               "Reply To:",
                                               val);
         return;
+    } else {
+        return;
     }
-    else return;
 
     libbalsa_address_view_add_from_string(bsmsg->recipient_view, type, val);
 }
@@ -4596,24 +4921,26 @@ sendmsg_window_set_field(BalsaSendmsg * bsmsg, const gchar * key,
    it at current point */
 
 static void
-do_insert_string_select_ch(BalsaSendmsg* bsmsg, GtkTextBuffer *buffer,
-                           const gchar* string, size_t len,
-                           const gchar* fname)
+do_insert_string_select_ch(BalsaSendmsg  *bsmsg,
+                           GtkTextBuffer *buffer,
+                           const gchar   *string,
+                           size_t         len,
+                           const gchar   *fname)
 {
-    const gchar *charset = NULL;
+    const gchar *charset       = NULL;
     LibBalsaTextAttribute attr = libbalsa_text_attr_string(string);
 
     do {
-       LibBalsaCodeset codeset;
-       LibBalsaCodesetInfo *info;
-       gchar* s;
+        LibBalsaCodeset codeset;
+        LibBalsaCodesetInfo *info;
+        gchar *s;
 
         if ((codeset = sw_get_user_codeset(bsmsg, NULL, NULL, fname))
             == (LibBalsaCodeset) (-1))
             break;
         info = &libbalsa_codeset_info[codeset];
 
-       charset = info->std;
+        charset = info->std;
         if (info->win && (attr & LIBBALSA_TEXT_HI_CTRL))
             charset = info->win;
 
@@ -4623,61 +4950,66 @@ do_insert_string_select_ch(BalsaSendmsg* bsmsg, GtkTextBuffer *buffer,
             g_free(s);
             break;
         }
-    } while(1);
+    } while (1);
 }
 
+
 static void
 insert_file_response(GtkWidget    *selector,
-                                        gint          response,
-                                        BalsaSendmsg *bsmsg)
+                     gint          response,
+                     BalsaSendmsg *bsmsg)
 {
     GtkFileChooser *fc;
     gchar *fname;
 
     if (response != GTK_RESPONSE_OK) {
-       gtk_widget_destroy(selector);
-       return;
+        gtk_widget_destroy(selector);
+        return;
     }
 
-    fc = GTK_FILE_CHOOSER(selector);
+    fc    = GTK_FILE_CHOOSER(selector);
     fname = gtk_file_chooser_get_filename(fc);
     if (fname != NULL) {
         gchar *string;
         gsize len;
         GError *error = NULL;
 
-       if (g_file_get_contents(fname, &string, &len, &error)) {
+        if (g_file_get_contents(fname, &string, &len, &error)) {
             LibBalsaTextAttribute attr;
             GtkTextBuffer *buffer;
 
             buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
-            attr = libbalsa_text_attr_string(string);
+            attr   = libbalsa_text_attr_string(string);
             if (!attr || (attr & LIBBALSA_TEXT_HI_UTF8)) {
                 /* Ascii or utf-8 */
                 gtk_text_buffer_insert_at_cursor(buffer, string, -1);
             } else {
                 /* Neither ascii nor utf-8... */
-                gchar *s = NULL;
+                gchar *s             = NULL;
                 const gchar *charset = sw_preferred_charset(bsmsg);
 
                 if (sw_can_convert(string, -1, "UTF-8", charset, &s)) {
                     /* ...but seems to be in current charset. */
                     gtk_text_buffer_insert_at_cursor(buffer, s, -1);
                     g_free(s);
-                } else
+                } else {
                     /* ...and can't be decoded from current charset. */
                     do_insert_string_select_ch(bsmsg, buffer, string, len, fname);
+                }
             }
             g_free(string);
 
             /* Use the same folder as for attachments. */
             g_free(balsa_app.attach_dir);
             balsa_app.attach_dir = gtk_file_chooser_get_current_folder(fc);
-       } else {
-               balsa_information_parented(GTK_WINDOW(bsmsg->window),
-                       LIBBALSA_INFORMATION_WARNING, _("Cannot not read the file ā€œ%sā€: %s"), fname, 
error->message);
-               g_error_free(error);
-       }
+        } else {
+            balsa_information_parented(GTK_WINDOW(bsmsg->window),
+                                       LIBBALSA_INFORMATION_WARNING,
+                                       _(
+                                           "Cannot not read the file ā€œ%sā€: %s"), fname,
+                                       error->message);
+            g_error_free(error);
+        }
 
         g_free(fname);
     }
@@ -4685,30 +5017,32 @@ insert_file_response(GtkWidget    *selector,
     gtk_widget_destroy(selector);
 }
 
+
 static void
-sw_include_file_activated(GSimpleAction * action,
-                          GVariant      * parameter,
-                          gpointer        data)
+sw_include_file_activated(GSimpleAction *action,
+                          GVariant      *parameter,
+                          gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
     GtkWidget *file_selector;
 
     file_selector =
-       gtk_file_chooser_dialog_new(_("Include file"),
+        gtk_file_chooser_dialog_new(_("Include file"),
                                     GTK_WINDOW(bsmsg->window),
                                     GTK_FILE_CHOOSER_ACTION_OPEN,
                                     _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                    _("_OK"),     GTK_RESPONSE_OK,
+                                    _("_OK"), GTK_RESPONSE_OK,
                                     NULL);
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(file_selector, GTK_WINDOW(bsmsg->window));
 #endif
     gtk_window_set_destroy_with_parent(GTK_WINDOW(file_selector), TRUE);
     /* Use the same folder as for attachments. */
-    if (balsa_app.attach_dir)
+    if (balsa_app.attach_dir) {
         gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER
-                                            (file_selector),
+                                                (file_selector),
                                             balsa_app.attach_dir);
+    }
     g_signal_connect(G_OBJECT(file_selector), "response",
                      G_CALLBACK(insert_file_response), bsmsg);
 
@@ -4716,20 +5050,23 @@ sw_include_file_activated(GSimpleAction * action,
     gtk_widget_show(file_selector);
 }
 
+
 static void
-strip_chars(gchar * str, const gchar * char2strip)
+strip_chars(gchar       *str,
+            const gchar *char2strip)
 {
     gchar *ins = str;
     while (*str) {
-       if (strchr(char2strip, *str) == NULL)
-           *ins++ = *str;
-       str++;
+        if (strchr(char2strip, *str) == NULL)
+            *ins++ = *str;
+        str++;
     }
     *ins = '\0';
 }
 
+
 static void
-sw_wrap_body(BalsaSendmsg * bsmsg)
+sw_wrap_body(BalsaSendmsg *bsmsg)
 {
     GtkTextView *text_view = GTK_TEXT_VIEW(bsmsg->text);
     GtkTextBuffer *buffer = gtk_text_view_get_buffer(text_view);
@@ -4738,9 +5075,9 @@ sw_wrap_body(BalsaSendmsg * bsmsg)
     gtk_text_buffer_get_bounds(buffer, &start, &end);
 
     if (bsmsg->flow) {
-       sw_buffer_signals_block(bsmsg, buffer);
+        sw_buffer_signals_block(bsmsg, buffer);
         libbalsa_unwrap_buffer(buffer, &start, -1);
-       sw_buffer_signals_unblock(bsmsg, buffer);
+        sw_buffer_signals_unblock(bsmsg, buffer);
     } else {
         GtkTextIter now;
         gint pos;
@@ -4767,8 +5104,10 @@ sw_wrap_body(BalsaSendmsg * bsmsg)
 
 
 static gboolean
-attachment2message(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter,
-                  gpointer data)
+attachment2message(GtkTreeModel *model,
+                   GtkTreePath  *path,
+                   GtkTreeIter  *iter,
+                   gpointer      data)
 {
     LibBalsaMessage *message = LIBBALSA_MESSAGE(data);
     BalsaAttachInfo *attachment;
@@ -4778,15 +5117,15 @@ attachment2message(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter,
     gtk_tree_model_get(model, iter, ATTACH_INFO_COLUMN, &attachment, -1);
 
     /* create the attachment */
-    body = libbalsa_message_body_new(message);
+    body           = libbalsa_message_body_new(message);
     body->file_uri = attachment->file_uri;
     if (attachment->file_uri)
         g_object_ref(attachment->file_uri);
     else
         body->filename = g_strdup(attachment->uri_ref);
     body->content_type = g_strdup(attachment->force_mime_type);
-    body->charset = g_strdup(attachment->charset);
-    body->attach_mode = attachment->mode;
+    body->charset      = g_strdup(attachment->charset);
+    body->attach_mode  = attachment->mode;
     libbalsa_message_append_part(message, body);
 
     /* clean up */
@@ -4800,18 +5139,20 @@ attachment2message(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter,
    stripping EOL chars is necessary - the GtkEntry fields can in principle
    contain them. Such characters might screw up message formatting
    (consider moving this code to mutt part).
-*/
+ */
 
 static void
-sw_set_header_from_path(LibBalsaMessage * message, const gchar * header,
-                        const gchar * path, const gchar * error_format)
+sw_set_header_from_path(LibBalsaMessage *message,
+                        const gchar     *header,
+                        const gchar     *path,
+                        const gchar     *error_format)
 {
     gchar *content = NULL;
-    GError *err = NULL;
+    GError *err    = NULL;
 
     if (path && !(content =
-                  libbalsa_get_header_from_path(header, path, NULL,
-                                                &err))) {
+                      libbalsa_get_header_from_path(header, path, NULL,
+                                                    &err))) {
         balsa_information(LIBBALSA_INFORMATION_WARNING,
                           error_format, path, err->message);
         g_error_free(err);
@@ -4821,8 +5162,10 @@ sw_set_header_from_path(LibBalsaMessage * message, const gchar * header,
     g_free(content);
 }
 
+
 static const gchar *
-sw_required_charset(BalsaSendmsg * bsmsg, const gchar * text)
+sw_required_charset(BalsaSendmsg *bsmsg,
+                    const gchar  *text)
 {
     const gchar *charset = "us-ascii";
 
@@ -4835,8 +5178,9 @@ sw_required_charset(BalsaSendmsg * bsmsg, const gchar * text)
     return charset;
 }
 
+
 static LibBalsaMessage *
-bsmsg2message(BalsaSendmsg * bsmsg)
+bsmsg2message(BalsaSendmsg *bsmsg)
 {
     LibBalsaMessage *message;
     LibBalsaMessageHeaders *headers;
@@ -4844,13 +5188,13 @@ bsmsg2message(BalsaSendmsg * bsmsg)
     gchar *tmp;
     GtkTextIter start, end;
     LibBalsaIdentity *ident = bsmsg->ident;
-    InternetAddress *ia = libbalsa_identity_get_address(ident);
+    InternetAddress *ia     = libbalsa_identity_get_address(ident);
     GtkTextBuffer *buffer;
     GtkTextBuffer *new_buffer = NULL;
 
     message = libbalsa_message_new();
 
-    headers = libbalsa_message_get_headers(message);
+    headers       = libbalsa_message_get_headers(message);
     headers->from = internet_address_list_new ();
     internet_address_list_add(headers->from, ia);
 
@@ -4877,23 +5221,24 @@ bsmsg2message(BalsaSendmsg * bsmsg)
         libbalsa_address_view_get_list(bsmsg->replyto_view, "Reply To:");
 
     if (bsmsg->req_mdn)
-       libbalsa_message_set_dispnotify(message, ia);
+        libbalsa_message_set_dispnotify(message, ia);
     libbalsa_message_set_request_dsn(message, bsmsg->req_dsn);
 
     sw_set_header_from_path(message, "Face", libbalsa_identity_get_face_path(ident),
-            /* Translators: please do not translate Face. */
+                            /* Translators: please do not translate Face. */
                             _("Could not load Face header file %s: %s"));
     sw_set_header_from_path(message, "X-Face", libbalsa_identity_get_x_face_path(ident),
-            /* Translators: please do not translate Face. */
+                            /* Translators: please do not translate Face. */
                             _("Could not load X-Face header file %s: %s"));
 
     libbalsa_message_set_references(message, bsmsg->references);
     bsmsg->references = NULL; /* steal it */
 
-    if (bsmsg->in_reply_to != NULL)
+    if (bsmsg->in_reply_to != NULL) {
         libbalsa_message_set_in_reply_to(message,
                                          g_list_prepend(NULL,
                                                         g_strdup(bsmsg->in_reply_to)));
+    }
 
     body = libbalsa_message_body_new(message);
 
@@ -4904,7 +5249,7 @@ bsmsg2message(BalsaSendmsg * bsmsg)
         /* Copy the message text to a new buffer: */
         GtkTextTagTable *table;
 
-        table = gtk_text_buffer_get_tag_table(buffer);
+        table      = gtk_text_buffer_get_tag_table(buffer);
         new_buffer = gtk_text_buffer_new(table);
 
         tmp = gtk_text_iter_get_text(&start, &end);
@@ -4922,14 +5267,16 @@ bsmsg2message(BalsaSendmsg * bsmsg)
     if (new_buffer)
         g_object_unref(new_buffer);
 
-    if (bsmsg->send_mp_alt)
+    if (bsmsg->send_mp_alt) {
         body->html_buffer =
             libbalsa_text_to_html(libbalsa_message_get_subject(message), body->buffer,
                                   bsmsg->spell_check_lang);
-    if (bsmsg->flow)
-       body->buffer =
-           libbalsa_wrap_rfc2646(body->buffer, balsa_app.wraplength,
+    }
+    if (bsmsg->flow) {
+        body->buffer =
+            libbalsa_wrap_rfc2646(body->buffer, balsa_app.wraplength,
                                   TRUE, FALSE, TRUE);
+    }
 
     /* Ildar reports that, when a message contains both text/plain and
      * text/html parts, some broken MUAs use the charset from the
@@ -4951,7 +5298,8 @@ bsmsg2message(BalsaSendmsg * bsmsg)
 #ifdef HAVE_GPGME
     if (balsa_app.has_openpgp || balsa_app.has_smime) {
         libbalsa_message_set_gpg_mode(message,
-            (bsmsg->gpg_mode & LIBBALSA_PROTECT_MODE) != 0 ? bsmsg->gpg_mode : 0);
+                                      (bsmsg->gpg_mode & LIBBALSA_PROTECT_MODE) !=
+                                      0 ? bsmsg->gpg_mode : 0);
         libbalsa_message_set_att_pubkey(message, bsmsg->attach_pubkey);
         libbalsa_message_set_identity(message, ident);
     } else {
@@ -4962,14 +5310,15 @@ bsmsg2message(BalsaSendmsg * bsmsg)
 
     /* remember the parent window */
     g_object_set_data(G_OBJECT(message), "parent-window",
-                     GTK_WINDOW(bsmsg->window));
+                      GTK_WINDOW(bsmsg->window));
 
     return message;
 }
 
+
 /* ask the user for a subject */
 static gboolean
-subject_not_empty(BalsaSendmsg * bsmsg)
+subject_not_empty(BalsaSendmsg *bsmsg)
 {
     const gchar *subj;
     GtkWidget *no_subj_dialog;
@@ -4986,12 +5335,13 @@ subject_not_empty(BalsaSendmsg * bsmsg)
        than spaces */
     subj = gtk_entry_get_text(GTK_ENTRY(bsmsg->subject[1]));
     if (subj) {
-       const gchar *p = subj;
+        const gchar *p = subj;
 
-       while (*p && g_unichar_isspace(g_utf8_get_char(p)))
-           p = g_utf8_next_char(p);
-       if (*p != '\0')
-           return TRUE;
+        while (*p && g_unichar_isspace(g_utf8_get_char(p))) {
+            p = g_utf8_next_char(p);
+        }
+        if (*p != '\0')
+            return TRUE;
     }
 
     /* build the dialog */
@@ -5001,7 +5351,7 @@ subject_not_empty(BalsaSendmsg * bsmsg)
                                     GTK_DIALOG_MODAL |
                                     libbalsa_dialog_flags(),
                                     _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                    _("_Send"),   GTK_RESPONSE_OK,
+                                    _("_Send"), GTK_RESPONSE_OK,
                                     NULL);
     gtk_window_set_resizable (GTK_WINDOW (no_subj_dialog), FALSE);
     gtk_window_set_type_hint (GTK_WINDOW (no_subj_dialog), GDK_SURFACE_TYPE_HINT_DIALOG);
@@ -5023,8 +5373,8 @@ subject_not_empty(BalsaSendmsg * bsmsg)
     gtk_box_pack_start (GTK_BOX (hbox), vbox);
 
     text_str = g_strdup_printf("<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s",
-                              _("You did not specify a subject for this message"),
-                              _("If you would like to provide one, enter it below."));
+                               _("You did not specify a subject for this message"),
+                               _("If you would like to provide one, enter it below."));
     label = gtk_label_new (text_str);
     g_free(text_str);
     gtk_box_pack_start (GTK_BOX (vbox), label);
@@ -5054,45 +5404,46 @@ subject_not_empty(BalsaSendmsg * bsmsg)
 
     /* always set the current string in the subject entry */
     gtk_entry_set_text(GTK_ENTRY(bsmsg->subject[1]),
-                      gtk_entry_get_text(GTK_ENTRY(subj_entry)));
+                       gtk_entry_get_text(GTK_ENTRY(subj_entry)));
     gtk_widget_destroy(no_subj_dialog);
 
     return response == GTK_RESPONSE_OK;
 }
 
+
 #ifdef HAVE_GPGME
 static gboolean
-check_suggest_encryption(BalsaSendmsg * bsmsg)
+check_suggest_encryption(BalsaSendmsg *bsmsg)
 {
-    InternetAddressList * ia_list;
+    InternetAddressList *ia_list;
     gboolean can_encrypt;
     gpgme_protocol_t protocol;
     gint len;
 
     /* check if the user wants to see the message */
     if (!libbalsa_identity_get_warn_send_plain(bsmsg->ident))
-       return TRUE;
+        return TRUE;
 
     /* nothing to do if encryption is already enabled */
     if ((bsmsg->gpg_mode & LIBBALSA_PROTECT_ENCRYPT) != 0)
-       return TRUE;
+        return TRUE;
 
     /* we can not encrypt if we have bcc recipients */
     ia_list = libbalsa_address_view_get_list(bsmsg->recipient_view, "BCC:");
-    len = internet_address_list_length(ia_list);
+    len     = internet_address_list_length(ia_list);
     g_object_unref(ia_list);
     if (len > 0)
         return TRUE;
 
     /* collect all to and cc recipients */
     protocol = bsmsg->gpg_mode & LIBBALSA_PROTECT_SMIMEV3 ?
-       GPGME_PROTOCOL_CMS : GPGME_PROTOCOL_OpenPGP;
+        GPGME_PROTOCOL_CMS : GPGME_PROTOCOL_OpenPGP;
 
-    ia_list = libbalsa_address_view_get_list(bsmsg->recipient_view, "To:");
+    ia_list     = libbalsa_address_view_get_list(bsmsg->recipient_view, "To:");
     can_encrypt = libbalsa_can_encrypt_for_all(ia_list, protocol);
     g_object_unref(ia_list);
     if (can_encrypt) {
-        ia_list = libbalsa_address_view_get_list(bsmsg->recipient_view, "CC:");
+        ia_list     = libbalsa_address_view_get_list(bsmsg->recipient_view, "CC:");
         can_encrypt = libbalsa_can_encrypt_for_all(ia_list, protocol);
         g_object_unref(ia_list);
     }
@@ -5105,75 +5456,78 @@ check_suggest_encryption(BalsaSendmsg * bsmsg)
 
     /* ask the user if we could encrypt this message */
     if (can_encrypt) {
-       GtkWidget *dialog;
-       gint choice;
-       GtkWidget *button;
-       GtkWidget *hbox;
-       GtkWidget *image;
-       GtkWidget *label;
-
-       dialog = gtk_message_dialog_new
-           (GTK_WINDOW(bsmsg->window),
-            GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
-            GTK_MESSAGE_QUESTION,
-            GTK_BUTTONS_NONE,
-            _("You did not select encryption for this message, although "
-               "%s public keys are available for all recipients. In order "
-               "to protect your privacy, the message could be %s encrypted."),
-             gpgme_get_protocol_name(protocol),
-             gpgme_get_protocol_name(protocol));
-#if HAVE_MACOSX_DESKTOP
+        GtkWidget *dialog;
+        gint choice;
+        GtkWidget *button;
+        GtkWidget *hbox;
+        GtkWidget *image;
+        GtkWidget *label;
+
+        dialog = gtk_message_dialog_new
+                (GTK_WINDOW(bsmsg->window),
+                GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
+                GTK_MESSAGE_QUESTION,
+                GTK_BUTTONS_NONE,
+                _("You did not select encryption for this message, although "
+                  "%s public keys are available for all recipients. In order "
+                  "to protect your privacy, the message could be %s encrypted."),
+                gpgme_get_protocol_name(protocol),
+                gpgme_get_protocol_name(protocol));
+#   if HAVE_MACOSX_DESKTOP
         libbalsa_macosx_menu_for_parent(dialog, GTK_WINDOW(bsmsg->window));
-#endif
+#   endif
 
 
-       button = gtk_button_new();
-       gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button, GTK_RESPONSE_YES);
+        button = gtk_button_new();
+        gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button, GTK_RESPONSE_YES);
         gtk_widget_set_can_default(button, TRUE);
-       gtk_widget_grab_focus(button);
+        gtk_widget_grab_focus(button);
 
-       hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
+        hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
         gtk_widget_set_halign(hbox, GTK_ALIGN_CENTER);
         gtk_widget_set_valign(hbox, GTK_ALIGN_CENTER);
-       gtk_container_add(GTK_CONTAINER(button), hbox);
-       image = gtk_image_new_from_icon_name(balsa_icon_id(BALSA_PIXMAP_GPG_ENCRYPT));
-       gtk_box_pack_start(GTK_BOX(hbox), image);
-       label = gtk_label_new_with_mnemonic(_("Send _encrypted"));
-       gtk_box_pack_start(GTK_BOX(hbox), label);
-
-       button = gtk_button_new();
-       gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button, GTK_RESPONSE_NO);
+        gtk_container_add(GTK_CONTAINER(button), hbox);
+        image = gtk_image_new_from_icon_name(balsa_icon_id(BALSA_PIXMAP_GPG_ENCRYPT));
+        gtk_box_pack_start(GTK_BOX(hbox), image);
+        label = gtk_label_new_with_mnemonic(_("Send _encrypted"));
+        gtk_box_pack_start(GTK_BOX(hbox), label);
+
+        button = gtk_button_new();
+        gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button, GTK_RESPONSE_NO);
         gtk_widget_set_can_default(button, TRUE);
 
-       hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
+        hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
         gtk_widget_set_halign(hbox, GTK_ALIGN_CENTER);
         gtk_widget_set_valign(hbox, GTK_ALIGN_CENTER);
-       gtk_container_add(GTK_CONTAINER(button), hbox);
-       image = gtk_image_new_from_icon_name(balsa_icon_id(BALSA_PIXMAP_SEND));
-       gtk_box_pack_start(GTK_BOX(hbox), image);
-       label = gtk_label_new_with_mnemonic(_("Send _unencrypted"));
-       gtk_box_pack_start(GTK_BOX(hbox), label);
-
-       button = gtk_button_new_with_mnemonic(_("_Cancel"));
-       gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button, GTK_RESPONSE_CANCEL);
+        gtk_container_add(GTK_CONTAINER(button), hbox);
+        image = gtk_image_new_from_icon_name(balsa_icon_id(BALSA_PIXMAP_SEND));
+        gtk_box_pack_start(GTK_BOX(hbox), image);
+        label = gtk_label_new_with_mnemonic(_("Send _unencrypted"));
+        gtk_box_pack_start(GTK_BOX(hbox), label);
+
+        button = gtk_button_new_with_mnemonic(_("_Cancel"));
+        gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button, GTK_RESPONSE_CANCEL);
         gtk_widget_set_can_default(button, TRUE);
 
-       choice = gtk_dialog_run(GTK_DIALOG(dialog));
-       gtk_widget_destroy(dialog);
-       if (choice == GTK_RESPONSE_YES)
-           bsmsg_setup_gpg_ui_by_mode(bsmsg, bsmsg->gpg_mode | LIBBALSA_PROTECT_ENCRYPT);
-       else if (choice == GTK_RESPONSE_CANCEL || choice == GTK_RESPONSE_DELETE_EVENT)
-           return FALSE;
+        choice = gtk_dialog_run(GTK_DIALOG(dialog));
+        gtk_widget_destroy(dialog);
+        if (choice == GTK_RESPONSE_YES)
+            bsmsg_setup_gpg_ui_by_mode(bsmsg, bsmsg->gpg_mode | LIBBALSA_PROTECT_ENCRYPT);
+        else if ((choice == GTK_RESPONSE_CANCEL) || (choice == GTK_RESPONSE_DELETE_EVENT))
+            return FALSE;
     }
 
     return TRUE;
 }
+
+
 #endif
 
 /* "send message" menu and toolbar callback.
  */
 static gint
-send_message_handler(BalsaSendmsg * bsmsg, gboolean queue_only)
+send_message_handler(BalsaSendmsg *bsmsg,
+                     gboolean      queue_only)
 {
     LibBalsaMsgCreateResult result;
     LibBalsaMessage *message;
@@ -5181,17 +5535,17 @@ send_message_handler(BalsaSendmsg * bsmsg, gboolean queue_only)
 #ifdef HAVE_GPGME
     GtkTreeIter iter;
 #endif
-    GError * error = NULL;
+    GError *error = NULL;
 
     if (!bsmsg->ready_to_send)
-       return FALSE;
+        return FALSE;
 
-    if(!subject_not_empty(bsmsg))
-       return FALSE;
+    if (!subject_not_empty(bsmsg))
+        return FALSE;
 
 #ifdef HAVE_GPGME
     if (!check_suggest_encryption(bsmsg))
-       return FALSE;
+        return FALSE;
 
     if ((bsmsg->gpg_mode & LIBBALSA_PROTECT_OPENPGP) != 0) {
         gboolean warn_mp;
@@ -5208,31 +5562,31 @@ send_message_handler(BalsaSendmsg * bsmsg, gboolean queue_only)
              * RFC2440 sign a multipart/alternative... */
             GtkWidget *dialog;
             gint choice;
-            GString * string =
+            GString *string =
                 g_string_new(_("You selected OpenPGP security for this message.\n"));
 
             if (warn_html_sign)
                 string =
                     g_string_append(string,
-                        _("The message text will be sent as plain text and as "
-                          "HTML, but only the plain part can be signed.\n"));
+                                    _("The message text will be sent as plain text and as "
+                                      "HTML, but only the plain part can be signed.\n"));
             if (warn_mp)
                 string =
                     g_string_append(string,
-                        _("The message contains attachments, which cannot be "
-                          "signed or encrypted.\n"));
+                                    _("The message contains attachments, which cannot be "
+                                      "signed or encrypted.\n"));
             string =
                 g_string_append(string,
-                    _("You should select MIME mode if the complete "
-                      "message shall be protected. Do you really want to proceed?"));
+                                _("You should select MIME mode if the complete "
+                                  "message shall be protected. Do you really want to proceed?"));
             dialog = gtk_message_dialog_new
-                (GTK_WINDOW(bsmsg->window),
-                 GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
-                 GTK_MESSAGE_QUESTION,
-                 GTK_BUTTONS_OK_CANCEL, "%s", string->str);
-#if HAVE_MACOSX_DESKTOP
-           libbalsa_macosx_menu_for_parent(dialog, GTK_WINDOW(bsmsg->window));
-#endif
+                    (GTK_WINDOW(bsmsg->window),
+                    GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
+                    GTK_MESSAGE_QUESTION,
+                    GTK_BUTTONS_OK_CANCEL, "%s", string->str);
+#   if HAVE_MACOSX_DESKTOP
+            libbalsa_macosx_menu_for_parent(dialog, GTK_WINDOW(bsmsg->window));
+#   endif
             g_string_free(string, TRUE);
             choice = gtk_dialog_run(GTK_DIALOG(dialog));
             gtk_widget_destroy(dialog);
@@ -5243,7 +5597,7 @@ send_message_handler(BalsaSendmsg * bsmsg, gboolean queue_only)
 #endif
 
     message = bsmsg2message(bsmsg);
-    fcc = balsa_find_mailbox_by_url(bsmsg->fcc_url);
+    fcc     = balsa_find_mailbox_by_url(bsmsg->fcc_url);
 
 #ifdef HAVE_GPGME
     balsa_information_parented(GTK_WINDOW(bsmsg->window),
@@ -5252,26 +5606,26 @@ send_message_handler(BalsaSendmsg * bsmsg, gboolean queue_only)
                                libbalsa_message_get_gpg_mode(message));
 #endif
 
-    if(queue_only)
-       result = libbalsa_message_queue(message, balsa_app.outbox, fcc,
-                                       libbalsa_identity_get_smtp_server(bsmsg->ident),
-                                       bsmsg->flow, &error);
-    else
+    if (queue_only) {
+        result = libbalsa_message_queue(message, balsa_app.outbox, fcc,
+                                        libbalsa_identity_get_smtp_server(bsmsg->ident),
+                                        bsmsg->flow, &error);
+    } else {
         result = libbalsa_message_send(message, balsa_app.outbox, fcc,
                                        balsa_find_sentbox_by_url,
-                                      libbalsa_identity_get_smtp_server(bsmsg->ident),
-                                                                          balsa_app.send_progress_dialog,
+                                       libbalsa_identity_get_smtp_server(bsmsg->ident),
+                                       balsa_app.send_progress_dialog,
                                        GTK_WINDOW(balsa_app.main_window),
                                        bsmsg->flow, &error);
+    }
     if (result == LIBBALSA_MESSAGE_CREATE_OK) {
-       if (bsmsg->parent_message != NULL) {
+        if (bsmsg->parent_message != NULL) {
             LibBalsaMailbox *mailbox;
 
             mailbox = libbalsa_message_get_mailbox(bsmsg->parent_message);
-            if (mailbox != NULL &&
-                !libbalsa_mailbox_get_readonly(mailbox)) {
+            if ((mailbox != NULL) &&
+                !libbalsa_mailbox_get_readonly(mailbox))
                 libbalsa_message_reply(bsmsg->parent_message);
-            }
         }
         sw_delete_draft(bsmsg);
     }
@@ -5280,33 +5634,45 @@ send_message_handler(BalsaSendmsg * bsmsg, gboolean queue_only)
 
     if (result != LIBBALSA_MESSAGE_CREATE_OK) {
         const char *msg;
-        switch(result) {
+        switch (result) {
         default:
         case LIBBALSA_MESSAGE_CREATE_ERROR:
-            msg = _("Message could not be created"); break;
+            msg = _("Message could not be created");
+            break;
+
         case LIBBALSA_MESSAGE_QUEUE_ERROR:
-            msg = _("Message could not be queued in outbox"); break;
+            msg = _("Message could not be queued in outbox");
+            break;
+
         case LIBBALSA_MESSAGE_SAVE_ERROR:
-            msg = _("Message could not be saved in sentbox"); break;
+            msg = _("Message could not be saved in sentbox");
+            break;
+
         case LIBBALSA_MESSAGE_SEND_ERROR:
-            msg = _("Message could not be sent"); break;
+            msg = _("Message could not be sent");
+            break;
+
 #ifdef HAVE_GPGME
-       case LIBBALSA_MESSAGE_SIGN_ERROR:
-            msg = _("Message could not be signed"); break;
-       case LIBBALSA_MESSAGE_ENCRYPT_ERROR:
-            msg = _("Message could not be encrypted"); break;
+        case LIBBALSA_MESSAGE_SIGN_ERROR:
+            msg = _("Message could not be signed");
+            break;
+
+        case LIBBALSA_MESSAGE_ENCRYPT_ERROR:
+            msg = _("Message could not be encrypted");
+            break;
 #endif
         }
-       if (error)
-           balsa_information_parented(GTK_WINDOW(bsmsg->window),
-                                      LIBBALSA_INFORMATION_ERROR,
-                                      _("Send failed: %s\n%s"), msg,
-                                      error->message);
-       else
-           balsa_information_parented(GTK_WINDOW(bsmsg->window),
-                                      LIBBALSA_INFORMATION_ERROR,
-                                      _("Send failed: %s"), msg);
-       return FALSE;
+        if (error) {
+            balsa_information_parented(GTK_WINDOW(bsmsg->window),
+                                       LIBBALSA_INFORMATION_ERROR,
+                                       _("Send failed: %s\n%s"), msg,
+                                       error->message);
+        } else {
+            balsa_information_parented(GTK_WINDOW(bsmsg->window),
+                                       LIBBALSA_INFORMATION_ERROR,
+                                       _("Send failed: %s"), msg);
+        }
+        return FALSE;
     }
     g_clear_error(&error);
 
@@ -5318,15 +5684,20 @@ send_message_handler(BalsaSendmsg * bsmsg, gboolean queue_only)
 
 /* "send message" menu callback */
 static void
-sw_toolbar_send_activated(GSimpleAction * action, GVariant * parameter, gpointer data)
+sw_toolbar_send_activated(GSimpleAction *action,
+                          GVariant      *parameter,
+                          gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
     send_message_handler(bsmsg, balsa_app.always_queue_sent_mail);
 }
 
+
 static void
-sw_send_activated(GSimpleAction * action, GVariant * parameter, gpointer data)
+sw_send_activated(GSimpleAction *action,
+                  GVariant      *parameter,
+                  gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -5335,15 +5706,18 @@ sw_send_activated(GSimpleAction * action, GVariant * parameter, gpointer data)
 
 
 static void
-sw_queue_activated(GSimpleAction * action, GVariant * parameter, gpointer data)
+sw_queue_activated(GSimpleAction *action,
+                   GVariant      *parameter,
+                   gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
     send_message_handler(bsmsg, TRUE);
 }
 
+
 static gboolean
-message_postpone(BalsaSendmsg * bsmsg)
+message_postpone(BalsaSendmsg *bsmsg)
 {
     gboolean successp;
     LibBalsaMessage *message;
@@ -5387,44 +5761,46 @@ message_postpone(BalsaSendmsg * bsmsg)
     g_ptr_array_add(headers, g_strdup_printf("%d", bsmsg->type));
     g_ptr_array_add(headers, NULL);
 
-    if ((bsmsg->type == SEND_REPLY || bsmsg->type == SEND_REPLY_ALL ||
-        bsmsg->type == SEND_REPLY_GROUP))
-       successp = libbalsa_message_postpone(message, balsa_app.draftbox,
+    if (((bsmsg->type == SEND_REPLY) || (bsmsg->type == SEND_REPLY_ALL) ||
+         (bsmsg->type == SEND_REPLY_GROUP))) {
+        successp = libbalsa_message_postpone(message, balsa_app.draftbox,
                                              bsmsg->parent_message,
                                              (gchar **) headers->pdata,
                                              bsmsg->flow, &error);
-    else
-       successp = libbalsa_message_postpone(message, balsa_app.draftbox,
+    } else {
+        successp = libbalsa_message_postpone(message, balsa_app.draftbox,
                                              NULL,
                                              (gchar **) headers->pdata,
                                              bsmsg->flow, &error);
+    }
     g_ptr_array_foreach(headers, (GFunc) g_free, NULL);
     g_ptr_array_free(headers, TRUE);
 
-    if(successp)
+    if (successp) {
         sw_delete_draft(bsmsg);
-    else {
+    } else {
         balsa_information_parented(GTK_WINDOW(bsmsg->window),
                                    LIBBALSA_INFORMATION_ERROR,
                                    _("Could not postpone message: %s"),
-                                  error ? error->message : "");
-       g_clear_error(&error);
+                                   error ? error->message : "");
+        g_clear_error(&error);
     }
 
     g_object_unref(G_OBJECT(message));
     return successp;
 }
 
+
 /* "postpone message" menu callback */
 static void
-sw_postpone_activated(GSimpleAction * action,
-                      GVariant      * parameter,
-                      gpointer data)
+sw_postpone_activated(GSimpleAction *action,
+                      GVariant      *parameter,
+                      gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
     if (bsmsg->ready_to_send) {
-        if(message_postpone(bsmsg)) {
+        if (message_postpone(bsmsg)) {
             balsa_information_parented(GTK_WINDOW(bsmsg->window),
                                        LIBBALSA_INFORMATION_MESSAGE,
                                        _("Message postponed."));
@@ -5437,10 +5813,11 @@ sw_postpone_activated(GSimpleAction * action,
     }
 }
 
+
 static void
-sw_save_activated(GSimpleAction * action,
-                  GVariant      * parameter,
-                  gpointer        data)
+sw_save_activated(GSimpleAction *action,
+                  GVariant      *parameter,
+                  gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -5448,10 +5825,11 @@ sw_save_activated(GSimpleAction * action,
         bsmsg->state = SENDMSG_STATE_CLEAN;
 }
 
+
 static void
-sw_page_setup_activated(GSimpleAction * action,
-                        GVariant      * parameter,
-                        gpointer data)
+sw_page_setup_activated(GSimpleAction *action,
+                        GVariant      *parameter,
+                        gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
     LibBalsaMessage *message;
@@ -5461,10 +5839,11 @@ sw_page_setup_activated(GSimpleAction * action,
     g_object_unref(message);
 }
 
+
 static void
-sw_print_activated(GSimpleAction * action,
-                   GVariant      * parameter,
-                   gpointer data)
+sw_print_activated(GSimpleAction *action,
+                   GVariant      *parameter,
+                   gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
     LibBalsaMessage *message;
@@ -5474,6 +5853,7 @@ sw_print_activated(GSimpleAction * action,
     g_object_unref(message);
 }
 
+
 /*
  * Signal handlers for updating the cursor when text is inserted.
  * The "insert-text" signal is emitted before the insertion, so we
@@ -5486,8 +5866,11 @@ sw_print_activated(GSimpleAction * action,
  * the insertion.
  */
 static void
-sw_buffer_insert_text(GtkTextBuffer * buffer, GtkTextIter * iter,
-                      const gchar * text, gint len, BalsaSendmsg * bsmsg)
+sw_buffer_insert_text(GtkTextBuffer *buffer,
+                      GtkTextIter   *iter,
+                      const gchar   *text,
+                      gint           len,
+                      BalsaSendmsg  *bsmsg)
 {
     bsmsg->insert_mark =
         gtk_text_buffer_create_mark(buffer, "balsa-insert-mark", iter,
@@ -5495,14 +5878,16 @@ sw_buffer_insert_text(GtkTextBuffer * buffer, GtkTextIter * iter,
 #if !HAVE_GTKSOURCEVIEW
     /* If this insertion is not from the keyboard, or if we just undid
      * something, save the current buffer for undo. */
-    if (len > 1 /* Not keyboard? */
+    if ((len > 1) /* Not keyboard? */
         || !sw_action_get_enabled(bsmsg, "undo"))
         sw_buffer_save(bsmsg);
 #endif                          /* HAVE_GTKSOURCEVIEW */
 }
 
+
 static void
-sw_buffer_changed(GtkTextBuffer * buffer, BalsaSendmsg * bsmsg)
+sw_buffer_changed(GtkTextBuffer *buffer,
+                  BalsaSendmsg  *bsmsg)
 {
     if (bsmsg->insert_mark) {
         GtkTextIter iter;
@@ -5516,22 +5901,27 @@ sw_buffer_changed(GtkTextBuffer * buffer, BalsaSendmsg * bsmsg)
     bsmsg->state = SENDMSG_STATE_MODIFIED;
 }
 
+
 #if !HAVE_GTKSOURCEVIEW
 static void
-sw_buffer_delete_range(GtkTextBuffer * buffer, GtkTextIter * start,
-                       GtkTextIter * end, BalsaSendmsg * bsmsg)
+sw_buffer_delete_range(GtkTextBuffer *buffer,
+                       GtkTextIter   *start,
+                       GtkTextIter   *end,
+                       BalsaSendmsg  *bsmsg)
 {
     if (gtk_text_iter_get_offset(end) >
         gtk_text_iter_get_offset(start) + 1)
         sw_buffer_save(bsmsg);
 }
+
+
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
 /*
  * Helpers for the undo and redo buffers.
  */
 static void
-sw_buffer_signals_connect(BalsaSendmsg * bsmsg)
+sw_buffer_signals_connect(BalsaSendmsg *bsmsg)
 {
     GtkTextBuffer *buffer =
         gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
@@ -5549,28 +5939,35 @@ sw_buffer_signals_connect(BalsaSendmsg * bsmsg)
 #endif                          /* HAVE_GTKSOURCEVIEW */
 }
 
+
 #if !HAVE_GTKSOURCEVIEW || !(HAVE_GSPELL || HAVE_GTKSPELL)
 static void
-sw_buffer_signals_disconnect(BalsaSendmsg * bsmsg)
+sw_buffer_signals_disconnect(BalsaSendmsg *bsmsg)
 {
     GtkTextBuffer *buffer =
         gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
 
     g_signal_handler_disconnect(buffer, bsmsg->changed_sig_id);
-#if !HAVE_GTKSOURCEVIEW
+#   if !HAVE_GTKSOURCEVIEW
     g_signal_handler_disconnect(buffer, bsmsg->delete_range_sig_id);
-#endif                          /* HAVE_GTKSOURCEVIEW */
+#   endif                       /* HAVE_GTKSOURCEVIEW */
     g_signal_handler_disconnect(buffer, bsmsg->insert_text_sig_id);
 }
+
+
 #endif                          /* !HAVE_GTKSOURCEVIEW || !HAVE_GTKSPELL */
 
 #if !HAVE_GTKSOURCEVIEW
 static void
-sw_buffer_set_undo(BalsaSendmsg * bsmsg, gboolean undo, gboolean redo)
+sw_buffer_set_undo(BalsaSendmsg *bsmsg,
+                   gboolean      undo,
+                   gboolean      redo)
 {
     sw_action_set_enabled(bsmsg, "undo", undo);
     sw_action_set_enabled(bsmsg, "redo", redo);
 }
+
+
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
 #ifdef HAVE_GTKSPELL
@@ -5582,16 +5979,16 @@ sw_buffer_set_undo(BalsaSendmsg * bsmsg, gboolean undo, gboolean redo)
  * the menu, set the appropriate item active.
  */
 static void
-sw_spell_language_changed_cb(GtkSpellChecker * spell,
-                             const gchar     * new_lang,
-                             gpointer          data)
+sw_spell_language_changed_cb(GtkSpellChecker *spell,
+                             const gchar     *new_lang,
+                             gpointer         data)
 {
     BalsaSendmsg *bsmsg = data;
     GtkWidget *langs;
     GList *list, *children;
 
     langs = gtk_menu_item_get_submenu(GTK_MENU_ITEM
-                                      (bsmsg->current_language_menu));
+                                          (bsmsg->current_language_menu));
     children = gtk_container_get_children(GTK_CONTAINER(langs));
 
     for (list = children; list; list = list->next) {
@@ -5617,8 +6014,9 @@ sw_spell_language_changed_cb(GtkSpellChecker * spell,
     balsa_app.spell_check_lang = g_strdup(new_lang);
 }
 
+
 static gboolean
-sw_spell_detach(BalsaSendmsg * bsmsg)
+sw_spell_detach(BalsaSendmsg *bsmsg)
 {
     GtkSpellChecker *spell;
 
@@ -5629,8 +6027,9 @@ sw_spell_detach(BalsaSendmsg * bsmsg)
     return spell != NULL;
 }
 
+
 static void
-sw_spell_attach(BalsaSendmsg * bsmsg)
+sw_spell_attach(BalsaSendmsg *bsmsg)
 {
     GtkSpellChecker *spell;
     GError *err = NULL;
@@ -5656,36 +6055,40 @@ sw_spell_attach(BalsaSendmsg * bsmsg)
                          G_CALLBACK(sw_spell_language_changed_cb), bsmsg);
     }
 }
+
+
 #endif                          /* HAVE_GTKSPELL */
 
 #if !HAVE_GTKSOURCEVIEW
 static void
-sw_buffer_swap(BalsaSendmsg * bsmsg, gboolean undo)
+sw_buffer_swap(BalsaSendmsg *bsmsg,
+               gboolean      undo)
 {
     GtkTextBuffer *buffer =
         gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
-#if HAVE_GTKSPELL
+#   if HAVE_GTKSPELL
     gboolean had_spell;
 
     /* GtkSpell doesn't seem to handle setting a new buffer... */
     had_spell = sw_spell_detach(bsmsg);
-#endif                          /* HAVE_GTKSPELL */
+#   endif                       /* HAVE_GTKSPELL */
 
     sw_buffer_signals_disconnect(bsmsg);
     g_object_ref(G_OBJECT(buffer));
     gtk_text_view_set_buffer(GTK_TEXT_VIEW(bsmsg->text), bsmsg->buffer2);
-#if HAVE_GTKSPELL
+#   if HAVE_GTKSPELL
     if (had_spell)
         sw_spell_attach(bsmsg);
-#endif                          /* HAVE_GTKSPELL */
+#   endif                       /* HAVE_GTKSPELL */
     g_object_unref(bsmsg->buffer2);
     bsmsg->buffer2 = buffer;
     sw_buffer_signals_connect(bsmsg);
     sw_buffer_set_undo(bsmsg, !undo, undo);
 }
 
+
 static void
-sw_buffer_save(BalsaSendmsg * bsmsg)
+sw_buffer_save(BalsaSendmsg *bsmsg)
 {
     GtkTextBuffer *buffer =
         gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
@@ -5698,6 +6101,8 @@ sw_buffer_save(BalsaSendmsg * bsmsg)
 
     sw_buffer_set_undo(bsmsg, TRUE, FALSE);
 }
+
+
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
 /*
@@ -5706,43 +6111,58 @@ sw_buffer_save(BalsaSendmsg * bsmsg)
 
 #if HAVE_GTKSOURCEVIEW
 static void
-sw_undo_activated(GSimpleAction * action, GVariant * parameter, gpointer data)
+sw_undo_activated(GSimpleAction *action,
+                  GVariant      *parameter,
+                  gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
     g_signal_emit_by_name(bsmsg->text, "undo");
 }
 
+
 static void
-sw_redo_activated(GSimpleAction * action, GVariant * parameter, gpointer data)
+sw_redo_activated(GSimpleAction *action,
+                  GVariant      *parameter,
+                  gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
     g_signal_emit_by_name(bsmsg->text, "redo");
 }
+
+
 #else                           /* HAVE_GTKSOURCEVIEW */
 static void
-sw_undo_activated(GSimpleAction * action, GVariant * parameter, gpointer data)
+sw_undo_activated(GSimpleAction *action,
+                  GVariant      *parameter,
+                  gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
     sw_buffer_swap(bsmsg, TRUE);
 }
 
+
 static void
-sw_redo_activated(GSimpleAction * action, GVariant * parameter, gpointer data)
+sw_redo_activated(GSimpleAction *action,
+                  GVariant      *parameter,
+                  gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
     sw_buffer_swap(bsmsg, FALSE);
 }
+
+
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
 /*
  * Cut, copy, and paste callbacks, and a helper.
  */
 static void
-clipboard_helper(BalsaSendmsg * bsmsg, gchar * signal)
+clipboard_helper(BalsaSendmsg *bsmsg,
+                 gchar        *signal)
 {
     guint signal_id;
     GtkWidget *focus_widget =
@@ -5754,47 +6174,52 @@ clipboard_helper(BalsaSendmsg * bsmsg, gchar * signal)
         g_signal_emit(focus_widget, signal_id, (GQuark) 0);
 }
 
+
 static void
-sw_cut_activated(GSimpleAction * action,
-                 GVariant      * parameter,
-                 gpointer        data)
+sw_cut_activated(GSimpleAction *action,
+                 GVariant      *parameter,
+                 gpointer       data)
 {
     clipboard_helper(data, "cut-clipboard");
 }
 
+
 static void
-sw_copy_activated(GSimpleAction * action,
-                  GVariant      * parameter,
-                  gpointer        data)
+sw_copy_activated(GSimpleAction *action,
+                  GVariant      *parameter,
+                  gpointer       data)
 {
     clipboard_helper(data, "copy-clipboard");
 }
 
+
 static void
-sw_paste_activated(GSimpleAction * action,
-                   GVariant      * parameter,
-                   gpointer        data)
+sw_paste_activated(GSimpleAction *action,
+                   GVariant      *parameter,
+                   gpointer       data)
 {
     clipboard_helper(data, "paste-clipboard");
 }
 
+
 /*
  * More menu callbacks.
  */
 static void
-sw_select_text_activated(GSimpleAction * action,
-                         GVariant      * parameter,
-                         gpointer        data)
+sw_select_text_activated(GSimpleAction *action,
+                         GVariant      *parameter,
+                         gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
     balsa_window_select_all(GTK_WINDOW(bsmsg->window));
 }
 
+
 static void
-sw_wrap_body_activated(GSimpleAction * action,
-                       GVariant      * parameter,
-                       gpointer        data)
+sw_wrap_body_activated(GSimpleAction *action,
+                       GVariant      *parameter,
+                       gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -5804,8 +6229,11 @@ sw_wrap_body_activated(GSimpleAction * action,
     sw_wrap_body(bsmsg);
 }
 
+
 static void
-sw_reflow_activated(GSimpleAction * action, GVariant * parameter, gpointer data)
+sw_reflow_activated(GSimpleAction *action,
+                    GVariant      *parameter,
+                    gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
     GtkTextView *text_view;
@@ -5813,7 +6241,7 @@ sw_reflow_activated(GSimpleAction * action, GVariant * parameter, gpointer data)
     GRegex *rex;
 
     if (!bsmsg->flow)
-       return;
+        return;
 
     if (!(rex = balsa_quote_regex_new()))
         return;
@@ -5823,27 +6251,28 @@ sw_reflow_activated(GSimpleAction * action, GVariant * parameter, gpointer data)
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
     text_view = GTK_TEXT_VIEW(bsmsg->text);
-    buffer = gtk_text_view_get_buffer(text_view);
+    buffer    = gtk_text_view_get_buffer(text_view);
     sw_buffer_signals_block(bsmsg, buffer);
     libbalsa_unwrap_selection(buffer, rex);
     sw_buffer_signals_unblock(bsmsg, buffer);
 
     bsmsg->state = SENDMSG_STATE_MODIFIED;
     gtk_text_view_scroll_to_mark(text_view,
-                                gtk_text_buffer_get_insert(buffer),
-                                0, FALSE, 0, 0);
+                                 gtk_text_buffer_get_insert(buffer),
+                                 0, FALSE, 0, 0);
 
     g_regex_unref(rex);
 }
 
+
 /* To field "changed" signal callback. */
 static void
-check_readiness(BalsaSendmsg * bsmsg)
+check_readiness(BalsaSendmsg *bsmsg)
 {
     gboolean ready =
         libbalsa_address_view_n_addresses(bsmsg->recipient_view) > 0;
     if (ready
-        && libbalsa_address_view_n_addresses(bsmsg->replyto_view) < 0)
+        && (libbalsa_address_view_n_addresses(bsmsg->replyto_view) < 0))
         ready = FALSE;
 
     bsmsg->ready_to_send = ready;
@@ -5851,7 +6280,8 @@ check_readiness(BalsaSendmsg * bsmsg)
                            G_N_ELEMENTS(ready_actions), ready);
 }
 
-static const gchar * const header_action_names[] = {
+
+static const gchar *const header_action_names[] = {
     "from",
     "recips",
     "reply-to",
@@ -5863,10 +6293,10 @@ static const gchar * const header_action_names[] = {
    saves the show header configuration.
  */
 static void
-sw_entry_helper(GSimpleAction      * action,
-                GVariant     * state,
-                BalsaSendmsg * bsmsg,
-                GtkWidget    * entry[])
+sw_entry_helper(GSimpleAction *action,
+                GVariant      *state,
+                BalsaSendmsg  *bsmsg,
+                GtkWidget     *entry[])
 {
     if (g_variant_get_boolean(state)) {
         gtk_widget_show(entry[0]);
@@ -5897,40 +6327,55 @@ sw_entry_helper(GSimpleAction      * action,
     g_simple_action_set_state(action, state);
 }
 
+
 static void
-sw_from_change_state(GSimpleAction * action, GVariant * state, gpointer data)
+sw_from_change_state(GSimpleAction *action,
+                     GVariant      *state,
+                     gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
     sw_entry_helper(action, state, bsmsg, bsmsg->from);
 }
 
+
 static void
-sw_recips_change_state(GSimpleAction * action, GVariant * state, gpointer data)
+sw_recips_change_state(GSimpleAction *action,
+                       GVariant      *state,
+                       gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
     sw_entry_helper(action, state, bsmsg, bsmsg->recipients);
 }
 
+
 static void
-sw_reply_to_change_state(GSimpleAction * action, GVariant * state, gpointer data)
+sw_reply_to_change_state(GSimpleAction *action,
+                         GVariant      *state,
+                         gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
     sw_entry_helper(action, state, bsmsg, bsmsg->replyto);
 }
 
+
 static void
-sw_fcc_change_state(GSimpleAction * action, GVariant * state, gpointer data)
+sw_fcc_change_state(GSimpleAction *action,
+                    GVariant      *state,
+                    gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
     sw_entry_helper(action, state, bsmsg, bsmsg->fcc);
 }
 
+
 static void
-sw_request_mdn_change_state(GSimpleAction * action, GVariant * state, gpointer data)
+sw_request_mdn_change_state(GSimpleAction *action,
+                            GVariant      *state,
+                            gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -5939,8 +6384,11 @@ sw_request_mdn_change_state(GSimpleAction * action, GVariant * state, gpointer d
     g_simple_action_set_state(action, state);
 }
 
+
 static void
-sw_request_dsn_change_state(GSimpleAction * action, GVariant * state, gpointer data)
+sw_request_dsn_change_state(GSimpleAction *action,
+                            GVariant      *state,
+                            gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -5949,8 +6397,11 @@ sw_request_dsn_change_state(GSimpleAction * action, GVariant * state, gpointer d
     g_simple_action_set_state(action, state);
 }
 
+
 static void
-sw_show_toolbar_change_state(GSimpleAction * action, GVariant * state, gpointer data)
+sw_show_toolbar_change_state(GSimpleAction *action,
+                             GVariant      *state,
+                             gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -5963,8 +6414,11 @@ sw_show_toolbar_change_state(GSimpleAction * action, GVariant * state, gpointer
     g_simple_action_set_state(action, state);
 }
 
+
 static void
-sw_flowed_change_state(GSimpleAction * action, GVariant * state, gpointer data)
+sw_flowed_change_state(GSimpleAction *action,
+                       GVariant      *state,
+                       gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -5974,8 +6428,11 @@ sw_flowed_change_state(GSimpleAction * action, GVariant * state, gpointer data)
     g_simple_action_set_state(action, state);
 }
 
+
 static void
-sw_send_html_change_state(GSimpleAction * action, GVariant * state, gpointer data)
+sw_send_html_change_state(GSimpleAction *action,
+                          GVariant      *state,
+                          gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -5984,12 +6441,13 @@ sw_send_html_change_state(GSimpleAction * action, GVariant * state, gpointer dat
     g_simple_action_set_state(action, state);
 }
 
+
 #ifdef HAVE_GPGME
 static void
-sw_gpg_helper(GSimpleAction  * action,
-              GVariant       * state,
-              gpointer         data,
-              guint            mask)
+sw_gpg_helper(GSimpleAction *action,
+              GVariant      *state,
+              gpointer       data,
+              guint          mask)
 {
     BalsaSendmsg *bsmsg = data;
     gboolean butval, radio_on;
@@ -6006,20 +6464,29 @@ sw_gpg_helper(GSimpleAction  * action,
     g_simple_action_set_state(action, state);
 }
 
+
 static void
-sw_sign_change_state(GSimpleAction * action, GVariant * state, gpointer data)
+sw_sign_change_state(GSimpleAction *action,
+                     GVariant      *state,
+                     gpointer       data)
 {
     sw_gpg_helper(action, state, data, LIBBALSA_PROTECT_SIGN);
 }
 
+
 static void
-sw_encrypt_change_state(GSimpleAction * action, GVariant * state, gpointer data)
+sw_encrypt_change_state(GSimpleAction *action,
+                        GVariant      *state,
+                        gpointer       data)
 {
     sw_gpg_helper(action, state, data, LIBBALSA_PROTECT_ENCRYPT);
 }
 
+
 static void
-sw_att_pubkey_change_state(GSimpleAction * action, GVariant * state, gpointer data)
+sw_att_pubkey_change_state(GSimpleAction *action,
+                           GVariant      *state,
+                           gpointer       data)
 {
     BalsaSendmsg *bsmsg = (BalsaSendmsg *) data;
 
@@ -6027,23 +6494,24 @@ sw_att_pubkey_change_state(GSimpleAction * action, GVariant * state, gpointer da
     g_simple_action_set_state(action, state);
 }
 
+
 static void
-sw_gpg_mode_change_state(GSimpleAction  * action,
-                         GVariant       * state,
-                         gpointer         data)
+sw_gpg_mode_change_state(GSimpleAction *action,
+                         GVariant      *state,
+                         gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
     const gchar *mode;
     guint rfc_flag = 0;
 
     mode = g_variant_get_string(state, NULL);
-    if (strcmp(mode, "mime") == 0)
+    if (strcmp(mode, "mime") == 0) {
         rfc_flag = LIBBALSA_PROTECT_RFC3156;
-    else if (strcmp(mode, "open-pgp") == 0)
+    } else if (strcmp(mode, "open-pgp") == 0) {
         rfc_flag = LIBBALSA_PROTECT_OPENPGP;
-    else if (strcmp(mode, "smime") == 0)
+    } else if (strcmp(mode, "smime") == 0) {
         rfc_flag = LIBBALSA_PROTECT_SMIMEV3;
-    else {
+    } else {
         g_print("%s unknown mode ā€œ%sā€\n", __func__, mode);
         return;
     }
@@ -6053,15 +6521,17 @@ sw_gpg_mode_change_state(GSimpleAction  * action,
 
     g_simple_action_set_state(action, state);
 }
+
+
 #endif                          /* HAVE_GPGME */
 
 
 /* init_menus:
    performs the initial menu setup: shown headers as well as correct
    message charset.
-*/
+ */
 static void
-init_menus(BalsaSendmsg * bsmsg)
+init_menus(BalsaSendmsg *bsmsg)
 {
     unsigned i;
 
@@ -6075,10 +6545,10 @@ init_menus(BalsaSendmsg * bsmsg)
                 const gchar *old_action_name;
                 const gchar *new_action_name;
             } name_map[] = {
-                {"From",       "from"},
-                {"Recipients", "recips"},
-                {"ReplyTo",    "reply-to"},
-                {"Fcc",        "fcc"}
+                {"From",       "from"                                                                        
                              },
+                {"Recipients", "recips"                                                                      
                              },
+                {"ReplyTo",    "reply-to"                                                                    
                              },
+                {"Fcc",        "fcc"                                                                         
                              }
             };
             guint j;
 
@@ -6098,8 +6568,10 @@ init_menus(BalsaSendmsg * bsmsg)
     check_readiness(bsmsg);
 }
 
+
 static void
-set_locale(BalsaSendmsg * bsmsg, const gchar * locale)
+set_locale(BalsaSendmsg *bsmsg,
+           const gchar  *locale)
 {
 #if HAVE_GSPELL
     if (sw_action_get_enabled(bsmsg, "spell-check")) {
@@ -6111,9 +6583,9 @@ set_locale(BalsaSendmsg * bsmsg, const gchar * locale)
             GspellTextBuffer *gspell_buffer;
             GspellChecker *checker;
 
-            buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
+            buffer        = gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
             gspell_buffer = gspell_text_buffer_get_from_gtk_text_buffer(buffer);
-            checker = gspell_text_buffer_get_spell_checker(gspell_buffer);
+            checker       = gspell_text_buffer_get_spell_checker(gspell_buffer);
             gspell_checker_set_language(checker, language);
         }
     }
@@ -6130,48 +6602,50 @@ set_locale(BalsaSendmsg * bsmsg, const gchar * locale)
 #endif                          /* HAVE_GTKSPELL */
 }
 
+
 #if HAVE_GSPELL || HAVE_GTKSPELL
 /* spell_check_menu_cb
  *
  * Toggle the spell checker
  */
 static void
-sw_spell_check_change_state(GSimpleAction * action,
-                            GVariant      * state,
-                            gpointer        data)
+sw_spell_check_change_state(GSimpleAction *action,
+                            GVariant      *state,
+                            gpointer       data)
 {
     BalsaSendmsg *bsmsg = data;
-#if HAVE_GSPELL
+#   if HAVE_GSPELL
     GtkTextView *text_view;
     GspellTextView *gspell_view;
 
     balsa_app.spell_check_active = g_variant_get_boolean(state);
-    text_view = GTK_TEXT_VIEW(bsmsg->text);
-    gspell_view = gspell_text_view_get_from_gtk_text_view(text_view);
+    text_view                    = GTK_TEXT_VIEW(bsmsg->text);
+    gspell_view                  = gspell_text_view_get_from_gtk_text_view(text_view);
     gspell_text_view_set_inline_spell_checking(gspell_view,
                                                balsa_app.spell_check_active);
-#elif HAVE_GTKSPELL
+#   elif HAVE_GTKSPELL
 
     if ((balsa_app.spell_check_active = g_variant_get_boolean(state)))
         sw_spell_attach(bsmsg);
     else
         sw_spell_detach(bsmsg);
-#endif                          /* HAVE_GSPELL */
+#   endif                       /* HAVE_GSPELL */
 
     g_simple_action_set_state(action, state);
 }
 
+
 #else                           /* HAVE_GTKSPELL */
 /* spell_check_cb
  *
  * Start the spell check
  * */
 static void
-sw_spell_check_activated(GSimpleAction * action,
-                         GVariant      * parameter,
-                         gpointer        data)
+sw_spell_check_activated(GSimpleAction *action,
+                         GVariant      *parameter,
+                         gpointer       data)
 {
-    BalsaSendmsg *bsmsg = data;
+    BalsaSendmsg *bsmsg    = data;
     GtkTextView *text_view = GTK_TEXT_VIEW(bsmsg->text);
     BalsaSpellCheck *sc;
 
@@ -6179,39 +6653,44 @@ sw_spell_check_activated(GSimpleAction * action,
         if (gtk_widget_get_realized(bsmsg->spell_checker)) {
             gtk_window_present(GTK_WINDOW(bsmsg->spell_checker));
             return;
-        } else
+        } else {
             /* A spell checker was created, but not shown because of
              * errors; we'll destroy it, and create a new one. */
             gtk_widget_destroy(bsmsg->spell_checker);
+        }
     }
 
     sw_buffer_signals_disconnect(bsmsg);
 
     bsmsg->spell_checker = balsa_spell_check_new(GTK_WINDOW(bsmsg->window));
-    sc = BALSA_SPELL_CHECK(bsmsg->spell_checker);
+    sc                   = BALSA_SPELL_CHECK(bsmsg->spell_checker);
 
     /* configure the spell checker */
     balsa_spell_check_set_text(sc, text_view);
     balsa_spell_check_set_language(sc, bsmsg->spell_check_lang);
 
     g_object_weak_ref(G_OBJECT(sc),
-                     (GWeakNotify) sw_spell_check_weak_notify, bsmsg);
+                      (GWeakNotify) sw_spell_check_weak_notify, bsmsg);
     gtk_text_view_set_editable(text_view, FALSE);
 
     balsa_spell_check_start(sc);
 }
 
+
 static void
-sw_spell_check_weak_notify(BalsaSendmsg * bsmsg)
+sw_spell_check_weak_notify(BalsaSendmsg *bsmsg)
 {
     bsmsg->spell_checker = NULL;
     gtk_text_view_set_editable(GTK_TEXT_VIEW(bsmsg->text), TRUE);
     sw_buffer_signals_connect(bsmsg);
 }
+
+
 #endif                          /* HAVE_GTKSPELL */
 
 static void
-lang_set_cb(GtkWidget * w, BalsaSendmsg * bsmsg)
+lang_set_cb(GtkWidget    *w,
+            BalsaSendmsg *bsmsg)
 {
     if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))) {
         const gchar *lang;
@@ -6226,14 +6705,16 @@ lang_set_cb(GtkWidget * w, BalsaSendmsg * bsmsg)
     }
 }
 
+
 /* sendmsg_window_new_from_list:
  * like sendmsg_window_new, but takes a GList of messages, instead of a
  * single message;
  * called by compose_from_list (balsa-index.c)
  */
 BalsaSendmsg *
-sendmsg_window_new_from_list(LibBalsaMailbox * mailbox,
-                             GArray * selected, SendType type)
+sendmsg_window_new_from_list(LibBalsaMailbox *mailbox,
+                             GArray          *selected,
+                             SendType         type)
 {
     BalsaSendmsg *bsmsg;
     LibBalsaMessage *message;
@@ -6243,20 +6724,21 @@ sendmsg_window_new_from_list(LibBalsaMailbox * mailbox,
 
     g_return_val_if_fail(selected->len > 0, NULL);
 
-    msgno = g_array_index(selected, guint, 0);
+    msgno   = g_array_index(selected, guint, 0);
     message = libbalsa_mailbox_get_message(mailbox, msgno);
     if (!message)
         return NULL;
 
-    switch(type) {
+    switch (type) {
     case SEND_FORWARD_ATTACH:
     case SEND_FORWARD_INLINE:
         bsmsg = sendmsg_window_forward(mailbox, msgno,
                                        type == SEND_FORWARD_ATTACH);
         break;
+
     default:
         g_assert_not_reached(); /* since it hardly makes sense... */
-        bsmsg = NULL; /** silence invalid warnings */
+        bsmsg = NULL;           /** silence invalid warnings */
 
     }
     g_object_unref(message);
@@ -6264,14 +6746,14 @@ sendmsg_window_new_from_list(LibBalsaMailbox * mailbox,
     buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
 
     for (i = 1; i < selected->len; i++) {
-       msgno = g_array_index(selected, guint, i);
+        msgno   = g_array_index(selected, guint, i);
         message = libbalsa_mailbox_get_message(mailbox, msgno);
         if (!message)
             continue;
 
-        if (type == SEND_FORWARD_ATTACH)
+        if (type == SEND_FORWARD_ATTACH) {
             attach_message(bsmsg, message);
-        else if (type == SEND_FORWARD_INLINE) {
+        } else if (type == SEND_FORWARD_INLINE) {
             GString *body =
                 quote_message_body(bsmsg, message, QUOTE_NOPREFIX);
             gtk_text_buffer_insert_at_cursor(buffer, body->str, body->len);
@@ -6285,10 +6767,11 @@ sendmsg_window_new_from_list(LibBalsaMailbox * mailbox,
     return bsmsg;
 }
 
+
 /* set_list_post_address:
  * look for the address for posting messages to a list */
 static void
-set_list_post_address(BalsaSendmsg * bsmsg)
+set_list_post_address(BalsaSendmsg *bsmsg)
 {
     LibBalsaMessage *message =
         bsmsg->parent_message ?
@@ -6296,23 +6779,25 @@ set_list_post_address(BalsaSendmsg * bsmsg)
     const gchar *header;
 
     if ((header = libbalsa_message_get_user_header(message, "list-post"))
-       && set_list_post_rfc2369(bsmsg, header))
-       return;
+        && set_list_post_rfc2369(bsmsg, header))
+        return;
 
     /* we didn't find "list-post", so try some nonstandard
      * alternatives: */
 
     if ((header = libbalsa_message_get_user_header(message, "x-beenthere"))
         || (header =
-            libbalsa_message_get_user_header(message, "x-mailing-list")))
+                libbalsa_message_get_user_header(message, "x-mailing-list")))
         libbalsa_address_view_set_from_string(bsmsg->recipient_view, "To:",
                                               header);
 }
 
+
 /* set_list_post_rfc2369:
  * look for "List-Post:" header, and get the address */
 static gboolean
-set_list_post_rfc2369(BalsaSendmsg * bsmsg, const gchar * url)
+set_list_post_rfc2369(BalsaSendmsg *bsmsg,
+                      const gchar  *url)
 {
     /* RFC 2369: To allow for future extension, client
      * applications MUST follow the following guidelines for
@@ -6335,25 +6820,26 @@ set_list_post_rfc2369(BalsaSendmsg * bsmsg, const gchar * url)
      * left most protocol that it supports, or knows how to
      * access by a separate application. */
     while (*(url = rfc2822_skip_comments(url)) == '<') {
-       const gchar *close = strchr(++url, '>');
-       if (!close)
-           /* broken syntax--break and return FALSE */
-           break;
-       if (g_ascii_strncasecmp(url, "mailto:";, 7) == 0) {
-           /* we support mailto! */
+        const gchar *close = strchr(++url, '>');
+        if (!close)
+            /* broken syntax--break and return FALSE */
+            break;
+        if (g_ascii_strncasecmp(url, "mailto:";, 7) == 0) {
+            /* we support mailto! */
             gchar *field = g_strndup(&url[7], close - &url[7]);
-           sendmsg_window_process_url(field, sendmsg_window_set_field,
+            sendmsg_window_process_url(field, sendmsg_window_set_field,
                                        bsmsg);
             g_free(field);
-           return TRUE;
-       }
-       if (!(*++close && *(close = rfc2822_skip_comments(close)) == ','))
-           break;
-       url = ++close;
+            return TRUE;
+        }
+        if (!(*++close && (*(close = rfc2822_skip_comments(close)) == ',')))
+            break;
+        url = ++close;
     }
     return FALSE;
 }
 
+
 /* rfc2822_skip_comments:
  * skip CFWS (comments and folding white space)
  *
@@ -6363,30 +6849,32 @@ set_list_post_rfc2369(BalsaSendmsg * bsmsg, const gchar * url)
  * returns a pointer to the first character following the CFWS,
  * which may point to a '\0' character but is never a NULL pointer */
 static const gchar *
-rfc2822_skip_comments(const gchar * str)
+rfc2822_skip_comments(const gchar *str)
 {
     gint level = 0;
 
     while (*str) {
-        if (*str == '(')
+        if (*str == '(') {
             /* start of a comment--they nest */
             ++level;
-        else if (level > 0) {
+        } else if (level > 0) {
             if (*str == ')')
                 /* end of a comment */
                 --level;
-            else if (*str == '\\' && *++str == '\0')
+            else if ((*str == '\\') && (*++str == '\0'))
                 /* quoted-pair: we must test for the end of the string,
                  * which would be an error; in this case, return a
                  * pointer to the '\0' character following the '\\' */
                 break;
-        } else if (!(*str == ' ' || *str == '\t'))
+        } else if (!((*str == ' ') || (*str == '\t'))) {
             break;
+        }
         ++str;
     }
     return str;
 }
 
+
 /* Set the title for the compose window;
  *
  * handler for the "changed" signals of the "To:" address and the
@@ -6395,7 +6883,7 @@ rfc2822_skip_comments(const gchar * str)
  * also called directly from sendmsg_window_new.
  */
 static void
-sendmsg_window_set_title(BalsaSendmsg * bsmsg)
+sendmsg_window_set_title(BalsaSendmsg *bsmsg)
 {
     gchar *title_format;
     InternetAddressList *list;
@@ -6419,7 +6907,7 @@ sendmsg_window_set_title(BalsaSendmsg * bsmsg)
         break;
     }
 
-    list = libbalsa_address_view_get_list(bsmsg->recipient_view, "To:");
+    list      = libbalsa_address_view_get_list(bsmsg->recipient_view, "To:");
     to_string = internet_address_list_to_string(list, FALSE);
     g_object_unref(list);
 
@@ -6430,10 +6918,11 @@ sendmsg_window_set_title(BalsaSendmsg * bsmsg)
     g_free(title);
 }
 
+
 #ifdef HAVE_GPGME
 static void
-bsmsg_update_gpg_ui_on_ident_change(BalsaSendmsg * bsmsg,
-                                    LibBalsaIdentity * ident)
+bsmsg_update_gpg_ui_on_ident_change(BalsaSendmsg     *bsmsg,
+                                    LibBalsaIdentity *ident)
 {
     GAction *action;
 
@@ -6461,10 +6950,12 @@ bsmsg_update_gpg_ui_on_ident_change(BalsaSendmsg * bsmsg,
         bsmsg->gpg_mode |= LIBBALSA_PROTECT_OPENPGP;
         g_action_change_state(action, g_variant_new_string("open-pgp"));
         break;
+
     case LIBBALSA_PROTECT_SMIMEV3:
         bsmsg->gpg_mode |= LIBBALSA_PROTECT_SMIMEV3;
         g_action_change_state(action, g_variant_new_string("smime"));
         break;
+
     case LIBBALSA_PROTECT_RFC3156:
     default:
         bsmsg->gpg_mode |= LIBBALSA_PROTECT_RFC3156;
@@ -6472,6 +6963,7 @@ bsmsg_update_gpg_ui_on_ident_change(BalsaSendmsg * bsmsg,
     }
 }
 
+
 static void
 bsmsg_setup_gpg_ui(BalsaSendmsg *bsmsg)
 {
@@ -6481,14 +6973,16 @@ bsmsg_setup_gpg_ui(BalsaSendmsg *bsmsg)
     sw_action_set_enabled(bsmsg, "attpubkey", balsa_app.has_openpgp);
 }
 
+
 static void
-bsmsg_setup_gpg_ui_by_mode(BalsaSendmsg *bsmsg, gint mode)
+bsmsg_setup_gpg_ui_by_mode(BalsaSendmsg *bsmsg,
+                           gint          mode)
 {
     GAction *action;
 
     /* do nothing if we don't support crypto */
     if (!balsa_app.has_openpgp && !balsa_app.has_smime)
-       return;
+        return;
 
     bsmsg->gpg_mode = mode;
     sw_action_set_active(bsmsg, "sign", mode & LIBBALSA_PROTECT_SIGN);
@@ -6502,92 +6996,121 @@ bsmsg_setup_gpg_ui_by_mode(BalsaSendmsg *bsmsg, gint mode)
     else
         g_action_change_state(action, g_variant_new_string("mime"));
 }
+
+
 #endif /* HAVE_GPGME */
 
 static GActionEntry win_entries[] = {
-    {"include-file",     sw_include_file_activated      },
-    {"attach-file",      sw_attach_file_activated       },
-    {"include-messages", sw_include_messages_activated  },
-    {"attach-messages",  sw_attach_messages_activated   },
-    {"send",             sw_send_activated              },
-    {"queue",            sw_queue_activated             },
-    {"postpone",         sw_postpone_activated          },
-    {"save",             sw_save_activated              },
-    {"page-setup",       sw_page_setup_activated        },
-    {"print",            sw_print_activated             },
-    {"close",            sw_close_activated             },
-    {"undo",             sw_undo_activated              },
-    {"redo",             sw_redo_activated              },
-    {"cut",              sw_cut_activated               },
-    {"copy",             sw_copy_activated              },
-    {"paste",            sw_paste_activated             },
-    {"select-all",       sw_select_text_activated       },
-    {"wrap-body",        sw_wrap_body_activated         },
-    {"reflow",           sw_reflow_activated            },
-    {"insert-sig",       sw_insert_sig_activated        },
-    {"quote",            sw_quote_activated             },
+    {"include-file",
+     sw_include_file_activated                                             },
+    {"attach-file",
+     sw_attach_file_activated                                              },
+    {"include-messages",
+     sw_include_messages_activated                                         },
+    {"attach-messages",
+     sw_attach_messages_activated                                          },
+    {"send",
+     sw_send_activated                                                     },
+    {"queue",
+     sw_queue_activated                                                    },
+    {"postpone",
+     sw_postpone_activated                                                 },
+    {"save",
+     sw_save_activated                                                     },
+    {"page-setup",
+     sw_page_setup_activated                                               },
+    {"print",
+     sw_print_activated                                                    },
+    {"close",
+     sw_close_activated                                                    },
+    {"undo",
+     sw_undo_activated                                                     },
+    {"redo",
+     sw_redo_activated                                                     },
+    {"cut",
+     sw_cut_activated                                                      },
+    {"copy",
+     sw_copy_activated                                                     },
+    {"paste",
+     sw_paste_activated                                                    },
+    {"select-all",
+     sw_select_text_activated                                              },
+    {"wrap-body",
+     sw_wrap_body_activated                                                },
+    {"reflow",
+     sw_reflow_activated                                                   },
+    {"insert-sig",
+     sw_insert_sig_activated                                               },
+    {"quote",
+     sw_quote_activated                                                    },
 #if HAVE_GSPELL || HAVE_GTKSPELL
-    {"spell-check",      libbalsa_toggle_activated, NULL, "false",
-                         sw_spell_check_change_state    },
+    {"spell-check",     libbalsa_toggle_activated,              NULL,              "false",
+     sw_spell_check_change_state    },
 #else                           /* HAVE_GTKSPELL */
-    {"spell-check",      sw_spell_check_activated       },
+    {"spell-check",
+     sw_spell_check_activated                                              },
 #endif                          /* HAVE_GTKSPELL */
-    {"select-ident",     sw_select_ident_activated      },
-    {"edit",             sw_edit_activated              },
-    {"show-toolbar",     libbalsa_toggle_activated, NULL, "false",
-                         sw_show_toolbar_change_state   },
-    {"from",             libbalsa_toggle_activated, NULL, "false",
-                         sw_from_change_state           },
-    {"recips",           libbalsa_toggle_activated, NULL, "false",
-                         sw_recips_change_state         },
-    {"reply-to",         libbalsa_toggle_activated, NULL, "false",
-                         sw_reply_to_change_state       },
-    {"fcc",              libbalsa_toggle_activated, NULL, "false",
-                         sw_fcc_change_state            },
-    {"request-mdn",      libbalsa_toggle_activated, NULL, "false",
-                         sw_request_mdn_change_state    },
-    {"request-dsn",      libbalsa_toggle_activated, NULL, "false",
-                         sw_request_dsn_change_state    },
-    {"flowed",           libbalsa_toggle_activated, NULL, "false",
-                         sw_flowed_change_state         },
-    {"send-html",        libbalsa_toggle_activated, NULL, "false",
-                         sw_send_html_change_state      },
+    {"select-ident",
+     sw_select_ident_activated                                             },
+    {"edit",
+     sw_edit_activated                                                     },
+    {"show-toolbar",    libbalsa_toggle_activated,              NULL,              "false",
+     sw_show_toolbar_change_state   },
+    {"from",            libbalsa_toggle_activated,              NULL,              "false",
+     sw_from_change_state           },
+    {"recips",          libbalsa_toggle_activated,              NULL,              "false",
+     sw_recips_change_state         },
+    {"reply-to",        libbalsa_toggle_activated,              NULL,              "false",
+     sw_reply_to_change_state       },
+    {"fcc",             libbalsa_toggle_activated,              NULL,              "false",
+     sw_fcc_change_state            },
+    {"request-mdn",     libbalsa_toggle_activated,              NULL,              "false",
+     sw_request_mdn_change_state    },
+    {"request-dsn",     libbalsa_toggle_activated,              NULL,              "false",
+     sw_request_dsn_change_state    },
+    {"flowed",          libbalsa_toggle_activated,              NULL,              "false",
+     sw_flowed_change_state         },
+    {"send-html",       libbalsa_toggle_activated,              NULL,              "false",
+     sw_send_html_change_state      },
 #ifdef HAVE_GPGME
-    {"sign",             libbalsa_toggle_activated, NULL, "false",
-                         sw_sign_change_state           },
-    {"encrypt",          libbalsa_toggle_activated, NULL, "false",
-                         sw_encrypt_change_state        },
-    {"gpg-mode",         libbalsa_radio_activated, "s", "'mime'",
-                         sw_gpg_mode_change_state       },
-    {"gpg-mode",         libbalsa_radio_activated, "s", "'open-pgp'",
-                         sw_gpg_mode_change_state       },
-    {"gpg-mode",         libbalsa_radio_activated, "s", "'smime'",
-                         sw_gpg_mode_change_state       },
-       {"attpubkey",        libbalsa_toggle_activated, NULL, "false",
-                                                sw_att_pubkey_change_state     },
+    {"sign",            libbalsa_toggle_activated,              NULL,              "false",
+     sw_sign_change_state           },
+    {"encrypt",         libbalsa_toggle_activated,              NULL,              "false",
+     sw_encrypt_change_state        },
+    {"gpg-mode",        libbalsa_radio_activated,               "s",               "'mime'",
+     sw_gpg_mode_change_state       },
+    {"gpg-mode",        libbalsa_radio_activated,               "s",               "'open-pgp'",
+     sw_gpg_mode_change_state       },
+    {"gpg-mode",        libbalsa_radio_activated,               "s",               "'smime'",
+     sw_gpg_mode_change_state       },
+    {"attpubkey",       libbalsa_toggle_activated,              NULL,              "false",
+     sw_att_pubkey_change_state     },
 #endif /* HAVE_GPGME */
     /* Only a toolbar button: */
-    {"toolbar-send",     sw_toolbar_send_activated      }
+    {"toolbar-send",    sw_toolbar_send_activated                                             }
 };
 
 void
-sendmsg_window_add_action_entries(GActionMap * action_map)
+sendmsg_window_add_action_entries(GActionMap *action_map)
 {
     g_action_map_add_action_entries(action_map, win_entries,
                                     G_N_ELEMENTS(win_entries), action_map);
 }
 
+
 static void
-sw_menubar_foreach(GtkWidget *widget, gpointer data)
+sw_menubar_foreach(GtkWidget *widget,
+                   gpointer   data)
 {
     GtkWidget **lang_menu = data;
-    GtkMenuItem *item = GTK_MENU_ITEM(widget);
+    GtkMenuItem *item     = GTK_MENU_ITEM(widget);
 
     if (strcmp(gtk_menu_item_get_label(item), _("_Language")) == 0)
         *lang_menu = widget;
 }
 
-static BalsaSendmsg*
+
+static BalsaSendmsg *
 sendmsg_window_new()
 {
     BalsaToolbarModel *model;
@@ -6603,19 +7126,19 @@ sendmsg_window_new()
     gchar *ui_file;
     const gchar *current_locale;
 
-    bsmsg = g_malloc(sizeof(BalsaSendmsg));
-    bsmsg->in_reply_to = NULL;
-    bsmsg->references = NULL;
+    bsmsg                   = g_malloc(sizeof(BalsaSendmsg));
+    bsmsg->in_reply_to      = NULL;
+    bsmsg->references       = NULL;
     bsmsg->spell_check_lang = NULL;
-    bsmsg->fcc_url  = NULL;
-    bsmsg->insert_mark = NULL;
-    bsmsg->ident = balsa_app.current_ident;
-    bsmsg->update_config = FALSE;
-    bsmsg->quit_on_close = FALSE;
-    bsmsg->state = SENDMSG_STATE_CLEAN;
+    bsmsg->fcc_url          = NULL;
+    bsmsg->insert_mark      = NULL;
+    bsmsg->ident            = balsa_app.current_ident;
+    bsmsg->update_config    = FALSE;
+    bsmsg->quit_on_close    = FALSE;
+    bsmsg->state            = SENDMSG_STATE_CLEAN;
 
     bsmsg->window = window =
-        gtk_application_window_new(balsa_app.application);
+            gtk_application_window_new(balsa_app.application);
 
     /*
      * restore the SendMsg window size
@@ -6631,26 +7154,26 @@ sendmsg_window_new()
     gtk_container_add(GTK_CONTAINER(window), main_box);
     gtk_widget_show(window);
 
-    bsmsg->type = SEND_NORMAL;
+    bsmsg->type        = SEND_NORMAL;
     bsmsg->is_continue = FALSE;
 #if !HAVE_GTKSPELL && !HAVE_GSPELL
     bsmsg->spell_checker = NULL;
 #endif                          /* HAVE_GTKSPELL */
 #ifdef HAVE_GPGME
-    bsmsg->gpg_mode = LIBBALSA_PROTECT_RFC3156;
+    bsmsg->gpg_mode      = LIBBALSA_PROTECT_RFC3156;
     bsmsg->attach_pubkey = FALSE;
 #endif
     bsmsg->autosave_timeout_id = /* autosave every 5 minutes */
-        g_timeout_add_seconds(60*5, (GSourceFunc)sw_autosave_timeout_cb, bsmsg);
+        g_timeout_add_seconds(60 * 5, (GSourceFunc)sw_autosave_timeout_cb, bsmsg);
 
-    bsmsg->draft_message = NULL;
+    bsmsg->draft_message  = NULL;
     bsmsg->parent_message = NULL;
     g_signal_connect(window, "close-request",
-                    G_CALLBACK(close_request_cb), bsmsg);
+                     G_CALLBACK(close_request_cb), bsmsg);
     g_signal_connect(G_OBJECT(window), "destroy",
-                    G_CALLBACK(destroy_event_cb), bsmsg);
+                     G_CALLBACK(destroy_event_cb), bsmsg);
     g_signal_connect(G_OBJECT(window), "size_allocate",
-                    G_CALLBACK(sw_size_alloc_cb), NULL);
+                     G_CALLBACK(sw_size_alloc_cb), NULL);
     /* If any compose windows are open when Balsa is closed, we want
      * them also to be closed. */
     g_object_weak_ref(G_OBJECT(balsa_app.main_window),
@@ -6682,11 +7205,10 @@ sendmsg_window_new()
     gtk_container_foreach(GTK_CONTAINER(menubar), sw_menubar_foreach,
                           &bsmsg->current_language_menu);
     current_locale = create_lang_menu(bsmsg->current_language_menu, bsmsg);
-    if (current_locale == NULL) {
+    if (current_locale == NULL)
         sw_action_set_enabled(bsmsg, "spell-check", FALSE);
-    }
 
-    model = sendmsg_window_get_toolbar_model();
+    model          = sendmsg_window_get_toolbar_model();
     bsmsg->toolbar = balsa_toolbar_new(model, G_ACTION_MAP(window));
     gtk_box_pack_start(GTK_BOX(main_box), bsmsg->toolbar);
 
@@ -6695,7 +7217,7 @@ sendmsg_window_new()
     bsmsg->send_mp_alt = FALSE;
 
     sw_action_set_enabled(bsmsg, "select-ident",
-                     balsa_app.identities->next != NULL);
+                          balsa_app.identities->next != NULL);
     bsmsg->identities_changed_id =
         g_signal_connect_swapped(balsa_app.main_window, "identities-changed",
                                  (GCallback)bsmsg_identities_changed_cb,
@@ -6739,7 +7261,7 @@ sendmsg_window_new()
 
 #if HAVE_GTKSOURCEVIEW
     source_buffer = GTK_SOURCE_BUFFER(gtk_text_view_get_buffer
-                                      (GTK_TEXT_VIEW(bsmsg->text)));
+                                          (GTK_TEXT_VIEW(bsmsg->text)));
     gtk_source_buffer_begin_not_undoable_action(source_buffer);
     gtk_source_buffer_end_not_undoable_action(source_buffer);
     sw_action_set_enabled(bsmsg, "undo", FALSE);
@@ -6751,23 +7273,24 @@ sendmsg_window_new()
     bsmsg->update_config = TRUE;
 
     bsmsg->delete_sig_id =
-       g_signal_connect(G_OBJECT(balsa_app.main_window), "close-request",
-                        G_CALLBACK(close_request_cb), bsmsg);
+        g_signal_connect(G_OBJECT(balsa_app.main_window), "close-request",
+                         G_CALLBACK(close_request_cb), bsmsg);
 
     setup_headers_from_identity(bsmsg, bsmsg->ident);
 
     /* Finish setting up the spell checker */
 #if HAVE_GSPELL || HAVE_GTKSPELL
-    if (current_locale != NULL) {
+    if (current_locale != NULL)
         sw_action_set_active(bsmsg, "spell-check", balsa_app.spell_check_active);
-    }
+
 #endif
     set_locale(bsmsg, current_locale);
 
     return bsmsg;
 }
 
-BalsaSendmsg*
+
+BalsaSendmsg *
 sendmsg_window_compose(void)
 {
     BalsaSendmsg *bsmsg = sendmsg_window_new();
@@ -6781,8 +7304,9 @@ sendmsg_window_compose(void)
     return bsmsg;
 }
 
-BalsaSendmsg*
-sendmsg_window_compose_with_address(const gchar * address)
+
+BalsaSendmsg *
+sendmsg_window_compose_with_address(const gchar *address)
 {
     BalsaSendmsg *bsmsg = sendmsg_window_compose();
     libbalsa_address_view_add_from_string(bsmsg->recipient_view,
@@ -6790,9 +7314,11 @@ sendmsg_window_compose_with_address(const gchar * address)
     return bsmsg;
 }
 
+
 BalsaSendmsg *
-sendmsg_window_reply(LibBalsaMailbox * mailbox, guint msgno,
-                     SendType reply_type)
+sendmsg_window_reply(LibBalsaMailbox *mailbox,
+                     guint            msgno,
+                     SendType         reply_type)
 {
     LibBalsaMessage *message;
     LibBalsaMessageHeaders *headers;
@@ -6806,12 +7332,15 @@ sendmsg_window_reply(LibBalsaMailbox * mailbox, guint msgno,
     headers = libbalsa_message_get_headers(message);
 
     bsmsg = sendmsg_window_new();
-    switch(reply_type) {
+    switch (reply_type) {
     case SEND_REPLY:
     case SEND_REPLY_ALL:
     case SEND_REPLY_GROUP:
-        bsmsg->type = reply_type;       break;
-    default: printf("reply_type: %d\n", reply_type); g_assert_not_reached();
+        bsmsg->type = reply_type;
+        break;
+
+    default: printf("reply_type: %d\n", reply_type);
+        g_assert_not_reached();
     }
     bsmsg->parent_message = message;
     set_identity(bsmsg, message);
@@ -6826,12 +7355,12 @@ sendmsg_window_reply(LibBalsaMailbox * mailbox, guint msgno,
     if (reply_type == SEND_REPLY_ALL)
         set_cc_from_all_recipients(bsmsg, headers);
 
-    references = libbalsa_message_get_references(message);
+    references  = libbalsa_message_get_references(message);
     in_reply_to = libbalsa_message_get_in_reply_to(message);
     set_references_reply(bsmsg, references,
                          in_reply_to != NULL ? in_reply_to->data : NULL,
                          message_id);
-    if(balsa_app.autoquote)
+    if (balsa_app.autoquote)
         fill_body_from_message(bsmsg, message, QUOTE_ALL);
     if (libbalsa_identity_get_sig_whenreply(bsmsg->ident))
         insert_initial_sig(bsmsg);
@@ -6841,9 +7370,10 @@ sendmsg_window_reply(LibBalsaMailbox * mailbox, guint msgno,
     return bsmsg;
 }
 
-BalsaSendmsg*
+
+BalsaSendmsg *
 sendmsg_window_reply_embedded(LibBalsaMessageBody *part,
-                              SendType reply_type)
+                              SendType             reply_type)
 {
     BalsaSendmsg *bsmsg = sendmsg_window_new();
     LibBalsaMessageHeaders *headers;
@@ -6851,19 +7381,22 @@ sendmsg_window_reply_embedded(LibBalsaMessageBody *part,
     g_assert(part);
     g_return_val_if_fail(part->embhdrs, bsmsg);
 
-    switch(reply_type) {
+    switch (reply_type) {
     case SEND_REPLY:
     case SEND_REPLY_ALL:
     case SEND_REPLY_GROUP:
-        bsmsg->type = reply_type;       break;
-    default: printf("reply_type: %d\n", reply_type); g_assert_not_reached();
+        bsmsg->type = reply_type;
+        break;
+
+    default: printf("reply_type: %d\n", reply_type);
+        g_assert_not_reached();
     }
     bsm_prepare_for_setup(g_object_ref(part->message));
     headers = part->embhdrs;
     /* To: */
     set_to(bsmsg, headers);
 
-    if(part->embhdrs) {
+    if (part->embhdrs) {
         const gchar *message_id =
             libbalsa_message_header_get_one(part->embhdrs, "Message-Id");
         const gchar *in_reply_to =
@@ -6890,9 +7423,11 @@ sendmsg_window_reply_embedded(LibBalsaMessageBody *part,
     return bsmsg;
 }
 
-BalsaSendmsg*
-sendmsg_window_forward(LibBalsaMailbox *mailbox, guint msgno,
-                       gboolean attach)
+
+BalsaSendmsg *
+sendmsg_window_forward(LibBalsaMailbox *mailbox,
+                       guint            msgno,
+                       gboolean         attach)
 {
     LibBalsaMessage *message;
     BalsaSendmsg *bsmsg;
@@ -6901,15 +7436,16 @@ sendmsg_window_forward(LibBalsaMailbox *mailbox, guint msgno,
     message = libbalsa_mailbox_get_message(mailbox, msgno);
     g_assert(message != NULL);
 
-    bsmsg = sendmsg_window_new();
+    bsmsg       = sendmsg_window_new();
     bsmsg->type = attach ? SEND_FORWARD_ATTACH : SEND_FORWARD_INLINE;
-    body_list = libbalsa_message_get_body_list(message);
+    body_list   = libbalsa_message_get_body_list(message);
     if (attach) {
-       if(!attach_message(bsmsg, message))
+        if (!attach_message(bsmsg, message)) {
             balsa_information_parented(GTK_WINDOW(bsmsg->window),
                                        LIBBALSA_INFORMATION_WARNING,
                                        _("Attaching message failed.\n"
                                          "Possible reason: not enough temporary space"));
+        }
         bsmsg->state = SENDMSG_STATE_CLEAN;
         bsmsg_set_subject_from_body(bsmsg, body_list, bsmsg->ident);
     } else {
@@ -6919,7 +7455,7 @@ sendmsg_window_forward(LibBalsaMailbox *mailbox, guint msgno,
     }
     if (libbalsa_identity_get_sig_whenforward(bsmsg->ident))
         insert_initial_sig(bsmsg);
-    if(!attach) {
+    if (!attach) {
         GtkTextBuffer *buffer =
             gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
         GtkTextIter pos;
@@ -6928,12 +7464,14 @@ sendmsg_window_forward(LibBalsaMailbox *mailbox, guint msgno,
         gtk_text_buffer_insert_at_cursor(buffer, "\n", 1);
         gtk_text_buffer_get_start_iter(buffer, &pos);
         gtk_text_buffer_place_cursor(buffer, &pos);
-     }
+    }
     return bsmsg;
 }
 
-BalsaSendmsg*
-sendmsg_window_continue(LibBalsaMailbox * mailbox, guint msgno)
+
+BalsaSendmsg *
+sendmsg_window_continue(LibBalsaMailbox *mailbox,
+                        guint            msgno)
 {
     LibBalsaMessage *message;
     BalsaSendmsg *bsmsg;
@@ -6951,7 +7489,7 @@ sendmsg_window_continue(LibBalsaMailbox * mailbox, guint msgno)
         return NULL;
     }
 
-    bsmsg = sendmsg_window_new();
+    bsmsg              = sendmsg_window_new();
     bsmsg->is_continue = TRUE;
     bsm_prepare_for_setup(message);
     bsmsg->draft_message = message;
@@ -6970,24 +7508,24 @@ sendmsg_window_continue(LibBalsaMailbox * mailbox, guint msgno)
 
 #ifdef HAVE_GPGME
     if ((postpone_hdr =
-         libbalsa_message_get_user_header(message, "X-Balsa-Crypto")))
+             libbalsa_message_get_user_header(message, "X-Balsa-Crypto")))
         bsmsg_setup_gpg_ui_by_mode(bsmsg, atoi(postpone_hdr));
     postpone_hdr = libbalsa_message_get_user_header(message, "X-Balsa-Att-Pubkey");
-    if (postpone_hdr != NULL) {
-       sw_action_set_active(bsmsg, "attpubkey", atoi(postpone_hdr) != 0);
-    }
+    if (postpone_hdr != NULL)
+        sw_action_set_active(bsmsg, "attpubkey", atoi(postpone_hdr) != 0);
+
 #endif
     if ((postpone_hdr =
-         libbalsa_message_get_user_header(message, "X-Balsa-MDN")))
+             libbalsa_message_get_user_header(message, "X-Balsa-MDN")))
         sw_action_set_active(bsmsg, "request-mdn", atoi(postpone_hdr) != 0);
     if ((postpone_hdr =
-         libbalsa_message_get_user_header(message, "X-Balsa-DSN")))
+             libbalsa_message_get_user_header(message, "X-Balsa-DSN")))
         sw_action_set_active(bsmsg, "request-dsn", atoi(postpone_hdr) != 0);
     if ((postpone_hdr =
-         libbalsa_message_get_user_header(message, "X-Balsa-Lang"))) {
+             libbalsa_message_get_user_header(message, "X-Balsa-Lang"))) {
         GtkWidget *langs =
             gtk_menu_item_get_submenu(GTK_MENU_ITEM
-                                      (bsmsg->current_language_menu));
+                                          (bsmsg->current_language_menu));
         GList *children =
             gtk_container_get_children(GTK_CONTAINER(langs));
         set_locale(bsmsg, postpone_hdr);
@@ -7003,13 +7541,13 @@ sendmsg_window_continue(LibBalsaMailbox * mailbox, guint msgno)
         g_list_free(children);
     }
     if ((postpone_hdr =
-         libbalsa_message_get_user_header(message, "X-Balsa-Format")))
+             libbalsa_message_get_user_header(message, "X-Balsa-Format")))
         sw_action_set_active(bsmsg, "flowed", strcmp(postpone_hdr, "Fixed"));
     if ((postpone_hdr =
-         libbalsa_message_get_user_header(message, "X-Balsa-MP-Alt")))
+             libbalsa_message_get_user_header(message, "X-Balsa-MP-Alt")))
         sw_action_set_active(bsmsg, "send-html", !strcmp(postpone_hdr, "yes"));
     if ((postpone_hdr =
-         libbalsa_message_get_user_header(message, "X-Balsa-Send-Type")))
+             libbalsa_message_get_user_header(message, "X-Balsa-Send-Type")))
         bsmsg->type = atoi(postpone_hdr);
 
     list = libbalsa_message_get_references(message);
@@ -7025,3 +7563,26 @@ sendmsg_window_continue(LibBalsaMailbox * mailbox, guint msgno)
                g_object_ref(bsmsg->text));
     return bsmsg;
 }
+
+
+/*
+ * Getter
+ */
+
+GtkWidget *
+sendmsg_window_get_window(BalsaSendmsg *bsmsg)
+{
+    return bsmsg->window;
+}
+
+
+/*
+ * Setter
+ */
+
+void
+sendmsg_window_set_quit_on_close(BalsaSendmsg *bsmsg,
+                                 gboolean      quit_on_close)
+{
+    bsmsg->quit_on_close = quit_on_close;
+}
diff --git a/src/sendmsg-window.h b/src/sendmsg-window.h
index e77aa4a..94fa9f8 100644
--- a/src/sendmsg-window.h
+++ b/src/sendmsg-window.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option) 
+ * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
- *  
+ *
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of 
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *  
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -21,7 +21,7 @@
 #define __BALSA_SENDMSG_H__
 
 #ifndef BALSA_VERSION
-# error "Include config.h before this file."
+#   error "Include config.h before this file."
 #endif
 
 #include "libbalsa.h"
@@ -30,118 +30,70 @@
 
 G_BEGIN_DECLS
 
-    typedef enum {
-       SEND_NORMAL,            /* initialized by Compose */
-       SEND_REPLY,             /* by Reply               */
-       SEND_REPLY_ALL,         /* by Reply All           */
-       SEND_REPLY_GROUP,       /* by Reply to Group      */
-       SEND_FORWARD_ATTACH,    /* by Forward attached    */
-       SEND_FORWARD_INLINE,    /* by Forward inline      */
-       SEND_CONTINUE           /* by Continue postponed  */
-    } SendType;
-
-    typedef enum {
-        SENDMSG_STATE_CLEAN,
-        SENDMSG_STATE_MODIFIED,
-        SENDMSG_STATE_AUTO_SAVED
-    } SendmsgState;
+typedef enum {
+    SEND_NORMAL,               /* initialized by Compose */
+    SEND_REPLY,                /* by Reply               */
+    SEND_REPLY_ALL,            /* by Reply All           */
+    SEND_REPLY_GROUP,          /* by Reply to Group      */
+    SEND_FORWARD_ATTACH,       /* by Forward attached    */
+    SEND_FORWARD_INLINE,       /* by Forward inline      */
+    SEND_CONTINUE              /* by Continue postponed  */
+} SendType;
 
 #define VIEW_MENU_LENGTH 5
 
-    typedef struct _BalsaSendmsg BalsaSendmsg;
-
-    struct _BalsaSendmsg {
-       GtkWidget *window;
-       GtkWidget *toolbar;
-        LibBalsaAddressView *recipient_view, *replyto_view;
-       GtkWidget *from[2], *recipients[2], *subject[2], *fcc[2];
-       GtkWidget *replyto[2];
-       GtkWidget *tree_view;
-        gchar *in_reply_to;
-        GList *references;
-       GtkWidget *text;
-#if !HAVE_GTKSPELL
-       GtkWidget *spell_checker;
-#endif                          /* HAVE_GTKSPELL */
-       GtkWidget *notebook;
-       LibBalsaMessage *parent_message; /* to which we're replying     */
-       LibBalsaMessage *draft_message;  /* where the message was saved */
-       SendType type;
-        gboolean is_continue;
-       /* language selection related data */
-       gchar *spell_check_lang;
-       GtkWidget *current_language_menu;
-       /* identity related data */
-       LibBalsaIdentity* ident;
-        /* fcc mailbox */
-        gchar *fcc_url;
-       gboolean update_config; /* is the window being set up or in normal  */
-                               /* operation and user actions should update */
-                               /* the config */
-       gulong delete_sig_id;
-        gulong changed_sig_id;
-#if !HAVE_GTKSOURCEVIEW
-        gulong delete_range_sig_id;
-#endif                          /* HAVE_GTKSOURCEVIEW */
-        gulong insert_text_sig_id;
-        guint autosave_timeout_id;
-        SendmsgState state;
-        gulong identities_changed_id;
-       gboolean flow;          /* send format=flowed */ 
-       gboolean send_mp_alt;   /* send multipart/alternative (plain and html) */ 
-       gboolean req_mdn;        /* send a MDN */
-       gboolean req_dsn;        /* send a delivery status notification */
-       gboolean quit_on_close; /* quit balsa after the compose window */
-                               /* is closed.                          */
-#ifdef HAVE_GPGME
-       guint gpg_mode;
-       gboolean attach_pubkey;
-#endif
-
-#if !HAVE_GTKSOURCEVIEW
-        GtkTextBuffer *buffer2;       /* Undo buffer. */
-#endif                          /* HAVE_GTKSOURCEVIEW */
-
-        /* To update cursor after text is inserted. */
-        GtkTextMark *insert_mark;
-
-        GtkWidget *paned;
-        gboolean ready_to_send;
-    };
-
-    BalsaSendmsg *sendmsg_window_compose(void);
-    BalsaSendmsg *sendmsg_window_compose_with_address(const gchar *
-                                                      address);
-    BalsaSendmsg *sendmsg_window_reply(LibBalsaMailbox *,
-                                       guint msgno, SendType rt);
-    BalsaSendmsg *sendmsg_window_reply_embedded(LibBalsaMessageBody *part,
-                                                SendType reply_type);
-
-    BalsaSendmsg *sendmsg_window_forward(LibBalsaMailbox *,
-                                         guint msgno, gboolean attach);
-    BalsaSendmsg *sendmsg_window_continue(LibBalsaMailbox *,
-                                          guint msgno);
-
-    void sendmsg_window_set_field(BalsaSendmsg *bsmsg, const gchar* key,
-                                  const gchar* val);
-
-    gboolean add_attachment(BalsaSendmsg * bsmsg,
-                            const gchar *filename, 
-                            gboolean is_a_tmp_file, 
-                            const gchar *forced_mime_type);
+typedef struct _BalsaSendmsg BalsaSendmsg;
+
+BalsaSendmsg *sendmsg_window_compose(void);
+BalsaSendmsg *sendmsg_window_compose_with_address(const gchar *
+                                                  address);
+BalsaSendmsg *sendmsg_window_reply(LibBalsaMailbox *,
+                                   guint    msgno,
+                                   SendType rt);
+BalsaSendmsg *sendmsg_window_reply_embedded(LibBalsaMessageBody *part,
+                                            SendType             reply_type);
+
+BalsaSendmsg *sendmsg_window_forward(LibBalsaMailbox *,
+                                     guint    msgno,
+                                     gboolean attach);
+BalsaSendmsg *sendmsg_window_continue(LibBalsaMailbox *,
+                                      guint msgno);
+
+void sendmsg_window_set_field(BalsaSendmsg *bsmsg,
+                              const gchar  *key,
+                              const gchar  *val);
+
+gboolean add_attachment(BalsaSendmsg *bsmsg,
+                        const gchar  *filename,
+                        gboolean      is_a_tmp_file,
+                        const gchar  *forced_mime_type);
+
+typedef void (*field_setter)(BalsaSendmsg *d,
+                             const gchar *,
+                             const gchar *);
+
+void sendmsg_window_process_url(const char  *url,
+                                field_setter func,
+                                void        *data);
+BalsaSendmsg *sendmsg_window_new_from_list(LibBalsaMailbox *mailbox,
+                                           GArray          *selected,
+                                           SendType         type);
+BalsaToolbarModel *sendmsg_window_get_toolbar_model(void);
+void               sendmsg_window_add_action_entries(GActionMap *action_map);
+
+/*
+ * Getter
+ */
 
-    typedef void (*field_setter)(BalsaSendmsg *d, const gchar*, const gchar*);
+GtkWidget *sendmsg_window_get_window(BalsaSendmsg *bsmsg);
 
-    void sendmsg_window_process_url(const char *url, field_setter func,
-                                   void *data);
-    BalsaSendmsg *sendmsg_window_new_from_list(LibBalsaMailbox * mailbox,
-                                               GArray * selected,
-                                               SendType type);
-    BalsaToolbarModel *sendmsg_window_get_toolbar_model(void);
-    void sendmsg_window_add_action_entries(GActionMap * action_map);
+/*
+ * Setter
+ */
 
-#define SENDMSG_WINDOW_QUIT_ON_CLOSE(bsmsg) ((bsmsg)->quit_on_close=TRUE)
+void sendmsg_window_set_quit_on_close(BalsaSendmsg *bsmsg,
+                                      gboolean      quit_on_close);
 
 G_END_DECLS
 
-#endif                         /* __BALSA_SENDMSG_H__ */
+#endif                          /* __BALSA_SENDMSG_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]