[totem-pl-parser] build: Fix build with GMime 3.0



commit 08f6a2f6d761fd835c492eac82d1b6bd387e3ecd
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Apr 13 10:52:19 2017 +0100

    build: Fix build with GMime 3.0
    
    The g_mime_utils_header_decode_date() function changed in GMime 3.0: it
    now takes a single argument, and generates a GDateTime instead of a Unix
    timestamp.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781254

 plparse/totem-pl-parser.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/plparse/totem-pl-parser.c b/plparse/totem-pl-parser.c
index 3cb579d..bd46c03 100644
--- a/plparse/totem-pl-parser.c
+++ b/plparse/totem-pl-parser.c
@@ -2355,7 +2355,19 @@ totem_pl_parser_parse_date (const char *date_str, gboolean debug)
        }
        D(g_message ("Failed to parse duration '%s' using the ISO8601 parser", date_str));
        /* Fall back to RFC 2822 date parsing */
+#ifdef HAVE_GMIME3
+       {
+               g_autoptr(GDateTime) date = NULL;
+               date = g_mime_utils_header_decode_date (date_str);
+               if (!date || !g_date_time_to_timeval (date, &val)) {
+                       D(g_message ("Failed to parse duration '%s' using the RFC 2822 parser", date_str));
+                       return -1;
+               }
+               return val.tv_sec;
+       }
+#else
        return g_mime_utils_header_decode_date (date_str, NULL);
+#endif /* HAVE_GMIME3 */
 #else
        WARN_NO_GMIME;
 #endif /* HAVE_GMIME */


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