[totem] Bug 537399 – debug option mess



commit 011a99b05e764798b90bcd7dff94ec4dfad49101
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Jul 27 00:04:30 2009 +0100

    Bug 537399 â?? debug option mess
    
    Tidied up the debugging infrastructure as well.

 browser-plugin/totemNPObject.h                     |   40 +++-------
 browser-plugin/totemPlugin.cpp                     |   78 ++++++++++----------
 browser-plugin/totemPluginGlue.cpp                 |   19 ++---
 configure.in                                       |   13 ---
 src/Makefile.am                                    |    3 +-
 src/backend/Makefile.am                            |    3 +-
 src/backend/debug.h                                |   45 -----------
 .../properties/bacon-video-widget-properties.c     |    2 -
 src/plugins/screenshot/totem-screenshot.c          |    1 -
 src/plugins/totem-python-module.c                  |    9 +-
 src/plugins/totem-python-plugin.c                  |    7 +-
 src/totem-dvb-setup.c                              |    1 -
 src/totem-menu.c                                   |    2 +-
 src/totem-object.c                                 |    2 -
 src/totem-playlist.c                               |    4 +-
 src/totem-preferences.c                            |    2 -
 src/totem-profile.h                                |   57 ++++++++++++++
 17 files changed, 128 insertions(+), 160 deletions(-)
---
diff --git a/browser-plugin/totemNPObject.h b/browser-plugin/totemNPObject.h
index 13abec6..bb10461 100644
--- a/browser-plugin/totemNPObject.h
+++ b/browser-plugin/totemNPObject.h
@@ -25,11 +25,6 @@
 #include "npapi.h"
 #include "npruntime.h"
 
-//FIXME force debug on
-#define GNOME_ENABLE_DEBUG 1
-
-#include "debug.h"
-
 class totemPlugin;
 class totemNPObject;
 class totemNPClass_base;
@@ -104,17 +99,14 @@ class totemNPObject : public NPObject {
 };
 
 /* Helper macros */
