1 /*
2  * camel-subscribable.h
3  *
4  * This library is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11  * for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library. If not, see <http://www.gnu.org/licenses/>.
15  *
16  */
17 
18 #if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
19 #error "Only <camel/camel.h> can be included directly."
20 #endif
21 
22 #ifndef CAMEL_SUBSCRIBABLE_H
23 #define CAMEL_SUBSCRIBABLE_H
24 
25 #include <camel/camel-store.h>
26 
27 /* Standard GObject macros */
28 #define CAMEL_TYPE_SUBSCRIBABLE \
29 	(camel_subscribable_get_type ())
30 #define CAMEL_SUBSCRIBABLE(obj) \
31 	(G_TYPE_CHECK_INSTANCE_CAST \
32 	((obj), CAMEL_TYPE_SUBSCRIBABLE, CamelSubscribable))
33 #define CAMEL_SUBSCRIBABLE_INTERFACE(cls) \
34 	(G_TYPE_CHECK_CLASS_CAST \
35 	((cls), CAMEL_TYPE_SUBSCRIBABLE, CamelSubscribableInterface))
36 #define CAMEL_IS_SUBSCRIBABLE(obj) \
37 	(G_TYPE_CHECK_INSTANCE_TYPE \
38 	((obj), CAMEL_TYPE_SUBSCRIBABLE))
39 #define CAMEL_IS_SUBSCRIBABLE_INTERFACE(cls) \
40 	(G_TYPE_CHECK_CLASS_TYPE \
41 	((cls), CAMEL_TYPE_SUBSCRIBABLE))
42 #define CAMEL_SUBSCRIBABLE_GET_INTERFACE(obj) \
43 	(G_TYPE_INSTANCE_GET_INTERFACE \
44 	((obj), CAMEL_TYPE_SUBSCRIBABLE, CamelSubscribableInterface))
45 
46 G_BEGIN_DECLS
47 
48 /**
49  * CamelSubscribable:
50  *
51  * Since: 3.2
52  **/
53 typedef struct _CamelSubscribable CamelSubscribable;
54 typedef struct _CamelSubscribableInterface CamelSubscribableInterface;
55 
56 struct _CamelSubscribableInterface {
57 	GTypeInterface parent_interface;
58 
59 	/* Non-Blocking Methods */
60 	gboolean	(*folder_is_subscribed)
61 					(CamelSubscribable *subscribable,
62 					 const gchar *folder_name);
63 
64 	/* Synchronous I/O Methods */
65 	gboolean	(*subscribe_folder_sync)
66 					(CamelSubscribable *subscribable,
67 					 const gchar *folder_name,
68 					 GCancellable *cancellable,
69 					 GError **error);
70 	gboolean	(*unsubscribe_folder_sync)
71 					(CamelSubscribable *subscribable,
72 					 const gchar *folder_name,
73 					 GCancellable *cancellable,
74 					 GError **error);
75 
76 	/* Padding for future expansion */
77 	gpointer reserved_methods[20];
78 
79 	/* Signals */
80 	void		(*folder_subscribed)
81 					(CamelSubscribable *subscribable,
82 					 CamelFolderInfo *folder_info);
83 	void		(*folder_unsubscribed)
84 					(CamelSubscribable *subscribable,
85 					 CamelFolderInfo *folder_info);
86 
87 	/* Padding for future expansion */
88 	gpointer reserved_signals[20];
89 };
90 
91 GType		camel_subscribable_get_type
92 					(void) G_GNUC_CONST;
93 gboolean	camel_subscribable_folder_is_subscribed
94 					(CamelSubscribable *subscribable,
95 					 const gchar *folder_name);
96 gboolean	camel_subscribable_subscribe_folder_sync
97 					(CamelSubscribable *subscribable,
98 					 const gchar *folder_name,
99 					 GCancellable *cancellable,
100 					 GError **error);
101 void		camel_subscribable_subscribe_folder
102 					(CamelSubscribable *subscribable,
103 					 const gchar *folder_name,
104 					 gint io_priority,
105 					 GCancellable *cancellable,
106 					 GAsyncReadyCallback callback,
107 					 gpointer user_data);
108 gboolean	camel_subscribable_subscribe_folder_finish
109 					(CamelSubscribable *subscribable,
110 					 GAsyncResult *result,
111 					 GError **error);
112 gboolean	camel_subscribable_unsubscribe_folder_sync
113 					(CamelSubscribable *subscribable,
114 					 const gchar *folder_name,
115 					 GCancellable *cancellable,
116 					 GError **error);
117 void		camel_subscribable_unsubscribe_folder
118 					(CamelSubscribable *subscribable,
119 					 const gchar *folder_name,
120 					 gint io_priority,
121 					 GCancellable *cancellable,
122 					 GAsyncReadyCallback callback,
123 					 gpointer user_data);
124 gboolean	camel_subscribable_unsubscribe_folder_finish
125 					(CamelSubscribable *subscribable,
126 					 GAsyncResult *result,
127 					 GError **error);
128 void		camel_subscribable_folder_subscribed
129 					(CamelSubscribable *subscribable,
130 					 CamelFolderInfo *folder_info);
131 void		camel_subscribable_folder_unsubscribed
132 					(CamelSubscribable *subscribable,
133 					 CamelFolderInfo *folder_info);
134 
135 G_END_DECLS
136 
137 #endif /* CAMEL_SUBSCRIBABLE_H */
138