glibmm: Gio::MountOperation Class Reference

glibmm 2.52.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gio::MountOperation Class Reference

Authentication methods for mountable locations. More...

`#include <giomm/mountoperation.h>`

Inheritance diagram for Gio::MountOperation:
[legend]

## Public Member Functions
| MountOperation (MountOperation&& src) noexcept
MountOperation& | operator= (MountOperation&& src) noexcept
| ~MountOperation () noexceptoverride
GMountOperation* | gobj ()
| Provides access to the underlying C GObject. More...
const GMountOperation* | gobj () const
| Provides access to the underlying C GObject. More...
GMountOperation* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
Glib::ustring | get_username () const
| Get the user name from the mount operation. More...
void | set_username (const Glib::ustring& username)
| Sets the user name within op to username. More...
Glib::ustring | get_password () const
| Gets a password from the mount operation. More...
void | set_password (const Glib::ustring& password)
| Sets the mount operation's password to password. More...
bool | get_anonymous () const
| Check to see whether the mount operation is being used for an anonymous user. More...
void | set_anonymous (bool anonymous=true)
| Sets the mount operation to use an anonymous user if anonymous is `true`. More...
Glib::ustring | get_domain () const
| Gets the domain of the mount operation. More...
void | set_domain (const Glib::ustring& domain)
| Sets the mount operation's domain. More...
PasswordSave | get_password_save () const
| Gets the state of saving passwords for the mount operation. More...
void | set_password_save (PasswordSave save)
| Sets the state of saving passwords for the mount operation. More...
int | get_choice () const
| Gets a choice from the mount operation. More...
void | set_choice (int choice)
| Sets a default choice for the mount operation. More...
void | reply (MountOperationResult result)
| Emits the MountOperation::signal_reply() signal. More...
Glib::SignalProxy< void, const Glib::ustring&, const Glib::ustring&, const Glib::ustring&, AskPasswordFlags > | signal_ask_password ()
Glib::SignalProxy< void, const Glib::ustring&, const Glib::StringArrayHandle& > | signal_ask_question ()
Glib::SignalProxy< void, MountOperationResult > | signal_reply ()
Glib::SignalProxy< void > | signal_aborted ()
Glib::SignalProxy< void, const Glib::ustring&, gint64, gint64 > | signal_show_unmount_progress ()
Glib::PropertyProxy< Glib::ustring > | property_username ()
| The user name that is used for authentication when carrying out the mount operation. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_username () const
| The user name that is used for authentication when carrying out the mount operation. More...
Glib::PropertyProxy< Glib::ustring > | property_password ()
| The password that is used for authentication when carrying out the mount operation. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_password () const
| The password that is used for authentication when carrying out the mount operation. More...
Glib::PropertyProxy< bool > | property_anonymous ()
| Whether to use an anonymous user when authenticating. More...
Glib::PropertyProxy_ReadOnly< bool > | property_anonymous () const
| Whether to use an anonymous user when authenticating. More...
Glib::PropertyProxy< Glib::ustring > | property_domain ()
| The domain to use for the mount operation. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_domain () const
| The domain to use for the mount operation. More...
Glib::PropertyProxy< PasswordSave > | property_password_save ()
| Determines if and how the password information should be saved. More...
Glib::PropertyProxy_ReadOnly< PasswordSave > | property_password_save () const
| Determines if and how the password information should be saved. More...
Glib::PropertyProxy< int > | property_choice ()
| The index of the user's choice when a question is asked during the mount operation. More...
Glib::PropertyProxy_ReadOnly< int > | property_choice () const
| The index of the user's choice when a question is asked during the mount operation. More...
Public Member Functions inherited from Glib::Object
| Object (const Object&)=delete
Object& | operator= (const Object&)=delete
| Object (Object&& src) noexcept
Object& | operator= (Object&& src) noexcept
void* | get_data (const QueryQuark& key)
void | set_data (const Quark& key, void* data)
void | set_data (const Quark& key, void* data, DestroyNotify notify)
void | remove_data (const QueryQuark& quark)
void* | steal_data (const QueryQuark& quark)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase&)=delete
ObjectBase& | operator= (const ObjectBase&)=delete
void | set_property_value (const Glib::ustring& property_name, const Glib::ValueBase& value)
| You probably want to use a specific property_*() accessor method instead. More...
void | get_property_value (const Glib::ustring& property_name, Glib::ValueBase& value) const
| You probably want to use a specific property_*() accessor method instead. More...
template<class PropertyType >
void | set_property (const Glib::ustring& property_name, const PropertyType& value)
| You probably want to use a specific property_*() accessor method instead. More...
template<class PropertyType >
void | get_property (const Glib::ustring& property_name, PropertyType& value) const
| You probably want to use a specific property_*() accessor method instead. More...
void | connect_property_changed (const Glib::ustring& property_name, const sigc::slot< void >& slot)
| You can use the signal_changed() signal of the property proxy instead. More...
void | connect_property_changed (const Glib::ustring& property_name, sigc::slot< void >&& slot)
| You can use the signal_changed() signal of the property proxy instead. More...
sigc::connection | connect_property_changed_with_return (const Glib::ustring& property_name, const sigc::slot< void >& slot)
| You can use the signal_changed() signal of the property proxy instead. More...
sigc::connection | connect_property_changed_with_return (const Glib::ustring& property_name, sigc::slot< void >&& slot)
| You can use the signal_changed() signal of the property proxy instead. More...
void | freeze_notify ()
| Increases the freeze count on object. More...
void | thaw_notify ()
| Reverts the effect of a previous call to freeze_notify(). More...
virtual void | reference () const
| Increment the reference count for this object. More...
virtual void | unreference () const
| Decrement the reference count for this object. More...
GObject* | gobj ()
| Provides access to the underlying C GObject. More...
const GObject* | gobj () const
| Provides access to the underlying C GObject. More...
GObject* | gobj_copy () const
| Give a ref-ed copy to someone. Use for direct struct access. More...
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src)
| ~trackable ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src)
void | remove_destroy_notify_callback (void *data) const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static Glib::RefPtr< MountOperation > | create ()

