[totem] Fix breakage caused by GDK-X11 API changes



commit 98f94e94d93d5d0da1405341a1bbadc15c94748d
Author: Philip Withnall <philip tecnocode co uk>
Date:   Wed Dec 22 17:15:41 2010 +0000

    Fix breakage caused by GDK-X11 API changes
    
    This adds a dependency on gdk-x11-3.0 >= 2.91.7.

 configure.in                                       |    1 +
 src/backend/bacon-video-widget-gst-0.10.c          |    4 +-
 src/backend/video-utils.c                          |    4 +-
 .../brasero-disc-recorder/totem-disc-recorder.c    |   85 +++++++++++---------
 src/plugins/youtube/totem-youtube.c                |    2 +-
 src/totem-interface.c                              |    2 +-
 6 files changed, 54 insertions(+), 44 deletions(-)
---
diff --git a/configure.in b/configure.in
index cc54384..59908b7 100644
--- a/configure.in
+++ b/configure.in
@@ -193,6 +193,7 @@ PKG_CHECK_MODULES([DEPENDENCY],[
   glib-2.0 >= $GLIB_REQS
   gio-2.0 >= $GIO_REQS
   gtk+-3.0 >= $GTK_REQS
+  gdk-x11-3.0 >= $GTK_REQS
   gmodule-2.0
   totem-plparser >= $TOTEM_PLPARSER_REQS
   gstreamer-tag-0.10 >= 0.10.26
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index 2fb8bb1..607da82 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -1642,7 +1642,7 @@ bvw_handle_element_message (BaconVideoWidget *bvw, GstMessage *msg)
           }
         } else {
           if (bvw->priv->cursor != NULL) {
-            gdk_cursor_unref (bvw->priv->cursor);
+            g_object_unref (bvw->priv->cursor);
             bvw->priv->cursor = NULL;
           }
         }
@@ -2803,7 +2803,7 @@ bacon_video_widget_finalize (GObject * object)
     g_source_remove (bvw->priv->eos_id);
 
   if (bvw->priv->cursor != NULL) {
-    gdk_cursor_unref (bvw->priv->cursor);
+    g_object_unref (bvw->priv->cursor);
     bvw->priv->cursor = NULL;
   }
 
diff --git a/src/backend/video-utils.c b/src/backend/video-utils.c
index 0116f82..edaf196 100644
--- a/src/backend/video-utils.c
+++ b/src/backend/video-utils.c
@@ -19,7 +19,7 @@ totem_gdk_window_set_invisible_cursor (GdkWindow *window)
 
 	cursor = gdk_cursor_new (GDK_BLANK_CURSOR);
 	gdk_window_set_cursor (window, cursor);
-	gdk_cursor_unref (cursor);
+	g_object_unref (cursor);
 }
 
 void
@@ -29,7 +29,7 @@ totem_gdk_window_set_waiting_cursor (GdkWindow *window)
 
 	cursor = gdk_cursor_new (GDK_WATCH);
 	gdk_window_set_cursor (window, cursor);
-	gdk_cursor_unref (cursor);
+	g_object_unref (cursor);
 
 	gdk_flush ();
 }
