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.UnixMountEntry; 26 27 private import gio.IconIF; 28 private import gio.c.functions; 29 public import gio.c.types; 30 private import glib.ListG; 31 private import glib.Str; 32 private import gobject.ObjectG; 33 public import gtkc.giotypes; 34 35 36 /** 37 * Defines a Unix mount entry (e.g. <filename>/media/cdrom</filename>). 38 * This corresponds roughly to a mtab entry. 39 */ 40 public class UnixMountEntry 41 { 42 /** the main Gtk struct */ 43 protected GUnixMountEntry* gUnixMountEntry; 44 protected bool ownedRef; 45 46 /** Get the main Gtk struct */ 47 public GUnixMountEntry* getUnixMountEntryStruct(bool transferOwnership = false) 48 { 49 if (transferOwnership) 50 ownedRef = false; 51 return gUnixMountEntry; 52 } 53 54 /** the main Gtk struct as a void* */ 55 protected void* getStruct() 56 { 57 return cast(void*)gUnixMountEntry; 58 } 59 60 /** 61 * Sets our main struct and passes it to the parent class. 62 */ 63 public this (GUnixMountEntry* gUnixMountEntry, bool ownedRef = false) 64 { 65 this.gUnixMountEntry = gUnixMountEntry; 66 this.ownedRef = ownedRef; 67 } 68 69 70 /** */ 71 public static GType getType() 72 { 73 return g_unix_mount_entry_get_type(); 74 } 75 76 /** 77 * Determines if @mount_path is considered an implementation of the 78 * OS. This is primarily used for hiding mountable and mounted volumes 79 * that only are used in the OS and has little to no relevance to the 80 * casual user. 81 * 82 * Params: 83 * mountPath = a mount path, e.g. `/media/disk` or `/usr` 84 * 85 * Returns: %TRUE if @mount_path is considered an implementation detail 86 * of the OS. 87 */ 88 public static bool isMountPathSystemInternal(string mountPath) 89 { 90 return g_unix_is_mount_path_system_internal(Str.toStringz(mountPath)) != 0; 91 } 92 93 /** 94 * Gets a #GUnixMountEntry for a given mount path. If @time_read 95 * is set, it will be filled with a unix timestamp for checking 96 * if the mounts have changed since with g_unix_mounts_changed_since(). 97 * 98 * Params: 99 * mountPath = path for a possible unix mount. 100 * timeRead = guint64 to contain a timestamp. 101 * 102 * Returns: a #GUnixMountEntry. 103 */ 104 public static UnixMountEntry at(string mountPath, out ulong timeRead) 105 { 106 auto p = g_unix_mount_at(Str.toStringz(mountPath), &timeRead); 107 108 if(p is null) 109 { 110 return null; 111 } 112 113 return ObjectG.getDObject!(UnixMountEntry)(cast(GUnixMountEntry*) p, true); 114 } 115 116 /** 117 * Compares two unix mounts. 118 * 119 * Params: 120 * mount2 = second #GUnixMountEntry to compare. 121 * 122 * Returns: 1, 0 or -1 if @mount1 is greater than, equal to, 123 * or less than @mount2, respectively. 124 */ 125 public int compare(UnixMountEntry mount2) 126 { 127 return g_unix_mount_compare(gUnixMountEntry, (mount2 is null) ? null : mount2.getUnixMountEntryStruct()); 128 } 129 130 /** 131 * Frees a unix mount. 132 */ 133 public void free() 134 { 135 g_unix_mount_free(gUnixMountEntry); 136 } 137 138 /** 139 * Gets the device path for a unix mount. 140 * 141 * Returns: a string containing the device path. 142 */ 143 public string getDevicePath() 144 { 145 return Str.toString(g_unix_mount_get_device_path(gUnixMountEntry)); 146 } 147 148 /** 149 * Gets the filesystem type for the unix mount. 150 * 151 * Returns: a string containing the file system type. 152 */ 153 public string getFsType() 154 { 155 return Str.toString(g_unix_mount_get_fs_type(gUnixMountEntry)); 156 } 157 158 /** 159 * Gets the mount path for a unix mount. 160 * 161 * Returns: the mount path for @mount_entry. 162 */ 163 public string getMountPath() 164 { 165 return Str.toString(g_unix_mount_get_mount_path(gUnixMountEntry)); 166 } 167 168 /** 169 * Guesses whether a Unix mount can be ejected. 170 * 171 * Returns: %TRUE if @mount_entry is deemed to be ejectable. 172 */ 173 public bool guessCanEject() 174 { 175 return g_unix_mount_guess_can_eject(gUnixMountEntry) != 0; 176 } 177 178 /** 179 * Guesses the icon of a Unix mount. 180 * 181 * Returns: a #GIcon 182 */ 183 public IconIF guessIcon() 184 { 185 auto p = g_unix_mount_guess_icon(gUnixMountEntry); 186 187 if(p is null) 188 { 189 return null; 190 } 191 192 return ObjectG.getDObject!(IconIF)(cast(GIcon*) p, true); 193 } 194 195 /** 196 * Guesses the name of a Unix mount. 197 * The result is a translated string. 198 * 199 * Returns: A newly allocated string that must 200 * be freed with g_free() 201 */ 202 public string guessName() 203 { 204 auto retStr = g_unix_mount_guess_name(gUnixMountEntry); 205 206 scope(exit) Str.freeString(retStr); 207 return Str.toString(retStr); 208 } 209 210 /** 211 * Guesses whether a Unix mount should be displayed in the UI. 212 * 213 * Returns: %TRUE if @mount_entry is deemed to be displayable. 214 */ 215 public bool guessShouldDisplay() 216 { 217 return g_unix_mount_guess_should_display(gUnixMountEntry) != 0; 218 } 219 220 /** 221 * Guesses the symbolic icon of a Unix mount. 222 * 223 * Returns: a #GIcon 224 * 225 * Since: 2.34 226 */ 227 public IconIF guessSymbolicIcon() 228 { 229 auto p = g_unix_mount_guess_symbolic_icon(gUnixMountEntry); 230 231 if(p is null) 232 { 233 return null; 234 } 235 236 return ObjectG.getDObject!(IconIF)(cast(GIcon*) p, true); 237 } 238 239 /** 240 * Checks if a unix mount is mounted read only. 241 * 242 * Returns: %TRUE if @mount_entry is read only. 243 */ 244 public bool isReadonly() 245 { 246 return g_unix_mount_is_readonly(gUnixMountEntry) != 0; 247 } 248 249 /** 250 * Checks if a unix mount is a system path. 251 * 252 * Returns: %TRUE if the unix mount is for a system path. 253 */ 254 public bool isSystemInternal() 255 { 256 return g_unix_mount_is_system_internal(gUnixMountEntry) != 0; 257 } 258 259 /** 260 * Checks if the unix mount points have changed since a given unix time. 261 * 262 * Params: 263 * time = guint64 to contain a timestamp. 264 * 265 * Returns: %TRUE if the mount points have changed since @time. 266 */ 267 public static bool pointsChangedSince(ulong time) 268 { 269 return g_unix_mount_points_changed_since(time) != 0; 270 } 271 272 /** 273 * Gets a #GList of #GUnixMountPoint containing the unix mount points. 274 * If @time_read is set, it will be filled with the mount timestamp, 275 * allowing for checking if the mounts have changed with 276 * g_unix_mount_points_changed_since(). 277 * 278 * Params: 279 * timeRead = guint64 to contain a timestamp. 280 * 281 * Returns: a #GList of the UNIX mountpoints. 282 */ 283 public static ListG mountPointsGet(out ulong timeRead) 284 { 285 auto p = g_unix_mount_points_get(&timeRead); 286 287 if(p is null) 288 { 289 return null; 290 } 291 292 return new ListG(cast(GList*) p, true); 293 } 294 295 /** 296 * Checks if the unix mounts have changed since a given unix time. 297 * 298 * Params: 299 * time = guint64 to contain a timestamp. 300 * 301 * Returns: %TRUE if the mounts have changed since @time. 302 */ 303 public static bool mountsChangedSince(ulong time) 304 { 305 return g_unix_mounts_changed_since(time) != 0; 306 } 307 308 /** 309 * Gets a #GList of #GUnixMountEntry containing the unix mounts. 310 * If @time_read is set, it will be filled with the mount 311 * timestamp, allowing for checking if the mounts have changed 312 * with g_unix_mounts_changed_since(). 313 * 314 * Params: 315 * timeRead = guint64 to contain a timestamp, or %NULL 316 * 317 * Returns: a #GList of the UNIX mounts. 318 */ 319 public static ListG mountsGet(out ulong timeRead) 320 { 321 auto p = g_unix_mounts_get(&timeRead); 322 323 if(p is null) 324 { 325 return null; 326 } 327 328 return new ListG(cast(GList*) p, true); 329 } 330 331 /** 332 * Makes a copy of @mount_entry. 333 * 334 * Returns: a new #GUnixMountEntry 335 * 336 * Since: 2.54 337 */ 338 public UnixMountEntry copy() 339 { 340 auto p = g_unix_mount_copy(gUnixMountEntry); 341 342 if(p is null) 343 { 344 return null; 345 } 346 347 return ObjectG.getDObject!(UnixMountEntry)(cast(GUnixMountEntry*) p, true); 348 } 349 350 /** 351 * Gets a #GUnixMountEntry for a given file path. If @time_read 352 * is set, it will be filled with a unix timestamp for checking 353 * if the mounts have changed since with g_unix_mounts_changed_since(). 354 * 355 * Params: 356 * filePath = file path on some unix mount. 357 * timeRead = guint64 to contain a timestamp. 358 * 359 * Returns: a #GUnixMountEntry. 360 * 361 * Since: 2.52 362 */ 363 public static UnixMountEntry mountFor(string filePath, out ulong timeRead) 364 { 365 auto p = g_unix_mount_for(Str.toStringz(filePath), &timeRead); 366 367 if(p is null) 368 { 369 return null; 370 } 371 372 return ObjectG.getDObject!(UnixMountEntry)(cast(GUnixMountEntry*) p, true); 373 } 374 }