[gnome-panel/gtk3] Fix gdk_spawn_on_screen deprecated



commit bcf55f738ee93e877faa842464776a71d5304da1
Author: Germán Póo-Caamaño <gpoo gnome org>
Date:   Thu Dec 30 05:05:34 2010 -0800

    Fix gdk_spawn_on_screen deprecated
    
    Replaced by g_spawn_async.
    https://bugzilla.gnome.org/show_bug.cgi?id=627455
    
    Signed-off-by: Germán Póo-Caamaño <gpoo gnome org>

 gnome-panel/libpanel-util/panel-launch.c |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/gnome-panel/libpanel-util/panel-launch.c b/gnome-panel/libpanel-util/panel-launch.c
index af2b428..58cf8ef 100644
--- a/gnome-panel/libpanel-util/panel-launch.c
+++ b/gnome-panel/libpanel-util/panel-launch.c
@@ -200,6 +200,15 @@ panel_launch_desktop_file (const char  *desktop_file,
 	return retval;
 }
 
+/*
+ * Set the DISPLAY variable, to be use by g_spawn_async.
+ */
+static void
+set_environment (gpointer display)
+{
+	g_setenv ("DISPLAY", display, TRUE);
+}
+
 gboolean
 panel_launch_desktop_file_with_fallback (const char  *desktop_file,
 					 const char  *fallback_exec,
@@ -209,6 +218,7 @@ panel_launch_desktop_file_with_fallback (const char  *desktop_file,
 	char     *argv[2] = { (char *) fallback_exec, NULL };
 	GError   *local_error;
 	gboolean  retval;
+	char    *display;
 
 	g_return_val_if_fail (desktop_file != NULL, FALSE);
 	g_return_val_if_fail (fallback_exec != NULL, FALSE);
@@ -225,9 +235,18 @@ panel_launch_desktop_file_with_fallback (const char  *desktop_file,
 		local_error = NULL;
 	}
 
-	retval = gdk_spawn_on_screen (screen, NULL, argv, NULL,
-				      G_SPAWN_SEARCH_PATH,
-				      NULL, NULL, NULL, &local_error);
+	display = gdk_screen_make_display_name (screen);
+
+	retval = g_spawn_async (NULL, /* working directory */
+				argv,
+				NULL, /* envp */
+				G_SPAWN_SEARCH_PATH,
+				set_environment,
+				&display,
+				NULL,
+				&local_error);
+
+	g_free (display);
 
 	return _panel_launch_handle_error (fallback_exec,
 					   screen, local_error, error);



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