[nautilus-actions/gnome-2-28] Initialize console utils log handlers
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus-actions/gnome-2-28] Initialize console utils log handlers
- Date: Wed, 28 Oct 2009 18:33:12 +0000 (UTC)
commit 314806ad7fcd4f4bce11577be4d1a24784b81e14
Author: Pierre Wieser <pwieser trychlos org>
Date: Wed Oct 28 19:03:51 2009 +0100
Initialize console utils log handlers
ChangeLog | 11 ++++++
src/utils/Makefile.am | 4 ++
src/utils/console-utils.c | 59 ++++++++++++++++++++++++++++++++++
src/utils/console-utils.h | 42 ++++++++++++++++++++++++
src/utils/nautilus-actions-new.c | 3 ++
src/utils/nautilus-actions-schemas.c | 3 ++
6 files changed, 122 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index db1c185..3c7c426 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-26 Pierre Wieser <pwieser trychlos org>
* src/nact/nact-xml-reader.c (add_message):
diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am
index fb3fec9..103917f 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 = \
@@ -49,6 +51,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..90eabd4
--- /dev/null
+++ b/src/utils/console-utils.c
@@ -0,0 +1,59 @@
+/*
+ * 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_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 7ea70b9..df40dda 100644
--- a/src/utils/nautilus-actions-new.c
+++ b/src/utils/nautilus-actions-new.c
@@ -43,6 +43,8 @@
#include <common/na-xml-names.h>
#include <common/na-xml-writer.h>
+#include "console-utils.h"
+
static gchar *label = "";
static gchar *tooltip = "";
static gchar *icon = "";
@@ -100,6 +102,7 @@ main( int argc, char** argv )
gchar *help;
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 2ecc79d..a43491d 100644
--- a/src/utils/nautilus-actions-schemas.c
+++ b/src/utils/nautilus-actions-schemas.c
@@ -42,6 +42,8 @@
#include <common/na-xml-names.h>
#include <common/na-xml-writer.h>
+#include "console-utils.h"
+
/*static gchar *output_fname = NULL;
static gboolean output_gconf = FALSE;*/
static gboolean output_stdout = FALSE;
@@ -69,6 +71,7 @@ main( int argc, char** argv )
gchar *msg = NULL;
g_type_init();
+ console_init_log_handler();
context = init_options();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]