aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-02-03 07:03:49 +0800
committerChristian Persch <chpe@src.gnome.org>2006-02-03 07:03:49 +0800
commit18d197f20f16b525b861d2dab67fcce2074fbfc5 (patch)
tree647326f45a3ab6a67ad6718938eb9b20410e257e
parentb5d229937e31e9cec6cf599ae816e22888237aa0 (diff)
downloadgsoc2013-epiphany-18d197f20f16b525b861d2dab67fcce2074fbfc5.tar
gsoc2013-epiphany-18d197f20f16b525b861d2dab67fcce2074fbfc5.tar.gz
gsoc2013-epiphany-18d197f20f16b525b861d2dab67fcce2074fbfc5.tar.bz2
gsoc2013-epiphany-18d197f20f16b525b861d2dab67fcce2074fbfc5.tar.lz
gsoc2013-epiphany-18d197f20f16b525b861d2dab67fcce2074fbfc5.tar.xz
gsoc2013-epiphany-18d197f20f16b525b861d2dab67fcce2074fbfc5.tar.zst
gsoc2013-epiphany-18d197f20f16b525b861d2dab67fcce2074fbfc5.zip
Only claim the DBUS name when not running as private instance.
2006-02-03 Christian Persch <chpe@cvs.gnome.org> * src/ephy-dbus.c: (ephy_dbus_connect_to_session_bus), (ephy_dbus_get_property), (ephy_dbus_set_property), (ephy_dbus_class_init), (_ephy_dbus_startup): * src/ephy-dbus.h: * src/ephy-main.c: (main): Only claim the DBUS name when not running as private instance.
-rw-r--r--ChangeLog10
-rw-r--r--src/ephy-dbus.c56
-rw-r--r--src/ephy-dbus.h3
-rw-r--r--src/ephy-main.c10
4 files changed, 72 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 0e981a294..a9c16d3ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2006-02-03 Christian Persch <chpe@cvs.gnome.org>
+
+ * src/ephy-dbus.c: (ephy_dbus_connect_to_session_bus),
+ (ephy_dbus_get_property), (ephy_dbus_set_property),
+ (ephy_dbus_class_init), (_ephy_dbus_startup):
+ * src/ephy-dbus.h:
+ * src/ephy-main.c: (main):
+
+ Only claim the DBUS name when not running as private instance.
+
2006-02-02 Christian Persch <chpe@cvs.gnome.org>
* embed/mozilla/Makefile.am:
diff --git a/src/ephy-dbus.c b/src/ephy-dbus.c
index e43523596..cbbddd1dd 100644
--- a/src/ephy-dbus.c
+++ b/src/ephy-dbus.c
@@ -57,6 +57,7 @@ struct _EphyDbusPrivate
guint session_reconnect_timeout_id;
guint system_reconnect_timeout_id;
guint is_session_service_owner : 1;
+ guint claim_name : 1;
};
enum
@@ -66,6 +67,12 @@ enum
LAST_SIGNAL
};
+enum
+{
+ PROP_0,
+ PROP_CLAIM_NAME
+};
+
static EphyDbus *ephy_dbus_instance;
static guint signals[LAST_SIGNAL];
@@ -248,7 +255,9 @@ ephy_dbus_connect_to_session_bus (EphyDbus *ephy_dbus,
dbus_connection_add_filter
(dbus_g_connection_get_connection (priv->session_bus),
session_filter_func, ephy_dbus, NULL);
-
+
+ if (priv->claim_name == FALSE) return TRUE;
+
dbus_g_object_type_install_info (EPHY_TYPE_DBUS,
&dbus_glib_ephy_activation_object_info);
@@ -368,12 +377,41 @@ ephy_dbus_finalize (GObject *object)
}
static void
+ephy_dbus_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ /* no readable properties */
+ g_return_if_reached ();
+}
+
+static void
+ephy_dbus_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyDbus *dbus = EPHY_DBUS (object);
+ EphyDbusPrivate *priv = dbus->priv;
+
+ switch (prop_id)
+ {
+ case PROP_CLAIM_NAME:
+ priv->claim_name = g_value_get_boolean (value);
+ break;
+ }
+}
+
+static void
ephy_dbus_class_init (EphyDbusClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
+ object_class->get_property = ephy_dbus_get_property;
+ object_class->set_property = ephy_dbus_set_property;
object_class->finalize = ephy_dbus_finalize;
signals[CONNECTED] =
@@ -398,6 +436,15 @@ ephy_dbus_class_init (EphyDbusClass *klass)
1,
EPHY_TYPE_DBUS_BUS);
+ g_object_class_install_property
+ (object_class,
+ PROP_CLAIM_NAME,
+ g_param_spec_boolean ("claim-name",
+ "claim-name",
+ "claim-name",
+ TRUE,
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
g_type_class_add_private (object_class, sizeof(EphyDbusPrivate));
}
@@ -494,13 +541,16 @@ ephy_dbus_get_proxy (EphyDbus *dbus,
/* private API */
gboolean
-_ephy_dbus_startup (GError **error)
+_ephy_dbus_startup (gboolean claim_name,
+ GError **error)
{
g_assert (ephy_dbus_instance == NULL);
ephy_dbus_error_quark = g_quark_from_static_string ("ephy-dbus-error");
- ephy_dbus_instance = g_object_new (EPHY_TYPE_DBUS, NULL);
+ ephy_dbus_instance = g_object_new (EPHY_TYPE_DBUS,
+ "claim-name", claim_name,
+ NULL);
/* We only connect to the session bus on startup*/
return ephy_dbus_connect_to_session_bus (ephy_dbus_instance, error);
diff --git a/src/ephy-dbus.h b/src/ephy-dbus.h
index 943a44c76..e283d1bf5 100644
--- a/src/ephy-dbus.h
+++ b/src/ephy-dbus.h
@@ -80,7 +80,8 @@ DBusGProxy *ephy_dbus_get_proxy (EphyDbus *dbus,
EphyDbusBus kind);
/* private */
-gboolean _ephy_dbus_startup (GError **error);
+gboolean _ephy_dbus_startup (gboolean claim_name,
+ GError **error);
void _ephy_dbus_release (void);
diff --git a/src/ephy-main.c b/src/ephy-main.c
index af53d230b..62d5906a4 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -578,7 +578,7 @@ main (int argc,
startup_error_quark = g_quark_from_static_string ("epiphany-startup-error");
- if (!_ephy_dbus_startup (&error))
+ if (!_ephy_dbus_startup (!private_instance, &error))
{
_ephy_dbus_release ();
@@ -590,7 +590,8 @@ main (int argc,
/* If we're remoting, no need to start up any further services,
* just forward the call.
*/
- if (!_ephy_dbus_is_name_owner ())
+ if (!private_instance &&
+ !_ephy_dbus_is_name_owner ())
{
/* Create DBUS proxy */
proxy = ephy_dbus_get_proxy (ephy_dbus_get_default (), EPHY_DBUS_SESSION);
@@ -627,7 +628,10 @@ main (int argc,
/* We're not remoting; start our services */
- if (!ephy_file_helpers_init (NULL, FALSE, FALSE, &error))
+ if (!ephy_file_helpers_init (profile_directory,
+ private_instance,
+ !keep_profile_directory,
+ &error))
{
_ephy_dbus_release ();