From 18ec1f25cb133d0719d31a945df5cfd084edda22 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sat, 12 Dec 2009 21:56:11 +0100 Subject: [PATCH] Add primitive Private Browsing based on Midori web app mode Essentially it's just an instance of Midori that doesn't load or write any preferences or personal data. The main drawback is that it doesn't load any extensions either. --- midori/midori-browser.c | 26 +++++++++++++++----------- midori/midori-view.c | 3 +++ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 13ad8350..ae3e516b 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -2165,6 +2165,15 @@ _action_tab_new_activate (GtkAction* action, midori_browser_set_current_page (browser, n); } +static void +_action_private_browsing_activate (GtkAction* action, + MidoriBrowser* browser) +{ + const gchar* uri = midori_browser_get_current_uri (browser); + /* FIXME: Use the same binary that is running right now */ + sokoke_spawn_program ("midori -a", uri, FALSE); +} + static void _action_open_activate (GtkAction* action, MidoriBrowser* browser) @@ -3033,14 +3042,13 @@ _action_compact_menu_populate_popup (GtkAction* action, static const GtkActionEntry actions[] = { { "TabNew" }, { "WindowNew" }, + { "PrivateBrowsing" }, { "Open" }, #if HAVE_HILDON { "Find" }, #else { "Print" }, { "About" }, - { "PrivateBrowsing" }, - { "ManageSearchEngines" }, { NULL }, { "Menubar" }, { "Bookmarkbar" }, @@ -4888,6 +4896,10 @@ static const GtkActionEntry entries[] = { { "TabNew", STOCK_TAB_NEW, NULL, "t", N_("Open a new tab"), G_CALLBACK (_action_tab_new_activate) }, + { "PrivateBrowsing", NULL, + N_("P_rivate Browsing"), "n", + N_("Don't save any private data while browsing"), + G_CALLBACK (_action_private_browsing_activate), }, { "Open", GTK_STOCK_OPEN, NULL, "o", N_("Open a file"), G_CALLBACK (_action_open_activate) }, @@ -5058,12 +5070,6 @@ static const GtkActionEntry entries[] = { static const guint entries_n = G_N_ELEMENTS (entries); static const GtkToggleActionEntry toggle_entries[] = { - { "PrivateBrowsing", NULL, - N_("P_rivate Browsing"), "", - N_("Don't save any private data while browsing"), - NULL/*G_CALLBACK (_action_private_browsing_activate)*/, - FALSE }, - { "Menubar", NULL, N_("_Menubar"), "", N_("Show menubar"), G_CALLBACK (_action_menubar_activate), @@ -5215,6 +5221,7 @@ static const gchar* ui_markup = "" "" "" + "" "" "" "" @@ -5226,7 +5233,6 @@ static const gchar* ui_markup = "" "" "" - "" "" "" "" @@ -5856,8 +5862,6 @@ midori_browser_init (MidoriBrowser* browser) g_signal_connect (forward, "button-press-event", G_CALLBACK (midori_browser_menu_item_middle_click_event_cb), browser); - - _action_set_visible (browser, "PrivateBrowsing", FALSE); #if HAVE_HILDON _action_set_visible (browser, "Menubar", FALSE); #endif diff --git a/midori/midori-view.c b/midori/midori-view.c index 43137c3e..31876a2b 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -2037,6 +2037,9 @@ webkit_web_view_populate_popup_cb (WebKitWebView* web_view, menuitem = sokoke_action_create_popup_menu_item ( gtk_action_group_get_action (actions, "Fullscreen")); gtk_menu_shell_append (menu_shell, menuitem); + menuitem = sokoke_action_create_popup_menu_item ( + gtk_action_group_get_action (actions, "PrivateBrowsing")); + gtk_menu_shell_append (menu_shell, menuitem); #else gtk_menu_shell_append (menu_shell, gtk_separator_menu_item_new ()); menuitem = sokoke_action_create_popup_menu_item ( -- 2.39.5