diff --git a/src/plugins/brasero-disc-recorder/totem-disc-recorder.c b/src/plugins/brasero-disc-recorder/totem-disc-recorder.c
index aa0875b..5ffb75c 100644
--- a/src/plugins/brasero-disc-recorder/totem-disc-recorder.c
+++ b/src/plugins/brasero-disc-recorder/totem-disc-recorder.c
@@ -80,51 +80,60 @@ totem_disc_recorder_plugin_start_burning (TotemDiscRecorderPlugin *pi,
 {
 	GtkWindow *main_window;
 	GdkScreen *screen;
-	GPtrArray *array;
-	char **args, *xid_str;
+	gchar *command_line;
+	GList *uris;
+	GAppInfo *info;
+	GdkAppLaunchContext *context;
 	GError *error = NULL;
-	gboolean ret;
 	int xid;
 
-	array = g_ptr_array_new ();
-	g_ptr_array_add (array, (gpointer) "brasero");
+	/* Build a command line to use */
+	main_window = totem_get_main_window (pi->priv->totem);
+	screen = gtk_widget_get_screen (GTK_WIDGET (main_window));
+	xid = gdk_x11_window_get_xid (gtk_widget_get_window (GTK_WIDGET (main_window)));
+	g_object_unref (main_window);
+
 	if (copy != FALSE)
-		g_ptr_array_add (array, (gpointer) "-c");
+		command_line = g_strdup_printf ("brasero -c -x %d", xid);
 	else
-		g_ptr_array_add (array, (gpointer) "-r");
-	g_ptr_array_add (array, (gpointer) path);
+		command_line = g_strdup_printf ("brasero -r -x %d", xid);
+
+	/* Build the app info */
+	info = g_app_info_create_from_commandline (command_line, NULL,
+	                                           G_APP_INFO_CREATE_SUPPORTS_URIS | G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION, &error);
+	g_free (command_line);
+
+	if (error != NULL)
+		goto error;
+
+	/* Create a launch context and launch it */
+	context = gdk_app_launch_context_new ();
+	gdk_app_launch_context_set_screen (context, screen);
+
+	uris = g_list_prepend (NULL, (gpointer) path);
+	g_app_info_launch_uris (info, uris, G_APP_LAUNCH_CONTEXT (context), &error);
+	g_list_free (uris);
+
+	g_object_unref (info);
+	g_object_unref (context);
 
+	if (error != NULL)
+		goto error;
+
+	return TRUE;
+
+error:
 	main_window = totem_get_main_window (pi->priv->totem);
-	screen = gtk_widget_get_screen (GTK_WIDGET (main_window));
-	xid = gdk_x11_window_get_xid (gtk_widget_get_window (GTK_WIDGET (main_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 (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,
-					       totem_get_main_window (pi->priv->totem));
-		} else {
-			totem_interface_error (_("The movie could not be recorded."),
-					       error->message,
-					       totem_get_main_window (pi->priv->totem));
-		}
-		ret = FALSE;
-		g_error_free (error);
-	}
 
-	g_free (xid_str);
-	g_free (args);
+	if (copy != FALSE)
+		totem_interface_error (_("The video disc could not be duplicated."), error->message, main_window);
+	else
+		totem_interface_error (_("The movie could not be recorded."), error->message, main_window);
+
+	g_error_free (error);
+	g_object_unref (main_window);
 
-	return ret;
+	return FALSE;
 }
 
 static char*
diff --git a/src/plugins/youtube/totem-youtube.c b/src/plugins/youtube/totem-youtube.c
index b3a55fc..7869526 100644
--- a/src/plugins/youtube/totem-youtube.c
+++ b/src/plugins/youtube/totem-youtube.c
@@ -254,7 +254,7 @@ set_progress_bar_text (TotemYouTubePlugin *self, const gchar *text, guint tree_v
 	/* Set the cursor to a watch */
 	cursor = gdk_cursor_new (GDK_WATCH);
 	gdk_window_set_cursor (gtk_widget_get_window (self->priv->vbox), cursor);
-	gdk_cursor_unref (cursor);
+	g_object_unref (cursor);
 
 	/* Call the pulse method */
 	data = g_slice_new (ProgressBarData);
diff --git a/src/totem-interface.c b/src/totem-interface.c
index 1386b1c..5d2b42d 100644
--- a/src/totem-interface.c
+++ b/src/totem-interface.c
@@ -311,7 +311,7 @@ totem_gtk_plug_get_toplevel (GtkPlug *plug)
 
 		if (root == parent) {
 			GdkWindow *toplevel;
-			toplevel = gdk_window_foreign_new (xid);
+			toplevel = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), xid);
 			return toplevel;
 		}
 



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