Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/Cards/ManualCard.vala
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ public class Greeter.ManualCard : Greeter.BaseCard {
form_grid.attach (label, 0, 1, 2);
form_grid.attach (username_entry, 0, 2);
form_grid.attach (password_entry, 0, 3);
form_grid.attach (session_button, 1, 2, 1, 2);
form_grid.attach (caps_lock_revealer, 0, 4, 2);
if (!session_button.single_session) {
form_grid.attach (session_button, 1, 2, 1, 2);
}
form_grid.attach (caps_lock_revealer,
0, 4, session_button.single_session ? 1 : 2);

main_box = new Gtk.Box (VERTICAL, 0) {
margin_top = 12,
Expand Down
11 changes: 8 additions & 3 deletions src/Cards/UserCard.vala
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ public class Greeter.UserCard : Greeter.BaseCard {
};
password_grid.attach (password_entry, 0, 0);
password_grid.attach (fingerprint_image, 1, 0);
password_grid.attach (password_session_button, 2, 0);
password_grid.attach (new Greeter.CapsLockRevealer (), 0, 1, 3);
if (!password_session_button.single_session) {
password_grid.attach (password_session_button, 2, 0);
}
password_grid.attach (new Greeter.CapsLockRevealer (),
0, 1, password_session_button.single_session ? 2 : 3);

var login_button = new Gtk.Button.with_label (_("Log In"));
login_button.add_css_class (Granite.CssClass.SUGGESTED);
Expand All @@ -73,7 +76,9 @@ public class Greeter.UserCard : Greeter.BaseCard {

var login_box = new Gtk.Box (HORIZONTAL, 6);
login_box.append (login_button);
login_box.append (login_button_session_button);
if (!login_button_session_button.single_session) {
login_box.append (login_button_session_button);
}

var disabled_box = new Gtk.Box (HORIZONTAL, 6) {
halign = Gtk.Align.CENTER,
Expand Down
4 changes: 4 additions & 0 deletions src/Widgets/SessionButton.vala
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*/

public class Greeter.SessionButton : Granite.Bin {
public bool single_session { get; private set; }

construct {
var menu = new GLib.Menu ();
unowned var application = (Gtk.Application) GLib.Application.get_default ();
Expand All @@ -25,5 +27,7 @@ public class Greeter.SessionButton : Granite.Bin {
};

child = menu_button;

single_session = menu.get_n_items () == 1;
}
}