[gnome-applets] mini-commander: Use g_spawn_async instead of gdk_spawn_on_screen
- From: Christopher Aillon <caillon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets] mini-commander: Use g_spawn_async instead of gdk_spawn_on_screen
- Date: Sun, 1 May 2011 22:09:55 +0000 (UTC)
commit fd17e9ae2259dce63bb3d6363e3671a48b3edf91
Author: Christopher Aillon <caillon redhat com>
Date: Fri Mar 25 17:16:05 2011 -0700
mini-commander: Use g_spawn_async instead of gdk_spawn_on_screen
The latter was removed in GDK 3
https://bugzilla.gnome.org/show_bug.cgi?id=646473
mini-commander/src/exec.c | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/mini-commander/src/exec.c b/mini-commander/src/exec.c
index ff0c1ec..f0e2c71 100644
--- a/mini-commander/src/exec.c
+++ b/mini-commander/src/exec.c
@@ -36,6 +36,15 @@
static void beep (void);
+/*
+ * Set the DISPLAY variable, to be use by g_spawn_async.
+ */
+static void
+set_environment (gpointer display)
+{
+ g_setenv ("DISPLAY", display, TRUE);
+}
+
void
mc_exec_command (MCData *mc,
const char *cmd)
@@ -44,6 +53,7 @@ mc_exec_command (MCData *mc,
char command [1000];
char **argv = NULL;
gchar *str;
+ gchar *display;
strncpy (command, cmd, sizeof (command));
command [sizeof (command) - 1] = '\0';
@@ -59,11 +69,16 @@ mc_exec_command (MCData *mc,
return;
}
- if(!gdk_spawn_on_screen (gtk_widget_get_screen (GTK_WIDGET (mc->applet)),
- g_get_home_dir (), argv, NULL,
- G_SPAWN_SEARCH_PATH,
- NULL, NULL, NULL,
- &error)) {
+ display = gdk_screen_make_display_name (gtk_widget_get_screen (GTK_WIDGET (mc->applet)));
+
+ if(!g_spawn_async (NULL, /* working directory */
+ argv,
+ NULL, /* envp */
+ G_SPAWN_SEARCH_PATH,
+ set_environment,
+ &display,
+ NULL,
+ &error)) {
str = g_strconcat ("(?)", command, NULL);
gtk_entry_set_text (GTK_ENTRY (mc->entry), str);
//gtk_editable_set_position (GTK_EDITABLE (mc->entry), 0);
@@ -74,6 +89,7 @@ mc_exec_command (MCData *mc,
gtk_entry_set_text (GTK_ENTRY (mc->entry), (gchar *) "");
append_history_entry (mc, cmd, FALSE);
}
+ g_free (display);
g_strfreev (argv);
if (error != NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]