1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
4  *
5  * This library is free software: you can redistribute it and/or modify it
6  * under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation.
8  *
9  * This library is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
12  * for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library. If not, see <http://www.gnu.org/licenses/>.
16  *
17  */
18 
19 #if !defined (__LIBEBOOK_H_INSIDE__) && !defined (LIBEBOOK_COMPILATION)
20 #error "Only <libebook/libebook.h> should be included directly."
21 #endif
22 
23 #ifndef E_BOOK_CLIENT_VIEW_H
24 #define E_BOOK_CLIENT_VIEW_H
25 
26 #include <glib-object.h>
27 #include <libebook-contacts/libebook-contacts.h>
28 
29 /* Standard GObject macros */
30 #define E_TYPE_BOOK_CLIENT_VIEW \
31 	(e_book_client_view_get_type ())
32 #define E_BOOK_CLIENT_VIEW(obj) \
33 	(G_TYPE_CHECK_INSTANCE_CAST \
34 	((obj), E_TYPE_BOOK_CLIENT_VIEW, EBookClientView))
35 #define E_BOOK_CLIENT_VIEW_CLASS(cls) \
36 	(G_TYPE_CHECK_CLASS_CAST \
37 	((cls), E_TYPE_BOOK_CLIENT_VIEW, EBookClientViewClass))
38 #define E_IS_BOOK_CLIENT_VIEW(obj) \
39 	(G_TYPE_CHECK_INSTANCE_TYPE \
40 	((obj), E_TYPE_BOOK_CLIENT_VIEW))
41 #define E_IS_BOOK_CLIENT_VIEW_CLASS(cls) \
42 	(G_TYPE_CHECK_CLASS_TYPE \
43 	((cls), E_TYPE_BOOK_CLIENT_VIEW))
44 #define E_BOOK_CLIENT_VIEW_GET_CLASS(obj) \
45 	(G_TYPE_INSTANCE_GET_CLASS \
46 	((obj), E_TYPE_BOOK_CLIENT_VIEW, EBookClientViewClass))
47 
48 G_BEGIN_DECLS
49 
50 typedef struct _EBookClientView EBookClientView;
51 typedef struct _EBookClientViewClass EBookClientViewClass;
52 typedef struct _EBookClientViewPrivate EBookClientViewPrivate;
53 
54 struct _EBookClient;
55 
56 /**
57  * EBookClientView:
58  *
59  * Contains only private data the should be read and manipulated using the
60  * functions below.
61  *
62  * Since: 3.2
63  **/
64 struct _EBookClientView {
65 	/*< private >*/
66 	GObject parent;
67 	EBookClientViewPrivate *priv;
68 };
69 
70 /**
71  * EBookClientViewClass:
72  * @objects_added: Signal emitted when contacts are added in the view
73  * @objects_removed: Signal emitted when contacts are removed from the view
74  * @objects_modified: Signal emitted when contacts in the view are modified
75  * @progress: Signal emitted intermittently while loading a view after calling e_book_client_view_start()
76  * @complete: Notification that loading a view has completed, after calling e_book_client_view_start()
77  *
78  * Class structure for the #EBookClient class.
79  *
80  * Since: 3.2
81  **/
82 struct _EBookClientViewClass {
83 	/*< private >*/
84 	GObjectClass parent_class;
85 
86 	/*< public >*/
87 	/* Signals */
88 	void		(*objects_added)	(EBookClientView *client_view,
89 						 const GSList *objects);
90 	void		(*objects_modified)	(EBookClientView *client_view,
91 						 const GSList *objects);
92 	void		(*objects_removed)	(EBookClientView *client_view,
93 						 const GSList *uids);
94 	void		(*progress)		(EBookClientView *client_view,
95 						 guint percent,
96 						 const gchar *message);
97 	void		(*complete)		(EBookClientView *client_view,
98 						 const GError *error);
99 };
100 
101 GType		e_book_client_view_get_type	(void) G_GNUC_CONST;
102 struct _EBookClient *
103 		e_book_client_view_ref_client	(EBookClientView *client_view);
104 GDBusConnection *
105 		e_book_client_view_get_connection
106 						(EBookClientView *client_view);
107 const gchar *	e_book_client_view_get_object_path
108 						(EBookClientView *client_view);
109 gboolean	e_book_client_view_is_running	(EBookClientView *client_view);
110 void		e_book_client_view_set_fields_of_interest
111 						(EBookClientView *client_view,
112 						 const GSList *fields_of_interest,
113 						 GError **error);
114 void		e_book_client_view_start	(EBookClientView *client_view,
115 						 GError **error);
116 void		e_book_client_view_stop		(EBookClientView *client_view,
117 						 GError **error);
118 void		e_book_client_view_set_flags	(EBookClientView *client_view,
119 						 EBookClientViewFlags flags,
120 						 GError **error);
121 
122 #ifndef EDS_DISABLE_DEPRECATED
123 struct _EBookClient *
124 		e_book_client_view_get_client	(EBookClientView *client_view);
125 #endif /* EDS_DISABLE_DEPRECATED */
126 
127 G_END_DECLS
128 
129 #endif /* E_BOOK_CLIENT_VIEW_H */
130