| 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 = GMountOperation.html |
|---|
| 27 |
* outPack = gio |
|---|
| 28 |
* outFile = MountOperation |
|---|
| 29 |
* strct = GMountOperation |
|---|
| 30 |
* realStrct= |
|---|
| 31 |
* ctorStrct= |
|---|
| 32 |
* clss = MountOperation |
|---|
| 33 |
* interf = |
|---|
| 34 |
* class Code: No |
|---|
| 35 |
* interface Code: No |
|---|
| 36 |
* template for: |
|---|
| 37 |
* extend = GObject |
|---|
| 38 |
* implements: |
|---|
| 39 |
* prefixes: |
|---|
| 40 |
* - g_mount_operation_ |
|---|
| 41 |
* omit structs: |
|---|
| 42 |
* omit prefixes: |
|---|
| 43 |
* omit code: |
|---|
| 44 |
* omit signals: |
|---|
| 45 |
* imports: |
|---|
| 46 |
* - glib.Str |
|---|
| 47 |
* - glib.ArrayG |
|---|
| 48 |
* structWrap: |
|---|
| 49 |
* - GArray* -> ArrayG |
|---|
| 50 |
* module aliases: |
|---|
| 51 |
* local aliases: |
|---|
| 52 |
* overrides: |
|---|
| 53 |
*/ |
|---|
| 54 |
|
|---|
| 55 |
module gio.MountOperation; |
|---|
| 56 |
|
|---|
| 57 |
public import gtkc.giotypes; |
|---|
| 58 |
|
|---|
| 59 |
private import gtkc.gio; |
|---|
| 60 |
private import glib.ConstructionException; |
|---|
| 61 |
|
|---|
| 62 |
private import gobject.Signals; |
|---|
| 63 |
public import gtkc.gdktypes; |
|---|
| 64 |
|
|---|
| 65 |
private import glib.Str; |
|---|
| 66 |
private import glib.ArrayG; |
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
private import gobject.ObjectG; |
|---|
| 71 |
|
|---|
| 72 |
/** |
|---|
| 73 |
* Description |
|---|
| 74 |
* GMountOperation provides a mechanism for interacting with the user. |
|---|
| 75 |
* It can be used for authenticating mountable operations, such as loop |
|---|
| 76 |
* mounting files, hard drive partitions or server locations. It can |
|---|
| 77 |
* also be used to ask the user questions or show a list of applications |
|---|
| 78 |
* preventing unmount or eject operations from completing. |
|---|
| 79 |
* Note that GMountOperation is used for more than just GMount |
|---|
| 80 |
* objects â for example it is also used in g_drive_start() and |
|---|
| 81 |
* g_drive_stop(). |
|---|
| 82 |
* Users should instantiate a subclass of this that implements all the |
|---|
| 83 |
* various callbacks to show the required dialogs, such as |
|---|
| 84 |
* GtkMountOperation. If no user interaction is desired (for example |
|---|
| 85 |
* when automounting filesystems at login time), usually NULL can be |
|---|
| 86 |
* passed, see each method taking a GMountOperation for details. |
|---|
| 87 |
*/ |
|---|
| 88 |
public class MountOperation : ObjectG |
|---|
| 89 |
{ |
|---|
| 90 |
|
|---|
| 91 |
/** the main Gtk struct */ |
|---|
| 92 |
protected GMountOperation* gMountOperation; |
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
public GMountOperation* getMountOperationStruct() |
|---|
| 96 |
{ |
|---|
| 97 |
return gMountOperation; |
|---|
| 98 |
} |
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 |
/** the main Gtk struct as a void* */ |
|---|
| 102 |
protected override void* getStruct() |
|---|
| 103 |
{ |
|---|
| 104 |
return cast(void*)gMountOperation; |
|---|
| 105 |
} |
|---|
| 106 |
|
|---|
| 107 |
/** |
|---|
| 108 |
* Sets our main struct and passes it to the parent class |
|---|
| 109 |
*/ |
|---|
| 110 |
public this (GMountOperation* gMountOperation) |
|---|
| 111 |
{ |
|---|
| 112 |
if(gMountOperation is null) |
|---|
| 113 |
{ |
|---|
| 114 |
this = null; |
|---|
| 115 |
return; |
|---|
| 116 |
} |
|---|
| 117 |
//Check if there already is a D object for this gtk struct |
|---|
| 118 |
void* ptr = getDObject(cast(GObject*)gMountOperation); |
|---|
| 119 |
if( ptr !is null ) |
|---|
| 120 |
{ |
|---|
| 121 |
this = cast(MountOperation)ptr; |
|---|
| 122 |
return; |
|---|
| 123 |
} |
|---|
| 124 |
super(cast(GObject*)gMountOperation); |
|---|
| 125 |
this.gMountOperation = gMountOperation; |
|---|
| 126 |
} |
|---|
| 127 |
|
|---|
| 128 |
protected override void setStruct(GObject* obj) |
|---|
| 129 |
{ |
|---|
| 130 |
super.setStruct(obj); |
|---|
| 131 |
gMountOperation = cast(GMountOperation*)obj; |
|---|
| 132 |
} |
|---|
| 133 |
|
|---|
| 134 |
/** |
|---|
| 135 |
*/ |
|---|
| 136 |
int[string] connectedSignals; |
|---|
| 137 |
|
|---|
| 138 |
void delegate(MountOperation)[] onAbortedListeners; |
|---|
| 139 |
/** |
|---|
| 140 |
* Emitted by the backend when e.g. a device becomes unavailable |
|---|
| 141 |
* while a mount operation is in progress. |
|---|
| 142 |
* Implementations of GMountOperation should handle this signal |
|---|
| 143 |
* by dismissing open password dialogs. |
|---|
| 144 |
* Since 2.20 |
|---|
| 145 |
*/ |
|---|
| 146 |
void addOnAborted(void delegate(MountOperation) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 147 |
{ |
|---|
| 148 |
if ( !("aborted" in connectedSignals) ) |
|---|
| 149 |
{ |
|---|
| 150 |
Signals.connectData( |
|---|
| 151 |
getStruct(), |
|---|
| 152 |
"aborted", |
|---|
| 153 |
cast(GCallback)&callBackAborted, |
|---|
| 154 |
cast(void*)this, |
|---|
| 155 |
null, |
|---|
| 156 |
connectFlags); |
|---|
| 157 |
connectedSignals["aborted"] = 1; |
|---|
| 158 |
} |
|---|
| 159 |
onAbortedListeners ~= dlg; |
|---|
| 160 |
} |
|---|
| 161 |
extern(C) static void callBackAborted(GMountOperation* arg0Struct, MountOperation mountOperation) |
|---|
| 162 |
{ |
|---|
| 163 |
foreach ( void delegate(MountOperation) dlg ; mountOperation.onAbortedListeners ) |
|---|
| 164 |
{ |
|---|
| 165 |
dlg(mountOperation); |
|---|
| 166 |
} |
|---|
| 167 |
} |
|---|
| 168 |
|
|---|
| 169 |
void delegate(string, string, string, GAskPasswordFlags, MountOperation)[] onAskPasswordListeners; |
|---|
| 170 |
/** |
|---|
| 171 |
* Emitted when a mount operation asks the user for a password. |
|---|
| 172 |
* If the message contains a line break, the first line should be |
|---|
| 173 |
* presented as a heading. For example, it may be used as the |
|---|
| 174 |
* primary text in a GtkMessageDialog. |
|---|
| 175 |
*/ |
|---|
| 176 |
void addOnAskPassword(void delegate(string, string, string, GAskPasswordFlags, MountOperation) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 177 |
{ |
|---|
| 178 |
if ( !("ask-password" in connectedSignals) ) |
|---|
| 179 |
{ |
|---|
| 180 |
Signals.connectData( |
|---|
| 181 |
getStruct(), |
|---|
| 182 |
"ask-password", |
|---|
| 183 |
cast(GCallback)&callBackAskPassword, |
|---|
| 184 |
cast(void*)this, |
|---|
| 185 |
null, |
|---|
| 186 |
connectFlags); |
|---|
| 187 |
connectedSignals["ask-password"] = 1; |
|---|
| 188 |
} |
|---|
| 189 |
onAskPasswordListeners ~= dlg; |
|---|
| 190 |
} |
|---|
| 191 |
extern(C) static void callBackAskPassword(GMountOperation* opStruct, gchar* message, gchar* defaultUser, gchar* defaultDomain, GAskPasswordFlags flags, MountOperation mountOperation) |
|---|
| 192 |
{ |
|---|
| 193 |
foreach ( void delegate(string, string, string, GAskPasswordFlags, MountOperation) dlg ; mountOperation.onAskPasswordListeners ) |
|---|
| 194 |
{ |
|---|
| 195 |
dlg(Str.toString(message), Str.toString(defaultUser), Str.toString(defaultDomain), flags, mountOperation); |
|---|
| 196 |
} |
|---|
| 197 |
} |
|---|
| 198 |
|
|---|
| 199 |
void delegate(string, GStrv, MountOperation)[] onAskQuestionListeners; |
|---|
| 200 |
/** |
|---|
| 201 |
* Emitted when asking the user a question and gives a list of |
|---|
| 202 |
* choices for the user to choose from. |
|---|
| 203 |
* If the message contains a line break, the first line should be |
|---|
| 204 |
* presented as a heading. For example, it may be used as the |
|---|
| 205 |
* primary text in a GtkMessageDialog. |
|---|
| 206 |
*/ |
|---|
| 207 |
void addOnAskQuestion(void delegate(string, GStrv, MountOperation) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 208 |
{ |
|---|
| 209 |
if ( !("ask-question" in connectedSignals) ) |
|---|
| 210 |
{ |
|---|
| 211 |
Signals.connectData( |
|---|
| 212 |
getStruct(), |
|---|
| 213 |
"ask-question", |
|---|
| 214 |
cast(GCallback)&callBackAskQuestion, |
|---|
| 215 |
cast(void*)this, |
|---|
| 216 |
null, |
|---|
| 217 |
connectFlags); |
|---|
| 218 |
connectedSignals["ask-question"] = 1; |
|---|
| 219 |
} |
|---|
| 220 |
onAskQuestionListeners ~= dlg; |
|---|
| 221 |
} |
|---|
| 222 |
extern(C) static void callBackAskQuestion(GMountOperation* opStruct, gchar* message, GStrv choices, MountOperation mountOperation) |
|---|
| 223 |
{ |
|---|
| 224 |
foreach ( void delegate(string, GStrv, MountOperation) dlg ; mountOperation.onAskQuestionListeners ) |
|---|
| 225 |
{ |
|---|
| 226 |
dlg(Str.toString(message), choices, mountOperation); |
|---|
| 227 |
} |
|---|
| 228 |
} |
|---|
| 229 |
|
|---|
| 230 |
void delegate(GMountOperationResult, MountOperation)[] onReplyListeners; |
|---|
| 231 |
/** |
|---|
| 232 |
* Emitted when the user has replied to the mount operation. |
|---|
| 233 |
*/ |
|---|
| 234 |
void addOnReply(void delegate(GMountOperationResult, MountOperation) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 235 |
{ |
|---|
| 236 |
if ( !("reply" in connectedSignals) ) |
|---|
| 237 |
{ |
|---|
| 238 |
Signals.connectData( |
|---|
| 239 |
getStruct(), |
|---|
| 240 |
"reply", |
|---|
| 241 |
cast(GCallback)&callBackReply, |
|---|
| 242 |
cast(void*)this, |
|---|
| 243 |
null, |
|---|
| 244 |
connectFlags); |
|---|
| 245 |
connectedSignals["reply"] = 1; |
|---|
| 246 |
} |
|---|
| 247 |
onReplyListeners ~= dlg; |
|---|
| 248 |
} |
|---|
| 249 |
extern(C) static void callBackReply(GMountOperation* opStruct, GMountOperationResult result, MountOperation mountOperation) |
|---|
| 250 |
{ |
|---|
| 251 |
foreach ( void delegate(GMountOperationResult, MountOperation) dlg ; mountOperation.onReplyListeners ) |
|---|
| 252 |
{ |
|---|
| 253 |
dlg(result, mountOperation); |
|---|
| 254 |
} |
|---|
| 255 |
} |
|---|
| 256 |
|
|---|
| 257 |
void delegate(string, ArrayG, GStrv, MountOperation)[] onShowProcessesListeners; |
|---|
| 258 |
/** |
|---|
| 259 |
* Emitted when one or more processes are blocking an operation |
|---|
| 260 |
* e.g. unmounting/ejecting a GMount or stopping a GDrive. |
|---|
| 261 |
* Note that this signal may be emitted several times to update the |
|---|
| 262 |
* list of blocking processes as processes close files. The |
|---|
| 263 |
* application should only respond with g_mount_operation_reply() to |
|---|
| 264 |
* the latest signal (setting "choice" to the choice |
|---|
| 265 |
* the user made). |
|---|
| 266 |
* If the message contains a line break, the first line should be |
|---|
| 267 |
* presented as a heading. For example, it may be used as the |
|---|
| 268 |
* primary text in a GtkMessageDialog. |
|---|
| 269 |
* Since 2.22 |
|---|
| 270 |
*/ |
|---|
| 271 |
void addOnShowProcesses(void delegate(string, ArrayG, GStrv, MountOperation) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) |
|---|
| 272 |
{ |
|---|
| 273 |
if ( !("show-processes" in connectedSignals) ) |
|---|
| 274 |
{ |
|---|
| 275 |
Signals.connectData( |
|---|
| 276 |
getStruct(), |
|---|
| 277 |
"show-processes", |
|---|
| 278 |
cast(GCallback)&callBackShowProcesses, |
|---|
| 279 |
cast(void*)this, |
|---|
| 280 |
null, |
|---|
| 281 |
connectFlags); |
|---|
| 282 |
connectedSignals["show-processes"] = 1; |
|---|
| 283 |
} |
|---|
| 284 |
onShowProcessesListeners ~= dlg; |
|---|
| 285 |
} |
|---|
| 286 |
extern(C) static void callBackShowProcesses(GMountOperation* opStruct, gchar* message, GArray* processes, GStrv choices, MountOperation mountOperation) |
|---|
| 287 |
{ |
|---|
| 288 |
foreach ( void delegate(string, ArrayG, GStrv, MountOperation) dlg ; mountOperation.onShowProcessesListeners ) |
|---|
| 289 |
{ |
|---|
| 290 |
dlg(Str.toString(message), new ArrayG(processes), choices, mountOperation); |
|---|
| 291 |
} |
|---|
| 292 |
} |
|---|
| 293 |
|
|---|
| 294 |
|
|---|
| 295 |
/** |
|---|
| 296 |
* Creates a new mount operation. |
|---|
| 297 |
* Throws: ConstructionException GTK+ fails to create the object. |
|---|
| 298 |
*/ |
|---|
| 299 |
public this () |
|---|
| 300 |
{ |
|---|
| 301 |
// GMountOperation * g_mount_operation_new (void); |
|---|
| 302 |
auto p = g_mount_operation_new(); |
|---|
| 303 |
if(p is null) |
|---|
| 304 |
{ |
|---|
| 305 |
throw new ConstructionException("null returned by g_mount_operation_new()"); |
|---|
| 306 |
} |
|---|
| 307 |
this(cast(GMountOperation*) p); |
|---|
| 308 |
} |
|---|
| 309 |
|
|---|
| 310 |
/** |
|---|
| 311 |
* Get the user name from the mount operation. |
|---|
| 312 |
* Returns: a string containing the user name. |
|---|
| 313 |
*/ |
|---|
| 314 |
public string getUsername() |
|---|
| 315 |
{ |
|---|
| 316 |
// const char * g_mount_operation_get_username (GMountOperation *op); |
|---|
| 317 |
return Str.toString(g_mount_operation_get_username(gMountOperation)); |
|---|
| 318 |
} |
|---|
| 319 |
|
|---|
| 320 |
/** |
|---|
| 321 |
* Sets the user name within op to username. |
|---|
| 322 |
* Params: |
|---|
| 323 |
* username = input username. |
|---|
| 324 |
*/ |
|---|
| 325 |
public void setUsername(string username) |
|---|
| 326 |
{ |
|---|
| 327 |
// void g_mount_operation_set_username (GMountOperation *op, const char *username); |
|---|
| 328 |
g_mount_operation_set_username(gMountOperation, Str.toStringz(username)); |
|---|
| 329 |
} |
|---|
| 330 |
|
|---|
| 331 |
/** |
|---|
| 332 |
* Gets a password from the mount operation. |
|---|
| 333 |
* Returns: a string containing the password within op. |
|---|
| 334 |
*/ |
|---|
| 335 |
public string getPassword() |
|---|
| 336 |
{ |
|---|
| 337 |
// const char * g_mount_operation_get_password (GMountOperation *op); |
|---|
| 338 |
return Str.toString(g_mount_operation_get_password(gMountOperation)); |
|---|
| 339 |
} |
|---|
| 340 |
|
|---|
| 341 |
/** |
|---|
| 342 |
* Sets the mount operation's password to password. |
|---|
| 343 |
* Params: |
|---|
| 344 |
* password = password to set. |
|---|
| 345 |
*/ |
|---|
| 346 |
public void setPassword(string password) |
|---|
| 347 |
{ |
|---|
| 348 |
// void g_mount_operation_set_password (GMountOperation *op, const char *password); |
|---|
| 349 |
g_mount_operation_set_password(gMountOperation, Str.toStringz(password)); |
|---|
| 350 |
} |
|---|
| 351 |
|
|---|
| 352 |
/** |
|---|
| 353 |
* Check to see whether the mount operation is being used |
|---|
| 354 |
* for an anonymous user. |
|---|
| 355 |
* Returns: TRUE if mount operation is anonymous. |
|---|
| 356 |
*/ |
|---|
| 357 |
public int getAnonymous() |
|---|
| 358 |
{ |
|---|
| 359 |
// gboolean g_mount_operation_get_anonymous (GMountOperation *op); |
|---|
| 360 |
return g_mount_operation_get_anonymous(gMountOperation); |
|---|
| 361 |
} |
|---|
| 362 |
|
|---|
| 363 |
/** |
|---|
| 364 |
* Sets the mount operation to use an anonymous user if anonymous is TRUE. |
|---|
| 365 |
* Params: |
|---|
| 366 |
* anonymous = boolean value. |
|---|
| 367 |
*/ |
|---|
| 368 |
public void setAnonymous(int anonymous) |
|---|
| 369 |
{ |
|---|
| 370 |
// void g_mount_operation_set_anonymous (GMountOperation *op, gboolean anonymous); |
|---|
| 371 |
g_mount_operation_set_anonymous(gMountOperation, anonymous); |
|---|
| 372 |
} |
|---|
| 373 |
|
|---|
| 374 |
/** |
|---|
| 375 |
* Gets the domain of the mount operation. |
|---|
| 376 |
* Returns: a string set to the domain. |
|---|
| 377 |
*/ |
|---|
| 378 |
public string getDomain() |
|---|
| 379 |
{ |
|---|
| 380 |
// const char * g_mount_operation_get_domain (GMountOperation *op); |
|---|
| 381 |
return Str.toString(g_mount_operation_get_domain(gMountOperation)); |
|---|
| 382 |
} |
|---|
| 383 |
|
|---|
| 384 |
/** |
|---|
| 385 |
* Sets the mount operation's domain. |
|---|
| 386 |
* Params: |
|---|
| 387 |
* domain = the domain to set. |
|---|
| 388 |
*/ |
|---|
| 389 |
public void setDomain(string domain) |
|---|
| 390 |
{ |
|---|
| 391 |
// void g_mount_operation_set_domain (GMountOperation *op, const char *domain); |
|---|
| 392 |
g_mount_operation_set_domain(gMountOperation, Str.toStringz(domain)); |
|---|
| 393 |
} |
|---|
| 394 |
|
|---|
| 395 |
/** |
|---|
| 396 |
* Gets the state of saving passwords for the mount operation. |
|---|
| 397 |
* Returns: a GPasswordSave flag. |
|---|
| 398 |
*/ |
|---|
| 399 |
public GPasswordSave getPasswordSave() |
|---|
| 400 |
{ |
|---|
| 401 |
// GPasswordSave g_mount_operation_get_password_save (GMountOperation *op); |
|---|
| 402 |
return g_mount_operation_get_password_save(gMountOperation); |
|---|
| 403 |
} |
|---|
| 404 |
|
|---|
| 405 |
/** |
|---|
| 406 |
* Sets the state of saving passwords for the mount operation. |
|---|
| 407 |
* Params: |
|---|
| 408 |
* save = a set of GPasswordSave flags. |
|---|
| 409 |
*/ |
|---|
| 410 |
public void setPasswordSave(GPasswordSave save) |
|---|
| 411 |
{ |
|---|
| 412 |
// void g_mount_operation_set_password_save (GMountOperation *op, GPasswordSave save); |
|---|
| 413 |
g_mount_operation_set_password_save(gMountOperation, save); |
|---|
| 414 |
} |
|---|
| 415 |
|
|---|
| 416 |
/** |
|---|
| 417 |
* Gets a choice from the mount operation. |
|---|
| 418 |
* Returns: an integer containing an index of the user's choice from the choice's list, or 0. |
|---|
| 419 |
*/ |
|---|
| 420 |
public int getChoice() |
|---|
| 421 |
{ |
|---|
| 422 |
// int g_mount_operation_get_choice (GMountOperation *op); |
|---|
| 423 |
return g_mount_operation_get_choice(gMountOperation); |
|---|
| 424 |
} |
|---|
| 425 |
|
|---|
| 426 |
/** |
|---|
| 427 |
* Sets a default choice for the mount operation. |
|---|
| 428 |
* Params: |
|---|
| 429 |
* choice = an integer. |
|---|
| 430 |
*/ |
|---|
| 431 |
public void setChoice(int choice) |
|---|
| 432 |
{ |
|---|
| 433 |
// void g_mount_operation_set_choice (GMountOperation *op, int choice); |
|---|
| 434 |
g_mount_operation_set_choice(gMountOperation, choice); |
|---|
| 435 |
} |
|---|
| 436 |
|
|---|
| 437 |
/** |
|---|
| 438 |
* Emits the "reply" signal. |
|---|
| 439 |
* Params: |
|---|
| 440 |
* result = a GMountOperationResult |
|---|
| 441 |
*/ |
|---|
| 442 |
public void reply(GMountOperationResult result) |
|---|
| 443 |
{ |
|---|
| 444 |
// void g_mount_operation_reply (GMountOperation *op, GMountOperationResult result); |
|---|
| 445 |
g_mount_operation_reply(gMountOperation, result); |
|---|
| 446 |
} |
|---|
| 447 |
} |
|---|