+
+static void
+on_notify_style (GObject *obj, GParamSpec *spec, gpointer userdata)
+{
+ if (strcmp ("style", spec->name) == 0) {
+ update_style (MODEST_ATTACHMENTS_VIEW (obj));
+ gtk_widget_queue_draw (GTK_WIDGET (obj));
+ }
+}
+
+/* This method updates the color (and other style settings) of widgets using secondary text color,
+ * tracking the gtk style */
+static void
+update_style (ModestAttachmentsView *self)
+{
+#ifdef MODEST_COMPACT_HEADER_BG
+ GdkColor bg_color;
+ GtkStyle *style;
+ GdkColor *current_bg;
+
+ g_return_if_fail (MODEST_IS_ATTACHMENTS_VIEW (self));
+
+ gdk_color_parse (MODEST_COMPACT_HEADER_BG, &bg_color);
+ style = gtk_widget_get_style (GTK_WIDGET (self));
+ current_bg = &(style->bg[GTK_STATE_NORMAL]);
+ if (current_bg->red != bg_color.red || current_bg->blue != bg_color.blue || current_bg->green != bg_color.green)
+ gtk_widget_modify_bg (GTK_WIDGET (self), GTK_STATE_NORMAL, &bg_color);
+#endif
+}
+