mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-09-13 04:51:15 +00:00
program-choosing: don't use gdk_spawn_ API
This commit is contained in:
parent
13b6a5a50d
commit
77ecdd69b0
|
@ -180,7 +180,6 @@ nautilus_launch_application_by_uri (GAppInfo *application,
|
|||
*/
|
||||
void
|
||||
nautilus_launch_application_from_command (GdkScreen *screen,
|
||||
const char *name,
|
||||
const char *command_string,
|
||||
gboolean use_terminal,
|
||||
...)
|
||||
|
@ -189,6 +188,8 @@ nautilus_launch_application_from_command (GdkScreen *screen,
|
|||
char *quoted_parameter;
|
||||
char *parameter;
|
||||
va_list ap;
|
||||
GAppInfo *app;
|
||||
GdkAppLaunchContext *ctx;
|
||||
|
||||
full_command = g_strdup (command_string);
|
||||
|
||||
|
@ -209,7 +210,17 @@ nautilus_launch_application_from_command (GdkScreen *screen,
|
|||
if (use_terminal) {
|
||||
eel_gnome_open_terminal_on_screen (full_command, screen);
|
||||
} else {
|
||||
gdk_spawn_command_line_on_screen (screen, full_command, NULL);
|
||||
app = g_app_info_create_from_commandline (full_command, NULL, 0, NULL);
|
||||
|
||||
if (app != NULL) {
|
||||
ctx = gdk_app_launch_context_new ();
|
||||
gdk_app_launch_context_set_screen (ctx, screen);
|
||||
|
||||
g_app_info_launch (app, NULL, G_APP_LAUNCH_CONTEXT (ctx), NULL);
|
||||
|
||||
g_object_unref (app);
|
||||
g_object_unref (ctx);
|
||||
}
|
||||
}
|
||||
|
||||
g_free (full_command);
|
||||
|
@ -227,7 +238,6 @@ nautilus_launch_application_from_command (GdkScreen *screen,
|
|||
*/
|
||||
void
|
||||
nautilus_launch_application_from_command_array (GdkScreen *screen,
|
||||
const char *name,
|
||||
const char *command_string,
|
||||
gboolean use_terminal,
|
||||
const char * const * parameters)
|
||||
|
@ -235,6 +245,8 @@ nautilus_launch_application_from_command_array (GdkScreen *screen,
|
|||
char *full_command, *tmp;
|
||||
char *quoted_parameter;
|
||||
const char * const *p;
|
||||
GAppInfo *app;
|
||||
GdkAppLaunchContext *ctx;
|
||||
|
||||
full_command = g_strdup (command_string);
|
||||
|
||||
|
@ -252,7 +264,17 @@ nautilus_launch_application_from_command_array (GdkScreen *screen,
|
|||
if (use_terminal) {
|
||||
eel_gnome_open_terminal_on_screen (full_command, screen);
|
||||
} else {
|
||||
gdk_spawn_command_line_on_screen (screen, full_command, NULL);
|
||||
app = g_app_info_create_from_commandline (full_command, NULL, 0, NULL);
|
||||
|
||||
if (app != NULL) {
|
||||
ctx = gdk_app_launch_context_new ();
|
||||
gdk_app_launch_context_set_screen (ctx, screen);
|
||||
|
||||
g_app_info_launch (app, NULL, G_APP_LAUNCH_CONTEXT (ctx), NULL);
|
||||
|
||||
g_object_unref (app);
|
||||
g_object_unref (ctx);
|
||||
}
|
||||
}
|
||||
|
||||
g_free (full_command);
|
||||
|
|
|
@ -43,12 +43,10 @@ void nautilus_launch_application_for_mount (GAppInfo
|
|||
GMount *mount,
|
||||
GtkWindow *parent_window);
|
||||
void nautilus_launch_application_from_command (GdkScreen *screen,
|
||||
const char *name,
|
||||
const char *command_string,
|
||||
gboolean use_terminal,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
void nautilus_launch_application_from_command_array (GdkScreen *screen,
|
||||
const char *name,
|
||||
const char *command_string,
|
||||
gboolean use_terminal,
|
||||
const char * const * parameters);
|
||||
|
|
Loading…
Reference in a new issue