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.FileAttributeInfoList; 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 33 34 /** 35 * Acts as a lightweight registry for possible valid file attributes. 36 * The registry stores Key-Value pair formats as #GFileAttributeInfos. 37 */ 38 public class FileAttributeInfoList 39 { 40 /** the main Gtk struct */ 41 protected GFileAttributeInfoList* gFileAttributeInfoList; 42 43 /** Get the main Gtk struct */ 44 public GFileAttributeInfoList* getFileAttributeInfoListStruct() 45 { 46 return gFileAttributeInfoList; 47 } 48 49 /** the main Gtk struct as a void* */ 50 protected void* getStruct() 51 { 52 return cast(void*)gFileAttributeInfoList; 53 } 54 55 /** 56 * Sets our main struct and passes it to the parent class. 57 */ 58 public this (GFileAttributeInfoList* gFileAttributeInfoList) 59 { 60 this.gFileAttributeInfoList = gFileAttributeInfoList; 61 } 62 63 /** 64 */ 65 66 public static GType getType() 67 { 68 return g_file_attribute_info_list_get_type(); 69 } 70 71 /** 72 * Creates a new file attribute info list. 73 * 74 * Return: a #GFileAttributeInfoList. 75 * 76 * Throws: ConstructionException GTK+ fails to create the object. 77 */ 78 public this() 79 { 80 auto p = g_file_attribute_info_list_new(); 81 82 if(p is null) 83 { 84 throw new ConstructionException("null returned by new"); 85 } 86 87 this(cast(GFileAttributeInfoList*) p); 88 } 89 90 /** 91 * Adds a new attribute with @name to the @list, setting 92 * its @type and @flags. 93 * 94 * Params: 95 * name = the name of the attribute to add. 96 * type = the #GFileAttributeType for the attribute. 97 * flags = #GFileAttributeInfoFlags for the attribute. 98 */ 99 public void add(string name, GFileAttributeType type, GFileAttributeInfoFlags flags) 100 { 101 g_file_attribute_info_list_add(gFileAttributeInfoList, Str.toStringz(name), type, flags); 102 } 103 104 /** 105 * Makes a duplicate of a file attribute info list. 106 * 107 * Return: a copy of the given @list. 108 */ 109 public FileAttributeInfoList dup() 110 { 111 auto p = g_file_attribute_info_list_dup(gFileAttributeInfoList); 112 113 if(p is null) 114 { 115 return null; 116 } 117 118 return ObjectG.getDObject!(FileAttributeInfoList)(cast(GFileAttributeInfoList*) p); 119 } 120 121 /** 122 * Gets the file attribute with the name @name from @list. 123 * 124 * Params: 125 * name = the name of the attribute to lookup. 126 * 127 * Return: a #GFileAttributeInfo for the @name, or %NULL if an 128 * attribute isn't found. 129 */ 130 public GFileAttributeInfo* lookup(string name) 131 { 132 return g_file_attribute_info_list_lookup(gFileAttributeInfoList, Str.toStringz(name)); 133 } 134 135 /** 136 * References a file attribute info list. 137 * 138 * Return: #GFileAttributeInfoList or %NULL on error. 139 */ 140 public FileAttributeInfoList doref() 141 { 142 auto p = g_file_attribute_info_list_ref(gFileAttributeInfoList); 143 144 if(p is null) 145 { 146 return null; 147 } 148 149 return ObjectG.getDObject!(FileAttributeInfoList)(cast(GFileAttributeInfoList*) p); 150 } 151 152 /** 153 * Removes a reference from the given @list. If the reference count 154 * falls to zero, the @list is deleted. 155 */ 156 public void unref() 157 { 158 g_file_attribute_info_list_unref(gFileAttributeInfoList); 159 } 160 }