Add new ESource classes.
[platform/upstream/evolution-data-server.git] / libedataserver / e-source.h
1 /*
2  * e-source.h
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) version 3.
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  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with the program; if not, see <http://www.gnu.org/licenses/>
16  *
17  */
18
19 #ifndef E_SOURCE_H
20 #define E_SOURCE_H
21
22 #include <gio/gio.h>
23
24 /* Standard GObject macros */
25 #define E_TYPE_SOURCE \
26         (e_source_get_type ())
27 #define E_SOURCE(obj) \
28         (G_TYPE_CHECK_INSTANCE_CAST \
29         ((obj), E_TYPE_SOURCE, ESource))
30 #define E_SOURCE_CLASS(cls) \
31         (G_TYPE_CHECK_CLASS_CAST \
32         ((cls), E_TYPE_SOURCE, ESourceClass))
33 #define E_IS_SOURCE(obj) \
34         (G_TYPE_CHECK_INSTANCE_TYPE \
35         ((obj), E_TYPE_SOURCE))
36 #define E_IS_SOURCE_CLASS(cls) \
37         (G_TYPE_CHECK_CLASS_TYPE \
38         ((cls), E_TYPE_SOURCE))
39 #define E_SOURCE_GET_CLASS(obj) \
40         (G_TYPE_INSTANCE_GET_CLASS \
41         ((obj), E_TYPE_SOURCE, ESourceClass))
42
43 /**
44  * E_SOURCE_PARAM_SETTING:
45  *
46  * Extends #GParamFlags to indicate the #GObject property is associated
47  * with a key file value.  Use this flag when installing #GObject properties
48  * in #ESourceExtension subclasses.
49  *
50  * Since: 3.6
51  **/
52 #define E_SOURCE_PARAM_SETTING (1 << G_PARAM_USER_SHIFT)
53
54 G_BEGIN_DECLS
55
56 typedef struct _ESource ESource;
57 typedef struct _ESourceClass ESourceClass;
58 typedef struct _ESourcePrivate ESourcePrivate;
59
60 /**
61  * ESource:
62  *
63  * Contains only private data that should be read and manipulated using the
64  * functions below.
65  *
66  * Since: 3.6
67  **/
68 struct _ESource {
69         GObject parent;
70         ESourcePrivate *priv;
71 };
72
73 struct _ESourceClass {
74         GObjectClass parent_class;
75
76         /* Signals */
77         void            (*changed)              (ESource *source);
78
79         /* Methods */
80         gboolean        (*remove_sync)          (ESource *source,
81                                                  GCancellable *cancellable,
82                                                  GError **error);
83         void            (*remove)               (ESource *source,
84                                                  GCancellable *cancellable,
85                                                  GAsyncReadyCallback callback,
86                                                  gpointer user_data);
87         gboolean        (*remove_finish)        (ESource *source,
88                                                  GAsyncResult *result,
89                                                  GError **error);
90         gboolean        (*write_sync)           (ESource *source,
91                                                  GCancellable *cancellable,
92                                                  GError **error);
93         void            (*write)                (ESource *source,
94                                                  GCancellable *cancellable,
95                                                  GAsyncReadyCallback callback,
96                                                  gpointer user_data);
97         gboolean        (*write_finish)         (ESource *source,
98                                                  GAsyncResult *result,
99                                                  GError **error);
100
101         /* Reserved slots. */
102         gpointer reserved[16];
103 };
104
105 GType           e_source_get_type               (void) G_GNUC_CONST;
106 ESource *       e_source_new                    (GDBusObject *dbus_object,
107                                                  GMainContext *main_context,
108                                                  GError **error);
109 guint           e_source_hash                   (ESource *source);
110 gboolean        e_source_equal                  (ESource *source1,
111                                                  ESource *source2);
112 void            e_source_changed                (ESource *source);
113 const gchar *   e_source_get_uid                (ESource *source);
114 gchar *         e_source_dup_uid                (ESource *source);
115 const gchar *   e_source_get_parent             (ESource *source);
116 gchar *         e_source_dup_parent             (ESource *source);
117 void            e_source_set_parent             (ESource *source,
118                                                  const gchar *parent);
119 gboolean        e_source_get_enabled            (ESource *source);
120 void            e_source_set_enabled            (ESource *source,
121                                                  gboolean enabled);
122 gboolean        e_source_get_writable           (ESource *source);
123 gboolean        e_source_get_removable          (ESource *source);
124 gpointer        e_source_get_extension          (ESource *source,
125                                                  const gchar *extension_name);
126 gboolean        e_source_has_extension          (ESource *source,
127                                                  const gchar *extension_name);
128 GDBusObject *   e_source_ref_dbus_object        (ESource *source);
129 GMainContext *  e_source_ref_main_context       (ESource *source);
130 const gchar *   e_source_get_display_name       (ESource *source);
131 gchar *         e_source_dup_display_name       (ESource *source);
132 void            e_source_set_display_name       (ESource *source,
133                                                  const gchar *display_name);
134 gint            e_source_compare_by_display_name
135                                                 (ESource *source1,
136                                                  ESource *source2);
137 gchar *         e_source_to_string              (ESource *source,
138                                                  gsize *length);
139 gchar *         e_source_parameter_to_key       (const gchar *param_name);
140 gboolean        e_source_remove_sync            (ESource *source,
141                                                  GCancellable *cancellable,
142                                                  GError **error);
143 void            e_source_remove                 (ESource *source,
144                                                  GCancellable *cancellable,
145                                                  GAsyncReadyCallback callback,
146                                                  gpointer user_data);
147 gboolean        e_source_remove_finish          (ESource *source,
148                                                  GAsyncResult *result,
149                                                  GError **error);
150 gboolean        e_source_write_sync             (ESource *source,
151                                                  GCancellable *cancellable,
152                                                  GError **error);
153 void            e_source_write                  (ESource *source,
154                                                  GCancellable *cancellable,
155                                                  GAsyncReadyCallback callback,
156                                                  gpointer user_data);
157 gboolean        e_source_write_finish           (ESource *source,
158                                                  GAsyncResult *result,
159                                                  GError **error);
160
161 G_END_DECLS
162
163 #endif /* E_SOURCE_H */