aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-main.c
diff options
context:
space:
mode:
authorXan Lopez <xan@igalia.com>2012-12-12 17:58:06 +0800
committerXan Lopez <xan@igalia.com>2012-12-12 19:22:39 +0800
commit5660617413c37eb397a50361b6ca5bdd250b5be5 (patch)
treed03508164c93e4e212587f33bf0a6dc1af703a4c /src/ephy-main.c
parent8b97d6e32fbe2e56a7012d731b5e864a86720504 (diff)
downloadgsoc2013-epiphany-5660617413c37eb397a50361b6ca5bdd250b5be5.tar
gsoc2013-epiphany-5660617413c37eb397a50361b6ca5bdd250b5be5.tar.gz
gsoc2013-epiphany-5660617413c37eb397a50361b6ca5bdd250b5be5.tar.bz2
gsoc2013-epiphany-5660617413c37eb397a50361b6ca5bdd250b5be5.tar.lz
gsoc2013-epiphany-5660617413c37eb397a50361b6ca5bdd250b5be5.tar.xz
gsoc2013-epiphany-5660617413c37eb397a50361b6ca5bdd250b5be5.tar.zst
gsoc2013-epiphany-5660617413c37eb397a50361b6ca5bdd250b5be5.zip
First iteration for 'Incognito mode'
For now this is just a private mode but with the following two twists: - We use the dark theme. - We steal our history and bookmarks from the main profile. This is done in 'read-only' mode though, so any changes made in this session will be lost. Add command line options and a UI item to launch the browser in this mode. https://bugzilla.gnome.org/show_bug.cgi?id=676914
Diffstat (limited to 'src/ephy-main.c')
-rw-r--r--src/ephy-main.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/ephy-main.c b/src/ephy-main.c
index 10450d7ff..04c82b6aa 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -56,6 +56,7 @@ static char *application_to_delete = NULL;
/* Only set from options in debug builds */
static gboolean private_instance = FALSE;
+static gboolean incognito_mode = FALSE;
static gboolean application_mode = FALSE;
static gboolean keep_temp_directory = FALSE;
static char *profile_directory = NULL;
@@ -86,6 +87,10 @@ static const GOptionEntry option_entries[] =
N_("Add a bookmark"), N_("URL") },
{ "private-instance", 'p', 0, G_OPTION_ARG_NONE, &private_instance,
N_("Start a private instance"), NULL },
+ { "incognito-mode", 'i', 0, G_OPTION_ARG_NONE, &incognito_mode,
+ N_("Start an instance in incognito mode"), NULL },
+ { "netbank-mode", 0, 0, G_OPTION_ARG_NONE, &incognito_mode,
+ N_("Start an instance in netbank mode"), NULL },
{ "application-mode", 'a', 0, G_OPTION_ARG_NONE, &application_mode,
N_("Start the browser in application mode"), NULL },
{ "profile", 0, 0, G_OPTION_ARG_STRING, &profile_directory,
@@ -353,8 +358,8 @@ main (int argc,
exit (1);
}
- if (profile_directory != NULL && private_instance == FALSE && application_mode == FALSE) {
- g_print ("--profile can only be used in combination with --private-instance or --application-mode\n");
+ if (profile_directory != NULL && private_instance == FALSE && application_mode == FALSE && incognito_mode == FALSE) {
+ g_print ("--profile can only be used in combination with --private-instance, --incognito-mode or --application-mode\n");
exit (1);
}
@@ -368,12 +373,18 @@ main (int argc,
exit (1);
}
+ if (incognito_mode && profile_directory == NULL) {
+ g_print ("--incognito-mode needs a --profile parameter to steal the data from\n");
+ exit (1);
+ }
+
/* Work-around Flash Player crash */
g_setenv ("XLIB_SKIP_ARGB_VISUALS", "1", FALSE);
/* Run the migration in all cases, except when running a private
- instance without a given profile directory. */
- if (!(private_instance && profile_directory == FALSE)) {
+ instance without a given profile directory or running in
+ incognito mode. */
+ if (!(private_instance && profile_directory == NULL) && incognito_mode == FALSE) {
/* If the migration fails we don't really want to continue. */
if (!ephy_profile_utils_do_migration ((const char *)profile_directory, -1, FALSE)) {
g_print ("Failed to run the migrator process, Web will now abort.");
@@ -384,8 +395,10 @@ main (int argc,
/* Start our services */
flags = EPHY_FILE_HELPERS_ENSURE_EXISTS;
- if (private_instance || application_mode)
+ if (incognito_mode || private_instance || application_mode)
flags |= EPHY_FILE_HELPERS_PRIVATE_PROFILE;
+ if (incognito_mode)
+ flags |= EPHY_FILE_HELPERS_STEAL_DATA;
if (keep_temp_directory || profile_directory)
flags |= EPHY_FILE_HELPERS_KEEP_DIR;
@@ -433,7 +446,15 @@ main (int argc,
/* Now create the shell */
if (private_instance)
mode = EPHY_EMBED_SHELL_MODE_PRIVATE;
- else if (application_mode) {
+ else if (incognito_mode) {
+ /* Internally incognito mode is also a private mode. */
+ mode = EPHY_EMBED_SHELL_MODE_PRIVATE;
+
+ /* Use the right theming. */
+ g_object_set (gtk_settings_get_default (),
+ "gtk-application-prefer-dark-theme", TRUE,
+ NULL);
+ } else if (application_mode) {
char *app_name;
char *app_icon;