[drwright] Don't use gdk_spawn_on_screen
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [drwright] Don't use gdk_spawn_on_screen
- Date: Wed, 2 Feb 2011 19:46:04 +0000 (UTC)
commit 865bfa5b0c9f6b5a05ebafef759e564f03b90313
Author: Christian Persch <chpe gnome org>
Date: Wed Feb 2 20:30:06 2011 +0100
Don't use gdk_spawn_on_screen
Instead, use g_spawn_async with a DISPLAY env var.
src/drwright.c | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/src/drwright.c b/src/drwright.c
index 97ebc4c..5fa4561 100644
--- a/src/drwright.c
+++ b/src/drwright.c
@@ -592,17 +592,36 @@ popup_break_cb (GtkAction *action, DrWright *dr)
}
static void
+setup_display_cb (gpointer data)
+{
+ g_setenv ("DISPLAY", (char *) data, TRUE);
+}
+
+static void
popup_preferences_cb (GtkAction *action, DrWright *dr)
{
GdkScreen *screen;
GError *error = NULL;
GtkWidget *menu;
- char *argv[] = { BINDIR"/gnome-control-center", "typing-break", NULL };
+ char *argv[] = { BINDIR "/gnome-control-center", "typing-break", NULL };
+ char *display;
menu = gtk_ui_manager_get_widget (dr->ui_manager, "/Pop");
screen = gtk_widget_get_screen (menu);
- if (!gdk_spawn_on_screen (screen, "/", argv, NULL, 0, NULL, NULL, NULL, &error)) {
+ if (screen != NULL) {
+ display = gdk_screen_make_display_name (screen);
+ } else {
+ display = NULL;
+ }
+
+ if (!g_spawn_async ("/",
+ argv,
+ NULL /* envv */,
+ 0,
+ setup_display_cb, display,
+ NULL,
+ &error)) {
GtkWidget *error_dialog;
error_dialog = gtk_message_dialog_new (NULL, 0,
@@ -618,6 +637,8 @@ popup_preferences_cb (GtkAction *action, DrWright *dr)
g_error_free (error);
}
+
+ g_free (display);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]