// GENERATED — DO NOT EDIT

///|
/// [Upstream documentation](https://docs.gtk.org/gio/class.DebugControllerDBus.html).
pub type DebugControllerDBus

///|
pub(open) trait IDebugControllerDBus {
  fn as_debug_controller_dbus(Self) -> DebugControllerDBus
  fn stop(Self) -> Unit = _
  fn connect_authorize(
    Self,
    (DebugControllerDBus, DBusMethodInvocation) -> Bool,
  ) -> UInt64 = _
}

///|
pub impl IDebugControllerDBus for DebugControllerDBus with fn as_debug_controller_dbus(
  self,
) {
  self
}

///|
#borrow(connection, cancellable, error)
extern "c" fn moonbit_g_debug_controller_dbus_new(
  connection : DBusConnection,
  cancellable : @glib.Nullable[Cancellable],
  error : Ref[@glib.Nullable[@glib.Error_]],
) -> @glib.Nullable[DebugControllerDBus] = "moonbit_g_debug_controller_dbus_new"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/ctor.DebugControllerDBus.new.html).
pub fn DebugControllerDBus::new(
  connection : &IDBusConnection,
  cancellable : &ICancellable?,
) -> DebugControllerDBus? raise @glib.Error_ {
  let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
  let raw_result = moonbit_g_debug_controller_dbus_new(
    connection.as_dbus_connection(),
    match cancellable {
      Some(v) => @glib.Nullable::some(v.as_cancellable())
      None => @glib.Nullable::null()
    },
    error_,
  )
  match error_.val.to_option() {
    Some(e) => raise e
    None => ()
  }
  raw_result.to_option()
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DebugControllerDBus.stop.html).
#borrow(self)
pub extern "c" fn DebugControllerDBus::stop(self : DebugControllerDBus) = "moonbit_g_debug_controller_dbus_stop"

///|
#borrow(instance)
extern "c" fn g_debug_controller_d_bus_connect_authorize(
  instance : DebugControllerDBus,
  function : FuncRef[
    (
      DebugControllerDBus,
      DBusMethodInvocation,
      (DebugControllerDBus, DBusMethodInvocation) -> Bool,
    ) -> Bool,
  ],
  closure : (DebugControllerDBus, DBusMethodInvocation) -> Bool,
) -> UInt64 = "moonbit_g_debug_controller_d_bus_connect_authorize"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/signal.DebugControllerDBus.authorize.html).
pub fn DebugControllerDBus::connect_authorize(
  self : DebugControllerDBus,
  f : (DebugControllerDBus, DBusMethodInvocation) -> Bool,
) -> UInt64 {
  g_debug_controller_d_bus_connect_authorize(
    self,
    fn(instance_, invocation, f) { f(instance_, invocation) },
    f,
  )
}

///|
#borrow(self_)
extern "c" fn moonbit_g_debug_controller_d_bus_get_connection(
  self_ : DebugControllerDBus,
) -> @glib.Nullable[DBusConnection] = "moonbit_g_debug_controller_d_bus_get_connection"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/property.DebugControllerDBus.connection.html).
pub fn DebugControllerDBus::get_connection(
  self : DebugControllerDBus,
) -> DBusConnection? {
  moonbit_g_debug_controller_d_bus_get_connection(self).to_option()
}

///|
impl IDebugControllerDBus with fn stop(self) -> Unit {
  self.as_debug_controller_dbus().stop()
}

///|
impl IDebugControllerDBus with fn connect_authorize(self, f) -> UInt64 {
  self.as_debug_controller_dbus().connect_authorize(f)
}

///|
pub fn DebugControllerDBus::as_gobject_object(
  self : DebugControllerDBus,
) -> @gobject.Object = "%identity"

///|
pub impl @gobject.IObject for DebugControllerDBus with fn as_object(self) {
  self.as_gobject_object()
}

///|
pub fn DebugControllerDBus::as_debug_controller(
  self : DebugControllerDBus,
) -> DebugController = "%identity"

///|
pub impl IDebugController for DebugControllerDBus with fn as_debug_controller(
  self,
) {
  self.as_debug_controller()
}

///|
pub fn DebugControllerDBus::as_initable(self : DebugControllerDBus) -> Initable = "%identity"

///|
pub impl IInitable for DebugControllerDBus with fn as_initable(self) {
  self.as_initable()
}