1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::ContentDeserializer;
use glib::translate::*;

impl ContentDeserializer {
    pub fn set_value(&self, value: glib::Value) {
        assert!(value.type_() == self.type_(), "Type mismatch");

        let src_value = value.to_glib_none();
        unsafe {
            let dest_value = ffi::gdk_content_deserializer_get_value(self.to_glib_none().0);
            glib::gobject_ffi::g_value_copy(src_value.0, dest_value);
        }
    }

    /// Gets the I/O priority for the current operation.
    ///
    /// This is the priority that was passed to [``content_deserialize_async()``][`crate::content_deserialize_async()`].
    ///
    /// # Returns
    ///
    /// the I/O priority for the current operation
    #[doc(alias = "gdk_content_deserializer_get_priority")]
    #[doc(alias = "get_priority")]
    pub fn priority(&self) -> glib::Priority {
        unsafe {
            from_glib(ffi::gdk_content_deserializer_get_priority(
                self.to_glib_none().0,
            ))
        }
    }

    /// Indicate that the deserialization has ended with an error.
    ///
    /// This function consumes `error`.
    /// ## `error`
    /// a `GError`
    #[doc(alias = "gdk_content_deserializer_return_error")]
    pub fn return_error(&self, error: glib::Error) {
        unsafe {
            ffi::gdk_content_deserializer_return_error(
                self.to_glib_none().0,
                mut_override(error.to_glib_full()),
            );
        }
    }
}