Test.GtkWriter.vala.c
[app.Builder.js] / Builder4 / EditProject.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/EditProject.vala  -o /tmp/EditProject
4 */
5
6
7 /* -- to test class
8 static int main (string[] args) {
9     Gtk.init (ref args);
10     new Xcls_EditProject();
11     EditProject.show_all();
12      Gtk.main ();
13     return 0;
14 }
15 */
16
17
18 public static Xcls_EditProject  EditProject;
19
20 public class Xcls_EditProject
21 {
22     public Gtk.Dialog el;
23     private static Xcls_EditProject  _this;
24
25     public Xcls_xtype xtype;
26     public Xcls_cellrender cellrender;
27     public Xcls_model model;
28     public Xcls_dir dir;
29
30         // my vars
31     public signal void success(Project.Project project);
32
33         // ctor 
34     public Xcls_EditProject()
35     {
36         this.el = new Gtk.Dialog();
37         _this = this;
38         EditProject = this;
39
40         // my vars
41
42         // set gobject values
43         this.el.border_width = 3;
44         this.el.default_height = 500;
45         this.el.default_width = 600;
46         this.el.deletable = true;
47         this.el.modal = true;
48         this.el.title = "Project Properties";
49         var child_0 = new Xcls_VBox2();
50         this.el. get_content_area().add 
51  
52  (  child_0.el  );
53         var child_1 = new Xcls_Button9();
54         this.el.add_action_widget (  child_1.el , 1 );
55         var child_2 = new Xcls_Button10();
56         this.el.add_action_widget (  child_2.el , 0 );
57
58         // listeners 
59         this.el.destroy_event.connect(  (self, event) => {
60              this.el.hide();
61                         return false;
62         } );
63         this.el.response.connect(   (self, id) => {
64              if (id < 1) {
65                     this.el.hide();
66                     return;
67             }
68             if (_this.xtype.getValue().length < 1) {
69                 StandardErrorDialog.show("You have to set Project type");             
70                 return;
71             }
72             if (_this.dir.el.get_filename().length < 1) {
73                 StandardErrorDialog.show("You have to select a folder");             
74                 return;
75             }
76         
77             this.el.hide();
78             
79             
80             var fn = _this.dir.el.get_filename();
81             
82             var project = Project.Project.factory(_this.xtype.getValue(), fn);
83             
84             
85             //var pr = imports.Builder.Provider.ProjectManager.ProjectManager.update(this.project);
86             
87             this.success(project);
88         
89         } );
90     }
91
92     // userdefined functions 
93
94     // skip listeners - not pipe 
95
96     // skip .signal:void:success(Project.Project project) - already used 
97
98     // skip border_width - already used 
99
100     // skip default_height - already used 
101
102     // skip default_width - already used 
103
104     // skip title - already used 
105
106     // skip xtype - not pipe 
107
108     // skip |deletable - already used 
109
110     // skip |modal - already used 
111     public void show() {
112               
113         
114             //[ 'xtype'  ].forEach(function(k) {
115             //    _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);
116             //});
117                 // shouild set path..
118             _this.model.loadData();
119             this.el.show_all();
120             //this.success = c.success;
121         }
122
123     // skip |xns - no return type
124
125     // skip items - not pipe 
126
127     // skip id - not pipe 
128
129     // skip xvala_cls - not pipe 
130
131     // skip xvala_xcls - not pipe 
132
133     // skip xvala_id - not pipe 
134     public class Xcls_VBox2
135     {
136         public Gtk.VBox el;
137
138             // my vars
139
140             // ctor 
141         public Xcls_VBox2()
142         {
143             this.el = new Gtk.VBox( true, 0 );
144
145             // my vars
146
147             // set gobject values
148             var child_0 = new Xcls_HBox3();
149             this.el.pack_start (  child_0.el , false,true,3 );
150             var child_1 = new Xcls_dir();
151             this.el.pack_end (  child_1.el , true,true,5 );
152         }
153
154         // userdefined functions 
155
156         // skip xtype - not pipe 
157
158         // skip |pack - already used 
159
160         // skip |xns - no return type
161
162         // skip items - not pipe 
163
164         // skip xvala_cls - not pipe 
165
166         // skip xvala_xcls - not pipe 
167
168         // skip xvala_id - not pipe 
169     }
170     public class Xcls_HBox3
171     {
172         public Gtk.HBox el;
173
174             // my vars
175
176             // ctor 
177         public Xcls_HBox3()
178         {
179             this.el = new Gtk.HBox( true, 0 );
180
181             // my vars
182
183             // set gobject values
184             var child_0 = new Xcls_Label4();
185             this.el.pack_start (  child_0.el , false,true,3 );
186             var child_1 = new Xcls_xtype();
187             this.el.pack_end (  child_1.el , true,true,3 );
188         }
189
190         // userdefined functions 
191
192         // skip |xns - no return type
193
194         // skip xtype - not pipe 
195
196         // skip pack - not pipe 
197
198         // skip items - not pipe 
199
200         // skip xvala_cls - not pipe 
201
202         // skip xvala_xcls - not pipe 
203
204         // skip xvala_id - not pipe 
205     }
206     public class Xcls_Label4
207     {
208         public Gtk.Label el;
209
210             // my vars
211
212             // ctor 
213         public Xcls_Label4()
214         {
215             this.el = new Gtk.Label( "Project type :" );
216
217             // my vars
218
219             // set gobject values
220         }
221
222         // userdefined functions 
223
224         // skip |xns - no return type
225
226         // skip xtype - not pipe 
227
228         // skip pack - not pipe 
229
230         // skip label - already used 
231
232         // skip xvala_cls - not pipe 
233
234         // skip xvala_xcls - not pipe 
235
236         // skip xvala_id - not pipe 
237     }
238     public class Xcls_xtype
239     {
240         public Gtk.ComboBox el;
241
242             // my vars
243
244             // ctor 
245         public Xcls_xtype()
246         {
247             this.el = new Gtk.ComboBox();
248             _this.xtype = this;
249
250             // my vars
251
252             // set gobject values
253             var child_0 = new Xcls_cellrender();
254             this.el.pack_start (  child_0.el , true );
255             var child_1 = new Xcls_model();
256             this.el.set_model (  child_1.el  );
257         }
258
259         // userdefined functions 
260
261         // skip id - not pipe 
262
263         // skip pack - not pipe 
264
265         // skip xtype - not pipe 
266
267         // skip |init - already used 
268
269         // skip |setValue - no return type
270         public string getValue () {
271                  var ix = this.el.get_active();
272                     if (ix < 0 ) {
273                         return "";
274                     }
275                     switch(ix) {
276                         case 0:
277                             return "Roo";
278                         case 1:
279                             return "Gtk";
280                     }
281                     return "";
282             }
283
284         // skip |xns - no return type
285
286         // skip items - not pipe 
287
288         // skip xvala_cls - not pipe 
289
290         // skip xvala_xcls - not pipe 
291
292         // skip xvala_id - not pipe 
293     }
294     public class Xcls_cellrender
295     {
296         public Gtk.CellRendererText el;
297
298             // my vars
299
300             // ctor 
301         public Xcls_cellrender()
302         {
303             this.el = new Gtk.CellRendererText();
304             _this.cellrender = this;
305
306             // my vars
307
308             // set gobject values
309         }
310
311         // userdefined functions 
312
313         // skip id - not pipe 
314
315         // skip pack - not pipe 
316
317         // skip xtype - not pipe 
318
319         // skip |xns - no return type
320
321         // skip xvala_cls - not pipe 
322
323         // skip xvala_xcls - not pipe 
324
325         // skip xvala_id - not pipe 
326     }
327     public class Xcls_model
328     {
329         public Gtk.ListStore el;
330
331             // my vars
332
333             // ctor 
334         public Xcls_model()
335         {
336             this.el = new Gtk.ListStore( 3, "typeof(string),typeof(string)" );
337             _this.model = this;
338
339             // my vars
340
341             // set gobject values
342         }
343
344         // userdefined functions 
345
346         // skip columns - already used 
347
348         // skip id - not pipe 
349
350         // skip n_columns - already used 
351
352         // skip pack - not pipe 
353
354         // skip xtype - not pipe 
355         public void loadData  ( ) {
356                     this.el.clear();
357                                   
358                     Gtk.TreeIter iter;
359                             
360                     el.append(out iter);
361                     
362                     el.set_value(iter, 0, "Roo");
363                     el.set_value(iter, 1, "Roo Project");
364                      el.append(out iter);
365                     
366                     el.set_value(iter, 0, "Gtk");
367                     el.set_value(iter, 1, "Gtk Project");
368                      
369                           
370                                                  
371             }
372
373         // skip |xns - no return type
374
375         // skip xvala_cls - not pipe 
376
377         // skip xvala_xcls - not pipe 
378
379         // skip xvala_id - not pipe 
380     }
381     public class Xcls_dir
382     {
383         public Gtk.FileChooserWidget el;
384
385             // my vars
386
387             // ctor 
388         public Xcls_dir()
389         {
390             this.el = new Gtk.FileChooserWidget( Gtk.FileChooserAction.SELECT_FOLDER );
391             _this.dir = this;
392
393             // my vars
394
395             // set gobject values
396             this.el.select_multiple = false;
397         }
398
399         // userdefined functions 
400
401         // skip |xns - no return type
402
403         // skip xtype - not pipe 
404
405         // skip pack - not pipe 
406
407         // skip |action - already used 
408
409         // skip id - not pipe 
410
411         // skip |select_multiple - already used 
412
413         // skip xvala_cls - not pipe 
414
415         // skip xvala_xcls - not pipe 
416
417         // skip xvala_id - not pipe 
418     }
419     public class Xcls_Button9
420     {
421         public Gtk.Button el;
422
423             // my vars
424
425             // ctor 
426         public Xcls_Button9()
427         {
428             this.el = new Gtk.Button();
429
430             // my vars
431
432             // set gobject values
433             this.el.label = "OK";
434         }
435
436         // userdefined functions 
437
438         // skip |xns - no return type
439
440         // skip xtype - not pipe 
441
442         // skip pack - not pipe 
443
444         // skip label - already used 
445
446         // skip xvala_cls - not pipe 
447
448         // skip xvala_xcls - not pipe 
449
450         // skip xvala_id - not pipe 
451     }
452     public class Xcls_Button10
453     {
454         public Gtk.Button el;
455
456             // my vars
457
458             // ctor 
459         public Xcls_Button10()
460         {
461             this.el = new Gtk.Button();
462
463             // my vars
464
465             // set gobject values
466             this.el.label = "Cancel";
467         }
468
469         // userdefined functions 
470
471         // skip |xns - no return type
472
473         // skip xtype - not pipe 
474
475         // skip pack - not pipe 
476
477         // skip label - already used 
478
479         // skip xvala_cls - not pipe 
480
481         // skip xvala_xcls - not pipe 
482
483         // skip xvala_id - not pipe 
484     }
485 }