Skip to content

Commit dd5b6d1

Browse files
committed
refactor: Setting focus child on TimerPage (Vala)
1 parent c1a63a8 commit dd5b6d1

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

data/resources/ui/timer_page.blp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ template $ExerciseTimerTimerPage : Adw.NavigationPage {
6565
label: _("Finished!");
6666
}
6767
}
68-
Gtk.Box {
68+
Gtk.Box button_box {
6969
orientation: horizontal;
7070
halign: center;
7171
spacing: 12;
@@ -89,7 +89,7 @@ template $ExerciseTimerTimerPage : Adw.NavigationPage {
8989
visible: bind template.Finished;
9090
clicked => $restart();
9191
}
92-
Gtk.Button {
92+
Gtk.Button play_pause_button {
9393
css-classes: ["circular", "huge-button"];
9494
icon-name: bind template.PlayIconName;
9595
tooltip-text: bind template.PlayIconTooltip;

src/TimerPage.vala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace ExerciseTimer {
77
updateCssClass();
88
timer_label_box.set_direction(Gtk.TextDirection.LTR);
99
volume_button.get_first_child().css_classes = new string[] { "circular", "toggle", "large-button" };
10+
button_box.set_focus_child(play_pause_button);
1011

1112
var settings = new GLib.Settings(Config.AppId);
1213
settings.bind("beep-volume", volume_adjustment, "value", GLib.SettingsBindFlags.DEFAULT);
@@ -229,6 +230,10 @@ namespace ExerciseTimer {
229230
unowned Gtk.Adjustment volume_adjustment;
230231
[GtkChild]
231232
unowned Gtk.ScaleButton volume_button;
233+
[GtkChild]
234+
unowned Gtk.Box button_box;
235+
[GtkChild]
236+
unowned Gtk.Button play_pause_button;
232237

233238
private State current_state;
234239
private int remaining_sec;

0 commit comments

Comments
 (0)