Sample/RooProjectProperties.js
[app.Builder.js] / Sample / RooProjectProperties.js
1 Gtk = imports.gi.Gtk;
2 Gdk = imports.gi.Gdk;
3 Pango = imports.gi.Pango;
4 GLib = imports.gi.GLib;
5 Gio = imports.gi.Gio;
6 GObject = imports.gi.GObject;
7 GtkSource = imports.gi.GtkSource;
8 WebKit = imports.gi.WebKit;
9 Vte = imports.gi.Vte;
10 console = imports.console;
11 XObject = imports.XObject.XObject;
12 RooProjectProperties=new XObject({
13     xtype: Gtk.Dialog,
14     modal : true,
15     show : function() {
16         // get the active project.
17         var file = this.get('/Window.LeftTree').getActiveFile();
18         if (!file) {
19             this.get('/StandardErrorDialog').show("No file is currently active");
20             return;
21         }
22         var project = this.get('/Window.LeftTree').getActiveFile().project;
23         print (project.fn);
24     
25         this.el.show_all();
26     },
27     default_width : 500,
28     listeners : {
29         "delete_event":function (self, event) {
30             this.el.hide()
31             return true;
32         },
33         "response":function (self, response_id) {
34            print(response_id);
35            if (!response_id) {
36               this.el.hide();
37               return;
38            }
39            // ok pressed..
40            this.el.hide();
41         }
42     },
43     items : [
44         {
45             xtype: Gtk.VBox,
46             pack : function(p,e) {
47                         p.el.get_content_area().add(e.el);
48                         e.border_width  =5;
49                     },
50             items : [
51                 {
52                     xtype: Gtk.Label,
53                     pack : "pack_start,false,false,0",
54                     label : "Javascript to run on before loading code"
55                 },
56                 {
57                     xtype: Gtk.ScrolledWindow,
58                     pack : "pack_end,true,true,0",
59                     items : [
60                         {
61                             xtype: GtkSource.View,
62                             pack : "add"
63                         }
64                     ]
65                 }
66             ]
67         },
68         {
69             xtype: Gtk.Button,
70             pack : "add_action_widget,1",
71             label : "OK"
72         },
73         {
74             xtype: Gtk.Button,
75             pack : "add_action_widget,0",
76             label : "Cancel"
77         }
78     ]
79 });
80 RooProjectProperties.init();
81 XObject.cache['/RooProjectProperties'] = RooProjectProperties;