1 module webkit2.Plugin; 2 3 private import glib.ListG; 4 private import glib.Str; 5 private import gobject.ObjectG; 6 private import webkit2.c.functions; 7 public import webkit2.c.types; 8 9 10 /** 11 * This object represents a single plugin, found while scanning the 12 * various platform plugin directories. This object can be used to get 13 * more information about a plugin, and enable/disable it, allowing 14 * fine-grained control of plugins. The list of available plugins can 15 * be obtained from the #WebKitWebContext, with 16 * webkit_web_context_get_plugins(). 17 */ 18 public class Plugin : ObjectG 19 { 20 /** the main Gtk struct */ 21 protected WebKitPlugin* webKitPlugin; 22 23 /** Get the main Gtk struct */ 24 public WebKitPlugin* getPluginStruct(bool transferOwnership = false) 25 { 26 if (transferOwnership) 27 ownedRef = false; 28 return webKitPlugin; 29 } 30 31 /** the main Gtk struct as a void* */ 32 protected override void* getStruct() 33 { 34 return cast(void*)webKitPlugin; 35 } 36 37 /** 38 * Sets our main struct and passes it to the parent class. 39 */ 40 public this (WebKitPlugin* webKitPlugin, bool ownedRef = false) 41 { 42 this.webKitPlugin = webKitPlugin; 43 super(cast(GObject*)webKitPlugin, ownedRef); 44 } 45 46 47 /** */ 48 public static GType getType() 49 { 50 return webkit_plugin_get_type(); 51 } 52 53 /** 54 * Returns: the description of the plugin. 55 */ 56 public string getDescription() 57 { 58 return Str.toString(webkit_plugin_get_description(webKitPlugin)); 59 } 60 61 /** 62 * Get information about MIME types handled by the plugin, 63 * as a list of #WebKitMimeInfo. 64 * 65 * Returns: a #GList of #WebKitMimeInfo. 66 */ 67 public ListG getMimeInfoList() 68 { 69 auto __p = webkit_plugin_get_mime_info_list(webKitPlugin); 70 71 if(__p is null) 72 { 73 return null; 74 } 75 76 return new ListG(cast(GList*) __p); 77 } 78 79 /** 80 * Returns: the name of the plugin. 81 */ 82 public string getName() 83 { 84 return Str.toString(webkit_plugin_get_name(webKitPlugin)); 85 } 86 87 /** 88 * Returns: the absolute path where the plugin is installed. 89 */ 90 public string getPath() 91 { 92 return Str.toString(webkit_plugin_get_path(webKitPlugin)); 93 } 94 }