[Xfce4-commits] <xfce4-weather-plugin:master> Power saving: Make power saving optional.

Harald Judt noreply at xfce.org
Tue Feb 5 15:24:03 CET 2013


Updating branch refs/heads/master
         to 7f9d46522e16bfae8ba923818857a8a51ce598bf (commit)
       from 2189f6bf37f6f379c4c4d9478f5f76083e8cb08a (commit)

commit 7f9d46522e16bfae8ba923818857a8a51ce598bf
Author: Harald Judt <h.judt at gmx.at>
Date:   Tue Feb 5 01:07:27 2013 +0100

    Power saving: Make power saving optional.

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

diff --git a/panel-plugin/weather-debug.c b/panel-plugin/weather-debug.c
index 7e0392c..1137048 100644
--- a/panel-plugin/weather-debug.c
+++ b/panel-plugin/weather-debug.c
@@ -411,6 +411,7 @@ weather_dump_plugindata(const plugin_data *data)
                            "  --------------------------------------------\n"
                            "  upower on battery: %s\n"
                            "  upower lid closed: %s\n"
+                           "  power saving: %s\n"
                            "  --------------------------------------------\n"
                            "  last astro update: %s\n"
                            "  next astro update: %s\n"
@@ -452,6 +453,7 @@ weather_dump_plugindata(const plugin_data *data)
                            data->orientation,
                            YESNO(data->upower_on_battery),
                            YESNO(data->upower_lid_closed),
+                           YESNO(data->power_saving),
                            last_astro_update,
                            next_astro_update,
                            data->astro_update->attempt,
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 5a5ff8a..824a281 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -832,6 +832,8 @@ xfceweather_read_config(XfcePanelPlugin *plugin,
     data->cache_file_max_age =
         xfce_rc_read_int_entry(rc, "cache_file_max_age", CACHE_FILE_MAX_AGE);
 
+    data->power_saving = xfce_rc_read_bool_entry(rc, "power_saving", TRUE);
+
     if (data->units)
         g_slice_free(units_config, data->units);
     data->units = g_slice_new0(units_config);
@@ -947,6 +949,8 @@ xfceweather_write_config(XfcePanelPlugin *plugin,
     xfce_rc_write_int_entry(rc, "cache_file_max_age",
                             data->cache_file_max_age);
 
+    xfce_rc_write_bool_entry(rc, "power_saving", data->power_saving);
+
     xfce_rc_write_int_entry(rc, "units_temperature", data->units->temperature);
     xfce_rc_write_int_entry(rc, "units_pressure", data->units->pressure);
     xfce_rc_write_int_entry(rc, "units_windspeed", data->units->windspeed);
@@ -1485,7 +1489,7 @@ upower_changed_cb(UpClient *client,
 {
     gboolean on_battery, lid_closed;
 
-    if (G_UNLIKELY(data->upower == NULL))
+    if (G_UNLIKELY(data->upower == NULL) || !data->power_saving)
         return;
 
     on_battery = data->upower_on_battery;
diff --git a/panel-plugin/weather.h b/panel-plugin/weather.h
index 25d7a5a..1b7336e 100644
--- a/panel-plugin/weather.h
+++ b/panel-plugin/weather.h
@@ -67,6 +67,7 @@ typedef struct {
     gboolean upower_on_battery;
     gboolean upower_lid_closed;
 #endif
+    gboolean power_saving;
     SoupSession *session;
     gchar *geonames_username;
 


More information about the Xfce4-commits mailing list