Blob Blame History Raw
--- trunk/common/gvfsdaemonprotocol.h	2009/02/27 12:59:47	2257
+++ trunk/common/gvfsdaemonprotocol.h	2009/03/18 21:03:15	2342
@@ -73,6 +73,7 @@
 #define G_VFS_DBUS_MOUNT_OPERATION_INTERFACE "org.gtk.vfs.MountOperation"
 #define G_VFS_DBUS_MOUNT_OPERATION_OP_ASK_PASSWORD "askPassword"
 #define G_VFS_DBUS_MOUNT_OPERATION_OP_ASK_QUESTION "askQuestion"
+#define G_VFS_DBUS_MOUNT_OPERATION_OP_ABORTED "aborted"
 
 /* Implemented by the spawner of a process, the spawned process sends the
    spawned message (with noreply) when it has spawned and gotten a dbus id */
--- trunk/common/gmountoperationdbus.c	2008/08/25 13:27:36	1907
+++ trunk/common/gmountoperationdbus.c	2009/03/18 21:03:15	2342
@@ -51,6 +51,8 @@
 						       DBusMessage         *message);
 static void              mount_op_ask_question        (GMountOperationDBus *op_dbus,
 						       DBusMessage         *message);
+static void              mount_op_aborted             (GMountOperationDBus *op_dbus,
+						       DBusMessage         *message);
 
 static void
 g_mount_operation_dbus_free (GMountOperationDBus *op_dbus)
@@ -131,6 +133,10 @@
 					G_VFS_DBUS_MOUNT_OPERATION_INTERFACE,
 					G_VFS_DBUS_MOUNT_OPERATION_OP_ASK_QUESTION))
     mount_op_ask_question (op_dbus, message);
+  else if (dbus_message_is_method_call (message,
+					G_VFS_DBUS_MOUNT_OPERATION_INTERFACE,
+					G_VFS_DBUS_MOUNT_OPERATION_OP_ABORTED))
+    mount_op_aborted (op_dbus, message);
   else
     return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
@@ -322,3 +328,10 @@
   
   dbus_free_string_array (choices);
 }
+
+static void
+mount_op_aborted (GMountOperationDBus *op_dbus,
+		  DBusMessage         *message)
+{
+  g_signal_emit_by_name (op_dbus->op, "aborted");
+}
--- trunk/common/gmountsource.c	2008/09/23 19:16:06	2021
+++ trunk/common/gmountsource.c	2009/03/18 21:03:15	2342
@@ -433,8 +433,8 @@
   handled = g_mount_source_ask_password_finish (source,
                                                 res,
                                                 &aborted,
-                                                &username,
                                                 &password,
+                                                &username,
                                                 &domain,
 						NULL,
 						&password_save);
@@ -475,6 +475,7 @@
                                      flags,
 				     op_ask_password_reply,
 				     g_object_ref (op));
+  g_signal_stop_emission_by_name (op, "ask_password");
   return TRUE;
 }
 
@@ -695,9 +696,41 @@
 				     n_choices,
 				     op_ask_question_reply,
 				     g_object_ref (op));
+  g_signal_stop_emission_by_name (op, "ask_question");
   return TRUE;
 }
 
+static gboolean
+op_aborted (GMountOperation *op,
+	    GMountSource    *source)
+{
+  DBusMessage *message;
+  DBusConnection *connection;
+
+  /* If no dbus id specified, reply that we weren't handled */
+  if (source->dbus_id[0] == 0)
+    goto out;
+
+  connection = dbus_bus_get (DBUS_BUS_SESSION, NULL);
+  if (connection == NULL)
+    goto out;
+  
+  message = dbus_message_new_method_call (source->dbus_id,
+					  source->obj_path,
+					  G_VFS_DBUS_MOUNT_OPERATION_INTERFACE,
+					  G_VFS_DBUS_MOUNT_OPERATION_OP_ABORTED);
+
+  if (message)
+    {
+      dbus_connection_send (connection, message, NULL);
+      dbus_message_unref (message);
+    }
+
+ out:
+  return TRUE;
+}
+
+
 GMountOperation *
 g_mount_source_get_operation (GMountSource *mount_source)
 {
@@ -711,6 +744,7 @@
 
   g_signal_connect (op, "ask_password", (GCallback)op_ask_password, mount_source);
   g_signal_connect (op, "ask_question", (GCallback)op_ask_question, mount_source);
+  g_signal_connect (op, "aborted", (GCallback)op_aborted, mount_source);
 
   return op;
 }