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 public static GType getType() 66 { 67 return g_file_attribute_info_list_get_type(); 68 } 69 70 /** 71 * Creates a new file attribute info list. 72 * 73 * Return: a #GFileAttributeInfoList. 74 * 75 * Throws: ConstructionException GTK+ fails to create the object. 76 */ 77 public this() 78 { 79 auto p = g_file_attribute_info_list_new(); 80 81 if(p is null) 82 { 83 throw new ConstructionException("null returned by new"); 84 } 85 86 this(cast(GFileAttributeInfoList*) p); 87 } 88 89 /** 90 * Adds a new attribute with @name to the @list, setting 91 * its @type and @flags. 92 * 93 * Params: 94 * name = the name of the attribute to add. 95 * type = the #GFileAttributeType for the attribute. 96 * flags = #GFileAttributeInfoFlags for the attribute. 97 */ 98 public void add(string name, GFileAttributeType type, GFileAttributeInfoFlags flags) 99 { 100 g_file_attribute_info_list_add(gFileAttributeInfoList, Str.toStringz(name), type, flags); 101 } 102 103 /** 104 * Makes a duplicate of a file attribute info list. 105 * 106 * Return: a copy of the given @list. 107 */ 108 public FileAttributeInfoList dup() 109 { 110 auto p = g_file_attribute_info_list_dup(gFileAttributeInfoList); 111 112 if(p is null) 113 { 114 return null; 115 } 116 117 return ObjectG.getDObject!(FileAttributeInfoList)(cast(GFileAttributeInfoList*) p); 118 } 119 120 /** 121 * Gets the file attribute with the name @name from @list. 122 * 123 * Params: 124 * name = the name of the attribute to lookup. 125 * 126 * Return: a #GFileAttributeInfo for the @name, or %NULL if an 127 * attribute isn't found. 128 */ 129 public GFileAttributeInfo* lookup(string name) 130 { 131 return g_file_attribute_info_list_lookup(gFileAttributeInfoList, Str.toStringz(name)); 132 } 133 134 /** 135 * References a file attribute info list. 136 * 137 * Return: #GFileAttributeInfoList or %NULL on error. 138 */ 139 public FileAttributeInfoList doref() 140 { 141 auto p = g_file_attribute_info_list_ref(gFileAttributeInfoList); 142 143 if(p is null) 144 { 145 return null; 146 } 147 148 return ObjectG.getDObject!(FileAttributeInfoList)(cast(GFileAttributeInfoList*) p); 149 } 150 151 /** 152 * Removes a reference from the given @list. If the reference count 153 * falls to zero, the @list is deleted. 154 */ 155 public void unref() 156 { 157 g_file_attribute_info_list_unref(gFileAttributeInfoList); 158 } 159 }