[gnome-software/gnome-3-22] trivial: Include the fwupd version in the useragent



commit 467b6af0413ce9cccc1c569712366e0fba062381
Author: Richard Hughes <richard hughsie com>
Date:   Fri Feb 16 20:32:04 2018 +0000

    trivial: Include the fwupd version in the useragent
    
    See https://blogs.gnome.org/hughsie/2018/02/16/ for more details.

 src/Makefile.am |  1 +
 src/gs-common.c | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index b8677dd9..15ca3e61 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -10,6 +10,7 @@ AM_CPPFLAGS =                                         \
        $(PACKAGEKIT_CFLAGS)                            \
        $(GNOME_DESKTOP_CFLAGS)                         \
        $(POLKIT_CFLAGS)                                \
+       $(FWUPD_CFLAGS)                                 \
        $(LIBSECRET_CFLAGS)                             \
        -DG_LOG_DOMAIN=\"Gs\"                           \
        -DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE  \
diff --git a/src/gs-common.c b/src/gs-common.c
index 30b20b02..6121c76b 100644
--- a/src/gs-common.c
+++ b/src/gs-common.c
@@ -26,6 +26,10 @@
 #include <errno.h>
 #include <fnmatch.h>
 
+#ifdef HAVE_FIRMWARE
+#include <fwupd.h>
+#endif
+
 #include "gs-app.h"
 #include "gs-common.h"
 #include "gs-plugin.h"
@@ -716,7 +720,20 @@ gs_utils_widget_set_css_app (GsApp *app,
 const gchar *
 gs_user_agent (void)
 {
+#ifdef HAVE_FIRMWARE
+       static gchar *user_agent = NULL;
+       if (user_agent == NULL) {
+               user_agent = g_strdup_printf ("%s/%s fwupd/%i.%i.%i",
+                                             PACKAGE_NAME,
+                                             PACKAGE_VERSION,
+                                             FWUPD_MAJOR_VERSION,
+                                             FWUPD_MINOR_VERSION,
+                                             FWUPD_MICRO_VERSION);
+       }
+       return user_agent;
+#else
        return PACKAGE_NAME "/" PACKAGE_VERSION;
+#endif
 }
 
 static void


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