// GENERATED — DO NOT EDIT
///|
/// [Upstream documentation](https://docs.gtk.org/gio/iface.Volume.html).
pub type Volume
///|
pub(open) trait IVolume {
fn as_volume(Self) -> Volume
fn can_eject(Self) -> Bool = _
fn can_mount(Self) -> Bool = _
fn get_activation_root(Self) -> File? = _
fn get_drive(Self) -> Drive? = _
fn get_icon(Self) -> Icon = _
fn get_identifier(Self, String) -> String? = _
fn get_mount(Self) -> Mount? = _
fn get_name(Self) -> String = _
fn get_sort_key(Self) -> String? = _
fn get_symbolic_icon(Self) -> Icon = _
fn get_uuid(Self) -> String? = _
fn should_automount(Self) -> Bool = _
fn eject_with_operation(
Self,
MountUnmountFlags,
&IMountOperation?,
&ICancellable?,
(Result[Bool, @glib.Error_]) -> Unit,
) -> Unit = _
fn mount(
Self,
MountMountFlags,
&IMountOperation?,
&ICancellable?,
(Result[Bool, @glib.Error_]) -> Unit,
) -> Unit = _
}
///|
pub impl IVolume for Volume with fn as_volume(self) {
self
}
///|
/// Implementation contract for Volume.changed. Self is the retained MoonBit state; the second parameter is the invoked Volume object.
pub(open) trait VVolumeChanged {
fn changed(Self, Volume) -> Unit
}
///|
/// Implementation contract for Volume.removed. Self is the retained MoonBit state; the second parameter is the invoked Volume object.
pub(open) trait VVolumeRemoved {
fn removed(Self, Volume) -> Unit
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Volume.can_eject.html).
#borrow(self)
pub extern "c" fn Volume::can_eject(self : Volume) -> Bool = "moonbit_g_volume_can_eject"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Volume.can_mount.html).
#borrow(self)
pub extern "c" fn Volume::can_mount(self : Volume) -> Bool = "moonbit_g_volume_can_mount"
///|
#borrow(self_)
extern "c" fn moonbit_g_volume_get_activation_root(
self_ : Volume,
) -> @glib.Nullable[File] = "moonbit_g_volume_get_activation_root"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Volume.get_activation_root.html).
pub fn Volume::get_activation_root(self : Volume) -> File? {
let raw_result = moonbit_g_volume_get_activation_root(self)
raw_result.to_option()
}
///|
#borrow(self_)
extern "c" fn moonbit_g_volume_get_drive(
self_ : Volume,
) -> @glib.Nullable[Drive] = "moonbit_g_volume_get_drive"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Volume.get_drive.html).
pub fn Volume::get_drive(self : Volume) -> Drive? {
let raw_result = moonbit_g_volume_get_drive(self)
raw_result.to_option()
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Volume.get_icon.html).
#borrow(self)
pub extern "c" fn Volume::get_icon(self : Volume) -> Icon = "moonbit_g_volume_get_icon"
///|
#borrow(self_, kind)
extern "c" fn moonbit_g_volume_get_identifier(
self_ : Volume,
kind : Bytes,
) -> @glib.Nullable[Bytes] = "moonbit_g_volume_get_identifier"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Volume.get_identifier.html).
pub fn Volume::get_identifier(self : Volume, kind : String) -> String? {
let result = moonbit_g_volume_get_identifier(
self,
@encoding/utf8.encode(kind),
)
match result.to_option() {
Some(bytes) => Some(@encoding/utf8.decode_lossy(bytes))
None => None
}
}
///|
#borrow(self_)
extern "c" fn moonbit_g_volume_get_mount(
self_ : Volume,
) -> @glib.Nullable[Mount] = "moonbit_g_volume_get_mount"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Volume.get_mount.html).
pub fn Volume::get_mount(self : Volume) -> Mount? {
let raw_result = moonbit_g_volume_get_mount(self)
raw_result.to_option()
}
///|
#borrow(self_)
extern "c" fn moonbit_g_volume_get_name(self_ : Volume) -> Bytes = "moonbit_g_volume_get_name"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Volume.get_name.html).
pub fn Volume::get_name(self : Volume) -> String {
@encoding/utf8.decode_lossy(moonbit_g_volume_get_name(self))
}
///|
#borrow(self_)
extern "c" fn moonbit_g_volume_get_sort_key(
self_ : Volume,
) -> @glib.Nullable[Bytes] = "moonbit_g_volume_get_sort_key"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Volume.get_sort_key.html).
pub fn Volume::get_sort_key(self : Volume) -> String? {
let result = moonbit_g_volume_get_sort_key(self)
match result.to_option() {
Some(bytes) => Some(@encoding/utf8.decode_lossy(bytes))
None => None
}
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Volume.get_symbolic_icon.html).
#borrow(self)
pub extern "c" fn Volume::get_symbolic_icon(self : Volume) -> Icon = "moonbit_g_volume_get_symbolic_icon"
///|
#borrow(self_)
extern "c" fn moonbit_g_volume_get_uuid(
self_ : Volume,
) -> @glib.Nullable[Bytes] = "moonbit_g_volume_get_uuid"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Volume.get_uuid.html).
pub fn Volume::get_uuid(self : Volume) -> String? {
let result = moonbit_g_volume_get_uuid(self)
match result.to_option() {
Some(bytes) => Some(@encoding/utf8.decode_lossy(bytes))
None => None
}
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Volume.should_automount.html).
#borrow(self)
pub extern "c" fn Volume::should_automount(self : Volume) -> Bool = "moonbit_g_volume_should_automount"
///|
#borrow(self_, mount_operation, cancellable)
extern "c" fn g_volume_eject_with_operation(
self_ : Volume,
flags : Int,
mount_operation : @glib.Nullable[MountOperation],
cancellable : @glib.Nullable[Cancellable],
function : FuncRef[
(
Bool,
@glib.Nullable[@glib.Error_],
(Bool, @glib.Nullable[@glib.Error_]) -> Unit,
) -> Unit,
],
closure : (Bool, @glib.Nullable[@glib.Error_]) -> Unit,
) = "moonbit_g_volume_eject_with_operation"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Volume.eject_with_operation.html).
pub fn Volume::eject_with_operation(
self : Volume,
flags : MountUnmountFlags,
mount_operation : &IMountOperation?,
cancellable : &ICancellable?,
callback : (Result[Bool, @glib.Error_]) -> Unit,
) -> Unit {
g_volume_eject_with_operation(
self,
flags.to_int(),
match mount_operation {
Some(v) => @glib.Nullable::some(v.as_mount_operation())
None => @glib.Nullable::null()
},
match cancellable {
Some(v) => @glib.Nullable::some(v.as_cancellable())
None => @glib.Nullable::null()
},
fn(result, error, f) { f(result, error) },
fn(result, error) {
match error.to_option() {
Some(e) => callback(Err(e))
None => callback(Ok(result))
}
},
)
}
///|
#borrow(self_, mount_operation, cancellable)
extern "c" fn g_volume_mount(
self_ : Volume,
flags : Int,
mount_operation : @glib.Nullable[MountOperation],
cancellable : @glib.Nullable[Cancellable],
function : FuncRef[
(
Bool,
@glib.Nullable[@glib.Error_],
(Bool, @glib.Nullable[@glib.Error_]) -> Unit,
) -> Unit,
],
closure : (Bool, @glib.Nullable[@glib.Error_]) -> Unit,
) = "moonbit_g_volume_mount"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Volume.mount.html).
pub fn Volume::mount(
self : Volume,
flags : MountMountFlags,
mount_operation : &IMountOperation?,
cancellable : &ICancellable?,
callback : (Result[Bool, @glib.Error_]) -> Unit,
) -> Unit {
g_volume_mount(
self,
flags.to_int(),
match mount_operation {
Some(v) => @glib.Nullable::some(v.as_mount_operation())
None => @glib.Nullable::null()
},
match cancellable {
Some(v) => @glib.Nullable::some(v.as_cancellable())
None => @glib.Nullable::null()
},
fn(result, error, f) { f(result, error) },
fn(result, error) {
match error.to_option() {
Some(e) => callback(Err(e))
None => callback(Ok(result))
}
},
)
}
///|
impl IVolume with fn can_eject(self) -> Bool {
self.as_volume().can_eject()
}
///|
impl IVolume with fn can_mount(self) -> Bool {
self.as_volume().can_mount()
}
///|
impl IVolume with fn get_activation_root(self) -> File? {
self.as_volume().get_activation_root()
}
///|
impl IVolume with fn get_drive(self) -> Drive? {
self.as_volume().get_drive()
}
///|
impl IVolume with fn get_icon(self) -> Icon {
self.as_volume().get_icon()
}
///|
impl IVolume with fn get_identifier(self, kind) -> String? {
self.as_volume().get_identifier(kind)
}
///|
impl IVolume with fn get_mount(self) -> Mount? {
self.as_volume().get_mount()
}
///|
impl IVolume with fn get_name(self) -> String {
self.as_volume().get_name()
}
///|
impl IVolume with fn get_sort_key(self) -> String? {
self.as_volume().get_sort_key()
}
///|
impl IVolume with fn get_symbolic_icon(self) -> Icon {
self.as_volume().get_symbolic_icon()
}
///|
impl IVolume with fn get_uuid(self) -> String? {
self.as_volume().get_uuid()
}
///|
impl IVolume with fn should_automount(self) -> Bool {
self.as_volume().should_automount()
}
///|
impl IVolume with fn eject_with_operation(
self,
flags,
mount_operation,
cancellable,
callback,
) -> Unit {
self
.as_volume()
.eject_with_operation(flags, mount_operation, cancellable, callback)
}
///|
impl IVolume with fn mount(self, flags, mount_operation, cancellable, callback) -> Unit {
self.as_volume().mount(flags, mount_operation, cancellable, callback)
}