From 3ca10752a9d585c7d1f731322f9e1174493cc9e0 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Wed, 13 Feb 2019 14:21:48 +0800 Subject: [PATCH] fix commits --- NewBranch.bjs | 6 +++--- NewBranch.vala | 28 +++++++++++++++------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/NewBranch.bjs b/NewBranch.bjs index 37a9a2de..5c69743d 100644 --- a/NewBranch.bjs +++ b/NewBranch.bjs @@ -10,7 +10,7 @@ { "listeners" : { "delete_event" : "(self, event) => {\n this.el.hide();\n return true; \n //test \n}\n ", - "response" : " (self, response_id) => { \n \n\tGLib.debug(\"got %d\", (int) response_id);\n\t\n\t\n\t\n\t\n\t\n\t \n\t// have they selected a ticket..\n\t// make that the current active ticket?\n\t// we really need to store locally what ticket is being worked on..\n\t// in theory we could be working on multiple project and not merging..\n\t// -- each repo would have their active ticket (only one per repo)\n\t// -- so we could just store that in there\n\t// -- initial load can check the contents of the ticket files on first scan.\n\tvar ticket_id = _this.ticketsel.selectedTicketId();\n\t\n\tif (ticket_id == \"\") {\n\t\t_this.ticketsel.el.get_child().get_style_context().add_class(\"warning\");\n\t\treturn;\n\t}\n\t\n\t\n\tif (response_id < 1) {\n\t _this.el.hide();\t\n\t this.running = false; \n\t \treturn;\n\t}\n\t\n\t\n if (this.repo != null) {\n \tvar bn = _this.name.el.get_text();\n\n\t\tvar res = this.repo.setActiveTicket(\t\t\t\n\t\t\t RooTicket.singleton().getById(ticket_id != \"\" ? ticket_id : \"-1\"), bn\n\t\t );\n\t\t if (res) {\n\t\t \t// start the monitoring..\n\t\t \t GitMonitor.gitmonitor.start();\n\t\t \t \n\t\t }\n }\n \n\n this.running = false; \n\n\tthis.el.hide();\n\t \n\t \n\n\t \n}" + "response" : " (self, response_id) => { \n \n\tGLib.debug(\"got %d\", (int) response_id);\n\t\n\t \n\t\n\t \n\t// have they selected a ticket..\n\t// make that the current active ticket?\n\t// we really need to store locally what ticket is being worked on..\n\t// in theory we could be working on multiple project and not merging..\n\t// -- each repo would have their active ticket (only one per repo)\n\t// -- so we could just store that in there\n\t// -- initial load can check the contents of the ticket files on first scan.\n\n\t \n\tif (response_id < 1) {\n\t _this.el.hide();\t\n\t this.running = false; \n\t \treturn;\n\t}\n\t\n\tvar ticket_id = _this.ticketsel.selectedTicketId();\n\t\n if (this.repo != null) {\n \tvar bn = _this.name.el.get_text();\n\n\t\tvar res = this.repo.setActiveTicket(\t\t\t\n\t\t\t RooTicket.singleton().getById(ticket_id != \"\" ? ticket_id : \"-1\"), bn\n\t\t );\n\t\t if (res) {\n\t\t \t// start the monitoring..\n\t\t \t GitMonitor.gitmonitor.start();\n\t\t \t \n\t\t }\n }\n \n\n this.running = false; \n\n\tthis.el.hide();\n\t \n\t \n\n\t \n}" }, "default_width" : 500, "$ deletable" : true, @@ -20,7 +20,7 @@ "| void show" : "( GitRepo repo, Gee.ArrayList queue, string tid = \"\" ) \n{\n // this.el.set_gravity(Gdk.Gravity.NORTH);\n if (this.running) { // should not happen!!\n \tGLib.error(\"new branch show called, when already being displayed?\");\n\t}\n\tthis.queue = queue;\n\t\n\tthis.running = true;\n\tGitMonitor.gitmonitor.stop();\n\t\n this.repo = repo;\n \n \n \n\tthis.el.move((Gdk.Screen.width() / 2)- 250 ,0);\n\tthis.el.set_default_size( 500,200); // not sure why it grows..\n GLib.debug(\"Loading tickets\"); \n \n\n this.el.show_all();\n this.el.set_keep_above(true);\n \n \n var curproj = RooProject.getProjectByRepo(this.repo);\n _this.prmodel.loadProjects(curproj == null ? \"\" : curproj.id);\n \n \t_this.dbmodel.loadTickets(curproj == null ? \"\": curproj.id, tid);\n\t_this.ticketsel.el.get_child().get_style_context().remove_class(\"warning\");\n \tif (tid != \"\") { \n\t \tvar name = RooTicket.singleton().usernameLocal();\n \t\tvar ticket = RooTicket.singleton().getById(tid);\n\t\t_this.name.el.set_text(\"wip_%s_T%s_%s\".printf(name,ticket.id, ticket.summaryToBranchName()));\n\t} else {\n\t\t_this.ticketsel.el.get_child().get_style_context().add_class(\"warning\");\n\t}\n _this.view.loadTicket(tid);\n \tthis.el.run();\n\n}", "default_height" : 500, "$ xns" : "Gtk", - "# bool running" : true, + "# bool running" : false, "# Gee.ArrayList queue" : "null", "bool modal" : true, "items" : [ @@ -150,7 +150,7 @@ }, { "listeners" : { - "clicked" : "() => {\n\tGLib.debug(\"fire response = 1\");\n\t_this.el.response(1);\n}" + "clicked" : "() => {\n\n\tGLib.debug(\"fire response = 1\");\n\t\n\tvar ticket_id = _this.ticketsel.selectedTicketId();\n\t\n\tif (ticket_id == \"\") {\n\t\t_this.ticketsel.el.get_child().get_style_context().add_class(\"warning\");\n\t\treturn;\n\t}\n\t \n\t_this.el.response(1);\n}" }, "label" : "Create Branch", "* init" : "{\n this.el.get_style_context().add_class(\"suggested-action\");\n}\n", diff --git a/NewBranch.vala b/NewBranch.vala index 03e56b91..bd6fedd2 100644 --- a/NewBranch.vala +++ b/NewBranch.vala @@ -37,7 +37,7 @@ public class NewBranch : Object // my vars (dec) this.repo = null; - this.running = true; + this.running = false; this.queue = null; // set gobject values @@ -60,9 +60,7 @@ public class NewBranch : Object GLib.debug("got %d", (int) response_id); - - - + // have they selected a ticket.. @@ -72,20 +70,15 @@ public class NewBranch : Object // -- 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. - var ticket_id = _this.ticketsel.selectedTicketId(); - - if (ticket_id == "") { - _this.ticketsel.el.get_child().get_style_context().add_class("warning"); - return; - } - - + + if (response_id < 1) { _this.el.hide(); this.running = false; return; } + var ticket_id = _this.ticketsel.selectedTicketId(); if (this.repo != null) { var bn = _this.name.el.get_text(); @@ -99,7 +92,7 @@ public class NewBranch : Object } } - + this.running = false; @@ -722,7 +715,16 @@ public class NewBranch : Object //listeners this.el.clicked.connect( () => { + GLib.debug("fire response = 1"); + + var ticket_id = _this.ticketsel.selectedTicketId(); + + if (ticket_id == "") { + _this.ticketsel.el.get_child().get_style_context().add_class("warning"); + return; + } + _this.el.response(1); }); } -- 2.39.2