diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2024-05-28 15:37:12 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2024-05-28 15:39:23 +0200 |
commit | f5f819ead1453ef1b817f843890686a5685632cf (patch) | |
tree | 2b8be4081a1cb15761ba483bceaf6b451575c13d | |
parent | 5a2e16b8405236a76c09de77120a03e50254c5bf (diff) | |
download | arctica-greeter-f5f819ead1453ef1b817f843890686a5685632cf.tar.gz arctica-greeter-f5f819ead1453ef1b817f843890686a5685632cf.tar.bz2 arctica-greeter-f5f819ead1453ef1b817f843890686a5685632cf.zip |
Add user filter to greeter's user list.
-rw-r--r-- | data/org.ArcticaProject.arctica-greeter.gschema.xml | 8 | ||||
-rw-r--r-- | src/settings.vala | 2 | ||||
-rw-r--r-- | src/user-list.vala | 14 |
3 files changed, 24 insertions, 0 deletions
diff --git a/data/org.ArcticaProject.arctica-greeter.gschema.xml b/data/org.ArcticaProject.arctica-greeter.gschema.xml index 67f8e83..56ef09b 100644 --- a/data/org.ArcticaProject.arctica-greeter.gschema.xml +++ b/data/org.ArcticaProject.arctica-greeter.gschema.xml @@ -174,6 +174,14 @@ <default>[]</default> <summary>List of usernames that are hidden until a special key combination is hit.</summary> </key> + <key name="user-filter" type="as"> + <default>[]</default> + <summary>List of usernames that are to be shown in the userlist only.</summary> + </key> + <key name="user-filter-always" type="b"> + <default>false</default> + <summary>Always filter-out users not listed in user-filter even if user-filter is empty.</summary> + </key> <key name="group-filter" type="as"> <default>[]</default> <summary>List of groups that users must be part of to be shown (empty list shows all users).</summary> diff --git a/src/settings.vala b/src/settings.vala index 7d1ce8f..6bdfe5d 100644 --- a/src/settings.vala +++ b/src/settings.vala @@ -56,6 +56,8 @@ public class AGSettings : Object public const string KEY_PLAY_READY_SOUND = "play-ready-sound"; public const string KEY_INDICATORS = "indicators"; public const string KEY_HIDDEN_USERS = "hidden-users"; + public const string KEY_USER_FILTER= "user-filter"; + public const string KEY_USER_FILTER_ALWAYS = "user-filter-always"; public const string KEY_GROUP_FILTER = "group-filter"; public const string KEY_IDLE_TIMEOUT = "idle-timeout"; public const string KEY_ACTIVATE_NUMLOCK = "activate-numlock"; diff --git a/src/user-list.vala b/src/user-list.vala index dee3850..3936768 100644 --- a/src/user-list.vala +++ b/src/user-list.vala @@ -1128,6 +1128,20 @@ public class UserList : GreeterList return; } + var user_filter = AGSettings.get_strv (AGSettings.KEY_USER_FILTER); + bool user_filter_always = AGSettings.get_boolean (AGSettings.KEY_USER_FILTER_ALWAYS); + + if ((user_filter_always) || (user_filter.length != 0)) + { + var match_found = false; + foreach (var username in user_filter) + if (username == user.name) + match_found = true; + // bail-out if user.name is not in user_filter + if (match_found == false) + return; + } + if (!filter_group (user.name)) return; |