[epiphany] ephy-embed-shell: add EPHY_EMBED_SHELL_MODE_INCOGNITO



commit 180ad78567be78007ac26fe5b73b0a2a28c0eb1f
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Mon Jan 28 22:05:00 2013 +0200

    ephy-embed-shell: add EPHY_EMBED_SHELL_MODE_INCOGNITO
    
    Since we need to differenciate between incognito and private mode in
    order to enable restoring closed tabs only for the latter case.
    
    Add a macro for the cases in which either mode should behave in the
    same way to simplify the change.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=128184

 embed/ephy-embed-shell.h  |    4 ++++
 embed/ephy-embed-single.c |    2 +-
 embed/ephy-web-view.c     |    4 ++--
 src/ephy-main.c           |    3 +--
 src/ephy-shell.c          |    2 +-
 src/pdm-dialog.c          |    5 ++---
 6 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/embed/ephy-embed-shell.h b/embed/ephy-embed-shell.h
index 08558f7..e9973a2 100644
--- a/embed/ephy-embed-shell.h
+++ b/embed/ephy-embed-shell.h
@@ -47,10 +47,14 @@ typedef enum
 {
   EPHY_EMBED_SHELL_MODE_BROWSER,
   EPHY_EMBED_SHELL_MODE_PRIVATE,
+  EPHY_EMBED_SHELL_MODE_INCOGNITO,
   EPHY_EMBED_SHELL_MODE_APPLICATION,
   EPHY_EMBED_SHELL_MODE_TEST
 } EphyEmbedShellMode;
 
+#define EPHY_EMBED_SHELL_MODE_HAS_PRIVATE_PROFILE(mode) \
+  (mode == EPHY_EMBED_SHELL_MODE_PRIVATE || mode == EPHY_EMBED_SHELL_MODE_INCOGNITO)
+
 struct _EphyEmbedShell
 {
   GtkApplication parent;
diff --git a/embed/ephy-embed-single.c b/embed/ephy-embed-single.c
index 0925e30..3bb1616 100644
--- a/embed/ephy-embed-single.c
+++ b/embed/ephy-embed-single.c
@@ -469,7 +469,7 @@ ephy_embed_single_initialize (EphyEmbedSingle *single)
   mode = ephy_embed_shell_get_mode (ephy_embed_shell_get_default ());
 
   /* WebKitSoupCache */
-  cache_dir = g_build_filename (mode == EPHY_EMBED_SHELL_MODE_PRIVATE ?
+  cache_dir = g_build_filename (EPHY_EMBED_SHELL_MODE_HAS_PRIVATE_PROFILE (mode) ?
                                 ephy_dot_dir () : g_get_user_cache_dir (),
                                 g_get_prgname (), NULL);
   priv->cache = soup_cache_new (cache_dir, SOUP_CACHE_SINGLE_USER);
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index b1d84de..adfdc74 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -2207,7 +2207,7 @@ load_changed_cb (WebKitWebView *web_view,
 
 #if 0
     /* TODO: DOM bindings */
-    if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) != EPHY_EMBED_SHELL_MODE_PRIVATE &&
+    if (!EPHY_EMBED_SHELL_MODE_HAS_PRIVATE_PROFILE(ephy_embed_shell_get_mode (ephy_embed_shell_get_default ())) &&
         g_settings_get_boolean (EPHY_SETTINGS_MAIN,
                                 EPHY_PREFS_REMEMBER_PASSWORDS))
       _ephy_web_view_hook_into_forms (view);
@@ -2329,7 +2329,7 @@ load_status_cb (WebKitWebView *web_view,
     if (priv->is_blank)
       ephy_web_view_set_title (view, NULL);
 
-    if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) != EPHY_EMBED_SHELL_MODE_PRIVATE &&
+    if (!EPHY_EMBED_SHELL_MODE_HAS_PRIVATE_PROFILE(ephy_embed_shell_get_mode (ephy_embed_shell_get_default ())) &&
         g_settings_get_boolean (EPHY_SETTINGS_MAIN,
                                 EPHY_PREFS_REMEMBER_PASSWORDS))
       _ephy_web_view_hook_into_forms (view);
diff --git a/src/ephy-main.c b/src/ephy-main.c
index 471ccae..3a464e4 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -419,8 +419,7 @@ main (int argc,
   if (private_instance)
     mode = EPHY_EMBED_SHELL_MODE_PRIVATE;
   else if (incognito_mode) {
-    /* Internally incognito mode is also a private mode. */
-    mode = EPHY_EMBED_SHELL_MODE_PRIVATE;
+    mode = EPHY_EMBED_SHELL_MODE_INCOGNITO;
 
     /* Use the right theming. */
     g_object_set (gtk_settings_get_default (),
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 5d7f47c..f080974 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -660,7 +660,7 @@ ephy_shell_init (EphyShell *shell)
   /* Initialize the favicon cache as early as possible, or further
      calls to webkit_web_context_get_favicon_database will fail. */
   mode = ephy_embed_shell_get_mode (ephy_embed_shell_get_default ());
-  favicon_db_path = g_build_filename (mode == EPHY_EMBED_SHELL_MODE_PRIVATE ?
+  favicon_db_path = g_build_filename (EPHY_EMBED_SHELL_MODE_HAS_PRIVATE_PROFILE (mode) ?
                                       ephy_dot_dir () : g_get_user_cache_dir (),
                                       g_get_prgname (), "icondatabase", NULL);
 
diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c
index 5243c15..0b56a2c 100644
--- a/src/pdm-dialog.c
+++ b/src/pdm-dialog.c
@@ -1609,9 +1609,8 @@ pdm_dialog_init (PdmDialog *dialog)
 	PdmDialogPrivate *priv;
 	PdmActionInfo *cookies, *passwords;
 	GtkWidget *window;
-	gboolean has_private_profile = 
-		ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_PRIVATE;
-
+	gboolean has_private_profile =
+		EPHY_EMBED_SHELL_MODE_HAS_PRIVATE_PROFILE (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()));
 
 	priv = dialog->priv = EPHY_PDM_DIALOG_GET_PRIVATE (dialog);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]