Ticket.bjs
[gitlive] / Ticket.vala
index daf2fc1..609cf72 100644 (file)
@@ -982,13 +982,7 @@ public class Ticket : Object
             
             el.append(out iter);
         
-            
-            el.set_value(iter, 0, "");
-            el.set_value(iter, 1, "-- select classification --");
-          //  if (id == "") {
-                   _this.classification_id.el.set_active_iter(iter);
-        //    }
-            
+             
             var projects = rt.classifications;
             foreach(var project in projects) {
             
@@ -996,9 +990,9 @@ public class Ticket : Object
                 
                 el.set_value(iter, 0, project.id);
                 el.set_value(iter, 1,  project.display_name );
-            //    if (id == project.id) {
-               //         _this.classification_id.el.set_active_iter(iter);
-               //    }   
+                if ("bug" == project.name) {
+                          _this.classification_id.el.set_active_iter(iter);
+                   }   
                 
             }
             
@@ -1114,7 +1108,7 @@ public class Ticket : Object
         
             
             el.set_value(iter, 0, "");
-            el.set_value(iter, 1, "-- select a project --");
+            el.set_value(iter, 1, "-- select a developer --");
           //  if (id == "") {
                    _this.developer_id.el.set_active_iter(iter);
            // }
@@ -1167,6 +1161,45 @@ public class Ticket : Object
             //listeners
             this.el.clicked.connect( () => {
                GLib.debug("fire response = 1");
+               
+               
+               var invalid = false;
+               
+               // validate first...
+               _this.project_id.el.get_style_context().remove_class("warning");        
+               if (_this.project_id.selectedProjectId() == "") {
+                       _this.project_id.el.get_style_context().add_class("warning");
+                       invalid = true;
+               }
+               
+               _this.milestone_id.el.get_style_context().remove_class("warning");      
+               if (_this.milestone_id.selectedMilestoneId() == "") {
+                       _this.milestone_id.el.get_style_context().add_class("warning");
+                       invalid = true;
+               }
+            
+               _this.priority_id.el.get_style_context().remove_class("warning");       
+               if (_this.priority_id.selectedPriorityId() == "") {
+                       _this.priority_id.el.get_style_context().add_class("warning");
+                       invalid = true;
+               }
+               
+               _this.classification_id.el.get_style_context().remove_class("warning"); 
+               if (_this.classification_id.selectedClassificationId() == "") {
+                       _this.classification_id.el.get_style_context().add_class("warning");
+                       invalid = true;
+               }
+               
+                       _this.classification_id.el.get_style_context().remove_class("warning"); 
+               if (_this.classification_id.selectedClassificationId() == "") {
+                       _this.classification_id.el.get_style_context().add_class("warning");
+                       invalid = true;
+               }
+               
+               if (invalid) {
+                       return;
+               }
+               
                _this.el.response(1);
             });
         }