Partial Fix #5639 - gitlive - general tidy ups
[gitlive] / MergeBranch.bjs
index 5449642..28cf631 100644 (file)
@@ -17,7 +17,7 @@
    "$ 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}",
+   "|   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\t\n    this.ticket = ticket;\n    this.repo = repo;\n    \n\t\n\tTimeout.add_seconds(1, () => {\n\t    _this.diff_view.el.get_buffer().set_text(\n\t    \trepo != null ? repo.previewMerge() : GitRepo.previewMerges(ticket.id)\n    \t);\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}",
    "default_height" : 200,
    "# RooTicket? ticket" : "null",
    "$ xns" : "Gtk",
@@ -33,8 +33,8 @@
       {
        "id" : "table",
        "bool homogeneous" : false,
-       "* pack" : "pack_start,false,false,0",
        "xtype" : "Table",
+       "* pack" : "pack_start,false,false,0",
        "uint column_spacing" : 2,
        "n_columns" : 2,
        "$ xns" : "Gtk",
        ]
       },
       {
-       "int height_request" : 500,
-       "id" : "scrolled_window",
-       "* init" : "{\n\tthis.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n}\n",
        "* pack" : "add",
-       "xtype" : "ScrolledWindow",
+       "xtype" : "Notebook",
        "$ xns" : "Gtk",
        "bool vexpand" : true,
        "items" : [
         {
-         "id" : "view",
-         "xtype" : "WebView",
-         "* pack" : "add",
-         "$ 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"
+         "id" : "label_diff",
+         "* pack" : false,
+         "xtype" : "Label",
+         "string label" : "Projected Commit Diff",
+         "$ xns" : "Gtk"
+        },
+        {
+         "id" : "label_ticket",
+         "string label" : "Ticket Details",
+         "* pack" : false,
+         "xtype" : "Label",
+         "$ xns" : "Gtk"
+        },
+        {
+         "* pack" : "append_page,_this.label_diff.el",
+         "xtype" : "Box",
+         "gboolean homogeneous" : false,
+         "$ xns" : "Gtk",
+         "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+         "items" : [
+          {
+           "int height_request" : 400,
+           "* pack" : "pack_start,true,true,0",
+           "xtype" : "ScrolledWindow",
+           "$ xns" : "Gtk",
+           "items" : [
+            {
+             "id" : "diff_view",
+             "* init" : " \n    var description =   Pango.FontDescription.from_string(\"monospace\");\n    description.set_size(9000);\n    this.el.override_font(description);\n         var lm = Gtk.SourceLanguageManager.get_default();\n                    \n    ((Gtk.SourceBuffer)(this.el.get_buffer())).set_language(\n        lm.get_language(\"diff\")\n    );",
+             "xtype" : "View",
+             "* pack" : "add",
+             "$ xns" : "GtkSource"
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "* pack" : "append_page,_this.label_ticket.el",
+         "xtype" : "Box",
+         "gboolean homogeneous" : false,
+         "$ xns" : "Gtk",
+         "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+         "items" : [
+          {
+           "int height_request" : 500,
+           "id" : "scrolled_window",
+           "* init" : "{\n\tthis.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n}\n",
+           "* pack" : "add",
+           "xtype" : "ScrolledWindow",
+           "$ xns" : "Gtk",
+           "bool vexpand" : true,
+           "items" : [
+            {
+             "id" : "view",
+             "* 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"
+            }
+           ]
+          }
+         ]
         }
        ]
       },