[brasero] Drop g_logv to display debug output as when included in some apps this would be filtered



commit cbd18994b31990b554eb8dd36f2f33c102156d5b
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Sat Oct 17 10:03:48 2009 +0200

    Drop g_logv to display debug output as when included in some apps this would be filtered
    Also add a GConf bool for nautilus extension to print debug output when it is TRUE

 libbrasero-burn/burn-debug.c             |   43 ++++++++++++------------------
 libbrasero-burn/burn-debug.h             |    5 ++-
 libbrasero-media/brasero-media-private.h |    3 ++
 libbrasero-media/brasero-media.c         |   16 ++++++-----
 nautilus/Makefile.am                     |    2 +
 nautilus/nautilus-burn-extension.c       |   18 ++++++++++++-
 6 files changed, 51 insertions(+), 36 deletions(-)
---
diff --git a/libbrasero-burn/burn-debug.c b/libbrasero-burn/burn-debug.c
index 56523eb..97887b2 100644
--- a/libbrasero-burn/burn-debug.c
+++ b/libbrasero-burn/burn-debug.c
@@ -33,6 +33,7 @@
 #endif
 
 #include <string.h>
+#include <stdio.h>
 
 #include <glib.h>
 #include <glib/gi18n-lib.h>
@@ -53,6 +54,12 @@ static const GOptionEntry options [] = {
 	{ NULL }
 };
 
+void
+brasero_burn_library_set_debug (gboolean value)
+{
+	debug = value;
+}
+
 /**
  * brasero_burn_library_get_option_group:
  *
@@ -94,15 +101,12 @@ brasero_burn_debug_message (const gchar *location,
 	if (!debug)
 		return;
 
-	format_real = g_strdup_printf ("At %s: %s",
+	format_real = g_strdup_printf ("BraseroBurn: (at %s) %s\n",
 				       location,
 				       format);
 
 	va_start (arg_list, format);
-	g_logv (BRASERO_BURN_LOG_DOMAIN,
-		G_LOG_LEVEL_DEBUG,
-		format_real,
-		arg_list);
+	vprintf (format_real, arg_list);
 	va_end (arg_list);
 
 	g_free (format_real);
@@ -118,15 +122,11 @@ brasero_burn_debug_messagev (const gchar *location,
 	if (!debug)
 		return;
 
-	format_real = g_strdup_printf ("At %s: %s",
+	format_real = g_strdup_printf ("BraseroBurn: (at %s) %s\n",
 				       location,
 				       format);
 
-	g_logv (BRASERO_BURN_LOG_DOMAIN,
-		G_LOG_LEVEL_DEBUG,
-		format_real,
-		arg_list);
-
+	vprintf (format_real, arg_list);
 	g_free (format_real);
 }
 
@@ -179,16 +179,13 @@ brasero_burn_debug_flags_type_message (BraseroBurnFlag flags,
 
 	brasero_debug_burn_flags_to_string (buffer, flags);
 
-	format_real = g_strdup_printf ("At %s: %s %s",
+	format_real = g_strdup_printf ("BraseroBurn: (at %s) %s %s\n",
 				       location,
 				       format,
 				       buffer);
 
 	va_start (arg_list, format);
-	g_logv (BRASERO_BURN_LOG_DOMAIN,
-		G_LOG_LEVEL_DEBUG,
-		format_real,
-		arg_list);
+	vprintf (format_real, arg_list);
 	va_end (arg_list);
 
 	g_free (format_real);
@@ -317,16 +314,13 @@ brasero_burn_debug_track_type_struct_message (BraseroTrackType *type,
 	else
 		strcpy (buffer, "Undefined");
 
-	format_real = g_strdup_printf ("At %s: %s %s",
+	format_real = g_strdup_printf ("BraseroBurn: (at %s) %s %s\n",
 				       location,
 				       format,
 				       buffer);
 
 	va_start (arg_list, format);
-	g_logv (BRASERO_BURN_LOG_DOMAIN,
-		G_LOG_LEVEL_DEBUG,
-		format_real,
-		arg_list);
+	vprintf (format_real, arg_list);
 	va_end (arg_list);
 
 	g_free (format_real);
@@ -387,16 +381,13 @@ brasero_burn_debug_track_type_message (BraseroTrackDataType type,
 		break;
 	}
 
-	format_real = g_strdup_printf ("At %s: %s %s",
+	format_real = g_strdup_printf ("BraseroBurn: (at %s) %s %s\n",
 				       location,
 				       format,
 				       buffer);
 
 	va_start (arg_list, format);
-	g_logv (BRASERO_BURN_LOG_DOMAIN,
-		G_LOG_LEVEL_DEBUG,
-		format_real,
-		arg_list);
+	vprintf (format_real, arg_list);
 	va_end (arg_list);
 
 	g_free (format_real);
diff --git a/libbrasero-burn/burn-debug.h b/libbrasero-burn/burn-debug.h
index 2bd0971..3504435 100644
--- a/libbrasero-burn/burn-debug.h
+++ b/libbrasero-burn/burn-debug.h
@@ -41,8 +41,6 @@
 
 G_BEGIN_DECLS
 
-#define BRASERO_BURN_LOG_DOMAIN					"BraseroBurn"
-
 #define BRASERO_BURN_LOG(format, ...)						\
 		brasero_burn_debug_message (G_STRLOC,				\
 					    format,				\
@@ -89,6 +87,9 @@ G_BEGIN_DECLS
 						       ##__VA_ARGS__);
 
 void
+brasero_burn_library_set_debug (gboolean value);
+
+void
 brasero_burn_debug_setup_module (GModule *handle);
 
 void
diff --git a/libbrasero-media/brasero-media-private.h b/libbrasero-media/brasero-media-private.h
index f9fee58..365e9e1 100644
--- a/libbrasero-media/brasero-media-private.h
+++ b/libbrasero-media/brasero-media-private.h
@@ -50,6 +50,9 @@ brasero_media_get_all_list (BraseroMedia type);
  */
 
 void
