From dab3505e0c99a2a275229fd1c1062c448e7e99ae Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Tue, 12 Jan 2010 23:22:50 +0100 Subject: [PATCH] Store argument vector and display it in about:version --- midori/main.c | 3 +++ midori/midori-view.c | 7 +++++++ midori/sokoke.c | 19 +++++++++++++++++++ midori/sokoke.h | 3 +++ 4 files changed, 32 insertions(+) diff --git a/midori/main.c b/midori/main.c index 21f0cc4e..6537aa8c 100644 --- a/midori/main.c +++ b/midori/main.c @@ -1763,6 +1763,9 @@ main (int argc, #endif #endif + /* Preserve argument vector */ + sokoke_get_argv (argv); + /* Parse cli options */ webapp = NULL; config = NULL; diff --git a/midori/midori-view.c b/midori/midori-view.c index 30b7c162..22a03571 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -3226,6 +3226,8 @@ midori_view_set_uri (MidoriView* view, } else if (!strcmp (uri, "about:version")) { + gchar** argument_vector = sokoke_get_argv (NULL); + gchar* command_line = g_strjoinv (" ", argument_vector); gchar* ident = katze_object_get_string (view->settings, "ident-string"); #if defined (G_OS_WIN32) gchar* sys_name = g_strdup ("Windows"); @@ -3261,6 +3263,7 @@ midori_view_set_uri (MidoriView* view, "" "" + "" "" "" "" @@ -3275,6 +3278,7 @@ midori_view_set_uri (MidoriView* view, "" "
Command line%s
Midori" PACKAGE_VERSION "%s
WebKitGTK+%d.%d.%d (%d.%d.%d)
GTK+%d.%d.%d (%d.%d.%d)
Identification%s
" "", + command_line, DEBUGGING, WEBKIT_MAJOR_VERSION, WEBKIT_MINOR_VERSION, @@ -3293,6 +3297,9 @@ midori_view_set_uri (MidoriView* view, HAVE_UNIQUE ? "Yes" : "No", HAVE_HILDON ? "Yes" : "No", sys_name, ident); + g_free (command_line); + g_free (ident); + g_free (sys_name); } else { diff --git a/midori/sokoke.c b/midori/sokoke.c index db185997..a9fba356 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -1384,6 +1384,25 @@ sokoke_find_data_filename (const gchar* filename) return g_build_filename (MDATADIR, filename, NULL); } +/** + * sokoke_get_argv: + * @argument_vector: %NULL + * + * Retrieves the argument vector passed at program startup. + * + * Return value: the argument vector + **/ +gchar** +sokoke_get_argv (gchar** argument_vector) +{ + static gchar** stored_argv = NULL; + + if (!stored_argv) + stored_argv = g_strdupv (argument_vector); + + return stored_argv; +} + #if !WEBKIT_CHECK_VERSION (1, 1, 14) static void res_server_handler_cb (SoupServer* res_server, diff --git a/midori/sokoke.h b/midori/sokoke.h index 1960650e..486dd5cf 100644 --- a/midori/sokoke.h +++ b/midori/sokoke.h @@ -183,6 +183,9 @@ sokoke_find_config_filename (const gchar* folder, gchar* sokoke_find_data_filename (const gchar* filename); +gchar** +sokoke_get_argv (gchar** argument_vector); + #if !WEBKIT_CHECK_VERSION (1, 1, 14) SoupServer* sokoke_get_res_server (void);