summaryrefslogtreecommitdiffstats
path: root/src/gui/Ephraim.vala
blob: cf87965537fe41c0474100a6a8fdfe0760698508 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
public class Ephraim {
  public static int main(string[] args) {
    Gtk.init(ref args);
    
    Gtk.Builder builder = new Gtk.Builder();
    try {
      builder.add_from_file("ephraim.glade");
    } catch(Error e) {
      return 1;
    }
    
    Roster roster = new Roster();
    CoreConnector coreconn = new CoreConnector(roster);
    
    if(!coreconn.start())
      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;
    rosterView.set_model(roster.get_default_group());
    
    rosterView.append_column(new Gtk.TreeViewColumn.with_attributes("Contact", new CellRendererContact(), "contact", 0, null));
    
    window.visible = true;
    
    Gtk.main();
    
    coreconn.stop();
    
    return 0;
  }
}