NewBranch.bjs
[gitlive] / NewBranch.vala
index 96e4265..e65ba33 100644 (file)
@@ -51,7 +51,26 @@ public class NewBranch : Object
         });
         this.el.response.connect( (self, response_id) =>  { 
           
-                GLib.debug("got %d", (int) response_id);
+               GLib.debug("got %d", (int) response_id);
+               if (response_id == 0) {
+                   _this.el.hide();     
+                       return;
+               }
+               // have they selected a ticket..
+               // make that the current active ticket?
+               // we really need to store locally what ticket is being worked on..
+               // in theory we could be working on multiple project and not merging..
+               // -- each repo would have their active ticket (only one per repo)
+               // -- so we could just store that in there
+               // -- initial load can check the contents of the ticket files on first scan.
+        
+               
+        
+                
+                
+                
+        
+                
         });
         this.el.show.connect( (self)  => {
          
@@ -196,10 +215,25 @@ public class NewBranch : Object
                Value val2;
              
                this.el.get_active_iter (out iter);
-               _this.dbmodel.get_value (iter, 0, out val1);
-               _this.dbmodellist_store.get_value (iter, 1, out val2);
+               _this.dbmodel.el.get_value (iter, 0, out val1);
+               _this.dbmodel.el.get_value (iter, 1, out val2);
             
-               print ("Selection: %s, %d\n", (string) val1, (int) val2);
+               var ticket_id = (string) val1;
+               
+               var name = RooTicket.singleton().usernameLocal();
+               
+               if (ticket_id == "") {
+               
+                       var dt = new  DateTime.now_local();
+                       _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
+                       return;
+               }
+               
+               var ticket = RooTicket.singleton().getById(ticket_id);
+               
+               _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
+               
+               //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
             });
         }