diff options
Diffstat (limited to 'src/gui/Conversation.vala')
-rw-r--r-- | src/gui/Conversation.vala | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/gui/Conversation.vala b/src/gui/Conversation.vala new file mode 100644 index 0000000..321fba9 --- /dev/null +++ b/src/gui/Conversation.vala @@ -0,0 +1,51 @@ +public class Conversation { + private Gtk.Notebook conversations; + private Gtk.Widget widget; + private string jid; + private string display_name; + + + private class TabLabel : Gtk.HBox { + public TabLabel(string label) { + pack_start(new Gtk.Label(label), false, true, 0); + + Gtk.Button closeButton = new Gtk.Button(); + Gdk.Pixbuf closeImage = render_icon(Gtk.STOCK_CLOSE, (Gtk.IconSize)(-1), null); + //Gtk.Image closeImage = new Gtk.Image.from_stock(Gtk.STOCK_CLOSE, (Gtk.IconSize)4); + closeButton.image = new Gtk.Image.from_pixbuf(closeImage.scale_simple(16, 16, Gdk.InterpType.BILINEAR)); + //closeButton.width_request = 20; + closeButton.height_request = 20; + pack_end(closeButton, false, false, 0); + + show_all(); + } + } + + public Conversation(Gtk.Notebook conversations0, string jid0, string? display_name0) { + conversations = conversations0; + jid = jid0; + + if(display_name0 != null) + display_name = display_name0; + else + display_name = jid; + + Gtk.Builder builder = new Gtk.Builder(); + try { + builder.add_objects_from_file("ephraim.glade", {"Conversation"}); + } catch(Error e) { + + } + + widget = builder.get_object("Conversation") as Gtk.Widget; + 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)); + } + + ~Conversation() { + conversations.remove(widget); + } +} |