aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xlopez@igalia.com>2011-06-29 06:13:09 +0800
committerXan Lopez <xlopez@igalia.com>2011-06-29 20:53:01 +0800
commit841b59d9a2af4492c8c51a040ea164e46c5093b9 (patch)
treeb15f225e71ac3b196de74d40c7e5a347efeef221
parent61b4a15531501833926b33a77f0416efc772a897 (diff)
downloadgsoc2013-epiphany-841b59d9a2af4492c8c51a040ea164e46c5093b9.tar.gz
gsoc2013-epiphany-841b59d9a2af4492c8c51a040ea164e46c5093b9.tar.zst
gsoc2013-epiphany-841b59d9a2af4492c8c51a040ea164e46c5093b9.zip
ephy-application: add a private-instance property
It does not do much at the moment, but we pass the information from ephy-main.c to the app.
-rw-r--r--src/ephy-application.c60
-rw-r--r--src/ephy-application.h2
-rw-r--r--src/ephy-main.c2
-rw-r--r--src/ephy-shell.c2
4 files changed, 62 insertions, 4 deletions
diff --git a/src/ephy-application.c b/src/ephy-application.c
index 8ae9f7f77..c6c3a544a 100644
--- a/src/ephy-application.c
+++ b/src/ephy-application.c
@@ -29,10 +29,19 @@
#include <string.h>
+enum {
+ PROP_0,
+ PROP_PRIVATE_INSTANCE,
+ N_PROPERTIES
+};
+
+static GParamSpec *object_properties[N_PROPERTIES] = { NULL, };
+
#define EPHY_APPLICATION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_APPLICATION, EphyApplicationPrivate))
struct _EphyApplicationPrivate {
EphyApplicationStartupContext *startup_context;
+ gboolean private_instance;
};
G_DEFINE_TYPE (EphyApplication, ephy_application, GTK_TYPE_APPLICATION);
@@ -309,18 +318,66 @@ ephy_application_before_emit (GApplication *application,
}
static void
+ephy_application_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyApplication *application = EPHY_APPLICATION (object);
+
+ switch (prop_id) {
+ case PROP_PRIVATE_INSTANCE:
+ application->priv->private_instance = g_value_get_boolean (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+ephy_application_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EphyApplication *application = EPHY_APPLICATION (object);
+
+ switch (prop_id) {
+ case PROP_PRIVATE_INSTANCE:
+ g_value_set_boolean (value, application->priv->private_instance);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
ephy_application_class_init (EphyApplicationClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS(class);
GApplicationClass *application_class = G_APPLICATION_CLASS (class);
object_class->finalize = ephy_application_finalize;
+ object_class->set_property = ephy_application_set_property;
+ object_class->get_property = ephy_application_get_property;
application_class->startup = ephy_application_startup;
application_class->activate = ephy_application_activate;
application_class->before_emit = ephy_application_before_emit;
application_class->add_platform_data = ephy_application_add_platform_data;
+ 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);
+
+ g_object_class_install_properties (object_class,
+ N_PROPERTIES,
+ object_properties);
+
g_type_class_add_private (class, sizeof (EphyApplicationPrivate));
}
@@ -343,11 +400,12 @@ ephy_application_finalize (GObject *object)
}
EphyApplication *
-ephy_application_new (void)
+ephy_application_new (gboolean private_instance)
{
return g_object_new (EPHY_TYPE_APPLICATION,
"application-id", "org.gnome.Epiphany",
"flags", G_APPLICATION_FLAGS_NONE,
+ "private-instance", private_instance,
NULL);
}
diff --git a/src/ephy-application.h b/src/ephy-application.h
index c530658ba..04cb37662 100644
--- a/src/ephy-application.h
+++ b/src/ephy-application.h
@@ -73,7 +73,7 @@ typedef struct {
GType ephy_application_get_type (void) G_GNUC_CONST;
-EphyApplication *ephy_application_new (void);
+EphyApplication *ephy_application_new (gboolean private_instance);
void ephy_application_set_startup_context (EphyApplication *application,
EphyApplicationStartupContext *ctx);
diff --git a/src/ephy-main.c b/src/ephy-main.c
index 98bde4f3e..2194e2869 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -417,7 +417,7 @@ main (int argc,
g_setenv ("XLIB_SKIP_ARGB_VISUALS", "1", FALSE);
/* Now create the shell */
- application = ephy_application_new ();
+ application = ephy_application_new (private_instance);
_ephy_shell_create_instance (application);
g_object_unref (application);
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 5ebd1f21c..c978f1b5e 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -825,5 +825,5 @@ _ephy_shell_create_instance (EphyApplication *application)
if (application)
ephy_shell->priv->application = g_object_ref (application);
else
- ephy_shell->priv->application = ephy_application_new ();
+ ephy_shell->priv->application = ephy_application_new (FALSE);
}