[Xfce4-commits] <midori:master> List available about: URLs in about:version
Christian Dywan
noreply at xfce.org
Tue Apr 10 22:34:01 CEST 2012
Updating branch refs/heads/master
to 12d49e36c266cd72b222da8661685e4042e3e05d (commit)
from 89dbbcc1b0c485ab9b22e190096b79751e734ff2 (commit)
commit 12d49e36c266cd72b222da8661685e4042e3e05d
Author: Christian Dywan <christian at twotoasts.de>
Date: Tue Apr 10 21:54:38 2012 +0200
List available about: URLs in about:version
Strings are built with GString to avoid printf limits.
midori/midori-view.c | 52 +++++++++++++++++++++++++++++++++----------------
1 files changed, 35 insertions(+), 17 deletions(-)
diff --git a/midori/midori-view.c b/midori/midori-view.c
index 35c0885..fb10fb5 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -3790,11 +3790,13 @@ midori_view_construct_web_view (MidoriView* view)
NULL);
}
-static gchar*
-list_netscape_plugins (JSContextRef js_context)
+static void
+list_netscape_plugins (GString* ns_plugins,
+ JSContextRef js_context)
{
- if (midori_web_settings_has_plugin_support ())
- {
+ if (!midori_web_settings_has_plugin_support ())
+ return;
+
/* Joins available plugins like this: URI1|title1,URI2|title2 */
gchar* value = sokoke_js_script_eval (js_context,
"function plugins (l) { var f = new Array (); for (var i in l) "
@@ -3803,7 +3805,7 @@ list_netscape_plugins (JSContextRef js_context)
"plugins (navigator.plugins)", NULL);
gchar** items = g_strsplit (value, ",", 0);
guint i = 0;
- GString* ns_plugins = g_string_new ("<h2>Netscape Plugins:</h2><table>");
+ g_string_append (ns_plugins, "<h2>Netscape Plugins:</h2><table>");
if (items != NULL)
while (items[i] != NULL)
{
@@ -3824,16 +3826,12 @@ list_netscape_plugins (JSContextRef js_context)
g_string_append (ns_plugins, "</table>");
g_strfreev (items);
g_free (value);
- return g_string_free (ns_plugins, FALSE);
- }
- else
- return g_strdup ("");
}
-static const gchar*
-list_geolocation ()
+static void
+list_geolocation (GString* markup)
{
- return
+ g_string_append (markup,
"<a href=\"http://dev.w3.org/geo/api/spec-source.html\" id=\"method\"></a>"
"<span id=\"locationInfo\"><noscript>No Geolocation without Javascript</noscript></span>"
"<script>"
@@ -3864,7 +3862,7 @@ list_geolocation ()
" }"
"} else"
" document.getElementById('locationInfo').innerHTML = 'Geolocation unavailable';"
- "</script>";
+ "</script>");
}
static gchar*
@@ -3885,6 +3883,23 @@ list_video_formats (JSContextRef js_context)
return value;
}
+static const gchar* valid_about_uris[] = {
+ "about:widgets",
+ "about:private",
+ "error:nodocs",
+ "http://.invalid",
+};
+
+static void
+list_about_uris (GString* markup)
+{
+ g_string_append (markup, "<p>");
+ guint i;
+ for (i = 0; i < G_N_ELEMENTS (valid_about_uris); i++)
+ g_string_append_printf (markup, "<a href=\"%s\">%s</a> ",
+ valid_about_uris[i], valid_about_uris[i]);
+}
+
static gchar*
prepare_speed_dial_html (MidoriView* view,
gboolean load_missing)
@@ -4168,8 +4183,11 @@ 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* netscape_plugins = list_netscape_plugins (js_context);
gchar* video_formats = list_video_formats (js_context);
+ GString* more = g_string_new ("");
+ list_netscape_plugins (more, js_context);
+ list_geolocation (more);
+ list_about_uris (more);
katze_assign (view->uri, g_strdup (uri));
data = g_strdup_printf (
@@ -4193,7 +4211,7 @@ midori_view_set_uri (MidoriView* view,
"<tr><td>Identification</td><td>%s</td></tr>"
"<tr><td>Video Formats</td><td>%s</td></tr>"
"</table>"
- "%s %s"
+ "%s"
"</body></html>",
_("Version numbers in brackets show the version used at runtime."),
command_line,
@@ -4220,12 +4238,12 @@ midori_view_set_uri (MidoriView* view,
"Sockets",
#endif
platform, sys_name, architecture ? architecture : "", ident,
- video_formats, list_geolocation (), netscape_plugins);
+ video_formats, (gchar*)(more->str));
g_free (command_line);
g_free (arguments);
g_free (ident);
- g_free (netscape_plugins);
g_free (video_formats);
+ g_string_free (more, TRUE);
}
else
{
More information about the Xfce4-commits
mailing list