Improvements.

This commit is contained in:
Tristan B. Kildaire 2020-10-17 14:26:17 +02:00
parent e164054849
commit da9d63a1f1
1 changed files with 16 additions and 2 deletions

View File

@ -21,6 +21,10 @@ public final class Connection : Thread
private DClient client; private DClient client;
private Address address; 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) this(GUI gui, Address address)
{ {
super(&worker); super(&worker);
@ -36,6 +40,8 @@ public final class Connection : Thread
box = getChatPane(); box = getChatPane();
gui.notebook.add(box); gui.notebook.add(box);
gui.notebook.setTabLabelText(box, "user@"~address.toString());
gui.mainWindow.showAll(); gui.mainWindow.showAll();
@ -64,7 +70,7 @@ public final class Connection : Thread
te(); te();
import std.conv; import std.conv;
textArea.add(new Label(to!(string)(notificationData))); textArea.add(new Label(to!(string)(notificationData)));
gui.mainWindow.showAll(); textArea.showAll();
process(notificationData); process(notificationData);
//gui.mainWindow.showAll(); //gui.mainWindow.showAll();
@ -171,6 +177,9 @@ public final class Connection : Thread
/* Join the channel */ /* Join the channel */
client.join(channelSelected); client.join(channelSelected);
/* Set this as the currently selected channel */
currentChannel = channelSelected;
/* Fetch a list of members */ /* Fetch a list of members */
string[] members = client.getMembers(channelSelected); string[] members = client.getMembers(channelSelected);
@ -236,10 +245,15 @@ public final class Connection : Thread
return box; return box;
} }
private int getPageNum()
{
return gui.notebook.pageNum(box);
}
public void shutdown() public void shutdown()
{ {
/* This is called from gui.d */ /* This is called from gui.d */
int pageNum = gui.notebook.pageNum(box); int pageNum = getPageNum();
if(pageNum == -1) if(pageNum == -1)
{ {