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 gio.IOModule; 26 27 private import gio.IOModuleScope; 28 private import gio.c.functions; 29 public import gio.c.types; 30 private import glib.ConstructionException; 31 private import glib.ListG; 32 private import glib.Str; 33 private import gobject.ObjectG; 34 private import gobject.TypeModule; 35 private import gobject.TypePluginIF; 36 private import gobject.TypePluginT; 37 public import gtkc.giotypes; 38 39 40 /** 41 * Provides an interface and default functions for loading and unloading 42 * modules. This is used internally to make GIO extensible, but can also 43 * be used by others to implement module loading. 44 */ 45 public class IOModule : TypeModule 46 { 47 /** the main Gtk struct */ 48 protected GIOModule* gIOModule; 49 50 /** Get the main Gtk struct */ 51 public GIOModule* getIOModuleStruct(bool transferOwnership = false) 52 { 53 if (transferOwnership) 54 ownedRef = false; 55 return gIOModule; 56 } 57 58 /** the main Gtk struct as a void* */ 59 protected override void* getStruct() 60 { 61 return cast(void*)gIOModule; 62 } 63 64 /** 65 * Sets our main struct and passes it to the parent class. 66 */ 67 public this (GIOModule* gIOModule, bool ownedRef = false) 68 { 69 this.gIOModule = gIOModule; 70 super(cast(GTypeModule*)gIOModule, ownedRef); 71 } 72 73 74 /** */ 75 public static GType getType() 76 { 77 return g_io_module_get_type(); 78 } 79 80 /** 81 * Creates a new GIOModule that will load the specific 82 * shared library when in use. 83 * 84 * Params: 85 * filename = filename of the shared library module. 86 * 87 * Returns: a #GIOModule from given @filename, 88 * or %NULL on error. 89 * 90 * Throws: ConstructionException GTK+ fails to create the object. 91 */ 92 public this(string filename) 93 { 94 auto __p = g_io_module_new(Str.toStringz(filename)); 95 96 if(__p is null) 97 { 98 throw new ConstructionException("null returned by new"); 99 } 100 101 this(cast(GIOModule*) __p, true); 102 } 103 104 /** 105 * Loads all the modules in the specified directory. 106 * 107 * If don't require all modules to be initialized (and thus registering 108 * all gtypes) then you can use g_io_modules_scan_all_in_directory() 109 * which allows delayed/lazy loading of modules. 110 * 111 * Params: 112 * dirname = pathname for a directory containing modules 113 * to load. 114 * 115 * Returns: a list of #GIOModules loaded 116 * from the directory, 117 * All the modules are loaded into memory, if you want to 118 * unload them (enabling on-demand loading) you must call 119 * g_type_module_unuse() on all the modules. Free the list 120 * with g_list_free(). 121 */ 122 public static ListG loadAllInDirectory(string dirname) 123 { 124 auto __p = g_io_modules_load_all_in_directory(Str.toStringz(dirname)); 125 126 if(__p is null) 127 { 128 return null; 129 } 130 131 return new ListG(cast(GList*) __p, true); 132 } 133 134 /** 135 * Loads all the modules in the specified directory. 136 * 137 * If don't require all modules to be initialized (and thus registering 138 * all gtypes) then you can use g_io_modules_scan_all_in_directory() 139 * which allows delayed/lazy loading of modules. 140 * 141 * Params: 142 * dirname = pathname for a directory containing modules 143 * to load. 144 * scope_ = a scope to use when scanning the modules. 145 * 146 * Returns: a list of #GIOModules loaded 147 * from the directory, 148 * All the modules are loaded into memory, if you want to 149 * unload them (enabling on-demand loading) you must call 150 * g_type_module_unuse() on all the modules. Free the list 151 * with g_list_free(). 152 * 153 * Since: 2.30 154 */ 155 public static ListG loadAllInDirectoryWithScope(string dirname, IOModuleScope scope_) 156 { 157 auto __p = g_io_modules_load_all_in_directory_with_scope(Str.toStringz(dirname), (scope_ is null) ? null : scope_.getIOModuleScopeStruct()); 158 159 if(__p is null) 160 { 161 return null; 162 } 163 164 return new ListG(cast(GList*) __p, true); 165 } 166 167 /** 168 * Scans all the modules in the specified directory, ensuring that 169 * any extension point implemented by a module is registered. 170 * 171 * This may not actually load and initialize all the types in each 172 * module, some modules may be lazily loaded and initialized when 173 * an extension point it implementes is used with e.g. 174 * g_io_extension_point_get_extensions() or 175 * g_io_extension_point_get_extension_by_name(). 176 * 177 * If you need to guarantee that all types are loaded in all the modules, 178 * use g_io_modules_load_all_in_directory(). 179 * 180 * Params: 181 * dirname = pathname for a directory containing modules 182 * to scan. 183 * 184 * Since: 2.24 185 */ 186 public static void scanAllInDirectory(string dirname) 187 { 188 g_io_modules_scan_all_in_directory(Str.toStringz(dirname)); 189 } 190 191 /** 192 * Scans all the modules in the specified directory, ensuring that 193 * any extension point implemented by a module is registered. 194 * 195 * This may not actually load and initialize all the types in each 196 * module, some modules may be lazily loaded and initialized when 197 * an extension point it implementes is used with e.g. 198 * g_io_extension_point_get_extensions() or 199 * g_io_extension_point_get_extension_by_name(). 200 * 201 * If you need to guarantee that all types are loaded in all the modules, 202 * use g_io_modules_load_all_in_directory(). 203 * 204 * Params: 205 * dirname = pathname for a directory containing modules 206 * to scan. 207 * scope_ = a scope to use when scanning the modules 208 * 209 * Since: 2.30 210 */ 211 public static void scanAllInDirectoryWithScope(string dirname, IOModuleScope scope_) 212 { 213 g_io_modules_scan_all_in_directory_with_scope(Str.toStringz(dirname), (scope_ is null) ? null : scope_.getIOModuleScopeStruct()); 214 } 215 }