~ubuntu-branches/ubuntu/quantal/colord/quantal-proposed

1 by Christopher James Halse Rogers
Import upstream version 0.1.11
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
2
 *
3
 * Copyright (C) 2010-2011 Richard Hughes <richard@hughsie.com>
4
 *
5
 * Licensed under the GNU Lesser General Public License Version 2.1
6
 *
7
 * This library is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Lesser General Public
9
 * License as published by the Free Software Foundation; either
10
 * version 2.1 of the License, or (at your option) any later version.
11
 *
12
 * This library is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with this library; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
20
 */
21
22
#if !defined (__COLORD_H_INSIDE__) && !defined (CD_COMPILATION)
23
#error "Only <colord.h> can be included directly."
24
#endif
25
26
#ifndef __CD_CLIENT_H
27
#define __CD_CLIENT_H
28
29
#include <glib-object.h>
30
#include <gio/gio.h>
31
32
#include "cd-device.h"
33
#include "cd-profile.h"
34
#include "cd-sensor.h"
35
36
G_BEGIN_DECLS
37
38
#define CD_TYPE_CLIENT		(cd_client_get_type ())
39
#define CD_CLIENT(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), CD_TYPE_CLIENT, CdClient))
40
#define CD_CLIENT_CLASS(k)	(G_TYPE_CHECK_CLASS_CAST((k), CD_TYPE_CLIENT, CdClientClass))
41
#define CD_IS_CLIENT(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), CD_TYPE_CLIENT))
42
#define CD_IS_CLIENT_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), CD_TYPE_CLIENT))
43
#define CD_CLIENT_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), CD_TYPE_CLIENT, CdClientClass))
44
#define CD_CLIENT_ERROR		(cd_client_error_quark ())
45
#define CD_CLIENT_TYPE_ERROR	(cd_client_error_get_type ())
46
47
typedef struct _CdClientPrivate CdClientPrivate;
48
49
typedef struct
50
{
51
	 GObject		 parent;
52
	 CdClientPrivate	*priv;
53
} CdClient;
54
55
typedef struct
56
{
57
	GObjectClass		 parent_class;
58
	void			(*device_added)		(CdClient		*client,
59
							 CdDevice		*device);
60
	void			(*device_removed)	(CdClient		*client,
61
							 CdDevice		*device);
62
	void			(*device_changed)	(CdClient		*client,
63
							 CdDevice		*device);
64
	void			(*profile_added)	(CdClient		*client,
65
							 CdProfile		*profile);
66
	void			(*profile_removed)	(CdClient		*client,
67
							 CdProfile		*profile);
68
	void			(*profile_changed)	(CdClient		*client,
69
							 CdProfile		*profile);
70
	void			(*sensor_added)		(CdClient		*client,
71
							 CdSensor		*sensor);
72
	void			(*sensor_removed)	(CdClient		*client,
73
							 CdSensor		*sensor);
74
	void			(*sensor_changed)	(CdClient		*client,
75
							 CdSensor		*sensor);
76
	void			(*changed)              (CdClient		*client);
77
	/*< private >*/
78
	/* Padding for future expansion */
79
	void (*_cd_client_reserved1) (void);
80
	void (*_cd_client_reserved2) (void);
81
	void (*_cd_client_reserved3) (void);
82
	void (*_cd_client_reserved4) (void);
83
	void (*_cd_client_reserved5) (void);
84
	void (*_cd_client_reserved6) (void);
85
	void (*_cd_client_reserved7) (void);
86
	void (*_cd_client_reserved8) (void);
87
} CdClientClass;
88
89
/**
90
 * CdClientError:
91
 * @CD_CLIENT_ERROR_FAILED: the transaction failed for an unknown reason
1.1.1 by Rodrigo Moya
Import upstream version 0.1.12
92
 * @CD_CLIENT_ERROR_ALREADY_EXISTS: the device or profile already exists
1 by Christopher James Halse Rogers
Import upstream version 0.1.11
93
 *
94
 * Errors that can be thrown
95
 */
96
typedef enum
97
{
98
	CD_CLIENT_ERROR_FAILED,
1.1.1 by Rodrigo Moya
Import upstream version 0.1.12
99
	CD_CLIENT_ERROR_ALREADY_EXISTS,
100
	CD_CLIENT_ERROR_FILE_INVALID,
1 by Christopher James Halse Rogers
Import upstream version 0.1.11
101
	CD_CLIENT_ERROR_LAST
102
} CdClientError;
103
104
GType		 cd_client_get_type			(void);
105
GQuark		 cd_client_error_quark			(void);
106
CdClient	*cd_client_new				(void);
107
108
/* async */
109
void		 cd_client_connect			(CdClient	*client,
110
							 GCancellable	*cancellable,
111
							 GAsyncReadyCallback callback,
112
							 gpointer	 user_data);
113
gboolean	 cd_client_connect_finish		(CdClient	*client,
114
							 GAsyncResult	*res,
115
							 GError		**error);
116
void		cd_client_create_device			(CdClient	*client,
117
							 const gchar	*id,
118
							 CdObjectScope	 scope,
119
							 GHashTable	*properties,
120
							 GCancellable	*cancellable,
121
							 GAsyncReadyCallback callback,
122
							 gpointer	 user_data);
123
CdDevice	*cd_client_create_device_finish		(CdClient	*client,
124
							 GAsyncResult	*res,
125
							 GError		**error);
