From 87963ea388fba20b1d03d7fb01df3d4886fdccbb Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Wed, 13 Feb 2019 14:05:02 +0800 Subject: [PATCH] fix bug in last commit - only hide branch if everything is ok --- NewBranch.bjs | 2 +- NewBranch.vala | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/NewBranch.bjs b/NewBranch.bjs index efee1cb0..37a9a2de 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\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\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 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\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}" }, "default_width" : 500, "$ deletable" : true, diff --git a/NewBranch.vala b/NewBranch.vala index 1a3a0793..03e56b91 100644 --- a/NewBranch.vala +++ b/NewBranch.vala @@ -59,11 +59,7 @@ public class NewBranch : Object this.el.response.connect( (self, response_id) => { GLib.debug("got %d", (int) response_id); - if (response_id < 1) { - _this.el.hide(); - this.running = false; - return; - } + @@ -83,6 +79,14 @@ public class NewBranch : Object return; } + + if (response_id < 1) { + _this.el.hide(); + this.running = false; + return; + } + + if (this.repo != null) { var bn = _this.name.el.get_text(); -- 2.39.2