Fwd: Mount samba share with Gio.

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

 



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);

if(!succeeded)
{
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://192.168.1.1/share");
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);

g_main_loop_run(main_loop);

return 0;
}


_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux