[brasero] Fix #587284 – nautilus hangs every time



commit 9a0efd0254ad871080d065fadd425c3b711c82b7
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Wed Jul 1 11:07:53 2009 +0200

    Fix #587284 â?? nautilus hangs every time
    Make sure libbrasero-burn initializes itself the libraries it depends on so that anything linking to it doesn't have to do it itself.

 libbrasero-burn/Makefile.am           |    5 +++--
 libbrasero-burn/brasero-burn-lib.h.in |    3 ++-
 libbrasero-burn/burn-basics.c         |   23 ++++++++++++++++++++---
 nautilus/nautilus-burn-extension.c    |    2 +-
 src/main.c                            |   16 ++++------------
 5 files changed, 30 insertions(+), 19 deletions(-)
---
diff --git a/libbrasero-burn/Makefile.am b/libbrasero-burn/Makefile.am
index a19a96b..f2d5b78 100644
--- a/libbrasero-burn/Makefile.am
+++ b/libbrasero-burn/Makefile.am
@@ -16,6 +16,7 @@ INCLUDES = \
 	$(BRASERO_GLIB_CFLAGS)						\
 	$(BRASERO_GIO_CFLAGS)						\
 	$(BRASERO_GTK_CFLAGS)						\
+	$(BRASERO_GSTREAMER_CFLAGS)					\
 	$(BRASERO_DBUS_CFLAGS)
 
 GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
@@ -63,8 +64,8 @@ libbrasero_burn_la_LIBADD =					\
 	$(BRASERO_GIO_LIBS)					\
 	$(BRASERO_GCONF_LIBS)					\
 	$(BRASERO_GTK_LIBS)					\
-	$(BRASERO_DBUS_LIBS)					\
-	-lm
+	$(BRASERO_GSTREAMER_LIBS)	\
+	$(BRASERO_DBUS_LIBS)
 
 libbrasero_burn_la_LDFLAGS =					\
 	-version-info $(LIBBRASERO_LT_VERSION)			\
diff --git a/libbrasero-burn/brasero-burn-lib.h.in b/libbrasero-burn/brasero-burn-lib.h.in
index b9cd7bc..dfc07b8 100644
--- a/libbrasero-burn/brasero-burn-lib.h.in
+++ b/libbrasero-burn/brasero-burn-lib.h.in
@@ -58,7 +58,8 @@ G_BEGIN_DECLS
  */
 
 gboolean
-brasero_burn_library_start (void);
+brasero_burn_library_start (int *argc,
+                            char **argv []);
 
 void
 brasero_burn_library_stop (void);
diff --git a/libbrasero-burn/burn-basics.c b/libbrasero-burn/burn-basics.c
index e3cbb86..1f1835e 100644
--- a/libbrasero-burn/burn-basics.c
+++ b/libbrasero-burn/burn-basics.c
@@ -39,6 +39,9 @@
 
 #include <gconf/gconf-client.h>
 
+#include <gst/gst.h>
+#include <gst/pbutils/pbutils.h>
+
 #include "brasero-io.h"
 
 #include "burn-basics.h"
@@ -201,7 +204,8 @@ brasero_caps_list_dump (void)
 }
 
 gboolean
-brasero_burn_library_start (void)
+brasero_burn_library_start (int *argc,
+                            char **argv [])
 {
 	GConfClient *client;
 
@@ -210,6 +214,17 @@ brasero_burn_library_start (void)
 			  BRASERO_MINOR_VERSION,
 			  BRASERO_SUB);
 
+	/* Initialize external libraries (threads... */
+	if (!g_thread_supported ())
+		g_thread_init (NULL);
+
+	/* ... and Gstreamer) */
+	if (!gst_init_check (argc, argv, NULL))
+		return FALSE;
+
+	/* This is for missing codec automatic install */
+	gst_pb_utils_init ();
+
 	/* preload some gconf keys */
 	client = gconf_client_get_default ();
 	gconf_client_add_dir (client,
@@ -244,6 +259,8 @@ brasero_burn_library_get_plugins_list (void)
 void
 brasero_burn_library_stop (void)
 {
+	GConfClient *client;
+
 	if (plugin_manager) {
 		g_object_unref (plugin_manager);
 		plugin_manager = NULL;
@@ -257,8 +274,8 @@ brasero_burn_library_stop (void)
 	/* Cleanup the io thing */
 	brasero_io_shutdown ();
 
-	/* close HAL connection */
-//	brasero_hal_watch_destroy ();
+	client = gconf_client_get_default ();
+	gconf_client_remove_dir (client, "/apps/brasero", NULL);
 }
 
 gboolean
diff --git a/nautilus/nautilus-burn-extension.c b/nautilus/nautilus-burn-extension.c
index 380e34b..a1fb74c 100644
--- a/nautilus/nautilus-burn-extension.c
+++ b/nautilus/nautilus-burn-extension.c
@@ -934,7 +934,7 @@ nautilus_module_initialize (GTypeModule *module)
         DEBUG_PRINT ("Initializing nautilus-disc-recorder\n");
 
         brasero_media_library_start ();
-        brasero_burn_library_start ();
+        brasero_burn_library_start (NULL, NULL);
         DEBUG_PRINT ("Libbrasero-media started\n");
 
         nautilus_disc_burn_register_type (module);
diff --git a/src/main.c b/src/main.c
index 56bc0f2..b945683 100644
--- a/src/main.c
+++ b/src/main.c
@@ -69,8 +69,6 @@ gint disc_check;
 gint open_ncb;
 gint parent_window;
 
-#define BRASERO_CONF_DIR "/apps/brasero"
-
 static const GOptionEntry options [] = {
 	{ "project", 'p', 0, G_OPTION_ARG_STRING, &project_uri,
 	  N_("Open the specified project"),
@@ -472,7 +470,6 @@ brasero_app_get_default (void)
 int
 main (int argc, char **argv)
 {
-	GConfClient *client;
 	GOptionContext *context;
 
 #ifdef ENABLE_NLS
@@ -503,18 +500,16 @@ main (int argc, char **argv)
 
 	g_option_context_free (context);
 
-	gst_init (&argc, &argv);
-
-	/* This is for missing codec automatic install */
+	/* REMINDER: this is done in burn library now */
+/*	gst_init (&argc, &argv);
 	gst_pb_utils_init ();
-
 	client = gconf_client_get_default ();
 	gconf_client_add_dir (client,
 			      BRASERO_CONF_DIR,
 			      GCONF_CLIENT_PRELOAD_NONE,
 			      NULL);
-
-	brasero_burn_library_start ();
+*/
+	brasero_burn_library_start (&argc, &argv);
 
 	brasero_enable_multi_DND ();
 
@@ -527,9 +522,6 @@ main (int argc, char **argv)
 
 	brasero_burn_library_stop ();
 
-	gconf_client_remove_dir (client, BRASERO_CONF_DIR, NULL);
-	g_object_unref (client);
-
 	gst_deinit ();
 
 	return 0;



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