:right-sidebar: True ContentSerializer =================================================================== .. currentmodule:: gi.repository.Gdk .. class:: ContentSerializer(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gio.AsyncResult` A ``GdkContentSerializer`` is used to serialize content for inter-application data transfers. The ``GdkContentSerializer`` transforms an object that is identified by a GType into a serialized form (i.e. a byte stream) that is identified by a mime type. GTK provides serializers and deserializers for common data types such as text, colors, images or file lists. To register your own serialization functions, use :obj:`~gi.repository.Gdk.content_register_serializer`\. Also see :obj:`~gi.repository.Gdk.ContentDeserializer`\. Methods ------- .. rst-class:: interim-class .. class:: ContentSerializer :no-index: .. method:: get_cancellable() -> ~gi.repository.Gio.Cancellable | None Gets the cancellable for the current operation. This is the ``GCancellable`` that was passed to :obj:`~gi.repository.Gdk.content_serialize_async`\. .. method:: get_gtype() -> ~gobject.GType Gets the ``GType`` to of the object to serialize. .. method:: get_mime_type() -> str Gets the mime type to serialize to. .. method:: get_output_stream() -> ~gi.repository.Gio.OutputStream Gets the output stream for the current operation. This is the stream that was passed to :obj:`~gi.repository.Gdk.content_serialize_async`\. .. method:: get_priority() -> int Gets the I/O priority for the current operation. This is the priority that was passed to :obj:`~gi.repository.Gdk.content_serialize_async`\. .. method:: get_task_data() -> ~typing.Any | None Gets the data that was associated with the current operation. See :obj:`~gi.repository.Gdk.ContentSerializer.set_task_data`\. .. method:: get_user_data() -> ~typing.Any | None Gets the user data that was passed when the serializer was registered. .. method:: get_value() -> ~gi.repository.GObject.Value Gets the ``GValue`` to read the object to serialize from. .. method:: return_error(error: ~gi.repository.GLib.GError) -> None Indicate that the serialization has ended with an error. This function consumes ``error``\. :param error: a ``GError`` .. method:: return_success() -> None Indicate that the serialization has been successfully completed. .. method:: set_task_data(data: ~typing.Any, notify: ~typing.Callable[[~typing.Any], None]) -> None Associate data with the current serialization operation. :param data: data to associate with this operation :param notify: destroy notify for ``data``