From da9d63a1f166b989bcf5a7d9d2aa6d254cead487 Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Sat, 17 Oct 2020 14:26:17 +0200 Subject: [PATCH] Improvements. --- source/Connection.d | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/source/Connection.d b/source/Connection.d index 94438fa..a8f153b 100644 --- a/source/Connection.d +++ b/source/Connection.d @@ -21,6 +21,10 @@ public final class Connection : Thread private DClient client; private Address address; + /* TODO: Check if we need to protect */ + /* TODO: So far usage is in signal handlers (mutex safved) and within te-tl lock for notifications */ + private string currentChannel; + this(GUI gui, Address address) { super(&worker); @@ -36,6 +40,8 @@ public final class Connection : Thread box = getChatPane(); gui.notebook.add(box); + gui.notebook.setTabLabelText(box, "user@"~address.toString()); + gui.mainWindow.showAll(); @@ -64,7 +70,7 @@ public final class Connection : Thread te(); import std.conv; textArea.add(new Label(to!(string)(notificationData))); - gui.mainWindow.showAll(); + textArea.showAll(); process(notificationData); //gui.mainWindow.showAll(); @@ -171,6 +177,9 @@ public final class Connection : Thread /* Join the channel */ client.join(channelSelected); + /* Set this as the currently selected channel */ + currentChannel = channelSelected; + /* Fetch a list of members */ string[] members = client.getMembers(channelSelected); @@ -236,10 +245,15 @@ public final class Connection : Thread return box; } + private int getPageNum() + { + return gui.notebook.pageNum(box); + } + public void shutdown() { /* This is called from gui.d */ - int pageNum = gui.notebook.pageNum(box); + int pageNum = getPageNum(); if(pageNum == -1) {