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

Authentication methods for mountable locations. More...

#include <giomm/mountoperation.h>

Inheritance diagram for Gio::MountOperation:
Inheritance graph
[legend]

Public Member Functions

 MountOperation (MountOperation &&src) noexcept
 
MountOperationoperator= (MountOperation &&src) noexcept
 
 ~MountOperation () noexcept override
 
GMountOperationgobj ()
 Provides access to the underlying C GObject.
 
const GMountOperationgobj () const
 Provides access to the underlying C GObject.
 
GMountOperationgobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
 
Glib::ustring get_username () const
 Get the user name from the mount operation.
 
void set_username (const Glib::ustring &username)
 Sets the user name within op to username.
 
Glib::ustring get_password () const
 Gets a password from the mount operation.
 
void set_password (const Glib::ustring &password)
 Sets the mount operation's password to password.
 
bool get_anonymous () const
 Check to see whether the mount operation is being used for an anonymous user.
 
void set_anonymous (bool anonymous=true)
 Sets the mount operation to use an anonymous user if anonymous is true.
 
Glib::ustring get_domain () const
 Gets the domain of the mount operation.
 
void set_domain (const Glib::ustring & domain)
 Sets the mount operation's domain.
 
PasswordSave get_password_save () const
 Gets the state of saving passwords for the mount operation.
 
void set_password_save (PasswordSave save)
 Sets the state of saving passwords for the mount operation.
 
int get_choice () const
 Gets a choice from the mount operation.
 
void set_choice (int choice)
 Sets a default choice for the mount operation.
 
void reply (MountOperationResult result)
 Emits the MountOperation::signal_reply() signal.
 
Glib::SignalProxy< void(const Glib::ustring &, const Glib::ustring &, const Glib::ustring &, AskPasswordFlags)> signal_ask_password ()
 
Glib::SignalProxy< void(const Glib::ustring &, const std::vector< Glib::ustring > &)> 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::ustringproperty_username ()
 The user name that is used for authentication when carrying out the mount operation.
 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_username () const
 The user name that is used for authentication when carrying out the mount operation.
 
Glib::PropertyProxy< Glib::ustringproperty_password ()
 The password that is used for authentication when carrying out the mount operation.
 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_password () const
 The password that is used for authentication when carrying out the mount operation.
 
Glib::PropertyProxy< bool > property_anonymous ()
 Whether to use an anonymous user when authenticating.
 
Glib::PropertyProxy_ReadOnly< bool > property_anonymous () const
 Whether to use an anonymous user when authenticating.
 
Glib::PropertyProxy< Glib::ustringproperty_domain ()
 The domain to use for the mount operation.
 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_domain () const
 The domain to use for the mount operation.
 
Glib::PropertyProxy< PasswordSaveproperty_password_save ()
 Determines if and how the password information should be saved.
 
Glib::PropertyProxy_ReadOnly< PasswordSaveproperty_password_save () const
 Determines if and how the password information should be saved.
 
Glib::PropertyProxy< intproperty_choice ()
 The index of the user's choice when a question is asked during the mount operation.
 
Glib::PropertyProxy_ReadOnly< intproperty_choice () const
 The index of the user's choice when a question is asked during the mount operation.
 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (Object &&src) noexcept
 
voidget_data (const QueryQuark & key)
 
void set_data (const Quark & key, void *data)
 
void set_data_with_c_callback (const Quark & key, void *data, GDestroyNotify notify)
 
void set_data (const Quark & key, void *data, DestroyNotify notify)
 Prefer set_data_with_c_callback() with a callback with C linkage.
 
void remove_data (const QueryQuark &quark)
 
