NewBranch.bjs
[gitlive] / NewBranch.vala
index 644d2bc..643489b 100644 (file)
@@ -19,6 +19,8 @@ public class NewBranch : Object
     public Xcls_dbcellrenderer dbcellrenderer;
     public Xcls_dbmodel dbmodel;
     public Xcls_name name;
+    public Xcls_btn_not_me btn_not_me;
+    public Xcls_btn_closed btn_closed;
 
         // my vars (def)
     public GitRepo? repo;
@@ -95,7 +97,7 @@ public class NewBranch : Object
     }
 
     // user defined functions
-    public   void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue ) 
+    public   void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" ) 
     {
          // this.el.set_gravity(Gdk.Gravity.NORTH);
         if (this.running) { // should not happen!!
@@ -123,7 +125,7 @@ public class NewBranch : Object
         var curproj = RooTicket.singleton().getProjectByRepo(this.repo);
          _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
         
-       _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
+       _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
        this.el.run();
     
     }
@@ -534,10 +536,18 @@ public class NewBranch : Object
         }
 
         // user defined functions
-        public void loadTickets (string project_id) {
+        public void loadTickets (string project_id , string tid = "") {
         
-            RooTicket.singleton().loadTickets(project_id);
+        
+            
+            // fixme .. get project id from selection..
             
+             RooTicket.singleton().loadTickets(
+                               project_id,
+                               _this.btn_not_me.el.active ? RooTicket.NotMe.TRUE :  RooTicket.NotMe.FALSE,
+                                _this.btn_closed.el.active ? RooTicket.Closed.TRUE :  RooTicket.Closed.FALSE
+                        );
+                
             _this.ticketsel.loading = true;
         
             this.el.clear();                                    
@@ -559,9 +569,9 @@ public class NewBranch : Object
                 el.set_value(iter, 0, ticket.id);
                 el.set_value(iter, 1, "#%s [%s] %s".printf( ticket.id, ticket.project_id_name , ticket.summary));
                 
-                //if (data.get(i) == cur) {
-                 //   _this.build_module.el.set_active_iter(iter);
-               // }
+                if (ticket.id == tid) {
+                           _this.ticketsel.el.set_active_iter(iter);
+                }
                 
             }
             
@@ -671,7 +681,8 @@ public class NewBranch : Object
             }
 
             //listeners
-            this.el.activate.connect( () => {
+            this.el.clicked.connect( () => {
+               GLib.debug("fire response = 1");
                _this.el.response(1);
             });
         }
@@ -696,10 +707,10 @@ public class NewBranch : Object
             // my vars (dec)
 
             // set gobject values
-            var child_0 = new Xcls_CheckButton17( _this );
+            var child_0 = new Xcls_btn_not_me( _this );
             child_0.ref();
             this.el.add (  child_0.el  );
-            var child_1 = new Xcls_CheckButton18( _this );
+            var child_1 = new Xcls_btn_closed( _this );
             child_1.ref();
             this.el.add (  child_1.el  );
             var child_2 = new Xcls_Label19( _this );
@@ -709,7 +720,7 @@ public class NewBranch : Object
 
         // user defined functions
     }
-    public class Xcls_CheckButton17 : Object
+    public class Xcls_btn_not_me : Object
     {
         public Gtk.CheckButton el;
         private NewBranch  _this;
@@ -718,21 +729,28 @@ public class NewBranch : Object
             // my vars (def)
 
         // ctor
-        public Xcls_CheckButton17(NewBranch _owner )
+        public Xcls_btn_not_me(NewBranch _owner )
         {
             _this = _owner;
+            _this.btn_not_me = this;
             this.el = new Gtk.CheckButton();
 
             // my vars (dec)
 
             // set gobject values
             this.el.label = "Show tickets not assigned to me";
+
+            //listeners
+            this.el.toggled.connect( () => {
+               var project_id = _this.projectsel.selectedProjectId();
+               _this.dbmodel.loadTickets(project_id);  
+            });
         }
 
         // user defined functions
     }
 
-    public class Xcls_CheckButton18 : Object
+    public class Xcls_btn_closed : Object
     {
         public Gtk.CheckButton el;
         private NewBranch  _this;
@@ -741,15 +759,23 @@ public class NewBranch : Object
             // my vars (def)
 
         // ctor
-        public Xcls_CheckButton18(NewBranch _owner )
+        public Xcls_btn_closed(NewBranch _owner )
         {
             _this = _owner;
+            _this.btn_closed = this;
             this.el = new Gtk.CheckButton();
 
             // my vars (dec)
 
             // set gobject values
             this.el.label = "Show closed Tickets";
+
+            //listeners
+            this.el.toggled.connect( () => {
+               var project_id = _this.projectsel.selectedProjectId();
+               _this.dbmodel.loadTickets(project_id);  
+                
+            });
         }
 
         // user defined functions