Line |
Branch |
Exec |
Source |
1 |
|
|
/* |
2 |
|
|
* This file is generated by gdbus-codegen, do not modify it. |
3 |
|
|
* |
4 |
|
|
* The license of this code is the same as for the D-Bus interface description |
5 |
|
|
* it was derived from. Note that it links to GLib, so must comply with the |
6 |
|
|
* LGPL linking clauses. |
7 |
|
|
*/ |
8 |
|
|
|
9 |
|
|
#ifdef HAVE_CONFIG_H |
10 |
|
|
# include "config.h" |
11 |
|
|
#endif |
12 |
|
|
|
13 |
|
|
#include "org.gnome.SettingsDaemon.Sharing.h" |
14 |
|
|
|
15 |
|
|
#include <string.h> |
16 |
|
|
#ifdef G_OS_UNIX |
17 |
|
|
# include <gio/gunixfdlist.h> |
18 |
|
|
#endif |
19 |
|
|
|
20 |
|
|
#ifdef G_ENABLE_DEBUG |
21 |
|
|
#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) |
22 |
|
|
#define g_marshal_value_peek_char(v) g_value_get_schar (v) |
23 |
|
|
#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) |
24 |
|
|
#define g_marshal_value_peek_int(v) g_value_get_int (v) |
25 |
|
|
#define g_marshal_value_peek_uint(v) g_value_get_uint (v) |
26 |
|
|
#define g_marshal_value_peek_long(v) g_value_get_long (v) |
27 |
|
|
#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) |
28 |
|
|
#define g_marshal_value_peek_int64(v) g_value_get_int64 (v) |
29 |
|
|
#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) |
30 |
|
|
#define g_marshal_value_peek_enum(v) g_value_get_enum (v) |
31 |
|
|
#define g_marshal_value_peek_flags(v) g_value_get_flags (v) |
32 |
|
|
#define g_marshal_value_peek_float(v) g_value_get_float (v) |
33 |
|
|
#define g_marshal_value_peek_double(v) g_value_get_double (v) |
34 |
|
|
#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) |
35 |
|
|
#define g_marshal_value_peek_param(v) g_value_get_param (v) |
36 |
|
|
#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) |
37 |
|
|
#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) |
38 |
|
|
#define g_marshal_value_peek_object(v) g_value_get_object (v) |
39 |
|
|
#define g_marshal_value_peek_variant(v) g_value_get_variant (v) |
40 |
|
|
#else /* !G_ENABLE_DEBUG */ |
41 |
|
|
/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. |
42 |
|
|
* Do not access GValues directly in your code. Instead, use the |
43 |
|
|
* g_value_get_*() functions |
44 |
|
|
*/ |
45 |
|
|
#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int |
46 |
|
|
#define g_marshal_value_peek_char(v) (v)->data[0].v_int |
47 |
|
|
#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint |
48 |
|
|
#define g_marshal_value_peek_int(v) (v)->data[0].v_int |
49 |
|
|
#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint |
50 |
|
|
#define g_marshal_value_peek_long(v) (v)->data[0].v_long |
51 |
|
|
#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong |
52 |
|
|
#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 |
53 |
|
|
#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 |
54 |
|
|
#define g_marshal_value_peek_enum(v) (v)->data[0].v_long |
55 |
|
|
#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong |
56 |
|
|
#define g_marshal_value_peek_float(v) (v)->data[0].v_float |
57 |
|
|
#define g_marshal_value_peek_double(v) (v)->data[0].v_double |
58 |
|
|
#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer |
59 |
|
|
#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer |
60 |
|
|
#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer |
61 |
|
|
#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer |
62 |
|
|
#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer |
63 |
|
|
#define g_marshal_value_peek_variant(v) (v)->data[0].v_pointer |
64 |
|
|
#endif /* !G_ENABLE_DEBUG */ |
65 |
|
|
|
66 |
|
|
typedef struct |
67 |
|
|
{ |
68 |
|
|
GDBusArgInfo parent_struct; |
69 |
|
|
gboolean use_gvariant; |
70 |
|
|
} _ExtendedGDBusArgInfo; |
71 |
|
|
|
72 |
|
|
typedef struct |
73 |
|
|
{ |
74 |
|
|
GDBusMethodInfo parent_struct; |
75 |
|
|
const gchar *signal_name; |
76 |
|
|
gboolean pass_fdlist; |
77 |
|
|
} _ExtendedGDBusMethodInfo; |
78 |
|
|
|
79 |
|
|
typedef struct |
80 |
|
|
{ |
81 |
|
|
GDBusSignalInfo parent_struct; |
82 |
|
|
const gchar *signal_name; |
83 |
|
|
} _ExtendedGDBusSignalInfo; |
84 |
|
|
|
85 |
|
|
typedef struct |
86 |
|
|
{ |
87 |
|
|
GDBusPropertyInfo parent_struct; |
88 |
|
|
const gchar *hyphen_name; |
89 |
|
|
guint use_gvariant : 1; |
90 |
|
|
guint emits_changed_signal : 1; |
91 |
|
|
} _ExtendedGDBusPropertyInfo; |
92 |
|
|
|
93 |
|
|
typedef struct |
94 |
|
|
{ |
95 |
|
|
GDBusInterfaceInfo parent_struct; |
96 |
|
|
const gchar *hyphen_name; |
97 |
|
|
} _ExtendedGDBusInterfaceInfo; |
98 |
|
|
|
99 |
|
|
typedef struct |
100 |
|
|
{ |
101 |
|
|
const _ExtendedGDBusPropertyInfo *info; |
102 |
|
|
guint prop_id; |
103 |
|
|
GValue orig_value; /* the value before the change */ |
104 |
|
|
} ChangedProperty; |
105 |
|
|
|
106 |
|
|
static void |
107 |
|
✗ |
_changed_property_free (ChangedProperty *data) |
108 |
|
|
{ |
109 |
|
✗ |
g_value_unset (&data->orig_value); |
110 |
|
✗ |
g_free (data); |
111 |
|
✗ |
} |
112 |
|
|
|
113 |
|
|
static gboolean |
114 |
|
✗ |
_g_strv_equal0 (gchar **a, gchar **b) |
115 |
|
|
{ |
116 |
|
✗ |
gboolean ret = FALSE; |
117 |
|
|
guint n; |
118 |
|
✗ |
if (a == NULL && b == NULL) |
119 |
|
|
{ |
120 |
|
✗ |
ret = TRUE; |
121 |
|
✗ |
goto out; |
122 |
|
|
} |
123 |
|
✗ |
if (a == NULL || b == NULL) |
124 |
|
✗ |
goto out; |
125 |
|
✗ |
if (g_strv_length (a) != g_strv_length (b)) |
126 |
|
✗ |
goto out; |
127 |
|
✗ |
for (n = 0; a[n] != NULL; n++) |
128 |
|
✗ |
if (g_strcmp0 (a[n], b[n]) != 0) |
129 |
|
✗ |
goto out; |
130 |
|
✗ |
ret = TRUE; |
131 |
|
✗ |
out: |
132 |
|
✗ |
return ret; |
133 |
|
|
} |
134 |
|
|
|
135 |
|
|
static gboolean |
136 |
|
✗ |
_g_variant_equal0 (GVariant *a, GVariant *b) |
137 |
|
|
{ |
138 |
|
✗ |
gboolean ret = FALSE; |
139 |
|
✗ |
if (a == NULL && b == NULL) |
140 |
|
|
{ |
141 |
|
✗ |
ret = TRUE; |
142 |
|
✗ |
goto out; |
143 |
|
|
} |
144 |
|
✗ |
if (a == NULL || b == NULL) |
145 |
|
✗ |
goto out; |
146 |
|
✗ |
ret = g_variant_equal (a, b); |
147 |
|
✗ |
out: |
148 |
|
✗ |
return ret; |
149 |
|
|
} |
150 |
|
|
|
151 |
|
|
G_GNUC_UNUSED static gboolean |
152 |
|
✗ |
_g_value_equal (const GValue *a, const GValue *b) |
153 |
|
|
{ |
154 |
|
✗ |
gboolean ret = FALSE; |
155 |
|
✗ |
g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b)); |
156 |
|
✗ |
switch (G_VALUE_TYPE (a)) |
157 |
|
|
{ |
158 |
|
✗ |
case G_TYPE_BOOLEAN: |
159 |
|
✗ |
ret = (g_value_get_boolean (a) == g_value_get_boolean (b)); |
160 |
|
✗ |
break; |
161 |
|
✗ |
case G_TYPE_UCHAR: |
162 |
|
✗ |
ret = (g_value_get_uchar (a) == g_value_get_uchar (b)); |
163 |
|
✗ |
break; |
164 |
|
✗ |
case G_TYPE_INT: |
165 |
|
✗ |
ret = (g_value_get_int (a) == g_value_get_int (b)); |
166 |
|
✗ |
break; |
167 |
|
✗ |
case G_TYPE_UINT: |
168 |
|
✗ |
ret = (g_value_get_uint (a) == g_value_get_uint (b)); |
169 |
|
✗ |
break; |
170 |
|
✗ |
case G_TYPE_INT64: |
171 |
|
✗ |
ret = (g_value_get_int64 (a) == g_value_get_int64 (b)); |
172 |
|
✗ |
break; |
173 |
|
✗ |
case G_TYPE_UINT64: |
174 |
|
✗ |
ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b)); |
175 |
|
✗ |
break; |
176 |
|
✗ |
case G_TYPE_DOUBLE: |
177 |
|
|
{ |
178 |
|
|
/* Avoid -Wfloat-equal warnings by doing a direct bit compare */ |
179 |
|
✗ |
gdouble da = g_value_get_double (a); |
180 |
|
✗ |
gdouble db = g_value_get_double (b); |
181 |
|
✗ |
ret = memcmp (&da, &db, sizeof (gdouble)) == 0; |
182 |
|
|
} |
183 |
|
✗ |
break; |
184 |
|
✗ |
case G_TYPE_STRING: |
185 |
|
✗ |
ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0); |
186 |
|
✗ |
break; |
187 |
|
✗ |
case G_TYPE_VARIANT: |
188 |
|
✗ |
ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b)); |
189 |
|
✗ |
break; |
190 |
|
✗ |
default: |
191 |
|
✗ |
if (G_VALUE_TYPE (a) == G_TYPE_STRV) |
192 |
|
✗ |
ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b)); |
193 |
|
|
else |
194 |
|
✗ |
g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a))); |
195 |
|
✗ |
break; |
196 |
|
|
} |
197 |
|
✗ |
return ret; |
198 |
|
|
} |
199 |
|
|
|
200 |
|
|
static void |
201 |
|
✗ |
_g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING ( |
202 |
|
|
GClosure *closure, |
203 |
|
|
GValue *return_value, |
204 |
|
|
unsigned int n_param_values, |
205 |
|
|
const GValue *param_values, |
206 |
|
|
void *invocation_hint G_GNUC_UNUSED, |
207 |
|
|
void *marshal_data) |
208 |
|
|
{ |
209 |
|
|
typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectStringFunc) |
210 |
|
|
(void *data1, |
211 |
|
|
GDBusMethodInvocation *arg_method_invocation, |
212 |
|
|
const gchar *arg_service_name, |
213 |
|
|
void *data2); |
214 |
|
|
_GDbusCodegenMarshalBoolean_ObjectStringFunc callback; |
215 |
|
✗ |
GCClosure *cc = (GCClosure*) closure; |
216 |
|
|
void *data1, *data2; |
217 |
|
|
gboolean v_return; |
218 |
|
|
|
219 |
|
✗ |
g_return_if_fail (return_value != NULL); |
220 |
|
✗ |
g_return_if_fail (n_param_values == 3); |
221 |
|
|
|
222 |
|
✗ |
if (G_CCLOSURE_SWAP_DATA (closure)) |
223 |
|
|
{ |
224 |
|
✗ |
data1 = closure->data; |
225 |
|
✗ |
data2 = g_value_peek_pointer (param_values + 0); |
226 |
|
|
} |
227 |
|
|
else |
228 |
|
|
{ |
229 |
|
✗ |
data1 = g_value_peek_pointer (param_values + 0); |
230 |
|
✗ |
data2 = closure->data; |
231 |
|
|
} |
232 |
|
|
|
233 |
|
✗ |
callback = (_GDbusCodegenMarshalBoolean_ObjectStringFunc) |
234 |
|
✗ |
(marshal_data ? marshal_data : cc->callback); |
235 |
|
|
|
236 |
|
|
v_return = |
237 |
|
✗ |
callback (data1, |
238 |
|
✗ |
g_marshal_value_peek_object (param_values + 1), |
239 |
|
✗ |
g_marshal_value_peek_string (param_values + 2), |
240 |
|
|
data2); |
241 |
|
|
|
242 |
|
✗ |
g_value_set_boolean (return_value, v_return); |
243 |
|
|
} |
244 |
|
|
|
245 |
|
|
static void |
246 |
|
✗ |
_g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING_STRING ( |
247 |
|
|
GClosure *closure, |
248 |
|
|
GValue *return_value, |
249 |
|
|
unsigned int n_param_values, |
250 |
|
|
const GValue *param_values, |
251 |
|
|
void *invocation_hint G_GNUC_UNUSED, |
252 |
|
|
void *marshal_data) |
253 |
|
|
{ |
254 |
|
|
typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectStringStringFunc) |
255 |
|
|
(void *data1, |
256 |
|
|
GDBusMethodInvocation *arg_method_invocation, |
257 |
|
|
const gchar *arg_service_name, |
258 |
|
|
const gchar *arg_network, |
259 |
|
|
void *data2); |
260 |
|
|
_GDbusCodegenMarshalBoolean_ObjectStringStringFunc callback; |
261 |
|
✗ |
GCClosure *cc = (GCClosure*) closure; |
262 |
|
|
void *data1, *data2; |
263 |
|
|
gboolean v_return; |
264 |
|
|
|
265 |
|
✗ |
g_return_if_fail (return_value != NULL); |
266 |
|
✗ |
g_return_if_fail (n_param_values == 4); |
267 |
|
|
|
268 |
|
✗ |
if (G_CCLOSURE_SWAP_DATA (closure)) |
269 |
|
|
{ |
270 |
|
✗ |
data1 = closure->data; |
271 |
|
✗ |
data2 = g_value_peek_pointer (param_values + 0); |
272 |
|
|
} |
273 |
|
|
else |
274 |
|
|
{ |
275 |
|
✗ |
data1 = g_value_peek_pointer (param_values + 0); |
276 |
|
✗ |
data2 = closure->data; |
277 |
|
|
} |
278 |
|
|
|
279 |
|
✗ |
callback = (_GDbusCodegenMarshalBoolean_ObjectStringStringFunc) |
280 |
|
✗ |
(marshal_data ? marshal_data : cc->callback); |
281 |
|
|
|
282 |
|
|
v_return = |
283 |
|
✗ |
callback (data1, |
284 |
|
✗ |
g_marshal_value_peek_object (param_values + 1), |
285 |
|
✗ |
g_marshal_value_peek_string (param_values + 2), |
286 |
|
✗ |
g_marshal_value_peek_string (param_values + 3), |
287 |
|
|
data2); |
288 |
|
|
|
289 |
|
✗ |
g_value_set_boolean (return_value, v_return); |
290 |
|
|
} |
291 |
|
|
|
292 |
|
|
/* ------------------------------------------------------------------------ |
293 |
|
|
* Code for interface org.gnome.SettingsDaemon.Sharing |
294 |
|
|
* ------------------------------------------------------------------------ |
295 |
|
|
*/ |
296 |
|
|
|
297 |
|
|
/** |
298 |
|
|
* SECTION:GsdSharing |
299 |
|
|
* @title: GsdSharing |
300 |
|
|
* @short_description: Generated C code for the org.gnome.SettingsDaemon.Sharing D-Bus interface |
301 |
|
|
* |
302 |
|
|
* This section contains code for working with the <link linkend="gdbus-interface-org-gnome-SettingsDaemon-Sharing.top_of_page">org.gnome.SettingsDaemon.Sharing</link> D-Bus interface in C. |
303 |
|
|
*/ |
304 |
|
|
|
305 |
|
|
/* ---- Introspection data for org.gnome.SettingsDaemon.Sharing ---- */ |
306 |
|
|
|
307 |
|
|
static const _ExtendedGDBusArgInfo _gsd_sharing_method_info_enable_service_IN_ARG_service_name = |
308 |
|
|
{ |
309 |
|
|
{ |
310 |
|
|
-1, |
311 |
|
|
(gchar *) "service_name", |
312 |
|
|
(gchar *) "s", |
313 |
|
|
NULL |
314 |
|
|
}, |
315 |
|
|
FALSE |
316 |
|
|
}; |
317 |
|
|
|
318 |
|
|
static const GDBusArgInfo * const _gsd_sharing_method_info_enable_service_IN_ARG_pointers[] = |
319 |
|
|
{ |
320 |
|
|
&_gsd_sharing_method_info_enable_service_IN_ARG_service_name.parent_struct, |
321 |
|
|
NULL |
322 |
|
|
}; |
323 |
|
|
|
324 |
|
|
static const _ExtendedGDBusMethodInfo _gsd_sharing_method_info_enable_service = |
325 |
|
|
{ |
326 |
|
|
{ |
327 |
|
|
-1, |
328 |
|
|
(gchar *) "EnableService", |
329 |
|
|
(GDBusArgInfo **) &_gsd_sharing_method_info_enable_service_IN_ARG_pointers, |
330 |
|
|
NULL, |
331 |
|
|
NULL |
332 |
|
|
}, |
333 |
|
|
"handle-enable-service", |
334 |
|
|
FALSE |
335 |
|
|
}; |
336 |
|
|
|
337 |
|
|
static const _ExtendedGDBusArgInfo _gsd_sharing_method_info_disable_service_IN_ARG_service_name = |
338 |
|
|
{ |
339 |
|
|
{ |
340 |
|
|
-1, |
341 |
|
|
(gchar *) "service_name", |
342 |
|
|
(gchar *) "s", |
343 |
|
|
NULL |
344 |
|
|
}, |
345 |
|
|
FALSE |
346 |
|
|
}; |
347 |
|
|
|
348 |
|
|
static const _ExtendedGDBusArgInfo _gsd_sharing_method_info_disable_service_IN_ARG_network = |
349 |
|
|
{ |
350 |
|
|
{ |
351 |
|
|
-1, |
352 |
|
|
(gchar *) "network", |
353 |
|
|
(gchar *) "s", |
354 |
|
|
NULL |
355 |
|
|
}, |
356 |
|
|
FALSE |
357 |
|
|
}; |
358 |
|
|
|
359 |
|
|
static const GDBusArgInfo * const _gsd_sharing_method_info_disable_service_IN_ARG_pointers[] = |
360 |
|
|
{ |
361 |
|
|
&_gsd_sharing_method_info_disable_service_IN_ARG_service_name.parent_struct, |
362 |
|
|
&_gsd_sharing_method_info_disable_service_IN_ARG_network.parent_struct, |
363 |
|
|
NULL |
364 |
|
|
}; |
365 |
|
|
|
366 |
|
|
static const _ExtendedGDBusMethodInfo _gsd_sharing_method_info_disable_service = |
367 |
|
|
{ |
368 |
|
|
{ |
369 |
|
|
-1, |
370 |
|
|
(gchar *) "DisableService", |
371 |
|
|
(GDBusArgInfo **) &_gsd_sharing_method_info_disable_service_IN_ARG_pointers, |
372 |
|
|
NULL, |
373 |
|
|
NULL |
374 |
|
|
}, |
375 |
|
|
"handle-disable-service", |
376 |
|
|
FALSE |
377 |
|
|
}; |
378 |
|
|
|
379 |
|
|
static const _ExtendedGDBusArgInfo _gsd_sharing_method_info_list_networks_IN_ARG_service_name = |
380 |
|
|
{ |
381 |
|
|
{ |
382 |
|
|
-1, |
383 |
|
|
(gchar *) "service_name", |
384 |
|
|
(gchar *) "s", |
385 |
|
|
NULL |
386 |
|
|
}, |
387 |
|
|
FALSE |
388 |
|
|
}; |
389 |
|
|
|
390 |
|
|
static const GDBusArgInfo * const _gsd_sharing_method_info_list_networks_IN_ARG_pointers[] = |
391 |
|
|
{ |
392 |
|
|
&_gsd_sharing_method_info_list_networks_IN_ARG_service_name.parent_struct, |
393 |
|
|
NULL |
394 |
|
|
}; |
395 |
|
|
|
396 |
|
|
static const _ExtendedGDBusArgInfo _gsd_sharing_method_info_list_networks_OUT_ARG_networks = |
397 |
|
|
{ |
398 |
|
|
{ |
399 |
|
|
-1, |
400 |
|
|
(gchar *) "networks", |
401 |
|
|
(gchar *) "a(sss)", |
402 |
|
|
NULL |
403 |
|
|
}, |
404 |
|
|
FALSE |
405 |
|
|
}; |
406 |
|
|
|
407 |
|
|
static const GDBusArgInfo * const _gsd_sharing_method_info_list_networks_OUT_ARG_pointers[] = |
408 |
|
|
{ |
409 |
|
|
&_gsd_sharing_method_info_list_networks_OUT_ARG_networks.parent_struct, |
410 |
|
|
NULL |
411 |
|
|
}; |
412 |
|
|
|
413 |
|
|
static const _ExtendedGDBusMethodInfo _gsd_sharing_method_info_list_networks = |
414 |
|
|
{ |
415 |
|
|
{ |
416 |
|
|
-1, |
417 |
|
|
(gchar *) "ListNetworks", |
418 |
|
|
(GDBusArgInfo **) &_gsd_sharing_method_info_list_networks_IN_ARG_pointers, |
419 |
|
|
(GDBusArgInfo **) &_gsd_sharing_method_info_list_networks_OUT_ARG_pointers, |
420 |
|
|
NULL |
421 |
|
|
}, |
422 |
|
|
"handle-list-networks", |
423 |
|
|
FALSE |
424 |
|
|
}; |
425 |
|
|
|
426 |
|
|
static const GDBusMethodInfo * const _gsd_sharing_method_info_pointers[] = |
427 |
|
|
{ |
428 |
|
|
&_gsd_sharing_method_info_enable_service.parent_struct, |
429 |
|
|
&_gsd_sharing_method_info_disable_service.parent_struct, |
430 |
|
|
&_gsd_sharing_method_info_list_networks.parent_struct, |
431 |
|
|
NULL |
432 |
|
|
}; |
433 |
|
|
|
434 |
|
|
static const _ExtendedGDBusPropertyInfo _gsd_sharing_property_info_current_network_name = |
435 |
|
|
{ |
436 |
|
|
{ |
437 |
|
|
-1, |
438 |
|
|
(gchar *) "CurrentNetworkName", |
439 |
|
|
(gchar *) "s", |
440 |
|
|
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
441 |
|
|
NULL |
442 |
|
|
}, |
443 |
|
|
"current-network-name", |
444 |
|
|
FALSE, |
445 |
|
|
TRUE |
446 |
|
|
}; |
447 |
|
|
|
448 |
|
|
static const _ExtendedGDBusPropertyInfo _gsd_sharing_property_info_current_network = |
449 |
|
|
{ |
450 |
|
|
{ |
451 |
|
|
-1, |
452 |
|
|
(gchar *) "CurrentNetwork", |
453 |
|
|
(gchar *) "s", |
454 |
|
|
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
455 |
|
|
NULL |
456 |
|
|
}, |
457 |
|
|
"current-network", |
458 |
|
|
FALSE, |
459 |
|
|
TRUE |
460 |
|
|
}; |
461 |
|
|
|
462 |
|
|
static const _ExtendedGDBusPropertyInfo _gsd_sharing_property_info_carrier_type = |
463 |
|
|
{ |
464 |
|
|
{ |
465 |
|
|
-1, |
466 |
|
|
(gchar *) "CarrierType", |
467 |
|
|
(gchar *) "s", |
468 |
|
|
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
469 |
|
|
NULL |
470 |
|
|
}, |
471 |
|
|
"carrier-type", |
472 |
|
|
FALSE, |
473 |
|
|
TRUE |
474 |
|
|
}; |
475 |
|
|
|
476 |
|
|
static const _ExtendedGDBusPropertyInfo _gsd_sharing_property_info_sharing_status = |
477 |
|
|
{ |
478 |
|
|
{ |
479 |
|
|
-1, |
480 |
|
|
(gchar *) "SharingStatus", |
481 |
|
|
(gchar *) "u", |
482 |
|
|
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
483 |
|
|
NULL |
484 |
|
|
}, |
485 |
|
|
"sharing-status", |
486 |
|
|
FALSE, |
487 |
|
|
TRUE |
488 |
|
|
}; |
489 |
|
|
|
490 |
|
|
static const GDBusPropertyInfo * const _gsd_sharing_property_info_pointers[] = |
491 |
|
|
{ |
492 |
|
|
&_gsd_sharing_property_info_current_network_name.parent_struct, |
493 |
|
|
&_gsd_sharing_property_info_current_network.parent_struct, |
494 |
|
|
&_gsd_sharing_property_info_carrier_type.parent_struct, |
495 |
|
|
&_gsd_sharing_property_info_sharing_status.parent_struct, |
496 |
|
|
NULL |
497 |
|
|
}; |
498 |
|
|
|
499 |
|
|
static const _ExtendedGDBusInterfaceInfo _gsd_sharing_interface_info = |
500 |
|
|
{ |
501 |
|
|
{ |
502 |
|
|
-1, |
503 |
|
|
(gchar *) "org.gnome.SettingsDaemon.Sharing", |
504 |
|
|
(GDBusMethodInfo **) &_gsd_sharing_method_info_pointers, |
505 |
|
|
NULL, |
506 |
|
|
(GDBusPropertyInfo **) &_gsd_sharing_property_info_pointers, |
507 |
|
|
NULL |
508 |
|
|
}, |
509 |
|
|
"sharing", |
510 |
|
|
}; |
511 |
|
|
|
512 |
|
|
|
513 |
|
|
/** |
514 |
|
|
* gsd_sharing_interface_info: |
515 |
|
|
* |
516 |
|
|
* Gets a machine-readable description of the <link linkend="gdbus-interface-org-gnome-SettingsDaemon-Sharing.top_of_page">org.gnome.SettingsDaemon.Sharing</link> D-Bus interface. |
517 |
|
|
* |
518 |
|
|
* Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
519 |
|
|
*/ |
520 |
|
|
GDBusInterfaceInfo * |
521 |
|
✗ |
gsd_sharing_interface_info (void) |
522 |
|
|
{ |
523 |
|
✗ |
return (GDBusInterfaceInfo *) &_gsd_sharing_interface_info.parent_struct; |
524 |
|
|
} |
525 |
|
|
|
526 |
|
|
/** |
527 |
|
|
* gsd_sharing_override_properties: |
528 |
|
|
* @klass: The class structure for a #GObject derived class. |
529 |
|
|
* @property_id_begin: The property id to assign to the first overridden property. |
530 |
|
|
* |
531 |
|
|
* Overrides all #GObject properties in the #GsdSharing interface for a concrete class. |
532 |
|
|
* The properties are overridden in the order they are defined. |
533 |
|
|
* |
534 |
|
|
* Returns: The last property id. |
535 |
|
|
*/ |
536 |
|
|
guint |
537 |
|
✗ |
gsd_sharing_override_properties (GObjectClass *klass, guint property_id_begin) |
538 |
|
|
{ |
539 |
|
✗ |
g_object_class_override_property (klass, property_id_begin++, "current-network-name"); |
540 |
|
✗ |
g_object_class_override_property (klass, property_id_begin++, "current-network"); |
541 |
|
✗ |
g_object_class_override_property (klass, property_id_begin++, "carrier-type"); |
542 |
|
✗ |
g_object_class_override_property (klass, property_id_begin++, "sharing-status"); |
543 |
|
✗ |
return property_id_begin - 1; |
544 |
|
|
} |
545 |
|
|
|
546 |
|
|
|
547 |
|
|
inline static void |
548 |
|
✗ |
gsd_sharing_method_marshal_enable_service ( |
549 |
|
|
GClosure *closure, |
550 |
|
|
GValue *return_value, |
551 |
|
|
unsigned int n_param_values, |
552 |
|
|
const GValue *param_values, |
553 |
|
|
void *invocation_hint, |
554 |
|
|
void *marshal_data) |
555 |
|
|
{ |
556 |
|
✗ |
_g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING (closure, |
557 |
|
|
return_value, n_param_values, param_values, invocation_hint, marshal_data); |
558 |
|
✗ |
} |
559 |
|
|
|
560 |
|
|
inline static void |
561 |
|
✗ |
gsd_sharing_method_marshal_disable_service ( |
562 |
|
|
GClosure *closure, |
563 |
|
|
GValue *return_value, |
564 |
|
|
unsigned int n_param_values, |
565 |
|
|
const GValue *param_values, |
566 |
|
|
void *invocation_hint, |
567 |
|
|
void *marshal_data) |
568 |
|
|
{ |
569 |
|
✗ |
_g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING_STRING (closure, |
570 |
|
|
return_value, n_param_values, param_values, invocation_hint, marshal_data); |
571 |
|
✗ |
} |
572 |
|
|
|
573 |
|
|
inline static void |
574 |
|
✗ |
gsd_sharing_method_marshal_list_networks ( |
575 |
|
|
GClosure *closure, |
576 |
|
|
GValue *return_value, |
577 |
|
|
unsigned int n_param_values, |
578 |
|
|
const GValue *param_values, |
579 |
|
|
void *invocation_hint, |
580 |
|
|
void *marshal_data) |
581 |
|
|
{ |
582 |
|
✗ |
_g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING (closure, |
583 |
|
|
return_value, n_param_values, param_values, invocation_hint, marshal_data); |
584 |
|
✗ |
} |
585 |
|
|
|
586 |
|
|
|
587 |
|
|
/** |
588 |
|
|
* GsdSharing: |
589 |
|
|
* |
590 |
|
|
* Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-gnome-SettingsDaemon-Sharing.top_of_page">org.gnome.SettingsDaemon.Sharing</link>. |
591 |
|
|
*/ |
592 |
|
|
|
593 |
|
|
/** |
594 |
|
|
* GsdSharingIface: |
595 |
|
|
* @parent_iface: The parent interface. |
596 |
|
|
* @handle_disable_service: Handler for the #GsdSharing::handle-disable-service signal. |
597 |
|
|
* @handle_enable_service: Handler for the #GsdSharing::handle-enable-service signal. |
598 |
|
|
* @handle_list_networks: Handler for the #GsdSharing::handle-list-networks signal. |
599 |
|
|
* @get_carrier_type: Getter for the #GsdSharing:carrier-type property. |
600 |
|
|
* @get_current_network: Getter for the #GsdSharing:current-network property. |
601 |
|
|
* @get_current_network_name: Getter for the #GsdSharing:current-network-name property. |
602 |
|
|
* @get_sharing_status: Getter for the #GsdSharing:sharing-status property. |
603 |
|
|
* |
604 |
|
|
* Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-gnome-SettingsDaemon-Sharing.top_of_page">org.gnome.SettingsDaemon.Sharing</link>. |
605 |
|
|
*/ |
606 |
|
|
|
607 |
|
|
typedef GsdSharingIface GsdSharingInterface; |
608 |
|
✗ |
G_DEFINE_INTERFACE (GsdSharing, gsd_sharing, G_TYPE_OBJECT) |
609 |
|
|
|
610 |
|
|
static void |
611 |
|
✗ |
gsd_sharing_default_init (GsdSharingIface *iface) |
612 |
|
|
{ |
613 |
|
|
/* GObject signals for incoming D-Bus method calls: */ |
614 |
|
|
/** |
615 |
|
|
* GsdSharing::handle-enable-service: |
616 |
|
|
* @object: A #GsdSharing. |
617 |
|
|
* @invocation: A #GDBusMethodInvocation. |
618 |
|
|
* @arg_service_name: Argument passed by remote caller. |
619 |
|
|
* |
620 |
|
|
* Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-SettingsDaemon-Sharing.EnableService">EnableService()</link> D-Bus method. |
621 |
|
|
* |
622 |
|
|
* If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call gsd_sharing_complete_enable_service() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
623 |
|
|
* |
624 |
|
|
* Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run. |
625 |
|
|
*/ |
626 |
|
✗ |
g_signal_new ("handle-enable-service", |
627 |
|
|
G_TYPE_FROM_INTERFACE (iface), |
628 |
|
|
G_SIGNAL_RUN_LAST, |
629 |
|
|
G_STRUCT_OFFSET (GsdSharingIface, handle_enable_service), |
630 |
|
|
g_signal_accumulator_true_handled, |
631 |
|
|
NULL, |
632 |
|
|
gsd_sharing_method_marshal_enable_service, |
633 |
|
|
G_TYPE_BOOLEAN, |
634 |
|
|
2, |
635 |
|
|
G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
636 |
|
|
|
637 |
|
|
/** |
638 |
|
|
* GsdSharing::handle-disable-service: |
639 |
|
|
* @object: A #GsdSharing. |
640 |
|
|
* @invocation: A #GDBusMethodInvocation. |
641 |
|
|
* @arg_service_name: Argument passed by remote caller. |
642 |
|
|
* @arg_network: Argument passed by remote caller. |
643 |
|
|
* |
644 |
|
|
* Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-SettingsDaemon-Sharing.DisableService">DisableService()</link> D-Bus method. |
645 |
|
|
* |
646 |
|
|
* If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call gsd_sharing_complete_disable_service() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
647 |
|
|
* |
648 |
|
|
* Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run. |
649 |
|
|
*/ |
650 |
|
✗ |
g_signal_new ("handle-disable-service", |
651 |
|
|
G_TYPE_FROM_INTERFACE (iface), |
652 |
|
|
G_SIGNAL_RUN_LAST, |
653 |
|
|
G_STRUCT_OFFSET (GsdSharingIface, handle_disable_service), |
654 |
|
|
g_signal_accumulator_true_handled, |
655 |
|
|
NULL, |
656 |
|
|
gsd_sharing_method_marshal_disable_service, |
657 |
|
|
G_TYPE_BOOLEAN, |
658 |
|
|
3, |
659 |
|
|
G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING); |
660 |
|
|
|
661 |
|
|
/** |
662 |
|
|
* GsdSharing::handle-list-networks: |
663 |
|
|
* @object: A #GsdSharing. |
664 |
|
|
* @invocation: A #GDBusMethodInvocation. |
665 |
|
|
* @arg_service_name: Argument passed by remote caller. |
666 |
|
|
* |
667 |
|
|
* Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-SettingsDaemon-Sharing.ListNetworks">ListNetworks()</link> D-Bus method. |
668 |
|
|
* |
669 |
|
|
* If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call gsd_sharing_complete_list_networks() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
670 |
|
|
* |
671 |
|
|
* Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run. |
672 |
|
|
*/ |
673 |
|
✗ |
g_signal_new ("handle-list-networks", |
674 |
|
|
G_TYPE_FROM_INTERFACE (iface), |
675 |
|
|
G_SIGNAL_RUN_LAST, |
676 |
|
|
G_STRUCT_OFFSET (GsdSharingIface, handle_list_networks), |
677 |
|
|
g_signal_accumulator_true_handled, |
678 |
|
|
NULL, |
679 |
|
|
gsd_sharing_method_marshal_list_networks, |
680 |
|
|
G_TYPE_BOOLEAN, |
681 |
|
|
2, |
682 |
|
|
G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
683 |
|
|
|
684 |
|
|
/* GObject properties for D-Bus properties: */ |
685 |
|
|
/** |
686 |
|
|
* GsdSharing:current-network-name: |
687 |
|
|
* |
688 |
|
|
* Represents the D-Bus property <link linkend="gdbus-property-org-gnome-SettingsDaemon-Sharing.CurrentNetworkName">"CurrentNetworkName"</link>. |
689 |
|
|
* |
690 |
|
|
* Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. |
691 |
|
|
*/ |
692 |
|
✗ |
g_object_interface_install_property (iface, |
693 |
|
|
g_param_spec_string ("current-network-name", "CurrentNetworkName", "CurrentNetworkName", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
694 |
|
|
/** |
695 |
|
|
* GsdSharing:current-network: |
696 |
|
|
* |
697 |
|
|
* Represents the D-Bus property <link linkend="gdbus-property-org-gnome-SettingsDaemon-Sharing.CurrentNetwork">"CurrentNetwork"</link>. |
698 |
|
|
* |
699 |
|
|
* Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. |
700 |
|
|
*/ |
701 |
|
✗ |
g_object_interface_install_property (iface, |
702 |
|
|
g_param_spec_string ("current-network", "CurrentNetwork", "CurrentNetwork", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
703 |
|
|
/** |
704 |
|
|
* GsdSharing:carrier-type: |
705 |
|
|
* |
706 |
|
|
* Represents the D-Bus property <link linkend="gdbus-property-org-gnome-SettingsDaemon-Sharing.CarrierType">"CarrierType"</link>. |
707 |
|
|
* |
708 |
|
|
* Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. |
709 |
|
|
*/ |
710 |
|
✗ |
g_object_interface_install_property (iface, |
711 |
|
|
g_param_spec_string ("carrier-type", "CarrierType", "CarrierType", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
712 |
|
|
/** |
713 |
|
|
* GsdSharing:sharing-status: |
714 |
|
|
* |
715 |
|
|
* Represents the D-Bus property <link linkend="gdbus-property-org-gnome-SettingsDaemon-Sharing.SharingStatus">"SharingStatus"</link>. |
716 |
|
|
* |
717 |
|
|
* Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. |
718 |
|
|
*/ |
719 |
|
✗ |
g_object_interface_install_property (iface, |
720 |
|
|
g_param_spec_uint ("sharing-status", "SharingStatus", "SharingStatus", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
721 |
|
✗ |
} |
722 |
|
|
|
723 |
|
|
/** |
724 |
|
|
* gsd_sharing_get_current_network_name: (skip) |
725 |
|
|
* @object: A #GsdSharing. |
726 |
|
|
* |
727 |
|
|
* Gets the value of the <link linkend="gdbus-property-org-gnome-SettingsDaemon-Sharing.CurrentNetworkName">"CurrentNetworkName"</link> D-Bus property. |
728 |
|
|
* |
729 |
|
|
* Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
730 |
|
|
* |
731 |
|
|
* The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gsd_sharing_dup_current_network_name() if on another thread. |
732 |
|
|
* |
733 |
|
|
* Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
734 |
|
|
*/ |
735 |
|
|
const gchar * |
736 |
|
✗ |
gsd_sharing_get_current_network_name (GsdSharing *object) |
737 |
|
|
{ |
738 |
|
✗ |
g_return_val_if_fail (GSD_IS_SHARING (object), NULL); |
739 |
|
|
|
740 |
|
✗ |
return GSD_SHARING_GET_IFACE (object)->get_current_network_name (object); |
741 |
|
|
} |
742 |
|
|
|
743 |
|
|
/** |
744 |
|
|
* gsd_sharing_dup_current_network_name: (skip) |
745 |
|
|
* @object: A #GsdSharing. |
746 |
|
|
* |
747 |
|
|
* Gets a copy of the <link linkend="gdbus-property-org-gnome-SettingsDaemon-Sharing.CurrentNetworkName">"CurrentNetworkName"</link> D-Bus property. |
748 |
|
|
* |
749 |
|
|
* Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
750 |
|
|
* |
751 |
|
|
* Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
752 |
|
|
*/ |
753 |
|
|
gchar * |
754 |
|
✗ |
gsd_sharing_dup_current_network_name (GsdSharing *object) |
755 |
|
|
{ |
756 |
|
|
gchar *value; |
757 |
|
✗ |
g_object_get (G_OBJECT (object), "current-network-name", &value, NULL); |
758 |
|
✗ |
return value; |
759 |
|
|
} |
760 |
|
|
|
761 |
|
|
/** |
762 |
|
|
* gsd_sharing_set_current_network_name: (skip) |
763 |
|
|
* @object: A #GsdSharing. |
764 |
|
|
* @value: The value to set. |
765 |
|
|
* |
766 |
|
|
* Sets the <link linkend="gdbus-property-org-gnome-SettingsDaemon-Sharing.CurrentNetworkName">"CurrentNetworkName"</link> D-Bus property to @value. |
767 |
|
|
* |
768 |
|
|
* Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
769 |
|
|
*/ |
770 |
|
|
void |
771 |
|
✗ |
gsd_sharing_set_current_network_name (GsdSharing *object, const gchar *value) |
772 |
|
|
{ |
773 |
|
✗ |
g_object_set (G_OBJECT (object), "current-network-name", value, NULL); |
774 |
|
✗ |
} |
775 |
|
|
|
776 |
|
|
/** |
777 |
|
|
* gsd_sharing_get_current_network: (skip) |
778 |
|
|
* @object: A #GsdSharing. |
779 |
|
|
* |
780 |
|
|
* Gets the value of the <link linkend="gdbus-property-org-gnome-SettingsDaemon-Sharing.CurrentNetwork">"CurrentNetwork"</link> D-Bus property. |
781 |
|
|
* |
782 |
|
|
* Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
783 |
|
|
* |
784 |
|
|
* The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gsd_sharing_dup_current_network() if on another thread. |
785 |
|
|
* |
786 |
|
|
* Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
787 |
|
|
*/ |
788 |
|
|
const gchar * |
789 |
|
✗ |
gsd_sharing_get_current_network (GsdSharing *object) |
790 |
|
|
{ |
791 |
|
✗ |
g_return_val_if_fail (GSD_IS_SHARING (object), NULL); |
792 |
|
|
|
793 |
|
✗ |
return GSD_SHARING_GET_IFACE (object)->get_current_network (object); |
794 |
|
|
} |
795 |
|
|
|
796 |
|
|
/** |
797 |
|
|
* gsd_sharing_dup_current_network: (skip) |
798 |
|
|
* @object: A #GsdSharing. |
799 |
|
|
* |
800 |
|
|
* Gets a copy of the <link linkend="gdbus-property-org-gnome-SettingsDaemon-Sharing.CurrentNetwork">"CurrentNetwork"</link> D-Bus property. |
801 |
|
|
* |
802 |
|
|
* Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
803 |
|
|
* |
804 |
|
|
* Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
805 |
|
|
*/ |
806 |
|
|
gchar * |
807 |
|
✗ |
gsd_sharing_dup_current_network (GsdSharing *object) |
808 |
|
|
{ |
809 |
|
|
gchar *value; |
810 |
|
✗ |
g_object_get (G_OBJECT (object), "current-network", &value, NULL); |
811 |
|
✗ |
return value; |
812 |
|
|
} |
813 |
|
|
|
814 |
|
|
/** |
815 |
|
|
* gsd_sharing_set_current_network: (skip) |
816 |
|
|
* @object: A #GsdSharing. |
817 |
|
|
* @value: The value to set. |
818 |
|
|
* |
819 |
|
|
* Sets the <link linkend="gdbus-property-org-gnome-SettingsDaemon-Sharing.CurrentNetwork">"CurrentNetwork"</link> D-Bus property to @value. |
820 |
|
|
* |
821 |
|
|
* Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
822 |
|
|
*/ |
823 |
|
|
void |
824 |
|
✗ |
gsd_sharing_set_current_network (GsdSharing *object, const gchar *value) |
825 |
|
|
{ |
826 |
|
✗ |
g_object_set (G_OBJECT (object), "current-network", value, NULL); |
827 |
|
✗ |
} |
828 |
|
|
|
829 |
|
|
/** |
830 |
|
|
* gsd_sharing_get_carrier_type: (skip) |
831 |
|
|
* @object: A #GsdSharing. |
832 |
|
|
* |
833 |
|
|
* Gets the value of the <link linkend="gdbus-property-org-gnome-SettingsDaemon-Sharing.CarrierType">"CarrierType"</link> D-Bus property. |
834 |
|
|
* |
835 |
|
|
* Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
836 |
|
|
* |
837 |
|
|
* The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gsd_sharing_dup_carrier_type() if on another thread. |
838 |
|
|
* |
839 |
|
|
* Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
840 |
|
|
*/ |
841 |
|
|
const gchar * |
842 |
|
✗ |
gsd_sharing_get_carrier_type (GsdSharing *object) |
843 |
|
|
{ |
844 |
|
✗ |
g_return_val_if_fail (GSD_IS_SHARING (object), NULL); |
845 |
|
|
|
846 |
|
✗ |
return GSD_SHARING_GET_IFACE (object)->get_carrier_type (object); |
847 |
|
|
} |
848 |
|
|
|
849 |
|
|
/** |
850 |
|
|
* gsd_sharing_dup_carrier_type: (skip) |
851 |
|
|
* @object: A #GsdSharing. |
852 |
|
|
* |
853 |
|
|
* Gets a copy of the <link linkend="gdbus-property-org-gnome-SettingsDaemon-Sharing.CarrierType">"CarrierType"</link> D-Bus property. |
854 |
|
|
* |
855 |
|
|
* Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
856 |
|
|
* |
857 |
|
|
* Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
858 |
|
|
*/ |
859 |
|
|
gchar * |
860 |
|
✗ |
gsd_sharing_dup_carrier_type (GsdSharing *object) |
861 |
|
|
{ |
862 |
|
|
gchar *value; |
863 |
|
✗ |
g_object_get (G_OBJECT (object), "carrier-type", &value, NULL); |
864 |
|
✗ |
return value; |
865 |
|
|
} |
866 |
|
|
|
867 |
|
|
/** |
868 |
|
|
* gsd_sharing_set_carrier_type: (skip) |
869 |
|
|
* @object: A #GsdSharing. |
870 |
|
|
* @value: The value to set. |
871 |
|
|
* |
872 |
|
|
* Sets the <link linkend="gdbus-property-org-gnome-SettingsDaemon-Sharing.CarrierType">"CarrierType"</link> D-Bus property to @value. |
873 |
|
|
* |
874 |
|
|
* Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
875 |
|
|
*/ |
876 |
|
|
void |
877 |
|
✗ |
gsd_sharing_set_carrier_type (GsdSharing *object, const gchar *value) |
878 |
|
|
{ |
879 |
|
✗ |
g_object_set (G_OBJECT (object), "carrier-type", value, NULL); |
880 |
|
✗ |
} |
881 |
|
|
|
882 |
|
|
/** |
883 |
|
|
* gsd_sharing_get_sharing_status: (skip) |
884 |
|
|
* @object: A #GsdSharing. |
885 |
|
|
* |
886 |
|
|
* Gets the value of the <link linkend="gdbus-property-org-gnome-SettingsDaemon-Sharing.SharingStatus">"SharingStatus"</link> D-Bus property. |
887 |
|
|
* |
888 |
|
|
* Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
889 |
|
|
* |
890 |
|
|
* Returns: The property value. |
891 |
|
|
*/ |
892 |
|
|
guint |
893 |
|
✗ |
gsd_sharing_get_sharing_status (GsdSharing *object) |
894 |
|
|
{ |
895 |
|
✗ |
g_return_val_if_fail (GSD_IS_SHARING (object), 0); |
896 |
|
|
|
897 |
|
✗ |
return GSD_SHARING_GET_IFACE (object)->get_sharing_status (object); |
898 |
|
|
} |
899 |
|
|
|
900 |
|
|
/** |
901 |
|
|
* gsd_sharing_set_sharing_status: (skip) |
902 |
|
|
* @object: A #GsdSharing. |
903 |
|
|
* @value: The value to set. |
904 |
|
|
* |
905 |
|
|
* Sets the <link linkend="gdbus-property-org-gnome-SettingsDaemon-Sharing.SharingStatus">"SharingStatus"</link> D-Bus property to @value. |
906 |
|
|
* |
907 |
|
|
* Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
908 |
|
|
*/ |
909 |
|
|
void |
910 |
|
✗ |
gsd_sharing_set_sharing_status (GsdSharing *object, guint value) |
911 |
|
|
{ |
912 |
|
✗ |
g_object_set (G_OBJECT (object), "sharing-status", value, NULL); |
913 |
|
✗ |
} |
914 |
|
|
|
915 |
|
|
/** |
916 |
|
|
* gsd_sharing_call_enable_service: |
917 |
|
|
* @proxy: A #GsdSharingProxy. |
918 |
|
|
* @arg_service_name: Argument to pass with the method invocation. |
919 |
|
|
* @cancellable: (nullable): A #GCancellable or %NULL. |
920 |
|
|
* @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
921 |
|
|
* @user_data: User data to pass to @callback. |
922 |
|
|
* |
923 |
|
|
* Asynchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-Sharing.EnableService">EnableService()</link> D-Bus method on @proxy. |
924 |
|
|
* When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()). |
925 |
|
|
* You can then call gsd_sharing_call_enable_service_finish() to get the result of the operation. |
926 |
|
|
* |
927 |
|
|
* See gsd_sharing_call_enable_service_sync() for the synchronous, blocking version of this method. |
928 |
|
|
*/ |
929 |
|
|
void |
930 |
|
✗ |
gsd_sharing_call_enable_service ( |
931 |
|
|
GsdSharing *proxy, |
932 |
|
|
const gchar *arg_service_name, |
933 |
|
|
GCancellable *cancellable, |
934 |
|
|
GAsyncReadyCallback callback, |
935 |
|
|
gpointer user_data) |
936 |
|
|
{ |
937 |
|
✗ |
g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
938 |
|
|
"EnableService", |
939 |
|
|
g_variant_new ("(s)", |
940 |
|
|
arg_service_name), |
941 |
|
|
G_DBUS_CALL_FLAGS_NONE, |
942 |
|
|
-1, |
943 |
|
|
cancellable, |
944 |
|
|
callback, |
945 |
|
|
user_data); |
946 |
|
✗ |
} |
947 |
|
|
|
948 |
|
|
/** |
949 |
|
|
* gsd_sharing_call_enable_service_finish: |
950 |
|
|
* @proxy: A #GsdSharingProxy. |
951 |
|
|
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gsd_sharing_call_enable_service(). |
952 |
|
|
* @error: Return location for error or %NULL. |
953 |
|
|
* |
954 |
|
|
* Finishes an operation started with gsd_sharing_call_enable_service(). |
955 |
|
|
* |
956 |
|
|
* Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
957 |
|
|
*/ |
958 |
|
|
gboolean |
959 |
|
✗ |
gsd_sharing_call_enable_service_finish ( |
960 |
|
|
GsdSharing *proxy, |
961 |
|
|
GAsyncResult *res, |
962 |
|
|
GError **error) |
963 |
|
|
{ |
964 |
|
|
GVariant *_ret; |
965 |
|
✗ |
_ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
966 |
|
✗ |
if (_ret == NULL) |
967 |
|
✗ |
goto _out; |
968 |
|
✗ |
g_variant_get (_ret, |
969 |
|
|
"()"); |
970 |
|
✗ |
g_variant_unref (_ret); |
971 |
|
✗ |
_out: |
972 |
|
✗ |
return _ret != NULL; |
973 |
|
|
} |
974 |
|
|
|
975 |
|
|
/** |
976 |
|
|
* gsd_sharing_call_enable_service_sync: |
977 |
|
|
* @proxy: A #GsdSharingProxy. |
978 |
|
|
* @arg_service_name: Argument to pass with the method invocation. |
979 |
|
|
* @cancellable: (nullable): A #GCancellable or %NULL. |
980 |
|
|
* @error: Return location for error or %NULL. |
981 |
|
|
* |
982 |
|
|
* Synchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-Sharing.EnableService">EnableService()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
983 |
|
|
* |
984 |
|
|
* See gsd_sharing_call_enable_service() for the asynchronous version of this method. |
985 |
|
|
* |
986 |
|
|
* Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
987 |
|
|
*/ |
988 |
|
|
gboolean |
989 |
|
✗ |
gsd_sharing_call_enable_service_sync ( |
990 |
|
|
GsdSharing *proxy, |
991 |
|
|
const gchar *arg_service_name, |
992 |
|
|
GCancellable *cancellable, |
993 |
|
|
GError **error) |
994 |
|
|
{ |
995 |
|
|
GVariant *_ret; |
996 |
|
✗ |
_ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
997 |
|
|
"EnableService", |
998 |
|
|
g_variant_new ("(s)", |
999 |
|
|
arg_service_name), |
1000 |
|
|
G_DBUS_CALL_FLAGS_NONE, |
1001 |
|
|
-1, |
1002 |
|
|
cancellable, |
1003 |
|
|
error); |
1004 |
|
✗ |
if (_ret == NULL) |
1005 |
|
✗ |
goto _out; |
1006 |
|
✗ |
g_variant_get (_ret, |
1007 |
|
|
"()"); |
1008 |
|
✗ |
g_variant_unref (_ret); |
1009 |
|
✗ |
_out: |
1010 |
|
✗ |
return _ret != NULL; |
1011 |
|
|
} |
1012 |
|
|
|
1013 |
|
|
/** |
1014 |
|
|
* gsd_sharing_call_disable_service: |
1015 |
|
|
* @proxy: A #GsdSharingProxy. |
1016 |
|
|
* @arg_service_name: Argument to pass with the method invocation. |
1017 |
|
|
* @arg_network: Argument to pass with the method invocation. |
1018 |
|
|
* @cancellable: (nullable): A #GCancellable or %NULL. |
1019 |
|
|
* @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1020 |
|
|
* @user_data: User data to pass to @callback. |
1021 |
|
|
* |
1022 |
|
|
* Asynchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-Sharing.DisableService">DisableService()</link> D-Bus method on @proxy. |
1023 |
|
|
* When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()). |
1024 |
|
|
* You can then call gsd_sharing_call_disable_service_finish() to get the result of the operation. |
1025 |
|
|
* |
1026 |
|
|
* See gsd_sharing_call_disable_service_sync() for the synchronous, blocking version of this method. |
1027 |
|
|
*/ |
1028 |
|
|
void |
1029 |
|
✗ |
gsd_sharing_call_disable_service ( |
1030 |
|
|
GsdSharing *proxy, |
1031 |
|
|
const gchar *arg_service_name, |
1032 |
|
|
const gchar *arg_network, |
1033 |
|
|
GCancellable *cancellable, |
1034 |
|
|
GAsyncReadyCallback callback, |
1035 |
|
|
gpointer user_data) |
1036 |
|
|
{ |
1037 |
|
✗ |
g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
1038 |
|
|
"DisableService", |
1039 |
|
|
g_variant_new ("(ss)", |
1040 |
|
|
arg_service_name, |
1041 |
|
|
arg_network), |
1042 |
|
|
G_DBUS_CALL_FLAGS_NONE, |
1043 |
|
|
-1, |
1044 |
|
|
cancellable, |
1045 |
|
|
callback, |
1046 |
|
|
user_data); |
1047 |
|
✗ |
} |
1048 |
|
|
|
1049 |
|
|
/** |
1050 |
|
|
* gsd_sharing_call_disable_service_finish: |
1051 |
|
|
* @proxy: A #GsdSharingProxy. |
1052 |
|
|
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gsd_sharing_call_disable_service(). |
1053 |
|
|
* @error: Return location for error or %NULL. |
1054 |
|
|
* |
1055 |
|
|
* Finishes an operation started with gsd_sharing_call_disable_service(). |
1056 |
|
|
* |
1057 |
|
|
* Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
1058 |
|
|
*/ |
1059 |
|
|
gboolean |
1060 |
|
✗ |
gsd_sharing_call_disable_service_finish ( |
1061 |
|
|
GsdSharing *proxy, |
1062 |
|
|
GAsyncResult *res, |
1063 |
|
|
GError **error) |
1064 |
|
|
{ |
1065 |
|
|
GVariant *_ret; |
1066 |
|
✗ |
_ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
1067 |
|
✗ |
if (_ret == NULL) |
1068 |
|
✗ |
goto _out; |
1069 |
|
✗ |
g_variant_get (_ret, |
1070 |
|
|
"()"); |
1071 |
|
✗ |
g_variant_unref (_ret); |
1072 |
|
✗ |
_out: |
1073 |
|
✗ |
return _ret != NULL; |
1074 |
|
|
} |
1075 |
|
|
|
1076 |
|
|
/** |
1077 |
|
|
* gsd_sharing_call_disable_service_sync: |
1078 |
|
|
* @proxy: A #GsdSharingProxy. |
1079 |
|
|
* @arg_service_name: Argument to pass with the method invocation. |
1080 |
|
|
* @arg_network: Argument to pass with the method invocation. |
1081 |
|
|
* @cancellable: (nullable): A #GCancellable or %NULL. |
1082 |
|
|
* @error: Return location for error or %NULL. |
1083 |
|
|
* |
1084 |
|
|
* Synchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-Sharing.DisableService">DisableService()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
1085 |
|
|
* |
1086 |
|
|
* See gsd_sharing_call_disable_service() for the asynchronous version of this method. |
1087 |
|
|
* |
1088 |
|
|
* Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
1089 |
|
|
*/ |
1090 |
|
|
gboolean |
1091 |
|
✗ |
gsd_sharing_call_disable_service_sync ( |
1092 |
|
|
GsdSharing *proxy, |
1093 |
|
|
const gchar *arg_service_name, |
1094 |
|
|
const gchar *arg_network, |
1095 |
|
|
GCancellable *cancellable, |
1096 |
|
|
GError **error) |
1097 |
|
|
{ |
1098 |
|
|
GVariant *_ret; |
1099 |
|
✗ |
_ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
1100 |
|
|
"DisableService", |
1101 |
|
|
g_variant_new ("(ss)", |
1102 |
|
|
arg_service_name, |
1103 |
|
|
arg_network), |
1104 |
|
|
G_DBUS_CALL_FLAGS_NONE, |
1105 |
|
|
-1, |
1106 |
|
|
cancellable, |
1107 |
|
|
error); |
1108 |
|
✗ |
if (_ret == NULL) |
1109 |
|
✗ |
goto _out; |
1110 |
|
✗ |
g_variant_get (_ret, |
1111 |
|
|
"()"); |
1112 |
|
✗ |
g_variant_unref (_ret); |
1113 |
|
✗ |
_out: |
1114 |
|
✗ |
return _ret != NULL; |
1115 |
|
|
} |
1116 |
|
|
|
1117 |
|
|
/** |
1118 |
|
|
* gsd_sharing_call_list_networks: |
1119 |
|
|
* @proxy: A #GsdSharingProxy. |
1120 |
|
|
* @arg_service_name: Argument to pass with the method invocation. |
1121 |
|
|
* @cancellable: (nullable): A #GCancellable or %NULL. |
1122 |
|
|
* @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1123 |
|
|
* @user_data: User data to pass to @callback. |
1124 |
|
|
* |
1125 |
|
|
* Asynchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-Sharing.ListNetworks">ListNetworks()</link> D-Bus method on @proxy. |
1126 |
|
|
* When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()). |
1127 |
|
|
* You can then call gsd_sharing_call_list_networks_finish() to get the result of the operation. |
1128 |
|
|
* |
1129 |
|
|
* See gsd_sharing_call_list_networks_sync() for the synchronous, blocking version of this method. |
1130 |
|
|
*/ |
1131 |
|
|
void |
1132 |
|
✗ |
gsd_sharing_call_list_networks ( |
1133 |
|
|
GsdSharing *proxy, |
1134 |
|
|
const gchar *arg_service_name, |
1135 |
|
|
GCancellable *cancellable, |
1136 |
|
|
GAsyncReadyCallback callback, |
1137 |
|
|
gpointer user_data) |
1138 |
|
|
{ |
1139 |
|
✗ |
g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
1140 |
|
|
"ListNetworks", |
1141 |
|
|
g_variant_new ("(s)", |
1142 |
|
|
arg_service_name), |
1143 |
|
|
G_DBUS_CALL_FLAGS_NONE, |
1144 |
|
|
-1, |
1145 |
|
|
cancellable, |
1146 |
|
|
callback, |
1147 |
|
|
user_data); |
1148 |
|
✗ |
} |
1149 |
|
|
|
1150 |
|
|
/** |
1151 |
|
|
* gsd_sharing_call_list_networks_finish: |
1152 |
|
|
* @proxy: A #GsdSharingProxy. |
1153 |
|
|
* @out_networks: (out) (optional): Return location for return parameter or %NULL to ignore. |
1154 |
|
|
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gsd_sharing_call_list_networks(). |
1155 |
|
|
* @error: Return location for error or %NULL. |
1156 |
|
|
* |
1157 |
|
|
* Finishes an operation started with gsd_sharing_call_list_networks(). |
1158 |
|
|
* |
1159 |
|
|
* Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
1160 |
|
|
*/ |
1161 |
|
|
gboolean |
1162 |
|
✗ |
gsd_sharing_call_list_networks_finish ( |
1163 |
|
|
GsdSharing *proxy, |
1164 |
|
|
GVariant **out_networks, |
1165 |
|
|
GAsyncResult *res, |
1166 |
|
|
GError **error) |
1167 |
|
|
{ |
1168 |
|
|
GVariant *_ret; |
1169 |
|
✗ |
_ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
1170 |
|
✗ |
if (_ret == NULL) |
1171 |
|
✗ |
goto _out; |
1172 |
|
✗ |
g_variant_get (_ret, |
1173 |
|
|
"(@a(sss))", |
1174 |
|
|
out_networks); |
1175 |
|
✗ |
g_variant_unref (_ret); |
1176 |
|
✗ |
_out: |
1177 |
|
✗ |
return _ret != NULL; |
1178 |
|
|
} |
1179 |
|
|
|
1180 |
|
|
/** |
1181 |
|
|
* gsd_sharing_call_list_networks_sync: |
1182 |
|
|
* @proxy: A #GsdSharingProxy. |
1183 |
|
|
* @arg_service_name: Argument to pass with the method invocation. |
1184 |
|
|
* @out_networks: (out) (optional): Return location for return parameter or %NULL to ignore. |
1185 |
|
|
* @cancellable: (nullable): A #GCancellable or %NULL. |
1186 |
|
|
* @error: Return location for error or %NULL. |
1187 |
|
|
* |
1188 |
|
|
* Synchronously invokes the <link linkend="gdbus-method-org-gnome-SettingsDaemon-Sharing.ListNetworks">ListNetworks()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
1189 |
|
|
* |
1190 |
|
|
* See gsd_sharing_call_list_networks() for the asynchronous version of this method. |
1191 |
|
|
* |
1192 |
|
|
* Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. |
1193 |
|
|
*/ |
1194 |
|
|
gboolean |
1195 |
|
✗ |
gsd_sharing_call_list_networks_sync ( |
1196 |
|
|
GsdSharing *proxy, |
1197 |
|
|
const gchar *arg_service_name, |
1198 |
|
|
GVariant **out_networks, |
1199 |
|
|
GCancellable *cancellable, |
1200 |
|
|
GError **error) |
1201 |
|
|
{ |
1202 |
|
|
GVariant *_ret; |
1203 |
|
✗ |
_ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
1204 |
|
|
"ListNetworks", |
1205 |
|
|
g_variant_new ("(s)", |
1206 |
|
|
arg_service_name), |
1207 |
|
|
G_DBUS_CALL_FLAGS_NONE, |
1208 |
|
|
-1, |
1209 |
|
|
cancellable, |
1210 |
|
|
error); |
1211 |
|
✗ |
if (_ret == NULL) |
1212 |
|
✗ |
goto _out; |
1213 |
|
✗ |
g_variant_get (_ret, |
1214 |
|
|
"(@a(sss))", |
1215 |
|
|
out_networks); |
1216 |
|
✗ |
g_variant_unref (_ret); |
1217 |
|
✗ |
_out: |
1218 |
|
✗ |
return _ret != NULL; |
1219 |
|
|
} |
1220 |
|
|
|
1221 |
|
|
/** |
1222 |
|
|
* gsd_sharing_complete_enable_service: |
1223 |
|
|
* @object: A #GsdSharing. |
1224 |
|
|
* @invocation: (transfer full): A #GDBusMethodInvocation. |
1225 |
|
|
* |
1226 |
|
|
* Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-SettingsDaemon-Sharing.EnableService">EnableService()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
1227 |
|
|
* |
1228 |
|
|
* This method will free @invocation, you cannot use it afterwards. |
1229 |
|
|
*/ |
1230 |
|
|
void |
1231 |
|
✗ |
gsd_sharing_complete_enable_service ( |
1232 |
|
|
GsdSharing *object G_GNUC_UNUSED, |
1233 |
|
|
GDBusMethodInvocation *invocation) |
1234 |
|
|
{ |
1235 |
|
✗ |
g_dbus_method_invocation_return_value (invocation, |
1236 |
|
|
g_variant_new ("()")); |
1237 |
|
✗ |
} |
1238 |
|
|
|
1239 |
|
|
/** |
1240 |
|
|
* gsd_sharing_complete_disable_service: |
1241 |
|
|
* @object: A #GsdSharing. |
1242 |
|
|
* @invocation: (transfer full): A #GDBusMethodInvocation. |
1243 |
|
|
* |
1244 |
|
|
* Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-SettingsDaemon-Sharing.DisableService">DisableService()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
1245 |
|
|
* |
1246 |
|
|
* This method will free @invocation, you cannot use it afterwards. |
1247 |
|
|
*/ |
1248 |
|
|
void |
1249 |
|
✗ |
gsd_sharing_complete_disable_service ( |
1250 |
|
|
GsdSharing *object G_GNUC_UNUSED, |
1251 |
|
|
GDBusMethodInvocation *invocation) |
1252 |
|
|
{ |
1253 |
|
✗ |
g_dbus_method_invocation_return_value (invocation, |
1254 |
|
|
g_variant_new ("()")); |
1255 |
|
✗ |
} |
1256 |
|
|
|
1257 |
|
|
/** |
1258 |
|
|
* gsd_sharing_complete_list_networks: |
1259 |
|
|
* @object: A #GsdSharing. |
1260 |
|
|
* @invocation: (transfer full): A #GDBusMethodInvocation. |
1261 |
|
|
* @networks: Parameter to return. |
1262 |
|
|
* |
1263 |
|
|
* Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-SettingsDaemon-Sharing.ListNetworks">ListNetworks()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
1264 |
|
|
* |
1265 |
|
|
* This method will free @invocation, you cannot use it afterwards. |
1266 |
|
|
*/ |
1267 |
|
|
void |
1268 |
|
✗ |
gsd_sharing_complete_list_networks ( |
1269 |
|
|
GsdSharing *object G_GNUC_UNUSED, |
1270 |
|
|
GDBusMethodInvocation *invocation, |
1271 |
|
|
GVariant *networks) |
1272 |
|
|
{ |
1273 |
|
✗ |
g_dbus_method_invocation_return_value (invocation, |
1274 |
|
|
g_variant_new ("(@a(sss))", |
1275 |
|
|
networks)); |
1276 |
|
✗ |
} |
1277 |
|
|
|
1278 |
|
|
/* ------------------------------------------------------------------------ */ |
1279 |
|
|
|
1280 |
|
|
/** |
1281 |
|
|
* GsdSharingProxy: |
1282 |
|
|
* |
1283 |
|
|
* The #GsdSharingProxy structure contains only private data and should only be accessed using the provided API. |
1284 |
|
|
*/ |
1285 |
|
|
|
1286 |
|
|
/** |
1287 |
|
|
* GsdSharingProxyClass: |
1288 |
|
|
* @parent_class: The parent class. |
1289 |
|
|
* |
1290 |
|
|
* Class structure for #GsdSharingProxy. |
1291 |
|
|
*/ |
1292 |
|
|
|
1293 |
|
|
struct _GsdSharingProxyPrivate |
1294 |
|
|
{ |
1295 |
|
|
GData *qdata; |
1296 |
|
|
}; |
1297 |
|
|
|
1298 |
|
|
static void gsd_sharing_proxy_iface_init (GsdSharingIface *iface); |
1299 |
|
|
|
1300 |
|
|
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
1301 |
|
✗ |
G_DEFINE_TYPE_WITH_CODE (GsdSharingProxy, gsd_sharing_proxy, G_TYPE_DBUS_PROXY, |
1302 |
|
|
G_ADD_PRIVATE (GsdSharingProxy) |
1303 |
|
|
G_IMPLEMENT_INTERFACE (GSD_TYPE_SHARING, gsd_sharing_proxy_iface_init)) |
1304 |
|
|
|
1305 |
|
|
#else |
1306 |
|
|
G_DEFINE_TYPE_WITH_CODE (GsdSharingProxy, gsd_sharing_proxy, G_TYPE_DBUS_PROXY, |
1307 |
|
|
G_IMPLEMENT_INTERFACE (GSD_TYPE_SHARING, gsd_sharing_proxy_iface_init)) |
1308 |
|
|
|
1309 |
|
|
#endif |
1310 |
|
|
static void |
1311 |
|
✗ |
gsd_sharing_proxy_finalize (GObject *object) |
1312 |
|
|
{ |
1313 |
|
✗ |
GsdSharingProxy *proxy = GSD_SHARING_PROXY (object); |
1314 |
|
✗ |
g_datalist_clear (&proxy->priv->qdata); |
1315 |
|
✗ |
G_OBJECT_CLASS (gsd_sharing_proxy_parent_class)->finalize (object); |
1316 |
|
✗ |
} |
1317 |
|
|
|
1318 |
|
|
static void |
1319 |
|
✗ |
gsd_sharing_proxy_get_property (GObject *object, |
1320 |
|
|
guint prop_id, |
1321 |
|
|
GValue *value, |
1322 |
|
|
GParamSpec *pspec G_GNUC_UNUSED) |
1323 |
|
|
{ |
1324 |
|
|
const _ExtendedGDBusPropertyInfo *info; |
1325 |
|
|
GVariant *variant; |
1326 |
|
✗ |
g_assert (prop_id != 0 && prop_id - 1 < 4); |
1327 |
|
✗ |
info = (const _ExtendedGDBusPropertyInfo *) _gsd_sharing_property_info_pointers[prop_id - 1]; |
1328 |
|
✗ |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
1329 |
|
✗ |
if (info->use_gvariant) |
1330 |
|
|
{ |
1331 |
|
✗ |
g_value_set_variant (value, variant); |
1332 |
|
|
} |
1333 |
|
|
else |
1334 |
|
|
{ |
1335 |
|
✗ |
if (variant != NULL) |
1336 |
|
✗ |
g_dbus_gvariant_to_gvalue (variant, value); |
1337 |
|
|
} |
1338 |
|
✗ |
if (variant != NULL) |
1339 |
|
✗ |
g_variant_unref (variant); |
1340 |
|
✗ |
} |
1341 |
|
|
|
1342 |
|
|
static void |
1343 |
|
✗ |
gsd_sharing_proxy_set_property_cb (GDBusProxy *proxy, |
1344 |
|
|
GAsyncResult *res, |
1345 |
|
|
gpointer user_data) |
1346 |
|
|
{ |
1347 |
|
✗ |
const _ExtendedGDBusPropertyInfo *info = user_data; |
1348 |
|
|
GError *error; |
1349 |
|
|
GVariant *_ret; |
1350 |
|
✗ |
error = NULL; |
1351 |
|
✗ |
_ret = g_dbus_proxy_call_finish (proxy, res, &error); |
1352 |
|
✗ |
if (!_ret) |
1353 |
|
|
{ |
1354 |
|
✗ |
g_warning ("Error setting property '%s' on interface org.gnome.SettingsDaemon.Sharing: %s (%s, %d)", |
1355 |
|
|
info->parent_struct.name, |
1356 |
|
|
error->message, g_quark_to_string (error->domain), error->code); |
1357 |
|
✗ |
g_error_free (error); |
1358 |
|
|
} |
1359 |
|
|
else |
1360 |
|
|
{ |
1361 |
|
✗ |
g_variant_unref (_ret); |
1362 |
|
|
} |
1363 |
|
✗ |
} |
1364 |
|
|
|
1365 |
|
|
static void |
1366 |
|
✗ |
gsd_sharing_proxy_set_property (GObject *object, |
1367 |
|
|
guint prop_id, |
1368 |
|
|
const GValue *value, |
1369 |
|
|
GParamSpec *pspec G_GNUC_UNUSED) |
1370 |
|
|
{ |
1371 |
|
|
const _ExtendedGDBusPropertyInfo *info; |
1372 |
|
|
GVariant *variant; |
1373 |
|
✗ |
g_assert (prop_id != 0 && prop_id - 1 < 4); |
1374 |
|
✗ |
info = (const _ExtendedGDBusPropertyInfo *) _gsd_sharing_property_info_pointers[prop_id - 1]; |
1375 |
|
✗ |
variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
1376 |
|
✗ |
g_dbus_proxy_call (G_DBUS_PROXY (object), |
1377 |
|
|
"org.freedesktop.DBus.Properties.Set", |
1378 |
|
✗ |
g_variant_new ("(ssv)", "org.gnome.SettingsDaemon.Sharing", info->parent_struct.name, variant), |
1379 |
|
|
G_DBUS_CALL_FLAGS_NONE, |
1380 |
|
|
-1, |
1381 |
|
✗ |
NULL, (GAsyncReadyCallback) gsd_sharing_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
1382 |
|
✗ |
g_variant_unref (variant); |
1383 |
|
✗ |
} |
1384 |
|
|
|
1385 |
|
|
static void |
1386 |
|
✗ |
gsd_sharing_proxy_g_signal (GDBusProxy *proxy, |
1387 |
|
|
const gchar *sender_name G_GNUC_UNUSED, |
1388 |
|
|
const gchar *signal_name, |
1389 |
|
|
GVariant *parameters) |
1390 |
|
|
{ |
1391 |
|
|
_ExtendedGDBusSignalInfo *info; |
1392 |
|
|
GVariantIter iter; |
1393 |
|
|
GVariant *child; |
1394 |
|
|
GValue *paramv; |
1395 |
|
|
gsize num_params; |
1396 |
|
|
gsize n; |
1397 |
|
|
guint signal_id; |
1398 |
|
✗ |
info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gsd_sharing_interface_info.parent_struct, signal_name); |
1399 |
|
✗ |
if (info == NULL) |
1400 |
|
✗ |
return; |
1401 |
|
✗ |
num_params = g_variant_n_children (parameters); |
1402 |
|
✗ |
paramv = g_new0 (GValue, num_params + 1); |
1403 |
|
✗ |
g_value_init (¶mv[0], GSD_TYPE_SHARING); |
1404 |
|
✗ |
g_value_set_object (¶mv[0], proxy); |
1405 |
|
✗ |
g_variant_iter_init (&iter, parameters); |
1406 |
|
✗ |
n = 1; |
1407 |
|
✗ |
while ((child = g_variant_iter_next_value (&iter)) != NULL) |
1408 |
|
|
{ |
1409 |
|
✗ |
_ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
1410 |
|
✗ |
if (arg_info->use_gvariant) |
1411 |
|
|
{ |
1412 |
|
✗ |
g_value_init (¶mv[n], G_TYPE_VARIANT); |
1413 |
|
✗ |
g_value_set_variant (¶mv[n], child); |
1414 |
|
✗ |
n++; |
1415 |
|
|
} |
1416 |
|
|
else |
1417 |
|
✗ |
g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
1418 |
|
✗ |
g_variant_unref (child); |
1419 |
|
|
} |
1420 |
|
✗ |
signal_id = g_signal_lookup (info->signal_name, GSD_TYPE_SHARING); |
1421 |
|
✗ |
g_signal_emitv (paramv, signal_id, 0, NULL); |
1422 |
|
✗ |
for (n = 0; n < num_params + 1; n++) |
1423 |
|
✗ |
g_value_unset (¶mv[n]); |
1424 |
|
✗ |
g_free (paramv); |
1425 |
|
|
} |
1426 |
|
|
|
1427 |
|
|
static void |
1428 |
|
✗ |
gsd_sharing_proxy_g_properties_changed (GDBusProxy *_proxy, |
1429 |
|
|
GVariant *changed_properties, |
1430 |
|
|
const gchar *const *invalidated_properties) |
1431 |
|
|
{ |
1432 |
|
✗ |
GsdSharingProxy *proxy = GSD_SHARING_PROXY (_proxy); |
1433 |
|
|
guint n; |
1434 |
|
|
const gchar *key; |
1435 |
|
|
GVariantIter *iter; |
1436 |
|
|
_ExtendedGDBusPropertyInfo *info; |
1437 |
|
✗ |
g_variant_get (changed_properties, "a{sv}", &iter); |
1438 |
|
✗ |
while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
1439 |
|
|
{ |
1440 |
|
✗ |
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gsd_sharing_interface_info.parent_struct, key); |
1441 |
|
✗ |
g_datalist_remove_data (&proxy->priv->qdata, key); |
1442 |
|
✗ |
if (info != NULL) |
1443 |
|
✗ |
g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
1444 |
|
|
} |
1445 |
|
✗ |
g_variant_iter_free (iter); |
1446 |
|
✗ |
for (n = 0; invalidated_properties[n] != NULL; n++) |
1447 |
|
|
{ |
1448 |
|
✗ |
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gsd_sharing_interface_info.parent_struct, invalidated_properties[n]); |
1449 |
|
✗ |
g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
1450 |
|
✗ |
if (info != NULL) |
1451 |
|
✗ |
g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
1452 |
|
|
} |
1453 |
|
✗ |
} |
1454 |
|
|
|
1455 |
|
|
static const gchar * |
1456 |
|
✗ |
gsd_sharing_proxy_get_current_network_name (GsdSharing *object) |
1457 |
|
|
{ |
1458 |
|
✗ |
GsdSharingProxy *proxy = GSD_SHARING_PROXY (object); |
1459 |
|
|
GVariant *variant; |
1460 |
|
✗ |
const gchar *value = NULL; |
1461 |
|
✗ |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "CurrentNetworkName"); |
1462 |
|
✗ |
if (variant != NULL) |
1463 |
|
|
{ |
1464 |
|
✗ |
value = g_variant_get_string (variant, NULL); |
1465 |
|
✗ |
g_variant_unref (variant); |
1466 |
|
|
} |
1467 |
|
✗ |
return value; |
1468 |
|
|
} |
1469 |
|
|
|
1470 |
|
|
static const gchar * |
1471 |
|
✗ |
gsd_sharing_proxy_get_current_network (GsdSharing *object) |
1472 |
|
|
{ |
1473 |
|
✗ |
GsdSharingProxy *proxy = GSD_SHARING_PROXY (object); |
1474 |
|
|
GVariant *variant; |
1475 |
|
✗ |
const gchar *value = NULL; |
1476 |
|
✗ |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "CurrentNetwork"); |
1477 |
|
✗ |
if (variant != NULL) |
1478 |
|
|
{ |
1479 |
|
✗ |
value = g_variant_get_string (variant, NULL); |
1480 |
|
✗ |
g_variant_unref (variant); |
1481 |
|
|
} |
1482 |
|
✗ |
return value; |
1483 |
|
|
} |
1484 |
|
|
|
1485 |
|
|
static const gchar * |
1486 |
|
✗ |
gsd_sharing_proxy_get_carrier_type (GsdSharing *object) |
1487 |
|
|
{ |
1488 |
|
✗ |
GsdSharingProxy *proxy = GSD_SHARING_PROXY (object); |
1489 |
|
|
GVariant *variant; |
1490 |
|
✗ |
const gchar *value = NULL; |
1491 |
|
✗ |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "CarrierType"); |
1492 |
|
✗ |
if (variant != NULL) |
1493 |
|
|
{ |
1494 |
|
✗ |
value = g_variant_get_string (variant, NULL); |
1495 |
|
✗ |
g_variant_unref (variant); |
1496 |
|
|
} |
1497 |
|
✗ |
return value; |
1498 |
|
|
} |
1499 |
|
|
|
1500 |
|
|
static guint |
1501 |
|
✗ |
gsd_sharing_proxy_get_sharing_status (GsdSharing *object) |
1502 |
|
|
{ |
1503 |
|
✗ |
GsdSharingProxy *proxy = GSD_SHARING_PROXY (object); |
1504 |
|
|
GVariant *variant; |
1505 |
|
✗ |
guint value = 0; |
1506 |
|
✗ |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "SharingStatus"); |
1507 |
|
✗ |
if (variant != NULL) |
1508 |
|
|
{ |
1509 |
|
✗ |
value = g_variant_get_uint32 (variant); |
1510 |
|
✗ |
g_variant_unref (variant); |
1511 |
|
|
} |
1512 |
|
✗ |
return value; |
1513 |
|
|
} |
1514 |
|
|
|
1515 |
|
|
static void |
1516 |
|
✗ |
gsd_sharing_proxy_init (GsdSharingProxy *proxy) |
1517 |
|
|
{ |
1518 |
|
|
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
1519 |
|
✗ |
proxy->priv = gsd_sharing_proxy_get_instance_private (proxy); |
1520 |
|
|
#else |
1521 |
|
|
proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, GSD_TYPE_SHARING_PROXY, GsdSharingProxyPrivate); |
1522 |
|
|
#endif |
1523 |
|
|
|
1524 |
|
✗ |
g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gsd_sharing_interface_info ()); |
1525 |
|
✗ |
} |
1526 |
|
|
|
1527 |
|
|
static void |
1528 |
|
✗ |
gsd_sharing_proxy_class_init (GsdSharingProxyClass *klass) |
1529 |
|
|
{ |
1530 |
|
|
GObjectClass *gobject_class; |
1531 |
|
|
GDBusProxyClass *proxy_class; |
1532 |
|
|
|
1533 |
|
✗ |
gobject_class = G_OBJECT_CLASS (klass); |
1534 |
|
✗ |
gobject_class->finalize = gsd_sharing_proxy_finalize; |
1535 |
|
✗ |
gobject_class->get_property = gsd_sharing_proxy_get_property; |
1536 |
|
✗ |
gobject_class->set_property = gsd_sharing_proxy_set_property; |
1537 |
|
|
|
1538 |
|
✗ |
proxy_class = G_DBUS_PROXY_CLASS (klass); |
1539 |
|
✗ |
proxy_class->g_signal = gsd_sharing_proxy_g_signal; |
1540 |
|
✗ |
proxy_class->g_properties_changed = gsd_sharing_proxy_g_properties_changed; |
1541 |
|
|
|
1542 |
|
✗ |
gsd_sharing_override_properties (gobject_class, 1); |
1543 |
|
|
|
1544 |
|
|
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
1545 |
|
|
g_type_class_add_private (klass, sizeof (GsdSharingProxyPrivate)); |
1546 |
|
|
#endif |
1547 |
|
✗ |
} |
1548 |
|
|
|
1549 |
|
|
static void |
1550 |
|
✗ |
gsd_sharing_proxy_iface_init (GsdSharingIface *iface) |
1551 |
|
|
{ |
1552 |
|
✗ |
iface->get_current_network_name = gsd_sharing_proxy_get_current_network_name; |
1553 |
|
✗ |
iface->get_current_network = gsd_sharing_proxy_get_current_network; |
1554 |
|
✗ |
iface->get_carrier_type = gsd_sharing_proxy_get_carrier_type; |
1555 |
|
✗ |
iface->get_sharing_status = gsd_sharing_proxy_get_sharing_status; |
1556 |
|
✗ |
} |
1557 |
|
|
|
1558 |
|
|
/** |
1559 |
|
|
* gsd_sharing_proxy_new: |
1560 |
|
|
* @connection: A #GDBusConnection. |
1561 |
|
|
* @flags: Flags from the #GDBusProxyFlags enumeration. |
1562 |
|
|
* @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
1563 |
|
|
* @object_path: An object path. |
1564 |
|
|
* @cancellable: (nullable): A #GCancellable or %NULL. |
1565 |
|
|
* @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
1566 |
|
|
* @user_data: User data to pass to @callback. |
1567 |
|
|
* |
1568 |
|
|
* Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-gnome-SettingsDaemon-Sharing.top_of_page">org.gnome.SettingsDaemon.Sharing</link>. See g_dbus_proxy_new() for more details. |
1569 |
|
|
* |
1570 |
|
|
* When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()). |
1571 |
|
|
* You can then call gsd_sharing_proxy_new_finish() to get the result of the operation. |
1572 |
|
|
* |
1573 |
|
|
* See gsd_sharing_proxy_new_sync() for the synchronous, blocking version of this constructor. |
1574 |
|
|
*/ |
1575 |
|
|
void |
1576 |
|
✗ |
gsd_sharing_proxy_new ( |
1577 |
|
|
GDBusConnection *connection, |
1578 |
|
|
GDBusProxyFlags flags, |
1579 |
|
|
const gchar *name, |
1580 |
|
|
const gchar *object_path, |
1581 |
|
|
GCancellable *cancellable, |
1582 |
|
|
GAsyncReadyCallback callback, |
1583 |
|
|
gpointer user_data) |
1584 |
|
|
{ |
1585 |
|
✗ |
g_async_initable_new_async (GSD_TYPE_SHARING_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.gnome.SettingsDaemon.Sharing", NULL); |
1586 |
|
✗ |
} |
1587 |
|
|
|
1588 |
|
|
/** |
1589 |
|
|
* gsd_sharing_proxy_new_finish: |
1590 |
|
|
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gsd_sharing_proxy_new(). |
1591 |
|
|
* @error: Return location for error or %NULL |
1592 |
|
|
* |
1593 |
|
|
* Finishes an operation started with gsd_sharing_proxy_new(). |
1594 |
|
|
* |
1595 |
|
|
* Returns: (transfer full) (type GsdSharingProxy): The constructed proxy object or %NULL if @error is set. |
1596 |
|
|
*/ |
1597 |
|
|
GsdSharing * |
1598 |
|
✗ |
gsd_sharing_proxy_new_finish ( |
1599 |
|
|
GAsyncResult *res, |
1600 |
|
|
GError **error) |
1601 |
|
|
{ |
1602 |
|
|
GObject *ret; |
1603 |
|
|
GObject *source_object; |
1604 |
|
✗ |
source_object = g_async_result_get_source_object (res); |
1605 |
|
✗ |
ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
1606 |
|
✗ |
g_object_unref (source_object); |
1607 |
|
✗ |
if (ret != NULL) |
1608 |
|
✗ |
return GSD_SHARING (ret); |
1609 |
|
|
else |
1610 |
|
✗ |
return NULL; |
1611 |
|
|
} |
1612 |
|
|
|
1613 |
|
|
/** |
1614 |
|
|
* gsd_sharing_proxy_new_sync: |
1615 |
|
|
* @connection: A #GDBusConnection. |
1616 |
|
|
* @flags: Flags from the #GDBusProxyFlags enumeration. |
1617 |
|
|
* @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
1618 |
|
|
* @object_path: An object path. |
1619 |
|
|
* @cancellable: (nullable): A #GCancellable or %NULL. |
1620 |
|
|
* @error: Return location for error or %NULL |
1621 |
|
|
* |
1622 |
|
|
* Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-gnome-SettingsDaemon-Sharing.top_of_page">org.gnome.SettingsDaemon.Sharing</link>. See g_dbus_proxy_new_sync() for more details. |
1623 |
|
|
* |
1624 |
|
|
* The calling thread is blocked until a reply is received. |
1625 |
|
|
* |
1626 |
|
|
* See gsd_sharing_proxy_new() for the asynchronous version of this constructor. |
1627 |
|
|
* |
1628 |
|
|
* Returns: (transfer full) (type GsdSharingProxy): The constructed proxy object or %NULL if @error is set. |
1629 |
|
|
*/ |
1630 |
|
|
GsdSharing * |
1631 |
|
✗ |
gsd_sharing_proxy_new_sync ( |
1632 |
|
|
GDBusConnection *connection, |
1633 |
|
|
GDBusProxyFlags flags, |
1634 |
|
|
const gchar *name, |
1635 |
|
|
const gchar *object_path, |
1636 |
|
|
GCancellable *cancellable, |
1637 |
|
|
GError **error) |
1638 |
|
|
{ |
1639 |
|
|
GInitable *ret; |
1640 |
|
✗ |
ret = g_initable_new (GSD_TYPE_SHARING_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.gnome.SettingsDaemon.Sharing", NULL); |
1641 |
|
✗ |
if (ret != NULL) |
1642 |
|
✗ |
return GSD_SHARING (ret); |
1643 |
|
|
else |
1644 |
|
✗ |
return NULL; |
1645 |
|
|
} |
1646 |
|
|
|
1647 |
|
|
|
1648 |
|
|
/** |
1649 |
|
|
* gsd_sharing_proxy_new_for_bus: |
1650 |
|
|
* @bus_type: A #GBusType. |
1651 |
|
|
* @flags: Flags from the #GDBusProxyFlags enumeration. |
1652 |
|
|
* @name: A bus name (well-known or unique). |
1653 |
|
|
* @object_path: An object path. |
1654 |
|
|
* @cancellable: (nullable): A #GCancellable or %NULL. |
1655 |
|
|
* @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
1656 |
|
|
* @user_data: User data to pass to @callback. |
1657 |
|
|
* |
1658 |
|
|
* Like gsd_sharing_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
1659 |
|
|
* |
1660 |
|
|
* When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()). |
1661 |
|
|
* You can then call gsd_sharing_proxy_new_for_bus_finish() to get the result of the operation. |
1662 |
|
|
* |
1663 |
|
|
* See gsd_sharing_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
1664 |
|
|
*/ |
1665 |
|
|
void |
1666 |
|
✗ |
gsd_sharing_proxy_new_for_bus ( |
1667 |
|
|
GBusType bus_type, |
1668 |
|
|
GDBusProxyFlags flags, |
1669 |
|
|
const gchar *name, |
1670 |
|
|
const gchar *object_path, |
1671 |
|
|
GCancellable *cancellable, |
1672 |
|
|
GAsyncReadyCallback callback, |
1673 |
|
|
gpointer user_data) |
1674 |
|
|
{ |
1675 |
|
✗ |
g_async_initable_new_async (GSD_TYPE_SHARING_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.gnome.SettingsDaemon.Sharing", NULL); |
1676 |
|
✗ |
} |
1677 |
|
|
|
1678 |
|
|
/** |
1679 |
|
|
* gsd_sharing_proxy_new_for_bus_finish: |
1680 |
|
|
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gsd_sharing_proxy_new_for_bus(). |
1681 |
|
|
* @error: Return location for error or %NULL |
1682 |
|
|
* |
1683 |
|
|
* Finishes an operation started with gsd_sharing_proxy_new_for_bus(). |
1684 |
|
|
* |
1685 |
|
|
* Returns: (transfer full) (type GsdSharingProxy): The constructed proxy object or %NULL if @error is set. |
1686 |
|
|
*/ |
1687 |
|
|
GsdSharing * |
1688 |
|
✗ |
gsd_sharing_proxy_new_for_bus_finish ( |
1689 |
|
|
GAsyncResult *res, |
1690 |
|
|
GError **error) |
1691 |
|
|
{ |
1692 |
|
|
GObject *ret; |
1693 |
|
|
GObject *source_object; |
1694 |
|
✗ |
source_object = g_async_result_get_source_object (res); |
1695 |
|
✗ |
ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
1696 |
|
✗ |
g_object_unref (source_object); |
1697 |
|
✗ |
if (ret != NULL) |
1698 |
|
✗ |
return GSD_SHARING (ret); |
1699 |
|
|
else |
1700 |
|
✗ |
return NULL; |
1701 |
|
|
} |
1702 |
|
|
|
1703 |
|
|
/** |
1704 |
|
|
* gsd_sharing_proxy_new_for_bus_sync: |
1705 |
|
|
* @bus_type: A #GBusType. |
1706 |
|
|
* @flags: Flags from the #GDBusProxyFlags enumeration. |
1707 |
|
|
* @name: A bus name (well-known or unique). |
1708 |
|
|
* @object_path: An object path. |
1709 |
|
|
* @cancellable: (nullable): A #GCancellable or %NULL. |
1710 |
|
|
* @error: Return location for error or %NULL |
1711 |
|
|
* |
1712 |
|
|
* Like gsd_sharing_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
1713 |
|
|
* |
1714 |
|
|
* The calling thread is blocked until a reply is received. |
1715 |
|
|
* |
1716 |
|
|
* See gsd_sharing_proxy_new_for_bus() for the asynchronous version of this constructor. |
1717 |
|
|
* |
1718 |
|
|
* Returns: (transfer full) (type GsdSharingProxy): The constructed proxy object or %NULL if @error is set. |
1719 |
|
|
*/ |
1720 |
|
|
GsdSharing * |
1721 |
|
✗ |
gsd_sharing_proxy_new_for_bus_sync ( |
1722 |
|
|
GBusType bus_type, |
1723 |
|
|
GDBusProxyFlags flags, |
1724 |
|
|
const gchar *name, |
1725 |
|
|
const gchar *object_path, |
1726 |
|
|
GCancellable *cancellable, |
1727 |
|
|
GError **error) |
1728 |
|
|
{ |
1729 |
|
|
GInitable *ret; |
1730 |
|
✗ |
ret = g_initable_new (GSD_TYPE_SHARING_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.gnome.SettingsDaemon.Sharing", NULL); |
1731 |
|
✗ |
if (ret != NULL) |
1732 |
|
✗ |
return GSD_SHARING (ret); |
1733 |
|
|
else |
1734 |
|
✗ |
return NULL; |
1735 |
|
|
} |
1736 |
|
|
|
1737 |
|
|
|
1738 |
|
|
/* ------------------------------------------------------------------------ */ |
1739 |
|
|
|
1740 |
|
|
/** |
1741 |
|
|
* GsdSharingSkeleton: |
1742 |
|
|
* |
1743 |
|
|
* The #GsdSharingSkeleton structure contains only private data and should only be accessed using the provided API. |
1744 |
|
|
*/ |
1745 |
|
|
|
1746 |
|
|
/** |
1747 |
|
|
* GsdSharingSkeletonClass: |
1748 |
|
|
* @parent_class: The parent class. |
1749 |
|
|
* |
1750 |
|
|
* Class structure for #GsdSharingSkeleton. |
1751 |
|
|
*/ |
1752 |
|
|
|
1753 |
|
|
struct _GsdSharingSkeletonPrivate |
1754 |
|
|
{ |
1755 |
|
|
GValue *properties; |
1756 |
|
|
GList *changed_properties; |
1757 |
|
|
GSource *changed_properties_idle_source; |
1758 |
|
|
GMainContext *context; |
1759 |
|
|
GMutex lock; |
1760 |
|
|
}; |
1761 |
|
|
|
1762 |
|
|
static void |
1763 |
|
✗ |
_gsd_sharing_skeleton_handle_method_call ( |
1764 |
|
|
GDBusConnection *connection G_GNUC_UNUSED, |
1765 |
|
|
const gchar *sender G_GNUC_UNUSED, |
1766 |
|
|
const gchar *object_path G_GNUC_UNUSED, |
1767 |
|
|
const gchar *interface_name, |
1768 |
|
|
const gchar *method_name, |
1769 |
|
|
GVariant *parameters, |
1770 |
|
|
GDBusMethodInvocation *invocation, |
1771 |
|
|
gpointer user_data) |
1772 |
|
|
{ |
1773 |
|
✗ |
GsdSharingSkeleton *skeleton = GSD_SHARING_SKELETON (user_data); |
1774 |
|
|
_ExtendedGDBusMethodInfo *info; |
1775 |
|
|
GVariantIter iter; |
1776 |
|
|
GVariant *child; |
1777 |
|
|
GValue *paramv; |
1778 |
|
|
gsize num_params; |
1779 |
|
|
guint num_extra; |
1780 |
|
|
gsize n; |
1781 |
|
|
guint signal_id; |
1782 |
|
✗ |
GValue return_value = G_VALUE_INIT; |
1783 |
|
✗ |
info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
1784 |
|
✗ |
g_assert (info != NULL); |
1785 |
|
✗ |
num_params = g_variant_n_children (parameters); |
1786 |
|
✗ |
num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
1787 |
|
✗ |
n = 0; |
1788 |
|
✗ |
g_value_init (¶mv[n], GSD_TYPE_SHARING); |
1789 |
|
✗ |
g_value_set_object (¶mv[n++], skeleton); |
1790 |
|
✗ |
g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
1791 |
|
✗ |
g_value_set_object (¶mv[n++], invocation); |
1792 |
|
✗ |
if (info->pass_fdlist) |
1793 |
|
|
{ |
1794 |
|
|
#ifdef G_OS_UNIX |
1795 |
|
✗ |
g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
1796 |
|
✗ |
g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
1797 |
|
|
#else |
1798 |
|
|
g_assert_not_reached (); |
1799 |
|
|
#endif |
1800 |
|
|
} |
1801 |
|
✗ |
g_variant_iter_init (&iter, parameters); |
1802 |
|
✗ |
while ((child = g_variant_iter_next_value (&iter)) != NULL) |
1803 |
|
|
{ |
1804 |
|
✗ |
_ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
1805 |
|
✗ |
if (arg_info->use_gvariant) |
1806 |
|
|
{ |
1807 |
|
✗ |
g_value_init (¶mv[n], G_TYPE_VARIANT); |
1808 |
|
✗ |
g_value_set_variant (¶mv[n], child); |
1809 |
|
✗ |
n++; |
1810 |
|
|
} |
1811 |
|
|
else |
1812 |
|
✗ |
g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
1813 |
|
✗ |
g_variant_unref (child); |
1814 |
|
|
} |
1815 |
|
✗ |
signal_id = g_signal_lookup (info->signal_name, GSD_TYPE_SHARING); |
1816 |
|
✗ |
g_value_init (&return_value, G_TYPE_BOOLEAN); |
1817 |
|
✗ |
g_signal_emitv (paramv, signal_id, 0, &return_value); |
1818 |
|
✗ |
if (!g_value_get_boolean (&return_value)) |
1819 |
|
✗ |
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name); |
1820 |
|
✗ |
g_value_unset (&return_value); |
1821 |
|
✗ |
for (n = 0; n < num_params + num_extra; n++) |
1822 |
|
✗ |
g_value_unset (¶mv[n]); |
1823 |
|
✗ |
g_free (paramv); |
1824 |
|
✗ |
} |
1825 |
|
|
|
1826 |
|
|
static GVariant * |
1827 |
|
✗ |
_gsd_sharing_skeleton_handle_get_property ( |
1828 |
|
|
GDBusConnection *connection G_GNUC_UNUSED, |
1829 |
|
|
const gchar *sender G_GNUC_UNUSED, |
1830 |
|
|
const gchar *object_path G_GNUC_UNUSED, |
1831 |
|
|
const gchar *interface_name G_GNUC_UNUSED, |
1832 |
|
|
const gchar *property_name, |
1833 |
|
|
GError **error, |
1834 |
|
|
gpointer user_data) |
1835 |
|
|
{ |
1836 |
|
✗ |
GsdSharingSkeleton *skeleton = GSD_SHARING_SKELETON (user_data); |
1837 |
|
✗ |
GValue value = G_VALUE_INIT; |
1838 |
|
|
GParamSpec *pspec; |
1839 |
|
|
_ExtendedGDBusPropertyInfo *info; |
1840 |
|
|
GVariant *ret; |
1841 |
|
✗ |
ret = NULL; |
1842 |
|
✗ |
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gsd_sharing_interface_info.parent_struct, property_name); |
1843 |
|
✗ |
g_assert (info != NULL); |
1844 |
|
✗ |
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
1845 |
|
✗ |
if (pspec == NULL) |
1846 |
|
|
{ |
1847 |
|
✗ |
g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
1848 |
|
|
} |
1849 |
|
|
else |
1850 |
|
|
{ |
1851 |
|
✗ |
g_value_init (&value, pspec->value_type); |
1852 |
|
✗ |
g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
1853 |
|
✗ |
ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
1854 |
|
✗ |
g_value_unset (&value); |
1855 |
|
|
} |
1856 |
|
✗ |
return ret; |
1857 |
|
|
} |
1858 |
|
|
|
1859 |
|
|
static gboolean |
1860 |
|
✗ |
_gsd_sharing_skeleton_handle_set_property ( |
1861 |
|
|
GDBusConnection *connection G_GNUC_UNUSED, |
1862 |
|
|
const gchar *sender G_GNUC_UNUSED, |
1863 |
|
|
const gchar *object_path G_GNUC_UNUSED, |
1864 |
|
|
const gchar *interface_name G_GNUC_UNUSED, |
1865 |
|
|
const gchar *property_name, |
1866 |
|
|
GVariant *variant, |
1867 |
|
|
GError **error, |
1868 |
|
|
gpointer user_data) |
1869 |
|
|
{ |
1870 |
|
✗ |
GsdSharingSkeleton *skeleton = GSD_SHARING_SKELETON (user_data); |
1871 |
|
✗ |
GValue value = G_VALUE_INIT; |
1872 |
|
|
GParamSpec *pspec; |
1873 |
|
|
_ExtendedGDBusPropertyInfo *info; |
1874 |
|
|
gboolean ret; |
1875 |
|
✗ |
ret = FALSE; |
1876 |
|
✗ |
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gsd_sharing_interface_info.parent_struct, property_name); |
1877 |
|
✗ |
g_assert (info != NULL); |
1878 |
|
✗ |
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
1879 |
|
✗ |
if (pspec == NULL) |
1880 |
|
|
{ |
1881 |
|
✗ |
g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
1882 |
|
|
} |
1883 |
|
|
else |
1884 |
|
|
{ |
1885 |
|
✗ |
if (info->use_gvariant) |
1886 |
|
✗ |
g_value_set_variant (&value, variant); |
1887 |
|
|
else |
1888 |
|
✗ |
g_dbus_gvariant_to_gvalue (variant, &value); |
1889 |
|
✗ |
g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
1890 |
|
✗ |
g_value_unset (&value); |
1891 |
|
✗ |
ret = TRUE; |
1892 |
|
|
} |
1893 |
|
✗ |
return ret; |
1894 |
|
|
} |
1895 |
|
|
|
1896 |
|
|
static const GDBusInterfaceVTable _gsd_sharing_skeleton_vtable = |
1897 |
|
|
{ |
1898 |
|
|
_gsd_sharing_skeleton_handle_method_call, |
1899 |
|
|
_gsd_sharing_skeleton_handle_get_property, |
1900 |
|
|
_gsd_sharing_skeleton_handle_set_property, |
1901 |
|
|
{NULL} |
1902 |
|
|
}; |
1903 |
|
|
|
1904 |
|
|
static GDBusInterfaceInfo * |
1905 |
|
✗ |
gsd_sharing_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
1906 |
|
|
{ |
1907 |
|
✗ |
return gsd_sharing_interface_info (); |
1908 |
|
|
} |
1909 |
|
|
|
1910 |
|
|
static GDBusInterfaceVTable * |
1911 |
|
✗ |
gsd_sharing_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
1912 |
|
|
{ |
1913 |
|
✗ |
return (GDBusInterfaceVTable *) &_gsd_sharing_skeleton_vtable; |
1914 |
|
|
} |
1915 |
|
|
|
1916 |
|
|
static GVariant * |
1917 |
|
✗ |
gsd_sharing_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
1918 |
|
|
{ |
1919 |
|
✗ |
GsdSharingSkeleton *skeleton = GSD_SHARING_SKELETON (_skeleton); |
1920 |
|
|
|
1921 |
|
|
GVariantBuilder builder; |
1922 |
|
|
guint n; |
1923 |
|
✗ |
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
1924 |
|
✗ |
if (_gsd_sharing_interface_info.parent_struct.properties == NULL) |
1925 |
|
✗ |
goto out; |
1926 |
|
✗ |
for (n = 0; _gsd_sharing_interface_info.parent_struct.properties[n] != NULL; n++) |
1927 |
|
|
{ |
1928 |
|
✗ |
GDBusPropertyInfo *info = _gsd_sharing_interface_info.parent_struct.properties[n]; |
1929 |
|
✗ |
if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
1930 |
|
|
{ |
1931 |
|
|
GVariant *value; |
1932 |
|
✗ |
value = _gsd_sharing_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.gnome.SettingsDaemon.Sharing", info->name, NULL, skeleton); |
1933 |
|
✗ |
if (value != NULL) |
1934 |
|
|
{ |
1935 |
|
✗ |
g_variant_take_ref (value); |
1936 |
|
✗ |
g_variant_builder_add (&builder, "{sv}", info->name, value); |
1937 |
|
✗ |
g_variant_unref (value); |
1938 |
|
|
} |
1939 |
|
|
} |
1940 |
|
|
} |
1941 |
|
✗ |
out: |
1942 |
|
✗ |
return g_variant_builder_end (&builder); |
1943 |
|
|
} |
1944 |
|
|
|
1945 |
|
|
static gboolean _gsd_sharing_emit_changed (gpointer user_data); |
1946 |
|
|
|
1947 |
|
|
static void |
1948 |
|
✗ |
gsd_sharing_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
1949 |
|
|
{ |
1950 |
|
✗ |
GsdSharingSkeleton *skeleton = GSD_SHARING_SKELETON (_skeleton); |
1951 |
|
✗ |
gboolean emit_changed = FALSE; |
1952 |
|
|
|
1953 |
|
✗ |
g_mutex_lock (&skeleton->priv->lock); |
1954 |
|
✗ |
if (skeleton->priv->changed_properties_idle_source != NULL) |
1955 |
|
|
{ |
1956 |
|
✗ |
g_source_destroy (skeleton->priv->changed_properties_idle_source); |
1957 |
|
✗ |
skeleton->priv->changed_properties_idle_source = NULL; |
1958 |
|
✗ |
emit_changed = TRUE; |
1959 |
|
|
} |
1960 |
|
✗ |
g_mutex_unlock (&skeleton->priv->lock); |
1961 |
|
|
|
1962 |
|
✗ |
if (emit_changed) |
1963 |
|
✗ |
_gsd_sharing_emit_changed (skeleton); |
1964 |
|
✗ |
} |
1965 |
|
|
|
1966 |
|
|
static void gsd_sharing_skeleton_iface_init (GsdSharingIface *iface); |
1967 |
|
|
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
1968 |
|
✗ |
G_DEFINE_TYPE_WITH_CODE (GsdSharingSkeleton, gsd_sharing_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
1969 |
|
|
G_ADD_PRIVATE (GsdSharingSkeleton) |
1970 |
|
|
G_IMPLEMENT_INTERFACE (GSD_TYPE_SHARING, gsd_sharing_skeleton_iface_init)) |
1971 |
|
|
|
1972 |
|
|
#else |
1973 |
|
|
G_DEFINE_TYPE_WITH_CODE (GsdSharingSkeleton, gsd_sharing_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
1974 |
|
|
G_IMPLEMENT_INTERFACE (GSD_TYPE_SHARING, gsd_sharing_skeleton_iface_init)) |
1975 |
|
|
|
1976 |
|
|
#endif |
1977 |
|
|
static void |
1978 |
|
✗ |
gsd_sharing_skeleton_finalize (GObject *object) |
1979 |
|
|
{ |
1980 |
|
✗ |
GsdSharingSkeleton *skeleton = GSD_SHARING_SKELETON (object); |
1981 |
|
|
guint n; |
1982 |
|
✗ |
for (n = 0; n < 4; n++) |
1983 |
|
✗ |
g_value_unset (&skeleton->priv->properties[n]); |
1984 |
|
✗ |
g_free (skeleton->priv->properties); |
1985 |
|
✗ |
g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
1986 |
|
✗ |
if (skeleton->priv->changed_properties_idle_source != NULL) |
1987 |
|
✗ |
g_source_destroy (skeleton->priv->changed_properties_idle_source); |
1988 |
|
✗ |
g_main_context_unref (skeleton->priv->context); |
1989 |
|
✗ |
g_mutex_clear (&skeleton->priv->lock); |
1990 |
|
✗ |
G_OBJECT_CLASS (gsd_sharing_skeleton_parent_class)->finalize (object); |
1991 |
|
✗ |
} |
1992 |
|
|
|
1993 |
|
|
static void |
1994 |
|
✗ |
gsd_sharing_skeleton_get_property (GObject *object, |
1995 |
|
|
guint prop_id, |
1996 |
|
|
GValue *value, |
1997 |
|
|
GParamSpec *pspec G_GNUC_UNUSED) |
1998 |
|
|
{ |
1999 |
|
✗ |
GsdSharingSkeleton *skeleton = GSD_SHARING_SKELETON (object); |
2000 |
|
✗ |
g_assert (prop_id != 0 && prop_id - 1 < 4); |
2001 |
|
✗ |
g_mutex_lock (&skeleton->priv->lock); |
2002 |
|
✗ |
g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
2003 |
|
✗ |
g_mutex_unlock (&skeleton->priv->lock); |
2004 |
|
✗ |
} |
2005 |
|
|
|
2006 |
|
|
static gboolean |
2007 |
|
✗ |
_gsd_sharing_emit_changed (gpointer user_data) |
2008 |
|
|
{ |
2009 |
|
✗ |
GsdSharingSkeleton *skeleton = GSD_SHARING_SKELETON (user_data); |
2010 |
|
|
GList *l; |
2011 |
|
|
GVariantBuilder builder; |
2012 |
|
|
GVariantBuilder invalidated_builder; |
2013 |
|
|
guint num_changes; |
2014 |
|
|
|
2015 |
|
✗ |
g_mutex_lock (&skeleton->priv->lock); |
2016 |
|
✗ |
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
2017 |
|
✗ |
g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
2018 |
|
✗ |
for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
2019 |
|
|
{ |
2020 |
|
✗ |
ChangedProperty *cp = l->data; |
2021 |
|
|
GVariant *variant; |
2022 |
|
|
const GValue *cur_value; |
2023 |
|
|
|
2024 |
|
✗ |
cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
2025 |
|
✗ |
if (!_g_value_equal (cur_value, &cp->orig_value)) |
2026 |
|
|
{ |
2027 |
|
✗ |
variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
2028 |
|
✗ |
g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
2029 |
|
✗ |
g_variant_unref (variant); |
2030 |
|
✗ |
num_changes++; |
2031 |
|
|
} |
2032 |
|
|
} |
2033 |
|
✗ |
if (num_changes > 0) |
2034 |
|
|
{ |
2035 |
|
|
GList *connections, *ll; |
2036 |
|
|
GVariant *signal_variant; |
2037 |
|
✗ |
signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.gnome.SettingsDaemon.Sharing", |
2038 |
|
|
&builder, &invalidated_builder)); |
2039 |
|
✗ |
connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
2040 |
|
✗ |
for (ll = connections; ll != NULL; ll = ll->next) |
2041 |
|
|
{ |
2042 |
|
✗ |
GDBusConnection *connection = ll->data; |
2043 |
|
|
|
2044 |
|
✗ |
g_dbus_connection_emit_signal (connection, |
2045 |
|
✗ |
NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
2046 |
|
|
"org.freedesktop.DBus.Properties", |
2047 |
|
|
"PropertiesChanged", |
2048 |
|
|
signal_variant, |
2049 |
|
|
NULL); |
2050 |
|
|
} |
2051 |
|
✗ |
g_variant_unref (signal_variant); |
2052 |
|
✗ |
g_list_free_full (connections, g_object_unref); |
2053 |
|
|
} |
2054 |
|
|
else |
2055 |
|
|
{ |
2056 |
|
✗ |
g_variant_builder_clear (&builder); |
2057 |
|
✗ |
g_variant_builder_clear (&invalidated_builder); |
2058 |
|
|
} |
2059 |
|
✗ |
g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
2060 |
|
✗ |
skeleton->priv->changed_properties = NULL; |
2061 |
|
✗ |
skeleton->priv->changed_properties_idle_source = NULL; |
2062 |
|
✗ |
g_mutex_unlock (&skeleton->priv->lock); |
2063 |
|
✗ |
return FALSE; |
2064 |
|
|
} |
2065 |
|
|
|
2066 |
|
|
static void |
2067 |
|
✗ |
_gsd_sharing_schedule_emit_changed (GsdSharingSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
2068 |
|
|
{ |
2069 |
|
|
ChangedProperty *cp; |
2070 |
|
|
GList *l; |
2071 |
|
✗ |
cp = NULL; |
2072 |
|
✗ |
for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
2073 |
|
|
{ |
2074 |
|
✗ |
ChangedProperty *i_cp = l->data; |
2075 |
|
✗ |
if (i_cp->info == info) |
2076 |
|
|
{ |
2077 |
|
✗ |
cp = i_cp; |
2078 |
|
✗ |
break; |
2079 |
|
|
} |
2080 |
|
|
} |
2081 |
|
✗ |
if (cp == NULL) |
2082 |
|
|
{ |
2083 |
|
✗ |
cp = g_new0 (ChangedProperty, 1); |
2084 |
|
✗ |
cp->prop_id = prop_id; |
2085 |
|
✗ |
cp->info = info; |
2086 |
|
✗ |
skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
2087 |
|
✗ |
g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
2088 |
|
✗ |
g_value_copy (orig_value, &cp->orig_value); |
2089 |
|
|
} |
2090 |
|
✗ |
} |
2091 |
|
|
|
2092 |
|
|
static void |
2093 |
|
✗ |
gsd_sharing_skeleton_notify (GObject *object, |
2094 |
|
|
GParamSpec *pspec G_GNUC_UNUSED) |
2095 |
|
|
{ |
2096 |
|
✗ |
GsdSharingSkeleton *skeleton = GSD_SHARING_SKELETON (object); |
2097 |
|
✗ |
g_mutex_lock (&skeleton->priv->lock); |
2098 |
|
✗ |
if (skeleton->priv->changed_properties != NULL && |
2099 |
|
✗ |
skeleton->priv->changed_properties_idle_source == NULL) |
2100 |
|
|
{ |
2101 |
|
✗ |
skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
2102 |
|
✗ |
g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
2103 |
|
✗ |
g_source_set_callback (skeleton->priv->changed_properties_idle_source, _gsd_sharing_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
2104 |
|
✗ |
g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _gsd_sharing_emit_changed"); |
2105 |
|
✗ |
g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
2106 |
|
✗ |
g_source_unref (skeleton->priv->changed_properties_idle_source); |
2107 |
|
|
} |
2108 |
|
✗ |
g_mutex_unlock (&skeleton->priv->lock); |
2109 |
|
✗ |
} |
2110 |
|
|
|
2111 |
|
|
static void |
2112 |
|
✗ |
gsd_sharing_skeleton_set_property (GObject *object, |
2113 |
|
|
guint prop_id, |
2114 |
|
|
const GValue *value, |
2115 |
|
|
GParamSpec *pspec) |
2116 |
|
|
{ |
2117 |
|
|
const _ExtendedGDBusPropertyInfo *info; |
2118 |
|
✗ |
GsdSharingSkeleton *skeleton = GSD_SHARING_SKELETON (object); |
2119 |
|
✗ |
g_assert (prop_id != 0 && prop_id - 1 < 4); |
2120 |
|
✗ |
info = (const _ExtendedGDBusPropertyInfo *) _gsd_sharing_property_info_pointers[prop_id - 1]; |
2121 |
|
✗ |
g_mutex_lock (&skeleton->priv->lock); |
2122 |
|
✗ |
g_object_freeze_notify (object); |
2123 |
|
✗ |
if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
2124 |
|
|
{ |
2125 |
|
✗ |
if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL && |
2126 |
|
|
info->emits_changed_signal) |
2127 |
|
✗ |
_gsd_sharing_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]); |
2128 |
|
✗ |
g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
2129 |
|
✗ |
g_object_notify_by_pspec (object, pspec); |
2130 |
|
|
} |
2131 |
|
✗ |
g_mutex_unlock (&skeleton->priv->lock); |
2132 |
|
✗ |
g_object_thaw_notify (object); |
2133 |
|
✗ |
} |
2134 |
|
|
|
2135 |
|
|
static void |
2136 |
|
✗ |
gsd_sharing_skeleton_init (GsdSharingSkeleton *skeleton) |
2137 |
|
|
{ |
2138 |
|
|
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
2139 |
|
✗ |
skeleton->priv = gsd_sharing_skeleton_get_instance_private (skeleton); |
2140 |
|
|
#else |
2141 |
|
|
skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, GSD_TYPE_SHARING_SKELETON, GsdSharingSkeletonPrivate); |
2142 |
|
|
#endif |
2143 |
|
|
|
2144 |
|
✗ |
g_mutex_init (&skeleton->priv->lock); |
2145 |
|
✗ |
skeleton->priv->context = g_main_context_ref_thread_default (); |
2146 |
|
✗ |
skeleton->priv->properties = g_new0 (GValue, 4); |
2147 |
|
✗ |
g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); |
2148 |
|
✗ |
g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
2149 |
|
✗ |
g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); |
2150 |
|
✗ |
g_value_init (&skeleton->priv->properties[3], G_TYPE_UINT); |
2151 |
|
✗ |
} |
2152 |
|
|
|
2153 |
|
|
static const gchar * |
2154 |
|
✗ |
gsd_sharing_skeleton_get_current_network_name (GsdSharing *object) |
2155 |
|
|
{ |
2156 |
|
✗ |
GsdSharingSkeleton *skeleton = GSD_SHARING_SKELETON (object); |
2157 |
|
|
const gchar *value; |
2158 |
|
✗ |
g_mutex_lock (&skeleton->priv->lock); |
2159 |
|
✗ |
value = g_marshal_value_peek_string (&(skeleton->priv->properties[0])); |
2160 |
|
✗ |
g_mutex_unlock (&skeleton->priv->lock); |
2161 |
|
✗ |
return value; |
2162 |
|
|
} |
2163 |
|
|
|
2164 |
|
|
static const gchar * |
2165 |
|
✗ |
gsd_sharing_skeleton_get_current_network (GsdSharing *object) |
2166 |
|
|
{ |
2167 |
|
✗ |
GsdSharingSkeleton *skeleton = GSD_SHARING_SKELETON (object); |
2168 |
|
|
const gchar *value; |
2169 |
|
✗ |
g_mutex_lock (&skeleton->priv->lock); |
2170 |
|
✗ |
value = g_marshal_value_peek_string (&(skeleton->priv->properties[1])); |
2171 |
|
✗ |
g_mutex_unlock (&skeleton->priv->lock); |
2172 |
|
✗ |
return value; |
2173 |
|
|
} |
2174 |
|
|
|
2175 |
|
|
static const gchar * |
2176 |
|
✗ |
gsd_sharing_skeleton_get_carrier_type (GsdSharing *object) |
2177 |
|
|
{ |
2178 |
|
✗ |
GsdSharingSkeleton *skeleton = GSD_SHARING_SKELETON (object); |
2179 |
|
|
const gchar *value; |
2180 |
|
✗ |
g_mutex_lock (&skeleton->priv->lock); |
2181 |
|
✗ |
value = g_marshal_value_peek_string (&(skeleton->priv->properties[2])); |
2182 |
|
✗ |
g_mutex_unlock (&skeleton->priv->lock); |
2183 |
|
✗ |
return value; |
2184 |
|
|
} |
2185 |
|
|
|
2186 |
|
|
static guint |
2187 |
|
✗ |
gsd_sharing_skeleton_get_sharing_status (GsdSharing *object) |
2188 |
|
|
{ |
2189 |
|
✗ |
GsdSharingSkeleton *skeleton = GSD_SHARING_SKELETON (object); |
2190 |
|
|
guint value; |
2191 |
|
✗ |
g_mutex_lock (&skeleton->priv->lock); |
2192 |
|
✗ |
value = g_marshal_value_peek_uint (&(skeleton->priv->properties[3])); |
2193 |
|
✗ |
g_mutex_unlock (&skeleton->priv->lock); |
2194 |
|
✗ |
return value; |
2195 |
|
|
} |
2196 |
|
|
|
2197 |
|
|
static void |
2198 |
|
✗ |
gsd_sharing_skeleton_class_init (GsdSharingSkeletonClass *klass) |
2199 |
|
|
{ |
2200 |
|
|
GObjectClass *gobject_class; |
2201 |
|
|
GDBusInterfaceSkeletonClass *skeleton_class; |
2202 |
|
|
|
2203 |
|
✗ |
gobject_class = G_OBJECT_CLASS (klass); |
2204 |
|
✗ |
gobject_class->finalize = gsd_sharing_skeleton_finalize; |
2205 |
|
✗ |
gobject_class->get_property = gsd_sharing_skeleton_get_property; |
2206 |
|
✗ |
gobject_class->set_property = gsd_sharing_skeleton_set_property; |
2207 |
|
✗ |
gobject_class->notify = gsd_sharing_skeleton_notify; |
2208 |
|
|
|
2209 |
|
|
|
2210 |
|
✗ |
gsd_sharing_override_properties (gobject_class, 1); |
2211 |
|
|
|
2212 |
|
✗ |
skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
2213 |
|
✗ |
skeleton_class->get_info = gsd_sharing_skeleton_dbus_interface_get_info; |
2214 |
|
✗ |
skeleton_class->get_properties = gsd_sharing_skeleton_dbus_interface_get_properties; |
2215 |
|
✗ |
skeleton_class->flush = gsd_sharing_skeleton_dbus_interface_flush; |
2216 |
|
✗ |
skeleton_class->get_vtable = gsd_sharing_skeleton_dbus_interface_get_vtable; |
2217 |
|
|
|
2218 |
|
|
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
2219 |
|
|
g_type_class_add_private (klass, sizeof (GsdSharingSkeletonPrivate)); |
2220 |
|
|
#endif |
2221 |
|
✗ |
} |
2222 |
|
|
|
2223 |
|
|
static void |
2224 |
|
✗ |
gsd_sharing_skeleton_iface_init (GsdSharingIface *iface) |
2225 |
|
|
{ |
2226 |
|
✗ |
iface->get_current_network_name = gsd_sharing_skeleton_get_current_network_name; |
2227 |
|
✗ |
iface->get_current_network = gsd_sharing_skeleton_get_current_network; |
2228 |
|
✗ |
iface->get_carrier_type = gsd_sharing_skeleton_get_carrier_type; |
2229 |
|
✗ |
iface->get_sharing_status = gsd_sharing_skeleton_get_sharing_status; |
2230 |
|
✗ |
} |
2231 |
|
|
|
2232 |
|
|
/** |
2233 |
|
|
* gsd_sharing_skeleton_new: |
2234 |
|
|
* |
2235 |
|
|
* Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-gnome-SettingsDaemon-Sharing.top_of_page">org.gnome.SettingsDaemon.Sharing</link>. |
2236 |
|
|
* |
2237 |
|
|
* Returns: (transfer full) (type GsdSharingSkeleton): The skeleton object. |
2238 |
|
|
*/ |
2239 |
|
|
GsdSharing * |
2240 |
|
✗ |
gsd_sharing_skeleton_new (void) |
2241 |
|
|
{ |
2242 |
|
✗ |
return GSD_SHARING (g_object_new (GSD_TYPE_SHARING_SKELETON, NULL)); |
2243 |
|
|
} |
2244 |
|
|
|
2245 |
|
|
|