~cairo-dock-team/ubuntu/oneiric/cairo-dock/2.3.0-3

« back to all changes in this revision

Viewing changes to src/gldit/cairo-dock-dbus.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-09 23:26:12 UTC
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20100809232612-pocdxliaxjdetm37
Tags: upstream-2.2.0~0beta4
ImportĀ upstreamĀ versionĀ 2.2.0~0beta4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
* This file is a part of the Cairo-Dock project
 
3
*
 
4
* Copyright : (C) see the 'copyright' file.
 
5
* E-mail    : see the 'copyright' file.
 
6
*
 
7
* This program is free software; you can redistribute it and/or
 
8
* modify it under the terms of the GNU General Public License
 
9
* as published by the Free Software Foundation; either version 3
 
10
* of the License, or (at your option) any later version.
 
11
*
 
12
* This program is distributed in the hope that it will be useful,
 
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
* GNU General Public License for more details.
 
16
* You should have received a copy of the GNU General Public License
 
17
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
*/
 
19
 
 
20
#include <string.h>
 
21
#include <glib.h>
 
22
 
 
23
#include "cairo-dock-log.h"
 
24
#include "cairo-dock-dbus.h"
 
25
 
 
26
static DBusGConnection *s_pSessionConnexion = NULL;
 
27
static DBusGConnection *s_pSystemConnexion = NULL;
 
28
static DBusGProxy *s_pDBusSessionProxy = NULL;
 
29
static DBusGProxy *s_pDBusSystemProxy = NULL;
 
30
 
 
31
 
 
32
DBusGConnection *cairo_dock_get_session_connection (void)
 
33
{
 
34
        if (s_pSessionConnexion == NULL)
 
35
        {
 
36
                GError *erreur = NULL;
 
37
                s_pSessionConnexion = dbus_g_bus_get (DBUS_BUS_SESSION, &erreur);
 
38
                if (erreur != NULL)
 
39
                {
 
40
                        cd_warning (erreur->message);
 
41
                        g_error_free (erreur);
 
42
                        s_pSessionConnexion = NULL;
 
43
                }
 
44
        }
 
45
        return s_pSessionConnexion;
 
46
}
 
47
 
 
48
DBusGConnection *cairo_dock_get_system_connection (void)
 
49
{
 
50
        if (s_pSystemConnexion == NULL)
 
51
        {
 
52
                GError *erreur = NULL;
 
53
                s_pSystemConnexion = dbus_g_bus_get (DBUS_BUS_SYSTEM, &erreur);
 
54
                if (erreur != NULL)
 
55
                {
 
56
                        cd_warning (erreur->message);
 
57
                        g_error_free (erreur);
 
58
                        s_pSystemConnexion = NULL;
 
59
                }
 
60
        }
 
61
        return s_pSystemConnexion;
 
62
}
 
63
 
 
64
DBusGProxy *cairo_dock_get_main_proxy (void)
 
65
{
 
66
        if (s_pDBusSessionProxy == NULL)
 
67
        {
 
68
                s_pDBusSessionProxy = cairo_dock_create_new_session_proxy (DBUS_SERVICE_DBUS,
 
69
                        DBUS_PATH_DBUS,
 
70
                        DBUS_INTERFACE_DBUS);
 
71
        }
 
72
        return s_pDBusSessionProxy;
 
73
}
 
74
 
 
75
DBusGProxy *cairo_dock_get_main_system_proxy (void)
 
76
{
 
77
        if (s_pDBusSystemProxy == NULL)
 
78
        {
 
79
                s_pDBusSystemProxy = cairo_dock_create_new_system_proxy (DBUS_SERVICE_DBUS,
 
80
                        DBUS_PATH_DBUS,
 
81
                        DBUS_INTERFACE_DBUS);
 
82
        } 
 
83
        return s_pDBusSystemProxy;
 
84
}
 
85
 
 
86
void cairo_dock_register_service_name (const gchar *cServiceName)
 
87
{
 
88
        DBusGProxy *pProxy = cairo_dock_get_main_proxy ();
 
89
        if (pProxy == NULL)
 
90
                return ;
 
91
        GError *erreur = NULL;
 
92
        int request_ret;
 
93
        org_freedesktop_DBus_request_name (pProxy, cServiceName, 0, &request_ret, &erreur);
 
94
        if (erreur != NULL)
 
95
        {
 
96
                cd_warning ("Unable to register service: %s", erreur->message);
 
97
                g_error_free (erreur);
 
98
        }
 
99
}
 
