← Back to team overview

ayatana-commits team mailing list archive

lp:~cjcurran/indicator-session/hide-user-menu-via-gsettings-key into lp:indicator-session

 

Conor Curran has proposed merging lp:~cjcurran/indicator-session/hide-user-menu-via-gsettings-key into lp:indicator-session.

Requested reviews:
  Ted Gould (ted)
Related bugs:
  Bug #834137 in Session Menu: "user menu says [Invalid UTF-8]"
  https://bugs.launchpad.net/indicator-session/+bug/834137

For more details, see:
https://code.launchpad.net/~cjcurran/indicator-session/hide-user-menu-via-gsettings-key/+merge/74262

The user menu turns up on the live CD, this new gsettings entry will allow casper to set the usermenu entry to false for the live cd and hence always ensure the user menu is hidden during the live session.
-- 
https://code.launchpad.net/~cjcurran/indicator-session/hide-user-menu-via-gsettings-key/+merge/74262
Your team ayatana-commits is subscribed to branch lp:indicator-session.
=== modified file 'src/settings-helper.c'
--- src/settings-helper.c	2011-08-22 12:32:00 +0000
+++ src/settings-helper.c	2011-09-06 16:53:38 +0000
@@ -53,6 +53,12 @@
 }
 
 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) ;

=== modified file 'src/settings-helper.h'
--- src/settings-helper.h	2011-08-19 20:09:03 +0000
+++ src/settings-helper.h	2011-09-06 16:53:38 +0000
@@ -36,6 +36,7 @@
 #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 show_logout (void);
 gboolean show_restart (void);
 gboolean show_shutdown (void);
+gboolean should_show_user_menu (void);
+
 
 #endif /* __GCONF_HELPER__ */

=== modified file 'src/user-menu-mgr.c'
--- src/user-menu-mgr.c	2011-08-30 16:17:19 +0000
+++ src/user-menu-mgr.c	2011-09-06 16:53:38 +0000
@@ -18,7 +18,6 @@
 */
 
 #include <libdbusmenu-glib/client.h>
-
 #include "user-menu-mgr.h"
 #include "settings-helper.h"
 #include "dbus-shared-names.h"
@@ -54,22 +53,19 @@
                                       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 @@
                         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 @@
     users = users_service_dbus_get_user_list (self->users_dbus_interface);
     self->user_count = g_list_length(users);
     
-    gboolean user_menu_is_visible = FALSE;
-    
-    if (!greeter_mode){
-      user_menu_is_visible = TRUE;
-    }
-    
-    session_dbus_set_user_menu_visibility (self->session_dbus_interface,
-                                           user_menu_is_visible);
+    gboolean user_menu_is_visible = should_show_user_menu();
+    
+    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);
+    }
+    
 
     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 @@
 
 /* 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


Follow ups