Add a basic UI
[moonshot-ui.git] / src / moonshot-window.vala
1 using Gtk;
2
3 class MainWindow : Window
4 {
5
6     private TextView text_view;
7
8     public MainWindow()
9     {
10         this.title = "Moonshoot";
11         this.position = WindowPosition.CENTER;
12         set_default_size (400, 300);
13
14         build_ui();
15         connect_signals();
16     }
17
18     private void build_ui()
19     {
20         var toolbar = new Toolbar ();
21         var open_button = new ToolButton (null, "Open"); //.from_stock (Stock.OPEN);
22         open_button.is_important = true;
23         toolbar.add (open_button);
24         //open_button.clicked.connect (on_open_clicked);
25
26         this.text_view = new TextView ();
27         this.text_view.editable = true;
28         this.text_view.cursor_visible = true;
29
30         var scroll = new ScrolledWindow (null, null);
31         scroll.set_policy (PolicyType.AUTOMATIC, PolicyType.AUTOMATIC);
32         scroll.add (this.text_view);
33
34         var vbox = new VBox (false, 0);
35         vbox.pack_start (toolbar, false, true, 0);
36         vbox.pack_start (scroll, true, true, 0);
37         add (vbox);
38     }
39
40     private void connect_signals()
41     {
42         this.destroy.connect (Gtk.main_quit);
43     }
44
45     public static int main(string[] args)
46     {
47         Gtk.init(ref args);
48
49         Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
50         Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
51         Intl.textdomain (Config.GETTEXT_PACKAGE);
52
53         var window = new MainWindow();
54         window.show_all();
55
56         Gtk.main();
57
58         return 0;
59     }
60 }