1 // Generated by gmmproc 2.64.2 -- DO NOT MODIFY! 2 #ifndef _GIOMM_MOUNTOPERATION_H 3 #define _GIOMM_MOUNTOPERATION_H 4 5 #include <giommconfig.h> 6 7 8 #include <glibmm/ustring.h> 9 #include <sigc++/sigc++.h> 10 11 /* Copyright (C) 2007 The gtkmm Development Team 12 * 13 * This library is free software; you can redistribute it and/or 14 * modify it under the terms of the GNU Lesser General Public 15 * License as published by the Free Software Foundation; either 16 * version 2.1 of the License, or (at your option) any later version. 17 * 18 * This library is distributed in the hope that it will be useful, 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 * Lesser General Public License for more details. 22 * 23 * You should have received a copy of the GNU Lesser General Public 24 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 25 */ 26 27 28 #include <glibmm/object.h> 29 #include <glibmm/arrayhandle.h> 30 31 32 #ifndef DOXYGEN_SHOULD_SKIP_THIS 33 using GMountOperation = struct _GMountOperation; 34 using GMountOperationClass = struct _GMountOperationClass; 35 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 36 37 38 #ifndef DOXYGEN_SHOULD_SKIP_THIS 39 namespace Gio 40 { class GIOMM_API MountOperation_Class; } // namespace Gio 41 #endif //DOXYGEN_SHOULD_SKIP_THIS 42 43 namespace Gio 44 { 45 46 /** @addtogroup giommEnums giomm Enums and Flags */ 47 48 /** 49 * @var AskPasswordFlags ASK_PASSWORD_NEED_PASSWORD 50 * Operation requires a password. 51 * 52 * @var AskPasswordFlags ASK_PASSWORD_NEED_USERNAME 53 * Operation requires a username. 54 * 55 * @var AskPasswordFlags ASK_PASSWORD_NEED_DOMAIN 56 * Operation requires a domain. 57 * 58 * @var AskPasswordFlags ASK_PASSWORD_SAVING_SUPPORTED 59 * Operation supports saving settings. 60 * 61 * @var AskPasswordFlags ASK_PASSWORD_ANONYMOUS_SUPPORTED 62 * Operation supports anonymous users. 63 * 64 * @var AskPasswordFlags ASK_PASSWORD_TCRYPT 65 * Operation takes TCRYPT parameters (Since: 2.58). 66 * 67 * @enum AskPasswordFlags 68 * 69 * AskPasswordFlags are used to request specific information from the 70 * user, or to notify the user of their choices in an authentication 71 * situation. 72 * 73 * @ingroup giommEnums 74 * @par Bitwise operators: 75 * <tt>%AskPasswordFlags operator|(AskPasswordFlags, AskPasswordFlags)</tt><br> 76 * <tt>%AskPasswordFlags operator&(AskPasswordFlags, AskPasswordFlags)</tt><br> 77 * <tt>%AskPasswordFlags operator^(AskPasswordFlags, AskPasswordFlags)</tt><br> 78 * <tt>%AskPasswordFlags operator~(AskPasswordFlags)</tt><br> 79 * <tt>%AskPasswordFlags& operator|=(AskPasswordFlags&, AskPasswordFlags)</tt><br> 80 * <tt>%AskPasswordFlags& operator&=(AskPasswordFlags&, AskPasswordFlags)</tt><br> 81 * <tt>%AskPasswordFlags& operator^=(AskPasswordFlags&, AskPasswordFlags)</tt><br> 82 */ 83 enum AskPasswordFlags 84 { 85 ASK_PASSWORD_NEED_PASSWORD = (1 << 0), 86 ASK_PASSWORD_NEED_USERNAME = (1 << 1), 87 ASK_PASSWORD_NEED_DOMAIN = (1 << 2), 88 ASK_PASSWORD_SAVING_SUPPORTED = (1 << 3), 89 ASK_PASSWORD_ANONYMOUS_SUPPORTED = (1 << 4), 90 ASK_PASSWORD_TCRYPT = (1 << 5) 91 }; 92 93 /** @ingroup giommEnums */ 94 inline AskPasswordFlags operator|(AskPasswordFlags lhs, AskPasswordFlags rhs) 95 { return static_cast<AskPasswordFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); } 96 97 /** @ingroup giommEnums */ 98 inline AskPasswordFlags operator&(AskPasswordFlags lhs, AskPasswordFlags rhs) 99 { return static_cast<AskPasswordFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); } 100 101 /** @ingroup giommEnums */ 102 inline AskPasswordFlags operator^(AskPasswordFlags lhs, AskPasswordFlags rhs) 103 { return static_cast<AskPasswordFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); } 104 105 /** @ingroup giommEnums */ 106 inline AskPasswordFlags operator~(AskPasswordFlags flags) 107 { return static_cast<AskPasswordFlags>(~static_cast<unsigned>(flags)); } 108 109 /** @ingroup giommEnums */ 110 inline AskPasswordFlags& operator|=(AskPasswordFlags& lhs, AskPasswordFlags rhs) 111 { return (lhs = static_cast<AskPasswordFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); } 112 113 /** @ingroup giommEnums */ 114 inline AskPasswordFlags& operator&=(AskPasswordFlags& lhs, AskPasswordFlags rhs) 115 { return (lhs = static_cast<AskPasswordFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); } 116 117 /** @ingroup giommEnums */ 118 inline AskPasswordFlags& operator^=(AskPasswordFlags& lhs, AskPasswordFlags rhs) 119 { return (lhs = static_cast<AskPasswordFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); } 120 121 122 /** 123 * @var PasswordSave PASSWORD_SAVE_NEVER 124 * Never save a password. 125 * 126 * @var PasswordSave PASSWORD_SAVE_FOR_SESSION 127 * Save a password for the session. 128 * 129 * @var PasswordSave PASSWORD_SAVE_PERMANENTLY 130 * Save a password permanently. 131 * 132 * @enum PasswordSave 133 * 134 * PasswordSave is used to indicate the lifespan of a saved password. 135 * 136 * #Gvfs stores passwords in the Gnome keyring when this flag allows it 137 * to, and later retrieves it again from there. 138 * 139 * @ingroup giommEnums 140 */ 141 enum PasswordSave 142 { 143 PASSWORD_SAVE_NEVER, 144 PASSWORD_SAVE_FOR_SESSION, 145 PASSWORD_SAVE_PERMANENTLY 146 }; 147 148 } // namespace Gio 149 150 #ifndef DOXYGEN_SHOULD_SKIP_THIS 151 namespace Glib 152 { 153 154 template <> 155 class Value<Gio::PasswordSave> : public Glib::Value_Enum<Gio::PasswordSave> 156 { 157 public: 158 static GType value_type() G_GNUC_CONST; 159 }; 160 161 } // namespace Glib 162 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 163 164 namespace Gio 165 { 166 167 /** 168 * @var MountOperationResult MOUNT_OPERATION_HANDLED 169 * The request was fulfilled and the 170 * user specified data is now available. 171 * 172 * @var MountOperationResult MOUNT_OPERATION_ABORTED 173 * The user requested the mount operation 174 * to be aborted. 175 * 176 * @var MountOperationResult MOUNT_OPERATION_UNHANDLED 177 * The request was unhandled (i.e. not 178 * implemented). 179 * 180 * @enum MountOperationResult 181 * 182 * MountOperationResult is returned as a result when a request for 183 * information is send by the mounting operation. 184 * 185 * @ingroup giommEnums 186 */ 187 enum MountOperationResult 188 { 189 MOUNT_OPERATION_HANDLED, 190 MOUNT_OPERATION_ABORTED, 191 MOUNT_OPERATION_UNHANDLED 192 }; 193 194 195 /** Authentication methods for mountable locations. 196 * 197 * MountOperation provides a mechanism for authenticating mountable operations, such as loop mounting files, hard drive partitions or server locations. 198 * 199 * Mounting operations are handed a MountOperation that they can use if they require any privileges or authentication for their volumes to be mounted (e.g. 200 * a hard disk partition or an encrypted filesystem), or if they are implementing a remote server protocol which requires user credentials such as FTP or 201 * WebDAV. 202 * 203 * Developers should instantiate a subclass of this that implements all the various callbacks to show the required dialogs. 204 * 205 * @newin{2,16} 206 */ 207 208 class GIOMM_API MountOperation : public Glib::Object 209 { 210 211 #ifndef DOXYGEN_SHOULD_SKIP_THIS 212 213 public: 214 using CppObjectType = MountOperation; 215 using CppClassType = MountOperation_Class; 216 using BaseObjectType = GMountOperation; 217 using BaseClassType = GMountOperationClass; 218 219 // noncopyable 220 MountOperation(const MountOperation&) = delete; 221 MountOperation& operator=(const MountOperation&) = delete; 222 223 private: friend class MountOperation_Class; 224 static CppClassType mountoperation_class_; 225 226 protected: 227 explicit MountOperation(const Glib::ConstructParams& construct_params); 228 explicit MountOperation(GMountOperation* castitem); 229 230 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 231 232 public: 233 234 MountOperation(MountOperation&& src) noexcept; 235 MountOperation& operator=(MountOperation&& src) noexcept; 236 237 ~MountOperation() noexcept override; 238 239 /** Get the GType for this class, for use with the underlying GObject type system. 240 */ 241 static GType get_type() G_GNUC_CONST; 242 243 #ifndef DOXYGEN_SHOULD_SKIP_THIS 244 245 246 static GType get_base_type() G_GNUC_CONST; 247 #endif 248 249 ///Provides access to the underlying C GObject. gobj()250 GMountOperation* gobj() { return reinterpret_cast<GMountOperation*>(gobject_); } 251 252 ///Provides access to the underlying C GObject. gobj()253 const GMountOperation* gobj() const { return reinterpret_cast<GMountOperation*>(gobject_); } 254 255 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. 256 GMountOperation* gobj_copy(); 257 258 private: 259 260 261 protected: 262 MountOperation(); 263 264 public: 265 266 static Glib::RefPtr<MountOperation> create(); 267 268 269 /** Get the user name from the mount operation. 270 * 271 * @return A string containing the user name. 272 */ 273 Glib::ustring get_username() const; 274 275 /** Sets the user name within @a op to @a username. 276 * 277 * @param username Input username. 278 */ 279 void set_username(const Glib::ustring& username); 280 281 /** Gets a password from the mount operation. 282 * 283 * @return A string containing the password within @a op. 284 */ 285 Glib::ustring get_password() const; 286 287 /** Sets the mount operation's password to @a password. 288 * 289 * @param password Password to set. 290 */ 291 void set_password(const Glib::ustring& password); 292 293 /** Check to see whether the mount operation is being used 294 * for an anonymous user. 295 * 296 * @return <tt>true</tt> if mount operation is anonymous. 297 */ 298 bool get_anonymous() const; 299 300 /** Sets the mount operation to use an anonymous user if @a anonymous is <tt>true</tt>. 301 * 302 * @param anonymous Boolean value. 303 */ 304 void set_anonymous(bool anonymous = true); 305 306 /** Gets the domain of the mount operation. 307 * 308 * @return A string set to the domain. 309 */ 310 Glib::ustring get_domain() const; 311 312 /** Sets the mount operation's domain. 313 * 314 * @param domain The domain to set. 315 */ 316 void set_domain(const Glib::ustring& domain); 317 318 /** Gets the state of saving passwords for the mount operation. 319 * 320 * @return A PasswordSave flag. 321 */ 322 PasswordSave get_password_save() const; 323 324 /** Sets the state of saving passwords for the mount operation. 325 * 326 * @param save A set of PasswordSave flags. 327 */ 328 void set_password_save(PasswordSave save); 329 330 /** Gets a choice from the mount operation. 331 * 332 * @return An integer containing an index of the user's choice from 333 * the choice's list, or `0`. 334 */ 335 int get_choice() const; 336 337 /** Sets a default choice for the mount operation. 338 * 339 * @param choice An integer. 340 */ 341 void set_choice(int choice); 342 343 /** Emits the MountOperation::signal_reply() signal. 344 * 345 * @param result A MountOperationResult. 346 */ 347 void reply(MountOperationResult result); 348 349 350 /** 351 * @par Slot Prototype: 352 * <tt>void on_my_%ask_password(const Glib::ustring& message, const Glib::ustring& default_user, const Glib::ustring& default_domain, AskPasswordFlags flags)</tt> 353 * 354 * Flags: Run Last 355 * 356 * Emitted when a mount operation asks the user for a password. 357 * 358 * If the message contains a line break, the first line should be 359 * presented as a heading. For example, it may be used as the 360 * primary text in a Gtk::MessageDialog. 361 * 362 * @param message String containing a message to display to the user. 363 * @param default_user String containing the default user name. 364 * @param default_domain String containing the default domain. 365 * @param flags A set of AskPasswordFlags. 366 */ 367 368 Glib::SignalProxy< void,const Glib::ustring&,const Glib::ustring&,const Glib::ustring&,AskPasswordFlags > signal_ask_password(); 369 370 371 //TODO: We really need some test to make sure that our use of StringArrayHandle is correct. murrayc. 372 373 374 /** 375 * @par Slot Prototype: 376 * <tt>void on_my_%ask_question(const Glib::ustring& message, const Glib::StringArrayHandle& choices)</tt> 377 * 378 * Flags: Run Last 379 * 380 * Emitted when asking the user a question and gives a list of 381 * choices for the user to choose from. 382 * 383 * If the message contains a line break, the first line should be 384 * presented as a heading. For example, it may be used as the 385 * primary text in a Gtk::MessageDialog. 386 * 387 * @param message String containing a message to display to the user. 388 * @param choices An array of strings for each possible choice. 389 */ 390 391 Glib::SignalProxy< void,const Glib::ustring&,const Glib::StringArrayHandle& > signal_ask_question(); 392 393 394 /** 395 * @par Slot Prototype: 396 * <tt>void on_my_%reply(MountOperationResult result)</tt> 397 * 398 * Flags: Run Last 399 * 400 * Emitted when the user has replied to the mount operation. 401 * 402 * @param result A MountOperationResult indicating how the request was handled. 403 */ 404 405 Glib::SignalProxy< void,MountOperationResult > signal_reply(); 406 407 408 //TODO: Remove no_default_handler when we can break ABI: 409 410 /** 411 * @par Slot Prototype: 412 * <tt>void on_my_%aborted()</tt> 413 * 414 * Flags: Run Last 415 * 416 * Emitted by the backend when e.g.\ a device becomes unavailable 417 * while a mount operation is in progress. 418 * 419 * Implementations of GMountOperation should handle this signal 420 * by dismissing open password dialogs. 421 * 422 * @newin{2,20} 423 */ 424 425 Glib::SignalProxy< void > signal_aborted(); 426 427 428 //TODO: The array of char* is not very pleasant to wrap: 429 //_WRAP_SIGNAL( void show_processes(const Glib::ustring& message, GArray* processes, const gchar *choices[]); 430 431 432 /** 433 * @par Slot Prototype: 434 * <tt>void on_my_%show_unmount_progress(const Glib::ustring& message, gint64 time_left, gint64 bytes_left)</tt> 435 * 436 * Flags: Run Last 437 * 438 * Emitted when an unmount operation has been busy for more than some time 439 * (typically 1.5 seconds). 440 * 441 * When unmounting or ejecting a volume, the kernel might need to flush 442 * pending data in its buffers to the volume stable storage, and this operation 443 * can take a considerable amount of time. This signal may be emitted several 444 * times as long as the unmount operation is outstanding, and then one 445 * last time when the operation is completed, with @a bytes_left set to zero. 446 * 447 * Implementations of GMountOperation should handle this signal by 448 * showing an UI notification, and then dismiss it, or show another notification 449 * of completion, when @a bytes_left reaches zero. 450 * 451 * If the message contains a line break, the first line should be 452 * presented as a heading. For example, it may be used as the 453 * primary text in a Gtk::MessageDialog. 454 * 455 * @newin{2,34} 456 * 457 * @param message String containing a mesage to display to the user. 458 * @param time_left The estimated time left before the operation completes, 459 * in microseconds, or -1. 460 * @param bytes_left The amount of bytes to be written before the operation 461 * completes (or -1 if such amount is not known), or zero if the operation 462 * is completed. 463 */ 464 465 Glib::SignalProxy< void,const Glib::ustring&,gint64,gint64 > signal_show_unmount_progress(); 466 467 468 /** The user name that is used for authentication when carrying out 469 * the mount operation. 470 * 471 * Default value: "" 472 * 473 * @return A PropertyProxy that allows you to get or set the value of the property, 474 * or receive notification when the value of the property changes. 475 */ 476 Glib::PropertyProxy< Glib::ustring > property_username() ; 477 478 /** The user name that is used for authentication when carrying out 479 * the mount operation. 480 * 481 * Default value: "" 482 * 483 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 484 * or receive notification when the value of the property changes. 485 */ 486 Glib::PropertyProxy_ReadOnly< Glib::ustring > property_username() const; 487 488 /** The password that is used for authentication when carrying out 489 * the mount operation. 490 * 491 * Default value: "" 492 * 493 * @return A PropertyProxy that allows you to get or set the value of the property, 494 * or receive notification when the value of the property changes. 495 */ 496 Glib::PropertyProxy< Glib::ustring > property_password() ; 497 498 /** The password that is used for authentication when carrying out 499 * the mount operation. 500 * 501 * Default value: "" 502 * 503 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 504 * or receive notification when the value of the property changes. 505 */ 506 Glib::PropertyProxy_ReadOnly< Glib::ustring > property_password() const; 507 508 /** Whether to use an anonymous user when authenticating. 509 * 510 * Default value: <tt>false</tt> 511 * 512 * @return A PropertyProxy that allows you to get or set the value of the property, 513 * or receive notification when the value of the property changes. 514 */ 515 Glib::PropertyProxy< bool > property_anonymous() ; 516 517 /** Whether to use an anonymous user when authenticating. 518 * 519 * Default value: <tt>false</tt> 520 * 521 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 522 * or receive notification when the value of the property changes. 523 */ 524 Glib::PropertyProxy_ReadOnly< bool > property_anonymous() const; 525 526 /** The domain to use for the mount operation. 527 * 528 * Default value: "" 529 * 530 * @return A PropertyProxy that allows you to get or set the value of the property, 531 * or receive notification when the value of the property changes. 532 */ 533 Glib::PropertyProxy< Glib::ustring > property_domain() ; 534 535 /** The domain to use for the mount operation. 536 * 537 * Default value: "" 538 * 539 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 540 * or receive notification when the value of the property changes. 541 */ 542 Glib::PropertyProxy_ReadOnly< Glib::ustring > property_domain() const; 543 544 /** Determines if and how the password information should be saved. 545 * 546 * Default value: PASSWORD_SAVE_NEVER 547 * 548 * @return A PropertyProxy that allows you to get or set the value of the property, 549 * or receive notification when the value of the property changes. 550 */ 551 Glib::PropertyProxy< PasswordSave > property_password_save() ; 552 553 /** Determines if and how the password information should be saved. 554 * 555 * Default value: PASSWORD_SAVE_NEVER 556 * 557 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 558 * or receive notification when the value of the property changes. 559 */ 560 Glib::PropertyProxy_ReadOnly< PasswordSave > property_password_save() const; 561 562 /** The index of the user's choice when a question is asked during the 563 * mount operation. See the MountOperation::signal_ask_question() signal. 564 * 565 * Default value: 0 566 * 567 * @return A PropertyProxy that allows you to get or set the value of the property, 568 * or receive notification when the value of the property changes. 569 */ 570 Glib::PropertyProxy< int > property_choice() ; 571 572 /** The index of the user's choice when a question is asked during the 573 * mount operation. See the MountOperation::signal_ask_question() signal. 574 * 575 * Default value: 0 576 * 577 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 578 * or receive notification when the value of the property changes. 579 */ 580 Glib::PropertyProxy_ReadOnly< int > property_choice() const; 581 582 583 public: 584 585 public: 586 //C++ methods used to invoke GTK+ virtual functions: 587 588 protected: 589 //GTK+ Virtual Functions (override these to change behaviour): 590 591 //Default Signal Handlers:: 592 /// This is a default handler for the signal signal_ask_password(). 593 virtual void on_ask_password(const Glib::ustring& message, const Glib::ustring& default_user, const Glib::ustring& default_domain, AskPasswordFlags flags); 594 /// This is a default handler for the signal signal_ask_question(). 595 virtual void on_ask_question(const Glib::ustring& message, const Glib::StringArrayHandle& choices); 596 /// This is a default handler for the signal signal_reply(). 597 virtual void on_reply(MountOperationResult result); 598 599 600 }; 601 602 } // namespace Gio 603 604 605 namespace Glib 606 { 607 /** A Glib::wrap() method for this object. 608 * 609 * @param object The C instance. 610 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. 611 * @result A C++ instance that wraps this C instance. 612 * 613 * @relates Gio::MountOperation 614 */ 615 GIOMM_API 616 Glib::RefPtr<Gio::MountOperation> wrap(GMountOperation* object, bool take_copy = false); 617 } 618 619 620 #endif /* _GIOMM_MOUNTOPERATION_H */ 621 622