// GENERATED — DO NOT EDIT
///|
/// [Upstream documentation](https://docs.gtk.org/gio/iface.Drive.html).
pub type Drive
///|
pub(open) trait IDrive {
fn as_drive(Self) -> Drive
fn can_eject(Self) -> Bool = _
fn can_poll_for_media(Self) -> Bool = _
fn can_start(Self) -> Bool = _
fn can_start_degraded(Self) -> Bool = _
fn can_stop(Self) -> Bool = _
fn get_icon(Self) -> Icon = _
fn get_identifier(Self, String) -> String? = _
fn get_name(Self) -> String = _
fn get_sort_key(Self) -> String? = _
fn get_start_stop_type(Self) -> DriveStartStopType = _
fn get_symbolic_icon(Self) -> Icon = _
fn get_volumes(Self) -> Array[Volume] = _
fn has_media(Self) -> Bool = _
fn has_volumes(Self) -> Bool = _
fn is_media_check_automatic(Self) -> Bool = _
fn is_media_removable(Self) -> Bool = _
fn is_removable(Self) -> Bool = _
fn eject_with_operation(
Self,
MountUnmountFlags,
&IMountOperation?,
&ICancellable?,
(Result[Bool, @glib.Error_]) -> Unit,
) -> Unit = _
fn poll_for_media(Self, &ICancellable?, (Result[Bool, @glib.Error_]) -> Unit) -> Unit = _
fn start(
Self,
DriveStartFlags,
&IMountOperation?,
&ICancellable?,
(Result[Bool, @glib.Error_]) -> Unit,
) -> Unit = _
fn stop(
Self,
MountUnmountFlags,
&IMountOperation?,
&ICancellable?,
(Result[Bool, @glib.Error_]) -> Unit,
) -> Unit = _
}
///|
pub impl IDrive for Drive with fn as_drive(self) {
self
}
///|
/// Implementation contract for Drive.changed. Self is the retained MoonBit state; the second parameter is the invoked Drive object.
pub(open) trait VDriveChanged {
fn changed(Self, Drive) -> Unit
}
///|
/// Implementation contract for Drive.disconnected. Self is the retained MoonBit state; the second parameter is the invoked Drive object.
pub(open) trait VDriveDisconnected {
fn disconnected(Self, Drive) -> Unit
}
///|
/// Implementation contract for Drive.eject_button. Self is the retained MoonBit state; the second parameter is the invoked Drive object.
pub(open) trait VDriveEjectButton {
fn eject_button(Self, Drive) -> Unit
}
///|
/// Implementation contract for Drive.stop_button. Self is the retained MoonBit state; the second parameter is the invoked Drive object.
pub(open) trait VDriveStopButton {
fn stop_button(Self, Drive) -> Unit
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.can_eject.html).
#borrow(self)
pub extern "c" fn Drive::can_eject(self : Drive) -> Bool = "moonbit_g_drive_can_eject"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.can_poll_for_media.html).
#borrow(self)
pub extern "c" fn Drive::can_poll_for_media(self : Drive) -> Bool = "moonbit_g_drive_can_poll_for_media"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.can_start.html).
#borrow(self)
pub extern "c" fn Drive::can_start(self : Drive) -> Bool = "moonbit_g_drive_can_start"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.can_start_degraded.html).
#borrow(self)
pub extern "c" fn Drive::can_start_degraded(self : Drive) -> Bool = "moonbit_g_drive_can_start_degraded"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.can_stop.html).
#borrow(self)
pub extern "c" fn Drive::can_stop(self : Drive) -> Bool = "moonbit_g_drive_can_stop"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.get_icon.html).
#borrow(self)
pub extern "c" fn Drive::get_icon(self : Drive) -> Icon = "moonbit_g_drive_get_icon"
///|
#borrow(self_, kind)
extern "c" fn moonbit_g_drive_get_identifier(
self_ : Drive,
kind : Bytes,
) -> @glib.Nullable[Bytes] = "moonbit_g_drive_get_identifier"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.get_identifier.html).
pub fn Drive::get_identifier(self : Drive, kind : String) -> String? {
let result = moonbit_g_drive_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_drive_get_name(self_ : Drive) -> Bytes = "moonbit_g_drive_get_name"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.get_name.html).
pub fn Drive::get_name(self : Drive) -> String {
@encoding/utf8.decode_lossy(moonbit_g_drive_get_name(self))
}
///|
#borrow(self_)
extern "c" fn moonbit_g_drive_get_sort_key(
self_ : Drive,
) -> @glib.Nullable[Bytes] = "moonbit_g_drive_get_sort_key"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.get_sort_key.html).
pub fn Drive::get_sort_key(self : Drive) -> String? {
let result = moonbit_g_drive_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.Drive.get_start_stop_type.html).
#borrow(self)
pub extern "c" fn Drive::get_start_stop_type(
self : Drive,
) -> DriveStartStopType = "moonbit_g_drive_get_start_stop_type"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.get_symbolic_icon.html).
#borrow(self)
pub extern "c" fn Drive::get_symbolic_icon(self : Drive) -> Icon = "moonbit_g_drive_get_symbolic_icon"
///|
#borrow(self_, result)
extern "c" fn moonbit_g_drive_get_volumes(
self_ : Drive,
result : Ref[FixedArray[Volume]],
) = "moonbit_g_drive_get_volumes"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.get_volumes.html).
pub fn Drive::get_volumes(self : Drive) -> Array[Volume] {
let result_ref : Ref[FixedArray[Volume]] = Ref([])
moonbit_g_drive_get_volumes(self, result_ref)
let values : Array[Volume] = Array::new(capacity=result_ref.val.length())
for value in result_ref.val {
values.push(value)
}
values
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.has_media.html).
#borrow(self)
pub extern "c" fn Drive::has_media(self : Drive) -> Bool = "moonbit_g_drive_has_media"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.has_volumes.html).
#borrow(self)
pub extern "c" fn Drive::has_volumes(self : Drive) -> Bool = "moonbit_g_drive_has_volumes"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.is_media_check_automatic.html).
#borrow(self)
pub extern "c" fn Drive::is_media_check_automatic(self : Drive) -> Bool = "moonbit_g_drive_is_media_check_automatic"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.is_media_removable.html).
#borrow(self)
pub extern "c" fn Drive::is_media_removable(self : Drive) -> Bool = "moonbit_g_drive_is_media_removable"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.is_removable.html).
#borrow(self)
pub extern "c" fn Drive::is_removable(self : Drive) -> Bool = "moonbit_g_drive_is_removable"
///|
#borrow(self_, mount_operation, cancellable)
extern "c" fn g_drive_eject_with_operation(
self_ : Drive,
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_drive_eject_with_operation"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.eject_with_operation.html).
pub fn Drive::eject_with_operation(
self : Drive,
flags : MountUnmountFlags,
mount_operation : &IMountOperation?,
cancellable : &ICancellable?,
callback : (Result[Bool, @glib.Error_]) -> Unit,
) -> Unit {
g_drive_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_, cancellable)
extern "c" fn g_drive_poll_for_media(
self_ : Drive,
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_drive_poll_for_media"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.poll_for_media.html).
pub fn Drive::poll_for_media(
self : Drive,
cancellable : &ICancellable?,
callback : (Result[Bool, @glib.Error_]) -> Unit,
) -> Unit {
g_drive_poll_for_media(
self,
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_drive_start(
self_ : Drive,
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_drive_start"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.start.html).
pub fn Drive::start(
self : Drive,
flags : DriveStartFlags,
mount_operation : &IMountOperation?,
cancellable : &ICancellable?,
callback : (Result[Bool, @glib.Error_]) -> Unit,
) -> Unit {
g_drive_start(
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_drive_stop(
self_ : Drive,
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_drive_stop"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Drive.stop.html).
pub fn Drive::stop(
self : Drive,
flags : MountUnmountFlags,
mount_operation : &IMountOperation?,
cancellable : &ICancellable?,
callback : (Result[Bool, @glib.Error_]) -> Unit,
) -> Unit {
g_drive_stop(
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 IDrive with fn can_eject(self) -> Bool {
self.as_drive().can_eject()
}
///|
impl IDrive with fn can_poll_for_media(self) -> Bool {
self.as_drive().can_poll_for_media()
}
///|
impl IDrive with fn can_start(self) -> Bool {
self.as_drive().can_start()
}
///|
impl IDrive with fn can_start_degraded(self) -> Bool {
self.as_drive().can_start_degraded()
}
///|
impl IDrive with fn can_stop(self) -> Bool {
self.as_drive().can_stop()
}
///|
impl IDrive with fn get_icon(self) -> Icon {
self.as_drive().get_icon()
}
///|
impl IDrive with fn get_identifier(self, kind) -> String? {
self.as_drive().get_identifier(kind)
}
///|
impl IDrive with fn get_name(self) -> String {
self.as_drive().get_name()
}
///|
impl IDrive with fn get_sort_key(self) -> String? {
self.as_drive().get_sort_key()
}
///|
impl IDrive with fn get_start_stop_type(self) -> DriveStartStopType {
self.as_drive().get_start_stop_type()
}
///|
impl IDrive with fn get_symbolic_icon(self) -> Icon {
self.as_drive().get_symbolic_icon()
}
///|
impl IDrive with fn get_volumes(self) -> Array[Volume] {
self.as_drive().get_volumes()
}
///|
impl IDrive with fn has_media(self) -> Bool {
self.as_drive().has_media()
}
///|
impl IDrive with fn has_volumes(self) -> Bool {
self.as_drive().has_volumes()
}
///|
impl IDrive with fn is_media_check_automatic(self) -> Bool {
self.as_drive().is_media_check_automatic()
}
///|
impl IDrive with fn is_media_removable(self) -> Bool {
self.as_drive().is_media_removable()
}
///|
impl IDrive with fn is_removable(self) -> Bool {
self.as_drive().is_removable()
}
///|
impl IDrive with fn eject_with_operation(
self,
flags,
mount_operation,
cancellable,
callback,
) -> Unit {
self
.as_drive()
.eject_with_operation(flags, mount_operation, cancellable, callback)
}
///|
impl IDrive with fn poll_for_media(self, cancellable, callback) -> Unit {
self.as_drive().poll_for_media(cancellable, callback)
}
///|
impl IDrive with fn start(self, flags, mount_operation, cancellable, callback) -> Unit {
self.as_drive().start(flags, mount_operation, cancellable, callback)
}
///|
impl IDrive with fn stop(self, flags, mount_operation, cancellable, callback) -> Unit {
self.as_drive().stop(flags, mount_operation, cancellable, callback)
}