100
 
 
101
 
 
102
gboolean cairo_dock_dbus_is_enabled (void)
 
103
{
 
104
        return (cairo_dock_get_session_connection () != NULL && cairo_dock_get_system_connection () != NULL);
 
105
}
 
106
 
 
107
 
 
108
DBusGProxy *cairo_dock_create_new_session_proxy (const char *name, const char *path, const char *interface)
 
109
{
 
110
        DBusGConnection *pConnection = cairo_dock_get_session_connection ();
 
111
        if (pConnection != NULL)
 
112
                return dbus_g_proxy_new_for_name (
 
113
                        pConnection,
 
114
                        name,
 
115
                        path,
 
116
                        interface);
 
117
        else
 
118
                return NULL;
 
119
}
 
120
 
 
121
DBusGProxy *cairo_dock_create_new_system_proxy (const char *name, const char *path, const char *interface)
 
122
{
 
123
        DBusGConnection *pConnection = cairo_dock_get_system_connection ();
 
124
        if (pConnection != NULL)
 
125
                return dbus_g_proxy_new_for_name (
 
126
                        pConnection,
 
127
                        name,
 
128
                        path,
 
129
                        interface);
 
130
        else
 
131
                return NULL;
 
132
}
 
133
 
 
134
static void _on_detect_application (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer *data)
 
135
{
 
136
        CairoDockOnAppliPresentOnDbus pCallback = data[0];
 
137
        gpointer user_data = data[1];
 
138
        gchar *cName = data[2];
 
139
        gchar **name_list = NULL;
 
140
        gboolean bSuccess = dbus_g_proxy_end_call (proxy,
 
141
                call_id,
 
142
                NULL,
 
143
                G_TYPE_STRV,
 
144
                &name_list,
 
145
                G_TYPE_INVALID);
 
146
        
 
147
        gboolean bPresent = FALSE;
 
148
        cd_message ("detection du service %s ...", cName);
 
149
        int i;
 
150
        for (i = 0; name_list[i] != NULL; i ++)
 
151
        {
 
152
                if (strcmp (name_list[i], cName) == 0)
 
153
                {
 
154
                        bPresent = TRUE;
 
155
                        break;
 
156
                }
 
157
        }
 
158
        g_strfreev (name_list);
 
159
        g_free (cName);
 
160
        data[2] = NULL;
 
161
        
 
162
        pCallback (bPresent, user_data);
 
163
}
 
164
static void _free_detect_application (gpointer *data)
 
165
{
 
166
        cd_debug ("free data\n");
 
167
        g_free (data[2]);
 
168
        g_free (data);
 
169
}
 
170
static inline DBusGProxyCall *_dbus_detect_application_async (const gchar *cName, DBusGProxy *pProxy, CairoDockOnAppliPresentOnDbus pCallback, gpointer user_data)
 
171
{
 
172
        g_return_val_if_fail (cName != NULL && pProxy != NULL, FALSE);
 
173
        gpointer *data = g_new0 (gpointer, 3);
 
174
        data[0] = pCallback;
 
175
        data[1] = user_data;
 
176
        data[2] = g_strdup (cName);
 
177
        DBusGProxyCall* pCall= dbus_g_proxy_begin_call (pProxy, "ListNames",
 
178
                (DBusGProxyCallNotify)_on_detect_application,
 
179
                data,
 
180
                (GDestroyNotify) _free_detect_application,
 
181
                G_TYPE_INVALID);
 
182
        return pCall;
 
183
}
 
184
 
 
185
DBusGProxyCall *cairo_dock_dbus_detect_application_async (const gchar *cName, CairoDockOnAppliPresentOnDbus pCallback, gpointer user_data)
 
186
{
 
187
        cd_message ("%s (%s)", __func__, cName);
 
188
        DBusGProxy *pProxy = cairo_dock_get_main_proxy ();
 
189
        return _dbus_detect_application_async (cName, pProxy, pCallback, user_data);
 
190
}
 
191
 
 
192
DBusGProxyCall *cairo_dock_dbus_detect_system_application_async (const gchar *cName, CairoDockOnAppliPresentOnDbus pCallback, gpointer user_data)
 
