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
use MimeInfo;
use ffi;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct Plugin(Object<ffi::WebKitPlugin, ffi::WebKitPluginClass>);
match fn {
get_type => || ffi::webkit_plugin_get_type(),
}
}
pub trait PluginExt {
fn get_description(&self) -> Option<String>;
fn get_mime_info_list(&self) -> Vec<MimeInfo>;
fn get_name(&self) -> Option<String>;
fn get_path(&self) -> Option<String>;
}
impl<O: IsA<Plugin>> PluginExt for O {
fn get_description(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::webkit_plugin_get_description(self.to_glib_none().0))
}
}
fn get_mime_info_list(&self) -> Vec<MimeInfo> {
unsafe {
FromGlibPtrContainer::from_glib_none(ffi::webkit_plugin_get_mime_info_list(self.to_glib_none().0))
}
}
fn get_name(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::webkit_plugin_get_name(self.to_glib_none().0))
}
}
fn get_path(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::webkit_plugin_get_path(self.to_glib_none().0))
}
}
}