aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--composer/e-msg-composer.c155
-rw-r--r--composer/e-msg-composer.h2
-rw-r--r--mail/mail-account-gui.c295
-rw-r--r--mail/mail-account-gui.h14
-rw-r--r--mail/mail-composer-prefs.c168
-rw-r--r--mail/mail-composer-prefs.h5
-rw-r--r--mail/mail-config.c97
-rw-r--r--mail/mail-config.glade398
-rw-r--r--mail/mail-config.h11
9 files changed, 472 insertions, 673 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index dab3c276dd..6b0899c60e 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -53,6 +53,7 @@
#include <gal/unicode/gunicode.h>
#include <gal/util/e-unicode-i18n.h>
+#include <gal/widgets/e-unicode.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-exec.h>
@@ -845,48 +846,56 @@ static gchar *
get_signature_html (EMsgComposer *composer)
{
gboolean format_html = FALSE;
- char *text, *html = NULL, *sig_file = NULL, *script = NULL;
- static gboolean random_initialized = FALSE;
-
+ char *text = NULL, *html = NULL, *sig_file = NULL, *script = NULL;
+
if (composer->signature) {
sig_file = composer->signature->filename;
format_html = composer->signature->html;
script = composer->signature->script;
- } else if (composer->random_signature) {
- GList *l;
- gint pos;
-
- if (!random_initialized) {
- printf ("initialize random generator\n");
- srand (time (NULL));
- random_initialized = TRUE;
- }
- pos = (int) (((gdouble) mail_config_get_signatures_random ())*rand()/(RAND_MAX+1.0));
- printf ("using %d sig\n", pos);
-
- for (l = mail_config_get_signature_list (); l; l = l->next) {
- MailConfigSignature *sig = (MailConfigSignature *) l->data;
-
- if (sig->random) {
- if (pos == 0) {
- printf ("using %s\n", sig->name);
- sig_file = sig->filename;
- script = sig->script;
- format_html = sig->html;
- break;
- }
- pos --;
- }
- }
+ } else if (composer->auto_signature) {
+ MailConfigIdentity *id;
+ gchar *address;
+ gchar *name;
+ gchar *organization;
+
+ id = E_MSG_COMPOSER_HDRS (composer->hdrs)->account->id;
+ address = id->address ? e_text_to_html (id->address, E_TEXT_TO_HTML_CONVERT_SPACES) : NULL;
+ name = id->name ? e_text_to_html (id->name, E_TEXT_TO_HTML_CONVERT_SPACES) : NULL;
+ organization = id->organization ? e_text_to_html (id->organization, E_TEXT_TO_HTML_CONVERT_SPACES) : NULL;
+
+ text = g_strdup_printf ("-- <BR>%s%s%s%s%s%s%s%s",
+ name ? name : "",
+ (address && *address) ? " &lt;<A HREF=\"mailto:" : "",
+ address ? address : "",
+ (address && *address) ? "\">" : "",
+ address ? address : "",
+ (address && *address) ? "</A>&gt;" : "",
+ (organization && *organization) ? "<BR>" : "",
+ organization ? organization : "");
+ g_free (address);
+ g_free (name);
+ g_free (organization);
+ format_html = TRUE;
+ }
+
+ if (!text) {
+ if (!sig_file)
+ return NULL;
+ printf ("sig file: %s\n", sig_file);
+
+ mail_config_signature_run_script (script);
+ text = e_msg_composer_get_sig_file_content (sig_file, format_html);
}
- if (!sig_file)
- return NULL;
- printf ("sig file: %s\n", sig_file);
- mail_config_signature_run_script (script);
- text = e_msg_composer_get_sig_file_content (sig_file, format_html);
/* printf ("text: %s\n", text); */
if (text) {
+ if (!format_html) {
+ gchar *tmp;
+
+ tmp = e_text_to_html (text, E_TEXT_TO_HTML_CONVERT_SPACES);
+ g_free (text);
+ text = tmp;
+ }
/* The signature dash convention ("-- \n") is specified in the
* "Son of RFC 1036": http://www.chemie.fu-berlin.de/outerspace/netnews/son-of-1036.html,
* section 4.3.2.
@@ -1736,14 +1745,6 @@ static EPixmap pixcache [] = {
};
static void
-signature_regenerate_cb (BonoboUIComponent *uic, gpointer user_data, const char *path)
-{
- printf ("signature_regenerate_cb: %s\n", path);
-
- e_msg_composer_show_sig_file (E_MSG_COMPOSER (user_data));
-}
-
-static void
signature_cb (BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type,
const char *state, gpointer user_data)
{
@@ -1754,23 +1755,23 @@ signature_cb (BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_Event
if (state && *state == '1') {
if (path && !strncmp (path, "Signature", 9)) {
MailConfigSignature *old_sig;
- gboolean old_random;
+ gboolean old_auto;
old_sig = composer->signature;
- old_random = composer->random_signature;
+ old_auto = composer->auto_signature;
printf ("I'm going to set signature (%d)\n", atoi (path + 9));
- if (path [9] == 'N') {
+ if (path [9] == 'N') { /* none */
composer->signature = NULL;
- composer->random_signature = FALSE;
- } else if (path [9] == 'R') {
+ composer->auto_signature = FALSE;
+ } else if (path [9] == 'A') { /* auto */
composer->signature = NULL;
- composer->random_signature = TRUE;
+ composer->auto_signature = TRUE;
} else {
composer->signature = g_list_nth_data (mail_config_get_signature_list (), atoi (path + 9));
- composer->random_signature = FALSE;
+ composer->auto_signature = FALSE;
}
- if (old_sig != composer->signature || old_random != composer->random_signature)
+ if (old_sig != composer->signature || old_auto != composer->auto_signature)
e_msg_composer_show_sig_file (composer);
}
}
@@ -1787,8 +1788,6 @@ remove_signature_list (EMsgComposer *composer)
gint len = g_list_length (mail_config_get_signature_list ());
bonobo_ui_component_rm (composer->uic, "/menu/Edit/EditMisc/EditSignaturesSubmenu/SeparatorList", NULL);
- bonobo_ui_component_rm (composer->uic, "/menu/Edit/EditMisc/EditSignaturesSubmenu/SeparatorRegenerate", NULL);
- bonobo_ui_component_rm (composer->uic, "/menu/Edit/EditMisc/EditSignaturesSubmenu/SignatureRegenerate", NULL);
for (; len; len --) {
g_snprintf (path, 64, "/menu/Edit/EditMisc/EditSignaturesSubmenu/Signature%d", len - 1);
bonobo_ui_component_rm (composer->uic, path, NULL);
@@ -1803,24 +1802,16 @@ sig_event_client (MailConfigSigEvent event, MailConfigSignature *sig, EMsgCompos
bonobo_ui_component_freeze (composer->uic, NULL);
switch (event) {
case MAIL_CONFIG_SIG_EVENT_DELETED:
- if (sig == composer->signature)
+ if (sig == composer->signature) {
composer->signature = NULL;
+ composer->auto_signature = TRUE;
+ }
path = g_strdup_printf ("/menu/Edit/EditMisc/EditSignaturesSubmenu/Signature%d",
g_list_length (mail_config_get_signature_list ()));
bonobo_ui_component_rm (composer->uic, path, NULL);
g_free (path);
setup_signatures_menu (composer);
break;
- case MAIL_CONFIG_SIG_EVENT_RANDOM_OFF:
- composer->random_signature = FALSE;
- bonobo_ui_component_rm (composer->uic, "/menu/Edit/EditMisc/EditSignaturesSubmenu/SignatureRandom", NULL);
- bonobo_ui_component_rm (composer->uic, "/menu/Edit/EditMisc/EditSignaturesSubmenu/SeparatorRandom", NULL);
- setup_signatures_menu (composer);
- break;
- case MAIL_CONFIG_SIG_EVENT_RANDOM_ON:
- remove_signature_list (composer);
- setup_signatures_menu (composer);
- break;
case MAIL_CONFIG_SIG_EVENT_ADDED:
case MAIL_CONFIG_SIG_EVENT_NAME_CHANGED:
setup_signatures_menu (composer);
@@ -1840,40 +1831,33 @@ setup_signatures_menu (EMsgComposer *composer)
str = g_string_new ("<submenu name=\"EditSignaturesSubmenu\" _label=\"Signatures\">\n"
"<menuitem name=\"SignatureNone\" _label=\"None\" verb=\"SignatureNone\""
+ " type=\"radio\" group=\"signatures_group\"/>\n"
+ "<menuitem name=\"SignatureAuto\" _label=\"Autogenerated\" verb=\"SignatureAuto\""
" type=\"radio\" group=\"signatures_group\"/>\n");
- if (mail_config_get_signatures_random ()) {
- g_string_append (str,
- "<separator name=\"SeparatorRandom\"/>\n"
- "<menuitem name=\"SignatureRandom\" _label=\"Random\" verb=\"SignatureRandom\""
- " type=\"radio\" group=\"signatures_group\"/>\n");
- }
list = mail_config_get_signature_list ();
if (list) {
-
+ gchar *gtk_str;
g_string_append (str, "<separator name=\"SeparatorList\"/>");
for (l = list; l; len ++, l = l->next) {
+ gtk_str = e_utf8_to_gtk_string (GTK_WIDGET (composer), ((MailConfigSignature *)l->data)->name);
line = g_strdup_printf ("<menuitem name=\"Signature%d\" _label=\"%s\""
" verb=\"Signature%d\" type=\"radio\" group=\"signatures_group\"/>\n",
- len, ((MailConfigSignature *)l->data)->name, len);
+ len, gtk_str, len);
+ g_free (gtk_str);
g_string_append (str, line);
g_free (line);
}
}
- g_string_append (str,
- "<separator name=\"SeparatorRegenerate\"/>\n"
- "<menuitem name=\"SignatureRegenerate\" _label=\"_Regenerate\""
- " verb=\"SignatureRegenerate\" accel=\"*Ctrl**Shift*G\"/>");
g_string_append (str, "</submenu>\n");
bonobo_ui_component_set_translate (composer->uic, "/menu/Edit/EditMisc/", str->str, NULL);
bonobo_ui_component_set (composer->uic, "/menu/Edit/EditMisc/", "<separator/>", NULL);
bonobo_ui_component_add_listener (composer->uic, "SignatureNone", signature_cb, composer);
- bonobo_ui_component_add_listener (composer->uic, "SignatureRandom", signature_cb, composer);
- bonobo_ui_component_add_verb (composer->uic, "SignatureRegenerate", signature_regenerate_cb, composer);
+ bonobo_ui_component_add_listener (composer->uic, "SignatureAuto", signature_cb, composer);
for (i = 0; i < len; i ++) {
g_string_sprintf (str, "Signature%d", i + 1);
@@ -2811,14 +2795,13 @@ set_editor_signature (EMsgComposer *composer)
id = E_MSG_COMPOSER_HDRS (composer->hdrs)->account->id;
- composer->random_signature = composer->send_html ? id->html_random : id->text_random;
- if (composer->random_signature)
- composer->signature = NULL;
- else
- composer->signature = composer->send_html ? id->html_signature : id->text_signature;
-
- if (composer->random_signature) {
- verb = g_strdup ("/commands/SignatureRandom");
+ composer->signature = id->def_signature;
+ composer->auto_signature = id->auto_signature;
+
+ printf ("auto: %d\n", id->auto_signature);
+
+ if (composer->auto_signature) {
+ verb = g_strdup ("/commands/SignatureAuto");
} else if (composer->signature == NULL) {
verb = g_strdup ("/commands/SignatureNone");
} else {
@@ -3818,8 +3801,6 @@ e_msg_composer_set_send_html (EMsgComposer *composer,
composer->send_html, NULL);
set_config (composer, "FormatHTML", composer->send_html);
- set_editor_signature (composer);
- e_msg_composer_show_sig_file (composer);
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "unblock-redraw", &ev);
CORBA_exception_free (&ev);
}
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
index ea457e43a6..584de4fa53 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -101,7 +101,7 @@ struct _EMsgComposer {
CamelMimeMessage *redirect;
MailConfigSignature *signature;
- gboolean random_signature;
+ gboolean auto_signature;
};
struct _EMsgComposerClass {
diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c
index 71f72e4269..80b27b0ff0 100644
--- a/mail/mail-account-gui.c
+++ b/mail/mail-account-gui.c
@@ -1179,78 +1179,51 @@ clear_menu (GtkWidget *menu)
static inline int
sig_get_index (MailConfigSignature *sig)
{
- return sig->id + (mail_config_get_signatures_random () ? 2 : 1);
+ return sig ? sig->id + 2 : 0;
}
-static gint
-sig_get_gui_index (MailAccountGui *gui, gboolean text)
+static inline int
+sig_gui_get_index (MailAccountGui *gui)
{
- MailConfigSignature *sig = text ? gui->text_signature : gui->html_signature;
- gboolean random = text ? gui->text_random : gui->html_random;
-
- if (random)
+ if (gui->auto_signature)
return 1;
- else if (!sig)
- return 0;
- else
- return sig_get_index (sig);
+ return sig_get_index (gui->def_signature);
}
static void
sig_fill_options (MailAccountGui *gui)
{
- GtkWidget *menu_text, *menu_html;
+ GtkWidget *menu;
GtkWidget *mi;
GList *l;
MailConfigSignature *sig;
- menu_text = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text));
- menu_html = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html));
-
- if (menu_text)
- clear_menu (menu_text);
- else
- menu_text = gtk_menu_new ();
+ menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_menu));
- if (menu_html)
- clear_menu (menu_html);
+ if (menu)
+ clear_menu (menu);
else
- menu_html = gtk_menu_new ();
-
- gtk_menu_append (GTK_MENU (menu_text), gtk_menu_item_new_with_label (_("None")));
- gtk_menu_append (GTK_MENU (menu_html), gtk_menu_item_new_with_label (_("None")));
-
- if (mail_config_get_signatures_random ()) {
- gtk_menu_append (GTK_MENU (menu_text), gtk_menu_item_new_with_label (_("Random")));
- gtk_menu_append (GTK_MENU (menu_html), gtk_menu_item_new_with_label (_("Random")));
- }
+ menu = gtk_menu_new ();
+
+ gtk_menu_append (GTK_MENU (menu), gtk_menu_item_new_with_label (_("None")));
+ gtk_menu_append (GTK_MENU (menu), gtk_menu_item_new_with_label (_("Autogenerated")));
+ /* gtk_menu_append (GTK_MENU (menu), gtk_menu_item_new_with_label (_("Random"))); */
for (l = mail_config_get_signature_list (); l; l = l->next) {
+ gchar *utf8;
+
sig = l->data;
- mi = gtk_menu_item_new_with_label (sig->name);
- gtk_object_set_data (GTK_OBJECT (mi), "sig", sig);
- gtk_menu_append (GTK_MENU (menu_text), mi);
-
- mi = gtk_menu_item_new_with_label (sig->name);
+ utf8 = e_utf8_to_gtk_string (menu, sig->name);
+ mi = gtk_menu_item_new_with_label (utf8);
+ g_free (utf8);
gtk_object_set_data (GTK_OBJECT (mi), "sig", sig);
- gtk_menu_append (GTK_MENU (menu_html), mi);
+ gtk_widget_show (mi);
+ gtk_menu_append (GTK_MENU (menu), mi);
}
}
static void
-sig_select_text_sig (MailAccountGui *gui)
-{
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_text), sig_get_gui_index (gui, TRUE));
-}
-
-static void
-sig_select_html_sig (MailAccountGui *gui)
-{
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_html), sig_get_gui_index (gui, FALSE));
-}
-
-static void
-sig_changed_text (GtkWidget *w, MailAccountGui *gui)
+sig_changed (GtkWidget *w, MailAccountGui *gui)
{
GtkWidget *active;
int index;
@@ -1258,55 +1231,8 @@ sig_changed_text (GtkWidget *w, MailAccountGui *gui)
active = gtk_menu_get_active (GTK_MENU (w));
index = g_list_index (GTK_MENU_SHELL (w)->children, active);
- gui->text_signature = (MailConfigSignature *) gtk_object_get_data (GTK_OBJECT (active), "sig");
- gui->text_random = index == 1;
-
- gtk_widget_set_sensitive (GTK_WIDGET (gui->sig_edit_text), gui->text_signature != NULL);
-}
-
-static void
-sig_changed_html (GtkWidget *w, MailAccountGui *gui)
-{
- GtkWidget *active;
- int index;
-
- active = gtk_menu_get_active (GTK_MENU (w));
- index = g_list_index (GTK_MENU_SHELL (w)->children, active);
-
- gui->html_signature = (MailConfigSignature *) gtk_object_get_data (GTK_OBJECT (active), "sig");
- gui->html_random = index == 1;
-
- gtk_widget_set_sensitive (GTK_WIDGET (gui->sig_edit_html), gui->html_signature != NULL);
-}
-
-static void
-sig_edit_text (GtkWidget *w, MailAccountGui *gui)
-{
- MailConfigSignature *sig = gui->text_signature;
-
- if (!sig)
- return;
-
- if (sig->filename && *sig->filename)
- mail_signature_editor (sig);
- else
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
- _("Please specify signature filename\nin Andvanced section of signature settings."));
-}
-
-static void
-sig_edit_html (GtkWidget *w, MailAccountGui *gui)
-{
- MailConfigSignature *sig = gui->html_signature;
-
- if (!sig)
- return;
-
- if (sig->filename && *sig->filename)
- mail_signature_editor (sig);
- else
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
- _("Please specify signature filename\nin Andvanced section of signature settings."));
+ gui->def_signature = (MailConfigSignature *) gtk_object_get_data (GTK_OBJECT (active), "sig");
+ gui->auto_signature = index == 1 ? TRUE : FALSE;
}
static void
@@ -1318,50 +1244,25 @@ sig_switch_to_list (GtkWidget *w, MailAccountGui *gui)
}
static void
-sig_new_text (GtkWidget *w, MailAccountGui *gui)
+sig_add_new_signature (GtkWidget *w, MailAccountGui *gui)
{
if (!gui->dialog)
return;
sig_switch_to_list (w, gui);
- gui->text_signature = mail_composer_prefs_new_signature (NULL, FALSE);
- gui->text_random = FALSE;
-
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_text), sig_get_index (gui->text_signature));
+ gui->def_signature = mail_composer_prefs_new_signature (NULL, FALSE);
+ gui->auto_signature = FALSE;
- gtk_widget_set_sensitive (gui->sig_edit_text, TRUE);
-}
-
-static void
-sig_new_html (GtkWidget *w, MailAccountGui *gui)
-{
- if (!gui->dialog)
- return;
-
- sig_switch_to_list (w, gui);
-
- gui->html_signature = mail_composer_prefs_new_signature (NULL, TRUE);
- gui->html_random = FALSE;
-
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_html), sig_get_index (gui->html_signature));
-
- gtk_widget_set_sensitive (gui->sig_edit_html, TRUE);
+ gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_menu), sig_gui_get_index (gui));
}
static void
setup_signatures (MailAccountGui *gui)
{
- gui->text_signature = gui->account->id->text_signature;
- gui->text_random = gui->account->id->text_random;
- gui->html_signature = gui->account->id->html_signature;
- gui->html_random = gui->account->id->html_random;
-
- sig_select_text_sig (gui);
- sig_select_html_sig (gui);
-
- gtk_widget_set_sensitive (GTK_WIDGET (gui->sig_edit_text), gui->text_signature != NULL);
- gtk_widget_set_sensitive (GTK_WIDGET (gui->sig_edit_html), gui->html_signature != NULL);
+ gui->def_signature = gui->account->id->def_signature;
+ gui->auto_signature = gui->account->id->auto_signature;
+ gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_menu), sig_gui_get_index (gui));
}
static void
@@ -1376,15 +1277,9 @@ sig_event_client (MailConfigSigEvent event, MailConfigSignature *sig, MailAccoun
mi = gtk_menu_item_new_with_label (sig->name);
gtk_object_set_data (GTK_OBJECT (mi), "sig", sig);
gtk_widget_show (mi);
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text));
+ menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_menu));
gtk_menu_append (GTK_MENU (menu), mi);
-
- mi = gtk_menu_item_new_with_label (sig->name);
- gtk_object_set_data (GTK_OBJECT (mi), "sig", sig);
- gtk_widget_show (mi);
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html));
- gtk_menu_append (GTK_MENU (GTK_MENU (menu)), mi);
-
+
break;
}
case MAIL_CONFIG_SIG_EVENT_NAME_CHANGED: {
@@ -1392,24 +1287,15 @@ sig_event_client (MailConfigSigEvent event, MailConfigSignature *sig, MailAccoun
GtkWidget *mi;
d(printf ("gui NAME CHANGED\n"));
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text));
- gtk_widget_ref (menu);
- gtk_option_menu_remove_menu (GTK_OPTION_MENU (gui->sig_option_text));
- mi = g_list_nth_data (GTK_MENU_SHELL (menu)->children, sig_get_index (sig));
- gtk_label_set_text (GTK_LABEL (GTK_BIN (mi)->child), sig->name);
- gtk_option_menu_set_menu (GTK_OPTION_MENU (gui->sig_option_text), menu);
- gtk_widget_unref (menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_text), sig_get_gui_index (gui, TRUE));
-
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html));
+ menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_menu));
gtk_widget_ref (menu);
- gtk_option_menu_remove_menu (GTK_OPTION_MENU (gui->sig_option_html));
+ gtk_option_menu_remove_menu (GTK_OPTION_MENU (gui->sig_option_menu));
mi = g_list_nth_data (GTK_MENU_SHELL (menu)->children, sig_get_index (sig));
gtk_label_set_text (GTK_LABEL (GTK_BIN (mi)->child), sig->name);
- gtk_option_menu_set_menu (GTK_OPTION_MENU (gui->sig_option_html), menu);
+ gtk_option_menu_set_menu (GTK_OPTION_MENU (gui->sig_option_menu), menu);
gtk_widget_unref (menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_html), sig_get_gui_index (gui, FALSE));
-
+ gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_menu), sig_gui_get_index (gui));
+
break;
}
case MAIL_CONFIG_SIG_EVENT_DELETED: {
@@ -1418,74 +1304,18 @@ sig_event_client (MailConfigSigEvent event, MailConfigSignature *sig, MailAccoun
d(printf ("gui DELETED\n"));
- if (sig == gui->text_signature) {
- gui->text_signature = NULL;
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_text),
- sig_get_gui_index (gui, TRUE));
+ if (sig == gui->def_signature) {
+ gui->def_signature = NULL;
+ gui->auto_signature = TRUE;
+ gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_menu), sig_gui_get_index (gui));
}
-
- if (sig == gui->html_signature) {
- gui->html_signature = NULL;
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_html),
- sig_get_gui_index (gui, FALSE));
- }
-
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text));
- mi = g_list_nth_data (GTK_MENU_SHELL (menu)->children, sig_get_index (sig));
- gtk_container_remove (GTK_CONTAINER (menu), mi);
-
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html));
+
+ menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_menu));
mi = g_list_nth_data (GTK_MENU_SHELL (menu)->children, sig_get_index (sig));
gtk_container_remove (GTK_CONTAINER (menu), mi);
break;
}
- case MAIL_CONFIG_SIG_EVENT_RANDOM_ON: {
- GtkWidget *menu;
- GtkWidget *mi;
-
- d(printf ("gui RANDOM ON\n"));
-
- mi = gtk_menu_item_new_with_label (_("Random"));
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text));
- gtk_menu_insert (GTK_MENU (menu), mi, 1);
- gtk_widget_show (mi);
-
- mi = gtk_menu_item_new_with_label (_("Random"));
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html));
- gtk_menu_insert (GTK_MENU (menu), mi, 1);
- gtk_widget_show (mi);
-
- break;
- }
- case MAIL_CONFIG_SIG_EVENT_RANDOM_OFF: {
- GtkWidget *menu;
- GtkWidget *mi;
-
- d(printf ("gui RANDOM OFF\n"));
-
- if (gui->text_random) {
- gui->text_random = FALSE;
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_text),
- sig_get_gui_index (gui, TRUE));
- }
-
- if (gui->html_random) {
- gui->html_random = FALSE;
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_html),
- sig_get_gui_index (gui, FALSE));
- }
-
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text));
- mi = g_list_nth_data (GTK_MENU_SHELL (menu)->children, 1);
- gtk_container_remove (GTK_CONTAINER (menu), mi);
-
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html));
- mi = g_list_nth_data (GTK_MENU_SHELL (menu)->children, 1);
- gtk_container_remove (GTK_CONTAINER (menu), mi);
-
- break;
- }
default:
;
}
@@ -1494,34 +1324,17 @@ sig_event_client (MailConfigSigEvent event, MailConfigSignature *sig, MailAccoun
static void
prepare_signatures (MailAccountGui *gui)
{
- gui->sig_option_text = glade_xml_get_widget (gui->xml, "option-sig-text");
- gui->sig_option_html = glade_xml_get_widget (gui->xml, "option-sig-html");
-
+ gui->sig_option_menu = glade_xml_get_widget (gui->xml, "sigOption");
sig_fill_options (gui);
+ gtk_signal_connect (GTK_OBJECT (gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_menu))),
+ "selection-done", sig_changed, gui);
- gtk_signal_connect (GTK_OBJECT (gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text))),
- "selection-done", sig_changed_text, gui);
- gtk_signal_connect (GTK_OBJECT (gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html))),
- "selection-done", sig_changed_html, gui);
-
- gui->sig_new_text = glade_xml_get_widget (gui->xml, "button-sig-new-text");
- gtk_signal_connect (GTK_OBJECT (gui->sig_new_text), "clicked", GTK_SIGNAL_FUNC (sig_new_text), gui);
- gui->sig_new_html = glade_xml_get_widget (gui->xml, "button-sig-new-html");
- gtk_signal_connect (GTK_OBJECT (gui->sig_new_html), "clicked", GTK_SIGNAL_FUNC (sig_new_html), gui);
- gui->sig_edit_text = glade_xml_get_widget (gui->xml, "button-sig-edit-text");
- gtk_signal_connect (GTK_OBJECT (gui->sig_edit_text), "clicked", GTK_SIGNAL_FUNC (sig_edit_text), gui);
- gui->sig_edit_html = glade_xml_get_widget (gui->xml, "button-sig-edit-html");
- gtk_signal_connect (GTK_OBJECT (gui->sig_edit_html), "clicked", GTK_SIGNAL_FUNC (sig_edit_html), gui);
+ glade_xml_signal_connect_data (gui->xml, "sigAddNewClicked", GTK_SIGNAL_FUNC (sig_add_new_signature), gui);
if (!gui->dialog) {
- gtk_widget_hide (glade_xml_get_widget (gui->xml, "label-sig-text"));
- gtk_widget_hide (glade_xml_get_widget (gui->xml, "label-sig-html"));
- gtk_widget_hide (gui->sig_option_text);
- gtk_widget_hide (gui->sig_option_html);
- gtk_widget_hide (gui->sig_new_text);
- gtk_widget_hide (gui->sig_new_html);
- gtk_widget_hide (gui->sig_edit_text);
- gtk_widget_hide (gui->sig_edit_html);
+ gtk_widget_hide (glade_xml_get_widget (gui->xml, "sigLabel"));
+ gtk_widget_hide (glade_xml_get_widget (gui->xml, "sigOption"));
+ gtk_widget_hide (glade_xml_get_widget (gui->xml, "sigAddNew"));
} else {
mail_config_signature_register_client ((MailConfigSignatureClient) sig_event_client, gui);
}
@@ -1993,10 +1806,8 @@ mail_account_gui_save (MailAccountGui *gui)
account->id->organization = e_utf8_gtk_entry_get_text (gui->organization);
/* signatures */
- account->id->text_signature = gui->text_signature;
- account->id->text_random = gui->text_random;
- account->id->html_signature = gui->html_signature;
- account->id->html_random = gui->html_random;
+ account->id->def_signature = gui->def_signature;
+ account->id->auto_signature = gui->auto_signature;
old_enabled = account->source && account->source->enabled;
service_destroy (account->source);
diff --git a/mail/mail-account-gui.h b/mail/mail-account-gui.h
index d5d873f3e0..b9469f54b1 100644
--- a/mail/mail-account-gui.h
+++ b/mail/mail-account-gui.h
@@ -70,16 +70,10 @@ typedef struct {
GtkEntry *organization;
/* signatures */
- GtkWidget *sig_option_text;
- GtkWidget *sig_option_html;
- GtkWidget *sig_new_text;
- GtkWidget *sig_new_html;
- GtkWidget *sig_edit_text;
- GtkWidget *sig_edit_html;
- MailConfigSignature *text_signature;
- gboolean text_random;
- MailConfigSignature *html_signature;
- gboolean html_random;
+ GtkWidget *sig_option_menu;
+
+ MailConfigSignature *def_signature;
+ gboolean auto_signature;
/* incoming mail */
MailAccountGuiService source;
diff --git a/mail/mail-composer-prefs.c b/mail/mail-composer-prefs.c
index c90d7ca229..95bb5bf8a8 100644
--- a/mail/mail-composer-prefs.c
+++ b/mail/mail-composer-prefs.c
@@ -226,17 +226,6 @@ sig_current_sig (MailComposerPrefs *prefs)
}
static void
-sig_script_activate (GtkWidget *widget, MailComposerPrefs *prefs)
-{
- MailConfigSignature *sig = sig_current_sig (prefs);
-
- if (sig && sig->script && *sig->script) {
- run_script (sig->script);
- sig_write_and_update_preview (prefs, sig);
- }
-}
-
-static void
sig_edit (GtkWidget *widget, MailComposerPrefs *prefs)
{
MailConfigSignature *sig = sig_current_sig (prefs);
@@ -252,17 +241,17 @@ MailConfigSignature *
mail_composer_prefs_new_signature (MailComposerPrefs *prefs, gboolean html)
{
MailConfigSignature *sig;
- char *name[2];
+ char *name [1];
int row;
sig = mail_config_signature_add (html);
if (prefs) {
- name[0] = sig->name;
- name[1] = sig->random ? _("yes") : _("no");
+ name [0] = e_utf8_to_gtk_string (prefs->sig_clist, sig->name);
row = gtk_clist_append (GTK_CLIST (prefs->sig_clist), name);
gtk_clist_set_row_data (GTK_CLIST (prefs->sig_clist), row, sig);
gtk_clist_select_row (GTK_CLIST (prefs->sig_clist), row, 0);
+ g_free (name [0]);
/*gtk_widget_grab_focus (prefs->sig_name);*/
}
@@ -303,28 +292,8 @@ sig_row_select (GtkCList *clist, int row, int col, GdkEvent *event, MailComposer
printf ("sig_row_select\n");
gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_delete, TRUE);
gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_edit, TRUE);
- /*gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_name, TRUE);*/
- gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_random, TRUE);
- gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_html, TRUE);
- gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_filename, TRUE);
- gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_script, TRUE);
- gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_html, TRUE);
- prefs->sig_switch = TRUE;
sig = gtk_clist_get_row_data (prefs->sig_clist, row);
- if (sig) {
- /*if (sig->name)
- e_utf8_gtk_entry_set_text (GTK_ENTRY (prefs->sig_name), sig->name);*/
- gtk_toggle_button_set_active (prefs->sig_random, sig->random);
- gtk_toggle_button_set_active (prefs->sig_html, sig->html);
- if (sig->filename)
- gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->sig_filename)),
- sig->filename);
- if (sig->script)
- gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->sig_script)),
- sig->script);
- }
- prefs->sig_switch = FALSE;
prefs->sig_row = row;
sig_load_preview (prefs, sig);
@@ -336,116 +305,24 @@ sig_row_unselect (GtkCList *clist, int row, int col, GdkEvent *event, MailCompos
printf ("sig_row_unselect\n");
gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_delete, FALSE);
gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_edit, FALSE);
- /*gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_name, FALSE);*/
- gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_random, FALSE);
- gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_html, FALSE);
- gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_filename, FALSE);
- gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_script, FALSE);
-
- prefs->sig_switch = TRUE;
- /*gtk_entry_set_text (GTK_ENTRY (prefs->sig_name), "");*/
- gtk_toggle_button_set_active (prefs->sig_random, FALSE);
- gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->sig_filename)), "");
- gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->sig_script)), "");
- prefs->sig_switch = FALSE;
}
static void
sig_fill_clist (GtkCList *clist)
{
GList *l;
- char *name[2];
+ char *name[1];
int row;
gtk_clist_freeze (clist);
for (l = mail_config_get_signature_list (); l; l = l->next) {
name[0] = ((MailConfigSignature *) l->data)->name;
- name[1] = ((MailConfigSignature *) l->data)->random ? _("yes") : _("no");
row = gtk_clist_append (clist, name);
gtk_clist_set_row_data (clist, row, l->data);
}
gtk_clist_thaw (clist);
}
-#if 0
-static void
-sig_name_changed (GtkWidget *widget, MailComposerPrefs *prefs)
-{
- MailConfigSignature *sig = sig_current_sig (prefs);
-
- if (prefs->sig_switch)
- return;
-
- /*mail_config_signature_set_name (sig, e_utf8_gtk_entry_get_text (GTK_ENTRY (prefs->sig_name)));*/
- gtk_clist_set_text (GTK_CLIST (prefs->sig_clist), prefs->sig_row, 0, sig->name);
-
- sig_write_and_update_preview (prefs, sig);
-}
-#endif
-
-static void
-sig_random_toggled (GtkWidget *widget, MailComposerPrefs *prefs)
-{
- MailConfigSignature *sig = sig_current_sig (prefs);
-
- if (prefs->sig_switch)
- return;
-
- mail_config_signature_set_random (sig, gtk_toggle_button_get_active (prefs->sig_random));
-
- gtk_clist_set_text (prefs->sig_clist, prefs->sig_row, 1, sig->random ? _("yes") : _("no"));
-
- sig_write_and_update_preview (prefs, sig);
-}
-
-static void
-sig_advanced_toggled (GtkWidget *widget, MailComposerPrefs *prefs)
-{
- GtkWidget *advanced_frame;
-
- advanced_frame = glade_xml_get_widget (prefs->gui, "frameAdvancedOptions");
- gtk_widget_set_sensitive (advanced_frame, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
-}
-
-static void
-sig_html_toggled (GtkWidget *widget, MailComposerPrefs *prefs)
-{
- MailConfigSignature *sig = sig_current_sig (prefs);
-
- if (prefs->sig_switch)
- return;
-
- sig->html = gtk_toggle_button_get_active (prefs->sig_html);
-
- sig_write_and_update_preview (prefs, sig);
-}
-
-static void
-sig_filename_changed (GtkWidget *widget, MailComposerPrefs *prefs)
-{
- MailConfigSignature *sig = sig_current_sig (prefs);
-
- if (prefs->sig_switch)
- return;
-
- mail_config_signature_set_filename (sig, gnome_file_entry_get_full_path (prefs->sig_filename, FALSE));
- sig_write_and_update_preview (prefs, sig);
-}
-
-static void
-sig_script_changed (GtkWidget *widget, MailComposerPrefs *prefs)
-{
- MailConfigSignature *sig = sig_current_sig (prefs);
-
- if (prefs->sig_switch)
- return;
-
- g_free (sig->script);
- sig->script = g_strdup (gnome_file_entry_get_full_path (prefs->sig_script, FALSE));
-
- sig_write_and_update_preview (prefs, sig);
-}
-
static void
url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle)
{
@@ -491,11 +368,6 @@ sig_event_client (MailConfigSigEvent event, MailConfigSignature *sig, MailCompos
if (sig == sig_current_sig (prefs))
sig_load_preview (prefs, sig);
break;
- case MAIL_CONFIG_SIG_EVENT_HTML_CHANGED:
- printf ("accounts HTML CHANGED\n");
- if (sig == sig_current_sig (prefs))
- gtk_toggle_button_set_active (prefs->sig_html, sig->html);
- break;
default:
;
}
@@ -940,43 +812,13 @@ mail_composer_prefs_construct (MailComposerPrefs *prefs)
gtk_signal_connect (GTK_OBJECT (prefs->sig_delete), "clicked",
GTK_SIGNAL_FUNC (sig_delete), prefs);
- prefs->sig_random = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkRandomSignature"));
- gtk_signal_connect (GTK_OBJECT (prefs->sig_random), "toggled",
- GTK_SIGNAL_FUNC (sig_random_toggled), prefs);
- gtk_signal_connect (GTK_OBJECT (prefs->sig_random), "toggled",
- toggle_button_toggled, prefs);
-
prefs->sig_clist = GTK_CLIST (glade_xml_get_widget (gui, "clistSignatures"));
sig_fill_clist (prefs->sig_clist);
gtk_signal_connect (GTK_OBJECT (prefs->sig_clist), "select_row",
GTK_SIGNAL_FUNC (sig_row_select), prefs);
gtk_signal_connect (GTK_OBJECT (prefs->sig_clist), "unselect_row",
GTK_SIGNAL_FUNC (sig_row_unselect), prefs);
-
- prefs->sig_advanced = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkAdvancedSignature"));
- gtk_toggle_button_set_active (prefs->sig_advanced, FALSE);
- gtk_signal_connect (GTK_OBJECT (prefs->sig_advanced), "toggled",
- GTK_SIGNAL_FUNC (sig_advanced_toggled), prefs);
-
- widget = glade_xml_get_widget (gui, "frameAdvancedOptions");
- gtk_widget_set_sensitive (widget, FALSE);
-
- prefs->sig_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkHtmlSignature"));
- gtk_signal_connect (GTK_OBJECT (prefs->sig_html), "toggled",
- GTK_SIGNAL_FUNC (sig_html_toggled), prefs);
- gtk_signal_connect (GTK_OBJECT (prefs->sig_html), "toggled",
- toggle_button_toggled, prefs);
-
- prefs->sig_filename = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileSignatureFilename"));
- gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (prefs->sig_filename)),
- "changed", GTK_SIGNAL_FUNC (sig_filename_changed), prefs);
-
- prefs->sig_script = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileSignatureScript"));
- gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (prefs->sig_script)),
- "changed", GTK_SIGNAL_FUNC (sig_script_changed), prefs);
- gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (prefs->sig_script)),
- "activate", GTK_SIGNAL_FUNC (sig_script_activate), prefs);
-
+
/* preview GtkHTML widget */
widget = glade_xml_get_widget (gui, "scrolled-sig");
prefs->sig_preview = (GtkHTML *) gtk_html_new ();
diff --git a/mail/mail-composer-prefs.h b/mail/mail-composer-prefs.h
index a23cfbfbcc..885baa6f9c 100644
--- a/mail/mail-composer-prefs.h
+++ b/mail/mail-composer-prefs.h
@@ -102,11 +102,6 @@ struct _MailComposerPrefs {
GtkButton *sig_add;
GtkButton *sig_edit;
GtkButton *sig_delete;
- GtkToggleButton *sig_random;
- GtkToggleButton *sig_advanced;
- GtkToggleButton *sig_html;
- GnomeFileEntry *sig_filename;
- GnomeFileEntry *sig_script;
GtkHTML *sig_preview;
gboolean sig_switch;
int sig_row;
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 316f945d59..673c8f2bbd 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -128,7 +128,6 @@ typedef struct {
GList *signature_list;
int signatures;
- int signatures_random;
MailConfigLabel labels[5];
} MailConfig;
@@ -155,7 +154,6 @@ signature_copy (const MailConfigSignature *sig)
ns->name = g_strdup (sig->name);
ns->filename = g_strdup (sig->filename);
ns->script = g_strdup (sig->script);
- ns->random = sig->random;
ns->html = sig->html;
return ns;
@@ -183,10 +181,8 @@ identity_copy (const MailConfigIdentity *id)
new->address = g_strdup (id->address);
new->reply_to = g_strdup (id->reply_to);
new->organization = g_strdup (id->organization);
- new->text_signature = id->text_signature;
- new->text_random = id->text_random;
- new->html_signature = id->html_signature;
- new->html_random = id->html_random;
+ new->def_signature = id->def_signature;
+ new->auto_signature = id->auto_signature;
return new;
}
@@ -413,11 +409,7 @@ config_read_signature (gint i)
sig->script = val;
else
g_free (val);
-
- path = g_strdup_printf ("/Mail/Signatures/random_%d", i);
- sig->random = bonobo_config_get_boolean_with_default (config->db, path, FALSE, NULL);
- g_free (path);
-
+
path = g_strdup_printf ("/Mail/Signatures/html_%d", i);
sig->html = bonobo_config_get_boolean_with_default (config->db, path, FALSE, NULL);
g_free (path);
@@ -432,14 +424,11 @@ config_read_signatures ()
gint i;
config->signature_list = NULL;
- config->signatures_random = 0;
config->signatures = bonobo_config_get_long_with_default (config->db, "/Mail/Signatures/num", 0, NULL);
for (i = 0; i < config->signatures; i ++) {
sig = config_read_signature (i);
config->signature_list = g_list_append (config->signature_list, sig);
- if (sig->random)
- config->signatures_random ++;
}
}
@@ -462,10 +451,6 @@ config_write_signature (MailConfigSignature *sig, gint i)
bonobo_config_set_string (config->db, path, sig->script ? sig->script : "", NULL);
g_free (path);
- path = g_strdup_printf ("/Mail/Signatures/random_%d", i);
- bonobo_config_set_boolean (config->db, path, sig->random, NULL);
- g_free (path);
-
path = g_strdup_printf ("/Mail/Signatures/html_%d", i);
bonobo_config_set_boolean (config->db, path, sig->html, NULL);
g_free (path);
@@ -736,22 +721,15 @@ config_read (void)
g_free (path);
/* id signatures */
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_text_%d", i);
- id->text_signature = lookup_signature (bonobo_config_get_long_with_default (config->db, path, -1, NULL));
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_html_%d", i);
- id->html_signature = lookup_signature (bonobo_config_get_long_with_default (config->db, path, -1, NULL));
+ path = g_strdup_printf ("/Mail/Accounts/identity_def_signature_%d", i);
+ id->def_signature = lookup_signature (bonobo_config_get_long_with_default (config->db, path, -1, NULL));
g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_text_random_%d", i);
- id->text_random = bonobo_config_get_boolean_with_default (config->db, path, FALSE, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_html_random_%d", i);
- id->html_random = bonobo_config_get_boolean_with_default (config->db, path, FALSE, NULL);
+
+ /* autogenerated signature */
+ path = g_strdup_printf ("/Mail/Accounts/identity_autogenerated_signature_%d", i);
+ id->auto_signature = bonobo_config_get_boolean_with_default (config->db, path, TRUE, NULL);
g_free (path);
-
+
/* get the source */
source = g_new0 (MailConfigService, 1);
@@ -1011,22 +989,9 @@ mail_config_write_account_sig (MailConfigAccount *account, gint i)
}
/* id signatures */
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_text_%d", i);
- bonobo_config_set_long (config->db, path, account->id->text_signature
- ? account->id->text_signature->id : -1, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_html_%d", i);
- bonobo_config_set_long (config->db, path, account->id->html_signature
- ? account->id->html_signature->id : -1, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_text_random_%d", i);
- bonobo_config_set_boolean (config->db, path, account->id->text_random, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_html_random_%d", i);
- bonobo_config_set_boolean (config->db, path, account->id->html_random, NULL);
+ path = g_strdup_printf ("/Mail/Accounts/identity_def_signature_%d", i);
+ bonobo_config_set_long (config->db, path, account->id->def_signature
+ ? account->id->def_signature->id : -1, NULL);
g_free (path);
}
@@ -1142,6 +1107,10 @@ mail_config_write (void)
g_free (path);
mail_config_write_account_sig (account, i);
+
+ path = g_strdup_printf ("/Mail/Accounts/identity_autogenerated_signature_%d", i);
+ bonobo_config_set_boolean (config->db, path, account->id->auto_signature, NULL);
+ g_free (path);
/* source info */
path = g_strdup_printf ("/Mail/Accounts/source_url_%d", i);
@@ -2890,10 +2859,8 @@ mail_config_signature_delete (MailConfigSignature *sig)
account = (MailConfigAccount *) al->data;
- if (account->id->text_signature == sig)
- account->id->text_signature = NULL;
- if (account->id->html_signature == sig)
- account->id->html_signature = NULL;
+ if (account->id->def_signature == sig)
+ account->id->def_signature = NULL;
}
for (l = config->signature_list; l; l = next) {
@@ -2904,8 +2871,6 @@ mail_config_signature_delete (MailConfigSignature *sig)
config->signature_list = g_list_remove_link (config->signature_list, l);
after = TRUE;
config->signatures --;
- if (sig->random)
- config->signatures_random --;
}
}
@@ -2944,30 +2909,6 @@ mail_config_signature_set_name (MailConfigSignature *sig, const gchar *name)
mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_NAME_CHANGED, sig);
}
-void
-mail_config_signature_set_random (MailConfigSignature *sig, gboolean random)
-{
- if (random != sig->random) {
- if (random && !sig->random) {
- config->signatures_random ++;
- if (config->signatures_random == 1)
- mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_RANDOM_ON, sig);
- } else if (!random && sig->random) {
- config->signatures_random --;
- if (config->signatures_random == 0)
- mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_RANDOM_OFF, sig);
- }
- sig->random = random;
- mail_config_signature_write (sig);
- }
-}
-
-gint
-mail_config_get_signatures_random (void)
-{
- return config->signatures_random;
-}
-
static GList *clients = NULL;
void
diff --git a/mail/mail-config.glade b/mail/mail-config.glade
index e4dd881ee7..cab9d8f94c 100644
--- a/mail/mail-config.glade
+++ b/mail/mail-config.glade
@@ -511,7 +511,7 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</label>
<widget>
<class>GtkLabel</class>
- <name>label-sig-text</name>
+ <name>sigLabel</name>
<label>_Default signature:</label>
<justify>GTK_JUSTIFY_LEFT</justify>
<wrap>False</wrap>
@@ -611,12 +611,10 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</label>
</widget>
<widget>
- <class>GtkAlignment</class>
- <name>alignment27</name>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xscale>0</xscale>
- <yscale>1</yscale>
+ <class>GtkHBox</class>
+ <name>hbox169</name>
+ <homogeneous>False</homogeneous>
+ <spacing>5</spacing>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
@@ -624,24 +622,49 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</label>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
- <xexpand>True</xexpand>
+ <xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
- <yfill>False</yfill>
+ <yfill>True</yfill>
</child>
<widget>
<class>GtkOptionMenu</class>
- <name>optionmenu2</name>
+ <name>sigOption</name>
<can_focus>True</can_focus>
<items>Default
Signature #1
Signature #2
+xxxxxxxxxxxxxxxxxxxx
</items>
<initial_choice>0</initial_choice>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>sigAddNew</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>clicked</name>
+ <handler>sigAddNewClicked</handler>
+ <last_modification_time>Tue, 04 Jun 2002 19:50:56 GMT</last_modification_time>
+ </signal>
+ <label>Add new signature...</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ <pack>GTK_PACK_END</pack>
+ </child>
</widget>
</widget>
</widget>
@@ -4080,7 +4103,6 @@ Baltic (ISO-8859-4)
<widget>
<class>GtkHBox</class>
<name>hbox161</name>
- <border_width>3</border_width>
<homogeneous>False</homogeneous>
<spacing>3</spacing>
<child>
@@ -4116,7 +4138,7 @@ Baltic (ISO-8859-4)
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>label448</name>
- <label>Description</label>
+ <label>Name</label>
<justify>GTK_JUSTIFY_LEFT</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
@@ -4140,6 +4162,23 @@ Baltic (ISO-8859-4)
</child>
<widget>
+ <class>GtkLabel</class>
+ <name>label455</name>
+ <label></label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
<class>GtkVButtonBox</class>
<name>vbuttonbox25</name>
<layout_style>GTK_BUTTONBOX_START</layout_style>
@@ -4159,43 +4198,34 @@ Baltic (ISO-8859-4)
<name>cmdSignatureAdd</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
- <label>_Create Signature</label>
+ <label>_Add...</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
<widget>
<class>GtkButton</class>
- <name>cmdSignatureEdit</name>
+ <name>cmdSignatureAddScript</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
- <label>_Edit</label>
+ <label>Add Sc_ript...</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
<widget>
<class>GtkButton</class>
- <name>cmdSignatureDelete</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>_Duplicate</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button1</name>
+ <name>cmdSignatureEdit</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
- <label>_Remove</label>
+ <label>_Edit...</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
<widget>
<class>GtkButton</class>
- <name>button2</name>
+ <name>cmdSignatureDelete</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
- <label>_Add Script...</label>
+ <label>_Delete</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
</widget>
@@ -4204,61 +4234,13 @@ Baltic (ISO-8859-4)
<widget>
<class>GtkHBox</class>
- <name>hbox165</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label449</name>
- <label>De_fault signature:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>3</xpad>
- <ypad>0</ypad>
- <default_focus_target>optionmenu1</default_focus_target>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkOptionMenu</class>
- <name>optionmenu1</name>
- <can_focus>True</can_focus>
- <items>Random
-
-Signature #1
-Signature #2
-</items>
- <initial_choice>0</initial_choice>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkHBox</class>
<name>hbox162</name>
- <border_width>3</border_width>
<homogeneous>False</homogeneous>
<spacing>3</spacing>
<child>
<padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
+ <expand>False</expand>
+ <fill>False</fill>
</child>
<widget>
@@ -4892,4 +4874,264 @@ Signature #2
</widget>
</widget>
+<widget>
+ <class>GnomeDialog</class>
+ <name>add_script_signature</name>
+ <visible>False</visible>
+ <type>GTK_WINDOW_TOPLEVEL</type>
+ <position>GTK_WIN_POS_NONE</position>
+ <modal>False</modal>
+ <allow_shrink>False</allow_shrink>
+ <allow_grow>False</allow_grow>
+ <auto_shrink>False</auto_shrink>
+ <auto_close>False</auto_close>
+ <hide_on_close>False</hide_on_close>
+
+ <widget>
+ <class>GtkVBox</class>
+ <child_name>GnomeDialog:vbox</child_name>
+ <name>dialog-vbox1</name>
+ <homogeneous>False</homogeneous>
+ <spacing>8</spacing>
+ <child>
+ <padding>4</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkHButtonBox</class>
+ <child_name>GnomeDialog:action_area</child_name>
+ <name>dialog-action_area1</name>
+ <layout_style>GTK_BUTTONBOX_END</layout_style>
+ <spacing>8</spacing>
+ <child_min_width>85</child_min_width>
+ <child_min_height>27</child_min_height>
+ <child_ipad_x>7</child_ipad_x>
+ <child_ipad_y>0</child_ipad_y>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ <pack>GTK_PACK_END</pack>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button4</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <label>Add signature</label>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button5</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox160</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkFrame</class>
+ <name>frame5</name>
+ <border_width>3</border_width>
+ <label>Signature information</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox161</name>
+ <border_width>3</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>3</spacing>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox171</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+
+ <widget>
+ <class>GnomePixmap</class>
+ <name>pixmap1</name>
+ <filename>info.png</filename>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label456</name>
+ <label>Type the name to which you would like to refer to this signature into Name entry.
+Enter the filename of the script which you want to use to generate your signature into Script entry. Standard output of this script will be used.</label>
+ <justify>GTK_JUSTIFY_LEFT</justify>
+ <wrap>True</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkTable</class>
+ <name>table9</name>
+ <rows>2</rows>
+ <columns>2</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>3</row_spacing>
+ <column_spacing>3</column_spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label459</name>
+ <label>Name:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label460</name>
+ <label>Script:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>entry1</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GnomeFileEntry</class>
+ <name>fileentry1</name>
+ <max_saved>10</max_saved>
+ <directory>False</directory>
+ <modal>False</modal>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+
+ <widget>
+ <class>GtkEntry</class>
+ <child_name>GnomeEntry:entry</child_name>
+ <name>combo-entry2</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+</widget>
+
</GTK-Interface>
diff --git a/mail/mail-config.h b/mail/mail-config.h
index bfcd442344..92f2073a32 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -36,7 +36,6 @@ typedef struct {
char *name;
char *filename;
char *script;
- gboolean random;
gboolean html;
} MailConfigSignature;
@@ -46,10 +45,8 @@ typedef struct {
char *reply_to;
char *organization;
- MailConfigSignature *text_signature;
- gboolean text_random;
- MailConfigSignature *html_signature;
- gboolean html_random;
+ MailConfigSignature *def_signature;
+ gboolean auto_signature;
} MailConfigIdentity;
typedef struct {
@@ -287,21 +284,17 @@ gboolean mail_config_check_service (const char *url, CamelProviderType type, GLi
gboolean evolution_mail_config_factory_init (void);
GList * mail_config_get_signature_list (void);
-gint mail_config_get_signatures_random (void);
MailConfigSignature *mail_config_signature_add (gboolean html);
void mail_config_signature_delete (MailConfigSignature *sig);
void mail_config_signature_write (MailConfigSignature *sig);
void mail_config_signature_set_name (MailConfigSignature *sig, const gchar *name);
void mail_config_signature_set_html (MailConfigSignature *sig, gboolean html);
void mail_config_signature_set_filename (MailConfigSignature *sig, const gchar *filename);
-void mail_config_signature_set_random (MailConfigSignature *sig, gboolean random);
typedef enum {
MAIL_CONFIG_SIG_EVENT_NAME_CHANGED,
MAIL_CONFIG_SIG_EVENT_CONTENT_CHANGED,
MAIL_CONFIG_SIG_EVENT_HTML_CHANGED,
- MAIL_CONFIG_SIG_EVENT_RANDOM_ON,
- MAIL_CONFIG_SIG_EVENT_RANDOM_OFF,
MAIL_CONFIG_SIG_EVENT_ADDED,
MAIL_CONFIG_SIG_EVENT_DELETED
} MailConfigSigEvent;