Test.GtkWriter.vala.c
[app.Builder.js] / Builder4 / DialogTemplateSelect.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/DialogTemplateSelect.vala  -o /tmp/DialogTemplateSelect
4 */
5
6
7 /* -- to test class
8 static int main (string[] args) {
9     Gtk.init (ref args);
10     new Xcls_DialogTemplateSelect();
11     DialogTemplateSelect.show_all();
12      Gtk.main ();
13     return 0;
14 }
15 */
16
17
18 public static Xcls_DialogTemplateSelect  DialogTemplateSelect;
19
20 public class Xcls_DialogTemplateSelect
21 {
22     public Gtk.Dialog el;
23     private static Xcls_DialogTemplateSelect  _this;
24
25     public Xcls_combo combo;
26     public Xcls_cellrenderer cellrenderer;
27     public Xcls_model model;
28
29         // my vars
30
31         // ctor 
32     public Xcls_DialogTemplateSelect()
33     {
34         this.el = new Gtk.Dialog();
35         _this = this;
36         DialogTemplateSelect = this;
37
38         // my vars
39
40         // set gobject values
41         this.el.default_height = 200;
42         this.el.default_width = 400;
43         this.el.modal = true;
44         var child_0 = new Xcls_VBox2();
45         this.el.get_content_area().add  (  child_0.el  );
46         var child_1 = new Xcls_Button8();
47         this.el.add_action_widget (  child_1.el , 0 );
48
49         // listeners 
50         this.el.delete_event.connect(   (self, event)  =>{
51             this.el.hide();
52             return true;
53         } );
54     }
55
56     // userdefined functions 
57
58     // skip listeners - not pipe 
59
60     // skip default_height - already used 
61
62     // skip default_width - already used 
63
64     // skip xtype - not pipe 
65     public JsRender.Node? show (Palete.Palete pal, JsRender.Node node) {
66             
67         
68             var opts = pal.listTemplates(node);
69             if (opts.length() < 1) {
70                 return node;
71             }
72             
73             //opts.unshift({ path: '' , name :'Just add Element' });
74              _this.model.loadData(opts);
75              _this.combo.el.set_active(0);
76              
77             this.el.show_all();
78             this.el.run();
79             this.el.hide();
80             var ix = _this.combo.el.get_active();
81             if (ix < 1 ) {
82                 return null;
83             }
84             
85         
86             return pal.loadTemplate(opts.nth_data(ix));
87         
88         }
89
90     // skip |modal - already used 
91
92     // skip |xns - no return type
93
94     // skip items - not pipe 
95
96     // skip id - not pipe 
97
98     // skip xvala_cls - not pipe 
99
100     // skip xvala_xcls - not pipe 
101
102     // skip xvala_id - not pipe 
103     public class Xcls_VBox2
104     {
105         public Gtk.VBox el;
106
107             // my vars
108
109             // ctor 
110         public Xcls_VBox2()
111         {
112             this.el = new Gtk.VBox( true, 0 );
113
114             // my vars
115
116             // set gobject values
117             var child_0 = new Xcls_HBox3();
118             this.el.pack_start (  child_0.el , false,false,0 );
119         }
120
121         // userdefined functions 
122
123         // skip xtype - not pipe 
124
125         // skip |pack - already used 
126
127         // skip |xns - no return type
128
129         // skip items - not pipe 
130
131         // skip xvala_cls - not pipe 
132
133         // skip xvala_xcls - not pipe 
134
135         // skip xvala_id - not pipe 
136     }
137     public class Xcls_HBox3
138     {
139         public Gtk.HBox el;
140
141             // my vars
142
143             // ctor 
144         public Xcls_HBox3()
145         {
146             this.el = new Gtk.HBox( true, 0 );
147
148             // my vars
149
150             // set gobject values
151             var child_0 = new Xcls_Label4();
152             this.el.pack_start (  child_0.el , false,false );
153             var child_1 = new Xcls_combo();
154             this.el.add (  child_1.el  );
155
156             // listeners 
157         }
158
159         // userdefined functions 
160
161         // skip pack - not pipe 
162
163         // skip xtype - not pipe 
164
165         // skip |xns - no return type
166
167         // skip listeners - not pipe 
168
169         // skip items - not pipe 
170
171         // skip xvala_cls - not pipe 
172
173         // skip xvala_xcls - not pipe 
174
175         // skip xvala_id - not pipe 
176     }
177     public class Xcls_Label4
178     {
179         public Gtk.Label el;
180
181             // my vars
182
183             // ctor 
184         public Xcls_Label4()
185         {
186             this.el = new Gtk.Label( "Select Template : " );
187
188             // my vars
189
190             // set gobject values
191         }
192
193         // userdefined functions 
194
195         // skip label - already used 
196
197         // skip pack - not pipe 
198
199         // skip xtype - not pipe 
200
201         // skip |xns - no return type
202
203         // skip xvala_cls - not pipe 
204
205         // skip xvala_xcls - not pipe 
206
207         // skip xvala_id - not pipe 
208     }
209     public class Xcls_combo
210     {
211         public Gtk.ComboBox el;
212
213             // my vars
214
215             // ctor 
216         public Xcls_combo()
217         {
218             this.el = new Gtk.ComboBox();
219             _this.combo = this;
220
221             // my vars
222
223             // set gobject values
224             var child_0 = new Xcls_cellrenderer();
225             this.el.pack_start (  child_0.el , true );
226             var child_1 = new Xcls_model();
227             this.el.set_model (  child_1.el  );
228         }
229
230         // userdefined functions 
231
232         // skip id - not pipe 
233
234         // skip pack - not pipe 
235
236         // skip xtype - not pipe 
237
238         // skip |init - already used 
239
240         // skip |xns - no return type
241
242         // skip items - not pipe 
243
244         // skip xvala_cls - not pipe 
245
246         // skip xvala_xcls - not pipe 
247
248         // skip xvala_id - not pipe 
249     }
250     public class Xcls_cellrenderer
251     {
252         public Gtk.CellRendererText el;
253
254             // my vars
255
256             // ctor 
257         public Xcls_cellrenderer()
258         {
259             this.el = new Gtk.CellRendererText();
260             _this.cellrenderer = this;
261
262             // my vars
263
264             // set gobject values
265         }
266
267         // userdefined functions 
268
269         // skip id - not pipe 
270
271         // skip pack - not pipe 
272
273         // skip xtype - not pipe 
274
275         // skip |xns - no return type
276
277         // skip xvala_cls - not pipe 
278
279         // skip xvala_xcls - not pipe 
280
281         // skip xvala_id - not pipe 
282     }
283     public class Xcls_model
284     {
285         public Gtk.ListStore el;
286
287             // my vars
288
289             // ctor 
290         public Xcls_model()
291         {
292             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
293             _this.model = this;
294
295             // my vars
296
297             // set gobject values
298         }
299
300         // userdefined functions 
301
302         // skip id - not pipe 
303
304         // skip n_columns - already used 
305
306         // skip pack - not pipe 
307
308         // skip xtype - not pipe 
309
310         // skip |columns - already used 
311         public void loadData  (GLib.List<string> data) {
312                 this.el.clear();                                    
313                 Gtk.TreeIter iter;
314                 var el = this.el;
315                 
316                 el.append(out iter);
317                 
318                  
319                 el.set_value(iter, 0, "");
320                 el.set_value(iter, 1, "Just add Element");
321                 
322                 for (var i = 0; i < data.length();i++) {
323                 
324             
325                     el.append(out iter);
326                     var str = data.nth_data(i);
327                     var fn = Path.get_basename (str);
328                     fn.replace(".json", "");
329                     
330                     el.set_value(iter, 0, fn);
331                     el.set_value(iter, 1, str);
332                     
333                 }
334                           
335                                                  
336             }
337
338         // skip |xns - no return type
339
340         // skip xvala_cls - not pipe 
341
342         // skip xvala_xcls - not pipe 
343
344         // skip xvala_id - not pipe 
345     }
346     public class Xcls_Button8
347     {
348         public Gtk.Button el;
349
350             // my vars
351
352             // ctor 
353         public Xcls_Button8()
354         {
355             this.el = new Gtk.Button();
356
357             // my vars
358
359             // set gobject values
360             this.el.label = "OK";
361         }
362
363         // userdefined functions 
364
365         // skip label - already used 
366
367         // skip pack - not pipe 
368
369         // skip xtype - not pipe 
370
371         // skip |xns - no return type
372
373         // skip xvala_cls - not pipe 
374
375         // skip xvala_xcls - not pipe 
376
377         // skip xvala_id - not pipe 
378     }
379 }