[Xfce4-commits] [panel-plugins/xfce4-weather-plugin] 05/08: Improvements to the previous patch
noreply at xfce.org
noreply at xfce.org
Sun Mar 24 18:26: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 - 0 . 8
in repository panel-plugins/xfce4-weather-plugin.
commit f2e44941a70dd92c6e0858b1358b9e3eb148da85
Author: Andre Miranda <andreldm at xfce.org>
Date: Mon Mar 18 02:26:04 2019 -0400
Improvements to the previous patch
Signed-off-by: Sean Davis <smd.seandavis at gmail.com>
---
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 b3bef08..8c2ad78 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 026c865..710faec 100644
--- a/panel-plugin/weather-summary.c
+++ b/panel-plugin/weather-summary.c
@@ -1091,7 +1091,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;
@@ -1105,13 +1105,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 11b9ae3..1281797 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -275,6 +275,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