No issues found
1 /*
2 * Generated by gdbus-codegen 2.34.2. 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 "nautilus-generated.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.Nautilus.FileOperations
153 * ------------------------------------------------------------------------
154 */
155
156 /**
157 * SECTION:NautilusDBusFileOperations
158 * @title: NautilusDBusFileOperations
159 * @short_description: Generated C code for the org.gnome.Nautilus.FileOperations D-Bus interface
160 *
161 * This section contains code for working with the <link linkend="gdbus-interface-org-gnome-Nautilus-FileOperations.top_of_page">org.gnome.Nautilus.FileOperations</link> D-Bus interface in C.
162 */
163
164 /* ---- Introspection data for org.gnome.Nautilus.FileOperations ---- */
165
166 static const _ExtendedGDBusArgInfo _nautilus_dbus_file_operations_method_info_copy_uris_IN_ARG_SourceFilesURIList =
167 {
168 {
169 -1,
170 (gchar *) "SourceFilesURIList",
171 (gchar *) "as",
172 NULL
173 },
174 FALSE
175 };
176
177 static const _ExtendedGDBusArgInfo _nautilus_dbus_file_operations_method_info_copy_uris_IN_ARG_DestinationDirectoryURI =
178 {
179 {
180 -1,
181 (gchar *) "DestinationDirectoryURI",
182 (gchar *) "s",
183 NULL
184 },
185 FALSE
186 };
187
188 static const _ExtendedGDBusArgInfo * const _nautilus_dbus_file_operations_method_info_copy_uris_IN_ARG_pointers[] =
189 {
190 &_nautilus_dbus_file_operations_method_info_copy_uris_IN_ARG_SourceFilesURIList,
191 &_nautilus_dbus_file_operations_method_info_copy_uris_IN_ARG_DestinationDirectoryURI,
192 NULL
193 };
194
195 static const _ExtendedGDBusMethodInfo _nautilus_dbus_file_operations_method_info_copy_uris =
196 {
197 {
198 -1,
199 (gchar *) "CopyURIs",
200 (GDBusArgInfo **) &_nautilus_dbus_file_operations_method_info_copy_uris_IN_ARG_pointers,
201 NULL,
202 NULL
203 },
204 "handle-copy-uris",
205 FALSE
206 };
207
208 static const _ExtendedGDBusMethodInfo _nautilus_dbus_file_operations_method_info_empty_trash =
209 {
210 {
211 -1,
212 (gchar *) "EmptyTrash",
213 NULL,
214 NULL,
215 NULL
216 },
217 "handle-empty-trash",
218 FALSE
219 };
220
221 static const _ExtendedGDBusArgInfo _nautilus_dbus_file_operations_method_info_copy_file_IN_ARG_SourceFileURI =
222 {
223 {
224 -1,
225 (gchar *) "SourceFileURI",
226 (gchar *) "s",
227 NULL
228 },
229 FALSE
230 };
231
232 static const _ExtendedGDBusArgInfo _nautilus_dbus_file_operations_method_info_copy_file_IN_ARG_SourceDisplayName =
233 {
234 {
235 -1,
236 (gchar *) "SourceDisplayName",
237 (gchar *) "s",
238 NULL
239 },
240 FALSE
241 };
242
243 static const _ExtendedGDBusArgInfo _nautilus_dbus_file_operations_method_info_copy_file_IN_ARG_DestinationDirectoryURI =
244 {
245 {
246 -1,
247 (gchar *) "DestinationDirectoryURI",
248 (gchar *) "s",
249 NULL
250 },
251 FALSE
252 };
253
254 static const _ExtendedGDBusArgInfo _nautilus_dbus_file_operations_method_info_copy_file_IN_ARG_DestinationDisplayName =
255 {
256 {
257 -1,
258 (gchar *) "DestinationDisplayName",
259 (gchar *) "s",
260 NULL
261 },
262 FALSE
263 };
264
265 static const _ExtendedGDBusArgInfo * const _nautilus_dbus_file_operations_method_info_copy_file_IN_ARG_pointers[] =
266 {
267 &_nautilus_dbus_file_operations_method_info_copy_file_IN_ARG_SourceFileURI,
268 &_nautilus_dbus_file_operations_method_info_copy_file_IN_ARG_SourceDisplayName,
269 &_nautilus_dbus_file_operations_method_info_copy_file_IN_ARG_DestinationDirectoryURI,
270 &_nautilus_dbus_file_operations_method_info_copy_file_IN_ARG_DestinationDisplayName,
271 NULL
272 };
273
274 static const _ExtendedGDBusMethodInfo _nautilus_dbus_file_operations_method_info_copy_file =
275 {
276 {
277 -1,
278 (gchar *) "CopyFile",
279 (GDBusArgInfo **) &_nautilus_dbus_file_operations_method_info_copy_file_IN_ARG_pointers,
280 NULL,
281 NULL
282 },
283 "handle-copy-file",
284 FALSE
285 };
286
287 static const _ExtendedGDBusMethodInfo * const _nautilus_dbus_file_operations_method_info_pointers[] =
288 {
289 &_nautilus_dbus_file_operations_method_info_copy_uris,
290 &_nautilus_dbus_file_operations_method_info_empty_trash,
291 &_nautilus_dbus_file_operations_method_info_copy_file,
292 NULL
293 };
294
295 static const _ExtendedGDBusInterfaceInfo _nautilus_dbus_file_operations_interface_info =
296 {
297 {
298 -1,
299 (gchar *) "org.gnome.Nautilus.FileOperations",
300 (GDBusMethodInfo **) &_nautilus_dbus_file_operations_method_info_pointers,
301 NULL,
302 NULL,
303 NULL
304 },
305 "file-operations",
306 };
307
308
309 /**
310 * nautilus_dbus_file_operations_interface_info:
311 *
312 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-gnome-Nautilus-FileOperations.top_of_page">org.gnome.Nautilus.FileOperations</link> D-Bus interface.
313 *
314 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
315 */
316 GDBusInterfaceInfo *
317 nautilus_dbus_file_operations_interface_info (void)
318 {
319 return (GDBusInterfaceInfo *) &_nautilus_dbus_file_operations_interface_info.parent_struct;
320 }
321
322 /**
323 * nautilus_dbus_file_operations_override_properties:
324 * @klass: The class structure for a #GObject<!-- -->-derived class.
325 * @property_id_begin: The property id to assign to the first overridden property.
326 *
327 * Overrides all #GObject properties in the #NautilusDBusFileOperations interface for a concrete class.
328 * The properties are overridden in the order they are defined.
329 *
330 * Returns: The last property id.
331 */
332 guint
333 nautilus_dbus_file_operations_override_properties (GObjectClass *klass, guint property_id_begin)
334 {
335 return property_id_begin - 1;
336 }
337
338
339
340 /**
341 * NautilusDBusFileOperations:
342 *
343 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-gnome-Nautilus-FileOperations.top_of_page">org.gnome.Nautilus.FileOperations</link>.
344 */
345
346 /**
347 * NautilusDBusFileOperationsIface:
348 * @parent_iface: The parent interface.
349 * @handle_copy_file: Handler for the #NautilusDBusFileOperations::handle-copy-file signal.
350 * @handle_copy_uris: Handler for the #NautilusDBusFileOperations::handle-copy-uris signal.
351 * @handle_empty_trash: Handler for the #NautilusDBusFileOperations::handle-empty-trash signal.
352 *
353 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-gnome-Nautilus-FileOperations.top_of_page">org.gnome.Nautilus.FileOperations</link>.
354 */
355
356 static void
357 nautilus_dbus_file_operations_default_init (NautilusDBusFileOperationsIface *iface)
358 {
359 /* GObject signals for incoming D-Bus method calls: */
360 /**
361 * NautilusDBusFileOperations::handle-copy-uris:
362 * @object: A #NautilusDBusFileOperations.
363 * @invocation: A #GDBusMethodInvocation.
364 * @arg_SourceFilesURIList: Argument passed by remote caller.
365 * @arg_DestinationDirectoryURI: Argument passed by remote caller.
366 *
367 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-Nautilus-FileOperations.CopyURIs">CopyURIs()</link> D-Bus method.
368 *
369 * 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 nautilus_dbus_file_operations_complete_copy_uris() 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.
370 *
371 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
372 */
373 g_signal_new ("handle-copy-uris",
374 G_TYPE_FROM_INTERFACE (iface),
375 G_SIGNAL_RUN_LAST,
376 G_STRUCT_OFFSET (NautilusDBusFileOperationsIface, handle_copy_uris),
377 g_signal_accumulator_true_handled,
378 NULL,
379 g_cclosure_marshal_generic,
380 G_TYPE_BOOLEAN,
381 3,
382 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRV, G_TYPE_STRING);
383
384 /**
385 * NautilusDBusFileOperations::handle-empty-trash:
386 * @object: A #NautilusDBusFileOperations.
387 * @invocation: A #GDBusMethodInvocation.
388 *
389 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-Nautilus-FileOperations.EmptyTrash">EmptyTrash()</link> D-Bus method.
390 *
391 * 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 nautilus_dbus_file_operations_complete_empty_trash() 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.
392 *
393 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
394 */
395 g_signal_new ("handle-empty-trash",
396 G_TYPE_FROM_INTERFACE (iface),
397 G_SIGNAL_RUN_LAST,
398 G_STRUCT_OFFSET (NautilusDBusFileOperationsIface, handle_empty_trash),
399 g_signal_accumulator_true_handled,
400 NULL,
401 g_cclosure_marshal_generic,
402 G_TYPE_BOOLEAN,
403 1,
404 G_TYPE_DBUS_METHOD_INVOCATION);
405
406 /**
407 * NautilusDBusFileOperations::handle-copy-file:
408 * @object: A #NautilusDBusFileOperations.
409 * @invocation: A #GDBusMethodInvocation.
410 * @arg_SourceFileURI: Argument passed by remote caller.
411 * @arg_SourceDisplayName: Argument passed by remote caller.
412 * @arg_DestinationDirectoryURI: Argument passed by remote caller.
413 * @arg_DestinationDisplayName: Argument passed by remote caller.
414 *
415 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-Nautilus-FileOperations.CopyFile">CopyFile()</link> D-Bus method.
416 *
417 * 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 nautilus_dbus_file_operations_complete_copy_file() 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.
418 *
419 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
420 */
421 g_signal_new ("handle-copy-file",
422 G_TYPE_FROM_INTERFACE (iface),
423 G_SIGNAL_RUN_LAST,
424 G_STRUCT_OFFSET (NautilusDBusFileOperationsIface, handle_copy_file),
425 g_signal_accumulator_true_handled,
426 NULL,
427 g_cclosure_marshal_generic,
428 G_TYPE_BOOLEAN,
429 5,
430 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
431
432 }
433
434 typedef NautilusDBusFileOperationsIface NautilusDBusFileOperationsInterface;
435 G_DEFINE_INTERFACE (NautilusDBusFileOperations, nautilus_dbus_file_operations, G_TYPE_OBJECT);
436
437 /**
438 * nautilus_dbus_file_operations_call_copy_uris:
439 * @proxy: A #NautilusDBusFileOperationsProxy.
440 * @arg_SourceFilesURIList: Argument to pass with the method invocation.
441 * @arg_DestinationDirectoryURI: Argument to pass with the method invocation.
442 * @cancellable: (allow-none): A #GCancellable or %NULL.
443 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
444 * @user_data: User data to pass to @callback.
445 *
446 * Asynchronously invokes the <link linkend="gdbus-method-org-gnome-Nautilus-FileOperations.CopyURIs">CopyURIs()</link> D-Bus method on @proxy.
447 * 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.
448 * You can then call nautilus_dbus_file_operations_call_copy_uris_finish() to get the result of the operation.
449 *
450 * See nautilus_dbus_file_operations_call_copy_uris_sync() for the synchronous, blocking version of this method.
451 */
452 void
453 nautilus_dbus_file_operations_call_copy_uris (
454 NautilusDBusFileOperations *proxy,
455 const gchar *const *arg_SourceFilesURIList,
456 const gchar *arg_DestinationDirectoryURI,
457 GCancellable *cancellable,
458 GAsyncReadyCallback callback,
459 gpointer user_data)
460 {
461 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
462 "CopyURIs",
463 g_variant_new ("(^ass)",
464 arg_SourceFilesURIList,
465 arg_DestinationDirectoryURI),
466 G_DBUS_CALL_FLAGS_NONE,
467 -1,
468 cancellable,
469 callback,
470 user_data);
471 }
472
473 /**
474 * nautilus_dbus_file_operations_call_copy_uris_finish:
475 * @proxy: A #NautilusDBusFileOperationsProxy.
476 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to nautilus_dbus_file_operations_call_copy_uris().
477 * @error: Return location for error or %NULL.
478 *
479 * Finishes an operation started with nautilus_dbus_file_operations_call_copy_uris().
480 *
481 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
482 */
483 gboolean
484 nautilus_dbus_file_operations_call_copy_uris_finish (
485 NautilusDBusFileOperations *proxy,
486 GAsyncResult *res,
487 GError **error)
488 {
489 GVariant *_ret;
490 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
491 if (_ret == NULL)
492 goto _out;
493 g_variant_get (_ret,
494 "()");
495 g_variant_unref (_ret);
496 _out:
497 return _ret != NULL;
498 }
499
500 /**
501 * nautilus_dbus_file_operations_call_copy_uris_sync:
502 * @proxy: A #NautilusDBusFileOperationsProxy.
503 * @arg_SourceFilesURIList: Argument to pass with the method invocation.
504 * @arg_DestinationDirectoryURI: Argument to pass with the method invocation.
505 * @cancellable: (allow-none): A #GCancellable or %NULL.
506 * @error: Return location for error or %NULL.
507 *
508 * Synchronously invokes the <link linkend="gdbus-method-org-gnome-Nautilus-FileOperations.CopyURIs">CopyURIs()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
509 *
510 * See nautilus_dbus_file_operations_call_copy_uris() for the asynchronous version of this method.
511 *
512 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
513 */
514 gboolean
515 nautilus_dbus_file_operations_call_copy_uris_sync (
516 NautilusDBusFileOperations *proxy,
517 const gchar *const *arg_SourceFilesURIList,
518 const gchar *arg_DestinationDirectoryURI,
519 GCancellable *cancellable,
520 GError **error)
521 {
522 GVariant *_ret;
523 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
524 "CopyURIs",
525 g_variant_new ("(^ass)",
526 arg_SourceFilesURIList,
527 arg_DestinationDirectoryURI),
528 G_DBUS_CALL_FLAGS_NONE,
529 -1,
530 cancellable,
531 error);
532 if (_ret == NULL)
533 goto _out;
534 g_variant_get (_ret,
535 "()");
536 g_variant_unref (_ret);
537 _out:
538 return _ret != NULL;
539 }
540
541 /**
542 * nautilus_dbus_file_operations_call_empty_trash:
543 * @proxy: A #NautilusDBusFileOperationsProxy.
544 * @cancellable: (allow-none): A #GCancellable or %NULL.
545 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
546 * @user_data: User data to pass to @callback.
547 *
548 * Asynchronously invokes the <link linkend="gdbus-method-org-gnome-Nautilus-FileOperations.EmptyTrash">EmptyTrash()</link> D-Bus method on @proxy.
549 * 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.
550 * You can then call nautilus_dbus_file_operations_call_empty_trash_finish() to get the result of the operation.
551 *
552 * See nautilus_dbus_file_operations_call_empty_trash_sync() for the synchronous, blocking version of this method.
553 */
554 void
555 nautilus_dbus_file_operations_call_empty_trash (
556 NautilusDBusFileOperations *proxy,
557 GCancellable *cancellable,
558 GAsyncReadyCallback callback,
559 gpointer user_data)
560 {
561 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
562 "EmptyTrash",
563 g_variant_new ("()"),
564 G_DBUS_CALL_FLAGS_NONE,
565 -1,
566 cancellable,
567 callback,
568 user_data);
569 }
570
571 /**
572 * nautilus_dbus_file_operations_call_empty_trash_finish:
573 * @proxy: A #NautilusDBusFileOperationsProxy.
574 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to nautilus_dbus_file_operations_call_empty_trash().
575 * @error: Return location for error or %NULL.
576 *
577 * Finishes an operation started with nautilus_dbus_file_operations_call_empty_trash().
578 *
579 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
580 */
581 gboolean
582 nautilus_dbus_file_operations_call_empty_trash_finish (
583 NautilusDBusFileOperations *proxy,
584 GAsyncResult *res,
585 GError **error)
586 {
587 GVariant *_ret;
588 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
589 if (_ret == NULL)
590 goto _out;
591 g_variant_get (_ret,
592 "()");
593 g_variant_unref (_ret);
594 _out:
595 return _ret != NULL;
596 }
597
598 /**
599 * nautilus_dbus_file_operations_call_empty_trash_sync:
600 * @proxy: A #NautilusDBusFileOperationsProxy.
601 * @cancellable: (allow-none): A #GCancellable or %NULL.
602 * @error: Return location for error or %NULL.
603 *
604 * Synchronously invokes the <link linkend="gdbus-method-org-gnome-Nautilus-FileOperations.EmptyTrash">EmptyTrash()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
605 *
606 * See nautilus_dbus_file_operations_call_empty_trash() for the asynchronous version of this method.
607 *
608 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
609 */
610 gboolean
611 nautilus_dbus_file_operations_call_empty_trash_sync (
612 NautilusDBusFileOperations *proxy,
613 GCancellable *cancellable,
614 GError **error)
615 {
616 GVariant *_ret;
617 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
618 "EmptyTrash",
619 g_variant_new ("()"),
620 G_DBUS_CALL_FLAGS_NONE,
621 -1,
622 cancellable,
623 error);
624 if (_ret == NULL)
625 goto _out;
626 g_variant_get (_ret,
627 "()");
628 g_variant_unref (_ret);
629 _out:
630 return _ret != NULL;
631 }
632
633 /**
634 * nautilus_dbus_file_operations_call_copy_file:
635 * @proxy: A #NautilusDBusFileOperationsProxy.
636 * @arg_SourceFileURI: Argument to pass with the method invocation.
637 * @arg_SourceDisplayName: Argument to pass with the method invocation.
638 * @arg_DestinationDirectoryURI: Argument to pass with the method invocation.
639 * @arg_DestinationDisplayName: Argument to pass with the method invocation.
640 * @cancellable: (allow-none): A #GCancellable or %NULL.
641 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
642 * @user_data: User data to pass to @callback.
643 *
644 * Asynchronously invokes the <link linkend="gdbus-method-org-gnome-Nautilus-FileOperations.CopyFile">CopyFile()</link> D-Bus method on @proxy.
645 * 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.
646 * You can then call nautilus_dbus_file_operations_call_copy_file_finish() to get the result of the operation.
647 *
648 * See nautilus_dbus_file_operations_call_copy_file_sync() for the synchronous, blocking version of this method.
649 */
650 void
651 nautilus_dbus_file_operations_call_copy_file (
652 NautilusDBusFileOperations *proxy,
653 const gchar *arg_SourceFileURI,
654 const gchar *arg_SourceDisplayName,
655 const gchar *arg_DestinationDirectoryURI,
656 const gchar *arg_DestinationDisplayName,
657 GCancellable *cancellable,
658 GAsyncReadyCallback callback,
659 gpointer user_data)
660 {
661 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
662 "CopyFile",
663 g_variant_new ("(ssss)",
664 arg_SourceFileURI,
665 arg_SourceDisplayName,
666 arg_DestinationDirectoryURI,
667 arg_DestinationDisplayName),
668 G_DBUS_CALL_FLAGS_NONE,
669 -1,
670 cancellable,
671 callback,
672 user_data);
673 }
674
675 /**
676 * nautilus_dbus_file_operations_call_copy_file_finish:
677 * @proxy: A #NautilusDBusFileOperationsProxy.
678 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to nautilus_dbus_file_operations_call_copy_file().
679 * @error: Return location for error or %NULL.
680 *
681 * Finishes an operation started with nautilus_dbus_file_operations_call_copy_file().
682 *
683 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
684 */
685 gboolean
686 nautilus_dbus_file_operations_call_copy_file_finish (
687 NautilusDBusFileOperations *proxy,
688 GAsyncResult *res,
689 GError **error)
690 {
691 GVariant *_ret;
692 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
693 if (_ret == NULL)
694 goto _out;
695 g_variant_get (_ret,
696 "()");
697 g_variant_unref (_ret);
698 _out:
699 return _ret != NULL;
700 }
701
702 /**
703 * nautilus_dbus_file_operations_call_copy_file_sync:
704 * @proxy: A #NautilusDBusFileOperationsProxy.
705 * @arg_SourceFileURI: Argument to pass with the method invocation.
706 * @arg_SourceDisplayName: Argument to pass with the method invocation.
707 * @arg_DestinationDirectoryURI: Argument to pass with the method invocation.
708 * @arg_DestinationDisplayName: Argument to pass with the method invocation.
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-Nautilus-FileOperations.CopyFile">CopyFile()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
713 *
714 * See nautilus_dbus_file_operations_call_copy_file() 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 nautilus_dbus_file_operations_call_copy_file_sync (
720 NautilusDBusFileOperations *proxy,
721 const gchar *arg_SourceFileURI,
722 const gchar *arg_SourceDisplayName,
723 const gchar *arg_DestinationDirectoryURI,
724 const gchar *arg_DestinationDisplayName,
725 GCancellable *cancellable,
726 GError **error)
727 {
728 GVariant *_ret;
729 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
730 "CopyFile",
731 g_variant_new ("(ssss)",
732 arg_SourceFileURI,
733 arg_SourceDisplayName,
734 arg_DestinationDirectoryURI,
735 arg_DestinationDisplayName),
736 G_DBUS_CALL_FLAGS_NONE,
737 -1,
738 cancellable,
739 error);
740 if (_ret == NULL)
741 goto _out;
742 g_variant_get (_ret,
743 "()");
744 g_variant_unref (_ret);
745 _out:
746 return _ret != NULL;
747 }
748
749 /**
750 * nautilus_dbus_file_operations_complete_copy_uris:
751 * @object: A #NautilusDBusFileOperations.
752 * @invocation: (transfer full): A #GDBusMethodInvocation.
753 *
754 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-Nautilus-FileOperations.CopyURIs">CopyURIs()</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.
755 *
756 * This method will free @invocation, you cannot use it afterwards.
757 */
758 void
759 nautilus_dbus_file_operations_complete_copy_uris (
760 NautilusDBusFileOperations *object,
761 GDBusMethodInvocation *invocation)
762 {
763 g_dbus_method_invocation_return_value (invocation,
764 g_variant_new ("()"));
765 }
766
767 /**
768 * nautilus_dbus_file_operations_complete_empty_trash:
769 * @object: A #NautilusDBusFileOperations.
770 * @invocation: (transfer full): A #GDBusMethodInvocation.
771 *
772 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-Nautilus-FileOperations.EmptyTrash">EmptyTrash()</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.
773 *
774 * This method will free @invocation, you cannot use it afterwards.
775 */
776 void
777 nautilus_dbus_file_operations_complete_empty_trash (
778 NautilusDBusFileOperations *object,
779 GDBusMethodInvocation *invocation)
780 {
781 g_dbus_method_invocation_return_value (invocation,
782 g_variant_new ("()"));
783 }
784
785 /**
786 * nautilus_dbus_file_operations_complete_copy_file:
787 * @object: A #NautilusDBusFileOperations.
788 * @invocation: (transfer full): A #GDBusMethodInvocation.
789 *
790 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-Nautilus-FileOperations.CopyFile">CopyFile()</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.
791 *
792 * This method will free @invocation, you cannot use it afterwards.
793 */
794 void
795 nautilus_dbus_file_operations_complete_copy_file (
796 NautilusDBusFileOperations *object,
797 GDBusMethodInvocation *invocation)
798 {
799 g_dbus_method_invocation_return_value (invocation,
800 g_variant_new ("()"));
801 }
802
803 /* ------------------------------------------------------------------------ */
804
805 /**
806 * NautilusDBusFileOperationsProxy:
807 *
808 * The #NautilusDBusFileOperationsProxy structure contains only private data and should only be accessed using the provided API.
809 */
810
811 /**
812 * NautilusDBusFileOperationsProxyClass:
813 * @parent_class: The parent class.
814 *
815 * Class structure for #NautilusDBusFileOperationsProxy.
816 */
817
818 struct _NautilusDBusFileOperationsProxyPrivate
819 {
820 GData *qdata;
821 };
822
823 static void nautilus_dbus_file_operations_proxy_iface_init (NautilusDBusFileOperationsIface *iface);
824
825 G_DEFINE_TYPE_WITH_CODE (NautilusDBusFileOperationsProxy, nautilus_dbus_file_operations_proxy, G_TYPE_DBUS_PROXY,
826 G_IMPLEMENT_INTERFACE (NAUTILUS_DBUS_TYPE_FILE_OPERATIONS, nautilus_dbus_file_operations_proxy_iface_init));
827
828 static void
829 nautilus_dbus_file_operations_proxy_finalize (GObject *object)
830 {
831 NautilusDBusFileOperationsProxy *proxy = NAUTILUS_DBUS_FILE_OPERATIONS_PROXY (object);
832 g_datalist_clear (&proxy->priv->qdata);
833 G_OBJECT_CLASS (nautilus_dbus_file_operations_proxy_parent_class)->finalize (object);
834 }
835
836 static void
837 nautilus_dbus_file_operations_proxy_get_property (GObject *object,
838 guint prop_id,
839 GValue *value,
840 GParamSpec *pspec)
841 {
842 }
843
844 static void
845 nautilus_dbus_file_operations_proxy_set_property (GObject *object,
846 guint prop_id,
847 const GValue *value,
848 GParamSpec *pspec)
849 {
850 }
851
852 static void
853 nautilus_dbus_file_operations_proxy_g_signal (GDBusProxy *proxy,
854 const gchar *sender_name,
855 const gchar *signal_name,
856 GVariant *parameters)
857 {
858 _ExtendedGDBusSignalInfo *info;
859 GVariantIter iter;
860 GVariant *child;
861 GValue *paramv;
862 guint num_params;
863 guint n;
864 guint signal_id;
865 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_nautilus_dbus_file_operations_interface_info.parent_struct, signal_name);
866 if (info == NULL)
867 return;
868 num_params = g_variant_n_children (parameters);
869 paramv = g_new0 (GValue, num_params + 1);
870 g_value_init (¶mv[0], NAUTILUS_DBUS_TYPE_FILE_OPERATIONS);
871 g_value_set_object (¶mv[0], proxy);
872 g_variant_iter_init (&iter, parameters);
873 n = 1;
874 while ((child = g_variant_iter_next_value (&iter)) != NULL)
875 {
876 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
877 if (arg_info->use_gvariant)
878 {
879 g_value_init (¶mv[n], G_TYPE_VARIANT);
880 g_value_set_variant (¶mv[n], child);
881 n++;
882 }
883 else
884 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
885 g_variant_unref (child);
886 }
887 signal_id = g_signal_lookup (info->signal_name, NAUTILUS_DBUS_TYPE_FILE_OPERATIONS);
888 g_signal_emitv (paramv, signal_id, 0, NULL);
889 for (n = 0; n < num_params + 1; n++)
890 g_value_unset (¶mv[n]);
891 g_free (paramv);
892 }
893
894 static void
895 nautilus_dbus_file_operations_proxy_g_properties_changed (GDBusProxy *_proxy,
896 GVariant *changed_properties,
897 const gchar *const *invalidated_properties)
898 {
899 NautilusDBusFileOperationsProxy *proxy = NAUTILUS_DBUS_FILE_OPERATIONS_PROXY (_proxy);
900 guint n;
901 const gchar *key;
902 GVariantIter *iter;
903 _ExtendedGDBusPropertyInfo *info;
904 g_variant_get (changed_properties, "a{sv}", &iter);
905 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
906 {
907 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_nautilus_dbus_file_operations_interface_info.parent_struct, key);
908 g_datalist_remove_data (&proxy->priv->qdata, key);
909 if (info != NULL)
910 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
911 }
912 g_variant_iter_free (iter);
913 for (n = 0; invalidated_properties[n] != NULL; n++)
914 {
915 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_nautilus_dbus_file_operations_interface_info.parent_struct, invalidated_properties[n]);
916 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
917 if (info != NULL)
918 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
919 }
920 }
921
922 static void
923 nautilus_dbus_file_operations_proxy_init (NautilusDBusFileOperationsProxy *proxy)
924 {
925 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, NAUTILUS_DBUS_TYPE_FILE_OPERATIONS_PROXY, NautilusDBusFileOperationsProxyPrivate);
926 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), nautilus_dbus_file_operations_interface_info ());
927 }
928
929 static void
930 nautilus_dbus_file_operations_proxy_class_init (NautilusDBusFileOperationsProxyClass *klass)
931 {
932 GObjectClass *gobject_class;
933 GDBusProxyClass *proxy_class;
934
935 g_type_class_add_private (klass, sizeof (NautilusDBusFileOperationsProxyPrivate));
936
937 gobject_class = G_OBJECT_CLASS (klass);
938 gobject_class->finalize = nautilus_dbus_file_operations_proxy_finalize;
939 gobject_class->get_property = nautilus_dbus_file_operations_proxy_get_property;
940 gobject_class->set_property = nautilus_dbus_file_operations_proxy_set_property;
941
942 proxy_class = G_DBUS_PROXY_CLASS (klass);
943 proxy_class->g_signal = nautilus_dbus_file_operations_proxy_g_signal;
944 proxy_class->g_properties_changed = nautilus_dbus_file_operations_proxy_g_properties_changed;
945
946 }
947
948 static void
949 nautilus_dbus_file_operations_proxy_iface_init (NautilusDBusFileOperationsIface *iface)
950 {
951 }
952
953 /**
954 * nautilus_dbus_file_operations_proxy_new:
955 * @connection: A #GDBusConnection.
956 * @flags: Flags from the #GDBusProxyFlags enumeration.
957 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
958 * @object_path: An object path.
959 * @cancellable: (allow-none): A #GCancellable or %NULL.
960 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
961 * @user_data: User data to pass to @callback.
962 *
963 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-gnome-Nautilus-FileOperations.top_of_page">org.gnome.Nautilus.FileOperations</link>. See g_dbus_proxy_new() for more details.
964 *
965 * 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.
966 * You can then call nautilus_dbus_file_operations_proxy_new_finish() to get the result of the operation.
967 *
968 * See nautilus_dbus_file_operations_proxy_new_sync() for the synchronous, blocking version of this constructor.
969 */
970 void
971 nautilus_dbus_file_operations_proxy_new (
972 GDBusConnection *connection,
973 GDBusProxyFlags flags,
974 const gchar *name,
975 const gchar *object_path,
976 GCancellable *cancellable,
977 GAsyncReadyCallback callback,
978 gpointer user_data)
979 {
980 g_async_initable_new_async (NAUTILUS_DBUS_TYPE_FILE_OPERATIONS_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.Nautilus.FileOperations", NULL);
981 }
982
983 /**
984 * nautilus_dbus_file_operations_proxy_new_finish:
985 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to nautilus_dbus_file_operations_proxy_new().
986 * @error: Return location for error or %NULL
987 *
988 * Finishes an operation started with nautilus_dbus_file_operations_proxy_new().
989 *
990 * Returns: (transfer full) (type NautilusDBusFileOperationsProxy): The constructed proxy object or %NULL if @error is set.
991 */
992 NautilusDBusFileOperations *
993 nautilus_dbus_file_operations_proxy_new_finish (
994 GAsyncResult *res,
995 GError **error)
996 {
997 GObject *ret;
998 GObject *source_object;
999 source_object = g_async_result_get_source_object (res);
1000 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1001 g_object_unref (source_object);
1002 if (ret != NULL)
1003 return NAUTILUS_DBUS_FILE_OPERATIONS (ret);
1004 else
1005 return NULL;
1006 }
1007
1008 /**
1009 * nautilus_dbus_file_operations_proxy_new_sync:
1010 * @connection: A #GDBusConnection.
1011 * @flags: Flags from the #GDBusProxyFlags enumeration.
1012 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1013 * @object_path: An object path.
1014 * @cancellable: (allow-none): A #GCancellable or %NULL.
1015 * @error: Return location for error or %NULL
1016 *
1017 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-gnome-Nautilus-FileOperations.top_of_page">org.gnome.Nautilus.FileOperations</link>. See g_dbus_proxy_new_sync() for more details.
1018 *
1019 * The calling thread is blocked until a reply is received.
1020 *
1021 * See nautilus_dbus_file_operations_proxy_new() for the asynchronous version of this constructor.
1022 *
1023 * Returns: (transfer full) (type NautilusDBusFileOperationsProxy): The constructed proxy object or %NULL if @error is set.
1024 */
1025 NautilusDBusFileOperations *
1026 nautilus_dbus_file_operations_proxy_new_sync (
1027 GDBusConnection *connection,
1028 GDBusProxyFlags flags,
1029 const gchar *name,
1030 const gchar *object_path,
1031 GCancellable *cancellable,
1032 GError **error)
1033 {
1034 GInitable *ret;
1035 ret = g_initable_new (NAUTILUS_DBUS_TYPE_FILE_OPERATIONS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.gnome.Nautilus.FileOperations", NULL);
1036 if (ret != NULL)
1037 return NAUTILUS_DBUS_FILE_OPERATIONS (ret);
1038 else
1039 return NULL;
1040 }
1041
1042
1043 /**
1044 * nautilus_dbus_file_operations_proxy_new_for_bus:
1045 * @bus_type: A #GBusType.
1046 * @flags: Flags from the #GDBusProxyFlags enumeration.
1047 * @name: A bus name (well-known or unique).
1048 * @object_path: An object path.
1049 * @cancellable: (allow-none): A #GCancellable or %NULL.
1050 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1051 * @user_data: User data to pass to @callback.
1052 *
1053 * Like nautilus_dbus_file_operations_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1054 *
1055 * 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.
1056 * You can then call nautilus_dbus_file_operations_proxy_new_for_bus_finish() to get the result of the operation.
1057 *
1058 * See nautilus_dbus_file_operations_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1059 */
1060 void
1061 nautilus_dbus_file_operations_proxy_new_for_bus (
1062 GBusType bus_type,
1063 GDBusProxyFlags flags,
1064 const gchar *name,
1065 const gchar *object_path,
1066 GCancellable *cancellable,
1067 GAsyncReadyCallback callback,
1068 gpointer user_data)
1069 {
1070 g_async_initable_new_async (NAUTILUS_DBUS_TYPE_FILE_OPERATIONS_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.Nautilus.FileOperations", NULL);
1071 }
1072
1073 /**
1074 * nautilus_dbus_file_operations_proxy_new_for_bus_finish:
1075 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to nautilus_dbus_file_operations_proxy_new_for_bus().
1076 * @error: Return location for error or %NULL
1077 *
1078 * Finishes an operation started with nautilus_dbus_file_operations_proxy_new_for_bus().
1079 *
1080 * Returns: (transfer full) (type NautilusDBusFileOperationsProxy): The constructed proxy object or %NULL if @error is set.
1081 */
1082 NautilusDBusFileOperations *
1083 nautilus_dbus_file_operations_proxy_new_for_bus_finish (
1084 GAsyncResult *res,
1085 GError **error)
1086 {
1087 GObject *ret;
1088 GObject *source_object;
1089 source_object = g_async_result_get_source_object (res);
1090 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1091 g_object_unref (source_object);
1092 if (ret != NULL)
1093 return NAUTILUS_DBUS_FILE_OPERATIONS (ret);
1094 else
1095 return NULL;
1096 }
1097
1098 /**
1099 * nautilus_dbus_file_operations_proxy_new_for_bus_sync:
1100 * @bus_type: A #GBusType.
1101 * @flags: Flags from the #GDBusProxyFlags enumeration.
1102 * @name: A bus name (well-known or unique).
1103 * @object_path: An object path.
1104 * @cancellable: (allow-none): A #GCancellable or %NULL.
1105 * @error: Return location for error or %NULL
1106 *
1107 * Like nautilus_dbus_file_operations_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1108 *
1109 * The calling thread is blocked until a reply is received.
1110 *
1111 * See nautilus_dbus_file_operations_proxy_new_for_bus() for the asynchronous version of this constructor.
1112 *
1113 * Returns: (transfer full) (type NautilusDBusFileOperationsProxy): The constructed proxy object or %NULL if @error is set.
1114 */
1115 NautilusDBusFileOperations *
1116 nautilus_dbus_file_operations_proxy_new_for_bus_sync (
1117 GBusType bus_type,
1118 GDBusProxyFlags flags,
1119 const gchar *name,
1120 const gchar *object_path,
1121 GCancellable *cancellable,
1122 GError **error)
1123 {
1124 GInitable *ret;
1125 ret = g_initable_new (NAUTILUS_DBUS_TYPE_FILE_OPERATIONS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.gnome.Nautilus.FileOperations", NULL);
1126 if (ret != NULL)
1127 return NAUTILUS_DBUS_FILE_OPERATIONS (ret);
1128 else
1129 return NULL;
1130 }
1131
1132
1133 /* ------------------------------------------------------------------------ */
1134
1135 /**
1136 * NautilusDBusFileOperationsSkeleton:
1137 *
1138 * The #NautilusDBusFileOperationsSkeleton structure contains only private data and should only be accessed using the provided API.
1139 */
1140
1141 /**
1142 * NautilusDBusFileOperationsSkeletonClass:
1143 * @parent_class: The parent class.
1144 *
1145 * Class structure for #NautilusDBusFileOperationsSkeleton.
1146 */
1147
1148 struct _NautilusDBusFileOperationsSkeletonPrivate
1149 {
1150 GValue *properties;
1151 GList *changed_properties;
1152 GSource *changed_properties_idle_source;
1153 GMainContext *context;
1154 GMutex lock;
1155 };
1156
1157 static void
1158 _nautilus_dbus_file_operations_skeleton_handle_method_call (
1159 GDBusConnection *connection,
1160 const gchar *sender,
1161 const gchar *object_path,
1162 const gchar *interface_name,
1163 const gchar *method_name,
1164 GVariant *parameters,
1165 GDBusMethodInvocation *invocation,
1166 gpointer user_data)
1167 {
1168 NautilusDBusFileOperationsSkeleton *skeleton = NAUTILUS_DBUS_FILE_OPERATIONS_SKELETON (user_data);
1169 _ExtendedGDBusMethodInfo *info;
1170 GVariantIter iter;
1171 GVariant *child;
1172 GValue *paramv;
1173 guint num_params;
1174 guint num_extra;
1175 guint n;
1176 guint signal_id;
1177 GValue return_value = G_VALUE_INIT;
1178 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1179 g_assert (info != NULL);
1180 num_params = g_variant_n_children (parameters);
1181 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1182 n = 0;
1183 g_value_init (¶mv[n], NAUTILUS_DBUS_TYPE_FILE_OPERATIONS);
1184 g_value_set_object (¶mv[n++], skeleton);
1185 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1186 g_value_set_object (¶mv[n++], invocation);
1187 if (info->pass_fdlist)
1188 {
1189 #ifdef G_OS_UNIX
1190 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
1191 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1192 #else
1193 g_assert_not_reached ();
1194 #endif
1195 }
1196 g_variant_iter_init (&iter, parameters);
1197 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1198 {
1199 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1200 if (arg_info->use_gvariant)
1201 {
1202 g_value_init (¶mv[n], G_TYPE_VARIANT);
1203 g_value_set_variant (¶mv[n], child);
1204 n++;
1205 }
1206 else
1207 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
1208 g_variant_unref (child);
1209 }
1210 signal_id = g_signal_lookup (info->signal_name, NAUTILUS_DBUS_TYPE_FILE_OPERATIONS);
1211 g_value_init (&return_value, G_TYPE_BOOLEAN);
1212 g_signal_emitv (paramv, signal_id, 0, &return_value);
1213 if (!g_value_get_boolean (&return_value))
1214 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);
1215 g_value_unset (&return_value);
1216 for (n = 0; n < num_params + num_extra; n++)
1217 g_value_unset (¶mv[n]);
1218 g_free (paramv);
1219 }
1220
1221 static GVariant *
1222 _nautilus_dbus_file_operations_skeleton_handle_get_property (
1223 GDBusConnection *connection,
1224 const gchar *sender,
1225 const gchar *object_path,
1226 const gchar *interface_name,
1227 const gchar *property_name,
1228 GError **error,
1229 gpointer user_data)
1230 {
1231 NautilusDBusFileOperationsSkeleton *skeleton = NAUTILUS_DBUS_FILE_OPERATIONS_SKELETON (user_data);
1232 GValue value = G_VALUE_INIT;
1233 GParamSpec *pspec;
1234 _ExtendedGDBusPropertyInfo *info;
1235 GVariant *ret;
1236 ret = NULL;
1237 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_nautilus_dbus_file_operations_interface_info.parent_struct, property_name);
1238 g_assert (info != NULL);
1239 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1240 if (pspec == NULL)
1241 {
1242 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1243 }
1244 else
1245 {
1246 g_value_init (&value, pspec->value_type);
1247 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1248 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1249 g_value_unset (&value);
1250 }
1251 return ret;
1252 }
1253
1254 static gboolean
1255 _nautilus_dbus_file_operations_skeleton_handle_set_property (
1256 GDBusConnection *connection,
1257 const gchar *sender,
1258 const gchar *object_path,
1259 const gchar *interface_name,
1260 const gchar *property_name,
1261 GVariant *variant,
1262 GError **error,
1263 gpointer user_data)
1264 {
1265 NautilusDBusFileOperationsSkeleton *skeleton = NAUTILUS_DBUS_FILE_OPERATIONS_SKELETON (user_data);
1266 GValue value = G_VALUE_INIT;
1267 GParamSpec *pspec;
1268 _ExtendedGDBusPropertyInfo *info;
1269 gboolean ret;
1270 ret = FALSE;
1271 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_nautilus_dbus_file_operations_interface_info.parent_struct, property_name);
1272 g_assert (info != NULL);
1273 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1274 if (pspec == NULL)
1275 {
1276 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1277 }
1278 else
1279 {
1280 if (info->use_gvariant)
1281 g_value_set_variant (&value, variant);
1282 else
1283 g_dbus_gvariant_to_gvalue (variant, &value);
1284 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1285 g_value_unset (&value);
1286 ret = TRUE;
1287 }
1288 return ret;
1289 }
1290
1291 static const GDBusInterfaceVTable _nautilus_dbus_file_operations_skeleton_vtable =
1292 {
1293 _nautilus_dbus_file_operations_skeleton_handle_method_call,
1294 _nautilus_dbus_file_operations_skeleton_handle_get_property,
1295 _nautilus_dbus_file_operations_skeleton_handle_set_property
1296 };
1297
1298 static GDBusInterfaceInfo *
1299 nautilus_dbus_file_operations_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton)
1300 {
1301 return nautilus_dbus_file_operations_interface_info ();
1302 }
1303
1304 static GDBusInterfaceVTable *
1305 nautilus_dbus_file_operations_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton)
1306 {
1307 return (GDBusInterfaceVTable *) &_nautilus_dbus_file_operations_skeleton_vtable;
1308 }
1309
1310 static GVariant *
1311 nautilus_dbus_file_operations_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1312 {
1313 NautilusDBusFileOperationsSkeleton *skeleton = NAUTILUS_DBUS_FILE_OPERATIONS_SKELETON (_skeleton);
1314
1315 GVariantBuilder builder;
1316 guint n;
1317 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1318 if (_nautilus_dbus_file_operations_interface_info.parent_struct.properties == NULL)
1319 goto out;
1320 for (n = 0; _nautilus_dbus_file_operations_interface_info.parent_struct.properties[n] != NULL; n++)
1321 {
1322 GDBusPropertyInfo *info = _nautilus_dbus_file_operations_interface_info.parent_struct.properties[n];
1323 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1324 {
1325 GVariant *value;
1326 value = _nautilus_dbus_file_operations_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.Nautilus.FileOperations", info->name, NULL, skeleton);
1327 if (value != NULL)
1328 {
1329 g_variant_take_ref (value);
1330 g_variant_builder_add (&builder, "{sv}", info->name, value);
1331 g_variant_unref (value);
1332 }
1333 }
1334 }
1335 out:
1336 return g_variant_builder_end (&builder);
1337 }
1338
1339 static void
1340 nautilus_dbus_file_operations_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1341 {
1342 }
1343
1344 static void nautilus_dbus_file_operations_skeleton_iface_init (NautilusDBusFileOperationsIface *iface);
1345 G_DEFINE_TYPE_WITH_CODE (NautilusDBusFileOperationsSkeleton, nautilus_dbus_file_operations_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1346 G_IMPLEMENT_INTERFACE (NAUTILUS_DBUS_TYPE_FILE_OPERATIONS, nautilus_dbus_file_operations_skeleton_iface_init));
1347
1348 static void
1349 nautilus_dbus_file_operations_skeleton_finalize (GObject *object)
1350 {
1351 NautilusDBusFileOperationsSkeleton *skeleton = NAUTILUS_DBUS_FILE_OPERATIONS_SKELETON (object);
1352 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1353 if (skeleton->priv->changed_properties_idle_source != NULL)
1354 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1355 g_main_context_unref (skeleton->priv->context);
1356 g_mutex_clear (&skeleton->priv->lock);
1357 G_OBJECT_CLASS (nautilus_dbus_file_operations_skeleton_parent_class)->finalize (object);
1358 }
1359
1360 static void
1361 nautilus_dbus_file_operations_skeleton_init (NautilusDBusFileOperationsSkeleton *skeleton)
1362 {
1363 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, NAUTILUS_DBUS_TYPE_FILE_OPERATIONS_SKELETON, NautilusDBusFileOperationsSkeletonPrivate);
1364 g_mutex_init (&skeleton->priv->lock);
1365 skeleton->priv->context = g_main_context_ref_thread_default ();
1366 }
1367
1368 static void
1369 nautilus_dbus_file_operations_skeleton_class_init (NautilusDBusFileOperationsSkeletonClass *klass)
1370 {
1371 GObjectClass *gobject_class;
1372 GDBusInterfaceSkeletonClass *skeleton_class;
1373
1374 g_type_class_add_private (klass, sizeof (NautilusDBusFileOperationsSkeletonPrivate));
1375
1376 gobject_class = G_OBJECT_CLASS (klass);
1377 gobject_class->finalize = nautilus_dbus_file_operations_skeleton_finalize;
1378
1379 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1380 skeleton_class->get_info = nautilus_dbus_file_operations_skeleton_dbus_interface_get_info;
1381 skeleton_class->get_properties = nautilus_dbus_file_operations_skeleton_dbus_interface_get_properties;
1382 skeleton_class->flush = nautilus_dbus_file_operations_skeleton_dbus_interface_flush;
1383 skeleton_class->get_vtable = nautilus_dbus_file_operations_skeleton_dbus_interface_get_vtable;
1384 }
1385
1386 static void
1387 nautilus_dbus_file_operations_skeleton_iface_init (NautilusDBusFileOperationsIface *iface)
1388 {
1389 }
1390
1391 /**
1392 * nautilus_dbus_file_operations_skeleton_new:
1393 *
1394 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-gnome-Nautilus-FileOperations.top_of_page">org.gnome.Nautilus.FileOperations</link>.
1395 *
1396 * Returns: (transfer full) (type NautilusDBusFileOperationsSkeleton): The skeleton object.
1397 */
1398 NautilusDBusFileOperations *
1399 nautilus_dbus_file_operations_skeleton_new (void)
1400 {
1401 return NAUTILUS_DBUS_FILE_OPERATIONS (g_object_new (NAUTILUS_DBUS_TYPE_FILE_OPERATIONS_SKELETON, NULL));
1402 }
1403
1404 /* ------------------------------------------------------------------------
1405 * Code for Object, ObjectProxy and ObjectSkeleton
1406 * ------------------------------------------------------------------------
1407 */
1408
1409 /**
1410 * SECTION:NautilusDBusObject
1411 * @title: NautilusDBusObject
1412 * @short_description: Specialized GDBusObject types
1413 *
1414 * This section contains the #NautilusDBusObject, #NautilusDBusObjectProxy, and #NautilusDBusObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
1415 */
1416
1417 /**
1418 * NautilusDBusObject:
1419 *
1420 * The #NautilusDBusObject type is a specialized container of interfaces.
1421 */
1422
1423 /**
1424 * NautilusDBusObjectIface:
1425 * @parent_iface: The parent interface.
1426 *
1427 * Virtual table for the #NautilusDBusObject interface.
1428 */
1429
1430 static void
1431 nautilus_dbus_object_default_init (NautilusDBusObjectIface *iface)
1432 {
1433 /**
1434 * NautilusDBusObject:file-operations:
1435 *
1436 * The #NautilusDBusFileOperations instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-gnome-Nautilus-FileOperations.top_of_page">org.gnome.Nautilus.FileOperations</link>, if any.
1437 *
1438 * Connect to the #GObject::notify signal to get informed of property changes.
1439 */
1440 g_object_interface_install_property (iface, g_param_spec_object ("file-operations", "file-operations", "file-operations", NAUTILUS_DBUS_TYPE_FILE_OPERATIONS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
1441
1442 }
1443
1444 typedef NautilusDBusObjectIface NautilusDBusObjectInterface;
1445 G_DEFINE_INTERFACE_WITH_CODE (NautilusDBusObject, nautilus_dbus_object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
1446
1447 /**
1448 * nautilus_dbus_object_get_file_operations:
1449 * @object: A #NautilusDBusObject.
1450 *
1451 * Gets the #NautilusDBusFileOperations instance for the D-Bus interface <link linkend="gdbus-interface-org-gnome-Nautilus-FileOperations.top_of_page">org.gnome.Nautilus.FileOperations</link> on @object, if any.
1452 *
1453 * Returns: (transfer full): A #NautilusDBusFileOperations that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
1454 */
1455 NautilusDBusFileOperations *nautilus_dbus_object_get_file_operations (NautilusDBusObject *object)
1456 {
1457 GDBusInterface *ret;
1458 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.gnome.Nautilus.FileOperations");
1459 if (ret == NULL)
1460 return NULL;
1461 return NAUTILUS_DBUS_FILE_OPERATIONS (ret);
1462 }
1463
1464
1465 /**
1466 * nautilus_dbus_object_peek_file_operations: (skip)
1467 * @object: A #NautilusDBusObject.
1468 *
1469 * Like nautilus_dbus_object_get_file_operations() but doesn't increase the reference count on the returned object.
1470 *
1471 * <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>
1472 *
1473 * Returns: (transfer none): A #NautilusDBusFileOperations or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
1474 */
1475 NautilusDBusFileOperations *nautilus_dbus_object_peek_file_operations (NautilusDBusObject *object)
1476 {
1477 GDBusInterface *ret;
1478 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.gnome.Nautilus.FileOperations");
1479 if (ret == NULL)
1480 return NULL;
1481 g_object_unref (ret);
1482 return NAUTILUS_DBUS_FILE_OPERATIONS (ret);
1483 }
1484
1485
1486 static void
1487 nautilus_dbus_object_notify (GDBusObject *object, GDBusInterface *interface)
1488 {
1489 g_object_notify (G_OBJECT (object), ((_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface))->hyphen_name);
1490 }
1491
1492 /**
1493 * NautilusDBusObjectProxy:
1494 *
1495 * The #NautilusDBusObjectProxy structure contains only private data and should only be accessed using the provided API.
1496 */
1497
1498 /**
1499 * NautilusDBusObjectProxyClass:
1500 * @parent_class: The parent class.
1501 *
1502 * Class structure for #NautilusDBusObjectProxy.
1503 */
1504
1505 static void
1506 nautilus_dbus_object_proxy__nautilus_dbus_object_iface_init (NautilusDBusObjectIface *iface)
1507 {
1508 }
1509
1510 static void
1511 nautilus_dbus_object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
1512 {
1513 iface->interface_added = nautilus_dbus_object_notify;
1514 iface->interface_removed = nautilus_dbus_object_notify;
1515 }
1516
1517
1518 G_DEFINE_TYPE_WITH_CODE (NautilusDBusObjectProxy, nautilus_dbus_object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
1519 G_IMPLEMENT_INTERFACE (NAUTILUS_DBUS_TYPE_OBJECT, nautilus_dbus_object_proxy__nautilus_dbus_object_iface_init)
1520 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, nautilus_dbus_object_proxy__g_dbus_object_iface_init));
1521
1522 static void
1523 nautilus_dbus_object_proxy_init (NautilusDBusObjectProxy *object)
1524 {
1525 }
1526
1527 static void
1528 nautilus_dbus_object_proxy_set_property (GObject *gobject,
1529 guint prop_id,
1530 const GValue *value,
1531 GParamSpec *pspec)
1532 {
1533 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1534 }
1535
1536 static void
1537 nautilus_dbus_object_proxy_get_property (GObject *gobject,
1538 guint prop_id,
1539 GValue *value,
1540 GParamSpec *pspec)
1541 {
1542 NautilusDBusObjectProxy *object = NAUTILUS_DBUS_OBJECT_PROXY (gobject);
1543 GDBusInterface *interface;
1544
1545 switch (prop_id)
1546 {
1547 case 1:
1548 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.gnome.Nautilus.FileOperations");
1549 g_value_take_object (value, interface);
1550 break;
1551
1552 default:
1553 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1554 break;
1555 }
1556 }
1557
1558 static void
1559 nautilus_dbus_object_proxy_class_init (NautilusDBusObjectProxyClass *klass)
1560 {
1561 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
1562
1563 gobject_class->set_property = nautilus_dbus_object_proxy_set_property;
1564 gobject_class->get_property = nautilus_dbus_object_proxy_get_property;
1565
1566 g_object_class_override_property (gobject_class, 1, "file-operations");
1567 }
1568
1569 /**
1570 * nautilus_dbus_object_proxy_new:
1571 * @connection: A #GDBusConnection.
1572 * @object_path: An object path.
1573 *
1574 * Creates a new proxy object.
1575 *
1576 * Returns: (transfer full): The proxy object.
1577 */
1578 NautilusDBusObjectProxy *
1579 nautilus_dbus_object_proxy_new (GDBusConnection *connection,
1580 const gchar *object_path)
1581 {
1582 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
1583 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
1584 return NAUTILUS_DBUS_OBJECT_PROXY (g_object_new (NAUTILUS_DBUS_TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
1585 }
1586
1587 /**
1588 * NautilusDBusObjectSkeleton:
1589 *
1590 * The #NautilusDBusObjectSkeleton structure contains only private data and should only be accessed using the provided API.
1591 */
1592
1593 /**
1594 * NautilusDBusObjectSkeletonClass:
1595 * @parent_class: The parent class.
1596 *
1597 * Class structure for #NautilusDBusObjectSkeleton.
1598 */
1599
1600 static void
1601 nautilus_dbus_object_skeleton__nautilus_dbus_object_iface_init (NautilusDBusObjectIface *iface)
1602 {
1603 }
1604
1605
1606 static void
1607 nautilus_dbus_object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
1608 {
1609 iface->interface_added = nautilus_dbus_object_notify;
1610 iface->interface_removed = nautilus_dbus_object_notify;
1611 }
1612
1613 G_DEFINE_TYPE_WITH_CODE (NautilusDBusObjectSkeleton, nautilus_dbus_object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
1614 G_IMPLEMENT_INTERFACE (NAUTILUS_DBUS_TYPE_OBJECT, nautilus_dbus_object_skeleton__nautilus_dbus_object_iface_init)
1615 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, nautilus_dbus_object_skeleton__g_dbus_object_iface_init));
1616
1617 static void
1618 nautilus_dbus_object_skeleton_init (NautilusDBusObjectSkeleton *object)
1619 {
1620 }
1621
1622 static void
1623 nautilus_dbus_object_skeleton_set_property (GObject *gobject,
1624 guint prop_id,
1625 const GValue *value,
1626 GParamSpec *pspec)
1627 {
1628 NautilusDBusObjectSkeleton *object = NAUTILUS_DBUS_OBJECT_SKELETON (gobject);
1629 GDBusInterfaceSkeleton *interface;
1630
1631 switch (prop_id)
1632 {
1633 case 1:
1634 interface = g_value_get_object (value);
1635 if (interface != NULL)
1636 {
1637 g_warn_if_fail (NAUTILUS_DBUS_IS_FILE_OPERATIONS (interface));
1638 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
1639 }
1640 else
1641 {
1642 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.gnome.Nautilus.FileOperations");
1643 }
1644 break;
1645
1646 default:
1647 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1648 break;
1649 }
1650 }
1651
1652 static void
1653 nautilus_dbus_object_skeleton_get_property (GObject *gobject,
1654 guint prop_id,
1655 GValue *value,
1656 GParamSpec *pspec)
1657 {
1658 NautilusDBusObjectSkeleton *object = NAUTILUS_DBUS_OBJECT_SKELETON (gobject);
1659 GDBusInterface *interface;
1660
1661 switch (prop_id)
1662 {
1663 case 1:
1664 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.gnome.Nautilus.FileOperations");
1665 g_value_take_object (value, interface);
1666 break;
1667
1668 default:
1669 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1670 break;
1671 }
1672 }
1673
1674 static void
1675 nautilus_dbus_object_skeleton_class_init (NautilusDBusObjectSkeletonClass *klass)
1676 {
1677 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
1678
1679 gobject_class->set_property = nautilus_dbus_object_skeleton_set_property;
1680 gobject_class->get_property = nautilus_dbus_object_skeleton_get_property;
1681
1682 g_object_class_override_property (gobject_class, 1, "file-operations");
1683 }
1684
1685 /**
1686 * nautilus_dbus_object_skeleton_new:
1687 * @object_path: An object path.
1688 *
1689 * Creates a new skeleton object.
1690 *
1691 * Returns: (transfer full): The skeleton object.
1692 */
1693 NautilusDBusObjectSkeleton *
1694 nautilus_dbus_object_skeleton_new (const gchar *object_path)
1695 {
1696 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
1697 return NAUTILUS_DBUS_OBJECT_SKELETON (g_object_new (NAUTILUS_DBUS_TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
1698 }
1699
1700 /**
1701 * nautilus_dbus_object_skeleton_set_file_operations:
1702 * @object: A #NautilusDBusObjectSkeleton.
1703 * @interface_: (allow-none): A #NautilusDBusFileOperations or %NULL to clear the interface.
1704 *
1705 * Sets the #NautilusDBusFileOperations instance for the D-Bus interface <link linkend="gdbus-interface-org-gnome-Nautilus-FileOperations.top_of_page">org.gnome.Nautilus.FileOperations</link> on @object.
1706 */
1707 void nautilus_dbus_object_skeleton_set_file_operations (NautilusDBusObjectSkeleton *object, NautilusDBusFileOperations *interface_)
1708 {
1709 g_object_set (G_OBJECT (object), "file-operations", interface_, NULL);
1710 }
1711
1712
1713 /* ------------------------------------------------------------------------
1714 * Code for ObjectManager client
1715 * ------------------------------------------------------------------------
1716 */
1717
1718 /**
1719 * SECTION:NautilusDBusObjectManagerClient
1720 * @title: NautilusDBusObjectManagerClient
1721 * @short_description: Generated GDBusObjectManagerClient type
1722 *
1723 * This section contains a #GDBusObjectManagerClient that uses nautilus_dbus_object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
1724 */
1725
1726 /**
1727 * NautilusDBusObjectManagerClient:
1728 *
1729 * The #NautilusDBusObjectManagerClient structure contains only private data and should only be accessed using the provided API.
1730 */
1731
1732 /**
1733 * NautilusDBusObjectManagerClientClass:
1734 * @parent_class: The parent class.
1735 *
1736 * Class structure for #NautilusDBusObjectManagerClient.
1737 */
1738
1739 G_DEFINE_TYPE (NautilusDBusObjectManagerClient, nautilus_dbus_object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
1740
1741 static void
1742 nautilus_dbus_object_manager_client_init (NautilusDBusObjectManagerClient *manager)
1743 {
1744 }
1745
1746 static void
1747 nautilus_dbus_object_manager_client_class_init (NautilusDBusObjectManagerClientClass *klass)
1748 {
1749 }
1750
1751 /**
1752 * nautilus_dbus_object_manager_client_get_proxy_type:
1753 * @manager: A #GDBusObjectManagerClient.
1754 * @object_path: The object path of the remote object (unused).
1755 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
1756 * @user_data: User data (unused).
1757 *
1758 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
1759 *
1760 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #NautilusDBusObjectProxy.
1761 */
1762 GType
1763 nautilus_dbus_object_manager_client_get_proxy_type (GDBusObjectManagerClient *manager, const gchar *object_path, const gchar *interface_name, gpointer user_data)
1764 {
1765 static gsize once_init_value = 0;
1766 static GHashTable *lookup_hash;
1767 GType ret;
1768
1769 if (interface_name == NULL)
1770 return NAUTILUS_DBUS_TYPE_OBJECT_PROXY;
1771 if (g_once_init_enter (&once_init_value))
1772 {
1773 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
1774 g_hash_table_insert (lookup_hash, (gpointer) "org.gnome.Nautilus.FileOperations", GSIZE_TO_POINTER (NAUTILUS_DBUS_TYPE_FILE_OPERATIONS_PROXY));
1775 g_once_init_leave (&once_init_value, 1);
1776 }
1777 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
1778 if (ret == (GType) 0)
1779 ret = G_TYPE_DBUS_PROXY;
1780 return ret;
1781 }
1782
1783 /**
1784 * nautilus_dbus_object_manager_client_new:
1785 * @connection: A #GDBusConnection.
1786 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
1787 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1788 * @object_path: An object path.
1789 * @cancellable: (allow-none): A #GCancellable or %NULL.
1790 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1791 * @user_data: User data to pass to @callback.
1792 *
1793 * Asynchronously creates #GDBusObjectManagerClient using nautilus_dbus_object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
1794 *
1795 * 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.
1796 * You can then call nautilus_dbus_object_manager_client_new_finish() to get the result of the operation.
1797 *
1798 * See nautilus_dbus_object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
1799 */
1800 void
1801 nautilus_dbus_object_manager_client_new (
1802 GDBusConnection *connection,
1803 GDBusObjectManagerClientFlags flags,
1804 const gchar *name,
1805 const gchar *object_path,
1806 GCancellable *cancellable,
1807 GAsyncReadyCallback callback,
1808 gpointer user_data)
1809 {
1810 g_async_initable_new_async (NAUTILUS_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", nautilus_dbus_object_manager_client_get_proxy_type, NULL);
1811 }
1812
1813 /**
1814 * nautilus_dbus_object_manager_client_new_finish:
1815 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to nautilus_dbus_object_manager_client_new().
1816 * @error: Return location for error or %NULL
1817 *
1818 * Finishes an operation started with nautilus_dbus_object_manager_client_new().
1819 *
1820 * Returns: (transfer full) (type NautilusDBusObjectManagerClient): The constructed object manager client or %NULL if @error is set.
1821 */
1822 GDBusObjectManager *
1823 nautilus_dbus_object_manager_client_new_finish (
1824 GAsyncResult *res,
1825 GError **error)
1826 {
1827 GObject *ret;
1828 GObject *source_object;
1829 source_object = g_async_result_get_source_object (res);
1830 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1831 g_object_unref (source_object);
1832 if (ret != NULL)
1833 return G_DBUS_OBJECT_MANAGER (ret);
1834 else
1835 return NULL;
1836 }
1837
1838 /**
1839 * nautilus_dbus_object_manager_client_new_sync:
1840 * @connection: A #GDBusConnection.
1841 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
1842 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1843 * @object_path: An object path.
1844 * @cancellable: (allow-none): A #GCancellable or %NULL.
1845 * @error: Return location for error or %NULL
1846 *
1847 * Synchronously creates #GDBusObjectManagerClient using nautilus_dbus_object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
1848 *
1849 * The calling thread is blocked until a reply is received.
1850 *
1851 * See nautilus_dbus_object_manager_client_new() for the asynchronous version of this constructor.
1852 *
1853 * Returns: (transfer full) (type NautilusDBusObjectManagerClient): The constructed object manager client or %NULL if @error is set.
1854 */
1855 GDBusObjectManager *
1856 nautilus_dbus_object_manager_client_new_sync (
1857 GDBusConnection *connection,
1858 GDBusObjectManagerClientFlags flags,
1859 const gchar *name,
1860 const gchar *object_path,
1861 GCancellable *cancellable,
1862 GError **error)
1863 {
1864 GInitable *ret;
1865 ret = g_initable_new (NAUTILUS_DBUS_TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", nautilus_dbus_object_manager_client_get_proxy_type, NULL);
1866 if (ret != NULL)
1867 return G_DBUS_OBJECT_MANAGER (ret);
1868 else
1869 return NULL;
1870 }
1871
1872
1873 /**
1874 * nautilus_dbus_object_manager_client_new_for_bus:
1875 * @bus_type: A #GBusType.
1876 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
1877 * @name: A bus name (well-known or unique).
1878 * @object_path: An object path.
1879 * @cancellable: (allow-none): A #GCancellable or %NULL.
1880 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1881 * @user_data: User data to pass to @callback.
1882 *
1883 * Like nautilus_dbus_object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
1884 *
1885 * 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.
1886 * You can then call nautilus_dbus_object_manager_client_new_for_bus_finish() to get the result of the operation.
1887 *
1888 * See nautilus_dbus_object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1889 */
1890 void
1891 nautilus_dbus_object_manager_client_new_for_bus (
1892 GBusType bus_type,
1893 GDBusObjectManagerClientFlags flags,
1894 const gchar *name,
1895 const gchar *object_path,
1896 GCancellable *cancellable,
1897 GAsyncReadyCallback callback,
1898 gpointer user_data)
1899 {
1900 g_async_initable_new_async (NAUTILUS_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", nautilus_dbus_object_manager_client_get_proxy_type, NULL);
1901 }
1902
1903 /**
1904 * nautilus_dbus_object_manager_client_new_for_bus_finish:
1905 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to nautilus_dbus_object_manager_client_new_for_bus().
1906 * @error: Return location for error or %NULL
1907 *
1908 * Finishes an operation started with nautilus_dbus_object_manager_client_new_for_bus().
1909 *
1910 * Returns: (transfer full) (type NautilusDBusObjectManagerClient): The constructed object manager client or %NULL if @error is set.
1911 */
1912 GDBusObjectManager *
1913 nautilus_dbus_object_manager_client_new_for_bus_finish (
1914 GAsyncResult *res,
1915 GError **error)
1916 {
1917 GObject *ret;
1918 GObject *source_object;
1919 source_object = g_async_result_get_source_object (res);
1920 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1921 g_object_unref (source_object);
1922 if (ret != NULL)
1923 return G_DBUS_OBJECT_MANAGER (ret);
1924 else
1925 return NULL;
1926 }
1927
1928 /**
1929 * nautilus_dbus_object_manager_client_new_for_bus_sync:
1930 * @bus_type: A #GBusType.
1931 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
1932 * @name: A bus name (well-known or unique).
1933 * @object_path: An object path.
1934 * @cancellable: (allow-none): A #GCancellable or %NULL.
1935 * @error: Return location for error or %NULL
1936 *
1937 * Like nautilus_dbus_object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1938 *
1939 * The calling thread is blocked until a reply is received.
1940 *
1941 * See nautilus_dbus_object_manager_client_new_for_bus() for the asynchronous version of this constructor.
1942 *
1943 * Returns: (transfer full) (type NautilusDBusObjectManagerClient): The constructed object manager client or %NULL if @error is set.
1944 */
1945 GDBusObjectManager *
1946 nautilus_dbus_object_manager_client_new_for_bus_sync (
1947 GBusType bus_type,
1948 GDBusObjectManagerClientFlags flags,
1949 const gchar *name,
1950 const gchar *object_path,
1951 GCancellable *cancellable,
1952 GError **error)
1953 {
1954 GInitable *ret;
1955 ret = g_initable_new (NAUTILUS_DBUS_TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", nautilus_dbus_object_manager_client_get_proxy_type, NULL);
1956 if (ret != NULL)
1957 return G_DBUS_OBJECT_MANAGER (ret);
1958 else
1959 return NULL;
1960 }