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.IOModuleScope;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gtkc.gio;
31 public  import gtkc.giotypes;
32 private import gtkd.Loader;
33 private import gtkd.paths;
34 
35 
36 /**
37  * Represents a scope for loading IO modules. A scope can be used for blocking
38  * duplicate modules, or blocking a module you don't want to load.
39  * 
40  * The scope can be used with g_io_modules_load_all_in_directory_with_scope()
41  * or g_io_modules_scan_all_in_directory_with_scope().
42  *
43  * Since: 2.30
44  */
45 public class IOModuleScope
46 {
47 	/** the main Gtk struct */
48 	protected GIOModuleScope* gIOModuleScope;
49 	protected bool ownedRef;
50 
51 	/** Get the main Gtk struct */
52 	public GIOModuleScope* getIOModuleScopeStruct()
53 	{
54 		return gIOModuleScope;
55 	}
56 
57 	/** the main Gtk struct as a void* */
58 	protected void* getStruct()
59 	{
60 		return cast(void*)gIOModuleScope;
61 	}
62 
63 	/**
64 	 * Sets our main struct and passes it to the parent class.
65 	 */
66 	public this (GIOModuleScope* gIOModuleScope, bool ownedRef = false)
67 	{
68 		this.gIOModuleScope = gIOModuleScope;
69 		this.ownedRef = ownedRef;
70 	}
71 
72 	~this()
73 	{
74 		if ( Linker.isLoaded(LIBRARY.GIO) && ownedRef )
75 		{
76 			g_io_module_scope_free(gIOModuleScope);
77 		}
78 	}
79 
80 	/**
81 	 */
82 
83 	/**
84 	 * Block modules with the given @basename from being loaded when
85 	 * this scope is used with g_io_modules_scan_all_in_directory_with_scope()
86 	 * or g_io_modules_load_all_in_directory_with_scope().
87 	 *
88 	 * Params:
89 	 *     basename = the basename to block
90 	 *
91 	 * Since: 2.30
92 	 */
93 	public void block(string basename)
94 	{
95 		g_io_module_scope_block(gIOModuleScope, Str.toStringz(basename));
96 	}
97 
98 	/**
99 	 * Free a module scope.
100 	 *
101 	 * Since: 2.30
102 	 */
103 	public void free()
104 	{
105 		g_io_module_scope_free(gIOModuleScope);
106 	}
107 
108 	/**
109 	 * Create a new scope for loading of IO modules. A scope can be used for
110 	 * blocking duplicate modules, or blocking a module you don't want to load.
111 	 *
112 	 * Specify the %G_IO_MODULE_SCOPE_BLOCK_DUPLICATES flag to block modules
113 	 * which have the same base name as a module that has already been seen
114 	 * in this scope.
115 	 *
116 	 * Params:
117 	 *     flags = flags for the new scope
118 	 *
119 	 * Returns: the new module scope
120 	 *
121 	 * Since: 2.30
122 	 *
123 	 * Throws: ConstructionException GTK+ fails to create the object.
124 	 */
125 	public this(GIOModuleScopeFlags flags)
126 	{
127 		auto p = g_io_module_scope_new(flags);
128 		
129 		if(p is null)
130 		{
131 			throw new ConstructionException("null returned by new");
132 		}
133 		
134 		this(cast(GIOModuleScope*) p);
135 	}
136 }