GtkWidget *brand_icon;
GtkWidget *brand_label;
+ GtkWidget *brand_container;
};
#define MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
priv->brand_icon = gtk_image_new ();
gtk_misc_set_alignment (GTK_MISC (priv->brand_icon), 0.5, 0.5);
priv->brand_label = gtk_label_new (NULL);
+ hildon_helper_set_logical_font (priv->brand_label, "SmallSystemFont");
gtk_misc_set_alignment (GTK_MISC (priv->brand_label), 0.0, 0.5);
gtk_widget_set_no_show_all (priv->brand_icon, TRUE);
gtk_widget_set_no_show_all (priv->brand_label, TRUE);
gtk_box_pack_start (GTK_BOX (from_send_hbox), priv->send_button, FALSE, FALSE, 0);
branding_box = gtk_hbox_new (FALSE, MODEST_MARGIN_DEFAULT);
+ gtk_widget_show (branding_box);
+ gtk_box_pack_start (GTK_BOX (branding_box), priv->brand_label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (branding_box), priv->brand_icon, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (branding_box), priv->brand_label, TRUE, TRUE, 0);
+
+ priv->brand_container = gtk_alignment_new (0.0, 0.5, 0.0, 1.0);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (priv->brand_container), 0, 0, MODEST_MARGIN_DOUBLE, 0);
+ gtk_container_add (GTK_CONTAINER (priv->brand_container), branding_box);
+ gtk_widget_set_no_show_all (priv->brand_container, TRUE);
gtk_box_pack_start (GTK_BOX (priv->header_box), from_send_hbox, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (priv->header_box), priv->bcc_caption, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (priv->header_box), subject_caption, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (priv->header_box), priv->attachments_caption, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (priv->header_box), branding_box, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->header_box), priv->brand_container, FALSE, FALSE, 0);
gtk_widget_set_no_show_all (priv->attachments_caption, TRUE);
init_wp_text_view_style ();
g_free (priv->last_search);
g_free (priv->references);
g_free (priv->in_reply_to);
- g_object_unref (priv->faces_model);
- g_object_unref (priv->sizes_model);
g_object_unref (priv->attachments);
g_object_unref (priv->images);
modest_selector_picker_set_pair_list (MODEST_SELECTOR_PICKER (priv->from_field), priv->from_field_protos);
modest_selector_picker_set_active_id (MODEST_SELECTOR_PICKER (priv->from_field), (gpointer) account_name);
priv->last_from_account = modest_selector_picker_get_active_id (MODEST_SELECTOR_PICKER (priv->from_field));
- update_branding (MODEST_MSG_EDIT_WINDOW (obj), priv->last_from_account);
if (mailbox && modest_pair_list_find_by_first_as_string (priv->from_field_protos, mailbox)) {
modest_selector_picker_set_active_id (MODEST_SELECTOR_PICKER (priv->from_field), (gpointer) mailbox);
priv->original_mailbox = g_strdup (mailbox);
modest_selector_picker_set_active_id (MODEST_SELECTOR_PICKER (priv->from_field), (gpointer) account_name);
}
priv->last_from_account = modest_selector_picker_get_active_id (MODEST_SELECTOR_PICKER (priv->from_field));
+ update_branding (MODEST_MSG_EDIT_WINDOW (obj), priv->last_from_account);
hildon_button_set_title (HILDON_BUTTON (priv->from_field),
_("mail_va_from"));
hildon_button_set_value (HILDON_BUTTON (priv->from_field),
info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) {
size = info->size;
if (size > allowed_size) {
- modest_platform_information_banner (NULL, NULL,
- _FM("sfil_ib_opening_not_allowed"));
+ modest_platform_information_banner (NULL, NULL,
+ _("mail_ib_error_attachment_size"));
g_free (filename);
return 0;
}
}
}
-static void update_signature (ModestMsgEditWindow *self,
- const gchar *old_account,
- const gchar *new_account)
+static void
+update_signature (ModestMsgEditWindow *self,
+ const gchar *old_account,
+ const gchar *new_account)
{
ModestMsgEditWindowPrivate *priv;
gboolean has_old_signature, has_new_signature;
GtkTextIter iter;
- GtkTextIter match_start, match_end;
ModestAccountMgr *mgr;
gchar *signature;
- gchar *full_signature;
priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (self);
if (old_account) {
signature = modest_account_mgr_get_signature_from_recipient (mgr, old_account, &has_old_signature);
if (has_old_signature) {
- full_signature = g_strconcat ("\n--\n", signature, NULL);
- if (gtk_text_iter_forward_search (&iter, full_signature, 0, &match_start, &match_end, NULL)) {
+ GtkTextIter match_start, match_end;
+ /* We cannot use
+ MODEST_TEXT_UTILS_SIGNATURE_MARKER as it
+ seems that the search has some problems
+ with the blank space at the end */
+ if (gtk_text_iter_forward_search (&iter, "--",
+ GTK_TEXT_SEARCH_TEXT_ONLY,
+ &match_start, NULL, NULL)) {
+ gtk_text_buffer_get_end_iter (priv->text_buffer ,&match_end);
gtk_text_buffer_delete (priv->text_buffer, &match_start, &match_end);
iter = match_start;
} else if (gtk_text_iter_forward_search (&iter, _("mcen_ia_editor_original_message"), 0,
&match_start, &match_end, NULL)) {
iter = match_start;
}
- g_free (full_signature);
}
g_free (signature);
}
priv->last_from_account = modest_selector_picker_get_active_id (MODEST_SELECTOR_PICKER (priv->from_field));
signature = modest_account_mgr_get_signature_from_recipient (mgr, new_account, &has_new_signature);
if (has_new_signature) {
- full_signature = g_strconcat ("\n--\n", signature, NULL);
+ gchar *full_signature = g_strconcat (MODEST_TEXT_UTILS_SIGNATURE_MARKER, "\n",
+ signature, NULL);
gtk_text_buffer_insert (priv->text_buffer, &iter, full_signature, -1);
g_free (full_signature);
}
ModestAccountMgr *mgr;
const GdkPixbuf *new_icon = NULL;
gchar *new_label = NULL;
+ gboolean show = FALSE;
priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (self);
if (new_icon) {
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->brand_icon), (GdkPixbuf *) new_icon);
gtk_widget_show (priv->brand_icon);
+ show = TRUE;
} else {
gtk_widget_hide (priv->brand_icon);
}
gtk_label_set_text (GTK_LABEL (priv->brand_label), new_label);
gtk_widget_show (priv->brand_label);
g_free (new_label);
+ show = TRUE;
} else {
gtk_widget_hide (priv->brand_label);
}
+
+ if (show)
+ gtk_widget_show (priv->brand_container);
+ else
+ gtk_widget_hide (priv->brand_container);
}
static void
priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (self);
old_account = priv->last_from_account;
- priv->last_from_account = modest_selector_picker_get_active_id (MODEST_SELECTOR_PICKER (priv->from_field));
- new_account = priv->last_from_account;
+ new_account = modest_selector_picker_get_active_id (MODEST_SELECTOR_PICKER (priv->from_field));
+
+ if (!new_account) {
+ g_warning ("%s, could not get the new account", __FUNCTION__);
+ return;
+ }
+
+ /* If the From is the same do nothing */
+ if (old_account && new_account && !strcmp (old_account, new_account))
+ return;
+
+ priv->last_from_account = new_account;
update_signature (self, old_account, new_account);
update_branding (self, new_account);