NewBranch.bjs
[gitlive] / NewBranch.vala
1 static NewBranch  _NewBranch;
2
3 public class NewBranch : Object
4 {
5     public Gtk.Dialog el;
6     private NewBranch  _this;
7
8     public static NewBranch singleton()
9     {
10         if (_NewBranch == null) {
11             _NewBranch= new NewBranch();
12         }
13         return _NewBranch;
14     }
15     public Xcls_ok_button ok_button;
16
17         // my vars (def)
18
19     // ctor
20     public NewBranch()
21     {
22         _this = this;
23         this.el = new Gtk.Dialog();
24
25         // my vars (dec)
26
27         // set gobject values
28         this.el.title = "Manage Clones";
29         this.el.border_width = 3;
30         this.el.default_height = 500;
31         this.el.default_width = 800;
32         this.el.deletable = true;
33         this.el.modal = true;
34         var child_0 = new Xcls_Box2( _this );
35         child_0.ref();
36         this.el.get_content_area().add (  child_0.el  );
37         var child_1 = new Xcls_ok_button( _this );
38         child_1.ref();
39         this.el.add_action_widget (  child_1.el , 1  );
40
41         //listeners
42         this.el.delete_event.connect( (self, event) => {
43             this.el.hide();
44             return true; 
45             //test  
46         });
47         this.el.response.connect( (self, response_id) =>  { 
48          
49                 this.el.hide();
50           
51         });
52     }
53
54     // user defined functions
55     public void show ()    {
56     
57         
58         this.el.set_deletable(false);
59         this.el.set_gravity(Gdk.Gravity.NORTH);
60         this.el.move(Gdk.Screen.width() / 2 ,0);
61         this.el.show_all();
62         _this.reposStore.load();
63         // load clones..
64     //     this.get('/reposStore').load();
65         
66         //this.get('/ok_button').el.set_sensitive(false);
67         
68         // block until we return.
69     //    var run_ret = this.el.run();
70     //    if (run_ret < 1 ) {
71     //        return  "DONE";
72     //    }
73     //    print("RUN RETURN : " + run_ret);
74     //    return "DONE";
75         //print(JSON.stringify(this.get('bug').getValue()));
76        // return this.get('bug').getValue();
77         //this.success = c.success;
78     }
79     public class Xcls_Box2 : Object
80     {
81         public Gtk.Box el;
82         private NewBranch  _this;
83
84
85             // my vars (def)
86
87         // ctor
88         public Xcls_Box2(NewBranch _owner )
89         {
90             _this = _owner;
91             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
92
93             // my vars (dec)
94
95             // set gobject values
96             var child_0 = new Xcls_Box3( _this );
97             child_0.ref();
98             this.el.pack_start (  child_0.el , false,false,0 );
99         }
100
101         // user defined functions
102     }
103     public class Xcls_Box3 : Object
104     {
105         public Gtk.Box el;
106         private NewBranch  _this;
107
108
109             // my vars (def)
110
111         // ctor
112         public Xcls_Box3(NewBranch _owner )
113         {
114             _this = _owner;
115             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
116
117             // my vars (dec)
118
119             // set gobject values
120             var child_0 = new Xcls_Button4( _this );
121             child_0.ref();
122             this.el.add (  child_0.el  );
123             var child_1 = new Xcls_Button5( _this );
124             child_1.ref();
125             this.el.add (  child_1.el  );
126             var child_2 = new Xcls_Button6( _this );
127             child_2.ref();
128             this.el.add (  child_2.el  );
129             var child_3 = new Xcls_Button7( _this );
130             child_3.ref();
131             this.el.add (  child_3.el  );
132         }
133
134         // user defined functions
135     }
136     public class Xcls_Button4 : Object
137     {
138         public Gtk.Button el;
139         private NewBranch  _this;
140
141
142             // my vars (def)
143
144         // ctor
145         public Xcls_Button4(NewBranch _owner )
146         {
147             _this = _owner;
148             this.el = new Gtk.Button();
149
150             // my vars (dec)
151
152             // set gobject values
153             this.el.label = "Branches";
154
155             //listeners
156             this.el.clicked.connect( () => {
157             /*
158                 var rv = this.get('/reposView');
159                 var rs = this.get('/reposStore');
160                 if (rv.el.get_selection().count_selected_rows() != 1) {
161                     //nothing?
162                     // error condition.
163                     return;
164                 }
165                 var Branches =     imports.Branches.Branches;
166                 
167              
168                 var ret = {};       
169                 var s = rv.el.get_selection();
170                 var path = '';
171                 s.selected_foreach(function(model,p,iter) {
172                                                                 
173                    path = model.get_value(iter, 6).value.get_string();
174                  
175                 }); 
176             
177                 var repo = false;
178                 rs.repos.forEach(function(r) {
179                     if (r.repopath == path) {
180                         repo = r;
181                     
182                     }
183                 
184                 });
185                 Branches.repo = repo;
186                 Branches.el.set_transient_for(Clones.el);
187                 Clones.el.set_title("Manage Clones - " + repo.repopath);
188                 Branches.show();
189                 Clones.el.set_title("Manage Clones");
190             
191                  
192                 
193                 
194                 
195             
196                    
197              */   
198                 
199             });
200         }
201
202         // user defined functions
203     }
204
205     public class Xcls_Button5 : Object
206     {
207         public Gtk.Button el;
208         private NewBranch  _this;
209
210
211             // my vars (def)
212
213         // ctor
214         public Xcls_Button5(NewBranch _owner )
215         {
216             _this = _owner;
217             this.el = new Gtk.Button();
218
219             // my vars (dec)
220
221             // set gobject values
222             this.el.label = "Merge";
223
224             //listeners
225             this.el.clicked.connect( () =>  {
226             /*
227                 var rv = this.get('/reposView');
228                 var rs = this.get('/reposStore');
229                 if (rv.el.get_selection().count_selected_rows() != 1) {
230                     //nothing?
231                     // error condition.
232                     return;
233                 }
234                 var Merger =     imports.Merger.Merger;
235                 
236              
237                 var ret = {};       
238                 var s = rv.el.get_selection();
239                 var path = '';
240                 s.selected_foreach(function(model,p,iter) {
241                                                                 
242                    path = model.get_value(iter, 6).value.get_string();
243                  
244                 }); 
245             
246                 var repo = false;
247                 rs.repos.forEach(function(r) {
248                     if (r.repopath == path) {
249                         repo = r;
250                     
251                     }
252                 
253                 });
254                 Merger.repo = repo;
255                 Merger.el.set_transient_for(Clones.el);
256                 Clones.el.set_title("Manage Clones - " + repo.repopath);
257                 Merger.show();
258                 Clones.el.set_title("Manage Clones");
259             
260                 
261                 
262             
263                  
264                 
265             
266              */      
267                 
268                 
269             });
270         }
271
272         // user defined functions
273     }
274
275     public class Xcls_Button6 : Object
276     {
277         public Gtk.Button el;
278         private NewBranch  _this;
279
280
281             // my vars (def)
282
283         // ctor
284         public Xcls_Button6(NewBranch _owner )
285         {
286             _this = _owner;
287             this.el = new Gtk.Button();
288
289             // my vars (dec)
290
291             // set gobject values
292             this.el.label = "Switch Branch";
293
294             //listeners
295             this.el.clicked.connect( () => {
296                 
297                 
298              
299                    
300                 
301                 
302             });
303         }
304
305         // user defined functions
306     }
307
308     public class Xcls_Button7 : Object
309     {
310         public Gtk.Button el;
311         private NewBranch  _this;
312
313
314             // my vars (def)
315
316         // ctor
317         public Xcls_Button7(NewBranch _owner )
318         {
319             _this = _owner;
320             this.el = new Gtk.Button();
321
322             // my vars (dec)
323
324             // set gobject values
325             this.el.label = "Pull";
326
327             //listeners
328             this.el.clicked.connect( () => {
329                 
330                 
331              
332                    
333                 
334                 
335             });
336         }
337
338         // user defined functions
339     }
340
341
342
343     public class Xcls_ok_button : Object
344     {
345         public Gtk.Button el;
346         private NewBranch  _this;
347
348
349             // my vars (def)
350
351         // ctor
352         public Xcls_ok_button(NewBranch _owner )
353         {
354             _this = _owner;
355             _this.ok_button = this;
356             this.el = new Gtk.Button();
357
358             // my vars (dec)
359
360             // set gobject values
361             this.el.expand = false;
362             this.el.label = "Close";
363         }
364
365         // user defined functions
366     }
367
368 }