[gnome-software] GTimeVal is deprecated in GLib 2.62, so use new functions for that.



commit 1ec596e7e0984849020440dba038662ccfbc864f
Author: Robert Ancell <robert ancell canonical com>
Date:   Thu Aug 22 17:40:13 2019 +0300

    GTimeVal is deprecated in GLib 2.62, so use new functions for that.

 plugins/external-appstream/gs-plugin-external-appstream.c | 6 ++++++
 src/gs-screenshot-image.c                                 | 6 ++++++
 2 files changed, 12 insertions(+)
---
diff --git a/plugins/external-appstream/gs-plugin-external-appstream.c 
b/plugins/external-appstream/gs-plugin-external-appstream.c
index 0b1e9ae7..bc307d32 100644
--- a/plugins/external-appstream/gs-plugin-external-appstream.c
+++ b/plugins/external-appstream/gs-plugin-external-appstream.c
@@ -69,7 +69,9 @@ gs_plugin_external_appstream_install (const gchar *appstream_file,
 static gchar *
 gs_plugin_external_appstream_get_modification_date (const gchar *file_path)
 {
+#ifndef GLIB_VERSION_2_62
        GTimeVal time_val;
+#endif
        g_autoptr(GDateTime) date_time = NULL;
        g_autoptr(GFile) file = NULL;
        g_autoptr(GFileInfo) info = NULL;
@@ -82,8 +84,12 @@ gs_plugin_external_appstream_get_modification_date (const gchar *file_path)
                                  NULL);
        if (info == NULL)
                return NULL;
+#ifdef GLIB_VERSION_2_62
+       date_time = g_file_info_get_modification_date_time (info);
+#else
        g_file_info_get_modification_time (info, &time_val);
        date_time = g_date_time_new_from_timeval_local (&time_val);
+#endif
        return g_date_time_format (date_time, "%a, %d %b %Y %H:%M:%S %Z");
 }
 
diff --git a/src/gs-screenshot-image.c b/src/gs-screenshot-image.c
index cd68f7c2..f087fbba 100644
--- a/src/gs-screenshot-image.c
+++ b/src/gs-screenshot-image.c
@@ -318,7 +318,9 @@ gs_screenshot_get_cachefn_for_url (const gchar *url)
 static void
 gs_screenshot_soup_msg_set_modified_request (SoupMessage *msg, GFile *file)
 {
+#ifndef GLIB_VERSION_2_62
        GTimeVal time_val;
+#endif
        g_autoptr(GDateTime) date_time = NULL;
        g_autoptr(GFileInfo) info = NULL;
        g_autofree gchar *mod_date = NULL;
@@ -330,8 +332,12 @@ gs_screenshot_soup_msg_set_modified_request (SoupMessage *msg, GFile *file)
                                  NULL);
        if (info == NULL)
                return;
+#ifdef GLIB_VERSION_2_62
+       date_time = g_file_info_get_modification_date_time (info);
+#else
        g_file_info_get_modification_time (info, &time_val);
        date_time = g_date_time_new_from_timeval_local (&time_val);
+#endif
        mod_date = g_date_time_format (date_time, "%a, %d %b %Y %H:%M:%S %Z");
        soup_message_headers_append (msg->request_headers,
                                     "If-Modified-Since",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]