[nautilus-actions: 26/45] Disable output of g_debug messages when not in maintainer mode



commit 1acdeba63803e397298710ba56adff3858ec9da1
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon Jul 27 23:17:11 2009 +0200

    Disable output of g_debug messages when not in maintainer mode

 ChangeLog                                          |   15 +++
 TODO                                               |    8 +--
 configure.ac                                       |   11 ++-
 m4/{nact-cmdline-tools.m4 => na-cmdline-tools.m4}  |   12 ++--
 ...nact-compiler-flags.m4 => na-compiler-flags.m4} |    6 +-
 m4/na-log-domains.m4                               |   16 ++++
 ...ct-maintainer-mode.m4 => na-maintainer-mode.m4} |    8 +-
 ...ct-nautilus-extdir.m4 => na-nautilus-extdir.m4} |   12 ++--
 src/common/Makefile.am                             |    2 +-
 src/nact/Makefile.am                               |    1 +
 src/nact/base-window.c                             |    2 +-
 src/nact/nact-assist-export.c                      |    9 +-
 src/nact/nact-assist-import.c                      |    7 +-
 src/nact/nact-assistant.c                          |    2 +-
 src/nact/nact-gconf-reader.c                       |   96 ++++++++++++--------
 src/nact/nact-main.c                               |   15 +++
 src/nact/nautilus-actions-config.ui                |    8 +-
 src/plugin/Makefile.am                             |    2 +-
 src/plugin/nautilus-actions.c                      |    4 +-
 src/plugin/nautilus-module.c                       |   17 ++---
 20 files changed, 159 insertions(+), 94 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f3d6ec5..646f10c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2009-07-27 Pierre Wieser <pwieser trychlos org>
 
+	* m4/na-log-domains.m4: New file.
+
+	* m4/nact-cmdline-tools.m4: Renamed to m4/na-cmdline-tools.m4.
+	* m4/nact-compiler-flags.m4: Renamed to m4/na-compiler-flags.m4.
+	* m4/nact-maintainer-mode.m4: Renamed to m4/na-maintainer-mode.m4.
+	* m4/nact-nautilus-extdir.m4: Renamed to m4/na-nautilus-extdir.m4.
+
+	* configure.ac:
+	Updated accordingly.
+
 	* src/common/na-object.c:
 	* src/common/na-object.h (na_object_check_edited_status):
 	New derivable function.
@@ -18,6 +28,11 @@
 
 	* src/nact/nact-gconf-reader.c:
 	Import the two new export formats.
+	Fix check of imported actions.
+
+	* src/nact/nact-main.c:
+	* src/plugin/nautilus-module.c:
+	Disable output of g_debug messages when not in maintainer mode.
 
 	* src/nact/nact-main-window.c:
 	Update count_modified_actions.
diff --git a/TODO b/TODO
index c7df89d..cc92b6c 100644
--- a/TODO
+++ b/TODO
@@ -12,10 +12,6 @@ like the scheme list, it seems.
 
 - try to import a schema for an action (without schema)
 
-- gtk_window_set_transient_for (see nact-conditions-editor.c) should be
-  called in base_window_do_initial_load, but requires a parent window
-  which should be passed as a virtual or in the constructor
+- import and export assistants are seen as a distinct application in the
+  task bar (there is a second NA icon)
 
-- when importing multi-profile actions, profiles are not marked as modified
-
-- reload actions : doesn't work ?? nothing appears in the ui
diff --git a/configure.ac b/configure.ac
index edb6e30..c239e76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -77,7 +77,7 @@ AC_PROG_MAKE_SET
 # Gnome stuff
 GNOME_COMMON_INIT
 GNOME_MAINTAINER_MODE_DEFINES
-NACT_GNOME_COMPILE_WARNINGS([error],[-ansi])
+NA_GNOME_COMPILE_WARNINGS([error],[-ansi])
 AC_SUBST([AM_CPPFLAGS],["${AM_CPPFLAGS} ${DISABLE_DEPRECATED}"])
 # unique 1.0.8 doesn't satisfy this
 #AC_SUBST([AM_CPPFLAGS],["${AM_CPPFLAGS} \
