aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.c42
-rw-r--r--src/service.c41
-rw-r--r--src/service.h2
-rw-r--r--tests/test-service.cc7
4 files changed, 10 insertions, 82 deletions
diff --git a/src/main.c b/src/main.c
index 4511fce..8df5e60 100644
--- a/src/main.c
+++ b/src/main.c
@@ -29,46 +29,16 @@
****
***/
-static gboolean replace = FALSE;
-
-static void
-parse_command_line (int * argc, char *** argv)
-{
- GError * error;
- GOptionContext * option_context;
-
- static GOptionEntry entries[] =
- {
- { "replace", 'r', 0, G_OPTION_ARG_NONE, &replace, "Replace the currently-running service", NULL },
- { NULL }
- };
-
- error = NULL;
- option_context = g_option_context_new ("- indicator-session service");
- g_option_context_add_main_entries (option_context, entries, GETTEXT_PACKAGE);
- if (!g_option_context_parse (option_context, argc, argv, &error))
- {
- g_print ("option parsing failed: %s\n", error->message);
- g_error_free (error);
- exit (EXIT_FAILURE);
- }
-
- g_option_context_free (option_context);
-}
-
-/***
-****
-***/
-
static void
on_name_lost (gpointer instance, gpointer loop)
{
- g_debug ("exiting: service couldn't acquire or lost ownership of busname");
- g_main_loop_quit ((GMainLoop*)loop);
+ g_warning ("exiting: service couldn't acquire, or lost ownership of, busname");
+
+ g_main_loop_quit (loop);
}
int
-main (int argc, char ** argv)
+main (int argc G_GNUC_UNUSED, char ** argv G_GNUC_UNUSED)
{
GMainLoop * loop;
IndicatorSessionService * service;
@@ -78,10 +48,8 @@ main (int argc, char ** argv)
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
textdomain (GETTEXT_PACKAGE);
- parse_command_line (&argc, &argv);
-
/* run */
- service = indicator_session_service_new (replace);
+ service = indicator_session_service_new ();
loop = g_main_loop_new (NULL, FALSE);
g_signal_connect (service, INDICATOR_SESSION_SERVICE_SIGNAL_NAME_LOST,
G_CALLBACK(on_name_lost), loop);
diff --git a/src/service.c b/src/service.c
index 862028b..83bfeaa 100644
--- a/src/service.c
+++ b/src/service.c
@@ -46,7 +46,6 @@ static guint signals[LAST_SIGNAL] = { 0 };
enum
{
PROP_0,
- PROP_REPLACE,
PROP_MAX_USERS,
PROP_LAST
};
@@ -106,8 +105,6 @@ struct _IndicatorSessionServicePrivate
int rebuild_flags;
GDBusConnection * conn;
GCancellable * cancellable;
-
- gboolean replace;
};
typedef IndicatorSessionServicePrivate priv_t;
@@ -1013,23 +1010,10 @@ indicator_session_service_init (IndicatorSessionService * self)
gp = p->keybinding_settings;
g_signal_connect_swapped (gp, "changed::screensaver",
G_CALLBACK(rebuild_switch_section_soon), self);
-}
-
-static void
-my_constructed (GObject * o)
-{
- GBusNameOwnerFlags owner_flags;
- IndicatorSessionService * self = INDICATOR_SESSION_SERVICE(o);
-
- /* own the name in constructed() instead of init() so that
- we'll know the value of the 'replace' property */
- owner_flags = G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT;
- if (self->priv->replace)
- owner_flags |= G_BUS_NAME_OWNER_FLAGS_REPLACE;
self->priv->own_id = g_bus_own_name (G_BUS_TYPE_SESSION,
BUS_NAME,
- owner_flags,
+ G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT,
on_bus_acquired,
NULL,
on_name_lost,
@@ -1051,10 +1035,6 @@ my_get_property (GObject * o,
switch (property_id)
{
- case PROP_REPLACE:
- g_value_set_boolean (value, self->priv->replace);
- break;
-
case PROP_MAX_USERS:
g_value_set_uint (value, self->priv->max_users);
break;
@@ -1074,10 +1054,6 @@ my_set_property (GObject * o,
switch (property_id)
{
- case PROP_REPLACE:
- self->priv->replace = g_value_get_boolean (value);
- break;
-
case PROP_MAX_USERS:
self->priv->max_users = g_value_get_uint (value);
rebuild_switch_section_soon (self);
@@ -1145,7 +1121,6 @@ indicator_session_service_class_init (IndicatorSessionServiceClass * klass)
GObjectClass * object_class = G_OBJECT_CLASS (klass);
object_class->dispose = my_dispose;
- object_class->constructed = my_constructed;
object_class->get_property = my_get_property;
object_class->set_property = my_set_property;
@@ -1161,14 +1136,6 @@ indicator_session_service_class_init (IndicatorSessionServiceClass * klass)
properties[PROP_0] = NULL;
- properties[PROP_REPLACE] = g_param_spec_boolean ("replace",
- "Replace Service",
- "Replace existing service",
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
-
properties[PROP_MAX_USERS] = g_param_spec_uint ("max-users",
"Max Users",
"Max visible users",
@@ -1181,11 +1148,9 @@ indicator_session_service_class_init (IndicatorSessionServiceClass * klass)
}
IndicatorSessionService *
-indicator_session_service_new (gboolean replace)
+indicator_session_service_new (void)
{
- GObject * o = g_object_new (INDICATOR_TYPE_SESSION_SERVICE,
- "replace", replace,
- NULL);
+ GObject * o = g_object_new (INDICATOR_TYPE_SESSION_SERVICE, NULL);
return INDICATOR_SESSION_SERVICE (o);
}
diff --git a/src/service.h b/src/service.h
index 3fad6bf..fa870e5 100644
--- a/src/service.h
+++ b/src/service.h
@@ -64,7 +64,7 @@ struct _IndicatorSessionServiceClass
GType indicator_session_service_get_type (void);
-IndicatorSessionService * indicator_session_service_new (gboolean replace);
+IndicatorSessionService * indicator_session_service_new (void);
G_END_DECLS
diff --git a/tests/test-service.cc b/tests/test-service.cc
index 76dcd75..57b4221 100644
--- a/tests/test-service.cc
+++ b/tests/test-service.cc
@@ -161,12 +161,7 @@ class ServiceTest: public GTestDBusFixture
// Start an IndicatorSessionService and wait for it to appear on the bus.
// This way our calls to g_dbus_*_get() in the next paragraph won't activate
// a second copy of the service...
- service = indicator_session_service_new (true);
-
- // confirm that the property got set
- gboolean replace = FALSE;
- g_object_get (service, "replace", &replace, NULL);
- ASSERT_TRUE (replace);
+ service = indicator_session_service_new ();
// wait for the service to show up on the bus
const guint watch_id = g_bus_watch_name_on_connection (conn,