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.Table,
53                     pack : "pack_start,true,true,3",
54                     init : function() {
55                         this.el = new Gtk.Table.c_new(1,2, true);
56                         XObject.prototype.init.call(this);
57                     
58                     },
59                     items : [
60                         {
61                             xtype: Gtk.Label,
62                             pack : "attach,0,1,0,1,0,0,0,0",
63                             label : "baseURL "
64                         },
65                         {
66                             xtype: Gtk.Entry,
67                             pack : "attach,1,2,0,1,5"
68                         },
69                         {
70                             xtype: Gtk.Label,
71                             pack : "attach,0,1,1,2,0,0,1,0",
72                             label : "login:"
73                         },
74                         {
75                             xtype: Gtk.Entry,
76                             pack : "attach,1,2,1,2,5"
77                         },
78                         {
79                             xtype: Gtk.Label,
80                             pack : "attach,0,1,2,3,0,0,1,0",
81                             label : "password"
82                         },
83                         {
84                             xtype: Gtk.Entry,
85                             pack : "attach,1,2,2,3,5",
86                             visibility : false
87                         }
88                     ]
89                 }
90             ]
91         },
92         {
93             xtype: Gtk.Button,
94             pack : "add_action_widget,1",
95             label : "OK"
96         },
97         {
98             xtype: Gtk.Button,
99             pack : "add_action_widget,0",
100             label : "Cancel"
101         }
102     ]
103 });
104 RooProjectProperties.init();
105 XObject.cache['/RooProjectProperties'] = RooProjectProperties;