summaryrefslogtreecommitdiff
path: root/camel/camel-subscribable.h
blob: 6d53492226a08181ee1ea59984b8d452fa980a09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
 * camel-subscribable.h
 *
 * This library is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library. If not, see <http://www.gnu.org/licenses/>.
 *
 */

#if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
#error "Only <camel/camel.h> can be included directly."
#endif

#ifndef CAMEL_SUBSCRIBABLE_H
#define CAMEL_SUBSCRIBABLE_H

#include <camel/camel-store.h>

/* Standard GObject macros */
#define CAMEL_TYPE_SUBSCRIBABLE \
	(camel_subscribable_get_type ())
#define CAMEL_SUBSCRIBABLE(obj) \
	(G_TYPE_CHECK_INSTANCE_CAST \
	((obj), CAMEL_TYPE_SUBSCRIBABLE, CamelSubscribable))
#define CAMEL_SUBSCRIBABLE_INTERFACE(cls) \
	(G_TYPE_CHECK_CLASS_CAST \
	((cls), CAMEL_TYPE_SUBSCRIBABLE, CamelSubscribableInterface))
#define CAMEL_IS_SUBSCRIBABLE(obj) \
	(G_TYPE_CHECK_INSTANCE_TYPE \
	((obj), CAMEL_TYPE_SUBSCRIBABLE))
#define CAMEL_IS_SUBSCRIBABLE_INTERFACE(cls) \
	(G_TYPE_CHECK_CLASS_TYPE \
	((cls), CAMEL_TYPE_SUBSCRIBABLE))
#define CAMEL_SUBSCRIBABLE_GET_INTERFACE(obj) \
	(G_TYPE_INSTANCE_GET_INTERFACE \
	((obj), CAMEL_TYPE_SUBSCRIBABLE, CamelSubscribableInterface))

G_BEGIN_DECLS

/**
 * CamelSubscribable:
 *
 * Since: 3.2
 **/
typedef struct _CamelSubscribable CamelSubscribable;
typedef struct _CamelSubscribableInterface CamelSubscribableInterface;

struct _CamelSubscribableInterface {
	GTypeInterface parent_interface;

	/* Non-Blocking Methods */
	gboolean	(*folder_is_subscribed)
					(CamelSubscribable *subscribable,
					 const gchar *folder_name);

	/* Synchronous I/O Methods */
	gboolean	(*subscribe_folder_sync)
					(CamelSubscribable *subscribable,
					 const gchar *folder_name,
					 GCancellable *cancellable,
					 GError **error);
	gboolean	(*unsubscribe_folder_sync)
					(CamelSubscribable *subscribable,
					 const gchar *folder_name,
					 GCancellable *cancellable,
					 GError **error);

	/* Reserved slots for methods. */
	gpointer reserved_for_methods[4];

	/* Signals */
	void		(*folder_subscribed)
					(CamelSubscribable *subscribable,
					 CamelFolderInfo *folder_info);
	void		(*folder_unsubscribed)
					(CamelSubscribable *subscribable,
					 CamelFolderInfo *folder_info);
};

GType		camel_subscribable_get_type
					(void) G_GNUC_CONST;
gboolean	camel_subscribable_folder_is_subscribed
					(CamelSubscribable *subscribable,
					 const gchar *folder_name);
gboolean	camel_subscribable_subscribe_folder_sync
					(CamelSubscribable *subscribable,
					 const gchar *folder_name,
					 GCancellable *cancellable,
					 GError **error);
void		camel_subscribable_subscribe_folder
					(CamelSubscribable *subscribable,
					 const gchar *folder_name,
					 gint io_priority,
					 GCancellable *cancellable,
					 GAsyncReadyCallback callback,
					 gpointer user_data);
gboolean	camel_subscribable_subscribe_folder_finish
					(CamelSubscribable *subscribable,
					 GAsyncResult *result,
					 GError **error);
gboolean	camel_subscribable_unsubscribe_folder_sync
					(CamelSubscribable *subscribable,
					 const gchar *folder_name,
					 GCancellable *cancellable,
					 GError **error);
void		camel_subscribable_unsubscribe_folder
					(CamelSubscribable *subscribable,
					 const gchar *folder_name,
					 gint io_priority,
					 GCancellable *cancellable,
					 GAsyncReadyCallback callback,
					 gpointer user_data);
gboolean	camel_subscribable_unsubscribe_folder_finish
					(CamelSubscribable *subscribable,
					 GAsyncResult *result,
					 GError **error);
void		camel_subscribable_folder_subscribed
					(CamelSubscribable *subscribable,
					 CamelFolderInfo *folder_info);
void		camel_subscribable_folder_unsubscribed
					(CamelSubscribable *subscribable,
					 CamelFolderInfo *folder_info);

G_END_DECLS

#endif /* CAMEL_SUBSCRIBABLE_H */