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