+brasero_media_library_set_debug (gboolean value);
+
+void
 brasero_media_to_string (BraseroMedia media,
 			 gchar *string);
 
diff --git a/libbrasero-media/brasero-media.c b/libbrasero-media/brasero-media.c
index 4ed0a26..b288269 100644
--- a/libbrasero-media/brasero-media.c
+++ b/libbrasero-media/brasero-media.c
@@ -33,6 +33,7 @@
 #endif
 
 #include <string.h>
+#include <stdio.h>
 
 #include <glib.h>
 #include <glib/gi18n-lib.h>
@@ -55,6 +56,12 @@ static const GOptionEntry options [] = {
 	{ NULL }
 };
 
+void
+brasero_media_library_set_debug (gboolean value)
+{
+	debug = value;
+}
+
 static GSList *
 brasero_media_add_to_list (GSList *retval,
 			   BraseroMedia media)
@@ -452,8 +459,6 @@ brasero_media_to_string (BraseroMedia media,
 		strcat (buffer, "Unformatted ");
 }
 
-#define BRASERO_MEDIA_LOG_DOMAIN				"BraseroMedia"
-
 /**
  * brasero_media_get_option_group:
  *
@@ -488,15 +493,12 @@ brasero_media_message (const gchar *location,
 	if (!debug)
 		return;
 
-	format_real = g_strdup_printf ("At %s: %s",
+	format_real = g_strdup_printf ("BraseroMedia: (at %s) %s\n",
 				       location,
 				       format);
 
 	va_start (arg_list, format);
-	g_logv (BRASERO_MEDIA_LOG_DOMAIN,
-		G_LOG_LEVEL_DEBUG,
-		format_real,
-		arg_list);
+	vprintf (format_real, arg_list);
 	va_end (arg_list);
 
 	g_free (format_real);
diff --git a/nautilus/Makefile.am b/nautilus/Makefile.am
index fe85491..657ed6e 100644
--- a/nautilus/Makefile.am
+++ b/nautilus/Makefile.am
@@ -9,6 +9,7 @@ INCLUDES =					\
 	-I$(top_builddir)/libbrasero-burn/	\
 	-I$(top_srcdir)/src/			\
 	-I$(top_builddir)/src/			\
+	$(BRASERO_GCONF_CFLAGS)	\
 	$(NAUTILUS_EXTENSION_CFLAGS)		\
 	$(WARN_CFLAGS)							\
 	$(WERROR)				\
@@ -48,6 +49,7 @@ libnautilus_brasero_extension_la_SOURCES = 	\
 	../src/brasero-project-name.h
 
 libnautilus_brasero_extension_la_LIBADD =	\
+	$(BRASERO_GCONF_CFLAGS)	\
 	$(NAUTILUS_EXTENSION_LIBS)		\
 	../libbrasero-utils/libbrasero-utils.la	\
 	../libbrasero-media/libbrasero-media.la	\
diff --git a/nautilus/nautilus-burn-extension.c b/nautilus/nautilus-burn-extension.c
index bd8e491..3aa9b95 100644
--- a/nautilus/nautilus-burn-extension.c
+++ b/nautilus/nautilus-burn-extension.c
@@ -29,6 +29,9 @@
 #include <glib/gi18n-lib.h>
 #include <gdk/gdkx.h>
 #include <gtk/gtk.h>
+
+#include <gconf/gconf-client.h>
+
 #include <libnautilus-extension/nautilus-menu-provider.h>
 #include <libnautilus-extension/nautilus-location-widget-provider.h>
 
@@ -58,6 +61,9 @@
 
 #include "brasero-misc.h"
 
+#include "brasero-media-private.h"
+#include "burn-debug.h"
+
 #define BURN_URI "burn:///"
 
 #define NAUTILUS_TYPE_DISC_BURN  (nautilus_disc_burn_get_type ())
@@ -959,10 +965,20 @@ nautilus_disc_burn_register_type (GTypeModule *module)
 void
 nautilus_module_initialize (GTypeModule *module)
 {
+	GConfClient *client;
+
         DEBUG_PRINT ("Initializing nautilus-disc-recorder\n");
 
-        brasero_media_library_start ();
+	client = gconf_client_get_default ();
+	if (gconf_client_get_bool (client, "/apps/brasero/nautilus-extension-debug", NULL)) {
+		brasero_media_library_set_debug (TRUE);
+		brasero_burn_library_set_debug (TRUE);
+	}
+	g_object_unref (client);
+
+	brasero_media_library_start ();
         brasero_burn_library_start (NULL, NULL);
+
         DEBUG_PRINT ("Libbrasero-media started\n");
 
         nautilus_disc_burn_register_type (module);



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