gtranslator r3691 - in trunk: . src src/plugin-system



Author: icq
Date: Mon Sep 22 09:43:13 2008
New Revision: 3691
URL: http://svn.gnome.org/viewvc/gtranslator?rev=3691&view=rev

Log:
Squashed commit of the following:

commit b4e4790767fda7d4885f9c0f74d43722d568174d
Author: Ignacio Casal Quinteiro <nacho resa gmail com>
Date:   Tue Aug 12 20:49:15 2008 +0200

    Added debug system.

Added:
   trunk/src/debug.h
Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/src/ChangeLog
   trunk/src/Makefile.am
   trunk/src/plugin-system/module.c
   trunk/src/plugin-system/plugin-info.c
   trunk/src/plugin-system/plugin-manager.c
   trunk/src/plugin-system/plugin.h
   trunk/src/plugin-system/plugins-engine.c
   trunk/src/plugin-system/update-from-gedit.sh

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Mon Sep 22 09:43:13 2008
@@ -479,7 +479,7 @@
 	,enable_debug=yes)
 AC_MSG_CHECKING([if a debug friendly version should be build])
 if test "x$enable_debug" = "xyes" ; then
-	CFLAGS="$CFLAGS -ggdb "
+	CFLAGS="$CFLAGS -ggdb -DDEBUG"
 else
 	CFLAGS="`echo $CFLAGS|sed -e s/-g.//g -e s/-ggdb//g`"
 fi

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Mon Sep 22 09:43:13 2008
@@ -54,6 +54,7 @@
 INST_H_FILES =				\
 	application.h \
 	context.h \
+	debug.h \
 	header.h \
 	io-error-message-area.h \
 	message-area.h \

Added: trunk/src/debug.h
==============================================================================
--- (empty file)
+++ trunk/src/debug.h	Mon Sep 22 09:43:13 2008
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2008  Ignacio Casal Quinteiro <nacho resa gmail com>
+ * 
+ *     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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __DEBUG_H__
+#define __DEBUG_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#ifdef DEBUG
+#  define DEBUG_PRINT g_message
+#else
+#  define DEBUG_PRINT(...)
+#endif
+
+G_END_DECLS
+
+#endif /* __DEBUG_H__ */

Modified: trunk/src/plugin-system/module.c
==============================================================================
--- trunk/src/plugin-system/module.c	(original)
+++ trunk/src/plugin-system/module.c	Mon Sep 22 09:43:13 2008
@@ -39,7 +39,7 @@
 #include "config.h"
 
 #include "module.h"
-//#include "gtranslator-debug.h"
+#include "debug.h"
 
 typedef GType (*GtranslatorModuleRegisterFunc) (GTypeModule *);
 
@@ -58,12 +58,12 @@
 	GtranslatorModuleRegisterFunc register_func;
 	gchar *path;
 
