[Xfce4-commits] <xfce4-weather-plugin:master> Reintroduce night time parameter for get_data().

Harald Judt noreply at xfce.org
Sat Jan 5 12:04:12 CET 2013


Updating branch refs/heads/master
         to fefdd9aa5cb81ab57cb74f47dbb0821eb262b24c (commit)
       from 683de85dc95a128c32ee20a885efba8667b9d27f (commit)

commit fefdd9aa5cb81ab57cb74f47dbb0821eb262b24c
Author: Harald Judt <h.judt at gmx.at>
Date:   Thu Jan 3 15:55:59 2013 +0100

    Reintroduce night time parameter for get_data().
    
    Some kind of data will depend on whether it is night or day.

 panel-plugin/weather-data.c    |    3 ++-
 panel-plugin/weather-data.h    |    3 ++-
 panel-plugin/weather-summary.c |   37 ++++++++++++++++++++++++-------------
 panel-plugin/weather.c         |   14 +++++++++-----
 4 files changed, 37 insertions(+), 20 deletions(-)

diff --git a/panel-plugin/weather-data.c b/panel-plugin/weather-data.c
index a42a309..26d4446 100644
--- a/panel-plugin/weather-data.c
+++ b/panel-plugin/weather-data.c
@@ -169,7 +169,8 @@ gchar *
 get_data(const xml_time *timeslice,
          const units_config *units,
          const data_types type,
-         gboolean round)
+         const gboolean round,
+         const gboolean night_time)
 {
     const xml_location *loc = NULL;
     gdouble val;
diff --git a/panel-plugin/weather-data.h b/panel-plugin/weather-data.h
index 9d7d32a..4902fa8 100644
--- a/panel-plugin/weather-data.h
+++ b/panel-plugin/weather-data.h
@@ -103,7 +103,8 @@ gboolean timeslice_is_interval(xml_time *timeslice);
 gchar *get_data(const xml_time *timeslice,
                 const units_config *units,
                 data_types type,
-                gboolean round);
+                gboolean round,
+                gboolean night_time);
 
 const gchar *get_unit(const units_config *units,
                       data_types type);
