gdk4/auto/
content_deserializer.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::ffi;
6use glib::translate::*;
7
8glib::wrapper! {
9    /// A [`ContentDeserializer`][crate::ContentDeserializer] is used to deserialize content received via
10    /// inter-application data transfers.
11    ///
12    /// The [`ContentDeserializer`][crate::ContentDeserializer] transforms serialized content that is
13    /// identified by a mime type into an object identified by a GType.
14    ///
15    /// GTK provides serializers and deserializers for common data types
16    /// such as text, colors, images or file lists. To register your own
17    /// deserialization functions, use [`content_register_deserializer()`][crate::content_register_deserializer()].
18    ///
19    /// Also see [`ContentSerializer`][crate::ContentSerializer].
20    #[doc(alias = "GdkContentDeserializer")]
21    pub struct ContentDeserializer(Object<ffi::GdkContentDeserializer>);
22
23    match fn {
24        type_ => || ffi::gdk_content_deserializer_get_type(),
25    }
26}
27
28impl ContentDeserializer {
29    /// Gets the cancellable for the current operation.
30    ///
31    /// This is the `GCancellable` that was passed to [`content_deserialize_async()`][crate::content_deserialize_async()].
32    ///
33    /// # Returns
34    ///
35    /// the cancellable for the current operation
36    #[doc(alias = "gdk_content_deserializer_get_cancellable")]
37    #[doc(alias = "get_cancellable")]
38    pub fn cancellable(&self) -> Option<gio::Cancellable> {
39        unsafe {
40            from_glib_none(ffi::gdk_content_deserializer_get_cancellable(
41                self.to_glib_none().0,
42            ))
43        }
44    }
45
46    /// Gets the `GType` to create an instance of.
47    ///
48    /// # Returns
49    ///
50    /// the `GType` for the current operation
51    #[doc(alias = "gdk_content_deserializer_get_gtype")]
52    #[doc(alias = "get_gtype")]
53    pub fn type_(&self) -> glib::types::Type {
54        unsafe {
55            from_glib(ffi::gdk_content_deserializer_get_gtype(
56                self.to_glib_none().0,
57            ))
58        }
59    }
60
61    /// Gets the input stream for the current operation.
62    ///
63    /// This is the stream that was passed to [`content_deserialize_async()`][crate::content_deserialize_async()].
64    ///
65    /// # Returns
66    ///
67    /// the input stream for the current operation
68    #[doc(alias = "gdk_content_deserializer_get_input_stream")]
69    #[doc(alias = "get_input_stream")]
70    pub fn input_stream(&self) -> gio::InputStream {
71        unsafe {
72            from_glib_none(ffi::gdk_content_deserializer_get_input_stream(
73                self.to_glib_none().0,
74            ))
75        }
76    }
77
78    /// Gets the mime type to deserialize from.
79    ///
80    /// # Returns
81    ///
82    /// the mime type for the current operation
83    #[doc(alias = "gdk_content_deserializer_get_mime_type")]
84    #[doc(alias = "get_mime_type")]
85    pub fn mime_type(&self) -> glib::GString {
86        unsafe {
87            from_glib_none(ffi::gdk_content_deserializer_get_mime_type(
88                self.to_glib_none().0,
89            ))
90        }
91    }
92
93    /// Gets the `GValue` to store the deserialized object in.
94    ///
95    /// # Returns
96    ///
97    /// the `GValue` for the current operation
98    #[doc(alias = "gdk_content_deserializer_get_value")]
99    #[doc(alias = "get_value")]
100    pub fn value(&self) -> glib::Value {
101        unsafe {
102            from_glib_none(ffi::gdk_content_deserializer_get_value(
103                self.to_glib_none().0,
104            ))
105        }
106    }
107
108    /// Indicate that the deserialization has been successfully completed.
109    #[doc(alias = "gdk_content_deserializer_return_success")]
110    pub fn return_success(&self) {
111        unsafe {
112            ffi::gdk_content_deserializer_return_success(self.to_glib_none().0);
113        }
114    }
115}