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