This commit is contained in:
Murilo Venturoso 2019-01-10 16:28:16 -02:00
parent f3d956002e
commit ee306b626e
2 changed files with 8 additions and 5 deletions

View File

@ -206,7 +206,7 @@ namespace EasySSH {
var notebook = select_host.notebook; var notebook = select_host.notebook;
notebook.hexpand = true; notebook.hexpand = true;
if(notebook.n_tabs == 0) { if(notebook.n_tabs == 0) {
var connect = new Connection(select_host, notebook, window); var connect = new Connection(select_host, notebook, window, this);
var tab = new Granite.Widgets.Tab (select_host.name, null, connect); var tab = new Granite.Widgets.Tab (select_host.name, null, connect);
notebook.insert_tab(tab, 0); notebook.insert_tab(tab, 0);
}else if(notebook.n_tabs > 0) { }else if(notebook.n_tabs > 0) {
@ -362,7 +362,7 @@ namespace EasySSH {
n.tab_removed.connect(() => { n.tab_removed.connect(() => {
if(n.n_tabs == 0) { if(n.n_tabs == 0) {
var n_host = hostmanager.get_host_by_name(host.name); var n_host = hostmanager.get_host_by_name(host.name);
var n_connect = new Connection(n_host, n, window); var n_connect = new Connection(n_host, n, window, this);
var n_tab = new Granite.Widgets.Tab (n_host.name, null, n_connect); var n_tab = new Granite.Widgets.Tab (n_host.name, null, n_connect);
n.insert_tab(n_tab, 0); n.insert_tab(n_tab, 0);
window.current_terminal = null; window.current_terminal = null;
@ -475,7 +475,7 @@ namespace EasySSH {
return (TerminalWidget)((TerminalBox)tab.page).term; return (TerminalWidget)((TerminalBox)tab.page).term;
} }
private void set_badge_item (Granite.Widgets.SourceList.Item item, Granite.Widgets.DynamicNotebook notebook){ public void set_badge_item (Granite.Widgets.SourceList.Item item, Granite.Widgets.DynamicNotebook notebook){
if(notebook.n_tabs == 0){ if(notebook.n_tabs == 0){
item.badge = null; item.badge = null;
}else if(notebook.n_tabs == 1){ }else if(notebook.n_tabs == 1){

View File

@ -27,14 +27,16 @@ namespace EasySSH {
private Gtk.Label title; private Gtk.Label title;
private Gtk.Label description; private Gtk.Label description;
public MainWindow window {get; construct;} public MainWindow window {get; construct;}
public SourceListView sourcelist {get; construct;}
public Connection (Host host, Granite.Widgets.DynamicNotebook notebook, MainWindow window) { public Connection (Host host, Granite.Widgets.DynamicNotebook notebook, MainWindow window, SourceListView sourcelist) {
Object ( Object (
orientation: Gtk.Orientation.VERTICAL, orientation: Gtk.Orientation.VERTICAL,
valign: Gtk.Align.CENTER, valign: Gtk.Align.CENTER,
host: host, host: host,
notebook: notebook, notebook: notebook,
window: window window: window,
sourcelist: sourcelist
); );
} }
@ -86,6 +88,7 @@ namespace EasySSH {
notebook.insert_tab (tab, next_tab); notebook.insert_tab (tab, next_tab);
notebook.remove_tab(notebook.current); notebook.remove_tab(notebook.current);
notebook.current = tab; notebook.current = tab;
sourcelist.set_badge_item (host.item, notebook);
destroy(); destroy();
} }