[Xfce4-commits] <xfce4-weather-plugin:master> Fix updates not happening sometimes on plugin startup.

Harald Judt noreply at xfce.org
Fri Dec 14 15:14:02 CET 2012


Updating branch refs/heads/master
         to f1849b532fe28cf88fa6c83283d0982d332cf848 (commit)
       from 4e3426e38f93400c3932063f479de127853efa38 (commit)

commit f1849b532fe28cf88fa6c83283d0982d332cf848
Author: Harald Judt <h.judt at gmx.at>
Date:   Fri Dec 14 15:12:13 2012 +0100

    Fix updates not happening sometimes on plugin startup.

 panel-plugin/weather.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 229eaf6..6e65399 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -608,6 +608,13 @@ schedule_next_wakeup(plugin_data *data)
             SCHEDULE_WAKEUP_COMPARE(data->astrodata->sunset,
                                     "sunset icon change");
     }
+
+    /* next wakeup time could not be calculated, so force it */
+    if (diff < 0) {
+        diff = 5;
+        data->next_wakeup_reason = "forced";
+    }
+
     data->update_timer =
         g_timeout_add_seconds((guint) diff,
                               (GSourceFunc) update_handler, data);
@@ -1550,9 +1557,6 @@ xfceweather_create_control(XfcePanelPlugin *plugin)
     gtk_scrollbox_set_label(GTK_SCROLLBOX(data->scrollbox), -1, "1");
     gtk_scrollbox_clear(GTK_SCROLLBOX(data->scrollbox));
 
-    /* prepare data and widget updates */
-    schedule_next_wakeup(data);
-
     weather_debug("Plugin widgets set up and ready.");
     return data;
 }
@@ -1788,6 +1792,9 @@ weather_construct(XfcePanelPlugin *plugin)
     g_signal_connect(G_OBJECT(plugin), "about",
                      G_CALLBACK(xfceweather_show_about), data);
 
+    /* call update handler updates */
+    update_handler(data);
+
     weather_dump(weather_dump_plugindata, data);
 }
 


More information about the Xfce4-commits mailing list