diff --git a/src/application.vala b/src/application.vala index 5fbf9dd..09fbf3c 100644 --- a/src/application.vala +++ b/src/application.vala @@ -32,6 +32,7 @@ namespace Footerm { }; this.add_action_entries (action_entries, this); this.set_accels_for_action ("app.quit", {"q"}); + this.set_accels_for_action ("win.new_tab", { "T", null }); } public override void activate () { diff --git a/src/footerm.gresource.xml b/src/footerm.gresource.xml index c923920..24fdcf0 100644 --- a/src/footerm.gresource.xml +++ b/src/footerm.gresource.xml @@ -2,6 +2,7 @@ window.ui + pane.ui newpane.ui terminalpane.ui newserver.ui diff --git a/src/meson.build b/src/meson.build index f8f946b..36efd94 100644 --- a/src/meson.build +++ b/src/meson.build @@ -2,6 +2,7 @@ footerm_sources = [ 'main.vala', 'application.vala', 'window.vala', + 'pane.vala', 'newpane.vala', 'newserver.vala', 'terminalpane.vala', diff --git a/src/pane.ui b/src/pane.ui new file mode 100644 index 0000000..090c71a --- /dev/null +++ b/src/pane.ui @@ -0,0 +1,5 @@ + + + diff --git a/src/pane.vala b/src/pane.vala new file mode 100644 index 0000000..361aa92 --- /dev/null +++ b/src/pane.vala @@ -0,0 +1,35 @@ +/* pane.vala + * + * Copyright 2023 oupson + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +namespace FooTerm { + [GtkTemplate (ui = "/fr/oupson/FooTerm/pane.ui")] + public class Pane : Gtk.Box { + construct { + var new_pane = new FooTerm.NewPane(); + ulong handler_id; + handler_id = new_pane.on_server_selected.connect((s) => { + new_pane.disconnect (handler_id); + this.remove(new_pane); + this.append(new FooTerm.TerminalPane(s)); + }); + this.append(new_pane); + } + } +} diff --git a/src/window.ui b/src/window.ui index 4069947..e12a835 100644 --- a/src/window.ui +++ b/src/window.ui @@ -11,16 +11,32 @@ - - open-menu-symbolic - primary_menu + + + + tab-new-symbolic + win.new_tab + + + + + open-menu-symbolic + primary_menu + + - - + + view + + + + + True + tab_menu @@ -42,4 +58,38 @@ + +
+ + P_in Tab + tab.pin + action-disabled + + + Unp_in Tab + tab.unpin + action-disabled + +
+
+ + Close _Other Tabs + tab.close-other + + + Close Tabs to the _Left + tab.close-before + + + Close Tabs to the _Right + tab.close-after + +
+
+ + _Close + tab.close + +
+
diff --git a/src/window.vala b/src/window.vala index 06297d3..19635e4 100644 --- a/src/window.vala +++ b/src/window.vala @@ -22,21 +22,21 @@ namespace Footerm { [GtkTemplate (ui = "/fr/oupson/FooTerm/window.ui")] public class Window : Adw.ApplicationWindow { [GtkChild] - private unowned Gtk.Box pane_content; + private unowned Adw.TabView view; public Window (Gtk.Application app) { Object (application: app); } construct { - var new_pane = new FooTerm.NewPane(); - ulong handler_id; - handler_id = new_pane.on_server_selected.connect((s) => { - new_pane.disconnect (handler_id); - pane_content.remove(new_pane); - pane_content.append(new FooTerm.TerminalPane(s)); + var action = new SimpleAction("new_tab", null); + action.activate.connect (() => { + var a = view.append (new FooTerm.Pane()); + a.set_title ("New Pane"); }); - pane_content.append(new_pane); + this.add_action (action); + var a = view.append (new FooTerm.Pane()); + a.set_title ("New Pane"); } } }