[Xfce4-commits] <xfce4-weather-plugin:master> More general cleanup.

Harald Judt noreply at xfce.org
Tue Jul 31 18:14:01 CEST 2012


Updating branch refs/heads/master
         to 92a743a80ca7c7b0e543f42ffaf402a703543730 (commit)
       from d7786d1dc83e3d8805ebef133defa763edea9663 (commit)

commit 92a743a80ca7c7b0e543f42ffaf402a703543730
Author: Harald Judt <h.judt at gmx.at>
Date:   Tue Jul 31 16:35:56 2012 +0200

    More general cleanup.
    
    Remove more unused variables, move some code around.

 panel-plugin/weather-config.c    |    2 +
 panel-plugin/weather-data.c      |    5 ++-
 panel-plugin/weather-http.c      |    5 +--
 panel-plugin/weather-parsers.c   |   45 +++++++++++++++---------------
 panel-plugin/weather-scrollbox.c |    4 +--
 panel-plugin/weather-search.c    |   30 +++++++++-----------
 panel-plugin/weather-summary.c   |   56 +++++++++++++++++++------------------
 panel-plugin/weather-translate.c |   16 +++++------
 panel-plugin/weather.c           |   15 ++++------
 9 files changed, 85 insertions(+), 93 deletions(-)

diff --git a/panel-plugin/weather-config.c b/panel-plugin/weather-config.c
index d8ea4be..944bb0f 100644
--- a/panel-plugin/weather-config.c
+++ b/panel-plugin/weather-config.c
@@ -155,6 +155,7 @@ cb_toggle(GtkWidget *widget,
           gpointer data)
 {
     GtkWidget *target = (GtkWidget *) data;
+
     gtk_widget_set_sensitive(target,
                              gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
                                                           (widget)));
@@ -167,6 +168,7 @@ cb_not_toggle(GtkWidget *widget,
               gpointer data)
 {
     GtkWidget *target = (GtkWidget *) data;
+
     gtk_widget_set_sensitive(target,
                              !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
                                                            (widget)));
diff --git a/panel-plugin/weather-data.c b/panel-plugin/weather-data.c
index 1de961c..61cec2e 100644
--- a/panel-plugin/weather-data.c
+++ b/panel-plugin/weather-data.c
@@ -31,6 +31,7 @@
 
 
 #define CHK_NULL(s) ((s) ? g_strdup(s) : g_strdup(""))
+
 #define LOCALE_DOUBLE(value,                                            \
                       format) (g_strdup_printf(format,                  \
                                                g_ascii_strtod(value, NULL)))
