[gnome-software] trivial: Allow plugins to use gs_user_agent()



commit 8bb9e738091eae688a8786a81ffdc6db2e6a0b21
Author: Richard Hughes <richard hughsie com>
Date:   Tue Mar 7 09:26:03 2017 +0000

    trivial: Allow plugins to use gs_user_agent()

 src/gs-common.c       |    6 ------
 src/gs-common.h       |    1 -
 src/gs-details-page.c |    1 +
 src/gs-page.c         |    1 +
 src/gs-utils.c        |   13 +++++++++++++
 src/gs-utils.h        |    1 +
 6 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/src/gs-common.c b/src/gs-common.c
index 5644519..cc8b11e 100644
--- a/src/gs-common.c
+++ b/src/gs-common.c
@@ -446,12 +446,6 @@ gs_utils_widget_set_css_app (GsApp *app,
        gs_utils_widget_set_css_internal (widget, class_name, str->str);
 }
 
-const gchar *
-gs_user_agent (void)
-{
-       return PACKAGE_NAME "/" PACKAGE_VERSION;
-}
-
 static void
 do_not_expand (GtkWidget *child, gpointer data)
 {
diff --git a/src/gs-common.h b/src/gs-common.h
index d0025e2..7d5d335 100644
--- a/src/gs-common.h
+++ b/src/gs-common.h
@@ -48,7 +48,6 @@ void  gs_image_set_from_pixbuf_with_scale     (GtkImage               *image,
 void   gs_image_set_from_pixbuf                (GtkImage               *image,
                                                 const GdkPixbuf        *pixbuf);
 
-const gchar    *gs_user_agent                  (void);
 gboolean        gs_utils_is_current_desktop    (const gchar    *name);
 void            gs_utils_widget_set_css_app    (GsApp          *app,
                                                 GtkWidget      *widget,
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 7f865e4..20989c3 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -39,6 +39,7 @@
 #include "gs-review-histogram.h"
 #include "gs-review-dialog.h"
 #include "gs-review-row.h"
+#include "gs-utils.h"
 
 /* the number of reviews to show before clicking the 'More Reviews' button */
 #define SHOW_NR_REVIEWS_INITIAL                4
diff --git a/src/gs-page.c b/src/gs-page.c
index d6b0403..72daf6e 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -30,6 +30,7 @@
 #include "gs-common.h"
 #include "gs-auth-dialog.h"
 #include "gs-screenshot-image.h"
+#include "gs-utils.h"
 
 typedef struct
 {
diff --git a/src/gs-utils.c b/src/gs-utils.c
index 97138bf..de02d71 100644
--- a/src/gs-utils.c
+++ b/src/gs-utils.c
@@ -933,4 +933,17 @@ gs_utils_get_url_path (const gchar *url)
        return g_strdup (path);
 }
 
+/**
+ * gs_user_agent:
+ *
+ * Gets the user agent to use for remote requests.
+ *
+ * Returns: the user-agent, e.g. "gnome-software/3.22.1"
+ */
+const gchar *
+gs_user_agent (void)
+{
+       return PACKAGE_NAME "/" PACKAGE_VERSION;
+}
+
 /* vim: set noexpandtab: */
diff --git a/src/gs-utils.h b/src/gs-utils.h
index a9cb783..a4e1fb9 100644
--- a/src/gs-utils.h
+++ b/src/gs-utils.h
@@ -82,6 +82,7 @@ gboolean       gs_utils_error_convert_appstream (GError       **perror);
 
 gchar          *gs_utils_get_url_scheme        (const gchar    *url);
 gchar          *gs_utils_get_url_path          (const gchar    *url);
+const gchar    *gs_user_agent                  (void);
 
 G_END_DECLS
 


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