1 Star 0 Fork 52

刘杰/third_party_glib

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
xao.h 36.48 KB
一键复制 编辑 原始数据 按行查看 历史
刘杰 提交于 2024-02-01 06:37 . glib2.72.2
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000
+ }
+ }
+out:
+ return g_variant_builder_end (&builder);
+}
+
+static gboolean _gxdp_proxy_resolver_emit_changed (gpointer user_data);
+
+static void
+gxdp_proxy_resolver_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
+{
+ GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (_skeleton);
+ gboolean emit_changed = FALSE;
+
+ g_mutex_lock (&skeleton->priv->lock);
+ if (skeleton->priv->changed_properties_idle_source != NULL)
+ {
+ g_source_destroy (skeleton->priv->changed_properties_idle_source);
+ skeleton->priv->changed_properties_idle_source = NULL;
+ emit_changed = TRUE;
+ }
+ g_mutex_unlock (&skeleton->priv->lock);
+
+ if (emit_changed)
+ _gxdp_proxy_resolver_emit_changed (skeleton);
+}
+
+static void gxdp_proxy_resolver_skeleton_iface_init (GXdpProxyResolverIface *iface);
+#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
+G_DEFINE_TYPE_WITH_CODE (GXdpProxyResolverSkeleton, gxdp_proxy_resolver_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
+ G_ADD_PRIVATE (GXdpProxyResolverSkeleton)
+ G_IMPLEMENT_INTERFACE (GXDP_TYPE_PROXY_RESOLVER, gxdp_proxy_resolver_skeleton_iface_init))
+
+#else
+G_DEFINE_TYPE_WITH_CODE (GXdpProxyResolverSkeleton, gxdp_proxy_resolver_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
+ G_IMPLEMENT_INTERFACE (GXDP_TYPE_PROXY_RESOLVER, gxdp_proxy_resolver_skeleton_iface_init))
+
+#endif
+static void
+gxdp_proxy_resolver_skeleton_finalize (GObject *object)
+{
+ GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (object);
+ guint n;
+ for (n = 0; n < 1; n++)
+ g_value_unset (&skeleton->priv->properties[n]);
+ g_free (skeleton->priv->properties);
+ g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
+ if (skeleton->priv->changed_properties_idle_source != NULL)
+ g_source_destroy (skeleton->priv->changed_properties_idle_source);
+ g_main_context_unref (skeleton->priv->context);
+ g_mutex_clear (&skeleton->priv->lock);
+ G_OBJECT_CLASS (gxdp_proxy_resolver_skeleton_parent_class)->finalize (object);
+}
+
+static void
+gxdp_proxy_resolver_skeleton_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec G_GNUC_UNUSED)
+{
+ GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (object);
+ g_assert (prop_id != 0 && prop_id - 1 < 1);
+ g_mutex_lock (&skeleton->priv->lock);
+ g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
+ g_mutex_unlock (&skeleton->priv->lock);
+}
+
+static gboolean
+_gxdp_proxy_resolver_emit_changed (gpointer user_data)
+{
+ GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (user_data);
+ GList *l;
+ GVariantBuilder builder;
+ GVariantBuilder invalidated_builder;
+ guint num_changes;
+
+ g_mutex_lock (&skeleton->priv->lock);
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
+ for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
+ {
+ ChangedProperty *cp = l->data;
+ GVariant *variant;
+ const GValue *cur_value;
+
+ cur_value = &skeleton->priv->properties[cp->prop_id - 1];
+ if (!_g_value_equal (cur_value, &cp->orig_value))
+ {
+ variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
+ g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
+ g_variant_unref (variant);
+ num_changes++;
+ }
+ }
+ if (num_changes > 0)
+ {
+ GList *connections, *ll;
+ GVariant *signal_variant;
+ signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.portal.ProxyResolver",
+ &builder, &invalidated_builder));
+ connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
+ for (ll = connections; ll != NULL; ll = ll->next)
+ {
+ GDBusConnection *connection = ll->data;
+
+ g_dbus_connection_emit_signal (connection,
+ NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
+ "org.freedesktop.DBus.Properties",
+ "PropertiesChanged",
+ signal_variant,
+ NULL);
+ }
+ g_variant_unref (signal_variant);
+ g_list_free_full (connections, g_object_unref);
+ }
+ else
+ {
+ g_variant_builder_clear (&builder);
+ g_variant_builder_clear (&invalidated_builder);
+ }
+ g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
+ skeleton->priv->changed_properties = NULL;
+ skeleton->priv->changed_properties_idle_source = NULL;
+ g_mutex_unlock (&skeleton->priv->lock);
+ return FALSE;
+}
+
+static void
+_gxdp_proxy_resolver_schedule_emit_changed (GXdpProxyResolverSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
+{
+ ChangedProperty *cp;
+ GList *l;
+ cp = NULL;
+ for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
+ {
+ ChangedProperty *i_cp = l->data;
+ if (i_cp->info == info)
+ {
+ cp = i_cp;
+ break;
+ }
+ }
+ if (cp == NULL)
+ {
+ cp = g_new0 (ChangedProperty, 1);
+ cp->prop_id = prop_id;
+ cp->info = info;
+ skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
+ g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
+ g_value_copy (orig_value, &cp->orig_value);
+ }
+}
+
+static void
+gxdp_proxy_resolver_skeleton_notify (GObject *object,
+ GParamSpec *pspec G_GNUC_UNUSED)
+{
+ GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (object);
+ g_mutex_lock (&skeleton->priv->lock);
+ if (skeleton->priv->changed_properties != NULL &&
+ skeleton->priv->changed_properties_idle_source == NULL)
+ {
+ skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
+ g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
+ g_source_set_callback (skeleton->priv->changed_properties_idle_source, _gxdp_proxy_resolver_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
+ g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _gxdp_proxy_resolver_emit_changed");
+ g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
+ g_source_unref (skeleton->priv->changed_properties_idle_source);
+ }
+ g_mutex_unlock (&skeleton->priv->lock);
+}
+
+static void
+gxdp_proxy_resolver_skeleton_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ const _ExtendedGDBusPropertyInfo *info;
+ GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (object);
+ g_assert (prop_id != 0 && prop_id - 1 < 1);
+ info = (const _ExtendedGDBusPropertyInfo *) _gxdp_proxy_resolver_property_info_pointers[prop_id - 1];
+ g_mutex_lock (&skeleton->priv->lock);
+ g_object_freeze_notify (object);
+ if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
+ {
+ if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
+ info->emits_changed_signal)
+ _gxdp_proxy_resolver_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
+ g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
+ g_object_notify_by_pspec (object, pspec);
+ }
+ g_mutex_unlock (&skeleton->priv->lock);
+ g_object_thaw_notify (object);
+}
+
+static void
+gxdp_proxy_resolver_skeleton_init (GXdpProxyResolverSkeleton *skeleton)
+{
+#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
+ skeleton->priv = gxdp_proxy_resolver_skeleton_get_instance_private (skeleton);
+#else
+ skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, GXDP_TYPE_PROXY_RESOLVER_SKELETON, GXdpProxyResolverSkeletonPrivate);
+#endif
+
+ g_mutex_init (&skeleton->priv->lock);
+ skeleton->priv->context = g_main_context_ref_thread_default ();
+ skeleton->priv->properties = g_new0 (GValue, 1);
+ g_value_init (&skeleton->priv->properties[0], G_TYPE_UINT);
+}
+
+static guint
+gxdp_proxy_resolver_skeleton_get_version (GXdpProxyResolver *object)
+{
+ GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (object);
+ guint value;
+ g_mutex_lock (&skeleton->priv->lock);
+ value = g_value_get_uint (&(skeleton->priv->properties[0]));
+ g_mutex_unlock (&skeleton->priv->lock);
+ return value;
+}
+
+static void
+gxdp_proxy_resolver_skeleton_class_init (GXdpProxyResolverSkeletonClass *klass)
+{
+ GObjectClass *gobject_class;
+ GDBusInterfaceSkeletonClass *skeleton_class;
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = gxdp_proxy_resolver_skeleton_finalize;
+ gobject_class->get_property = gxdp_proxy_resolver_skeleton_get_property;
+ gobject_class->set_property = gxdp_proxy_resolver_skeleton_set_property;
+ gobject_class->notify = gxdp_proxy_resolver_skeleton_notify;
+
+
+ gxdp_proxy_resolver_override_properties (gobject_class, 1);
+
+ skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
+ skeleton_class->get_info = gxdp_proxy_resolver_skeleton_dbus_interface_get_info;
+ skeleton_class->get_properties = gxdp_proxy_resolver_skeleton_dbus_interface_get_properties;
+ skeleton_class->flush = gxdp_proxy_resolver_skeleton_dbus_interface_flush;
+ skeleton_class->get_vtable = gxdp_proxy_resolver_skeleton_dbus_interface_get_vtable;
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
+ g_type_class_add_private (klass, sizeof (GXdpProxyResolverSkeletonPrivate));
+#endif
+}
+
+static void
+gxdp_proxy_resolver_skeleton_iface_init (GXdpProxyResolverIface *iface)
+{
+ iface->get_version = gxdp_proxy_resolver_skeleton_get_version;
+}
+
+/**
+ * gxdp_proxy_resolver_skeleton_new:
+ *
+ * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-ProxyResolver.top_of_page">org.freedesktop.portal.ProxyResolver</link>.
+ *
+ * Returns: (transfer full) (type GXdpProxyResolverSkeleton): The skeleton object.
+ */
+GXdpProxyResolver *
+gxdp_proxy_resolver_skeleton_new (void)
+{
+ return GXDP_PROXY_RESOLVER (g_object_new (GXDP_TYPE_PROXY_RESOLVER_SKELETON, NULL));
+}
+
+/* ------------------------------------------------------------------------
+ * Code for interface org.freedesktop.portal.Trash
+ * ------------------------------------------------------------------------
+ */
+
+/**
+ * SECTION:GXdpTrash
+ * @title: GXdpTrash
+ * @short_description: Generated C code for the org.freedesktop.portal.Trash D-Bus interface
+ *
+ * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-portal-Trash.top_of_page">org.freedesktop.portal.Trash</link> D-Bus interface in C.
+ */
+
+/* ---- Introspection data for org.freedesktop.portal.Trash ---- */
+
+static const _ExtendedGDBusArgInfo _gxdp_trash_method_info_trash_file_IN_ARG_fd =
+{
+ {
+ -1,
+ (gchar *) "fd",
+ (gchar *) "h",
+ NULL
+ },
+ FALSE
+};
+
+static const GDBusArgInfo * const _gxdp_trash_method_info_trash_file_IN_ARG_pointers[] =
+{
+ &_gxdp_trash_method_info_trash_file_IN_ARG_fd.parent_struct,
+ NULL
+};
+
+static const _ExtendedGDBusArgInfo _gxdp_trash_method_info_trash_file_OUT_ARG_result =
+{
+ {
+ -1,
+ (gchar *) "result",
+ (gchar *) "u",
+ NULL
+ },
+ FALSE
+};
+
+static const GDBusArgInfo * const _gxdp_trash_method_info_trash_file_OUT_ARG_pointers[] =
+{
+ &_gxdp_trash_method_info_trash_file_OUT_ARG_result.parent_struct,
+ NULL
+};
+
+static const _ExtendedGDBusMethodInfo _gxdp_trash_method_info_trash_file =
+{
+ {
+ -1,
+ (gchar *) "TrashFile",
+ (GDBusArgInfo **) &_gxdp_trash_method_info_trash_file_IN_ARG_pointers,
+ (GDBusArgInfo **) &_gxdp_trash_method_info_trash_file_OUT_ARG_pointers,
+ NULL
+ },
+ "handle-trash-file",
+ TRUE
+};
+
+static const GDBusMethodInfo * const _gxdp_trash_method_info_pointers[] =
+{
+ &_gxdp_trash_method_info_trash_file.parent_struct,
+ NULL
+};
+
+static const _ExtendedGDBusPropertyInfo _gxdp_trash_property_info_version =
+{
+ {
+ -1,
+ (gchar *) "version",
+ (gchar *) "u",
+ G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
+ NULL
+ },
+ "version",
+ FALSE,
+ TRUE
+};
+
+static const GDBusPropertyInfo * const _gxdp_trash_property_info_pointers[] =
+{
+ &_gxdp_trash_property_info_version.parent_struct,
+ NULL
+};
+
+static const _ExtendedGDBusInterfaceInfo _gxdp_trash_interface_info =
+{
+ {
+ -1,
+ (gchar *) "org.freedesktop.portal.Trash",
+ (GDBusMethodInfo **) &_gxdp_trash_method_info_pointers,
+ NULL,
+ (GDBusPropertyInfo **) &_gxdp_trash_property_info_pointers,
+ NULL
+ },
+ "trash",
+};
+
+
+/**
+ * gxdp_trash_interface_info:
+ *
+ * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-portal-Trash.top_of_page">org.freedesktop.portal.Trash</link> D-Bus interface.
+ *
+ * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
+ */
+GDBusInterfaceInfo *
+gxdp_trash_interface_info (void)
+{
+ return (GDBusInterfaceInfo *) &_gxdp_trash_interface_info.parent_struct;
+}
+
+/**
+ * gxdp_trash_override_properties:
+ * @klass: The class structure for a #GObject derived class.
+ * @property_id_begin: The property id to assign to the first overridden property.
+ *
+ * Overrides all #GObject properties in the #GXdpTrash interface for a concrete class.
+ * The properties are overridden in the order they are defined.
+ *
+ * Returns: The last property id.
+ */
+guint
+gxdp_trash_override_properties (GObjectClass *klass, guint property_id_begin)
+{
+ g_object_class_override_property (klass, property_id_begin++, "version");
+ return property_id_begin - 1;
+}
+
+
+
+/**
+ * GXdpTrash:
+ *
+ * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-Trash.top_of_page">org.freedesktop.portal.Trash</link>.
+ */
+
+/**
+ * GXdpTrashIface:
+ * @parent_iface: The parent interface.
+ * @handle_trash_file: Handler for the #GXdpTrash::handle-trash-file signal.
+ * @get_version: Getter for the #GXdpTrash:version property.
+ *
+ * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-Trash.top_of_page">org.freedesktop.portal.Trash</link>.
+ */
+
+typedef GXdpTrashIface GXdpTrashInterface;
+G_DEFINE_INTERFACE (GXdpTrash, gxdp_trash, G_TYPE_OBJECT)
+
+static void
+gxdp_trash_default_init (GXdpTrashIface *iface)
+{
+ /* GObject signals for incoming D-Bus method calls: */
+ /**
+ * GXdpTrash::handle-trash-file:
+ * @object: A #GXdpTrash.
+ * @invocation: A #GDBusMethodInvocation.
+ * @fd_list: (nullable): A #GUnixFDList or %NULL.
+ * @arg_fd: Argument passed by remote caller.
+ *
+ * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Trash.TrashFile">TrashFile()</link> D-Bus method.
+ *
+ * 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 gxdp_trash_complete_trash_file() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
+ *
+ * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
+ */
+ g_signal_new ("handle-trash-file",
+ G_TYPE_FROM_INTERFACE (iface),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GXdpTrashIface, handle_trash_file),
+ g_signal_accumulator_true_handled,
+ NULL,
+ g_cclosure_marshal_generic,
+ G_TYPE_BOOLEAN,
+ 3,
+ G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UNIX_FD_LIST, G_TYPE_VARIANT);
+
+ /* GObject properties for D-Bus properties: */
+ /**
+ * GXdpTrash:version:
+ *
+ * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-portal-Trash.version">"version"</link>.
+ *
+ * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
+ */
+ g_object_interface_install_property (iface,
+ g_param_spec_uint ("version", "version", "version", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+}
+
+/**
+ * gxdp_trash_get_version: (skip)
+ * @object: A #GXdpTrash.
+ *
+ * Gets the value of the <link linkend="gdbus-property-org-freedesktop-portal-Trash.version">"version"</link> D-Bus property.
+ *
+ * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
+ *
+ * Returns: The property value.
+ */
+guint
+gxdp_trash_get_version (GXdpTrash *object)
+{
+ return GXDP_TRASH_GET_IFACE (object)->get_version (object);
+}
+
+/**
+ * gxdp_trash_set_version: (skip)
+ * @object: A #GXdpTrash.
+ * @value: The value to set.
+ *
+ * Sets the <link linkend="gdbus-property-org-freedesktop-portal-Trash.version">"version"</link> D-Bus property to @value.
+ *
+ * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
+ */
+void
+gxdp_trash_set_version (GXdpTrash *object, guint value)
+{
+ g_object_set (G_OBJECT (object), "version", value, NULL);
+}
+
+/**
+ * gxdp_trash_call_trash_file:
+ * @proxy: A #GXdpTrashProxy.
+ * @arg_fd: Argument to pass with the method invocation.
+ * @fd_list: (nullable): A #GUnixFDList or %NULL.
+ * @cancellable: (nullable): A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
+ * @user_data: User data to pass to @callback.
+ *
+ * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Trash.TrashFile">TrashFile()</link> D-Bus method on @proxy.
+ * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
+ * You can then call gxdp_trash_call_trash_file_finish() to get the result of the operation.
+ *
+ * See gxdp_trash_call_trash_file_sync() for the synchronous, blocking version of this method.
+ */
+void
+gxdp_trash_call_trash_file (
+ GXdpTrash *proxy,
+ GVariant *arg_fd,
+ GUnixFDList *fd_list,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_dbus_proxy_call_with_unix_fd_list (G_DBUS_PROXY (proxy),
+ "TrashFile",
+ g_variant_new ("(@h)",
+ arg_fd),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ fd_list,
+ cancellable,
+ callback,
+ user_data);
+}
+
+/**
+ * gxdp_trash_call_trash_file_finish:
+ * @proxy: A #GXdpTrashProxy.
+ * @out_result: (out) (optional): Return location for return parameter or %NULL to ignore.
+ * @out_fd_list: (out) (optional): Return location for a #GUnixFDList or %NULL to ignore.
+ * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_trash_call_trash_file().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes an operation started with gxdp_trash_call_trash_file().
+ *
+ * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
+ */
+gboolean
+gxdp_trash_call_trash_file_finish (
+ GXdpTrash *proxy,
+ guint *out_result,
+ GUnixFDList **out_fd_list,
+ GAsyncResult *res,
+ GError **error)
+{
+ GVariant *_ret;
+ _ret = g_dbus_proxy_call_with_unix_fd_list_finish (G_DBUS_PROXY (proxy), out_fd_list, res, error);
+ if (_ret == NULL)
+ goto _out;
+ g_variant_get (_ret,
+ "(u)",
+ out_result);
+ g_variant_unref (_ret);
+_out:
+ return _ret != NULL;
+}
+
+/**
+ * gxdp_trash_call_trash_file_sync:
+ * @proxy: A #GXdpTrashProxy.
+ * @arg_fd: Argument to pass with the method invocation.
+ * @fd_list: (nullable): A #GUnixFDList or %NULL.
+ * @out_result: (out) (optional): Return location for return parameter or %NULL to ignore.
+ * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL.
+ * @cancellable: (nullable): A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Trash.TrashFile">TrashFile()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
+ *
+ * See gxdp_trash_call_trash_file() for the asynchronous version of this method.
+ *
+ * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
+ */
+gboolean
+gxdp_trash_call_trash_file_sync (
+ GXdpTrash *proxy,
+ GVariant *arg_fd,
+ GUnixFDList *fd_list,
+ guint *out_result,
+ GUnixFDList **out_fd_list,
+ GCancellable *cancellable,
+ GError **error)
+{
+ GVariant *_ret;
+ _ret = g_dbus_proxy_call_with_unix_fd_list_sync (G_DBUS_PROXY (proxy),
+ "TrashFile",
+ g_variant_new ("(@h)",
+ arg_fd),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ fd_list,
+ out_fd_list,
+ cancellable,
+ error);
+ if (_ret == NULL)
+ goto _out;
+ g_variant_get (_ret,
+ "(u)",
+ out_result);
+ g_variant_unref (_ret);
+_out:
+ return _ret != NULL;
+}
+
+/**
+ * gxdp_trash_complete_trash_file:
+ * @object: A #GXdpTrash.
+ * @invocation: (transfer full): A #GDBusMethodInvocation.
+ * @fd_list: (nullable): A #GUnixFDList or %NULL.
+ * @result: Parameter to return.
+ *
+ * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-portal-Trash.TrashFile">TrashFile()</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.
+ *
+ * This method will free @invocation, you cannot use it afterwards.
+ */
+void
+gxdp_trash_complete_trash_file (
+ GXdpTrash *object G_GNUC_UNUSED,
+ GDBusMethodInvocation *invocation,
+ GUnixFDList *fd_list,
+ guint result)
+{
+ g_dbus_method_invocation_return_value_with_unix_fd_list (invocation,
+ g_variant_new ("(u)",
+ result),
+ fd_list);
+}
+
+/* ------------------------------------------------------------------------ */
+
+/**
+ * GXdpTrashProxy:
+ *
+ * The #GXdpTrashProxy structure contains only private data and should only be accessed using the provided API.
+ */
+
+/**
+ * GXdpTrashProxyClass:
+ * @parent_class: The parent class.
+ *
+ * Class structure for #GXdpTrashProxy.
+ */
+
+struct _GXdpTrashProxyPrivate
+{
+ GData *qdata;
+};
+
+static void gxdp_trash_proxy_iface_init (GXdpTrashIface *iface);
+
+#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
+G_DEFINE_TYPE_WITH_CODE (GXdpTrashProxy, gxdp_trash_proxy, G_TYPE_DBUS_PROXY,
+ G_ADD_PRIVATE (GXdpTrashProxy)
+ G_IMPLEMENT_INTERFACE (GXDP_TYPE_TRASH, gxdp_trash_proxy_iface_init))
+
+#else
+G_DEFINE_TYPE_WITH_CODE (GXdpTrashProxy, gxdp_trash_proxy, G_TYPE_DBUS_PROXY,
+ G_IMPLEMENT_INTERFACE (GXDP_TYPE_TRASH, gxdp_trash_proxy_iface_init))
+
+#endif
+static void
+gxdp_trash_proxy_finalize (GObject *object)
+{
+ GXdpTrashProxy *proxy = GXDP_TRASH_PROXY (object);
+ g_datalist_clear (&proxy->priv->qdata);
+ G_OBJECT_CLASS (gxdp_trash_proxy_parent_class)->finalize (object);
+}
+
+static void
+gxdp_trash_proxy_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec G_GNUC_UNUSED)
+{
+ const _ExtendedGDBusPropertyInfo *info;
+ GVariant *variant;
+ g_assert (prop_id != 0 && prop_id - 1 < 1);
+ info = (const _ExtendedGDBusPropertyInfo *) _gxdp_trash_property_info_pointers[prop_id - 1];
+ variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
+ if (info->use_gvariant)
+ {
+ g_value_set_variant (value, variant);
+ }
+ else
+ {
+ if (variant != NULL)
+ g_dbus_gvariant_to_gvalue (variant, value);
+ }
+ if (variant != NULL)
+ g_variant_unref (variant);
+}
+
+static void
+gxdp_trash_proxy_set_property_cb (GDBusProxy *proxy,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ const _ExtendedGDBusPropertyInfo *info = user_data;
+ GError *error;
+ GVariant *_ret;
+ error = NULL;
+ _ret = g_dbus_proxy_call_finish (proxy, res, &error);
+ if (!_ret)
+ {
+ g_warning ("Error setting property '%s' on interface org.freedesktop.portal.Trash: %s (%s, %d)",
+ info->parent_struct.name,
+ error->message, g_quark_to_string (error->domain), error->code);
+ g_error_free (error);
+ }
+ else
+ {
+ g_variant_unref (_ret);
+ }
+}
+
+static void
+gxdp_trash_proxy_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec G_GNUC_UNUSED)
+{
+ const _ExtendedGDBusPropertyInfo *info;
+ GVariant *variant;
+ g_assert (prop_id != 0 && prop_id - 1 < 1);
+ info = (const _ExtendedGDBusPropertyInfo *) _gxdp_trash_property_info_pointers[prop_id - 1];
+ variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
+ g_dbus_proxy_call (G_DBUS_PROXY (object),
+ "org.freedesktop.DBus.Properties.Set",
+ g_variant_new ("(ssv)", "org.freedesktop.portal.Trash", info->parent_struct.name, variant),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL, (GAsyncReadyCallback) gxdp_trash_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
+ g_variant_unref (variant);
+}
+
+static void
+gxdp_trash_proxy_g_signal (GDBusProxy *proxy,
+ const gchar *sender_name G_GNUC_UNUSED,
+ const gchar *signal_name,
+ GVariant *parameters)
+{
+ _ExtendedGDBusSignalInfo *info;
+ GVariantIter iter;
+ GVariant *child;
+ GValue *paramv;
+ gsize num_params;
+ gsize n;
+ guint signal_id;
+ info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gxdp_trash_interface_info.parent_struct, signal_name);
+ if (info == NULL)
+ return;
+ num_params = g_variant_n_children (parameters);
+ paramv = g_new0 (GValue, num_params + 1);
+ g_value_init (&paramv[0], GXDP_TYPE_TRASH);
+ g_value_set_object (&paramv[0], proxy);
+ g_variant_iter_init (&iter, parameters);
+ n = 1;
+ while ((child = g_variant_iter_next_value (&iter)) != NULL)
+ {
+ _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
+ if (arg_info->use_gvariant)
+ {
+ g_value_init (&paramv[n], G_TYPE_VARIANT);
+ g_value_set_variant (&paramv[n], child);
+ n++;
+ }
+ else
+ g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
+ g_variant_unref (child);
+ }
+ signal_id = g_signal_lookup (info->signal_name, GXDP_TYPE_TRASH);
+ g_signal_emitv (paramv, signal_id, 0, NULL);
+ for (n = 0; n < num_params + 1; n++)
+ g_value_unset (&paramv[n]);
+ g_free (paramv);
+}
+
+static void
+gxdp_trash_proxy_g_properties_changed (GDBusProxy *_proxy,
+ GVariant *changed_properties,
+ const gchar *const *invalidated_properties)
+{
+ GXdpTrashProxy *proxy = GXDP_TRASH_PROXY (_proxy);
+ guint n;
+ const gchar *key;
+ GVariantIter *iter;
+ _ExtendedGDBusPropertyInfo *info;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
+ {
+ info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_trash_interface_info.parent_struct, key);
+ g_datalist_remove_data (&proxy->priv->qdata, key);
+ if (info != NULL)
+ g_object_notify (G_OBJECT (proxy), info->hyphen_name);
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++)
+ {
+ info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_trash_interface_info.parent_struct, invalidated_properties[n]);
+ g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
+ if (info != NULL)
+ g_object_notify (G_OBJECT (proxy), info->hyphen_name);
+ }
+}
+
+static guint
+gxdp_trash_proxy_get_version (GXdpTrash *object)
+{
+ GXdpTrashProxy *proxy = GXDP_TRASH_PROXY (object);
+ GVariant *variant;
+ guint value = 0;
+ variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "version");
+ if (variant != NULL)
+ {
+ value = g_variant_get_uint32 (variant);
+ g_variant_unref (variant);
+ }
+ return value;
+}
+
+static void
+gxdp_trash_proxy_init (GXdpTrashProxy *proxy)
+{
+#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
+ proxy->priv = gxdp_trash_proxy_get_instance_private (proxy);
+#else
+ proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, GXDP_TYPE_TRASH_PROXY, GXdpTrashProxyPrivate);
+#endif
+
+ g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gxdp_trash_interface_info ());
+}
+
+static void
+gxdp_trash_proxy_class_init (GXdpTrashProxyClass *klass)
+{
+ GObjectClass *gobject_class;
+ GDBusProxyClass *proxy_class;
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = gxdp_trash_proxy_finalize;
+ gobject_class->get_property = gxdp_trash_proxy_get_property;
+ gobject_class->set_property = gxdp_trash_proxy_set_property;
+
+ proxy_class = G_DBUS_PROXY_CLASS (klass);
+ proxy_class->g_signal = gxdp_trash_proxy_g_signal;
+ proxy_class->g_properties_changed = gxdp_trash_proxy_g_properties_changed;
+
+ gxdp_trash_override_properties (gobject_class, 1);
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
+ g_type_class_add_private (klass, sizeof (GXdpTrashProxyPrivate));
+#endif
+}
+
+static void
+gxdp_trash_proxy_iface_init (GXdpTrashIface *iface)
+{
+ iface->get_version = gxdp_trash_proxy_get_version;
+}
+
+/**
+ * gxdp_trash_proxy_new:
+ * @connection: A #GDBusConnection.
+ * @flags: Flags from the #GDBusProxyFlags enumeration.
+ * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
+ * @object_path: An object path.
+ * @cancellable: (nullable): A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
+ * @user_data: User data to pass to @callback.
+ *
+ * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-Trash.top_of_page">org.freedesktop.portal.Trash</link>. See g_dbus_proxy_new() for more details.
+ *
+ * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
+ * You can then call gxdp_trash_proxy_new_finish() to get the result of the operation.
+ *
+ * See gxdp_trash_proxy_new_sync() for the synchronous, blocking version of this constructor.
+ */
+void
+gxdp_trash_proxy_new (
+ GDBusConnection *connection,
+ GDBusProxyFlags flags,
+ const gchar *name,
+ const gchar *object_path,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_async_initable_new_async (GXDP_TYPE_TRASH_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.freedesktop.portal.Trash", NULL);
+}
+
+/**
+ * gxdp_trash_proxy_new_finish:
+ * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_trash_proxy_new().
+ * @error: Return location for error or %NULL
+ *
+ * Finishes an operation started with gxdp_trash_proxy_new().
+ *
+ * Returns: (transfer full) (type GXdpTrashProxy): The constructed proxy object or %NULL if @error is set.
+ */
+GXdpTrash *
+gxdp_trash_proxy_new_finish (
+ GAsyncResult *res,
+ GError **error)
+{
+ GObject *ret;
+ GObject *source_object;
+ source_object = g_async_result_get_source_object (res);
+ ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
+ g_object_unref (source_object);
+ if (ret != NULL)
+ return GXDP_TRASH (ret);
+ else
+ return NULL;
+}
+
+/**
+ * gxdp_trash_proxy_new_sync:
+ * @connection: A #GDBusConnection.
+ * @flags: Flags from the #GDBusProxyFlags enumeration.
+ * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
+ * @object_path: An object path.
+ * @cancellable: (nullable): A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL
+ *
+ * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-Trash.top_of_page">org.freedesktop.portal.Trash</link>. See g_dbus_proxy_new_sync() for more details.
+ *
+ * The calling thread is blocked until a reply is received.
+ *
+ * See gxdp_trash_proxy_new() for the asynchronous version of this constructor.
+ *
+ * Returns: (transfer full) (type GXdpTrashProxy): The constructed proxy object or %NULL if @error is set.
+ */
+GXdpTrash *
+gxdp_trash_proxy_new_sync (
+ GDBusConnection *connection,
+ GDBusProxyFlags flags,
+ const gchar *name,
+ const gchar *object_path,
+ GCancellable *cancellable,
+ GError **error)
+{
+ GInitable *ret;
+ ret = g_initable_new (GXDP_TYPE_TRASH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.portal.Trash", NULL);
+ if (ret != NULL)
+ return GXDP_TRASH (ret);
+ else
+ return NULL;
+}
+
+
+/**
+ * gxdp_trash_proxy_new_for_bus:
+ * @bus_type: A #GBusType.
+ * @flags: Flags from the #GDBusProxyFlags enumeration.
+ * @name: A bus name (well-known or unique).
+ * @object_path: An object path.
+ * @cancellable: (nullable): A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
+ * @user_data: User data to pass to @callback.
+ *
+ * Like gxdp_trash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
+ *
+ * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
+ * You can then call gxdp_trash_proxy_new_for_bus_finish() to get the result of the operation.
+ *
+ * See gxdp_trash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
+ */
+void
+gxdp_trash_proxy_new_for_bus (
+ GBusType bus_type,
+ GDBusProxyFlags flags,
+ const gchar *name,
+ const gchar *object_path,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_async_initable_new_async (GXDP_TYPE_TRASH_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.freedesktop.portal.Trash", NULL);
+}
+
+/**
+ * gxdp_trash_proxy_new_for_bus_finish:
+ * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_trash_proxy_new_for_bus().
+ * @error: Return location for error or %NULL
+ *
+ * Finishes an operation started with gxdp_trash_proxy_new_for_bus().
+ *
+ * Returns: (transfer full) (type GXdpTrashProxy): The constructed proxy object or %NULL if @error is set.
+ */
+GXdpTrash *
+gxdp_trash_proxy_new_for_bus_finish (
+ GAsyncResult *res,
+ GError **error)
+{
+ GObject *ret;
+ GObject *source_object;
+ source_object = g_async_result_get_source_object (res);
+ ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
+ g_object_unref (source_object);
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jaygome/third_party_glib.git
[email protected]:jaygome/third_party_glib.git
jaygome
third_party_glib
third_party_glib
master

搜索帮助