[Xfce4-commits] <midori:master> List versions from about:version in --version
Christian Dywan
noreply at xfce.org
Thu Feb 21 00:40:02 CET 2013
Updating branch refs/heads/master
to 5c6d70db33a1c5eaabfae6399cff8dd0e2b1d113 (commit)
from 321f75980abedfe0be33ffd103ca2746c721a6a0 (commit)
commit 5c6d70db33a1c5eaabfae6399cff8dd0e2b1d113
Author: Christian Dywan <christian at twotoasts.de>
Date: Thu Feb 21 00:36:45 2013 +0100
List versions from about:version in --version
midori/main.c | 7 ++-
midori/midori-view.c | 117 +++++++++++++++++++++++++-------------------------
midori/midori-view.h | 4 ++
3 files changed, 68 insertions(+), 60 deletions(-)
diff --git a/midori/main.c b/midori/main.c
index 8a7d5e6..9037abd 100644
--- a/midori/main.c
+++ b/midori/main.c
@@ -141,14 +141,17 @@ main (int argc,
if (version)
{
+ GString* versions = g_string_new ("");
+ midori_view_list_versions (versions, FALSE);
+ g_print ("%s\n", versions->str);
+ g_string_free (versions, TRUE);
+
g_print (
- "%s %s\n\n"
"Copyright (c) 2007-2012 Christian Dywan\n\n"
"%s\n"
"\t%s\n\n"
"%s\n"
"\thttp://www.midori-browser.org\n",
- _("Midori"), PACKAGE_VERSION,
_("Please report comments, suggestions and bugs to:"),
PACKAGE_BUGREPORT,
_("Check for new versions at:")
diff --git a/midori/midori-view.c b/midori/midori-view.c
index 4de318e..6aae10b 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -3678,6 +3678,47 @@ midori_view_constructor (GType type,
}
static void
+midori_view_add_version (GString* markup,
+ gboolean html,
+ gchar* text)
+{
+ if (html)
+ g_string_append (markup, "<tr><td>");
+ g_string_append (markup, text);
+ if (html)
+ g_string_append (markup, "</td></tr>");
+ else
+ g_string_append_c (markup, '\n');
+ g_free (text);
+}
+
+void
+midori_view_list_versions (GString* markup,
+ gboolean html)
+{
+ midori_view_add_version (markup, html, g_strdup_printf ("%s %s (%s)",
+ _("Midori"), PACKAGE_VERSION, midori_app_get_name (NULL)));
+ midori_view_add_version (markup, html, g_strdup_printf ("GTK+ %s (%u.%u.%u)\tGlib %s (%u.%u.%u)",
+ GTK_VERSION, gtk_major_version, gtk_minor_version, gtk_micro_version,
+ GIO_VERSION, glib_major_version, glib_minor_version, glib_micro_version));
+ midori_view_add_version (markup, html, g_strdup_printf ("WebKitGTK+ %s (%u.%u.%u)\tlibSoup %s",
+ WEBKIT_VERSION, webkit_major_version (), webkit_minor_version (), webkit_micro_version (),
+ LIBSOUP_VERSION));
+ midori_view_add_version (markup, html, g_strdup_printf ("cairo %s (%s)\tlibnotify %s",
+ CAIRO_VERSION_STRING, cairo_version_string (),
+ LIBNOTIFY_VERSION));
+ midori_view_add_version (markup, html, g_strdup_printf ("gcr %s\tgranite %s",
+ GCR_VERSION, GRANITE_VERSION));
+ midori_view_add_version (markup, html, g_strdup_printf ("single instance %s",
+ #if HAVE_UNIQUE
+ "libunique " UNIQUE_VERSION
+ #else
+ "Sockets"
+ #endif
+ ));
+}
+
+static void
list_netscape_plugins (GString* ns_plugins,
JSContextRef js_context)
{
@@ -3964,39 +4005,7 @@ midori_view_set_uri (MidoriView* view,
gchar* ident = katze_object_get_string (view->settings, "user-agent");
WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view));
JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
- gchar* video_formats = list_video_formats (js_context);
-
- /* FIXME: This is for workarounding a crash deeper down the callstack on some systems. */
- static char const * const version_format_strings[] = {
- " libsoup %s</td></tr>",
- "<tr><td>cairo</td><td>%s ", "(%s)</td></tr>",
- "<tr><td>gcr</td><td>%s</td></tr>",
- "<tr><td>granite</td><td>%s</td></tr>",
- "<tr><td>libnotify</td><td>%s</td></tr>",
- "<tr><td>single instance</td><td>%s</td></tr>",
- "<tr><td>Platform</td><td>%s ", "%s ", "%s</td></tr>",
- "<tr><td>Identification</td><td><code>%s</code></td></tr>",
- "<tr><td>Video Formats</td><td>%s</td></tr>",
- };
- gchar const* version_strings[] = {
- LIBSOUP_VERSION,
- CAIRO_VERSION_STRING, cairo_version_string (),
- GCR_VERSION,
- GRANITE_VERSION,
- LIBNOTIFY_VERSION,
- #if HAVE_UNIQUE
- "libunique " UNIQUE_VERSION,
- #else
- "Sockets",
- #endif
- platform, sys_name, architecture ? architecture : "", ident,
- video_formats,
- };
- gsize i = 0;
GString * tmp = g_string_new ("");
- GString* more = g_string_new ("");
- list_netscape_plugins (more, js_context);
- list_about_uris (more);
g_string_append_printf (tmp,
"<html><head><title>about:version</title></head>"
@@ -4004,36 +4013,28 @@ midori_view_set_uri (MidoriView* view,
"<p>%s</p>"
"<img src=\"res://logo-shade.png\" "
"style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">"
- "<table>"
- "<tr><td>Command line</td><td><code>%s</code></td></tr>"
- "<tr><td>Midori</td><td>%s (%s)</td></tr>"
- "<tr><td>GTK+</td><td>%d.%d.%d (%d.%d.%d)"
- " Glib %d.%d.%d (%d.%d.%d)</td></tr>"
- "<tr><td>WebKitGTK+</td><td>%d.%d.%d (%d.%d.%d)",
- _("Version numbers in brackets show the version used at runtime."),
- command_line,
- PACKAGE_VERSION, midori_app_get_name (NULL),
- GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION,
- gtk_major_version, gtk_minor_version, gtk_micro_version,
- GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION,
- glib_major_version, glib_minor_version, glib_micro_version,
- WEBKIT_MAJOR_VERSION, WEBKIT_MINOR_VERSION, WEBKIT_MICRO_VERSION,
- webkit_major_version (), webkit_minor_version (), webkit_micro_version ());
-
- for (i = 0;
- i < sizeof (version_format_strings) / sizeof (version_format_strings[0]);
- ++i)
- g_string_append_printf (tmp, version_format_strings[i], version_strings[i]);
-
- g_string_append_printf (
- tmp, "</table>%s</body></html>", (gchar*)(more->str));
-
+ "<table>",
+ _("Version numbers in brackets show the version used at runtime."));
+ midori_view_add_version (tmp, TRUE, g_strdup_printf ("Command line %s",
+ command_line));
+ midori_view_list_versions (tmp, TRUE);
+ midori_view_add_version (tmp, TRUE, g_strdup_printf ("Platform %s %s %s",
+ platform, sys_name, architecture ? architecture : ""));
+ midori_view_add_version (tmp, TRUE, g_strdup_printf ("Identification %s",
+ ident));
+ midori_view_add_version (tmp, TRUE, g_strdup_printf ("Video Formats %s",
+ list_video_formats (js_context)));
+ g_string_append (tmp, "</table>");
+
+ list_netscape_plugins (tmp, js_context);
+ list_about_uris (tmp);
+ /* TODO: list active extensions */
+
+ g_string_append (tmp, "</body></html>");
data = g_string_free (tmp, FALSE);
g_free (command_line);
g_free (ident);
- g_free (video_formats);
- g_string_free (more, TRUE);
}
else
{
diff --git a/midori/midori-view.h b/midori/midori-view.h
index 40ede7c..0101ec5 100644
--- a/midori/midori-view.h
+++ b/midori/midori-view.h
@@ -234,6 +234,10 @@ midori_view_fallback_extension (MidoriView* view,
GList*
midori_view_get_resources (MidoriView* view);
+void
+midori_view_list_versions (GString* markup,
+ gboolean html);
+
G_END_DECLS
#endif /* __MIDORI_VIEW_H__ */
More information about the Xfce4-commits
mailing list