[balsa/wip/gtk4: 304/351] print-object: declare it final and private



commit fd2ca3a6966cae045f14387dfbba3f8c886c88bb
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sat Apr 28 22:12:56 2018 -0400

    print-object: declare it final and private
    
    and provide setters and getters.

 src/balsa-print-object-decor.c   |  260 ++++++-----
 src/balsa-print-object-decor.h   |   35 +-
 src/balsa-print-object-default.c |  185 ++++----
 src/balsa-print-object-default.h |   33 +-
 src/balsa-print-object-header.c  |  506 +++++++++++----------
 src/balsa-print-object-header.h  |   54 ++--
 src/balsa-print-object-image.c   |  139 +++---
 src/balsa-print-object-image.h   |   30 +-
 src/balsa-print-object-text.c    |  903 ++++++++++++++++++++------------------
 src/balsa-print-object-text.h    |   54 ++--
 src/balsa-print-object.c         |  435 ++++++++++++-------
 src/balsa-print-object.h         |  113 +++--
 src/print-gtk.c                  |    2 +-
 13 files changed, 1492 insertions(+), 1257 deletions(-)
---
diff --git a/src/balsa-print-object-decor.c b/src/balsa-print-object-decor.c
index 741ec8d..d43e0e1 100644
--- a/src/balsa-print-object-decor.c
+++ b/src/balsa-print-object-decor.c
@@ -7,18 +7,18 @@
  * it under the terms of the GNU General Public License as published by
  * 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/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-# include "config.h"
+#   include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-print-object-decor.h"
 
@@ -26,14 +26,14 @@
 
 
 /* object related functions */
-static void
-balsa_print_object_decor_class_init(BalsaPrintObjectDecorClass *klass);
-static void balsa_print_object_decor_init (GTypeInstance *instance, gpointer g_class);
-static void balsa_print_object_decor_finalize(GObject * self);
+static void balsa_print_object_decor_class_init(BalsaPrintObjectDecorClass *klass);
+static void balsa_print_object_decor_init(GTypeInstance *instance,
+                                          gpointer       g_class);
+static void balsa_print_object_decor_finalize(GObject *self);
 
-static void balsa_print_object_decor_draw(BalsaPrintObject * self,
-                                         GtkPrintContext * context,
-                                         cairo_t * cairo_ctx);
+static void balsa_print_object_decor_draw(BalsaPrintObject *self,
+                                          GtkPrintContext  *context,
+                                          cairo_t          *cairo_ctx);
 
 
 static BalsaPrintObjectClass *parent_class = NULL;
@@ -45,22 +45,22 @@ balsa_print_object_decor_get_type()
     static GType balsa_print_object_decor_type = 0;
 
     if (!balsa_print_object_decor_type) {
-       static const GTypeInfo balsa_print_object_decor_info = {
-           sizeof(BalsaPrintObjectDecorClass),
-           NULL,               /* base_init */
-           NULL,               /* base_finalize */
-           (GClassInitFunc) balsa_print_object_decor_class_init,
-           NULL,               /* class_finalize */
-           NULL,               /* class_data */
-           sizeof(BalsaPrintObjectDecor),
-           0,                  /* n_preallocs */
-           (GInstanceInitFunc) balsa_print_object_decor_init
-       };
-
-       balsa_print_object_decor_type =
-           g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
-                                  "BalsaPrintObjectDecor",
-                                  &balsa_print_object_decor_info, 0);
+        static const GTypeInfo balsa_print_object_decor_info = {
+            sizeof(BalsaPrintObjectDecorClass),
+            NULL,               /* base_init */
+            NULL,               /* base_finalize */
+            (GClassInitFunc) balsa_print_object_decor_class_init,
+            NULL,               /* class_finalize */
+            NULL,               /* class_data */
+            sizeof(BalsaPrintObjectDecor),
+            0,                  /* n_preallocs */
+            (GInstanceInitFunc) balsa_print_object_decor_init
+        };
+
+        balsa_print_object_decor_type =
+            g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
+                                   "BalsaPrintObjectDecor",
+                                   &balsa_print_object_decor_info, 0);
     }
 
     return balsa_print_object_decor_type;
@@ -70,36 +70,37 @@ balsa_print_object_decor_get_type()
 static void
 balsa_print_object_decor_class_init(BalsaPrintObjectDecorClass *klass)
 {
-    parent_class = g_type_class_ref(BALSA_TYPE_PRINT_OBJECT);
+    parent_class                          = g_type_class_ref(BALSA_TYPE_PRINT_OBJECT);
     BALSA_PRINT_OBJECT_CLASS(klass)->draw =
-       balsa_print_object_decor_draw;
+        balsa_print_object_decor_draw;
     G_OBJECT_CLASS(klass)->finalize = balsa_print_object_decor_finalize;
 }
 
 
 static void
-balsa_print_object_decor_init(GTypeInstance * instance,
-                             gpointer g_class)
+balsa_print_object_decor_init(GTypeInstance *instance,
+                              gpointer       g_class)
 {
-    BalsaPrintObjectDecor *po = BALSA_PRINT_OBJECT_DECOR(instance);
+    BalsaPrintObjectDecor *pod = BALSA_PRINT_OBJECT_DECOR(instance);
 
-    po->label = NULL;
+    pod->label = NULL;
 }
 
 
 static void
-balsa_print_object_decor_finalize(GObject * self)
+balsa_print_object_decor_finalize(GObject *self)
 {
-    BalsaPrintObjectDecor *po = BALSA_PRINT_OBJECT_DECOR(self);
+    BalsaPrintObjectDecor *pod = BALSA_PRINT_OBJECT_DECOR(self);
 
-    g_free(po->label);
+    g_free(pod->label);
 
     G_OBJECT_CLASS(parent_class)->finalize(self);
 }
 
 
 static BalsaPrintObject *
