From 9efc81691426e023df3a2124a6d65a7f4e4fb327 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 29 Sep 2009 16:25:35 -0500 Subject: Making the locking menu item a global and make it sensitive based on whether there is autologin. --- src/users-service.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/users-service.c b/src/users-service.c index dc11e8d..894b832 100644 --- a/src/users-service.c +++ b/src/users-service.c @@ -53,6 +53,8 @@ static DbusmenuMenuitem *root_menuitem = NULL; static GMainLoop *mainloop = NULL; static UsersServiceDbus *dbus_interface = NULL; +static DbusmenuMenuitem *lock_menuitem = NULL; + static DBusGProxy * gdm_settings_proxy = NULL; static gboolean gdm_auto_login = FALSE; static const gchar * gdm_auto_login_string = "daemon/AutomaticLoginEnable"; @@ -78,6 +80,14 @@ gdm_settings_change (DBusGProxy * proxy, const gchar * value, const gchar * old, gdm_auto_login = FALSE; } + if (lock_menuitem != NULL) { + if (gdm_auto_login) { + 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 +287,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) { + 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) { -- cgit v1.2.3 From 36c4001d54b67fa5c687255d73f5db79a421db7f Mon Sep 17 00:00:00 2001 From: Cody Russell Date: Tue, 29 Sep 2009 16:52:32 -0500 Subject: Set MAXIMUM_USERS from 7 or 1 --- src/users-service-dbus.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3 From 13cb4dfa96124d14aaf86b422ff47c481acbcd49 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 29 Sep 2009 21:03:36 -0500 Subject: Checking to see if we're the guest user. No locking the guest. --- src/users-service.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/users-service.c b/src/users-service.c index 894b832..9877ba6 100644 --- a/src/users-service.c +++ b/src/users-service.c @@ -54,6 +54,7 @@ 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; @@ -81,7 +82,7 @@ gdm_settings_change (DBusGProxy * proxy, const gchar * value, const gchar * old, } if (lock_menuitem != NULL) { - if (gdm_auto_login) { + 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"); @@ -291,7 +292,7 @@ rebuild_items (DbusmenuMenuitem *root, 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) { + 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"); @@ -409,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); -- cgit v1.2.3 From 75bf969d3ee50d5d49817e1737b351eb0857b05c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 1 Oct 2009 15:17:43 -0500 Subject: 0.1.6 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 0ce9fbc..193e88c 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_INIT(src/indicator-session.c) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-session, 0.1.5) +AM_INIT_AUTOMAKE(indicator-session, 0.1.6) AM_MAINTAINER_MODE -- cgit v1.2.3