[nautilus] program-choosing: don't use gdk_spawn_ API



commit 77ecdd69b023a16fc4d6d2895dd470c628679168
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Dec 22 16:56:20 2010 +0100

    program-choosing: don't use gdk_spawn_ API

 libnautilus-private/nautilus-program-choosing.c |   30 +++++++++++++++++++---
 libnautilus-private/nautilus-program-choosing.h |    2 -
 2 files changed, 26 insertions(+), 6 deletions(-)
---
diff --git a/libnautilus-private/nautilus-program-choosing.c b/libnautilus-private/nautilus-program-choosing.c
index ea21f04..a003b84 100644
--- a/libnautilus-private/nautilus-program-choosing.c
+++ b/libnautilus-private/nautilus-program-choosing.c
@@ -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);
diff --git a/libnautilus-private/nautilus-program-choosing.h b/libnautilus-private/nautilus-program-choosing.h
index f90ac05..56fa836 100644
--- a/libnautilus-private/nautilus-program-choosing.h
+++ b/libnautilus-private/nautilus-program-choosing.h
@@ -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);



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