diff options
author | Conor Curran <conor.curran@canonical.com> | 2011-08-18 12:45:50 +0100 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2011-08-18 12:45:50 +0100 |
commit | dce6ee5caccdf9f9683bad26d062671a889792ee (patch) | |
tree | 3ec6f8862d88f3f87ede4e6837e93698e42286e9 | |
parent | fbc3c1069a1472d0c5229eb6bcd583e784fcc963 (diff) | |
download | ayatana-indicator-session-dce6ee5caccdf9f9683bad26d062671a889792ee.tar.gz ayatana-indicator-session-dce6ee5caccdf9f9683bad26d062671a889792ee.tar.bz2 ayatana-indicator-session-dce6ee5caccdf9f9683bad26d062671a889792ee.zip |
greeter mode uses to flag whether we are showing the user menu or not
-rw-r--r-- | src/session-service.c | 2 | ||||
-rw-r--r-- | src/user-menu-mgr.c | 24 | ||||
-rw-r--r-- | src/user-menu-mgr.h | 3 |
3 files changed, 16 insertions, 13 deletions
diff --git a/src/session-service.c b/src/session-service.c index fa212fd..753e304 100644 --- a/src/session-service.c +++ b/src/session-service.c @@ -118,7 +118,7 @@ main (int argc, char ** argv) if (!greeter_mode) { // Users - UserMenuMgr* user_mgr = user_menu_mgr_new (session_dbus); + UserMenuMgr* user_mgr = user_menu_mgr_new (session_dbus, greeter_mode); DbusmenuServer* users_server = dbusmenu_server_new (INDICATOR_USERS_DBUS_OBJECT); dbusmenu_server_set_root (users_server, user_mgr_get_root_item (user_mgr)); } diff --git a/src/user-menu-mgr.c b/src/user-menu-mgr.c index f2757ad..72b5802 100644 --- a/src/user-menu-mgr.c +++ b/src/user-menu-mgr.c @@ -29,7 +29,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>. static GConfClient * gconf_client = NULL; static DbusmenuMenuitem *switch_menuitem = NULL; - struct _UserMenuMgr { GObject parent_instance; @@ -50,7 +49,8 @@ static gint compare_users_by_username (const gchar *a, static void activate_online_accounts (DbusmenuMenuitem *mi, guint timestamp, gpointer user_data); -static void user_menu_mgr_rebuild_items (UserMenuMgr *self); +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, @@ -99,7 +99,7 @@ user_menu_mgr_class_init (UserMenuMgrClass *klass) /* Builds up the menu for us */ static void -user_menu_mgr_rebuild_items (UserMenuMgr *self) +user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) { DbusmenuMenuitem *mi = NULL; DbusmenuMenuitem *guest_mi = NULL; @@ -145,7 +145,6 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self) if (check_guest_session ()) { - g_debug ("ADDING GUEST SESSION"); guest_mi = dbusmenu_menuitem_new (); dbusmenu_menuitem_property_set (guest_mi, DBUSMENU_MENUITEM_PROP_TYPE, @@ -164,16 +163,19 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self) users_service_dbus_set_guest_item (self->users_dbus_interface, guest_mi); } - else{ - g_debug ("NOT ADDING GUEST SESSION"); - } GList * users = NULL; users = users_service_dbus_get_user_list (self->users_dbus_interface); self->user_count = g_list_length(users); - g_debug ("USER COUNT = %i", self->user_count); - session_dbus_set_user_menu_visibility (self->session_dbus_interface, self->user_count > 1); + gboolean user_menu_is_visible = FALSE; + + if (!greeter_mode){ + user_menu_is_visible = self->user_count > 1; + } + + 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); @@ -418,11 +420,11 @@ activate_guest_session (DbusmenuMenuitem * mi, guint timestamp, gpointer user_da /* * Clean Entry Point */ -UserMenuMgr* user_menu_mgr_new (SessionDbus* session_dbus) +UserMenuMgr* user_menu_mgr_new (SessionDbus* session_dbus, gboolean greeter_mode) { UserMenuMgr* user_mgr = g_object_new (USER_TYPE_MENU_MGR, NULL); user_mgr->session_dbus_interface = session_dbus; - user_menu_mgr_rebuild_items (user_mgr); + user_menu_mgr_rebuild_items (user_mgr, greeter_mode); return user_mgr; } diff --git a/src/user-menu-mgr.h b/src/user-menu-mgr.h index ff2cb77..01823e7 100644 --- a/src/user-menu-mgr.h +++ b/src/user-menu-mgr.h @@ -45,7 +45,8 @@ struct _UserMenuMgrClass }; GType user_menu_mgr_get_type (void) G_GNUC_CONST; -UserMenuMgr* user_menu_mgr_new (SessionDbus* session_dbus); +UserMenuMgr* user_menu_mgr_new (SessionDbus* session_dbus, + gboolean greeter_mode); DbusmenuMenuitem* user_mgr_get_root_item (UserMenuMgr* self); G_END_DECLS |