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 * Description 85 * Routines for managing mounted UNIX mount points and paths. 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 name of a Unix mount. 210 * The result is a translated string. 211 * Returns: A newly allocated string that must be freed with g_free() 212 */ 213 public string guessName() 214 { 215 // char * g_unix_mount_guess_name (GUnixMountEntry *mount_entry); 216 return Str.toString(g_unix_mount_guess_name(gUnixMountEntry)); 217 } 218 219 /** 220 * Guesses whether a Unix mount can be ejected. 221 * Returns: TRUE if mount_entry is deemed to be ejectable. 222 */ 223 public int guessCanEject() 224 { 225 // gboolean g_unix_mount_guess_can_eject (GUnixMountEntry *mount_entry); 226 return g_unix_mount_guess_can_eject(gUnixMountEntry); 227 } 228 229 /** 230 * Guesses whether a Unix mount should be displayed in the UI. 231 * Returns: TRUE if mount_entry is deemed to be displayable. 232 */ 233 public int guessShouldDisplay() 234 { 235 // gboolean g_unix_mount_guess_should_display (GUnixMountEntry *mount_entry); 236 return g_unix_mount_guess_should_display(gUnixMountEntry); 237 } 238 239 /** 240 * Gets a GList of GUnixMountPoint containing the unix mount points. 241 * If time_read is set, it will be filled with the mount timestamp, 242 * allowing for checking if the mounts have changed with 243 * g_unix_mounts_points_changed_since(). 244 * Params: 245 * timeRead = guint64 to contain a timestamp. [out][allow-none] 246 * Returns: a GList of the UNIX mountpoints. [element-type GUnixMountPoint][transfer full] 247 */ 248 public static ListG pointsGet(ulong* timeRead) 249 { 250 // GList * g_unix_mount_points_get (guint64 *time_read); 251 auto p = g_unix_mount_points_get(timeRead); 252 253 if(p is null) 254 { 255 return null; 256 } 257 258 return ObjectG.getDObject!(ListG)(cast(GList*) p); 259 } 260 261 /** 262 * Gets a GList of GUnixMountEntry containing the unix mounts. 263 * If time_read is set, it will be filled with the mount 264 * timestamp, allowing for checking if the mounts have changed 265 * with g_unix_mounts_changed_since(). 266 * Params: 267 * timeRead = guint64 to contain a timestamp, or NULL. [out][allow-none] 268 * Returns: a GList of the UNIX mounts. [element-type GUnixMountEntry][transfer full] 269 */ 270 public static ListG mountsGet(ref ulong timeRead) 271 { 272 // GList * g_unix_mounts_get (guint64 *time_read); 273 auto p = g_unix_mounts_get(&timeRead); 274 275 if(p is null) 276 { 277 return null; 278 } 279 280 return ObjectG.getDObject!(ListG)(cast(GList*) p); 281 } 282 283 /** 284 * Gets a GUnixMountEntry for a given mount path. If time_read 285 * is set, it will be filled with a unix timestamp for checking 286 * if the mounts have changed since with g_unix_mounts_changed_since(). 287 * Params: 288 * mountPath = path for a possible unix mount. 289 * timeRead = guint64 to contain a timestamp. [out][allow-none] 290 * Returns: a GUnixMountEntry. [transfer full] 291 */ 292 public static UnixMountEntry at(string mountPath, ref ulong timeRead) 293 { 294 // GUnixMountEntry * g_unix_mount_at (const char *mount_path, guint64 *time_read); 295 auto p = g_unix_mount_at(Str.toStringz(mountPath), &timeRead); 296 297 if(p is null) 298 { 299 return null; 300 } 301 302 return ObjectG.getDObject!(UnixMountEntry)(cast(GUnixMountEntry*) p); 303 } 304 305 /** 306 * Checks if the unix mounts have changed since a given unix time. 307 * Params: 308 * time = guint64 to contain a timestamp. 309 * Returns: TRUE if the mounts have changed since time. 310 */ 311 public static int mountsChangedSince(ulong time) 312 { 313 // gboolean g_unix_mounts_changed_since (guint64 time); 314 return g_unix_mounts_changed_since(time); 315 } 316 317 /** 318 * Checks if the unix mount points have changed since a given unix time. 319 * Params: 320 * time = guint64 to contain a timestamp. 321 * Returns: TRUE if the mount points have changed since time. 322 */ 323 public static int pointsChangedSince(ulong time) 324 { 325 // gboolean g_unix_mount_points_changed_since (guint64 time); 326 return g_unix_mount_points_changed_since(time); 327 } 328 329 /** 330 * Determines if mount_path is considered an implementation of the 331 * OS. This is primarily used for hiding mountable and mounted volumes 332 * that only are used in the OS and has little to no relevance to the 333 * casual user. 334 * Params: 335 * mountPath = a mount path, e.g. /media/disk 336 * or /usr 337 * 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. 338 */ 339 public static int isMountPathSystemInternal(string mountPath) 340 { 341 // gboolean g_unix_is_mount_path_system_internal (const char *mount_path); 342 return g_unix_is_mount_path_system_internal(Str.toStringz(mountPath)); 343 } 344 }