File lightdm-gtk-greeter-fix-login.patch of Package lightdm-gtk-greeter
Index: lightdm-gtk-greeter-1.3.1/src/lightdm-gtk-greeter.c
===================================================================
--- lightdm-gtk-greeter-1.3.1.orig/src/lightdm-gtk-greeter.c
+++ lightdm-gtk-greeter-1.3.1/src/lightdm-gtk-greeter.c
@@ -146,14 +146,14 @@ set_message_label (const gchar *text)
}
static void
-set_login_button_label (const gchar *username)
+set_login_button_label (LightDMGreeter *greeter, const gchar *username)
{
LightDMUser *user;
gboolean logged_in = FALSE;
user = lightdm_user_list_get_user_by_name (lightdm_user_list_get_instance (), username);
- /* Show 'Unlock' instead of 'Login' for an already logged in user */
- logged_in = user && lightdm_user_get_logged_in (user);
+ if (user && lightdm_greeter_get_lock_hint (greeter))
+ logged_in = lightdm_user_get_logged_in (user);
if (logged_in)
gtk_button_set_label (login_button, _("Unlock"));
else
@@ -292,10 +292,10 @@ start_session (void)
g_free (session);
}
-void user_treeview_selection_changed_cb (GtkTreeSelection *selection);
+void user_treeview_selection_changed_cb (GtkTreeSelection *selection, LightDMGreeter *greeter);
G_MODULE_EXPORT
void
-user_treeview_selection_changed_cb (GtkTreeSelection *selection)
+user_treeview_selection_changed_cb (GtkTreeSelection *selection, LightDMGreeter *greeter)
{
GtkTreeModel *model;
GtkTreeIter iter;
@@ -311,7 +311,7 @@ user_treeview_selection_changed_cb (GtkT
else
gtk_widget_hide (GTK_WIDGET (cancel_button));
- set_login_button_label (user);
+ set_login_button_label (greeter, user);
start_authentication (user);
g_free (user);
}
@@ -474,18 +474,22 @@ shutdown_cb (GtkWidget *widget, LightDMG
}
static void
-user_added_cb (LightDMUserList *user_list, LightDMUser *user)
+user_added_cb (LightDMUserList *user_list, LightDMUser *user, LightDMGreeter *greeter)
{
GtkTreeModel *model;
GtkTreeIter iter;
+ gboolean logged_in = FALSE;
model = gtk_tree_view_get_model (user_view);
+ if (lightdm_greeter_get_lock_hint (greeter))
+ logged_in = lightdm_user_get_logged_in (user);
+
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
0, lightdm_user_get_name (user),
1, lightdm_user_get_display_name (user),
- 2, lightdm_user_get_logged_in (user) ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
+ 2, logged_in ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
-1);
}
@@ -514,19 +518,23 @@ get_user_iter (const gchar *username, Gt
}
static void
-user_changed_cb (LightDMUserList *user_list, LightDMUser *user)
+user_changed_cb (LightDMUserList *user_list, LightDMUser *user, LightDMGreeter *greeter)
{
GtkTreeModel *model;
GtkTreeIter iter;
+ gboolean logged_in = FALSE;
if (!get_user_iter (lightdm_user_get_name (user), &iter))
return;
+ if (lightdm_greeter_get_lock_hint (greeter))
+ logged_in = lightdm_user_get_logged_in (user);
+
model = gtk_tree_view_get_model (user_view);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
0, lightdm_user_get_name (user),
1, lightdm_user_get_display_name (user),
- 2, lightdm_user_get_logged_in (user) ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
+ 2, logged_in ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
-1);
}
@@ -606,9 +614,10 @@ load_user_list ()
GtkTreeIter iter;
gchar *last_user;
const gchar *selected_user;
+ gboolean logged_in = FALSE;
- g_signal_connect (lightdm_user_list_get_instance (), "user-added", G_CALLBACK (user_added_cb), NULL);
- g_signal_connect (lightdm_user_list_get_instance (), "user-changed", G_CALLBACK (user_changed_cb), NULL);
+ g_signal_connect (lightdm_user_list_get_instance (), "user-added", G_CALLBACK (user_added_cb), greeter);
+ g_signal_connect (lightdm_user_list_get_instance (), "user-changed", G_CALLBACK (user_changed_cb), greeter);
g_signal_connect (lightdm_user_list_get_instance (), "user-removed", G_CALLBACK (user_removed_cb), NULL);
model = gtk_tree_view_get_model (user_view);
@@ -616,12 +625,14 @@ load_user_list ()
for (item = items; item; item = item->next)
{
LightDMUser *user = item->data;
+ if (lightdm_greeter_get_lock_hint (greeter))
+ logged_in = lightdm_user_get_logged_in (user);
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
0, lightdm_user_get_name (user),
1, lightdm_user_get_display_name (user),
- 2, lightdm_user_get_logged_in (user) ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
+ 2, logged_in ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
-1);
}
if (lightdm_greeter_get_has_guest_account_hint (greeter))
@@ -664,7 +675,7 @@ load_user_list ()
if (matched)
{
gtk_tree_selection_select_iter (gtk_tree_view_get_selection (user_view), &iter);
- set_login_button_label (selected_user);
+ set_login_button_label (greeter, selected_user);
start_authentication (selected_user);
break;
}