[nautilus-actions] Initialize console utils log handlers
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Initialize console utils log handlers
- Date: Wed, 28 Oct 2009 23:59:22 +0000 (UTC)
commit 8fae4b4caea1274086f9b6091cc85360292b9ed3
Author: Pierre Wieser <pwieser trychlos org>
Date: Wed Oct 28 19:58:03 2009 +0100
Initialize console utils log handlers
ChangeLog | 11 ++++++
src/utils/Makefile.am | 4 ++
src/utils/console-utils.c | 60 ++++++++++++++++++++++++++++++++++
src/utils/console-utils.h | 42 +++++++++++++++++++++++
src/utils/nautilus-actions-new.c | 3 ++
src/utils/nautilus-actions-schemas.c | 3 ++
6 files changed, 123 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 18d3546..4690951 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-10-28 Pierre Wieser <pwieser trychlos org>
+
+ * src/utils/console-utils.c:
+ * src/utils/console-utils.h: New files.
+
+ * src/utils/Makefile.am: Updated accordingly.
+
+ * src/utils/nautilus-actions-new.c:
+ * src/utils/nautilus-actions-schemas.c: Initialize log handler
+ to not emit debug messages when not in maintainer mode.
+
2009-10-27 Pierre Wieser <pwieser trychlos org>
* src/nact/nact-main-window.c (class_init):
diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am
index 0a37e4f..572ba60 100644
--- a/src/utils/Makefile.am
+++ b/src/utils/Makefile.am
@@ -40,6 +40,8 @@ AM_CPPFLAGS += \
nautilus_actions_new_SOURCES = \
nautilus-actions-new.c \
+ console-utils.c \
+ console-utils.h \
$(NULL)
nautilus_actions_new_LDADD = \
@@ -50,6 +52,8 @@ nautilus_actions_new_LDADD = \
nautilus_actions_schemas_SOURCES = \
nautilus-actions-schemas.c \
+ console-utils.c \
+ console-utils.h \
$(NULL)
nautilus_actions_schemas_LDADD = \
diff --git a/src/utils/console-utils.c b/src/utils/console-utils.c
new file mode 100644
index 0000000..31e1fe2
--- /dev/null
+++ b/src/utils/console-utils.c
@@ -0,0 +1,60 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
+ *
+ * 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 Library; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Frederic Ruaudel <grumz grumz net>
+ * Rodrigo Moya <rodrigo gnome-db org>
+ * Pierre Wieser <pwieser trychlos org>
+ * ... and many others (see AUTHORS)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+
+#include "console-utils.h"
+
+static void log_handler( const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data );
+
+/**
+ * console_init_log_handler:
+ */
+void
+console_init_log_handler( void )
+{
+ g_log_set_handler( NA_LOGDOMAIN_COMMON, G_LOG_LEVEL_DEBUG, log_handler, NULL );
+ g_log_set_handler( NA_LOGDOMAIN_RUNTIME, G_LOG_LEVEL_DEBUG, log_handler, NULL );
+ g_log_set_handler( NA_LOGDOMAIN_UTILS, G_LOG_LEVEL_DEBUG, log_handler, NULL );
+}
+
+static void
+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/utils/console-utils.h b/src/utils/console-utils.h
new file mode 100644
index 0000000..a8e11a3
--- /dev/null
+++ b/src/utils/console-utils.h
@@ -0,0 +1,42 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
+ *
+ * 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 Library; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Frederic Ruaudel <grumz grumz net>
+ * Rodrigo Moya <rodrigo gnome-db org>
+ * Pierre Wieser <pwieser trychlos org>
+ * ... and many others (see AUTHORS)
+ */
+
+#ifndef __CONSOLE_UTILS_H__
+#define __CONSOLE_UTILS_H__
+
+/**
+ * SECTION: console_utils
+ * @short_description: Console utility function declarations.
+ * @include: utils/console-utils.h
+ */
+
+void console_init_log_handler( void );
+
+#endif /* __CONSOLE_UTILS_H__ */
diff --git a/src/utils/nautilus-actions-new.c b/src/utils/nautilus-actions-new.c
index 78b2e8a..030fb9d 100644
--- a/src/utils/nautilus-actions-new.c
+++ b/src/utils/nautilus-actions-new.c
@@ -45,6 +45,8 @@
#include <common/na-xml-writer.h>
#include <common/na-utils.h>
+#include "console-utils.h"
+
static gchar *label = "";
static gchar *tooltip = "";
static gchar *icon = "";
@@ -145,6 +147,7 @@ main( int argc, char** argv )
gint errors;
g_type_init();
+ console_init_log_handler();
context = init_options();
diff --git a/src/utils/nautilus-actions-schemas.c b/src/utils/nautilus-actions-schemas.c
index 2b5b6db..07562ea 100644
--- a/src/utils/nautilus-actions-schemas.c
+++ b/src/utils/nautilus-actions-schemas.c
@@ -43,6 +43,8 @@
#include <common/na-xml-writer.h>
#include <common/na-utils.h>
+#include "console-utils.h"
+
/*static gchar *output_fname = NULL;
static gboolean output_gconf = FALSE;*/
static gboolean output_stdout = FALSE;
@@ -79,6 +81,7 @@ main( int argc, char** argv )
GSList *im;
g_type_init();
+ console_init_log_handler();
context = init_options();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]