From 42c1b70c7d7c10246b2c7b7a3116ac9e9c6cc06b Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Mon, 31 Oct 2011 03:57:51 +0100 Subject: [PATCH] unique, notify, and system details in about:version Introduce midori_web_settings_get_system_name helper. Add version numbers for libunique and libnotify if available. Show platform and architecture if possible. Merge debug string into the full version number. Render video formats as a one-liner. --- midori/midori-view.c | 54 +++++++++++++------------------------ midori/midori-websettings.c | 46 +++++++++++++++++++++++++------ midori/midori-websettings.h | 4 +++ wscript | 17 ++++++++++-- 4 files changed, 76 insertions(+), 45 deletions(-) diff --git a/midori/midori-view.c b/midori/midori-view.c index 3f73dfbd..9c537e65 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -3662,12 +3662,12 @@ list_video_formats () "var supported = function (format) { " "var video = document.createElement('video');" "return !!video.canPlayType && video.canPlayType (format) != 'no' };" - "'H264' + " - "supported('video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"') + '' + " - "'Ogg Theora' + " - "supported('video/ogg; codecs=\"theora, vorbis\"') + '' + " - "'WebM' + " - "supported('video/webm; codecs=\"vp8, vorbis\"') + ''" + "' H264 ' + " + "supported('video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"') + " + "' Ogg Theora ' + " + "supported('video/ogg; codecs=\"theora, vorbis\"') + " + "' WebM ' + " + "supported('video/webm; codecs=\"vp8, vorbis\"')" "", NULL); gtk_widget_destroy (web_view); return value; @@ -3875,26 +3875,14 @@ midori_view_set_uri (MidoriView* view, { gchar** argument_vector = sokoke_get_argv (NULL); gchar* command_line = g_strjoinv (" ", argument_vector); + gchar* architecture, *platform; + const gchar* sys_name = midori_web_settings_get_system_name ( + &architecture, &platform); gchar* ident = katze_object_get_string (view->settings, "user-agent"); gchar* netscape_plugins = list_netscape_plugins (); gchar* video_formats = list_video_formats (); - #if defined (G_OS_WIN32) - gchar* sys_name = g_strdup ("Windows"); - #else - gchar* sys_name; - struct utsname name; - if (uname (&name) != -1) - sys_name = g_strdup_printf ("%s %s", name.sysname, name.machine); - else - sys_name = g_strdup ("Unix"); - #endif katze_assign (view->uri, g_strdup (uri)); - #ifdef G_ENABLE_DEBUG - #define DEBUGGING " (Debug)" - #else - #define DEBUGGING "" - #endif data = g_strdup_printf ( "about:version" "

about:version

" @@ -3902,8 +3890,8 @@ midori_view_set_uri (MidoriView* view, "" "" - "" - "" + "" + "" "" "" "" @@ -3911,18 +3899,16 @@ midori_view_set_uri (MidoriView* view, "" "" "" - "" + "" "" + "" "
Command line%s
Midori" PACKAGE_VERSION "%s
Command line%s
Midori%s
WebKitGTK+%d.%d.%d (%d.%d.%d)
GTK+%d.%d.%d (%d.%d.%d)
Glib%d.%d.%d (%d.%d.%d)
libnotify%s
libunique%s
libhildon%s
Platform%s
Platform%s %s %s
Identification%s
Video Formats%s
" "

Netscape Plugins:

%s
" - "

Video Formats:

%s
" "", _("Version numbers in brackets show the version used at runtime."), command_line, - DEBUGGING, - WEBKIT_MAJOR_VERSION, - WEBKIT_MINOR_VERSION, - WEBKIT_MICRO_VERSION, + PACKAGE_VERSION, + WEBKIT_MAJOR_VERSION, WEBKIT_MINOR_VERSION, WEBKIT_MICRO_VERSION, webkit_major_version (), webkit_minor_version (), webkit_micro_version (), @@ -3931,15 +3917,13 @@ midori_view_set_uri (MidoriView* view, GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION, glib_major_version, glib_minor_version, glib_micro_version, LIBSOUP_VERSION, - HAVE_LIBNOTIFY ? "Yes" : "No", - HAVE_UNIQUE ? "Yes" : "No", + LIBNOTIFY_VERSION, + UNIQUE_VERSION, HAVE_HILDON ? "Yes" : "No", - sys_name, ident, - netscape_plugins, - video_formats); + platform, sys_name, architecture ? architecture : "", ident, + video_formats, netscape_plugins); g_free (command_line); g_free (ident); - g_free (sys_name); g_free (netscape_plugins); g_free (video_formats); } diff --git a/midori/midori-websettings.c b/midori/midori-websettings.c index fea94627..9ef144ca 100644 --- a/midori/midori-websettings.c +++ b/midori/midori-websettings.c @@ -1159,9 +1159,10 @@ midori_web_settings_finalize (GObject* object) #if (!HAVE_OSX && defined (G_OS_UNIX)) || defined (G_OS_WIN32) static gchar* -get_sys_name (void) +get_sys_name (gchar** architecture) { static gchar* sys_name = NULL; + static gchar* sys_architecture = NULL; if (!sys_name) { @@ -1172,20 +1173,42 @@ get_sys_name (void) #else struct utsname name; if (uname (&name) != -1) - sys_name = g_strdup(name.sysname); + { + sys_name = g_strdup (name.sysname); + sys_architecture = g_strdup (name.machine); + } else sys_name = "Linux"; #endif } + + if (architecture != NULL) + *architecture = sys_architecture; return sys_name; } #endif -static gchar* -generate_ident_string (MidoriWebSettings* web_settings, - MidoriIdentity identify_as) +/** + * midori_web_settings_get_system_name: + * @architecture: location of a string, or %NULL + * @platform: location of a string, or %NULL + * + * Determines the system name, architecture and platform. + * @architecturce can have a %NULL value. + * + * Returns: a string + * + * Since: 0.4.2 + **/ +const gchar* +midori_web_settings_get_system_name (gchar** architecture, + gchar** platform) { - const gchar* platform = + if (architecture != NULL) + *architecture = NULL; + + if (platform != NULL) + *platform = #if HAVE_HILDON "Maemo;" #elif defined (G_OS_WIN32) @@ -1198,20 +1221,27 @@ generate_ident_string (MidoriWebSettings* web_settings, "X11;"; #endif - const gchar* os = + return #if HAVE_OSX "Mac OS X"; #elif defined (G_OS_UNIX) || defined (G_OS_WIN32) - get_sys_name (); + get_sys_name (architecture); #else "Linux"; #endif +} +static gchar* +generate_ident_string (MidoriWebSettings* web_settings, + MidoriIdentity identify_as) +{ const gchar* appname = "Midori/" G_STRINGIFY (MIDORI_MAJOR_VERSION) "." G_STRINGIFY (MIDORI_MINOR_VERSION); const gchar* lang = pango_language_to_string (gtk_get_default_language ()); + gchar* platform; + const gchar* os = midori_web_settings_get_system_name (NULL, &platform); const int webcore_major = WEBKIT_USER_AGENT_MAJOR_VERSION; const int webcore_minor = WEBKIT_USER_AGENT_MINOR_VERSION; diff --git a/midori/midori-websettings.h b/midori/midori-websettings.h index 5e343442..818b99f9 100644 --- a/midori/midori-websettings.h +++ b/midori/midori-websettings.h @@ -167,6 +167,10 @@ void midori_web_settings_remove_style (MidoriWebSettings* settings, const gchar* rule_id); +const gchar* +midori_web_settings_get_system_name (gchar** architecture, + gchar** platform); + G_END_DECLS #endif /* __MIDORI_WEB_SETTINGS_H__ */ diff --git a/wscript b/wscript index 6c3073a2..584571e5 100644 --- a/wscript +++ b/wscript @@ -178,8 +178,12 @@ def configure (conf): unique = ['N/A', 'yes'][conf.env['HAVE_UNIQUE'] == 1] if unique != 'yes': option_checkfatal ('unique', 'single instance') + conf.define ('UNIQUE_VERSION', 'No') + else: + conf.define ('UNIQUE_VERSION', conf.check_cfg (modversion='unique-1.0')) else: unique = 'no ' + conf.define ('UNIQUE_VERSION', 'No') conf.define ('HAVE_UNIQUE', [0,1][unique == 'yes']) if option_enabled ('libnotify'): @@ -187,8 +191,12 @@ def configure (conf): libnotify = ['N/A','yes'][conf.env['HAVE_LIBNOTIFY'] == 1] if libnotify != 'yes': option_checkfatal ('libnotify', 'notifications') + conf.define ('LIBNOTIFY_VERSION', 'No') + else: + conf.define ('LIBNOTIFY_VERSION', conf.check_cfg (modversion='libnotify')) else: libnotify = 'no ' + conf.define ('LIBNOTIFY_VERSION', 'No') conf.define ('HAVE_LIBNOTIFY', [0,1][libnotify == 'yes']) conf.check (lib='m', mandatory=True) @@ -272,7 +280,6 @@ def configure (conf): else: conf.check (header_name='signal.h') - conf.define ('PACKAGE_VERSION', VERSION_FULL) conf.define ('PACKAGE_NAME', APPNAME) conf.define ('PACKAGE_BUGREPORT', 'https://bugs.launchpad.net/midori') conf.define ('GETTEXT_PACKAGE', APPNAME) @@ -282,7 +289,6 @@ def configure (conf): conf.define ('MIDORI_MINOR_VERSION', minor) conf.define ('MIDORI_MICRO_VERSION', micro) - conf.write_config_header ('config.h') conf.env.append_value ('CCFLAGS', '-DHAVE_CONFIG_H -include config.h'.split ()) debug_level = Options.options.debug_level compiler = conf.env['CC_NAME'] @@ -291,6 +297,13 @@ def configure (conf): sys.exit (1) elif debug_level == '': debug_level = 'debug' + + if debug_level == 'full': + conf.define ('PACKAGE_VERSION', '%s (debug)' % VERSION_FULL) + else: + conf.define ('PACKAGE_VERSION', VERSION_FULL) + conf.write_config_header ('config.h') + if compiler == 'gcc': if debug_level == 'none': if 'CCFLAGS' in os.environ: