From: Alan Knowles Date: Fri, 28 Dec 2018 06:53:03 +0000 (+0800) Subject: MergeBranch.bjs X-Git-Url: http://git.roojs.org/?p=gitlive;a=commitdiff_plain;h=189a05252a21ae69e8484afeeb97d0abb4c79ee5 MergeBranch.bjs MergeBranch.vala --- diff --git a/MergeBranch.bjs b/MergeBranch.bjs index 054eb952..d9ff6c04 100644 --- a/MergeBranch.bjs +++ b/MergeBranch.bjs @@ -13,8 +13,8 @@ "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 \tGitMonitor.gitmonitor.start();\n\t \treturn;\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 if (this.repo != null) {\n \tvar bn = _this.name.el.get_text();\n \tif (ticket_id != \"\" ) {\n\t\t\tthis.repo.setActiveTicket( RooTicket.singleton().getById(ticket_id), bn);\n\t\t} else {\n\t\t\tthis.repo.createBranchNamed(bn);\n\t\t}\n }\n\t*/\n\t\n\tif (this.repo != null) {\n\t\trepo.doMerge(\n\t\t\t_this.actionsel.selectedAction(), \n\t\t\t_this.ticketsel.selectedTicketId(),\n\t\t\t_this.name.el.get_text()\n\t\t);\n\t\n\t} else {\n\t\tGitRepo.doMerges(\n\t\t\t_this.actionsel.selectedAction(), \n\t\t\t_this.ticketsel.selectedTicketId(),\n\t\t\t_this.name.el.get_text()\n\t\t);\n\t}\n\tthis.running = false; \n\n\t \n\t_this.el.hide();\t\n \tGitMonitor.gitmonitor.start();\n\n\t \n}" }, "default_width" : 500, - "$ deletable" : true, "# GitRepo repo" : "", + "$ deletable" : true, "title" : "Merge Branch", "xtype" : "Dialog", "| void show" : "( RooTicket ticket, GitRepo? repo ) \n{\n // this.el.set_gravity(Gdk.Gravity.NORTH);\n if (this.running) {\n \treturn;\n\t}\n\tGitMonitor.gitmonitor.stop();\n\t\n\t_this.el.show_all();\n\t\n\t_this.table.el.hide();\n\t_this.scrolled_window.el.hide();\n\t_this.spinner.el.show();\n\t_this.spinner.el.start();\t\n\tthis.el.set_keep_above(true); \n\tthis.el.move((Gdk.Screen.width() / 2)- 250 ,0);\n \tGLib.debug(\"Loading tickets\"); \n\n\n\t\n\t\n this.ticket = ticket;\n this.repo = repo;\n \n\t\n\tTimeout.add_seconds(1, () => {\n\t\t\n\t\t// if we are not working on a ticket, then we should be able to pick one?\n\t \t_this.dbmodel.loadTickets();\n\t \t_this.actionmodel.loadActions();\n\t\t_this.view.loadTicket(ticket.id);\n\t\t_this.spinner.el.stop();\n\t\t_this.spinner.el.hide();\t\n\n\t\tthis.table.el.show();\n\t\treturn false;\n\t});\n\t\n\tthis.el.run();\n\t \n}", @@ -66,14 +66,14 @@ "items" : [ { "id" : "actioncellrenderer", - "xtype" : "CellRendererText", "* pack" : "pack_start,true", + "xtype" : "CellRendererText", "$ xns" : "Gtk" }, { "id" : "actionmodel", - "xtype" : "ListStore", "* pack" : "set_model", + "xtype" : "ListStore", "$ columns" : "typeof(string),typeof(string)", "n_columns" : 2, "$ xns" : "Gtk", @@ -105,8 +105,8 @@ "items" : [ { "id" : "dbcellrenderer", - "* pack" : "pack_start,true", "xtype" : "CellRendererText", + "* pack" : "pack_start,true", "$ xns" : "Gtk" }, { @@ -138,6 +138,11 @@ } ] }, + { + "* pack" : "add", + "xtype" : "Notebook", + "$ xns" : "Gtk" + }, { "int height_request" : 500, "id" : "scrolled_window", @@ -149,8 +154,8 @@ "items" : [ { "id" : "view", - "xtype" : "WebView", "* pack" : "add", + "xtype" : "WebView", "$ xns" : "WebKit", "| void loadTicket" : "(string tid) {\n\tint h,w;\n\t_this.el.get_size(out w, out h);\n\t\n\tif (tid == \"\") {\n\t\t_this.scrolled_window.el.hide();\n\t\t_this.el.resize(w, 150);\n\t} else {\n\t\t_this.scrolled_window.el.show();\n\t\t_this.el.resize(w, 800);\n\t}\n\t\n\tvar rs = RooTicket.singleton();\t\t\n\tvar uri = new WebKit.URIRequest(\"https://roojs.com/admin.php/MTrack/View/\" + tid);\n\tvar hd = uri.get_http_headers();\n\tvar authCode = Base64.encode (\"%s:%s\".printf(rs.username, rs.password).data);\n\thd.append(\"Authorization\", \"Basic %s\".printf(authCode));\n\t\n\t this.el.load_request(uri);\n}\n" } @@ -168,8 +173,8 @@ }, { "label" : "Cancel", - "* pack" : "add_action_widget,0", "xtype" : "Button", + "* pack" : "add_action_widget,0", "Gtk.ReliefStyle relief" : "Gtk.ReliefStyle.NONE", "$ xns" : "Gtk" }, @@ -178,7 +183,6 @@ "* init" : "{\n this.el.get_style_context().add_class(\"suggested-action\");\n}\n", "xtype" : "Button", "* pack" : "add_action_widget,1", - "xtype" : "Button", "$ xns" : "Gtk" } ] diff --git a/MergeBranch.vala b/MergeBranch.vala index 5eec3387..4c8e6245 100644 --- a/MergeBranch.vala +++ b/MergeBranch.vala @@ -48,10 +48,10 @@ public class MergeBranch : Object var child_0 = new Xcls_Box2( _this ); child_0.ref(); this.el.get_content_area().add ( child_0.el ); - var child_1 = new Xcls_Button17( _this ); + var child_1 = new Xcls_Button18( _this ); child_1.ref(); this.el.add_action_widget ( child_1.el , 0 ); - var child_2 = new Xcls_Button18( _this ); + var child_2 = new Xcls_Button19( _this ); child_2.ref(); this.el.add_action_widget ( child_2.el , 1 ); @@ -176,12 +176,15 @@ public class MergeBranch : Object 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_scrolled_window( _this ); + var child_1 = new Xcls_Notebook14( _this ); child_1.ref(); this.el.add ( child_1.el ); - var child_2 = new Xcls_spinner( _this ); + var child_2 = new Xcls_scrolled_window( _this ); child_2.ref(); this.el.add ( child_2.el ); + var child_3 = new Xcls_spinner( _this ); + child_3.ref(); + this.el.add ( child_3.el ); } // user defined functions @@ -506,7 +509,7 @@ public class MergeBranch : Object public class Xcls_dbmodel : Object { - public Gtk.ListStore el; + public Gtk. el; private MergeBranch _this; @@ -517,11 +520,9 @@ public class MergeBranch : Object { _this = _owner; _this.dbmodel = this; - this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) ); + this.el = new Gtk.(); // my vars (dec) - - // set gobject values } // user defined functions @@ -649,6 +650,28 @@ public class MergeBranch : Object } + public class Xcls_Notebook14 : Object + { + public Gtk.Notebook el; + private MergeBranch _this; + + + // my vars (def) + + // ctor + public Xcls_Notebook14(MergeBranch _owner ) + { + _this = _owner; + this.el = new Gtk.Notebook(); + + // my vars (dec) + + // set gobject values + } + + // user defined functions + } + public class Xcls_scrolled_window : Object { public Gtk.ScrolledWindow el; @@ -752,7 +775,7 @@ public class MergeBranch : Object } - public class Xcls_Button17 : Object + public class Xcls_Button18 : Object { public Gtk.Button el; private MergeBranch _this; @@ -761,7 +784,7 @@ public class MergeBranch : Object // my vars (def) // ctor - public Xcls_Button17(MergeBranch _owner ) + public Xcls_Button18(MergeBranch _owner ) { _this = _owner; this.el = new Gtk.Button(); @@ -776,7 +799,7 @@ public class MergeBranch : Object // user defined functions } - public class Xcls_Button18 : Object + public class Xcls_Button19 : Object { public Gtk.Button el; private MergeBranch _this; @@ -785,7 +808,7 @@ public class MergeBranch : Object // my vars (def) // ctor - public Xcls_Button18(MergeBranch _owner ) + public Xcls_Button19(MergeBranch _owner ) { _this = _owner; this.el = new Gtk.Button();