[totem] Use GDK spawn functions instead of g_spawn_*



commit df00c6940fcaf45b92fcc665434a1d374bc2b7ee
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Oct 13 17:22:58 2009 +0100

    Use GDK spawn functions instead of g_spawn_*

 .../brasero-disc-recorder/totem-disc-recorder.c    |   20 ++++++++++----------
 src/totem-dvb-setup.c                              |    8 ++++++--
 2 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/src/plugins/brasero-disc-recorder/totem-disc-recorder.c b/src/plugins/brasero-disc-recorder/totem-disc-recorder.c
index 4402fec..3e3bcc6 100644
--- a/src/plugins/brasero-disc-recorder/totem-disc-recorder.c
+++ b/src/plugins/brasero-disc-recorder/totem-disc-recorder.c
@@ -91,10 +91,12 @@ totem_disc_recorder_plugin_start_burning (TotemDiscRecorderPlugin *pi,
 					  gboolean copy)
 {
 	GtkWindow *main_window;
+	GdkScreen *screen;
 	GPtrArray *array;
 	char **args, *xid_str;
 	GError *error = NULL;
 	gboolean ret;
+	int xid;
 
 	array = g_ptr_array_new ();
 	g_ptr_array_add (array, (gpointer) "brasero");
@@ -105,21 +107,19 @@ totem_disc_recorder_plugin_start_burning (TotemDiscRecorderPlugin *pi,
 	g_ptr_array_add (array, (gpointer) path);
 
 	main_window = totem_get_main_window (pi->totem);
-	if (main_window && GTK_WIDGET (main_window)->window) {
-		int xid;
-		xid = gdk_x11_drawable_get_xid (GDK_DRAWABLE (GTK_WIDGET (main_window)->window));
-		xid_str = g_strdup_printf ("%d", xid);
-		g_ptr_array_add (array, (gpointer) "-x");
-		g_ptr_array_add (array, xid_str);
-	} else {
-		xid_str = NULL;
-	}
+	screen = gtk_widget_get_screen (GTK_WIDGET (main_window));
+	xid = gdk_x11_drawable_get_xid (GDK_DRAWABLE (GTK_WIDGET (main_window)->window));
+	xid_str = g_strdup_printf ("%d", xid);
+	g_ptr_array_add (array, (gpointer) "-x");
+	g_ptr_array_add (array, xid_str);
 
 	g_ptr_array_add (array, NULL);
 	args = (char **) g_ptr_array_free (array, FALSE);
 
 	ret = TRUE;
-	if (!g_spawn_async (NULL, args, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error)) {
+	if (gdk_spawn_on_screen (screen, NULL, args, NULL,
+				 G_SPAWN_SEARCH_PATH | G_SPAWN_FILE_AND_ARGV_ZERO,
+				 NULL, NULL, NULL, &error) == FALSE) {
 		if (copy != FALSE) {
 			totem_interface_error (_("The video disc could not be duplicated."),
 					       error->message,
diff --git a/src/totem-dvb-setup.c b/src/totem-dvb-setup.c
index 1012947..1831ca9 100644
--- a/src/totem-dvb-setup.c
+++ b/src/totem-dvb-setup.c
@@ -76,6 +76,7 @@ totem_dvb_setup_device (const char *device,
 			TotemDvbSetupResultFunc func,
 			gpointer user_data)
 {
+	GdkScreen *screen;
 	GPtrArray *arr;
 	char *tmp, **argv;
 	GPid pid;
@@ -89,6 +90,8 @@ totem_dvb_setup_device (const char *device,
 
 	arr = g_ptr_array_new ();
 	g_ptr_array_add (arr, g_strdup (totem_dvb_setup_helper ()));
+
+	screen = gtk_widget_get_screen (GTK_WIDGET (parent));
 	tmp = g_strdup_printf ("--transient-for=%u", (unsigned int) GDK_WINDOW_XID (GTK_WIDGET (parent)->window));
 	g_ptr_array_add (arr, tmp);
 	g_ptr_array_add (arr, g_strdup (device));
@@ -96,8 +99,9 @@ totem_dvb_setup_device (const char *device,
 
 	argv = (gchar **) arr->pdata;
 
-	if (g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL,
-			   NULL, &pid, NULL) == FALSE) {
+	if (gdk_spawn_on_screen (screen, NULL, argv, NULL,
+				 G_SPAWN_FILE_AND_ARGV_ZERO | G_SPAWN_DO_NOT_REAP_CHILD,
+				 NULL, NULL, &pid, NULL) == FALSE) {
 		g_ptr_array_free (arr, TRUE);
 		return TOTEM_DVB_SETUP_FAILURE;
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]