2020
2121public class Badger.MainGrid : Gtk .Box {
2222 delegate void SetInterval (uint interval );
23+ public Gtk . Revealer revealer;
2324
2425 public MainGrid (Reminder [] reminders ) {
2526 var settings = new GLib .Settings (" com.github.elfenware.badger.timers" );
@@ -41,6 +42,7 @@ public class Badger.MainGrid : Gtk.Box {
4142 halign = Gtk . Align . END ,
4243 hexpand = true ,
4344 valign = Gtk . Align . CENTER ,
45+ margin_bottom = 18
4446 };
4547 settings. bind (" all" , global_switch, " active" , SettingsBindFlags . DEFAULT );
4648 var heading = new Granite .HeaderLabel (_ (" Reminders" )) {
@@ -52,23 +54,28 @@ public class Badger.MainGrid : Gtk.Box {
5254 global_box.append (global_switch );
5355 append (global_box );
5456
57+ // This is everything below the switch.
58+ var scale_box = new Gtk .Box (Gtk . Orientation . VERTICAL , 0 );
59+ scale_box. vexpand = true ;
60+
61+
5562
5663 /* ***********************************************/
5764 /* Label to explain */
5865 /* ***********************************************/
5966
6067 var subheading = new Gtk .Label (_ (" Decide how often Badger should remind you to relax these:" )) {
6168 halign = Gtk . Align . START ,
62- margin_top = 18 ,
63- margin_bottom = 6
69+ margin_top = 12 ,
70+ margin_bottom = 0
6471 };
6572 subheading.add_css_class (Granite .STYLE_CLASS_H4_LABEL );
6673 subheading.add_css_class ("title -4 ");
6774
68- append (subheading );
75+ scale_box. append (subheading );
6976
7077 var marks = new Marks ();
71- append (marks );
78+ scale_box. append (marks );
7279
7380 HashTable<string, Gtk . Scale > scales = new HashTable<string, Gtk . Scale > (str_hash, str_equal);
7481
@@ -97,9 +104,6 @@ public class Badger.MainGrid : Gtk.Box {
97104 /* All the scales */
98105 /* ***********************************************/
99106
100- var scale_box = new Gtk .Box (Gtk . Orientation . VERTICAL , 0 );
101- scale_box. vexpand = true ;
102-
103107 for (int index = 0 ; index < reminders .length ; index ++) {
104108 Reminder reminder = reminders[index];
105109
@@ -161,9 +165,6 @@ public class Badger.MainGrid : Gtk.Box {
161165
162166 }
163167
164- append (scale_box );
165-
166-
167168 /* *******************************************/
168169 /* DnD Label */
169170 /* *******************************************/
@@ -174,6 +175,19 @@ public class Badger.MainGrid : Gtk.Box {
174175 margin_bottom = 6
175176 };
176177 hey.add_css_class ("accent ");
177- append (hey );
178+ scale_box.append (hey );
179+
180+ /* *************************************************/
181+ /* Scales revealer */
182+ /* *************************************************/
183+
184+ // If the "all" flag is false, the switch is off, hide the scales
185+ Gtk . Revealer revealer = new Gtk .Revealer ();
186+ revealer.set_transition_type (Gtk .RevealerTransitionType .SLIDE_DOWN );
187+ settings.bind ("all ", revealer , "reveal_child ", SettingsBindFlags .DEFAULT );
188+
189+ revealer.set_child (scale_box );
190+ append (revealer );
191+
178192 }
179193}
0 commit comments