aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/indicator-session.c110
-rw-r--r--src/session-dbus.c31
-rw-r--r--src/session-dbus.h1
-rw-r--r--src/settings-helper.c7
-rw-r--r--src/settings-helper.h1
-rw-r--r--src/user-menu-mgr.c5
6 files changed, 14 insertions, 141 deletions
diff --git a/src/indicator-session.c b/src/indicator-session.c
index 1af2552..d74b8f8 100644
--- a/src/indicator-session.c
+++ b/src/indicator-session.c
@@ -52,18 +52,19 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
typedef struct _IndicatorSession IndicatorSession;
typedef struct _IndicatorSessionClass IndicatorSessionClass;
-struct _IndicatorSessionClass {
- IndicatorObjectClass parent_class;
+struct _IndicatorSessionClass
+{
+ IndicatorObjectClass parent_class;
};
-struct _IndicatorSession {
- IndicatorObject parent;
- IndicatorServiceManager * service;
+struct _IndicatorSession
+{
+ IndicatorObject parent;
+ IndicatorServiceManager * service;
IndicatorObjectEntry users;
IndicatorObjectEntry devices;
- gboolean show_users_entry;
- GCancellable * service_proxy_cancel;
- GDBusProxy * service_proxy;
+ GCancellable * service_proxy_cancel;
+ GDBusProxy * service_proxy;
};
static gboolean greeter_mode;
@@ -93,7 +94,6 @@ static void service_connection_cb (IndicatorServiceManager * sm, gboolean connec
static void receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, GVariant * parameters, gpointer user_data);
static void service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data);
static void user_real_name_get_cb (GObject * obj, GAsyncResult * res, gpointer user_data);
-static void user_menu_visibility_get_cb (GObject* obj, GAsyncResult* res, gpointer user_data);
static void indicator_session_class_init (IndicatorSessionClass *klass);
static void indicator_session_init (IndicatorSession *self);
@@ -125,7 +125,6 @@ indicator_session_init (IndicatorSession *self)
self->service = NULL;
self->service_proxy_cancel = NULL;
self->service_proxy = NULL;
- self->show_users_entry = FALSE;
/* Now let's fire these guys up. */
self->service = indicator_service_manager_new_version(INDICATOR_SESSION_DBUS_NAME,
@@ -242,18 +241,15 @@ indicator_session_finalize (GObject *object)
static GList*
indicator_session_get_entries (IndicatorObject* obj)
{
- g_return_val_if_fail(IS_INDICATOR_SESSION(obj), NULL);
+ g_return_val_if_fail(IS_INDICATOR_SESSION(obj), NULL);
IndicatorSession* self = INDICATOR_SESSION (obj);
g_debug ("get entries");
- GList * retval = NULL;
- // Only show the users menu if we have more than one
- if (self->show_users_entry == TRUE){
- retval = g_list_prepend (retval, &self->users);
- }
- retval = g_list_prepend (retval, &self->devices);
- return g_list_reverse (retval);
+ GList * entries = NULL;
+ entries = g_list_append (entries, &self->users);
+ entries = g_list_append (entries, &self->devices);
+ return entries;
}
static guint
@@ -282,14 +278,6 @@ service_connection_cb (IndicatorServiceManager * sm, gboolean connected, gpointe
// Its a reconnect !
// Fetch synchronisation data and return (proxy is still legit)
g_dbus_proxy_call (self->service_proxy,
- "GetUserMenuVisibility",
- NULL,
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- user_menu_visibility_get_cb,
- user_data);
- g_dbus_proxy_call (self->service_proxy,
"GetUserRealName",
NULL,
G_DBUS_CALL_FLAGS_NONE,
@@ -339,16 +327,6 @@ service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data)
g_signal_connect(proxy, "g-signal", G_CALLBACK(receive_signal), self);
- // Figure out whether we should show the user menu at all.
- g_dbus_proxy_call (self->service_proxy,
- "GetUserMenuVisibility",
- NULL,
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- user_menu_visibility_get_cb,
- user_data);
-
// Fetch the user's real name for the user entry label
g_dbus_proxy_call (self->service_proxy,
"GetUserRealName",
@@ -414,42 +392,6 @@ user_real_name_get_cb (GObject * obj, GAsyncResult * res, gpointer user_data)
return;
}
-static void
-user_menu_visibility_get_cb (GObject* obj, GAsyncResult* res, gpointer user_data)
-{
- IndicatorSession * self = INDICATOR_SESSION(user_data);
- GError * error = NULL;
- GVariant * result;
-
- result = g_dbus_proxy_call_finish(self->service_proxy, res, &error);
-
- if (error != NULL) {
- g_warning ("unable to complete real name dbus query");
- g_error_free (error);
- return;
- }
- gboolean update;
- g_variant_get (result, "(b)", &update);
-
- // If it is what we had before no need to do anything...
- if (self->show_users_entry == update){
- return;
- }
- //Otherwise
- self->show_users_entry = update;
-
- if (self->show_users_entry == TRUE){
- g_signal_emit_by_name ((gpointer)self,
- "entry-added",
- &self->users);
- }
- else{
- g_signal_emit_by_name ((gpointer)self,
- "entry-removed",
- &self->users);
- }
-}
-
/* Receives all signals from the service, routed to the appropriate functions */
static void
receive_signal (GDBusProxy * proxy,
@@ -465,30 +407,6 @@ receive_signal (GDBusProxy * proxy,
g_variant_get (parameters, "(&s)", &username);
indicator_session_update_users_label (self, username);
}
- else if (g_strcmp0(signal_name, "UserMenuIsVisible") == 0) {
- gboolean update;
- g_variant_get (parameters, "(b)", &update);
-
- // If it is what we had before no need to do anything...
- if (self->show_users_entry == update){
- return;
- }
-
- //Otherwise
- self->show_users_entry = update;
-
- if (self->show_users_entry == TRUE){
- g_signal_emit_by_name ((gpointer)self,
- "entry-added",
- &self->users);
-
- }
- else{
- g_signal_emit_by_name ((gpointer)self,
- "entry-removed",
- &self->users);
- }
- }
else if (g_strcmp0(signal_name, "RestartRequired") == 0) {
if (greeter_mode == TRUE){
indicator_image_helper_update(self->devices.image, GREETER_ICON_RESTART);
diff --git a/src/session-dbus.c b/src/session-dbus.c
index 232e440..124733a 100644
--- a/src/session-dbus.c
+++ b/src/session-dbus.c
@@ -38,7 +38,6 @@ static void bus_method_call (GDBusConnection * connection, const gchar * sender,
typedef struct _SessionDbusPrivate SessionDbusPrivate;
struct _SessionDbusPrivate {
gchar * name;
- gboolean user_menu_is_visible;
GDBusConnection * bus;
GCancellable * bus_cancel;
guint dbus_registration;
@@ -104,7 +103,6 @@ session_dbus_init (SessionDbus *self)
priv->bus = NULL;
priv->bus_cancel = NULL;
priv->dbus_registration = 0;
- priv->user_menu_is_visible = FALSE;
priv->bus_cancel = g_cancellable_new();
g_bus_get(G_BUS_TYPE_SESSION,
@@ -164,16 +162,12 @@ bus_method_call (GDBusConnection * connection, const gchar * sender,
GDBusMethodInvocation * invocation, gpointer user_data)
{
SessionDbus * service = SESSION_DBUS (user_data);
- SessionDbusPrivate * priv = SESSION_DBUS_GET_PRIVATE (service);
GVariant * retval = NULL;
if (g_strcmp0(method, "GetUserRealName") == 0) {
retval = get_users_real_name (service);
}
- else if (g_strcmp0 (method, "GetUserMenuVisibility") == 0){
- retval = g_variant_new ("(b)", priv->user_menu_is_visible);
- }
else {
g_warning("Calling method '%s' on the indicator service and it's unknown", method);
}
@@ -269,31 +263,6 @@ session_dbus_set_users_real_name (SessionDbus * session, const gchar * name)
return;
}
-void
-session_dbus_set_user_menu_visibility (SessionDbus* session,
- gboolean visible)
-{
- SessionDbusPrivate * priv = SESSION_DBUS_GET_PRIVATE(session);
- GError * error = NULL;
-
- priv->user_menu_is_visible = visible;
-
- if (priv->bus != NULL) {
- g_dbus_connection_emit_signal (priv->bus,
- NULL,
- INDICATOR_SESSION_SERVICE_DBUS_OBJECT,
- INDICATOR_SESSION_SERVICE_DBUS_IFACE,
- "UserMenuIsVisible",
- g_variant_new ("(b)", priv->user_menu_is_visible),
- &error);
-
- if (error != NULL) {
- g_warning("Unable to send UserMenuIsVisible signal: %s", error->message);
- g_error_free(error);
- }
- }
-}
-
void session_dbus_restart_required (SessionDbus* session)
{
SessionDbusPrivate * priv = SESSION_DBUS_GET_PRIVATE(session);
diff --git a/src/session-dbus.h b/src/session-dbus.h
index 4dc340a..7520f06 100644
--- a/src/session-dbus.h
+++ b/src/session-dbus.h
@@ -50,7 +50,6 @@ GType session_dbus_get_type (void);
SessionDbus * session_dbus_new (void);
void session_dbus_set_name (SessionDbus * session, const gchar * name);
void session_dbus_set_users_real_name (SessionDbus * session, const gchar * name);
-void session_dbus_set_user_menu_visibility (SessionDbus* session, gboolean visible);
void session_dbus_restart_required (SessionDbus* session);
G_END_DECLS
diff --git a/src/settings-helper.c b/src/settings-helper.c
index 6a09498..d8e858f 100644
--- a/src/settings-helper.c
+++ b/src/settings-helper.c
@@ -54,13 +54,6 @@ supress_confirmations (void) {
}
gboolean
-should_show_user_menu (void) {
- gboolean settings_built = build_settings();
- g_return_val_if_fail(settings_built, TRUE);
- return g_settings_get_boolean (settings, SHOW_USER_MENU) ;
-}
-
-gboolean
show_logout (void) {
gboolean settings_built = build_settings();
g_return_val_if_fail(settings_built, TRUE);
diff --git a/src/settings-helper.h b/src/settings-helper.h
index f50c4d8..29372f3 100644
--- a/src/settings-helper.h
+++ b/src/settings-helper.h
@@ -55,7 +55,6 @@ gboolean supress_confirmations (void);
gboolean show_logout (void);
gboolean show_restart (void);
gboolean show_shutdown (void);
-gboolean should_show_user_menu (void);
#endif /* __GCONF_HELPER__ */
diff --git a/src/user-menu-mgr.c b/src/user-menu-mgr.c
index 89fb841..2fe042a 100644
--- a/src/user-menu-mgr.c
+++ b/src/user-menu-mgr.c
@@ -294,12 +294,7 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self)
{
/* TODO: This needs to be updated once the ability to query guest session support is available */
GList * users = users_service_dbus_get_user_list (self->users_dbus_interface);
- const gint user_count = g_list_length(users);
const gboolean guest_enabled = users_service_dbus_guest_session_enabled (self->users_dbus_interface);
- const gboolean is_guest = guest_enabled && is_this_guest_session();
- const gboolean other_users_exist = user_count>1 || (is_guest && user_count>0);
- const gboolean visible = !self->greeter_mode && should_show_user_menu() && other_users_exist;
- session_dbus_set_user_menu_visibility (self->session_dbus_interface, visible);
/* TODO we should really return here if the menu is not going to be shown. */