aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2003-02-24 11:10:37 +0800
committerMichael Zucci <zucchi@src.gnome.org>2003-02-24 11:10:37 +0800
commit39d5d1df1903dd76f62dc86d6825045832e6b12f (patch)
tree2843c9decd8fd1c4b37769bed5c0e5a925ca1d27
parentba64403a4fef604cc3aaea6bff35b8275f30cfb1 (diff)
downloadgsoc2013-evolution-39d5d1df1903dd76f62dc86d6825045832e6b12f.tar
gsoc2013-evolution-39d5d1df1903dd76f62dc86d6825045832e6b12f.tar.gz
gsoc2013-evolution-39d5d1df1903dd76f62dc86d6825045832e6b12f.tar.bz2
gsoc2013-evolution-39d5d1df1903dd76f62dc86d6825045832e6b12f.tar.lz
gsoc2013-evolution-39d5d1df1903dd76f62dc86d6825045832e6b12f.tar.xz
gsoc2013-evolution-39d5d1df1903dd76f62dc86d6825045832e6b12f.tar.zst
gsoc2013-evolution-39d5d1df1903dd76f62dc86d6825045832e6b12f.zip
fix the g_snprintf stuff.
2003-02-20 Not Zed <NotZed@Ximian.com> * mail-preferences.c (mail_preferences_apply): fix the g_snprintf stuff. * mail-config.c (mail_config_add_account): Use new e_account_list_add. (mail_config_remove_account): Use new e_account_list_remove. (mail_config_set_default_account): Similarly for e_account_list_set_default. (mail_config_get_default_account): Same for e_account_list_get_default. (mail_config_get_account_by_name): Use e_account_list_find. * mail-account-gui.c (mail_account_gui_save): use new e_account_list_changed call instead of manual signalling. svn path=/trunk/; revision=20020
-rw-r--r--mail/ChangeLog17
-rw-r--r--mail/mail-account-gui.c6
-rw-r--r--mail/mail-config.c79
-rw-r--r--mail/mail-preferences.c4
4 files changed, 29 insertions, 77 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index eb08433c49..c5174cfe40 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,20 @@
+2003-02-20 Not Zed <NotZed@Ximian.com>
+
+ * mail-preferences.c (mail_preferences_apply): fix the g_snprintf
+ stuff.
+
+ * mail-config.c (mail_config_add_account): Use new
+ e_account_list_add.
+ (mail_config_remove_account): Use new e_account_list_remove.
+ (mail_config_set_default_account): Similarly for
+ e_account_list_set_default.
+ (mail_config_get_default_account): Same for
+ e_account_list_get_default.
+ (mail_config_get_account_by_name): Use e_account_list_find.
+
+ * mail-account-gui.c (mail_account_gui_save): use new
+ e_account_list_changed call instead of manual signalling.
+
2003-02-23 Jeffrey Stedfast <fejj@ximian.com>
* mail-local.c: Set the local provider description field to a
diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c
index a2896f6017..bb458adebf 100644
--- a/mail/mail-account-gui.c
+++ b/mail/mail-account-gui.c
@@ -33,6 +33,8 @@
#include <gconf/gconf.h>
#include <gconf/gconf-client.h>
+#include <e-util/e-account-list.h>
+
#include <gal/widgets/e-gui-utils.h>
#include "evolution-folder-selector-button.h"
@@ -1840,7 +1842,6 @@ add_new_store (char *uri, CamelStore *store, void *user_data)
gboolean
mail_account_gui_save (MailAccountGui *gui)
{
- EAccountList *accounts;
EAccount *account, *new;
CamelProvider *provider = NULL;
CamelURL *source_url = NULL, *url;
@@ -1974,8 +1975,7 @@ mail_account_gui_save (MailAccountGui *gui)
if (is_new) {
mail_config_add_account (account);
} else {
- accounts = mail_config_get_accounts ();
- g_signal_emit_by_name (accounts, "account-changed", account);
+ e_account_list_changed(mail_config_get_accounts (), account);
}
/* if the account provider is something we can stick
diff --git a/mail/mail-config.c b/mail/mail-config.c
index acb044449c..4e3f634aaf 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -593,68 +593,20 @@ mail_config_find_account (EAccount *account)
EAccount *
mail_config_get_default_account (void)
{
- EAccount *account = NULL;
- EIterator *iter;
- char *uid;
-
if (config == NULL)
mail_config_init ();
if (!config->accounts)
return NULL;
-
- uid = gconf_client_get_string (config->gconf, "/apps/evolution/mail/default_account", NULL);
-
- iter = e_list_get_iterator ((EList *) config->accounts);
- if (uid != NULL) {
- while (e_iterator_is_valid (iter)) {
- account = (EAccount *) e_iterator_get (iter);
-
- if (!strcmp (account->uid, uid)) {
- g_object_unref (iter);
- g_free (uid);
-
- return account;
- }
-
- e_iterator_next (iter);
- }
-
- g_free (uid);
- }
-
- /* Looks like we have no default, so make the first account
- the default */
- e_iterator_reset (iter);
- account = (EAccount *) e_iterator_get (iter);
- if (account)
- gconf_client_set_string (config->gconf, "/apps/evolution/mail/default_account",
- account->uid, NULL);
- g_object_unref (iter);
-
- return account;
+
+ /* should probably return const */
+ return (EAccount *)e_account_list_get_default(config->accounts);
}
EAccount *
mail_config_get_account_by_name (const char *account_name)
{
- EAccount *account;
- EIterator *iter;
-
- iter = e_list_get_iterator ((EList *) config->accounts);
- while (e_iterator_is_valid (iter)) {
- account = (EAccount *) e_iterator_get (iter);
- if (!strcmp (account->name, account_name)) {
- g_object_unref (iter);
- return account;
- }
-
- e_iterator_next (iter);
- }
-
- g_object_unref (iter);
-
- return NULL;
+ return (EAccount *)e_account_list_find(config->accounts, E_ACCOUNT_FIND_NAME, account_name);
}
EAccount *
@@ -764,38 +716,21 @@ mail_config_get_accounts (void)
void
mail_config_add_account (EAccount *account)
{
- e_list_append ((EList *) config->accounts, account);
- g_signal_emit_by_name (config->accounts, "account-added", account);
-
+ e_account_list_add(config->accounts, account);
mail_config_save_accounts ();
}
void
mail_config_remove_account (EAccount *account)
{
- char *uid;
-
- uid = gconf_client_get_string (config->gconf, "/apps/evolution/mail/default_account", NULL);
-
- if (account == mail_config_get_default_account ()) {
- /* the default account has been deleted, the new
- default becomes the first account in the list */
- gconf_client_set_string (config->gconf, "/apps/evolution/mail/default_account", account->uid, NULL);
- }
-
- g_free (uid);
- g_object_ref (account);
- e_list_remove ((EList *) config->accounts, account);
- g_signal_emit_by_name (config->accounts, "account-removed", account);
- g_object_unref (account);
-
+ e_account_list_remove(config->accounts, account);
mail_config_save_accounts ();
}
void
mail_config_set_default_account (EAccount *account)
{
- gconf_client_set_string (config->gconf, "/apps/evolution/mail/default_account", account->uid, NULL);
+ e_account_list_set_default(config->accounts, account);
}
EAccountIdentity *
diff --git a/mail/mail-preferences.c b/mail/mail-preferences.c
index be582a8a70..fe66fc1f19 100644
--- a/mail/mail-preferences.c
+++ b/mail/mail-preferences.c
@@ -381,7 +381,7 @@ mail_preferences_apply (MailPreferences *prefs)
gtk_toggle_button_get_active (prefs->citation_highlight), NULL);
rgb = colorpicker_get_color (prefs->citation_color);
- g_snprintf (buf, sizeof (buf), "#%0.6x", rgb);
+ sprintf (buf,"#%06x", rgb & 0xffffff);
gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/display/citation_colour", buf, NULL);
/* Deleting Mail */
@@ -428,7 +428,7 @@ mail_preferences_apply (MailPreferences *prefs)
for (i = 4; i >= 0; i--) {
cstring = gtk_entry_get_text (prefs->labels[i].name);
rgb = colorpicker_get_color (prefs->labels[i].color);
- string = g_strdup_printf ("%s:#%0.6x", cstring, rgb);
+ string = g_strdup_printf ("%s:#%06x", cstring, rgb & 0xffffff);
list = g_slist_prepend (list, string);
}