web-page: Append GIMP to the user agent string

This commit is contained in:
Mukund Sivaraman 2011-04-01 16:24:02 +05:30
parent d03d804b92
commit 796038b216
1 changed files with 15 additions and 1 deletions

View File

@ -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);