[Xfce4-commits] <xfce4-panel:master> Don't export the debug variable use function.

Nick Schermer noreply at xfce.org
Tue Jan 4 22:10:03 CET 2011


Updating branch refs/heads/master
         to 98795060c0edbf9e0bf066e3b65ca0fb4fea1c89 (commit)
       from b001378a46dde10bc405e34f755fba5c067168cf (commit)

commit 98795060c0edbf9e0bf066e3b65ca0fb4fea1c89
Author: Nick Schermer <nick at xfce.org>
Date:   Tue Jan 4 20:03:12 2011 +0100

    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 d85752b..efc7cd3 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 fb92209..15ef492 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 6ed2669..e43b57c 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 (&timestamp);
       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 853bd8c..12c53d8 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



More information about the Xfce4-commits mailing list