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 gio.c.functions; 28 public import gio.c.types; 29 private import glib.ConstructionException; 30 private import glib.Str; 31 private import gobject.ObjectG; 32 private import gtkd.Loader; 33 34 35 /** 36 * Represents a scope for loading IO modules. A scope can be used for blocking 37 * duplicate modules, or blocking a module you don't want to load. 38 * 39 * The scope can be used with g_io_modules_load_all_in_directory_with_scope() 40 * or g_io_modules_scan_all_in_directory_with_scope(). 41 * 42 * Since: 2.30 43 */ 44 public class IOModuleScope 45 { 46 /** the main Gtk struct */ 47 protected GIOModuleScope* gIOModuleScope; 48 protected bool ownedRef; 49 50 /** Get the main Gtk struct */ 51 public GIOModuleScope* getIOModuleScopeStruct(bool transferOwnership = false) 52 { 53 if (transferOwnership) 54 ownedRef = false; 55 return gIOModuleScope; 56 } 57 58 /** the main Gtk struct as a void* */ 59 protected void* getStruct() 60 { 61 return cast(void*)gIOModuleScope; 62 } 63 64 /** 65 * Sets our main struct and passes it to the parent class. 66 */ 67 public this (GIOModuleScope* gIOModuleScope, bool ownedRef = false) 68 { 69 this.gIOModuleScope = gIOModuleScope; 70 this.ownedRef = ownedRef; 71 } 72 73 ~this () 74 { 75 if ( Linker.isLoaded(LIBRARY_GIO) && ownedRef ) 76 g_io_module_scope_free(gIOModuleScope); 77 } 78 79 80 /** 81 * Block modules with the given @basename from being loaded when 82 * this scope is used with g_io_modules_scan_all_in_directory_with_scope() 83 * or g_io_modules_load_all_in_directory_with_scope(). 84 * 85 * Params: 86 * basename = the basename to block 87 * 88 * Since: 2.30 89 */ 90 public void block(string basename) 91 { 92 g_io_module_scope_block(gIOModuleScope, Str.toStringz(basename)); 93 } 94 95 /** 96 * Free a module scope. 97 * 98 * Since: 2.30 99 */ 100 public void free() 101 { 102 g_io_module_scope_free(gIOModuleScope); 103 ownedRef = false; 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 * Returns: 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 }