[gnome-software/gnome-3-24] trivial: Include the fwupd version in the useragent
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-24] trivial: Include the fwupd version in the useragent
- Date: Fri, 16 Feb 2018 20:47:33 +0000 (UTC)
commit ac645199fd14290a9b6fad469901e9cbeb28cc71
Author: Richard Hughes <richard hughsie com>
Date: Fri Feb 16 20:45:09 2018 +0000
trivial: Include the fwupd version in the useragent
See https://blogs.gnome.org/hughsie/2018/02/16/ for more details.
lib/Makefile.am | 2 +-
lib/gs-utils.c | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 0a1bad1a..e9a529af 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -60,7 +60,7 @@ libgnomesoftware_a_SOURCES = \
gs-utils.c \
gs-utils.h
-libgnomesoftware_a_CFLAGS = $(GS_PRIVATE_CFLAGS)
+libgnomesoftware_a_CFLAGS = $(GS_PRIVATE_CFLAGS) $(FWUPD_CFLAGS)
libexec_PROGRAMS = \
gnome-software-cmd
diff --git a/lib/gs-utils.c b/lib/gs-utils.c
index a6e50901..ea5822dd 100644
--- a/lib/gs-utils.c
+++ b/lib/gs-utils.c
@@ -43,6 +43,10 @@
#include <polkit/polkit.h>
#endif
+#ifdef HAVE_FIRMWARE
+#include <fwupd.h>
+#endif
+
#include "gs-app.h"
#include "gs-utils.h"
#include "gs-plugin.h"
@@ -944,7 +948,20 @@ gs_utils_get_url_path (const gchar *url)
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
}
/* vim: set noexpandtab: */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]