Skip to content

Commit

Permalink
MainWindow: Avoid naming child of stack
Browse files Browse the repository at this point in the history
  • Loading branch information
ryonakano committed Oct 28, 2023
1 parent 2c66af3 commit 5134a0f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public class MainWindow : Gtk.ApplicationWindow {
margin_start = 6,
margin_end = 6
};
stack.add_named (welcome_view, "welcome");
stack.add_named (countdown_view, "count");
stack.add_named (record_view, "record");
stack.add_child (welcome_view);
stack.add_child (countdown_view);
stack.add_child (record_view);

child = stack;
show_welcome ();
Expand All @@ -85,9 +85,9 @@ public class MainWindow : Gtk.ApplicationWindow {
return true;
case Gdk.Key.R:
if (Gdk.ModifierType.SHIFT_MASK in state) {
if (stack.visible_child_name == "welcome") {
if (stack.visible_child == welcome_view) {
welcome_view.trigger_recording ();
} else if (stack.visible_child_name == "record") {
} else if (stack.visible_child == record_view) {
var loop = new MainLoop ();
record_view.trigger_stop_recording.begin ((obj, res) => {
loop.quit ();
Expand Down Expand Up @@ -177,11 +177,11 @@ public class MainWindow : Gtk.ApplicationWindow {
}

public void show_welcome () {
stack.visible_child_name = "welcome";
stack.visible_child = welcome_view;
}

public void show_countdown () {
stack.visible_child_name = "count";
stack.visible_child = countdown_view;
countdown_view.init_countdown ();
countdown_view.start_countdown ();
}
Expand All @@ -196,7 +196,7 @@ public class MainWindow : Gtk.ApplicationWindow {

record_view.init_count ();
record_view.start_count ();
stack.visible_child_name = "record";
stack.visible_child = record_view;
}

private void show_error_dialog (string error_message) {
Expand Down

0 comments on commit 5134a0f

Please sign in to comment.