// GENERATED — DO NOT EDIT
///|
/// [Upstream documentation](https://docs.gtk.org/gio/class.Cancellable.html).
pub type Cancellable
///|
pub(open) trait ICancellable {
fn as_cancellable(Self) -> Cancellable
fn cancel(Self) -> Unit = _
fn disconnect(Self, UInt64) -> Unit = _
fn get_fd(Self) -> Int = _
fn is_cancelled(Self) -> Bool = _
fn pop_current(Self) -> Unit = _
fn push_current(Self) -> Unit = _
fn release_fd(Self) -> Unit = _
fn reset(Self) -> Unit = _
fn set_error_if_cancelled(Self) -> Bool raise @glib.Error_ = _
fn connect_cancelled(Self, (Cancellable) -> Unit) -> UInt64 = _
fn connect(Self, () -> Unit) -> Unit = _
}
///|
pub impl ICancellable for Cancellable with fn as_cancellable(self) {
self
}
///|
/// Implementation contract for Cancellable.cancelled. Self is the retained MoonBit state; the second parameter is the invoked Cancellable object.
pub(open) trait VCancellableCancelled {
fn cancelled(Self, Cancellable) -> Unit
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/ctor.Cancellable.new.html).
pub extern "c" fn Cancellable::new() -> Cancellable = "moonbit_g_cancellable_new"
///|
extern "c" fn moonbit_g_cancellable_get_current() -> @glib.Nullable[Cancellable] = "moonbit_g_cancellable_get_current"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/type_func.Cancellable.get_current.html).
pub fn Cancellable::get_current() -> Cancellable? {
let raw_result = moonbit_g_cancellable_get_current()
raw_result.to_option()
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Cancellable.cancel.html).
#borrow(self)
pub extern "c" fn Cancellable::cancel(self : Cancellable) = "moonbit_g_cancellable_cancel"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Cancellable.disconnect.html).
#borrow(self)
pub extern "c" fn Cancellable::disconnect(
self : Cancellable,
handler_id : UInt64,
) = "moonbit_g_cancellable_disconnect"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Cancellable.get_fd.html).
#borrow(self)
pub extern "c" fn Cancellable::get_fd(self : Cancellable) -> Int = "moonbit_g_cancellable_get_fd"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Cancellable.is_cancelled.html).
#borrow(self)
pub extern "c" fn Cancellable::is_cancelled(self : Cancellable) -> Bool = "moonbit_g_cancellable_is_cancelled"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Cancellable.pop_current.html).
#borrow(self)
pub extern "c" fn Cancellable::pop_current(self : Cancellable) = "moonbit_g_cancellable_pop_current"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Cancellable.push_current.html).
#borrow(self)
pub extern "c" fn Cancellable::push_current(self : Cancellable) = "moonbit_g_cancellable_push_current"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Cancellable.release_fd.html).
#borrow(self)
pub extern "c" fn Cancellable::release_fd(self : Cancellable) = "moonbit_g_cancellable_release_fd"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Cancellable.reset.html).
#borrow(self)
pub extern "c" fn Cancellable::reset(self : Cancellable) = "moonbit_g_cancellable_reset"
///|
#borrow(self_, error)
extern "c" fn moonbit_g_cancellable_set_error_if_cancelled(
self_ : Cancellable,
error : Ref[@glib.Nullable[@glib.Error_]],
) -> Bool = "moonbit_g_cancellable_set_error_if_cancelled"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Cancellable.set_error_if_cancelled.html).
pub fn Cancellable::set_error_if_cancelled(
self : Cancellable,
) -> Bool raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_cancellable_set_error_if_cancelled(self, error_)
match error_.val.to_option() {
Some(e) => raise e
None => ()
}
result
}
///|
#borrow(instance)
extern "c" fn g_cancellable_connect_cancelled(
instance : Cancellable,
function : FuncRef[(Cancellable, (Cancellable) -> Unit) -> Unit],
closure : (Cancellable) -> Unit,
) -> UInt64 = "moonbit_g_cancellable_connect_cancelled"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/signal.Cancellable.cancelled.html).
pub fn Cancellable::connect_cancelled(
self : Cancellable,
f : (Cancellable) -> Unit,
) -> UInt64 {
g_cancellable_connect_cancelled(self, fn(instance_, f) { f(instance_) }, f)
}
///|
#borrow(instance)
extern "c" fn g_cancellable_connect(
instance : Cancellable,
function : FuncRef[(() -> Unit) -> Unit],
closure : () -> Unit,
) -> Unit = "moonbit_g_cancellable_connect"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Cancellable.connect.html).
pub fn Cancellable::connect(self : Cancellable, callback : () -> Unit) -> Unit {
g_cancellable_connect(self, fn(f) { f() }, callback)
}
///|
impl ICancellable with fn cancel(self) -> Unit {
self.as_cancellable().cancel()
}
///|
impl ICancellable with fn disconnect(self, handler_id) -> Unit {
self.as_cancellable().disconnect(handler_id)
}
///|
impl ICancellable with fn get_fd(self) -> Int {
self.as_cancellable().get_fd()
}
///|
impl ICancellable with fn is_cancelled(self) -> Bool {
self.as_cancellable().is_cancelled()
}
///|
impl ICancellable with fn pop_current(self) -> Unit {
self.as_cancellable().pop_current()
}
///|
impl ICancellable with fn push_current(self) -> Unit {
self.as_cancellable().push_current()
}
///|
impl ICancellable with fn release_fd(self) -> Unit {
self.as_cancellable().release_fd()
}
///|
impl ICancellable with fn reset(self) -> Unit {
self.as_cancellable().reset()
}
///|
impl ICancellable with fn set_error_if_cancelled(self) -> Bool raise @glib.Error_ {
self.as_cancellable().set_error_if_cancelled()
}
///|
impl ICancellable with fn connect_cancelled(self, f) -> UInt64 {
self.as_cancellable().connect_cancelled(f)
}
///|
impl ICancellable with fn connect(self, callback) -> Unit {
self.as_cancellable().connect(callback)
}
///|
pub fn Cancellable::as_gobject_object(self : Cancellable) -> @gobject.Object = "%identity"
///|
pub impl @gobject.IObject for Cancellable with fn as_object(self) {
self.as_gobject_object()
}