summaryrefslogtreecommitdiff
path: root/monitor
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2012-07-09 21:20:19 -0400
committerCosimo Cecchi <cosimoc@gnome.org>2012-07-11 19:59:52 -0400
commit8c61a01d9b143842fceb641e9ee03cb30bebb4ef (patch)
treeb19a6fcf25be4aadb174834648304b8da9c53082 /monitor
parent8dcd2e3756632bca6ea12744ee02099ba8a7e1d4 (diff)
downloadgvfs-8c61a01d9b143842fceb641e9ee03cb30bebb4ef.tar.gz
monitor: handle show-unmount-progress signal
https://bugzilla.gnome.org/show_bug.cgi?id=676111
Diffstat (limited to 'monitor')
-rw-r--r--monitor/proxy/dbus-interfaces.xml7
-rw-r--r--monitor/proxy/gproxymountoperation.c29
-rw-r--r--monitor/proxy/gproxymountoperation.h5
-rw-r--r--monitor/proxy/gproxyvolumemonitor.c29
-rw-r--r--monitor/proxy/gvfsproxyvolumemonitordaemon.c56
5 files changed, 126 insertions, 0 deletions
diff --git a/monitor/proxy/dbus-interfaces.xml b/monitor/proxy/dbus-interfaces.xml
index 49af8c76..7ea8a8d7 100644
--- a/monitor/proxy/dbus-interfaces.xml
+++ b/monitor/proxy/dbus-interfaces.xml
@@ -108,6 +108,13 @@
<arg type='ai' name='pid'/>
<arg type='as' name='choices'/>
</signal>
+ <signal name="MountOpShowUnmountProgress">
+ <arg type='s' name='dbus_name'/>
+ <arg type='s' name='id'/>
+ <arg type='s' name='message_to_show'/>
+ <arg type='t' name='time_left'/>
+ <arg type='t' name='bytes_left'/>
+ </signal>
<signal name="MountOpAborted">
<arg type='s' name='dbus_name'/>
<arg type='s' name='id'/>
diff --git a/monitor/proxy/gproxymountoperation.c b/monitor/proxy/gproxymountoperation.c
index 5253d59e..c21e9917 100644
--- a/monitor/proxy/gproxymountoperation.c
+++ b/monitor/proxy/gproxymountoperation.c
@@ -307,6 +307,35 @@ g_proxy_mount_operation_handle_show_processes (const gchar *wrapped_id,
/* ---------------------------------------------------------------------------------------------------- */
void
+g_proxy_mount_operation_handle_show_unmount_progress (const gchar *wrapped_id,
+ const gchar *message,
+ guint64 time_left,
+ guint64 bytes_left)
+{
+ ProxyMountOpData *data;
+
+ g_return_if_fail (wrapped_id != NULL);
+
+ if (id_to_op == NULL)
+ return;
+
+ G_LOCK (proxy_op);
+ data = g_hash_table_lookup (id_to_op, wrapped_id);
+ G_UNLOCK (proxy_op);
+
+ if (data == NULL)
+ return;
+
+ g_signal_emit_by_name (data->op,
+ "show-unmount-progress",
+ message,
+ time_left,
+ bytes_left);
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+void
g_proxy_mount_operation_handle_aborted (const gchar *wrapped_id)
{
ProxyMountOpData *data;
diff --git a/monitor/proxy/gproxymountoperation.h b/monitor/proxy/gproxymountoperation.h
index a7d51b8c..854a1028 100644
--- a/monitor/proxy/gproxymountoperation.h
+++ b/monitor/proxy/gproxymountoperation.h
@@ -49,6 +49,11 @@ void g_proxy_mount_operation_handle_show_processes (const gchar *wrapped
GVariant *pids,
const gchar *const *choices);
+void g_proxy_mount_operation_handle_show_unmount_progress (const gchar *wrapped_id,
+ const gchar *message,
+ guint64 time_left,
+ guint64 bytes_left);
+
void g_proxy_mount_operation_handle_aborted (const gchar *wrapped_id);
void g_proxy_mount_operation_destroy (const gchar *wrapped_id);
diff --git a/monitor/proxy/gproxyvolumemonitor.c b/monitor/proxy/gproxyvolumemonitor.c
index 6aab4dcc..eb7a187a 100644
--- a/monitor/proxy/gproxyvolumemonitor.c
+++ b/monitor/proxy/gproxyvolumemonitor.c
@@ -726,6 +726,34 @@ mount_op_show_processes (GVfsRemoteVolumeMonitor *object,
}
static void
+mount_op_show_unmount_progress (GVfsRemoteVolumeMonitor *object,
+ const gchar *arg_dbus_name,
+ const gchar *arg_id,
+ const gchar *arg_message_to_show,
+ guint64 arg_time_left,
+ guint64 arg_bytes_left,
+ gpointer user_data)
+{
+ GProxyVolumeMonitor *monitor = G_PROXY_VOLUME_MONITOR (user_data);
+ GProxyVolumeMonitorClass *klass;
+
+ G_LOCK (proxy_vm);
+
+ klass = G_PROXY_VOLUME_MONITOR_CLASS (G_OBJECT_GET_CLASS (monitor));
+
+ if (strcmp (arg_dbus_name, klass->dbus_name) != 0)
+ goto not_for_us;
+
+ g_proxy_mount_operation_handle_show_unmount_progress (arg_id,
+ arg_message_to_show,
+ arg_time_left,
+ arg_bytes_left);
+
+ not_for_us:
+ G_UNLOCK (proxy_vm);
+}
+
+static void
volume_added (GVfsRemoteVolumeMonitor *object,
const gchar *arg_dbus_name,
const gchar *arg_id,
@@ -962,6 +990,7 @@ g_proxy_volume_monitor_constructor (GType type,
g_signal_connect (monitor->proxy, "mount-op-ask-password", G_CALLBACK (mount_op_ask_password), monitor);
g_signal_connect (monitor->proxy, "mount-op-ask-question", G_CALLBACK (mount_op_ask_question), monitor);
g_signal_connect (monitor->proxy, "mount-op-show-processes", G_CALLBACK (mount_op_show_processes), monitor);
+ g_signal_connect (monitor->proxy, "mount-op-show-unmount-progress", G_CALLBACK (mount_op_show_unmount_progress), monitor);
g_signal_connect (monitor->proxy, "mount-pre-unmount", G_CALLBACK (mount_pre_unmount), monitor);
g_signal_connect (monitor->proxy, "mount-removed", G_CALLBACK (mount_removed), monitor);
g_signal_connect (monitor->proxy, "volume-added", G_CALLBACK (volume_added), monitor);
diff --git a/monitor/proxy/gvfsproxyvolumemonitordaemon.c b/monitor/proxy/gvfsproxyvolumemonitordaemon.c
index 713250c5..daa8a5f0 100644
--- a/monitor/proxy/gvfsproxyvolumemonitordaemon.c
+++ b/monitor/proxy/gvfsproxyvolumemonitordaemon.c
@@ -125,6 +125,15 @@ g_proxy_mount_operation_show_processes (GMountOperation *op,
}
static void
+g_proxy_mount_operation_show_unmount_progress (GMountOperation *op,
+ const gchar *message,
+ guint64 time_left,
+ guint64 bytes_left)
+{
+ /* do nothing */
+}
+
+static void
g_proxy_mount_operation_class_init (GProxyMountOperationClass *klass)
{
GMountOperationClass *mount_op_class;
@@ -134,6 +143,7 @@ g_proxy_mount_operation_class_init (GProxyMountOperationClass *klass)
mount_op_class->ask_password = g_proxy_mount_operation_ask_password;
mount_op_class->ask_question = g_proxy_mount_operation_ask_question;
mount_op_class->show_processes = g_proxy_mount_operation_show_processes;
+ mount_op_class->show_unmount_progress = g_proxy_mount_operation_show_unmount_progress;
}
static void
@@ -304,6 +314,51 @@ show_processes_cb (GMountOperation *mount_operation,
}
static void
+show_unmount_progress_cb (GMountOperation *mount_operation,
+ const gchar *message_to_show,
+ guint64 time_left,
+ guint64 bytes_left,
+ GVfsRemoteVolumeMonitor *monitor)
+{
+ const gchar *mount_op_id;
+ const gchar *mount_op_owner;
+ GDBusConnection *connection;
+ GError *error;
+
+ print_debug ("in show_unmount_progress_cb %s", message_to_show);
+
+ mount_op_id = g_object_get_data (G_OBJECT (mount_operation), "mount_op_id");
+ mount_op_owner = g_object_get_data (G_OBJECT (mount_operation), "mount_op_owner");
+
+ print_debug (" owner = '%s'", mount_op_owner);
+
+ if (message_to_show == NULL)
+ message_to_show = "";
+
+ connection = g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (monitor));
+ g_assert (connection != NULL);
+
+ error = NULL;
+ if (!g_dbus_connection_emit_signal (connection,
+ mount_op_owner,
+ "/org/gtk/Private/RemoteVolumeMonitor",
+ "org.gtk.Private.RemoteVolumeMonitor",
+ "MountOpShowUnmountProgress",
+ g_variant_new ("(ssstt)",
+ the_dbus_name,
+ mount_op_id,
+ message_to_show,
+ time_left,
+ bytes_left),
+ &error))
+ {
+ g_printerr ("Error emitting signal: %s (%s, %d)\n",
+ error->message, g_quark_to_string (error->domain), error->code);
+ g_error_free (error);
+ }
+}
+
+static void
aborted_cb (GMountOperation *mount_operation,
GVfsRemoteVolumeMonitor *monitor)
{
@@ -356,6 +411,7 @@ wrap_mount_op (const gchar *mount_op_id,
g_signal_connect (op, "ask-password", G_CALLBACK (ask_password_cb), monitor);
g_signal_connect (op, "ask-question", G_CALLBACK (ask_question_cb), monitor);
g_signal_connect (op, "show-processes", G_CALLBACK (show_processes_cb), monitor);
+ g_signal_connect (op, "show-unmount-progress", G_CALLBACK (show_unmount_progress_cb), monitor);
g_signal_connect (op, "aborted", G_CALLBACK (aborted_cb), monitor);
g_object_set_data_full (G_OBJECT (op), "mount_op_id", g_strdup (mount_op_id), g_free);
g_object_set_data_full (G_OBJECT (op), "mount_op_owner", g_strdup (mount_op_owner), g_free);