diff options
author | Stefano Karapetsas <[email protected]> | 2013-10-26 14:34:04 +0200 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2013-10-26 14:34:04 +0200 |
commit | a6efbbceb5b1122512cd01609eab99fe522d8435 (patch) | |
tree | 43a85aa03fce3f022c5db5f60579daea90cecae3 /mate-panel/libpanel-util/panel-launch.c | |
parent | fa97943c56e331668aff4b3587fe70c5edcd36b2 (diff) | |
download | mate-panel-a6efbbceb5b1122512cd01609eab99fe522d8435.tar.bz2 mate-panel-a6efbbceb5b1122512cd01609eab99fe522d8435.tar.xz |
mate-panel: Add GTK3 support
Diffstat (limited to 'mate-panel/libpanel-util/panel-launch.c')
-rw-r--r-- | mate-panel/libpanel-util/panel-launch.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/mate-panel/libpanel-util/panel-launch.c b/mate-panel/libpanel-util/panel-launch.c index c332d09a..28824269 100644 --- a/mate-panel/libpanel-util/panel-launch.c +++ b/mate-panel/libpanel-util/panel-launch.c @@ -221,6 +221,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, @@ -231,6 +240,9 @@ panel_launch_desktop_file_with_fallback (const char *desktop_file, GError *local_error; gboolean retval; GPid pid; +#if GTK_CHECK_VERSION (3, 0, 0) + char *display; +#endif g_return_val_if_fail (desktop_file != NULL, FALSE); g_return_val_if_fail (fallback_exec != NULL, FALSE); @@ -247,9 +259,22 @@ panel_launch_desktop_file_with_fallback (const char *desktop_file, local_error = NULL; } +#if GTK_CHECK_VERSION (3, 0, 0) + 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); +#else retval = gdk_spawn_on_screen (screen, NULL, argv, NULL, G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, &local_error); +#endif if (local_error == NULL && retval == TRUE) { g_child_watch_add (pid, dummy_child_watch, NULL); |