From 98795060c0edbf9e0bf066e3b65ca0fb4fea1c89 Mon Sep 17 00:00:00 2001 From: Nick Schermer Date: Tue, 4 Jan 2011 20:03:12 +0100 Subject: [PATCH] Don't export the debug variable use function. --- common/panel-debug.c | 10 +++++++++- common/panel-debug.h | 14 +++++++------- panel/panel-plugin-external.c | 8 ++++---- panel/panel-window.c | 6 +++--- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/common/panel-debug.c b/common/panel-debug.c index d85752b5..efc7cd39 100644 --- a/common/panel-debug.c +++ b/common/panel-debug.c @@ -30,7 +30,7 @@ -PanelDebugFlag panel_debug_flags = 0; +static PanelDebugFlag panel_debug_flags = 0; @@ -151,6 +151,14 @@ panel_debug_print (PanelDebugFlag domain, +gboolean +panel_debug_has_domain (PanelDebugFlag domain) +{ + return PANEL_HAS_FLAG (panel_debug_flags, domain); +} + + + void panel_debug (PanelDebugFlag domain, const gchar *message, diff --git a/common/panel-debug.h b/common/panel-debug.h index fb92209c..15ef4920 100644 --- a/common/panel-debug.h +++ b/common/panel-debug.h @@ -39,14 +39,14 @@ typedef enum } PanelDebugFlag; -extern PanelDebugFlag panel_debug_flags; +gboolean panel_debug_has_domain (PanelDebugFlag domain); -void panel_debug (PanelDebugFlag domain, - const gchar *message, - ...) G_GNUC_PRINTF (2, 3); +void panel_debug (PanelDebugFlag domain, + const gchar *message, + ...) G_GNUC_PRINTF (2, 3); -void panel_debug_filtered (PanelDebugFlag domain, - const gchar *message, - ...) G_GNUC_PRINTF (2, 3); +void panel_debug_filtered (PanelDebugFlag domain, + const gchar *message, + ...) G_GNUC_PRINTF (2, 3); #endif /* !__PANEL_DEBUG_H__ */ diff --git a/panel/panel-plugin-external.c b/panel/panel-plugin-external.c index 6ed2669a..e43b57cb 100644 --- a/panel/panel-plugin-external.c +++ b/panel/panel-plugin-external.c @@ -503,8 +503,8 @@ panel_plugin_external_child_spawn (PanelPluginExternal *external) panel_return_if_fail (argv != NULL); /* check debugging state */ - if (PANEL_HAS_FLAG (panel_debug_flags, PANEL_DEBUG_GDB) - || PANEL_HAS_FLAG (panel_debug_flags, PANEL_DEBUG_VALGRIND)) + if (panel_debug_has_domain (PANEL_DEBUG_GDB) + || panel_debug_has_domain (PANEL_DEBUG_VALGRIND)) { g_get_current_time (×tamp); cmd_line = NULL; @@ -512,7 +512,7 @@ panel_plugin_external_child_spawn (PanelPluginExternal *external) /* note that if the program was not found in PATH, we already * warned for it in panel_debug_init, so no need to do that again */ - if (PANEL_HAS_FLAG (panel_debug_flags, PANEL_DEBUG_GDB)) + if (panel_debug_has_domain (PANEL_DEBUG_GDB)) { program = g_find_program_in_path ("gdb"); if (G_LIKELY (program != NULL)) @@ -531,7 +531,7 @@ panel_plugin_external_child_spawn (PanelPluginExternal *external) argv[PLUGIN_ARGV_UNIQUE_ID]); } } - else if (PANEL_HAS_FLAG (panel_debug_flags, PANEL_DEBUG_VALGRIND)) + else if (panel_debug_has_domain (PANEL_DEBUG_VALGRIND)) { program = g_find_program_in_path ("valgrind"); if (G_LIKELY (program != NULL)) diff --git a/panel/panel-window.c b/panel/panel-window.c index 853bd8ce..12c53d89 100644 --- a/panel/panel-window.c +++ b/panel/panel-window.c @@ -1507,7 +1507,7 @@ panel_window_screen_struts_set (PanelWindow *window) if (gdk_error_trap_pop () != 0) g_critical ("Failed to set the struts"); - if (G_UNLIKELY (panel_debug_flags != 0)) + if (panel_debug_has_domain (PANEL_DEBUG_YES)) { n = -1; @@ -1693,7 +1693,7 @@ panel_window_display_layout_debug (GtkWidget *widget) gchar *name; panel_return_if_fail (GTK_IS_WIDGET (widget)); - panel_return_if_fail (panel_debug_flags != 0); + panel_return_if_fail (panel_debug_has_domain (PANEL_DEBUG_YES)); str = g_string_new (NULL); @@ -1760,7 +1760,7 @@ panel_window_screen_layout_changed (GdkScreen *screen, return; /* print the display layout when debugging is enabled */ - if (G_UNLIKELY (panel_debug_flags != 0)) + if (G_UNLIKELY (panel_debug_has_domain (PANEL_DEBUG_YES))) panel_window_display_layout_debug (GTK_WIDGET (window)); /* update the struts edge of this window and check if we need to force