aboutsummaryrefslogtreecommitdiff
path: root/src/greeter-list.vala
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2014-12-06 10:35:38 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2014-12-06 10:35:38 +0100
commitc3bbc8fbf85d58e029ffec9ce6415859e55b66eb (patch)
treef3e14691fb07766c72be06c31c2b05acc34e1a95 /src/greeter-list.vala
parent2bc848327d75839aa87a5fc0619d2e2f49709efb (diff)
downloadarctica-greeter-c3bbc8fbf85d58e029ffec9ce6415859e55b66eb.tar.gz
arctica-greeter-c3bbc8fbf85d58e029ffec9ce6415859e55b66eb.tar.bz2
arctica-greeter-c3bbc8fbf85d58e029ffec9ce6415859e55b66eb.zip
Improve selection code of new entry if an entry is removed.
Diffstat (limited to 'src/greeter-list.vala')
-rw-r--r--src/greeter-list.vala21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/greeter-list.vala b/src/greeter-list.vala
index 62f3681..2433a10 100644
--- a/src/greeter-list.vala
+++ b/src/greeter-list.vala
@@ -456,22 +456,23 @@ public abstract class GreeterList : FadableBox
return;
var index = entries.index (entry);
- entry.destroy ();
- entries.remove (entry);
- /* Select another entry if the selected one was removed */
+ /* Select another entry if the selected one was removed */
if (entry == selected_entry)
{
- if (entries.length () == 1)
- index = 0;
- else if (index >= entries.length () && index > 0)
+ if (index > 0) {
index--;
- else if (index < entries.length ())
+ if (entries.nth_data (index) != null)
+ select_entry (entries.nth_data (index), -1.0);
+ }
+ else if (index < entries.length () -1 ) {
index++;
-
- if (entries.nth_data (index) != null)
- select_entry (entries.nth_data (index), -1.0);
+ if (entries.nth_data (index) != null)
+ select_entry (entries.nth_data (index), +1.0);
+ }
}
+ entries.remove (entry);
+ entry.destroy ();
/* Show a manual login if no users and no remote login entry */
if (!have_entries () && !UnityGreeter.singleton.show_remote_login_hint ())