[gnome-panel] launch: avoid deprecated gdk_screen_make_display_name



commit 4dde05e9bd5b99d2a0e8d8fffb92b859edfa4f75
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Nov 4 21:40:37 2016 +0200

    launch: avoid deprecated gdk_screen_make_display_name

 gnome-panel/libpanel-util/panel-launch.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/gnome-panel/libpanel-util/panel-launch.c b/gnome-panel/libpanel-util/panel-launch.c
index 8d36394..4ba2369 100644
--- a/gnome-panel/libpanel-util/panel-launch.c
+++ b/gnome-panel/libpanel-util/panel-launch.c
@@ -228,9 +228,13 @@ panel_launch_desktop_file (const char  *desktop_file,
  * Set the DISPLAY variable, to be use by g_spawn_async.
  */
 static void
-set_environment (gpointer display)
+set_environment (gpointer user_data)
 {
-       g_setenv ("DISPLAY", display, TRUE);
+       GdkDisplay *display;
+
+       display = gdk_display_get_default ();
+
+       g_setenv ("DISPLAY", gdk_display_get_name (display), TRUE);
 }
 
 gboolean
@@ -241,7 +245,6 @@ panel_launch_desktop_file_with_fallback (const char  *desktop_file,
 {
        char     *argv[2] = { (char *) fallback_exec, NULL };
        GError   *local_error;
-       char     *display;
        GPid      pid;
 
        g_return_val_if_fail (desktop_file != NULL, FALSE);
@@ -259,22 +262,18 @@ panel_launch_desktop_file_with_fallback (const char  *desktop_file,
                local_error = NULL;
        }
 
-       display = gdk_screen_make_display_name (screen);
-
        g_spawn_async (NULL, /* working directory */
                       argv,
                       NULL, /* envp */
                       G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
                       set_environment,
-                      display,
+                      NULL,
                       &pid,
                       &local_error);
        if (local_error == NULL) {
                g_child_watch_add (pid, dummy_child_watch, NULL);
        }
 
-       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]