~ubuntu-branches/ubuntu/vivid/gnome-flashback/vivid

« back to all changes in this revision

Viewing changes to gnome-flashback/libidle-monitor/meta-dbus-idle-monitor.c

  • Committer: Package Import Robot
  • Author(s): Dmitry Shachnev
  • Date: 2014-09-19 17:09:43 UTC
  • Revision ID: package-import@ubuntu.com-20140919170943-oboafsedi6z69951
Tags: upstream-3.10.0
ImportĀ upstreamĀ versionĀ 3.10.0

Show diffs side-by-side

added added

removed removed

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