[epiphany] Append '(WebappShell)' to User-Agent when running in web app mode
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Append '(WebappShell)' to User-Agent when running in web app mode
- Date: Fri, 3 Jun 2016 23:41:10 +0000 (UTC)
commit dc0aef57257a582ee03aa251a514349a804c6dea
Author: Daniel Aleksandersen <code daniel priv no>
Date: Sat Jun 4 00:17:02 2016 +0200
Append '(WebappShell)' to User-Agent when running in web app mode
https://bugzilla.gnome.org/show_bug.cgi?id=767123
embed/ephy-embed-prefs.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/embed/ephy-embed-prefs.c b/embed/ephy-embed-prefs.c
index 044761f..da5635c 100644
--- a/embed/ephy-embed-prefs.c
+++ b/embed/ephy-embed-prefs.c
@@ -182,6 +182,7 @@ webkit_pref_callback_user_agent (GSettings *settings,
gpointer data)
{
char *value;
+ char *user_agent;
const char *internal_user_agent;
value = g_settings_get_string (settings, key);
@@ -194,10 +195,20 @@ webkit_pref_callback_user_agent (GSettings *settings,
internal_user_agent = webkit_pref_get_internal_user_agent ();
if (internal_user_agent)
- webkit_settings_set_user_agent (webkit_settings, internal_user_agent);
+ user_agent = g_strdup (internal_user_agent);
else
- webkit_settings_set_user_agent_with_application_details (webkit_settings,
- "Epiphany", VERSION);
+ user_agent = g_strdup_printf ("%s Epiphany/%s",
+ webkit_settings_get_user_agent (webkit_settings),
+ VERSION);
+
+ if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) ==
+ EPHY_EMBED_SHELL_MODE_APPLICATION) {
+ char *user_agent_old = user_agent;
+ user_agent = g_strdup_printf ("%s (WebappShell)", user_agent);
+ g_free (user_agent_old);
+ }
+ webkit_settings_set_user_agent (webkit_settings, user_agent);
+ g_free (user_agent);
}
static gdouble
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]