1 /*
2  * Generated by gdbus-codegen 2.42.0. 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 "gca-service.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
_changed_property_free(ChangedProperty * data)58 _changed_property_free (ChangedProperty *data)
59 {
60   g_value_unset (&data->orig_value);
61   g_free (data);
62 }
63 
64 static gboolean
_g_strv_equal0(gchar ** a,gchar ** b)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
_g_variant_equal0(GVariant * a,GVariant * b)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
_g_value_equal(const GValue * a,const GValue * b)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.CodeAssist.v1.Service
153  * ------------------------------------------------------------------------
154  */
155 
156 /**
157  * SECTION:GcaService
158  * @title: GcaService
159  * @short_description: Generated C code for the org.gnome.CodeAssist.v1.Service D-Bus interface
160  *
161  * This section contains code for working with the <link linkend="gdbus-interface-org-gnome-CodeAssist-v1-Service.top_of_page">org.gnome.CodeAssist.v1.Service</link> D-Bus interface in C.
162  *
163  * Since: 3.32
164  */
165 
166 /* ---- Introspection data for org.gnome.CodeAssist.v1.Service ---- */
167 
168 static const _ExtendedGDBusArgInfo _gca_service_method_info_dispose_IN_ARG_path =
169 {
170   {
171     -1,
172     (gchar *) "path",
173     (gchar *) "s",
174     NULL
175   },
176   FALSE
177 };
178 
179 static const _ExtendedGDBusArgInfo * const _gca_service_method_info_dispose_IN_ARG_pointers[] =
180 {
181   &_gca_service_method_info_dispose_IN_ARG_path,
182   NULL
183 };
184 
185 static const _ExtendedGDBusMethodInfo _gca_service_method_info_dispose =
186 {
187   {
188     -1,
189     (gchar *) "Dispose",
190     (GDBusArgInfo **) &_gca_service_method_info_dispose_IN_ARG_pointers,
191     NULL,
192     NULL
193   },
194   "handle-dispose",
195   FALSE
196 };
197 
198 static const _ExtendedGDBusArgInfo _gca_service_method_info_parse_IN_ARG_path =
199 {
200   {
201     -1,
202     (gchar *) "path",
203     (gchar *) "s",
204     NULL
205   },
206   FALSE
207 };
208 
209 static const _ExtendedGDBusArgInfo _gca_service_method_info_parse_IN_ARG_data_path =
210 {
211   {
212     -1,
213     (gchar *) "data_path",
214     (gchar *) "s",
215     NULL
216   },
217   FALSE
218 };
219 
220 static const _ExtendedGDBusArgInfo _gca_service_method_info_parse_IN_ARG_cursor =
221 {
222   {
223     -1,
224     (gchar *) "cursor",
225     (gchar *) "(xx)",
226     NULL
227   },
228   FALSE
229 };
230 
231 static const _ExtendedGDBusArgInfo _gca_service_method_info_parse_IN_ARG_options =
232 {
233   {
234     -1,
235     (gchar *) "options",
236     (gchar *) "a{sv}",
237     NULL
238   },
239   FALSE
240 };
241 
242 static const _ExtendedGDBusArgInfo * const _gca_service_method_info_parse_IN_ARG_pointers[] =
243 {
244   &_gca_service_method_info_parse_IN_ARG_path,
245   &_gca_service_method_info_parse_IN_ARG_data_path,
246   &_gca_service_method_info_parse_IN_ARG_cursor,
247   &_gca_service_method_info_parse_IN_ARG_options,
248   NULL
249 };
250 
251 static const _ExtendedGDBusArgInfo _gca_service_method_info_parse_OUT_ARG_unnamed_arg4 =
252 {
253   {
254     -1,
255     (gchar *) "unnamed_arg4",
256     (gchar *) "o",
257     NULL
258   },
259   FALSE
260 };
261 
262 static const _ExtendedGDBusArgInfo * const _gca_service_method_info_parse_OUT_ARG_pointers[] =
263 {
264   &_gca_service_method_info_parse_OUT_ARG_unnamed_arg4,
265   NULL
266 };
267 
268 static const _ExtendedGDBusMethodInfo _gca_service_method_info_parse =
269 {
270   {
271     -1,
272     (gchar *) "Parse",
273     (GDBusArgInfo **) &_gca_service_method_info_parse_IN_ARG_pointers,
274     (GDBusArgInfo **) &_gca_service_method_info_parse_OUT_ARG_pointers,
275     NULL
276   },
277   "handle-parse",
278   FALSE
279 };
280 
281 static const _ExtendedGDBusMethodInfo * const _gca_service_method_info_pointers[] =
282 {
283   &_gca_service_method_info_dispose,
284   &_gca_service_method_info_parse,
285   NULL
286 };
287 
288 static const _ExtendedGDBusInterfaceInfo _gca_service_interface_info =
289 {
290   {
291     -1,
292     (gchar *) "org.gnome.CodeAssist.v1.Service",
293     (GDBusMethodInfo **) &_gca_service_method_info_pointers,
294     NULL,
295     NULL,
296     NULL
297   },
298   "service",
299 };
300 
301 
302 /**
303  * gca_service_interface_info:
304  *
305  * Gets a machine-readable description of the <link linkend="gdbus-interface-org-gnome-CodeAssist-v1-Service.top_of_page">org.gnome.CodeAssist.v1.Service</link> D-Bus interface.
306  *
307  * Returns: (transfer none): a #GDBusInterfaceInfo. Do not free.
308  *
309  * Since: 3.32
310  */
311 GDBusInterfaceInfo *
gca_service_interface_info(void)312 gca_service_interface_info (void)
313 {
314   return (GDBusInterfaceInfo *) &_gca_service_interface_info.parent_struct;
315 }
316 
317 /**
318  * gca_service_override_properties:
319  * @klass: The class structure for a #GObject<!-- -->-derived class.
320  * @property_id_begin: The property id to assign to the first overridden property.
321  *
322  * Overrides all #GObject properties in the #GcaService interface for a concrete class.
323  * The properties are overridden in the order they are defined.
324  *
325  * Returns: The last property id.
326  *
327  * Since: 3.32
328  */
329 guint
gca_service_override_properties(GObjectClass * klass,guint property_id_begin)330 gca_service_override_properties (GObjectClass *klass, guint property_id_begin)
331 {
332   return property_id_begin - 1;
333 }
334 
335 
336 
337 /**
338  * GcaService:
339  *
340  * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-gnome-CodeAssist-v1-Service.top_of_page">org.gnome.CodeAssist.v1.Service</link>.
341  *
342  * Since: 3.32
343  */
344 
345 /**
346  * GcaServiceIface:
347  * @parent_iface: The parent interface.
348  * @handle_dispose: Handler for the #GcaService::handle-dispose signal.
349  * @handle_parse: Handler for the #GcaService::handle-parse signal.
350  *
351  * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-gnome-CodeAssist-v1-Service.top_of_page">org.gnome.CodeAssist.v1.Service</link>.
352  *
353  * Since: 3.32
354  */
355 
356 typedef GcaServiceIface GcaServiceInterface;
357 G_DEFINE_INTERFACE (GcaService, gca_service, G_TYPE_OBJECT);
358 
359 static void
gca_service_default_init(GcaServiceIface * iface)360 gca_service_default_init (GcaServiceIface *iface)
361 {
362   /* GObject signals for incoming D-Bus method calls: */
363   /**
364    * GcaService::handle-dispose:
365    * @object: a #GcaService.
366    * @invocation: a #GDBusMethodInvocation.
367    * @arg_path: Argument passed by remote caller.
368    *
369    * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-CodeAssist-v1-Service.Dispose">Dispose()</link> D-Bus method.
370    *
371    * 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 gca_service_complete_dispose() 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.
372    *
373    * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
374    *
375    * Since: 3.32
376    */
377   g_signal_new ("handle-dispose",
378     G_TYPE_FROM_INTERFACE (iface),
379     G_SIGNAL_RUN_LAST,
380     G_STRUCT_OFFSET (GcaServiceIface, handle_dispose),
381     g_signal_accumulator_true_handled,
382     NULL,
383     g_cclosure_marshal_generic,
384     G_TYPE_BOOLEAN,
385     2,
386     G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
387 
388   /**
389    * GcaService::handle-parse:
390    * @object: a #GcaService.
391    * @invocation: a #GDBusMethodInvocation.
392    * @arg_path: Argument passed by remote caller.
393    * @arg_data_path: Argument passed by remote caller.
394    * @arg_cursor: Argument passed by remote caller.
395    * @arg_options: Argument passed by remote caller.
396    *
397    * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-CodeAssist-v1-Service.Parse">Parse()</link> D-Bus method.
398    *
399    * 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 gca_service_complete_parse() 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.
400    *
401    * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
402    *
403    * Since: 3.32
404    */
405   g_signal_new ("handle-parse",
406     G_TYPE_FROM_INTERFACE (iface),
407     G_SIGNAL_RUN_LAST,
408     G_STRUCT_OFFSET (GcaServiceIface, handle_parse),
409     g_signal_accumulator_true_handled,
410     NULL,
411     g_cclosure_marshal_generic,
412     G_TYPE_BOOLEAN,
413     5,
414     G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_VARIANT);
415 
416 }
417 
418 /**
419  * gca_service_call_dispose:
420  * @proxy: a #GcaServiceProxy.
421  * @arg_path: Argument to pass with the method invocation.
422  * @cancellable: (allow-none): a #GCancellable or %NULL.
423  * @callback: a #GAsyncReadyCallback to call when the request is satisfied or %NULL.
424  * @user_data: User data to pass to @callback.
425  *
426  * Asynchronously invokes the <link linkend="gdbus-method-org-gnome-CodeAssist-v1-Service.Dispose">Dispose()</link> D-Bus method on @proxy.
427  * 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.
428  * You can then call gca_service_call_dispose_finish() to get the result of the operation.
429  *
430  * See gca_service_call_dispose_sync() for the synchronous, blocking version of this method.
431  *
432  * Since: 3.32
433  */
434 void
gca_service_call_dispose(GcaService * proxy,const gchar * arg_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)435 gca_service_call_dispose (
436     GcaService *proxy,
437     const gchar *arg_path,
438     GCancellable *cancellable,
439     GAsyncReadyCallback callback,
440     gpointer user_data)
441 {
442   g_dbus_proxy_call (G_DBUS_PROXY (proxy),
443     "Dispose",
444     g_variant_new ("(s)",
445                    arg_path),
446     G_DBUS_CALL_FLAGS_NONE,
447     -1,
448     cancellable,
449     callback,
450     user_data);
451 }
452 
453 /**
454  * gca_service_call_dispose_finish:
455  * @proxy: a #GcaServiceProxy.
456  * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gca_service_call_dispose().
457  * @error: Return location for error or %NULL.
458  *
459  * Finishes an operation started with gca_service_call_dispose().
460  *
461  * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
462  *
463  * Since: 3.32
464  */
465 gboolean
gca_service_call_dispose_finish(GcaService * proxy,GAsyncResult * res,GError ** error)466 gca_service_call_dispose_finish (
467     GcaService *proxy,
468     GAsyncResult *res,
469     GError **error)
470 {
471   GVariant *_ret;
472   _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
473   if (_ret == NULL)
474     goto _out;
475   g_variant_get (_ret,
476                  "()");
477   g_variant_unref (_ret);
478 _out:
479   return _ret != NULL;
480 }
481 
482 /**
483  * gca_service_call_dispose_sync:
484  * @proxy: a #GcaServiceProxy.
485  * @arg_path: Argument to pass with the method invocation.
486  * @cancellable: (allow-none): a #GCancellable or %NULL.
487  * @error: Return location for error or %NULL.
488  *
489  * Synchronously invokes the <link linkend="gdbus-method-org-gnome-CodeAssist-v1-Service.Dispose">Dispose()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
490  *
491  * See gca_service_call_dispose() for the asynchronous version of this method.
492  *
493  * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
494  *
495  * Since: 3.32
496  */
497 gboolean
gca_service_call_dispose_sync(GcaService * proxy,const gchar * arg_path,GCancellable * cancellable,GError ** error)498 gca_service_call_dispose_sync (
499     GcaService *proxy,
500     const gchar *arg_path,
501     GCancellable *cancellable,
502     GError **error)
503 {
504   GVariant *_ret;
505   _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
506     "Dispose",
507     g_variant_new ("(s)",
508                    arg_path),
509     G_DBUS_CALL_FLAGS_NONE,
510     -1,
511     cancellable,
512     error);
513   if (_ret == NULL)
514     goto _out;
515   g_variant_get (_ret,
516                  "()");
517   g_variant_unref (_ret);
518 _out:
519   return _ret != NULL;
520 }
521 
522 /**
523  * gca_service_call_parse:
524  * @proxy: a #GcaServiceProxy.
525  * @arg_path: Argument to pass with the method invocation.
526  * @arg_data_path: Argument to pass with the method invocation.
527  * @arg_cursor: Argument to pass with the method invocation.
528  * @arg_options: Argument to pass with the method invocation.
529  * @cancellable: (allow-none): a #GCancellable or %NULL.
530  * @callback: a #GAsyncReadyCallback to call when the request is satisfied or %NULL.
531  * @user_data: User data to pass to @callback.
532  *
533  * Asynchronously invokes the <link linkend="gdbus-method-org-gnome-CodeAssist-v1-Service.Parse">Parse()</link> D-Bus method on @proxy.
534  * 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.
535  * You can then call gca_service_call_parse_finish() to get the result of the operation.
536  *
537  * See gca_service_call_parse_sync() for the synchronous, blocking version of this method.
538  *
539  * Since: 3.32
540  */
541 void
gca_service_call_parse(GcaService * proxy,const gchar * arg_path,const gchar * arg_data_path,GVariant * arg_cursor,GVariant * arg_options,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)542 gca_service_call_parse (
543     GcaService *proxy,
544     const gchar *arg_path,
545     const gchar *arg_data_path,
546     GVariant *arg_cursor,
547     GVariant *arg_options,
548     GCancellable *cancellable,
549     GAsyncReadyCallback callback,
550     gpointer user_data)
551 {
552   g_dbus_proxy_call (G_DBUS_PROXY (proxy),
553     "Parse",
554     g_variant_new ("(ss@(xx)@a{sv})",
555                    arg_path,
556                    arg_data_path,
557                    arg_cursor,
558                    arg_options),
559     G_DBUS_CALL_FLAGS_NONE,
560     -1,
561     cancellable,
562     callback,
563     user_data);
564 }
565 
566 /**
567  * gca_service_call_parse_finish:
568  * @proxy: a #GcaServiceProxy.
569  * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
570  * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gca_service_call_parse().
571  * @error: Return location for error or %NULL.
572  *
573  * Finishes an operation started with gca_service_call_parse().
574  *
575  * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
576  *
577  * Since: 3.32
578  */
579 gboolean
gca_service_call_parse_finish(GcaService * proxy,gchar ** out_unnamed_arg4,GAsyncResult * res,GError ** error)580 gca_service_call_parse_finish (
581     GcaService *proxy,
582     gchar **out_unnamed_arg4,
583     GAsyncResult *res,
584     GError **error)
585 {
586   GVariant *_ret;
587   _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
588   if (_ret == NULL)
589     goto _out;
590   g_variant_get (_ret,
591                  "(o)",
592                  out_unnamed_arg4);
593   g_variant_unref (_ret);
594 _out:
595   return _ret != NULL;
596 }
597 
598 /**
599  * gca_service_call_parse_sync:
600  * @proxy: a #GcaServiceProxy.
601  * @arg_path: Argument to pass with the method invocation.
602  * @arg_data_path: Argument to pass with the method invocation.
603  * @arg_cursor: Argument to pass with the method invocation.
604  * @arg_options: Argument to pass with the method invocation.
605  * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
606  * @cancellable: (allow-none): a #GCancellable or %NULL.
607  * @error: Return location for error or %NULL.
608  *
609  * Synchronously invokes the <link linkend="gdbus-method-org-gnome-CodeAssist-v1-Service.Parse">Parse()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
610  *
611  * See gca_service_call_parse() for the asynchronous version of this method.
612  *
613  * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
614  *
615  * Since: 3.32
616  */
617 gboolean
gca_service_call_parse_sync(GcaService * proxy,const gchar * arg_path,const gchar * arg_data_path,GVariant * arg_cursor,GVariant * arg_options,gchar ** out_unnamed_arg4,GCancellable * cancellable,GError ** error)618 gca_service_call_parse_sync (
619     GcaService *proxy,
620     const gchar *arg_path,
621     const gchar *arg_data_path,
622     GVariant *arg_cursor,
623     GVariant *arg_options,
624     gchar **out_unnamed_arg4,
625     GCancellable *cancellable,
626     GError **error)
627 {
628   GVariant *_ret;
629   _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
630     "Parse",
631     g_variant_new ("(ss@(xx)@a{sv})",
632                    arg_path,
633                    arg_data_path,
634                    arg_cursor,
635                    arg_options),
636     G_DBUS_CALL_FLAGS_NONE,
637     -1,
638     cancellable,
639     error);
640   if (_ret == NULL)
641     goto _out;
642   g_variant_get (_ret,
643                  "(o)",
644                  out_unnamed_arg4);
645   g_variant_unref (_ret);
646 _out:
647   return _ret != NULL;
648 }
649 
650 /**
651  * gca_service_complete_dispose:
652  * @object: a #GcaService.
653  * @invocation: (transfer full): a #GDBusMethodInvocation.
654  *
655  * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-CodeAssist-v1-Service.Dispose">Dispose()</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.
656  *
657  * This method will free @invocation, you cannot use it afterwards.
658  *
659  * Since: 3.32
660  */
661 void
gca_service_complete_dispose(GcaService * object,GDBusMethodInvocation * invocation)662 gca_service_complete_dispose (
663     GcaService *object,
664     GDBusMethodInvocation *invocation)
665 {
666   g_dbus_method_invocation_return_value (invocation,
667     g_variant_new ("()"));
668 }
669 
670 /**
671  * gca_service_complete_parse:
672  * @object: a #GcaService.
673  * @invocation: (transfer full): a #GDBusMethodInvocation.
674  * @unnamed_arg4: Parameter to return.
675  *
676  * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-CodeAssist-v1-Service.Parse">Parse()</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.
677  *
678  * This method will free @invocation, you cannot use it afterwards.
679  *
680  * Since: 3.32
681  */
682 void
gca_service_complete_parse(GcaService * object,GDBusMethodInvocation * invocation,const gchar * unnamed_arg4)683 gca_service_complete_parse (
684     GcaService *object,
685     GDBusMethodInvocation *invocation,
686     const gchar *unnamed_arg4)
687 {
688   g_dbus_method_invocation_return_value (invocation,
689     g_variant_new ("(o)",
690                    unnamed_arg4));
691 }
692 
693 /* ------------------------------------------------------------------------ */
694 
695 /**
696  * GcaServiceProxy:
697  *
698  * The #GcaServiceProxy structure contains only private data and should only be accessed using the provided API.
699  *
700  * Since: 3.32
701  */
702 
703 /**
704  * GcaServiceProxyClass:
705  * @parent_class: The parent class.
706  *
707  * Class structure for #GcaServiceProxy.
708  *
709  * Since: 3.32
710  */
711 
712 struct _GcaServiceProxyPrivate
713 {
714   GData *qdata;
715 };
716 
717 static void gca_service_proxy_iface_init (GcaServiceIface *iface);
718 
719 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
720 G_DEFINE_TYPE_WITH_CODE (GcaServiceProxy, gca_service_proxy, G_TYPE_DBUS_PROXY,
721                          G_ADD_PRIVATE (GcaServiceProxy)
722                          G_IMPLEMENT_INTERFACE (GCA_TYPE_SERVICE, gca_service_proxy_iface_init));
723 
724 #else
725 G_DEFINE_TYPE_WITH_CODE (GcaServiceProxy, gca_service_proxy, G_TYPE_DBUS_PROXY,
726                          G_IMPLEMENT_INTERFACE (GCA_TYPE_SERVICE, gca_service_proxy_iface_init));
727 
728 #endif
729 static void
gca_service_proxy_finalize(GObject * object)730 gca_service_proxy_finalize (GObject *object)
731 {
732   GcaServiceProxy *proxy = GCA_SERVICE_PROXY (object);
733   g_datalist_clear (&proxy->priv->qdata);
734   G_OBJECT_CLASS (gca_service_proxy_parent_class)->finalize (object);
735 }
736 
737 static void
gca_service_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)738 gca_service_proxy_get_property (GObject      *object,
739   guint         prop_id,
740   GValue       *value,
741   GParamSpec   *pspec G_GNUC_UNUSED)
742 {
743 }
744 
745 static void
gca_service_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)746 gca_service_proxy_set_property (GObject      *object,
747   guint         prop_id,
748   const GValue *value,
749   GParamSpec   *pspec G_GNUC_UNUSED)
750 {
751 }
752 
753 static void
gca_service_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)754 gca_service_proxy_g_signal (GDBusProxy *proxy,
755   const gchar *sender_name G_GNUC_UNUSED,
756   const gchar *signal_name,
757   GVariant *parameters)
758 {
759   _ExtendedGDBusSignalInfo *info;
760   GVariantIter iter;
761   GVariant *child;
762   GValue *paramv;
763   guint num_params;
764   guint n;
765   guint signal_id;
766   info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gca_service_interface_info.parent_struct, signal_name);
767   if (info == NULL)
768     return;
769   num_params = g_variant_n_children (parameters);
770   paramv = g_new0 (GValue, num_params + 1);
771   g_value_init (&paramv[0], GCA_TYPE_SERVICE);
772   g_value_set_object (&paramv[0], proxy);
773   g_variant_iter_init (&iter, parameters);
774   n = 1;
775   while ((child = g_variant_iter_next_value (&iter)) != NULL)
776     {
777       _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
778       if (arg_info->use_gvariant)
779         {
780           g_value_init (&paramv[n], G_TYPE_VARIANT);
781           g_value_set_variant (&paramv[n], child);
782           n++;
783         }
784       else
785         g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
786       g_variant_unref (child);
787     }
788   signal_id = g_signal_lookup (info->signal_name, GCA_TYPE_SERVICE);
789   g_signal_emitv (paramv, signal_id, 0, NULL);
790   for (n = 0; n < num_params + 1; n++)
791     g_value_unset (&paramv[n]);
792   g_free (paramv);
793 }
794 
795 static void
gca_service_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)796 gca_service_proxy_g_properties_changed (GDBusProxy *_proxy,
797   GVariant *changed_properties,
798   const gchar *const *invalidated_properties)
799 {
800   GcaServiceProxy *proxy = GCA_SERVICE_PROXY (_proxy);
801   guint n;
802   const gchar *key;
803   GVariantIter *iter;
804   _ExtendedGDBusPropertyInfo *info;
805   g_variant_get (changed_properties, "a{sv}", &iter);
806   while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
807     {
808       info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gca_service_interface_info.parent_struct, key);
809       g_datalist_remove_data (&proxy->priv->qdata, key);
810       if (info != NULL)
811         g_object_notify (G_OBJECT (proxy), info->hyphen_name);
812     }
813   g_variant_iter_free (iter);
814   for (n = 0; invalidated_properties[n] != NULL; n++)
815     {
816       info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gca_service_interface_info.parent_struct, invalidated_properties[n]);
817       g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
818       if (info != NULL)
819         g_object_notify (G_OBJECT (proxy), info->hyphen_name);
820     }
821 }
822 
823 static void
gca_service_proxy_init(GcaServiceProxy * proxy)824 gca_service_proxy_init (GcaServiceProxy *proxy)
825 {
826 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
827   proxy->priv = gca_service_proxy_get_instance_private (proxy);
828 #else
829   proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, GCA_TYPE_SERVICE_PROXY, GcaServiceProxyPrivate);
830 #endif
831 
832   g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gca_service_interface_info ());
833 }
834 
835 static void
gca_service_proxy_class_init(GcaServiceProxyClass * klass)836 gca_service_proxy_class_init (GcaServiceProxyClass *klass)
837 {
838   GObjectClass *gobject_class;
839   GDBusProxyClass *proxy_class;
840 
841   gobject_class = G_OBJECT_CLASS (klass);
842   gobject_class->finalize     = gca_service_proxy_finalize;
843   gobject_class->get_property = gca_service_proxy_get_property;
844   gobject_class->set_property = gca_service_proxy_set_property;
845 
846   proxy_class = G_DBUS_PROXY_CLASS (klass);
847   proxy_class->g_signal = gca_service_proxy_g_signal;
848   proxy_class->g_properties_changed = gca_service_proxy_g_properties_changed;
849 
850 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
851   g_type_class_add_private (klass, sizeof (GcaServiceProxyPrivate));
852 #endif
853 }
854 
855 static void
gca_service_proxy_iface_init(GcaServiceIface * iface)856 gca_service_proxy_iface_init (GcaServiceIface *iface)
857 {
858 }
859 
860 /**
861  * gca_service_proxy_new:
862  * @connection: a #GDBusConnection.
863  * @flags: Flags from the #GDBusProxyFlags enumeration.
864  * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
865  * @object_path: An object path.
866  * @cancellable: (allow-none): a #GCancellable or %NULL.
867  * @callback: a #GAsyncReadyCallback to call when the request is satisfied.
868  * @user_data: User data to pass to @callback.
869  *
870  * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-gnome-CodeAssist-v1-Service.top_of_page">org.gnome.CodeAssist.v1.Service</link>. See g_dbus_proxy_new() for more details.
871  *
872  * 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.
873  * You can then call gca_service_proxy_new_finish() to get the result of the operation.
874  *
875  * See gca_service_proxy_new_sync() for the synchronous, blocking version of this constructor.
876  *
877  * Since: 3.32
878  */
879 void
gca_service_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)880 gca_service_proxy_new (
881     GDBusConnection     *connection,
882     GDBusProxyFlags      flags,
883     const gchar         *name,
884     const gchar         *object_path,
885     GCancellable        *cancellable,
886     GAsyncReadyCallback  callback,
887     gpointer             user_data)
888 {
889   g_async_initable_new_async (GCA_TYPE_SERVICE_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.CodeAssist.v1.Service", NULL);
890 }
891 
892 /**
893  * gca_service_proxy_new_finish:
894  * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gca_service_proxy_new().
895  * @error: Return location for error or %NULL
896  *
897  * Finishes an operation started with gca_service_proxy_new().
898  *
899  * Returns: (transfer full) (type GcaServiceProxy): The constructed proxy object or %NULL if @error is set.
900  *
901  * Since: 3.32
902  */
903 GcaService *
gca_service_proxy_new_finish(GAsyncResult * res,GError ** error)904 gca_service_proxy_new_finish (
905     GAsyncResult        *res,
906     GError             **error)
907 {
908   GObject *ret;
909   GObject *source_object;
910   source_object = g_async_result_get_source_object (res);
911   ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
912   g_object_unref (source_object);
913   if (ret != NULL)
914     return GCA_SERVICE (ret);
915   else
916     return NULL;
917 }
918 
919 /**
920  * gca_service_proxy_new_sync:
921  * @connection: a #GDBusConnection.
922  * @flags: Flags from the #GDBusProxyFlags enumeration.
923  * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
924  * @object_path: An object path.
925  * @cancellable: (allow-none): a #GCancellable or %NULL.
926  * @error: Return location for error or %NULL
927  *
928  * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-gnome-CodeAssist-v1-Service.top_of_page">org.gnome.CodeAssist.v1.Service</link>. See g_dbus_proxy_new_sync() for more details.
929  *
930  * The calling thread is blocked until a reply is received.
931  *
932  * See gca_service_proxy_new() for the asynchronous version of this constructor.
933  *
934  * Returns: (transfer full) (type GcaServiceProxy): The constructed proxy object or %NULL if @error is set.
935  *
936  * Since: 3.32
937  */
938 GcaService *
gca_service_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)939 gca_service_proxy_new_sync (
940     GDBusConnection     *connection,
941     GDBusProxyFlags      flags,
942     const gchar         *name,
943     const gchar         *object_path,
944     GCancellable        *cancellable,
945     GError             **error)
946 {
947   GInitable *ret;
948   ret = g_initable_new (GCA_TYPE_SERVICE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.gnome.CodeAssist.v1.Service", NULL);
949   if (ret != NULL)
950     return GCA_SERVICE (ret);
951   else
952     return NULL;
953 }
954 
955 
956 /**
957  * gca_service_proxy_new_for_bus:
958  * @bus_type: a #GBusType.
959  * @flags: Flags from the #GDBusProxyFlags enumeration.
960  * @name: A bus name (well-known or unique).
961  * @object_path: An object path.
962  * @cancellable: (allow-none): a #GCancellable or %NULL.
963  * @callback: a #GAsyncReadyCallback to call when the request is satisfied.
964  * @user_data: User data to pass to @callback.
965  *
966  * Like gca_service_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
967  *
968  * 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.
969  * You can then call gca_service_proxy_new_for_bus_finish() to get the result of the operation.
970  *
971  * See gca_service_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
972  *
973  * Since: 3.32
974  */
975 void
gca_service_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)976 gca_service_proxy_new_for_bus (
977     GBusType             bus_type,
978     GDBusProxyFlags      flags,
979     const gchar         *name,
980     const gchar         *object_path,
981     GCancellable        *cancellable,
982     GAsyncReadyCallback  callback,
983     gpointer             user_data)
984 {
985   g_async_initable_new_async (GCA_TYPE_SERVICE_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.CodeAssist.v1.Service", NULL);
986 }
987 
988 /**
989  * gca_service_proxy_new_for_bus_finish:
990  * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gca_service_proxy_new_for_bus().
991  * @error: Return location for error or %NULL
992  *
993  * Finishes an operation started with gca_service_proxy_new_for_bus().
994  *
995  * Returns: (transfer full) (type GcaServiceProxy): The constructed proxy object or %NULL if @error is set.
996  *
997  * Since: 3.32
998  */
999 GcaService *
gca_service_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)1000 gca_service_proxy_new_for_bus_finish (
1001     GAsyncResult        *res,
1002     GError             **error)
1003 {
1004   GObject *ret;
1005   GObject *source_object;
1006   source_object = g_async_result_get_source_object (res);
1007   ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1008   g_object_unref (source_object);
1009   if (ret != NULL)
1010     return GCA_SERVICE (ret);
1011   else
1012     return NULL;
1013 }
1014 
1015 /**
1016  * gca_service_proxy_new_for_bus_sync:
1017  * @bus_type: a #GBusType.
1018  * @flags: Flags from the #GDBusProxyFlags enumeration.
1019  * @name: A bus name (well-known or unique).
1020  * @object_path: An object path.
1021  * @cancellable: (allow-none): a #GCancellable or %NULL.
1022  * @error: Return location for error or %NULL
1023  *
1024  * Like gca_service_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1025  *
1026  * The calling thread is blocked until a reply is received.
1027  *
1028  * See gca_service_proxy_new_for_bus() for the asynchronous version of this constructor.
1029  *
1030  * Returns: (transfer full) (type GcaServiceProxy): The constructed proxy object or %NULL if @error is set.
1031  *
1032  * Since: 3.32
1033  */
1034 GcaService *
gca_service_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)1035 gca_service_proxy_new_for_bus_sync (
1036     GBusType             bus_type,
1037     GDBusProxyFlags      flags,
1038     const gchar         *name,
1039     const gchar         *object_path,
1040     GCancellable        *cancellable,
1041     GError             **error)
1042 {
1043   GInitable *ret;
1044   ret = g_initable_new (GCA_TYPE_SERVICE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.gnome.CodeAssist.v1.Service", NULL);
1045   if (ret != NULL)
1046     return GCA_SERVICE (ret);
1047   else
1048     return NULL;
1049 }
1050 
1051 
1052 /* ------------------------------------------------------------------------ */
1053 
1054 /**
1055  * GcaServiceSkeleton:
1056  *
1057  * The #GcaServiceSkeleton structure contains only private data and should only be accessed using the provided API.
1058  *
1059  * Since: 3.32
1060  */
1061 
1062 /**
1063  * GcaServiceSkeletonClass:
1064  * @parent_class: The parent class.
1065  *
1066  * Class structure for #GcaServiceSkeleton.
1067  *
1068  * Since: 3.32
1069  */
1070 
1071 struct _GcaServiceSkeletonPrivate
1072 {
1073   GValue *properties;
1074   GList *changed_properties;
1075   GSource *changed_properties_idle_source;
1076   GMainContext *context;
1077   GMutex lock;
1078 };
1079 
1080 static void
_gca_service_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)1081 _gca_service_skeleton_handle_method_call (
1082   GDBusConnection *connection G_GNUC_UNUSED,
1083   const gchar *sender G_GNUC_UNUSED,
1084   const gchar *object_path G_GNUC_UNUSED,
1085   const gchar *interface_name,
1086   const gchar *method_name,
1087   GVariant *parameters,
1088   GDBusMethodInvocation *invocation,
1089   gpointer user_data)
1090 {
1091   GcaServiceSkeleton *skeleton = GCA_SERVICE_SKELETON (user_data);
1092   _ExtendedGDBusMethodInfo *info;
1093   GVariantIter iter;
1094   GVariant *child;
1095   GValue *paramv;
1096   guint num_params;
1097   guint num_extra;
1098   guint n;
1099   guint signal_id;
1100   GValue return_value = G_VALUE_INIT;
1101   info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1102   g_assert (info != NULL);
1103   num_params = g_variant_n_children (parameters);
1104   num_extra = info->pass_fdlist ? 3 : 2;  paramv = g_new0 (GValue, num_params + num_extra);
1105   n = 0;
1106   g_value_init (&paramv[n], GCA_TYPE_SERVICE);
1107   g_value_set_object (&paramv[n++], skeleton);
1108   g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1109   g_value_set_object (&paramv[n++], invocation);
1110   if (info->pass_fdlist)
1111     {
1112 #ifdef G_OS_UNIX
1113       g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
1114       g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1115 #else
1116       g_assert_not_reached ();
1117 #endif
1118     }
1119   g_variant_iter_init (&iter, parameters);
1120   while ((child = g_variant_iter_next_value (&iter)) != NULL)
1121     {
1122       _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1123       if (arg_info->use_gvariant)
1124         {
1125           g_value_init (&paramv[n], G_TYPE_VARIANT);
1126           g_value_set_variant (&paramv[n], child);
1127           n++;
1128         }
1129       else
1130         g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1131       g_variant_unref (child);
1132     }
1133   signal_id = g_signal_lookup (info->signal_name, GCA_TYPE_SERVICE);
1134   g_value_init (&return_value, G_TYPE_BOOLEAN);
1135   g_signal_emitv (paramv, signal_id, 0, &return_value);
1136   if (!g_value_get_boolean (&return_value))
1137     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);
1138   g_value_unset (&return_value);
1139   for (n = 0; n < num_params + num_extra; n++)
1140     g_value_unset (&paramv[n]);
1141   g_free (paramv);
1142 }
1143 
1144 static GVariant *
_gca_service_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)1145 _gca_service_skeleton_handle_get_property (
1146   GDBusConnection *connection G_GNUC_UNUSED,
1147   const gchar *sender G_GNUC_UNUSED,
1148   const gchar *object_path G_GNUC_UNUSED,
1149   const gchar *interface_name G_GNUC_UNUSED,
1150   const gchar *property_name,
1151   GError **error,
1152   gpointer user_data)
1153 {
1154   GcaServiceSkeleton *skeleton = GCA_SERVICE_SKELETON (user_data);
1155   GValue value = G_VALUE_INIT;
1156   GParamSpec *pspec;
1157   _ExtendedGDBusPropertyInfo *info;
1158   GVariant *ret;
1159   ret = NULL;
1160   info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gca_service_interface_info.parent_struct, property_name);
1161   g_assert (info != NULL);
1162   pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1163   if (pspec == NULL)
1164     {
1165       g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1166     }
1167   else
1168     {
1169       g_value_init (&value, pspec->value_type);
1170       g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1171       ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1172       g_value_unset (&value);
1173     }
1174   return ret;
1175 }
1176 
1177 static gboolean
_gca_service_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)1178 _gca_service_skeleton_handle_set_property (
1179   GDBusConnection *connection G_GNUC_UNUSED,
1180   const gchar *sender G_GNUC_UNUSED,
1181   const gchar *object_path G_GNUC_UNUSED,
1182   const gchar *interface_name G_GNUC_UNUSED,
1183   const gchar *property_name,
1184   GVariant *variant,
1185   GError **error,
1186   gpointer user_data)
1187 {
1188   GcaServiceSkeleton *skeleton = GCA_SERVICE_SKELETON (user_data);
1189   GValue value = G_VALUE_INIT;
1190   GParamSpec *pspec;
1191   _ExtendedGDBusPropertyInfo *info;
1192   gboolean ret;
1193   ret = FALSE;
1194   info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gca_service_interface_info.parent_struct, property_name);
1195   g_assert (info != NULL);
1196   pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1197   if (pspec == NULL)
1198     {
1199       g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1200     }
1201   else
1202     {
1203       if (info->use_gvariant)
1204         g_value_set_variant (&value, variant);
1205       else
1206         g_dbus_gvariant_to_gvalue (variant, &value);
1207       g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1208       g_value_unset (&value);
1209       ret = TRUE;
1210     }
1211   return ret;
1212 }
1213 
1214 static const GDBusInterfaceVTable _gca_service_skeleton_vtable =
1215 {
1216   _gca_service_skeleton_handle_method_call,
1217   _gca_service_skeleton_handle_get_property,
1218   _gca_service_skeleton_handle_set_property,
1219   {NULL}
1220 };
1221 
1222 static GDBusInterfaceInfo *
gca_service_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)1223 gca_service_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1224 {
1225   return gca_service_interface_info ();
1226 }
1227 
1228 static GDBusInterfaceVTable *
gca_service_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)1229 gca_service_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1230 {
1231   return (GDBusInterfaceVTable *) &_gca_service_skeleton_vtable;
1232 }
1233 
1234 static GVariant *
gca_service_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)1235 gca_service_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1236 {
1237   GcaServiceSkeleton *skeleton = GCA_SERVICE_SKELETON (_skeleton);
1238 
1239   GVariantBuilder builder;
1240   guint n;
1241   g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1242   if (_gca_service_interface_info.parent_struct.properties == NULL)
1243     goto out;
1244   for (n = 0; _gca_service_interface_info.parent_struct.properties[n] != NULL; n++)
1245     {
1246       GDBusPropertyInfo *info = _gca_service_interface_info.parent_struct.properties[n];
1247       if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1248         {
1249           GVariant *value;
1250           value = _gca_service_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.CodeAssist.v1.Service", info->name, NULL, skeleton);
1251           if (value != NULL)
1252             {
1253               g_variant_take_ref (value);
1254               g_variant_builder_add (&builder, "{sv}", info->name, value);
1255               g_variant_unref (value);
1256             }
1257         }
1258     }
1259 out:
1260   return g_variant_builder_end (&builder);
1261 }
1262 
1263 static void
gca_service_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)1264 gca_service_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1265 {
1266 }
1267 
1268 static void gca_service_skeleton_iface_init (GcaServiceIface *iface);
1269 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1270 G_DEFINE_TYPE_WITH_CODE (GcaServiceSkeleton, gca_service_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1271                          G_ADD_PRIVATE (GcaServiceSkeleton)
1272                          G_IMPLEMENT_INTERFACE (GCA_TYPE_SERVICE, gca_service_skeleton_iface_init));
1273 
1274 #else
1275 G_DEFINE_TYPE_WITH_CODE (GcaServiceSkeleton, gca_service_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1276                          G_IMPLEMENT_INTERFACE (GCA_TYPE_SERVICE, gca_service_skeleton_iface_init));
1277 
1278 #endif
1279 static void
gca_service_skeleton_finalize(GObject * object)1280 gca_service_skeleton_finalize (GObject *object)
1281 {
1282   GcaServiceSkeleton *skeleton = GCA_SERVICE_SKELETON (object);
1283   g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1284   if (skeleton->priv->changed_properties_idle_source != NULL)
1285     g_source_destroy (skeleton->priv->changed_properties_idle_source);
1286   g_main_context_unref (skeleton->priv->context);
1287   g_mutex_clear (&skeleton->priv->lock);
1288   G_OBJECT_CLASS (gca_service_skeleton_parent_class)->finalize (object);
1289 }
1290 
1291 static void
gca_service_skeleton_init(GcaServiceSkeleton * skeleton)1292 gca_service_skeleton_init (GcaServiceSkeleton *skeleton)
1293 {
1294 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1295   skeleton->priv = gca_service_skeleton_get_instance_private (skeleton);
1296 #else
1297   skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, GCA_TYPE_SERVICE_SKELETON, GcaServiceSkeletonPrivate);
1298 #endif
1299 
1300   g_mutex_init (&skeleton->priv->lock);
1301   skeleton->priv->context = g_main_context_ref_thread_default ();
1302 }
1303 
1304 static void
gca_service_skeleton_class_init(GcaServiceSkeletonClass * klass)1305 gca_service_skeleton_class_init (GcaServiceSkeletonClass *klass)
1306 {
1307   GObjectClass *gobject_class;
1308   GDBusInterfaceSkeletonClass *skeleton_class;
1309 
1310   gobject_class = G_OBJECT_CLASS (klass);
1311   gobject_class->finalize = gca_service_skeleton_finalize;
1312 
1313   skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1314   skeleton_class->get_info = gca_service_skeleton_dbus_interface_get_info;
1315   skeleton_class->get_properties = gca_service_skeleton_dbus_interface_get_properties;
1316   skeleton_class->flush = gca_service_skeleton_dbus_interface_flush;
1317   skeleton_class->get_vtable = gca_service_skeleton_dbus_interface_get_vtable;
1318 
1319 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1320   g_type_class_add_private (klass, sizeof (GcaServiceSkeletonPrivate));
1321 #endif
1322 }
1323 
1324 static void
gca_service_skeleton_iface_init(GcaServiceIface * iface)1325 gca_service_skeleton_iface_init (GcaServiceIface *iface)
1326 {
1327 }
1328 
1329 /**
1330  * gca_service_skeleton_new:
1331  *
1332  * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-gnome-CodeAssist-v1-Service.top_of_page">org.gnome.CodeAssist.v1.Service</link>.
1333  *
1334  * Returns: (transfer full) (type GcaServiceSkeleton): The skeleton object.
1335  *
1336  * Since: 3.32
1337  */
1338 GcaService *
gca_service_skeleton_new(void)1339 gca_service_skeleton_new (void)
1340 {
1341   return GCA_SERVICE (g_object_new (GCA_TYPE_SERVICE_SKELETON, NULL));
1342 }
1343 
1344