| 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 = GVolumeMonitor.html |
|---|
| 27 |
* outPack = gio |
|---|
| 28 |
* outFile = VolumeMonitor |
|---|
| 29 |
* strct = GVolumeMonitor |
|---|
| 30 |
* realStrct= |
|---|
| 31 |
* ctorStrct= |
|---|
| 32 |
* clss = VolumeMonitor |
|---|
| 33 |
* interf = |
|---|
| 34 |
* class Code: Yes |
|---|
| 35 |
* interface Code: No |
|---|
| 36 |
* template for: |
|---|
| 37 |
* extend = |
|---|
| 38 |
* implements: |
|---|
| 39 |
* prefixes: |
|---|
| 40 |
* - g_volume_monitor_ |
|---|
| 41 |
* omit structs: |
|---|
| 42 |
* omit prefixes: |
|---|
| 43 |
* omit code: |
|---|
| 44 |
* - g_volume_monitor_get |
|---|
| 45 |
* omit signals: |
|---|
| 46 |
* imports: |
|---|
| 47 |
* - glib.Str |
|---|
| 48 |
* - glib.ListG |
|---|
| 49 |
* - gio.Drive |
|---|
| 50 |
* - gio.DriveIF |
|---|
| 51 |
* - gio.Mount |
|---|
| 52 |
* - gio.MountIF |
|---|
| 53 |
* - gio.Volume |
|---|
| 54 |
* - gio.VolumeIF |
|---|
| 55 |
* structWrap: |
|---|
| 56 |
* - GDrive* -> DriveIF |
|---|
| 57 |
* - GList* -> ListG |
|---|
| 58 |
* - GMount* -> MountIF |
|---|
| 59 |
* - GVolume* -> VolumeIF |
|---|
| 60 |
* - GVolumeMonitor* -> |
|---|
| 61 |
* module aliases: |
|---|
| 62 |
* local aliases: |
|---|
| 63 |
* overrides: |
|---|
| 64 |
*/ |
|---|
| 65 |
|
|---|
| 66 |
module gio.VolumeMonitor; |
|---|
| 67 |
|
|---|
| 68 |
public import gtkc.giotypes; |
|---|
| 69 |
|
|---|
| 70 |
private import gtkc.gio; |
|---|
| 71 |
private import glib.ConstructionException; |
|---|
| 72 |
|
|---|
| 73 |
private import gobject.Signals; |
|---|
| 74 |
public import gtkc.gdktypes; |
|---|
| 75 |
|
|---|
| 76 |
private import glib.Str; |
|---|
| 77 |
private import glib.ListG; |
|---|
| 78 |
private import gio.Drive; |
|---|
| 79 |
private import gio.DriveIF; |
|---|
| 80 |
private import gio.Mount; |
|---|
| 81 |
private import gio.MountIF; |
|---|
| 82 |
private import gio.Volume; |
|---|
| 83 |
private import gio.VolumeIF; |
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
private import gobject.ObjectG; |
|---|
| 88 |
|
|---|
| 89 |
/** |
|---|
| 90 |
* Description |
|---|
| 91 |
* GVolumeMonitor is for listing the user interesting devices and volumes |
|---|
| 92 |
* on the computer. In other words, what a file selector or file manager |
|---|
| 93 |
* would show in a sidebar. |
|---|
| 94 |
* GVolumeMonitor is not thread-default-context |
|---|
| 95 |
* aware, and so should not be used other than from the main |
|---|
| 96 |
* thread, with no thread-default-context active. |
|---|
| 97 |
*/ |
|---|
| 98 |
public class VolumeMonitor : ObjectG |
|---|
| 99 |
{ |
|---|
| 100 |
|
|---|
| 101 |
/** the main Gtk struct */ |
|---|
| 102 |
protected GVolumeMonitor* gVolumeMonitor; |
|---|
| 103 |
|
|---|
| 104 |
|
|---|
| 105 |
public GVolumeMonitor* getVolumeMonitorStruct() |
|---|
| 106 |
{ |
|---|
| 107 |
return gVolumeMonitor; |
|---|
| 108 |
} |
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 |
/** the main Gtk struct as a void* */ |
|---|
| 112 |
protected override void* getStruct() |
|---|
| 113 |
{ |
|---|
| 114 |
return cast(void*)gVolumeMonitor; |
|---|
| 115 |
} |
|---|
| 116 |
|
|---|
| 117 |
/** |
|---|
| 118 |
* Sets our main struct and passes it to the parent class |
|---|
| 119 |
*/ |
|---|
| 120 |
public this (GVolumeMonitor* gVolumeMonitor) |
|---|
| 121 |
{ |
|---|
| 122 |
if(gVolumeMonitor is null) |
|---|
| 123 |
{ |
|---|
| 124 |
this = null; |
|---|
| 125 |
return; |
|---|
| 126 |
} |
|---|
| 127 |
//Check if there already is a D object for this gtk struct |
|---|
| 128 |
void* ptr = getDObject(cast(GObject*)gVolumeMonitor); |
|---|
| 129 |
if( ptr !is null ) |
|---|
| 130 |
{ |
|---|
| 131 |
this = cast(VolumeMonitor)ptr; |
|---|
| 132 |
return; |
|---|
| 133 |
} |
|---|
| 134 |
super(cast(GObject*)gVolumeMonitor); |
|---|
| 135 |
this.gVolumeMonitor = gVolumeMonitor; |
|---|
| 136 |
} |
|---|
| 137 |
|
|---|
| 138 |
protected override void setStruct(GObject* obj) |
|---|
| 139 |
{ |
|---|
| 140 |
super.setStruct(obj); |
|---|
| 141 |
gVolumeMonitor = cast(GVolumeMonitor*)obj; |
|---|
| 142 |
} |
|---|
| 143 |
|
|---|
| 144 |
/** |
|---|
| 145 |
* Gets the volume monitor used by gio. |
|---|
| 146 |
* Throws: ConstructionException GTK+ fails to create the object. |
|---|
| 147 |
*/ |
|---|
| 148 |
public this() |
|---|
| 149 |
{ |
|---|
| 150 |
// GVolumeMonitor* g_volume_monitor_get (void); |
|---|
| 151 |
auto p = g_volume_monitor_get(); |
|---|
| 152 |
if(p is null) |
|---|
| 153 |
{ |
|---|
| 154 |
throw new ConstructionException("g_volume_monitor_get()"); |
|---|
| 155 |
} |
|---|
| 156 |
this(cast(GVolumeMonitor*) p); |
|---|
| 157 |
} |
|---|
| 158 |
|
|---|
| 159 |
/** |
|---|
| 160 |
*/ |
|---|
| 161 |
int[string] connectedSignals; |
|---|
| 162 |
|
|---|
| 163 |
void delegate(DriveIF, VolumeMonitor)[] onDriveChangedListeners; |
|---|
| 164 |
/** |
|---|
| 165 |
* Emitted when a drive changes. |
|---|
| 166 |
*/ |
|---|
| 167 |
void addOnDriveChanged(void delegate(DriveIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 168 |
{ |
|---|
| 169 |
if ( !("drive-changed" in connectedSignals) ) |
|---|
| 170 |
{ |
|---|
| 171 |
Signals.connectData( |
|---|
| 172 |
getStruct(), |
|---|
| 173 |
"drive-changed", |
|---|
| 174 |
cast(GCallback)&callBackDriveChanged, |
|---|
| 175 |
cast(void*)this, |
|---|
| 176 |
null, |
|---|
| 177 |
connectFlags); |
|---|
| 178 |
connectedSignals["drive-changed"] = 1; |
|---|
| 179 |
} |
|---|
| 180 |
onDriveChangedListeners ~= dlg; |
|---|
| 181 |
} |
|---|
| 182 |
extern(C) static void callBackDriveChanged(GVolumeMonitor* volumeMonitorStruct, GDrive* drive, VolumeMonitor volumeMonitor) |
|---|
| 183 |
{ |
|---|
| 184 |
foreach ( void delegate(DriveIF, VolumeMonitor) dlg ; volumeMonitor.onDriveChangedListeners ) |
|---|
| 185 |
{ |
|---|
| 186 |
dlg(new Drive(drive), volumeMonitor); |
|---|
| 187 |
} |
|---|
| 188 |
} |
|---|
| 189 |
|
|---|
| 190 |
void delegate(DriveIF, VolumeMonitor)[] onDriveConnectedListeners; |
|---|
| 191 |
/** |
|---|
| 192 |
* Emitted when a drive is connected to the system. |
|---|
| 193 |
*/ |
|---|
| 194 |
void addOnDriveConnected(void delegate(DriveIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 195 |
{ |
|---|
| 196 |
if ( !("drive-connected" in connectedSignals) ) |
|---|
| 197 |
{ |
|---|
| 198 |
Signals.connectData( |
|---|
| 199 |
getStruct(), |
|---|
| 200 |
"drive-connected", |
|---|
| 201 |
cast(GCallback)&callBackDriveConnected, |
|---|
| 202 |
cast(void*)this, |
|---|
| 203 |
null, |
|---|
| 204 |
connectFlags); |
|---|
| 205 |
connectedSignals["drive-connected"] = 1; |
|---|
| 206 |
} |
|---|
| 207 |
onDriveConnectedListeners ~= dlg; |
|---|
| 208 |
} |
|---|
| 209 |
extern(C) static void callBackDriveConnected(GVolumeMonitor* volumeMonitorStruct, GDrive* drive, VolumeMonitor volumeMonitor) |
|---|
| 210 |
{ |
|---|
| 211 |
foreach ( void delegate(DriveIF, VolumeMonitor) dlg ; volumeMonitor.onDriveConnectedListeners ) |
|---|
| 212 |
{ |
|---|
| 213 |
dlg(new Drive(drive), volumeMonitor); |
|---|
| 214 |
} |
|---|
| 215 |
} |
|---|
| 216 |
|
|---|
| 217 |
void delegate(DriveIF, VolumeMonitor)[] onDriveDisconnectedListeners; |
|---|
| 218 |
/** |
|---|
| 219 |
* Emitted when a drive is disconnected from the system. |
|---|
| 220 |
*/ |
|---|
| 221 |
void addOnDriveDisconnected(void delegate(DriveIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 222 |
{ |
|---|
| 223 |
if ( !("drive-disconnected" in connectedSignals) ) |
|---|
| 224 |
{ |
|---|
| 225 |
Signals.connectData( |
|---|
| 226 |
getStruct(), |
|---|
| 227 |
"drive-disconnected", |
|---|
| 228 |
cast(GCallback)&callBackDriveDisconnected, |
|---|
| 229 |
cast(void*)this, |
|---|
| 230 |
null, |
|---|
| 231 |
connectFlags); |
|---|
| 232 |
connectedSignals["drive-disconnected"] = 1; |
|---|
| 233 |
} |
|---|
| 234 |
onDriveDisconnectedListeners ~= dlg; |
|---|
| 235 |
} |
|---|
| 236 |
extern(C) static void callBackDriveDisconnected(GVolumeMonitor* volumeMonitorStruct, GDrive* drive, VolumeMonitor volumeMonitor) |
|---|
| 237 |
{ |
|---|
| 238 |
foreach ( void delegate(DriveIF, VolumeMonitor) dlg ; volumeMonitor.onDriveDisconnectedListeners ) |
|---|
| 239 |
{ |
|---|
| 240 |
dlg(new Drive(drive), volumeMonitor); |
|---|
| 241 |
} |
|---|
| 242 |
} |
|---|
| 243 |
|
|---|
| 244 |
void delegate(DriveIF, VolumeMonitor)[] onDriveEjectButtonListeners; |
|---|
| 245 |
/** |
|---|
| 246 |
* Emitted when the eject button is pressed on drive. |
|---|
| 247 |
* Since 2.18 |
|---|
| 248 |
*/ |
|---|
| 249 |
void addOnDriveEjectButton(void delegate(DriveIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 250 |
{ |
|---|
| 251 |
if ( !("drive-eject-button" in connectedSignals) ) |
|---|
| 252 |
{ |
|---|
| 253 |
Signals.connectData( |
|---|
| 254 |
getStruct(), |
|---|
| 255 |
"drive-eject-button", |
|---|
| 256 |
cast(GCallback)&callBackDriveEjectButton, |
|---|
| 257 |
cast(void*)this, |
|---|
| 258 |
null, |
|---|
| 259 |
connectFlags); |
|---|
| 260 |
connectedSignals["drive-eject-button"] = 1; |
|---|
| 261 |
} |
|---|
| 262 |
onDriveEjectButtonListeners ~= dlg; |
|---|
| 263 |
} |
|---|
| 264 |
extern(C) static void callBackDriveEjectButton(GVolumeMonitor* volumeMonitorStruct, GDrive* drive, VolumeMonitor volumeMonitor) |
|---|
| 265 |
{ |
|---|
| 266 |
foreach ( void delegate(DriveIF, VolumeMonitor) dlg ; volumeMonitor.onDriveEjectButtonListeners ) |
|---|
| 267 |
{ |
|---|
| 268 |
dlg(new Drive(drive), volumeMonitor); |
|---|
| 269 |
} |
|---|
| 270 |
} |
|---|
| 271 |
|
|---|
| 272 |
void delegate(DriveIF, VolumeMonitor)[] onDriveStopButtonListeners; |
|---|
| 273 |
/** |
|---|
| 274 |
* Emitted when the stop button is pressed on drive. |
|---|
| 275 |
* Since 2.22 |
|---|
| 276 |
*/ |
|---|
| 277 |
void addOnDriveStopButton(void delegate(DriveIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 278 |
{ |
|---|
| 279 |
if ( !("drive-stop-button" in connectedSignals) ) |
|---|
| 280 |
{ |
|---|
| 281 |
Signals.connectData( |
|---|
| 282 |
getStruct(), |
|---|
| 283 |
"drive-stop-button", |
|---|
| 284 |
cast(GCallback)&callBackDriveStopButton, |
|---|
| 285 |
cast(void*)this, |
|---|
| 286 |
null, |
|---|
| 287 |
connectFlags); |
|---|
| 288 |
connectedSignals["drive-stop-button"] = 1; |
|---|
| 289 |
} |
|---|
| 290 |
onDriveStopButtonListeners ~= dlg; |
|---|
| 291 |
} |
|---|
| 292 |
extern(C) static void callBackDriveStopButton(GVolumeMonitor* volumeMonitorStruct, GDrive* drive, VolumeMonitor volumeMonitor) |
|---|
| 293 |
{ |
|---|
| 294 |
foreach ( void delegate(DriveIF, VolumeMonitor) dlg ; volumeMonitor.onDriveStopButtonListeners ) |
|---|
| 295 |
{ |
|---|
| 296 |
dlg(new Drive(drive), volumeMonitor); |
|---|
| 297 |
} |
|---|
| 298 |
} |
|---|
| 299 |
|
|---|
| 300 |
void delegate(MountIF, VolumeMonitor)[] onMountAddedListeners; |
|---|
| 301 |
/** |
|---|
| 302 |
* Emitted when a mount is added. |
|---|
| 303 |
*/ |
|---|
| 304 |
void addOnMountAdded(void delegate(MountIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 305 |
{ |
|---|
| 306 |
if ( !("mount-added" in connectedSignals) ) |
|---|
| 307 |
{ |
|---|
| 308 |
Signals.connectData( |
|---|
| 309 |
getStruct(), |
|---|
| 310 |
"mount-added", |
|---|
| 311 |
cast(GCallback)&callBackMountAdded, |
|---|
| 312 |
cast(void*)this, |
|---|
| 313 |
null, |
|---|
| 314 |
connectFlags); |
|---|
| 315 |
connectedSignals["mount-added"] = 1; |
|---|
| 316 |
} |
|---|
| 317 |
onMountAddedListeners ~= dlg; |
|---|
| 318 |
} |
|---|
| 319 |
extern(C) static void callBackMountAdded(GVolumeMonitor* volumeMonitorStruct, GMount* mount, VolumeMonitor volumeMonitor) |
|---|
| 320 |
{ |
|---|
| 321 |
foreach ( void delegate(MountIF, VolumeMonitor) dlg ; volumeMonitor.onMountAddedListeners ) |
|---|
| 322 |
{ |
|---|
| 323 |
dlg(new Mount(mount), volumeMonitor); |
|---|
| 324 |
} |
|---|
| 325 |
} |
|---|
| 326 |
|
|---|
| 327 |
void delegate(MountIF, VolumeMonitor)[] onMountChangedListeners; |
|---|
| 328 |
/** |
|---|
| 329 |
* Emitted when a mount changes. |
|---|
| 330 |
*/ |
|---|
| 331 |
void addOnMountChanged(void delegate(MountIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 332 |
{ |
|---|
| 333 |
if ( !("mount-changed" in connectedSignals) ) |
|---|
| 334 |
{ |
|---|
| 335 |
Signals.connectData( |
|---|
| 336 |
getStruct(), |
|---|
| 337 |
"mount-changed", |
|---|
| 338 |
cast(GCallback)&callBackMountChanged, |
|---|
| 339 |
cast(void*)this, |
|---|
| 340 |
null, |
|---|
| 341 |
connectFlags); |
|---|
| 342 |
connectedSignals["mount-changed"] = 1; |
|---|
| 343 |
} |
|---|
| 344 |
onMountChangedListeners ~= dlg; |
|---|
| 345 |
} |
|---|
| 346 |
extern(C) static void callBackMountChanged(GVolumeMonitor* volumeMonitorStruct, GMount* mount, VolumeMonitor volumeMonitor) |
|---|
| 347 |
{ |
|---|
| 348 |
foreach ( void delegate(MountIF, VolumeMonitor) dlg ; volumeMonitor.onMountChangedListeners ) |
|---|
| 349 |
{ |
|---|
| 350 |
dlg(new Mount(mount), volumeMonitor); |
|---|
| 351 |
} |
|---|
| 352 |
} |
|---|
| 353 |
|
|---|
| 354 |
void delegate(MountIF, VolumeMonitor)[] onMountPreUnmountListeners; |
|---|
| 355 |
/** |
|---|
| 356 |
* Emitted when a mount is about to be removed. |
|---|
| 357 |
*/ |
|---|
| 358 |
void addOnMountPreUnmount(void delegate(MountIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 359 |
{ |
|---|
| 360 |
if ( !("mount-pre-unmount" in connectedSignals) ) |
|---|
| 361 |
{ |
|---|
| 362 |
Signals.connectData( |
|---|
| 363 |
getStruct(), |
|---|
| 364 |
"mount-pre-unmount", |
|---|
| 365 |
cast(GCallback)&callBackMountPreUnmount, |
|---|
| 366 |
cast(void*)this, |
|---|
| 367 |
null, |
|---|
| 368 |
connectFlags); |
|---|
| 369 |
connectedSignals["mount-pre-unmount"] = 1; |
|---|
| 370 |
} |
|---|
| 371 |
onMountPreUnmountListeners ~= dlg; |
|---|
| 372 |
} |
|---|
| 373 |
extern(C) static void callBackMountPreUnmount(GVolumeMonitor* volumeMonitorStruct, GMount* mount, VolumeMonitor volumeMonitor) |
|---|
| 374 |
{ |
|---|
| 375 |
foreach ( void delegate(MountIF, VolumeMonitor) dlg ; volumeMonitor.onMountPreUnmountListeners ) |
|---|
| 376 |
{ |
|---|
| 377 |
dlg(new Mount(mount), volumeMonitor); |
|---|
| 378 |
} |
|---|
| 379 |
} |
|---|
| 380 |
|
|---|
| 381 |
void delegate(MountIF, VolumeMonitor)[] onMountRemovedListeners; |
|---|
| 382 |
/** |
|---|
| 383 |
* Emitted when a mount is removed. |
|---|
| 384 |
*/ |
|---|
| 385 |
void addOnMountRemoved(void delegate(MountIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 386 |
{ |
|---|
| 387 |
if ( !("mount-removed" in connectedSignals) ) |
|---|
| 388 |
{ |
|---|
| 389 |
Signals.connectData( |
|---|
| 390 |
getStruct(), |
|---|
| 391 |
"mount-removed", |
|---|
| 392 |
cast(GCallback)&callBackMountRemoved, |
|---|
| 393 |
cast(void*)this, |
|---|
| 394 |
null, |
|---|
| 395 |
connectFlags); |
|---|
| 396 |
connectedSignals["mount-removed"] = 1; |
|---|
| 397 |
} |
|---|
| 398 |
onMountRemovedListeners ~= dlg; |
|---|
| 399 |
} |
|---|
| 400 |
extern(C) static void callBackMountRemoved(GVolumeMonitor* volumeMonitorStruct, GMount* mount, VolumeMonitor volumeMonitor) |
|---|
| 401 |
{ |
|---|
| 402 |
foreach ( void delegate(MountIF, VolumeMonitor) dlg ; volumeMonitor.onMountRemovedListeners ) |
|---|
| 403 |
{ |
|---|
| 404 |
dlg(new Mount(mount), volumeMonitor); |
|---|
| 405 |
} |
|---|
| 406 |
} |
|---|
| 407 |
|
|---|
| 408 |
void delegate(VolumeIF, VolumeMonitor)[] onVolumeAddedListeners; |
|---|
| 409 |
/** |
|---|
| 410 |
* Emitted when a mountable volume is added to the system. |
|---|
| 411 |
*/ |
|---|
| 412 |
void addOnVolumeAdded(void delegate(VolumeIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 413 |
{ |
|---|
| 414 |
if ( !("volume-added" in connectedSignals) ) |
|---|
| 415 |
{ |
|---|
| 416 |
Signals.connectData( |
|---|
| 417 |
getStruct(), |
|---|
| 418 |
"volume-added", |
|---|
| 419 |
cast(GCallback)&callBackVolumeAdded, |
|---|
| 420 |
cast(void*)this, |
|---|
| 421 |
null, |
|---|
| 422 |
connectFlags); |
|---|
| 423 |
connectedSignals["volume-added"] = 1; |
|---|
| 424 |
} |
|---|
| 425 |
onVolumeAddedListeners ~= dlg; |
|---|
| 426 |
} |
|---|
| 427 |
extern(C) static void callBackVolumeAdded(GVolumeMonitor* volumeMonitorStruct, GVolume* volume, VolumeMonitor volumeMonitor) |
|---|
| 428 |
{ |
|---|
| 429 |
foreach ( void delegate(VolumeIF, VolumeMonitor) dlg ; volumeMonitor.onVolumeAddedListeners ) |
|---|
| 430 |
{ |
|---|
| 431 |
dlg(new Volume(volume), volumeMonitor); |
|---|
| 432 |
} |
|---|
| 433 |
} |
|---|
| 434 |
|
|---|
| 435 |
void delegate(VolumeIF, VolumeMonitor)[] onVolumeChangedListeners; |
|---|
| 436 |
/** |
|---|
| 437 |
* Emitted when mountable volume is changed. |
|---|
| 438 |
*/ |
|---|
| 439 |
void addOnVolumeChanged(void delegate(VolumeIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 440 |
{ |
|---|
| 441 |
if ( !("volume-changed" in connectedSignals) ) |
|---|
| 442 |
{ |
|---|
| 443 |
Signals.connectData( |
|---|
| 444 |
getStruct(), |
|---|
| 445 |
"volume-changed", |
|---|
| 446 |
cast(GCallback)&callBackVolumeChanged, |
|---|
| 447 |
cast(void*)this, |
|---|
| 448 |
null, |
|---|
| 449 |
connectFlags); |
|---|
| 450 |
connectedSignals["volume-changed"] = 1; |
|---|
| 451 |
} |
|---|
| 452 |
onVolumeChangedListeners ~= dlg; |
|---|
| 453 |
} |
|---|
| 454 |
extern(C) static void callBackVolumeChanged(GVolumeMonitor* volumeMonitorStruct, GVolume* volume, VolumeMonitor volumeMonitor) |
|---|
| 455 |
{ |
|---|
| 456 |
foreach ( void delegate(VolumeIF, VolumeMonitor) dlg ; volumeMonitor.onVolumeChangedListeners ) |
|---|
| 457 |
{ |
|---|
| 458 |
dlg(new Volume(volume), volumeMonitor); |
|---|
| 459 |
} |
|---|
| 460 |
} |
|---|
| 461 |
|
|---|
| 462 |
void delegate(VolumeIF, VolumeMonitor)[] onVolumeRemovedListeners; |
|---|
| 463 |
/** |
|---|
| 464 |
* Emitted when a mountable volume is removed from the system. |
|---|
| 465 |
* See Also |
|---|
| 466 |
* GFileMonitor |
|---|
| 467 |
*/ |
|---|
| 468 |
void addOnVolumeRemoved(void delegate(VolumeIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 469 |
{ |
|---|
| 470 |
if ( !("volume-removed" in connectedSignals) ) |
|---|
| 471 |
{ |
|---|
| 472 |
Signals.connectData( |
|---|
| 473 |
getStruct(), |
|---|
| 474 |
"volume-removed", |
|---|
| 475 |
cast(GCallback)&callBackVolumeRemoved, |
|---|
| 476 |
cast(void*)this, |
|---|
| 477 |
null, |
|---|
| 478 |
connectFlags); |
|---|
| 479 |
connectedSignals["volume-removed"] = 1; |
|---|
| 480 |
} |
|---|
| 481 |
onVolumeRemovedListeners ~= dlg; |
|---|
| 482 |
} |
|---|
| 483 |
extern(C) static void callBackVolumeRemoved(GVolumeMonitor* volumeMonitorStruct, GVolume* volume, VolumeMonitor volumeMonitor) |
|---|
| 484 |
{ |
|---|
| 485 |
foreach ( void delegate(VolumeIF, VolumeMonitor) dlg ; volumeMonitor.onVolumeRemovedListeners ) |
|---|
| 486 |
{ |
|---|
| 487 |
dlg(new Volume(volume), volumeMonitor); |
|---|
| 488 |
} |
|---|
| 489 |
} |
|---|
| 490 |
|
|---|
| 491 |
|
|---|
| 492 |
/** |
|---|
| 493 |
* Gets a list of drives connected to the system. |
|---|
| 494 |
* The returned list should be freed with g_list_free(), after |
|---|
| 495 |
* its elements have been unreffed with g_object_unref(). |
|---|
| 496 |
* Returns: a GList of connected GDrive objects. [element-type GDrive][transfer full] |
|---|
| 497 |
*/ |
|---|
| 498 |
public ListG getConnectedDrives() |
|---|
| 499 |
{ |
|---|
| 500 |
// GList * g_volume_monitor_get_connected_drives (GVolumeMonitor *volume_monitor); |
|---|
| 501 |
auto p = g_volume_monitor_get_connected_drives(gVolumeMonitor); |
|---|
| 502 |
if(p is null) |
|---|
| 503 |
{ |
|---|
| 504 |
return null; |
|---|
| 505 |
} |
|---|
| 506 |
return new ListG(cast(GList*) p); |
|---|
| 507 |
} |
|---|
| 508 |
|
|---|
| 509 |
/** |
|---|
| 510 |
* Gets a list of the volumes on the system. |
|---|
| 511 |
* The returned list should be freed with g_list_free(), after |
|---|
| 512 |
* its elements have been unreffed with g_object_unref(). |
|---|
| 513 |
* Returns: a GList of GVolume objects. [element-type GVolume][transfer full] |
|---|
| 514 |
*/ |
|---|
| 515 |
public ListG getVolumes() |
|---|
| 516 |
{ |
|---|
| 517 |
// GList * g_volume_monitor_get_volumes (GVolumeMonitor *volume_monitor); |
|---|
| 518 |
auto p = g_volume_monitor_get_volumes(gVolumeMonitor); |
|---|
| 519 |
if(p is null) |
|---|
| 520 |
{ |
|---|
| 521 |
return null; |
|---|
| 522 |
} |
|---|
| 523 |
return new ListG(cast(GList*) p); |
|---|
| 524 |
} |
|---|
| 525 |
|
|---|
| 526 |
/** |
|---|
| 527 |
* Gets a list of the mounts on the system. |
|---|
| 528 |
* The returned list should be freed with g_list_free(), after |
|---|
| 529 |
* its elements have been unreffed with g_object_unref(). |
|---|
| 530 |
* Returns: a GList of GMount objects. [element-type GMount][transfer full] |
|---|
| 531 |
*/ |
|---|
| 532 |
public ListG getMounts() |
|---|
| 533 |
{ |
|---|
| 534 |
// GList * g_volume_monitor_get_mounts (GVolumeMonitor *volume_monitor); |
|---|
| 535 |
auto p = g_volume_monitor_get_mounts(gVolumeMonitor); |
|---|
| 536 |
if(p is null) |
|---|
| 537 |
{ |
|---|
| 538 |
return null; |
|---|
| 539 |
} |
|---|
| 540 |
return new ListG(cast(GList*) p); |
|---|
| 541 |
} |
|---|
| 542 |
|
|---|
| 543 |
/** |
|---|
| 544 |
* Warning |
|---|
| 545 |
* g_volume_monitor_adopt_orphan_mount has been deprecated since version 2.20 and should not be used in newly-written code. Instead of using this function, GVolumeMonitor |
|---|
| 546 |
* implementations should instead create shadow mounts with the URI of |
|---|
| 547 |
* the mount they intend to adopt. See the proxy volume monitor in |
|---|
| 548 |
* gvfs for an example of this. Also see g_mount_is_shadowed(), |
|---|
| 549 |
* g_mount_shadow() and g_mount_unshadow() functions. |
|---|
| 550 |
* This function should be called by any GVolumeMonitor |
|---|
| 551 |
* implementation when a new GMount object is created that is not |
|---|
| 552 |
* associated with a GVolume object. It must be called just before |
|---|
| 553 |
* emitting the mount_added signal. |
|---|
| 554 |
* If the return value is not NULL, the caller must associate the |
|---|
| 555 |
* returned GVolume object with the GMount. This involves returning |
|---|
| 556 |
* it in its g_mount_get_volume() implementation. The caller must |
|---|
| 557 |
* also listen for the "removed" signal on the returned object |
|---|
| 558 |
* and give up its reference when handling that signal |
|---|
| 559 |
* Similary, if implementing g_volume_monitor_adopt_orphan_mount(), |
|---|
| 560 |
* the implementor must take a reference to mount and return it in |
|---|
| 561 |
* its g_volume_get_mount() implemented. Also, the implementor must |
|---|
| 562 |
* listen for the "unmounted" signal on mount and give up its |
|---|
| 563 |
* reference upon handling that signal. |
|---|
| 564 |
* There are two main use cases for this function. |
|---|
| 565 |
* One is when implementing a user space file system driver that reads |
|---|
| 566 |
* blocks of a block device that is already represented by the native |
|---|
| 567 |
* volume monitor (for example a CD Audio file system driver). Such |
|---|
| 568 |
* a driver will generate its own GMount object that needs to be |
|---|
| 569 |
* assoicated with the GVolume object that represents the volume. |
|---|
| 570 |
* The other is for implementing a GVolumeMonitor whose sole purpose |
|---|
| 571 |
* is to return GVolume objects representing entries in the users |
|---|
| 572 |
* "favorite servers" list or similar. |
|---|
| 573 |
* Params: |
|---|
| 574 |
* mount = a GMount object to find a parent for |
|---|
| 575 |
* Returns: the GVolume object that is the parent for mount or NULL if no wants to adopt the GMount. [transfer full] |
|---|
| 576 |
*/ |
|---|
| 577 |
public static VolumeIF adoptOrphanMount(MountIF mount) |
|---|
| 578 |
{ |
|---|
| 579 |
// GVolume * g_volume_monitor_adopt_orphan_mount (GMount *mount); |
|---|
| 580 |
auto p = g_volume_monitor_adopt_orphan_mount((mount is null) ? null : mount.getMountTStruct()); |
|---|
| 581 |
if(p is null) |
|---|
| 582 |
{ |
|---|
| 583 |
return null; |
|---|
| 584 |
} |
|---|
| 585 |
return new Volume(cast(GVolume*) p); |
|---|
| 586 |
} |
|---|
| 587 |
|
|---|
| 588 |
/** |
|---|
| 589 |
* Finds a GMount object by its UUID (see g_mount_get_uuid()) |
|---|
| 590 |
* Params: |
|---|
| 591 |
* uuid = the UUID to look for |
|---|
| 592 |
* Returns: a GMount or NULL if no such mount is available. Free the returned object with g_object_unref(). [transfer full] |
|---|
| 593 |
*/ |
|---|
| 594 |
public MountIF getMountForUuid(string uuid) |
|---|
| 595 |
{ |
|---|
| 596 |
// GMount * g_volume_monitor_get_mount_for_uuid (GVolumeMonitor *volume_monitor, const char *uuid); |
|---|
| 597 |
auto p = g_volume_monitor_get_mount_for_uuid(gVolumeMonitor, Str.toStringz(uuid)); |
|---|
| 598 |
if(p is null) |
|---|
| 599 |
{ |
|---|
| 600 |
return null; |
|---|
| 601 |
} |
|---|
| 602 |
return new Mount(cast(GMount*) p); |
|---|
| 603 |
} |
|---|
| 604 |
|
|---|
| 605 |
/** |
|---|
| 606 |
* Finds a GVolume object by its UUID (see g_volume_get_uuid()) |
|---|
| 607 |
* Params: |
|---|
| 608 |
* uuid = the UUID to look for |
|---|
| 609 |
* Returns: a GVolume or NULL if no such volume is available. Free the returned object with g_object_unref(). [transfer full] Signal Details The "drive-changed" signal void user_function (GVolumeMonitor *volume_monitor, GDrive *drive, gpointer user_data) : Run Last Emitted when a drive changes. |
|---|
| 610 |
*/ |
|---|
| 611 |
public VolumeIF getVolumeForUuid(string uuid) |
|---|
| 612 |
{ |
|---|
| 613 |
// GVolume * g_volume_monitor_get_volume_for_uuid (GVolumeMonitor *volume_monitor, const char *uuid); |
|---|
| 614 |
auto p = g_volume_monitor_get_volume_for_uuid(gVolumeMonitor, Str.toStringz(uuid)); |
|---|
| 615 |
if(p is null) |
|---|
| 616 |
{ |
|---|
| 617 |
return null; |
|---|
| 618 |
} |
|---|
| 619 |
return new Volume(cast(GVolume*) p); |
|---|
| 620 |
} |
|---|
| 621 |
} |
|---|