1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module peas.PluginInfo; 26 27 private import gio.Settings; 28 private import glib.ErrorG; 29 private import glib.GException; 30 private import glib.Str; 31 private import gobject.ObjectG; 32 private import peas.c.functions; 33 public import peas.c.types; 34 35 36 /** 37 * The #PeasPluginInfo structure contains only private data and should only 38 * be accessed using the provided API. 39 */ 40 public class PluginInfo 41 { 42 /** the main Gtk struct */ 43 protected PeasPluginInfo* peasPluginInfo; 44 protected bool ownedRef; 45 46 /** Get the main Gtk struct */ 47 public PeasPluginInfo* getPluginInfoStruct(bool transferOwnership = false) 48 { 49 if (transferOwnership) 50 ownedRef = false; 51 return peasPluginInfo; 52 } 53 54 /** the main Gtk struct as a void* */ 55 protected void* getStruct() 56 { 57 return cast(void*)peasPluginInfo; 58 } 59 60 /** 61 * Sets our main struct and passes it to the parent class. 62 */ 63 public this (PeasPluginInfo* peasPluginInfo, bool ownedRef = false) 64 { 65 this.peasPluginInfo = peasPluginInfo; 66 this.ownedRef = ownedRef; 67 } 68 69 70 /** */ 71 public static GType getType() 72 { 73 return peas_plugin_info_get_type(); 74 } 75 76 /** 77 * Gets a %NULL-terminated array of strings with the authors of the plugin. 78 * 79 * The relevant key in the plugin info file is "Authors". 80 * 81 * Returns: the plugin's author list. 82 */ 83 public string[] getAuthors() 84 { 85 return Str.toStringArray(peas_plugin_info_get_authors(peasPluginInfo)); 86 } 87 88 /** 89 * Gets the copyright of the plugin. 90 * 91 * The relevant key in the plugin info file is "Copyright". 92 * 93 * Returns: the plugin's copyright information. 94 */ 95 public string getCopyright() 96 { 97 return Str.toString(peas_plugin_info_get_copyright(peasPluginInfo)); 98 } 99 100 /** 101 * Gets the data dir of the plugin. 102 * 103 * The module data directory is the directory where a plugin should find its 104 * runtime data. This is not a value read from the #GKeyFile, but rather a 105 * value provided by the #PeasEngine, depending on where the plugin file was 106 * found. 107 * 108 * Returns: the plugin's data dir. 109 */ 110 public string getDataDir() 111 { 112 return Str.toString(peas_plugin_info_get_data_dir(peasPluginInfo)); 113 } 114 115 /** 116 * Gets the dependencies of the plugin. 117 * 118 * The #PeasEngine will always ensure that the dependencies of a plugin are 119 * loaded when the said plugin is loaded. It means that dependencies are 120 * loaded before the plugin, and unloaded after it. Circular dependencies of 121 * plugins lead to undefined loading order. 122 * 123 * The relevant key in the plugin info file is "Depends". 124 * 125 * Returns: the plugin's dependencies. 126 */ 127 public string[] getDependencies() 128 { 129 return Str.toStringArray(peas_plugin_info_get_dependencies(peasPluginInfo)); 130 } 131 132 /** 133 * Gets the description of the plugin. 134 * 135 * The description of the plugin should be a string presenting the purpose of 136 * the plugin. It will typically be presented in a plugin's about box. 137 * 138 * The relevant key in the plugin info file is "Description". 139 * 140 * Returns: the plugin's description. 141 */ 142 public string getDescription() 143 { 144 return Str.toString(peas_plugin_info_get_description(peasPluginInfo)); 145 } 146 147 /** 148 * Gets external data specified for the plugin. 149 * 150 * External data is specified in the plugin info file prefixed with X-. For 151 * example, if a key/value pair X-Peas=1 is specified in the key file, you 152 * can use "Peas" for @key to retrieve the value "1". 153 * 154 * Note: that you can omit the X- prefix when retrieving the value, 155 * but not when specifying the value in the file. 156 * 157 * Params: 158 * key = The key to lookup. 159 * 160 * Returns: the external data, or %NULL if the external data could not be found. 161 * 162 * Since: 1.6 163 */ 164 public string getExternalData(string key) 165 { 166 return Str.toString(peas_plugin_info_get_external_data(peasPluginInfo, Str.toStringz(key))); 167 } 168 169 /** 170 * Gets the help URI of the plugin. 171 * 172 * The Help URI of a plugin will typically be presented by the plugin manager 173 * as a "Help" button linking to the URI. It can either be a HTTP URL on some 174 * website or a ghelp: URI if a Gnome help page is available for the plugin. 175 * 176 * The relevant key in the plugin info file is "Help". Other platform-specific 177 * keys exist for platform-specific help files. Those are "Help-GNOME", 178 * "Help-Windows" and "Help-MacOS-X". 179 * 180 * Returns: the plugin's help URI. 181 */ 182 public string getHelpUri() 183 { 184 return Str.toString(peas_plugin_info_get_help_uri(peasPluginInfo)); 185 } 186 187 /** 188 * Gets the icon name of the plugin. 189 * 190 * The icon of the plugin will be presented in the plugin manager UI. If no 191 * icon is specified, the default green puzzle icon will be used. 192 * 193 * The relevant key in the plugin info file is "Icon". 194 * 195 * Returns: the plugin's icon name. 196 */ 197 public string getIconName() 198 { 199 return Str.toString(peas_plugin_info_get_icon_name(peasPluginInfo)); 200 } 201 202 /** 203 * Gets the module directory. 204 * 205 * The module directory is the directory where the plugin file was found. This 206 * is not a value from the #GKeyFile, but rather a value provided by the 207 * #PeasEngine. 208 * 209 * Returns: the module directory. 210 */ 211 public string getModuleDir() 212 { 213 return Str.toString(peas_plugin_info_get_module_dir(peasPluginInfo)); 214 } 215 216 /** 217 * Gets the module name. 218 * 219 * The module name will be used to find the actual plugin. The way this value 220 * will be used depends on the loader (i.e. on the language) of the plugin. 221 * This value is also used to uniquely identify a particular plugin. 222 * 223 * The relevant key in the plugin info file is "Module". 224 * 225 * Returns: the module name. 226 */ 227 public string getModuleName() 228 { 229 return Str.toString(peas_plugin_info_get_module_name(peasPluginInfo)); 230 } 231 232 /** 233 * Gets the name of the plugin. 234 * 235 * The name of a plugin should be a nice short string to be presented in UIs. 236 * 237 * The relevant key in the plugin info file is "Name". 238 * 239 * Returns: the plugin's name. 240 */ 241 public string getName() 242 { 243 return Str.toString(peas_plugin_info_get_name(peasPluginInfo)); 244 } 245 246 /** 247 * Creates a new #GSettings for the given @schema_id and if 248 * gschemas.compiled is not in the module directory an attempt 249 * will be made to create it. 250 * 251 * Params: 252 * schemaId = The schema id. 253 * 254 * Returns: a new #GSettings, or %NULL. 255 * 256 * Since: 1.4 257 */ 258 public Settings getSettings(string schemaId) 259 { 260 auto p = peas_plugin_info_get_settings(peasPluginInfo, Str.toStringz(schemaId)); 261 262 if(p is null) 263 { 264 return null; 265 } 266 267 return ObjectG.getDObject!(Settings)(cast(GSettings*) p, true); 268 } 269 270 /** 271 * Gets the version of the plugin. 272 * 273 * The relevant key in the plugin info file is "Version". 274 * 275 * Returns: the plugin's version. 276 */ 277 public string getVersion() 278 { 279 return Str.toString(peas_plugin_info_get_version(peasPluginInfo)); 280 } 281 282 /** 283 * Gets the website of the plugin. 284 * 285 * The relevant key in the plugin info file is "Website". 286 * 287 * Returns: the plugin's associated website. 288 */ 289 public string getWebsite() 290 { 291 return Str.toString(peas_plugin_info_get_website(peasPluginInfo)); 292 } 293 294 /** 295 * Check if the plugin depends on another plugin. 296 * 297 * Params: 298 * moduleName = The name of the plugin to check. 299 * 300 * Returns: whether the plugin depends on the plugin @module_name. 301 */ 302 public bool hasDependency(string moduleName) 303 { 304 return peas_plugin_info_has_dependency(peasPluginInfo, Str.toStringz(moduleName)) != 0; 305 } 306 307 /** 308 * Check if the plugin is available. 309 * 310 * A plugin is marked as not available when there is no loader available to 311 * load it, or when there has been an error when trying to load it previously. 312 * If not available then @error will be set. 313 * 314 * Returns: %TRUE if the plugin is available. 315 * 316 * Throws: GException on failure. 317 */ 318 public bool isAvailable() 319 { 320 GError* err = null; 321 322 auto p = peas_plugin_info_is_available(peasPluginInfo, &err) != 0; 323 324 if (err !is null) 325 { 326 throw new GException( new ErrorG(err) ); 327 } 328 329 return p; 330 } 331 332 /** 333 * Check if the plugin is a builtin plugin. 334 * 335 * A builtin plugin is a plugin which cannot be enabled or disabled by the 336 * user through a plugin manager (like #PeasGtkPluginManager). Loading or 337 * unloading such plugins is the responsibility of the application alone. 338 * Most applications will usually load those plugins immediately after 339 * the initialization of the #PeasEngine. 340 * 341 * The relevant key in the plugin info file is "Builtin". 342 * 343 * Returns: %TRUE if the plugin is a builtin plugin, %FALSE 344 * if not. 345 */ 346 public bool isBuiltin() 347 { 348 return peas_plugin_info_is_builtin(peasPluginInfo) != 0; 349 } 350 351 /** 352 * Check if the plugin is a hidden plugin. 353 * 354 * A hidden plugin is a plugin which cannot be seen by a 355 * user through a plugin manager (like #PeasGtkPluginManager). Loading and 356 * unloading such plugins is the responsibility of the application alone or 357 * through plugins that depend on them. 358 * 359 * The relevant key in the plugin info file is "Hidden". 360 * 361 * Returns: %TRUE if the plugin is a hidden plugin, %FALSE 362 * if not. 363 */ 364 public bool isHidden() 365 { 366 return peas_plugin_info_is_hidden(peasPluginInfo) != 0; 367 } 368 369 /** 370 * Check if the plugin is loaded. 371 * 372 * Returns: %TRUE if the plugin is loaded. 373 */ 374 public bool isLoaded() 375 { 376 return peas_plugin_info_is_loaded(peasPluginInfo) != 0; 377 } 378 379 /** */ 380 public static GQuark errorQuark() 381 { 382 return peas_plugin_info_error_quark(); 383 } 384 }