From 420f92f7b9792dae97fa7b74d5f72073b782c614 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 21 Mar 2019 12:40:23 +0800 Subject: [PATCH] NewBranch.bjs NewBranch.vala --- NewBranch.bjs | 246 ++++++++++- NewBranch.vala | 1101 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 1343 insertions(+), 4 deletions(-) diff --git a/NewBranch.bjs b/NewBranch.bjs index 804ada50..15639164 100644 --- a/NewBranch.bjs +++ b/NewBranch.bjs @@ -255,7 +255,251 @@ "xtype" : "Box", "* pack" : "append_page,_this.label_create_ticket.el", "$ xns" : "Gtk", - "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL" + "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", + "items" : [ + { + "id" : "table", + "bool homogeneous" : true, + "bool expand" : false, + "xtype" : "Table", + "* pack" : "pack_start,false,false,0", + "uint column_spacing" : 4, + "n_columns" : 4, + "$ xns" : "Gtk", + "n_rows" : 14, + "bool vexpand" : false, + "int margin" : 2, + "items" : [ + { + "label" : "Project", + "$ visible" : true, + "Gtk.Align halign" : "Gtk.Align.START", + "* pack" : "attach_defaults,0,1,0,1", + "xtype" : "Label", + "$ xns" : "Gtk" + }, + { + "label" : "Summary", + "$ visible" : true, + "Gtk.Align halign" : "Gtk.Align.START", + "* pack" : "attach_defaults,1,2,0,1", + "xtype" : "Label", + "x_options" : 4, + "$ xns" : "Gtk" + }, + { + "listeners" : { + "changed" : "() => {\n\tif (this.loading) {\n\t\treturn;\n\t}\n\tvar project_id = this.selectedProjectId();\n\t\n\tvar rt = RooTicket.singleton();\n\trt.loadProjectOptions(project_id);\n\t\n\t_this.msmodel.loadMilestones();\n\t_this.primodel.loadPriorities();\n\t_this.sevmodel.loadSeverities();\n\t_this.clmodel.loadClassifications();\t\n\t_this.devmodel.loadDevelopers();\t\n\t\n\t// affects projects and milestones..\n\t\n\t\n\t/*if (this.loading) {\n\t\treturn;\n\t}\n\tvar ticket_id = this.selectedTicketId();\n\t\n\tvar name = RooTicket.singleton().usernameLocal();\n\t\n\tif (ticket_id == \"\" || ticket_id == null) {\n\t\n\t\tvar dt = new DateTime.now_local();\n\t\t_this.name.el.set_text(\"wip_%s_%s\".printf(name,dt.format(\"%Y_%b_%d\")));\n\t\treturn;\n\t}\n\t\n\t\n\tvar ticket = RooTicket.singleton().getById(ticket_id);\n \n\t_this.name.el.set_text(\"wip_%s_T%s_%s\".printf(name,ticket.id, ticket.summaryToBranchName()));\n\t\n\t//GLib.debug (//\"Selection: %s, %s\\n\", (string) val1, (string) val2);\n\t*/\n}" + }, + "* ctor" : "new Gtk.ComboBox.with_entry()", + "id" : "project_id", + "| string selectedProjectId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.prmodel.el.get_value (iter, 0, out val1);\n \n\n\treturn (string) val1;\n\t\n\t\n\t\n\t\n}\n", + "* init" : "this.el.set_entry_text_column(1);", + "* pack" : "attach_defaults,0,1,1,2", + "xtype" : "ComboBox", + "# bool loading" : false, + "$ xns" : "Gtk", + "items" : [ + { + "id" : "prcellrenderer", + "xtype" : "CellRendererText", + "* pack" : "pack_start,true", + "$ xns" : "Gtk" + }, + { + "| void loadProjects" : " (string id) {\n\n \n _this.project_id.loading = true;\n\n this.el.clear(); \n Gtk.TreeIter iter;\n var el = this.el;\n \n el.append(out iter);\n\n \n el.set_value(iter, 0, \"\");\n el.set_value(iter, 1, \"-- select a project --\");\n if (id == \"\") {\n\t _this.project_id.el.set_active_iter(iter);\n }\n\n foreach(var project in RooProject.projects()) {\n \n el.append(out iter);\n \n el.set_value(iter, 0, project.id);\n el.set_value(iter, 1, project.name );\n if (id == project.id) {\n\t \t _this.project_id.el.set_active_iter(iter);\n\t } \n \n }\n \n _this.project_id.loading = false;\n //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); \n \n}\n", + "id" : "prmodel", + "* pack" : "set_model", + "xtype" : "ListStore", + "$ columns" : "typeof(string),typeof(string)", + "n_columns" : 2, + "$ xns" : "Gtk" + } + ] + }, + { + "id" : "summary", + "$ visible" : true, + "xtype" : "Entry", + "* pack" : "attach_defaults,1,4,1,2", + "$ xns" : "Gtk" + }, + { + "label" : "Milestone", + "Gtk.Align halign" : "Gtk.Align.START", + "xalign" : 0.90000000000000002, + "* pack" : "attach_defaults,0,1,2,3", + "xtype" : "Label", + "$ justify" : "Gtk.Justification.RIGHT", + "x_options" : 4, + "$ xns" : "Gtk" + }, + { + "* ctor" : "new Gtk.ComboBox.with_entry()", + "id" : "milestone_id", + "* init" : "this.el.set_entry_text_column(1);", + "* pack" : "attach_defaults,0,1,3,4", + "xtype" : "ComboBox", + "# bool loading" : false, + "$ xns" : "Gtk", + "| string selectedMilestoneId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.msmodel.el.get_value (iter, 0, out val1);\n \n\n\treturn (string) val1;\n\t\n\t\n\t\n\t\n}\n", + "items" : [ + { + "id" : "msmodel", + "* pack" : "set_model", + "xtype" : "ListStore", + "| void loadMilestones" : " ( ) {\n\n var rt = RooTicket.singleton();\n // rt.loadProjects();\n \n _this.milestone_id.loading = true;\n\n this.el.clear(); \n Gtk.TreeIter iter;\n var el = this.el;\n \n el.append(out iter);\n\n \n el.set_value(iter, 0, \"\");\n el.set_value(iter, 1, \"-- select a milestone --\");\n _this.milestone_id.el.set_active_iter(iter); \n \n var projects = rt.milestones;\n foreach(var project in projects) {\n \n el.append(out iter);\n \n el.set_value(iter, 0, project.id);\n el.set_value(iter, 1, project.display_name );\n // if (id == project.id) {\n\t //\t _this.milestone.el.set_active_iter(iter);\n\t // } \n \n }\n \n \n _this.milestone_id.loading = false;\n //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); \n \n}\n", + "$ columns" : "typeof(string),typeof(string)", + "n_columns" : 2, + "$ xns" : "Gtk" + } + ] + }, + { + "label" : "Description", + "Gtk.Align halign" : "Gtk.Align.START", + "* pack" : "attach_defaults,1,4,2,3", + "xtype" : "Label", + "x_options" : 4, + "$ xns" : "Gtk" + }, + { + "id" : "description", + "* pack" : "attach_defaults,1,4,3,12", + "xtype" : "TextView", + "$ xns" : "Gtk", + "uint border_width" : 1 + }, + { + "label" : "Priority", + "Gtk.Align halign" : "Gtk.Align.START", + "xalign" : 0.90000000000000002, + "* pack" : "attach_defaults,0,1,4,5", + "xtype" : "Label", + "x_options" : 4, + "$ xns" : "Gtk" + }, + { + "* ctor" : "new Gtk.ComboBox.with_entry()", + "id" : "priority_id", + "* init" : "this.el.set_entry_text_column(1);", + "* pack" : "attach_defaults,0,1,5,6", + "xtype" : "ComboBox", + "# bool loading" : false, + "$ xns" : "Gtk", + "| string selectedPriorityId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.primodel.el.get_value (iter, 0, out val1);\n \n\n\treturn (string) val1;\n\t\n\t\n\t\n\t\n}\n", + "items" : [ + { + "id" : "primodel", + "| void loadPriorities" : " ( ) {\n\n var rt = RooTicket.singleton();\n // rt.loadProjects();\n \n _this.priority_id.loading = true;\n\n this.el.clear(); \n Gtk.TreeIter iter;\n var el = this.el;\n \n \n var projects = rt.priorities;\n foreach(var project in projects) {\n \n el.append(out iter);\n \n el.set_value(iter, 0, project.id);\n el.set_value(iter, 1, project.display_name );\n if (\"normal\" == project.name) {\n\t \t _this.priority_id.el.set_active_iter(iter);\n\t } \n \n }\n \n _this.priority_id.loading = false;\n \n \n}\n", + "* pack" : "set_model", + "xtype" : "ListStore", + "$ columns" : "typeof(string),typeof(string)", + "n_columns" : 2, + "$ xns" : "Gtk" + } + ] + }, + { + "label" : "Severity", + "Gtk.Align halign" : "Gtk.Align.START", + "* pack" : "attach_defaults,0,1,6,7", + "xtype" : "Label", + "x_options" : 4, + "$ xns" : "Gtk" + }, + { + "* ctor" : "new Gtk.ComboBox.with_entry()", + "id" : "severity_id", + "* init" : "this.el.set_entry_text_column(1);", + "* pack" : "attach_defaults,0,1,7,8", + "xtype" : "ComboBox", + "# bool loading" : false, + "$ xns" : "Gtk", + "| string selectedSeverityId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.sevmodel.el.get_value (iter, 0, out val1);\n \n\n\treturn (string) val1;\n\t\n\t\n\t\n\t\n}\n", + "items" : [ + { + "| void loadSeverities" : " () {\n\n var rt = RooTicket.singleton();\n //rt.loadProjects();\n \n _this.severity_id.loading = true;\n\n this.el.clear(); \n Gtk.TreeIter iter;\n var el = this.el;\n \n var projects = rt.serverities;\n foreach(var project in projects) {\n \n el.append(out iter);\n \n el.set_value(iter, 0, project.id);\n el.set_value(iter, 1, project.display_name );\n if (\"normal\" == project.name) {\n\t \t _this.severity_id.el.set_active_iter(iter);\n\t } \n \n }\n \n _this.severity_id.loading = false;\n //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); \n \n}\n", + "id" : "sevmodel", + "* pack" : "set_model", + "xtype" : "ListStore", + "$ columns" : "typeof(string),typeof(string)", + "n_columns" : 2, + "$ xns" : "Gtk" + } + ] + }, + { + "label" : "Classification", + "Gtk.Align halign" : "Gtk.Align.START", + "* pack" : "attach_defaults,0,1,8,9", + "xtype" : "Label", + "x_options" : 4, + "$ xns" : "Gtk" + }, + { + "* ctor" : "new Gtk.ComboBox.with_entry()", + "id" : "classification_id", + "* init" : "this.el.set_entry_text_column(1);", + "* pack" : "attach_defaults,0,1,9,10", + "xtype" : "ComboBox", + "# bool loading" : false, + "$ xns" : "Gtk", + "| string selectedClassificationId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.clmodel.el.get_value (iter, 0, out val1);\n \n\n\treturn (string) val1;\n\t\n\t\n\t\n\t\n}\n", + "items" : [ + { + "id" : "clmodel", + "| void loadClassifications" : " ( ) {\n\n var rt = RooTicket.singleton();\n // rt.loadProjects();\n \n _this.classification_id.loading = true;\n\n this.el.clear(); \n Gtk.TreeIter iter;\n var el = this.el;\n \n el.append(out iter);\n\n \n var projects = rt.classifications;\n foreach(var project in projects) {\n \n el.append(out iter);\n \n el.set_value(iter, 0, project.id);\n el.set_value(iter, 1, project.display_name );\n if (\"bug\" == project.name) {\n\t \t _this.classification_id.el.set_active_iter(iter);\n\t } \n \n }\n \n _this.classification_id.loading = false;\n //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); \n \n}\n", + "* pack" : "set_model", + "xtype" : "ListStore", + "$ columns" : "typeof(string),typeof(string)", + "n_columns" : 2, + "$ xns" : "Gtk" + } + ] + }, + { + "label" : "Assign to", + "Gtk.Align halign" : "Gtk.Align.START", + "* pack" : "attach_defaults,0,1,10,11", + "xtype" : "Label", + "x_options" : 4, + "$ xns" : "Gtk" + }, + { + "* ctor" : "new Gtk.ComboBox.with_entry()", + "id" : "developer_id", + "* init" : "this.el.set_entry_text_column(1);", + "* pack" : "attach_defaults,0,1,11,12", + "xtype" : "ComboBox", + "# bool loading" : false, + "| string selectedDeveloperId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.devmodel.el.get_value (iter, 0, out val1);\n \n\n\treturn (string) val1;\n\t\n\t\n\t\n\t\n}\n", + "$ xns" : "Gtk", + "items" : [ + { + "id" : "devmodel", + "* pack" : "set_model", + "xtype" : "ListStore", + "$ columns" : "typeof(string),typeof(string)", + "n_columns" : 2, + "$ xns" : "Gtk", + "| void loadDevelopers" : " ( ) {\n\n var rt = RooTicket.singleton();\n //rt.loadProjects();\n \n _this.developer_id.loading = true;\n\n this.el.clear(); \n Gtk.TreeIter iter;\n var el = this.el;\n \n el.append(out iter);\n\n \n el.set_value(iter, 0, \"\");\n el.set_value(iter, 1, \"-- select a developer --\");\n // if (id == \"\") {\n\t _this.developer_id.el.set_active_iter(iter);\n // }\n \n var peps = rt.developers;\n foreach(var p in peps) {\n \n el.append(out iter);\n \n el.set_value(iter, 0, p.id);\n el.set_value(iter, 1, p.display_name );\n if (rt.authuser_id == p.id) {\n\t \t _this.developer_id.el.set_active_iter(iter);\n\t } \n }\n \n _this.developer_id.loading = false;\n //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); \n \n}\n" + } + ] + }, + { + "listeners" : { + "clicked" : "() => {\n\tGLib.debug(\"fire response = 1\");\n\t\n\t\n\tvar invalid = false;\n\t\n\t// validate first...\n\t_this.project_id.el.get_child().get_style_context().remove_class(\"warning\");\t\n\tif (_this.project_id.selectedProjectId() == \"\") {\n\t\t_this.project_id.el.get_child().get_style_context().add_class(\"warning\");\n\t\tinvalid = true;\n\t}\n\t\n\t_this.milestone_id.el.get_child().get_style_context().remove_class(\"warning\");\t\n\n\t_this.priority_id.el.get_child().get_style_context().remove_class(\"warning\");\t\n\tif (_this.priority_id.selectedPriorityId() == \"\") {\n\t\t_this.priority_id.el.get_child().get_style_context().add_class(\"warning\");\n\t\tinvalid = true;\n\t}\n\t\n\t_this.classification_id.el.get_child().get_style_context().remove_class(\"warning\");\t\n\tif (_this.classification_id.selectedClassificationId() == \"\") {\n\t\t_this.classification_id.el.get_child().get_style_context().add_class(\"warning\");\n\t\tinvalid = true;\n\t}\n\t\n\t_this.developer_id.el.get_child().get_style_context().remove_class(\"warning\");\t\n\tif (_this.developer_id.selectedDeveloperId() == \"\") {\n\t\t_this.developer_id.el.get_child().get_style_context().add_class(\"warning\");\n\t\tinvalid = true;\n\t}\n\t\n\t_this.summary.el.get_style_context().remove_class(\"warning\");\t\n\tif (_this.summary.el.get_text() == \"\") {\n\t\t_this.summary.el.get_style_context().add_class(\"warning\");\n\t\tinvalid = true;\n\t}\n\t\n\t_this.description.el.get_style_context().remove_class(\"warning\");\t\n \n\tif (invalid) {\n\t\treturn;\n\t}\n\tGLib.debug(\"for is valid\");\n\t\n\t_this.el.response(1);\n}" + }, + "label" : "Create Ticket", + "* init" : "{\n this.el.get_style_context().add_class(\"suggested-action\");\n}\n", + "xtype" : "Button", + "* pack" : "attach_defaults,0,4,13,14", + "$ xns" : "Gtk" + } + ] + } + ] }, { "bool homogeneous" : false, diff --git a/NewBranch.vala b/NewBranch.vala index 4114dd60..eaa005da 100644 --- a/NewBranch.vala +++ b/NewBranch.vala @@ -27,6 +27,22 @@ public class NewBranch : Object public Xcls_btn_closed btn_closed; public Xcls_scrolled_window scrolled_window; public Xcls_view view; + public Xcls_table table; + public Xcls_project_id project_id; + public Xcls_prcellrenderer prcellrenderer; + public Xcls_prmodel prmodel; + public Xcls_summary summary; + public Xcls_milestone_id milestone_id; + public Xcls_msmodel msmodel; + public Xcls_description description; + public Xcls_priority_id priority_id; + public Xcls_primodel primodel; + public Xcls_severity_id severity_id; + public Xcls_sevmodel sevmodel; + public Xcls_classification_id classification_id; + public Xcls_clmodel clmodel; + public Xcls_developer_id developer_id; + public Xcls_devmodel devmodel; // my vars (def) public GitRepo? repo; @@ -181,7 +197,7 @@ public class NewBranch : Object var child_4 = new Xcls_Box26( _this ); child_4.ref(); this.el.append_page ( child_4.el , _this.label_create_ticket.el ); - var child_5 = new Xcls_Box27( _this ); + var child_5 = new Xcls_Box52( _this ); child_5.ref(); this.el.append_page ( child_5.el , _this.label_quick_commit.el ); } @@ -1086,12 +1102,1091 @@ public class NewBranch : Object // set gobject values this.el.homogeneous = false; + var child_0 = new Xcls_table( _this ); + child_0.ref(); + this.el.pack_start ( child_0.el , false,false,0 ); + } + + // user defined functions + } + public class Xcls_table : Object + { + public Gtk.Table el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_table(NewBranch _owner ) + { + _this = _owner; + _this.table = this; + this.el = new Gtk.Table( 14, 4, true ); + + // my vars (dec) + + // set gobject values + this.el.expand = false; + this.el.margin = 2; + this.el.column_spacing = 4; + this.el.vexpand = false; + var child_0 = new Xcls_Label28( _this ); + child_0.ref(); + this.el.attach_defaults ( child_0.el , 0,1,0,1 ); + var child_1 = new Xcls_Label29( _this ); + child_1.ref(); + this.el.attach_defaults ( child_1.el , 1,2,0,1 ); + var child_2 = new Xcls_project_id( _this ); + child_2.ref(); + this.el.attach_defaults ( child_2.el , 0,1,1,2 ); + var child_3 = new Xcls_summary( _this ); + child_3.ref(); + this.el.attach_defaults ( child_3.el , 1,4,1,2 ); + var child_4 = new Xcls_Label34( _this ); + child_4.ref(); + this.el.attach_defaults ( child_4.el , 0,1,2,3 ); + var child_5 = new Xcls_milestone_id( _this ); + child_5.ref(); + this.el.attach_defaults ( child_5.el , 0,1,3,4 ); + var child_6 = new Xcls_Label37( _this ); + child_6.ref(); + this.el.attach_defaults ( child_6.el , 1,4,2,3 ); + var child_7 = new Xcls_description( _this ); + child_7.ref(); + this.el.attach_defaults ( child_7.el , 1,4,3,12 ); + var child_8 = new Xcls_Label39( _this ); + child_8.ref(); + this.el.attach_defaults ( child_8.el , 0,1,4,5 ); + var child_9 = new Xcls_priority_id( _this ); + child_9.ref(); + this.el.attach_defaults ( child_9.el , 0,1,5,6 ); + var child_10 = new Xcls_Label42( _this ); + child_10.ref(); + this.el.attach_defaults ( child_10.el , 0,1,6,7 ); + var child_11 = new Xcls_severity_id( _this ); + child_11.ref(); + this.el.attach_defaults ( child_11.el , 0,1,7,8 ); + var child_12 = new Xcls_Label45( _this ); + child_12.ref(); + this.el.attach_defaults ( child_12.el , 0,1,8,9 ); + var child_13 = new Xcls_classification_id( _this ); + child_13.ref(); + this.el.attach_defaults ( child_13.el , 0,1,9,10 ); + var child_14 = new Xcls_Label48( _this ); + child_14.ref(); + this.el.attach_defaults ( child_14.el , 0,1,10,11 ); + var child_15 = new Xcls_developer_id( _this ); + child_15.ref(); + this.el.attach_defaults ( child_15.el , 0,1,11,12 ); + var child_16 = new Xcls_Button51( _this ); + child_16.ref(); + this.el.attach_defaults ( child_16.el , 0,4,13,14 ); + } + + // user defined functions + } + public class Xcls_Label28 : Object + { + public Gtk.Label el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_Label28(NewBranch _owner ) + { + _this = _owner; + this.el = new Gtk.Label( "Project" ); + + // my vars (dec) + + // set gobject values + this.el.halign = Gtk.Align.START; + this.el.visible = true; + } + + // user defined functions + } + + public class Xcls_Label29 : Object + { + public Gtk.Label el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_Label29(NewBranch _owner ) + { + _this = _owner; + this.el = new Gtk.Label( "Summary" ); + + // my vars (dec) + + // set gobject values + this.el.halign = Gtk.Align.START; + this.el.visible = true; + } + + // user defined functions + } + + public class Xcls_project_id : Object + { + public Gtk.ComboBox el; + private NewBranch _this; + + + // my vars (def) + public bool loading; + + // ctor + public Xcls_project_id(NewBranch _owner ) + { + _this = _owner; + _this.project_id = this; + this.el = new Gtk.ComboBox.with_entry(); + + // my vars (dec) + this.loading = false; + + // set gobject values + var child_0 = new Xcls_prcellrenderer( _this ); + child_0.ref(); + this.el.pack_start ( child_0.el , true ); + var child_1 = new Xcls_prmodel( _this ); + child_1.ref(); + this.el.set_model ( child_1.el ); + + // init method + + this.el.set_entry_text_column(1); + + //listeners + this.el.changed.connect( () => { + if (this.loading) { + return; + } + var project_id = this.selectedProjectId(); + + var rt = RooTicket.singleton(); + rt.loadProjectOptions(project_id); + + _this.msmodel.loadMilestones(); + _this.primodel.loadPriorities(); + _this.sevmodel.loadSeverities(); + _this.clmodel.loadClassifications(); + _this.devmodel.loadDevelopers(); + + // affects projects and milestones.. + + + /*if (this.loading) { + return; + } + var ticket_id = this.selectedTicketId(); + + var name = RooTicket.singleton().usernameLocal(); + + if (ticket_id == "" || ticket_id == null) { + + 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); + */ + }); + } + + // user defined functions + public string selectedProjectId () { + Gtk.TreeIter iter; + Value val1; + + + this.el.get_active_iter (out iter); + _this.prmodel.el.get_value (iter, 0, out val1); + + + return (string) val1; + + + + + } + } + public class Xcls_prcellrenderer : Object + { + public Gtk.CellRendererText el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_prcellrenderer(NewBranch _owner ) + { + _this = _owner; + _this.prcellrenderer = this; + this.el = new Gtk.CellRendererText(); + + // my vars (dec) + + // set gobject values + } + + // user defined functions + } + + public class Xcls_prmodel : Object + { + public Gtk.ListStore el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_prmodel(NewBranch _owner ) + { + _this = _owner; + _this.prmodel = this; + this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) ); + + // my vars (dec) + + // set gobject values } // user defined functions + public void loadProjects (string id) { + + + _this.project_id.loading = true; + + this.el.clear(); + Gtk.TreeIter iter; + var el = this.el; + + el.append(out iter); + + + el.set_value(iter, 0, ""); + el.set_value(iter, 1, "-- select a project --"); + if (id == "") { + _this.project_id.el.set_active_iter(iter); + } + + foreach(var project in RooProject.projects()) { + + el.append(out iter); + + el.set_value(iter, 0, project.id); + el.set_value(iter, 1, project.name ); + if (id == project.id) { + _this.project_id.el.set_active_iter(iter); + } + + } + + _this.project_id.loading = false; + //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); + + } } - public class Xcls_Box27 : Object + + public class Xcls_summary : Object + { + public Gtk.Entry el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_summary(NewBranch _owner ) + { + _this = _owner; + _this.summary = this; + this.el = new Gtk.Entry(); + + // my vars (dec) + + // set gobject values + this.el.visible = true; + } + + // user defined functions + } + + public class Xcls_Label34 : Object + { + public Gtk.Label el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_Label34(NewBranch _owner ) + { + _this = _owner; + this.el = new Gtk.Label( "Milestone" ); + + // my vars (dec) + + // set gobject values + this.el.halign = Gtk.Align.START; + this.el.justify = Gtk.Justification.RIGHT; + this.el.xalign = 0.900000f; + } + + // user defined functions + } + + public class Xcls_milestone_id : Object + { + public Gtk.ComboBox el; + private NewBranch _this; + + + // my vars (def) + public bool loading; + + // ctor + public Xcls_milestone_id(NewBranch _owner ) + { + _this = _owner; + _this.milestone_id = this; + this.el = new Gtk.ComboBox.with_entry(); + + // my vars (dec) + this.loading = false; + + // set gobject values + var child_0 = new Xcls_msmodel( _this ); + child_0.ref(); + this.el.set_model ( child_0.el ); + + // init method + + this.el.set_entry_text_column(1); + } + + // user defined functions + public string selectedMilestoneId () { + Gtk.TreeIter iter; + Value val1; + + + this.el.get_active_iter (out iter); + _this.msmodel.el.get_value (iter, 0, out val1); + + + return (string) val1; + + + + + } + } + public class Xcls_msmodel : Object + { + public Gtk.ListStore el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_msmodel(NewBranch _owner ) + { + _this = _owner; + _this.msmodel = this; + this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) ); + + // my vars (dec) + + // set gobject values + } + + // user defined functions + public void loadMilestones ( ) { + + var rt = RooTicket.singleton(); + // rt.loadProjects(); + + _this.milestone_id.loading = true; + + this.el.clear(); + Gtk.TreeIter iter; + var el = this.el; + + el.append(out iter); + + + el.set_value(iter, 0, ""); + el.set_value(iter, 1, "-- select a milestone --"); + _this.milestone_id.el.set_active_iter(iter); + + var projects = rt.milestones; + foreach(var project in projects) { + + el.append(out iter); + + el.set_value(iter, 0, project.id); + el.set_value(iter, 1, project.display_name ); + // if (id == project.id) { + // _this.milestone.el.set_active_iter(iter); + // } + + } + + + _this.milestone_id.loading = false; + //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); + + } + } + + + public class Xcls_Label37 : Object + { + public Gtk.Label el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_Label37(NewBranch _owner ) + { + _this = _owner; + this.el = new Gtk.Label( "Description" ); + + // my vars (dec) + + // set gobject values + this.el.halign = Gtk.Align.START; + } + + // user defined functions + } + + public class Xcls_description : Object + { + public Gtk.TextView el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_description(NewBranch _owner ) + { + _this = _owner; + _this.description = this; + this.el = new Gtk.TextView(); + + // my vars (dec) + + // set gobject values + this.el.border_width = 1; + } + + // user defined functions + } + + public class Xcls_Label39 : Object + { + public Gtk.Label el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_Label39(NewBranch _owner ) + { + _this = _owner; + this.el = new Gtk.Label( "Priority" ); + + // my vars (dec) + + // set gobject values + this.el.halign = Gtk.Align.START; + this.el.xalign = 0.900000f; + } + + // user defined functions + } + + public class Xcls_priority_id : Object + { + public Gtk.ComboBox el; + private NewBranch _this; + + + // my vars (def) + public bool loading; + + // ctor + public Xcls_priority_id(NewBranch _owner ) + { + _this = _owner; + _this.priority_id = this; + this.el = new Gtk.ComboBox.with_entry(); + + // my vars (dec) + this.loading = false; + + // set gobject values + var child_0 = new Xcls_primodel( _this ); + child_0.ref(); + this.el.set_model ( child_0.el ); + + // init method + + this.el.set_entry_text_column(1); + } + + // user defined functions + public string selectedPriorityId () { + Gtk.TreeIter iter; + Value val1; + + + this.el.get_active_iter (out iter); + _this.primodel.el.get_value (iter, 0, out val1); + + + return (string) val1; + + + + + } + } + public class Xcls_primodel : Object + { + public Gtk.ListStore el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_primodel(NewBranch _owner ) + { + _this = _owner; + _this.primodel = this; + this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) ); + + // my vars (dec) + + // set gobject values + } + + // user defined functions + public void loadPriorities ( ) { + + var rt = RooTicket.singleton(); + // rt.loadProjects(); + + _this.priority_id.loading = true; + + this.el.clear(); + Gtk.TreeIter iter; + var el = this.el; + + + var projects = rt.priorities; + foreach(var project in projects) { + + el.append(out iter); + + el.set_value(iter, 0, project.id); + el.set_value(iter, 1, project.display_name ); + if ("normal" == project.name) { + _this.priority_id.el.set_active_iter(iter); + } + + } + + _this.priority_id.loading = false; + + + } + } + + + public class Xcls_Label42 : Object + { + public Gtk.Label el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_Label42(NewBranch _owner ) + { + _this = _owner; + this.el = new Gtk.Label( "Severity" ); + + // my vars (dec) + + // set gobject values + this.el.halign = Gtk.Align.START; + } + + // user defined functions + } + + public class Xcls_severity_id : Object + { + public Gtk.ComboBox el; + private NewBranch _this; + + + // my vars (def) + public bool loading; + + // ctor + public Xcls_severity_id(NewBranch _owner ) + { + _this = _owner; + _this.severity_id = this; + this.el = new Gtk.ComboBox.with_entry(); + + // my vars (dec) + this.loading = false; + + // set gobject values + var child_0 = new Xcls_sevmodel( _this ); + child_0.ref(); + this.el.set_model ( child_0.el ); + + // init method + + this.el.set_entry_text_column(1); + } + + // user defined functions + public string selectedSeverityId () { + Gtk.TreeIter iter; + Value val1; + + + this.el.get_active_iter (out iter); + _this.sevmodel.el.get_value (iter, 0, out val1); + + + return (string) val1; + + + + + } + } + public class Xcls_sevmodel : Object + { + public Gtk.ListStore el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_sevmodel(NewBranch _owner ) + { + _this = _owner; + _this.sevmodel = this; + this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) ); + + // my vars (dec) + + // set gobject values + } + + // user defined functions + public void loadSeverities () { + + var rt = RooTicket.singleton(); + //rt.loadProjects(); + + _this.severity_id.loading = true; + + this.el.clear(); + Gtk.TreeIter iter; + var el = this.el; + + var projects = rt.serverities; + foreach(var project in projects) { + + el.append(out iter); + + el.set_value(iter, 0, project.id); + el.set_value(iter, 1, project.display_name ); + if ("normal" == project.name) { + _this.severity_id.el.set_active_iter(iter); + } + + } + + _this.severity_id.loading = false; + //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); + + } + } + + + public class Xcls_Label45 : Object + { + public Gtk.Label el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_Label45(NewBranch _owner ) + { + _this = _owner; + this.el = new Gtk.Label( "Classification" ); + + // my vars (dec) + + // set gobject values + this.el.halign = Gtk.Align.START; + } + + // user defined functions + } + + public class Xcls_classification_id : Object + { + public Gtk.ComboBox el; + private NewBranch _this; + + + // my vars (def) + public bool loading; + + // ctor + public Xcls_classification_id(NewBranch _owner ) + { + _this = _owner; + _this.classification_id = this; + this.el = new Gtk.ComboBox.with_entry(); + + // my vars (dec) + this.loading = false; + + // set gobject values + var child_0 = new Xcls_clmodel( _this ); + child_0.ref(); + this.el.set_model ( child_0.el ); + + // init method + + this.el.set_entry_text_column(1); + } + + // user defined functions + public string selectedClassificationId () { + Gtk.TreeIter iter; + Value val1; + + + this.el.get_active_iter (out iter); + _this.clmodel.el.get_value (iter, 0, out val1); + + + return (string) val1; + + + + + } + } + public class Xcls_clmodel : Object + { + public Gtk.ListStore el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_clmodel(NewBranch _owner ) + { + _this = _owner; + _this.clmodel = this; + this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) ); + + // my vars (dec) + + // set gobject values + } + + // user defined functions + public void loadClassifications ( ) { + + var rt = RooTicket.singleton(); + // rt.loadProjects(); + + _this.classification_id.loading = true; + + this.el.clear(); + Gtk.TreeIter iter; + var el = this.el; + + el.append(out iter); + + + var projects = rt.classifications; + foreach(var project in projects) { + + el.append(out iter); + + el.set_value(iter, 0, project.id); + el.set_value(iter, 1, project.display_name ); + if ("bug" == project.name) { + _this.classification_id.el.set_active_iter(iter); + } + + } + + _this.classification_id.loading = false; + //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); + + } + } + + + public class Xcls_Label48 : Object + { + public Gtk.Label el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_Label48(NewBranch _owner ) + { + _this = _owner; + this.el = new Gtk.Label( "Assign to" ); + + // my vars (dec) + + // set gobject values + this.el.halign = Gtk.Align.START; + } + + // user defined functions + } + + public class Xcls_developer_id : Object + { + public Gtk.ComboBox el; + private NewBranch _this; + + + // my vars (def) + public bool loading; + + // ctor + public Xcls_developer_id(NewBranch _owner ) + { + _this = _owner; + _this.developer_id = this; + this.el = new Gtk.ComboBox.with_entry(); + + // my vars (dec) + this.loading = false; + + // set gobject values + var child_0 = new Xcls_devmodel( _this ); + child_0.ref(); + this.el.set_model ( child_0.el ); + + // init method + + this.el.set_entry_text_column(1); + } + + // user defined functions + public string selectedDeveloperId () { + Gtk.TreeIter iter; + Value val1; + + + this.el.get_active_iter (out iter); + _this.devmodel.el.get_value (iter, 0, out val1); + + + return (string) val1; + + + + + } + } + public class Xcls_devmodel : Object + { + public Gtk.ListStore el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_devmodel(NewBranch _owner ) + { + _this = _owner; + _this.devmodel = this; + this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) ); + + // my vars (dec) + + // set gobject values + } + + // user defined functions + public void loadDevelopers ( ) { + + var rt = RooTicket.singleton(); + //rt.loadProjects(); + + _this.developer_id.loading = true; + + this.el.clear(); + Gtk.TreeIter iter; + var el = this.el; + + el.append(out iter); + + + el.set_value(iter, 0, ""); + el.set_value(iter, 1, "-- select a developer --"); + // if (id == "") { + _this.developer_id.el.set_active_iter(iter); + // } + + var peps = rt.developers; + foreach(var p in peps) { + + el.append(out 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; + //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); + + } + } + + + public class Xcls_Button51 : Object + { + public Gtk.Button el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_Button51(NewBranch _owner ) + { + _this = _owner; + this.el = new Gtk.Button(); + + // my vars (dec) + + // set gobject values + this.el.label = "Create Ticket"; + + // init method + + { + this.el.get_style_context().add_class("suggested-action"); + } + + //listeners + this.el.clicked.connect( () => { + GLib.debug("fire response = 1"); + + + var invalid = false; + + // validate first... + _this.project_id.el.get_child().get_style_context().remove_class("warning"); + if (_this.project_id.selectedProjectId() == "") { + _this.project_id.el.get_child().get_style_context().add_class("warning"); + invalid = true; + } + + _this.milestone_id.el.get_child().get_style_context().remove_class("warning"); + + _this.priority_id.el.get_child().get_style_context().remove_class("warning"); + if (_this.priority_id.selectedPriorityId() == "") { + _this.priority_id.el.get_child().get_style_context().add_class("warning"); + invalid = true; + } + + _this.classification_id.el.get_child().get_style_context().remove_class("warning"); + if (_this.classification_id.selectedClassificationId() == "") { + _this.classification_id.el.get_child().get_style_context().add_class("warning"); + invalid = true; + } + + _this.developer_id.el.get_child().get_style_context().remove_class("warning"); + if (_this.developer_id.selectedDeveloperId() == "") { + _this.developer_id.el.get_child().get_style_context().add_class("warning"); + invalid = true; + } + + _this.summary.el.get_style_context().remove_class("warning"); + if (_this.summary.el.get_text() == "") { + _this.summary.el.get_style_context().add_class("warning"); + invalid = true; + } + + _this.description.el.get_style_context().remove_class("warning"); + + if (invalid) { + return; + } + GLib.debug("for is valid"); + + _this.el.response(1); + }); + } + + // user defined functions + } + + + + public class Xcls_Box52 : Object { public Gtk.Box el; private NewBranch _this; @@ -1100,7 +2195,7 @@ public class NewBranch : Object // my vars (def) // ctor - public Xcls_Box27(NewBranch _owner ) + public Xcls_Box52(NewBranch _owner ) { _this = _owner; this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 ); -- 2.39.2