[Xfce4-commits] <xfce4-weather-plugin:master> Show or hide scrollbox immediately.

Harald Judt noreply at xfce.org
Tue Nov 27 16:46:22 CET 2012


Updating branch refs/heads/master
         to 64c54269e6102df7f19a11e19562e2d9bf1d4738 (commit)
       from 87011e617fdabce2bba8385c75925693730d25a0 (commit)

commit 64c54269e6102df7f19a11e19562e2d9bf1d4738
Author: Harald Judt <h.judt at gmx.at>
Date:   Sat Nov 24 12:51:03 2012 +0100

    Show or hide scrollbox immediately.
    
    This simply shows or hides both the scrollbox container and the scrollbox
    widget. It doesn't stop processing events for the scrollbox, so this will
    still waste CPU cycles, but we can optimize this at a later time.

 panel-plugin/weather-config.c |    1 +
 panel-plugin/weather.c        |   17 +++++++++++++++++
 panel-plugin/weather.h        |    2 ++
 3 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/panel-plugin/weather-config.c b/panel-plugin/weather-config.c
index 89e7d81..3694edb 100644
--- a/panel-plugin/weather-config.c
+++ b/panel-plugin/weather-config.c
@@ -928,6 +928,7 @@ check_scrollbox_show_toggled(GtkWidget *button,
     xfceweather_dialog *dialog = (xfceweather_dialog *) user_data;
     dialog->wd->show_scrollbox =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
+    toggle_scrollbox(dialog->wd);
 }
 
 
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 40b5a53..d1f3c72 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -221,6 +221,16 @@ update_icon(xfceweather_data *data)
 }
 
 
+void
+toggle_scrollbox(xfceweather_data *data)
+{
+    if (data->show_scrollbox)
+        gtk_widget_show_all(GTK_WIDGET(data->vbox_center_scrollbox));
+    else
+        gtk_widget_hide_all(GTK_WIDGET(data->vbox_center_scrollbox));
+}
+
+
 static void
 update_scrollbox(xfceweather_data *data)
 {
@@ -233,6 +243,9 @@ update_scrollbox(xfceweather_data *data)
 
     txtsize = get_label_size(data);
     gtk_scrollbox_clear(GTK_SCROLLBOX(data->scrollbox));
+    gtk_scrollbox_set_animate(GTK_SCROLLBOX(data->scrollbox),
+                              data->scrollbox_animate);
+
     if (data->weatherdata) {
         for (i = 0; i < data->labels->len; i++) {
             type = g_array_index(data->labels, data_types, i);
@@ -249,6 +262,10 @@ update_scrollbox(xfceweather_data *data)
         weather_debug("No weather data available, set single label '%s'.",
                       _("No Data"));
     }
+
+    /* show or hide scrollbox */
+    toggle_scrollbox(data);
+
     weather_debug("Updated scrollbox.");
 }
 
diff --git a/panel-plugin/weather.h b/panel-plugin/weather.h
index d2e54bd..8ac9228 100644
--- a/panel-plugin/weather.h
+++ b/panel-plugin/weather.h
@@ -89,6 +89,8 @@ void weather_http_queue_request(SoupSession *session,
                                 SoupSessionCallback callback_func,
                                 gpointer user_data);
 
+void toggle_scrollbox(xfceweather_data *data);
+
 G_END_DECLS
 
 #endif


More information about the Xfce4-commits mailing list