gkdbus: Fix underflow and unreachable code bug
[platform/upstream/glib.git] / gio / gmountoperation.h
1 /* GIO - GLib Input, Output and Streaming Library
2  *
3  * Copyright (C) 2006-2007 Red Hat, Inc.
4  *
5  * SPDX-License-Identifier: LGPL-2.1-or-later
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General
18  * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
19  *
20  * Author: Alexander Larsson <alexl@redhat.com>
21  */
22
23 #ifndef __G_MOUNT_OPERATION_H__
24 #define __G_MOUNT_OPERATION_H__
25
26 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
27 #error "Only <gio/gio.h> can be included directly."
28 #endif
29
30 #include <gio/giotypes.h>
31
32 G_BEGIN_DECLS
33
34 #define G_TYPE_MOUNT_OPERATION         (g_mount_operation_get_type ())
35 #define G_MOUNT_OPERATION(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_MOUNT_OPERATION, GMountOperation))
36 #define G_MOUNT_OPERATION_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_MOUNT_OPERATION, GMountOperationClass))
37 #define G_IS_MOUNT_OPERATION(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_MOUNT_OPERATION))
38 #define G_IS_MOUNT_OPERATION_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_MOUNT_OPERATION))
39 #define G_MOUNT_OPERATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_MOUNT_OPERATION, GMountOperationClass))
40
41 /**
42  * GMountOperation:
43  *
44  * Class for providing authentication methods for mounting operations,
45  * such as mounting a file locally, or authenticating with a server.
46  **/
47 typedef struct _GMountOperationClass   GMountOperationClass;
48 typedef struct _GMountOperationPrivate GMountOperationPrivate;
49
50 struct _GMountOperation
51 {
52   GObject parent_instance;
53
54   GMountOperationPrivate *priv;
55 };
56
57 struct _GMountOperationClass
58 {
59   GObjectClass parent_class;
60
61   /* signals: */
62
63   void (* ask_password) (GMountOperation       *op,
64                          const char            *message,
65                          const char            *default_user,
66                          const char            *default_domain,
67                          GAskPasswordFlags      flags);
68
69   /**
70    * GMountOperationClass::ask_question:
71    * @op: a #GMountOperation
72    * @message: string containing a message to display to the user
73    * @choices: (array zero-terminated=1) (element-type utf8): an array of
74    *    strings for each possible choice
75    *
76    * Virtual implementation of #GMountOperation::ask-question.
77    */
78   void (* ask_question) (GMountOperation       *op,
79                          const char            *message,
80                          const char            *choices[]);
81
82   void (* reply)        (GMountOperation       *op,
83                          GMountOperationResult  result);
84
85   void (* aborted)      (GMountOperation       *op);
86
87   /**
88    * GMountOperationClass::show_processes:
89    * @op: a #GMountOperation
90    * @message: string containing a message to display to the user
91    * @processes: (element-type GPid): an array of #GPid for processes blocking
92    *    the operation
93    * @choices: (array zero-terminated=1) (element-type utf8): an array of
94    *    strings for each possible choice
95    *
96    * Virtual implementation of #GMountOperation::show-processes.
97    *
98    * Since: 2.22
99    */
100   void (* show_processes) (GMountOperation      *op,
101                            const gchar          *message,
102                            GArray               *processes,
103                            const gchar          *choices[]);
104
105   void (* show_unmount_progress) (GMountOperation *op,
106                                   const gchar     *message,
107                                   gint64           time_left,
108                                   gint64           bytes_left);
109
110   /*< private >*/
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 };
122
123 GIO_AVAILABLE_IN_ALL
124 GType             g_mount_operation_get_type      (void) G_GNUC_CONST;
125 GIO_AVAILABLE_IN_ALL
126 GMountOperation * g_mount_operation_new           (void);
127
128 GIO_AVAILABLE_IN_ALL
129 const char *  g_mount_operation_get_username      (GMountOperation *op);
130 GIO_AVAILABLE_IN_ALL
131 void          g_mount_operation_set_username      (GMountOperation *op,
132                                                    const char      *username);
133 GIO_AVAILABLE_IN_ALL
134 const char *  g_mount_operation_get_password      (GMountOperation *op);
135 GIO_AVAILABLE_IN_ALL
136 void          g_mount_operation_set_password      (GMountOperation *op,
137                                                    const char      *password);
138 GIO_AVAILABLE_IN_ALL
139 gboolean      g_mount_operation_get_anonymous     (GMountOperation *op);
140 GIO_AVAILABLE_IN_ALL
141 void          g_mount_operation_set_anonymous     (GMountOperation *op,
142                                                    gboolean         anonymous);
143 GIO_AVAILABLE_IN_ALL
144 const char *  g_mount_operation_get_domain        (GMountOperation *op);
145 GIO_AVAILABLE_IN_ALL
146 void          g_mount_operation_set_domain        (GMountOperation *op,
147                                                    const char      *domain);
148 GIO_AVAILABLE_IN_ALL
149 GPasswordSave g_mount_operation_get_password_save (GMountOperation *op);
150 GIO_AVAILABLE_IN_ALL
151 void          g_mount_operation_set_password_save (GMountOperation *op,
152                                                    GPasswordSave    save);
153 GIO_AVAILABLE_IN_ALL
154 int           g_mount_operation_get_choice        (GMountOperation *op);
155 GIO_AVAILABLE_IN_ALL
156 void          g_mount_operation_set_choice        (GMountOperation *op,
157                                                    int              choice);
158 GIO_AVAILABLE_IN_ALL
159 void          g_mount_operation_reply             (GMountOperation *op,
160                                                    GMountOperationResult result);
161 GIO_AVAILABLE_IN_2_58
162 gboolean      g_mount_operation_get_is_tcrypt_hidden_volume (GMountOperation *op);
163 GIO_AVAILABLE_IN_2_58
164 void          g_mount_operation_set_is_tcrypt_hidden_volume (GMountOperation *op,
165                                                              gboolean hidden_volume);
166 GIO_AVAILABLE_IN_2_58
167 gboolean      g_mount_operation_get_is_tcrypt_system_volume (GMountOperation *op);
168 GIO_AVAILABLE_IN_2_58
169 void          g_mount_operation_set_is_tcrypt_system_volume (GMountOperation *op,
170                                                              gboolean system_volume);
171 GIO_AVAILABLE_IN_2_58
172 guint  g_mount_operation_get_pim           (GMountOperation *op);
173 GIO_AVAILABLE_IN_2_58
174 void          g_mount_operation_set_pim           (GMountOperation *op,
175                                                    guint pim);
176
177 G_END_DECLS
178
179 #endif /* __G_MOUNT_OPERATION_H__ */