[nautilus-open-terminal] gnome-extensions: use new GDK API to launch the terminal



commit f5f4fc2f4f50ef387ea07a047981eaba6f248537
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Feb 22 12:28:55 2011 -0500

    gnome-extensions: use new GDK API to launch the terminal

 src/eel-gnome-extensions.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/src/eel-gnome-extensions.c b/src/eel-gnome-extensions.c
index 3700a09..faf279c 100644
--- a/src/eel-gnome-extensions.c
+++ b/src/eel-gnome-extensions.c
@@ -175,6 +175,10 @@ _not_eel_gnome_open_terminal_on_screen (const char *command,
 					GdkScreen  *screen)
 {
 	char *command_line;
+	GAppInfo *app;
+	GdkAppLaunchContext *ctx;
+	GError *error = NULL;
+	GdkDisplay *display;
 
 	if (screen == NULL) {
 		screen = gdk_screen_get_default ();
@@ -185,7 +189,26 @@ _not_eel_gnome_open_terminal_on_screen (const char *command,
 		g_message ("Could not start a terminal");
 		return;
 	}
-	gdk_spawn_command_line_on_screen (screen, command_line, NULL);
+
+	app = g_app_info_create_from_commandline (command_line, NULL, 0, &error);
+
+	if (app != 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);
 }
 



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