[Xfce4-commits] <xfce4-weather-plugin:master> Add debugging messages for easier tracing.
Harald Judt
noreply at xfce.org
Sun Aug 19 10:08:10 CEST 2012
Updating branch refs/heads/master
to f5dec77b044c633e87a1b09ff689287153616719 (commit)
from 083244097e77aba592a77f50554c62da9e428f1b (commit)
commit f5dec77b044c633e87a1b09ff689287153616719
Author: Harald Judt <h.judt at gmx.at>
Date: Sun Aug 19 09:54:04 2012 +0200
Add debugging messages for easier tracing.
panel-plugin/weather-parsers.c | 9 +++++++--
panel-plugin/weather.c | 28 +++++++++++++++++++++++-----
2 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/panel-plugin/weather-parsers.c b/panel-plugin/weather-parsers.c
index 5f25cc2..2316f68 100644
--- a/panel-plugin/weather-parsers.c
+++ b/panel-plugin/weather-parsers.c
@@ -33,6 +33,8 @@
#include <stdlib.h>
#include <string.h>
+#include "weather-debug.h"
+
#define DATA(node) \
((gchar *) xmlNodeListGetString(node->doc, node->children, 1))
@@ -487,10 +489,13 @@ xml_weather_free(xml_weather *data)
g_assert(data != NULL);
if (G_UNLIKELY(data == NULL))
return;
- for (i = 0; i < data->num_timeslices; i++) {
+ weather_debug("Freeing %u timeslices.", data->num_timeslices);
+ for (i = 0; i < data->num_timeslices; i++)
xml_time_free(data->timeslice[i]);
+ if (G_LIKELY(data->current_conditions)) {
+ weather_debug("Freeing current conditions.");
+ xml_time_free(data->current_conditions);
}
- xml_time_free(data->current_conditions);
g_slice_free(xml_weather, data);
}
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 24c84b3..b26c1bc 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -248,6 +248,7 @@ update_icon(xfceweather_data *data)
gtk_image_set_from_pixbuf(GTK_IMAGE(data->iconimage), icon);
if (G_LIKELY(icon))
g_object_unref(G_OBJECT(icon));
+ weather_debug("Updated panel icon.");
}
@@ -263,18 +264,23 @@ update_scrollbox(xfceweather_data *data)
txtsize = get_label_size(data);
gtk_scrollbox_clear(GTK_SCROLLBOX(data->scrollbox));
- if (data->weatherdata)
+ if (data->weatherdata) {
for (i = 0; i < data->labels->len; i++) {
type = g_array_index(data->labels, data_types, i);
str = make_label(data, type);
gtk_scrollbox_set_label(GTK_SCROLLBOX(data->scrollbox), -1, str);
g_free(str);
}
- else {
- str = g_strdup_printf("<span size=\"%s\">%s</span>", txtsize, _("No Data"));
+ weather_debug("Added %u labels to scrollbox.", data->labels->len);
+ } else {
+ str = g_strdup_printf("<span size=\"%s\">%s</span>",
+ txtsize, _("No Data"));
gtk_scrollbox_set_label(GTK_SCROLLBOX(data->scrollbox), -1, str);
g_free(str);
+ weather_debug("No weather data available, set single label '%s'.",
+ _("No Data"));
}
+ weather_debug("Updated scrollbox.");
}
@@ -298,6 +304,7 @@ update_current_conditions(xfceweather_data *data)
data->night_time = is_night_time(data->astrodata);
update_icon(data);
update_scrollbox(data);
+ weather_debug("Updated current conditions.");
}
@@ -367,11 +374,14 @@ cb_update(const gboolean succeed,
}
if (G_LIKELY(weather)) {
- if (G_LIKELY(data->weatherdata))
+ if (G_LIKELY(data->weatherdata)) {
+ weather_debug("Freeing weather data.");
xml_weather_free(data->weatherdata);
+ }
data->weatherdata = weather;
data->last_data_update = time(NULL);
}
+ weather_debug("Updating current conditions.");
update_current_conditions(data);
weather_dump(weather_dump_weatherdata, data->weatherdata);
@@ -492,12 +502,15 @@ update_weatherdata(xfceweather_data *data)
}
/* update current conditions, icon and labels */
- if (need_conditions_update(data))
+ if (need_conditions_update(data)) {
+ weather_debug("Updating current conditions.");
update_current_conditions(data);
+ }
/* update night time status and icon */
night_time = is_night_time(data->astrodata);
if (data->night_time != night_time) {
+ weather_debug("Night time status changed, updating icon.");
data->night_time = night_time;
update_icon(data);
}
@@ -617,6 +630,7 @@ xfceweather_read_config(XfcePanelPlugin *plugin,
}
xfce_rc_close(rc);
+ weather_debug("Config file read.");
}
@@ -672,6 +686,7 @@ xfceweather_write_config(XfcePanelPlugin *plugin,
}
xfce_rc_close(rc);
+ weather_debug("Config file written.");
}
@@ -784,6 +799,7 @@ xfceweather_dialog_response(GtkWidget *dlg,
g_warning(_("Unable to open the following url: %s"),
PLUGIN_WEBSITE);
} else {
+ weather_debug("Applying configuration options.");
apply_options(dialog);
weather_dump(weather_dump_plugindata, data);
@@ -1086,6 +1102,7 @@ xfceweather_create_control(XfcePanelPlugin *plugin)
(GSourceFunc) update_weatherdata,
data);
+ weather_debug("Plugin widgets set up and ready.");
return data;
}
@@ -1094,6 +1111,7 @@ static void
xfceweather_free(XfcePanelPlugin *plugin,
xfceweather_data *data)
{
+ weather_debug("Freeing plugin data.");
g_assert(data != NULL);
weather_http_cleanup_queue();
More information about the Xfce4-commits
mailing list