| 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 = GMount.html |
|---|
| 27 |
* outPack = gio |
|---|
| 28 |
* outFile = MountT |
|---|
| 29 |
* strct = GMount |
|---|
| 30 |
* realStrct= |
|---|
| 31 |
* ctorStrct= |
|---|
| 32 |
* clss = MountT |
|---|
| 33 |
* interf = MountIF |
|---|
| 34 |
* class Code: No |
|---|
| 35 |
* interface Code: No |
|---|
| 36 |
* template for: |
|---|
| 37 |
* - TStruct |
|---|
| 38 |
* extend = |
|---|
| 39 |
* implements: |
|---|
| 40 |
* prefixes: |
|---|
| 41 |
* - g_mount_ |
|---|
| 42 |
* omit structs: |
|---|
| 43 |
* omit prefixes: |
|---|
| 44 |
* omit code: |
|---|
| 45 |
* omit signals: |
|---|
| 46 |
* imports: |
|---|
| 47 |
* - glib.Str |
|---|
| 48 |
* - glib.ErrorG |
|---|
| 49 |
* - glib.GException |
|---|
| 50 |
* - gobject.Signals |
|---|
| 51 |
* - gio.AsyncResultIF |
|---|
| 52 |
* - gio.Cancellable |
|---|
| 53 |
* - gio.Drive |
|---|
| 54 |
* - gio.DriveIF |
|---|
| 55 |
* - gio.File |
|---|
| 56 |
* - gio.Icon |
|---|
| 57 |
* - gio.IconIF |
|---|
| 58 |
* - gio.MountOperation |
|---|
| 59 |
* - gio.Volume |
|---|
| 60 |
* - gio.VolumeIF |
|---|
| 61 |
* structWrap: |
|---|
| 62 |
* - GAsyncResult* -> AsyncResultIF |
|---|
| 63 |
* - GCancellable* -> Cancellable |
|---|
| 64 |
* - GDrive* -> DriveIF |
|---|
| 65 |
* - GFile* -> File |
|---|
| 66 |
* - GIcon* -> IconIF |
|---|
| 67 |
* - GMountOperation* -> MountOperation |
|---|
| 68 |
* - GVolume* -> VolumeIF |
|---|
| 69 |
* module aliases: |
|---|
| 70 |
* local aliases: |
|---|
| 71 |
* overrides: |
|---|
| 72 |
*/ |
|---|
| 73 |
|
|---|
| 74 |
module gio.MountT; |
|---|
| 75 |
|
|---|
| 76 |
public import gtkc.giotypes; |
|---|
| 77 |
|
|---|
| 78 |
public import gtkc.gio; |
|---|
| 79 |
public import glib.ConstructionException; |
|---|
| 80 |
|
|---|
| 81 |
public import gobject.Signals; |
|---|
| 82 |
public import gtkc.gdktypes; |
|---|
| 83 |
|
|---|
| 84 |
public import glib.Str; |
|---|
| 85 |
public import glib.ErrorG; |
|---|
| 86 |
public import glib.GException; |
|---|
| 87 |
public import gobject.Signals; |
|---|
| 88 |
public import gio.AsyncResultIF; |
|---|
| 89 |
public import gio.Cancellable; |
|---|
| 90 |
public import gio.Drive; |
|---|
| 91 |
public import gio.DriveIF; |
|---|
| 92 |
public import gio.File; |
|---|
| 93 |
public import gio.Icon; |
|---|
| 94 |
public import gio.IconIF; |
|---|
| 95 |
public import gio.MountOperation; |
|---|
| 96 |
public import gio.Volume; |
|---|
| 97 |
public import gio.VolumeIF; |
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 |
/** |
|---|
| 103 |
* Description |
|---|
| 104 |
* The GMount interface represents user-visible mounts. Note, when |
|---|
| 105 |
* porting from GnomeVFS, GMount is the moral equivalent of GnomeVFSVolume. |
|---|
| 106 |
* GMount is a "mounted" filesystem that you can access. Mounted is in |
|---|
| 107 |
* quotes because it's not the same as a unix mount, it might be a gvfs |
|---|
| 108 |
* mount, but you can still access the files on it if you use GIO. Might or |
|---|
| 109 |
* might not be related to a volume object. |
|---|
| 110 |
* Unmounting a GMount instance is an asynchronous operation. For |
|---|
| 111 |
* more information about asynchronous operations, see GAsyncReady |
|---|
| 112 |
* and GSimpleAsyncReady. To unmount a GMount instance, first call |
|---|
| 113 |
* g_mount_unmount_with_operation() with (at least) the GMount instance and a |
|---|
| 114 |
* GAsyncReadyCallback. The callback will be fired when the |
|---|
| 115 |
* operation has resolved (either with success or failure), and a |
|---|
| 116 |
* GAsyncReady structure will be passed to the callback. That |
|---|
| 117 |
* callback should then call g_mount_unmount_with_operation_finish() with the GMount |
|---|
| 118 |
* and the GAsyncReady data to see if the operation was completed |
|---|
| 119 |
* successfully. If an error is present when g_mount_unmount_with_operation_finish() |
|---|
| 120 |
* is called, then it will be filled with any error information. |
|---|
| 121 |
*/ |
|---|
| 122 |
public template MountT(TStruct) |
|---|
| 123 |
{ |
|---|
| 124 |
|
|---|
| 125 |
/** the main Gtk struct */ |
|---|
| 126 |
protected GMount* gMount; |
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 |
public GMount* getMountTStruct() |
|---|
| 130 |
{ |
|---|
| 131 |
return cast(GMount*)getStruct(); |
|---|
| 132 |
} |
|---|
| 133 |
|
|---|
| 134 |
|
|---|
| 135 |
/** |
|---|
| 136 |
*/ |
|---|
| 137 |
int[string] connectedSignals; |
|---|
| 138 |
|
|---|
| 139 |
void delegate(MountIF)[] _onChangedListeners; |
|---|
| 140 |
void delegate(MountIF)[] onChangedListeners() |
|---|
| 141 |
{ |
|---|
| 142 |
return _onChangedListeners; |
|---|
| 143 |
} |
|---|
| 144 |
/** |
|---|
| 145 |
* Emitted when the mount has been changed. |
|---|
| 146 |
*/ |
|---|
| 147 |
void addOnChanged(void delegate(MountIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 148 |
{ |
|---|
| 149 |
if ( !("changed" in connectedSignals) ) |
|---|
| 150 |
{ |
|---|
| 151 |
Signals.connectData( |
|---|
| 152 |
getStruct(), |
|---|
| 153 |
"changed", |
|---|
| 154 |
cast(GCallback)&callBackChanged, |
|---|
| 155 |
cast(void*)cast(MountIF)this, |
|---|
| 156 |
null, |
|---|
| 157 |
connectFlags); |
|---|
| 158 |
connectedSignals["changed"] = 1; |
|---|
| 159 |
} |
|---|
| 160 |
_onChangedListeners ~= dlg; |
|---|
| 161 |
} |
|---|
| 162 |
extern(C) static void callBackChanged(GMount* mountStruct, MountIF mountIF) |
|---|
| 163 |
{ |
|---|
| 164 |
foreach ( void delegate(MountIF) dlg ; mountIF.onChangedListeners ) |
|---|
| 165 |
{ |
|---|
| 166 |
dlg(mountIF); |
|---|
| 167 |
} |
|---|
| 168 |
} |
|---|
| 169 |
|
|---|
| 170 |
void delegate(MountIF)[] _onPreUnmountListeners; |
|---|
| 171 |
void delegate(MountIF)[] onPreUnmountListeners() |
|---|
| 172 |
{ |
|---|
| 173 |
return _onPreUnmountListeners; |
|---|
| 174 |
} |
|---|
| 175 |
/** |
|---|
| 176 |
* This signal is emitted when the GMount is about to be |
|---|
| 177 |
* unmounted. |
|---|
| 178 |
* Since 2.22 |
|---|
| 179 |
*/ |
|---|
| 180 |
void addOnPreUnmount(void delegate(MountIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 181 |
{ |
|---|
| 182 |
if ( !("pre-unmount" in connectedSignals) ) |
|---|
| 183 |
{ |
|---|
| 184 |
Signals.connectData( |
|---|
| 185 |
getStruct(), |
|---|
| 186 |
"pre-unmount", |
|---|
| 187 |
cast(GCallback)&callBackPreUnmount, |
|---|
| 188 |
cast(void*)cast(MountIF)this, |
|---|
| 189 |
null, |
|---|
| 190 |
connectFlags); |
|---|
| 191 |
connectedSignals["pre-unmount"] = 1; |
|---|
| 192 |
} |
|---|
| 193 |
_onPreUnmountListeners ~= dlg; |
|---|
| 194 |
} |
|---|
| 195 |
extern(C) static void callBackPreUnmount(GMount* mountStruct, MountIF mountIF) |
|---|
| 196 |
{ |
|---|
| 197 |
foreach ( void delegate(MountIF) dlg ; mountIF.onPreUnmountListeners ) |
|---|
| 198 |
{ |
|---|
| 199 |
dlg(mountIF); |
|---|
| 200 |
} |
|---|
| 201 |
} |
|---|
| 202 |
|
|---|
| 203 |
void delegate(MountIF)[] _onUnmountedListeners; |
|---|
| 204 |
void delegate(MountIF)[] onUnmountedListeners() |
|---|
| 205 |
{ |
|---|
| 206 |
return _onUnmountedListeners; |
|---|
| 207 |
} |
|---|
| 208 |
/** |
|---|
| 209 |
* This signal is emitted when the GMount have been |
|---|
| 210 |
* unmounted. If the recipient is holding references to the |
|---|
| 211 |
* object they should release them so the object can be |
|---|
| 212 |
* finalized. |
|---|
| 213 |
* See Also |
|---|
| 214 |
* GVolume, GUnixMount |
|---|
| 215 |
*/ |
|---|
| 216 |
void addOnUnmounted(void delegate(MountIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 217 |
{ |
|---|
| 218 |
if ( !("unmounted" in connectedSignals) ) |
|---|
| 219 |
{ |
|---|
| 220 |
Signals.connectData( |
|---|
| 221 |
getStruct(), |
|---|
| 222 |
"unmounted", |
|---|
| 223 |
cast(GCallback)&callBackUnmounted, |
|---|
| 224 |
cast(void*)cast(MountIF)this, |
|---|
| 225 |
null, |
|---|
| 226 |
connectFlags); |
|---|
| 227 |
connectedSignals["unmounted"] = 1; |
|---|
| 228 |
} |
|---|
| 229 |
_onUnmountedListeners ~= dlg; |
|---|
| 230 |
} |
|---|
| 231 |
extern(C) static void callBackUnmounted(GMount* mountStruct, MountIF mountIF) |
|---|
| 232 |
{ |
|---|
| 233 |
foreach ( void delegate(MountIF) dlg ; mountIF.onUnmountedListeners ) |
|---|
| 234 |
{ |
|---|
| 235 |
dlg(mountIF); |
|---|
| 236 |
} |
|---|
| 237 |
} |
|---|
| 238 |
|
|---|
| 239 |
|
|---|
| 240 |
/** |
|---|
| 241 |
* Gets the name of mount. |
|---|
| 242 |
* Returns: the name for the given mount. The returned string should be freed with g_free() when no longer needed. |
|---|
| 243 |
*/ |
|---|
| 244 |
public string getName() |
|---|
| 245 |
{ |
|---|
| 246 |
// char * g_mount_get_name (GMount *mount); |
|---|
| 247 |
return Str.toString(g_mount_get_name(getMountTStruct())); |
|---|
| 248 |
} |
|---|
| 249 |
|
|---|
| 250 |
/** |
|---|
| 251 |
* Gets the UUID for the mount. The reference is typically based on |
|---|
| 252 |
* the file system UUID for the mount in question and should be |
|---|
| 253 |
* considered an opaque string. Returns NULL if there is no UUID |
|---|
| 254 |
* available. |
|---|
| 255 |
* Returns: the UUID for mount or NULL if no UUID can be computed. The returned string should be freed with g_free() when no longer needed. |
|---|
| 256 |
*/ |
|---|
| 257 |
public string getUuid() |
|---|
| 258 |
{ |
|---|
| 259 |
// char * g_mount_get_uuid (GMount *mount); |
|---|
| 260 |
return Str.toString(g_mount_get_uuid(getMountTStruct())); |
|---|
| 261 |
} |
|---|
| 262 |
|
|---|
| 263 |
/** |
|---|
| 264 |
* Gets the icon for mount. |
|---|
| 265 |
* Returns: a GIcon. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full] |
|---|
| 266 |
*/ |
|---|
| 267 |
public IconIF getIcon() |
|---|
| 268 |
{ |
|---|
| 269 |
// GIcon * g_mount_get_icon (GMount *mount); |
|---|
| 270 |
auto p = g_mount_get_icon(getMountTStruct()); |
|---|
| 271 |
if(p is null) |
|---|
| 272 |
{ |
|---|
| 273 |
return null; |
|---|
| 274 |
} |
|---|
| 275 |
return new Icon(cast(GIcon*) p); |
|---|
| 276 |
} |
|---|
| 277 |
|
|---|
| 278 |
/** |
|---|
| 279 |
* Gets the drive for the mount. |
|---|
| 280 |
* This is a convenience method for getting the GVolume and then |
|---|
| 281 |
* using that object to get the GDrive. |
|---|
| 282 |
* Returns: a GDrive or NULL if mount is not associated with a volume or a drive. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full] |
|---|
| 283 |
*/ |
|---|
| 284 |
public DriveIF getDrive() |
|---|
| 285 |
{ |
|---|
| 286 |
// GDrive * g_mount_get_drive (GMount *mount); |
|---|
| 287 |
auto p = g_mount_get_drive(getMountTStruct()); |
|---|
| 288 |
if(p is null) |
|---|
| 289 |
{ |
|---|
| 290 |
return null; |
|---|
| 291 |
} |
|---|
| 292 |
return new Drive(cast(GDrive*) p); |
|---|
| 293 |
} |
|---|
| 294 |
|
|---|
| 295 |
/** |
|---|
| 296 |
* Gets the root directory on mount. |
|---|
| 297 |
* Returns: a GFile. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full] |
|---|
| 298 |
*/ |
|---|
| 299 |
public File getRoot() |
|---|
| 300 |
{ |
|---|
| 301 |
// GFile * g_mount_get_root (GMount *mount); |
|---|
| 302 |
auto p = g_mount_get_root(getMountTStruct()); |
|---|
| 303 |
if(p is null) |
|---|
| 304 |
{ |
|---|
| 305 |
return null; |
|---|
| 306 |
} |
|---|
| 307 |
return new File(cast(GFile*) p); |
|---|
| 308 |
} |
|---|
| 309 |
|
|---|
| 310 |
/** |
|---|
| 311 |
* Gets the volume for the mount. |
|---|
| 312 |
* Returns: a GVolume or NULL if mount is not associated with a volume. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full] |
|---|
| 313 |
*/ |
|---|
| 314 |
public VolumeIF getVolume() |
|---|
| 315 |
{ |
|---|
| 316 |
// GVolume * g_mount_get_volume (GMount *mount); |
|---|
| 317 |
auto p = g_mount_get_volume(getMountTStruct()); |
|---|
| 318 |
if(p is null) |
|---|
| 319 |
{ |
|---|
| 320 |
return null; |
|---|
| 321 |
} |
|---|
| 322 |
return new Volume(cast(GVolume*) p); |
|---|
| 323 |
} |
|---|
| 324 |
|
|---|
| 325 |
/** |
|---|
| 326 |
* Gets the default location of mount. The default location of the given |
|---|
| 327 |
* mount is a path that reflects the main entry point for the user (e.g. |
|---|
| 328 |
* the home directory, or the root of the volume). |
|---|
| 329 |
* Returns: a GFile. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full] |
|---|
| 330 |
*/ |
|---|
| 331 |
public File getDefaultLocation() |
|---|
| 332 |
{ |
|---|
| 333 |
// GFile * g_mount_get_default_location (GMount *mount); |
|---|
| 334 |
auto p = g_mount_get_default_location(getMountTStruct()); |
|---|
| 335 |
if(p is null) |
|---|
| 336 |
{ |
|---|
| 337 |
return null; |
|---|
| 338 |
} |
|---|
| 339 |
return new File(cast(GFile*) p); |
|---|
| 340 |
} |
|---|
| 341 |
|
|---|
| 342 |
/** |
|---|
| 343 |
* Checks if mount can be mounted. |
|---|
| 344 |
* Params: |
|---|
| 345 |
* mount = a GMount. |
|---|
| 346 |
* Returns: TRUE if the mount can be unmounted. |
|---|
| 347 |
*/ |
|---|
| 348 |
public int canUnmount() |
|---|
| 349 |
{ |
|---|
| 350 |
// gboolean g_mount_can_unmount (GMount *mount); |
|---|
| 351 |
return g_mount_can_unmount(getMountTStruct()); |
|---|
| 352 |
} |
|---|
| 353 |
|
|---|
| 354 |
/** |
|---|
| 355 |
* Warning |
|---|
| 356 |
* g_mount_unmount has been deprecated since version 2.22 and should not be used in newly-written code. Use g_mount_unmount_with_operation() instead. |
|---|
| 357 |
* Unmounts a mount. This is an asynchronous operation, and is |
|---|
| 358 |
* finished by calling g_mount_unmount_finish() with the mount |
|---|
| 359 |
* and GAsyncResult data returned in the callback. |
|---|
| 360 |
* Params: |
|---|
| 361 |
* mount = a GMount. |
|---|
| 362 |
* flags = flags affecting the operation |
|---|
| 363 |
* cancellable = optional GCancellable object, NULL to ignore. [allow-none] |
|---|
| 364 |
* callback = a GAsyncReadyCallback, or NULL. [allow-none] |
|---|
| 365 |
* userData = user data passed to callback. |
|---|
| 366 |
*/ |
|---|
| 367 |
public void unmount(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) |
|---|
| 368 |
{ |
|---|
| 369 |
// void g_mount_unmount (GMount *mount, GMountUnmountFlags flags, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); |
|---|
| 370 |
g_mount_unmount(getMountTStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); |
|---|
| 371 |
} |
|---|
| 372 |
|
|---|
| 373 |
/** |
|---|
| 374 |
* Warning |
|---|
| 375 |
* g_mount_unmount_finish has been deprecated since version 2.22 and should not be used in newly-written code. Use g_mount_unmount_with_operation_finish() instead. |
|---|
| 376 |
* Finishes unmounting a mount. If any errors occurred during the operation, |
|---|
| 377 |
* error will be set to contain the errors and FALSE will be returned. |
|---|
| 378 |
* Params: |
|---|
| 379 |
* mount = a GMount. |
|---|
| 380 |
* result = a GAsyncResult. |
|---|
| 381 |
* Returns: TRUE if the mount was successfully unmounted. FALSE otherwise. |
|---|
| 382 |
* Throws: GException on failure. |
|---|
| 383 |
*/ |
|---|
| 384 |
public int unmountFinish(AsyncResultIF result) |
|---|
| 385 |
{ |
|---|
| 386 |
// gboolean g_mount_unmount_finish (GMount *mount, GAsyncResult *result, GError **error); |
|---|
| 387 |
GError* err = null; |
|---|
| 388 |
|
|---|
| 389 |
auto p = g_mount_unmount_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); |
|---|
| 390 |
|
|---|
| 391 |
if (err !is null) |
|---|
| 392 |
{ |
|---|
| 393 |
throw new GException( new ErrorG(err) ); |
|---|
| 394 |
} |
|---|
| 395 |
|
|---|
| 396 |
return p; |
|---|
| 397 |
} |
|---|
| 398 |
|
|---|
| 399 |
/** |
|---|
| 400 |
* Unmounts a mount. This is an asynchronous operation, and is |
|---|
| 401 |
* finished by calling g_mount_unmount_with_operation_finish() with the mount |
|---|
| 402 |
* and GAsyncResult data returned in the callback. |
|---|
| 403 |
* Since 2.22 |
|---|
| 404 |
* Params: |
|---|
| 405 |
* mount = a GMount. |
|---|
| 406 |
* flags = flags affecting the operation |
|---|
| 407 |
* mountOperation = a GMountOperation or NULL to avoid |
|---|
| 408 |
* user interaction. [allow-none] |
|---|
| 409 |
* cancellable = optional GCancellable object, NULL to ignore. [allow-none] |
|---|
| 410 |
* callback = a GAsyncReadyCallback, or NULL. [allow-none] |
|---|
| 411 |
* userData = user data passed to callback. |
|---|
| 412 |
*/ |
|---|
| 413 |
public void unmountWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) |
|---|
| 414 |
{ |
|---|
| 415 |
// void g_mount_unmount_with_operation (GMount *mount, GMountUnmountFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); |
|---|
| 416 |
g_mount_unmount_with_operation(getMountTStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); |
|---|
| 417 |
} |
|---|
| 418 |
|
|---|
| 419 |
/** |
|---|
| 420 |
* Finishes unmounting a mount. If any errors occurred during the operation, |
|---|
| 421 |
* error will be set to contain the errors and FALSE will be returned. |
|---|
| 422 |
* Since 2.22 |
|---|
| 423 |
* Params: |
|---|
| 424 |
* mount = a GMount. |
|---|
| 425 |
* result = a GAsyncResult. |
|---|
| 426 |
* Returns: TRUE if the mount was successfully unmounted. FALSE otherwise. |
|---|
| 427 |
* Throws: GException on failure. |
|---|
| 428 |
*/ |
|---|
| 429 |
public int unmountWithOperationFinish(AsyncResultIF result) |
|---|
| 430 |
{ |
|---|
| 431 |
// gboolean g_mount_unmount_with_operation_finish (GMount *mount, GAsyncResult *result, GError **error); |
|---|
| 432 |
GError* err = null; |
|---|
| 433 |
|
|---|
| 434 |
auto p = g_mount_unmount_with_operation_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); |
|---|
| 435 |
|
|---|
| 436 |
if (err !is null) |
|---|
| 437 |
{ |
|---|
| 438 |
throw new GException( new ErrorG(err) ); |
|---|
| 439 |
} |
|---|
| 440 |
|
|---|
| 441 |
return p; |
|---|
| 442 |
} |
|---|
| 443 |
|
|---|
| 444 |
/** |
|---|
| 445 |
* Remounts a mount. This is an asynchronous operation, and is |
|---|
| 446 |
* finished by calling g_mount_remount_finish() with the mount |
|---|
| 447 |
* and GAsyncResults data returned in the callback. |
|---|
| 448 |
* Remounting is useful when some setting affecting the operation |
|---|
| 449 |
* of the volume has been changed, as these may need a remount to |
|---|
| 450 |
* take affect. While this is semantically equivalent with unmounting |
|---|
| 451 |
* and then remounting not all backends might need to actually be |
|---|
| 452 |
* unmounted. |
|---|
| 453 |
* Params: |
|---|
| 454 |
* mount = a GMount. |
|---|
| 455 |
* flags = flags affecting the operation |
|---|
| 456 |
* mountOperation = a GMountOperation or NULL to avoid |
|---|
| 457 |
* user interaction. [allow-none] |
|---|
| 458 |
* cancellable = optional GCancellable object, NULL to ignore. [allow-none] |
|---|
| 459 |
* callback = a GAsyncReadyCallback, or NULL. [allow-none] |
|---|
| 460 |
* userData = user data passed to callback. |
|---|
| 461 |
*/ |
|---|
| 462 |
public void remount(GMountMountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) |
|---|
| 463 |
{ |
|---|
| 464 |
// void g_mount_remount (GMount *mount, GMountMountFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); |
|---|
| 465 |
g_mount_remount(getMountTStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); |
|---|
| 466 |
} |
|---|
| 467 |
|
|---|
| 468 |
/** |
|---|
| 469 |
* Finishes remounting a mount. If any errors occurred during the operation, |
|---|
| 470 |
* error will be set to contain the errors and FALSE will be returned. |
|---|
| 471 |
* Params: |
|---|
| 472 |
* mount = a GMount. |
|---|
| 473 |
* result = a GAsyncResult. |
|---|
| 474 |
* Returns: TRUE if the mount was successfully remounted. FALSE otherwise. |
|---|
| 475 |
* Throws: GException on failure. |
|---|
| 476 |
*/ |
|---|
| 477 |
public int remountFinish(AsyncResultIF result) |
|---|
| 478 |
{ |
|---|
| 479 |
// gboolean g_mount_remount_finish (GMount *mount, GAsyncResult *result, GError **error); |
|---|
| 480 |
GError* err = null; |
|---|
| 481 |
|
|---|
| 482 |
auto p = g_mount_remount_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); |
|---|
| 483 |
|
|---|
| 484 |
if (err !is null) |
|---|
| 485 |
{ |
|---|
| 486 |
throw new GException( new ErrorG(err) ); |
|---|
| 487 |
} |
|---|
| 488 |
|
|---|
| 489 |
return p; |
|---|
| 490 |
} |
|---|
| 491 |
|
|---|
| 492 |
/** |
|---|
| 493 |
* Checks if mount can be eject. |
|---|
| 494 |
* Returns: TRUE if the mount can be ejected. |
|---|
| 495 |
*/ |
|---|
| 496 |
public int canEject() |
|---|
| 497 |
{ |
|---|
| 498 |
// gboolean g_mount_can_eject (GMount *mount); |
|---|
| 499 |
return g_mount_can_eject(getMountTStruct()); |
|---|
| 500 |
} |
|---|
| 501 |
|
|---|
| 502 |
/** |
|---|
| 503 |
* Warning |
|---|
| 504 |
* g_mount_eject has been deprecated since version 2.22 and should not be used in newly-written code. Use g_mount_eject_with_operation() instead. |
|---|
| 505 |
* Ejects a mount. This is an asynchronous operation, and is |
|---|
| 506 |
* finished by calling g_mount_eject_finish() with the mount |
|---|
| 507 |
* and GAsyncResult data returned in the callback. |
|---|
| 508 |
* Params: |
|---|
| 509 |
* mount = a GMount. |
|---|
| 510 |
* flags = flags affecting the unmount if required for eject |
|---|
| 511 |
* cancellable = optional GCancellable object, NULL to ignore. [allow-none] |
|---|
| 512 |
* callback = a GAsyncReadyCallback, or NULL. [allow-none] |
|---|
| 513 |
* userData = user data passed to callback. |
|---|
| 514 |
*/ |
|---|
| 515 |
public void eject(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) |
|---|
| 516 |
{ |
|---|
| 517 |
// void g_mount_eject (GMount *mount, GMountUnmountFlags flags, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); |
|---|
| 518 |
g_mount_eject(getMountTStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); |
|---|
| 519 |
} |
|---|
| 520 |
|
|---|
| 521 |
/** |
|---|
| 522 |
* Warning |
|---|
| 523 |
* g_mount_eject_finish has been deprecated since version 2.22 and should not be used in newly-written code. Use g_mount_eject_with_operation_finish() instead. |
|---|
| 524 |
* Finishes ejecting a mount. If any errors occurred during the operation, |
|---|
| 525 |
* error will be set to contain the errors and FALSE will be returned. |
|---|
| 526 |
* Params: |
|---|
| 527 |
* result = a GAsyncResult. |
|---|
| 528 |
* Returns: TRUE if the mount was successfully ejected. FALSE otherwise. |
|---|
| 529 |
* Throws: GException on failure. |
|---|
| 530 |
*/ |
|---|
| 531 |
public int ejectFinish(AsyncResultIF result) |
|---|
| 532 |
{ |
|---|
| 533 |
// gboolean g_mount_eject_finish (GMount *mount, GAsyncResult *result, GError **error); |
|---|
| 534 |
GError* err = null; |
|---|
| 535 |
|
|---|
| 536 |
auto p = g_mount_eject_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); |
|---|
| 537 |
|
|---|
| 538 |
if (err !is null) |
|---|
| 539 |
{ |
|---|
| 540 |
throw new GException( new ErrorG(err) ); |
|---|
| 541 |
} |
|---|
| 542 |
|
|---|
| 543 |
return p; |
|---|
| 544 |
} |
|---|
| 545 |
|
|---|
| 546 |
/** |
|---|
| 547 |
* Ejects a mount. This is an asynchronous operation, and is |
|---|
| 548 |
* finished by calling g_mount_eject_with_operation_finish() with the mount |
|---|
| 549 |
* and GAsyncResult data returned in the callback. |
|---|
| 550 |
* Since 2.22 |
|---|
| 551 |
* Params: |
|---|
| 552 |
* mount = a GMount. |
|---|
| 553 |
* flags = flags affecting the unmount if required for eject |
|---|
| 554 |
* mountOperation = a GMountOperation or NULL to avoid |
|---|
| 555 |
* user interaction. [allow-none] |
|---|
| 556 |
* cancellable = optional GCancellable object, NULL to ignore. [allow-none] |
|---|
| 557 |
* callback = a GAsyncReadyCallback, or NULL. [allow-none] |
|---|
| 558 |
* userData = user data passed to callback. |
|---|
| 559 |
*/ |
|---|
| 560 |
public void ejectWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) |
|---|
| 561 |
{ |
|---|
| 562 |
// void g_mount_eject_with_operation (GMount *mount, GMountUnmountFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); |
|---|
| 563 |
g_mount_eject_with_operation(getMountTStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); |
|---|
| 564 |
} |
|---|
| 565 |
|
|---|
| 566 |
/** |
|---|
| 567 |
* Finishes ejecting a mount. If any errors occurred during the operation, |
|---|
| 568 |
* error will be set to contain the errors and FALSE will be returned. |
|---|
| 569 |
* Since 2.22 |
|---|
| 570 |
* Params: |
|---|
| 571 |
* result = a GAsyncResult. |
|---|
| 572 |
* Returns: TRUE if the mount was successfully ejected. FALSE otherwise. |
|---|
| 573 |
* Throws: GException on failure. |
|---|
| 574 |
*/ |
|---|
| 575 |
public int ejectWithOperationFinish(AsyncResultIF result) |
|---|
| 576 |
{ |
|---|
| 577 |
// gboolean g_mount_eject_with_operation_finish (GMount *mount, GAsyncResult *result, GError **error); |
|---|
| 578 |
GError* err = null; |
|---|
| 579 |
|
|---|
| 580 |
auto p = g_mount_eject_with_operation_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); |
|---|
| 581 |
|
|---|
| 582 |
if (err !is null) |
|---|
| 583 |
{ |
|---|
| 584 |
throw new GException( new ErrorG(err) ); |
|---|
| 585 |
} |
|---|
| 586 |
|
|---|
| 587 |
return p; |
|---|
| 588 |
} |
|---|
| 589 |
|
|---|
| 590 |
/** |
|---|
| 591 |
* Tries to guess the type of content stored on mount. Returns one or |
|---|
| 592 |
* more textual identifiers of well-known content types (typically |
|---|
| 593 |
* prefixed with "x-content/"), e.g. x-content/image-dcf for camera |
|---|
| 594 |
* memory cards. See the shared-mime-info |
|---|
| 595 |
* specification for more on x-content types. |
|---|
| 596 |
* This is an asynchronous operation (see |
|---|
| 597 |
* g_mount_guess_content_type_sync() for the synchronous version), and |
|---|
| 598 |
* is finished by calling g_mount_guess_content_type_finish() with the |
|---|
| 599 |
* mount and GAsyncResult data returned in the callback. |
|---|
| 600 |
* Since 2.18 |
|---|
| 601 |
* Params: |
|---|
| 602 |
* forceRescan = Whether to force a rescan of the content. |
|---|
| 603 |
* Otherwise a cached result will be used if available |
|---|
| 604 |
* cancellable = optional GCancellable object, NULL to ignore. [allow-none] |
|---|
| 605 |
* callback = a GAsyncReadyCallback |
|---|
| 606 |
* userData = user data passed to callback |
|---|
| 607 |
*/ |
|---|
| 608 |
public void guessContentType(int forceRescan, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) |
|---|
| 609 |
{ |
|---|
| 610 |
// void g_mount_guess_content_type (GMount *mount, gboolean force_rescan, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); |
|---|
| 611 |
g_mount_guess_content_type(getMountTStruct(), forceRescan, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); |
|---|
| 612 |
} |
|---|
| 613 |
|
|---|
| 614 |
/** |
|---|
| 615 |
* Finishes guessing content types of mount. If any errors occured |
|---|
| 616 |
* during the operation, error will be set to contain the errors and |
|---|
| 617 |
* FALSE will be returned. In particular, you may get an |
|---|
| 618 |
* G_IO_ERROR_NOT_SUPPORTED if the mount does not support content |
|---|
| 619 |
* guessing. |
|---|
| 620 |
* Since 2.18 |
|---|
| 621 |
* Params: |
|---|
| 622 |
* result = a GAsyncResult |
|---|
| 623 |
* Returns: a NULL-terminated array of content types or NULL on error. Caller should free this array with g_strfreev() when done with it. [transfer full][element-type utf8] |
|---|
| 624 |
* Throws: GException on failure. |
|---|
| 625 |
*/ |
|---|
| 626 |
public string[] guessContentTypeFinish(AsyncResultIF result) |
|---|
| 627 |
{ |
|---|
| 628 |
// gchar ** g_mount_guess_content_type_finish (GMount *mount, GAsyncResult *result, GError **error); |
|---|
| 629 |
GError* err = null; |
|---|
| 630 |
|
|---|
| 631 |
auto p = g_mount_guess_content_type_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); |
|---|
| 632 |
|
|---|
| 633 |
if (err !is null) |
|---|
| 634 |
{ |
|---|
| 635 |
throw new GException( new ErrorG(err) ); |
|---|
| 636 |
} |
|---|
| 637 |
|
|---|
| 638 |
return Str.toStringArray(p); |
|---|
| 639 |
} |
|---|
| 640 |
|
|---|
| 641 |
/** |
|---|
| 642 |
* Tries to guess the type of content stored on mount. Returns one or |
|---|
| 643 |
* more textual identifiers of well-known content types (typically |
|---|
| 644 |
* prefixed with "x-content/"), e.g. x-content/image-dcf for camera |
|---|
| 645 |
* memory cards. See the shared-mime-info |
|---|
| 646 |
* specification for more on x-content types. |
|---|
| 647 |
* This is an synchronous operation and as such may block doing IO; |
|---|
| 648 |
* see g_mount_guess_content_type() for the asynchronous version. |
|---|
| 649 |
* Since 2.18 |
|---|
| 650 |
* Params: |
|---|
| 651 |
* forceRescan = Whether to force a rescan of the content. |
|---|
| 652 |
* Otherwise a cached result will be used if available |
|---|
| 653 |
* cancellable = optional GCancellable object, NULL to ignore. [allow-none] |
|---|
| 654 |
* Returns: a NULL-terminated array of content types or NULL on error. Caller should free this array with g_strfreev() when done with it. [transfer full][element-type utf8] |
|---|
| 655 |
* Throws: GException on failure. |
|---|
| 656 |
*/ |
|---|
| 657 |
public string[] guessContentTypeSync(int forceRescan, Cancellable cancellable) |
|---|
| 658 |
{ |
|---|
| 659 |
// gchar ** g_mount_guess_content_type_sync (GMount *mount, gboolean force_rescan, GCancellable *cancellable, GError **error); |
|---|
| 660 |
GError* err = null; |
|---|
| 661 |
|
|---|
| 662 |
auto p = g_mount_guess_content_type_sync(getMountTStruct(), forceRescan, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); |
|---|
| 663 |
|
|---|
| 664 |
if (err !is null) |
|---|
| 665 |
{ |
|---|
| 666 |
throw new GException( new ErrorG(err) ); |
|---|
| 667 |
} |
|---|
| 668 |
|
|---|
| 669 |
return Str.toStringArray(p); |
|---|
| 670 |
} |
|---|
| 671 |
|
|---|
| 672 |
/** |
|---|
| 673 |
* Determines if mount is shadowed. Applications or libraries should |
|---|
| 674 |
* avoid displaying mount in the user interface if it is shadowed. |
|---|
| 675 |
* A mount is said to be shadowed if there exists one or more user |
|---|
| 676 |
* visible objects (currently GMount objects) with a root that is |
|---|
| 677 |
* inside the root of mount. |
|---|
| 678 |
* One application of shadow mounts is when exposing a single file |
|---|
| 679 |
* system that is used to address several logical volumes. In this |
|---|
| 680 |
* situation, a GVolumeMonitor implementation would create two |
|---|
| 681 |
* GVolume objects (for example, one for the camera functionality of |
|---|
| 682 |
* the device and one for a SD card reader on the device) with |
|---|
| 683 |
* activation URIs gphoto2://[usb:001,002]/store1/ |
|---|
| 684 |
* and gphoto2://[usb:001,002]/store2/. When the |
|---|
| 685 |
* underlying mount (with root |
|---|
| 686 |
* gphoto2://[usb:001,002]/) is mounted, said |
|---|
| 687 |
* GVolumeMonitor implementation would create two GMount objects |
|---|
| 688 |
* (each with their root matching the corresponding volume activation |
|---|
| 689 |
* root) that would shadow the original mount. |
|---|
| 690 |
* The proxy monitor in GVfs 2.26 and later, automatically creates and |
|---|
| 691 |
* manage shadow mounts (and shadows the underlying mount) if the |
|---|
| 692 |
* activation root on a GVolume is set. |
|---|
| 693 |
* Since 2.20 |
|---|
| 694 |
* Returns: TRUE if mount is shadowed. |
|---|
| 695 |
*/ |
|---|
| 696 |
public int isShadowed() |
|---|
| 697 |
{ |
|---|
| 698 |
// gboolean g_mount_is_shadowed (GMount *mount); |
|---|
| 699 |
return g_mount_is_shadowed(getMountTStruct()); |
|---|
| 700 |
} |
|---|
| 701 |
|
|---|
| 702 |
/** |
|---|
| 703 |
* Increments the shadow count on mount. Usually used by |
|---|
| 704 |
* GVolumeMonitor implementations when creating a shadow mount for |
|---|
| 705 |
* mount, see g_mount_is_shadowed() for more information. The caller |
|---|
| 706 |
* will need to emit the "changed" signal on mount manually. |
|---|
| 707 |
* Since 2.20 |
|---|
| 708 |
*/ |
|---|
| 709 |
public void shadow() |
|---|
| 710 |
{ |
|---|
| 711 |
// void g_mount_shadow (GMount *mount); |
|---|
| 712 |
g_mount_shadow(getMountTStruct()); |
|---|
| 713 |
} |
|---|
| 714 |
|
|---|
| 715 |
/** |
|---|
| 716 |
* Decrements the shadow count on mount. Usually used by |
|---|
| 717 |
* GVolumeMonitor implementations when destroying a shadow mount for |
|---|
| 718 |
* mount, see g_mount_is_shadowed() for more information. The caller |
|---|
| 719 |
* will need to emit the "changed" signal on mount manually. |
|---|
| 720 |
* Since 2.20 |
|---|
| 721 |
* Signal Details |
|---|
| 722 |
* The "changed" signal |
|---|
| 723 |
* void user_function (GMount *mount, |
|---|
| 724 |
* gpointer user_data) : Run Last |
|---|
| 725 |
* Emitted when the mount has been changed. |
|---|
| 726 |
*/ |
|---|
| 727 |
public void unshadow() |
|---|
| 728 |
{ |
|---|
| 729 |
// void g_mount_unshadow (GMount *mount); |
|---|
| 730 |
g_mount_unshadow(getMountTStruct()); |
|---|
| 731 |
} |
|---|
| 732 |
} |
|---|