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);
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);

View file

@ -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);

View file

@ -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

View file

@ -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);

View file

@ -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);