1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
// This file was generated by gir (https://github.com/gtk-rs/gir)
// DO NOT EDIT
use crate::{Core,Object};
use glib::{prelude::*,translate::*};
glib::wrapper! {
#[doc(alias = "WpPlugin")]
pub struct Plugin(Object<ffi::WpPlugin, ffi::WpPluginClass>) @extends Object;
match fn {
type_ => || ffi::wp_plugin_get_type(),
}
}
impl Plugin {
pub const NONE: Option<&'static Plugin> = None;
#[doc(alias = "wp_plugin_find")]
pub fn find(core: &Core, plugin_name: &str) -> Option<Plugin> {
unsafe {
from_glib_full(ffi::wp_plugin_find(core.to_glib_none().0, plugin_name.to_glib_none().0))
}
}
}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::Plugin>> Sealed for T {}
}
pub trait PluginExt: IsA<Plugin> + sealed::Sealed + 'static {
#[doc(alias = "wp_plugin_get_name")]
#[doc(alias = "get_name")]
fn name(&self) -> Option<glib::GString> {
unsafe {
from_glib_none(ffi::wp_plugin_get_name(self.as_ref().to_glib_none().0))
}
}
#[doc(alias = "wp_plugin_register")]
fn register(self) {
unsafe {
ffi::wp_plugin_register(self.upcast().into_glib_ptr());
}
}
}
impl<O: IsA<Plugin>> PluginExt for O {}