Test.GtkWriter.vala.c
[app.Builder.js] / Builder4 / RooProjectProperties.vala
1 /* -- to compile
2 valac  --pkg gio-2.0  --pkg posix  --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0  --pkg  libwnck-3.0 \
3     /tmp/RooProjectProperties.vala  -o /tmp/RooProjectProperties
4 */
5
6
7 /* -- to test class
8 static int main (string[] args) {
9     Gtk.init (ref args);
10     new Xcls_RooProjectProperties();
11     RooProjectProperties.show_all();
12      Gtk.main ();
13     return 0;
14 }
15 */
16
17
18 public static Xcls_RooProjectProperties  RooProjectProperties;
19
20 public class Xcls_RooProjectProperties
21 {
22     public Gtk.Dialog el;
23     private static Xcls_RooProjectProperties  _this;
24
25     public Xcls_view view;
26
27         // my vars
28     public Project.Project project;
29
30         // ctor 
31     public Xcls_RooProjectProperties()
32     {
33         this.el = new Gtk.Dialog();
34         _this = this;
35         RooProjectProperties = this;
36
37         // my vars
38
39         // set gobject values
40         this.el.default_width = 500;
41         this.el.modal = true;
42         var child_0 = new Xcls_VBox2();
43         this.el. get_content_area().add
44  (  child_0.el  );
45         var child_1 = new Xcls_Button6();
46         this.el.add_action_widget (  child_1.el , 1 );
47         var child_2 = new Xcls_Button7();
48         this.el.add_action_widget (  child_2.el , 0 );
49
50         // listeners 
51         this.el.delete_event.connect(   (self, event) => {
52             this.el.hide();
53              return true;
54         } );
55         this.el.response.connect(   (self, response_id)  => {
56            //print(response_id);
57            if (response_id< 1 ) {
58               this.el.hide();
59             
60               return;
61            }
62            
63            var buf =    view.el.get_buffer();
64            Gtk.TextIter s;
65              Gtk.TextIter e;
66             buf.get_start_iter(out s);
67             buf.get_end_iter(out e);
68             var str = buf.get_text(s,e,true);
69             // ideally we should syntax check it.. but it's html!?
70             
71            //var project = this.get('/Window.LeftTree').getActiveFile().project;
72            
73            
74            _this.project.runhtml = str;
75            _this.project.save();
76            
77           // imports.Builder.Provider.ProjectManager.ProjectManager.saveConfig();
78         //   print (str);
79            //    this.get('view').el.get_buffer().get_text(project.runjs, project.runjs.length);
80            // ok pressed..
81            this.el.hide();
82         } );
83     }
84
85     // userdefined functions 
86
87     // skip listeners - not pipe 
88
89     // skip .Project.Project:project - already used 
90
91     // skip default_width - already used 
92
93     // skip xtype - not pipe 
94
95     // skip |modal - already used 
96     public void show (Project.Project project) {
97             _this.project = project;
98             // get the active project.
99             
100             //print (project.fn);
101             //project.runhtml = project.runhtml || '';
102             _this.view.el.get_buffer().set_text(project.runhtml);
103             
104             this.el.show_all();
105         }
106
107     // skip |xns - no return type
108
109     // skip items - not pipe 
110
111     // skip id - not pipe 
112
113     // skip xvala_cls - not pipe 
114
115     // skip xvala_xcls - not pipe 
116
117     // skip xvala_id - not pipe 
118     public class Xcls_VBox2
119     {
120         public Gtk.VBox el;
121
122             // my vars
123
124             // ctor 
125         public Xcls_VBox2()
126         {
127             this.el = new Gtk.VBox( true, 0 );
128
129             // my vars
130
131             // set gobject values
132             this.el.border_width = 5;
133             var child_0 = new Xcls_Label3();
134             this.el.pack_start (  child_0.el , false,false,0 );
135             var child_1 = new Xcls_ScrolledWindow4();
136             this.el.pack_end (  child_1.el , true,true,0 );
137         }
138
139         // userdefined functions 
140
141         // skip border_width - already used 
142
143         // skip xtype - not pipe 
144
145         // skip |pack - already used 
146
147         // skip |xns - no return type
148
149         // skip items - not pipe 
150
151         // skip xvala_cls - not pipe 
152
153         // skip xvala_xcls - not pipe 
154
155         // skip xvala_id - not pipe 
156     }
157     public class Xcls_Label3
158     {
159         public Gtk.Label el;
160
161             // my vars
162
163             // ctor 
164         public Xcls_Label3()
165         {
166             this.el = new Gtk.Label( "HTML To insert at end of <HEAD>" );
167
168             // my vars
169
170             // set gobject values
171         }
172
173         // userdefined functions 
174
175         // skip |xns - no return type
176
177         // skip xtype - not pipe 
178
179         // skip pack - not pipe 
180
181         // skip label - already used 
182
183         // skip xvala_cls - not pipe 
184
185         // skip xvala_xcls - not pipe 
186
187         // skip xvala_id - not pipe 
188     }
189     public class Xcls_ScrolledWindow4
190     {
191         public Gtk.ScrolledWindow el;
192
193             // my vars
194
195             // ctor 
196         public Xcls_ScrolledWindow4()
197         {
198             this.el = new Gtk.ScrolledWindow( null, null );
199
200             // my vars
201
202             // set gobject values
203             var child_0 = new Xcls_view();
204             this.el.add (  child_0.el  );
205         }
206
207         // userdefined functions 
208
209         // skip |xns - no return type
210
211         // skip xtype - not pipe 
212
213         // skip pack - not pipe 
214
215         // skip items - not pipe 
216
217         // skip xvala_cls - not pipe 
218
219         // skip xvala_xcls - not pipe 
220
221         // skip xvala_id - not pipe 
222     }
223     public class Xcls_view
224     {
225         public Gtk.SourceView el;
226
227             // my vars
228
229             // ctor 
230         public Xcls_view()
231         {
232             this.el = new Gtk.SourceView();
233             _this.view = this;
234
235             // my vars
236
237             // set gobject values
238         }
239
240         // userdefined functions 
241
242         // skip |xns - no return type
243
244         // skip xtype - not pipe 
245
246         // skip pack - not pipe 
247
248         // skip id - not pipe 
249
250         // skip xvala_cls - not pipe 
251
252         // skip xvala_xcls - not pipe 
253
254         // skip xvala_id - not pipe 
255     }
256     public class Xcls_Button6
257     {
258         public Gtk.Button el;
259
260             // my vars
261
262             // ctor 
263         public Xcls_Button6()
264         {
265             this.el = new Gtk.Button();
266
267             // my vars
268
269             // set gobject values
270             this.el.label = "OK";
271         }
272
273         // userdefined functions 
274
275         // skip |xns - no return type
276
277         // skip xtype - not pipe 
278
279         // skip pack - not pipe 
280
281         // skip label - already used 
282
283         // skip xvala_cls - not pipe 
284
285         // skip xvala_xcls - not pipe 
286
287         // skip xvala_id - not pipe 
288     }
289     public class Xcls_Button7
290     {
291         public Gtk.Button el;
292
293             // my vars
294
295             // ctor 
296         public Xcls_Button7()
297         {
298             this.el = new Gtk.Button();
299
300             // my vars
301
302             // set gobject values
303             this.el.label = "Cancel";
304         }
305
306         // userdefined functions 
307
308         // skip |xns - no return type
309
310         // skip xtype - not pipe 
311
312         // skip pack - not pipe 
313
314         // skip label - already used 
315
316         // skip xvala_cls - not pipe 
317
318         // skip xvala_xcls - not pipe 
319
320         // skip xvala_id - not pipe 
321     }
322 }