Set the tab's title to that of the channel's name

This commit is contained in:
Tristan B. Kildaire 2020-10-18 12:34:06 +02:00
parent 5da6691c4a
commit b442c36101
2 changed files with 21 additions and 2 deletions

View File

@ -11,9 +11,13 @@ import gtk.Box;
import gtk.ListBox;
import gtk.Label;
import gtk.TextView;
import libdnet.dclient;
import gtk.Label;
public final class Channel
{
private DClient client;
/**
* Channel details
*/
@ -35,8 +39,9 @@ public final class Channel
private ListBox textArea;
private TextView textInput;
this(string channelName)
this(DClient client, string channelName)
{
this.client = client;
this.channelName = channelName;
initializeBox();
@ -92,4 +97,14 @@ public final class Channel
{
return channelName;
}
public void populateUsersList()
{
string[] memberList = client.getMembers(channelName);
foreach(string member; memberList)
{
users.add(new Label(member));
}
}
}

View File

@ -254,7 +254,7 @@ public final class Connection : Thread
client.join(channelSelected);
/* Create the Channel object */
Channel newChannel = new Channel(channelSelected);
Channel newChannel = new Channel(client, channelSelected);
/* Add the channel */
addChannel(newChannel);
@ -264,10 +264,14 @@ public final class Connection : Thread
/* Get the Widgets container for this channel and add a tab for it */
notebookSwitcher.add(newChannel.getBox());
notebookSwitcher.setTabLabelText(newChannel.getBox(), newChannel.getName());
writeln("hdsjghjsd");
writeln("first time: "~channelSelected);
/* Get the user's list */
newChannel.populateUsersList();
}
/* Switch to the channel's pane */