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 gsv.SourceFile; 26 27 private import gio.File; 28 private import gio.FileIF; 29 private import glib.ConstructionException; 30 private import gobject.ObjectG; 31 private import gsv.SourceEncoding; 32 private import gsvc.gsv; 33 public import gsvc.gsvtypes; 34 35 36 public class SourceFile : ObjectG 37 { 38 /** the main Gtk struct */ 39 protected GtkSourceFile* gtkSourceFile; 40 41 /** Get the main Gtk struct */ 42 public GtkSourceFile* getSourceFileStruct() 43 { 44 return gtkSourceFile; 45 } 46 47 /** the main Gtk struct as a void* */ 48 protected override void* getStruct() 49 { 50 return cast(void*)gtkSourceFile; 51 } 52 53 protected override void setStruct(GObject* obj) 54 { 55 gtkSourceFile = cast(GtkSourceFile*)obj; 56 super.setStruct(obj); 57 } 58 59 /** 60 * Sets our main struct and passes it to the parent class. 61 */ 62 public this (GtkSourceFile* gtkSourceFile, bool ownedRef = false) 63 { 64 this.gtkSourceFile = gtkSourceFile; 65 super(cast(GObject*)gtkSourceFile, ownedRef); 66 } 67 68 /** 69 */ 70 71 public static GType getType() 72 { 73 return gtk_source_file_get_type(); 74 } 75 76 /** 77 * Return: a new #GtkSourceFile object. 78 * 79 * Since: 3.14 80 * 81 * Throws: ConstructionException GTK+ fails to create the object. 82 */ 83 public this() 84 { 85 auto p = gtk_source_file_new(); 86 87 if(p is null) 88 { 89 throw new ConstructionException("null returned by new"); 90 } 91 92 this(cast(GtkSourceFile*) p, true); 93 } 94 95 /** 96 * Return: the compression type. 97 * 98 * Since: 3.14 99 */ 100 public GtkSourceCompressionType getCompressionType() 101 { 102 return gtk_source_file_get_compression_type(gtkSourceFile); 103 } 104 105 /** 106 * The encoding is initially %NULL. After a successful file loading or saving 107 * operation, the encoding is non-%NULL. 108 * 109 * Return: the character encoding. 110 * 111 * Since: 3.14 112 */ 113 public SourceEncoding getEncoding() 114 { 115 auto p = gtk_source_file_get_encoding(gtkSourceFile); 116 117 if(p is null) 118 { 119 return null; 120 } 121 122 return ObjectG.getDObject!(SourceEncoding)(cast(GtkSourceEncoding*) p); 123 } 124 125 /** 126 * Return: the #GFile. 127 * 128 * Since: 3.14 129 */ 130 public FileIF getLocation() 131 { 132 auto p = gtk_source_file_get_location(gtkSourceFile); 133 134 if(p is null) 135 { 136 return null; 137 } 138 139 return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p); 140 } 141 142 /** 143 * Return: the newline type. 144 * 145 * Since: 3.14 146 */ 147 public GtkSourceNewlineType getNewlineType() 148 { 149 return gtk_source_file_get_newline_type(gtkSourceFile); 150 } 151 152 /** 153 * Sets the location. 154 * 155 * Params: 156 * location = the new #GFile, or %NULL. 157 * 158 * Since: 3.14 159 */ 160 public void setLocation(FileIF location) 161 { 162 gtk_source_file_set_location(gtkSourceFile, (location is null) ? null : location.getFileStruct()); 163 } 164 165 /** 166 * Sets a #GtkSourceMountOperationFactory function that will be called when a 167 * #GMountOperation must be created. This is useful for creating a 168 * #GtkMountOperation with the parent #GtkWindow. 169 * 170 * If a mount operation factory isn't set, g_mount_operation_new() will be 171 * called. 172 * 173 * Params: 174 * callback = a #GtkSourceMountOperationFactory to call when a 175 * #GMountOperation is needed. 176 * userData = the data to pass to the @callback function. 177 * notify = function to call on @user_data when the @callback is no 178 * longer needed, or %NULL. 179 * 180 * Since: 3.14 181 */ 182 public void setMountOperationFactory(GtkSourceMountOperationFactory callback, void* userData, GDestroyNotify notify) 183 { 184 gtk_source_file_set_mount_operation_factory(gtkSourceFile, callback, userData, notify); 185 } 186 }