Re: Unable to unmout the mount point in Fedora 9
- From: Christian Neumair <cneumair gnome org>
- To: Vincent Guo <vincent y guo gmail com>
- Cc: nautilus-list gnome org
- Subject: Re: Unable to unmout the mount point in Fedora 9
- Date: Tue, 02 Sep 2008 13:44:39 +0200
Dear Vincent,
Am Dienstag, den 02.09.2008, 10:41 +0800 schrieb Vincent Guo:
> I used the following code to mount a volume,
> int main()
> {
...
> g_file_mount_enclosing_volume (file, 0, NULL, NULL, NULL, NULL);
> return (0);
> }
Even if that works, you are supposed to use an asynchronous mechanism
like you used in the unmount case. For some volumes actually snychronous
calls may be used, but you can not rely on that.
> and used the following code the unmount the mount point:
...
> static void
> cb(GObject *object, GAsyncResult *res, gpointer user_data)
> {
> ...
> gboolean ret = g_mount_unmount_finish(G_MOUNT (object), res,
> ...
> }
> int main()
> {
> ...
> g_mount_unmount(mount, 0, NULL, cb, NULL);
> return (0);
> }
Everything is OK with this unmount helper, except that you need a main
loop:
GMainLoop *main_loop;
main_loop = g_main_loop_new (NULL, TRUE);
g_main_loop_run (main_loop);
the main loop should be run right before the return call.
Note that your application will not exit unless you quit the main loop,
using g_main_loop_quit() [for instance in your callback].
best regards,
Christian Neumair
--
Christian Neumair <cneumair gnome org>
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]