X-Git-Url: http://git.roojs.org/?p=gitlive;a=blobdiff_plain;f=Clone.bjs;fp=Clone.bjs;h=e6e034f3ef54edd83c6fef570e72784358c59ad5;hp=0000000000000000000000000000000000000000;hb=2ac46b7e5e54b5382df0c55b865e47a9937e15f8;hpb=2d3bb6db4cf59fb23b8774360ee0f15ffb7dc975 diff --git a/Clone.bjs b/Clone.bjs new file mode 100644 index 00000000..e6e034f3 --- /dev/null +++ b/Clone.bjs @@ -0,0 +1,68 @@ +{ + "name" : "Clone", + "parent" : "", + "title" : "", + "path" : "/home/alan/gitlive/gitlive/Clone.bjs", + "permname" : "", + "modOrder" : "", + "build_module" : "gitlive", + "items" : [ + { + "| 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", + "bool modal" : true, + "uint border_width" : 0, + "items" : [ + { + "* pack" : "add", + "xtype" : "Box", + "gboolean expand" : false, + "$ xns" : "Gtk", + "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL", + "gboolean vexpand" : false, + "items" : [ + { + "* 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", + "items" : [ + { + "id" : "prcellrenderer", + "xtype" : "CellRendererText", + "* pack" : "pack_start,true", + "$ xns" : "Gtk" + }, + { + "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" + } + ] + } + ] + } + ] +} \ No newline at end of file