Commit 55d58869 authored by Antenore Gatta's avatar Antenore Gatta

Improvements to request #520. Args are parsed correcthly

parent e58ecf9e
......@@ -1421,7 +1421,7 @@ GtkWidget* remmina_file_editor_new_from_file(RemminaFile* remminafile)
priv->precommand_entry = widget;
cs = remmina_file_get_string(remminafile, "precommand");
gtk_entry_set_text(GTK_ENTRY(widget), cs ? cs : "");
s = g_strdup_printf(_("Script/command full path w/o arguments"));
s = g_strdup_printf(_("Script/command with arguments"));
gtk_widget_set_tooltip_text (widget, s);
g_free(s);
......@@ -1440,7 +1440,9 @@ GtkWidget* remmina_file_editor_new_from_file(RemminaFile* remminafile)
priv->postcommand_entry = widget;
cs = remmina_file_get_string(remminafile, "postcommand");
gtk_entry_set_text(GTK_ENTRY(widget), cs ? cs : "");
s = g_strdup_printf(_("Script/command full path w/o arguments"));
s = g_strdup_printf(_("Script/command with arguments"));
gtk_widget_set_tooltip_text (widget, s);
g_free(s);
/* Create the Preference frame */
widget = gtk_event_box_new();
......
......@@ -66,7 +66,6 @@ GtkDialog* remmina_plugin_cmdexec_new(RemminaFile* remminafile, const char *remm
char const *plugin_cmd = NULL;
gchar pre[11];
gchar post[12];
char const *cmd = NULL;
GPid child_pid;
strcpy(pre, "precommand");
......@@ -83,7 +82,6 @@ GtkDialog* remmina_plugin_cmdexec_new(RemminaFile* remminafile, const char *remm
if (plugin_cmd != NULL)
{
cmd = g_shell_quote(remmina_file_get_string(remminafile, remmina_plugin_cmdexec_type));
pcspinner = g_new(PCon_Spinner, 1);
builder = remmina_public_gtk_builder_new_from_file("remmina_spinner.glade");
pcspinner->dialog = GTK_DIALOG(gtk_builder_get_object(builder, "DialogSpinner"));
......@@ -94,11 +92,7 @@ GtkDialog* remmina_plugin_cmdexec_new(RemminaFile* remminafile, const char *remm
gtk_builder_connect_signals(builder, NULL);
/* Exec a predefined command */
#ifdef g_info
/* g_info available since glib 2.4 */
g_info("Spawning \"%s\"...", cmd);
#endif
g_shell_parse_argv(cmd, NULL, &argv, &error);
g_shell_parse_argv(plugin_cmd, NULL, &argv, &error);
if (error)
{
......@@ -107,15 +101,16 @@ GtkDialog* remmina_plugin_cmdexec_new(RemminaFile* remminafile, const char *remm
}
/* Consider using G_SPAWN_SEARCH_PATH_FROM_ENVP (from glib 2.38)*/
g_spawn_async( NULL, // cwd
argv, // argv
NULL, // envp
G_SPAWN_SEARCH_PATH |
G_SPAWN_DO_NOT_REAP_CHILD, // flags
NULL, // child_setup
NULL, // child_setup user data
&child_pid, // exit status
&error); // error
g_spawn_async( NULL, // cwd
argv, // argv
NULL, // envp
G_SPAWN_SEARCH_PATH|
G_SPAWN_SEARCH_PATH_FROM_ENVP|
G_SPAWN_DO_NOT_REAP_CHILD, // flags
NULL, // child_setup
NULL, // child_setup user data
&child_pid, // pid location
&error); // error
if (!error)
{
gtk_spinner_start (GTK_SPINNER (pcspinner->spinner));
......@@ -124,7 +119,7 @@ GtkDialog* remmina_plugin_cmdexec_new(RemminaFile* remminafile, const char *remm
}
else
{
g_warning ("%s\n", error->message);
g_warning ("Command %s exited with error: %s\n", plugin_cmd, error->message);
g_error_free(error);
}
g_strfreev(argv);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment