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 = GInitable.html 27 * outPack = gio 28 * outFile = InitableIF 29 * strct = GInitable 30 * realStrct= 31 * ctorStrct= 32 * clss = InitableT 33 * interf = InitableIF 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - g_initable_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * - glib.ErrorG 48 * - glib.GException 49 * - gobject.ObjectG 50 * - gio.Cancellable 51 * structWrap: 52 * - GCancellable* -> Cancellable 53 * - GObject* -> ObjectG 54 * module aliases: 55 * local aliases: 56 * overrides: 57 */ 58 59 module gio.InitableIF; 60 61 public import gtkc.giotypes; 62 63 private import gtkc.gio; 64 private import glib.ConstructionException; 65 private import gobject.ObjectG; 66 67 68 private import glib.Str; 69 private import glib.ErrorG; 70 private import glib.GException; 71 private import gobject.ObjectG; 72 private import gio.Cancellable; 73 74 75 76 77 /** 78 * GInitable is implemented by objects that can fail during 79 * initialization. If an object implements this interface then 80 * it must be initialized as the first thing after construction, 81 * either via g_initable_init() or g_async_initable_init_async() 82 * (the latter is only available if it also implements GAsyncInitable). 83 * 84 * If the object is not initialized, or initialization returns with an 85 * error, then all operations on the object except g_object_ref() and 86 * g_object_unref() are considered to be invalid, and have undefined 87 * behaviour. They will often fail with g_critical() or g_warning(), but 88 * this must not be relied on. 89 * 90 * Users of objects implementing this are not intended to use 91 * the interface method directly, instead it will be used automatically 92 * in various ways. For C applications you generally just call 93 * g_initable_new() directly, or indirectly via a foo_thing_new() wrapper. 94 * This will call g_initable_init() under the cover, returning NULL and 95 * setting a GError on failure (at which point the instance is 96 * unreferenced). 97 * 98 * For bindings in languages where the native constructor supports 99 * exceptions the binding could check for objects implemention GInitable 100 * during normal construction and automatically initialize them, throwing 101 * an exception on failure. 102 */ 103 public interface InitableIF 104 { 105 106 107 public GInitable* getInitableTStruct(); 108 109 /** the main Gtk struct as a void* */ 110 protected void* getStruct(); 111 112 113 /** 114 */ 115 116 /** 117 * Initializes the object implementing the interface. 118 * The object must be initialized before any real use after initial 119 * construction, either with this function or g_async_initable_init_async(). 120 * Implementations may also support cancellation. If cancellable is not NULL, 121 * then initialization can be cancelled by triggering the cancellable object 122 * from another thread. If the operation was cancelled, the error 123 * G_IO_ERROR_CANCELLED will be returned. If cancellable is not NULL and 124 * the object doesn't support cancellable initialization the error 125 * G_IO_ERROR_NOT_SUPPORTED will be returned. 126 * If the object is not initialized, or initialization returns with an 127 * error, then all operations on the object except g_object_ref() and 128 * g_object_unref() are considered to be invalid, and have undefined 129 * behaviour. See the ??? section introduction 130 * for more details. 131 * Implementations of this method must be idempotent, i.e. multiple calls 132 * to this function with the same argument should return the same results. 133 * Only the first call initializes the object, further calls return the result 134 * of the first call. This is so that it's safe to implement the singleton 135 * pattern in the GObject constructor function. 136 * Since 2.22 137 * Params: 138 * cancellable = optional GCancellable object, NULL to ignore. 139 * Returns: TRUE if successful. If an error has occurred, this function will return FALSE and set error appropriately if present. 140 * Throws: GException on failure. 141 */ 142 public int init(Cancellable cancellable); 143 144 /** 145 * Helper function for constructing GInitable object. This is 146 * similar to g_object_new_valist() but also initializes the object 147 * and returns NULL, setting an error on failure. 148 * Since 2.22 149 * Params: 150 * objectType = a GType supporting GInitable. 151 * firstPropertyName = the name of the first property, followed by 152 * the value, and other property value pairs, and ended by NULL. 153 * varArgs = The var args list generated from first_property_name. 154 * cancellable = optional GCancellable object, NULL to ignore. 155 * Returns: a newly allocated GObject, or NULL on error. [type GObject.Object][transfer full] 156 * Throws: GException on failure. 157 */ 158 public static ObjectG newValist(GType objectType, string firstPropertyName, void* varArgs, Cancellable cancellable); 159 160 /** 161 * Helper function for constructing GInitable object. This is 162 * similar to g_object_newv() but also initializes the object 163 * and returns NULL, setting an error on failure. 164 * Since 2.22 165 * Params: 166 * objectType = a GType supporting GInitable. 167 * parameters = the parameters to use to construct the object. [array length=n_parameters] 168 * cancellable = optional GCancellable object, NULL to ignore. 169 * Returns: a newly allocated GObject, or NULL on error. [type GObject.Object][transfer full] 170 * Throws: GException on failure. 171 */ 172 public static void* newv(GType objectType, GParameter[] parameters, Cancellable cancellable); 173 }