mirror of https://github.com/oupson/FooTerm.git
Change tab name
This commit is contained in:
parent
ef8f570ba5
commit
533617d59f
|
@ -30,15 +30,19 @@ namespace Footerm {
|
||||||
[GtkChild]
|
[GtkChild]
|
||||||
private unowned Footerm.TerminalPane terminal_pane;
|
private unowned Footerm.TerminalPane terminal_pane;
|
||||||
|
|
||||||
|
public signal void title_changed (string new_title);
|
||||||
|
|
||||||
construct {
|
construct {
|
||||||
this.new_pane.on_server_selected.connect ((s) => {
|
this.new_pane.on_server_selected.connect ((s) => {
|
||||||
this.footerm_pane_stack.set_visible_child (this.terminal_pane);
|
this.footerm_pane_stack.set_visible_child (this.terminal_pane);
|
||||||
|
this.title_changed (s.name);
|
||||||
|
this.terminal_pane.title_changed.connect ((s) => this.title_changed (s));
|
||||||
this.terminal_pane.connect_to_server_async (s);
|
this.terminal_pane.connect_to_server_async (s);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void close () {
|
public async void close () {
|
||||||
yield this.terminal_pane.disconnect_from_server();
|
yield this.terminal_pane.disconnect_from_server ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,8 @@ namespace Footerm {
|
||||||
private int old_terminal_width = 0;
|
private int old_terminal_width = 0;
|
||||||
private int old_terminal_height = 0;
|
private int old_terminal_height = 0;
|
||||||
|
|
||||||
|
public signal void title_changed(string new_title);
|
||||||
|
|
||||||
construct {
|
construct {
|
||||||
this.configure_terminal();
|
this.configure_terminal();
|
||||||
}
|
}
|
||||||
|
@ -83,6 +85,13 @@ namespace Footerm {
|
||||||
this.terminal.set_enable_sixel(true);
|
this.terminal.set_enable_sixel(true);
|
||||||
this.terminal.char_size_changed.connect(this.terminal_appearance_changed);
|
this.terminal.char_size_changed.connect(this.terminal_appearance_changed);
|
||||||
this.terminal.contents_changed.connect(this.terminal_appearance_changed);
|
this.terminal.contents_changed.connect(this.terminal_appearance_changed);
|
||||||
|
this.terminal.window_title_changed.connect((t) => {
|
||||||
|
var terminal_title = t.window_title;
|
||||||
|
if (terminal_title.length == 0) {
|
||||||
|
terminal_title = this.server.name;
|
||||||
|
}
|
||||||
|
this.title_changed(terminal_title);
|
||||||
|
});
|
||||||
this.setup_terminal_theme();
|
this.setup_terminal_theme();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,13 +32,19 @@ namespace Footerm {
|
||||||
this.view.close_page.connect (this.close_page);
|
this.view.close_page.connect (this.close_page);
|
||||||
var action = new SimpleAction ("new_tab", null);
|
var action = new SimpleAction ("new_tab", null);
|
||||||
action.activate.connect (() => {
|
action.activate.connect (() => {
|
||||||
var a = view.append (new Footerm.Pane ());
|
this.create_new_pane ();
|
||||||
a.set_title ("New Pane");
|
|
||||||
view.set_selected_page (a);
|
|
||||||
});
|
});
|
||||||
this.add_action (action);
|
this.add_action (action);
|
||||||
var a = view.append (new Footerm.Pane ());
|
this.create_new_pane ();
|
||||||
a.set_title ("New Pane");
|
}
|
||||||
|
|
||||||
|
private void create_new_pane () {
|
||||||
|
var pane = new Footerm.Pane ();
|
||||||
|
var tab_page = this.view.append (pane);
|
||||||
|
tab_page.set_title ("New Pane");
|
||||||
|
pane.title_changed.connect ((title) => {
|
||||||
|
tab_page.set_title (title);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool close_page (Adw.TabView tab_view, Adw.TabPage page) {
|
private bool close_page (Adw.TabView tab_view, Adw.TabPage page) {
|
||||||
|
|
Loading…
Reference in New Issue