diff options
author | Clement Lefebvre <clement.lefebvre@linuxmint.com> | 2023-02-06 10:07:02 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2023-02-06 12:08:33 +0100 |
commit | 6101635251b611916c8f4ba7d18a6d396038ff3a (patch) | |
tree | 05e15389994ec9fe160fdbf9966324b266ef5326 /src/toggle-box.vala | |
parent | 499274f3da9d7adc0e9c42ce3bf6f9bd0a571128 (diff) | |
download | arctica-greeter-6101635251b611916c8f4ba7d18a6d396038ff3a.tar.gz arctica-greeter-6101635251b611916c8f4ba7d18a6d396038ff3a.tar.bz2 arctica-greeter-6101635251b611916c8f4ba7d18a6d396038ff3a.zip |
sessions: Make the list scrollable.
Ported from Slick Greeter ported by Mike Gabriel.
https://github.com/linuxmint/slick-greeter/commit/1480b029099ea24724d307943dc742a42fcd3159
Diffstat (limited to 'src/toggle-box.vala')
-rw-r--r-- | src/toggle-box.vala | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/toggle-box.vala b/src/toggle-box.vala index 518275f..5301583 100644 --- a/src/toggle-box.vala +++ b/src/toggle-box.vala @@ -24,6 +24,7 @@ public class ToggleBox : Gtk.Box public string default_key {get; construct;} public string starting_key {get; construct;} public string selected_key {get; protected set;} + protected Gtk.Box scrolled_box; public static string font = AGSettings.get_string (AGSettings.KEY_FONT_NAME); public static string font_family = "sans"; @@ -33,6 +34,16 @@ public class ToggleBox : Gtk.Box { Object (default_key: default_key, starting_key: starting_key, selected_key: starting_key); + Gtk.ScrolledWindow scrolled_window = new Gtk.ScrolledWindow (null, null); + scrolled_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 2); + add (scrolled_window); + scrolled_window.add (scrolled_box); + scrolled_window.show (); + scrolled_box.show (); + scrolled_window.set_max_content_height (210); // Show a max of 5 sessions + scrolled_window.set_propagate_natural_height (true); + scrolled_window.set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); + scrolled_window.set_shadow_type (Gtk.ShadowType.NONE); /* Split font family and size via regular expression. */ Regex font_regexp = new Regex ("^([[:blank:]]*)(?<font_family>[ a-zA-Z0-9]+) (?<font_size>[0-9]+)([[:blank:]]*)$"); @@ -55,7 +66,7 @@ public class ToggleBox : Gtk.Box select (item); item.show (); - add (item); + scrolled_box.add (item); } public void set_normal_button_style (Gtk.Button button) |