From d6c0ce729e5b3ac9eccf3ee838fe32aa3e982497 Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Wed, 3 Jun 2009 11:44:58 +0200 Subject: [PATCH] Add support for setting brand images in message view widgets --- src/widgets/modest-compact-mail-header-view.c | 58 +++++++++++++++++++++++- src/widgets/modest-compact-mail-header-view.h | 1 + src/widgets/modest-expander-mail-header-view.c | 19 ++++++++ src/widgets/modest-expander-mail-header-view.h | 1 + src/widgets/modest-gtkhtml-msg-view.c | 25 ++++++++++ src/widgets/modest-gtkhtml-msg-view.h | 1 + src/widgets/modest-mail-header-view.c | 6 +++ src/widgets/modest-mail-header-view.h | 2 + src/widgets/modest-mozembed-msg-view.c | 25 ++++++++++ src/widgets/modest-mozembed-msg-view.h | 1 + src/widgets/modest-msg-view.c | 6 +++ src/widgets/modest-msg-view.h | 2 + 12 files changed, 146 insertions(+), 1 deletion(-) diff --git a/src/widgets/modest-compact-mail-header-view.c b/src/widgets/modest-compact-mail-header-view.c index d248f03..4f1f7ab 100644 --- a/src/widgets/modest-compact-mail-header-view.c +++ b/src/widgets/modest-compact-mail-header-view.c @@ -55,6 +55,8 @@ struct _ModestCompactMailHeaderViewPriv GtkWidget *fromto_contents; GtkWidget *time_label; GtkWidget *date_label; + GtkWidget *brand_label; + GtkWidget *brand_image; GSList *custom_labels; @@ -97,6 +99,8 @@ static gboolean modest_compact_mail_header_view_get_loading (ModestMailHeaderVie static gboolean modest_compact_mail_header_view_get_loading_default (ModestMailHeaderView *headers_view); static void modest_compact_mail_header_view_set_loading (ModestMailHeaderView *headers_view, gboolean is_loading); static void modest_compact_mail_header_view_set_loading_default (ModestMailHeaderView *headers_view, gboolean is_loading); +static void modest_compact_mail_header_view_set_branding (ModestMailHeaderView *headers_view, const gchar *brand_name, const GdkPixbuf *brand_icon); +static void modest_compact_mail_header_view_set_branding_default (ModestMailHeaderView *headers_view, const gchar *brand_name, const GdkPixbuf *brand_icon); static const GtkWidget *modest_compact_mail_header_view_add_custom_header (ModestMailHeaderView *self, const gchar *label, GtkWidget *custom_widget, @@ -327,6 +331,7 @@ modest_compact_mail_header_view_instance_init (GTypeInstance *instance, gpointer GtkWidget *from_date_hbox, *vbox, *main_vbox; GtkWidget *main_align; GtkWidget *headers_date_hbox; + GtkWidget *date_brand_vbox, *brand_hbox; priv->header = NULL; priv->custom_labels = NULL; @@ -358,6 +363,16 @@ modest_compact_mail_header_view_instance_init (GTypeInstance *instance, gpointer gtk_misc_set_alignment (GTK_MISC (priv->time_label), 1.0, 1.0); gtk_misc_set_padding (GTK_MISC (priv->time_label), MODEST_MARGIN_DOUBLE, 0); + priv->brand_label = gtk_label_new (NULL); + gtk_label_set_justify (GTK_LABEL (priv->brand_label), GTK_JUSTIFY_RIGHT); + gtk_misc_set_alignment (GTK_MISC (priv->brand_label), 1.0, 0.5); + gtk_misc_set_padding (GTK_MISC (priv->brand_label), MODEST_MARGIN_DOUBLE, 0); + gtk_widget_set_no_show_all (priv->brand_label, TRUE); + + priv->brand_image = gtk_image_new (); + gtk_misc_set_alignment (GTK_MISC (priv->brand_image), 0.5, 0.5); + gtk_widget_set_no_show_all (priv->brand_image, TRUE); + gtk_box_pack_start (GTK_BOX (from_date_hbox), priv->fromto_label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (from_date_hbox), priv->fromto_contents, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (from_date_hbox), priv->time_label, FALSE, FALSE, 0); @@ -376,9 +391,17 @@ modest_compact_mail_header_view_instance_init (GTypeInstance *instance, gpointer gtk_container_set_focus_chain (GTK_CONTAINER (priv->headers_vbox), NULL); g_object_ref (priv->headers_vbox); + brand_hbox = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (brand_hbox), priv->brand_image, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (brand_hbox), priv->brand_label, TRUE, TRUE, 0); + + date_brand_vbox = gtk_vbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (date_brand_vbox), priv->date_label, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (date_brand_vbox), brand_hbox, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (headers_date_hbox), priv->headers_vbox, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (headers_date_hbox), priv->date_label, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (headers_date_hbox), date_brand_vbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (main_vbox), headers_date_hbox, FALSE, FALSE, 0); main_align = gtk_alignment_new (0.0, 0.0, 1.0, 1.0); @@ -445,6 +468,7 @@ modest_mail_header_view_init (gpointer g, gpointer iface_data) klass->set_priority = modest_compact_mail_header_view_set_priority; klass->get_loading = modest_compact_mail_header_view_get_loading; klass->set_loading = modest_compact_mail_header_view_set_loading; + klass->set_branding = modest_compact_mail_header_view_set_branding; klass->add_custom_header = modest_compact_mail_header_view_add_custom_header; return; @@ -464,6 +488,7 @@ modest_compact_mail_header_view_class_init (ModestCompactMailHeaderViewClass *kl klass->get_priority_func = modest_compact_mail_header_view_get_priority_default; klass->set_loading_func = modest_compact_mail_header_view_set_loading_default; klass->get_loading_func = modest_compact_mail_header_view_get_loading_default; + klass->set_branding_func = modest_compact_mail_header_view_set_branding_default; klass->add_custom_header_func = modest_compact_mail_header_view_add_custom_header_default; object_class->finalize = modest_compact_mail_header_view_finalize; @@ -590,6 +615,37 @@ modest_compact_mail_header_view_set_loading_default (ModestMailHeaderView *heade priv->is_loading = is_loading; } +static void +modest_compact_mail_header_view_set_branding (ModestMailHeaderView *headers_view, const gchar *brand_name, const GdkPixbuf *brand_icon) +{ + MODEST_COMPACT_MAIL_HEADER_VIEW_GET_CLASS (headers_view)->set_branding_func (headers_view, brand_name, brand_icon); +} + +static void +modest_compact_mail_header_view_set_branding_default (ModestMailHeaderView *headers_view, const gchar *brand_name, const GdkPixbuf *brand_icon) +{ + ModestCompactMailHeaderViewPriv *priv; + + g_return_if_fail (MODEST_IS_COMPACT_MAIL_HEADER_VIEW (headers_view)); + priv = MODEST_COMPACT_MAIL_HEADER_VIEW_GET_PRIVATE (headers_view); + + if (brand_name) { + gtk_label_set_text (GTK_LABEL (priv->brand_label), brand_name); + gtk_widget_show (priv->brand_label); + } else { + gtk_widget_hide (priv->brand_label); + } + + if (brand_icon) { + gtk_image_set_from_pixbuf (GTK_IMAGE (priv->brand_image), (GdkPixbuf *) brand_icon); + gtk_widget_show (priv->brand_image); + } else { + gtk_widget_hide (priv->brand_image); + } + + +} + static void on_notify_style (GObject *obj, GParamSpec *spec, gpointer userdata) { diff --git a/src/widgets/modest-compact-mail-header-view.h b/src/widgets/modest-compact-mail-header-view.h index 9b77668..f68eb1f 100644 --- a/src/widgets/modest-compact-mail-header-view.h +++ b/src/widgets/modest-compact-mail-header-view.h @@ -65,6 +65,7 @@ struct _ModestCompactMailHeaderViewClass TnyHeaderFlags (*get_priority_func) (ModestMailHeaderView *self); void (*set_loading_func) (ModestMailHeaderView *self, gboolean is_loading); gboolean (*get_loading_func) (ModestMailHeaderView *self); + void (*set_branding_func) (ModestMailHeaderView *self, const gchar *brand_name, const GdkPixbuf *brand_icon); const GtkWidget * (*add_custom_header_func) (ModestMailHeaderView *self, const gchar *label, GtkWidget *custom_widget, diff --git a/src/widgets/modest-expander-mail-header-view.c b/src/widgets/modest-expander-mail-header-view.c index 41e0238..c6a3aef 100644 --- a/src/widgets/modest-expander-mail-header-view.c +++ b/src/widgets/modest-expander-mail-header-view.c @@ -87,6 +87,8 @@ static void modest_expander_mail_header_view_set_priority_default (ModestMailHea TnyHeaderFlags flags); static gboolean modest_expander_mail_header_view_get_loading (ModestMailHeaderView *headers_view); static gboolean modest_expander_mail_header_view_get_loading_default (ModestMailHeaderView *headers_view); +static void modest_expander_mail_header_view_set_branding (ModestMailHeaderView *headers_view, const gchar *brand_name, const GdkPixbuf *brand_icon); +static void modest_expander_mail_header_view_set_branding_default (ModestMailHeaderView *headers_view, const gchar *brand_name, const GdkPixbuf *brand_icon); static void modest_expander_mail_header_view_set_loading (ModestMailHeaderView *headers_view, gboolean is_loading); static void modest_expander_mail_header_view_set_loading_default (ModestMailHeaderView *headers_view, gboolean is_loading); static const GtkWidget *modest_expander_mail_header_view_add_custom_header (ModestMailHeaderView *self, @@ -538,6 +540,7 @@ modest_mail_header_view_init (gpointer g, gpointer iface_data) klass->set_priority = modest_expander_mail_header_view_set_priority; klass->get_loading = modest_expander_mail_header_view_get_loading; klass->set_loading = modest_expander_mail_header_view_set_loading; + klass->set_branding = modest_expander_mail_header_view_set_branding; klass->add_custom_header = modest_expander_mail_header_view_add_custom_header; return; @@ -557,6 +560,7 @@ modest_expander_mail_header_view_class_init (ModestExpanderMailHeaderViewClass * klass->get_priority_func = modest_expander_mail_header_view_get_priority_default; klass->set_loading_func = modest_expander_mail_header_view_set_loading_default; klass->get_loading_func = modest_expander_mail_header_view_get_loading_default; + klass->set_branding_func = modest_expander_mail_header_view_set_branding_default; klass->add_custom_header_func = modest_expander_mail_header_view_add_custom_header_default; object_class->finalize = modest_expander_mail_header_view_finalize; @@ -699,3 +703,18 @@ modest_expander_mail_header_view_set_loading_default (ModestMailHeaderView *head priv->is_loading = is_loading; } + +static void +modest_expander_mail_header_view_set_branding (ModestMailHeaderView *headers_view, const gchar *brand_name, const GdkPixbuf *brand_icon) +{ + MODEST_EXPANDER_MAIL_HEADER_VIEW_GET_CLASS (headers_view)->set_branding_func (headers_view, brand_name, brand_icon); +} + +static void +modest_expander_mail_header_view_set_branding_default (ModestMailHeaderView *headers_view, const gchar *brand_name, const GdkPixbuf *brand_icon) +{ + g_return_if_fail (MODEST_IS_EXPANDER_MAIL_HEADER_VIEW (headers_view)); + + /* Empty implementation */ + return; +} diff --git a/src/widgets/modest-expander-mail-header-view.h b/src/widgets/modest-expander-mail-header-view.h index 87288c1..aba9e05 100644 --- a/src/widgets/modest-expander-mail-header-view.h +++ b/src/widgets/modest-expander-mail-header-view.h @@ -65,6 +65,7 @@ struct _ModestExpanderMailHeaderViewClass TnyHeaderFlags (*get_priority_func) (ModestMailHeaderView *self); void (*set_loading_func) (ModestMailHeaderView *self, gboolean is_loading); gboolean (*get_loading_func) (ModestMailHeaderView *self); + void (*set_branding_func) (ModestMailHeaderView *self, const gchar *brand_name, const GdkPixbuf *brand_icon); const GtkWidget *(*add_custom_header_func) (ModestMailHeaderView *self, const gchar *label, GtkWidget *custom_widget, diff --git a/src/widgets/modest-gtkhtml-msg-view.c b/src/widgets/modest-gtkhtml-msg-view.c index 8b92f05..6ec5a20 100644 --- a/src/widgets/modest-gtkhtml-msg-view.c +++ b/src/widgets/modest-gtkhtml-msg-view.c @@ -186,6 +186,7 @@ static TnyList *modest_gtkhtml_msg_view_get_attachments (ModestMsgView *self); static void modest_gtkhtml_msg_view_grab_focus (ModestMsgView *self); static void modest_gtkhtml_msg_view_remove_attachment (ModestMsgView *view, TnyMimePart *attachment); static void modest_gtkhtml_msg_view_request_fetch_images (ModestMsgView *view); +static void modest_gtkhtml_msg_view_set_branding (ModestMsgView *view, const gchar *brand_name, const GdkPixbuf *brand_icon); static gboolean modest_gtkhtml_msg_view_has_blocked_external_images (ModestMsgView *view); static void modest_gtkhtml_msg_view_set_msg_with_other_body_default (ModestMsgView *view, TnyMsg *msg, TnyMimePart *part); static GtkAdjustment *modest_gtkhtml_msg_view_get_vadjustment_default (ModestMsgView *self); @@ -202,6 +203,7 @@ static void modest_gtkhtml_msg_view_grab_focus_default (ModestMsgView *self); static void modest_gtkhtml_msg_view_remove_attachment_default (ModestMsgView *view, TnyMimePart *attachment); static gboolean modest_gtkhtml_msg_view_has_blocked_external_images_default (ModestMsgView *view); static void modest_gtkhtml_msg_view_request_fetch_images_default (ModestMsgView *view); +static void modest_gtkhtml_msg_view_set_branding_default (ModestMsgView *view, const gchar *brand_name, const GdkPixbuf *brand_icon); /* internal api */ static void set_header (ModestGtkhtmlMsgView *self, TnyHeader *header); @@ -225,6 +227,7 @@ static TnyList *get_attachments (ModestGtkhtmlMsgView *self); static void grab_focus (ModestGtkhtmlMsgView *self); static void remove_attachment (ModestGtkhtmlMsgView *view, TnyMimePart *attachment); static void request_fetch_images (ModestGtkhtmlMsgView *view); +static void set_branding (ModestGtkhtmlMsgView *view, const gchar *brand_name, const GdkPixbuf *brand_icon); static gboolean has_blocked_external_images (ModestGtkhtmlMsgView *view); /* list properties */ @@ -433,6 +436,7 @@ modest_gtkhtml_msg_view_class_init (ModestGtkhtmlMsgViewClass *klass) klass->grab_focus_func = modest_gtkhtml_msg_view_grab_focus_default; klass->remove_attachment_func = modest_gtkhtml_msg_view_remove_attachment_default; klass->request_fetch_images_func = modest_gtkhtml_msg_view_request_fetch_images_default; + klass->set_branding_func = modest_gtkhtml_msg_view_set_branding_default; klass->has_blocked_external_images_func = modest_gtkhtml_msg_view_has_blocked_external_images_default; g_type_class_add_private (gobject_class, sizeof(ModestGtkhtmlMsgViewPrivate)); @@ -1507,6 +1511,14 @@ request_fetch_images (ModestGtkhtmlMsgView *self) } } +static void +set_branding (ModestGtkhtmlMsgView *self, const gchar *brand_name, const GdkPixbuf *brand_icon) +{ + ModestGtkhtmlMsgViewPrivate *priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE (self); + + modest_mail_header_view_set_branding (MODEST_MAIL_HEADER_VIEW (priv->mail_header_view), brand_name, brand_icon); +} + static gboolean has_blocked_external_images (ModestGtkhtmlMsgView *self) { @@ -2369,6 +2381,7 @@ modest_msg_view_init (gpointer g, gpointer iface_data) klass->grab_focus_func = modest_gtkhtml_msg_view_grab_focus; klass->remove_attachment_func = modest_gtkhtml_msg_view_remove_attachment; klass->request_fetch_images_func = modest_gtkhtml_msg_view_request_fetch_images; + klass->set_branding_func = modest_gtkhtml_msg_view_set_branding; klass->has_blocked_external_images_func = modest_gtkhtml_msg_view_has_blocked_external_images; return; @@ -2542,6 +2555,18 @@ modest_gtkhtml_msg_view_request_fetch_images_default (ModestMsgView *self) request_fetch_images (MODEST_GTKHTML_MSG_VIEW (self)); } +static void +modest_gtkhtml_msg_view_set_branding (ModestMsgView *self, const gchar *brand_name, const GdkPixbuf *brand_icon) +{ + MODEST_GTKHTML_MSG_VIEW_GET_CLASS (self)->set_branding_func (self, brand_name, brand_icon); +} + +static void +modest_gtkhtml_msg_view_set_branding_default (ModestMsgView *self, const gchar *brand_name, const GdkPixbuf *brand_icon) +{ + set_branding (MODEST_GTKHTML_MSG_VIEW (self), brand_name, brand_icon); +} + static gboolean modest_gtkhtml_msg_view_has_blocked_external_images (ModestMsgView *self) { diff --git a/src/widgets/modest-gtkhtml-msg-view.h b/src/widgets/modest-gtkhtml-msg-view.h index 64d31e6..e952e3e 100644 --- a/src/widgets/modest-gtkhtml-msg-view.h +++ b/src/widgets/modest-gtkhtml-msg-view.h @@ -97,6 +97,7 @@ struct _ModestGtkhtmlMsgViewClass { void (*grab_focus_func) (ModestMsgView *self); void (*remove_attachment_func) (ModestMsgView *view, TnyMimePart *attachment); void (*request_fetch_images_func) (ModestMsgView *view); + void (*set_branding_func) (ModestMsgView *view, const gchar *brand_name, const GdkPixbuf *brand_icon); gboolean (*has_blocked_external_images_func) (ModestMsgView *view); void (*set_scroll_adjustments) (ModestGtkhtmlMsgView *msg_view, GtkAdjustment *hadj, GtkAdjustment *vadj); diff --git a/src/widgets/modest-mail-header-view.c b/src/widgets/modest-mail-header-view.c index c9a8977..485eecd 100644 --- a/src/widgets/modest-mail-header-view.c +++ b/src/widgets/modest-mail-header-view.c @@ -63,6 +63,12 @@ modest_mail_header_view_set_loading (ModestMailHeaderView *self, gboolean is_loa MODEST_MAIL_HEADER_VIEW_GET_IFACE (self)->set_loading (self, is_loading); } +void +modest_mail_header_view_set_branding (ModestMailHeaderView *self, const gchar *brand_name, const GdkPixbuf *brand_icon) +{ + MODEST_MAIL_HEADER_VIEW_GET_IFACE (self)->set_branding (self, brand_name, brand_icon); +} + const GtkWidget * modest_mail_header_view_add_custom_header (ModestMailHeaderView *self, const gchar *label, diff --git a/src/widgets/modest-mail-header-view.h b/src/widgets/modest-mail-header-view.h index 9b50a8c..992a180 100644 --- a/src/widgets/modest-mail-header-view.h +++ b/src/widgets/modest-mail-header-view.h @@ -56,6 +56,7 @@ struct _ModestMailHeaderViewIface { gboolean start); void (*set_loading) (ModestMailHeaderView *self, gboolean is_loading); gboolean (*get_loading) (ModestMailHeaderView *self); + void (*set_branding) (ModestMailHeaderView *self, const gchar *brand_name, const GdkPixbuf *brand_icon); /* signals */ void (*show_details) (ModestMailHeaderView *msgview, @@ -84,6 +85,7 @@ const GtkWidget *modest_mail_header_view_add_custom_header (ModestMailHeaderView gboolean start); void modest_mail_header_view_set_loading (ModestMailHeaderView *self, gboolean is_loading); gboolean modest_mail_header_view_get_loading (ModestMailHeaderView *self); +void modest_mail_header_view_set_branding (ModestMailHeaderView *self, const gchar *brand_name, const GdkPixbuf *brand_icon); G_END_DECLS diff --git a/src/widgets/modest-mozembed-msg-view.c b/src/widgets/modest-mozembed-msg-view.c index fb22106..6dc5952 100644 --- a/src/widgets/modest-mozembed-msg-view.c +++ b/src/widgets/modest-mozembed-msg-view.c @@ -132,6 +132,7 @@ static TnyList *modest_mozembed_msg_view_get_attachments (ModestMsgView *self); static void modest_mozembed_msg_view_grab_focus (ModestMsgView *self); static void modest_mozembed_msg_view_remove_attachment (ModestMsgView *view, TnyMimePart *attachment); static void modest_mozembed_msg_view_request_fetch_images (ModestMsgView *view); +static void modest_mozembed_msg_view_set_branding (ModestMsgView *view, const gchar *brand_name, const GdkPixbuf *brand_icon); static gboolean modest_mozembed_msg_view_has_blocked_external_images (ModestMsgView *view); static void modest_mozembed_msg_view_set_msg_with_other_body_default (ModestMsgView *self, TnyMsg *msg, TnyMimePart *part); static GtkAdjustment *modest_mozembed_msg_view_get_vadjustment_default (ModestMsgView *self); @@ -148,6 +149,7 @@ static void modest_mozembed_msg_view_grab_focus_default (ModestMsgView *self); static void modest_mozembed_msg_view_remove_attachment_default (ModestMsgView *view, TnyMimePart *attachment); static gboolean modest_mozembed_msg_view_has_blocked_external_images_default (ModestMsgView *view); static void modest_mozembed_msg_view_request_fetch_images_default (ModestMsgView *view); +static void modest_mozembed_msg_view_set_branding_default (ModestMsgView *view, const gchar *brand_name, const GdkPixbuf *brand_icon); /* internal api */ static void set_header (ModestMozembedMsgView *self, TnyHeader *header); @@ -171,6 +173,7 @@ static TnyList *get_attachments (ModestMozembedMsgView *self); static void grab_focus (ModestMozembedMsgView *self); static void remove_attachment (ModestMozembedMsgView *view, TnyMimePart *attachment); static void request_fetch_images (ModestMozembedMsgView *view); +static void set_branding (ModestMozembedMsgView *view, const gchar *brand_name, const GdkPixbuf *brand_icon); static gboolean has_blocked_external_images (ModestMozembedMsgView *view); typedef struct _ModestMozembedMsgViewPrivate ModestMozembedMsgViewPrivate; @@ -342,6 +345,7 @@ modest_mozembed_msg_view_class_init (ModestMozembedMsgViewClass *klass) klass->grab_focus_func = modest_mozembed_msg_view_grab_focus_default; klass->remove_attachment_func = modest_mozembed_msg_view_remove_attachment_default; klass->request_fetch_images_func = modest_mozembed_msg_view_request_fetch_images_default; + klass->set_branding_func = modest_mozembed_msg_view_set_branding_default; klass->has_blocked_external_images_func = modest_mozembed_msg_view_has_blocked_external_images_default; g_type_class_add_private (gobject_class, sizeof(ModestMozembedMsgViewPrivate)); @@ -563,6 +567,14 @@ request_fetch_images (ModestMozembedMsgView *self) } } +static void +set_branding (ModestMozembedMsgView *self, const gchar *brand_name, const GdkPixbuf *brand_icon) +{ + ModestMozembedMsgViewPrivate *priv = MODEST_MOZEMBED_MSG_VIEW_GET_PRIVATE (self); + + modest_mail_header_view_set_branding (MODEST_MAIL_HEADER_VIEW (priv->mail_header_view), brand_name, brand_icon); +} + static gboolean has_blocked_external_images (ModestMozembedMsgView *self) { @@ -1260,6 +1272,7 @@ modest_msg_view_init (gpointer g, gpointer iface_data) klass->grab_focus_func = modest_mozembed_msg_view_grab_focus; klass->remove_attachment_func = modest_mozembed_msg_view_remove_attachment; klass->request_fetch_images_func = modest_mozembed_msg_view_request_fetch_images; + klass->set_branding_func = modest_mozembed_msg_view_set_branding; klass->has_blocked_external_images_func = modest_mozembed_msg_view_has_blocked_external_images; return; @@ -1433,6 +1446,18 @@ modest_mozembed_msg_view_request_fetch_images_default (ModestMsgView *self) request_fetch_images (MODEST_MOZEMBED_MSG_VIEW (self)); } +static void +modest_mozembed_msg_view_set_branding (ModestMsgView *self, const gchar *brand_name, const GdkPixbuf *brand_icon) +{ + MODEST_MOZEMBED_MSG_VIEW_GET_CLASS (self)->set_branding_func (self, brand_name, brand_icon); +} + +static void +modest_mozembed_msg_view_set_branding_default (ModestMsgView *self, const gchar *brand_name, const GdkPixbuf *brand_icon) +{ + set_branding (MODEST_MOZEMBED_MSG_VIEW (self), brand_name, brand_icon); +} + static gboolean modest_mozembed_msg_view_has_blocked_external_images (ModestMsgView *self) { diff --git a/src/widgets/modest-mozembed-msg-view.h b/src/widgets/modest-mozembed-msg-view.h index acd22d4..9ca947e 100644 --- a/src/widgets/modest-mozembed-msg-view.h +++ b/src/widgets/modest-mozembed-msg-view.h @@ -97,6 +97,7 @@ struct _ModestMozembedMsgViewClass { void (*grab_focus_func) (ModestMsgView *self); void (*remove_attachment_func) (ModestMsgView *view, TnyMimePart *attachment); void (*request_fetch_images_func) (ModestMsgView *view); + void (*set_branding_func) (ModestMsgView *view, const gchar *brand_name, const GdkPixbuf *brand_icon); gboolean (*has_blocked_external_images_func) (ModestMsgView *view); void (*set_scroll_adjustments) (ModestMozembedMsgView *msg_view, GtkAdjustment *hadj, GtkAdjustment *vadj); diff --git a/src/widgets/modest-msg-view.c b/src/widgets/modest-msg-view.c index ebdf402..bcbf561 100644 --- a/src/widgets/modest-msg-view.c +++ b/src/widgets/modest-msg-view.c @@ -128,6 +128,12 @@ modest_msg_view_remove_attachment (ModestMsgView *self, TnyMimePart *attachment) } void +modest_msg_view_set_branding (ModestMsgView *self, const gchar *brand_name, const GdkPixbuf *brand_icon) +{ + MODEST_MSG_VIEW_GET_IFACE (self)->set_branding_func (self, brand_name, brand_icon); +} + +void modest_msg_view_request_fetch_images (ModestMsgView *self) { MODEST_MSG_VIEW_GET_IFACE (self)->request_fetch_images_func (self); diff --git a/src/widgets/modest-msg-view.h b/src/widgets/modest-msg-view.h index f59080d..9fb01d7 100644 --- a/src/widgets/modest-msg-view.h +++ b/src/widgets/modest-msg-view.h @@ -68,6 +68,7 @@ struct _ModestMsgViewIface { TnyList * (*get_attachments_func) (ModestMsgView *self); void (*grab_focus_func) (ModestMsgView *self); void (*remove_attachment_func) (ModestMsgView *view, TnyMimePart *attachment); + void (*set_branding_func) (ModestMsgView *view, const gchar *brand_name, const GdkPixbuf *brand_icon); /* signals */ void (*set_scroll_adjustments) (ModestMsgView *msg_view, @@ -113,6 +114,7 @@ TnyList *modest_msg_view_get_selected_attachments (ModestMsgView *self); TnyList *modest_msg_view_get_attachments (ModestMsgView *self); void modest_msg_view_grab_focus (ModestMsgView *self); void modest_msg_view_remove_attachment (ModestMsgView *view, TnyMimePart *attachment); +void modest_msg_view_set_branding (ModestMsgView *view, const gchar *brand_name, const GdkPixbuf *brand_icon); void modest_msg_view_set_view_images (ModestMsgView *view, gboolean view_images); void modest_msg_view_request_fetch_images (ModestMsgView *view); gboolean modest_msg_view_has_blocked_external_images (ModestMsgView *view); -- 1.7.9.5