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.
This commit is contained in:
Christian Dywan 2010-10-13 23:41:11 +02:00
parent 80ff8ac0f0
commit bcc622c456
5 changed files with 27 additions and 16 deletions

View file

@ -1732,19 +1732,23 @@ main (int argc,
g_free (config_file); g_free (config_file);
soup_session_add_feature (session, SOUP_SESSION_FEATURE (jar)); soup_session_add_feature (session, SOUP_SESSION_FEATURE (jar));
g_object_unref (jar); g_object_unref (jar);
} }
else else
{
settings = katze_object_get_object (browser, "settings"); settings = katze_object_get_object (browser, "settings");
g_object_set (settings, g_object_set (settings,
"show-menubar", FALSE, "show-menubar", FALSE,
"show-navigationbar", TRUE, "show-navigationbar", FALSE,
"show-panel", FALSE, "toolbar-items", "Back,Forward,ReloadStop,Location,Homepage",
"toolbar-items", "Back,Forward,ReloadStop,Location", "homepage", webapp,
"homepage", NULL,
"show-statusbar", FALSE, "show-statusbar", FALSE,
"enable-developer-extras", FALSE, "enable-developer-extras", FALSE,
NULL); 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); g_object_set (browser, "settings", settings, NULL);
midori_startup_timer ("Setup config: \t%f"); midori_startup_timer ("Setup config: \t%f");
g_object_unref (settings); g_object_unref (settings);

View file

@ -2138,7 +2138,7 @@ _action_private_browsing_activate (GtkAction* action,
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
const gchar* uri = midori_browser_get_current_uri (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 static void
@ -2741,7 +2741,7 @@ midori_browser_open_bookmark (MidoriBrowser* browser,
uri_fixed = g_strdup (uri); uri_fixed = g_strdup (uri);
if (katze_item_get_meta_boolean (item, "app")) if (katze_item_get_meta_boolean (item, "app"))
sokoke_spawn_app (uri_fixed); sokoke_spawn_app (uri_fixed, FALSE);
else else
{ {
midori_browser_set_current_uri (browser, uri_fixed); midori_browser_set_current_uri (browser, uri_fixed);

View file

@ -1785,7 +1785,7 @@ static void
midori_web_view_menu_web_app_activate_cb (GtkWidget* widget, midori_web_view_menu_web_app_activate_cb (GtkWidget* widget,
MidoriView* view) MidoriView* view)
{ {
sokoke_spawn_app (view->link_uri); sokoke_spawn_app (view->link_uri, FALSE);
} }
static void static void

View file

@ -487,14 +487,20 @@ sokoke_spawn_program (const gchar* command,
} }
void void
sokoke_spawn_app (const gchar* uri) sokoke_spawn_app (const gchar* uri,
gboolean inherit_config)
{ {
const gchar* executable = sokoke_get_argv (NULL)[0]; const gchar* executable = sokoke_get_argv (NULL)[0];
/* "midori" /* "midori"
"/usr/bin/midori" "/usr/bin/midori"
"c:/Program Files/Midori/bin/midori.exe" */ "c:/Program Files/Midori/bin/midori.exe" */
gchar* quoted = g_shell_quote (executable); 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); g_free (quoted);
sokoke_spawn_program (command, uri); sokoke_spawn_program (command, uri);
g_free (command); g_free (command);

View file

@ -102,7 +102,8 @@ sokoke_spawn_program (const gchar* command,
const gchar* argument); const gchar* argument);
void void
sokoke_spawn_app (const gchar* uri); sokoke_spawn_app (const gchar* uri,
gboolean inherit_config);
gchar* sokoke_search_uri (const gchar* uri, gchar* sokoke_search_uri (const gchar* uri,
const gchar* keywords); const gchar* keywords);