Skip to content

Commit

Permalink
Remove unnecessary cast
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Wootten authored and Jeremy Wootten committed Jan 2, 2025
1 parent 8bd1d3c commit 696327a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ namespace Terminal {

var pos = notebook.tab_menu_target != null ?
notebook.tab_view.get_page_position (notebook.tab_menu_target) + 1 :
(int)notebook.n_pages;
notebook.n_pages;

new_tab (term.get_shell_location (), null, true, pos);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/TerminalView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Terminal.TerminalView : Gtk.Box {
public signal void new_tab_requested ();
public signal void tab_duplicated (Hdy.TabPage page);

public uint n_pages {
public int n_pages {
get {
return tab_view.n_pages;
}
Expand Down
8 changes: 4 additions & 4 deletions src/tests/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ namespace Terminal.Test.Application {
option ("{'new-tab':<true>}", "@a{sv} {}", () => {
unowned var window = (MainWindow) application.active_window;
assert_nonnull (window);
var n_tabs = (int) window.notebook.n_pages;
var n_tabs = window.notebook.n_pages;
assert_cmpint (n_tabs, CompareOperator.EQ, 2);
});

option ("{'new-tab':<false>}", "@a{sv} {}", () => {
unowned var window = (MainWindow) application.active_window;
assert_nonnull (window);
var n_tabs = (int) window.notebook.n_pages;
var n_tabs = window.notebook.n_pages;
assert_cmpint (n_tabs, CompareOperator.EQ, 1);
});
});
Expand All @@ -176,15 +176,15 @@ namespace Terminal.Test.Application {
option ("{'execute':<[b'%s']>}".printf (string.joinv ("',b'", execute)), "@a{sv} {}", () => {
unowned var window = (MainWindow) application.active_window;
assert_nonnull (window);
var n_tabs = (int) window.notebook.n_pages;
var n_tabs = window.notebook.n_pages;
assert_cmpint (n_tabs, CompareOperator.EQ, 5); // include the guaranted extra tab
});

// invalid
option ("{'execute':<[b'',b'',b'']>}", "@a{sv} {}", () => {
unowned var window = (MainWindow) application.active_window;
assert_nonnull (window);
var n_tabs = (int) window.notebook.n_pages;
var n_tabs = window.notebook.n_pages;
assert_cmpint (n_tabs, CompareOperator.EQ, 1);
});
});
Expand Down

0 comments on commit 696327a

Please sign in to comment.