193
{
 
194
        cd_message ("%s (%s)", __func__, cName);
 
195
        DBusGProxy *pProxy = cairo_dock_get_main_system_proxy ();
 
196
        return _dbus_detect_application_async (cName, pProxy, pCallback, user_data);
 
197
}
 
198
 
 
199
static inline gboolean _dbus_detect_application (const gchar *cName, DBusGProxy *pProxy)
 
200
{
 
201
        g_return_val_if_fail (cName != NULL && pProxy != NULL, FALSE);
 
202
        
 
203
        gchar **name_list = NULL;
 
204
        gboolean bPresent = FALSE;
 
205
        
 
206
        if(dbus_g_proxy_call (pProxy, "ListNames", NULL,
 
207
                G_TYPE_INVALID,
 
208
                G_TYPE_STRV,
 
209
                &name_list,
 
210
                G_TYPE_INVALID))
 
211
        {
 
212
                cd_message ("detection du service %s ...", cName);
 
213
                int i;
 
214
                for (i = 0; name_list[i] != NULL; i ++)
 
215
                {
 
216
                        if (strcmp (name_list[i], cName) == 0)
 
217
                        {
 
218
                                bPresent = TRUE;
 
219
                                break;
 
220
                        }
 
221
                }
 
222
        }
 
223
        g_strfreev (name_list);
 
224
        return bPresent;
 
225
}
 
226
 
 
227
gboolean cairo_dock_dbus_detect_application (const gchar *cName)
 
228
{
 
229
        cd_message ("%s (%s)", __func__, cName);
 
230
        DBusGProxy *pProxy = cairo_dock_get_main_proxy ();
 
231
        return _dbus_detect_application (cName, pProxy);
 
232
}
 
233
 
 
234
gboolean cairo_dock_dbus_detect_system_application (const gchar *cName)
 
235
{
 
236
        cd_message ("%s (%s)", __func__, cName);
 
237
        DBusGProxy *pProxy = cairo_dock_get_main_system_proxy ();
 
238
        return _dbus_detect_application (cName, pProxy);
 
239
}
 
240
 
 
241
 
 
242
gchar **cairo_dock_dbus_get_services (void)
 
243
{
 
244
        DBusGProxy *pProxy = cairo_dock_get_main_proxy ();
 
245
        gchar **name_list = NULL;
 
246
        if(dbus_g_proxy_call (pProxy, "ListNames", NULL,
 
247
                G_TYPE_INVALID,
 
248
                G_TYPE_STRV,
 
249
                &name_list,
 
250
                G_TYPE_INVALID))
 
251
                return name_list;
 
252
        else
 
253
                return NULL;
 
254
}
 
255
 
 
256
 
 
257
 
 
258
gboolean cairo_dock_dbus_get_boolean (DBusGProxy *pDbusProxy, const gchar *cAccessor)
 
259
{
 
260
        GError *erreur = NULL;
 
261
        gboolean bValue = FALSE;
 
262
        dbus_g_proxy_call (pDbusProxy, cAccessor, &erreur,
 
263
                G_TYPE_INVALID,
 
264
                G_TYPE_BOOLEAN, &bValue,
 
265
                G_TYPE_INVALID);
 
266
        if (erreur != NULL)
 
267
        {
 
268
                cd_warning (erreur->message);
 
269
                g_error_free (erreur);
 
270
        }
 
271
        return bValue;
 
272
}
 
273
 
 
274
int cairo_dock_dbus_get_integer (DBusGProxy *pDbusProxy, const gchar *cAccessor)
 
275
{
 
276
        GError *erreur = NULL;
 
277
        int iValue = -1;
 
278
        dbus_g_proxy_call (pDbusProxy, cAccessor, &erreur,
 
279
                G_TYPE_INVALID,
 
280
                G_TYPE_INT, &iValue,
 
281
                G_TYPE_INVALID);
 
282
        if (erreur != NULL)
 
283
        {
 
284
                cd_warning (erreur->message);
 
285
                g_error_free (erreur);
 
286
                iValue = -1;
 
287
        }
 
288
        return iValue;
 
289
}
 
290
 
 
291
guint cairo_dock_dbus_get_uinteger (DBusGProxy *pDbusProxy, const gchar *cAccessor)
 
