Hi Guys:
I used the following code to mount a volume,
#include <stdio.h>
#include <string.h>
#include <gio/gfile.h>
int main()
{
g_type_init();
GFile* file = g_file_new_for_uri("smb://
10.32.100.25/public/joseph");
GError *error = NULL;
g_file_mount_enclosing_volume (file, 0, NULL, NULL, NULL, NULL);
return (0);
}
and used the following code the unmount the mount point:
#include <stdio.h>
#include <string.h>
#include <gio/gio.h>
#include <gio/gfile.h>
static void
cb(GObject *object, GAsyncResult *res, gpointer user_data)
{
g_print("cb Entry!\n");
GError *error = NULL;
gboolean ret = g_mount_unmount_finish(G_MOUNT (object), res, &error);
if (!ret)
g_print ("unmounting error!");
}
int main()
{
g_type_init();
GError *error = NULL;
GFile* file = g_file_new_for_uri("smb://
10.32.100.25/public/joseph");
GMount *mount = g_file_find_enclosing_mount (file, NULL, &error);
if (mount == NULL)
g_print("mount finding error(%s)\n", error->message);
else
g_print("finding right\n");
g_print ("%s\n", g_mount_get_name(mount));
g_mount_unmount(mount, 0, NULL, cb, NULL);
return (0);
}
it seems it can find the mount point correctly, but failed to unmount the mount point.
Can you help me out of this issue?
Thanks.
Vincent.