~euclide/euclide/trunk

« back to all changes in this revision

Viewing changes to templates/templates/granite/src/MainWindow.vala

  • Committer: Mario Guerriero
  • Date: 2013-05-25 14:46:55 UTC
  • Revision ID: mefrio.g@gmail.com-20130525144655-oz63qkgtpzguv0ml
improved granite's template

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
namespace $$NAME {
 
2
    
 
3
    public class MainWindow : Gtk.Window {
 
4
        
 
5
        private $$NAMEApp app;
 
6
        
 
7
        public MainWindow ($$NAMEApp app) {
 
8
            this.app = app;
 
9
            this.set_application (app);
 
10
            
 
11
            this.set_size_request (350, 200);
 
12
            this.window_position = Gtk.WindowPosition.CENTER;
 
13
            
 
14
            // Build UI
 
15
            setup_ui ();
 
16
            this.show_all ();
 
17
        }
 
18
        
 
19
        private void setup_ui () {
 
20
            var box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
 
21
            
 
22
            // Toolbar
 
23
            var toolbar = new Gtk.Toolbar ();
 
24
            
 
25
            // AppMenu
 
26
            var menu = new Gtk.Menu ();
 
27
            var app_menu = (this.app as Granite.Application).create_appmenu (menu);
 
28
            
 
29
            // Populate the toolbar
 
30
            var item = new Gtk.ToolItem ();
 
31
            item.set_expand (true);
 
32
            
 
33
            toolbar.add (item);
 
34
            toolbar.add (app_menu);
 
35
            
 
36
            // Add everything to window
 
37
            box.pack_start (toolbar, false, true, 0);
 
38
            
 
39
            this.add (box);
 
40
        }
 
41
    }
 
42
}