[epiphany] Add option to start always in incognito mode
- From: Jan-Michael Brummer <jbrummer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Add option to start always in incognito mode
- Date: Tue, 16 Apr 2019 11:06:35 +0000 (UTC)
commit 6bf963537e23ea77b05d4b62204dcfee0b871994
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Sun Apr 14 18:18:21 2019 +0200
Add option to start always in incognito mode
Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/300
data/org.gnome.epiphany.gschema.xml | 5 +++++
lib/ephy-prefs.h | 1 +
src/ephy-main.c | 4 ++++
src/prefs-dialog.c | 14 ++++++++++++++
src/resources/gtk/prefs-dialog.ui | 8 ++++++++
5 files changed, 32 insertions(+)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index 8a6b622c0..758668cbc 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -65,6 +65,11 @@
<summary>Whether to ask for setting browser as default</summary>
<description>When this option is set to true, browser will ask for being default if
it is not already set.</description>
</key>
+ <key type="b" name="start-in-incognito-mode">
+ <default>false</default>
+ <summary>Start in incognito mode</summary>
+ <description>When this option is set to true, browser will always start in incognito
mode</description>
+ </key>
</schema>
<schema path="/org/gnome/epiphany/ui/" id="org.gnome.Epiphany.ui">
<key type="b" name="expand-tabs-bar">
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index b134957ac..34cadfcf1 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -171,6 +171,7 @@ static const char * const ephy_prefs_web_schema[] = {
#define EPHY_PREFS_SEARCH_ENGINES "search-engines"
#define EPHY_PREFS_DEFAULT_SEARCH_ENGINE "default-search-engine"
#define EPHY_PREFS_ASK_FOR_DEFAULT "ask-for-default"
+#define EPHY_PREFS_START_IN_INCOGNITO_MODE "start-in-incognito-mode"
#define EPHY_PREFS_LOCKDOWN_SCHEMA "org.gnome.Epiphany.lockdown"
#define EPHY_PREFS_LOCKDOWN_FULLSCREEN "disable-fullscreen"
diff --git a/src/ephy-main.c b/src/ephy-main.c
index ec895b574..bc362d8c1 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -331,6 +331,10 @@ main (int argc,
g_error ("Fatal initialization error: %s", error->message);
}
+ if (g_settings_get_boolean (EPHY_SETTINGS_MAIN, EPHY_PREFS_START_IN_INCOGNITO_MODE)) {
+ incognito_mode = TRUE;
+ }
+
/* Run the migration in all cases, except when running a private
instance without a given profile directory or running in
incognito or automation mode. */
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index efed665ab..f92651e05 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -97,6 +97,7 @@ struct _PrefsDialog {
GtkWidget *enable_safe_browsing_checkbutton;
GtkWidget *enable_smooth_scrolling_checkbutton;
GtkWidget *ask_on_download_checkbutton;
+ GtkWidget *start_in_incognito_mode_checkbutton;
/* fonts & style */
GtkWidget *use_gnome_fonts_checkbutton;
@@ -994,6 +995,7 @@ prefs_dialog_class_init (PrefsDialogClass *klass)
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, download_button_label);
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, download_box);
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, ask_on_download_checkbutton);
+ gtk_widget_class_bind_template_child (widget_class, PrefsDialog, start_in_incognito_mode_checkbutton);
/* fonts & style */
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, use_gnome_fonts_checkbutton);
@@ -2033,6 +2035,18 @@ setup_general_page (PrefsDialog *dialog)
"active",
G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (settings,
+ EPHY_PREFS_START_IN_INCOGNITO_MODE,
+ dialog->start_in_incognito_mode_checkbutton,
+ "active",
+ G_SETTINGS_BIND_DEFAULT);
+
+ g_settings_bind (settings,
+ EPHY_PREFS_START_IN_INCOGNITO_MODE,
+ dialog->restore_session_checkbutton,
+ "sensitive",
+ G_SETTINGS_BIND_INVERT_BOOLEAN);
+
if (ephy_is_running_inside_flatpak ())
gtk_widget_hide (dialog->download_box);
else
diff --git a/src/resources/gtk/prefs-dialog.ui b/src/resources/gtk/prefs-dialog.ui
index 89a8e6abf..a6c6b1e60 100644
--- a/src/resources/gtk/prefs-dialog.ui
+++ b/src/resources/gtk/prefs-dialog.ui
@@ -354,11 +354,19 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<property name="margin-start">12</property>
+ <child>
+ <object class="GtkCheckButton" id="start_in_incognito_mode_checkbutton">
+ <property name="label" translatable="yes">Always start browser in _incognito
mode</property>
+ <property name="visible">True</property>
+ <property name="use-underline">True</property>
+ </object>
+ </child>
<child>
<object class="GtkCheckButton" id="restore_session_checkbutton">
<property name="label" translatable="yes">_Remember previous tabs on
startup</property>
<property name="visible">True</property>
<property name="use-underline">True</property>
+ <property name="margin-start">12</property>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]