RooTicket.vala
[gitlive] / Clone.bjs
index ba8074f..e6e034f 100644 (file)
--- a/Clone.bjs
+++ b/Clone.bjs
@@ -8,8 +8,7 @@
  "build_module" : "gitlive",
  "items" : [
   {
-   "GitRepo repo" : "",
-   "| void show" : " (Gtk.Widget btn, Gdk.Rectangle rect, GitRepo repo) {\n    _this.repo = repo;\n    // get the active project.\n     var lm = Gtk.SourceLanguageManager.get_default();\n                \n//    ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(\n  //      lm.get_language(\"html\")\n //   );\n  \n    //print (project.fn);\n    //project.runhtml = project.runhtml || '';\n    _this.diff_view.el.get_buffer().set_text(repo.git_diff);\n    _this.status_view.el.get_buffer().set_text(repo.git_status);\n       \n    \t//console.log('show all');\n\tthis.el.set_modal(true);\n\tthis.el.set_relative_to(btn);\n    this.el.set_pointing_to(rect);\n  \n\t//this.el.set_position(Gtk.PositionType.RIGHT);\n\n\t// window + header?\n\t GLib.debug(\"SHOWALL - POPIP\\n\");\n\tthis.el.show_all();\n\t//this.el.set_size_request(800,500);\n//\tthis.diff_view.el.grab_focus();\n\t\n    //this.el.show_all();\n}\n",
+   "| void show" : " (Gtk.Widget btn) {\n \n    \t//console.log('show all');\n\tthis.el.set_modal(true);\n\tthis.el.set_relative_to(btn);\n  \tthis.repomodel.loadRepos();\n\t//this.el.set_position(Gtk.PositionType.RIGHT);\n\n\t// window + header?\n\t GLib.debug(\"SHOWALL - POPIP\\n\");\n\tthis.el.show_all();\n;\n}\n",
    "xtype" : "Popover",
    "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
    "$ xns" : "Gtk",
    "uint border_width" : 0,
    "items" : [
     {
-     "xtype" : "Box",
      "* pack" : "add",
+     "xtype" : "Box",
+     "gboolean expand" : false,
      "$ xns" : "Gtk",
-     "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
-     "border_width" : 5,
-     "$ homogeneous" : false,
+     "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+     "gboolean vexpand" : false,
      "items" : [
       {
-       "* pack" : "pack_end,false,false,0",
-       "xtype" : "Box",
-       "gboolean expand" : false,
+       "* ctor" : "new Gtk.ComboBox.with_entry()",
+       "| string selectedRepo" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.repomodel.el.get_value (iter, 0, out val1);\n \n\n\treturn  (string) val1;\n\t\n\t\n\t\n\t\n}\n",
+       "id" : "reposel",
+       "* init" : "this.el.set_entry_text_column(1);",
+       "bool hexpand" : true,
+       "* pack" : "add",
+       "xtype" : "ComboBox",
+       "# bool loading" : false,
        "$ xns" : "Gtk",
-       "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
-       "$ homogeneous" : true,
-       "gboolean vexpand" : false,
        "items" : [
         {
-         "listeners" : {
-          "button_press_event" : "() => {\n  \n   \n   GitMonitor.gitmonitor.stop();\n   _this.repo.git({ \"stash\" , \"--all\" });\n   _this.repo.loadStatus();\n   GitMonitor.gitmonitor.start();\n    _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);\n    _this.status_view.el.get_buffer().set_text(_this.repo.git_status);\n    Clones.singleton().reposStore.load();\n  \n   _this.el.hide();\n    return false;\n}"
-         },
-         "label" : "Stash Changes",
-         "* pack" : "add",
-         "xtype" : "Button",
-         "$ xns" : "Gtk"
-        },
-        {
-         "listeners" : {
-          "button_press_event" : "() => {\n   _this.repo.git({ \"commit\" , \"-a\" ,\"-m\", \"Uncommited changes synced\" });\n   _this.repo.push();\n   _this.repo.loadStatus();\n   \n    _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);\n    _this.status_view.el.get_buffer().set_text(_this.repo.git_status);\n    \n   _this.el.hide();\n   Clones.singleton().reposStore.load();\n   \n    return false;\n}"
-         },
-         "label" : "Commit Changes",
-         "* pack" : "add",
-         "xtype" : "Button",
+         "id" : "prcellrenderer",
+         "xtype" : "CellRendererText",
+         "* pack" : "pack_start,true",
          "$ xns" : "Gtk"
         },
         {
-         "listeners" : {
-          "button_press_event" : "() => {\n   var oldq = new Gee.ArrayList<GitMonitorQueue>();  \n\t \n\tNewBranch.singleton().show(_this.repo, oldq);\n\n    return false;\n}"
-         },
-         "label" : "Create Branch",
-         "xtype" : "Button",
-         "* pack" : "add",
-         "$ xns" : "Gtk"
-        },
-        {
-         "listeners" : {
-          "button_press_event" : "() => {\n       _this.el.hide();\n        return false;\n}"
-         },
-         "label" : "Ignore for now",
-         "xtype" : "Button",
-         "* pack" : "add",
+         "id" : "repomodel",
+         "| void loadRepos" : "  () {\n\n    var rt = RooTicket.singleton();\n    var gr = GitRepo.singleton();\n    _this.reposel.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    el.append(out iter);\n\n    \n    el.set_value(iter, 0, \"\");\n    el.set_value(iter, 1, \"-- select a repo --\");\n \n\t_this.reposel.el.set_active_iter(iter);\n    \n    var projects = rt.projects;\n    foreach(var newrepo in rt.repos) {\n    \tvar has_repo = false;\n    \tforeach(var repo in gr.cache.values) {\n    \t\tif (newrepo.shortname == repo.name) {\n    \t\t\thas_repo = true;\n    \t\t}\n    \t}\n    \tif (has_repo) {\n    \t\tcontinue;\n\t\t}\n        el.append(out iter);\n        \n        el.set_value(iter, 0, newrepo.shortname);\n        el.set_value(iter, 1, newrepo.shortname); // \"%s : %s\".printf(newrepo.shortname, newrepo.description) );\n       \n        \n    }\n    \n    _this.reposel.loading = false;\n     //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n",
+         "* pack" : "set_model",
+         "xtype" : "ListStore",
+         "$ columns" : "typeof(string),typeof(string)",
+         "n_columns" : 2,
          "$ xns" : "Gtk"
         }
        ]
+      },
+      {
+       "listeners" : {
+        "button_press_event" : "() => {\n      _this.el.hide();\n      Clones.singleton().el.hide();\n     var repo = _this.reposel.selectedRepo();\n        GitMonitor.gitmonitor.stop();\n        \n    \n        string[]  args = { \"git\" , \"--no-pager\" , \"clone\" };\n    \n        args +=  (\"http://git.roojs.com/\" + repo );\n \n    \n\n        string[]   env = {};\n        string  home = \"HOME=\" + Environment.get_home_dir() ;\n        env +=  home ;\n   \t\t//v.push(\"GITPATH=\" + this.repo );\n        //}\n          \n        var cfg = new SpawnConfig(Environment.get_home_dir() + \"/gitlive\" , args , env);\n        //cfg.debug = true;\n\n       // may throw error...\n        var sp = new Spawn(cfg);\n      \n      \t GLib.debug(\"Spawn: %s\", sp.output);\n\t\n        \n        \n        \n        \n        \n        GitMonitor.gitmonitor.start();\n\n         GitRepo.updateAll(\"show_clones\");\n      \n        return false;\n}"
+       },
+       "label" : "Checkout",
+       "xtype" : "Button",
+       "* pack" : "add",
+       "$ xns" : "Gtk"
       }
      ]
     }