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