[gimp] web-page: Append GIMP to the user agent string



commit 796038b216d8f333b880150a5185a3b84f26a94d
Author: Mukund Sivaraman <muks banu com>
Date:   Fri Apr 1 16:24:02 2011 +0530

    web-page: Append GIMP to the user agent string

 plug-ins/common/web-page.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/plug-ins/common/web-page.c b/plug-ins/common/web-page.c
index 614d2e9..86197d9 100644
--- a/plug-ins/common/web-page.c
+++ b/plug-ins/common/web-page.c
@@ -22,7 +22,6 @@
  *
  * TODO:
  * - Add a font scale combo: default, larger, smaller etc.
- * - Set GIMP as user agent
  */
 
 #include "config.h"
@@ -369,6 +368,9 @@ webpage_capture (void)
   gchar *scheme;
   GtkWidget *window;
   GtkWidget *view;
+  WebKitWebSettings *settings;
+  char *ua_old;
+  char *ua;
 
   if (webpixbuf)
     {
@@ -424,6 +426,18 @@ webpage_capture (void)
   gtk_widget_set_size_request (view, webpagevals.width, -1);
   gtk_container_add (GTK_CONTAINER (window), view);
 
+  /* Append "GIMP/<GIMP_VERSION>" to the user agent string */
+  settings = webkit_web_view_get_settings (WEBKIT_WEB_VIEW (view));
+  g_object_get (settings,
+                "user-agent", &ua_old,
+                NULL);
+  ua = g_strdup_printf ("%s GIMP/%s", ua_old, GIMP_VERSION);
+  g_object_set (settings,
+                "user-agent", ua,
+                NULL);
+  g_free (ua_old);
+  g_free (ua);
+
   g_signal_connect (view, "notify::progress",
                     G_CALLBACK (notify_progress_cb),
                     window);



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