## Protected Member Functions
| MountOperation ()
virtual void | on_ask_password (const Glib::ustring& message, const Glib::ustring& default_user, const Glib::ustring& default_domain, AskPasswordFlags flags)
| This is a default handler for the signal signal_ask_password(). More...
virtual void | on_ask_question (const Glib::ustring& message, const Glib::StringArrayHandle& choices)
| This is a default handler for the signal signal_ask_question(). More...
virtual void | on_reply (MountOperationResult result)
| This is a default handler for the signal signal_reply(). More...
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams& construct_params)
| Object (GObject* castitem)
| ~Object () noexceptoverride
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| This default constructor is called implicitly from the constructor of user-derived classes, even if, for instance, Gtk::Button calls a different ObjectBase constructor. More...
| ObjectBase (const char* custom_type_name)
| A derived constructor always overrides this choice. More...
| ObjectBase (const std::type_info& custom_type_info)
| This constructor is a special feature to allow creation of derived types on the fly, without having to use g_object_new() manually. More...
| ObjectBase (ObjectBase&& src) noexcept
ObjectBase& | operator= (ObjectBase&& src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject* castitem)
void | initialize_move (GObject* castitem, Glib::ObjectBase* previous_wrapper)

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gio::MountOperation > | wrap (GMountOperation* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...
Related Functions inherited from Glib::Object
Glib::RefPtr< Glib::Object > | wrap (GObject* object, bool take_copy=false)

## Additional Inherited Members
Public Types inherited from Glib::Object
using | DestroyNotify = void(*)(gpointer data)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify

## Detailed Description

Authentication methods for mountable locations.

MountOperation provides a mechanism for authenticating mountable operations, such as loop mounting files, hard drive partitions or server locations.

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. 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 WebDAV.

Developers should instantiate a subclass of this that implements all the various callbacks to show the required dialogs.

Since glibmm 2.16:

## Constructor & Destructor Documentation

Gio::MountOperation::MountOperation | ( | MountOperation&& | src | ) |
| noexcept

Gio::MountOperation::~MountOperation | ( |  | ) |
| overridenoexcept

Gio::MountOperation::MountOperation | ( |  | ) |
| protected

## Member Function Documentation

static Glib::RefPtr<MountOperation> Gio::MountOperation::create | ( |  | ) |
| static

bool Gio::MountOperation::get_anonymous | ( |  | ) | const

Check to see whether the mount operation is being used for an anonymous user.

Returns
  `true` if mount operation is anonymous.

int Gio::MountOperation::get_choice | ( |  | ) | const

Gets a choice from the mount operation.

Returns
  An integer containing an index of the user's choice from the choice's list, or %0.

Glib::ustring Gio::MountOperation::get_domain | ( |  | ) | const

Gets the domain of the mount operation.

Returns
  A string set to the domain.

Glib::ustring Gio::MountOperation::get_password | ( |  | ) | const

Gets a password from the mount operation.

Returns
  A string containing the password within op.

PasswordSave Gio::MountOperation::get_password_save | ( |  | ) | const

Gets the state of saving passwords for the mount operation.

Returns
  A PasswordSave flag.

static GType Gio::MountOperation::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

Glib::ustring Gio::MountOperation::get_username | ( |  | ) | const

Get the user name from the mount operation.

Returns
  A string containing the user name.

GMountOperation* Gio::MountOperation::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

const GMountOperation* Gio::MountOperation::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

GMountOperation* Gio::MountOperation::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

virtual void Gio::MountOperation::on_ask_password | ( | const Glib::ustring& | message,
|  | const Glib::ustring& | default_user,
|  | const Glib::ustring& | default_domain,
|  | AskPasswordFlags | flags
| ) |  |
| protectedvirtual

This is a default handler for the signal signal_ask_password().

virtual void Gio::MountOperation::on_ask_question | ( | const Glib::ustring& | message,
|  | const Glib::StringArrayHandle& | choices
| ) |  |
| protectedvirtual

This is a default handler for the signal signal_ask_question().

virtual void Gio::MountOperation::on_reply | ( | MountOperationResult | result | ) |
| protectedvirtual

This is a default handler for the signal signal_reply().

MountOperation& Gio::MountOperation::operator= | ( | MountOperation&& | src | ) |
| noexcept

Glib::PropertyProxy< bool > Gio::MountOperation::property_anonymous | ( |  | ) |

Whether to use an anonymous user when authenticating.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< bool > Gio::MountOperation::property_anonymous | ( |  | ) | const

Whether to use an anonymous user when authenticating.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy< int > Gio::MountOperation::property_choice | ( |  | ) |

The index of the user's choice when a question is asked during the mount operation.

See the MountOperation::signal_ask_question() signal.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< int > Gio::MountOperation::property_choice | ( |  | ) | const

The index of the user's choice when a question is asked during the mount operation.

See the MountOperation::signal_ask_question() signal.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy< Glib::ustring > Gio::MountOperation::property_domain | ( |  | ) |

The domain to use for the mount operation.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gio::MountOperation::property_domain | ( |  | ) | const

The domain to use for the mount operation.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy< Glib::ustring > Gio::MountOperation::property_password | ( |  | ) |

The password that is used for authentication when carrying out the mount operation.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gio::MountOperation::property_password | ( |  | ) | const

The password that is used for authentication when carrying out the mount operation.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy< PasswordSave > Gio::MountOperation::property_password_save | ( |  | ) |

Determines if and how the password information should be saved.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< PasswordSave > Gio::MountOperation::property_password_save | ( |  | ) | const

Determines if and how the password information should be saved.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy< Glib::ustring > Gio::MountOperation::property_username | ( |  | ) |

The user name that is used for authentication when carrying out the mount operation.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gio::MountOperation::property_username | ( |  | ) | const

The user name that is used for authentication when carrying out the mount operation.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

void Gio::MountOperation::reply | ( | MountOperationResult | result | ) |

Emits the MountOperation::signal_reply() signal.

Parameters

  result | A MountOperationResult.

void Gio::MountOperation::set_anonymous | ( | bool | anonymous = `true` | ) |

Sets the mount operation to use an anonymous user if anonymous is `true`.

Parameters

  anonymous | Boolean value.

void Gio::MountOperation::set_choice | ( | int | choice | ) |

Sets a default choice for the mount operation.

Parameters

  choice | An integer.

void Gio::MountOperation::set_domain | ( | const Glib::ustring& | domain | ) |

Sets the mount operation's domain.

Parameters

  domain | The domain to set.

void Gio::MountOperation::set_password | ( | const Glib::ustring& | password | ) |

Sets the mount operation's password to password.

Parameters

  password | Password to set.

void Gio::MountOperation::set_password_save | ( | PasswordSave | save | ) |

Sets the state of saving passwords for the mount operation.

Parameters

  save | A set of PasswordSave flags.

void Gio::MountOperation::set_username | ( | const Glib::ustring& | username | ) |

Sets the user name within op to username.

Parameters

  username | Input username.

Glib::SignalProxy< void > Gio::MountOperation::signal_aborted | ( |  | ) |

Slot Prototype:
  `void on_my_aborted()`

Emitted by the backend when e.g. a device becomes unavailable while a mount operation is in progress.

Implementations of GMountOperation should handle this signal by dismissing open password dialogs.

Since glibmm 2.20:

Glib::SignalProxy< void,const Glib::ustring&,const Glib::ustring&,const Glib::ustring&,AskPasswordFlags > Gio::MountOperation::signal_ask_password | ( |  | ) |

Slot Prototype:
  `void on_my_ask_password(const Glib::ustring& message, const Glib::ustring& default_user, const Glib::ustring& default_domain, AskPasswordFlags flags)`

Emitted when a mount operation asks the user for a password.

If the message contains a line break, the first line should be presented as a heading. For example, it may be used as the primary text in a Gtk::MessageDialog.

Parameters

  message | String containing a message to display to the user.
  default_user | String containing the default user name.
  default_domain | String containing the default domain.
  flags | A set of AskPasswordFlags.

Glib::SignalProxy< void,const Glib::ustring&,const Glib::StringArrayHandle& > Gio::MountOperation::signal_ask_question | ( |  | ) |

Slot Prototype:
  `void on_my_ask_question(const Glib::ustring& message, const Glib::StringArrayHandle& choices)`

Emitted when asking the user a question and gives a list of choices for the user to choose from.

If the message contains a line break, the first line should be presented as a heading. For example, it may be used as the primary text in a Gtk::MessageDialog.

Parameters

  message | String containing a message to display to the user.
  choices | An array of strings for each possible choice.

Glib::SignalProxy< void,MountOperationResult > Gio::MountOperation::signal_reply | ( |  | ) |

Slot Prototype:
  `void on_my_reply(MountOperationResult result)`

Emitted when the user has replied to the mount operation.

Parameters

  result | A MountOperationResult indicating how the request was handled.

Glib::SignalProxy< void,const Glib::ustring&,gint64,gint64 > Gio::MountOperation::signal_show_unmount_progress | ( |  | ) |

Slot Prototype:
  `void on_my_show_unmount_progress(const Glib::ustring& message, gint64 time_left, gint64 bytes_left)`

Emitted when an unmount operation has been busy for more than some time (typically 1.5 seconds).

When unmounting or ejecting a volume, the kernel might need to flush pending data in its buffers to the volume stable storage, and this operation can take a considerable amount of time. This signal may be emitted several times as long as the unmount operation is outstanding, and then one last time when the operation is completed, with bytes_left set to zero.

Implementations of GMountOperation should handle this signal by showing an UI notification, and then dismiss it, or show another notification of completion, when bytes_left reaches zero.

If the message contains a line break, the first line should be presented as a heading. For example, it may be used as the primary text in a Gtk::MessageDialog.

Since glibmm 2.34:

Parameters

  message | String containing a mesage to display to the user.
  time_left | The estimated time left before the operation completes, in microseconds, or -1.
  bytes_left | The amount of bytes to be written before the operation completes (or -1 if such amount is not known), or zero if the operation is completed.

## Friends And Related Function Documentation

Glib::RefPtr< Gio::MountOperation > wrap | ( | GMountOperation * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.