[gnome-panel/gtk3] calendar-window: Port gdk_spawn_on_screen to g_spawn_async
- From: Germán Poó Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/gtk3] calendar-window: Port gdk_spawn_on_screen to g_spawn_async
- Date: Mon, 31 Jan 2011 02:12:15 +0000 (UTC)
commit 692264bdc7e33f3e034506440191212c0f9787f6
Author: Germán Póo-Caamaño <gpoo gnome org>
Date: Sun Jan 30 17:33:52 2011 -0800
calendar-window: Port gdk_spawn_on_screen to g_spawn_async
Signed-off-by: Germán Póo-Caamaño <gpoo gnome org>
applets/clock/calendar-window.c | 31 ++++++++++++++++++++++---------
1 files changed, 22 insertions(+), 9 deletions(-)
---
diff --git a/applets/clock/calendar-window.c b/applets/clock/calendar-window.c
index d3335cd..dcc51e4 100644
--- a/applets/clock/calendar-window.c
+++ b/applets/clock/calendar-window.c
@@ -140,6 +140,15 @@ static GtkWidget * create_hig_frame (CalendarWindow *calwin,
#ifdef HAVE_LIBECAL
+/*
+ * Set the DISPLAY variable, to be use by g_spawn_async.
+ */
+static void
+set_environment (gpointer display)
+{
+ g_setenv ("DISPLAY", display, TRUE);
+}
+
static void
clock_launch_calendar_tasks_app (CalendarWindow *calwin,
const char *key_program,
@@ -154,6 +163,7 @@ clock_launch_calendar_tasks_app (CalendarWindow *calwin,
GdkScreen *screen;
GError *error;
gboolean result;
+ char *display;
key = g_strdup_printf ("%s%s", key_program, "/exec");
program = gconf_client_get_string (calwin->priv->gconfclient,
@@ -194,15 +204,18 @@ clock_launch_calendar_tasks_app (CalendarWindow *calwin,
if (terminal)
gnome_desktop_prepend_terminal_to_vector (&argc, &argv);
- result = gdk_spawn_on_screen (screen,
- NULL, /* working directory */
- argv,
- NULL, /* envp */
- G_SPAWN_SEARCH_PATH,
- NULL, /* child setup func */
- NULL, /* user data */
- NULL, /* child pid */
- &error);
+ display = gdk_screen_make_display_name (screen);
+
+ result = g_spawn_async (NULL, /* working directory */
+ argv,
+ NULL, /* envp */
+ G_SPAWN_SEARCH_PATH,
+ set_environment, /* child setup func */
+ &display, /* user data for child setup */
+ NULL, /* child pid */
+ &error);
+
+ g_free (display);
if (!result) {
g_printerr ("Cannot launch calendar/tasks application: %s\n",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]