-decor_new_real(BalsaPrintSetup * psetup, BalsaPrintDecorType mode)
+decor_new_real(BalsaPrintSetup    *psetup,
+               BalsaPrintDecorType mode)
 {
     BalsaPrintObjectDecor *pod;
     BalsaPrintObject *po;
@@ -109,21 +110,23 @@ decor_new_real(BalsaPrintSetup * psetup, BalsaPrintDecorType mode)
     po = BALSA_PRINT_OBJECT(pod);
 
     /* create the part */
-    po->depth = psetup->curr_depth;
+    balsa_print_object_set_depth(po, psetup->curr_depth);
     pod->mode = mode;
 
     /* check if it should start on a new page */
     if (psetup->c_y_pos + C_SEPARATOR > psetup->c_height) {
-       psetup->page_count++;
-       psetup->c_y_pos = 0;
+        psetup->page_count++;
+        psetup->c_y_pos = 0;
     }
 
     /* remember the extent */
-    po->on_page = psetup->page_count - 1;
-    po->c_at_x = psetup->c_x0 + po->depth * C_LABEL_SEP;
-    po->c_at_y = psetup->c_y0 + psetup->c_y_pos;
-    po->c_width = psetup->c_width - 2 * po->depth * C_LABEL_SEP;
-    po->c_height = C_SEPARATOR;
+    balsa_print_object_set_on_page(po, psetup->page_count - 1);
+    balsa_print_object_set_c_at_x(po, psetup->c_x0 + balsa_print_object_get_depth(
+                                      po) * C_LABEL_SEP);
+    balsa_print_object_set_c_at_y(po, psetup->c_y0 + psetup->c_y_pos);
+    balsa_print_object_set_c_width(po, psetup->c_width - 2 * balsa_print_object_get_depth(
+                                       po) * C_LABEL_SEP);
+    balsa_print_object_set_c_height(po, C_SEPARATOR);
 
     /* adjust the y position */
     psetup->c_y_pos += C_SEPARATOR;
@@ -133,14 +136,17 @@ decor_new_real(BalsaPrintSetup * psetup, BalsaPrintDecorType mode)
 
 
 GList *
-balsa_print_object_separator(GList * list, BalsaPrintSetup * psetup)
+balsa_print_object_separator(GList           *list,
+                             BalsaPrintSetup *psetup)
 {
     return g_list_append(list, decor_new_real(psetup, BALSA_PRINT_DECOR_SEPARATOR));
 }
 
 
 GList *
-balsa_print_object_frame_begin(GList * list, const gchar * label, BalsaPrintSetup * psetup)
+balsa_print_object_frame_begin(GList           *list,
+                               const gchar     *label,
+                               BalsaPrintSetup *psetup)
 {
     BalsaPrintObjectDecor *pod;
     BalsaPrintObject *po;
@@ -150,37 +156,43 @@ balsa_print_object_frame_begin(GList * list, const gchar * label, BalsaPrintSetu
     po = BALSA_PRINT_OBJECT(pod);
 
     /* create the part */
-    po->depth = psetup->curr_depth++;
+    balsa_print_object_set_depth(po, psetup->curr_depth++);
     pod->mode = BALSA_PRINT_DECOR_FRAME_BEGIN;
     if (label) {
-       pod->label = g_strdup(label);
-       po->c_height = MAX(P_TO_C(psetup->p_hdr_font_height), C_SEPARATOR) +
-           C_SEPARATOR * 0.5;
-    } else
-       po->c_height = C_SEPARATOR;
+        pod->label = g_strdup(label);
+        balsa_print_object_set_c_height(po,
+                                        MAX(P_TO_C(psetup->p_hdr_font_height),
+                                            C_SEPARATOR)
+                                        + C_SEPARATOR * 0.5);
+    } else {
+        balsa_print_object_set_c_height(po, C_SEPARATOR);
+    }
 
     /* check if it should start on a new page */
-    if (psetup->c_y_pos + po->c_height +
-       3 * P_TO_C(psetup->p_body_font_height) > psetup->c_height) {
-       psetup->page_count++;
-       psetup->c_y_pos = 0;
+    if (psetup->c_y_pos + balsa_print_object_get_c_height(po) +
+        3 * P_TO_C(psetup->p_body_font_height) > psetup->c_height) {
+        psetup->page_count++;
+        psetup->c_y_pos = 0;
     }
 
     /* remember the extent */
-    po->on_page = psetup->page_count - 1;
-    po->c_at_x = psetup->c_x0 + po->depth * C_LABEL_SEP;
-    po->c_at_y = psetup->c_y0 + psetup->c_y_pos;
-    po->c_width = psetup->c_width - 2 * po->depth * C_LABEL_SEP;
+    balsa_print_object_set_on_page(po, psetup->page_count - 1);
+    balsa_print_object_set_c_at_x(po, psetup->c_x0 + balsa_print_object_get_depth(
+                                      po) * C_LABEL_SEP);
+    balsa_print_object_set_c_at_y(po, psetup->c_y0 + psetup->c_y_pos);
+    balsa_print_object_set_c_width(po, psetup->c_width - 2 * balsa_print_object_get_depth(
+                                       po) * C_LABEL_SEP);
 
     /* adjust the y position */
-    psetup->c_y_pos += po->c_height;
+    psetup->c_y_pos += balsa_print_object_get_c_height(po);
 
     return g_list_append(list, po);
 }
 
 
 GList *
-balsa_print_object_frame_end(GList * list, BalsaPrintSetup * psetup)
+balsa_print_object_frame_end(GList           *list,
+                             BalsaPrintSetup *psetup)
 {
     g_return_val_if_fail(psetup->curr_depth > 0, list);
     psetup->curr_depth--;
@@ -189,9 +201,9 @@ balsa_print_object_frame_end(GList * list, BalsaPrintSetup * psetup)
 
 
 static void
-balsa_print_object_decor_draw(BalsaPrintObject * self,
-                             GtkPrintContext * context,
-                             cairo_t * cairo_ctx)
+balsa_print_object_decor_draw(BalsaPrintObject *self,
+                              GtkPrintContext  *context,
+                              cairo_t          *cairo_ctx)
 {
     BalsaPrintObjectDecor *pod;
 
@@ -204,58 +216,76 @@ balsa_print_object_decor_draw(BalsaPrintObject * self,
 
     switch (pod->mode) {
     case BALSA_PRINT_DECOR_SEPARATOR:
-       cairo_set_line_width(cairo_ctx, 1.0);
-       cairo_move_to(cairo_ctx, self->c_at_x, self->c_at_y + 0.5 * C_SEPARATOR);
-       cairo_line_to(cairo_ctx, self->c_at_x + self->c_width,
-                     self->c_at_y + 0.5 * C_SEPARATOR);
-       break;
+        cairo_set_line_width(cairo_ctx, 1.0);
+        cairo_move_to(cairo_ctx, balsa_print_object_get_c_at_x(
+                          self), balsa_print_object_get_c_at_y(self) + 0.5 * C_SEPARATOR);
+        cairo_line_to(cairo_ctx, balsa_print_object_get_c_at_x(
+                          self) + balsa_print_object_get_c_width(self),
+                      balsa_print_object_get_c_at_y(self) + 0.5 * C_SEPARATOR);
+        break;
 
     case BALSA_PRINT_DECOR_FRAME_END:
-       cairo_set_line_width(cairo_ctx, 0.25);
-       cairo_move_to(cairo_ctx, self->c_at_x, self->c_at_y);
-       cairo_line_to(cairo_ctx, self->c_at_x, self->c_at_y + 0.5 * C_SEPARATOR);
-       cairo_line_to(cairo_ctx, self->c_at_x + self->c_width,
-                     self->c_at_y + 0.5 * C_SEPARATOR);
-       cairo_line_to(cairo_ctx, self->c_at_x + self->c_width, self->c_at_y);
-       break;
+        cairo_set_line_width(cairo_ctx, 0.25);
+        cairo_move_to(cairo_ctx, balsa_print_object_get_c_at_x(
+                          self), balsa_print_object_get_c_at_y(self));
+        cairo_line_to(cairo_ctx, balsa_print_object_get_c_at_x(
+                          self), balsa_print_object_get_c_at_y(self) + 0.5 * C_SEPARATOR);
+        cairo_line_to(cairo_ctx, balsa_print_object_get_c_at_x(
+                          self) + balsa_print_object_get_c_width(self),
+                      balsa_print_object_get_c_at_y(self) + 0.5 * C_SEPARATOR);
+        cairo_line_to(cairo_ctx, balsa_print_object_get_c_at_x(
+                          self) + balsa_print_object_get_c_width(
+                          self), balsa_print_object_get_c_at_y(self));
+        break;
 
     case BALSA_PRINT_DECOR_FRAME_BEGIN:
-       cairo_set_line_width(cairo_ctx, 0.25);
-       cairo_move_to(cairo_ctx, self->c_at_x, self->c_at_y + self->c_height);
-       if (pod->label) {
-           PangoLayout *layout;
-           PangoFontDescription *font;
-           gint p_label_width;
-           gint p_label_height;
-           gdouble c_y_hor_line;
-
-           /* print the label */
-           font = pango_font_description_from_string(balsa_app.print_header_font);
-           layout = gtk_print_context_create_pango_layout(context);
-           pango_layout_set_font_description(layout, font);
-           pango_font_description_free(font);
-           pango_layout_set_text(layout, pod->label, -1);
-           pango_layout_get_size(layout, &p_label_width, &p_label_height);
-           c_y_hor_line = self->c_at_y + self->c_height -
-               MAX(P_TO_C(p_label_height), C_SEPARATOR) * 0.5;
-           cairo_line_to(cairo_ctx, self->c_at_x, c_y_hor_line);
-           cairo_line_to(cairo_ctx, self->c_at_x + C_LABEL_SEP, c_y_hor_line);
-           cairo_move_to(cairo_ctx, self->c_at_x + 1.5 * C_LABEL_SEP,
-                         c_y_hor_line - 0.5 * P_TO_C(p_label_height));
-           pango_cairo_show_layout(cairo_ctx, layout);
-           g_object_unref(G_OBJECT(layout));
-           cairo_move_to(cairo_ctx, self->c_at_x + 2.0 * C_LABEL_SEP + P_TO_C(p_label_width),
-                         c_y_hor_line);
-           cairo_line_to(cairo_ctx, self->c_at_x + self->c_width, c_y_hor_line);
-       } else {
-           cairo_line_to(cairo_ctx, self->c_at_x,
-                         self->c_at_y + self->c_height - 0.5 * C_SEPARATOR);
-           cairo_line_to(cairo_ctx, self->c_at_x + self->c_width,
-                         self->c_at_y + self->c_height - 0.5 * C_SEPARATOR);
-       }
-       cairo_line_to(cairo_ctx, self->c_at_x + self->c_width,
-                     self->c_at_y + self->c_height);
-       break;
+        cairo_set_line_width(cairo_ctx, 0.25);
+        cairo_move_to(cairo_ctx, balsa_print_object_get_c_at_x(
+                          self), balsa_print_object_get_c_at_y(
+                          self) + balsa_print_object_get_c_height(self));
+        if (pod->label) {
+            PangoLayout *layout;
+            PangoFontDescription *font;
+            gint p_label_width;
+            gint p_label_height;
+            gdouble c_y_hor_line;
+
+            /* print the label */
+            font   = pango_font_description_from_string(balsa_app.print_header_font);
+            layout = gtk_print_context_create_pango_layout(context);
+            pango_layout_set_font_description(layout, font);
+            pango_font_description_free(font);
+            pango_layout_set_text(layout, pod->label, -1);
+            pango_layout_get_size(layout, &p_label_width, &p_label_height);
+            c_y_hor_line = balsa_print_object_get_c_at_y(self) +
+                balsa_print_object_get_c_height(self) -
+                MAX(P_TO_C(p_label_height), C_SEPARATOR) * 0.5;
+            cairo_line_to(cairo_ctx, balsa_print_object_get_c_at_x(self), c_y_hor_line);
+            cairo_line_to(cairo_ctx, balsa_print_object_get_c_at_x(
+                              self) + C_LABEL_SEP, c_y_hor_line);
+            cairo_move_to(cairo_ctx, balsa_print_object_get_c_at_x(self) + 1.5 * C_LABEL_SEP,
+                          c_y_hor_line - 0.5 * P_TO_C(p_label_height));
+            pango_cairo_show_layout(cairo_ctx, layout);
+            g_object_unref(G_OBJECT(layout));
+            cairo_move_to(cairo_ctx, balsa_print_object_get_c_at_x(
+                              self) + 2.0 * C_LABEL_SEP + P_TO_C(p_label_width),
+                          c_y_hor_line);
+            cairo_line_to(cairo_ctx, balsa_print_object_get_c_at_x(
+                              self) + balsa_print_object_get_c_width(self), c_y_hor_line);
+        } else {
+            cairo_line_to(cairo_ctx, balsa_print_object_get_c_at_x(self),
+                          balsa_print_object_get_c_at_y(self) +
+                          balsa_print_object_get_c_height(self) - 0.5 * C_SEPARATOR);
+            cairo_line_to(cairo_ctx, balsa_print_object_get_c_at_x(
+                              self) + balsa_print_object_get_c_width(self),
+                          balsa_print_object_get_c_at_y(self) +
+                          balsa_print_object_get_c_height(self) - 0.5 * C_SEPARATOR);
+        }
+        cairo_line_to(cairo_ctx, balsa_print_object_get_c_at_x(
+                          self) + balsa_print_object_get_c_width(self),
+                      balsa_print_object_get_c_at_y(self) + balsa_print_object_get_c_height(
+                          self));
+        break;
     }
 
     cairo_stroke(cairo_ctx);
diff --git a/src/balsa-print-object-decor.h b/src/balsa-print-object-decor.h
index 90a2cac..d7f105c 100644
--- a/src/balsa-print-object-decor.h
+++ b/src/balsa-print-object-decor.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/>.
  */
@@ -24,13 +24,13 @@
 
 G_BEGIN_DECLS
 
-#define BALSA_TYPE_PRINT_OBJECT_DECOR  \
+#define BALSA_TYPE_PRINT_OBJECT_DECOR   \
     (balsa_print_object_decor_get_type())
-#define BALSA_PRINT_OBJECT_DECOR(obj)                          \
+#define BALSA_PRINT_OBJECT_DECOR(obj)                           \
     G_TYPE_CHECK_INSTANCE_CAST(obj, BALSA_TYPE_PRINT_OBJECT_DECOR, BalsaPrintObjectDecor)
-#define BALSA_PRINT_OBJECT_DECOR_CLASS(klass)                  \
+#define BALSA_PRINT_OBJECT_DECOR_CLASS(klass)                   \
     G_TYPE_CHECK_CLASS_CAST(klass, BALSA_TYPE_PRINT_OBJECT_DECOR, BalsaPrintObjectDecorClass)
-#define BALSA_IS_PRINT_OBJECT_DECOR(obj)                       \
+#define BALSA_IS_PRINT_OBJECT_DECOR(obj)                        \
     G_TYPE_CHECK_INSTANCE_TYPE(obj, BALSA_TYPE_PRINT_OBJECT_DECOR)
 
 typedef struct _BalsaPrintObjectDecorClass BalsaPrintObjectDecorClass;
@@ -46,7 +46,7 @@ struct _BalsaPrintObjectDecor {
     BalsaPrintObject parent;
 
     BalsaPrintDecorType mode;
-    gchar * label;
+    gchar *label;
 };
 
 
@@ -55,13 +55,16 @@ struct _BalsaPrintObjectDecorClass {
 };
 
 
-GType balsa_print_object_decor_get_type(void);
-GList *balsa_print_object_separator(GList * list, BalsaPrintSetup * psetup);
-GList *balsa_print_object_frame_begin(GList * list, const gchar * label,
-                                     BalsaPrintSetup * psetup);
-GList *balsa_print_object_frame_end(GList * list, BalsaPrintSetup * psetup);
+GType  balsa_print_object_decor_get_type(void);
+GList *balsa_print_object_separator(GList           *list,
+                                    BalsaPrintSetup *psetup);
+GList *balsa_print_object_frame_begin(GList           *list,
+                                      const gchar     *label,
+                                      BalsaPrintSetup *psetup);
+GList *balsa_print_object_frame_end(GList           *list,
+                                    BalsaPrintSetup *psetup);
 
 
 G_END_DECLS
 
-#endif                         /* __BALSA_PRINT_OBJECT_SEPARATOR_H__ */
+#endif                          /* __BALSA_PRINT_OBJECT_SEPARATOR_H__ */
diff --git a/src/balsa-print-object-default.c b/src/balsa-print-object-default.c
index db9e14f..dbe3182 100644
--- a/src/balsa-print-object-default.c
+++ b/src/balsa-print-object-default.c
@@ -7,18 +7,18 @@
  * it under the terms of the GNU General Public License as published by
  * 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/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-# include "config.h"
+#   include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-print-object-default.h"
 
@@ -29,17 +29,16 @@
 
 
 /* object related functions */
-static void
-balsa_print_object_default_class_init(BalsaPrintObjectDefaultClass *
-                                     klass);
-static void balsa_print_object_default_init(GTypeInstance * instance,
-                                           gpointer g_class);
-static void balsa_print_object_default_dispose(GObject * self);
-static void balsa_print_object_default_finalize(GObject * self);
+static void balsa_print_object_default_class_init(BalsaPrintObjectDefaultClass *
+                                                  klass);
+static void balsa_print_object_default_init(GTypeInstance *instance,
+                                            gpointer       g_class);
+static void balsa_print_object_default_dispose(GObject *self);
+static void balsa_print_object_default_finalize(GObject *self);
 
-static void balsa_print_object_default_draw(BalsaPrintObject * self,
-                                           GtkPrintContext * context,
-                                           cairo_t * cairo_ctx);
+static void balsa_print_object_default_draw(BalsaPrintObject *self,
+                                            GtkPrintContext  *context,
+                                            cairo_t          *cairo_ctx);
 
 
 static BalsaPrintObjectClass *parent_class = NULL;
@@ -51,22 +50,22 @@ balsa_print_object_default_get_type()
     static GType balsa_print_object_default_type = 0;
 
     if (!balsa_print_object_default_type) {
-       static const GTypeInfo balsa_print_object_default_info = {
-           sizeof(BalsaPrintObjectDefaultClass),
-           NULL,               /* base_init */
-           NULL,               /* base_finalize */
-           (GClassInitFunc) balsa_print_object_default_class_init,
-           NULL,               /* class_finalize */
-           NULL,               /* class_data */
-           sizeof(BalsaPrintObjectDefault),
-           0,                  /* n_preallocs */
-           (GInstanceInitFunc) balsa_print_object_default_init
-       };
-
-       balsa_print_object_default_type =
-           g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
-                                  "BalsaPrintObjectDefault",
-                                  &balsa_print_object_default_info, 0);
+        static const GTypeInfo balsa_print_object_default_info = {
+            sizeof(BalsaPrintObjectDefaultClass),
+            NULL,               /* base_init */
+            NULL,               /* base_finalize */
+            (GClassInitFunc) balsa_print_object_default_class_init,
+            NULL,               /* class_finalize */
+            NULL,               /* class_data */
+            sizeof(BalsaPrintObjectDefault),
+            0,                  /* n_preallocs */
+            (GInstanceInitFunc) balsa_print_object_default_init
+        };
+
+        balsa_print_object_default_type =
+            g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
+                                   "BalsaPrintObjectDefault",
+                                   &balsa_print_object_default_info, 0);
     }
 
     return balsa_print_object_default_type;
@@ -74,53 +73,54 @@ balsa_print_object_default_get_type()
 
 
 static void
-balsa_print_object_default_class_init(BalsaPrintObjectDefaultClass * klass)
+balsa_print_object_default_class_init(BalsaPrintObjectDefaultClass *klass)
 {
-    parent_class = g_type_class_ref(BALSA_TYPE_PRINT_OBJECT);
+    parent_class                          = g_type_class_ref(BALSA_TYPE_PRINT_OBJECT);
     BALSA_PRINT_OBJECT_CLASS(klass)->draw =
-       balsa_print_object_default_draw;
-    G_OBJECT_CLASS(klass)->dispose = balsa_print_object_default_dispose;
+        balsa_print_object_default_draw;
+    G_OBJECT_CLASS(klass)->dispose  = balsa_print_object_default_dispose;
     G_OBJECT_CLASS(klass)->finalize = balsa_print_object_default_finalize;
 }
 
 
 static void
-balsa_print_object_default_init(GTypeInstance * instance, gpointer g_class)
+balsa_print_object_default_init(GTypeInstance *instance,
+                                gpointer       g_class)
 {
-    BalsaPrintObjectDefault *po = BALSA_PRINT_OBJECT_DEFAULT(instance);
+    BalsaPrintObjectDefault *pod = BALSA_PRINT_OBJECT_DEFAULT(instance);
 
-    po->pixbuf = NULL;
-    po->description = NULL;
+    pod->pixbuf      = NULL;
+    pod->description = NULL;
 }
 
 
 static void
-balsa_print_object_default_dispose(GObject * self)
+balsa_print_object_default_dispose(GObject *self)
 {
-    BalsaPrintObjectDefault *po = BALSA_PRINT_OBJECT_DEFAULT(self);
+    BalsaPrintObjectDefault *pod = BALSA_PRINT_OBJECT_DEFAULT(self);
 
-    g_clear_object(&po->pixbuf);
+    g_clear_object(&pod->pixbuf);
 
     G_OBJECT_CLASS(parent_class)->dispose(self);
 }
 
 
 static void
-balsa_print_object_default_finalize(GObject * self)
+balsa_print_object_default_finalize(GObject *self)
 {
-    BalsaPrintObjectDefault *po = BALSA_PRINT_OBJECT_DEFAULT(self);
+    BalsaPrintObjectDefault *pod = BALSA_PRINT_OBJECT_DEFAULT(self);
 
-    g_free(po->description);
+    g_free(pod->description);
 
     G_OBJECT_CLASS(parent_class)->finalize(self);
 }
 
 
 GList *
-balsa_print_object_default(GList * list,
-                          GtkPrintContext * context,
-                          LibBalsaMessageBody * body,
-                          BalsaPrintSetup * psetup)
+balsa_print_object_default(GList               *list,
+                           GtkPrintContext     *context,
+                           LibBalsaMessageBody *body,
+                           BalsaPrintSetup     *psetup)
 {
     BalsaPrintObjectDefault *pod;
     BalsaPrintObject *po;
@@ -137,20 +137,21 @@ balsa_print_object_default(GList * list,
     po = BALSA_PRINT_OBJECT(pod);
 
     /* create the part */
-    po->depth = psetup->curr_depth;
-    po->c_width =
-       psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
+    balsa_print_object_set_depth(po, psetup->curr_depth);
+    balsa_print_object_set_c_width(po,
+                                   psetup->c_width
+                                   - 2 * psetup->curr_depth * C_LABEL_SEP);
 
     /* get a pixbuf according to the mime type */
-    conttype = libbalsa_message_body_get_mime_type(body);
-    pod->pixbuf = libbalsa_icon_finder(NULL, conttype, NULL, NULL, 48);
-    pod->c_image_width = gdk_pixbuf_get_width(pod->pixbuf);
+    conttype            = libbalsa_message_body_get_mime_type(body);
+    pod->pixbuf         = libbalsa_icon_finder(NULL, conttype, NULL, NULL, 48);
+    pod->c_image_width  = gdk_pixbuf_get_width(pod->pixbuf);
     pod->c_image_height = gdk_pixbuf_get_height(pod->pixbuf);
 
 
     /* create a layout for calculating the maximum label width */
     header_font =
-       pango_font_description_from_string(balsa_app.print_header_font);
+        pango_font_description_from_string(balsa_app.print_header_font);
     test_layout = gtk_print_context_create_pango_layout(context);
     pango_layout_set_font_description(test_layout, header_font);
     pango_font_description_free(header_font);
@@ -158,22 +159,22 @@ balsa_print_object_default(GList * list,
 
     /* add type and filename (if available) */
     pod->p_label_width =
-       p_string_width_from_layout(test_layout, _("Type:"));
+        p_string_width_from_layout(test_layout, _("Type:"));
     if ((part_desc = libbalsa_vfs_content_description(conttype)))
-       g_string_append_printf(desc_buf, "%s\t%s (%s)", _("Type:"),
-                              part_desc, conttype);
+        g_string_append_printf(desc_buf, "%s\t%s (%s)", _("Type:"),
+                               part_desc, conttype);
     else
-       g_string_append_printf(desc_buf, "%s\t%s", _("Type:"), conttype);
+        g_string_append_printf(desc_buf, "%s\t%s", _("Type:"), conttype);
     g_free(part_desc);
     g_free(conttype);
     if (body->filename) {
-       gint p_fnwidth =
-           p_string_width_from_layout(test_layout, _("File name:"));
+        gint p_fnwidth =
+            p_string_width_from_layout(test_layout, _("File name:"));
 
-       if (p_fnwidth > pod->p_label_width)
-           pod->p_label_width = p_fnwidth;
-       g_string_append_printf(desc_buf, "\n%s\t%s", _("File name:"),
-                              body->filename);
+        if (p_fnwidth > pod->p_label_width)
+            pod->p_label_width = p_fnwidth;
+        g_string_append_printf(desc_buf, "\n%s\t%s", _("File name:"),
+                               body->filename);
     }
 
     /* add a small space between label and value */
@@ -182,31 +183,33 @@ balsa_print_object_default(GList * list,
     /* configure the layout so we can calculate the text height */
     pango_layout_set_indent(test_layout, -pod->p_label_width);
     tabs =
-       pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
-                                          pod->p_label_width);
+        pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
+                                           pod->p_label_width);
     pango_layout_set_tabs(test_layout, tabs);
     pango_tab_array_free(tabs);
     pango_layout_set_width(test_layout,
-                          C_TO_P(po->c_width -
-                                 4 * C_LABEL_SEP - pod->c_image_width));
+                           C_TO_P(balsa_print_object_get_c_width(po) -
+                                  4 * C_LABEL_SEP - pod->c_image_width));
     pango_layout_set_alignment(test_layout, PANGO_ALIGN_LEFT);
     pod->c_text_height =
-       P_TO_C(p_string_height_from_layout(test_layout, desc_buf->str));
+        P_TO_C(p_string_height_from_layout(test_layout, desc_buf->str));
     pod->description = g_string_free(desc_buf, FALSE);
 
     /* check if we should move to the next page */
     c_max_height = MAX(pod->c_text_height, pod->c_image_height);
     if (psetup->c_y_pos + c_max_height > psetup->c_height) {
-       psetup->c_y_pos = 0;
-       psetup->page_count++;
+        psetup->c_y_pos = 0;
+        psetup->page_count++;
     }
 
     /* remember the extent */
-    po->on_page = psetup->page_count - 1;
-    po->c_at_x = psetup->c_x0 + po->depth * C_LABEL_SEP;
-    po->c_at_y = psetup->c_y0 + psetup->c_y_pos;
-    po->c_width = psetup->c_width - 2 * po->depth * C_LABEL_SEP;
-    po->c_height = c_max_height;
+    balsa_print_object_set_on_page(po, psetup->page_count - 1);
+    balsa_print_object_set_c_at_x(po, psetup->c_x0 + balsa_print_object_get_depth(
+                                      po) * C_LABEL_SEP);
+    balsa_print_object_set_c_at_y(po, psetup->c_y0 + psetup->c_y_pos);
+    balsa_print_object_set_c_width(po, psetup->c_width - 2 * balsa_print_object_get_depth(
+                                       po) * C_LABEL_SEP);
+    balsa_print_object_set_c_height(po, c_max_height);
 
     /* adjust the y position */
     psetup->c_y_pos += c_max_height;
@@ -216,9 +219,9 @@ balsa_print_object_default(GList * list,
 
 
 static void
-balsa_print_object_default_draw(BalsaPrintObject * self,
-                               GtkPrintContext * context,
-                               cairo_t * cairo_ctx)
+balsa_print_object_default_draw(BalsaPrintObject *self,
+                                GtkPrintContext  *context,
+                                cairo_t          *cairo_ctx)
 {
     BalsaPrintObjectDefault *pod;
     gdouble c_max_height;
@@ -231,30 +234,30 @@ balsa_print_object_default_draw(BalsaPrintObject * self,
     pod = BALSA_PRINT_OBJECT_DEFAULT(self);
     g_assert(pod != NULL);
     c_max_height = MAX(pod->c_text_height, pod->c_image_height);
-    c_offset = pod->c_image_width + 4 * C_LABEL_SEP;
+    c_offset     = pod->c_image_width + 4 * C_LABEL_SEP;
 
     /* print the icon */
     if (pod->pixbuf)
-        cairo_print_pixbuf(cairo_ctx, pod->pixbuf, self->c_at_x,
-                           self->c_at_y, 1.0);
+        cairo_print_pixbuf(cairo_ctx, pod->pixbuf, balsa_print_object_get_c_at_x(self),
+                           balsa_print_object_get_c_at_y(self), 1.0);
 
     /* print the description */
-    font = pango_font_description_from_string(balsa_app.print_header_font);
+    font   = pango_font_description_from_string(balsa_app.print_header_font);
     layout = gtk_print_context_create_pango_layout(context);
     pango_layout_set_font_description(layout, font);
     pango_font_description_free(font);
     pango_layout_set_indent(layout, -pod->p_label_width);
     tabs =
-       pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
-                                          pod->p_label_width);
+        pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
+                                           pod->p_label_width);
     pango_layout_set_tabs(layout, tabs);
     pango_tab_array_free(tabs);
-    pango_layout_set_width(layout, C_TO_P(self->c_width - c_offset));
+    pango_layout_set_width(layout, C_TO_P(balsa_print_object_get_c_width(self) - c_offset));
     pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT);
     pango_layout_set_text(layout, pod->description, -1);
-    cairo_move_to(cairo_ctx, self->c_at_x + c_offset,
-                 self->c_at_y + (c_max_height -
-                                 pod->c_text_height) * 0.5);
+    cairo_move_to(cairo_ctx, balsa_print_object_get_c_at_x(self) + c_offset,
+                  balsa_print_object_get_c_at_y(self) + (c_max_height -
+                                                         pod->c_text_height) * 0.5);
     pango_cairo_show_layout(cairo_ctx, layout);
     g_object_unref(G_OBJECT(layout));
 }
diff --git a/src/balsa-print-object-default.h b/src/balsa-print-object-default.h
index 7375612..eecb838 100644
--- a/src/balsa-print-object-default.h
+++ b/src/balsa-print-object-default.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/>.
  */
@@ -24,13 +24,14 @@
 
 G_BEGIN_DECLS
 
-#define BALSA_TYPE_PRINT_OBJECT_DEFAULT        \
+#define BALSA_TYPE_PRINT_OBJECT_DEFAULT \
     (balsa_print_object_default_get_type())
-#define BALSA_PRINT_OBJECT_DEFAULT(obj)                                \
+#define BALSA_PRINT_OBJECT_DEFAULT(obj)                         \
     G_TYPE_CHECK_INSTANCE_CAST(obj, BALSA_TYPE_PRINT_OBJECT_DEFAULT, BalsaPrintObjectDefault)
-#define BALSA_PRINT_OBJECT_DEFAULT_CLASS(klass)                        \
-    G_TYPE_CHECK_CLASS_CAST(klass, BALSA_TYPE_PRINT_OBJECT_DEFAULT, BalsaPrintObjectDefaultClass)
-#define BALSA_IS_PRINT_OBJECT_DEFAULT(obj)                     \
+#define BALSA_PRINT_OBJECT_DEFAULT_CLASS(klass)                 \
+    G_TYPE_CHECK_CLASS_CAST(klass, BALSA_TYPE_PRINT_OBJECT_DEFAULT, \
+                            BalsaPrintObjectDefaultClass)
+#define BALSA_IS_PRINT_OBJECT_DEFAULT(obj)                      \
     G_TYPE_CHECK_INSTANCE_TYPE(obj, BALSA_TYPE_PRINT_OBJECT_DEFAULT)
 
 
@@ -55,13 +56,13 @@ struct _BalsaPrintObjectDefaultClass {
 };
 
 
-GType balsa_print_object_default_get_type(void);
-GList *balsa_print_object_default(GList * list,
-                                 GtkPrintContext *context,
-                                 LibBalsaMessageBody *body,
-                                 BalsaPrintSetup *psetup);
+GType  balsa_print_object_default_get_type(void);
+GList *balsa_print_object_default(GList               *list,
+                                  GtkPrintContext     *context,
+                                  LibBalsaMessageBody *body,
+                                  BalsaPrintSetup     *psetup);
 
 
 G_END_DECLS
 
-#endif                         /* __BALSA_PRINT_OBJECT_DEFAULT_H__ */
+#endif                          /* __BALSA_PRINT_OBJECT_DEFAULT_H__ */
diff --git a/src/balsa-print-object-header.c b/src/balsa-print-object-header.c
index d08bc24..9669a87 100644
--- a/src/balsa-print-object-header.c
+++ b/src/balsa-print-object-header.c
@@ -7,18 +7,18 @@
  * it under the terms of the GNU General Public License as published by
  * 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/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-# include "config.h"
+#   include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-print-object-header.h"
 
@@ -30,24 +30,29 @@
 
 
 /* object related functions */
-static void balsa_print_object_header_class_init(BalsaPrintObjectHeaderClass * klass);
-static void balsa_print_object_header_init(GTypeInstance * instance,
-                                           gpointer g_class);
-static void balsa_print_object_header_finalize(GObject * self);
-
-static void balsa_print_object_header_draw(BalsaPrintObject * self,
-                                           GtkPrintContext * context,
-                                           cairo_t * cairo_ctx);
-
-static void header_add_string(PangoLayout * layout, GString * header_buf,
-                             const gchar * field_id, const gchar * label,
-                             const gchar * value, gint * p_label_width,
-                             gboolean print_all_headers);
-static void header_add_list(PangoLayout * layout, GString * header_buf,
-                           const gchar * field_id, const gchar * label,
-                           InternetAddressList * values,
-                           gint * p_label_width,
-                           gboolean print_all_headers);
+static void balsa_print_object_header_class_init(BalsaPrintObjectHeaderClass *klass);
+static void balsa_print_object_header_init(GTypeInstance *instance,
+                                           gpointer       g_class);
+static void balsa_print_object_header_finalize(GObject *self);
+
+static void balsa_print_object_header_draw(BalsaPrintObject *self,
+                                           GtkPrintContext  *context,
+                                           cairo_t          *cairo_ctx);
+
+static void header_add_string(PangoLayout *layout,
+                              GString     *header_buf,
+                              const gchar *field_id,
+                              const gchar *label,
+                              const gchar *value,
+                              gint        *p_label_width,
+                              gboolean     print_all_headers);
+static void header_add_list(PangoLayout         *layout,
+                            GString             *header_buf,
+                            const gchar         *field_id,
+                            const gchar         *label,
+                            InternetAddressList *values,
+                            gint                *p_label_width,
+                            gboolean             print_all_headers);
 
 
 static BalsaPrintObjectClass *parent_class = NULL;
@@ -59,22 +64,22 @@ balsa_print_object_header_get_type()
     static GType balsa_print_object_header_type = 0;
 
     if (!balsa_print_object_header_type) {
-       static const GTypeInfo balsa_print_object_header_info = {
-           sizeof(BalsaPrintObjectHeaderClass),
-           NULL,               /* base_init */
-           NULL,               /* base_finalize */
-           (GClassInitFunc) balsa_print_object_header_class_init,
-           NULL,               /* class_finalize */
-           NULL,               /* class_data */
-           sizeof(BalsaPrintObjectHeader),
-           0,                  /* n_preallocs */
-           (GInstanceInitFunc) balsa_print_object_header_init
-       };
-
-       balsa_print_object_header_type =
-           g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
-                                  "BalsaPrintObjectHeader",
-                                  &balsa_print_object_header_info, 0);
+        static const GTypeInfo balsa_print_object_header_info = {
+            sizeof(BalsaPrintObjectHeaderClass),
+            NULL,               /* base_init */
+            NULL,               /* base_finalize */
+            (GClassInitFunc) balsa_print_object_header_class_init,
+            NULL,               /* class_finalize */
+            NULL,               /* class_data */
+            sizeof(BalsaPrintObjectHeader),
+            0,                  /* n_preallocs */
+            (GInstanceInitFunc) balsa_print_object_header_init
+        };
+
+        balsa_print_object_header_type =
+            g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
+                                   "BalsaPrintObjectHeader",
+                                   &balsa_print_object_header_info, 0);
     }
 
     return balsa_print_object_header_type;
@@ -82,26 +87,27 @@ balsa_print_object_header_get_type()
 
 
 static void
-balsa_print_object_header_class_init(BalsaPrintObjectHeaderClass * klass)
+balsa_print_object_header_class_init(BalsaPrintObjectHeaderClass *klass)
 {
-    parent_class = g_type_class_ref(BALSA_TYPE_PRINT_OBJECT);
+    parent_class                          = g_type_class_ref(BALSA_TYPE_PRINT_OBJECT);
     BALSA_PRINT_OBJECT_CLASS(klass)->draw =
-       balsa_print_object_header_draw;
+        balsa_print_object_header_draw;
     G_OBJECT_CLASS(klass)->finalize = balsa_print_object_header_finalize;
 }
 
 
 static void
-balsa_print_object_header_init(GTypeInstance * instance, gpointer g_class)
+balsa_print_object_header_init(GTypeInstance *instance,
+                               gpointer       g_class)
 {
-    BalsaPrintObjectHeader *po = BALSA_PRINT_OBJECT_HEADER(instance);
+    BalsaPrintObjectHeader *poh = BALSA_PRINT_OBJECT_HEADER(instance);
 
-    po->headers = NULL;
+    poh->headers = NULL;
 }
 
 
 static void
-balsa_print_object_header_finalize(GObject * self)
+balsa_print_object_header_finalize(GObject *self)
 {
     BalsaPrintObjectHeader *po = BALSA_PRINT_OBJECT_HEADER(self);
 
@@ -111,14 +117,15 @@ balsa_print_object_header_finalize(GObject * self)
     G_OBJECT_CLASS(parent_class)->finalize(self);
 }
 
+
 static GList *
-balsa_print_object_header_new_real(GList * list,
-                                  GtkPrintContext * context,
-                                  LibBalsaMessageBody * sig_body,
-                                  LibBalsaMessageHeaders * headers,
-                                  const gchar * the_subject,
-                                  BalsaPrintSetup * psetup,
-                                  gboolean print_all_headers)
+balsa_print_object_header_new_real(GList                  *list,
+                                   GtkPrintContext        *context,
+                                   LibBalsaMessageBody    *sig_body,
+                                   LibBalsaMessageHeaders *headers,
+                                   const gchar            *the_subject,
+                                   BalsaPrintSetup        *psetup,
+                                   gboolean                print_all_headers)
 {
     gchar *subject;
     gchar *date;
@@ -142,7 +149,7 @@ balsa_print_object_header_new_real(GList * list,
 
     /* create a layout for calculating the maximum label width */
     header_font =
-       pango_font_description_from_string(balsa_app.print_header_font);
+        pango_font_description_from_string(balsa_app.print_header_font);
     test_layout = gtk_print_context_create_pango_layout(context);
     pango_layout_set_font_description(test_layout, header_font);
     pango_font_description_free(header_font);
@@ -150,65 +157,65 @@ balsa_print_object_header_new_real(GList * list,
 
     /* collect headers, starting with the subject */
     p_label_width = 0;
-    subject = g_strdup(the_subject);
+    subject       = g_strdup(the_subject);
     libbalsa_utf8_sanitize(&subject, balsa_app.convert_unknown_8bit, NULL);
     header_add_string(test_layout, header_buf, "subject", _("Subject:"),
-                     subject, &p_label_width, print_all_headers);
+                      subject, &p_label_width, print_all_headers);
     g_free(subject);
 
     /* date */
     date =
-       libbalsa_message_headers_date_to_utf8(headers,
-                                             balsa_app.date_string);
+        libbalsa_message_headers_date_to_utf8(headers,
+                                              balsa_app.date_string);
     header_add_string(test_layout, header_buf, "date", _("Date:"), date,
-                     &p_label_width, print_all_headers);
+                      &p_label_width, print_all_headers);
     g_free(date);
 
     /* addresses */
     header_add_list(test_layout, header_buf, "from", _("From:"),
-                   headers->from, &p_label_width, print_all_headers);
+                    headers->from, &p_label_width, print_all_headers);
     header_add_list(test_layout, header_buf, "to", _("To:"),
-                   headers->to_list, &p_label_width, print_all_headers);
+                    headers->to_list, &p_label_width, print_all_headers);
     header_add_list(test_layout, header_buf, "cc", _("CC:"),
-                   headers->cc_list, &p_label_width, print_all_headers);
+                    headers->cc_list, &p_label_width, print_all_headers);
     header_add_list(test_layout, header_buf, "bcc", _("BCC:"),
-                   headers->bcc_list, &p_label_width, print_all_headers);
+                    headers->bcc_list, &p_label_width, print_all_headers);
     header_add_string(test_layout, header_buf, "fcc", _("FCC:"),
-                     headers->fcc_url, &p_label_width, print_all_headers);
+                      headers->fcc_url, &p_label_width, print_all_headers);
     header_add_list(test_layout, header_buf, "disposition-notification-to",
-                   _("Disposition-Notification-To:"),
-                   headers->dispnotify_to, &p_label_width, print_all_headers);
+                    _("Disposition-Notification-To:"),
+                    headers->dispnotify_to, &p_label_width, print_all_headers);
 
     /* user headers */
