aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorXan Lopez <xlopez@igalia.com>2011-06-30 22:31:01 +0800
committerXan Lopez <xlopez@igalia.com>2011-06-30 22:31:01 +0800
commitf594ec68442049ad9b6ecce598f2623e0ece9049 (patch)
tree2cd2291857a752d0ce789fff6f2de558bb9b283a /embed
parent1b73fcdddb386855fb15cc61cf723f002743e7c0 (diff)
downloadgsoc2013-epiphany-f594ec68442049ad9b6ecce598f2623e0ece9049.tar
gsoc2013-epiphany-f594ec68442049ad9b6ecce598f2623e0ece9049.tar.gz
gsoc2013-epiphany-f594ec68442049ad9b6ecce598f2623e0ece9049.tar.bz2
gsoc2013-epiphany-f594ec68442049ad9b6ecce598f2623e0ece9049.tar.lz
gsoc2013-epiphany-f594ec68442049ad9b6ecce598f2623e0ece9049.tar.xz
gsoc2013-epiphany-f594ec68442049ad9b6ecce598f2623e0ece9049.tar.zst
gsoc2013-epiphany-f594ec68442049ad9b6ecce598f2623e0ece9049.zip
Use an enum for the global mode of the application
In preparation to add a new mode for WebApps.
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed-shell.c40
-rw-r--r--embed/ephy-embed-shell.h8
-rw-r--r--embed/ephy-embed-single.c2
-rw-r--r--embed/ephy-web-view.c2
4 files changed, 30 insertions, 22 deletions
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index 73ab92771..30de7dd8a 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -32,6 +32,7 @@
#include "ephy-download.h"
#include "ephy-embed-shell.h"
#include "ephy-embed-single.h"
+#include "ephy-embed-type-builtins.h"
#include "ephy-encodings.h"
#include "ephy-favicon-cache.h"
#include "ephy-file-helpers.h"
@@ -58,7 +59,7 @@ struct _EphyEmbedShellPrivate
EphyAdBlockManager *adblock_manager;
GtkPageSetup *page_setup;
GtkPrintSettings *print_settings;
- gboolean private_instance;
+ EphyEmbedShellMode mode;
guint single_initialised : 1;
};
@@ -75,7 +76,7 @@ static guint signals[LAST_SIGNAL];
enum
{
PROP_0,
- PROP_PRIVATE_INSTANCE,
+ PROP_MODE,
N_PROPERTIES
};
@@ -291,8 +292,8 @@ ephy_embed_shell_set_property (GObject *object,
switch (prop_id)
{
- case PROP_PRIVATE_INSTANCE:
- embed_shell->priv->private_instance = g_value_get_boolean (value);
+ case PROP_MODE:
+ embed_shell->priv->mode = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -309,8 +310,8 @@ ephy_embed_shell_get_property (GObject *object,
switch (prop_id)
{
- case PROP_PRIVATE_INSTANCE:
- g_value_set_boolean (value, embed_shell->priv->private_instance);
+ case PROP_MODE:
+ g_value_set_enum (value, embed_shell->priv->mode);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -341,13 +342,14 @@ ephy_embed_shell_class_init (EphyEmbedShellClass *klass)
klass->get_embed_single = impl_get_embed_single;
- object_properties[PROP_PRIVATE_INSTANCE] =
- g_param_spec_boolean ("private-instance",
- "Private instance",
- "Whether this Epiphany instance is private.",
- FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB | G_PARAM_CONSTRUCT_ONLY);
+ object_properties[PROP_MODE] =
+ g_param_spec_enum ("mode",
+ "Mode",
+ "The global mode for this instance of Epiphany .",
+ EPHY_TYPE_EMBED_SHELL_MODE,
+ EPHY_EMBED_SHELL_MODE_BROWSER,
+ G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_properties (object_class,
N_PROPERTIES,
@@ -646,15 +648,15 @@ ephy_embed_shell_remove_download (EphyEmbedShell *shell, EphyDownload *download)
}
/**
- * ephy_embed_shell_is_private_instance:
+ * ephy_embed_shell_get_mode:
* @shell: an #EphyEmbedShell
*
- * Returns: whether @shell is a private instance
+ * Returns: the global mode of the @shell
**/
-gboolean
-ephy_embed_shell_is_private_instance (EphyEmbedShell *shell)
+EphyEmbedShellMode
+ephy_embed_shell_get_mode (EphyEmbedShell *shell)
{
- g_return_val_if_fail (EPHY_IS_EMBED_SHELL (shell), FALSE);
+ g_return_val_if_fail (EPHY_IS_EMBED_SHELL (shell), EPHY_EMBED_SHELL_MODE_BROWSER);
- return shell->priv->private_instance;
+ return shell->priv->mode;
}
diff --git a/embed/ephy-embed-shell.h b/embed/ephy-embed-shell.h
index 02eaf43a8..d89aafe94 100644
--- a/embed/ephy-embed-shell.h
+++ b/embed/ephy-embed-shell.h
@@ -47,6 +47,12 @@ typedef struct _EphyEmbedShellPrivate EphyEmbedShellPrivate;
extern EphyEmbedShell *embed_shell;
+typedef enum
+{
+ EPHY_EMBED_SHELL_MODE_BROWSER,
+ EPHY_EMBED_SHELL_MODE_PRIVATE
+} EphyEmbedShellMode;
+
struct _EphyEmbedShell
{
GtkApplication parent;
@@ -101,7 +107,7 @@ void ephy_embed_shell_add_download (EphyEmbedShell *shell,
void ephy_embed_shell_remove_download (EphyEmbedShell *shell,
EphyDownload *download);
-gboolean ephy_embed_shell_is_private_instance (EphyEmbedShell *shell);
+EphyEmbedShellMode ephy_embed_shell_get_mode (EphyEmbedShell *shell);
G_END_DECLS
diff --git a/embed/ephy-embed-single.c b/embed/ephy-embed-single.c
index a41d0b25e..547f49283 100644
--- a/embed/ephy-embed-single.c
+++ b/embed/ephy-embed-single.c
@@ -528,7 +528,7 @@ ephy_embed_single_initialize (EphyEmbedSingle *single)
are not using a private session, otherwise we want any new
password to expire when we exit *and* we don't want to use any
existing password in the keyring */
- if (ephy_embed_shell_is_private_instance (ephy_embed_shell_get_default ()) == FALSE)
+ if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) != EPHY_EMBED_SHELL_MODE_PRIVATE)
soup_session_add_feature_by_type (session, SOUP_TYPE_PASSWORD_MANAGER_GNOME);
#endif
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 719db1024..19ff7d4f7 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1873,7 +1873,7 @@ load_status_cb (WebKitWebView *web_view,
if (ephy_web_view_get_is_blank (view))
g_object_notify (object, "embed-title");
- if (ephy_embed_shell_is_private_instance (embed_shell) == FALSE &&
+ if (ephy_embed_shell_get_mode (embed_shell) != EPHY_EMBED_SHELL_MODE_PRIVATE &&
g_settings_get_boolean (EPHY_SETTINGS_MAIN,
EPHY_PREFS_REMEMBER_PASSWORDS))
_ephy_web_view_hook_into_forms (view);