292
{
 
293
        GError *erreur = NULL;
 
294
        guint iValue = -1;
 
295
        dbus_g_proxy_call (pDbusProxy, cAccessor, &erreur,
 
296
                G_TYPE_INVALID,
 
297
                G_TYPE_UINT, &iValue,
 
298
                G_TYPE_INVALID);
 
299
        if (erreur != NULL)
 
300
        {
 
301
                cd_warning (erreur->message);
 
302
                g_error_free (erreur);
 
303
                iValue = -1;
 
304
        }
 
305
        return iValue;
 
306
}
 
307
 
 
308
gchar *cairo_dock_dbus_get_string (DBusGProxy *pDbusProxy, const gchar *cAccessor)
 
309
{
 
310
        GError *erreur = NULL;
 
311
        gchar *cValue = NULL;
 
312
        dbus_g_proxy_call (pDbusProxy, cAccessor, &erreur,
 
313
                G_TYPE_INVALID,
 
314
                G_TYPE_STRING, &cValue,
 
315
                G_TYPE_INVALID);
 
316
        if (erreur != NULL)
 
317
        {
 
318
                cd_warning (erreur->message);
 
319
                g_error_free (erreur);
 
320
        }
 
321
        return cValue;
 
322
}
 
323
 
 
324
guchar *cairo_dock_dbus_get_uchar (DBusGProxy *pDbusProxy, const gchar *cAccessor)
 
325
{
 
326
        GError *erreur = NULL;
 
327
        guchar* uValue = NULL;
 
328
        
 
329
        dbus_g_proxy_call (pDbusProxy, cAccessor, &erreur,
 
330
                G_TYPE_INVALID,
 
331
                G_TYPE_UCHAR, &uValue,
 
332
                G_TYPE_INVALID);
 
333
        if (erreur != NULL)
 
334
        {
 
335
                cd_warning (erreur->message);
 
336
                g_error_free (erreur);
 
337
        }
 
338
        
 
339
        return uValue;
 
340
}
 
341
 
 
342
gdouble cairo_dock_dbus_get_double (DBusGProxy *pDbusProxy, const gchar *cAccessor)
 
343
{
 
344
        GError *erreur = NULL;
 
345
        gdouble fValue = 0.;
 
346
        
 
347
        dbus_g_proxy_call (pDbusProxy, cAccessor, &erreur,
 
348
                G_TYPE_INVALID,
 
349
                G_TYPE_DOUBLE, &fValue,
 
350
                G_TYPE_INVALID);
 
351
        if (erreur != NULL)
 
352
        {
 
353
                cd_warning (erreur->message);
 
354
                g_error_free (erreur);
 
355
        }
 
356
        
 
357
        return fValue;
 
358
}
 
359
 
 
360
gchar **cairo_dock_dbus_get_string_list (DBusGProxy *pDbusProxy, const gchar *cAccessor)
 
361
{
 
362
        GError *erreur = NULL;
 
363
        gchar **cValues = NULL;
 
364
        dbus_g_proxy_call (pDbusProxy, cAccessor, &erreur,
 
365
                G_TYPE_INVALID,
 
366
                G_TYPE_POINTER, &cValues,
 
367
                G_TYPE_INVALID);
 
368
        if (erreur != NULL)
 
369
        {
 
370
                cd_warning (erreur->message);
 
371
                g_error_free (erreur);
 
372
        }
 
373
        return cValues;
 
374
}
 
375
 
 
376
GPtrArray *cairo_dock_dbus_get_array (DBusGProxy *pDbusProxy, const gchar *cAccessor)
 
377
{
 
378
        GError *erreur = NULL;
 
379
        GPtrArray *pArray = NULL;
 
380
        dbus_g_proxy_call (pDbusProxy, cAccessor, &erreur,
 
381
                G_TYPE_INVALID,
 
382
                dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH), &pArray,
 
383
                G_TYPE_INVALID);
 
384
        if (erreur != NULL)
 
385
        {
 
386
                cd_warning (erreur->message);
 
387
                g_error_free (erreur);
 
388
        }
 
389
        return pArray;
 
390
}
 
391
 
 
392
 
 
393
 
 
394
void cairo_dock_dbus_call (DBusGProxy *pDbusProxy, const gchar *cCommand)
 
