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); Conversation conv = new Conversation(conversationNotebook, jid, contact != null ? contact.display_string : null); conversations[jid] = conv; conv.send_message.connect((type, message) => coreconn.send_message(jid, type, message)); }); coreconn.chat_message.connect((jid, from, type, message) => { if(!(jid in conversations.keys)) { warn_if_reached(); return; } conversations[jid].chat_message(from, type, message); }); //if(!coreconn.start()) // return 1; coreconn.start(); window.visible = true; Gtk.main(); coreconn.stop(); return 0; } }