126
void		cd_client_create_profile		(CdClient	*client,
127
							 const gchar	*id,
128
							 CdObjectScope	 scope,
129
							 GHashTable	*properties,
130
							 GCancellable	*cancellable,
131
							 GAsyncReadyCallback callback,
132
							 gpointer	 user_data);
133
CdProfile	*cd_client_create_profile_finish	(CdClient	*client,
134
							 GAsyncResult	*res,
135
							 GError		**error);
1.1.1 by Rodrigo Moya
Import upstream version 0.1.12
136
void		cd_client_import_profile		(CdClient	*client,
137
							 GFile		*file,
138
							 GCancellable	*cancellable,
139
							 GAsyncReadyCallback callback,
140
							 gpointer	 user_data);
141
CdProfile	*cd_client_import_profile_finish	(CdClient	*client,
142
							 GAsyncResult	*res,
143
							 GError		**error);
1 by Christopher James Halse Rogers
Import upstream version 0.1.11
144
void		 cd_client_delete_device		(CdClient	*client,
145
							 CdDevice	*device,
146
							 GCancellable	*cancellable,
147
							 GAsyncReadyCallback callback,
148
							 gpointer	 user_data);
149
gboolean	 cd_client_delete_device_finish		(CdClient	*client,
150
							 GAsyncResult	*res,
151
							 GError		**error);
152
void		 cd_client_delete_profile		(CdClient	*client,
153
							 CdProfile	*profile,
154
							 GCancellable	*cancellable,
155
							 GAsyncReadyCallback callback,
156
							 gpointer	 user_data);
157
gboolean	 cd_client_delete_profile_finish	(CdClient	*client,
158
							 GAsyncResult	*res,
159
							 GError		**error);
160
void		cd_client_find_device			(CdClient	*client,
161
							 const gchar	*id,
162
							 GCancellable	*cancellable,
163
							 GAsyncReadyCallback callback,
164
							 gpointer	 user_data);
165
CdDevice	*cd_client_find_device_finish 		(CdClient	*client,
166
							 GAsyncResult	*res,
167
							 GError		**error);
168
void		cd_client_find_device_by_property	(CdClient	*client,
169
							 const gchar	*key,
170
							 const gchar	*value,
171
							 GCancellable	*cancellable,
172
							 GAsyncReadyCallback callback,
173
							 gpointer	 user_data);
174
CdDevice	*cd_client_find_device_by_property_finish (CdClient	*client,
175
							 GAsyncResult	*res,
176
							 GError		**error);
177
void		cd_client_find_profile			(CdClient	*client,
178
							 const gchar	*id,
179
							 GCancellable	*cancellable,
180
							 GAsyncReadyCallback callback,
181
							 gpointer	 user_data);
182
CdProfile	*cd_client_find_profile_finish 		(CdClient	*client,
183
							 GAsyncResult	*res,
184
							 GError		**error);
185
186
void		cd_client_find_profile_by_filename	(CdClient	*client,
187
							 const gchar	*filename,
188
							 GCancellable	*cancellable,
189
							 GAsyncReadyCallback callback,
190
							 gpointer	 user_data);
191
CdProfile	*cd_client_find_profile_by_filename_finish (CdClient	*client,
192
							 GAsyncResult	*res,
193
							 GError		**error);
194
void		cd_client_get_standard_space		(CdClient	*client,
195
							 CdStandardSpace standard_space,
196
							 GCancellable	*cancellable,
197
							 GAsyncReadyCallback callback,
198
							 gpointer	 user_data);
199
CdProfile	*cd_client_get_standard_space_finish	(CdClient	*client,
200
							 GAsyncResult	*res,
201
							 GError		**error);
202
void		 cd_client_get_devices			(CdClient	*client,
203
							 GCancellable	*cancellable,
204
							 GAsyncReadyCallback callback,
205
							 gpointer	 user_data);
206
GPtrArray	*cd_client_get_devices_finish		(CdClient	*client,
207
							 GAsyncResult	*res,
208
							 GError		**error);
209
void		 cd_client_get_devices_by_kind		(CdClient	*client,
210
							 CdDeviceKind	 kind,
211
							 GCancellable	*cancellable,
212
							 GAsyncReadyCallback callback,
213
							 gpointer	 user_data);
214
GPtrArray	*cd_client_get_devices_by_kind_finish	(CdClient	*client,
215
							 GAsyncResult	*res,
216
							 GError		**error);
217
void		 cd_client_get_profiles			(CdClient	*client,
218
							 GCancellable	*cancellable,
219
							 GAsyncReadyCallback callback,
220
							 gpointer	 user_data);
221
GPtrArray	*cd_client_get_profiles_finish		(CdClient	*client,
222
							 GAsyncResult	*res,
223
							 GError		**error);
224
void		 cd_client_get_sensors			(CdClient	*client,
225
							 GCancellable	*cancellable,
226
							 GAsyncReadyCallback callback,
227
							 gpointer	 user_data);
228
GPtrArray	*cd_client_get_sensors_finish		(CdClient	*client,
229
							 GAsyncResult	*res,
230
							 GError		**error);
231
232
/* getters */
233
gboolean	 cd_client_get_connected		(CdClient	*client);
1.1.1 by Rodrigo Moya
Import upstream version 0.1.12
234
gboolean	 cd_client_get_has_server		(CdClient	*client);
1 by Christopher James Halse Rogers
Import upstream version 0.1.11
235
const gchar	*cd_client_get_daemon_version		(CdClient	*client);
236
237
G_END_DECLS
238
239
#endif /* __CD_CLIENT_H */
240