![]() |
![]() |
![]() |
GIO Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <gio/gio.h> enum GAskPasswordFlags; enum GPasswordSave; GMountOperation; enum GMountOperationResult; GMountOperation * g_mount_operation_new (void); const char * g_mount_operation_get_username (GMountOperation *op); void g_mount_operation_set_username (GMountOperation *op, const char *username); const char * g_mount_operation_get_password (GMountOperation *op); void g_mount_operation_set_password (GMountOperation *op, const char *password); gboolean g_mount_operation_get_anonymous (GMountOperation *op); void g_mount_operation_set_anonymous (GMountOperation *op, gboolean anonymous); const char * g_mount_operation_get_domain (GMountOperation *op); void g_mount_operation_set_domain (GMountOperation *op, const char *domain); GPasswordSave g_mount_operation_get_password_save (GMountOperation *op); void g_mount_operation_set_password_save (GMountOperation *op, GPasswordSave save); int g_mount_operation_get_choice (GMountOperation *op); void g_mount_operation_set_choice (GMountOperation *op, int choice); void g_mount_operation_reply (GMountOperation *op, GMountOperationResult result);
GMountOperation provides a mechanism for interacting with the user. It can be used for authenticating mountable operations, such as loop mounting files, hard drive partitions or server locations. It can also be used to ask the user questions or show a list of applications preventing unmount or eject operations from completing.
Note that GMountOperation is used for more than just GMount
objects – for example it is also used in g_drive_start()
and
g_drive_stop()
.
Users should instantiate a subclass of this that implements all the
various callbacks to show the required dialogs, such as
GtkMountOperation. If no user interaction is desired (for example
when automounting filesystems at login time), usually NULL
can be
passed, see each method taking a GMountOperation for details.
typedef enum { G_ASK_PASSWORD_NEED_PASSWORD = (1 << 0), G_ASK_PASSWORD_NEED_USERNAME = (1 << 1), G_ASK_PASSWORD_NEED_DOMAIN = (1 << 2), G_ASK_PASSWORD_SAVING_SUPPORTED = (1 << 3), G_ASK_PASSWORD_ANONYMOUS_SUPPORTED = (1 << 4) } GAskPasswordFlags;
GAskPasswordFlags are used to request specific information from the user, or to notify the user of their choices in an authentication situation.
operation requires a password. | |
operation requires a username. | |
operation requires a domain. | |
operation supports saving settings. | |
operation supports anonymous users. |
typedef enum { G_PASSWORD_SAVE_NEVER, G_PASSWORD_SAVE_FOR_SESSION, G_PASSWORD_SAVE_PERMANENTLY } GPasswordSave;
GPasswordSave is used to indicate the lifespan of a saved password.
Gvfs stores passwords in the Gnome keyring when this flag allows it to, and later retrieves it again from there.
typedef struct { GObject parent_instance; GMountOperationPrivate *priv; } GMountOperation;
Class for providing authentication methods for mounting operations, such as mounting a file locally, or authenticating with a server.
typedef enum { G_MOUNT_OPERATION_HANDLED, G_MOUNT_OPERATION_ABORTED, G_MOUNT_OPERATION_UNHANDLED } GMountOperationResult;
GMountOperationResult is returned as a result when a request for information is send by the mounting operation.
GMountOperation * g_mount_operation_new (void);
Creates a new mount operation.
Returns : |
a GMountOperation. |
const char * g_mount_operation_get_username (GMountOperation *op);
Get the user name from the mount operation.
|
a GMountOperation. |
Returns : |
a string containing the user name. |
void g_mount_operation_set_username (GMountOperation *op, const char *username);
Sets the user name within op
to username
.
|
a GMountOperation. |
|
input username. |
const char * g_mount_operation_get_password (GMountOperation *op);
Gets a password from the mount operation.
|
a GMountOperation. |
Returns : |
a string containing the password within op .
|
void g_mount_operation_set_password (GMountOperation *op, const char *password);
Sets the mount operation's password to password
.
|
a GMountOperation. |
|
password to set. |
gboolean g_mount_operation_get_anonymous (GMountOperation *op);
Check to see whether the mount operation is being used for an anonymous user.
|
a GMountOperation. |
Returns : |
TRUE if mount operation is anonymous.
|
void g_mount_operation_set_anonymous (GMountOperation *op, gboolean anonymous);
Sets the mount operation to use an anonymous user if anonymous
is TRUE
.
|
a GMountOperation. |
|
boolean value. |
const char * g_mount_operation_get_domain (GMountOperation *op);
Gets the domain of the mount operation.
|
a GMountOperation. |
Returns : |
a string set to the domain. |
void g_mount_operation_set_domain (GMountOperation *op, const char *domain);
Sets the mount operation's domain.
|
a GMountOperation. |
|
the domain to set. |
GPasswordSave g_mount_operation_get_password_save (GMountOperation *op);
Gets the state of saving passwords for the mount operation.
|
a GMountOperation. |
Returns : |
a GPasswordSave flag. |
void g_mount_operation_set_password_save (GMountOperation *op, GPasswordSave save);
Sets the state of saving passwords for the mount operation.
|
a GMountOperation. |
|
a set of GPasswordSave flags. |
int g_mount_operation_get_choice (GMountOperation *op);
Gets a choice from the mount operation.
|
a GMountOperation. |
Returns : |
an integer containing an index of the user's choice from
the choice's list, or 0 .
|
void g_mount_operation_set_choice (GMountOperation *op, int choice);
Sets a default choice for the mount operation.
|
a GMountOperation. |
|
an integer. |
void g_mount_operation_reply (GMountOperation *op, GMountOperationResult result);
Emits the "reply" signal.
|
a GMountOperation |
|
a GMountOperationResult |