Fwd: Mount samba share with Gio.

Hi list. I wrote a very basic code based on gvfs-mount which purpose is to mount a samba share. But when I run, I get an error message: operation not permitted. I tested the uri in gvfs-mount and it works, only my code doesn't. I'm missed something?

#include <glib.h>
#include <gio/gio.h>

static GMainLoop* main_loop;

static void mount_done_cb(GObject* object,
GAsyncResult* res,
gpointer user_data)
gboolean succeeded;
GError* error = NULL;

succeeded = g_file_mount_enclosing_volume_finish (G_FILE (object), res, &error);

g_printerr ("Error mounting location: %s\n", error->message);
g_main_loop_quit (main_loop);

int main()
main_loop = g_main_loop_new(NULL, FALSE);
GFile* file = g_file_new_for_commandline_arg("smb://");
GMountOperation* mount_operation = g_mount_operation_new();
/*g_mount_operation_set_domain(mount_operation, "domain");
g_mount_operation_set_username(mount_operation, "user");
g_mount_operation_set_password(mount_operation, "password");
g_mount_operation_reply(mount_operation, G_MOUNT_OPERATION_HANDLED);*/
// even if I comment these lines I get the error

g_file_mount_enclosing_volume(file, 0, mount_operation, NULL, mount_done_cb, mount_operation);


return 0;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]