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