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  = 
27  * outPack = gio
28  * outFile = IOModuleScope
29  * strct   = GIOModuleScope
30  * realStrct=
31  * ctorStrct=
32  * clss    = IOModuleScope
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_io_module_scope_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- gtkc.Loader
48  * 	- gtkc.paths
49  * structWrap:
50  * 	- GIOModuleScope* -> IOModuleScope
51  * module aliases:
52  * local aliases:
53  * overrides:
54  */
55 
56 module gio.IOModuleScope;
57 
58 public  import gtkc.giotypes;
59 
60 private import gtkc.gio;
61 private import glib.ConstructionException;
62 private import gobject.ObjectG;
63 
64 private import glib.Str;
65 private import gtkc.Loader;
66 private import gtkc.paths;
67 
68 
69 
70 /**
71  * Provides an interface and default functions for loading and unloading
72  * modules. This is used internally to make GIO extensible, but can also
73  * be used by others to implement module loading.
74  */
75 public class IOModuleScope
76 {
77 	
78 	/** the main Gtk struct */
79 	protected GIOModuleScope* gIOModuleScope;
80 	
81 	
82 	/** Get the main Gtk struct */
83 	public GIOModuleScope* getIOModuleScopeStruct()
84 	{
85 		return gIOModuleScope;
86 	}
87 	
88 	
89 	/** the main Gtk struct as a void* */
90 	protected void* getStruct()
91 	{
92 		return cast(void*)gIOModuleScope;
93 	}
94 	
95 	/**
96 	 * Sets our main struct and passes it to the parent class
97 	 */
98 	public this (GIOModuleScope* gIOModuleScope)
99 	{
100 		this.gIOModuleScope = gIOModuleScope;
101 	}
102 	
103 	~this()
104 	{
105 		if ( Linker.isLoaded(LIBRARY.GIO) && gIOModuleScope != null)
106 		{
107 			g_io_module_scope_free(gIOModuleScope);
108 		}
109 	}
110 	
111 	/**
112 	 */
113 	
114 	/**
115 	 * Block modules with the given basename from being loaded when
116 	 * this scope is used with g_io_modules_scan_all_in_directory_with_scope()
117 	 * or g_io_modules_load_all_in_directory_with_scope().
118 	 * Since 2.30
119 	 * Params:
120 	 * basename = the basename to block
121 	 */
122 	public void block(string basename)
123 	{
124 		// void g_io_module_scope_block (GIOModuleScope *scope,  const gchar *basename);
125 		g_io_module_scope_block(gIOModuleScope, Str.toStringz(basename));
126 	}
127 	
128 	/**
129 	 * Free a module scope.
130 	 * Since 2.30
131 	 */
132 	public void free()
133 	{
134 		// void g_io_module_scope_free (GIOModuleScope *scope);
135 		g_io_module_scope_free(gIOModuleScope);
136 	}
137 	
138 	/**
139 	 * Create a new scope for loading of IO modules. A scope can be used for
140 	 * blocking duplicate modules, or blocking a module you don't want to load.
141 	 * Specify the G_IO_MODULE_SCOPE_BLOCK_DUPLICATES flag to block modules
142 	 * which have the same base name as a module that has already been seen
143 	 * in this scope.
144 	 * Since 2.30
145 	 * Params:
146 	 * flags = flags for the new scope
147 	 * Throws: ConstructionException GTK+ fails to create the object.
148 	 */
149 	public this (GIOModuleScopeFlags flags)
150 	{
151 		// GIOModuleScope * g_io_module_scope_new (GIOModuleScopeFlags flags);
152 		auto p = g_io_module_scope_new(flags);
153 		if(p is null)
154 		{
155 			throw new ConstructionException("null returned by g_io_module_scope_new(flags)");
156 		}
157 		this(cast(GIOModuleScope*) p);
158 	}
159 }