~ubuntu-branches/ubuntu/oneiric/indicator-session/oneiric-proposed

« back to all changes in this revision

Viewing changes to src/user-menu-mgr.c

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher
  • Date: 2011-09-09 11:18:26 UTC
  • mfrom: (1.1.40 upstream)
  • Revision ID: package-import@ubuntu.com-20110909111826-5cu458yxgnu4k3nu
Tags: 0.3.5.0-0ubuntu1
* New upstream release:
  - fix the updates menu items randomly working (lp: #842946)
  - "Guest Session should not show if guest session was disabled in 
     the display manager" (lp: #835084)
  - segfault fix (lp: #840660)
  - don't display temporary guest user generated username (lp: #844272)
  - respect "show-real-name-on-panel" to hide the username (lp: #812728)

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
static void activate_guest_session (DbusmenuMenuitem * mi,
66
66
                                    guint timestamp,
67
67
                                    gpointer user_data);
 
68
                                    
68
69
 
69
70
G_DEFINE_TYPE (UserMenuMgr, user_menu_mgr, G_TYPE_OBJECT);
70
71
 
129
130
  if (can_activate == TRUE)
130
131
  {
131
132
    
 
133
    gboolean guest_enabled = users_service_dbus_guest_session_enabled (self->users_dbus_interface);
 
134
    GList * users = NULL;
 
135
    users = users_service_dbus_get_user_list (self->users_dbus_interface);
 
136
    self->user_count = g_list_length(users);
 
137
    
 
138
    gboolean gsettings_user_menu_is_visible = should_show_user_menu();
 
139
    
 
140
    if (gsettings_user_menu_is_visible == FALSE || greeter_mode == TRUE){
 
141
      session_dbus_set_user_menu_visibility (self->session_dbus_interface,
 
142
                                             FALSE);
 
143
    }
 
144
    else{
 
145
      // This needs to be updated once the ability to query guest session support is available
 
146
      session_dbus_set_user_menu_visibility (self->session_dbus_interface,
 
147
                                             guest_enabled || self->user_count > 1);
 
148
    }
 
149
    
 
150
    // TODO we should really return here if the menu is not going to be shown.
 
151
    
132
152
    if (check_new_session ()){
133
153
      switch_menuitem = dbusmenu_menuitem_new ();
134
154
      dbusmenu_menuitem_property_set (switch_menuitem,
144
164
                        self->users_dbus_interface);
145
165
    }    
146
166
    
147
 
    if (is_this_guest_session ())
 
167
    if ( !is_this_guest_session () && guest_enabled)
148
168
    {
149
169
      guest_mi = dbusmenu_menuitem_new ();
150
170
      dbusmenu_menuitem_property_set (guest_mi,
169
189
                                        _("Guest"));      
170
190
    }
171
191
    
172
 
    GList * users = NULL;
173
 
    users = users_service_dbus_get_user_list (self->users_dbus_interface);
174
 
    self->user_count = g_list_length(users);
175
 
    
176
 
    gboolean user_menu_is_visible = should_show_user_menu();
177
 
    
178
 
    if (user_menu_is_visible == FALSE || greeter_mode == TRUE){
179
 
      session_dbus_set_user_menu_visibility (self->session_dbus_interface,
180
 
                                             FALSE);
181
 
    }
182
 
    else{
183
 
      // This needs to be updated once the ability to query guest session support is available
184
 
      session_dbus_set_user_menu_visibility (self->session_dbus_interface,
185
 
                                             user_menu_is_visible);
186
 
    }
187
192
    
188
193
 
189
194
    if (self->user_count > MINIMUM_USERS && self->user_count < MAXIMUM_USERS) {
420
425
        if (geteuid() < 500) {
421
426
                /* System users shouldn't have guest account shown.  Mostly
422
427
                   this would be the case of the guest user itself. */
423
 
                return FALSE;
 
428
                return TRUE;
424
429
        }
425
430
 
426
 
        return TRUE;
 
431
        return FALSE;
427
432
}
428
433
 
429
434
/* Called when someone clicks on the guest session item. */