-	g_message( "Loading %s module from %s",
+	DEBUG_PRINT ( "Loading %s module from %s",
 			     module->module_name, module->path);
 
 	path = g_module_build_path (module->path, module->module_name);
 	g_return_val_if_fail (path != NULL, FALSE);
-	g_message( "Module filename: %s", path);
+	DEBUG_PRINT ( "Module filename: %s", path);
 
 	module->library = g_module_open (path, 0);
 	g_free (path);
@@ -111,7 +111,7 @@
 {
 	GtranslatorModule *module = GTR_MODULE (gmodule);
 
-	g_message( "Unloading %s", module->path);
+	DEBUG_PRINT ( "Unloading %s", module->path);
 
 	g_module_close (module->library);
 
@@ -128,7 +128,7 @@
 static void
 gtranslator_module_init (GtranslatorModule *module)
 {
-	g_message( "GtranslatorModule %p initialising", module);
+	DEBUG_PRINT ( "GtranslatorModule %p initialising", module);
 }
 
 static void
@@ -136,7 +136,7 @@
 {
 	GtranslatorModule *module = GTR_MODULE (object);
 
-	g_message( "GtranslatorModule %p finalising", module);
+	DEBUG_PRINT ( "GtranslatorModule %p finalising", module);
 
 	g_free (module->path);
 	g_free (module->module_name);
@@ -235,7 +235,7 @@
 {
 	g_return_val_if_fail (module->type != 0, NULL);
 
-	g_message( "Creating object of type %s",
+	DEBUG_PRINT ( "Creating object of type %s",
 			     g_type_name (module->type));
 
 	return g_object_new (module->type, NULL);

Modified: trunk/src/plugin-system/plugin-info.c
==============================================================================
--- trunk/src/plugin-system/plugin-info.c	(original)
+++ trunk/src/plugin-system/plugin-info.c	Mon Sep 22 09:43:13 2008
@@ -39,7 +39,7 @@
 
 #include "plugin-info.h"
 #include "plugin-info-priv.h"
-//#include "gtranslator-debug.h"
+#include "debug.h"
 #include "plugin.h"
 
 #ifdef ENABLE_PYTHON
@@ -67,7 +67,7 @@
 
 	if (info->plugin != NULL)
 	{
-		g_message( "Unref plugin %s", info->name);
+		DEBUG_PRINT ( "Unref plugin %s", info->name);
 
 		g_object_unref (info->plugin);
 		
@@ -127,7 +127,7 @@
 
 	g_return_val_if_fail (file != NULL, NULL);
 
-	g_message( "Loading plugin: %s", file);
+	DEBUG_PRINT ( "Loading plugin: %s", file);
 
 	info = g_new0 (GtranslatorPluginInfo, 1);
 	info->refcount = 1;
@@ -145,7 +145,7 @@
 				 "IAge",
 				 NULL))
 	{
-		g_message(
+		DEBUG_PRINT (
 				     "IAge key does not exist in file: %s", file);
 		goto error;
 	}
@@ -156,7 +156,7 @@
 				    "IAge",
 				    NULL) != 2)
 	{
-		g_message(
+		DEBUG_PRINT (
 				     "Wrong IAge in file: %s", file);
 		goto error;
 	}
@@ -185,7 +185,7 @@
 							 NULL);
 	if (info->dependencies == NULL)
 	{
-		g_message( "Could not find 'Depends' in %s", file);
+		DEBUG_PRINT ( "Could not find 'Depends' in %s", file);
 		info->dependencies = g_new0 (gchar *, 1);
 	}
 
@@ -231,7 +231,7 @@
 	if (str)
 		info->desc = str;
 	else
-		g_message( "Could not find 'Description' in %s", file);
+		DEBUG_PRINT ( "Could not find 'Description' in %s", file);
 
 	/* Get Icon */
 	str = g_key_file_get_locale_string (plugin_file,
@@ -241,7 +241,7 @@
 	if (str)
 		info->icon_name = str;
 	else
-		g_message( "Could not find 'Icon' in %s, using 'plugin'", file);
+		DEBUG_PRINT ( "Could not find 'Icon' in %s, using 'plugin'", file);
 	
 
 	/* Get Authors */
@@ -251,7 +251,7 @@
 						    NULL,
 						    NULL);
 	if (info->authors == NULL)
-		g_message( "Could not find 'Authors' in %s", file);
+		DEBUG_PRINT ( "Could not find 'Authors' in %s", file);
 
 
 	/* Get Copyright */
@@ -262,7 +262,7 @@
 	if (str)
 		info->copyright = str;
 	else
-		g_message( "Could not find 'Copyright' in %s", file);
+		DEBUG_PRINT ( "Could not find 'Copyright' in %s", file);
 
 	/* Get Website */
 	str = g_key_file_get_string (plugin_file,
@@ -272,7 +272,7 @@
 	if (str)
 		info->website = str;
 	else
-		g_message( "Could not find 'Website' in %s", file);
+		DEBUG_PRINT ( "Could not find 'Website' in %s", file);
 		
 	g_key_file_free (plugin_file);
 	
@@ -311,7 +311,7 @@
 gboolean
 gtranslator_plugin_info_is_configurable (GtranslatorPluginInfo *info)
 {
-	g_message( "Is '%s' configurable?", info->name);
+	DEBUG_PRINT ( "Is '%s' configurable?", info->name);
 
 	g_return_val_if_fail (info != NULL, FALSE);
 

Modified: trunk/src/plugin-system/plugin-manager.c
==============================================================================
--- trunk/src/plugin-system/plugin-manager.c	(original)
+++ trunk/src/plugin-system/plugin-manager.c	Mon Sep 22 09:43:13 2008
@@ -41,7 +41,7 @@
 #include "utils.h"
 #include "plugins-engine.h"
 #include "plugin.h"
-//#include "gtranslator-debug.h"
+#include "debug.h"
 
 enum
 {
@@ -141,7 +141,7 @@
 
 	g_return_if_fail (info != NULL);
 
-	g_message( "Configuring: %s\n", 
+	DEBUG_PRINT ( "Configuring: %s\n", 
 			     gtranslator_plugin_info_get_name (info));
 
 	toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET(pm)));
@@ -149,7 +149,7 @@
 	gtranslator_plugins_engine_configure_plugin (pm->priv->engine,
 					       info, toplevel);
 
-	g_message( "Done");	
+	DEBUG_PRINT ( "Done");	
 }
 
 static void
@@ -335,7 +335,7 @@
 	{
 		/* activate the plugin */
 		if (!gtranslator_plugins_engine_activate_plugin (pm->priv->engine, info)) {
-			g_message( "Could not activate %s.\n", 
+			DEBUG_PRINT ( "Could not activate %s.\n", 
 					     gtranslator_plugin_info_get_name (info));
 
 			res = FALSE;
@@ -345,7 +345,7 @@
 	{
 		/* deactivate the plugin */
 		if (!gtranslator_plugins_engine_deactivate_plugin (pm->priv->engine, info)) {
-			g_message( "Could not deactivate %s.\n", 
+			DEBUG_PRINT ( "Could not deactivate %s.\n", 
 					     gtranslator_plugin_info_get_name (info));
 
 			res = FALSE;

Modified: trunk/src/plugin-system/plugin.h
==============================================================================
--- trunk/src/plugin-system/plugin.h	(original)
+++ trunk/src/plugin-system/plugin.h	Mon Sep 22 09:43:13 2008
@@ -34,7 +34,7 @@
 #include <glib-object.h>
 
 #include "window.h"
-//#include <gtranslator/gtranslator-debug.h>
+#include "debug.h"
 
 /* TODO: add a .h file that includes all the .h files normally needed to
  * develop a plugin */ 
@@ -152,7 +152,7 @@
 		(GInstanceInitFunc) plugin_name##_init				\
 	};									\
 										\
-	g_message( "Registering " #PluginName);	\
+	DEBUG_PRINT ( "Registering " #PluginName);	\
 										\
 	/* Initialise the i18n stuff */						\
 	bindtextdomain (GETTEXT_PACKAGE, GTR_LOCALEDIR);			\
@@ -217,7 +217,7 @@
 		(GInstanceInitFunc) object_name##_init				\
 	};									\
 										\
-	g_message( "Registering " #ObjectName);	\
+	DEBUG_PRINT ( "Registering " #ObjectName);	\
 										\
 	g_define_type_id = g_type_module_register_type (module,			\
 					   	        PARENT_TYPE,		\

Modified: trunk/src/plugin-system/plugins-engine.c
==============================================================================
--- trunk/src/plugin-system/plugins-engine.c	(original)
+++ trunk/src/plugin-system/plugins-engine.c	Mon Sep 22 09:43:13 2008
@@ -40,7 +40,7 @@
 #include "plugins-engine.h"
 #include "plugin-info-priv.h"
 #include "plugin.h"
-//#include "gtranslator-debug.h"
+#include "debug.h"
 #include "application.h"
 
 #include "module.h"
@@ -96,7 +96,7 @@
 	g_return_if_fail (engine->priv->gconf_client != NULL);
 	g_return_if_fail (dir != NULL);
 
-	g_message( "DIR: %s", dir);
+	DEBUG_PRINT ( "DIR: %s", dir);
 
 	d = g_dir_open (dir, 0, &error);
 	if (!d)
@@ -141,7 +141,7 @@
 
 			engine->priv->plugin_list = g_list_prepend (engine->priv->plugin_list, info);
 
-			g_message( "Plugin %s loaded", info->name);
+			DEBUG_PRINT ( "Plugin %s loaded", info->name);
 		}
 	}
 
@@ -187,7 +187,7 @@
 	if (pdirs_env == NULL)
 		pdirs_env = GTR_PLUGINDIR;
 
-	g_message( "GTR_PLUGINS_PATH=%s", pdirs_env);
+	DEBUG_PRINT ( "GTR_PLUGINS_PATH=%s", pdirs_env);
 	pdirs = g_strsplit (pdirs_env, G_SEARCHPATH_SEPARATOR_S, 0);
 
 	for (i = 0; pdirs[i] != NULL; i++)
@@ -395,7 +395,7 @@
 
 	g_type_module_unuse (G_TYPE_MODULE (info->module));
 
-	g_message( "End");
+	DEBUG_PRINT ( "End");
 
 	return TRUE;
 }
@@ -534,7 +534,7 @@
 		}
 	}
 	
-	g_message( "End");
+	DEBUG_PRINT ( "End");
 }
 
 void
@@ -559,7 +559,7 @@
 		if (!info->available || !info->active)
 			continue;
 			
-	       	g_message( "Updating UI of %s", info->name);
+	       	DEBUG_PRINT ( "Updating UI of %s", info->name);
 		
 		gtranslator_plugin_update_ui (info->plugin, window);
 	}

Modified: trunk/src/plugin-system/update-from-gedit.sh
==============================================================================
--- trunk/src/plugin-system/update-from-gedit.sh	(original)
+++ trunk/src/plugin-system/update-from-gedit.sh	Mon Sep 22 09:43:13 2008
@@ -27,10 +27,10 @@
 	-e 's/gedit-panel.h/panel.h/g' \
 	-e 's/gedit-window.h/window.h/g' \
 	-e 's/gedit-utils.h/utils.h/g' \
-	-e 's/#include <gedit\/gedit-debug.h>/\/\/#include <gedit\/gedit-debug.h>/g' \
-	-e 's/#include "gedit-debug.h"/\/\/#include "gedit-debug.h"/g' \
+	-e 's/#include <gedit\/gedit-debug.h>/#include "debug.h"/g' \
+	-e 's/#include "gedit-debug.h"/#include "debug.h"/g' \
 	-e 's/#include "gedit-app.h"/#include "application.h"/g' \
-	-e 's/gedit_debug_message (DEBUG_PLUGINS,/g_message(/g' \
+	-e 's/gedit_debug_message (DEBUG_PLUGINS,/DEBUG_PRINT (/g' \
 	-e 's/gedit_debug/\/\/gedit_debug/g' \
 	-e 's/gedit_app/gtranslator_application/g' \
 	-e 's/.gnome2\/gedit\/plugins\//.gtranslator\/plugins\//g' \



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