[Xfce4-commits] [panel-plugins/xfce4-weather-plugin] 02/02: Improvements to the previous patch (bug #14972)

noreply at xfce.org noreply at xfce.org
Mon Mar 18 07:33:16 CET 2019


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository panel-plugins/xfce4-weather-plugin.

commit 24e0cdf990ca6552d83a1462d02aba13a5fbb398
Author: Andre Miranda <andreldm at xfce.org>
Date:   Mon Mar 18 02:26:04 2019 -0400

    Improvements to the previous patch (bug #14972)
---
 panel-plugin/weather-parsers.c | 21 ++++++++-------------
 panel-plugin/weather-summary.c | 10 ++--------
 panel-plugin/weather.c         |  1 +
 3 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/panel-plugin/weather-parsers.c b/panel-plugin/weather-parsers.c
index ef6f269..726d2a0 100644
--- a/panel-plugin/weather-parsers.c
+++ b/panel-plugin/weather-parsers.c
@@ -167,22 +167,17 @@ parse_timestring(const gchar *ts,
     memset(&tm, 0, sizeof(struct tm));
     tm.tm_isdst = -1;
 
-    if (strptime(ts, format, &tm) != NULL) {
-        if (local)
-            t = mktime(&tm);
-        else
-            t = my_timegm(&tm);
-
-        if (t < 0) {
-            memset(&t, 0, sizeof(time_t));
-            return t;
-        } else {
-            return t;
-        }
-    } else {
+    if (strptime(ts, format, &tm) == NULL) {
         memset(&t, 0, sizeof(time_t));
         return t;
     }
+
+    t = local ? mktime(&tm) : my_timegm(&tm);
+
+    if (t < 0)
+        memset(&t, 0, sizeof(time_t));
+
+    return t;
 }
 
 
diff --git a/panel-plugin/weather-summary.c b/panel-plugin/weather-summary.c
index 44d1874..dbe3014 100644
--- a/panel-plugin/weather-summary.c
+++ b/panel-plugin/weather-summary.c
@@ -1068,7 +1068,7 @@ update_summary_subtitle(plugin_data *data)
 {
     time_t now_t;
     GTimeVal now;
-    gchar *title, *date, *date_format;
+    gchar *title, *date;
     guint update_interval;
     gint64 now_ms;
 
@@ -1082,13 +1082,7 @@ update_summary_subtitle(plugin_data *data)
         return FALSE;
 
     time(&now_t);
-#ifdef HAVE_UPOWER_GLIB
-    if (data->upower_on_battery)
-        date_format = "%Y-%m-%d %H:%M:%S (%Z)";
-    else
-#endif
-        date_format = "%Y-%m-%d %H:%M:%S (%Z)";
-    date = format_date(now_t, date_format, TRUE);
+    date = format_date(now_t, "%Y-%m-%d %H:%M:%S (%Z)", TRUE);
     title = g_strdup_printf("%s\n%s", data->location_name, date);
     g_free(date);
     xfce_titled_dialog_set_subtitle(XFCE_TITLED_DIALOG(data->summary_window),
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index c398381..710bd88 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -277,6 +277,7 @@ update_offset(plugin_data *data)
         g_free(data->offset);
 
     data->offset = g_date_time_format(dt, "%:z");
+    g_date_time_unref(dt);
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list