-
-#ifdef GNOME_ENABLE_DEBUG
-
-#define TOTEM_LOG_CTOR() D ("%s [%p]", __func__, (void*) this)
-#define TOTEM_LOG_DTOR() D ("%s [%p]", __func__, (void*) this)
+#define TOTEM_LOG_CTOR() g_debug ("%s [%p]", __func__, (void*) this)
+#define TOTEM_LOG_DTOR() g_debug ("%s [%p]", __func__, (void*) this)
 
 #define TOTEM_LOG_INVOKE(i, T) \
 {\
   static bool logAccess[G_N_ELEMENTS (methodNames)];\
   if (!logAccess[i]) {\
-    D ("NOTE: site calls function %s::%s", #T, methodNames[i]);\
+    g_debug ("NOTE: site calls function %s::%s", #T, methodNames[i]);\
     logAccess[i] = true;\
   }\
 }
@@ -123,7 +115,7 @@ class totemNPObject : public NPObject {
 {\
   static bool logAccess[G_N_ELEMENTS (propertyNames)];\
   if (!logAccess[i]) {\
-    D ("NOTE: site gets property %s::%s", #T, propertyNames[i]);\
+    g_debug ("NOTE: site gets property %s::%s", #T, propertyNames[i]);\
     logAccess[i] = true;\
   }\
 }
@@ -132,26 +124,16 @@ class totemNPObject : public NPObject {
 {\
   static bool logAccess[G_N_ELEMENTS (propertyNames)];\
   if (!logAccess[i]) {\
-    D ("NOTE: site sets property %s::%s", #T, propertyNames[i]);\
+    g_debug ("NOTE: site sets property %s::%s", #T, propertyNames[i]);\
     logAccess[i] = true;\
   }\
 }
 
-#else
-
-#define TOTEM_LOG_CTOR()
-#define TOTEM_LOG_DTOR()
-#define TOTEM_LOG_INVOKE(i, T)
-#define TOTEM_LOG_GETTER(i, T)
-#define TOTEM_LOG_SETTER(i, T)
-
-#endif /* GNOME_ENABLE_DEBUG */
-
 #define TOTEM_WARN_INVOKE_UNIMPLEMENTED(i, T) \
 {\
   static bool logWarning[G_N_ELEMENTS (methodNames)];\
   if (!logWarning[i]) {\
-    D ("WARNING: function %s::%s is unimplemented", #T, methodNames[i]);\
+    g_warning ("WARNING: function %s::%s is unimplemented", #T, methodNames[i]);\
     logWarning[i] = true;\
   }\
 }
@@ -160,7 +142,7 @@ class totemNPObject : public NPObject {
 {\
   static bool logWarning;\
   if (!logWarning) {\
-    D ("WARNING: function %s::%s is unimplemented", #T, methodNames[i]);\
+    g_warning ("WARNING: function %s::%s is unimplemented", #T, methodNames[i]);\
     logWarning = true;\
   }\
 }
@@ -169,7 +151,7 @@ class totemNPObject : public NPObject {
 {\
   static bool logWarning[G_N_ELEMENTS (propertyNames)];\
   if (!logWarning[i]) {\
-    D ("WARNING: getter for property %s::%s is unimplemented", #T, propertyNames[i]);\
+    g_warning ("WARNING: getter for property %s::%s is unimplemented", #T, propertyNames[i]);\
     logWarning[i] = true;\
   }\
 }
@@ -178,7 +160,7 @@ class totemNPObject : public NPObject {
 {\
   static bool logWarning;\
   if (!logWarning) {\
-    D ("WARNING: getter for property %s::%s is unimplemented", #T, propertyNames[i]);\
+    g_warning ("WARNING: getter for property %s::%s is unimplemented", #T, propertyNames[i]);\
     logWarning = true;\
   }\
 }
@@ -187,7 +169,7 @@ class totemNPObject : public NPObject {
 {\
   static bool logWarning[G_N_ELEMENTS (propertyNames)];\
   if (!logWarning[i]) {\
-    D ("WARNING: setter for property %s::%s is unimplemented", #T, propertyNames[i]);\
+    g_warning ("WARNING: setter for property %s::%s is unimplemented", #T, propertyNames[i]);\
     logWarning[i] = true;\
   }\
 }
@@ -196,7 +178,7 @@ class totemNPObject : public NPObject {
 {\
   static bool logWarning;\
   if (!logWarning) {\
-    D ("WARNING: setter for property %s::%s is unimplemented", #T, propertyNames[i]);\
+    g_warning ("WARNING: setter for property %s::%s is unimplemented", #T, propertyNames[i]);\
     logWarning = true;\
   }\
 }
diff --git a/browser-plugin/totemPlugin.cpp b/browser-plugin/totemPlugin.cpp
index 2738699..13a5c57 100644
--- a/browser-plugin/totemPlugin.cpp
+++ b/browser-plugin/totemPlugin.cpp
@@ -43,16 +43,18 @@
 #include "npruntime.h"
 #include "npupp.h"
 
-/* define GNOME_ENABLE_DEBUG for more debug spew */
-#define GNOME_ENABLE_DEBUG 1
-/* FIXME define D() so that it prints the |this| pointer, so we can differentiate between different concurrent plugins! */
-#include "debug.h"
+#ifdef G_HAVE_ISO_VARARGS
+#define D(m, ...) g_debug ("%p: "#m, this, __VA_ARGS__)
+#elif defined(G_HAVE_GNUC_VARARGS)
+#define D(m, x...) g_debug ("%p: "#m, this, x)
+#endif
+#define Dm(m) g_debug ("%p: "#m, this)
 
-// really noisy debug
+// Really noisy messages; let's noop them for now
 #ifdef G_HAVE_ISO_VARARGS
 #define DD(...)
 #elif defined(G_HAVE_GNUC_VARARGS)
-#define DD(args...)
+#define DD(x...)
 #endif
 
 #include "totemPlugin.h"
@@ -343,7 +345,7 @@ totemPlugin::SetFullscreen (bool enabled)
 void
 totemPlugin::ClearPlaylist ()
 {
-	D ("ClearPlaylist");
+	Dm ("ClearPlaylist");
 
 	/* FIXME: queue the action instead */
 	if (!mViewerReady)
@@ -466,7 +468,7 @@ totemPlugin::ViewerFork ()
 	const char *userAgent = NPN_UserAgent (mNPP);
 	if (!userAgent) {
 		/* See https://bugzilla.mozilla.org/show_bug.cgi?id=328778 */
-		D ("User agent has more than 127 characters; fix your browser!");
+		Dm ("User agent has more than 127 characters; fix your browser!");
 	}
 
         GPtrArray *arr = g_ptr_array_new ();
@@ -619,7 +621,7 @@ totemPlugin::ViewerSetup ()
 
 	mViewerSetUp = true;
 
-	D ("ViewerSetup");
+	Dm ("ViewerSetup");
 
 	/* Cancel timeout */
         if (mTimerID != 0) {
@@ -758,7 +760,7 @@ totemPlugin::ViewerSetWindow ()
 		return;
 
 	if (!mViewerProxy) {
-		D ("No viewer proxy yet, deferring SetWindow");
+		Dm ("No viewer proxy yet, deferring SetWindow");
 		return;
 	}
 
@@ -771,7 +773,7 @@ totemPlugin::ViewerSetWindow ()
 
 	assert (mViewerPendingCall == NULL); /* Have a pending call */
 
-	D ("Calling SetWindow");
+	Dm ("Calling SetWindow");
 	mViewerPendingCall = 
 		dbus_g_proxy_begin_call (mViewerProxy,
 					 "SetWindow",
@@ -794,7 +796,7 @@ totemPlugin::ViewerSetWindow ()
 void
 totemPlugin::ViewerReady ()
 {
-	D ("ViewerReady");
+	Dm ("ViewerReady");
 
 	assert (!mViewerReady);
 
@@ -823,7 +825,7 @@ totemPlugin::ViewerReady ()
 void
 totemPlugin::ViewerButtonPressed (guint aTimestamp, guint aButton)
 {
-	D ("ButtonPress");
+	Dm ("ButtonPress");
 
 #ifdef TOTEM_NARROWSPACE_PLUGIN
 	/* FIXME set href="" afterwards, so we don't try to launch again when the user clicks again? */
@@ -910,14 +912,14 @@ totemPlugin::NameOwnerChanged (const char *aName,
 	    aNewOwner[0] != '\0' /* non-empty */) {
 		if (mViewerBusAddress &&
                     strcmp (mViewerBusAddress, aNewOwner) == 0) {
-			D ("Already have owner, why are we notified again?");
+			Dm ("Already have owner, why are we notified again?");
                         g_free (mViewerBusAddress);
 		} else if (mViewerBusAddress) {
-			D ("WTF, new owner!?");
+			Dm ("WTF, new owner!?");
                         g_free (mViewerBusAddress);
 		} else {
 			/* This is the regular case */
-			D ("Viewer now connected to the bus");
+			Dm ("Viewer now connected to the bus");
 		}
 
 		mViewerBusAddress = g_strdup (aNewOwner);
@@ -925,7 +927,7 @@ totemPlugin::NameOwnerChanged (const char *aName,
 		ViewerSetup ();
 	} else if (mViewerBusAddress &&
 		   strcmp (mViewerBusAddress, aOldOwner) == 0) {
-		D ("Viewer lost connection!");
+		Dm ("Viewer lost connection!");
 
 		g_free (mViewerBusAddress);
                 mViewerBusAddress = NULL;
@@ -961,7 +963,7 @@ totemPlugin::RequestStream (bool aForceViewer)
           return;//FIXMEchpe
 
 	if (mStream) {
-		D ("Unexpectedly have a stream!");
+		Dm ("Unexpectedly have a stream!");
 		/* FIXME cancel existing stream, schedule new timer to try again */
 		return;
 	}
@@ -1117,7 +1119,7 @@ totemPlugin::ViewerForkTimeoutCallback (void *aData)
 
         plugin->mTimerID = 0;
 
-	D ("ViewerForkTimeoutCallback");
+	g_debug ("ViewerForkTimeoutCallback");
 
 	/* FIXME: can this really happen? */
 	assert (!plugin->mViewerReady); /* Viewer ready but timeout running? */
@@ -1136,7 +1138,7 @@ totemPlugin::ButtonPressCallback (DBusGProxy *proxy,
 {
 	totemPlugin *plugin = reinterpret_cast<totemPlugin*>(aData);
 
-	D ("ButtonPress signal received");
+	g_debug ("ButtonPress signal received");
 
 	plugin->ViewerButtonPressed (aTimestamp, aButton);
 }
@@ -1147,7 +1149,7 @@ totemPlugin::StopStreamCallback (DBusGProxy *proxy,
 {
 	totemPlugin *plugin = reinterpret_cast<totemPlugin*>(aData);
 
-	D ("StopStream signal received");
+	g_debug ("StopStream signal received");
 
 	plugin->UnsetStream ();
 }
@@ -1227,7 +1229,7 @@ totemPlugin::ViewerSetWindowCallback (DBusGProxy *aProxy,
 {
 	totemPlugin *plugin = reinterpret_cast<totemPlugin*>(aData);
 
-	D ("SetWindow reply");
+	g_debug ("SetWindow reply");
 
 	//assert (aCall == plugin->mViewerPendingCall, "SetWindow not the current call");
         if (aCall != plugin->mViewerPendingCall)
@@ -1253,7 +1255,7 @@ totemPlugin::ViewerOpenStreamCallback (DBusGProxy *aProxy,
 {
 	totemPlugin *plugin = reinterpret_cast<totemPlugin*>(aData);
 
-	D ("OpenStream reply");
+	g_debug ("OpenStream reply");
 
 // 	assert (aCall == plugin->mViewerPendingCall, "OpenStream not the current call");
         if (aCall != plugin->mViewerPendingCall)
@@ -1290,7 +1292,7 @@ totemPlugin::ViewerOpenStreamCallback (DBusGProxy *aProxy,
 	if (err != NPERR_NO_ERROR) {
 		plugin->mExpectingStream = false;
 
-		D ("GetURLNotify '%s' failed with error %d", plugin->mRequestURI, err);
+		g_debug ("GetURLNotify '%s' failed with error %d", plugin->mRequestURI, err);
 		return;
 	}
 
@@ -1317,7 +1319,7 @@ totemPlugin::ViewerOpenURICallback (DBusGProxy *aProxy,
 {
 	totemPlugin *plugin = reinterpret_cast<totemPlugin*>(aData);
 
-	D ("OpenURI reply");
+	g_debug ("OpenURI reply");
 
 // 	//assert (aCall == plugin->mViewerPendingCall, "OpenURI not the current call");
         if (aCall != plugin->mViewerPendingCall)
@@ -1865,7 +1867,7 @@ totemPlugin::Init (NPMIMEType mimetype,
                             NPNVPluginElementNPObject,
                             getter_Retains (mPluginElement));
 	if (err != NPERR_NO_ERROR || mPluginElement.IsNull ()) {
-		D ("Failed to get our DOM Element NPObject");
+		Dm ("Failed to get our DOM Element NPObject");
 		return NPERR_GENERIC_ERROR;
 	}
 
@@ -1876,7 +1878,7 @@ totemPlugin::Init (NPMIMEType mimetype,
                               NPN_GetStringIdentifier ("ownerDocument"),
                               getter_Retains (mPluginOwnerDocument)) ||
             mPluginOwnerDocument.IsNull ()) {
-		D ("Failed to get the plugin element's ownerDocument");
+		Dm ("Failed to get the plugin element's ownerDocument");
 		return NPERR_GENERIC_ERROR;
 	}
 #endif /* TOTEM_COMPLEX_PLUGIN */
@@ -1894,7 +1896,7 @@ totemPlugin::Init (NPMIMEType mimetype,
                               NPN_GetStringIdentifier ("baseURI"),
                               getter_Copies (baseURI)) ||
             !baseURI.IsString ()) {
-          D ("Failed to get the base URI");
+          Dm ("Failed to get the base URI");
           return NPERR_GENERIC_ERROR;
         }
 
@@ -1914,7 +1916,7 @@ totemPlugin::Init (NPMIMEType mimetype,
 	      					     DBUS_SERVICE_DBUS,
 						     DBUS_PATH_DBUS,
 						     DBUS_INTERFACE_DBUS))) {
-		D ("Failed to get DBUS proxy");
+		Dm ("Failed to get DBUS proxy");
 		return NPERR_OUT_OF_MEMORY_ERROR;
 	}
 
@@ -2217,7 +2219,7 @@ NPError
 totemPlugin::SetWindow (NPWindow *window)
 {
 	if (mHidden && window->window != 0) {
-		D("SetWindow: hidden, can't set window");
+		Dm ("SetWindow: hidden, can't set window");
 		return NPERR_GENERIC_ERROR;
 	}
 
@@ -2237,7 +2239,7 @@ totemPlugin::SetWindow (NPWindow *window)
 
 		ViewerSetWindow ();
 	} else {
-		D ("Setting a new window != mWindow, this is unsupported!");
+		Dm ("Setting a new window != mWindow, this is unsupported!");
 	}
 
 	return NPERR_NO_ERROR;
@@ -2256,7 +2258,7 @@ totemPlugin::NewStream (NPMIMEType type,
 
 	/* We already have a live stream */
 	if (mStream) {
-		D ("Already have a live stream, aborting stream");
+		Dm ("Already have a live stream, aborting stream");
 
 		/* We don't just return NPERR_GENERIC_ERROR (or any other error code),
 		 * since, using gecko trunk (1.9), this causes the plugin to be destroyed,
@@ -2275,7 +2277,7 @@ totemPlugin::NewStream (NPMIMEType type,
 	 *   doesn't catch always this.
 	 */
 	if (!mExpectingStream) {
-		D ("Not expecting a new stream; aborting stream");
+		Dm ("Not expecting a new stream; aborting stream");
 
 		return NPN_DestroyStream (mNPP,
                                           stream,
@@ -2294,7 +2296,7 @@ totemPlugin::NewStream (NPMIMEType type,
 	 * until the viewer is ready.
 	 */
 	if (!mViewerReady) {
-		D ("Viewer not ready, aborting stream");
+		Dm ("Viewer not ready, aborting stream");
 
 		return NPN_DestroyStream (mNPP,
                                           stream,
@@ -2417,7 +2419,7 @@ totemPlugin::Write (NPStream *stream,
 		mCheckedForPlaylist = true;
 
 		if (totem_pl_parser_can_parse_from_data ((const char *) buffer, len, TRUE /* FIXME */)) {
-			D ("Is playlist; need to wait for the file to be downloaded completely");
+			Dm ("Is playlist; need to wait for the file to be downloaded completely");
 			mIsPlaylist = true;
 
 			/* Close the viewer */
@@ -2476,7 +2478,7 @@ totemPlugin::StreamAsFile (NPStream *stream,
 	 * it finishes before we're ready.
 	 */
 	if (!mViewerReady) {
-		D ("Viewer not ready yet, deferring SetLocalFile");
+		Dm ("Viewer not ready yet, deferring SetLocalFile");
 		return;
 	}
 
@@ -2569,7 +2571,7 @@ totemPlugin::URLNotify (const char *url,
 					   G_TYPE_INVALID,
 					   G_TYPE_INVALID);
 		} else if (reason != NPRES_DONE) {
-			D ("Failed to get stream");
+			Dm ("Failed to get stream");
 			/* FIXME: show error to user? */
 		}
 
@@ -2636,7 +2638,7 @@ totemPlugin::GetNPObject (ObjectEnum which)
 
   mNPObjects[which] = do_CreateInstance (npclass, mNPP);
   if (mNPObjects[which].IsNull ()) {
-    D ("Creating scriptable NPObject failed!");
+    Dm ("Creating scriptable NPObject failed!");
     return NULL;
   }
 
diff --git a/browser-plugin/totemPluginGlue.cpp b/browser-plugin/totemPluginGlue.cpp
index ea681c2..fc5afc1 100644
--- a/browser-plugin/totemPluginGlue.cpp
+++ b/browser-plugin/totemPluginGlue.cpp
@@ -30,9 +30,6 @@
 #include "npapi.h"
 #include "npupp.h"
 
-#define GNOME_ENABLE_DEBUG 1
-#include "debug.h"
-
 #include "totemPlugin.h"
 
 NPNetscapeFuncs NPNFuncs; /* used in npn_gate.cpp */
@@ -121,7 +118,7 @@ totem_plugin_destroy_stream (NPP instance,
 			     NPError reason)
 {
 	if (!instance) {
-		D("totem_plugin_destroy_stream instance is NULL");
+		g_debug ("totem_plugin_destroy_stream instance is NULL");
 		/* FIXME? */
 		return NPERR_NO_ERROR;
 	}
@@ -199,14 +196,14 @@ static void
 totem_plugin_print (NPP instance,
                     NPPrint* platformPrint)
 {
-	D ("Print");
+	g_debug ("Print");
 }
 
 static int16_t
 totem_plugin_handle_event (NPP instance,
                            void* event)
 {
-	D ("Handle event");
+	g_debug ("Handle event");
         return FALSE;
 }
 
@@ -247,7 +244,7 @@ totem_plugin_get_value (NPP instance,
                 }
 		break;
 	default:
-		D ("Unhandled variable %d instance %p", variable, plugin);
+		g_debug ("Unhandled variable %d instance %p", variable, plugin);
 		err = NPERR_INVALID_PARAM;
 		break;
 	}
@@ -260,7 +257,7 @@ totem_plugin_set_value (NPP instance,
 			NPNVariable variable,
 			void *value)
 {
-	D ("SetValue variable %d (%x)", variable, variable);
+	g_debug ("SetValue variable %d (%x)", variable, variable);
 
 	return NPERR_NO_ERROR;
 }
@@ -397,7 +394,7 @@ NPError
 NP_Initialize (NPNetscapeFuncs *aMozillaVTable,
 	       NPPluginFuncs *aPluginVTable)
 {
-	D ("NP_Initialize");
+	g_debug ("NP_Initialize");
 
 	if (aMozillaVTable == NULL || aPluginVTable == NULL)
 		return NPERR_INVALID_FUNCTABLE_ERROR;
@@ -464,7 +461,7 @@ NP_Initialize (NPNetscapeFuncs *aMozillaVTable,
 	aPluginVTable->getvalue       = NewNPP_GetValueProc (totem_plugin_get_value);
 	aPluginVTable->setvalue       = NewNPP_SetValueProc (totem_plugin_set_value);
 
-	D ("NP_Initialize succeeded");
+	g_debug ("NP_Initialize succeeded");
 
 	return totemPlugin::Initialise ();
 }
@@ -472,7 +469,7 @@ NP_Initialize (NPNetscapeFuncs *aMozillaVTable,
 NPError
 NP_Shutdown(void)
 {
-	D ("NP_Shutdown");
+	g_debug ("NP_Shutdown");
 
 	g_free (mime_list);
 	mime_list = NULL;
diff --git a/configure.in b/configure.in
index da61c58..c4c0fc9 100644
--- a/configure.in
+++ b/configure.in
@@ -770,19 +770,6 @@ dnl in data/totem.desktop.in.in.in
 TOTEM_FULLPATH(libexecdir, NONE, FULL_LIBEXECDIR)
 AC_SUBST(FULL_LIBEXECDIR)
 
-dnl debug
-AC_ARG_ENABLE(debug,
-		AC_HELP_STRING([--disable-debug],[disables compilation of debugging messages]),
-	[case "${enableval}" in
-	yes) ENABLE_DEBUG=yes ;;
-	no)  ENABLE_DEBUG=no ;;
-	*) AC_MSG_ERROR(bad value ${enableval} for --disable-debug) ;;
-	esac],
-[ENABLE_DEBUG=no]) dnl Default value
-if test x$ENABLE_DEBUG = xyes; then
-	AC_DEFINE(TOTEM_DEBUG, 1, [Define if DEBUG statements should be compiled in])
-fi
-
 dnl run in source tree
 AC_ARG_ENABLE(run-in-source-tree,
 	      AC_HELP_STRING([--disable-run-in-source-tree],[disable search for UI files and plugins in local directory ]),
diff --git a/src/Makefile.am b/src/Makefile.am
index 70c6372..7dd34c9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -83,7 +83,8 @@ libtotem_main_la_SOURCES = \
 	totem-subtitle-encoding.c	\
 	totem-subtitle-encoding.h	\
 	totem-dvb-setup.c		\
-	totem-dvb-setup.h
+	totem-dvb-setup.h		\
+	totem-profile.h
 
 libtotem_main_la_CPPFLAGS = \
 	-I$(top_srcdir)/		\
diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am
index 2a4dfad..97b73ff 100644
--- a/src/backend/Makefile.am
+++ b/src/backend/Makefile.am
@@ -38,8 +38,7 @@ libbaconvideowidget_la_SOURCES = \
 	bacon-video-widget-gst-missing-plugins.c	\
 	bacon-video-widget-gst-missing-plugins.h	\
 	gstscreenshot.c					\
-	gstscreenshot.h					\
-	debug.h
+	gstscreenshot.h
 
 libbaconvideowidget_la_CPPFLAGS =		\
 	-D_REENTRANT				\
diff --git a/src/plugins/properties/bacon-video-widget-properties.c b/src/plugins/properties/bacon-video-widget-properties.c
index 79ed37e..500baca 100644
--- a/src/plugins/properties/bacon-video-widget-properties.c
+++ b/src/plugins/properties/bacon-video-widget-properties.c
@@ -30,8 +30,6 @@
 #include "video-utils.h"
 #include "totem-interface.h"
 
-#include "debug.h"
-
 /* used in bacon_video_widget_properties_update() */
 #define UPDATE_FROM_STRING(type, name) \
 	do { \
diff --git a/src/plugins/screenshot/totem-screenshot.c b/src/plugins/screenshot/totem-screenshot.c
index 0e25111..213eb14 100644
--- a/src/plugins/screenshot/totem-screenshot.c
+++ b/src/plugins/screenshot/totem-screenshot.c
@@ -37,7 +37,6 @@
 #include <unistd.h>
 #include <sys/stat.h>
 
-#include "debug.h"
 #include "totem-interface.h"
 #include "totem-uri.h"
 #include "totem-screenshot-plugin.h"
diff --git a/src/plugins/totem-python-module.c b/src/plugins/totem-python-module.c
index a3bd808..a514907 100644
--- a/src/plugins/totem-python-module.c
+++ b/src/plugins/totem-python-module.c
@@ -36,7 +36,6 @@
 
 #include <gmodule.h>
 
-#include "debug.h"
 #include "totem-plugin.h"
 #include "totem-python-module.h"
 #include "totem-python-plugin.h"
@@ -338,7 +337,7 @@ static void
 totem_python_module_unload (GTypeModule *module)
 {
 	TotemPythonModulePrivate *priv = TOTEM_PYTHON_MODULE_GET_PRIVATE (module);
-	D("Unloading Python module");
+	g_debug ("Unloading Python module");
 
 	priv->type = 0;
 }
@@ -352,7 +351,7 @@ totem_python_module_new_object (TotemPythonModule *module)
 	if (priv->type == 0)
 		return NULL;
 
-	D("Creating object of type %s", g_type_name (priv->type));
+	g_debug ("Creating object of type %s", g_type_name (priv->type));
 	object = (TotemPythonObject*) (g_object_new (priv->type,
 						  "name", priv->module,
 						  NULL));
@@ -377,7 +376,7 @@ totem_python_module_new_object (TotemPythonModule *module)
 static void
 totem_python_module_init (TotemPythonModule *module)
 {
-	D("Init of Python module");
+	g_debug ("Init of Python module");
 }
 
 static void
@@ -386,7 +385,7 @@ totem_python_module_finalize (GObject *object)
 	TotemPythonModulePrivate *priv = TOTEM_PYTHON_MODULE_GET_PRIVATE (object);
 
 	if (priv && priv->type) {
-		D("Finalizing Python module %s", g_type_name (priv->type));
+		g_debug ("Finalizing Python module %s", g_type_name (priv->type));
 
 		g_free (priv->module);
 		g_free (priv->path);
diff --git a/src/plugins/totem-python-plugin.c b/src/plugins/totem-python-plugin.c
index a067df7..8bf8955 100644
--- a/src/plugins/totem-python-plugin.c
+++ b/src/plugins/totem-python-plugin.c
@@ -28,7 +28,6 @@
 
 #include "totem-python-plugin.h"
 #include "totem-plugin.h"
-#include "debug.h"
 
 #include <pygobject.h>
 #include <string.h>
@@ -198,7 +197,7 @@ totem_python_object_init (TotemPythonObject *object)
 
 	state = pyg_gil_state_ensure();
 
-	D("Creating Python plugin instance");
+	g_debug ("Creating Python plugin instance");
 
 	class = (TotemPythonObjectClass*) (((GTypeInstance*) object)->g_class);
 
@@ -212,7 +211,7 @@ totem_python_object_init (TotemPythonObject *object)
 static void
 totem_python_object_finalize (GObject *object)
 {
-	D("Finalizing Python plugin instance");
+	g_debug ("Finalizing Python plugin instance");
 
 	if (((TotemPythonObject *) object)->instance) {
 		Py_DECREF (((TotemPythonObject *) object)->instance);
@@ -268,7 +267,7 @@ totem_python_object_get_type (GTypeModule *module,
 	type_name = g_strdup_printf ("%s+TotemPythonPlugin",
 				     PyString_AsString (PyObject_GetAttrString (type, "__name__")));
 
-	D("Registering Python plugin instance: %s", type_name);
+	g_debug ("Registering Python plugin instance: %s", type_name);
 	gtype = g_type_module_register_type (module,
 					     TOTEM_TYPE_PLUGIN,
 					     type_name,
diff --git a/src/totem-dvb-setup.c b/src/totem-dvb-setup.c
index 6d98e25..1012947 100644
--- a/src/totem-dvb-setup.c
+++ b/src/totem-dvb-setup.c
@@ -25,7 +25,6 @@
 #include <gdk/gdk.h>
 
 #include "totem-dvb-setup.h"
-#include "debug.h"
 
 #ifdef GDK_WINDOWING_X11
 
diff --git a/src/totem-menu.c b/src/totem-menu.c
index 8895058..dddedd3 100644
--- a/src/totem-menu.c
+++ b/src/totem-menu.c
@@ -36,7 +36,7 @@
 #include "bacon-video-widget.h"
 #include "totem-uri.h"
 
-#include "debug.h"
+#include "totem-profile.h"
 
 #define TOTEM_MAX_RECENT_ITEM_LEN 40
 
diff --git a/src/totem-object.c b/src/totem-object.c
index 4de299f..2635654 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -75,8 +75,6 @@
 #include "totem-dnd-menu.h"
 #include "totem-preferences.h"
 
-#include "debug.h"
-
 #define REWIND_OR_PREVIOUS 4000
 
 #define SEEK_FORWARD_SHORT_OFFSET 15
diff --git a/src/totem-playlist.c b/src/totem-playlist.c
index 64b4fb6..0269f54 100644
--- a/src/totem-playlist.c
+++ b/src/totem-playlist.c
@@ -37,7 +37,6 @@
 #include "totem-uri.h"
 #include "totem-interface.h"
 #include "video-utils.h"
-#include "debug.h"
 
 #define PL_LEN (gtk_tree_model_iter_n_children (playlist->priv->model, NULL))
 
@@ -1677,8 +1676,7 @@ totem_playlist_add_one_mrl (TotemPlaylist *playlist, const char *mrl,
 	ref = NULL;
 	uri = totem_create_full_path (mrl);
 
-	D("totem_playlist_add_one_mrl (): %s %s %s\n",
-				filename_for_display, uri ? uri : "(null)", display_name);
+	g_debug ("totem_playlist_add_one_mrl (): %s %s %s\n", filename_for_display, uri, display_name);
 
 	if (playlist->priv->tree_path != NULL && playlist->priv->current != NULL) {
 		int *indices;
diff --git a/src/totem-preferences.c b/src/totem-preferences.c
index fd37e6a..f05e695 100644
--- a/src/totem-preferences.c
+++ b/src/totem-preferences.c
@@ -44,8 +44,6 @@
 #include "totem-plugin.h"
 #include "totem-plugins-engine.h"
 
-#include "debug.h"
-
 /* Callback functions for GtkBuilder */
 G_MODULE_EXPORT void checkbutton1_toggled_cb (GtkToggleButton *togglebutton, Totem *totem);
 G_MODULE_EXPORT void checkbutton2_toggled_cb (GtkToggleButton *togglebutton, Totem *totem);
diff --git a/src/totem-profile.h b/src/totem-profile.h
new file mode 100644
index 0000000..1089c56
--- /dev/null
+++ b/src/totem-profile.h
@@ -0,0 +1,57 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2001,2002,2003 Bastien Nocera <hadess hadess net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
+ *
+ *
+ * The Totem project hereby grant permission for non-gpl compatible GStreamer
+ * plugins to be used and distributed together with GStreamer and Totem. This
+ * permission are above and beyond the permissions granted by the GPL license
+ * Totem is covered by.
+ *
+ * Monday 7th February 2005: Christian Schaller: Add exception clause.
+ * See license_change file for details.
+ *
+ */
+
+#ifndef __TOTEM_PROFILE_H__
+#define __TOTEM_PROFILE_H__ 1
+
+#ifdef GNOME_ENABLE_DEBUG
+
+#include <sys/time.h>
+#include <glib.h>
+
+#define TOTEM_PROFILE(function)     \
+    do{                             \
+      struct timeval current_time;  \
+      double dtime;                 \
+      gettimeofday(&current_time, NULL); \
+      dtime = -(current_time.tv_sec + (current_time.tv_usec / 1000000.0)); \
+      function;                     \
+      gettimeofday(&current_time, NULL); \
+      dtime += current_time.tv_sec + (current_time.tv_usec / 1000000.0); \
+      printf("(%s:%d) took %lf seconds\n", \
+	     G_STRFUNC, __LINE__, dtime ); \
+    }while(0)
+
+#else /* GNOME_ENABLE_DEBUG */
+
+#define TOTEM_PROFILE(function) function
+
+#endif /* GNOME_ENABLE_DEBUG */
+
+#endif /* __TOTEM_PROFILE_H__ */



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