[Xfce4-commits] <xfce4-panel:master> Stop using gdk_spawn functions.
Nick Schermer
noreply at xfce.org
Sun Mar 27 11:50:05 CEST 2011
Updating branch refs/heads/master
to c7707fa076c720d3157f0eb052fb6421f32d01f1 (commit)
from ee39a027284070a467961439a5862509171828d9 (commit)
commit c7707fa076c720d3157f0eb052fb6421f32d01f1
Author: Nick Schermer <nick at xfce.org>
Date: Sun Mar 27 11:43:43 2011 +0200
Stop using gdk_spawn functions.
They will be removed in Gtk3 and it is easy to work
around them with the 4ui function.
panel/panel-plugin-external.c | 23 +++++++++++++++++++----
plugins/applicationsmenu/applicationsmenu.c | 3 ++-
plugins/clock/clock.c | 4 ++--
plugins/launcher/launcher-dialog.c | 2 +-
plugins/pager/pager.c | 3 ++-
5 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/panel/panel-plugin-external.c b/panel/panel-plugin-external.c
index e8ce304..4cf0a62 100644
--- a/panel/panel-plugin-external.c
+++ b/panel/panel-plugin-external.c
@@ -490,6 +490,22 @@ panel_plugin_external_child_ask_restart (PanelPluginExternal *external)
static void
+panel_plugin_external_child_spawn_child_setup (gpointer data)
+{
+ PanelPluginExternal *external = PANEL_PLUGIN_EXTERNAL (data);
+ GdkScreen *screen;
+ gchar *name;
+
+ /* this is what gdk_spawn_on_screen does */
+ screen = gtk_widget_get_screen (GTK_WIDGET (external));
+ name = gdk_screen_make_display_name (screen);
+ g_setenv ("DISPLAY", name, TRUE);
+ g_free (name);
+}
+
+
+
+static void
panel_plugin_external_child_spawn (PanelPluginExternal *external)
{
gchar **argv, **dbg_argv, **tmp_argv;
@@ -583,10 +599,9 @@ panel_plugin_external_child_spawn (PanelPluginExternal *external)
}
/* spawn the proccess */
- succeed = gdk_spawn_on_screen (gtk_widget_get_screen (GTK_WIDGET (external)),
- NULL, argv, NULL,
- G_SPAWN_DO_NOT_REAP_CHILD, NULL,
- NULL, &pid, &error);
+ succeed = g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD,
+ panel_plugin_external_child_spawn_child_setup,
+ external, &pid, &error);
panel_debug (PANEL_DEBUG_EXTERNAL,
"%s-%d: child spawned; pid=%d, argc=%d",
diff --git a/plugins/applicationsmenu/applicationsmenu.c b/plugins/applicationsmenu/applicationsmenu.c
index df0bb5c..ea20a38 100644
--- a/plugins/applicationsmenu/applicationsmenu.c
+++ b/plugins/applicationsmenu/applicationsmenu.c
@@ -508,7 +508,8 @@ applications_menu_plugin_configure_plugin_edit (GtkWidget *button,
panel_return_if_fail (XFCE_IS_APPLICATIONS_MENU_PLUGIN (plugin));
panel_return_if_fail (GTK_IS_WIDGET (button));
- if (!gdk_spawn_command_line_on_screen (gtk_widget_get_screen (button), command, &error))
+ if (!xfce_spawn_command_line_on_screen (gtk_widget_get_screen (button), command,
+ FALSE, FALSE, &error))
{
xfce_dialog_show_error (NULL, error, _("Failed to execute command \"%s\"."), command);
g_error_free (error);
diff --git a/plugins/clock/clock.c b/plugins/clock/clock.c
index a44fd56..25435e0 100644
--- a/plugins/clock/clock.c
+++ b/plugins/clock/clock.c
@@ -401,8 +401,8 @@ clock_plugin_button_press_event (GtkWidget *widget,
&& !exo_str_is_empty (plugin->command))
{
/* launch command */
- if (!gdk_spawn_command_line_on_screen (gtk_widget_get_screen (widget),
- plugin->command, &error))
+ if (!xfce_spawn_command_line_on_screen (gtk_widget_get_screen (widget),
+ plugin->command, FALSE, FALSE, &error))
{
xfce_dialog_show_error (NULL, error, _("Failed to execute clock command"));
g_error_free (error);
diff --git a/plugins/launcher/launcher-dialog.c b/plugins/launcher/launcher-dialog.c
index 7a1d6d7..4a87222 100644
--- a/plugins/launcher/launcher-dialog.c
+++ b/plugins/launcher/launcher-dialog.c
@@ -780,7 +780,7 @@ launcher_dialog_item_button_clicked (GtkWidget *button,
/* spawn item editor */
screen = gtk_widget_get_screen (button);
- if (!gdk_spawn_command_line_on_screen (screen, command, &error))
+ if (!xfce_spawn_command_line_on_screen (screen, command, FALSE, FALSE, &error))
{
toplevel = gtk_widget_get_toplevel (button);
xfce_dialog_show_error (GTK_WINDOW (toplevel), error,
diff --git a/plugins/pager/pager.c b/plugins/pager/pager.c
index 9bb9df9..7659979 100644
--- a/plugins/pager/pager.c
+++ b/plugins/pager/pager.c
@@ -421,7 +421,8 @@ pager_plugin_configure_workspace_settings (GtkWidget *button)
screen = gdk_screen_get_default ();
/* try to start the settings dialog */
- if (!gdk_spawn_command_line_on_screen (screen, WORKSPACE_SETTINGS_COMMAND, &error))
+ if (!xfce_spawn_command_line_on_screen (screen, WORKSPACE_SETTINGS_COMMAND,
+ FALSE, FALSE, &error))
{
/* show an error dialog */
toplevel = gtk_widget_get_toplevel (button);
More information about the Xfce4-commits
mailing list