[Xfce4-commits] <xfce4-weather-plugin:master> Scrollbox: Reset on manual update.

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


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

commit f6d00862cf58fb35abfce892e734c339369e9cab
Author: Harald Judt <h.judt at gmx.at>
Date:   Sat Dec 15 19:26:59 2012 +0100

    Scrollbox: Reset on manual update.
    
    It's a good idea to give the user feedback when a manual update has been
    performed.

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

diff --git a/panel-plugin/weather-scrollbox.c b/panel-plugin/weather-scrollbox.c
index b2d9949..0ec8092 100644
--- a/panel-plugin/weather-scrollbox.c
+++ b/panel-plugin/weather-scrollbox.c
@@ -417,12 +417,22 @@ gtk_scrollbox_new(void)
 
 
 void
-gtk_scrollbox_clear(GtkScrollbox *self)
+gtk_scrollbox_reset(GtkScrollbox *self)
 {
     g_return_if_fail(GTK_IS_SCROLLBOX(self));
 
-    gtk_scrollbox_labels_free(self);
+    if (self->timeout_id != 0) {
+        g_source_remove(self->timeout_id);
+        self->timeout_id = 0;
+    }
 
+    if (self->animate)
+        gtk_scrollbox_start_fade(self);
+    else {
+        self->fade = FADE_NONE;
+        self->timeout_id = g_timeout_add(LABEL_REFRESH_NO_ANIMATION,
+                                         gtk_scrollbox_fade_none, self);
+    }
     gtk_widget_queue_resize(GTK_WIDGET(self));
 }
 
diff --git a/panel-plugin/weather-scrollbox.h b/panel-plugin/weather-scrollbox.h
index 63dd371..c6a54b2 100644
--- a/panel-plugin/weather-scrollbox.h
+++ b/panel-plugin/weather-scrollbox.h
@@ -78,7 +78,7 @@ void gtk_scrollbox_set_orientation(GtkScrollbox *self,
 
 GtkWidget *gtk_scrollbox_new(void);
 
-void gtk_scrollbox_clear(GtkScrollbox *self);
+void gtk_scrollbox_reset(GtkScrollbox *self);
 
 void gtk_scrollbox_set_animate(GtkScrollbox *self,
                                gboolean animate);
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index b612fec..607e7e4 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -1126,6 +1126,7 @@ update_weatherdata_with_reset(plugin_data *data, gboolean clear)
         read_cache_file(data);
     }
     schedule_next_wakeup(data);
+    gtk_scrollbox_reset(GTK_SCROLLBOX(data->scrollbox));
     weather_debug("Updated weatherdata with reset.");
 }
 


More information about the Xfce4-commits mailing list