[grilo] pls: don't use GTimeVal on newer glib
- From: Victor Toso <victortoso src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] pls: don't use GTimeVal on newer glib
- Date: Fri, 21 Feb 2020 10:45:31 +0000 (UTC)
commit 18282b430c00ef335bbbb80efd91f8680b78add2
Author: Victor Toso <me victortoso com>
Date: Mon Feb 17 10:52:01 2020 +0100
pls: don't use GTimeVal on newer glib
On 2.62.0 we can use new API and avoid GTimeVal usage in grl-pls.c. As
2.62 is a bit new, wrap the old code to avoid warnings on new builds.
It can be removed after bumping glib to >= 2.62.0
libs/pls/grl-pls.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/libs/pls/grl-pls.c b/libs/pls/grl-pls.c
index f6121cc..616d6f1 100644
--- a/libs/pls/grl-pls.c
+++ b/libs/pls/grl-pls.c
@@ -1104,10 +1104,14 @@ file_is_valid_content (GFileInfo *info, gboolean fast, GrlOperationOptions *opti
}
if (min_date || max_date) {
+#if GLIB_CHECK_VERSION (2, 62, 0)
+ file_date = g_file_info_get_modification_date_time (info);
+#else
GTimeVal time = {0,};
g_file_info_get_modification_time (info, &time);
file_date = g_date_time_new_from_timeval_utc (&time);
+#endif
}
if (min_date && file_date && g_date_time_compare (min_date, file_date) > 0) {
@@ -1272,7 +1276,6 @@ grl_pls_file_to_media (GrlMedia *content,
g_clear_error (&error);
g_free (str);
} else {
- GTimeVal time;
GDateTime *date_time;
mime = g_file_info_get_content_type (info);
@@ -1329,8 +1332,13 @@ grl_pls_file_to_media (GrlMedia *content,
grl_data_set_boolean (GRL_DATA (media), GRL_METADATA_KEY_TITLE_FROM_FILENAME, TRUE);
/* Date */
+#if GLIB_CHECK_VERSION (2, 62, 0)
+ date_time = g_file_info_get_modification_date_time (info);
+#else
+ GTimeVal time;
g_file_info_get_modification_time (info, &time);
date_time = g_date_time_new_from_timeval_utc (&time);
+#endif
grl_media_set_modification_date (media, date_time);
g_date_time_unref (date_time);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]