aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-09-06 18:19:12 +0100
committerConor Curran <conor.curran@canonical.com>2011-09-06 18:19:12 +0100
commit8eb3b24c20bb5d5da1ddbdb6b8ab83c3b02b53db (patch)
tree1e42a429cefc18f57153d2d72dd232b8a623bace /src
parentf177b1e0b8ab0413a6eced41de3710e38852319a (diff)
parentc6857c3028b36d35f69079e3c0e5510597997f75 (diff)
downloadayatana-indicator-session-8eb3b24c20bb5d5da1ddbdb6b8ab83c3b02b53db.tar.gz
ayatana-indicator-session-8eb3b24c20bb5d5da1ddbdb6b8ab83c3b02b53db.tar.bz2
ayatana-indicator-session-8eb3b24c20bb5d5da1ddbdb6b8ab83c3b02b53db.zip
added new gsettings entry to control visibility of the user menu
Diffstat (limited to 'src')
-rw-r--r--src/settings-helper.c6
-rw-r--r--src/settings-helper.h3
-rw-r--r--src/user-menu-mgr.c26
3 files changed, 22 insertions, 13 deletions
diff --git a/src/settings-helper.c b/src/settings-helper.c
index 5a69d17..d70df95 100644
--- a/src/settings-helper.c
+++ b/src/settings-helper.c
@@ -53,6 +53,12 @@ supress_confirmations (void) {
}
gboolean
+should_show_user_menu (void) {
+ build_settings();
+ return g_settings_get_boolean (settings, SHOW_USER_MENU) ;
+}
+
+gboolean
show_logout (void) {
build_settings();
return !g_settings_get_boolean (settings, LOGOUT_KEY) ;
diff --git a/src/settings-helper.h b/src/settings-helper.h
index 7b377ca..ae57575 100644
--- a/src/settings-helper.h
+++ b/src/settings-helper.h
@@ -36,6 +36,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#define LOGOUT_KEY "suppress-logout-menuitem"
#define RESTART_KEY "suppress-restart-menuitem"
#define SHUTDOWN_KEY "suppress-shutdown-menuitem"
+#define SHOW_USER_MENU "user-show-menu"
#define LOCKDOWN_SCHEMA "org.gnome.desktop.lockdown"
#define LOCKDOWN_KEY_USER "disable-user-switching"
@@ -56,5 +57,7 @@ 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 a4308dd..16c6e3b 100644
--- a/src/user-menu-mgr.c
+++ b/src/user-menu-mgr.c
@@ -18,7 +18,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <libdbusmenu-glib/client.h>
-
#include "user-menu-mgr.h"
#include "settings-helper.h"
#include "dbus-shared-names.h"
@@ -54,22 +53,19 @@ static void activate_online_accounts (DbusmenuMenuitem *mi,
gpointer user_data);
static void activate_user_accounts (DbusmenuMenuitem *mi,
guint timestamp,
- gpointer user_data);
-
+ gpointer user_data);
static void user_menu_mgr_rebuild_items (UserMenuMgr *self,
gboolean greeter_mode);
static gboolean check_new_session ();
static void user_change (UsersServiceDbus *service,
const gchar *user_id,
gpointer user_data);
-
static void ensure_settings_client ();
-static gboolean check_guest_session (void);
+static gboolean is_this_guest_session (void);
static void activate_guest_session (DbusmenuMenuitem * mi,
guint timestamp,
gpointer user_data);
-
G_DEFINE_TYPE (UserMenuMgr, user_menu_mgr, G_TYPE_OBJECT);
@@ -148,7 +144,7 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode)
self->users_dbus_interface);
}
- if (check_guest_session ())
+ if (is_this_guest_session ())
{
guest_mi = dbusmenu_menuitem_new ();
dbusmenu_menuitem_property_set (guest_mi,
@@ -177,14 +173,18 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode)
users = users_service_dbus_get_user_list (self->users_dbus_interface);
self->user_count = g_list_length(users);
- gboolean user_menu_is_visible = FALSE;
+ gboolean user_menu_is_visible = should_show_user_menu();
- if (!greeter_mode){
- user_menu_is_visible = TRUE;
+ if (user_menu_is_visible == FALSE || greeter_mode == TRUE){
+ session_dbus_set_user_menu_visibility (self->session_dbus_interface,
+ FALSE);
+ }
+ else{
+ // This needs to be updated once the ability to query guest session support is available
+ session_dbus_set_user_menu_visibility (self->session_dbus_interface,
+ user_menu_is_visible);
}
- session_dbus_set_user_menu_visibility (self->session_dbus_interface,
- user_menu_is_visible);
if (self->user_count > MINIMUM_USERS && self->user_count < MAXIMUM_USERS) {
users = g_list_sort (users, (GCompareFunc)compare_users_by_username);
@@ -415,7 +415,7 @@ user_mgr_get_root_item (UserMenuMgr* self)
/* Checks to see if we should show the guest suession item */
static gboolean
-check_guest_session (void)
+is_this_guest_session (void)
{
if (geteuid() < 500) {
/* System users shouldn't have guest account shown. Mostly