[empathy] main-window: use g_app_info_launch() instead of gdk_spawn_on_screen() (#637854)



commit 8cf5f1c4f4224bc8863ab498c4d89082db6ceb7b
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Thu Dec 23 13:36:50 2010 +0100

    main-window: use g_app_info_launch() instead of gdk_spawn_on_screen() (#637854)

 src/empathy-main-window.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c
index b1e26f5..e0b0553 100644
--- a/src/empathy-main-window.c
+++ b/src/empathy-main-window.c
@@ -1481,9 +1481,9 @@ main_window_help_debug_cb (GtkAction         *action,
 {
 	GdkScreen *screen = gdk_screen_get_default ();
 	GError *error = NULL;
-	gchar *argv[2] = { NULL, };
-	gint i = 0;
 	gchar *path;
+	GAppInfo *app_info;
+	GdkAppLaunchContext *context;
 
 	g_return_if_fail (GDK_IS_SCREEN (screen));
 
@@ -1496,17 +1496,26 @@ main_window_help_debug_cb (GtkAction         *action,
 		path = g_build_filename (BIN_DIR, "empathy-debugger", NULL);
 	}
 
-	argv[i++] = path;
+	app_info = g_app_info_create_from_commandline (path, NULL, 0, &error);
+	if (app_info == NULL) {
+		DEBUG ("Failed to create app info: %s", error->message);
+		g_error_free (error);
+		goto out;
+	}
 
-	gdk_spawn_on_screen (screen, NULL, argv, NULL,
-			G_SPAWN_SEARCH_PATH,
-			NULL, NULL, NULL, &error);
+	context = gdk_app_launch_context_new ();
+	gdk_app_launch_context_set_display (context, gdk_screen_get_display (screen));
 
-	if (error) {
+	if (!g_app_info_launch (app_info, NULL, (GAppLaunchContext *) context,
+		&error)) {
 		g_warning ("Failed to open debug window: %s", error->message);
 		g_error_free (error);
+		goto out;
 	}
 
+out:
+	tp_clear_object (&app_info);
+	tp_clear_object (&context);
 	g_free (path);
 }
 



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