diff options
author | Michael Zucci <zucchi@src.gnome.org> | 2003-02-24 10:59:24 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2003-02-24 10:59:24 +0800 |
commit | ee568bb74f887c3322f0729dedb81a1abdd6c025 (patch) | |
tree | aba309254a92c141b1c66070313b197e7cacc338 /calendar/pcs | |
parent | ff5e6a90aae6652a188903d589395775d79b11b4 (diff) | |
download | gsoc2013-evolution-ee568bb74f887c3322f0729dedb81a1abdd6c025.tar gsoc2013-evolution-ee568bb74f887c3322f0729dedb81a1abdd6c025.tar.gz gsoc2013-evolution-ee568bb74f887c3322f0729dedb81a1abdd6c025.tar.bz2 gsoc2013-evolution-ee568bb74f887c3322f0729dedb81a1abdd6c025.tar.lz gsoc2013-evolution-ee568bb74f887c3322f0729dedb81a1abdd6c025.tar.xz gsoc2013-evolution-ee568bb74f887c3322f0729dedb81a1abdd6c025.tar.zst gsoc2013-evolution-ee568bb74f887c3322f0729dedb81a1abdd6c025.zip |
gconf settings upgrades
svn path=/trunk/; revision=20018
Diffstat (limited to 'calendar/pcs')
-rw-r--r-- | calendar/pcs/cal-backend-util.c | 74 | ||||
-rw-r--r-- | calendar/pcs/cal-backend-util.h | 2 |
2 files changed, 24 insertions, 52 deletions
diff --git a/calendar/pcs/cal-backend-util.c b/calendar/pcs/cal-backend-util.c index a5b6d1adc8..ad39bfcc38 100644 --- a/calendar/pcs/cal-backend-util.c +++ b/calendar/pcs/cal-backend-util.c @@ -22,6 +22,9 @@ #include <string.h> #include "cal-backend-util.h" +#include <e-util/e-account-list.h> + +static EAccountList *accounts; void cal_backend_util_fill_alarm_instances_seq (GNOME_Evolution_Calendar_CalAlarmInstanceSeq *seq, @@ -53,65 +56,36 @@ cal_backend_util_fill_alarm_instances_seq (GNOME_Evolution_Calendar_CalAlarmInst } } -void -cal_backend_mail_account_get (EConfigListener *db, - gint def, - char **address, - char **name) -{ - gchar *path; - - *address = NULL; - *name = NULL; - - /* get the identity info */ - path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_name_%d", def); - *name = e_config_listener_get_string_with_default (db, path, NULL, NULL); - g_free (path); - - path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_address_%d", def); - *address = e_config_listener_get_string_with_default (db, path, NULL, NULL); - g_free (path); -} - gboolean cal_backend_mail_account_get_default (EConfigListener *db, char **address, char **name) { - glong def, len; - - *address = NULL; - *name = NULL; - - len = e_config_listener_get_long_with_default (db, "/apps/Evolution/Mail/Accounts/num", 0, NULL); - def = e_config_listener_get_long_with_default (db, "/apps/Evolution/Mail/Accounts/default_account", 0, NULL); - - if (def < len) - cal_backend_mail_account_get (db, def, address, name); - else - return FALSE; - - return TRUE; + const EAccount *account; + + if (accounts == NULL) + accounts = e_account_list_new(gconf_client_get_default()); + + account = e_account_list_get_default(accounts); + if (account) { + *address = g_strdup(account->id->address); + *name = g_strdup(account->id->name); + } + + return account != NULL; } gboolean cal_backend_mail_account_is_valid (EConfigListener *db, char *user, char **name) { - gchar *address; - glong len, i; - - len = e_config_listener_get_long_with_default (db, "/apps/Evolution/Mail/Accounts/num", 0, NULL); - - for (i = 0; i < len; i++) { - cal_backend_mail_account_get (db, i, &address, name); - if (address != NULL && !strcmp (address, user)) { - g_free (address); - return TRUE; - } - g_free (address); - g_free (*name); - } + const EAccount *account; + + if (accounts == NULL) + accounts = e_account_list_new(gconf_client_get_default()); + + account = e_account_list_find(accounts, E_ACCOUNT_FIND_ID_ADDRESS, user); + if (account) + *name = g_strdup(account->id->name); - return FALSE; + return account != NULL; } diff --git a/calendar/pcs/cal-backend-util.h b/calendar/pcs/cal-backend-util.h index 20c07f0799..6ce9d59807 100644 --- a/calendar/pcs/cal-backend-util.h +++ b/calendar/pcs/cal-backend-util.h @@ -39,8 +39,6 @@ void cal_backend_util_fill_alarm_instances_seq ( * Functions for accessing mail configuration */ -void cal_backend_mail_account_get (EConfigListener *db, gint def, - char **address, char **name); gboolean cal_backend_mail_account_get_default (EConfigListener *db, char **address, char **name); gboolean cal_backend_mail_account_is_valid (EConfigListener *db, |