[Xfce4-commits] <postler:master> Use system name and Webkit version in user agent
Christian Dywan
noreply at xfce.org
Wed Dec 1 03:24:05 CET 2010
Updating branch refs/heads/master
to 40de7ed60c3cbb7d769e39b05591687d3981f99f (commit)
from 3129af78323aa2f762eb231909fa084792011755 (commit)
commit 40de7ed60c3cbb7d769e39b05591687d3981f99f
Author: Christian Dywan <christian at twotoasts.de>
Date: Tue Nov 30 23:34:55 2010 +0100
Use system name and Webkit version in user agent
postler/postler-app.vala | 12 ++++++++----
postler/postler.vapi | 13 +++++++++++++
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/postler/postler-app.vala b/postler/postler-app.vala
index 1378e5e..d3ad3c5 100644
--- a/postler/postler-app.vala
+++ b/postler/postler-app.vala
@@ -111,10 +111,14 @@ public class Postler.App : Unique.App {
}
public static string get_user_agent () {
- /* FIXME: Define the user agent properly */
- return "%s/%s (X11; Linux; U; %s) WebKit/531.2+".
- printf (Config.PACKAGE_NAME, Config.PACKAGE_VERSION,
- Pango.Language.get_default ().to_string ());
+ return "%s/%s (%s; %s; U; %s) WebKit/%d.%d+".
+ printf (Config.PACKAGE_NAME,
+ Config.PACKAGE_VERSION.substring (0, 3),
+ "X11", /* FIXME: Determine window system */
+ Posix.utsname ().sysname,
+ Pango.Language.get_default ().to_string (),
+ WebKit.USER_AGENT_MAJOR_VERSION,
+ WebKit.USER_AGENT_MINOR_VERSION);
}
public static bool show_uri (Gdk.Screen screen, string uri) {
diff --git a/postler/postler.vapi b/postler/postler.vapi
index 0a22602..9caf57d 100644
--- a/postler/postler.vapi
+++ b/postler/postler.vapi
@@ -25,3 +25,16 @@ namespace Gdk {
void* a, void* b) throws GLib.Error;
}
+[CCode (cprefix = "", lower_case_cprefix = "")]
+namespace Posix {
+ [CCode (cname = "struct utsname", cheader_filename = "sys/utsname.h")]
+ public struct utsname {
+ public unowned string sysname;
+ public unowned string nodename;
+ public unowned string release;
+ public unowned string version;
+ public unowned string machine;
+ [CCode (cname = "uname")]
+ public utsname ();
+ }
+}
More information about the Xfce4-commits
mailing list