@@ -42,6 +43,7 @@ has_timeslice(xml_weather *data,
               time_t end_t)
 {
     int i = 0;
+
     for (i = 0; i < data->num_timeslices; i++)
         if (data->timeslice[i]->start == start_t &&
             data->timeslice[i]->end == end_t)
@@ -58,7 +60,7 @@ get_data(xml_time *timeslice,
     const xml_location *loc = NULL;
     double val;
 
-    if (timeslice == NULL)
+    if (timeslice == NULL || timeslice->location == NULL)
         return g_strdup("");
 
     loc = timeslice->location;
@@ -388,7 +390,6 @@ find_shortest_timeslice(xml_weather *data,
         start_tm = *localtime(&start_t);
         end_tm = *localtime(&end_t);
     }
-
     return NULL;
 }
 
diff --git a/panel-plugin/weather-http.c b/panel-plugin/weather-http.c
index a738194..53a9b4c 100644
--- a/panel-plugin/weather-http.c
+++ b/panel-plugin/weather-http.c
@@ -148,7 +148,7 @@ weather_http_receive_data_idle(gpointer user_data)
     struct addrinfo h, *r, *a;
     const gchar *p;
     gchar buffer[1024], *request, *port = NULL;
-    gint bytes = 0, n, m = 0, err;
+    gint bytes = 0, n, m = 0, err, cts_len;
     fd_set fds;
     GTimeVal timeout;
 
@@ -211,7 +211,6 @@ weather_http_receive_data_idle(gpointer user_data)
         return FALSE;
 
     /* open the socket */
-
     for (a = r; a != NULL; a = a->ai_next) {
         connection->fd = socket(a->ai_family, a->ai_socktype, a->ai_protocol);
         if (connection->fd < 0)
@@ -339,7 +338,7 @@ weather_http_receive_data_idle(gpointer user_data)
 
     if (G_LIKELY(connection->received_len > 0)) {
         /* get the pointer to the content-length */
-        int cts_len = -1;
+        cts_len = -1;
         p = strstr((char *) connection->received, "Content-Length:");
         if (G_LIKELY(p)) {
             /* advance the pointer */
diff --git a/panel-plugin/weather-parsers.c b/panel-plugin/weather-parsers.c
index a3988ca..2b42f5e 100644
--- a/panel-plugin/weather-parsers.c
+++ b/panel-plugin/weather-parsers.c
@@ -61,7 +61,6 @@ parse_weather(xmlNode *cur_node)
 {
     xml_weather *ret;
     xmlNode *child_node;
-    guint i = 0;
 
     if (!NODE_IS_TYPE(cur_node, "weatherdata")) {
         return NULL;
@@ -93,7 +92,7 @@ parse_weather(xmlNode *cur_node)
 
 
 time_t
-parse_xml_timestring(gchar* ts, gchar* format) {
+parse_xml_timestring(gchar *ts, gchar *format) {
     time_t t;
     struct tm tm;
 
@@ -197,14 +196,13 @@ parse_astro(xmlNode *cur_node)
 {
     xmlNode *child_node, *time_node = NULL, *location_node = NULL;
     xml_astro *astro = g_slice_new0(xml_astro);
-    guint i = 0;
 
     if (G_UNLIKELY(astro == NULL))
         return NULL;
 
     for (child_node = cur_node->children; child_node;
          child_node = child_node->next)
-        if (NODE_IS_TYPE (child_node, "time")) {
+        if (NODE_IS_TYPE(child_node, "time")) {
             time_node = child_node;
             break;
         }
@@ -212,15 +210,15 @@ parse_astro(xmlNode *cur_node)
     if (G_LIKELY(time_node))
         for (child_node = time_node->children; child_node;
              child_node = child_node->next)
-            if (NODE_IS_TYPE (child_node, "location"))
+            if (NODE_IS_TYPE(child_node, "location"))
                 parse_astro_location(child_node, astro);
     return astro;
 }
 
 
 void
-parse_time(xmlNode * cur_node,
-           xml_weather * data)
+parse_time(xmlNode *cur_node,
+           xml_weather *data)
 {
     gchar *datatype = xmlGetProp(cur_node, (const xmlChar *) "datatype");
     gchar *start = xmlGetProp(cur_node, (const xmlChar *) "from");
@@ -231,7 +229,7 @@ parse_time(xmlNode * cur_node,
     xmlNode *child_node;
 
     /* strptime needs an initialized struct, or unpredictable
-       behaviour might occur */
+     * behaviour might occur */
     memset(&start_tm, 0, sizeof(struct tm));
     memset(&end_tm, 0, sizeof(struct tm));
     start_tm.tm_isdst = -1;
@@ -272,7 +270,7 @@ parse_time(xmlNode * cur_node,
     }
     for (child_node = cur_node->children; child_node;
          child_node = child_node->next)
-        if (NODE_IS_TYPE (child_node, "location")) {
+        if (NODE_IS_TYPE(child_node, "location")) {
             if (timeslice->location == NULL)
                 timeslice->location = g_slice_new0(xml_location);
             parse_location(child_node, timeslice->location);
@@ -285,7 +283,8 @@ get_timeslice(xml_weather *data,
               time_t start_t,
               time_t end_t)
 {
-    int i;
+    guint i;
+
     for (i = 0; i < data->num_timeslices; i++) {
         if (data->timeslice[i]->start == start_t &&
             data->timeslice[i]->end == end_t)
@@ -304,7 +303,7 @@ get_timeslice(xml_weather *data,
 
 
 void
-parse_location(xmlNode * cur_node,
+parse_location(xmlNode *cur_node,
                xml_location *loc)
 {
     xmlNode *child_node;
@@ -320,63 +319,63 @@ parse_location(xmlNode * cur_node,
 
     for (child_node = cur_node->children; child_node;
          child_node = child_node->next) {
-        if (NODE_IS_TYPE (child_node, "temperature")) {
+        if (NODE_IS_TYPE(child_node, "temperature")) {
             g_free(loc->temperature_unit);
             g_free(loc->temperature_value);
             loc->temperature_unit = PROP(child_node, "unit");
             loc->temperature_value = PROP(child_node, "value");
         }
-        if (NODE_IS_TYPE (child_node, "windDirection")) {
+        if (NODE_IS_TYPE(child_node, "windDirection")) {
             g_free(loc->wind_dir_deg);
             g_free(loc->wind_dir_name);
             loc->wind_dir_deg = PROP(child_node, "deg");
             loc->wind_dir_name = PROP(child_node, "name");
         }
-        if (NODE_IS_TYPE (child_node, "windSpeed")) {
+        if (NODE_IS_TYPE(child_node, "windSpeed")) {
             g_free(loc->wind_speed_mps);
             g_free(loc->wind_speed_beaufort);
             loc->wind_speed_mps = PROP(child_node, "mps");
             loc->wind_speed_beaufort = PROP(child_node, "beaufort");
         }
-        if (NODE_IS_TYPE (child_node, "humidity")) {
+        if (NODE_IS_TYPE(child_node, "humidity")) {
             g_free(loc->humidity_unit);
             g_free(loc->humidity_value);
             loc->humidity_unit = PROP(child_node, "unit");
             loc->humidity_value = PROP(child_node, "value");
         }
-        if (NODE_IS_TYPE (child_node, "pressure")) {
+        if (NODE_IS_TYPE(child_node, "pressure")) {
             g_free(loc->pressure_unit);
             g_free(loc->pressure_value);
             loc->pressure_unit = PROP(child_node, "unit");
             loc->pressure_value = PROP(child_node, "value");
         }
-        if (NODE_IS_TYPE (child_node, "cloudiness")) {
+        if (NODE_IS_TYPE(child_node, "cloudiness")) {
             g_free(loc->clouds_percent[CLOUDS_PERC_CLOUDINESS]);
             loc->clouds_percent[CLOUDS_PERC_CLOUDINESS] = PROP(child_node, "percent");
         }
-        if (NODE_IS_TYPE (child_node, "fog")) {
+        if (NODE_IS_TYPE(child_node, "fog")) {
             g_free(loc->fog_percent);
             loc->fog_percent = PROP(child_node, "percent");
         }
-        if (NODE_IS_TYPE (child_node, "lowClouds")) {
+        if (NODE_IS_TYPE(child_node, "lowClouds")) {
             g_free(loc->clouds_percent[CLOUDS_PERC_LOW]);
             loc->clouds_percent[CLOUDS_PERC_LOW] = PROP(child_node, "percent");
         }
-        if (NODE_IS_TYPE (child_node, "mediumClouds")) {
+        if (NODE_IS_TYPE(child_node, "mediumClouds")) {
             g_free(loc->clouds_percent[CLOUDS_PERC_MED]);
             loc->clouds_percent[CLOUDS_PERC_MED] = PROP(child_node, "percent");
         }
-        if (NODE_IS_TYPE (child_node, "highClouds")) {
+        if (NODE_IS_TYPE(child_node, "highClouds")) {
             g_free(loc->clouds_percent[CLOUDS_PERC_HIGH]);
             loc->clouds_percent[CLOUDS_PERC_HIGH] = PROP(child_node, "percent");
         }
-        if (NODE_IS_TYPE (child_node, "precipitation")) {
+        if (NODE_IS_TYPE(child_node, "precipitation")) {
             g_free(loc->precipitation_unit);
             g_free(loc->precipitation_value);
             loc->precipitation_unit = PROP(child_node, "unit");
             loc->precipitation_value = PROP(child_node, "value");
         }
-        if (NODE_IS_TYPE (child_node, "symbol")) {
+        if (NODE_IS_TYPE(child_node, "symbol")) {
             g_free(loc->symbol);
             loc->symbol = PROP(child_node, "id");
             loc->symbol_id = strtol(PROP(child_node, "number"), NULL, 10);
diff --git a/panel-plugin/weather-scrollbox.c b/panel-plugin/weather-scrollbox.c
index 50dfe80..03fb51f 100644
--- a/panel-plugin/weather-scrollbox.c
+++ b/panel-plugin/weather-scrollbox.c
@@ -71,7 +71,6 @@ gtk_scrollbox_init(GtkScrollbox *self)
 }
 
 
-
 static void
 gtk_scrollbox_finalize(GObject *object)
 {
@@ -89,7 +88,6 @@ gtk_scrollbox_finalize(GObject *object)
 }
 
 
-
 static void
 gtk_scrollbox_size_request(GtkWidget *widget,
                            GtkRequisition *requisition)
@@ -176,6 +174,7 @@ static gboolean
 gtk_scrollbox_sleep(gpointer user_data)
 {
     GtkScrollbox *self = GTK_SCROLLBOX(user_data);
+
     self->timeout_id = g_timeout_add(LABEL_SPEED, gtk_scrollbox_fade_out, self);
     return FALSE;
 }
@@ -199,7 +198,6 @@ gtk_scrollbox_fade_in(gpointer user_data)
         return TRUE;
 
     self->timeout_id = g_timeout_add(LABEL_REFRESH, gtk_scrollbox_sleep, self);
-
     return FALSE;
 }
 
diff --git a/panel-plugin/weather-search.c b/panel-plugin/weather-search.c
index 3631015..c03319a 100644
--- a/panel-plugin/weather-search.c
+++ b/panel-plugin/weather-search.c
@@ -34,6 +34,18 @@
 #define BORDER 8
 
 
+typedef struct {
+    const gchar *proxy_host;
+    gint proxy_port;
+    void (*cb) (const gchar *loc_name,
+                const gchar *lat,
+                const gchar *lon,
+                const unit_systems unit_system,
+                gpointer user_data);
+    gpointer user_data;
+} geolocation_data;
+
+
 static void
 append_result(GtkListStore *mdl,
               gchar *lat,
@@ -59,11 +71,8 @@ sanitize_str(const gchar *str)
         else
             g_string_append_c(retstr, c);
     }
-
     realstr = retstr->str;
-
     g_string_free(retstr, FALSE);
-
     return realstr;
 }
 
@@ -337,18 +346,6 @@ free_search_dialog(search_dialog *dialog)
 }
 
 
-typedef struct {
-    const gchar *proxy_host;
-    gint proxy_port;
-    void (*cb) (const gchar *loc_name,
-                const gchar *lat,
-                const gchar *lon,
-                const unit_systems unit_system,
-                gpointer user_data);
-    gpointer user_data;
-} geolocation_data;
-
-
 static unit_systems
 get_preferred_unit_system(const gchar *country_code)
 {
@@ -379,10 +376,9 @@ cb_geolocation(gboolean succeed,
     gchar *city = NULL, *country = NULL;
     gchar *country_code = NULL, *region = NULL;
     gchar *latitude = NULL, *longitude = NULL;
-    gchar *full_loc;
+    gchar *full_loc, *p;
     unit_systems unit_system;
     gsize length;
-    gchar *p;
 
     if (!succeed || received == NULL) {
         data->cb(NULL, NULL, NULL, METRIC, data->user_data);
diff --git a/panel-plugin/weather-summary.c b/panel-plugin/weather-summary.c
index 26953f9..2a80a21 100644
--- a/panel-plugin/weather-summary.c
+++ b/panel-plugin/weather-summary.c
@@ -31,6 +31,13 @@
 #include "weather-icon.h"
 
 
+static GdkCursor *hand_cursor = NULL;
+static GdkCursor *text_cursor = NULL;
+static gboolean on_icon = FALSE;
+static GtkWidget *weather_channel_evt = NULL;
+static GtkTooltips *tooltips = NULL;
+
+
 static gboolean
 lnk_clicked(GtkTextTag *tag,
             GObject *obj,
@@ -73,9 +80,6 @@ lnk_clicked(GtkTextTag *tag,
                      G_CALLBACK(lnk_clicked), NULL);
 
 
-static GtkTooltips *tooltips = NULL;
-
-
 static gboolean
 lnk_clicked(GtkTextTag *tag,
             GObject *obj,
@@ -108,20 +112,18 @@ icon_clicked (GtkWidget *widget,
 }
 
 
-static GdkCursor *hand_cursor = NULL;
-static GdkCursor *text_cursor = NULL;
-static gboolean on_icon = FALSE;
 static gboolean
 view_motion_notify(GtkWidget *widget,
                    GdkEventMotion *event,
                    GtkWidget *view)
 {
-    if (event->x != -1 && event->y != -1) {
-        gint bx, by;
-        GtkTextIter iter;
-        GSList *tags;
-        GSList *cur;
+    GtkTextIter iter;
+    GtkTextTag *tag;
+    GSList *tags;
+    GSList *cur;
+    gint bx, by;
 
+    if (event->x != -1 && event->y != -1) {
         gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW(view),
                                               GTK_TEXT_WINDOW_WIDGET,
                                               event->x, event->y, &bx, &by);
@@ -129,7 +131,7 @@ view_motion_notify(GtkWidget *widget,
                                            &iter, bx, by);
         tags = gtk_text_iter_get_tags(&iter);
         for (cur = tags; cur != NULL; cur = cur->next) {
-            GtkTextTag *tag = cur->data;
+            tag = cur->data;
             if (g_object_get_data(G_OBJECT(tag), "url")) {
                 gdk_window_set_cursor(gtk_text_view_get_window
                                       (GTK_TEXT_VIEW(view),
@@ -172,13 +174,13 @@ view_leave_notify(GtkWidget *widget,
 }
 
 
-static GtkWidget *weather_channel_evt = NULL;
 static void
 view_scrolled_cb(GtkAdjustment *adj,
                  GtkWidget *view)
 {
+    gint x, y, x1, y1;
+
     if (weather_channel_evt) {
-        gint x, y, x1, y1;
         x1 = view->allocation.width - 191 - 15;
         y1 = view->requisition.height - 60 - 15;
         gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(view),
@@ -208,7 +210,6 @@ get_logo_path(void)
 
     g_mkdir_with_parents(dir, 0755);
     g_free(dir);
-
     return g_strconcat(g_get_user_cache_dir(), G_DIR_SEPARATOR_S,
                        "xfce4", G_DIR_SEPARATOR_S, "weather-plugin",
                        G_DIR_SEPARATOR_S, "weather_logo.gif", NULL);
@@ -260,7 +261,6 @@ weather_summary_get_logo(xfceweather_data *data)
         gtk_image_set_from_pixbuf(GTK_IMAGE(image), pixbuf);
         g_object_unref(pixbuf);
     }
-
     return image;
 }
 
@@ -278,7 +278,7 @@ create_summary_tab(xfceweather_data *data)
     const gchar *unit;
     struct tm *start_tm, *end_tm, *point_tm;
     struct tm *sunrise_tm, *sunset_tm, *moonrise_tm, *moonset_tm;
-    gchar *value, *wind, *sun_val, *vis, *rawvalue;
+    gchar *value, *rawvalue, *wind;
     gchar interval_start[80], interval_end[80], point[80];
     gchar sunrise[80], sunset[80], moonrise[80], moonset[80];
 
@@ -333,7 +333,10 @@ create_summary_tab(xfceweather_data *data)
     end_tm = localtime(&conditions->end);
     strftime(interval_end, 80, "%c", end_tm);
     value = g_strdup_printf
-        (_("\n\tPrecipitation and the weather symbol have been calculated\n\tfor the following time interval:\n\tStart:\t%s\n\tEnd:\t%s\n"),
+        (_("\n\tPrecipitation and the weather symbol have been calculated\n"
+           "\tfor the following time interval:\n"
+           "\tStart:\t%s\n"
+           "\tEnd:\t%s\n"),
          interval_start,
          interval_end);
     APPEND_TEXT_ITEM_REAL(value);
@@ -477,7 +480,6 @@ create_summary_tab(xfceweather_data *data)
         hand_cursor = gdk_cursor_new(GDK_HAND2);
     if (text_cursor == NULL)
         text_cursor = gdk_cursor_new(GDK_XTERM);
-
     return frame;
 }
 
@@ -487,6 +489,7 @@ add_forecast_cell(GtkWidget *widget,
                   GdkColor *color)
 {
     GtkWidget *ebox;
+
     ebox = gtk_event_box_new();
     if (color == NULL)
         gtk_event_box_set_visible_window(GTK_EVENT_BOX(ebox), FALSE);
@@ -519,7 +522,6 @@ add_forecast_header(gchar *text,
     gtk_label_set_markup(GTK_LABEL(label), str);
     g_free(str);
     gtk_container_add(GTK_CONTAINER(align), GTK_WIDGET(label));
-
     return add_forecast_cell(align, color);
 }
 
@@ -734,7 +736,8 @@ summary_dialog_response(GtkWidget *dlg,
     if (response == GTK_RESPONSE_ACCEPT)
         gtk_widget_destroy(window);
     else if (response == GTK_RESPONSE_HELP)
-        g_spawn_command_line_async ("exo-open --launch WebBrowser " PLUGIN_WEBSITE, NULL);
+        g_spawn_command_line_async ("exo-open --launch WebBrowser "
+                                    PLUGIN_WEBSITE, NULL);
 }
 
 
@@ -742,7 +745,7 @@ GtkWidget *
 create_summary_window (xfceweather_data *data)
 {
     GtkWidget *window, *notebook, *vbox, *hbox, *label;
-    gchar *title, *rawvalue;
+    gchar *title, *symbol;
     GdkPixbuf *icon;
     xml_time *conditions;
 
@@ -761,14 +764,13 @@ create_summary_window (xfceweather_data *data)
     }
 
     vbox = gtk_vbox_new(FALSE, 0);
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), vbox, TRUE, TRUE,
-                       0);
+    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), vbox, TRUE, TRUE, 0);
 
     conditions = get_current_conditions(data->weatherdata);
 
-    rawvalue = get_data(conditions, data->unit_system, SYMBOL);
-    icon = get_icon(rawvalue, 48, data->night_time);
-    g_free(rawvalue);
+    symbol = get_data(conditions, data->unit_system, SYMBOL);
+    icon = get_icon(symbol, 48, data->night_time);
+    g_free(symbol);
 
     gtk_window_set_icon(GTK_WINDOW(window), icon);
 
diff --git a/panel-plugin/weather-translate.c b/panel-plugin/weather-translate.c
index 656728d..0725c0e 100644
--- a/panel-plugin/weather-translate.c
+++ b/panel-plugin/weather-translate.c
@@ -91,7 +91,6 @@ translate_str(const gchar **loc_strings,
         if (!g_ascii_strncasecmp(loc_strings[i], str, str_len))
             return _(loc_strings[i]);
     }
-
     return str;
 }
 
@@ -101,9 +100,9 @@ typedef struct {
     gchar *symbol;
     gchar *desc;
     gchar *night_desc;
-} SymbolToDesc;
+} symbol_desc;
 
-static const SymbolToDesc symbol_to_desc[] = {
+static const symbol_desc symbol_to_desc[] = {
     { 1, "SUN",                 N_("Sunny"),                     N_("Clear")		},
     { 2, "LIGHTCLOUD",          N_("Lightly cloudy"),            N_("Lightly cloudy")	},
     { 3, "PARTLYCLOUD",         N_("Partly cloudy"),             N_("Partly cloudy")	},
@@ -137,14 +136,14 @@ const gchar *
 translate_desc(const gchar *desc,
                gboolean nighttime)
 {
-    int i;
-    for (i = 0; i < NUM_SYMBOLS; i++) {
+    guint i;
+
+    for (i = 0; i < NUM_SYMBOLS; i++)
         if (!strcmp(desc, symbol_to_desc[i].symbol))
             if (nighttime)
                 return _(symbol_to_desc[i].night_desc);
             else
                 return _(symbol_to_desc[i].desc);
-    }
     return desc;
 }
 
@@ -153,6 +152,7 @@ const gchar *
 translate_moon_phase(const gchar *moon_phase)
 {
     guint i;
+
     for (i = 0; i < NUM_MOON_PHASES; i++)
         if (!strcmp(moon_phase, moon_phases[i]))
             return _(moon_phases[i]);
@@ -190,8 +190,8 @@ gchar *
 translate_wind_direction(const gchar *wdir)
 {
     gint wdir_len;
-    guint i;
     gchar *wdir_loc, *tmp, wdir_i[2];
+    guint i;
 
     if (wdir == NULL || (wdir_len = strlen(wdir)) < 1)
         return NULL;
@@ -220,7 +220,6 @@ translate_wind_direction(const gchar *wdir)
         }
 
     }
-
     return wdir_loc;
 }
 
@@ -241,6 +240,5 @@ translate_wind_speed(xml_time *timeslice,
         wspeed_loc =
             g_strdup_printf("%s %s", wspeed, get_unit(unit_system, WIND_SPEED));
     }
-
     return wspeed_loc;
 }
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 958f03f..b365e56 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -354,15 +354,12 @@ cb_astro_update(gboolean succeed,
             doc = xmlReadMemory(result, strlen(result), NULL, "UTF-8", 0);
         } else
             doc = xmlParseMemory(result, strlen(result));
-
         g_free(result);
 
         if (G_LIKELY(doc)) {
             cur_node = xmlDocGetRootElement(doc);
-
             if (G_LIKELY(cur_node))
                 astro = parse_astro(cur_node);
-
             xmlFreeDoc(doc);
         }
     }
@@ -393,22 +390,18 @@ cb_update(gboolean succeed,
             doc = xmlReadMemory(result, strlen(result), NULL, "UTF-8", 0);
         } else
             doc = xmlParseMemory(result, strlen(result));
-
         g_free(result);
 
         if (G_LIKELY(doc)) {
             cur_node = xmlDocGetRootElement(doc);
-
             if (cur_node)
                 weather = parse_weather(cur_node);
-
             xmlFreeDoc(doc);
         }
     }
 
     gtk_scrollbox_clear(GTK_SCROLLBOX(data->scrollbox));
 
-
     if (weather) {
         data->weatherdata = weather;
         data->last_data_update = time(NULL);
@@ -479,6 +472,8 @@ update_weatherdata(xfceweather_data *data)
 {
     gchar *url;
     gboolean night_time;
+    time_t now_t;
+    struct tm now_tm;
 
     g_assert(data != NULL);
     if (G_UNLIKELY(data == NULL))
@@ -493,8 +488,8 @@ update_weatherdata(xfceweather_data *data)
 
     /* fetch astrological data */
     if (need_astro_update(data)) {
-        time_t now_t = time(NULL);
-        struct tm now_tm = *localtime(&now_t);
+        now_t = time(NULL);
+        now_tm = *localtime(&now_t);
 
         /* build url */
         url = g_strdup_printf("/weatherapi/sunrise/1.0/?"
@@ -743,6 +738,7 @@ close_summary(GtkWidget *widget,
               gpointer *user_data)
 {
     xfceweather_data *data = (xfceweather_data *) user_data;
+
     data->summary_window = NULL;
 }
 
@@ -800,6 +796,7 @@ mi_click(GtkWidget *widget,
          gpointer user_data)
 {
     xfceweather_data *data = (xfceweather_data *) user_data;
+
     update_weatherdata_with_reset(data);
 }
 


More information about the Xfce4-commits mailing list