Changed MergeBranch.bjsMergeBranch.vala
[gitlive] / MergeBranch.bjs
index 9375c8e..905cd03 100644 (file)
     "show" : "(self)  => {\n \n\n  //test\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    this.ticket = ticket;\n    this.repo = repo;\n    \n\tthis.el.move((Gdk.Screen.width() / 2)- 250 ,0);\n       \tGLib.debug(\"Loading tickets\"); \n\n\n    this.el.show_all();\n \t_this.dbmodel.loadTickets();\n \t_this.actionmodel.loadActions();\n\n\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    this.ticket = ticket;\n    this.repo = repo;\n    \n\tthis.el.move((Gdk.Screen.width() / 2)- 250 ,0);\n       \tGLib.debug(\"Loading tickets\"); \n\n\n    this.el.show_all();\n \t_this.dbmodel.loadTickets();\n \t_this.actionmodel.loadActions();\n\t_this.view.loadTicket(ticket.id);\n\n}",
    "default_height" : 200,
    "# RooTicket? ticket" : "null",
    "$ xns" : "Gtk",
    "bool modal" : true,
    "items" : [
     {
-     "xtype" : "VBox",
+     "xtype" : "Box",
      "$ pack" : "get_content_area().add",
      "$ xns" : "Gtk",
+     "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
      "items" : [
       {
        "bool homogeneous" : false,
-       "xtype" : "Table",
        "* pack" : "pack_start,false,false,0",
+       "xtype" : "Table",
        "uint column_spacing" : 2,
        "n_columns" : 2,
        "$ xns" : "Gtk",
        "n_rows" : 2,
+       "bool vexpand" : false,
        "int margin" : 2,
        "items" : [
         {
          "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",
         },
         {
          "listeners" : {
-          "changed" : "() => {\n\tif (this.loading) {\n\t\treturn;\n\t}\n\t\n\t \n  \t_this.name.updateText();\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}"
+          "changed" : "() => {\n\tif (this.loading) {\n\t\treturn;\n\t}\n\t_this.view.loadTicket(this.selectedTicketId());\n\t \n  \t_this.name.updateText();\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}"
          },
          "id" : "ticketsel",
          "* init" : "this.el.add_attribute(_this.dbcellrenderer.el , \"markup\", 1 );",
          "* pack" : "attach_defaults,1,2,1,2",
          "xtype" : "ComboBox",
-         "# bool loading" : false,
+         "# bool loading" : true,
          "$ xns" : "Gtk",
          "| string selectedTicketId" : "() {\nGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.dbmodel.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" : "dbcellrenderer",
-           "* pack" : "pack_start,true",
            "xtype" : "CellRendererText",
+           "* pack" : "pack_start,true",
            "$ xns" : "Gtk"
           },
           {
            "id" : "dbmodel",
-           "* pack" : "set_model",
            "xtype" : "ListStore",
+           "* pack" : "set_model",
            "| void loadTickets" : "  () {\n\n    RooTicket.singleton().loadTickets(\"\",RooTicket.Who.ME, RooTicket.Status.ACTIVE);\n    \n    _this.ticketsel.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    el.append(out iter);\n    el.set_value(iter, 0, \"\");\n    el.set_value(iter, 1, \"-- select a ticket --\");\n    \n    _this.ticketsel.el.set_active_iter(iter);\n    \n    if (_this.ticket != null &&  _this.ticket.id == \"-1\") {\n\t\tel.append(out iter);\n\t\tel.set_value(iter, 0, \"-1\");\n\t\tel.set_value(iter, 1, \"Temporary Branch - No ticket specified/relivant\");\n        _this.ticketsel.el.set_active_iter(iter);\t\n    }\n    \n    \n    \n    \n    var tickets = RooTicket.singleton().tickets;\n    foreach(var ticket in tickets) {\n    \n        el.append(out iter);\n\n        el.set_value(iter, 0, ticket.id);\n        el.set_value(iter, 1, \"#%s [%s] %s\".printf( ticket.id, ticket.project_id_name , ticket.summary));\n\t\tif (_this.ticket != null && _this.ticket.id == ticket.id) {\n\t\t    _this.ticketsel.el.set_active_iter(iter);\n\t    }\n        \n    }\n    \n    _this.ticketsel.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"
         }
        ]
+      },
+      {
+       "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",
+         "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"
+        }
+       ]
       }
      ]
     },
     {
      "label" : "Cancel",
-     "* pack" : "add_action_widget,0",
      "xtype" : "Button",
+     "* pack" : "add_action_widget,0",
      "Gtk.ReliefStyle relief" : "Gtk.ReliefStyle.NONE",
      "$ xns" : "Gtk"
     },
     {
      "label" : "Do Merge",
-     "* pack" : "add_action_widget,1",
      "xtype" : "Button",
+     "* pack" : "add_action_widget,1",
      "$ xns" : "Gtk"
     }
    ]