-    p = headers->user_hdrs;
+    p    = headers->user_hdrs;
     face = NULL;
     while (p != NULL) {
-       gchar **pair, *curr_hdr;
+        gchar **pair, *curr_hdr;
 
-       pair = p->data;
-       curr_hdr = g_strconcat(pair[0], ":", NULL);
-       header_add_string(test_layout, header_buf, pair[0], curr_hdr,
-                         pair[1], &p_label_width, print_all_headers);
-       g_free(curr_hdr);
+        pair     = p->data;
+        curr_hdr = g_strconcat(pair[0], ":", NULL);
+        header_add_string(test_layout, header_buf, pair[0], curr_hdr,
+                          pair[1], &p_label_width, print_all_headers);
+        g_free(curr_hdr);
 
-       /* check for face and x-face */
-       if (face == NULL) {
-           GError *err = NULL;
+        /* check for face and x-face */
+        if (face == NULL) {
+            GError *err = NULL;
 
-           if (g_ascii_strcasecmp("Face", pair[0]) == 0)
-               face = libbalsa_get_pixbuf_from_face_header(pair[1], &err);
+            if (g_ascii_strcasecmp("Face", pair[0]) == 0)
+                face = libbalsa_get_pixbuf_from_face_header(pair[1], &err);
 #if HAVE_COMPFACE
-           else if (g_ascii_strcasecmp("X-Face", pair[0]) == 0)
-               face = libbalsa_get_pixbuf_from_x_face_header(pair[1], &err);
+            else if (g_ascii_strcasecmp("X-Face", pair[0]) == 0)
+                face = libbalsa_get_pixbuf_from_x_face_header(pair[1], &err);
 #endif                          /* HAVE_COMPFACE */
-           if (err != NULL)
+            if (err != NULL)
                 /* FIXME report something? */
-               g_error_free(err);
+                g_error_free(err);
 
-       }
+        }
 
-       /* next */
-       p = p->next;
+        /* next */
+        p = p->next;
     }
 
     /* add a small space between label and value */