voidsteal_data (const QueryQuark &quark)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (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.
 
void get_property_value (const Glib::ustring & property_name, Glib::ValueBase & value) const
 You probably want to use a specific property_*() accessor method instead.
 
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.
 
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.
 
template<class PropertyType >
PropertyType get_property (const Glib::ustring & property_name) const
 You probably want to use a specific property_*() accessor method instead.
 
sigc::connection 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.
 
sigc::connection connect_property_changed (const Glib::ustring & property_name, sigc::slot< void()> &&slot)
 You can use the signal_changed() signal of the property proxy instead.
 
void freeze_notify ()
 Increases the freeze count on object.
 
void thaw_notify ()
 Reverts the effect of a previous call to freeze_notify().
 
virtual void reference () const
 Increment the reference count for this object.
 
virtual void unreference () const
 Decrement the reference count for this object.
 
GObject * gobj ()
 Provides access to the underlying C GObject.
 
const GObject * gobj () const
 Provides access to the underlying C GObject.
 
GObject * gobj_copy () const
 Give a ref-ed copy to someone. Use for direct struct access.
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system.
 
static Glib::RefPtr< MountOperationcreate ()
 

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().
 
virtual void on_ask_question (const Glib::ustring & message, const std::vector< Glib::ustring > &choices)
 This is a default handler for the signal signal_ask_question().
 
virtual void on_reply (MountOperationResult result)
 This is a default handler for the signal signal_reply().
 
virtual void on_aborted ()
 This is a default handler for the signal signal_aborted().
 
virtual void on_show_unmount_progress (const Glib::ustring & message, gint64 time_left, gint64 bytes_left)
 This is a default handler for the signal signal_show_unmount_progress().
 
- Protected Member Functions inherited from Glib::Object
 Object ()
 
 Object (const Glib::ConstructParams &construct_params)
 
 Object (GObject *castitem)
 
 ~Object () noexcept override
 
- 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.
 
 ObjectBase (const char *custom_type_name)
 A derived constructor always overrides this choice.
 
 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.
 
 ObjectBase (ObjectBase &&src) noexcept
 
ObjectBaseoperator= (ObjectBase &&src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject *castitem)
 
void initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
 

Related Symbols

(Note that these are not member symbols.)

Glib::RefPtr< Gio::MountOperationwrap (GMountOperation *object, bool take_copy=false)
 A Glib::wrap() method for this object.
 

Additional Inherited Members

- Public Types inherited from Glib::Object
using DestroyNotify = void(*)(gpointer data)
 

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

◆ MountOperation() [1/2]

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

◆ ~MountOperation()

Gio::MountOperation::~MountOperation ( )
overridenoexcept

◆ MountOperation() [2/2]

Gio::MountOperation::MountOperation ( )
protected

Member Function Documentation

◆ create()

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

◆ get_anonymous()

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.

◆ get_choice()

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.

◆ get_domain()

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

Gets the domain of the mount operation.

Returns
A string set to the domain.

◆ get_password()

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

Gets a password from the mount operation.

Returns
A string containing the password within op.

◆ get_password_save()

PasswordSave Gio::MountOperation::get_password_save ( ) const

Gets the state of saving passwords for the mount operation.

Returns
A PasswordSave flag.

◆ get_type()

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

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

◆ get_username()

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

Get the user name from the mount operation.

Returns
A string containing the user name.

◆ gobj() [1/2]

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

Provides access to the underlying C GObject.

◆ gobj() [2/2]

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

Provides access to the underlying C GObject.

◆ gobj_copy()

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.

◆ on_aborted()

virtual void Gio::MountOperation::on_aborted ( )
protectedvirtual

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

◆ on_ask_password()

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().

◆ on_ask_question()

virtual void Gio::MountOperation::on_ask_question ( const Glib::ustring message,
const std::vector< Glib::ustring > &  choices 
)
protectedvirtual

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

◆ on_reply()

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

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

◆ on_show_unmount_progress()

virtual void Gio::MountOperation::on_show_unmount_progress ( const Glib::ustring message,
gint64  time_left,
gint64  bytes_left 
)
protectedvirtual

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

◆ operator=()

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

◆ property_anonymous() [1/2]

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

Whether to use an anonymous user when authenticating.

Default value: false

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.

◆ property_anonymous() [2/2]

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

Whether to use an anonymous user when authenticating.

Default value: false

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

◆ property_choice() [1/2]

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.

Default value: 0

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.

◆ property_choice() [2/2]

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.

Default value: 0

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

◆ property_domain() [1/2]

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

The domain to use for the mount operation.

Default value: ""

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.

◆ property_domain() [2/2]

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

The domain to use for the mount operation.

Default value: ""

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

◆ property_password() [1/2]

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

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

Default value: ""

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.

◆ property_password() [2/2]

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

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

Default value: ""

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

◆ property_password_save() [1/2]

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

Determines if and how the password information should be saved.

Default value: Gio::PasswordSave::NEVER

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.

◆ property_password_save() [2/2]

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

Determines if and how the password information should be saved.

Default value: Gio::PasswordSave::NEVER

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

◆ property_username() [1/2]

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

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

Default value: ""

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.

◆ property_username() [2/2]

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

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

Default value: ""

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

◆ reply()

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

Emits the MountOperation::signal_reply() signal.

Parameters
resultA MountOperationResult.

◆ set_anonymous()

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

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

Parameters
anonymousBoolean value.

◆ set_choice()

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

Sets a default choice for the mount operation.

Parameters
choiceAn integer.

◆ set_domain()

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

Sets the mount operation's domain.

Parameters
domainThe domain to set.

◆ set_password()

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

Sets the mount operation's password to password.

Parameters
passwordPassword to set.

◆ set_password_save()

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

Sets the state of saving passwords for the mount operation.

Parameters
saveA set of PasswordSave flags.

◆ set_username()

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

Sets the user name within op to username.

Parameters
usernameInput username.

◆ signal_aborted()

Glib::SignalProxy< void()> Gio::MountOperation::signal_aborted ( )
Slot Prototype:
void on_my_aborted()

Flags: Run Last

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:

◆ signal_ask_password()

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)

Flags: Run Last

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
messageString containing a message to display to the user.
default_userString containing the default user name.
default_domainString containing the default domain.
flagsA set of AskPasswordFlags.

◆ signal_ask_question()

Glib::SignalProxy< void(const Glib::ustring &, const std::vector< Glib::ustring > &)> Gio::MountOperation::signal_ask_question ( )
Slot Prototype:
void on_my_ask_question(const Glib::ustring& message, const std::vector<Glib::ustring>& choices)

Flags: Run Last

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
messageString containing a message to display to the user.
choicesAn array of strings for each possible choice.

◆ signal_reply()

Glib::SignalProxy< void(MountOperationResult)> Gio::MountOperation::signal_reply ( )
Slot Prototype:
void on_my_reply(MountOperationResult result)

Flags: Run Last

Emitted when the user has replied to the mount operation.

Parameters
resultA MountOperationResult indicating how the request was handled.

◆ signal_show_unmount_progress()

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)

Flags: Run Last

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
messageString containing a message to display to the user.
time_leftThe estimated time left before the operation completes, in microseconds, or -1.
bytes_leftThe 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 Symbol Documentation

◆ wrap()

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

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

Parameters
objectThe C instance.
take_copyFalse 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.