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
51
52
53
54
55
56
57
58
59
60
61
62
use glib::object::IsA;
use glib::translate::*;
use glib::GString;
use std::fmt;
use webkit2_sys;
use MimeInfo;
glib_wrapper! {
pub struct Plugin(Object<webkit2_sys::WebKitPlugin, webkit2_sys::WebKitPluginClass, PluginClass>);
match fn {
get_type => || webkit2_sys::webkit_plugin_get_type(),
}
}
pub const NONE_PLUGIN: Option<&Plugin> = None;
pub trait PluginExt: 'static {
fn get_description(&self) -> Option<GString>;
fn get_mime_info_list(&self) -> Vec<MimeInfo>;
fn get_name(&self) -> Option<GString>;
fn get_path(&self) -> Option<GString>;
}
impl<O: IsA<Plugin>> PluginExt for O {
fn get_description(&self) -> Option<GString> {
unsafe {
from_glib_none(webkit2_sys::webkit_plugin_get_description(self.as_ref().to_glib_none().0))
}
}
fn get_mime_info_list(&self) -> Vec<MimeInfo> {
unsafe {
FromGlibPtrContainer::from_glib_none(webkit2_sys::webkit_plugin_get_mime_info_list(self.as_ref().to_glib_none().0))
}
}
fn get_name(&self) -> Option<GString> {
unsafe {
from_glib_none(webkit2_sys::webkit_plugin_get_name(self.as_ref().to_glib_none().0))
}
}
fn get_path(&self) -> Option<GString> {
unsafe {
from_glib_none(webkit2_sys::webkit_plugin_get_path(self.as_ref().to_glib_none().0))
}
}
}
impl fmt::Display for Plugin {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Plugin")
}
}