@@ -216,22 +223,22 @@ balsa_print_object_header_new_real(GList * list,
 
 #ifdef HAVE_GPGME
     /* add a signature status to the string */
-    if (balsa_app.shown_headers != HEADERS_NONE && sig_body &&
-       sig_body->parts && sig_body->parts->next &&
-       sig_body->parts->next->sig_info) {
-       gint prot = libbalsa_message_body_protection(sig_body);
+    if ((balsa_app.shown_headers != HEADERS_NONE) && sig_body &&
+        sig_body->parts && sig_body->parts->next &&
+        sig_body->parts->next->sig_info) {
+        gint prot = libbalsa_message_body_protection(sig_body);
 
-       if ((prot & LIBBALSA_PROTECT_SIGN) &&
-           (prot & (LIBBALSA_PROTECT_RFC3156 | LIBBALSA_PROTECT_SMIMEV3))) {
-           GMimeGpgmeSigstat *siginfo = sig_body->parts->next->sig_info;
+        if ((prot & LIBBALSA_PROTECT_SIGN) &&
+            (prot & (LIBBALSA_PROTECT_RFC3156 | LIBBALSA_PROTECT_SMIMEV3))) {
+            GMimeGpgmeSigstat *siginfo = sig_body->parts->next->sig_info;
 
-           g_string_append_printf(header_buf, "%s%s\n",
-               g_mime_gpgme_sigstat_protocol_name(siginfo),
+            g_string_append_printf(header_buf, "%s%s\n",
+                                   g_mime_gpgme_sigstat_protocol_name(siginfo),
                                    libbalsa_gpgme_sig_stat_to_gchar
-                                   (g_mime_gpgme_sigstat_get_status(siginfo)));
-       }
+                                       (g_mime_gpgme_sigstat_get_status(siginfo)));
+        }
     }
-#endif                         /* HAVE_GPGME */
+#endif                          /* HAVE_GPGME */
 
     /* strip the trailing '\n' */
     header_buf = g_string_truncate(header_buf, header_buf->len - 1);
@@ -239,28 +246,28 @@ balsa_print_object_header_new_real(GList * list,
     /* check if we have a face */
     c_use_width = psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
     if (face != NULL) {
-       p_layout_width = C_TO_P(c_use_width - gdk_pixbuf_get_width(face) - C_LABEL_SEP);
-       c_face_height = gdk_pixbuf_get_height(face);
+        p_layout_width = C_TO_P(c_use_width - gdk_pixbuf_get_width(face) - C_LABEL_SEP);
+        c_face_height  = gdk_pixbuf_get_height(face);
     } else {
-       p_layout_width = C_TO_P(c_use_width);
-       c_face_height = 0;
+        p_layout_width = C_TO_P(c_use_width);
+        c_face_height  = 0;
     }
 
     /* start on new page if less than 2 header lines can be printed or if
      * the face doesn't fit */
-    if (psetup->c_y_pos + 2 * P_TO_C(psetup->p_hdr_font_height) > psetup->c_height ||
-       psetup->c_y_pos + c_face_height > psetup->c_height) {
-       psetup->c_y_pos = 0;
-       psetup->page_count++;
+    if ((psetup->c_y_pos + 2 * P_TO_C(psetup->p_hdr_font_height) > psetup->c_height) ||
+        (psetup->c_y_pos + c_face_height > psetup->c_height)) {
+        psetup->c_y_pos = 0;
+        psetup->page_count++;
     }
     first_page = psetup->page_count - 1;
-    c_at_y = psetup->c_y_pos;
+    c_at_y     = psetup->c_y_pos;
 
     /* configure the layout so we can use Pango to split the text into pages */
     pango_layout_set_indent(test_layout, -p_label_width);
     tabs =
-       pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
-                                          p_label_width);
+        pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
+                                           p_label_width);
     pango_layout_set_tabs(test_layout, tabs);
     pango_tab_array_free(tabs);
     pango_layout_set_width(test_layout, p_layout_width);
@@ -269,47 +276,49 @@ balsa_print_object_header_new_real(GList * list,
 
     /* split the headers into a list fitting on one or more pages */
     chunks =
-       split_for_layout(test_layout, header_buf->str, NULL, psetup, TRUE,
-                        NULL);
+        split_for_layout(test_layout, header_buf->str, NULL, psetup, TRUE,
+                         NULL);
     g_string_free(header_buf, TRUE);
 
     /* create a list of objects */
     this_chunk = chunks;
-    c_at_x = psetup->c_x0 + psetup->curr_depth * C_LABEL_SEP;
+    c_at_x     = psetup->c_x0 + psetup->curr_depth * C_LABEL_SEP;
     while (this_chunk) {
-       BalsaPrintObjectHeader *po;
-
-       po = g_object_new(BALSA_TYPE_PRINT_OBJECT_HEADER, NULL);
-       g_assert(po != NULL);
-       BALSA_PRINT_OBJECT(po)->on_page = first_page++;
-       BALSA_PRINT_OBJECT(po)->c_at_x = c_at_x;
-       BALSA_PRINT_OBJECT(po)->c_at_y = psetup->c_y0 + c_at_y;
-       BALSA_PRINT_OBJECT(po)->depth = psetup->curr_depth;
-       c_at_y = 0.0;
-       BALSA_PRINT_OBJECT(po)->c_width = c_use_width;
-       /* note: height is calculated when the object is drawn */
-       po->headers = (gchar *) this_chunk->data;
-       po->p_label_width = p_label_width;
-       po->p_layout_width = p_layout_width;
-       if (face != NULL) {
-           po->face = face;
-           face = NULL;
-
-           if (this_chunk->next == NULL) {
-               gint p_height;
-
-               /* verify that the image is not higher than the headers
-                * if there is a next part, we checked before that the
-                * image fits */
-               pango_layout_set_text(test_layout, po->headers, -1);
-               pango_layout_get_size(test_layout, NULL, &p_height);
-               if (c_face_height > P_TO_C(p_height))
-                   psetup->c_y_pos += c_face_height - P_TO_C(p_height);
-           }
-       }
-       list = g_list_append(list, po);
-
-       this_chunk = this_chunk->next;
+        BalsaPrintObjectHeader *poh;
+        BalsaPrintObject *po;
+
+        poh = g_object_new(BALSA_TYPE_PRINT_OBJECT_HEADER, NULL);
+        g_assert(poh != NULL);
+        po = BALSA_PRINT_OBJECT(poh);
+        balsa_print_object_set_on_page(po, first_page++);
+        balsa_print_object_set_c_at_x(po, c_at_x);
+        balsa_print_object_set_c_at_y(po, psetup->c_y0 + c_at_y);
+        balsa_print_object_set_depth(po, psetup->curr_depth);
+        c_at_y = 0.0;
+        balsa_print_object_set_c_width(po, c_use_width);
+        /* note: height is calculated when the object is drawn */
+        poh->headers        = (gchar *) this_chunk->data;
+        poh->p_label_width  = p_label_width;
+        poh->p_layout_width = p_layout_width;
+        if (face != NULL) {
+            poh->face = face;
+            face      = NULL;
+
+            if (this_chunk->next == NULL) {
+                gint p_height;
+
+                /* verify that the image is not higher than the headers
+                 * if there is a next part, we checked before that the
+                 * image fits */
+                pango_layout_set_text(test_layout, poh->headers, -1);
+                pango_layout_get_size(test_layout, NULL, &p_height);
+                if (c_face_height > P_TO_C(p_height))
+                    psetup->c_y_pos += c_face_height - P_TO_C(p_height);
+            }
+        }
+        list = g_list_append(list, po);
+
+        this_chunk = this_chunk->next;
     }
     g_list_free(chunks);
     g_object_unref(G_OBJECT(test_layout));
@@ -319,42 +328,45 @@ balsa_print_object_header_new_real(GList * list,
 
 
 GList *
-balsa_print_object_header_from_message(GList *list,
-                                      GtkPrintContext * context,
-                                      LibBalsaMessage * message,
-                                      const gchar * subject,
-                                      BalsaPrintSetup * psetup)
+balsa_print_object_header_from_message(GList           *list,
+                                       GtkPrintContext *context,
+                                       LibBalsaMessage *message,
+                                       const gchar     *subject,
+                                       BalsaPrintSetup *psetup)
 {
     LibBalsaMessageBody *body_list;
     LibBalsaMessageHeaders *headers;
 
     body_list = libbalsa_message_get_body_list(message);
-    headers = libbalsa_message_get_headers(message);
+    headers   = libbalsa_message_get_headers(message);
     return balsa_print_object_header_new_real(list, context,
-                                             body_list, headers, subject,
-                                             psetup, FALSE);
+                                              body_list, headers, subject,
+                                              psetup, FALSE);
 }
 
 
 GList *
-balsa_print_object_header_from_body(GList *list,
-                                   GtkPrintContext * context,
-                                   LibBalsaMessageBody * body,
-                                   BalsaPrintSetup * psetup)
+balsa_print_object_header_from_body(GList               *list,
+                                    GtkPrintContext     *context,
+                                    LibBalsaMessageBody *body,
+                                    BalsaPrintSetup     *psetup)
 {
     return balsa_print_object_header_new_real(list, context, body->parts,
-                                             body->embhdrs,
-                                             body->embhdrs->subject,
-                                             psetup,
-                                             body->body_type == LIBBALSA_MESSAGE_BODY_TYPE_TEXT);
+                                              body->embhdrs,
+                                              body->embhdrs->subject,
+                                              psetup,
+                                              body->body_type ==
+                                              LIBBALSA_MESSAGE_BODY_TYPE_TEXT);
 }
 
 
 #ifdef HAVE_GPGME
 GList *
-balsa_print_object_header_crypto(GList *list, GtkPrintContext * context,
-                                LibBalsaMessageBody * body, const gchar * label,
-                                BalsaPrintSetup * psetup)
+balsa_print_object_header_crypto(GList               *list,
+                                 GtkPrintContext     *context,
+                                 LibBalsaMessageBody *body,
+                                 const gchar         *label,
+                                 BalsaPrintSetup     *psetup)
 {
     gint first_page;
     gdouble c_at_x;
@@ -368,38 +380,37 @@ balsa_print_object_header_crypto(GList *list, GtkPrintContext * context,
 
     /* only if the body has an attached signature info */
     if (!body->sig_info)
-       return balsa_print_object_default(list, context, body, psetup);
-    
+        return balsa_print_object_default(list, context, body, psetup);
+
     /* start on new page if less than 2 header lines can be printed */
     if (psetup->c_y_pos + 2 * P_TO_C(psetup->p_hdr_font_height) >
-       psetup->c_height) {
-       psetup->c_y_pos = 0;
-       psetup->page_count++;
+        psetup->c_height) {
+        psetup->c_y_pos = 0;
+        psetup->page_count++;
     }
-    first_page = psetup->page_count - 1;
-    c_at_y = psetup->c_y_pos;
+    first_page  = psetup->page_count - 1;
+    c_at_y      = psetup->c_y_pos;
     c_use_width = psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
 
     /* create a layout for wrapping */
     header_font =
-       pango_font_description_from_string(balsa_app.print_header_font);
+        pango_font_description_from_string(balsa_app.print_header_font);
     test_layout = gtk_print_context_create_pango_layout(context);
     pango_layout_set_font_description(test_layout, header_font);
     pango_font_description_free(header_font);
 
     /* check if the key needs to be loaded */
     if (((g_mime_gpgme_sigstat_get_summary(body->sig_info) & GPGME_SIGSUM_KEY_MISSING) == 0) &&
-       (g_mime_gpgme_sigstat_get_key(body->sig_info) == NULL)) {
-       g_mime_gpgme_sigstat_load_key(body->sig_info);
-    }
+        (g_mime_gpgme_sigstat_get_key(body->sig_info) == NULL))
+        g_mime_gpgme_sigstat_load_key(body->sig_info);
 
     /* create a buffer with the signature info */
     textbuf = g_mime_gpgme_sigstat_to_gchar(body->sig_info, TRUE, balsa_app.date_string);
     if (label) {
-       gchar *newbuf = g_strconcat(label, "\n", textbuf, NULL);
+        gchar *newbuf = g_strconcat(label, "\n", textbuf, NULL);
 
-       g_free(textbuf);
-       textbuf = newbuf;
+        g_free(textbuf);
+        textbuf = newbuf;
     }
 
     /* configure the layout so we can use Pango to split the text into pages */
@@ -414,37 +425,41 @@ balsa_print_object_header_crypto(GList *list, GtkPrintContext * context,
 
     /* create a list of objects */
     this_chunk = chunks;
-    c_at_x = psetup->c_x0 + psetup->curr_depth * C_LABEL_SEP;
+    c_at_x     = psetup->c_x0 + psetup->curr_depth * C_LABEL_SEP;
     while (this_chunk) {
-       BalsaPrintObjectHeader *po;
-
-       po = g_object_new(BALSA_TYPE_PRINT_OBJECT_HEADER, NULL);
-       g_assert(po != NULL);
-       BALSA_PRINT_OBJECT(po)->on_page = first_page++;
-       BALSA_PRINT_OBJECT(po)->c_at_x = c_at_x;
-       BALSA_PRINT_OBJECT(po)->c_at_y = psetup->c_y0 + c_at_y;
-       BALSA_PRINT_OBJECT(po)->depth = psetup->curr_depth;
-       c_at_y = 0.0;
-       BALSA_PRINT_OBJECT(po)->c_width = c_use_width;
-       /* note: height is calculated when the object is drawn */
-       po->headers = (gchar *) this_chunk->data;
-       po->p_label_width = 0;
-       po->p_layout_width = C_TO_P(c_use_width);
-       list = g_list_append(list, po);
-
-       this_chunk = this_chunk->next;
+        BalsaPrintObjectHeader *poh;
+        BalsaPrintObject *po;
+
+        poh = g_object_new(BALSA_TYPE_PRINT_OBJECT_HEADER, NULL);
+        g_assert(poh != NULL);
+        po = BALSA_PRINT_OBJECT(poh);
+        balsa_print_object_set_on_page(po, first_page++);
+        balsa_print_object_set_c_at_x(po, c_at_x);
+        balsa_print_object_set_c_at_y(po, psetup->c_y0 + c_at_y);
+        balsa_print_object_set_depth(po, psetup->curr_depth);
+        c_at_y = 0.0;
+        balsa_print_object_set_c_width(po, c_use_width);
+        /* note: height is calculated when the object is drawn */
+        poh->headers        = (gchar *) this_chunk->data;
+        poh->p_label_width  = 0;
+        poh->p_layout_width = C_TO_P(c_use_width);
+        list                = g_list_append(list, po);
+
+        this_chunk = this_chunk->next;
     }
     g_list_free(chunks);
 
     return list;
 }
+
+
 #endif
 
 
 static void
-balsa_print_object_header_draw(BalsaPrintObject * self,
-                               GtkPrintContext * context,
-                               cairo_t * cairo_ctx)
+balsa_print_object_header_draw(BalsaPrintObject *self,
+                               GtkPrintContext  *context,
+                               cairo_t          *cairo_ctx)
 {
     BalsaPrintObjectHeader *po;
     PangoLayout *layout;
@@ -454,65 +469,71 @@ balsa_print_object_header_draw(BalsaPrintObject * self,
     po = BALSA_PRINT_OBJECT_HEADER(self);
     g_assert(po != NULL);
 
-    font = pango_font_description_from_string(balsa_app.print_header_font);
+    font   = pango_font_description_from_string(balsa_app.print_header_font);
     layout = gtk_print_context_create_pango_layout(context);
     pango_layout_set_font_description(layout, font);
     pango_font_description_free(font);
     if (po->p_label_width) {
-       PangoTabArray *tabs;
-       
-       pango_layout_set_indent(layout, -po->p_label_width);
-       tabs = pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
-                                                 po->p_label_width);
-       pango_layout_set_tabs(layout, tabs);
-       pango_tab_array_free(tabs);
+        PangoTabArray *tabs;
+
+        pango_layout_set_indent(layout, -po->p_label_width);
+        tabs = pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
+                                                  po->p_label_width);
+        pango_layout_set_tabs(layout, tabs);
+        pango_tab_array_free(tabs);
     }
     pango_layout_set_width(layout, po->p_layout_width);
     pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
     pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT);
     pango_layout_set_text(layout, po->headers, -1);
     pango_layout_get_size(layout, NULL, &p_height);
-    self->c_height = P_TO_C(p_height); /* needed to properly print borders */
-    cairo_move_to(cairo_ctx, self->c_at_x, self->c_at_y);
+    balsa_print_object_set_c_height(self, P_TO_C(p_height));    /* needed to properly print
+                                                                   borders */
+    cairo_move_to(cairo_ctx, balsa_print_object_get_c_at_x(self),
+                  balsa_print_object_get_c_at_y(self));
     pango_cairo_show_layout(cairo_ctx, layout);
     g_object_unref(G_OBJECT(layout));
 
     /* print a face image */
     if (po->face) {
-       gdouble c_face_h;
-       gdouble c_face_w;
-
-       c_face_h = gdk_pixbuf_get_height(po->face);
-       c_face_w = gdk_pixbuf_get_width(po->face);
-
-       cairo_print_pixbuf(cairo_ctx, po->face,
-                          self->c_at_x + self->c_width - c_face_w,
-                          self->c_at_y, 1.0);
-       if (c_face_h > self->c_height)
-           self->c_height = c_face_h;
+        gdouble c_face_h;
+        gdouble c_face_w;
+
+        c_face_h = gdk_pixbuf_get_height(po->face);
+        c_face_w = gdk_pixbuf_get_width(po->face);
+
+        cairo_print_pixbuf(cairo_ctx, po->face,
+                           balsa_print_object_get_c_at_x(self) +
+                           balsa_print_object_get_c_width(self) - c_face_w,
+                           balsa_print_object_get_c_at_y(self), 1.0);
+        if (c_face_h > balsa_print_object_get_c_height(self))
+            balsa_print_object_set_c_height(self, c_face_h);
     }
 }
 
 
 static void
-header_add_string(PangoLayout * layout, GString * header_buf,
-                 const gchar * field_id, const gchar * label,
-                 const gchar * value, gint * p_label_width,
-                 gboolean print_all_headers)
+header_add_string(PangoLayout *layout,
+                  GString     *header_buf,
+                  const gchar *field_id,
+                  const gchar *label,
+                  const gchar *value,
+                  gint        *p_label_width,
+                  gboolean     print_all_headers)
 {
     gchar *_value;
     gint p_width;
 
-    if (!value || balsa_app.shown_headers == HEADERS_NONE ||
-       !(print_all_headers ||
-         balsa_app.show_all_headers ||
-         balsa_app.shown_headers == HEADERS_ALL ||
-         libbalsa_find_word(field_id, balsa_app.selected_headers)))
-       return;
+    if (!value || (balsa_app.shown_headers == HEADERS_NONE) ||
+        !(print_all_headers ||
+          balsa_app.show_all_headers ||
+          (balsa_app.shown_headers == HEADERS_ALL) ||
+          libbalsa_find_word(field_id, balsa_app.selected_headers)))
+        return;
 
     p_width = p_string_width_from_layout(layout, label);
     if (p_width > *p_label_width)
-       *p_label_width = p_width;
+        *p_label_width = p_width;
     _value = g_strdup(value);
     libbalsa_utf8_sanitize(&_value, balsa_app.convert_unknown_8bit, NULL);
     g_string_append_printf(header_buf, "%s\t%s\n", label, _value);
@@ -521,26 +542,29 @@ header_add_string(PangoLayout * layout, GString * header_buf,
 
 
 static void
-header_add_list(PangoLayout * layout, GString * header_buf,
-               const gchar * field_id, const gchar * label,
-               InternetAddressList * values, gint * p_label_width,
-               gboolean print_all_headers)
+header_add_list(PangoLayout         *layout,
+                GString             *header_buf,
+                const gchar         *field_id,
+                const gchar         *label,
+                InternetAddressList *values,
+                gint                *p_label_width,
+                gboolean             print_all_headers)
 {
     gchar *_value;
     gint p_width;
 
-    if (balsa_app.shown_headers == HEADERS_NONE ||
-       !(print_all_headers ||
-         balsa_app.show_all_headers ||
-         balsa_app.shown_headers == HEADERS_ALL ||
-         libbalsa_find_word(field_id, balsa_app.selected_headers)) ||
+    if ((balsa_app.shown_headers == HEADERS_NONE) ||
+        !(print_all_headers ||
+          balsa_app.show_all_headers ||
+          (balsa_app.shown_headers == HEADERS_ALL) ||
+          libbalsa_find_word(field_id, balsa_app.selected_headers)) ||
         !values ||
         !(_value = internet_address_list_to_string(values, FALSE)))
-       return;
+        return;
 
     p_width = p_string_width_from_layout(layout, label);
     if (p_width > *p_label_width)
-       *p_label_width = p_width;
+        *p_label_width = p_width;
     libbalsa_utf8_sanitize(&_value, balsa_app.convert_unknown_8bit, NULL);
     g_string_append_printf(header_buf, "%s\t%s\n", label, _value);
     g_free(_value);
diff --git a/src/balsa-print-object-header.h b/src/balsa-print-object-header.h
index 88eaaec..af47dca 100644
--- a/src/balsa-print-object-header.h
+++ b/src/balsa-print-object-header.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,20 +21,20 @@
 #define __BALSA_PRINT_OBJECT_HEADER_H__
 
 #ifndef BALSA_VERSION
-# error "Include config.h before this file."
+#   error "Include config.h before this file."
 #endif
 
 #include "balsa-print-object.h"
 
 G_BEGIN_DECLS
 
-#define BALSA_TYPE_PRINT_OBJECT_HEADER \
+#define BALSA_TYPE_PRINT_OBJECT_HEADER  \
     (balsa_print_object_header_get_type())
-#define BALSA_PRINT_OBJECT_HEADER(obj)                         \
+#define BALSA_PRINT_OBJECT_HEADER(obj)                          \
     G_TYPE_CHECK_INSTANCE_CAST(obj, BALSA_TYPE_PRINT_OBJECT_HEADER, BalsaPrintObjectHeader)
-#define BALSA_PRINT_OBJECT_HEADER_CLASS(klass)                 \
+#define BALSA_PRINT_OBJECT_HEADER_CLASS(klass)                  \
     G_TYPE_CHECK_CLASS_CAST(klass, BALSA_TYPE_PRINT_OBJECT_HEADER, BalsaPrintObjectHeaderClass)
-#define BALSA_IS_PRINT_OBJECT_HEADER(obj)                      \
+#define BALSA_IS_PRINT_OBJECT_HEADER(obj)                       \
     G_TYPE_CHECK_INSTANCE_TYPE(obj, BALSA_TYPE_PRINT_OBJECT_HEADER)
 
 
@@ -57,25 +57,27 @@ struct _BalsaPrintObjectHeaderClass {
 };
 
 
-GType balsa_print_object_header_get_type(void);
-GList *balsa_print_object_header_from_message(GList *list,
-                                             GtkPrintContext * context,
-                                             LibBalsaMessage * message,
-                                             const gchar * subject,
-                                              BalsaPrintSetup * psetup);
-GList *balsa_print_object_header_from_body(GList *list,
-                                          GtkPrintContext * context,
-                                          LibBalsaMessageBody * body,
-                                          BalsaPrintSetup * psetup);
+GType  balsa_print_object_header_get_type(void);
+GList *balsa_print_object_header_from_message(GList           *list,
+                                              GtkPrintContext *context,
+                                              LibBalsaMessage *message,
+                                              const gchar     *subject,
+                                              BalsaPrintSetup *psetup);
+GList *balsa_print_object_header_from_body(GList               *list,
+                                           GtkPrintContext     *context,
+                                           LibBalsaMessageBody *body,
+                                           BalsaPrintSetup     *psetup);
+
 #ifdef HAVE_GPGME
-GList *balsa_print_object_header_crypto(GList *list,
-                                       GtkPrintContext * context,
-                                       LibBalsaMessageBody * body,
-                                       const gchar * label,
-                                       BalsaPrintSetup * psetup);
+GList *balsa_print_object_header_crypto(GList               *list,
+                                        GtkPrintContext     *context,
+                                        LibBalsaMessageBody *body,
+                                        const gchar         *label,
+                                        BalsaPrintSetup     *psetup);
+
 #endif
 
 
 G_END_DECLS
 
-#endif                         /* __BALSA_PRINT_OBJECT_HEADER_H__ */
+#endif                          /* __BALSA_PRINT_OBJECT_HEADER_H__ */
diff --git a/src/balsa-print-object-image.c b/src/balsa-print-object-image.c
index ad7ccfb..d7c3da9 100644
--- a/src/balsa-print-object-image.c
+++ b/src/balsa-print-object-image.c
@@ -7,18 +7,18 @@
  * it under the terms of the GNU General Public License as published by
  * 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/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-# include "config.h"
+#   include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-print-object-image.h"
 #include "balsa-print-object-default.h"
@@ -26,15 +26,14 @@
 #include <gtk/gtk.h>
 
 /* object related functions */
-static void
-balsa_print_object_image_class_init(BalsaPrintObjectImageClass * klass);
-static void balsa_print_object_image_init (GTypeInstance *instance,
-                                          gpointer g_class);
-static void balsa_print_object_image_dispose(GObject * self);
+static void balsa_print_object_image_class_init(BalsaPrintObjectImageClass *klass);
+static void balsa_print_object_image_init(GTypeInstance *instance,
+                                          gpointer       g_class);
+static void balsa_print_object_image_dispose(GObject *self);
 
-static void balsa_print_object_image_draw(BalsaPrintObject * self,
-                                         GtkPrintContext * context,
-                                         cairo_t * cairo_ctx);
+static void balsa_print_object_image_draw(BalsaPrintObject *self,
+                                          GtkPrintContext  *context,
+                                          cairo_t          *cairo_ctx);
 
 
 static BalsaPrintObjectClass *parent_class = NULL;
@@ -46,22 +45,22 @@ balsa_print_object_image_get_type()
     static GType balsa_print_object_image_type = 0;
 
     if (!balsa_print_object_image_type) {
-       static const GTypeInfo balsa_print_object_image_info = {
-           sizeof(BalsaPrintObjectImageClass),
-           NULL,               /* base_init */
-           NULL,               /* base_finalize */
-           (GClassInitFunc) balsa_print_object_image_class_init,
-           NULL,               /* class_finalize */
-           NULL,               /* class_data */
-           sizeof(BalsaPrintObjectImage),
-           0,                  /* n_preallocs */
-           (GInstanceInitFunc) balsa_print_object_image_init
-       };
-
-       balsa_print_object_image_type =
-           g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
-                                  "BalsaPrintObjectImage",
-                                  &balsa_print_object_image_info, 0);
+        static const GTypeInfo balsa_print_object_image_info = {
+            sizeof(BalsaPrintObjectImageClass),
+            NULL,               /* base_init */
+            NULL,               /* base_finalize */
+            (GClassInitFunc) balsa_print_object_image_class_init,
+            NULL,               /* class_finalize */
+            NULL,               /* class_data */
+            sizeof(BalsaPrintObjectImage),
+            0,                  /* n_preallocs */
+            (GInstanceInitFunc) balsa_print_object_image_init
+        };
+
+        balsa_print_object_image_type =
+            g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
+                                   "BalsaPrintObjectImage",
+                                   &balsa_print_object_image_info, 0);
     }
 
     return balsa_print_object_image_type;
@@ -69,39 +68,42 @@ balsa_print_object_image_get_type()
 
 
 static void
-balsa_print_object_image_class_init(BalsaPrintObjectImageClass * klass)
+balsa_print_object_image_class_init(BalsaPrintObjectImageClass *klass)
 {
-    parent_class = g_type_class_ref(BALSA_TYPE_PRINT_OBJECT);
+    parent_class                          = g_type_class_ref(BALSA_TYPE_PRINT_OBJECT);
     BALSA_PRINT_OBJECT_CLASS(klass)->draw =
-       balsa_print_object_image_draw;
+        balsa_print_object_image_draw;
     G_OBJECT_CLASS(klass)->dispose = balsa_print_object_image_dispose;
 }
 
 
 static void
-balsa_print_object_image_init(GTypeInstance * instance, gpointer g_class)
+balsa_print_object_image_init(GTypeInstance *instance,
+                              gpointer       g_class)
 {
-    BalsaPrintObjectImage *po = BALSA_PRINT_OBJECT_IMAGE(instance);
+    BalsaPrintObjectImage *poi = BALSA_PRINT_OBJECT_IMAGE(instance);
 
-    po->pixbuf = NULL;
-    po->scale = 1.0;
+    poi->pixbuf = NULL;
+    poi->scale  = 1.0;
 }
 
 
 static void
-balsa_print_object_image_dispose(GObject * self)
+balsa_print_object_image_dispose(GObject *self)
 {
-    BalsaPrintObjectImage *po = BALSA_PRINT_OBJECT_IMAGE(self);
+    BalsaPrintObjectImage *poi = BALSA_PRINT_OBJECT_IMAGE(self);
 
-    g_clear_object(&po->pixbuf);
+    g_clear_object(&poi->pixbuf);
 
     G_OBJECT_CLASS(parent_class)->dispose(self);
 }
 
 
 GList *
-balsa_print_object_image(GList * list, GtkPrintContext *context,
-                        LibBalsaMessageBody *body, BalsaPrintSetup * psetup)
+balsa_print_object_image(GList               *list,
+                         GtkPrintContext     *context,
+                         LibBalsaMessageBody *body,
+                         BalsaPrintSetup     *psetup)
 {
     BalsaPrintObjectImage *poi;
     BalsaPrintObject *po;
@@ -114,53 +116,53 @@ balsa_print_object_image(GList * list, GtkPrintContext *context,
     /* check if we can handle the image */
     pixbuf = libbalsa_message_body_get_pixbuf(body, &err);
     if (err) {
-       g_message("Error loading image from file: %s", err->message);
-       g_error_free(err);
+        g_message("Error loading image from file: %s", err->message);
+        g_error_free(err);
     }
 
     /* fall back to default if the pixbuf could no be loaded */
     if (!pixbuf)
-      return balsa_print_object_default(list, context, body, psetup);
+        return balsa_print_object_default(list, context, body, psetup);
 
     /* create the part */
     poi = g_object_new(BALSA_TYPE_PRINT_OBJECT_IMAGE, NULL);
     g_assert(poi != NULL);
     po = BALSA_PRINT_OBJECT(poi);
-    po->depth = psetup->curr_depth;
-    poi->pixbuf = pixbuf;
-    c_use_width = psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
-    c_img_width = gdk_pixbuf_get_width(pixbuf);
+    balsa_print_object_set_depth(po, psetup->curr_depth);
+    poi->pixbuf  = pixbuf;
+    c_use_width  = psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
+    c_img_width  = gdk_pixbuf_get_width(pixbuf);
     c_img_height = gdk_pixbuf_get_height(pixbuf);
-    poi->scale = 1.0;
+    poi->scale   = 1.0;
 
     /* check if we should scale the width */
     if (c_img_width > c_use_width) {
-       poi->scale = c_use_width / c_img_width;
-       c_img_height *= poi->scale;
-       c_img_width = c_use_width;
+        poi->scale    = c_use_width / c_img_width;
+        c_img_height *= poi->scale;
+        c_img_width   = c_use_width;
     }
 
     /* check if the image is too high for one full page */
     if (c_img_height > psetup->c_height) {
-       gdouble hscale = psetup->c_height / c_img_height;
-       poi->scale *= hscale;
-       c_img_width *= hscale;
-       c_img_height = psetup->c_height;
+        gdouble hscale = psetup->c_height / c_img_height;
+        poi->scale  *= hscale;
+        c_img_width *= hscale;
+        c_img_height = psetup->c_height;
     }
 
     /* check if we should move to the next page */
     if (psetup->c_y_pos + c_img_height > psetup->c_height) {
-       psetup->c_y_pos = 0;
-       psetup->page_count++;
+        psetup->c_y_pos = 0;
+        psetup->page_count++;
     }
 
     /* remember the extent */
-    po->on_page = psetup->page_count - 1;
-    po->c_at_x = psetup->c_x0 + psetup->curr_depth * C_LABEL_SEP;
-    po->c_at_y = psetup->c_y0 + psetup->c_y_pos;
-    po->c_width = c_img_width;
+    balsa_print_object_set_on_page(po, psetup->page_count - 1);
+    balsa_print_object_set_c_at_x(po, psetup->c_x0 + psetup->curr_depth * C_LABEL_SEP);
+    balsa_print_object_set_c_at_y(po, psetup->c_y0 + psetup->c_y_pos);
+    balsa_print_object_set_c_width(po, c_img_width);
     poi->c_img_offs = 0.5 * (c_use_width - c_img_width);
-    po->c_height = c_img_height;
+    balsa_print_object_set_c_height(po, c_img_height);
 
     /* adjust the y position */
     psetup->c_y_pos += c_img_height;
@@ -170,9 +172,9 @@ balsa_print_object_image(GList * list, GtkPrintContext *context,
 
 
 static void
-balsa_print_object_image_draw(BalsaPrintObject * self,
-                             GtkPrintContext * context,
-                             cairo_t * cairo_ctx)
+balsa_print_object_image_draw(BalsaPrintObject *self,
+                              GtkPrintContext  *context,
+                              cairo_t          *cairo_ctx)
 {
     BalsaPrintObjectImage *poi;
 
@@ -181,6 +183,7 @@ balsa_print_object_image_draw(BalsaPrintObject * self,
     g_assert(poi != NULL);
 
     /* print the image */
-    cairo_print_pixbuf(cairo_ctx, poi->pixbuf, self->c_at_x + poi->c_img_offs,
-                      self->c_at_y, poi->scale);
+    cairo_print_pixbuf(cairo_ctx, poi->pixbuf, balsa_print_object_get_c_at_x(
+                           self) + poi->c_img_offs,
+                       balsa_print_object_get_c_at_y(self), poi->scale);
 }
diff --git a/src/balsa-print-object-image.h b/src/balsa-print-object-image.h
index e52fa77..04baae4 100644
--- a/src/balsa-print-object-image.h
+++ b/src/balsa-print-object-image.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/>.
  */
@@ -24,13 +24,13 @@
 
 G_BEGIN_DECLS
 
-#define BALSA_TYPE_PRINT_OBJECT_IMAGE  \
+#define BALSA_TYPE_PRINT_OBJECT_IMAGE   \
     (balsa_print_object_image_get_type())
-#define BALSA_PRINT_OBJECT_IMAGE(obj)                          \
+#define BALSA_PRINT_OBJECT_IMAGE(obj)                           \
     G_TYPE_CHECK_INSTANCE_CAST(obj, BALSA_TYPE_PRINT_OBJECT_IMAGE, BalsaPrintObjectImage)
-#define BALSA_PRINT_OBJECT_IMAGE_CLASS(klass)                  \
+#define BALSA_PRINT_OBJECT_IMAGE_CLASS(klass)                   \
     G_TYPE_CHECK_CLASS_CAST(klass, BALSA_TYPE_PRINT_OBJECT_IMAGE, BalsaPrintObjectImageClass)
-#define BALSA_IS_PRINT_OBJECT_IMAGE(obj)                       \
+#define BALSA_IS_PRINT_OBJECT_IMAGE(obj)                        \
     G_TYPE_CHECK_INSTANCE_TYPE(obj, BALSA_TYPE_PRINT_OBJECT_IMAGE)
 
 
@@ -52,13 +52,13 @@ struct _BalsaPrintObjectImageClass {
 };
 
 
-GType balsa_print_object_image_get_type(void);
-GList *balsa_print_object_image(GList *list,
-                               GtkPrintContext *context,
-                               LibBalsaMessageBody *body,
-                               BalsaPrintSetup *psetup);
+GType  balsa_print_object_image_get_type(void);
+GList *balsa_print_object_image(GList               *list,
+                                GtkPrintContext     *context,
+                                LibBalsaMessageBody *body,
+                                BalsaPrintSetup     *psetup);
 
 
 G_END_DECLS
 
-#endif                         /* __BALSA_PRINT_OBJECT_IMAGE_H__ */
+#endif                          /* __BALSA_PRINT_OBJECT_IMAGE_H__ */
diff --git a/src/balsa-print-object-text.c b/src/balsa-print-object-text.c
index 645ed2f..cd0641b 100644
--- a/src/balsa-print-object-text.c
+++ b/src/balsa-print-object-text.c
@@ -7,18 +7,18 @@
  * it under the terms of the GNU General Public License as published by
  * 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/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-# include "config.h"
+#   include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-print-object-text.h"
 
@@ -48,19 +48,23 @@ typedef struct {
 
 
 /* object related functions */
-static void balsa_print_object_text_class_init(BalsaPrintObjectTextClass * klass);
-static void balsa_print_object_text_init(GTypeInstance * instance,
-                                        gpointer g_class);
-static void balsa_print_object_text_finalize(GObject * self);
+static void balsa_print_object_text_class_init(BalsaPrintObjectTextClass *klass);
+static void balsa_print_object_text_init(GTypeInstance *instance,
+                                         gpointer       g_class);
+static void balsa_print_object_text_finalize(GObject *self);
 
-static void balsa_print_object_text_draw(BalsaPrintObject * self,
-                                        GtkPrintContext * context,
-                                        cairo_t * cairo_ctx);
+static void balsa_print_object_text_draw(BalsaPrintObject *self,
+                                         GtkPrintContext  *context,
+                                         cairo_t          *cairo_ctx);
 
-static GList * collect_attrs(GList * all_attr, guint offset, guint len);
-static PangoAttrList * phrase_list_to_pango(GList * phrase_list);
-static GList * phrase_highlight(const gchar * buffer, gunichar tag_char,
-                               PhraseType tag_type, GList * phrase_list);
+static GList *collect_attrs(GList *all_attr,
+                            guint  offset,
+                            guint  len);
+static PangoAttrList *phrase_list_to_pango(GList *phrase_list);
+static GList         *phrase_highlight(const gchar *buffer,
+                                       gunichar     tag_char,
+                                       PhraseType   tag_type,
+                                       GList       *phrase_list);
 
 
 static BalsaPrintObjectClass *parent_class = NULL;
@@ -72,22 +76,22 @@ balsa_print_object_text_get_type()
     static GType balsa_print_object_text_type = 0;
 
     if (!balsa_print_object_text_type) {
-       static const GTypeInfo balsa_print_object_text_info = {
-           sizeof(BalsaPrintObjectTextClass),
-           NULL,               /* base_init */
-           NULL,               /* base_finalize */
-           (GClassInitFunc) balsa_print_object_text_class_init,
-           NULL,               /* class_finalize */
-           NULL,               /* class_data */
-           sizeof(BalsaPrintObjectText),
-           0,                  /* n_preallocs */
-           (GInstanceInitFunc) balsa_print_object_text_init
-       };
-
-       balsa_print_object_text_type =
-           g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
-                                  "BalsaPrintObjectText",
-                                  &balsa_print_object_text_info, 0);
+        static const GTypeInfo balsa_print_object_text_info = {
+            sizeof(BalsaPrintObjectTextClass),
+            NULL,               /* base_init */
+            NULL,               /* base_finalize */
+            (GClassInitFunc) balsa_print_object_text_class_init,
+            NULL,               /* class_finalize */
+            NULL,               /* class_data */
+            sizeof(BalsaPrintObjectText),
+            0,                  /* n_preallocs */
+            (GInstanceInitFunc) balsa_print_object_text_init
+        };
+
+        balsa_print_object_text_type =
+            g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
+                                   "BalsaPrintObjectText",
+                                   &balsa_print_object_text_info, 0);
     }
 
     return balsa_print_object_text_type;
@@ -95,44 +99,47 @@ balsa_print_object_text_get_type()
 
 
 static void
-balsa_print_object_text_class_init(BalsaPrintObjectTextClass * klass)
+balsa_print_object_text_class_init(BalsaPrintObjectTextClass *klass)
 {
-    parent_class = g_type_class_ref(BALSA_TYPE_PRINT_OBJECT);
+    parent_class                          = g_type_class_ref(BALSA_TYPE_PRINT_OBJECT);
     BALSA_PRINT_OBJECT_CLASS(klass)->draw =
-       balsa_print_object_text_draw;
+        balsa_print_object_text_draw;
     G_OBJECT_CLASS(klass)->finalize = balsa_print_object_text_finalize;
 }
 
 
 static void
-balsa_print_object_text_init(GTypeInstance * instance, gpointer g_class)
+balsa_print_object_text_init(GTypeInstance *instance,
+                             gpointer       g_class)
 {
-    BalsaPrintObjectText *po = BALSA_PRINT_OBJECT_TEXT(instance);
+    BalsaPrintObjectText *pot = BALSA_PRINT_OBJECT_TEXT(instance);
 
-    po->text = NULL;
-    po->attributes = NULL;
+    pot->text       = NULL;
+    pot->attributes = NULL;
 }
 
 
 static void
-balsa_print_object_text_finalize(GObject * self)
+balsa_print_object_text_finalize(GObject *self)
 {
-    BalsaPrintObjectText *po = BALSA_PRINT_OBJECT_TEXT(self);
+    BalsaPrintObjectText *pot = BALSA_PRINT_OBJECT_TEXT(self);
 
-    g_list_free_full(po->attributes, g_free);
-    g_free(po->text);
+    g_list_free_full(pot->attributes, g_free);
+    g_free(pot->text);
 
     G_OBJECT_CLASS(parent_class)->finalize(self);
 }
 
+
 /* prepare a text/plain part, which gets
  * - citation bars and colourisation of cited text (prefs dependant)
  * - syntax highlighting (prefs dependant)
  * - RFC 3676 "flowed" processing */
 GList *
-balsa_print_object_text_plain(GList *list, GtkPrintContext * context,
-                             LibBalsaMessageBody * body,
-                             BalsaPrintSetup * psetup)
+balsa_print_object_text_plain(GList               *list,
+                              GtkPrintContext     *context,
+                              LibBalsaMessageBody *body,
+                              BalsaPrintSetup     *psetup)
 {
     GRegex *rex;
     gchar *textbuf;
@@ -140,48 +147,48 @@ balsa_print_object_text_plain(GList *list, GtkPrintContext * context,
     gdouble c_at_x;
     gdouble c_use_width;
     guint first_page;
-    gchar * par_start;
-    gchar * eol;
+    gchar *par_start;
+    gchar *eol;
     gint par_len;
 
     /* set up the regular expression for qouted text */
     if (!(rex = balsa_quote_regex_new()))
-       return balsa_print_object_default(list, context, body, psetup);
+        return balsa_print_object_default(list, context, body, psetup);
 
     /* start on new page if less than 2 lines can be printed */
     if (psetup->c_y_pos + 2 * P_TO_C(psetup->p_body_font_height) >
-       psetup->c_height) {
-       psetup->c_y_pos = 0;
-       psetup->page_count++;
+        psetup->c_height) {
+        psetup->c_y_pos = 0;
+        psetup->page_count++;
     }
-    c_at_x = psetup->c_x0 + psetup->curr_depth * C_LABEL_SEP;
+    c_at_x      = psetup->c_x0 + psetup->curr_depth * C_LABEL_SEP;
     c_use_width = psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
 
     /* copy the text body to a buffer */
     if (body->buffer)
-       textbuf = g_strdup(body->buffer);
+        textbuf = g_strdup(body->buffer);
     else
-       libbalsa_message_body_get_content(body, &textbuf, NULL);
+        libbalsa_message_body_get_content(body, &textbuf, NULL);
 
     /* fake an empty buffer if textbuf is NULL */
     if (!textbuf)
-       textbuf = g_strdup("");
+        textbuf = g_strdup("");
 
     /* be sure the we have correct utf-8 stuff here... */
     libbalsa_utf8_sanitize(&textbuf, balsa_app.convert_unknown_8bit, NULL);
 
     /* apply flowed if requested */
     if (libbalsa_message_body_is_flowed(body)) {
-       GString *flowed;
-
-       flowed =
-           libbalsa_process_text_rfc2646(textbuf, G_MAXINT, FALSE, FALSE,
-                                         FALSE,
-                                         libbalsa_message_body_is_delsp
-                                         (body));
-       g_free(textbuf);
-       textbuf = flowed->str;
-       g_string_free(flowed, FALSE);
+        GString *flowed;
+
+        flowed =
+            libbalsa_process_text_rfc2646(textbuf, G_MAXINT, FALSE, FALSE,
+                                          FALSE,
+                                          libbalsa_message_body_is_delsp
+                                              (body));
+        g_free(textbuf);
+        textbuf = flowed->str;
+        g_string_free(flowed, FALSE);
     }
 
     /* get the font */
@@ -189,127 +196,129 @@ balsa_print_object_text_plain(GList *list, GtkPrintContext * context,
 
     /* loop over paragraphs */
     par_start = textbuf;
-    eol = strchr(par_start, '\n');
-    par_len = eol ? eol - par_start : (gint) strlen(par_start);
+    eol       = strchr(par_start, '\n');
+    par_len   = eol ? eol - par_start : (gint) strlen(par_start);
     while (*par_start) {
-       GString *level_buf;
-       guint curr_level;
-       guint cite_level;
-       GList *par_parts;
-       GList *this_par_part;
-       GList *attr_list;
-       PangoLayout *layout;
-       PangoAttrList *pango_attr_list;
-       GArray *attr_offs;
-       gdouble c_at_y;
-
-       level_buf = NULL;
-       curr_level = 0;         /* just to make the compiler happy */
-       do {
-           gchar *thispar;
-           guint cite_idx;
-
-           thispar = g_strndup(par_start, par_len);
-
-           /* get the cite level and strip off the prefix */
-           if (libbalsa_match_regex(thispar, rex, &cite_level, &cite_idx))
-            {
-               gchar *new;
-
-               new = thispar + cite_idx;
-               if (g_unichar_isspace(g_utf8_get_char(new)))
-                   new = g_utf8_next_char(new);
-               new = g_strdup(new);
-               g_free(thispar);
-               thispar = new;
-           }
-
-           /* glue paragraphs with the same cite level together */
-           if (!level_buf || (curr_level == cite_level)) {
-               if (!level_buf) {
-                   level_buf = g_string_new(thispar);
-                   curr_level = cite_level;
-               } else {
-                   level_buf = g_string_append_c(level_buf, '\n');
-                   level_buf = g_string_append(level_buf, thispar);
-               }
-
-               par_start = eol ? eol + 1 : par_start + par_len;
-               eol = strchr(par_start, '\n');
-               par_len = eol ? eol - par_start : (gint) strlen(par_start);
-           }
-
-           g_free(thispar);
-       } while (*par_start && (curr_level == cite_level));
-       
-       /* configure the layout so we can use Pango to split the text into pages */
-       layout = gtk_print_context_create_pango_layout(context);
-       pango_layout_set_font_description(layout, font);
-       pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT);
-       pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
-
-       /* leave place for the citation bars */
-       pango_layout_set_width(layout,
-                              C_TO_P(c_use_width - curr_level * C_LABEL_SEP));
-
-       /* highlight structured phrases if requested */
-       if (balsa_app.print_highlight_phrases) {
-           attr_list =
-               phrase_highlight(level_buf->str, '*', PHRASE_BF, NULL);
-           attr_list =
-               phrase_highlight(level_buf->str, '/', PHRASE_EM, attr_list);
-           attr_list =
-               phrase_highlight(level_buf->str, '_', PHRASE_UL, attr_list);
-       } else
-           attr_list = NULL;
-
-       /* start on new page if less than one line can be printed */
-       if (psetup->c_y_pos + P_TO_C(psetup->p_body_font_height) >
-           psetup->c_height) {
-           psetup->c_y_pos = 0;
-           psetup->page_count++;
-       }
-
-       /* split paragraph if necessary */
-       pango_attr_list = phrase_list_to_pango(attr_list);
-       first_page = psetup->page_count - 1;
-       c_at_y = psetup->c_y_pos;
-       par_parts =
-           split_for_layout(layout, level_buf->str, pango_attr_list,
-                            psetup, FALSE, &attr_offs);
-       if (pango_attr_list)
-           pango_attr_list_unref(pango_attr_list);
-       g_object_unref(G_OBJECT(layout));
-       g_string_free(level_buf, TRUE);
-
-       /* each part is a new text object */
-       this_par_part = par_parts;
-       while (this_par_part) {
-           BalsaPrintObjectText *pot;
-
-           pot = g_object_new(BALSA_TYPE_PRINT_OBJECT_TEXT, NULL);
-           g_assert(pot != NULL);
-           BALSA_PRINT_OBJECT(pot)->on_page = first_page++;
-           BALSA_PRINT_OBJECT(pot)->c_at_x = c_at_x;
-           BALSA_PRINT_OBJECT(pot)->c_at_y = psetup->c_y0 + c_at_y;
-           BALSA_PRINT_OBJECT(pot)->depth = psetup->curr_depth;
-           c_at_y = 0.0;
-           BALSA_PRINT_OBJECT(pot)->c_width = c_use_width;
-           /* note: height is calculated when the object is drawn */
-           pot->text = (gchar *) this_par_part->data;
-           pot->cite_level = curr_level;
-           pot->attributes =
-               collect_attrs(attr_list,
-                             g_array_index(attr_offs, guint, 0),
-                             strlen(pot->text));
-
-           list = g_list_append(list, pot);
-           g_array_remove_index(attr_offs, 0);
-           this_par_part = this_par_part->next;
-       }
-       g_list_free_full(attr_list, g_free);
-       g_list_free(par_parts);
-       g_array_free(attr_offs, TRUE);
+        GString *level_buf;
+        guint curr_level;
+        guint cite_level;
+        GList *par_parts;
+        GList *this_par_part;
+        GList *attr_list;
+        PangoLayout *layout;
+        PangoAttrList *pango_attr_list;
+        GArray *attr_offs;
+        gdouble c_at_y;
+
+        level_buf  = NULL;
+        curr_level = 0;         /* just to make the compiler happy */
+        do {
+            gchar *thispar;
+            guint cite_idx;
+
+            thispar = g_strndup(par_start, par_len);
+
+            /* get the cite level and strip off the prefix */
+            if (libbalsa_match_regex(thispar, rex, &cite_level, &cite_idx)) {
+                gchar *new;
+
+                new = thispar + cite_idx;
+                if (g_unichar_isspace(g_utf8_get_char(new)))
+                    new = g_utf8_next_char(new);
+                new = g_strdup(new);
+                g_free(thispar);
+                thispar = new;
+            }
+
+            /* glue paragraphs with the same cite level together */
+            if (!level_buf || (curr_level == cite_level)) {
+                if (!level_buf) {
+                    level_buf  = g_string_new(thispar);
+                    curr_level = cite_level;
+                } else {
+                    level_buf = g_string_append_c(level_buf, '\n');
+                    level_buf = g_string_append(level_buf, thispar);
+                }
+
+                par_start = eol ? eol + 1 : par_start + par_len;
+                eol       = strchr(par_start, '\n');
+                par_len   = eol ? eol - par_start : (gint) strlen(par_start);
+            }
+
+            g_free(thispar);
+        } while (*par_start && (curr_level == cite_level));
+
+        /* configure the layout so we can use Pango to split the text into pages */
+        layout = gtk_print_context_create_pango_layout(context);
+        pango_layout_set_font_description(layout, font);
+        pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT);
+        pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
+
+        /* leave place for the citation bars */
+        pango_layout_set_width(layout,
+                               C_TO_P(c_use_width - curr_level * C_LABEL_SEP));
+
+        /* highlight structured phrases if requested */
+        if (balsa_app.print_highlight_phrases) {
+            attr_list =
+                phrase_highlight(level_buf->str, '*', PHRASE_BF, NULL);
+            attr_list =
+                phrase_highlight(level_buf->str, '/', PHRASE_EM, attr_list);
+            attr_list =
+                phrase_highlight(level_buf->str, '_', PHRASE_UL, attr_list);
+        } else {
+            attr_list = NULL;
+        }
+
+        /* start on new page if less than one line can be printed */
+        if (psetup->c_y_pos + P_TO_C(psetup->p_body_font_height) >
+            psetup->c_height) {
+            psetup->c_y_pos = 0;
+            psetup->page_count++;
+        }
+
+        /* split paragraph if necessary */
+        pango_attr_list = phrase_list_to_pango(attr_list);
+        first_page      = psetup->page_count - 1;
+        c_at_y          = psetup->c_y_pos;
+        par_parts       =
+            split_for_layout(layout, level_buf->str, pango_attr_list,
+                             psetup, FALSE, &attr_offs);
+        if (pango_attr_list)
+            pango_attr_list_unref(pango_attr_list);
+        g_object_unref(G_OBJECT(layout));
+        g_string_free(level_buf, TRUE);
+
+        /* each part is a new text object */
+        this_par_part = par_parts;
+        while (this_par_part) {
+            BalsaPrintObjectText *pot;
+            BalsaPrintObject *po;
+
+            pot = g_object_new(BALSA_TYPE_PRINT_OBJECT_TEXT, NULL);
+            g_assert(pot != NULL);
+            po = BALSA_PRINT_OBJECT(pot);
+            balsa_print_object_set_on_page(po, first_page++);
+            balsa_print_object_set_c_at_x(po, c_at_x);
+            balsa_print_object_set_c_at_y(po, psetup->c_y0 + c_at_y);
+            balsa_print_object_set_depth(po, psetup->curr_depth);
+            c_at_y = 0.0;
+            balsa_print_object_set_c_width(po, c_use_width);
+            /* note: height is calculated when the object is drawn */
+            pot->text       = (gchar *) this_par_part->data;
+            pot->cite_level = curr_level;
+            pot->attributes =
+                collect_attrs(attr_list,
+                              g_array_index(attr_offs, guint, 0),
+                              strlen(pot->text));
+
+            list = g_list_append(list, pot);
+            g_array_remove_index(attr_offs, 0);
+            this_par_part = this_par_part->next;
+        }
+        g_list_free_full(attr_list, g_free);
+        g_list_free(par_parts);
+        g_array_free(attr_offs, TRUE);
     }
 
     /* clean up */
@@ -323,9 +332,10 @@ balsa_print_object_text_plain(GList *list, GtkPrintContext * context,
 /* prepare a text part which is simply printed "as is" without all the bells
  * and whistles of text/plain (see above) */
 GList *
-balsa_print_object_text(GList *list, GtkPrintContext * context,
-                       LibBalsaMessageBody * body,
-                       BalsaPrintSetup * psetup)
+balsa_print_object_text(GList               *list,
+                        GtkPrintContext     *context,
+                        LibBalsaMessageBody *body,
+                        BalsaPrintSetup     *psetup)
 {
     gchar *textbuf;
     PangoFontDescription *font;
@@ -339,22 +349,22 @@ balsa_print_object_text(GList *list, GtkPrintContext * context,
 
     /* start on new page if less than 2 lines can be printed */
     if (psetup->c_y_pos + 2 * P_TO_C(psetup->p_body_font_height) >
-       psetup->c_height) {
-       psetup->c_y_pos = 0;
-       psetup->page_count++;
+        psetup->c_height) {
+        psetup->c_y_pos = 0;
+        psetup->page_count++;
     }
-    c_at_x = psetup->c_x0 + psetup->curr_depth * C_LABEL_SEP;
+    c_at_x      = psetup->c_x0 + psetup->curr_depth * C_LABEL_SEP;
     c_use_width = psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
 
     /* copy the text body to a buffer */
     if (body->buffer)
-       textbuf = g_strdup(body->buffer);
+        textbuf = g_strdup(body->buffer);
     else
-       libbalsa_message_body_get_content(body, &textbuf, NULL);
+        libbalsa_message_body_get_content(body, &textbuf, NULL);
 
     /* fake an empty buffer if textbuf is NULL */
     if (!textbuf)
-       textbuf = g_strdup("");
+        textbuf = g_strdup("");
 
     /* be sure the we have correct utf-8 stuff here... */
     libbalsa_utf8_sanitize(&textbuf, balsa_app.convert_unknown_8bit, NULL);
@@ -371,8 +381,8 @@ balsa_print_object_text(GList *list, GtkPrintContext * context,
 
     /* split paragraph if necessary */
     first_page = psetup->page_count - 1;
-    c_at_y = psetup->c_y_pos;
-    par_parts = split_for_layout(layout, textbuf, NULL, psetup, FALSE, NULL);
+    c_at_y     = psetup->c_y_pos;
+    par_parts  = split_for_layout(layout, textbuf, NULL, psetup, FALSE, NULL);
     g_object_unref(G_OBJECT(layout));
     pango_font_description_free(font);
     g_free(textbuf);
@@ -380,23 +390,25 @@ balsa_print_object_text(GList *list, GtkPrintContext * context,
     /* each part is a new text object */
     this_par_part = par_parts;
     while (this_par_part) {
-       BalsaPrintObjectText *pot;
-
-       pot = g_object_new(BALSA_TYPE_PRINT_OBJECT_TEXT, NULL);
-       g_assert(pot != NULL);
-       BALSA_PRINT_OBJECT(pot)->on_page = first_page++;
-       BALSA_PRINT_OBJECT(pot)->c_at_x = c_at_x;
-       BALSA_PRINT_OBJECT(pot)->c_at_y = psetup->c_y0 + c_at_y;
-       BALSA_PRINT_OBJECT(pot)->depth = psetup->curr_depth;
-       c_at_y = 0.0;
-       BALSA_PRINT_OBJECT(pot)->c_width = c_use_width;
-       /* note: height is calculated when the object is drawn */
-       pot->text = (gchar *) this_par_part->data;
-       pot->cite_level = 0;
-       pot->attributes = NULL;
-
-       list = g_list_append(list, pot);
-       this_par_part = this_par_part->next;
+        BalsaPrintObjectText *pot;
+        BalsaPrintObject *po;
+
+        pot = g_object_new(BALSA_TYPE_PRINT_OBJECT_TEXT, NULL);
+        g_assert(pot != NULL);
+        po = BALSA_PRINT_OBJECT(pot);
+        balsa_print_object_set_on_page(po, first_page++);
+        balsa_print_object_set_c_at_x(po, c_at_x);
+        balsa_print_object_set_c_at_y(po, psetup->c_y0 + c_at_y);
+        balsa_print_object_set_depth(po, psetup->curr_depth);
+        c_at_y = 0.0;
+        balsa_print_object_set_c_width(po, c_use_width);
+        /* note: height is calculated when the object is drawn */
+        pot->text       = (gchar *) this_par_part->data;
+        pot->cite_level = 0;
+        pot->attributes = NULL;
+
+        list          = g_list_append(list, pot);
+        this_par_part = this_par_part->next;
     }
     g_list_free(par_parts);
 
@@ -407,23 +419,23 @@ balsa_print_object_text(GList *list, GtkPrintContext * context,
 /* note: a vcard is an icon plus a series of labels/text, so this function actually
  * returns a BalsaPrintObjectDefault... */
 
-#define ADD_VCARD_FIELD(buf, labwidth, layout, field, descr)           \
-    do {                                                               \
-       if (field) {                                                    \
-           gint label_width = p_string_width_from_layout(layout, descr); \
-           if (label_width > labwidth)                                 \
-               labwidth = label_width;                                 \
-           if ((buf)->len > 0)                                         \
-               g_string_append_c(buf, '\n');                           \
-           g_string_append_printf(buf, "%s\t%s", descr, field);        \
-       }                                                               \
-    } while(0)
+#define ADD_VCARD_FIELD(buf, labwidth, layout, field, descr)            \
+    do {                                                                \
+        if (field) {                                                    \
+            gint label_width = p_string_width_from_layout(layout, descr); \
+            if (label_width > labwidth)                                 \
+                labwidth = label_width;                                 \
+            if ((buf)->len > 0)                                         \
+                g_string_append_c(buf, '\n');                           \
+            g_string_append_printf(buf, "%s\t%s", descr, field);        \
+        }                                                               \
+    } while (0)
 
 GList *
-balsa_print_object_text_vcard(GList * list,
-                             GtkPrintContext * context,
-                             LibBalsaMessageBody * body,
-                             BalsaPrintSetup * psetup)
+balsa_print_object_text_vcard(GList               *list,
+                              GtkPrintContext     *context,
+                              LibBalsaMessageBody *body,
+                              BalsaPrintSetup     *psetup)
 {
     BalsaPrintObjectDefault *pod;
     BalsaPrintObject *po;
@@ -435,17 +447,17 @@ balsa_print_object_text_vcard(GList * list,
     LibBalsaAddress *address = NULL;
     gchar *textbuf;
 
-    /* check if we can create an address from the body and fall back to default if 
-    * this fails */
+    /* check if we can create an address from the body and fall back to default if
+     * this fails */
     if (body->buffer)
-       textbuf = g_strdup(body->buffer);
+        textbuf = g_strdup(body->buffer);
     else
-       libbalsa_message_body_get_content(body, &textbuf, NULL);
+        libbalsa_message_body_get_content(body, &textbuf, NULL);
     if (textbuf)
         address = libbalsa_address_new_from_vcard(textbuf, body->charset);
     if (address == NULL) {
-       g_free(textbuf);
-       return balsa_print_object_text(list, context, body, psetup);
+        g_free(textbuf);
+        return balsa_print_object_text(list, context, body, psetup);
     }
 
     /* proceed with the address information */
@@ -454,46 +466,47 @@ balsa_print_object_text_vcard(GList * list,
     po = BALSA_PRINT_OBJECT(pod);
 
     /* create the part */
-    po->depth = psetup->curr_depth;
-    po->c_width =
-       psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
+    balsa_print_object_set_depth(po, psetup->curr_depth);
+    balsa_print_object_set_c_width(po,
+                                   psetup->c_width
+                                   - 2 * psetup->curr_depth * C_LABEL_SEP);
 
     /* get the stock contacts icon or the mime type icon on fail */
     pod->pixbuf =
-       gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
-                                BALSA_PIXMAP_IDENTITY, 48,
-                                GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+        gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
+                                 BALSA_PIXMAP_IDENTITY, 48,
+                                 GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
     if (!pod->pixbuf) {
-       gchar *conttype = libbalsa_message_body_get_mime_type(body);
+        gchar *conttype = libbalsa_message_body_get_mime_type(body);
 
-       pod->pixbuf = libbalsa_icon_finder(NULL, conttype, NULL, NULL, 48);
+        pod->pixbuf = libbalsa_icon_finder(NULL, conttype, NULL, NULL, 48);
     }
-    pod->c_image_width = gdk_pixbuf_get_width(pod->pixbuf);
+    pod->c_image_width  = gdk_pixbuf_get_width(pod->pixbuf);
     pod->c_image_height = gdk_pixbuf_get_height(pod->pixbuf);
 
 
     /* create a layout for calculating the maximum label width */
     header_font =
-       pango_font_description_from_string(balsa_app.print_header_font);
+        pango_font_description_from_string(balsa_app.print_header_font);
     test_layout = gtk_print_context_create_pango_layout(context);
     pango_layout_set_font_description(test_layout, header_font);
     pango_font_description_free(header_font);
 
     /* add fields from the address */
-    desc_buf = g_string_new("");
+    desc_buf           = g_string_new("");
     pod->p_label_width = 0;
     ADD_VCARD_FIELD(desc_buf, pod->p_label_width, test_layout,
-                   libbalsa_address_get_full_name(address),    _("Full Name"));
+                    libbalsa_address_get_full_name(address), _("Full Name"));
     ADD_VCARD_FIELD(desc_buf, pod->p_label_width, test_layout,
-                   libbalsa_address_get_nick_name(address),    _("Nick Name"));
+                    libbalsa_address_get_nick_name(address), _("Nick Name"));
     ADD_VCARD_FIELD(desc_buf, pod->p_label_width, test_layout,
-                   libbalsa_address_get_first_name(address),   _("First Name"));
+                    libbalsa_address_get_first_name(address), _("First Name"));
     ADD_VCARD_FIELD(desc_buf, pod->p_label_width, test_layout,
-                   libbalsa_address_get_last_name(address),    _("Last Name"));
+                    libbalsa_address_get_last_name(address), _("Last Name"));
     ADD_VCARD_FIELD(desc_buf, pod->p_label_width, test_layout,
-                   libbalsa_address_get_organization(address), _("Organization"));
+                    libbalsa_address_get_organization(address), _("Organization"));
     ADD_VCARD_FIELD(desc_buf, pod->p_label_width, test_layout,
-                    libbalsa_address_get_addr(address),         _("Email Address"));
+                    libbalsa_address_get_addr(address), _("Email Address"));
 
     g_object_unref(address);
 
@@ -503,31 +516,33 @@ balsa_print_object_text_vcard(GList * list,
     /* configure the layout so we can calculate the text height */
     pango_layout_set_indent(test_layout, -pod->p_label_width);
     tabs =
-       pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
-                                          pod->p_label_width);
+        pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
+                                           pod->p_label_width);
     pango_layout_set_tabs(test_layout, tabs);
     pango_tab_array_free(tabs);
     pango_layout_set_width(test_layout,
-                          C_TO_P(po->c_width -
-                                 4 * C_LABEL_SEP - pod->c_image_width));
+                           C_TO_P(balsa_print_object_get_c_width(po) -
+                                  4 * C_LABEL_SEP - pod->c_image_width));
     pango_layout_set_alignment(test_layout, PANGO_ALIGN_LEFT);
     pod->c_text_height =
-       P_TO_C(p_string_height_from_layout(test_layout, desc_buf->str));
+        P_TO_C(p_string_height_from_layout(test_layout, desc_buf->str));
     pod->description = g_string_free(desc_buf, FALSE);
 
     /* check if we should move to the next page */
     c_max_height = MAX(pod->c_text_height, pod->c_image_height);
     if (psetup->c_y_pos + c_max_height > psetup->c_height) {
-       psetup->c_y_pos = 0;
-       psetup->page_count++;
+        psetup->c_y_pos = 0;
+        psetup->page_count++;
     }
 
     /* remember the extent */
-    po->on_page = psetup->page_count - 1;
-    po->c_at_x = psetup->c_x0 + po->depth * C_LABEL_SEP;
-    po->c_at_y = psetup->c_y0 + psetup->c_y_pos;
-    po->c_width = psetup->c_width - 2 * po->depth * C_LABEL_SEP;
-    po->c_height = c_max_height;
+    balsa_print_object_set_on_page(po, psetup->page_count - 1);
+    balsa_print_object_set_c_at_x(po, psetup->c_x0 + balsa_print_object_get_depth(
+                                      po) * C_LABEL_SEP);
+    balsa_print_object_set_c_at_y(po, psetup->c_y0 + psetup->c_y_pos);
+    balsa_print_object_set_c_width(po, psetup->c_width - 2 * balsa_print_object_get_depth(
+                                       po) * C_LABEL_SEP);
+    balsa_print_object_set_c_height(po, c_max_height);
 
     /* adjust the y position */
     psetup->c_y_pos += c_max_height;
@@ -538,22 +553,22 @@ balsa_print_object_text_vcard(GList * list,
 
 /* add a text/calendar object */
 
-#define ADD_VCAL_FIELD(buf, labwidth, layout, field, descr)            \
-    do {                                                               \
-       if (field) {                                                    \
-           gint label_width = p_string_width_from_layout(layout, descr); \
-           if (label_width > labwidth)                                 \
-               labwidth = label_width;                                 \
-           if ((buf)->len > 0)                                         \
-               g_string_append_c(buf, '\n');                           \
-           g_string_append_printf(buf, "%s\t%s", descr, field);        \
-       }                                                               \
-    } while(0)
+#define ADD_VCAL_FIELD(buf, labwidth, layout, field, descr)             \
+    do {                                                                \
+        if (field) {                                                    \
+            gint label_width = p_string_width_from_layout(layout, descr); \
+            if (label_width > labwidth)                                 \
+                labwidth = label_width;                                 \
+            if ((buf)->len > 0)                                         \
+                g_string_append_c(buf, '\n');                           \
+            g_string_append_printf(buf, "%s\t%s", descr, field);        \
+        }                                                               \
+    } while (0)
 
 #define ADD_VCAL_DATE(buf, labwidth, layout, date, descr)               \
     do {                                                                \
         if (date != (time_t) -1) {                                      \
-            gchar * _dstr =                                             \
+            gchar *_dstr =                                             \
                 libbalsa_date_to_utf8(date, balsa_app.date_string);     \
             ADD_VCAL_FIELD(buf, labwidth, layout, _dstr, descr);        \
             g_free(_dstr);                                              \
@@ -563,7 +578,7 @@ balsa_print_object_text_vcard(GList * list,
 #define ADD_VCAL_ADDRESS(buf, labwidth, layout, addr, descr)            \
     do {                                                                \
         if (addr) {                                                     \
-            gchar * _astr = libbalsa_vcal_attendee_to_str(addr);        \
+            gchar *_astr = libbalsa_vcal_attendee_to_str(addr);        \
             ADD_VCAL_FIELD(buf, labwidth, layout, _astr, descr);        \
             g_free(_astr);                                              \
         }                                                               \
@@ -571,10 +586,10 @@ balsa_print_object_text_vcard(GList * list,
 
 
 GList *
-balsa_print_object_text_calendar(GList * list,
-                                 GtkPrintContext * context,
-                                 LibBalsaMessageBody * body,
-                                 BalsaPrintSetup * psetup)
+balsa_print_object_text_calendar(GList               *list,
+                                 GtkPrintContext     *context,
+                                 LibBalsaMessageBody *body,
+                                 BalsaPrintSetup     *psetup)
 {
     BalsaPrintObjectDefault *pod;
     BalsaPrintObject *po;
@@ -582,8 +597,8 @@ balsa_print_object_text_calendar(GList * list,
     PangoLayout *test_layout;
     PangoTabArray *tabs;
     GString *desc_buf;
-    LibBalsaVCal * vcal_obj;
-    GList * this_ev;
+    LibBalsaVCal *vcal_obj;
+    GList *this_ev;
     guint first_page;
     GList *par_parts;
     GList *this_par_part;
@@ -592,7 +607,7 @@ balsa_print_object_text_calendar(GList * list,
     /* check if we can evaluate the body as calendar object and fall back
      * to text if not */
     if (!(vcal_obj = libbalsa_vcal_new_from_body(body)))
-       return balsa_print_object_text(list, context, body, psetup);
+        return balsa_print_object_text(list, context, body, psetup);
 
     /* proceed with the address information */
     pod = g_object_new(BALSA_TYPE_PRINT_OBJECT_DEFAULT, NULL);
@@ -600,43 +615,44 @@ balsa_print_object_text_calendar(GList * list,
     po = BALSA_PRINT_OBJECT(pod);
 
     /* create the part */
-    po->depth = psetup->curr_depth;
-    po->c_width =
-       psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
+    balsa_print_object_set_depth(po, psetup->curr_depth);
+    balsa_print_object_set_c_width(po,
+                                   psetup->c_width
+                                   - 2 * psetup->curr_depth * C_LABEL_SEP);
 
     /* get the stock calendar icon or the mime type icon on fail */
     pod->pixbuf =
-       gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
-                                "x-office-calendar", 48,
-                                GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+        gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
+                                 "x-office-calendar", 48,
+                                 GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
     if (!pod->pixbuf) {
-       gchar *conttype = libbalsa_message_body_get_mime_type(body);
+        gchar *conttype = libbalsa_message_body_get_mime_type(body);
 
-       pod->pixbuf = libbalsa_icon_finder(NULL, conttype, NULL, NULL, 48);
+        pod->pixbuf = libbalsa_icon_finder(NULL, conttype, NULL, NULL, 48);
     }
-    pod->c_image_width = gdk_pixbuf_get_width(pod->pixbuf);
+    pod->c_image_width  = gdk_pixbuf_get_width(pod->pixbuf);
     pod->c_image_height = gdk_pixbuf_get_height(pod->pixbuf);
 
     /* move to the next page if the icon doesn't fit */
     if (psetup->c_y_pos + pod->c_image_height > psetup->c_height) {
-       psetup->c_y_pos = 0;
-       psetup->page_count++;
+        psetup->c_y_pos = 0;
+        psetup->page_count++;
     }
 
     /* create a layout for calculating the maximum label width and for splitting
      * the body (if necessary) */
     header_font =
-       pango_font_description_from_string(balsa_app.print_header_font);
+        pango_font_description_from_string(balsa_app.print_header_font);
     test_layout = gtk_print_context_create_pango_layout(context);
     pango_layout_set_font_description(test_layout, header_font);
     pango_font_description_free(header_font);
 
     /* add fields from the events*/
-    desc_buf = g_string_new("");
+    desc_buf           = g_string_new("");
     pod->p_label_width = 0;
     for (this_ev = libbalsa_vcal_get_vevent(vcal_obj);
          this_ev != NULL; this_ev = this_ev->next) {
-        LibBalsaVEvent * event = (LibBalsaVEvent *) this_ev->data;
+        LibBalsaVEvent *event = (LibBalsaVEvent *) this_ev->data;
         const gchar *description;
         GList *attendee;
 
@@ -655,8 +671,8 @@ balsa_print_object_text_calendar(GList * list,
 
         attendee = libbalsa_vevent_get_attendee(event);
         if (attendee != NULL) {
-            GList * att = attendee;
-            gchar * this_att;
+            GList *att = attendee;
+            gchar *this_att;
 
             this_att =
                 libbalsa_vcal_attendee_to_str(LIBBALSA_ADDRESS(att->data));
@@ -674,13 +690,14 @@ balsa_print_object_text_calendar(GList * list,
 
         description = libbalsa_vevent_get_description(event);
         if (description != NULL) {
-            gchar ** desc_lines = g_strsplit(description, "\n", -1);
+            gchar **desc_lines = g_strsplit(description, "\n", -1);
             gint i;
 
             ADD_VCAL_FIELD(desc_buf, pod->p_label_width, test_layout,
                            desc_lines[0], _("Description"));
-            for (i = 1; desc_lines[i]; i++)
+            for (i = 1; desc_lines[i]; i++) {
                 g_string_append_printf(desc_buf, "\n\t%s", desc_lines[i]);
+            }
             g_strfreev(desc_lines);
         }
     }
@@ -692,38 +709,39 @@ balsa_print_object_text_calendar(GList * list,
     /* configure the layout so we can split the text */
     pango_layout_set_indent(test_layout, -pod->p_label_width);
     tabs =
-       pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
-                                          pod->p_label_width);
+        pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
+                                           pod->p_label_width);
     pango_layout_set_tabs(test_layout, tabs);
     pango_tab_array_free(tabs);
     pango_layout_set_width(test_layout,
-                          C_TO_P(po->c_width -
-                                 4 * C_LABEL_SEP - pod->c_image_width));
+                           C_TO_P(balsa_print_object_get_c_width(po) -
+                                  4 * C_LABEL_SEP - pod->c_image_width));
     pango_layout_set_alignment(test_layout, PANGO_ALIGN_LEFT);
 
     /* split paragraph if necessary */
     first_page = psetup->page_count - 1;
-    c_at_y = psetup->c_y_pos;
-    par_parts =
+    c_at_y     = psetup->c_y_pos;
+    par_parts  =
         split_for_layout(test_layout, desc_buf->str, NULL, psetup, TRUE, NULL);
     g_string_free(desc_buf, TRUE);
 
     /* set the parameters of the first part */
-    pod->description = (gchar *) par_parts->data;
+    pod->description   = (gchar *) par_parts->data;
     pod->c_text_height =
-       P_TO_C(p_string_height_from_layout(test_layout, pod->description));
-    po->on_page = first_page++;
-    po->c_at_x = psetup->c_x0 + po->depth * C_LABEL_SEP;
-    po->c_at_y = psetup->c_y0 + c_at_y;
-    po->c_height = MAX(pod->c_image_height, pod->c_text_height);
+        P_TO_C(p_string_height_from_layout(test_layout, pod->description));
+    balsa_print_object_set_on_page(po, first_page++);
+    balsa_print_object_set_c_at_x(po, psetup->c_x0 + balsa_print_object_get_depth(
+                                      po) * C_LABEL_SEP);
+    balsa_print_object_set_c_at_y(po, psetup->c_y0 + c_at_y);
+    balsa_print_object_set_c_height(po, MAX(pod->c_image_height, pod->c_text_height));
     list = g_list_append(list, pod);
 
     /* add more parts */
     for (this_par_part = par_parts->next; this_par_part != NULL;
          this_par_part = this_par_part->next) {
-        BalsaPrintObjectDefault * new_pod;
+        BalsaPrintObjectDefault *new_pod;
         BalsaPrintObject *new_po;
-        
+
         /* create a new object */
         new_pod = g_object_new(BALSA_TYPE_PRINT_OBJECT_DEFAULT, NULL);
         g_assert(new_pod != NULL);
@@ -732,17 +750,19 @@ balsa_print_object_text_calendar(GList * list,
         /* fill data */
         new_pod->p_label_width = pod->p_label_width;
         new_pod->c_image_width = pod->c_image_width;
-        new_pod->description = (gchar *) this_par_part->data;
+        new_pod->description   = (gchar *) this_par_part->data;
         new_pod->c_text_height =
             P_TO_C(p_string_height_from_layout(test_layout, new_pod->description));
-        new_po->on_page = first_page++;
-        new_po->c_at_x = psetup->c_x0 + po->depth * C_LABEL_SEP;
-        new_po->c_at_y = psetup->c_y0;
-        new_po->c_height = new_pod->c_text_height;
-        new_po->depth = psetup->curr_depth;
-        new_po->c_width =
-            psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
-        
+        balsa_print_object_set_on_page(new_po, first_page++);
+        balsa_print_object_set_c_at_x(new_po, psetup->c_x0 + balsa_print_object_get_depth(
+                                          po) * C_LABEL_SEP);
+        balsa_print_object_set_c_at_y(new_po, psetup->c_y0);
+        balsa_print_object_set_c_height(new_po, new_pod->c_text_height);
+        balsa_print_object_set_depth(new_po, psetup->curr_depth);
+        balsa_print_object_set_c_width(new_po,
+                                       psetup->c_width
+                                       - 2 * psetup->curr_depth * C_LABEL_SEP);
+
         /* append */
         list = g_list_append(list, new_pod);
     }
@@ -754,73 +774,79 @@ balsa_print_object_text_calendar(GList * list,
 
 
 static void
-balsa_print_object_text_draw(BalsaPrintObject * self,
-                            GtkPrintContext * context,
-                            cairo_t * cairo_ctx)
+balsa_print_object_text_draw(BalsaPrintObject *self,
+                             GtkPrintContext  *context,
+                             cairo_t          *cairo_ctx)
 {
-    BalsaPrintObjectText *po;
+    BalsaPrintObjectText *pot;
     PangoFontDescription *font;
     gint p_height;
     PangoLayout *layout;
     PangoAttrList *attr_list;
 
-    po = BALSA_PRINT_OBJECT_TEXT(self);
-    g_assert(po != NULL);
+    pot = BALSA_PRINT_OBJECT_TEXT(self);
+    g_assert(pot != NULL);
 
     /* prepare */
-    font = pango_font_description_from_string(balsa_app.print_body_font);
+    font   = pango_font_description_from_string(balsa_app.print_body_font);
     layout = gtk_print_context_create_pango_layout(context);
     pango_layout_set_font_description(layout, font);
     pango_font_description_free(font);
     pango_layout_set_width(layout,
-                          C_TO_P(self->c_width - po->cite_level * C_LABEL_SEP));
+                           C_TO_P(balsa_print_object_get_c_width(self) - pot->cite_level *
+                                  C_LABEL_SEP));
     pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT);
     pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
-    pango_layout_set_text(layout, po->text, -1);
-    if ((attr_list = phrase_list_to_pango(po->attributes))) {
-       pango_layout_set_attributes(layout, attr_list);
-       pango_attr_list_unref(attr_list);
+    pango_layout_set_text(layout, pot->text, -1);
+    if ((attr_list = phrase_list_to_pango(pot->attributes))) {
+        pango_layout_set_attributes(layout, attr_list);
+        pango_attr_list_unref(attr_list);
     }
     pango_layout_get_size(layout, NULL, &p_height);
-    if (po->cite_level > 0) {
-       cairo_save(cairo_ctx);
-       if (balsa_app.print_highlight_cited) {
-           gint k = (po->cite_level - 1) % MAX_QUOTED_COLOR;
-
-           cairo_set_source_rgb(cairo_ctx,
-                                balsa_app.quoted_color[k].red,
-                                balsa_app.quoted_color[k].green,
-                                balsa_app.quoted_color[k].blue);
-       }
+    if (pot->cite_level > 0) {
+        cairo_save(cairo_ctx);
+        if (balsa_app.print_highlight_cited) {
+            gint k = (pot->cite_level - 1) % MAX_QUOTED_COLOR;
+
+            cairo_set_source_rgb(cairo_ctx,
+                                 balsa_app.quoted_color[k].red,
+                                 balsa_app.quoted_color[k].green,
+                                 balsa_app.quoted_color[k].blue);
+        }
     }
-    cairo_move_to(cairo_ctx, self->c_at_x + po->cite_level * C_LABEL_SEP,
-                 self->c_at_y);
+    cairo_move_to(cairo_ctx, balsa_print_object_get_c_at_x(
+                      self) + pot->cite_level * C_LABEL_SEP,
+                  balsa_print_object_get_c_at_y(self));
     pango_cairo_show_layout(cairo_ctx, layout);
     g_object_unref(G_OBJECT(layout));
-    if (po->cite_level > 0) {
-       guint n;
-
-       cairo_new_path(cairo_ctx);
-       cairo_set_line_width(cairo_ctx, 1.0);
-       for (n = 0; n < po->cite_level; n++) {
-           gdouble c_xpos = self->c_at_x + 0.5 + n * C_LABEL_SEP;
-
-           cairo_move_to(cairo_ctx, c_xpos, self->c_at_y);
-           cairo_line_to(cairo_ctx, c_xpos, self->c_at_y + P_TO_C(p_height));
-       }
-       cairo_stroke(cairo_ctx);
-       cairo_restore(cairo_ctx);
+    if (pot->cite_level > 0) {
+        guint n;
+
+        cairo_new_path(cairo_ctx);
+        cairo_set_line_width(cairo_ctx, 1.0);
+        for (n = 0; n < pot->cite_level; n++) {
+            gdouble c_xpos = balsa_print_object_get_c_at_x(self) + 0.5 + n * C_LABEL_SEP;
+
+            cairo_move_to(cairo_ctx, c_xpos, balsa_print_object_get_c_at_y(self));
+            cairo_line_to(cairo_ctx, c_xpos,
+                          balsa_print_object_get_c_at_y(self) + P_TO_C(p_height));
+        }
+        cairo_stroke(cairo_ctx);
+        cairo_restore(cairo_ctx);
     }
 
-    self->c_height = P_TO_C(p_height); /* needed to properly print borders */
+    balsa_print_object_set_c_height(self, P_TO_C(p_height));    /* needed to properly print
+                                                                   borders */
 }
 
 
 #define UNICHAR_PREV(p)  g_utf8_get_char(g_utf8_prev_char(p))
 
 static GList *
-phrase_highlight(const gchar * buffer, gunichar tag_char,
-                PhraseType tag_type, GList * phrase_list)
+phrase_highlight(const gchar *buffer,
+                 gunichar     tag_char,
+                 PhraseType   tag_type,
+                 GList       *phrase_list)
 {
     gchar *utf_start;
 
@@ -829,49 +855,53 @@ phrase_highlight(const gchar * buffer, gunichar tag_char,
        <whitespace, punctuation or buffer end> */
     utf_start = g_utf8_strchr(buffer, -1, tag_char);
     while (utf_start) {
-       gchar *s_next = g_utf8_next_char(utf_start);
-
-       if ((utf_start == buffer
-            || g_unichar_isspace(UNICHAR_PREV(utf_start)))
-           && *s_next != '\0'
-           && g_unichar_isalnum(g_utf8_get_char(s_next))) {
-           gchar *utf_end;
-           gchar *line_end;
-           gchar *e_next;
-
-           /* found a proper start sequence - find the end or eject */
-           if (!(utf_end = g_utf8_strchr(s_next, -1, tag_char)))
-               return phrase_list;
-           line_end = g_utf8_strchr(s_next, -1, '\n');
-           e_next = g_utf8_next_char(utf_end);
-           while (!g_unichar_isalnum(UNICHAR_PREV(utf_end)) ||
-                  !(*e_next == '\0' ||
-                    g_unichar_isspace(g_utf8_get_char(e_next)) ||
-                    g_unichar_ispunct(g_utf8_get_char(e_next)))) {
-               if (!(utf_end = g_utf8_strchr(e_next, -1, tag_char)))
-                   return phrase_list;
-               e_next = g_utf8_next_char(utf_end);
-           }
-
-           /* append the attribute if there is no line break */
-           if (!line_end || line_end >= e_next) {
-               PhraseRegion *new_region = g_new0(PhraseRegion, 1);
-
-               new_region->phrase_type = tag_type;
-               new_region->start_index = utf_start - buffer;
-               new_region->end_index = e_next - buffer;
-               phrase_list = g_list_prepend(phrase_list, new_region);
-
-               /* set the next start properly */
-               utf_start =
-                   *e_next ? g_utf8_strchr(e_next, -1, tag_char) : NULL;
-           } else
-               utf_start =
-                   *s_next ? g_utf8_strchr(s_next, -1, tag_char) : NULL;
-       } else
-           /* no start sequence, find the next start tag char */
-           utf_start =
-               *s_next ? g_utf8_strchr(s_next, -1, tag_char) : NULL;
+        gchar *s_next = g_utf8_next_char(utf_start);
+
+        if (((utf_start == buffer)
+             || g_unichar_isspace(UNICHAR_PREV(utf_start)))
+            && (*s_next != '\0')
+            && g_unichar_isalnum(g_utf8_get_char(s_next))) {
+            gchar *utf_end;
+            gchar *line_end;
+            gchar *e_next;
+
+            /* found a proper start sequence - find the end or eject */
+            if (!(utf_end = g_utf8_strchr(s_next, -1, tag_char)))
+                return phrase_list;
+
+            line_end = g_utf8_strchr(s_next, -1, '\n');
+            e_next   = g_utf8_next_char(utf_end);
+            while (!g_unichar_isalnum(UNICHAR_PREV(utf_end)) ||
+                   !(*e_next == '\0' ||
+                     g_unichar_isspace(g_utf8_get_char(e_next)) ||
+                     g_unichar_ispunct(g_utf8_get_char(e_next)))) {
+                if (!(utf_end = g_utf8_strchr(e_next, -1, tag_char)))
+                    return phrase_list;
+
+                e_next = g_utf8_next_char(utf_end);
+            }
+
+            /* append the attribute if there is no line break */
+            if (!line_end || (line_end >= e_next)) {
+                PhraseRegion *new_region = g_new0(PhraseRegion, 1);
+
+                new_region->phrase_type = tag_type;
+                new_region->start_index = utf_start - buffer;
+                new_region->end_index   = e_next - buffer;
+                phrase_list             = g_list_prepend(phrase_list, new_region);
+
+                /* set the next start properly */
+                utf_start =
+                    *e_next ? g_utf8_strchr(e_next, -1, tag_char) : NULL;
+            } else {
+                utf_start =
+                    *s_next ? g_utf8_strchr(s_next, -1, tag_char) : NULL;
+            }
+        } else {
+            /* no start sequence, find the next start tag char */
+            utf_start =
+                *s_next ? g_utf8_strchr(s_next, -1, tag_char) : NULL;
+        }
     }
 
     return phrase_list;
@@ -879,66 +909,69 @@ phrase_highlight(const gchar * buffer, gunichar tag_char,
 
 
 static PangoAttrList *
-phrase_list_to_pango(GList * phrase_list)
+phrase_list_to_pango(GList *phrase_list)
 {
     PangoAttrList *attr_list;
     PangoAttribute *ph_attr[PHRASE_TYPE_COUNT];
     gint n;
 
     if (!phrase_list)
-       return NULL;
+        return NULL;
 
-    attr_list = pango_attr_list_new();
+    attr_list          = pango_attr_list_new();
     ph_attr[PHRASE_BF] = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
     ph_attr[PHRASE_EM] = pango_attr_style_new(PANGO_STYLE_ITALIC);
     ph_attr[PHRASE_UL] = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
 
     while (phrase_list) {
-       PhraseRegion *region = (PhraseRegion *) phrase_list->data;
-       PangoAttribute *new_attr;
+        PhraseRegion *region = (PhraseRegion *) phrase_list->data;
+        PangoAttribute *new_attr;
 
-       new_attr = pango_attribute_copy(ph_attr[region->phrase_type]);
-       new_attr->start_index = region->start_index;
-       new_attr->end_index = region->end_index;
-       pango_attr_list_insert(attr_list, new_attr);
+        new_attr              = pango_attribute_copy(ph_attr[region->phrase_type]);
+        new_attr->start_index = region->start_index;
+        new_attr->end_index   = region->end_index;
+        pango_attr_list_insert(attr_list, new_attr);
 
-       phrase_list = phrase_list->next;
+        phrase_list = phrase_list->next;
     }
 
-    for (n = 0; n < PHRASE_TYPE_COUNT; n++)
-       pango_attribute_destroy(ph_attr[n]);
+    for (n = 0; n < PHRASE_TYPE_COUNT; n++) {
+        pango_attribute_destroy(ph_attr[n]);
+    }
 
     return attr_list;
 }
 
 
 static GList *
-collect_attrs(GList * all_attr, guint offset, guint len)
+collect_attrs(GList *all_attr,
+              guint  offset,
+              guint  len)
 {
     GList *attr = NULL;
 
     while (all_attr) {
-       PhraseRegion *region = (PhraseRegion *) all_attr->data;
+        PhraseRegion *region = (PhraseRegion *) all_attr->data;
 
-       if ((region->start_index >= offset
-            && region->start_index <= offset + len)
-           || (region->end_index >= offset
-               && region->end_index <= offset + len)) {
+        if (((region->start_index >= offset)
+             && (region->start_index <= offset + len))
+            || ((region->end_index >= offset)
+                && (region->end_index <= offset + len))) {
             /* scan-build does not see this as initializing this_reg:
-           PhraseRegion *this_reg =
-               g_memdup(region, sizeof(PhraseRegion));
+               PhraseRegion *this_reg =
+                g_memdup(region, sizeof(PhraseRegion));
              */
             PhraseRegion *this_reg;
 
-            this_reg = g_new(PhraseRegion, 1);
+            this_reg  = g_new(PhraseRegion, 1);
             *this_reg = *region;
 
-            this_reg->start_index = MAX(0,   this_reg->start_index - offset);
-            this_reg->end_index   = MIN(len, this_reg->end_index   - offset);
+            this_reg->start_index = MAX(0, this_reg->start_index - offset);
+            this_reg->end_index   = MIN(len, this_reg->end_index - offset);
 
-           attr = g_list_prepend(attr, this_reg);
-       }
-       all_attr = all_attr->next;
+            attr = g_list_prepend(attr, this_reg);
+        }
+        all_attr = all_attr->next;
     }
 
     return attr;
diff --git a/src/balsa-print-object-text.h b/src/balsa-print-object-text.h
index 7847402..32f843a 100644
--- a/src/balsa-print-object-text.h
+++ b/src/balsa-print-object-text.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/>.
  */
@@ -24,13 +24,13 @@
 
 G_BEGIN_DECLS
 
-#define BALSA_TYPE_PRINT_OBJECT_TEXT   \
+#define BALSA_TYPE_PRINT_OBJECT_TEXT    \
     (balsa_print_object_text_get_type())
-#define BALSA_PRINT_OBJECT_TEXT(obj)                           \
+#define BALSA_PRINT_OBJECT_TEXT(obj)                            \
     G_TYPE_CHECK_INSTANCE_CAST(obj, BALSA_TYPE_PRINT_OBJECT_TEXT, BalsaPrintObjectText)
-#define BALSA_PRINT_OBJECT_TEXT_CLASS(klass)                   \
+#define BALSA_PRINT_OBJECT_TEXT_CLASS(klass)                    \
     G_TYPE_CHECK_CLASS_CAST(klass, BALSA_TYPE_PRINT_OBJECT_TEXT, BalsaPrintObjectTextClass)
-#define BALSA_IS_PRINT_OBJECT_TEXT(obj)                        \
+#define BALSA_IS_PRINT_OBJECT_TEXT(obj)                 \
     G_TYPE_CHECK_INSTANCE_TYPE(obj, BALSA_TYPE_PRINT_OBJECT_TEXT)
 
 
@@ -53,25 +53,25 @@ struct _BalsaPrintObjectTextClass {
 };
 
 
-GType balsa_print_object_text_get_type(void);
-GList *balsa_print_object_text_plain(GList *list,
-                                    GtkPrintContext * context,
-                                    LibBalsaMessageBody * body,
-                                    BalsaPrintSetup * psetup);
-GList *balsa_print_object_text(GList *list,
-                              GtkPrintContext * context,
-                              LibBalsaMessageBody * body,
-                              BalsaPrintSetup * psetup);
-GList *balsa_print_object_text_vcard(GList *list,
-                                    GtkPrintContext * context,
-                                    LibBalsaMessageBody * body,
-                                    BalsaPrintSetup * psetup);
-GList *balsa_print_object_text_calendar(GList *list,
-                                        GtkPrintContext * context,
-                                        LibBalsaMessageBody * body,
-                                        BalsaPrintSetup * psetup);
+GType  balsa_print_object_text_get_type(void);
+GList *balsa_print_object_text_plain(GList               *list,
+                                     GtkPrintContext     *context,
+                                     LibBalsaMessageBody *body,
+                                     BalsaPrintSetup     *psetup);
+GList *balsa_print_object_text(GList               *list,
+                               GtkPrintContext     *context,
+                               LibBalsaMessageBody *body,
+                               BalsaPrintSetup     *psetup);
+GList *balsa_print_object_text_vcard(GList               *list,
+                                     GtkPrintContext     *context,
+                                     LibBalsaMessageBody *body,
+                                     BalsaPrintSetup     *psetup);
+GList *balsa_print_object_text_calendar(GList               *list,
+                                        GtkPrintContext     *context,
+                                        LibBalsaMessageBody *body,
+                                        BalsaPrintSetup     *psetup);
 
 
 G_END_DECLS
 
-#endif                         /* __BALSA_PRINT_OBJECT_TEXT_H__ */
+#endif                          /* __BALSA_PRINT_OBJECT_TEXT_H__ */
diff --git a/src/balsa-print-object.c b/src/balsa-print-object.c
index 2157483..706d7cf 100644
--- a/src/balsa-print-object.c
+++ b/src/balsa-print-object.c
@@ -7,18 +7,18 @@
  * it under the terms of the GNU General Public License as published by
  * 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/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-# include "config.h"
+#   include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-print-object.h"
 
@@ -35,122 +35,111 @@
 
 
 /* object related functions */
-static void balsa_print_object_init(GTypeInstance * instance,
-                                   gpointer g_class);
-static void balsa_print_object_class_init(BalsaPrintObjectClass * klass);
-
 
-static GObjectClass *parent_class = NULL;
+typedef struct _BalsaPrintObjectPrivate BalsaPrintObjectPrivate;
 
+struct _BalsaPrintObjectPrivate {
+    gint on_page;
+    guint depth;
 
-GType
-balsa_print_object_get_type()
-{
-    static GType balsa_print_object_type = 0;
-
-    if (!balsa_print_object_type) {
-       static const GTypeInfo balsa_print_object_info = {
-           sizeof(BalsaPrintObjectClass),
-           NULL,               /* base_init */
-           NULL,               /* base_finalize */
-           (GClassInitFunc) balsa_print_object_class_init,
-           NULL,               /* class_finalize */
-           NULL,               /* class_data */
-           sizeof(BalsaPrintObject),
-           0,                  /* n_preallocs */
-           (GInstanceInitFunc) balsa_print_object_init
-       };
-
-       balsa_print_object_type =
-           g_type_register_static(G_TYPE_OBJECT, "BalsaPrintObject",
-                                  &balsa_print_object_info, 0);
-    }
+    gdouble c_at_x;
+    gdouble c_at_y;
+    gdouble c_width;
+    gdouble c_height;
+};
 
-    return balsa_print_object_type;
-}
+G_DEFINE_TYPE_WITH_PRIVATE(BalsaPrintObject, balsa_print_object, G_TYPE_OBJECT)
 
 
 static void
-balsa_print_object_init(GTypeInstance * instance, gpointer g_class)
+balsa_print_object_init(BalsaPrintObject *self)
 {
-    BalsaPrintObject *self = (BalsaPrintObject *) instance;
-
-    self->on_page = 0;
-    self->depth = 0;
-    self->c_at_x = 0.0;
-    self->c_at_y = 0.0;
-    self->c_width = 0.0;
-    self->c_height = 0.0;
+    BalsaPrintObjectPrivate *priv = balsa_print_object_get_instance_private(self);
+
+    priv->on_page  = 0;
+    priv->depth    = 0;
+    priv->c_at_x   = 0.0;
+    priv->c_at_y   = 0.0;
+    priv->c_width  = 0.0;
+    priv->c_height = 0.0;
 }
 
 
 static void
-balsa_print_object_class_init(BalsaPrintObjectClass * klass)
+balsa_print_object_class_init(BalsaPrintObjectClass *klass)
 {
-    parent_class = g_type_class_ref(G_TYPE_OBJECT);
     klass->draw = balsa_print_object_draw;
 }
 
 
 static GList *
-balsa_print_object_emb_message(GList * list, GtkPrintContext * context,
-                                    LibBalsaMessageBody * mime_body,
-                                    BalsaPrintSetup * psetup)
+balsa_print_object_emb_message(GList               *list,
+                               GtkPrintContext     *context,
+                               LibBalsaMessageBody *mime_body,
+                               BalsaPrintSetup     *psetup)
 {
     list = balsa_print_object_frame_begin(list, NULL, psetup);
     return balsa_print_object_header_from_body(list, context, mime_body, psetup);
 }
 
+
 static GList *
-balsa_print_object_emb_headers(GList * list, GtkPrintContext * context,
-            LibBalsaMessageBody * mime_body,
-            BalsaPrintSetup * psetup)
+balsa_print_object_emb_headers(GList               *list,
+                               GtkPrintContext     *context,
+                               LibBalsaMessageBody *mime_body,
+                               BalsaPrintSetup     *psetup)
 {
     list = balsa_print_object_frame_begin(list, _("message headers"), psetup);
     list = balsa_print_object_header_from_body(list, context, mime_body, psetup);
     return balsa_print_object_frame_end(list, psetup);
 }
 
+
 #ifdef HAVE_GPGME
 static GList *
-balsa_print_object_mp_crypto(GList * list, GtkPrintContext * context,
-                               LibBalsaMessageBody * mime_body,
-                               BalsaPrintSetup * psetup)
+balsa_print_object_mp_crypto(GList               *list,
+                             GtkPrintContext     *context,
+                             LibBalsaMessageBody *mime_body,
+                             BalsaPrintSetup     *psetup)
 {
     return balsa_print_object_header_crypto(list, context, mime_body, NULL, psetup);
 }
+
+
 #endif                          /* HAVE_GPGME */
 
 
 GList *
-balsa_print_objects_append_from_body(GList * list,
-                                    GtkPrintContext * context,
-                                    LibBalsaMessageBody * mime_body,
-                                    BalsaPrintSetup * psetup)
+balsa_print_objects_append_from_body(GList               *list,
+                                     GtkPrintContext     *context,
+                                     LibBalsaMessageBody *mime_body,
+                                     BalsaPrintSetup     *psetup)
 {
     static const struct {
-        char * type;  /* MIME type */
+        char *type;   /* MIME type */
         int use_len;  /* length for strncasecmp or -1 for strcasecmp */
-        GList * (*handler)(GList *, GtkPrintContext *, LibBalsaMessageBody *,
+        GList * (*handler)(GList *,
+                           GtkPrintContext *,
+                           LibBalsaMessageBody *,
                            BalsaPrintSetup *);
     } pr_handlers[] = {
-        { "text/html",                     -1, balsa_print_object_default },
-        { "text/enriched",                 -1, balsa_print_object_default },
-        { "text/richtext",                 -1, balsa_print_object_default },
-        { "text/x-vcard",                  -1, balsa_print_object_text_vcard },
-        { "text/directory",                -1, balsa_print_object_text_vcard },
-        { "text/calendar",                 -1, balsa_print_object_text_calendar },
-        { "text/plain",                    -1, balsa_print_object_text_plain },
-        { "text/rfc822-headers",          -1, balsa_print_object_emb_headers },
-        { "text/",                          5, balsa_print_object_text },
-        { "image/",                         6, balsa_print_object_image },
-        { "message/rfc822",                -1, balsa_print_object_emb_message },
+        { "text/html", -1, balsa_print_object_default },
+        { "text/enriched", -1, balsa_print_object_default },
+        { "text/richtext", -1, balsa_print_object_default },
+        { "text/x-vcard", -1, balsa_print_object_text_vcard },
+        { "text/directory", -1, balsa_print_object_text_vcard },
+        { "text/calendar", -1, balsa_print_object_text_calendar },
+        { "text/plain", -1, balsa_print_object_text_plain },
+        { "text/rfc822-headers", -1, balsa_print_object_emb_headers },
+        { "text/", 5, balsa_print_object_text },
+        { "image/", 6, balsa_print_object_image },
+        { "message/rfc822", -1, balsa_print_object_emb_message },
 #ifdef HAVE_GPGME
-        { "application/pgp-signature",     -1, balsa_print_object_mp_crypto },
-        { "application/pkcs7-signature",   -1, balsa_print_object_mp_crypto },
+        { "application/pgp-signature", -1, balsa_print_object_mp_crypto },
+        { "application/pkcs7-signature", -1, balsa_print_object_mp_crypto },
         { "application/x-pkcs7-signature", -1, balsa_print_object_mp_crypto },
-#endif                         /* HAVE_GPGME */
-        { NULL,                            -1, balsa_print_object_default }
+#endif                          /* HAVE_GPGME */
+        { NULL, -1, balsa_print_object_default }
     };
     gchar *conttype;
     GList *result;
@@ -159,11 +148,12 @@ balsa_print_objects_append_from_body(GList * list,
     conttype = libbalsa_message_body_get_mime_type(mime_body);
     for (n = 0;
          pr_handlers[n].type &&
-             ((pr_handlers[n].use_len == -1 &&
-               g_ascii_strcasecmp(pr_handlers[n].type, conttype)) ||
-              (pr_handlers[n].use_len > 0 &&
-               g_ascii_strncasecmp(pr_handlers[n].type, conttype, pr_handlers[n].use_len)));
-         n++);
+         ((pr_handlers[n].use_len == -1 &&
+           g_ascii_strcasecmp(pr_handlers[n].type, conttype)) ||
+          (pr_handlers[n].use_len > 0 &&
+           g_ascii_strncasecmp(pr_handlers[n].type, conttype, pr_handlers[n].use_len)));
+         n++) {
+    }
     result = pr_handlers[n].handler(list, context, mime_body, psetup);
     g_free(conttype);
     return result;
@@ -171,31 +161,33 @@ balsa_print_objects_append_from_body(GList * list,
 
 
 void
-balsa_print_object_draw(BalsaPrintObject * self, GtkPrintContext * context,
-                       cairo_t * cairo_ctx)
+balsa_print_object_draw(BalsaPrintObject *self,
+                        GtkPrintContext  *context,
+                        cairo_t          *cairo_ctx)
 {
+    BalsaPrintObjectPrivate *priv = balsa_print_object_get_instance_private(self);
     guint level;
 
     BALSA_PRINT_OBJECT_CLASS(G_OBJECT_GET_CLASS(self))->draw(self, context, cairo_ctx);
 
     /* print borders if the depth is > 0 */
-    if (self->depth == 0)
-       return;
+    if (priv->depth == 0)
+        return;
 
     /* print the requested number of border lines */
     cairo_save(cairo_ctx);
     cairo_set_line_width(cairo_ctx, 0.25);
     cairo_new_path(cairo_ctx);
-    for (level = self->depth; level; level--) {
-       gdouble level_sep = level * C_LABEL_SEP;
-
-       cairo_move_to(cairo_ctx, self->c_at_x - level_sep, self->c_at_y);
-       cairo_line_to(cairo_ctx, self->c_at_x - level_sep,
-                     self->c_at_y + self->c_height);
-       cairo_move_to(cairo_ctx, self->c_at_x + self->c_width + level_sep,
-                     self->c_at_y);
-       cairo_line_to(cairo_ctx, self->c_at_x + self->c_width + level_sep,
-                     self->c_at_y + self->c_height);
+    for (level = priv->depth; level; level--) {
+        gdouble level_sep = level * C_LABEL_SEP;
+
+        cairo_move_to(cairo_ctx, priv->c_at_x - level_sep, priv->c_at_y);
+        cairo_line_to(cairo_ctx, priv->c_at_x - level_sep,
+                      priv->c_at_y + priv->c_height);
+        cairo_move_to(cairo_ctx, priv->c_at_x + priv->c_width + level_sep,
+                      priv->c_at_y);
+        cairo_line_to(cairo_ctx, priv->c_at_x + priv->c_width + level_sep,
+                      priv->c_at_y + priv->c_height);
     }
     cairo_stroke(cairo_ctx);
     cairo_restore(cairo_ctx);
@@ -206,7 +198,8 @@ balsa_print_object_draw(BalsaPrintObject * self, GtkPrintContext * context,
 
 /* return the width of the passed string in Pango units */
 gint
-p_string_width_from_layout(PangoLayout * layout, const gchar * text)
+p_string_width_from_layout(PangoLayout *layout,
+                           const gchar *text)
 {
     gint width;
 
@@ -218,7 +211,8 @@ p_string_width_from_layout(PangoLayout * layout, const gchar * text)
 
 /* return the height of the passed string in Pango units */
 gint
-p_string_height_from_layout(PangoLayout * layout, const gchar * text)
+p_string_height_from_layout(PangoLayout *layout,
+                            const gchar *text)
 {
     gint height;
 
@@ -231,8 +225,11 @@ p_string_height_from_layout(PangoLayout * layout, const gchar * text)
 /* print a GdkPixbuf to cairo at the specified position and with the
  * specified scale */
 gboolean
-cairo_print_pixbuf(cairo_t * cairo_ctx, GdkPixbuf * pixbuf,
-                   gdouble c_at_x, gdouble c_at_y, gdouble scale)
+cairo_print_pixbuf(cairo_t   *cairo_ctx,
+                   GdkPixbuf *pixbuf,
+                   gdouble    c_at_x,
+                   gdouble    c_at_y,
+                   gdouble    scale)
 {
     gint n_chans;
     gint width;
@@ -242,7 +239,7 @@ cairo_print_pixbuf(cairo_t * cairo_ctx, GdkPixbuf * pixbuf,
 
     /* paranoia checks */
     g_return_val_if_fail(cairo_ctx != NULL, FALSE);
-    g_return_val_if_fail(pixbuf    != NULL, FALSE);
+    g_return_val_if_fail(pixbuf != NULL, FALSE);
 
     /* must have 3 (no alpha) or 4 (with alpha) channels */
     n_chans = gdk_pixbuf_get_n_channels(pixbuf);
@@ -271,7 +268,7 @@ cairo_print_pixbuf(cairo_t * cairo_ctx, GdkPixbuf * pixbuf,
     cairo_move_to(cairo_ctx, c_at_x, c_at_y);
     cairo_line_to(cairo_ctx, c_at_x + width * scale, c_at_y);
     cairo_line_to(cairo_ctx, c_at_x + width * scale,
-                 c_at_y + height * scale);
+                  c_at_y + height * scale);
     cairo_line_to(cairo_ctx, c_at_x, c_at_y + height * scale);
     cairo_close_path(cairo_ctx);
     cairo_clip(cairo_ctx);
@@ -284,13 +281,14 @@ cairo_print_pixbuf(cairo_t * cairo_ctx, GdkPixbuf * pixbuf,
 }
 
 
-
-
 /* split a text buffer into chunks using the passed Pango layout */
 GList *
-split_for_layout(PangoLayout * layout, const gchar * text,
-                PangoAttrList * attributes, BalsaPrintSetup * psetup,
-                gboolean is_header, GArray ** offsets)
+split_for_layout(PangoLayout     *layout,
+                 const gchar     *text,
+                 PangoAttrList   *attributes,
+                 BalsaPrintSetup *psetup,
+                 gboolean         is_header,
+                 GArray         **offsets)
 {
     GList *split_list = NULL;
     PangoLayoutIter *iter;
@@ -305,70 +303,71 @@ split_for_layout(PangoLayout * layout, const gchar * text,
     /* set the text and its attributes, then get an iter */
     pango_layout_set_text(layout, text, -1);
     if (attributes)
-       pango_layout_set_attributes(layout, attributes);
+        pango_layout_set_attributes(layout, attributes);
     if (offsets)
-       *offsets = g_array_new(FALSE, FALSE, sizeof(guint));
+        *offsets = g_array_new(FALSE, FALSE, sizeof(guint));
     iter = pango_layout_get_iter(layout);
 
     /* loop over lines */
-    start = text;
+    start    = text;
     p_offset = 0;
-    add_tab = FALSE;
-    p_y_pos = C_TO_P(psetup->c_y_pos);
+    add_tab  = FALSE;
+    p_y_pos  = C_TO_P(psetup->c_y_pos);
     p_height = C_TO_P(psetup->c_height);
     do {
-       pango_layout_iter_get_line_yrange(iter, &p_y0, &p_y1);
-       if (p_y_pos + p_y1 - p_offset > p_height) {
-           gint index;
-           gint tr;
-           gchar *chunk;
-           gboolean ends_with_nl;
-
-           if (offsets) {
-               guint offs = start - text;
-
-               *offsets = g_array_append_val(*offsets, offs);
-           }
-           pango_layout_xy_to_index(layout, 0, p_y0, &index, &tr);
-           ends_with_nl = text[index - 1] == '\n';
-           if (ends_with_nl)
-               index--;
-           chunk = g_strndup(start, text + index - start);
-           if (add_tab)
-               split_list =
-                   g_list_append(split_list,
-                                 g_strconcat("\t", chunk, NULL));
-           else
-               split_list = g_list_append(split_list, g_strdup(chunk));
-           add_tab = is_header && !ends_with_nl;
-           g_free(chunk);
-           start = text + index;
-           if (ends_with_nl)
-               start++;
-           if (*start == '\0')
-               p_y_pos = p_height;
-           else {
-               p_y_pos = 0;
-               psetup->page_count++;
-           }
-           p_offset = p_y0;
-       }
+        pango_layout_iter_get_line_yrange(iter, &p_y0, &p_y1);
+        if (p_y_pos + p_y1 - p_offset > p_height) {
+            gint index;
+            gint tr;
+            gchar *chunk;
+            gboolean ends_with_nl;
+
+            if (offsets) {
+                guint offs = start - text;
+
+                *offsets = g_array_append_val(*offsets, offs);
+            }
+            pango_layout_xy_to_index(layout, 0, p_y0, &index, &tr);
+            ends_with_nl = text[index - 1] == '\n';
+            if (ends_with_nl)
+                index--;
+            chunk = g_strndup(start, text + index - start);
+            if (add_tab) {
+                split_list =
+                    g_list_append(split_list,
+                                  g_strconcat("\t", chunk, NULL));
+            } else {
+                split_list = g_list_append(split_list, g_strdup(chunk));
+            }
+            add_tab = is_header && !ends_with_nl;
+            g_free(chunk);
+            start = text + index;
+            if (ends_with_nl)
+                start++;
+            if (*start == '\0') {
+                p_y_pos = p_height;
+            } else {
+                p_y_pos = 0;
+                psetup->page_count++;
+            }
+            p_offset = p_y0;
+        }
     } while (pango_layout_iter_next_line(iter));
     pango_layout_iter_free(iter);
 
     /* append any remaining stuff */
     if (*start != '\0') {
-       p_y_pos += p_y1 - p_offset;
-       if (offsets) {
-           guint offs = start - text;
-
-           *offsets = g_array_append_val(*offsets, offs);
-       }
-       if (add_tab)
-           split_list =
-               g_list_append(split_list, g_strconcat("\t", start, NULL));
-       else
-           split_list = g_list_append(split_list, g_strdup(start));
+        p_y_pos += p_y1 - p_offset;
+        if (offsets) {
+            guint offs = start - text;
+
+            *offsets = g_array_append_val(*offsets, offs);
+        }
+        if (add_tab)
+            split_list =
+                g_list_append(split_list, g_strconcat("\t", start, NULL));
+        else
+            split_list = g_list_append(split_list, g_strdup(start));
     }
 
     /* remember the new y position in cairo units */
@@ -377,3 +376,125 @@ split_for_layout(PangoLayout * layout, const gchar * text,
     /* return the list */
     return split_list;
 }
+
+
+/*
+ * Getters
+ */
+
+gint
+balsa_print_object_get_on_page(BalsaPrintObject *self)
+{
+    BalsaPrintObjectPrivate *priv = balsa_print_object_get_instance_private(self);
+
+    return priv->on_page;
+}
+
+
+guint
+balsa_print_object_get_depth(BalsaPrintObject *self)
+{
+    BalsaPrintObjectPrivate *priv = balsa_print_object_get_instance_private(self);
+
+    return priv->depth;
+}
+
+
+gdouble
+balsa_print_object_get_c_at_x(BalsaPrintObject *self)
+{
+    BalsaPrintObjectPrivate *priv = balsa_print_object_get_instance_private(self);
+
+    return priv->c_at_x;
+}
+
+
+gdouble
+balsa_print_object_get_c_at_y(BalsaPrintObject *self)
+{
+    BalsaPrintObjectPrivate *priv = balsa_print_object_get_instance_private(self);
+
+    return priv->c_at_y;
+}
+
+
+gdouble
+balsa_print_object_get_c_width(BalsaPrintObject *self)
+{
+    BalsaPrintObjectPrivate *priv = balsa_print_object_get_instance_private(self);
+
+    return priv->c_width;
+}
+
+
+gdouble
+balsa_print_object_get_c_height(BalsaPrintObject *self)
+{
+    BalsaPrintObjectPrivate *priv = balsa_print_object_get_instance_private(self);
+
+    return priv->c_height;
+}
+
+
+/*
+ * Setters
+ */
+
+void
+balsa_print_object_set_on_page(BalsaPrintObject *self,
+                               gint              on_page)
+{
+    BalsaPrintObjectPrivate *priv = balsa_print_object_get_instance_private(self);
+
+    priv->on_page = on_page;
+}
+
+
+void
+balsa_print_object_set_depth(BalsaPrintObject *self,
+                             guint             depth)
+{
+    BalsaPrintObjectPrivate *priv = balsa_print_object_get_instance_private(self);
+
+    priv->depth = depth;
+}
+
+
+void
+balsa_print_object_set_c_at_x(BalsaPrintObject *self,
+                              gdouble           c_at_x)
+{
+    BalsaPrintObjectPrivate *priv = balsa_print_object_get_instance_private(self);
+
+    priv->c_at_x = c_at_x;
+}
+
+
+void
+balsa_print_object_set_c_at_y(BalsaPrintObject *self,
+                              gdouble           c_at_y)
+{
+    BalsaPrintObjectPrivate *priv = balsa_print_object_get_instance_private(self);
+
+    priv->c_at_y = c_at_y;
+}
+
+
+void
+balsa_print_object_set_c_width(BalsaPrintObject *self,
+                               gdouble           c_width)
+{
+    BalsaPrintObjectPrivate *priv = balsa_print_object_get_instance_private(self);
+
+    priv->c_width = c_width;
+}
+
+
+void
+balsa_print_object_set_c_height(BalsaPrintObject *self,
+                                gdouble           c_height)
+{
+    BalsaPrintObjectPrivate *priv = balsa_print_object_get_instance_private(self);
+
+    priv->c_height = c_height;
+}
diff --git a/src/balsa-print-object.h b/src/balsa-print-object.h
index 85fce30..7c12d06 100644
--- a/src/balsa-print-object.h
+++ b/src/balsa-print-object.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/>.
  */
@@ -56,65 +56,80 @@ typedef struct {
 #define C_HEADER_SEP            12
 
 
-gint p_string_width_from_layout(PangoLayout * layout, const gchar * text);
-gint p_string_height_from_layout(PangoLayout * layout, const gchar * text);
-gboolean cairo_print_pixbuf(cairo_t * cairo_ctx, GdkPixbuf * pixbuf,
-                           gdouble c_at_x, gdouble c_at_y, gdouble scale);
-GList *split_for_layout(PangoLayout * layout, const gchar * text,
-                       PangoAttrList * attributes,
-                       BalsaPrintSetup * psetup, gboolean is_header,
-                       GArray ** offsets);
+gint     p_string_width_from_layout(PangoLayout *layout,
+                                    const gchar *text);
+gint     p_string_height_from_layout(PangoLayout *layout,
+                                     const gchar *text);
+gboolean cairo_print_pixbuf(cairo_t   *cairo_ctx,
+                            GdkPixbuf *pixbuf,
+                            gdouble    c_at_x,
+                            gdouble    c_at_y,
+                            gdouble    scale);
+GList *split_for_layout(PangoLayout     *layout,
+                        const gchar     *text,
+                        PangoAttrList   *attributes,
+                        BalsaPrintSetup *psetup,
+                        gboolean         is_header,
+                        GArray         **offsets);
 
 
 /*  == print object base class stuff ==  */
 
-#define BALSA_TYPE_PRINT_OBJECT                        \
-    (balsa_print_object_get_type())
-#define BALSA_PRINT_OBJECT(obj)                                                \
-    G_TYPE_CHECK_INSTANCE_CAST(obj, BALSA_TYPE_PRINT_OBJECT, BalsaPrintObject)
-#define BALSA_PRINT_OBJECT_CLASS(klass)                                        \
-    G_TYPE_CHECK_CLASS_CAST(klass, BALSA_TYPE_PRINT_OBJECT, BalsaPrintObjectClass)
-#define BALSA_IS_PRINT_OBJECT(obj)                     \
-    G_TYPE_CHECK_INSTANCE_TYPE(obj, BALSA_TYPE_PRINT_OBJECT)
-
-
-typedef struct _BalsaPrintObjectClass BalsaPrintObjectClass;
-typedef struct _BalsaPrintObject BalsaPrintObject;
+#define BALSA_TYPE_PRINT_OBJECT balsa_print_object_get_type()
 
-
-struct _BalsaPrintObject {
-    GObject parent;
-
-    gint on_page;
-    guint depth;
-
-    gdouble c_at_x;
-    gdouble c_at_y;
-    gdouble c_width;
-    gdouble c_height;
-};
+G_DECLARE_DERIVABLE_TYPE(BalsaPrintObject,
+                         balsa_print_object,
+                         BALSA,
+                         PRINT_OBJECT,
+                         GObject)
 
 
 struct _BalsaPrintObjectClass {
     GObjectClass parent;
 
-    void (*draw) (BalsaPrintObject * self, GtkPrintContext * context,
-                 cairo_t * cairo_ctx);
+    void (*draw) (BalsaPrintObject *self,
+                  GtkPrintContext  *context,
+                  cairo_t          *cairo_ctx);
 };
 
 
-GType balsa_print_object_get_type(void);
-GList *balsa_print_objects_append_from_body(GList * list,
-                                           GtkPrintContext * context,
-                                           LibBalsaMessageBody *
-                                           mime_body,
-                                           BalsaPrintSetup * psetup);
-void balsa_print_object_draw(BalsaPrintObject * self,
-                            GtkPrintContext * context,
-                            cairo_t * cairo_ctx);
+GList *balsa_print_objects_append_from_body(GList           *list,
+                                            GtkPrintContext *context,
+                                            LibBalsaMessageBody *
+                                            mime_body,
+                                            BalsaPrintSetup *psetup);
+void balsa_print_object_draw(BalsaPrintObject *self,
+                             GtkPrintContext  *context,
+                             cairo_t          *cairo_ctx);
+
+/*
+ * Getters
+ */
+gint    balsa_print_object_get_on_page(BalsaPrintObject *self);
+guint   balsa_print_object_get_depth(BalsaPrintObject *self);
+gdouble balsa_print_object_get_c_at_x(BalsaPrintObject *self);
+gdouble balsa_print_object_get_c_at_y(BalsaPrintObject *self);
+gdouble balsa_print_object_get_c_width(BalsaPrintObject *self);
+gdouble balsa_print_object_get_c_height(BalsaPrintObject *self);
+
+/*
+ * Setters
+ */
+void balsa_print_object_set_on_page(BalsaPrintObject *self,
+                                    gint              on_page);
+void balsa_print_object_set_depth(BalsaPrintObject *self,
+                                  guint             depth);
+void balsa_print_object_set_c_at_x(BalsaPrintObject *self,
+                                   gdouble           c_at_x);
+void balsa_print_object_set_c_at_y(BalsaPrintObject *self,
+                                   gdouble           c_at_y);
+void balsa_print_object_set_c_width(BalsaPrintObject *self,
+                                    gdouble           c_width);
+void balsa_print_object_set_c_height(BalsaPrintObject *self,
+                                     gdouble           c_height);
 
 
 G_END_DECLS
 
 
-#endif                         /* __BALSA_PRINT_OBJECT_H__ */
+#endif                          /* __BALSA_PRINT_OBJECT_H__ */
diff --git a/src/print-gtk.c b/src/print-gtk.c
index 5060f53..07b0152 100644
--- a/src/print-gtk.c
+++ b/src/print-gtk.c
@@ -371,7 +371,7 @@ draw_page(GtkPrintOperation * operation, GtkPrintContext * context,
     while (p) {
        BalsaPrintObject *po = BALSA_PRINT_OBJECT(p->data);
 
-       if (po->on_page == page_nr)
+       if (balsa_print_object_get_on_page(po) == page_nr)
            balsa_print_object_draw(po, context, cairo_ctx);
 
        p = p->next;


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