From: Christian Dywan Date: Wed, 13 Oct 2010 21:41:11 +0000 (+0200) Subject: Let private mode inherit preferences X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcc622c45619ba805a0f73c4a302cd66935b6fb8;p=midori Let private mode inherit preferences Private mode should retain most preferences, while menus for Bookmarks, Tools and Panel are hidden. App mode now hides the navigationbar by default. --- diff --git a/midori/main.c b/midori/main.c index 5ed6a357..b3ab80a4 100644 --- a/midori/main.c +++ b/midori/main.c @@ -1732,19 +1732,23 @@ main (int argc, g_free (config_file); soup_session_add_feature (session, SOUP_SESSION_FEATURE (jar)); g_object_unref (jar); - } else + { settings = katze_object_get_object (browser, "settings"); - g_object_set (settings, - "show-menubar", FALSE, - "show-navigationbar", TRUE, - "show-panel", FALSE, - "toolbar-items", "Back,Forward,ReloadStop,Location", - "homepage", NULL, - "show-statusbar", FALSE, - "enable-developer-extras", FALSE, - NULL); + g_object_set (settings, + "show-menubar", FALSE, + "show-navigationbar", FALSE, + "toolbar-items", "Back,Forward,ReloadStop,Location,Homepage", + "homepage", webapp, + "show-statusbar", FALSE, + "enable-developer-extras", FALSE, + NULL); + } + g_object_set (settings, "show-panel", FALSE, NULL); + midori_browser_set_action_visible (browser, "Bookmarks", FALSE); + midori_browser_set_action_visible (browser, "Tools", FALSE); + midori_browser_set_action_visible (browser, "Panel", FALSE); g_object_set (browser, "settings", settings, NULL); midori_startup_timer ("Setup config: \t%f"); g_object_unref (settings); diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 5e777fd5..4b6f18d6 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -2138,7 +2138,7 @@ _action_private_browsing_activate (GtkAction* action, MidoriBrowser* browser) { const gchar* uri = midori_browser_get_current_uri (browser); - sokoke_spawn_app (uri && *uri ? uri : "about:blank"); + sokoke_spawn_app (uri && *uri ? uri : "about:blank", TRUE); } static void @@ -2741,7 +2741,7 @@ midori_browser_open_bookmark (MidoriBrowser* browser, uri_fixed = g_strdup (uri); if (katze_item_get_meta_boolean (item, "app")) - sokoke_spawn_app (uri_fixed); + sokoke_spawn_app (uri_fixed, FALSE); else { midori_browser_set_current_uri (browser, uri_fixed); diff --git a/midori/midori-view.c b/midori/midori-view.c index 01899861..3245aa72 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -1785,7 +1785,7 @@ static void midori_web_view_menu_web_app_activate_cb (GtkWidget* widget, MidoriView* view) { - sokoke_spawn_app (view->link_uri); + sokoke_spawn_app (view->link_uri, FALSE); } static void diff --git a/midori/sokoke.c b/midori/sokoke.c index 4add49a7..1e6f599b 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -487,14 +487,20 @@ sokoke_spawn_program (const gchar* command, } void -sokoke_spawn_app (const gchar* uri) +sokoke_spawn_app (const gchar* uri, + gboolean inherit_config) { const gchar* executable = sokoke_get_argv (NULL)[0]; /* "midori" "/usr/bin/midori" "c:/Program Files/Midori/bin/midori.exe" */ gchar* quoted = g_shell_quote (executable); - gchar* command = g_strconcat (quoted, " -a", NULL); + gchar* command; + if (inherit_config) + command = g_strconcat (quoted, " -c ", sokoke_set_config_dir (NULL), + " -a", NULL); + else + command = g_strconcat (quoted, " -a", NULL); g_free (quoted); sokoke_spawn_program (command, uri); g_free (command); diff --git a/midori/sokoke.h b/midori/sokoke.h index 2cceee85..bd1a23e7 100644 --- a/midori/sokoke.h +++ b/midori/sokoke.h @@ -102,7 +102,8 @@ sokoke_spawn_program (const gchar* command, const gchar* argument); void -sokoke_spawn_app (const gchar* uri); +sokoke_spawn_app (const gchar* uri, + gboolean inherit_config); gchar* sokoke_search_uri (const gchar* uri, const gchar* keywords);