1 /*
2  * e-dbus-server.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 (__LIBEBACKEND_H_INSIDE__) && !defined (LIBEBACKEND_COMPILATION)
19 #error "Only <libebackend/libebackend.h> should be included directly."
20 #endif
21 
22 #ifndef E_DBUS_SERVER_H
23 #define E_DBUS_SERVER_H
24 
25 #include <gio/gio.h>
26 #include <libebackend/e-backend-enums.h>
27 
28 /* Standard GObject macros */
29 #define E_TYPE_DBUS_SERVER \
30 	(e_dbus_server_get_type ())
31 #define E_DBUS_SERVER(obj) \
32 	(G_TYPE_CHECK_INSTANCE_CAST \
33 	((obj), E_TYPE_DBUS_SERVER, EDBusServer))
34 #define E_DBUS_SERVER_CLASS(cls) \
35 	(G_TYPE_CHECK_CLASS_CAST \
36 	((cls), E_TYPE_DBUS_SERVER, EDBusServerClass))
37 #define E_IS_DBUS_SERVER(obj) \
38 	(G_TYPE_CHECK_INSTANCE_TYPE \
39 	((obj), E_TYPE_DBUS_SERVER))
40 #define E_IS_DBUS_SERVER_CLASS(cls) \
41 	(G_TYPE_CHECK_CLASS_TYPE \
42 	((cls), E_TYPE_DBUS_SERVER))
43 #define E_DBUS_SERVER_GET_CLASS(obj) \
44 	(G_TYPE_INSTANCE_GET_CLASS \
45 	((obj), E_TYPE_DBUS_SERVER, EDBusServerClass))
46 
47 G_BEGIN_DECLS
48 
49 typedef struct _EDBusServer EDBusServer;
50 typedef struct _EDBusServerClass EDBusServerClass;
51 typedef struct _EDBusServerPrivate EDBusServerPrivate;
52 
53 /**
54  * EDBusServer:
55  *
56  * Contains only private data that should be read and manipulated using the
57  * functions below.
58  *
59  * Since: 3.4
60  **/
61 struct _EDBusServer {
62 	/*< private >*/
63 	GObject parent;
64 	EDBusServerPrivate *priv;
65 };
66 
67 struct _EDBusServerClass {
68 	GObjectClass parent_class;
69 
70 	const gchar *bus_name;
71 	const gchar *module_directory;
72 
73 	/* Signals */
74 	void		(*bus_acquired)		(EDBusServer *server,
75 						 GDBusConnection *connection);
76 	void		(*bus_name_acquired)	(EDBusServer *server,
77 						 GDBusConnection *connection);
78 	void		(*bus_name_lost)	(EDBusServer *server,
79 						 GDBusConnection *connection);
80 	EDBusServerExitCode
81 			(*run_server)		(EDBusServer *server);
82 	void		(*quit_server)		(EDBusServer *server,
83 						 EDBusServerExitCode code);
84 
85 	gpointer reserved[14];
86 };
87 
88 GType		e_dbus_server_get_type		(void) G_GNUC_CONST;
89 EDBusServerExitCode
90 		e_dbus_server_run		(EDBusServer *server,
91 						 gboolean wait_for_client);
92 void		e_dbus_server_quit		(EDBusServer *server,
93 						 EDBusServerExitCode code);
94 void		e_dbus_server_hold		(EDBusServer *server);
95 void		e_dbus_server_release		(EDBusServer *server);
96 void		e_dbus_server_load_modules	(EDBusServer *server);
97 
98 G_END_DECLS
99 
100 #endif /* E_DBUS_SERVER_H */
101