1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* Evolution calendar - generic backend class
4 * Copyright (C) 2000 Ximian, Inc.
5 * Copyright (C) 2001 Ximian, Inc.
7 * Authors: Rodrigo Moya <rodrigo@ximian.com>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of version 2 of the GNU Lesser General Public
11 * License as published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #include "e-cal-backend-util.h"
25 #include "libedataserver/e-account-list.h"
27 static EAccountList *accounts;
30 * e_cal_backend_mail_account_get_default:
31 * @address: Placeholder for default address.
32 * @name: Placeholder for name.
34 * Retrieve the default mail account as stored in Evolution configuration.
36 * Return value: TRUE if there is a default account, FALSE otherwise.
39 e_cal_backend_mail_account_get_default (char **address, char **name)
41 const EAccount *account;
43 /* FIXME I think this leaks the gconf client */
45 accounts = e_account_list_new(gconf_client_get_default());
47 account = e_account_list_get_default(accounts);
49 *address = g_strdup(account->id->address);
50 *name = g_strdup(account->id->name);
53 return account != NULL;
57 * e_cal_backend_mail_account_is_valid:
58 * @user: User name for the account to check.
59 * @name: Placeholder for the account name.
61 * Checks that a mail account is valid, and returns its name.
63 * Return value: TRUE if the account is valid, FALSE if not.
66 e_cal_backend_mail_account_is_valid (char *user, char **name)
68 const EAccount *account;
70 /* FIXME I think this leaks the gconf client */
72 accounts = e_account_list_new(gconf_client_get_default());
74 account = e_account_list_find(accounts, E_ACCOUNT_FIND_ID_ADDRESS, user);
76 *name = g_strdup(account->id->name);
78 return account != NULL;