summaryrefslogtreecommitdiffstats
path: root/nautilus-plugin/src/nautilus_sfshare.c
diff options
context:
space:
mode:
Diffstat (limited to 'nautilus-plugin/src/nautilus_sfshare.c')
-rwxr-xr-xnautilus-plugin/src/nautilus_sfshare.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/nautilus-plugin/src/nautilus_sfshare.c b/nautilus-plugin/src/nautilus_sfshare.c
index 7ea11d6..302f3a9 100755
--- a/nautilus-plugin/src/nautilus_sfshare.c
+++ b/nautilus-plugin/src/nautilus_sfshare.c
@@ -122,7 +122,7 @@ sfshare_extension_get_file_items ( NautilusMenuProvider *provider,
{
NautilusMenuItem *item;
NautilusFileInfo *file;
- char *name;
+ gchar *name;
/* Only one folder must be selected */
@@ -165,14 +165,38 @@ sfshare_start_gui (NautilusMenuItem *item,
{
NautilusFileInfo *file = g_object_get_data ((GObject *) item, "sfshare_extension_folder");
- const char *path;
+ gchar *path;
GFile *f;
- const char *run;
+
+ const gchar *gui_argv[3];
+ GError *error;
f = nautilus_file_info_get_location (file);
path = g_file_get_path (f);
- /* Run command: sfshare-gui /path/to/folder & */
- run = g_strconcat("sfshare-gui ", path, " &", NULL);
- system(run);
+ gui_argv[0] = "/usr/bin/sfshare-gui";
+ gui_argv[1] = path; /* Path to selected directory */
+ gui_argv[2] = NULL;
+
+ error = NULL;
+ g_spawn_async (NULL, /* working_directory */
+ (gchar **) gui_argv,
+ NULL, /* envp */
+ 0, /* flags */
+ NULL, /* child_setup */
+ NULL, /* user_data */
+ NULL, /* child_pid */
+ &error);
+
+ if (error != NULL)
+ {
+ g_warning ("Error launching sfshare-gui: %s", error->message);
+ g_error_free (error);
+ }
+
+ /* free */
+ g_object_unref (f);
+ g_object_unref (file);
+ g_free (path);
+
}