From 64eccc102207085223d10f6d0ade8b82943416d0 Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@fedoraproject.org>
Date: Thu, 4 Mar 2010 01:54:01 +0000
Subject: [PATCH] fix nautilus cd-burner

---
 brasero.spec        |  9 ++++++++-
 fix-cd-burner.patch | 44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 fix-cd-burner.patch

diff --git a/brasero.spec b/brasero.spec
index cf85ea1..b786d43 100644
--- a/brasero.spec
+++ b/brasero.spec
@@ -6,13 +6,16 @@
 
 Name:      brasero
 Version:   2.29.91
-Release:   1%{?dist}
+Release:   2%{?dist}
 Summary:   Gnome CD/DVD burning application
 Group:     Applications/Multimedia
 License:   GPLv2+
 URL:       http://www.gnome.org/projects/brasero/
 Source0:   http://ftp.gnome.org/pub/GNOME/sources/brasero/2.29/%{name}-%{version}.tar.bz2
 
+# upstream fix
+Patch0: fix-cd-burner.patch
+
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  glib2-devel >= 2.15.6
@@ -97,6 +100,7 @@ developing brasero applications.
 
 %prep
 %setup -q
+%patch0 -p1 -b .fix-cd-burner
 
 %build
 %configure \
@@ -215,6 +219,9 @@ fi
 
 
 %changelog
+* Wed Mar  3 2010 Matthias Clasen <mclasen@redhat.com> - 2.29.91-2
+- Fix a nautilus cd-burner crash
+
 * Mon Feb 22 2010 Matthias Clasen <mclasen@redhat.com> - 2.29.91-1
 - Update to 2.29.91
 
diff --git a/fix-cd-burner.patch b/fix-cd-burner.patch
new file mode 100644
index 0000000..b44c737
--- /dev/null
+++ b/fix-cd-burner.patch
@@ -0,0 +1,44 @@
+diff -up brasero-2.29.91/nautilus/nautilus-burn-extension.c.fix-cd-burner brasero-2.29.91/nautilus/nautilus-burn-extension.c
+--- brasero-2.29.91/nautilus/nautilus-burn-extension.c.fix-cd-burner	2010-02-22 15:37:17.000000000 -0500
++++ brasero-2.29.91/nautilus/nautilus-burn-extension.c	2010-03-03 20:38:00.784400518 -0500
+@@ -265,6 +265,8 @@ write_activate (GtkWindow *toplevel)
+ 	if (nautilus_disc_burn_is_empty (toplevel))
+ 		return;
+ 
++        ensure_initialized ();
++
+ 	track = brasero_track_data_cfg_new ();
+ 	brasero_track_data_cfg_add (track, BURN_URI, NULL);
+ 
+@@ -433,6 +435,8 @@ check_disc_activate_cb (NautilusMenuItem
+ {
+ 	BraseroSumDialog *dialog;
+ 
++        ensure_initialized ();
++
+ 	dialog = brasero_sum_dialog_new ();
+ 	tool_dialog_run (BRASERO_TOOL_DIALOG (dialog),
+ 			 GTK_WINDOW (user_data),
+@@ -504,7 +508,12 @@ drive_is_cd_device (GDrive *gdrive)
+ 
+         DEBUG_PRINT ("Got device: %s\n", device);
+ 
+-        monitor = brasero_medium_monitor_get_default ();
++       /* FIXME: since we call the monitor, the library should be initialized.
++        * To avoid all the initializing we'll be able to use the new GIO API
++        * (#594649 -  Have a way to detect optical drives) */
++       ensure_initialized();
++
++       monitor = brasero_medium_monitor_get_default ();
+         drive = brasero_medium_monitor_get_drive (monitor, device);
+         g_object_unref (monitor);
+         g_free (device);
+@@ -620,8 +629,6 @@ nautilus_disc_burn_get_file_items (Nauti
+ 		BraseroMedia		 media;
+ 		BraseroTrackType	*type;
+ 
+-		ensure_initialized();
+-
+                 device_path = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
+ 		monitor = brasero_medium_monitor_get_default ();
+ 		bdrive = brasero_medium_monitor_get_drive (monitor, device_path);