| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | /* GIO - GLib Input, Output and Streaming Library
 | 
					
						
							|  |  |  |  |  *  | 
					
						
							|  |  |  |  |  * Copyright (C) 2006-2007 Red Hat, Inc. | 
					
						
							|  |  |  |  |  * | 
					
						
							|  |  |  |  |  * This library is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  |  * modify it under the terms of the GNU Lesser General Public | 
					
						
							|  |  |  |  |  * License as published by the Free Software Foundation; either | 
					
						
							|  |  |  |  |  * version 2 of the License, or (at your option) any later version. | 
					
						
							|  |  |  |  |  * | 
					
						
							|  |  |  |  |  * This library is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
					
						
							|  |  |  |  |  * Lesser General Public License for more details. | 
					
						
							|  |  |  |  |  * | 
					
						
							|  |  |  |  |  * You should have received a copy of the GNU Lesser General | 
					
						
							|  |  |  |  |  * Public License along with this library; if not, write to the | 
					
						
							|  |  |  |  |  * Free Software Foundation, Inc., 59 Temple Place, Suite 330, | 
					
						
							|  |  |  |  |  * Boston, MA 02111-1307, USA. | 
					
						
							|  |  |  |  |  * | 
					
						
							|  |  |  |  |  * Author: Alexander Larsson <alexl@redhat.com> | 
					
						
							|  |  |  |  |  */ | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-22 15:10:51 +00:00
										 |  |  |  | #include "config.h"
 | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | #include <string.h>
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | #include "gmountoperation.h"
 | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  | #include "gioenumtypes.h"
 | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | #include "glibintl.h"
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-28 12:39:07 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-05 21:59:38 -04:00
										 |  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * SECTION:gmountoperation | 
					
						
							| 
									
										
										
										
											2009-07-05 21:59:38 -04:00
										 |  |  |  |  * @short_description: Object used for authentication and user interaction | 
					
						
							| 
									
										
										
										
											2008-02-21 18:20:17 +00:00
										 |  |  |  |  * @include: gio/gio.h | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * | 
					
						
							| 
									
										
										
										
											2009-07-05 21:59:38 -04:00
										 |  |  |  |  * #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. | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * | 
					
						
							| 
									
										
										
										
											2009-07-05 21:59:38 -04:00
										 |  |  |  |  * 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(). | 
					
						
							| 
									
										
										
										
											2007-12-12 12:19:02 +00:00
										 |  |  |  |  * | 
					
						
							| 
									
										
										
										
											2009-07-05 21:59:38 -04:00
										 |  |  |  |  * 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. | 
					
						
							|  |  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | G_DEFINE_TYPE (GMountOperation, g_mount_operation, G_TYPE_OBJECT); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | enum { | 
					
						
							|  |  |  |  |   ASK_PASSWORD, | 
					
						
							|  |  |  |  |   ASK_QUESTION, | 
					
						
							|  |  |  |  |   REPLY, | 
					
						
							| 
									
										
										
										
											2009-02-17 00:02:06 +00:00
										 |  |  |  |   ABORTED, | 
					
						
							| 
									
										
										
										
											2009-07-05 21:59:38 -04:00
										 |  |  |  |   SHOW_PROCESSES, | 
					
						
							| 
									
										
										
										
											2012-07-06 15:41:47 -04:00
										 |  |  |  |   SHOW_UNMOUNT_PROGRESS, | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |   LAST_SIGNAL | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | static guint signals[LAST_SIGNAL] = { 0 }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | struct _GMountOperationPrivate { | 
					
						
							|  |  |  |  |   char *password; | 
					
						
							|  |  |  |  |   char *user; | 
					
						
							|  |  |  |  |   char *domain; | 
					
						
							|  |  |  |  |   gboolean anonymous; | 
					
						
							|  |  |  |  |   GPasswordSave password_save; | 
					
						
							|  |  |  |  |   int choice; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  | enum { | 
					
						
							|  |  |  |  |   PROP_0, | 
					
						
							|  |  |  |  |   PROP_USERNAME, | 
					
						
							|  |  |  |  |   PROP_PASSWORD, | 
					
						
							|  |  |  |  |   PROP_ANONYMOUS, | 
					
						
							|  |  |  |  |   PROP_DOMAIN, | 
					
						
							|  |  |  |  |   PROP_PASSWORD_SAVE, | 
					
						
							|  |  |  |  |   PROP_CHOICE | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | static void  | 
					
						
							|  |  |  |  | g_mount_operation_set_property (GObject      *object, | 
					
						
							|  |  |  |  |                                 guint         prop_id, | 
					
						
							|  |  |  |  |                                 const GValue *value, | 
					
						
							|  |  |  |  |                                 GParamSpec   *pspec) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |   GMountOperation *operation; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   operation = G_MOUNT_OPERATION (object); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   switch (prop_id) | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |     case PROP_USERNAME: | 
					
						
							|  |  |  |  |       g_mount_operation_set_username (operation,  | 
					
						
							|  |  |  |  |                                       g_value_get_string (value)); | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  |     | 
					
						
							|  |  |  |  |     case PROP_PASSWORD: | 
					
						
							|  |  |  |  |       g_mount_operation_set_password (operation,  | 
					
						
							|  |  |  |  |                                       g_value_get_string (value)); | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     case PROP_ANONYMOUS: | 
					
						
							|  |  |  |  |       g_mount_operation_set_anonymous (operation,  | 
					
						
							|  |  |  |  |                                        g_value_get_boolean (value)); | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     case PROP_DOMAIN: | 
					
						
							|  |  |  |  |       g_mount_operation_set_domain (operation,  | 
					
						
							|  |  |  |  |                                     g_value_get_string (value)); | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     case PROP_PASSWORD_SAVE: | 
					
						
							|  |  |  |  |       g_mount_operation_set_password_save (operation,  | 
					
						
							|  |  |  |  |                                            g_value_get_enum (value)); | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     case PROP_CHOICE: | 
					
						
							|  |  |  |  |       g_mount_operation_set_choice (operation,  | 
					
						
							|  |  |  |  |                                     g_value_get_int (value)); | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     default: | 
					
						
							|  |  |  |  |       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | static void  | 
					
						
							|  |  |  |  | g_mount_operation_get_property (GObject    *object, | 
					
						
							|  |  |  |  |                                 guint       prop_id, | 
					
						
							|  |  |  |  |                                 GValue     *value, | 
					
						
							|  |  |  |  |                                 GParamSpec *pspec) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |   GMountOperation *operation; | 
					
						
							|  |  |  |  |   GMountOperationPrivate *priv; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   operation = G_MOUNT_OPERATION (object); | 
					
						
							|  |  |  |  |   priv = operation->priv; | 
					
						
							|  |  |  |  |    | 
					
						
							|  |  |  |  |   switch (prop_id) | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |     case PROP_USERNAME: | 
					
						
							|  |  |  |  |       g_value_set_string (value, priv->user); | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     case PROP_PASSWORD: | 
					
						
							|  |  |  |  |       g_value_set_string (value, priv->password); | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     case PROP_ANONYMOUS: | 
					
						
							|  |  |  |  |       g_value_set_boolean (value, priv->anonymous); | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     case PROP_DOMAIN: | 
					
						
							|  |  |  |  |       g_value_set_string (value, priv->domain); | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     case PROP_PASSWORD_SAVE: | 
					
						
							|  |  |  |  |       g_value_set_enum (value, priv->password_save); | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     case PROP_CHOICE: | 
					
						
							|  |  |  |  |       g_value_set_int (value, priv->choice); | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     default: | 
					
						
							|  |  |  |  |       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | static void | 
					
						
							|  |  |  |  | g_mount_operation_finalize (GObject *object) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |   GMountOperation *operation; | 
					
						
							|  |  |  |  |   GMountOperationPrivate *priv; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   operation = G_MOUNT_OPERATION (object); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   priv = operation->priv; | 
					
						
							|  |  |  |  |    | 
					
						
							|  |  |  |  |   g_free (priv->password); | 
					
						
							|  |  |  |  |   g_free (priv->user); | 
					
						
							|  |  |  |  |   g_free (priv->domain); | 
					
						
							| 
									
										
										
										
											2008-06-16 09:54:04 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |   G_OBJECT_CLASS (g_mount_operation_parent_class)->finalize (object); | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | static gboolean | 
					
						
							| 
									
										
										
										
											2008-01-09 14:43:41 +00:00
										 |  |  |  | reply_non_handled_in_idle (gpointer data) | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-01-09 14:43:41 +00:00
										 |  |  |  |   GMountOperation *op = data; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   g_mount_operation_reply (op, G_MOUNT_OPERATION_UNHANDLED); | 
					
						
							| 
									
										
										
										
											2012-01-25 14:18:34 -05:00
										 |  |  |  |   return G_SOURCE_REMOVE; | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-01-09 14:43:41 +00:00
										 |  |  |  | static void | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | ask_password (GMountOperation *op, | 
					
						
							|  |  |  |  | 	      const char      *message, | 
					
						
							|  |  |  |  | 	      const char      *default_user, | 
					
						
							|  |  |  |  | 	      const char      *default_domain, | 
					
						
							| 
									
										
										
										
											2007-12-14 11:07:31 +00:00
										 |  |  |  | 	      GAskPasswordFlags flags) | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-01-09 14:43:41 +00:00
										 |  |  |  |   g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, | 
					
						
							|  |  |  |  | 		   reply_non_handled_in_idle, | 
					
						
							|  |  |  |  | 		   g_object_ref (op), | 
					
						
							|  |  |  |  | 		   g_object_unref); | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  |    | 
					
						
							| 
									
										
										
										
											2008-01-09 14:43:41 +00:00
										 |  |  |  | static void | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | ask_question (GMountOperation *op, | 
					
						
							|  |  |  |  | 	      const char      *message, | 
					
						
							|  |  |  |  | 	      const char      *choices[]) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-01-09 14:43:41 +00:00
										 |  |  |  |   g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, | 
					
						
							|  |  |  |  | 		   reply_non_handled_in_idle, | 
					
						
							|  |  |  |  | 		   g_object_ref (op), | 
					
						
							|  |  |  |  | 		   g_object_unref); | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-05 21:59:38 -04:00
										 |  |  |  | static void | 
					
						
							|  |  |  |  | show_processes (GMountOperation      *op, | 
					
						
							|  |  |  |  |                 const gchar          *message, | 
					
						
							|  |  |  |  |                 GArray               *processes, | 
					
						
							|  |  |  |  |                 const gchar          *choices[]) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |   g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, | 
					
						
							|  |  |  |  | 		   reply_non_handled_in_idle, | 
					
						
							|  |  |  |  | 		   g_object_ref (op), | 
					
						
							|  |  |  |  | 		   g_object_unref); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-06 15:41:47 -04:00
										 |  |  |  | static void | 
					
						
							|  |  |  |  | show_unmount_progress (GMountOperation *op, | 
					
						
							|  |  |  |  |                        const gchar     *message, | 
					
						
							| 
									
										
										
										
											2012-08-20 19:46:33 +02:00
										 |  |  |  |                        gint64           time_left, | 
					
						
							|  |  |  |  |                        gint64           bytes_left) | 
					
						
							| 
									
										
										
										
											2012-07-06 15:41:47 -04:00
										 |  |  |  | { | 
					
						
							|  |  |  |  |   /* nothing to do */ | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | static void | 
					
						
							|  |  |  |  | g_mount_operation_class_init (GMountOperationClass *klass) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  |   GObjectClass *object_class; | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |    | 
					
						
							|  |  |  |  |   g_type_class_add_private (klass, sizeof (GMountOperationPrivate)); | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  |   | 
					
						
							|  |  |  |  |   object_class = G_OBJECT_CLASS (klass); | 
					
						
							|  |  |  |  |   object_class->finalize = g_mount_operation_finalize; | 
					
						
							|  |  |  |  |   object_class->get_property = g_mount_operation_get_property; | 
					
						
							|  |  |  |  |   object_class->set_property = g_mount_operation_set_property; | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |    | 
					
						
							|  |  |  |  |   klass->ask_password = ask_password; | 
					
						
							|  |  |  |  |   klass->ask_question = ask_question; | 
					
						
							| 
									
										
										
										
											2009-07-05 21:59:38 -04:00
										 |  |  |  |   klass->show_processes = show_processes; | 
					
						
							| 
									
										
										
										
											2012-07-06 15:41:47 -04:00
										 |  |  |  |   klass->show_unmount_progress = show_unmount_progress; | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |    | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |   /**
 | 
					
						
							|  |  |  |  |    * GMountOperation::ask-password: | 
					
						
							|  |  |  |  |    * @op: a #GMountOperation requesting a password. | 
					
						
							|  |  |  |  |    * @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. | 
					
						
							| 
									
										
										
										
											2007-12-14 11:07:31 +00:00
										 |  |  |  |    * @flags: a set of #GAskPasswordFlags. | 
					
						
							| 
									
										
										
										
											2009-02-27 21:02:19 +00:00
										 |  |  |  |    * | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |    * Emitted when a mount operation asks the user for a password. | 
					
						
							| 
									
										
										
										
											2009-02-27 21:02:19 +00:00
										 |  |  |  |    * | 
					
						
							|  |  |  |  |    * 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 #GtkMessageDialog. | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |    */ | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |   signals[ASK_PASSWORD] = | 
					
						
							| 
									
										
										
										
											2008-08-11 19:45:08 +00:00
										 |  |  |  |     g_signal_new (I_("ask-password"), | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  | 		  G_TYPE_FROM_CLASS (object_class), | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | 		  G_SIGNAL_RUN_LAST, | 
					
						
							|  |  |  |  | 		  G_STRUCT_OFFSET (GMountOperationClass, ask_password), | 
					
						
							| 
									
										
										
										
											2008-01-09 14:43:41 +00:00
										 |  |  |  | 		  NULL, NULL, | 
					
						
							| 
									
										
										
										
											2011-07-19 14:18:10 -03:00
										 |  |  |  | 		  NULL, | 
					
						
							| 
									
										
										
										
											2008-01-09 14:43:41 +00:00
										 |  |  |  | 		  G_TYPE_NONE, 4, | 
					
						
							| 
									
										
										
										
											2008-01-07 13:56:10 +00:00
										 |  |  |  | 		  G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_ASK_PASSWORD_FLAGS); | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  | 		   | 
					
						
							|  |  |  |  |   /**
 | 
					
						
							|  |  |  |  |    * GMountOperation::ask-question: | 
					
						
							|  |  |  |  |    * @op: a #GMountOperation asking a question. | 
					
						
							|  |  |  |  |    * @message: string containing a message to display to the user. | 
					
						
							|  |  |  |  |    * @choices: an array of strings for each possible choice. | 
					
						
							| 
									
										
										
										
											2009-02-27 21:02:19 +00:00
										 |  |  |  |    * | 
					
						
							|  |  |  |  |    * 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 #GtkMessageDialog. | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |    */ | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |   signals[ASK_QUESTION] = | 
					
						
							| 
									
										
										
										
											2008-08-11 19:45:08 +00:00
										 |  |  |  |     g_signal_new (I_("ask-question"), | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  | 		  G_TYPE_FROM_CLASS (object_class), | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | 		  G_SIGNAL_RUN_LAST, | 
					
						
							|  |  |  |  | 		  G_STRUCT_OFFSET (GMountOperationClass, ask_question), | 
					
						
							| 
									
										
										
										
											2008-01-09 14:43:41 +00:00
										 |  |  |  | 		  NULL, NULL, | 
					
						
							| 
									
										
										
										
											2011-07-19 14:18:10 -03:00
										 |  |  |  | 		  NULL, | 
					
						
							| 
									
										
										
										
											2008-01-09 14:43:41 +00:00
										 |  |  |  | 		  G_TYPE_NONE, 2, | 
					
						
							| 
									
										
										
										
											2008-01-07 13:56:10 +00:00
										 |  |  |  | 		  G_TYPE_STRING, G_TYPE_STRV); | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  | 		   | 
					
						
							|  |  |  |  |   /**
 | 
					
						
							|  |  |  |  |    * GMountOperation::reply: | 
					
						
							|  |  |  |  |    * @op: a #GMountOperation. | 
					
						
							| 
									
										
										
										
											2008-07-21 02:46:54 +00:00
										 |  |  |  |    * @result: a #GMountOperationResult indicating how the request was handled | 
					
						
							| 
									
										
										
										
											2009-02-27 21:02:19 +00:00
										 |  |  |  |    * | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |    * Emitted when the user has replied to the mount operation. | 
					
						
							|  |  |  |  |    */ | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |   signals[REPLY] = | 
					
						
							|  |  |  |  |     g_signal_new (I_("reply"), | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  | 		  G_TYPE_FROM_CLASS (object_class), | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | 		  G_SIGNAL_RUN_LAST, | 
					
						
							|  |  |  |  | 		  G_STRUCT_OFFSET (GMountOperationClass, reply), | 
					
						
							|  |  |  |  | 		  NULL, NULL, | 
					
						
							| 
									
										
										
										
											2008-01-09 14:43:41 +00:00
										 |  |  |  | 		  g_cclosure_marshal_VOID__ENUM, | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | 		  G_TYPE_NONE, 1, | 
					
						
							| 
									
										
										
										
											2008-01-09 14:43:41 +00:00
										 |  |  |  | 		  G_TYPE_MOUNT_OPERATION_RESULT); | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-17 00:02:06 +00:00
										 |  |  |  |   /**
 | 
					
						
							|  |  |  |  |    * GMountOperation::aborted: | 
					
						
							|  |  |  |  |    * | 
					
						
							|  |  |  |  |    * Emitted by the backend when e.g. a device becomes unavailable | 
					
						
							| 
									
										
										
										
											2009-02-27 21:02:19 +00:00
										 |  |  |  |    * while a mount operation is in progress. | 
					
						
							| 
									
										
										
										
											2009-02-17 00:02:06 +00:00
										 |  |  |  |    * | 
					
						
							|  |  |  |  |    * Implementations of GMountOperation should handle this signal | 
					
						
							|  |  |  |  |    * by dismissing open password dialogs. | 
					
						
							|  |  |  |  |    * | 
					
						
							|  |  |  |  |    * Since: 2.20 | 
					
						
							|  |  |  |  |    */ | 
					
						
							| 
									
										
										
										
											2009-02-27 21:02:19 +00:00
										 |  |  |  |   signals[ABORTED] = | 
					
						
							| 
									
										
										
										
											2009-02-17 00:02:06 +00:00
										 |  |  |  |     g_signal_new (I_("aborted"), | 
					
						
							|  |  |  |  | 		  G_TYPE_FROM_CLASS (object_class), | 
					
						
							|  |  |  |  | 		  G_SIGNAL_RUN_LAST, | 
					
						
							|  |  |  |  | 		  G_STRUCT_OFFSET (GMountOperationClass, aborted), | 
					
						
							|  |  |  |  | 		  NULL, NULL, | 
					
						
							|  |  |  |  | 		  g_cclosure_marshal_VOID__VOID, | 
					
						
							|  |  |  |  | 		  G_TYPE_NONE, 0); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-05 21:59:38 -04:00
										 |  |  |  |   /**
 | 
					
						
							|  |  |  |  |    * GMountOperation::show-processes: | 
					
						
							|  |  |  |  |    * @op: a #GMountOperation. | 
					
						
							|  |  |  |  |    * @message: string containing a message to display to the user. | 
					
						
							| 
									
										
										
										
											2012-01-07 09:54:53 -08:00
										 |  |  |  |    * @processes: (element-type GPid): an array of #GPid for processes | 
					
						
							|  |  |  |  |    *   blocking the operation. | 
					
						
							| 
									
										
										
										
											2009-07-05 21:59:38 -04:00
										 |  |  |  |    * @choices: an array of strings for each possible choice. | 
					
						
							|  |  |  |  |    * | 
					
						
							|  |  |  |  |    * Emitted when one or more processes are blocking an operation | 
					
						
							|  |  |  |  |    * e.g. unmounting/ejecting a #GMount or stopping a #GDrive. | 
					
						
							|  |  |  |  |    * | 
					
						
							|  |  |  |  |    * Note that this signal may be emitted several times to update the | 
					
						
							|  |  |  |  |    * list of blocking processes as processes close files. The | 
					
						
							|  |  |  |  |    * application should only respond with g_mount_operation_reply() to | 
					
						
							|  |  |  |  |    * the latest signal (setting #GMountOperation:choice to the choice | 
					
						
							|  |  |  |  |    * the user made). | 
					
						
							|  |  |  |  |    * | 
					
						
							|  |  |  |  |    * 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 #GtkMessageDialog. | 
					
						
							|  |  |  |  |    * | 
					
						
							|  |  |  |  |    * Since: 2.22 | 
					
						
							|  |  |  |  |    */ | 
					
						
							|  |  |  |  |   signals[SHOW_PROCESSES] = | 
					
						
							|  |  |  |  |     g_signal_new (I_("show-processes"), | 
					
						
							|  |  |  |  | 		  G_TYPE_FROM_CLASS (object_class), | 
					
						
							|  |  |  |  | 		  G_SIGNAL_RUN_LAST, | 
					
						
							|  |  |  |  | 		  G_STRUCT_OFFSET (GMountOperationClass, show_processes), | 
					
						
							|  |  |  |  | 		  NULL, NULL, | 
					
						
							| 
									
										
										
										
											2011-07-19 14:18:10 -03:00
										 |  |  |  | 		  NULL, | 
					
						
							| 
									
										
										
										
											2009-07-05 21:59:38 -04:00
										 |  |  |  | 		  G_TYPE_NONE, 3, | 
					
						
							|  |  |  |  | 		  G_TYPE_STRING, G_TYPE_ARRAY, G_TYPE_STRV); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-06 15:41:47 -04:00
										 |  |  |  |   /**
 | 
					
						
							|  |  |  |  |    * GMountOperation::show-unmount-progress: | 
					
						
							|  |  |  |  |    * @op: a #GMountOperation: | 
					
						
							|  |  |  |  |    * @message: string containing a mesage to display to the user | 
					
						
							| 
									
										
										
										
											2012-08-20 19:46:33 +02:00
										 |  |  |  |    * @time_left: the estimated time left before the operation completes, | 
					
						
							|  |  |  |  |    *     in microseconds, or -1 | 
					
						
							| 
									
										
										
										
											2012-07-06 15:41:47 -04:00
										 |  |  |  |    * @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 | 
					
						
							|  |  |  |  |    * | 
					
						
							|  |  |  |  |    * 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 #GtkMessageDialog. | 
					
						
							| 
									
										
										
										
											2012-07-11 20:25:59 -04:00
										 |  |  |  |    * | 
					
						
							|  |  |  |  |    * Since: 2.34 | 
					
						
							| 
									
										
										
										
											2012-07-06 15:41:47 -04:00
										 |  |  |  |    */ | 
					
						
							|  |  |  |  |   signals[SHOW_UNMOUNT_PROGRESS] = | 
					
						
							|  |  |  |  |     g_signal_new (I_("show-unmount-progress"), | 
					
						
							|  |  |  |  |                   G_TYPE_FROM_CLASS (object_class), | 
					
						
							|  |  |  |  |                   G_SIGNAL_RUN_LAST, | 
					
						
							|  |  |  |  |                   G_STRUCT_OFFSET (GMountOperationClass, show_unmount_progress), | 
					
						
							|  |  |  |  |                   NULL, NULL, NULL, | 
					
						
							|  |  |  |  |                   G_TYPE_NONE, 3, | 
					
						
							| 
									
										
										
										
											2012-08-20 19:46:33 +02:00
										 |  |  |  |                   G_TYPE_STRING, G_TYPE_INT64, G_TYPE_INT64); | 
					
						
							| 
									
										
										
										
											2012-07-06 15:41:47 -04:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  |   /**
 | 
					
						
							|  |  |  |  |    * GMountOperation:username: | 
					
						
							|  |  |  |  |    * | 
					
						
							|  |  |  |  |    * The user name that is used for authentication when carrying out | 
					
						
							|  |  |  |  |    * the mount operation. | 
					
						
							|  |  |  |  |    */  | 
					
						
							|  |  |  |  |   g_object_class_install_property (object_class, | 
					
						
							|  |  |  |  |                                    PROP_USERNAME, | 
					
						
							|  |  |  |  |                                    g_param_spec_string ("username", | 
					
						
							|  |  |  |  |                                                         P_("Username"), | 
					
						
							|  |  |  |  |                                                         P_("The user name"), | 
					
						
							|  |  |  |  |                                                         NULL, | 
					
						
							| 
									
										
										
										
											2007-12-01 06:12:45 +00:00
										 |  |  |  |                                                         G_PARAM_READWRITE| | 
					
						
							|  |  |  |  |                                                         G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)); | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |   /**
 | 
					
						
							|  |  |  |  |    * GMountOperation:password: | 
					
						
							|  |  |  |  |    * | 
					
						
							|  |  |  |  |    * The password that is used for authentication when carrying out | 
					
						
							|  |  |  |  |    * the mount operation. | 
					
						
							|  |  |  |  |    */  | 
					
						
							|  |  |  |  |   g_object_class_install_property (object_class, | 
					
						
							|  |  |  |  |                                    PROP_PASSWORD, | 
					
						
							|  |  |  |  |                                    g_param_spec_string ("password", | 
					
						
							|  |  |  |  |                                                         P_("Password"), | 
					
						
							|  |  |  |  |                                                         P_("The password"), | 
					
						
							|  |  |  |  |                                                         NULL, | 
					
						
							| 
									
										
										
										
											2007-12-01 06:12:45 +00:00
										 |  |  |  |                                                         G_PARAM_READWRITE| | 
					
						
							|  |  |  |  |                                                         G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)); | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |   /**
 | 
					
						
							|  |  |  |  |    * GMountOperation:anonymous: | 
					
						
							|  |  |  |  |    *  | 
					
						
							|  |  |  |  |    * Whether to use an anonymous user when authenticating. | 
					
						
							|  |  |  |  |    */ | 
					
						
							|  |  |  |  |   g_object_class_install_property (object_class, | 
					
						
							|  |  |  |  |                                    PROP_ANONYMOUS, | 
					
						
							|  |  |  |  |                                    g_param_spec_boolean ("anonymous", | 
					
						
							|  |  |  |  |                                                          P_("Anonymous"), | 
					
						
							|  |  |  |  |                                                          P_("Whether to use an anonymous user"), | 
					
						
							|  |  |  |  |                                                          FALSE, | 
					
						
							| 
									
										
										
										
											2007-12-01 06:12:45 +00:00
										 |  |  |  |                                                          G_PARAM_READWRITE| | 
					
						
							|  |  |  |  |                                                          G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)); | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |   /**
 | 
					
						
							|  |  |  |  |    * GMountOperation:domain: | 
					
						
							|  |  |  |  |    * | 
					
						
							|  |  |  |  |    * The domain to use for the mount operation. | 
					
						
							|  |  |  |  |    */  | 
					
						
							|  |  |  |  |   g_object_class_install_property (object_class, | 
					
						
							|  |  |  |  |                                    PROP_DOMAIN, | 
					
						
							|  |  |  |  |                                    g_param_spec_string ("domain", | 
					
						
							|  |  |  |  |                                                         P_("Domain"), | 
					
						
							|  |  |  |  |                                                         P_("The domain of the mount operation"), | 
					
						
							|  |  |  |  |                                                         NULL, | 
					
						
							| 
									
										
										
										
											2007-12-01 06:12:45 +00:00
										 |  |  |  |                                                         G_PARAM_READWRITE| | 
					
						
							|  |  |  |  |                                                         G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)); | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |   /**
 | 
					
						
							|  |  |  |  |    * GMountOperation:password-save: | 
					
						
							|  |  |  |  |    * | 
					
						
							|  |  |  |  |    * Determines if and how the password information should be saved.  | 
					
						
							|  |  |  |  |    */  | 
					
						
							|  |  |  |  |   g_object_class_install_property (object_class, | 
					
						
							|  |  |  |  |                                    PROP_PASSWORD_SAVE, | 
					
						
							|  |  |  |  |                                    g_param_spec_enum ("password-save", | 
					
						
							|  |  |  |  |                                                       P_("Password save"), | 
					
						
							|  |  |  |  |                                                       P_("How passwords should be saved"), | 
					
						
							|  |  |  |  |                                                       G_TYPE_PASSWORD_SAVE, | 
					
						
							|  |  |  |  |                                                       G_PASSWORD_SAVE_NEVER, | 
					
						
							| 
									
										
										
										
											2007-12-01 06:12:45 +00:00
										 |  |  |  |                                                       G_PARAM_READWRITE| | 
					
						
							|  |  |  |  |                                                       G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)); | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |   /**
 | 
					
						
							|  |  |  |  |    * GMountOperation:choice: | 
					
						
							|  |  |  |  |    * | 
					
						
							|  |  |  |  |    * The index of the user's choice when a question is asked during the  | 
					
						
							|  |  |  |  |    * mount operation. See the #GMountOperation::ask-question signal. | 
					
						
							|  |  |  |  |    */  | 
					
						
							|  |  |  |  |   g_object_class_install_property (object_class, | 
					
						
							|  |  |  |  |                                    PROP_CHOICE, | 
					
						
							|  |  |  |  |                                    g_param_spec_int ("choice", | 
					
						
							|  |  |  |  |                                                      P_("Choice"), | 
					
						
							|  |  |  |  |                                                      P_("The users choice"), | 
					
						
							|  |  |  |  |                                                      0, G_MAXINT, 0, | 
					
						
							| 
									
										
										
										
											2007-12-01 06:12:45 +00:00
										 |  |  |  |                                                      G_PARAM_READWRITE| | 
					
						
							|  |  |  |  |                                                      G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)); | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | static void | 
					
						
							|  |  |  |  | g_mount_operation_init (GMountOperation *operation) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |   operation->priv = G_TYPE_INSTANCE_GET_PRIVATE (operation, | 
					
						
							|  |  |  |  | 						 G_TYPE_MOUNT_OPERATION, | 
					
						
							|  |  |  |  | 						 GMountOperationPrivate); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /**
 | 
					
						
							|  |  |  |  |  * g_mount_operation_new: | 
					
						
							|  |  |  |  |  *  | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * Creates a new mount operation. | 
					
						
							|  |  |  |  |  *  | 
					
						
							|  |  |  |  |  * Returns: a #GMountOperation. | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  **/ | 
					
						
							|  |  |  |  | GMountOperation * | 
					
						
							|  |  |  |  | g_mount_operation_new (void) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |   return g_object_new (G_TYPE_MOUNT_OPERATION, NULL); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2012-04-02 17:16:35 +02:00
										 |  |  |  |  * g_mount_operation_get_username: | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * @op: a #GMountOperation. | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  *  | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * Get the user name from the mount operation. | 
					
						
							|  |  |  |  |  * | 
					
						
							|  |  |  |  |  * Returns: a string containing the user name. | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  **/ | 
					
						
							|  |  |  |  | const char * | 
					
						
							|  |  |  |  | g_mount_operation_get_username (GMountOperation *op) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |   g_return_val_if_fail (G_IS_MOUNT_OPERATION (op), NULL); | 
					
						
							|  |  |  |  |   return op->priv->user; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /**
 | 
					
						
							|  |  |  |  |  * g_mount_operation_set_username: | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * @op: a #GMountOperation. | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  * @username: input username. | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * | 
					
						
							|  |  |  |  |  * Sets the user name within @op to @username. | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  **/ | 
					
						
							|  |  |  |  | void | 
					
						
							|  |  |  |  | g_mount_operation_set_username (GMountOperation *op, | 
					
						
							|  |  |  |  | 				const char      *username) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |   g_return_if_fail (G_IS_MOUNT_OPERATION (op)); | 
					
						
							|  |  |  |  |   g_free (op->priv->user); | 
					
						
							|  |  |  |  |   op->priv->user = g_strdup (username); | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  |   g_object_notify (G_OBJECT (op), "username"); | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /**
 | 
					
						
							|  |  |  |  |  * g_mount_operation_get_password: | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * @op: a #GMountOperation. | 
					
						
							|  |  |  |  |  * | 
					
						
							|  |  |  |  |  * Gets a password from the mount operation.  | 
					
						
							|  |  |  |  |  * | 
					
						
							|  |  |  |  |  * Returns: a string containing the password within @op. | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  **/ | 
					
						
							|  |  |  |  | const char * | 
					
						
							|  |  |  |  | g_mount_operation_get_password (GMountOperation *op) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |   g_return_val_if_fail (G_IS_MOUNT_OPERATION (op), NULL); | 
					
						
							|  |  |  |  |   return op->priv->password; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /**
 | 
					
						
							|  |  |  |  |  * g_mount_operation_set_password: | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * @op: a #GMountOperation. | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  * @password: password to set. | 
					
						
							|  |  |  |  |  *  | 
					
						
							|  |  |  |  |  * Sets the mount operation's password to @password.   | 
					
						
							|  |  |  |  |  * | 
					
						
							|  |  |  |  |  **/ | 
					
						
							|  |  |  |  | void | 
					
						
							|  |  |  |  | g_mount_operation_set_password (GMountOperation *op, | 
					
						
							|  |  |  |  | 				const char      *password) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |   g_return_if_fail (G_IS_MOUNT_OPERATION (op)); | 
					
						
							|  |  |  |  |   g_free (op->priv->password); | 
					
						
							|  |  |  |  |   op->priv->password = g_strdup (password); | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  |   g_object_notify (G_OBJECT (op), "password"); | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /**
 | 
					
						
							|  |  |  |  |  * g_mount_operation_get_anonymous: | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * @op: a #GMountOperation. | 
					
						
							|  |  |  |  |  *  | 
					
						
							|  |  |  |  |  * Check to see whether the mount operation is being used  | 
					
						
							|  |  |  |  |  * for an anonymous user. | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  *  | 
					
						
							|  |  |  |  |  * Returns: %TRUE if mount operation is anonymous.  | 
					
						
							|  |  |  |  |  **/ | 
					
						
							|  |  |  |  | gboolean | 
					
						
							|  |  |  |  | g_mount_operation_get_anonymous (GMountOperation *op) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |   g_return_val_if_fail (G_IS_MOUNT_OPERATION (op), FALSE); | 
					
						
							|  |  |  |  |   return op->priv->anonymous; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /**
 | 
					
						
							|  |  |  |  |  * g_mount_operation_set_anonymous: | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * @op: a #GMountOperation. | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  * @anonymous: boolean value. | 
					
						
							|  |  |  |  |  *  | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * Sets the mount operation to use an anonymous user if @anonymous is %TRUE. | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  **/   | 
					
						
							|  |  |  |  | void | 
					
						
							|  |  |  |  | g_mount_operation_set_anonymous (GMountOperation *op, | 
					
						
							|  |  |  |  | 				 gboolean         anonymous) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  |   GMountOperationPrivate *priv; | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |   g_return_if_fail (G_IS_MOUNT_OPERATION (op)); | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  |   priv = op->priv; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   if (priv->anonymous != anonymous) | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |       priv->anonymous = anonymous; | 
					
						
							|  |  |  |  |       g_object_notify (G_OBJECT (op), "anonymous"); | 
					
						
							|  |  |  |  |     } | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /**
 | 
					
						
							|  |  |  |  |  * g_mount_operation_get_domain: | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * @op: a #GMountOperation. | 
					
						
							|  |  |  |  |  *  | 
					
						
							|  |  |  |  |  * Gets the domain of the mount operation. | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  *  | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * Returns: a string set to the domain.  | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  **/ | 
					
						
							|  |  |  |  | const char * | 
					
						
							|  |  |  |  | g_mount_operation_get_domain (GMountOperation *op) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |   g_return_val_if_fail (G_IS_MOUNT_OPERATION (op), NULL); | 
					
						
							|  |  |  |  |   return op->priv->domain; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /**
 | 
					
						
							|  |  |  |  |  * g_mount_operation_set_domain: | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * @op: a #GMountOperation. | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  * @domain: the domain to set. | 
					
						
							|  |  |  |  |  *  | 
					
						
							|  |  |  |  |  * Sets the mount operation's domain.  | 
					
						
							|  |  |  |  |  **/   | 
					
						
							|  |  |  |  | void | 
					
						
							|  |  |  |  | g_mount_operation_set_domain (GMountOperation *op, | 
					
						
							|  |  |  |  | 			      const char      *domain) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |   g_return_if_fail (G_IS_MOUNT_OPERATION (op)); | 
					
						
							|  |  |  |  |   g_free (op->priv->domain); | 
					
						
							|  |  |  |  |   op->priv->domain = g_strdup (domain); | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  |   g_object_notify (G_OBJECT (op), "domain"); | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /**
 | 
					
						
							|  |  |  |  |  * g_mount_operation_get_password_save: | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * @op: a #GMountOperation. | 
					
						
							|  |  |  |  |  *  | 
					
						
							|  |  |  |  |  * Gets the state of saving passwords for the mount operation. | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  * | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * Returns: a #GPasswordSave flag.  | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  **/   | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | GPasswordSave | 
					
						
							|  |  |  |  | g_mount_operation_get_password_save (GMountOperation *op) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |   g_return_val_if_fail (G_IS_MOUNT_OPERATION (op), G_PASSWORD_SAVE_NEVER); | 
					
						
							|  |  |  |  |   return op->priv->password_save; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * g_mount_operation_set_password_save: | 
					
						
							|  |  |  |  |  * @op: a #GMountOperation. | 
					
						
							|  |  |  |  |  * @save: a set of #GPasswordSave flags. | 
					
						
							|  |  |  |  |  *  | 
					
						
							|  |  |  |  |  * Sets the state of saving passwords for the mount operation. | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  *  | 
					
						
							|  |  |  |  |  **/    | 
					
						
							|  |  |  |  | void | 
					
						
							|  |  |  |  | g_mount_operation_set_password_save (GMountOperation *op, | 
					
						
							|  |  |  |  | 				     GPasswordSave    save) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  |   GMountOperationPrivate *priv; | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |   g_return_if_fail (G_IS_MOUNT_OPERATION (op)); | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  |   priv = op->priv; | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  |   if (priv->password_save != save) | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |       priv->password_save = save; | 
					
						
							|  |  |  |  |       g_object_notify (G_OBJECT (op), "password-save"); | 
					
						
							|  |  |  |  |     } | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /**
 | 
					
						
							|  |  |  |  |  * g_mount_operation_get_choice: | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * @op: a #GMountOperation. | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  *  | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * 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. | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  **/ | 
					
						
							|  |  |  |  | int | 
					
						
							|  |  |  |  | g_mount_operation_get_choice (GMountOperation *op) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |   g_return_val_if_fail (G_IS_MOUNT_OPERATION (op), 0); | 
					
						
							|  |  |  |  |   return op->priv->choice; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /**
 | 
					
						
							|  |  |  |  |  * g_mount_operation_set_choice: | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * @op: a #GMountOperation. | 
					
						
							|  |  |  |  |  * @choice: an integer. | 
					
						
							|  |  |  |  |  * | 
					
						
							|  |  |  |  |  * Sets a default choice for the mount operation. | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  **/ | 
					
						
							|  |  |  |  | void | 
					
						
							|  |  |  |  | g_mount_operation_set_choice (GMountOperation *op, | 
					
						
							| 
									
										
										
										
											2007-11-30 05:11:25 +00:00
										 |  |  |  | 			      int              choice) | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  |   GMountOperationPrivate *priv; | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |   g_return_if_fail (G_IS_MOUNT_OPERATION (op)); | 
					
						
							| 
									
										
										
										
											2007-12-01 04:29:14 +00:00
										 |  |  |  |   priv = op->priv; | 
					
						
							|  |  |  |  |   if (priv->choice != choice) | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |       priv->choice = choice; | 
					
						
							|  |  |  |  |       g_object_notify (G_OBJECT (op), "choice"); | 
					
						
							|  |  |  |  |     } | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /**
 | 
					
						
							|  |  |  |  |  * g_mount_operation_reply: | 
					
						
							| 
									
										
										
										
											2008-01-21 03:49:20 +00:00
										 |  |  |  |  * @op: a #GMountOperation | 
					
						
							|  |  |  |  |  * @result: a #GMountOperationResult | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  *  | 
					
						
							| 
									
										
										
										
											2007-11-27 14:00:13 +00:00
										 |  |  |  |  * Emits the #GMountOperation::reply signal. | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  |  **/ | 
					
						
							|  |  |  |  | void | 
					
						
							|  |  |  |  | g_mount_operation_reply (GMountOperation *op, | 
					
						
							| 
									
										
										
										
											2008-01-09 14:43:41 +00:00
										 |  |  |  | 			 GMountOperationResult result) | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | { | 
					
						
							|  |  |  |  |   g_return_if_fail (G_IS_MOUNT_OPERATION (op)); | 
					
						
							| 
									
										
										
										
											2008-01-09 14:43:41 +00:00
										 |  |  |  |   g_signal_emit (op, signals[REPLY], 0, result); | 
					
						
							| 
									
										
										
										
											2007-11-26 16:13:05 +00:00
										 |  |  |  | } |