Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / libedataserver / e-source-group.h
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /* e-source-group.h
3  *
4  * Copyright (C) 2003  Ximian, Inc.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of version 2 of the GNU Lesser General Public
8  * License as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  *
20  * Author: Ettore Perazzoli <ettore@ximian.com>
21  */
22
23 #ifndef _E_SOURCE_GROUP_H_
24 #define _E_SOURCE_GROUP_H_
25
26 #include <glib-object.h>
27 #include <libxml/tree.h>
28
29 G_BEGIN_DECLS
30
31 #define E_TYPE_SOURCE_GROUP                     (e_source_group_get_type ())
32 #define E_SOURCE_GROUP(obj)                     (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SOURCE_GROUP, ESourceGroup))
33 #define E_SOURCE_GROUP_CLASS(klass)             (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SOURCE_GROUP, ESourceGroupClass))
34 #define E_IS_SOURCE_GROUP(obj)                  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SOURCE_GROUP))
35 #define E_IS_SOURCE_GROUP_CLASS(klass)          (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_SOURCE_GROUP))
36
37
38 typedef struct _ESourceGroup        ESourceGroup;
39 typedef struct _ESourceGroupPrivate ESourceGroupPrivate;
40 typedef struct _ESourceGroupClass   ESourceGroupClass;
41
42 #include "e-source.h"
43
44 struct _ESourceGroup {
45         GObject parent;
46
47         ESourceGroupPrivate *priv;
48 };
49
50 struct _ESourceGroupClass {
51         GObjectClass parent_class;
52
53         /* Signals.  */
54
55         void (* changed) (ESourceGroup *group);
56
57         void (* source_removed) (ESourceGroup *source_list, ESource *source);
58         void (* source_added)   (ESourceGroup *source_list, ESource *source);
59 };
60
61
62 GType    e_source_group_get_type (void);
63
64 ESourceGroup *e_source_group_new              (const char *name,
65                                                const char *base_uri);
66 ESourceGroup *e_source_group_new_from_xml     (const char *xml);
67 ESourceGroup *e_source_group_new_from_xmldoc  (xmlDocPtr   doc);
68
69 gboolean  e_source_group_update_from_xml     (ESourceGroup *group,
70                                               const char   *xml,
71                                               gboolean     *changed_return);
72 gboolean  e_source_group_update_from_xmldoc  (ESourceGroup *group,
73                                               xmlDocPtr     doc,
74                                               gboolean     *changed_return);
75
76 char *e_source_group_uid_from_xmldoc  (xmlDocPtr doc);
77
78 void  e_source_group_set_name      (ESourceGroup *group,
79                                     const char   *name);
80 void  e_source_group_set_base_uri  (ESourceGroup *group,
81                                     const char   *base_uri);
82
83 void e_source_group_set_readonly (ESourceGroup *group,
84                                   gboolean      readonly);
85
86 const char *e_source_group_peek_uid       (ESourceGroup *group);
87 const char *e_source_group_peek_name      (ESourceGroup *group);
88 const char *e_source_group_peek_base_uri  (ESourceGroup *group);
89 gboolean    e_source_group_get_readonly   (ESourceGroup *group);
90
91 GSList  *e_source_group_peek_sources        (ESourceGroup *group);
92 ESource *e_source_group_peek_source_by_uid  (ESourceGroup *group,
93                                              const char   *source_uid);
94 ESource *e_source_group_peek_source_by_name (ESourceGroup *group,
95                                              const char   *source_name);
96
97 gboolean  e_source_group_add_source            (ESourceGroup *group,
98                                                 ESource      *source,
99                                                 int           position);
100 gboolean  e_source_group_remove_source         (ESourceGroup *group,
101                                                 ESource      *source);
102 gboolean  e_source_group_remove_source_by_uid  (ESourceGroup *group,
103                                                 const char   *uid);
104
105 gchar *e_source_group_get_property     (ESourceGroup *source,
106                                               const gchar *property);
107 void         e_source_group_set_property     (ESourceGroup *source,
108                                               const gchar *property,
109                                               const gchar *value);
110 void         e_source_group_foreach_property (ESourceGroup *source,
111                                               GHFunc func,
112                                               gpointer data);
113
114 char *e_source_group_to_xml (ESourceGroup *group);
115
116 G_END_DECLS
117
118 #endif /* _E_SOURCE_GROUP_H_ */