[Xfce4-commits] <xfce4-weather-plugin:master> Scrollbox: Clear temporary queue before adding new labels.

Harald Judt noreply at xfce.org
Sat Dec 15 21:22:11 CET 2012


Updating branch refs/heads/master
         to e7cd852e19c59c57f39b01d6b4a5de17b2e8a2e7 (commit)
       from f6d00862cf58fb35abfce892e734c339369e9cab (commit)

commit e7cd852e19c59c57f39b01d6b4a5de17b2e8a2e7
Author: Harald Judt <h.judt at gmx.at>
Date:   Sat Dec 15 19:34:42 2012 +0100

    Scrollbox: Clear temporary queue before adding new labels.

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

diff --git a/panel-plugin/weather-scrollbox.c b/panel-plugin/weather-scrollbox.c
index 0ec8092..72427ce 100644
--- a/panel-plugin/weather-scrollbox.c
+++ b/panel-plugin/weather-scrollbox.c
@@ -103,9 +103,7 @@ gtk_scrollbox_finalize(GObject *object)
     gtk_scrollbox_labels_free(self);
 
     /* free all the new labels */
-    g_list_foreach(self->labels_new, (GFunc) g_object_unref, NULL);
-    g_list_free(self->labels_new);
-    self->labels_new = NULL;
+    gtk_scrollbox_clear_new(self);
 
     /* free everything else */
     g_free(self->fontname);
@@ -417,6 +415,18 @@ gtk_scrollbox_new(void)
 
 
 void
+gtk_scrollbox_clear_new(GtkScrollbox *self)
+{
+    g_return_if_fail(GTK_IS_SCROLLBOX(self));
+
+    /* free all the new labels */
+    g_list_foreach(self->labels_new, (GFunc) g_object_unref, NULL);
+    g_list_free(self->labels_new);
+    self->labels_new = NULL;
+}
+
+
+void
 gtk_scrollbox_reset(GtkScrollbox *self)
 {
     g_return_if_fail(GTK_IS_SCROLLBOX(self));
diff --git a/panel-plugin/weather-scrollbox.h b/panel-plugin/weather-scrollbox.h
index c6a54b2..70dc4a7 100644
--- a/panel-plugin/weather-scrollbox.h
+++ b/panel-plugin/weather-scrollbox.h
@@ -78,6 +78,8 @@ void gtk_scrollbox_set_orientation(GtkScrollbox *self,
 
 GtkWidget *gtk_scrollbox_new(void);
 
+void gtk_scrollbox_clear_new(GtkScrollbox *self);
+
 void gtk_scrollbox_reset(GtkScrollbox *self);
 
 void gtk_scrollbox_set_animate(GtkScrollbox *self,
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 607e7e4..ca7f0fb 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -284,6 +284,7 @@ update_scrollbox(plugin_data *data)
     data_types type;
     gint i = 0, j = 0;
 
+    gtk_scrollbox_clear_new(GTK_SCROLLBOX(data->scrollbox));
     if (data->weatherdata && data->weatherdata->current_conditions) {
         while (i < data->labels->len) {
             j = 0;


More information about the Xfce4-commits mailing list