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.VBox rosterView = builder.get_object("Roster") as Gtk.VBox; Gee.TreeMap conversations = new Gee.TreeMap(); unowned Gtk.Notebook conversationNotebook = builder.get_object("Conversations") as Gtk.Notebook; Roster roster = new Roster(rosterView); // FIXME string me = "/me"; 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, me, jid, contact.display_string); } else { conversations[jid] = new Conversation(conversationNotebook, me, jid, null); } conversations[jid].send_message.connect((type, message) => coreconn.send_message(jid, type, message)); }); coreconn.receive_message.connect((jid, type, message) => { if(!(jid in conversations)) return; conversations[jid].receive_message(type, message); }); coreconn.sent_message.connect((jid, type, message) => { if(!(jid in conversations)) return; conversations[jid].sent_message(type, message); }); //if(!coreconn.start()) // return 1; coreconn.start(); window.visible = true; Gtk.main(); coreconn.stop(); return 0; } }