X-Git-Url: http://git.roojs.org/?p=gitlive;a=blobdiff_plain;f=Ticket.vala;h=04d431cc11af66fff9cee3449905610d23ee5eb5;hp=3432d9b4ae50808047e6662493c93cfcced33a51;hb=62bcbeee7e77f9f8774f13569dc9fb5cc25666d6;hpb=ce5337e4ad3400605415fb497dbbced99ed35860 diff --git a/Ticket.vala b/Ticket.vala index 3432d9b4..04d431cc 100644 --- a/Ticket.vala +++ b/Ticket.vala @@ -12,6 +12,7 @@ public class Ticket : Object } return _Ticket; } + public Xcls_table table; public Xcls_project_id project_id; public Xcls_prcellrenderer prcellrenderer; public Xcls_prmodel prmodel; @@ -27,6 +28,7 @@ public class Ticket : Object public Xcls_clmodel clmodel; public Xcls_developer_id developer_id; public Xcls_devmodel devmodel; + public Xcls_spinner spinner; // my vars (def) public GitRepo? repo; @@ -48,7 +50,7 @@ public class Ticket : Object this.el.default_width = 500; this.el.deletable = true; this.el.modal = true; - var child_0 = new Xcls_VBox2( _this ); + var child_0 = new Xcls_Box2( _this ); child_0.ref(); this.el.get_content_area().add ( child_0.el ); @@ -74,17 +76,19 @@ public class Ticket : Object _this.milestone_id.selectedMilestoneId(), _this.priority_id.selectedPriorityId() , + _this.severity_id.selectedSeverityId() , _this.classification_id.selectedClassificationId() , _this.developer_id.selectedDeveloperId(), _this.summary.el.get_text() , _this.description.el.buffer.text ); - + this.el.hide(); + this.running = false; if (this.repo != null) { NewBranch.singleton().show(this.repo, new Gee.ArrayList(), tid); } - this.el.hide(); + }); } @@ -96,72 +100,87 @@ public class Ticket : Object if (this.running) { // should not happen!! GLib.error("new branch show called, when already being displayed?"); } + this.running = true; + _this.el.show_all(); - this.running = true; - //GitMonitor.gitmonitor.stop(); - - this.repo = repo; - - - - + _this.table.el.hide(); + + _this.spinner.el.show(); + _this.spinner.el.start(); + this.el.set_keep_above(true); this.el.move((Gdk.Screen.width() / 2)- 250 ,0); this.el.set_default_size( 500,200); // not sure why it grows.. - GLib.debug("Loading tickets"); - - - this.el.show_all(); - this.el.set_keep_above(true); - - - RooProject? curproj = null; - if (this.repo != null) { - curproj = RooTicket.singleton().getProjectByRepo(this.repo); - } - _this.prmodel.loadProjects(curproj == null ? "" : curproj.id); - if (curproj != null) { - + + GLib.debug("Showing dialog?"); + Timeout.add_seconds(1, () => { - var rt = RooTicket.singleton(); - rt.loadProjectOptions(curproj.id); + + //GitMonitor.gitmonitor.stop(); - _this.msmodel.loadMilestones(); - _this.primodel.loadPriorities(); - _this.sevmodel.loadSeverities(); - _this.clmodel.loadClassifications(); - _this.devmodel.loadDevelopers(); + this.repo = repo; - } + + RooProject? curproj = null; + if (this.repo != null) { + curproj = RooProject.getProjectByRepo(this.repo); + } + _this.prmodel.loadProjects(curproj == null ? "" : curproj.id); + if (curproj != null) { + + + var rt = RooTicket.singleton(); + rt.loadProjectOptions(curproj.id); + + _this.msmodel.loadMilestones(); + _this.primodel.loadPriorities(); + _this.sevmodel.loadSeverities(); + _this.clmodel.loadClassifications(); + _this.devmodel.loadDevelopers(); + + } + _this.summary.el.set_text(""); + _this.description.el.buffer.text = ""; + _this.spinner.el.stop(); + _this.spinner.el.hide(); + + this.table.el.show(); + _this.summary.el.grab_focus(); + return false; + }); this.el.run(); + } - public class Xcls_VBox2 : Object + public class Xcls_Box2 : Object { - public Gtk.VBox el; + public Gtk.Box el; private Ticket _this; // my vars (def) // ctor - public Xcls_VBox2(Ticket _owner ) + public Xcls_Box2(Ticket _owner ) { _this = _owner; - this.el = new Gtk.VBox( true, 0 ); + this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 ); // my vars (dec) // set gobject values - var child_0 = new Xcls_Table3( _this ); + var child_0 = new Xcls_table( _this ); child_0.ref(); this.el.pack_start ( child_0.el , false,false,0 ); + var child_1 = new Xcls_spinner( _this ); + child_1.ref(); + this.el.add ( child_1.el ); } // user defined functions } - public class Xcls_Table3 : Object + public class Xcls_table : Object { public Gtk.Table el; private Ticket _this; @@ -170,9 +189,10 @@ public class Ticket : Object // my vars (def) // ctor - public Xcls_Table3(Ticket _owner ) + public Xcls_table(Ticket _owner ) { _this = _owner; + _this.table = this; this.el = new Gtk.Table( 14, 4, true ); // my vars (dec) @@ -422,8 +442,6 @@ public class Ticket : Object // user defined functions public void loadProjects (string id) { - var rt = RooTicket.singleton(); - rt.loadProjects(); _this.project_id.loading = true; @@ -439,8 +457,8 @@ public class Ticket : Object if (id == "") { _this.project_id.el.set_active_iter(iter); } - var projects = rt.projects; - foreach(var project in projects) { + + foreach(var project in RooProject.projects()) { el.append(out iter); @@ -1139,17 +1157,16 @@ public class Ticket : Object _this.developer_id.el.set_active_iter(iter); // } - var projects = rt.developers; - foreach(var project in projects) { + var peps = rt.developers; + foreach(var p in peps) { el.append(out iter); - el.set_value(iter, 0, project.id); - el.set_value(iter, 1, project.display_name ); - // if (id == project.id) { - // _this.projectsel.el.set_active_iter(iter); - // } - + el.set_value(iter, 0, p.id); + el.set_value(iter, 1, p.display_name ); + if (rt.authuser_id == p.id) { + _this.developer_id.el.set_active_iter(iter); + } } _this.developer_id.loading = false; @@ -1199,10 +1216,6 @@ public class Ticket : Object } _this.milestone_id.el.get_child().get_style_context().remove_class("warning"); - if (_this.milestone_id.selectedMilestoneId() == "") { - _this.milestone_id.el.get_child().get_style_context().add_class("warning"); - invalid = true; - } _this.priority_id.el.get_child().get_style_context().remove_class("warning"); if (_this.priority_id.selectedPriorityId() == "") { @@ -1229,12 +1242,7 @@ public class Ticket : Object } _this.description.el.get_style_context().remove_class("warning"); - if (_this.description.el.buffer.text == "") { - _this.description.el.get_style_context().add_class("warning"); - invalid = true; - } - - + if (invalid) { return; } @@ -1248,5 +1256,30 @@ public class Ticket : Object } + public class Xcls_spinner : Object + { + public Gtk.Spinner el; + private Ticket _this; + + + // my vars (def) + + // ctor + public Xcls_spinner(Ticket _owner ) + { + _this = _owner; + _this.spinner = this; + this.el = new Gtk.Spinner(); + + // my vars (dec) + + // set gobject values + this.el.hexpand = true; + this.el.vexpand = true; + } + + // user defined functions + } + }