Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / servers / exchange / storage / exchange-hierarchy-gal.c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2
3 /* Copyright (C) 2002-2004 Novell, Inc.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of version 2 of the GNU Lesser General Public
7  * License as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 /* ExchangeHierarchyGAL: class for the Global Address List hierarchy
21  * of an Exchange storage. (Currently the "hierarchy" only contains
22  * a single folder, but see bugzilla #21029.)
23  */
24
25 #ifdef HAVE_CONFIG_H
26 #include <config.h>
27 #endif
28
29 #include "exchange-hierarchy-gal.h"
30 #include "exchange-account.h"
31 #include "e-folder-exchange.h"
32 #include "exchange-esource.h"
33
34 #include <libedataserver/e-source-list.h>
35
36 #define PARENT_TYPE EXCHANGE_TYPE_HIERARCHY
37
38 E2K_MAKE_TYPE (exchange_hierarchy_gal, ExchangeHierarchyGAL, NULL, NULL, PARENT_TYPE)
39
40
41 ExchangeHierarchy *
42 exchange_hierarchy_gal_new (ExchangeAccount *account,
43                             const char *hierarchy_name,
44                             const char *physical_uri_prefix)
45 {
46         ExchangeHierarchy *hier;
47         EFolder *toplevel;
48
49         g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (account), NULL);
50         g_return_val_if_fail (hierarchy_name != NULL, NULL);
51         g_return_val_if_fail (physical_uri_prefix != NULL, NULL);
52
53         hier = g_object_new (EXCHANGE_TYPE_HIERARCHY_GAL, NULL);
54
55         toplevel = e_folder_exchange_new (hier, hierarchy_name,
56                                           "contacts/ldap", NULL,
57                                           physical_uri_prefix,
58                                           physical_uri_prefix);
59         exchange_hierarchy_construct (hier, account,
60                                       EXCHANGE_HIERARCHY_GAL, toplevel,
61                                       NULL, NULL, NULL);
62         /* Add ESource */
63         add_folder_esource (hier->account, EXCHANGE_CONTACTS_FOLDER, 
64                             hierarchy_name, physical_uri_prefix);
65         
66         g_object_unref (toplevel);
67
68         return hier;
69 }