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