Merge lp:~hbayindir/lightdm-gtk-greeter/lightdm-gtk-greeter into lp:~lightdm-gtk-greeter-team/lightdm-gtk-greeter/trunk

Proposed by Hakan Bayındır on 2016-06-07
Status: Needs review
Proposed branch: lp:~hbayindir/lightdm-gtk-greeter/lightdm-gtk-greeter
Merge into: lp:~lightdm-gtk-greeter-team/lightdm-gtk-greeter/trunk
Diff against target: 107 lines (+59/-3)
1 file modified
src/lightdm-gtk-greeter.c (+59/-3)
To merge this branch: bzr merge lp:~hbayindir/lightdm-gtk-greeter/lightdm-gtk-greeter
Reviewer Review Type Date Requested Status
Sean Davis 2016-06-07 Pending
Review via email: mp+296637@code.launchpad.net

Description of the change

Increase the ergonomics and usefulness of the greeter in systems where password expiration is enabled. Disabled GTK animations and multiple line infobar messages enable all messages to be shown accurately and enables users to understand what is going on.

To post a comment you must log in.

Unmerged revisions

348. By Hakan Bayındır on 2016-06-07

Enable support for multiline messages in the infobar. Useful in password changing flows.

347. By Hakan Bayındır on 2016-06-07

Disable GTK animations to prevent InfoBar from disappearing during password change flows.

346. By Hakan Bayındır on 2016-06-06

This change disables GTK animations inside the LightDM, since a bug [0] in the
infobar implementations supresses quick transitions; LDAP password change
scenarios are become impossible to complete when encountered by normal,
ordinary users.

[0]: https://bugzilla.gnome.org/show_bug.cgi?id=710888

345. By Hakan Bayındır on 2016-06-06

This patch enables LightDM to show multiple non-prompt messages in the infobar.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/lightdm-gtk-greeter.c'
2--- src/lightdm-gtk-greeter.c 2015-11-18 05:00:06 +0000
3+++ src/lightdm-gtk-greeter.c 2016-06-07 07:49:15 +0000
4@@ -188,6 +188,10 @@
5 /* Screensaver values */
6 static int timeout, interval, prefer_blanking, allow_exposures;
7
8+/* Support variables for multiple messages in InfoBar */
9+gboolean append_next_prompt = FALSE;
10+gchar *long_infobar_message = NULL;
11+
12 /* Handling monitors backgrounds */
13 static const gint USER_BACKGROUND_DELAY = 250;
14 static GreeterBackground *greeter_background;
15@@ -1141,19 +1145,60 @@
16 return;
17 }
18
19+ g_debug ("[process_prompts] Entering while loop");
20+
21 while (pending_questions)
22 {
23 PAMConversationMessage *message = (PAMConversationMessage *) pending_questions->data;
24 pending_questions = g_slist_remove (pending_questions, (gconstpointer) message);
25
26+ g_debug ("[process_prompts] Message is a prompt: %d", message->is_prompt);
27+ g_debug ("[process_prompts] Value of type union is %d", message->type.message);
28+ g_debug ("[process_prompts] Text of the message is %s", message->text);
29+
30 if (!message->is_prompt)
31 {
32- /* FIXME: this doesn't show multiple messages, but that was
33- * already the case before. */
34- set_message_label (message->type.message, message->text);
35+ g_debug ("[process_prompts] Setting message %s since it's a prompt", message->text);
36+
37+ if (!append_next_prompt)
38+ {
39+ /*
40+ * Since we're going to change the message label anyway,
41+ * We won't need that message anymore.
42+ */
43+ if (long_infobar_message != NULL)
44+ {
45+ g_free (long_infobar_message);
46+ long_infobar_message = NULL;
47+ }
48+ set_message_label (message->type.message, message->text);
49+ }
50+ else
51+ {
52+ long_infobar_message = g_strjoin ("\n", gtk_label_get_text (message_label), message->text, NULL);
53+ /* Use the last message's type as the type. */
54+ set_message_label (message->type.message, long_infobar_message);
55+ }
56+
57+ g_debug ("[process_prompts] Setting append next prompt to TRUE");
58+ append_next_prompt = TRUE;
59 continue;
60 }
61
62+ /* If we're reached here, we're going to write different things to the infobar. */
63+ g_debug ("[process_prompts] Setting append next prompt to FALSE");
64+ append_next_prompt = FALSE;
65+
66+ /*
67+ * If we've reached here, the message label is gonna change below,
68+ * so we won't need that message.
69+ */
70+ if (long_infobar_message != NULL)
71+ {
72+ g_free (long_infobar_message);
73+ long_infobar_message = NULL;
74+ }
75+
76 gtk_widget_show (GTK_WIDGET (password_entry));
77 gtk_widget_grab_focus (GTK_WIDGET (password_entry));
78 gtk_entry_set_text (password_entry, "");
79@@ -1172,10 +1217,18 @@
80 str = g_strndup (str, strlen (str) - 2);
81 else if (g_str_has_suffix (str, ":"))
82 str = g_strndup (str, strlen (str) - 1);
83+
84+ g_debug ("[process_prompts] Message is a prompt, but no messages beforehand, so setting prompt as message");
85+
86 set_message_label (LIGHTDM_MESSAGE_TYPE_INFO, str);
87 if (str != message->text)
88 g_free (str);
89 }
90+ else if (message->type.prompt == LIGHTDM_PROMPT_TYPE_SECRET)
91+ {
92+ g_debug ("[process_prompts] Message is a prompt, but it's secret. Not setting prompt as message");
93+ }
94+
95 gtk_widget_grab_focus (GTK_WIDGET (password_entry));
96 prompted = TRUE;
97 password_prompted = TRUE;
98@@ -2793,6 +2846,9 @@
99 clock_menuitem = GTK_WIDGET (gtk_builder_get_object (builder, "clock_menuitem"));
100 host_menuitem = GTK_WIDGET (gtk_builder_get_object (builder, "host_menuitem"));
101
102+ /* Disable GTK Toolkit animations to prevent missing infobar messages bug */
103+ g_object_set (gtk_settings_get_default(), "gtk-enable-animations", FALSE, NULL);
104+
105 /* Power dialog */
106 power_window = GTK_WIDGET (gtk_builder_get_object (builder, "power_window"));
107 power_ok_button = GTK_BUTTON (gtk_builder_get_object (builder, "power_ok_button"));

Subscribers

People subscribed via source and target branches