diff options
author | Victor Toso <me@victortoso.com> | 2020-02-17 10:52:01 +0100 |
---|---|---|
committer | Victor Toso <me@victortoso.com> | 2020-02-21 11:36:41 +0100 |
commit | 18282b430c00ef335bbbb80efd91f8680b78add2 (patch) | |
tree | 22125287083511bf016ed92f6c4aedba6f5ef8aa | |
parent | e95121bfd48318582526f79c52043c0df0e12d10 (diff) | |
download | grilo-18282b430c00ef335bbbb80efd91f8680b78add2.tar.gz |
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
-rw-r--r-- | libs/pls/grl-pls.c | 10 |
1 files changed, 9 insertions, 1 deletions
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); |