// 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 gio_sys;
use glib;
use glib::translate::*;
use DBusMethodInfo;
use DBusPropertyInfo;
use DBusSignalInfo;

glib_wrapper! {
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct DBusInterfaceInfo(Shared<gio_sys::GDBusInterfaceInfo>);

    match fn {
        ref => |ptr| gio_sys::g_dbus_interface_info_ref(ptr),
        unref => |ptr| gio_sys::g_dbus_interface_info_unref(ptr),
        get_type => || gio_sys::g_dbus_interface_info_get_type(),
    }
}

impl DBusInterfaceInfo {
    pub fn generate_xml(&self, indent: u32, string_builder: &mut glib::String) {
        unsafe {
            gio_sys::g_dbus_interface_info_generate_xml(
                self.to_glib_none().0,
                indent,
                string_builder.to_glib_none_mut().0,
            );
        }
    }

    pub fn lookup_method(&self, name: &str) -> Option<DBusMethodInfo> {
        unsafe {
            from_glib_none(gio_sys::g_dbus_interface_info_lookup_method(
                self.to_glib_none().0,
                name.to_glib_none().0,
            ))
        }
    }

    pub fn lookup_property(&self, name: &str) -> Option<DBusPropertyInfo> {
        unsafe {
            from_glib_none(gio_sys::g_dbus_interface_info_lookup_property(
                self.to_glib_none().0,
                name.to_glib_none().0,
            ))
        }
    }

    pub fn lookup_signal(&self, name: &str) -> Option<DBusSignalInfo> {
        unsafe {
            from_glib_none(gio_sys::g_dbus_interface_info_lookup_signal(
                self.to_glib_none().0,
                name.to_glib_none().0,
            ))
        }
    }
}
