← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~ted/indicator-session/lock-insensitively into lp:indicator-session

 

Ted Gould has proposed merging lp:~ted/indicator-session/lock-insensitively into lp:indicator-session.

    Requested reviews:
    Indicator Applet Developers (indicator-applet-developers)


Make it so that the lock screen item's sensitivity is also controlled by the gdm autologin setting.
-- 
https://code.launchpad.net/~ted/indicator-session/lock-insensitively/+merge/12618
Your team ayatana-commits is subscribed to branch lp:indicator-session.
=== modified file 'src/users-service.c'
--- src/users-service.c	2009-09-24 21:54:11 +0000
+++ src/users-service.c	2009-09-29 21:35:17 +0000
@@ -53,6 +53,8 @@
 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_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 @@
   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)
     {


Follow ups