aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-config.c
diff options
context:
space:
mode:
authorRadek Doulik <rodo@src.gnome.org>2002-06-05 23:43:50 +0800
committerRadek Doulik <rodo@src.gnome.org>2002-06-05 23:43:50 +0800
commitee96e3762905713b1785d24f6de278608060d6c3 (patch)
tree3a789f264c3bf3d039d2f6733e1693b2bf2a137b /mail/mail-config.c
parent4ea52e5e61cbd750f37b07f4aad0c92ede66556c (diff)
downloadgsoc2013-evolution-ee96e3762905713b1785d24f6de278608060d6c3.tar.gz
gsoc2013-evolution-ee96e3762905713b1785d24f6de278608060d6c3.tar.zst
gsoc2013-evolution-ee96e3762905713b1785d24f6de278608060d6c3.zip
signature editor reworked, WIP
svn path=/trunk/; revision=17117
Diffstat (limited to 'mail/mail-config.c')
-rw-r--r--mail/mail-config.c97
1 files changed, 19 insertions, 78 deletions
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