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 
65 private import glib.Str;
66 private import gtkc.Loader;
67 private import gtkc.paths;
68 
69 
70 
71 
72 /**
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 IOModuleScope
78 {
79 	
80 	/** the main Gtk struct */
81 	protected GIOModuleScope* gIOModuleScope;
82 	
83 	
84 	public GIOModuleScope* getIOModuleScopeStruct()
85 	{
86 		return gIOModuleScope;
87 	}
88 	
89 	
90 	/** the main Gtk struct as a void* */
91 	protected void* getStruct()
92 	{
93 		return cast(void*)gIOModuleScope;
94 	}
95 	
96 	/**
97 	 * Sets our main struct and passes it to the parent class
98 	 */
99 	public this (GIOModuleScope* gIOModuleScope)
100 	{
101 		this.gIOModuleScope = gIOModuleScope;
102 	}
103 	
104 	~this()
105 	{
106 		if ( Linker.isLoaded(LIBRARY.GIO) && gIOModuleScope != null)
107 		{
108 			g_io_module_scope_free(gIOModuleScope);
109 		}
110 	}
111 	
112 	/**
113 	 */
114 	
115 	/**
116 	 * Block modules with the given basename from being loaded when
117 	 * this scope is used with g_io_modules_scan_all_in_directory_with_scope()
118 	 * or g_io_modules_load_all_in_directory_with_scope().
119 	 * Since 2.30
120 	 * Params:
121 	 * basename = the basename to block
122 	 */
123 	public void block(string basename)
124 	{
125 		// void g_io_module_scope_block (GIOModuleScope *scope,  const gchar *basename);
126 		g_io_module_scope_block(gIOModuleScope, Str.toStringz(basename));
127 	}
128 	
129 	/**
130 	 * Free a module scope.
131 	 * Since 2.30
132 	 */
133 	public void free()
134 	{
135 		// void g_io_module_scope_free (GIOModuleScope *scope);
136 		g_io_module_scope_free(gIOModuleScope);
137 	}
138 	
139 	/**
140 	 * Create a new scope for loading of IO modules. A scope can be used for
141 	 * blocking duplicate modules, or blocking a module you don't want to load.
142 	 * Specify the G_IO_MODULE_SCOPE_BLOCK_DUPLICATES flag to block modules
143 	 * which have the same base name as a module that has already been seen
144 	 * in this scope.
145 	 * Since 2.30
146 	 * Params:
147 	 * flags = flags for the new scope
148 	 * Throws: ConstructionException GTK+ fails to create the object.
149 	 */
150 	public this (GIOModuleScopeFlags flags)
151 	{
152 		// GIOModuleScope * g_io_module_scope_new (GIOModuleScopeFlags flags);
153 		auto p = g_io_module_scope_new(flags);
154 		if(p is null)
155 		{
156 			throw new ConstructionException("null returned by g_io_module_scope_new(flags)");
157 		}
158 		this(cast(GIOModuleScope*) p);
159 	}
160 }