public class Ephraim { public static int main(string[] args) { Gtk.init(ref args); Gtk.Builder builder = new Gtk.Builder(); try { builder.add_objects_from_file("ephraim.glade", {"MainWindow"}); } catch(Error e) { return 1; } unowned Gtk.Window window = builder.get_object("MainWindow") as Gtk.Window; window.hide.connect(Gtk.main_quit); unowned Gtk.MenuItem quitItem = builder.get_object("MenuItemQuit") as Gtk.MenuItem; quitItem.activate.connect(() => window.visible = false); unowned Gtk.TreeView rosterView = builder.get_object("Roster") as Gtk.TreeView; Gee.TreeMap conversations = new Gee.TreeMap(); unowned Gtk.Notebook conversationNotebook = builder.get_object("Conversations") as Gtk.Notebook; ContactList roster = new ContactList(rosterView); CoreConnector coreconn = new CoreConnector(); roster.start_conversation.connect((jid) => coreconn.start_conversation(jid)); coreconn.update_contact.connect(roster.update_contact); coreconn.new_conversation.connect((jid) => { Contact contact = roster.get_contact(jid); if(contact != null) { conversations[jid] = new Conversation(conversationNotebook, jid, contact.display_string); } else { conversations[jid] = new Conversation(conversationNotebook, jid, null); } conversations[jid].send_message.connect((type, message) => coreconn.send_message(jid, type, message)); }); coreconn.chat_message.connect((jid, type, from, message) => { if(!(jid in conversations.keys)) return; conversations[jid].chat_message(type, from, message); }); //if(!coreconn.start()) // return 1; coreconn.start(); window.visible = true; Gtk.main(); coreconn.stop(); return 0; } }