Skip to main content

gio/auto/
simple_permission.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::{Permission, ffi};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    /// t change.
10    ///
11    /// Calling [`PermissionExt::acquire()`][crate::prelude::PermissionExt::acquire()] or [`PermissionExt::release()`][crate::prelude::PermissionExt::release()]
12    /// on a `GSimplePermission` will result in errors.
13    ///
14    /// # Implements
15    ///
16    /// [`PermissionExt`][trait@crate::prelude::PermissionExt], [`trait@glib::ObjectExt`]
17    #[doc(alias = "GSimplePermission")]
18    pub struct SimplePermission(Object<ffi::GSimplePermission>) @extends Permission;
19
20    match fn {
21        type_ => || ffi::g_simple_permission_get_type(),
22    }
23}
24
25impl SimplePermission {
26    /// Creates a new #GPermission instance that represents an action that is
27    /// either always or never allowed.
28    /// ## `allowed`
29    /// [`true`] if the action is allowed
30    ///
31    /// # Returns
32    ///
33    /// the #GSimplePermission, as a #GPermission
34    #[doc(alias = "g_simple_permission_new")]
35    pub fn new(allowed: bool) -> SimplePermission {
36        unsafe {
37            Permission::from_glib_full(ffi::g_simple_permission_new(allowed.into_glib()))
38                .unsafe_cast()
39        }
40    }
41}