diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/users-service-dbus.h | 5 | ||||
-rw-r--r-- | src/users-service.c | 28 |
2 files changed, 28 insertions, 5 deletions
diff --git a/src/users-service-dbus.h b/src/users-service-dbus.h index fc14beb..9ba05c9 100644 --- a/src/users-service-dbus.h +++ b/src/users-service-dbus.h @@ -50,8 +50,11 @@ struct _UserData UsersServiceDbus *service; }; +/* XXX - MAXIMUM_USERS should be set to 7 once we've + * got some gdm issues worked out. + */ #define MINIMUM_USERS 1 -#define MAXIMUM_USERS 7 +#define MAXIMUM_USERS 1 struct _UsersServiceDbus { GObject parent; diff --git a/src/users-service.c b/src/users-service.c index dc11e8d..9877ba6 100644 --- a/src/users-service.c +++ b/src/users-service.c @@ -53,6 +53,9 @@ static DbusmenuMenuitem *root_menuitem = NULL; static GMainLoop *mainloop = NULL; static UsersServiceDbus *dbus_interface = NULL; +static DbusmenuMenuitem *lock_menuitem = NULL; +static gboolean is_guest = FALSE; + static DBusGProxy * gdm_settings_proxy = NULL; static gboolean gdm_auto_login = FALSE; static const gchar * gdm_auto_login_string = "daemon/AutomaticLoginEnable"; @@ -78,6 +81,14 @@ gdm_settings_change (DBusGProxy * proxy, const gchar * value, const gchar * old, gdm_auto_login = FALSE; } + if (lock_menuitem != NULL) { + if (gdm_auto_login || is_guest) { + dbusmenu_menuitem_property_set(lock_menuitem, DBUSMENU_MENUITEM_PROP_SENSITIVE, "false"); + } else { + dbusmenu_menuitem_property_set(lock_menuitem, DBUSMENU_MENUITEM_PROP_SENSITIVE, "true"); + } + } + return; } @@ -277,10 +288,15 @@ rebuild_items (DbusmenuMenuitem *root, g_list_foreach (children, (GFunc)g_object_unref, NULL); g_list_free (children); - mi = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Lock Screen")); - g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(lock_screen), NULL); - dbusmenu_menuitem_child_append(root, mi); + lock_menuitem = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set(lock_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, _("Lock Screen")); + g_signal_connect(G_OBJECT(lock_menuitem), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(lock_screen), NULL); + dbusmenu_menuitem_child_append(root, lock_menuitem); + if (gdm_auto_login || is_guest) { + dbusmenu_menuitem_property_set(lock_menuitem, DBUSMENU_MENUITEM_PROP_SENSITIVE, "false"); + } else { + dbusmenu_menuitem_property_set(lock_menuitem, DBUSMENU_MENUITEM_PROP_SENSITIVE, "true"); + } if (can_activate == TRUE) { @@ -394,6 +410,10 @@ main (int argc, char ** argv) return 1; } + if (!g_strcmp0(g_get_user_name(), "guest")) { + is_guest = TRUE; + } + g_idle_add(build_gdm_proxy, NULL); dbus_interface = g_object_new (USERS_SERVICE_DBUS_TYPE, NULL); |