1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright (C) 2006-2007 Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library 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 GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Author: Alexander Larsson <alexl@redhat.com>
23 #ifndef __G_MOUNT_OPERATION_H__
24 #define __G_MOUNT_OPERATION_H__
28 #include <glib-object.h>
32 #define G_TYPE_MOUNT_OPERATION (g_mount_operation_get_type ())
33 #define G_MOUNT_OPERATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_MOUNT_OPERATION, GMountOperation))
34 #define G_MOUNT_OPERATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_MOUNT_OPERATION, GMountOperationClass))
35 #define G_IS_MOUNT_OPERATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_MOUNT_OPERATION))
36 #define G_IS_MOUNT_OPERATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_MOUNT_OPERATION))
37 #define G_MOUNT_OPERATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_MOUNT_OPERATION, GMountOperationClass))
42 * Class for providing authentication methods for mounting operations,
43 * such as mounting a file locally, or authenticating with a server.
45 typedef struct _GMountOperation GMountOperation;
46 typedef struct _GMountOperationClass GMountOperationClass;
47 typedef struct _GMountOperationPrivate GMountOperationPrivate;
49 struct _GMountOperation
51 GObject parent_instance;
53 GMountOperationPrivate *priv;
58 * @G_PASSWORD_FLAGS_NEED_PASSWORD: operation requires a password.
59 * @G_PASSWORD_FLAGS_NEED_USERNAME: operation requires a username.
60 * @G_PASSWORD_FLAGS_NEED_DOMAIN: operation requires a domain.
61 * @G_PASSWORD_FLAGS_SAVING_SUPPORTED: operation supports saving settings.
62 * @G_PASSWORD_FLAGS_ANON_SUPPORTED: operation supports anonymous users.
64 * #GPasswordFlags are used to request specific information from the
65 * user, or to notify the user of their choices in an authentication
70 G_PASSWORD_FLAGS_NEED_PASSWORD = 1<<0,
71 G_PASSWORD_FLAGS_NEED_USERNAME = 1<<1,
72 G_PASSWORD_FLAGS_NEED_DOMAIN = 1<<2,
73 G_PASSWORD_FLAGS_SAVING_SUPPORTED = 1<<4,
74 G_PASSWORD_FLAGS_ANON_SUPPORTED = 1<<5
79 * @G_PASSWORD_SAVE_NEVER: never save a password.
80 * @G_PASSWORD_SAVE_FOR_SESSION: save a password for the session.
81 * @G_PASSWORD_SAVE_PERMANENTLY: save a password permanently.
83 * #GPasswordSave is used to indicate the lifespan of a saved password.
86 G_PASSWORD_SAVE_NEVER,
87 G_PASSWORD_SAVE_FOR_SESSION,
88 G_PASSWORD_SAVE_PERMANENTLY
91 struct _GMountOperationClass
93 GObjectClass parent_class;
97 gboolean (* ask_password) (GMountOperation *op,
99 const char *default_user,
100 const char *default_domain,
101 GPasswordFlags flags);
103 gboolean (* ask_question) (GMountOperation *op,
105 const char *choices[]);
107 void (* reply) (GMountOperation *op,
111 /* Padding for future expansion */
112 void (*_g_reserved1) (void);
113 void (*_g_reserved2) (void);
114 void (*_g_reserved3) (void);
115 void (*_g_reserved4) (void);
116 void (*_g_reserved5) (void);
117 void (*_g_reserved6) (void);
118 void (*_g_reserved7) (void);
119 void (*_g_reserved8) (void);
120 void (*_g_reserved9) (void);
121 void (*_g_reserved10) (void);
122 void (*_g_reserved11) (void);
123 void (*_g_reserved12) (void);
126 GType g_mount_operation_get_type (void) G_GNUC_CONST;
128 GMountOperation * g_mount_operation_new (void);
130 const char * g_mount_operation_get_username (GMountOperation *op);
131 void g_mount_operation_set_username (GMountOperation *op,
132 const char *username);
133 const char * g_mount_operation_get_password (GMountOperation *op);
134 void g_mount_operation_set_password (GMountOperation *op,
135 const char *password);
136 gboolean g_mount_operation_get_anonymous (GMountOperation *op);
137 void g_mount_operation_set_anonymous (GMountOperation *op,
139 const char * g_mount_operation_get_domain (GMountOperation *op);
140 void g_mount_operation_set_domain (GMountOperation *op,
142 GPasswordSave g_mount_operation_get_password_save (GMountOperation *op);
143 void g_mount_operation_set_password_save (GMountOperation *op,
145 int g_mount_operation_get_choice (GMountOperation *op);
146 void g_mount_operation_set_choice (GMountOperation *op,
148 void g_mount_operation_reply (GMountOperation *op,
153 #endif /* __G_MOUNT_OPERATION_H__ */