void
eel_gnome_open_terminal_on_screen (const char *command,
				   GdkScreen  *screen)
{
	char *command_line;

	if (screen == NULL) {
		screen = gdk_screen_get_default ();
	}
	
	command_line = eel_gnome_make_terminal_command (command);
	if (command_line == NULL) {
		g_message ("Could not start a terminal");
		return;
	}
	gdk_spawn_command_line_on_screen (screen, command_line, NULL);
	g_free (command_line);
}
Beispiel #2
0
void
eel_gnome_open_terminal_on_screen (const char *command,
				   GdkScreen  *screen)
{
	char *command_line;
	GAppInfo *app;
	GdkAppLaunchContext *ctx;
	GError *error = NULL;
	GdkDisplay *display;

	command_line = eel_gnome_make_terminal_command (command);
	if (command_line == NULL) {
		g_message ("Could not start a terminal");
		return;
	}

	app = g_app_info_create_from_commandline (command_line, NULL, 0, &error);

	if (app != NULL && screen != NULL) {
		display = gdk_screen_get_display (screen);
		ctx = gdk_display_get_app_launch_context (display);
		gdk_app_launch_context_set_screen (ctx, screen);

		g_app_info_launch (app, NULL, G_APP_LAUNCH_CONTEXT (ctx), &error);

		g_object_unref (app);
		g_object_unref (ctx);
	}

	if (error != NULL) {
		g_message ("Could not start application on terminal: %s", error->message);

		g_error_free (error);
	}

	g_free (command_line);
}