395
{
 
396
        dbus_g_proxy_call_no_reply (pDbusProxy, cCommand,
 
397
                G_TYPE_INVALID,
 
398
                G_TYPE_INVALID);
 
399
}
 
400
 
 
401
 
 
402
void cairo_dock_dbus_get_properties (DBusGProxy *pDbusProxy, const gchar *cCommand, const gchar *cInterface, const gchar *cProperty, GValue *vProperties)
 
403
{
 
404
        GError *erreur=NULL;
 
405
        
 
406
        dbus_g_proxy_call(pDbusProxy, cCommand, &erreur,
 
407
                G_TYPE_STRING, cInterface,
 
408
                G_TYPE_STRING, cProperty,
 
409
                G_TYPE_INVALID,
 
410
                G_TYPE_VALUE, vProperties,
 
411
                G_TYPE_INVALID);
 
412
        
 
413
        if (erreur != NULL)
 
414
        {
 
415
                cd_warning (erreur->message);
 
416
                g_error_free (erreur);
 
417
        }
 
418
}
 
419
 
 
420
 
 
421
 
 
422
void cairo_dock_dbus_get_property_in_value (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty, GValue *pProperty)
 
423
{
 
424
        GError *erreur=NULL;
 
425
        
 
426
        dbus_g_proxy_call(pDbusProxy, "Get", &erreur,
 
427
                G_TYPE_STRING, cInterface,
 
428
                G_TYPE_STRING, cProperty,
 
429
                G_TYPE_INVALID,
 
430
                G_TYPE_VALUE, pProperty,
 
431
                G_TYPE_INVALID);
 
432
        
 
433
        if (erreur != NULL)
 
434
        {
 
435
                cd_warning (erreur->message);
 
436
                g_error_free (erreur);
 
437
        }
 
438
}
 
439
 
 
440
gboolean cairo_dock_dbus_get_property_as_boolean (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty)
 
441
{
 
442
        GValue v = G_VALUE_INIT;
 
443
        cairo_dock_dbus_get_property_in_value (pDbusProxy, cInterface, cProperty, &v);
 
444
        if (G_VALUE_HOLDS_BOOLEAN (&v))
 
445
                return g_value_get_boolean (&v);
 
446
        else
 
447
                return FALSE;
 
448
}
 
449
 
 
450
gint cairo_dock_dbus_get_property_as_int (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty)
 
451
{
 
452
        GValue v = G_VALUE_INIT;
 
453
        cairo_dock_dbus_get_property_in_value (pDbusProxy, cInterface, cProperty, &v);
 
454
        if (G_VALUE_HOLDS_INT (&v))
 
455
                return g_value_get_int (&v);
 
456
        else
 
457
                return 0;
 
458
}
 
459
 
 
460
guint cairo_dock_dbus_get_property_as_uint (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty)
 
461
{
 
462
        GValue v = G_VALUE_INIT;
 
463
        cairo_dock_dbus_get_property_in_value (pDbusProxy, cInterface, cProperty, &v);
 
464
        if (G_VALUE_HOLDS_UINT (&v))
 
465
                return g_value_get_uint (&v);
 
466
        else
 
467
                return 0;
 
468
}
 
469
 
 
470
guchar cairo_dock_dbus_get_property_as_uchar (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty)
 
471
{
 
472
        GValue v = G_VALUE_INIT;
 
473
        cairo_dock_dbus_get_property_in_value (pDbusProxy, cInterface, cProperty, &v);
 
474
        if (G_VALUE_HOLDS_UCHAR (&v))
 
475
                return g_value_get_uchar (&v);
 
476
        else
 
477
                return 0;
 
478
}
 
479
 
 
480
gdouble cairo_dock_dbus_get_property_as_double (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty)
 
481
{
 
482
        GValue v = G_VALUE_INIT;
 
483
        cairo_dock_dbus_get_property_in_value (pDbusProxy, cInterface, cProperty, &v);
 
484
        if (G_VALUE_HOLDS_DOUBLE (&v))
 
485
                return g_value_get_double (&v);
 
486
        else
 
487
                return 0.;
 
488
}
 
489
 
 
490
gchar *cairo_dock_dbus_get_property_as_string (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty)
 
