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.
This commit is contained in:
Christian Dywan 2011-10-31 03:57:51 +01:00
parent 55227d2a3b
commit 42c1b70c7d
4 changed files with 76 additions and 45 deletions

View file

@ -3662,12 +3662,12 @@ list_video_formats ()
"var supported = function (format) { "
"var video = document.createElement('video');"
"return !!video.canPlayType && video.canPlayType (format) != 'no' };"
"'<tr><td>H264</td><td>' + "
"supported('video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"') + '</tr>' + "
"'<tr><td>Ogg Theora</td><td>' + "
"supported('video/ogg; codecs=\"theora, vorbis\"') + '</tr>' + "
"'<tr><td>WebM</td><td>' + "
"supported('video/webm; codecs=\"vp8, vorbis\"') + '</tr>'"
"' 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 (
"<html><head><title>about:version</title></head>"
"<body><h1>about:version</h1>"
@ -3902,8 +3890,8 @@ midori_view_set_uri (MidoriView* view,
"<img src=\"res://logo-shade.png\" "
"style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">"
"<table>"
"<tr><td>Command line</td><td>%s</td></tr>"
"<tr><td>Midori</td><td>" PACKAGE_VERSION "%s</td></tr>"
"<tr><td>Command&nbsp;line</td><td>%s</td></tr>"
"<tr><td>Midori</td><td>%s</td></tr>"
"<tr><td>WebKitGTK+</td><td>%d.%d.%d (%d.%d.%d)</td></tr>"
"<tr><td>GTK+</td><td>%d.%d.%d (%d.%d.%d)</td></tr>"
"<tr><td>Glib</td><td>%d.%d.%d (%d.%d.%d)</td></tr>"
@ -3911,18 +3899,16 @@ midori_view_set_uri (MidoriView* view,
"<tr><td>libnotify</td><td>%s</td></tr>"
"<tr><td>libunique</td><td>%s</td></tr>"
"<tr><td>libhildon</td><td>%s</td></tr>"
"<tr><td>Platform</td><td>%s</td></tr>"
"<tr><td>Platform</td><td>%s %s %s</td></tr>"
"<tr><td>Identification</td><td>%s</td></tr>"
"<tr><td>Video&nbsp;Formats</td><td>%s</td></tr>"
"</table>"
"<h2>Netscape Plugins:</h2><table>%s</table>"
"<h2>Video Formats:</h2><table>%s</table>"
"</body></html>",
_("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);
}

View file

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

View file

@ -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__ */

17
wscript
View file

@ -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: