| 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 |
* Conversion parameters: |
|---|
| 26 |
* inFile = GIOModule.html |
|---|
| 27 |
* outPack = gio |
|---|
| 28 |
* outFile = IOModule |
|---|
| 29 |
* strct = GIOModule |
|---|
| 30 |
* realStrct= |
|---|
| 31 |
* ctorStrct= |
|---|
| 32 |
* clss = IOModule |
|---|
| 33 |
* interf = |
|---|
| 34 |
* class Code: No |
|---|
| 35 |
* interface Code: No |
|---|
| 36 |
* template for: |
|---|
| 37 |
* extend = |
|---|
| 38 |
* implements: |
|---|
| 39 |
* prefixes: |
|---|
| 40 |
* - g_io_module_ |
|---|
| 41 |
* - g_io_ |
|---|
| 42 |
* omit structs: |
|---|
| 43 |
* omit prefixes: |
|---|
| 44 |
* omit code: |
|---|
| 45 |
* omit signals: |
|---|
| 46 |
* imports: |
|---|
| 47 |
* - glib.Str |
|---|
| 48 |
* - glib.ListG |
|---|
| 49 |
* structWrap: |
|---|
| 50 |
* - GList* -> ListG |
|---|
| 51 |
* module aliases: |
|---|
| 52 |
* local aliases: |
|---|
| 53 |
* overrides: |
|---|
| 54 |
*/ |
|---|
| 55 |
|
|---|
| 56 |
module gio.IOModule; |
|---|
| 57 |
|
|---|
| 58 |
public import gtkc.giotypes; |
|---|
| 59 |
|
|---|
| 60 |
private import gtkc.gio; |
|---|
| 61 |
private import glib.ConstructionException; |
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
private import glib.Str; |
|---|
| 65 |
private import glib.ListG; |
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
private import gobject.TypeModule; |
|---|
| 70 |
|
|---|
| 71 |
/** |
|---|
| 72 |
* Description |
|---|
| 73 |
* Provides an interface and default functions for loading and unloading |
|---|
| 74 |
* modules. This is used internally to make GIO extensible, but can also |
|---|
| 75 |
* be used by others to implement module loading. |
|---|
| 76 |
*/ |
|---|
| 77 |
public class IOModule : TypeModule |
|---|
| 78 |
{ |
|---|
| 79 |
|
|---|
| 80 |
/** the main Gtk struct */ |
|---|
| 81 |
protected GIOModule* gIOModule; |
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
public GIOModule* getIOModuleStruct() |
|---|
| 85 |
{ |
|---|
| 86 |
return gIOModule; |
|---|
| 87 |
} |
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
/** the main Gtk struct as a void* */ |
|---|
| 91 |
protected override void* getStruct() |
|---|
| 92 |
{ |
|---|
| 93 |
return cast(void*)gIOModule; |
|---|
| 94 |
} |
|---|
| 95 |
|
|---|
| 96 |
/** |
|---|
| 97 |
* Sets our main struct and passes it to the parent class |
|---|
| 98 |
*/ |
|---|
| 99 |
public this (GIOModule* gIOModule) |
|---|
| 100 |
{ |
|---|
| 101 |
if(gIOModule is null) |
|---|
| 102 |
{ |
|---|
| 103 |
this = null; |
|---|
| 104 |
return; |
|---|
| 105 |
} |
|---|
| 106 |
//Check if there already is a D object for this gtk struct |
|---|
| 107 |
void* ptr = getDObject(cast(GObject*)gIOModule); |
|---|
| 108 |
if( ptr !is null ) |
|---|
| 109 |
{ |
|---|
| 110 |
this = cast(IOModule)ptr; |
|---|
| 111 |
return; |
|---|
| 112 |
} |
|---|
| 113 |
super(cast(GTypeModule*)gIOModule); |
|---|
| 114 |
this.gIOModule = gIOModule; |
|---|
| 115 |
} |
|---|
| 116 |
|
|---|
| 117 |
protected override void setStruct(GObject* obj) |
|---|
| 118 |
{ |
|---|
| 119 |
super.setStruct(obj); |
|---|
| 120 |
gIOModule = cast(GIOModule*)obj; |
|---|
| 121 |
} |
|---|
| 122 |
|
|---|
| 123 |
/** |
|---|
| 124 |
*/ |
|---|
| 125 |
|
|---|
| 126 |
/** |
|---|
| 127 |
* Creates a new GIOModule that will load the specific |
|---|
| 128 |
* shared library when in use. |
|---|
| 129 |
* Params: |
|---|
| 130 |
* filename = filename of the shared library module. |
|---|
| 131 |
* Throws: ConstructionException GTK+ fails to create the object. |
|---|
| 132 |
*/ |
|---|
| 133 |
public this (string filename) |
|---|
| 134 |
{ |
|---|
| 135 |
// GIOModule * g_io_module_new (const gchar *filename); |
|---|
| 136 |
auto p = g_io_module_new(Str.toStringz(filename)); |
|---|
| 137 |
if(p is null) |
|---|
| 138 |
{ |
|---|
| 139 |
throw new ConstructionException("null returned by g_io_module_new(Str.toStringz(filename))"); |
|---|
| 140 |
} |
|---|
| 141 |
this(cast(GIOModule*) p); |
|---|
| 142 |
} |
|---|
| 143 |
|
|---|
| 144 |
/** |
|---|
| 145 |
* Loads all the modules in the specified directory. |
|---|
| 146 |
* If don't require all modules to be initialized (and thus registering |
|---|
| 147 |
* all gtypes) then you can use g_io_modules_scan_all_in_directory() |
|---|
| 148 |
* which allows delayed/lazy loading of modules. |
|---|
| 149 |
* Params: |
|---|
| 150 |
* dirname = pathname for a directory containing modules to load. |
|---|
| 151 |
* Returns: a list of GIOModules loaded from the directory, All the modules are loaded into memory, if you want to unload them (enabling on-demand loading) you must call g_type_module_unuse() on all the modules. Free the list with g_list_free(). [element-type GIOModule][transfer full] |
|---|
| 152 |
*/ |
|---|
| 153 |
public static ListG modulesLoadAllInDirectory(string dirname) |
|---|
| 154 |
{ |
|---|
| 155 |
// GList * g_io_modules_load_all_in_directory (const gchar *dirname); |
|---|
| 156 |
auto p = g_io_modules_load_all_in_directory(Str.toStringz(dirname)); |
|---|
| 157 |
if(p is null) |
|---|
| 158 |
{ |
|---|
| 159 |
return null; |
|---|
| 160 |
} |
|---|
| 161 |
return new ListG(cast(GList*) p); |
|---|
| 162 |
} |
|---|
| 163 |
|
|---|
| 164 |
/** |
|---|
| 165 |
* Scans all the modules in the specified directory, ensuring that |
|---|
| 166 |
* any extension point implemented by a module is registered. |
|---|
| 167 |
* This may not actually load and initialize all the types in each |
|---|
| 168 |
* module, some modules may be lazily loaded and initialized when |
|---|
| 169 |
* an extension point it implementes is used with e.g. |
|---|
| 170 |
* g_io_extension_point_get_extensions() or |
|---|
| 171 |
* g_io_extension_point_get_extension_by_name(). |
|---|
| 172 |
* If you need to guarantee that all types are loaded in all the modules, |
|---|
| 173 |
* use g_io_modules_load_all_in_directory(). |
|---|
| 174 |
* Since 2.24 |
|---|
| 175 |
* Params: |
|---|
| 176 |
* dirname = pathname for a directory containing modules to scan. |
|---|
| 177 |
*/ |
|---|
| 178 |
public static void modulesScanAllInDirectory(string dirname) |
|---|
| 179 |
{ |
|---|
| 180 |
// void g_io_modules_scan_all_in_directory (const char *dirname); |
|---|
| 181 |
g_io_modules_scan_all_in_directory(Str.toStringz(dirname)); |
|---|
| 182 |
} |
|---|
| 183 |
|
|---|
| 184 |
/** |
|---|
| 185 |
* Required API for GIO modules to implement. |
|---|
| 186 |
* This function is ran after the module has been loaded into GIO, |
|---|
| 187 |
* to initialize the module. |
|---|
| 188 |
*/ |
|---|
| 189 |
public void load() |
|---|
| 190 |
{ |
|---|
| 191 |
// void g_io_module_load (GIOModule *module); |
|---|
| 192 |
g_io_module_load(gIOModule); |
|---|
| 193 |
} |
|---|
| 194 |
|
|---|
| 195 |
/** |
|---|
| 196 |
* Required API for GIO modules to implement. |
|---|
| 197 |
* This function is ran when the module is being unloaded from GIO, |
|---|
| 198 |
* to finalize the module. |
|---|
| 199 |
*/ |
|---|
| 200 |
public void unload() |
|---|
| 201 |
{ |
|---|
| 202 |
// void g_io_module_unload (GIOModule *module); |
|---|
| 203 |
g_io_module_unload(gIOModule); |
|---|
| 204 |
} |
|---|
| 205 |
|
|---|
| 206 |
/** |
|---|
| 207 |
* Optional API for GIO modules to implement. |
|---|
| 208 |
* Should return a list of all the extension points that may be |
|---|
| 209 |
* implemented in this module. |
|---|
| 210 |
* This method will not be called in normal use, however it may be |
|---|
| 211 |
* called when probing existing modules and recording which extension |
|---|
| 212 |
* points that this modle is used for. This means we won't have to |
|---|
| 213 |
* load and initialze this module unless its needed. |
|---|
| 214 |
* If this function is not implemented by the module the module will |
|---|
| 215 |
* always be loaded, initialized and then unloaded on application startup |
|---|
| 216 |
* so that it can register its extension points during init. |
|---|
| 217 |
* Note that a module need not actually implement all the extension points |
|---|
| 218 |
* that g_io_module_query returns, since the exact list of extension may |
|---|
| 219 |
* depend on runtime issues. However all extension points actually implemented |
|---|
| 220 |
* must be returned by g_io_module_query() (if defined). |
|---|
| 221 |
* When installing a module that implements g_io_module_query you must |
|---|
| 222 |
* run gio-querymodules in order to build the cache files required for |
|---|
| 223 |
* lazy loading. |
|---|
| 224 |
* Since 2.24 |
|---|
| 225 |
* Returns: A NULL-terminated array of strings, listing the supported extension points of the module. The array must be suitable for freeing with g_strfreev(). [transfer full] |
|---|
| 226 |
*/ |
|---|
| 227 |
public static string[] query() |
|---|
| 228 |
{ |
|---|
| 229 |
// char ** g_io_module_query (void); |
|---|
| 230 |
return Str.toStringArray(g_io_module_query()); |
|---|
| 231 |
} |
|---|
| 232 |
} |
|---|