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.UnixMountPoint; 26 27 private import gio.Icon; 28 private import gio.IconIF; 29 private import glib.Str; 30 private import gobject.ObjectG; 31 private import gtkc.gio; 32 public import gtkc.giotypes; 33 private import gtkd.Loader; 34 35 36 /** 37 * Defines a Unix mount point (e.g. <filename>/dev</filename>). 38 * This corresponds roughly to a fstab entry. 39 */ 40 public class UnixMountPoint 41 { 42 /** the main Gtk struct */ 43 protected GUnixMountPoint* gUnixMountPoint; 44 protected bool ownedRef; 45 46 /** Get the main Gtk struct */ 47 public GUnixMountPoint* getUnixMountPointStruct(bool transferOwnership = false) 48 { 49 if (transferOwnership) 50 ownedRef = false; 51 return gUnixMountPoint; 52 } 53 54 /** the main Gtk struct as a void* */ 55 protected void* getStruct() 56 { 57 return cast(void*)gUnixMountPoint; 58 } 59 60 /** 61 * Sets our main struct and passes it to the parent class. 62 */ 63 public this (GUnixMountPoint* gUnixMountPoint, bool ownedRef = false) 64 { 65 this.gUnixMountPoint = gUnixMountPoint; 66 this.ownedRef = ownedRef; 67 } 68 69 ~this () 70 { 71 if ( Linker.isLoaded(LIBRARY_GIO) && ownedRef ) 72 g_unix_mount_point_free(gUnixMountPoint); 73 } 74 75 76 /** 77 * Compares two unix mount points. 78 * 79 * Params: 80 * mount2 = a #GUnixMount. 81 * 82 * Returns: 1, 0 or -1 if @mount1 is greater than, equal to, 83 * or less than @mount2, respectively. 84 */ 85 public int compare(UnixMountPoint mount2) 86 { 87 return g_unix_mount_point_compare(gUnixMountPoint, (mount2 is null) ? null : mount2.getUnixMountPointStruct()); 88 } 89 90 /** 91 * Frees a unix mount point. 92 */ 93 public void free() 94 { 95 g_unix_mount_point_free(gUnixMountPoint); 96 ownedRef = false; 97 } 98 99 /** 100 * Gets the device path for a unix mount point. 101 * 102 * Returns: a string containing the device path. 103 */ 104 public string getDevicePath() 105 { 106 return Str.toString(g_unix_mount_point_get_device_path(gUnixMountPoint)); 107 } 108 109 /** 110 * Gets the file system type for the mount point. 111 * 112 * Returns: a string containing the file system type. 113 */ 114 public string getFsType() 115 { 116 return Str.toString(g_unix_mount_point_get_fs_type(gUnixMountPoint)); 117 } 118 119 /** 120 * Gets the mount path for a unix mount point. 121 * 122 * Returns: a string containing the mount path. 123 */ 124 public string getMountPath() 125 { 126 return Str.toString(g_unix_mount_point_get_mount_path(gUnixMountPoint)); 127 } 128 129 /** 130 * Gets the options for the mount point. 131 * 132 * Returns: a string containing the options. 133 * 134 * Since: 2.32 135 */ 136 public string getOptions() 137 { 138 return Str.toString(g_unix_mount_point_get_options(gUnixMountPoint)); 139 } 140 141 /** 142 * Guesses whether a Unix mount point can be ejected. 143 * 144 * Returns: %TRUE if @mount_point is deemed to be ejectable. 145 */ 146 public bool guessCanEject() 147 { 148 return g_unix_mount_point_guess_can_eject(gUnixMountPoint) != 0; 149 } 150 151 /** 152 * Guesses the icon of a Unix mount point. 153 * 154 * Returns: a #GIcon 155 */ 156 public IconIF guessIcon() 157 { 158 auto p = g_unix_mount_point_guess_icon(gUnixMountPoint); 159 160 if(p is null) 161 { 162 return null; 163 } 164 165 return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p, true); 166 } 167 168 /** 169 * Guesses the name of a Unix mount point. 170 * The result is a translated string. 171 * 172 * Returns: A newly allocated string that must 173 * be freed with g_free() 174 */ 175 public string guessName() 176 { 177 auto retStr = g_unix_mount_point_guess_name(gUnixMountPoint); 178 179 scope(exit) Str.freeString(retStr); 180 return Str.toString(retStr); 181 } 182 183 /** 184 * Guesses the symbolic icon of a Unix mount point. 185 * 186 * Returns: a #GIcon 187 * 188 * Since: 2.34 189 */ 190 public IconIF guessSymbolicIcon() 191 { 192 auto p = g_unix_mount_point_guess_symbolic_icon(gUnixMountPoint); 193 194 if(p is null) 195 { 196 return null; 197 } 198 199 return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p, true); 200 } 201 202 /** 203 * Checks if a unix mount point is a loopback device. 204 * 205 * Returns: %TRUE if the mount point is a loopback. %FALSE otherwise. 206 */ 207 public bool isLoopback() 208 { 209 return g_unix_mount_point_is_loopback(gUnixMountPoint) != 0; 210 } 211 212 /** 213 * Checks if a unix mount point is read only. 214 * 215 * Returns: %TRUE if a mount point is read only. 216 */ 217 public bool isReadonly() 218 { 219 return g_unix_mount_point_is_readonly(gUnixMountPoint) != 0; 220 } 221 222 /** 223 * Checks if a unix mount point is mountable by the user. 224 * 225 * Returns: %TRUE if the mount point is user mountable. 226 */ 227 public bool isUserMountable() 228 { 229 return g_unix_mount_point_is_user_mountable(gUnixMountPoint) != 0; 230 } 231 }