GtkWidget *list_view;
GtkWidget *entry_name;
GtkWidget *entry_subject;
+ GtkWidget *entry_from;
GtkWidget *entry_to;
GtkWidget *entry_cc;
GtkWidget *entry_bcc;
GtkWidget *scrolled_window;
GtkWidget *vpaned;
GtkWidget *vbox1;
- GtkWidget *table; /* including : entry_[name|to|cc|bcc|subject] */
+ GtkWidget *table; /* including : entry_[name|from|to|cc|bcc|subject] */
GtkWidget *scroll2;
GtkWidget *text_value;
GtkWidget *vbox2;
} tab[] = {
{_("Name"), &templates.entry_name, FALSE,
_("This name is used as the Menu item")},
+ {_("From"), &templates.entry_from, TRUE,
+ _("Override composing account's From header. This doesn't change the composing account.")},
{_("To"), &templates.entry_to, TRUE, NULL},
{_("Cc"), &templates.entry_cc, TRUE, NULL},
{_("Bcc"), &templates.entry_bcc, TRUE, NULL},
GtkTextBuffer *buffer;
gtk_entry_set_text(GTK_ENTRY(templates.entry_name), "");
+ gtk_entry_set_text(GTK_ENTRY(templates.entry_from), "");
gtk_entry_set_text(GTK_ENTRY(templates.entry_to), "");
gtk_entry_set_text(GTK_ENTRY(templates.entry_cc), "");
gtk_entry_set_text(GTK_ENTRY(templates.entry_bcc), "");
ntmpl->subject = tmpl->subject && *(tmpl->subject)
? g_strdup(tmpl->subject)
: NULL;
+ ntmpl->from = tmpl->from && *(tmpl->from)
+ ? g_strdup(tmpl->from)
+ : NULL;
ntmpl->to = tmpl->to && *(tmpl->to)
? g_strdup(tmpl->to)
: NULL;
Template *tmpl;
gchar *name;
gchar *subject;
+ gchar *from;
gchar *to;
gchar *cc;
gchar *bcc;
g_free(value);
return FALSE;
}
+ from = gtk_editable_get_chars(GTK_EDITABLE(templates.entry_from),
+ 0, -1);
to = gtk_editable_get_chars(GTK_EDITABLE(templates.entry_to),
0, -1);
cc = gtk_editable_get_chars(GTK_EDITABLE(templates.entry_cc),
subject = gtk_editable_get_chars(GTK_EDITABLE(templates.entry_subject),
0, -1);
+ if (from && *from == '\0') {
+ g_free(from);
+ from = NULL;
+ }
if (to && *to == '\0') {
g_free(to);
to = NULL;
subject = NULL;
}
+ if (!prefs_template_string_is_valid(to, NULL, FALSE)) {
+ alertpanel_error(_("Template From format error."));
+ g_free(from);
+ g_free(value);
+ return FALSE;
+ }
if (!prefs_template_string_is_valid(to, NULL, FALSE)) {
alertpanel_error(_("Template To format error."));
g_free(to);
tmpl->load_filename = NULL;
tmpl->name = name;
tmpl->subject = subject;
+ tmpl->from = from;
tmpl->to = to;
tmpl->cc = cc;
tmpl->bcc = bcc;
tmpl_def.name = _("Template");
tmpl_def.subject = "";
+ tmpl_def.from = "";
tmpl_def.to = "";
tmpl_def.cc = "";
tmpl_def.bcc = "";
tmpl = &tmpl_def;
gtk_entry_set_text(GTK_ENTRY(templates.entry_name), tmpl->name);
+ gtk_entry_set_text(GTK_ENTRY(templates.entry_from),
+ tmpl->from ? tmpl->from : "");
gtk_entry_set_text(GTK_ENTRY(templates.entry_to),
tmpl->to ? tmpl->to : "");
gtk_entry_set_text(GTK_ENTRY(templates.entry_cc),