diff --git a/panel-plugin/weather-summary.c b/panel-plugin/weather-summary.c
index 0fb2950..8cef55b 100644
--- a/panel-plugin/weather-summary.c
+++ b/panel-plugin/weather-summary.c
@@ -50,7 +50,8 @@ lnk_clicked(GtkTextTag *tag,
     g_free(value);
 
 #define APPEND_TEXT_ITEM(text, item)                            \
-    rawvalue = get_data(conditions, data->units, item, FALSE);  \
+    rawvalue = get_data(conditions, data->units, item,          \
+                        FALSE, data->night_time);               \
     unit = get_unit(data->units, item);                         \
     value = g_strdup_printf("\t%s%s%s%s%s\n",                   \
                             text, text ? ": " : "",             \
@@ -84,7 +85,8 @@ lnk_clicked(GtkTextTag *tag,
              pos, pos+1, 0, 1);                         \
 
 #define APPEND_TOOLTIP_ITEM(description, item)                  \
-    value = get_data(fcdata, data->units, item, data->round);   \
+    value = get_data(fcdata, data->units, item,                 \
+                     data->round, data->night_time);            \
     unit = get_unit(data->units, item);                         \
     g_string_append_printf(text, description, value,            \
                            strcmp(unit, "°") ? " " : "",        \
@@ -422,8 +424,10 @@ create_summary_tab(plugin_data *data)
 
     /* wind */
     APPEND_BTEXT(_("\nWind\n"));
-    wind = get_data(conditions, data->units, WIND_SPEED, FALSE);
-    rawvalue = get_data(conditions, data->units, WIND_BEAUFORT, FALSE);
+    wind = get_data(conditions, data->units, WIND_SPEED,
+                    FALSE, data->night_time);
+    rawvalue = get_data(conditions, data->units, WIND_BEAUFORT,
+                        FALSE, data->night_time);
     value = g_strdup_printf(_("\t%s: %s %s (%s on the Beaufort scale)\n"),
                             _("Speed"), wind,
                             get_unit(data->units, WIND_SPEED),
@@ -432,10 +436,12 @@ create_summary_tab(plugin_data *data)
     g_free(wind);
     APPEND_TEXT_ITEM_REAL(value);
 
-    rawvalue = get_data(conditions, data->units, WIND_DIRECTION, FALSE);
+    rawvalue = get_data(conditions, data->units, WIND_DIRECTION,
+                        FALSE, data->night_time);
     wind = translate_wind_direction(rawvalue);
     g_free(rawvalue);
-    rawvalue = get_data(conditions, data->units, WIND_DIRECTION_DEG, FALSE);
+    rawvalue = get_data(conditions, data->units, WIND_DIRECTION_DEG,
+                        FALSE, data->night_time);
     value = g_strdup_printf("\t%s: %s (%s%s)\n", _("Direction"),
                             wind, rawvalue,
                             get_unit(data->units, WIND_DIRECTION_DEG));
@@ -630,7 +636,8 @@ add_forecast_cell(plugin_data *data,
     }
 
     /* symbol */
-    rawvalue = get_data(fcdata, data->units, SYMBOL, FALSE);
+    rawvalue = get_data(fcdata, data->units, SYMBOL,
+                        FALSE, data->night_time);
     icon = get_icon(data->icon_theme, rawvalue, 48, (daytime == NIGHT));
     g_free(rawvalue);
     image = gtk_image_new_from_pixbuf(icon);
@@ -639,7 +646,8 @@ add_forecast_cell(plugin_data *data,
         g_object_unref(G_OBJECT(icon));
 
     /* symbol description */
-    rawvalue = get_data(fcdata, data->units, SYMBOL, FALSE);
+    rawvalue = get_data(fcdata, data->units, SYMBOL,
+                        FALSE, data->night_time);
     value = g_strdup_printf("%s",
                             translate_desc(rawvalue, (daytime == NIGHT)));
     g_free(rawvalue);
@@ -651,8 +659,8 @@ add_forecast_cell(plugin_data *data,
     g_free(value);
 
     /* temperature */
-    rawvalue = get_data(fcdata, data->units,
-                        TEMPERATURE, data->round);
+    rawvalue = get_data(fcdata, data->units, TEMPERATURE,
+                        data->round, data->night_time);
     value = g_strdup_printf("%s %s", rawvalue,
                             get_unit(data->units, TEMPERATURE));
     g_free(rawvalue);
@@ -663,9 +671,11 @@ add_forecast_cell(plugin_data *data,
     g_free(value);
 
     /* wind direction and speed */
-    rawvalue = get_data(fcdata, data->units, WIND_DIRECTION, FALSE);
+    rawvalue = get_data(fcdata, data->units, WIND_DIRECTION,
+                        FALSE, data->night_time);
     wind_direction = translate_wind_direction(rawvalue);
-    wind_speed = get_data(fcdata, data->units, WIND_SPEED, data->round);
+    wind_speed = get_data(fcdata, data->units, WIND_SPEED,
+                          data->round, data->night_time);
     value = g_strdup_printf("%s %s %s", wind_direction, wind_speed,
                             get_unit(data->units, WIND_SPEED));
     g_free(wind_speed);
@@ -879,7 +889,8 @@ create_summary_window(plugin_data *data)
     vbox = gtk_vbox_new(FALSE, 0);
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), vbox, TRUE, TRUE, 0);
 
-    symbol = get_data(conditions, data->units, SYMBOL, FALSE);
+    symbol = get_data(conditions, data->units, SYMBOL,
+                      FALSE, data->night_time);
     icon = get_icon(data->icon_theme, symbol, 48, data->night_time);
     g_free(symbol);
 
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 9bf464c..498161a 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -50,7 +50,8 @@
 #define UPDATE_INTERVAL (10)
 
 #define DATA_AND_UNIT(var, item)                                    \
-    value = get_data(conditions, data->units, item, data->round);   \
+    value = get_data(conditions, data->units, item,                 \
+                     data->round, data->night_time);                \
     unit = get_unit(data->units, item);                             \
     var = g_strdup_printf("%s%s%s",                                 \
                           value,                                    \
@@ -161,7 +162,8 @@ make_label(const plugin_data *data,
 
     /* get current weather conditions */
     conditions = get_current_conditions(data->weatherdata);
-    rawvalue = get_data(conditions, data->units, type, data->round);
+    rawvalue = get_data(conditions, data->units, type,
+                        data->round, data->night_time);
 
     switch (type) {
     case WIND_DIRECTION:
@@ -261,7 +263,8 @@ update_icon(plugin_data *data)
 
     /* set icon according to current weather conditions */
     conditions = get_current_conditions(data->weatherdata);
-    str = get_data(conditions, data->units, SYMBOL, data->round);
+    str = get_data(conditions, data->units, SYMBOL,
+                   data->round, data->night_time);
     icon = get_icon(data->icon_theme, str, size, data->night_time);
     g_free(str);
     gtk_image_set_from_pixbuf(GTK_IMAGE(data->iconimage), icon);
@@ -1347,7 +1350,7 @@ weather_get_tooltip_text(const plugin_data *data)
     else
         sunval = g_strdup_printf("");
 
-    sym = get_data(conditions, data->units, SYMBOL, FALSE);
+    sym = get_data(conditions, data->units, SYMBOL, FALSE, data->night_time);
     DATA_AND_UNIT(alt, ALTITUDE);
     DATA_AND_UNIT(temp, TEMPERATURE);
     DATA_AND_UNIT(windspeed, WIND_SPEED);
@@ -1456,7 +1459,8 @@ weather_get_tooltip_cb(GtkWidget *widget,
     }
 
     conditions = get_current_conditions(data->weatherdata);
-    rawvalue = get_data(conditions, data->units, SYMBOL, data->round);
+    rawvalue = get_data(conditions, data->units, SYMBOL,
+                        data->round, data->night_time);
     switch (data->tooltip_style) {
     case TOOLTIP_SIMPLE:
         icon_size = 96;


More information about the Xfce4-commits mailing list