@@ -133,15 +133,18 @@ PKG_CHECK_MODULES([NAUTILUS_ACTIONS], \
 AC_SUBST([NAUTILUS_ACTIONS_CFLAGS])
 AC_SUBST([NAUTILUS_ACTIONS_LIBS])
 
+# defines log domains when in maintainer mode
+NA_LOG_DOMAINS
+
 # when working in a test environment, nautilus is typically installed in
 # a non-standard location ; lets specify this here
-NACT_NAUTILUS_EXTDIR
+NA_NAUTILUS_EXTDIR
 
 # building or not the commandline tools
-NACT_COMMANDLINE_TOOLS
+NA_COMMANDLINE_TOOLS
 
 # define NACT_MAINTAINER_MODE variable
-NACT_IS_MAINTAINER_MODE
+NA_IS_MAINTAINER_MODE
 
 # Check for menu update function
 AC_CHECK_LIB(nautilus-extension, nautilus_menu_item_new)
diff --git a/m4/nact-cmdline-tools.m4 b/m4/na-cmdline-tools.m4
similarity index 91%
rename from m4/nact-cmdline-tools.m4
rename to m4/na-cmdline-tools.m4
index f622406..a7b5e01 100644
--- a/m4/nact-cmdline-tools.m4
+++ b/m4/na-cmdline-tools.m4
@@ -26,15 +26,15 @@
 #   Pierre Wieser <pwieser trychlos org>
 #   ... and many others (see AUTHORS)
 
-# serial 1 creation
+# serial 2 change NACT_ prefix to NA_ (Nautilus Actions)
 
 # commandline tools are built on user option
 # they need gtk+ 2.4, and take interest of glib 2.8
 # default is to build them if we have gtk+ v 2.4
 
-AC_DEFUN([NACT_COMMANDLINE_TOOLS],[
-	AC_REQUIRE([_AC_ARG_NACT_COMMANDLINE_TOOLS])dnl
-	AC_REQUIRE([_AC_CHECK_NACT_COMMANDLINE_TOOLS])dnl
+AC_DEFUN([NA_COMMANDLINE_TOOLS],[
+	AC_REQUIRE([_AC_ARG_NA_COMMANDLINE_TOOLS])dnl
+	AC_REQUIRE([_AC_CHECK_NA_COMMANDLINE_TOOLS])dnl
 
 	if test "${_ac_commandline_tools}" = "yes"; then
 
@@ -58,7 +58,7 @@ AC_DEFUN([NACT_COMMANDLINE_TOOLS],[
 	fi
 ])
 
-AC_DEFUN([_AC_ARG_NACT_COMMANDLINE_TOOLS],[
+AC_DEFUN([_AC_ARG_NA_COMMANDLINE_TOOLS],[
 	AC_ARG_ENABLE(
 		[commandline-tool],
 		AC_HELP_STRING(
@@ -70,7 +70,7 @@ AC_DEFUN([_AC_ARG_NACT_COMMANDLINE_TOOLS],[
 	)
 ])
 
-AC_DEFUN([_AC_CHECK_NACT_COMMANDLINE_TOOLS],[
+AC_DEFUN([_AC_CHECK_NA_COMMANDLINE_TOOLS],[
 	_ac_commandline_tools="yes"
 	_ac_have_glib_2_8=0
 	${PKG_CONFIG} gtk+-2.0 --max-version=2.4
diff --git a/m4/nact-compiler-flags.m4 b/m4/na-compiler-flags.m4
similarity index 97%
rename from m4/nact-compiler-flags.m4
rename to m4/na-compiler-flags.m4
index 0389a0c..8ca6ed7 100644
--- a/m4/nact-compiler-flags.m4
+++ b/m4/na-compiler-flags.m4
@@ -1,11 +1,15 @@
 dnl GNOME_COMPILE_WARNINGS
 dnl Turn on many useful compiler warnings
 dnl For now, only works on GCC
+
+# serial 2 change NACT_ prefix to NA_ (Nautilus Actions)
+
 #
 # pwi 2009-05-15 shamelessly copied from gnome-compiler-flags.m4
 # two patch have been submitted (see gnome-common #582860)
 #
-AC_DEFUN([NACT_GNOME_COMPILE_WARNINGS],[
+
+AC_DEFUN([NA_GNOME_COMPILE_WARNINGS],[
 
 	_ac_warning_def=m4_default([$1],[yes])
 	_ac_compliant_def=m4_default([$2],[no])
diff --git a/m4/na-log-domains.m4 b/m4/na-log-domains.m4
new file mode 100644
index 0000000..0c5d067
--- /dev/null
+++ b/m4/na-log-domains.m4
@@ -0,0 +1,16 @@
+dnl define three distinct log domains, respectively for common code,
+dnl plugin and NACT user interface - log handlers will be disabled 
+dnl when not in development mode
+
+# serial 1 creation
+
+AC_DEFUN([NA_LOG_DOMAINS],[
+	AC_SUBST([NA_LOGDOMAIN_COMMON],[NA-common])
+	AC_DEFINE_UNQUOTED([NA_LOGDOMAIN_COMMON],["NA-common"],[Log domain of common code])
+
+	AC_SUBST([NA_LOGDOMAIN_PLUGIN],[NA-plugin])
+	AC_DEFINE_UNQUOTED([NA_LOGDOMAIN_PLUGIN],["NA-plugin"],[Log domain of Nautilus plugin])
+
+	AC_SUBST([NA_LOGDOMAIN_NACT],[NA-nact])
+	AC_DEFINE_UNQUOTED([NA_LOGDOMAIN_NACT],["NA-nact"],[Log domain of NACT user interface])
+])
diff --git a/m4/nact-maintainer-mode.m4 b/m4/na-maintainer-mode.m4
similarity index 85%
rename from m4/nact-maintainer-mode.m4
rename to m4/na-maintainer-mode.m4
index eb9d889..0175448 100644
--- a/m4/nact-maintainer-mode.m4
+++ b/m4/na-maintainer-mode.m4
@@ -26,12 +26,12 @@
 #   Pierre Wieser <pwieser trychlos org>
 #   ... and many others (see AUTHORS)
 
-# serial 1 creation
+# serial 2 change NACT_ prefix to NA_ (Nautilus Actions)
 
-dnl define NACT_MAINTAINER_MODE
+dnl define NA_MAINTAINER_MODE
 
-AC_DEFUN([NACT_IS_MAINTAINER_MODE],[
+AC_DEFUN([NA_IS_MAINTAINER_MODE],[
 	if test "${USE_MAINTAINER_MODE}" = "yes"; then
-		AC_DEFINE([NACT_MAINTAINER_MODE],[1],[Define to 1 if we are in maintainer mode])
+		AC_DEFINE([NA_MAINTAINER_MODE],[1],[Define to 1 if we are in maintainer mode])
 	fi
 ])
diff --git a/m4/nact-nautilus-extdir.m4 b/m4/na-nautilus-extdir.m4
similarity index 88%
rename from m4/nact-nautilus-extdir.m4
rename to m4/na-nautilus-extdir.m4
index 6d086ce..b32a85f 100644
--- a/m4/nact-nautilus-extdir.m4
+++ b/m4/na-nautilus-extdir.m4
@@ -26,14 +26,14 @@
 #   Pierre Wieser <pwieser trychlos org>
 #   ... and many others (see AUTHORS)
 
-# serial 1 creation
+# serial 2 change NACT_ prefix to NA_ (Nautilus Actions)
 
 # let the user specify an alternate nautilus-extension dir
 # --with-nautilus-extdir=<dir>
 
-AC_DEFUN([NACT_NAUTILUS_EXTDIR],[
-	AC_REQUIRE([_AC_ARG_NACT_NAUTILUS_EXTDIR])dnl
-	AC_REQUIRE([_AC_NACT_CHECK_NAUTILUS_EXTDIR])dnl
+AC_DEFUN([NA_NAUTILUS_EXTDIR],[
+	AC_REQUIRE([_AC_ARG_NA_NAUTILUS_EXTDIR])dnl
+	AC_REQUIRE([_AC_NA_CHECK_NAUTILUS_EXTDIR])dnl
 	if test "${ac_with_nact_nautilus_extdir}" = ""; then
 		AC_MSG_ERROR([Unable to determine nautilus extension folder, please use --with-nautilus-extdir option])
 	else
@@ -42,7 +42,7 @@ AC_DEFUN([NACT_NAUTILUS_EXTDIR],[
 	fi
 ])
 
-AC_DEFUN([_AC_ARG_NACT_NAUTILUS_EXTDIR],[
+AC_DEFUN([_AC_ARG_NA_NAUTILUS_EXTDIR],[
 	AC_ARG_WITH(
 		[nautilus-extdir],
 		AC_HELP_STRING(
@@ -54,7 +54,7 @@ AC_DEFUN([_AC_ARG_NACT_NAUTILUS_EXTDIR],[
 	)
 ])
 
-AC_DEFUN([_AC_NACT_CHECK_NAUTILUS_EXTDIR],[
+AC_DEFUN([_AC_NA_CHECK_NAUTILUS_EXTDIR],[
 	if test "${ac_with_nact_nautilus_extdir}" = ""; then
 		if test "{PKG_CONFIG}" != ""; then
 			ac_with_nact_nautilus_extdir=`${PKG_CONFIG} --variable=extensiondir libnautilus-extension`
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index 868da5d..cac8002 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -30,7 +30,7 @@ noinst_LTLIBRARIES = libnact.la
 
 AM_CPPFLAGS += \
 	-DGNOMELOCALEDIR=\""$(datadir)/locale"\"	\
-	-DG_LOG_DOMAIN=\"nact\"						\
+	-DG_LOG_DOMAIN=\"${NA_LOGDOMAIN_COMMON}\"	\
 	$(NAUTILUS_ACTIONS_CFLAGS)					\
 	$(NULL)
 
diff --git a/src/nact/Makefile.am b/src/nact/Makefile.am
index c342312..ce6d29a 100644
--- a/src/nact/Makefile.am
+++ b/src/nact/Makefile.am
@@ -36,6 +36,7 @@ AM_CPPFLAGS += \
 	-I $(top_srcdir)/src								\
 	-DGNOMELOCALEDIR=\""$(datadir)/locale"\"			\
 	-DGLADEDIR=\"$(gladedir)\"							\
+	-DG_LOG_DOMAIN=\"${NA_LOGDOMAIN_NACT}\"				\
 	$(NAUTILUS_ACTIONS_CFLAGS)							\
 	$(NULL)
 
diff --git a/src/nact/base-window.c b/src/nact/base-window.c
index 36d3fc1..1d0b457 100644
--- a/src/nact/base-window.c
+++ b/src/nact/base-window.c
@@ -561,7 +561,7 @@ static void
 do_runtime_init_toplevel( BaseWindow *window )
 {
 	static const gchar *thisfn = "base_window_do_runtime_init_toplevel";
-	g_debug( "%s: window=%p", thisfn, window );
+	g_debug( "%s: window=%p, parent_window=%p", thisfn, window, window->private->parent );
 
 	if( window->private->parent ){
 		g_assert( BASE_IS_WINDOW( window->private->parent ));
diff --git a/src/nact/nact-assist-export.c b/src/nact/nact-assist-export.c
index bb5b084..bfd4ed3 100644
--- a/src/nact/nact-assist-export.c
+++ b/src/nact/nact-assist-export.c
@@ -135,7 +135,7 @@ static void              assist_prepare_exportdone( NactAssistExport *window, Gt
 
 static void              do_export( NactAssistExport *window );
 
-#ifdef NACT_MAINTAINER_MODE
+#ifdef NA_MAINTAINER_MODE
 static void              dump( NactAssistExport *window );
 #endif
 
@@ -294,6 +294,7 @@ nact_assist_export_run( NactWindow *main_window )
 	BaseApplication *appli = BASE_APPLICATION( base_window_get_application( BASE_WINDOW( main_window )));
 
 	NactAssistExport *assist = assist_new( appli );
+	g_object_set( G_OBJECT( assist ), PROP_WINDOW_PARENT_STR, main_window, NULL );
 
 	assist->private->main_window = NACT_MAIN_WINDOW( main_window );
 
@@ -643,7 +644,7 @@ assist_prepare_confirm( NactAssistExport *window, GtkAssistant *assistant, GtkWi
 	static const gchar *thisfn = "nact_assist_export_prepare_confirm";
 	g_debug( "%s: window=%p, assistant=%p, page=%p", thisfn, window, assistant, page );
 
-#ifdef NACT_MAINTAINER_MODE
+#ifdef NA_MAINTAINER_MODE
 	dump( window );
 #endif
 
@@ -717,7 +718,7 @@ assist_prepare_exportdone( NactAssistExport *window, GtkAssistant *assistant, Gt
 
 	do_export( window );
 
-#ifdef NACT_MAINTAINER_MODE
+#ifdef NA_MAINTAINER_MODE
 	dump( window );
 #endif
 
@@ -806,7 +807,7 @@ do_export( NactAssistExport *window )
 	g_slist_free( actions );
 }
 
-#ifdef NACT_MAINTAINER_MODE
+#ifdef NA_MAINTAINER_MODE
 static void
 dump( NactAssistExport *window )
 {
diff --git a/src/nact/nact-assist-import.c b/src/nact/nact-assist-import.c
index a379c0d..9e7e86a 100644
--- a/src/nact/nact-assist-import.c
+++ b/src/nact/nact-assist-import.c
@@ -229,11 +229,14 @@ assist_new( BaseApplication *application )
  * @main: the main window of the application.
  */
 GSList *
-nact_assist_import_run( NactWindow *main )
+nact_assist_import_run( NactWindow *main_window )
 {
-	BaseApplication *appli = BASE_APPLICATION( base_window_get_application( BASE_WINDOW( main )));
+	BaseApplication *appli = BASE_APPLICATION( base_window_get_application( BASE_WINDOW( main_window )));
+
 	NactAssistImport *assist = assist_new( appli );
 
+	g_object_set( G_OBJECT( assist ), PROP_WINDOW_PARENT_STR, main_window, NULL );
+
 	base_window_run( BASE_WINDOW( assist ));
 
 	return( assist->private->actions );
diff --git a/src/nact/nact-assistant.c b/src/nact/nact-assistant.c
index ce85353..5375d53 100644
--- a/src/nact/nact-assistant.c
+++ b/src/nact/nact-assistant.c
@@ -240,7 +240,7 @@ instance_finalize( GObject *window )
 }
 
 /*
- * cf. http://bugzilla.gnome.org/show_bug.cgi?id=589746
+ * cf. http://bugzilla.gnome.org/show_bug.cgi?id=589746 against Gtk+ 2.16
  * a GtkFileChooseWidget embedded in a GtkAssistant is not displayed
  * when run more than once
  *
diff --git a/src/nact/nact-gconf-reader.c b/src/nact/nact-gconf-reader.c
index 10fcc11..1804044 100644
--- a/src/nact/nact-gconf-reader.c
+++ b/src/nact/nact-gconf-reader.c
@@ -113,8 +113,10 @@ static GConfReaderStruct reader_str[] = {
 #define ERR_INVALID_UUID			_( "Invalid UUID: waited for %s, found %s at line %d." )
 #define ERR_INVALID_KEY_PREFIX		_( "Invalid content: waited for %s prefix, found %s at line %d." )
 #define ERR_NOT_AN_UUID				_( "Invalid UUID %s found at line %d." )
-#define ERR_UUID_ALREADY_EXISTS		_( "Already existing UUID %s at line %d." )
+#define ERR_UUID_ALREADY_EXISTS		_( "Already existing action (UUID: %s) at line %d." )
 #define ERR_VALUE_ALREADY_SET		_( "Value '%s' already set: new value ignored at line %d." )
+#define ERR_UUID_NOT_FOUND			_( "UUID not found." )
+#define ERR_ACTION_LABEL_NOT_FOUND	_( "Action label not found." )
 
 static GObjectClass *st_parent_class = NULL;
 
@@ -384,12 +386,18 @@ gconf_reader_parse_schemalist( NactGConfReader *reader, xmlNode *schema )
 		}
 	}
 
-	gboolean ok = FALSE;
+	gboolean ok = TRUE;
 
-	if( reader->private->uuid_set ){
+	if( !reader->private->uuid_set ){
+		add_message( reader, ERR_UUID_NOT_FOUND );
+		ok = FALSE;
+	}
+
+	if( ok ){
 		gchar *label = na_action_get_label( reader->private->action );
-		ok = ( label && g_utf8_strlen( label, -1 ));
-		g_debug( "%s: action=%p, label=%s, ok=%s", thisfn, reader->private->action, label, ok ? "True":"False" );
+		if( !label || !g_utf8_strlen( label, -1 )){
+			add_message( reader, ERR_ACTION_LABEL_NOT_FOUND );
+		}
 		g_free( label );
 	}
 
@@ -783,32 +791,8 @@ gconf_reader_parse_dump_root( NactGConfReader *reader, xmlNode *root )
 		}
 
 		found = TRUE;
-
-		reader->private->action = na_action_new();
-		xmlChar *path = xmlGetProp( iter, ( const xmlChar * ) NACT_GCONF_DUMP_ENTRYLIST_BASE );
-		gchar *uuid = na_utils_path_to_key(( const gchar * ) path );
-		na_action_set_uuid( reader->private->action, uuid );
-		reader->private->uuid_set = TRUE;
-		g_debug( "%s: uuid=%s", thisfn, uuid );
-		g_free( uuid );
-		xmlFree( path );
-
 		gconf_reader_parse_entrylist( reader, iter );
 	}
-
-	gboolean ok = FALSE;
-
-	if( reader->private->uuid_set ){
-		gchar *label = na_action_get_label( reader->private->action );
-		ok = ( label && g_utf8_strlen( label, -1 ));
-		g_debug( "%s: action=%p, label=%s, ok=%s", thisfn, reader->private->action, label, ok ? "True":"False" );
-		g_free( label );
-	}
-
-	if( !ok ){
-		g_object_unref( reader->private->action );
-		reader->private->action = NULL;
-	}
 }
 
 /*
@@ -822,23 +806,55 @@ gconf_reader_parse_entrylist( NactGConfReader *reader, xmlNode *entrylist )
 	static const gchar *thisfn = "gconf_reader_parse_entrylist";
 	g_debug( "%s: reader=%p, entrylist=%p", thisfn, reader, entrylist );
 
-	xmlNode *iter;
-	for( iter = entrylist->children ; iter ; iter = iter->next ){
+	reader->private->action = na_action_new();
+	xmlChar *path = xmlGetProp( entrylist, ( const xmlChar * ) NACT_GCONF_DUMP_ENTRYLIST_BASE );
+	gchar *uuid = na_utils_path_to_key(( const gchar * ) path );
+	g_debug( "%s: uuid=%s", thisfn, uuid );
 
-		if( iter->type != XML_ELEMENT_NODE ){
-			continue;
+	if( is_uuid_valid( uuid )){
+		if( action_exists( reader, uuid )){
+			add_message( reader, ERR_UUID_ALREADY_EXISTS, uuid, entrylist->line );
+
+		} else {
+			na_action_set_uuid( reader->private->action, uuid );
+			reader->private->uuid_set = TRUE;
 		}
+	} else {
+		add_message( reader, ERR_NOT_AN_UUID, uuid, entrylist->line );
+	}
 
-		if( strxcmp( iter->name, NACT_GCONF_DUMP_ENTRY )){
-			add_message( reader,
-					ERR_WAITED_IGNORED_NODE,
-					NACT_GCONF_DUMP_ENTRY, ( const char * ) iter->name, iter->line );
-			continue;
+	g_free( uuid );
+	xmlFree( path );
+
+	if( reader->private->uuid_set ){
+		xmlNode *iter;
+		for( iter = entrylist->children ; iter ; iter = iter->next ){
+
+			if( iter->type != XML_ELEMENT_NODE ){
+				continue;
+			}
+
+			if( strxcmp( iter->name, NACT_GCONF_DUMP_ENTRY )){
+				add_message( reader,
+						ERR_WAITED_IGNORED_NODE,
+						NACT_GCONF_DUMP_ENTRY, ( const char * ) iter->name, iter->line );
+				continue;
+			}
+
+			if( !gconf_reader_parse_entry( reader, iter )){
+				add_message( reader, ERR_IGNORED_SCHEMA, iter->line );
+			}
 		}
 
-		if( !gconf_reader_parse_entry( reader, iter )){
-			add_message( reader, ERR_IGNORED_SCHEMA, iter->line );
+		gchar *label = na_action_get_label( reader->private->action );
+		if( !label || !g_utf8_strlen( label, -1 )){
+			add_message( reader, ERR_ACTION_LABEL_NOT_FOUND );
 		}
+		g_free( label );
+
+	} else {
+		g_object_unref( reader->private->action );
+		reader->private->action = NULL;
 	}
 }
 static gboolean
diff --git a/src/nact/nact-main.c b/src/nact/nact-main.c
index 27c4710..aa0dae4 100644
--- a/src/nact/nact-main.c
+++ b/src/nact/nact-main.c
@@ -34,9 +34,14 @@
 
 #include "nact-application.h"
 
+static void na_log_handler( const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data );
+
 int
 main( int argc, char *argv[] )
 {
+	g_log_set_handler( NA_LOGDOMAIN_NACT, G_LOG_LEVEL_DEBUG, na_log_handler, NULL );
+	g_log_set_handler( NA_LOGDOMAIN_COMMON, G_LOG_LEVEL_DEBUG, na_log_handler, NULL );
+
 	NactApplication *app = nact_application_new_with_args( argc, argv );
 
 	int ret = base_application_run( BASE_APPLICATION( app ));
@@ -45,3 +50,13 @@ main( int argc, char *argv[] )
 
 	return( ret );
 }
+
+static void
+na_log_handler( const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data )
+{
+#ifdef NA_MAINTAINER_MODE
+	g_log_default_handler( log_domain, log_level, message, user_data );
+#else
+	/* do nothing */
+#endif
+}
diff --git a/src/nact/nautilus-actions-config.ui b/src/nact/nautilus-actions-config.ui
index ce9a83f..8325888 100644
--- a/src/nact/nautilus-actions-config.ui
+++ b/src/nact/nautilus-actions-config.ui
@@ -1400,16 +1400,16 @@ file(s)/folder(s)</property>
   </object>
   <object class="GtkSizeGroup" id="CommandLabelSizeGroup">
     <widgets>
-      <widget name="ProfileLabelLabel"/>
-      <widget name="CommandPathLabel"/>
-      <widget name="CommandParametersLabel"/>
       <widget name="CommandExamplePreLabel"/>
+      <widget name="CommandParametersLabel"/>
+      <widget name="CommandPathLabel"/>
+      <widget name="ProfileLabelLabel"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup" id="CommandButtonSizeGroup">
     <widgets>
-      <widget name="CommandPathButton"/>
       <widget name="CommandLegendButton"/>
+      <widget name="CommandPathButton"/>
     </widgets>
   </object>
 </interface>
diff --git a/src/plugin/Makefile.am b/src/plugin/Makefile.am
index c31da7d..4d75b44 100644
--- a/src/plugin/Makefile.am
+++ b/src/plugin/Makefile.am
@@ -28,8 +28,8 @@
 
 AM_CPPFLAGS += \
 	-I $(top_srcdir)/src								\
-	-DG_LOG_DOMAIN=\"nact\"								\
 	$(NAUTILUS_ACTIONS_CFLAGS)							\
+	-DG_LOG_DOMAIN=\"${NA_LOGDOMAIN_PLUGIN}\"			\
 	$(NULL)
 
 nautilus_extensiondir = $(NAUTILUS_EXTENSIONS_DIR)
diff --git a/src/plugin/nautilus-actions.c b/src/plugin/nautilus-actions.c
index b9a5d71..6555123 100644
--- a/src/plugin/nautilus-actions.c
+++ b/src/plugin/nautilus-actions.c
@@ -233,7 +233,7 @@ static void nautilus_menu_provider_emit_items_updated_signal (NautilusMenuProvid
 static GList *
 get_background_items( NautilusMenuProvider *provider, GtkWidget *window, NautilusFileInfo *current_folder )
 {
-#ifdef NACT_MAINTAINER_MODE
+#ifdef NA_MAINTAINER_MODE
 	static const gchar *thisfn = "nautilus_actions_get_background_items";
 	gchar *uri = nautilus_file_info_get_uri( current_folder );
 	g_debug( "%s: provider=%p, window=%p, current_folder=%p (%s)", thisfn, provider, window, current_folder, uri );
@@ -288,7 +288,7 @@ get_file_items( NautilusMenuProvider *provider, GtkWidget *window, GList *files
 
 				NAActionProfile *profile = NA_ACTION_PROFILE( ip->data );
 
-#ifdef NACT_MAINTAINER_MODE
+#ifdef NA_MAINTAINER_MODE
 				label = na_action_profile_get_label( profile );
 				g_debug( "%s: examining '%s' profile", thisfn, label );
 				g_free( label );
diff --git a/src/plugin/nautilus-module.c b/src/plugin/nautilus-module.c
index 5667194..eb34bfc 100644
--- a/src/plugin/nautilus-module.c
+++ b/src/plugin/nautilus-module.c
@@ -40,9 +40,7 @@
 
 static guint st_log_handler = 0;
 
-#ifdef NACT_MAINTAINER_MODE
 static void na_log_handler( const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data );
-#endif
 
 /*
  * A nautilus extension must implement three functions :
@@ -61,16 +59,11 @@ nautilus_module_initialize( GTypeModule *module )
 {
 	syslog( LOG_USER | LOG_INFO, "%s initializing...", PACKAGE_STRING );
 
-#ifdef NACT_MAINTAINER_MODE
-	/*
-	 *  install a debug log handler
-	 * (if development mode and not already done)
-	 */
 	if( !st_log_handler ){
 		openlog( G_LOG_DOMAIN, LOG_PID, LOG_USER );
-		st_log_handler = g_log_set_handler( G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, na_log_handler, NULL );
+		st_log_handler = g_log_set_handler( NA_LOGDOMAIN_PLUGIN, G_LOG_LEVEL_DEBUG, na_log_handler, NULL );
+		g_log_set_handler( NA_LOGDOMAIN_COMMON, G_LOG_LEVEL_DEBUG, na_log_handler, NULL );
 	}
-#endif
 
 	static const gchar *thisfn = "nautilus_module_initialize";
 	g_debug( "%s: module=%p", thisfn, module );
@@ -115,13 +108,15 @@ nautilus_module_shutdown( void )
  * setup a given key and obtain a full log to send to Bugzilla..
  * For now, is always install when compiled in maintainer mode, never else
  */
-#ifdef NACT_MAINTAINER_MODE
 static void
 na_log_handler( const gchar *log_domain,
 					GLogLevelFlags log_level,
 					const gchar *message,
 					gpointer user_data )
 {
+#ifdef NA_MAINTAINER_MODE
 	syslog( LOG_USER | LOG_DEBUG, "%s", message );
-}
+#else
+	/* do nothing */
 #endif
+}



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