summaryrefslogtreecommitdiffstats
path: root/src/gui/Conversation.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/Conversation.vala')
-rw-r--r--src/gui/Conversation.vala31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/gui/Conversation.vala b/src/gui/Conversation.vala
index 321fba9..629461e 100644
--- a/src/gui/Conversation.vala
+++ b/src/gui/Conversation.vala
@@ -1,9 +1,14 @@
public class Conversation {
private Gtk.Notebook conversations;
private Gtk.Widget widget;
+ private Gtk.TextView content;
+ private Gtk.Entry entry;
+ private string me;
private string jid;
private string display_name;
+
+ public signal void send_message(string type, string message);
private class TabLabel : Gtk.HBox {
public TabLabel(string label) {
@@ -21,8 +26,9 @@ public class Conversation {
}
}
- public Conversation(Gtk.Notebook conversations0, string jid0, string? display_name0) {
+ public Conversation(Gtk.Notebook conversations0, string me0, string jid0, string? display_name0) {
conversations = conversations0;
+ me = me0;
jid = jid0;
if(display_name0 != null)
@@ -38,8 +44,15 @@ public class Conversation {
}
widget = builder.get_object("Conversation") as Gtk.Widget;
- unowned Gtk.Label title = builder.get_object("ConversationTitle") as Gtk.Label;
+ content = builder.get_object("ConversationContent") as Gtk.TextView;
+ entry = builder.get_object("ConversationEntry") as Gtk.Entry;
+
+ entry.activate.connect((widget) => {
+ send_message("chat", entry.text);
+ entry.text = "";
+ });
+ unowned Gtk.Label title = builder.get_object("ConversationTitle") as Gtk.Label;
title.set_text("Conversation with " + display_name);
conversations.append_page(widget, new TabLabel(display_name));
@@ -48,4 +61,18 @@ public class Conversation {
~Conversation() {
conversations.remove(widget);
}
+
+ public void sent_message(string type, string message) {
+ if(type != "chat")
+ return;
+
+ content.buffer.text += me + ": " + message + "\n";
+ }
+
+ public void receive_message(string type, string message) {
+ if(type != "chat")
+ return;
+
+ content.buffer.text += display_name + ": " + message + "\n";
+ }
}