From: Christian Dywan Date: Mon, 13 Apr 2009 02:38:01 +0000 (+0200) Subject: Implement "-a" or "--app" to run web apps X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94c1d3c7131252499a6adac5d3554344bbcbde67;p=midori Implement "-a" or "--app" to run web apps At the moment this takes an URI and opens a standalone window with a non-editable toolbar and a statusbar. --- diff --git a/midori/main.c b/midori/main.c index 57480bd8..cab8d0af 100644 --- a/midori/main.c +++ b/midori/main.c @@ -1322,6 +1322,7 @@ int main (int argc, char** argv) { + gchar* webapp; gchar* config; gboolean run; gboolean version; @@ -1331,6 +1332,8 @@ main (int argc, GError* error; GOptionEntry entries[] = { + { "app", 'a', 0, G_OPTION_ARG_STRING, &webapp, + N_("Run ADDRESS as a web application"), N_("ADDRESS") }, { "config", 'c', 0, G_OPTION_ARG_FILENAME, &config, N_("Use FOLDER as configuration folder"), N_("FOLDER") }, { "run", 'r', 0, G_OPTION_ARG_NONE, &run, @@ -1373,6 +1376,7 @@ main (int argc, #endif /* Parse cli options */ + webapp = NULL; config = NULL; run = FALSE; version = FALSE; @@ -1408,6 +1412,29 @@ main (int argc, return 0; } + /* Web Application support */ + if (webapp) + { + MidoriBrowser* browser = midori_browser_new (); + settings = katze_object_get_object (browser, "settings"); + g_object_set (settings, + "show-menubar", FALSE, + "show-navigationbar", TRUE, + "toolbar-items", "Back,Forward,ReloadStop,Location", + "show-statusbar", TRUE, + NULL); + g_object_unref (settings); + g_object_set (browser, "settings", settings, NULL); + midori_browser_add_uri (browser, webapp); + g_object_set_data (G_OBJECT (browser), "locked", (void*)1); + g_signal_connect (browser, "destroy", + G_CALLBACK (gtk_main_quit), NULL); + gtk_widget_show (GTK_WIDGET (browser)); + midori_browser_activate_action (browser, "Location"); + gtk_main (); + return 0; + } + /* Standalone javascript support */ if (run) return midori_run_script (uris ? *uris : NULL); diff --git a/midori/midori-browser.c b/midori/midori-browser.c index f13820be..caa81ed6 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -1943,6 +1943,10 @@ midori_browser_toolbar_popup_context_menu_cb (GtkWidget* widget, GtkWidget* menu; GtkWidget* menuitem; + /* Unsupported trick used for web app mode */ + if (g_object_get_data (G_OBJECT (browser), "locked")) + return FALSE; + menu = gtk_menu_new (); menuitem = sokoke_action_create_popup_menu_item ( _action_by_name (browser, "Menubar"));