// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::{DBusConnection, DBusObject, ffi};
use glib::{prelude::*, translate::*};

glib::wrapper! {
    #[doc(alias = "GDBusObjectProxy")]
    pub struct DBusObjectProxy(Object<ffi::GDBusObjectProxy, ffi::GDBusObjectProxyClass>) @implements DBusObject;

    match fn {
        type_ => || ffi::g_dbus_object_proxy_get_type(),
    }
}

impl DBusObjectProxy {
    pub const NONE: Option<&'static DBusObjectProxy> = None;

    #[doc(alias = "g_dbus_object_proxy_new")]
    pub fn new(connection: &DBusConnection, object_path: &str) -> DBusObjectProxy {
        unsafe {
            from_glib_full(ffi::g_dbus_object_proxy_new(
                connection.to_glib_none().0,
                object_path.to_glib_none().0,
            ))
        }
    }
}

pub trait DBusObjectProxyExt: IsA<DBusObjectProxy> + 'static {
    #[doc(alias = "g_dbus_object_proxy_get_connection")]
    #[doc(alias = "get_connection")]
    #[doc(alias = "g-connection")]
    fn connection(&self) -> DBusConnection {
        unsafe {
            from_glib_none(ffi::g_dbus_object_proxy_get_connection(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "g-connection")]
    fn g_connection(&self) -> Option<DBusConnection> {
        ObjectExt::property(self.as_ref(), "g-connection")
    }

    #[doc(alias = "g-object-path")]
    fn g_object_path(&self) -> Option<glib::GString> {
        ObjectExt::property(self.as_ref(), "g-object-path")
    }
}

impl<O: IsA<DBusObjectProxy>> DBusObjectProxyExt for O {}
