[Xfce4-commits] <xfce4-weather-plugin:master> Initialize debugging on plugin construction.

Harald Judt noreply at xfce.org
Sun Aug 19 10:08:03 CEST 2012


Updating branch refs/heads/master
         to e45b3d59897cc7c7a8d79bd171b5e4a7335eca8c (commit)
       from a17e14a6955a22a9815665b4ba565468b02f8a6c (commit)

commit e45b3d59897cc7c7a8d79bd171b5e4a7335eca8c
Author: Harald Judt <h.judt at gmx.at>
Date:   Sat Aug 18 22:42:45 2012 +0200

    Initialize debugging on plugin construction.
    
    Since we need to check for debug mode in various places, let's define
    a global boolean variable debug_mode and set it to true when constructing
    the plugin, if the appropriate environment variables are set.

 panel-plugin/weather.c |   13 +++++++++++++
 panel-plugin/weather.h |    3 +++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 23fb948..2df1bbb 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -36,6 +36,7 @@
 #include "weather-config.h"
 #include "weather-icon.h"
 #include "weather-scrollbox.h"
+#include "weather-debug.h"
 
 #define XFCEWEATHER_ROOT "weather"
 #define UPDATE_INTERVAL 15
@@ -53,6 +54,10 @@
     g_free(value);
 
 
+
+gboolean debug_mode = FALSE;
+
+
 gboolean
 check_envproxy(gchar **proxy_host,
                gint *proxy_port)
@@ -1213,6 +1218,14 @@ static void
 weather_construct(XfcePanelPlugin *plugin)
 {
     xfceweather_data *data;
+    const gchar *panel_debug_env;
+
+    /* Enable debug level logging if PANEL_DEBUG contains G_LOG_DOMAIN */
+    panel_debug_env = g_getenv("PANEL_DEBUG");
+    if (panel_debug_env && strstr(panel_debug_env, G_LOG_DOMAIN))
+        debug_mode = TRUE;
+    weather_debug_init(G_LOG_DOMAIN, debug_mode);
+    weather_debug("weather plugin version " VERSION " starting up");
 
     xfce_textdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
     data = xfceweather_create_control(plugin);
diff --git a/panel-plugin/weather.h b/panel-plugin/weather.h
index 80c6bb9..fa67991 100644
--- a/panel-plugin/weather.h
+++ b/panel-plugin/weather.h
@@ -72,6 +72,9 @@ typedef struct {
 } xfceweather_data;
 
 
+extern gboolean debug_mode;
+
+
 gboolean check_envproxy(gchar **proxy_host,
                         gint *proxy_port);
 


More information about the Xfce4-commits mailing list