sync
[gitlive] / NewBranch.vala
index 640ae38..c55d3de 100644 (file)
@@ -20,6 +20,7 @@ public class NewBranch : Object
         // my vars (def)
     public GitRepo? repo;
     public bool running;
+    public Gee.ArrayList<GitMonitorQueue> queue;
 
     // ctor
     public NewBranch()
@@ -29,7 +30,8 @@ public class NewBranch : Object
 
         // my vars (dec)
         this.repo = null;
-        this.running = true;
+        this.running = false;
+        this.queue = null;
 
         // set gobject values
         this.el.title = "Create a working branch ";
@@ -61,6 +63,7 @@ public class NewBranch : Object
                    this.running = false; 
                        return;
                }
+                
                // have they selected a ticket..
                // make that the current active ticket?
                // we really need to store locally what ticket is being worked on..
@@ -72,16 +75,21 @@ public class NewBranch : Object
                
             if (this.repo != null) {
                var bn = _this.name.el.get_text();
-               if (ticket_id != "" ) {
-                               this.repo.setActiveTicket( RooTicket.singleton().getById(ticket_id), bn);
-                       } else {
-                               this.repo.createBranchNamed(bn);
-                       }
+        
+                       var res = this.repo.setActiveTicket(                    
+                                RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn
+                        );
+                        if (res) {
+                               // start the monitoring..
+                                GitMonitor.gitmonitor.start();
+                                
+                        }
             }
+            
         
-                           this.running = false; 
+            this.running = false; 
         
-                
+               this.el.hide();
                 
                 
         
@@ -95,12 +103,17 @@ public class NewBranch : Object
     }
 
     // user defined functions
-    public   void show ( GitRepo repo ) 
+    public   void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue ) 
     {
          // this.el.set_gravity(Gdk.Gravity.NORTH);
-        if (this.running) {
-               return;
+        if (this.running) { // should not happen!!
+               GLib.error("new branch show called, when already being displayed?");
        }
+       this.queue = queue;
+       
+       this.running  = true;
+       GitMonitor.gitmonitor.stop();
+       
         this.repo = repo;
         
        this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
@@ -108,7 +121,9 @@ public class NewBranch : Object
     
     
         this.el.show_all();
+            this.el.set_keep_above(true);
        _this.dbmodel.loadTickets();
+       this.el.run();
     
     }
     public class Xcls_VBox2 : Object