diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2009-03-26 13:50:04 +0000 |
---|---|---|
committer | Carlos Garnacho <carlosg@src.gnome.org> | 2009-03-26 13:50:04 +0000 |
commit | 41b61328bae59250c6421611785e879fbbacb804 (patch) | |
tree | 80b9c12d59540efbadf8e39bcf52e8ed252b9d84 /monitor/hal | |
parent | 4a63e6e6fd78e18ffa6fa84c053b7cb009bb36f7 (diff) | |
download | gvfs-41b61328bae59250c6421611785e879fbbacb804.tar.gz |
Bug 576083 – pre-unmount signals not being triggered
2009-03-26 Carlos Garnacho <carlosg@gnome.org>
Bug 576083 – pre-unmount signals not being triggered
* monitor/hal/ghalmount.c (unmount_do) (unmount_do_cb): Emit
::mount-pre-unmount and wait 500msec before actually trying to
unmount.
* monitor/proxy/gproxyshadowmount.c (real_mount_pre_unmount_cb): Proxy
the shadowed mount pre-unmount signal.
* monitor/proxy/gproxyvolumemonitor.c (filter_function): GMount
doesn't have the ::pre-unmount signal yet, so don't emit it.
svn path=/trunk/; revision=2350
Diffstat (limited to 'monitor/hal')
-rw-r--r-- | monitor/hal/ghalmount.c | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/monitor/hal/ghalmount.c b/monitor/hal/ghalmount.c index 2c84f4b4..20371088 100644 --- a/monitor/hal/ghalmount.c +++ b/monitor/hal/ghalmount.c @@ -775,6 +775,7 @@ typedef struct { guint error_channel_source_id; GString *error_string; gboolean using_legacy; + gchar **argv; } UnmountOp; static void @@ -824,6 +825,7 @@ unmount_cb (GPid pid, gint status, gpointer user_data) g_source_remove (data->error_channel_source_id); g_io_channel_unref (data->error_channel); g_string_free (data->error_string, TRUE); + g_strfreev (data->argv); close (data->error_fd); g_spawn_close_pid (pid); @@ -846,28 +848,16 @@ unmount_read_error (GIOChannel *channel, return TRUE; } -static void -unmount_do (GMount *mount, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data, - char **argv, - gboolean using_legacy) +static gboolean +unmount_do_cb (gpointer user_data) { - UnmountOp *data; + UnmountOp *data = (UnmountOp *) user_data; GPid child_pid; GError *error; - data = g_new0 (UnmountOp, 1); - data->object = g_object_ref (mount); - data->callback = callback; - data->user_data = user_data; - data->cancellable = cancellable; - data->using_legacy = using_legacy; - error = NULL; if (!g_spawn_async_with_pipes (NULL, /* working dir */ - argv, + data->argv, NULL, /* envp */ G_SPAWN_DO_NOT_REAP_CHILD|G_SPAWN_SEARCH_PATH, NULL, /* child_setup */ @@ -886,15 +876,43 @@ unmount_do (GMount *mount, g_simple_async_result_complete (simple); g_object_unref (simple); g_error_free (error); + g_strfreev (data->argv); g_free (data); - return; + + return FALSE; } data->error_string = g_string_new (""); data->error_channel = g_io_channel_unix_new (data->error_fd); data->error_channel_source_id = g_io_add_watch (data->error_channel, G_IO_IN, unmount_read_error, data); g_child_watch_add (child_pid, unmount_cb, data); + + return FALSE; } +static void +unmount_do (GMount *mount, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data, + char **argv, + gboolean using_legacy) +{ + GHalMount *hal_mount = G_HAL_MOUNT (mount); + UnmountOp *data; + + data = g_new0 (UnmountOp, 1); + data->object = g_object_ref (mount); + data->callback = callback; + data->user_data = user_data; + data->cancellable = cancellable; + data->using_legacy = using_legacy; + data->argv = g_strdupv (argv); + + if (hal_mount->volume_monitor != NULL) + g_signal_emit_by_name (hal_mount->volume_monitor, "mount-pre-unmount", mount); + + g_timeout_add (500, unmount_do_cb, data); +} static void g_hal_mount_unmount (GMount *mount, |