491
{
 
492
        GValue v = G_VALUE_INIT;
 
493
        cairo_dock_dbus_get_property_in_value (pDbusProxy, cInterface, cProperty, &v);
 
494
        if (G_VALUE_HOLDS_STRING (&v))
 
495
        {
 
496
                gchar *s = (gchar*)g_value_get_string (&v);  // on recupere directement le contenu de la GValue. Comme on ne libere pas la GValue, la chaine est a liberer soi-meme quand on en n'a plus besoin.
 
497
                return s;
 
498
        }
 
499
        else
 
500
                return NULL;
 
501
}
 
502
 
 
503
gchar *cairo_dock_dbus_get_property_as_object_path (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty)
 
504
{
 
505
        GValue v = G_VALUE_INIT;
 
506
        cairo_dock_dbus_get_property_in_value (pDbusProxy, cInterface, cProperty, &v);
 
507
        if (G_VALUE_HOLDS (&v, DBUS_TYPE_G_OBJECT_PATH))
 
508
        {
 
509
                gchar *s = (gchar*)g_value_get_string (&v);  // meme remarque.
 
510
                return s;
 
511
        }
 
512
        else
 
513
                return NULL;
 
514
}
 
515
 
 
516
gpointer cairo_dock_dbus_get_property_as_boxed (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty)
 
517
{
 
518
        GValue v = G_VALUE_INIT;
 
519
        cairo_dock_dbus_get_property_in_value (pDbusProxy, cInterface, cProperty, &v);
 
520
        if (G_VALUE_HOLDS_BOXED (&v))
 
521
        {
 
522
                gpointer p = g_value_get_boxed (&v);  // meme remarque.
 
523
                return p;
 
524
        }
 
525
        else
 
526
                return NULL;
 
527
}
 
528
 
 
529
gchar **cairo_dock_dbus_get_property_as_string_list (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty)
 
530
{
 
531
        GValue v = G_VALUE_INIT;
 
532
        cairo_dock_dbus_get_property_in_value (pDbusProxy, cInterface, cProperty, &v);
 
533
        if (G_VALUE_HOLDS_BOXED(&v))
 
534
        {
 
535
                gchar **s = (gchar**)g_value_get_boxed (&v);  // meme remarque.
 
536
                return s;
 
537
        }
 
538
        else
 
539
                return NULL;
 
540
}
 
541
 
 
542
GHashTable *cairo_dock_dbus_get_all_properties (DBusGProxy *pDbusProxy, const gchar *cInterface)
 
543
{
 
544
        GError *erreur=NULL;
 
545
        GHashTable *hProperties = NULL;
 
546
        
 
547
        dbus_g_proxy_call(pDbusProxy, "GetAll", &erreur,
 
548
                G_TYPE_STRING, cInterface,
 
549
                G_TYPE_INVALID,
 
550
                (dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE)), &hProperties,
 
551
                G_TYPE_INVALID);
 
552
        
 
553
        if (erreur != NULL)
 
554
        {
 
555
                cd_warning (erreur->message);
 
556
                g_error_free (erreur);
 
557
                return NULL;
 
558
        }
 
559
        else
 
560
        {
 
561
                return hProperties;
 
562
        }
 
563
}
 
564
 
 
565
 
 
566
void cairo_dock_dbus_set_property (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty, GValue *pProperty)
 
567
{
 
568
        GError *erreur=NULL;
 
569
        
 
570
        dbus_g_proxy_call(pDbusProxy, "Set", &erreur,
 
571
                G_TYPE_STRING, cInterface,
 
572
                G_TYPE_STRING, cProperty,
 
573
                G_TYPE_VALUE, pProperty,
 
574
                G_TYPE_INVALID,
 
575
                G_TYPE_INVALID);
 
576
        
 
577
        if (erreur != NULL)
 
578
        {
 
579
                cd_warning (erreur->message);
 
580
                g_error_free (erreur);
 
581
        }
 
582
}
 
583
 
 
584
void cairo_dock_dbus_set_boolean_property (DBusGProxy *pDbusProxy, const gchar *cInterface, const gchar *cProperty, gboolean bValue)
 
585
{
 
586
        GValue v = G_VALUE_INIT;
 
587
        g_value_init (&v, G_TYPE_BOOLEAN);
 
588
        g_value_set_boolean (&v, bValue);
 
589
        cairo_dock_dbus_set_property (pDbusProxy, cInterface, cProperty, &v);
 
590
}
 
591