[Xfce4-commits] <xfce4-weather-plugin:master> Scrollbox: Refactor code to free labels.

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


Updating branch refs/heads/master
         to 8c80d9279e87ebfd3729347aeb459f535dace813 (commit)
       from e0ba60ed9879eefd117f106c7c408c107da185df (commit)

commit 8c80d9279e87ebfd3729347aeb459f535dace813
Author: Harald Judt <h.judt at gmx.at>
Date:   Fri Dec 14 20:41:06 2012 +0100

    Scrollbox: Refactor code to free labels.

 panel-plugin/weather-scrollbox.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/panel-plugin/weather-scrollbox.c b/panel-plugin/weather-scrollbox.c
index 471dbf7..5d69b9c 100644
--- a/panel-plugin/weather-scrollbox.c
+++ b/panel-plugin/weather-scrollbox.c
@@ -75,6 +75,16 @@ gtk_scrollbox_init(GtkScrollbox *self)
 
 
 static void
+gtk_scrollbox_labels_free(GtkScrollbox *self)
+{
+    /* free all the labels */
+    g_list_foreach(self->labels, (GFunc) g_object_unref, NULL);
+    g_list_free(self->labels);
+    self->labels = NULL;
+}
+
+
+static void
 gtk_scrollbox_finalize(GObject *object)
 {
     GtkScrollbox *self = GTK_SCROLLBOX(object);
@@ -84,8 +94,7 @@ gtk_scrollbox_finalize(GObject *object)
         g_source_remove(self->timeout_id);
 
     /* free all the labels */
-    g_list_foreach(self->labels, (GFunc) g_object_unref, NULL);
-    g_list_free(self->labels);
+    gtk_scrollbox_labels_free(self);
 
     /* free everything else */
     g_free(self->fontname);
@@ -331,9 +340,7 @@ gtk_scrollbox_clear(GtkScrollbox *self)
 {
     g_return_if_fail(GTK_IS_SCROLLBOX(self));
 
-    g_list_foreach(self->labels, (GFunc) g_object_unref, NULL);
-    g_list_free(self->labels);
-    self->labels = NULL;
+    gtk_scrollbox_labels_free(self);
 
     gtk_widget_queue_resize(GTK_WIDGET(self));
 }


More information about the Xfce4-commits mailing list