3 public class Clone : Object
8 public static Clone singleton()
15 public Xcls_reposel reposel;
16 public Xcls_prcellrenderer prcellrenderer;
17 public Xcls_repomodel repomodel;
25 this.el = new Gtk.Popover( null );
30 this.el.border_width = 0;
32 this.el.position = Gtk.PositionType.RIGHT;
33 var child_0 = new Xcls_Box2( _this );
35 this.el.add ( child_0.el );
38 // user defined functions
39 public void show (Gtk.Widget btn) {
41 //console.log('show all');
42 this.el.set_modal(true);
43 this.el.set_relative_to(btn);
44 this.repomodel.loadRepos();
45 //this.el.set_position(Gtk.PositionType.RIGHT);
48 GLib.debug("SHOWALL - POPIP\n");
52 public class Xcls_Box2 : Object
61 public Xcls_Box2(Clone _owner )
64 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
69 this.el.expand = false;
70 this.el.vexpand = false;
71 var child_0 = new Xcls_reposel( _this );
73 this.el.add ( child_0.el );
74 var child_1 = new Xcls_Button6( _this );
76 this.el.add ( child_1.el );
79 // user defined functions
81 public class Xcls_reposel : Object
83 public Gtk.ComboBox el;
91 public Xcls_reposel(Clone _owner )
95 this.el = new Gtk.ComboBox.with_entry();
100 // set gobject values
101 this.el.hexpand = true;
102 var child_0 = new Xcls_prcellrenderer( _this );
104 this.el.pack_start ( child_0.el , true );
105 var child_1 = new Xcls_repomodel( _this );
107 this.el.set_model ( child_1.el );
111 this.el.set_entry_text_column(1);
114 // user defined functions
115 public string selectedRepo () {
120 this.el.get_active_iter (out iter);
121 _this.repomodel.el.get_value (iter, 0, out val1);
124 return (string) val1;
131 public class Xcls_prcellrenderer : Object
133 public Gtk.CellRendererText el;
140 public Xcls_prcellrenderer(Clone _owner )
143 _this.prcellrenderer = this;
144 this.el = new Gtk.CellRendererText();
148 // set gobject values
151 // user defined functions
154 public class Xcls_repomodel : Object
156 public Gtk.ListStore el;
163 public Xcls_repomodel(Clone _owner )
166 _this.repomodel = this;
167 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
171 // set gobject values
174 // user defined functions
175 public void loadRepos () {
177 var rt = RooTicket.singleton();
178 var gr = GitRepo.singleton();
179 _this.reposel.loading = true;
188 el.set_value(iter, 0, "");
189 el.set_value(iter, 1, "-- select a repo --");
191 _this.reposel.el.set_active_iter(iter);
193 foreach(var newrepo in RooRepo.repos()) {
194 var has_repo = false;
195 foreach(var repo in gr.cache.values) {
196 if (newrepo.shortname == repo.name) {
205 el.set_value(iter, 0, newrepo.shortname);
206 el.set_value(iter, 1, newrepo.shortname); // "%s : %s".printf(newrepo.shortname, newrepo.description) );
211 _this.reposel.loading = false;
212 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
218 public class Xcls_Button6 : Object
220 public Gtk.Button el;
227 public Xcls_Button6(Clone _owner )
230 this.el = new Gtk.Button();
234 // set gobject values
235 this.el.label = "Checkout";
238 this.el.button_press_event.connect( () => {
240 Clones.singleton().el.hide();
241 var repo = _this.reposel.selectedRepo();
242 GitMonitor.gitmonitor.stop();
245 string[] args = { "git" , "--no-pager" , "clone" };
247 args += ("http://git.roojs.com/" + repo );
252 string home = "HOME=" + Environment.get_home_dir() ;
254 //v.push("GITPATH=" + this.repo );
257 var cfg = new SpawnConfig(Environment.get_home_dir() + "/gitlive" , args , env);
260 // may throw error...
261 var sp = new Spawn(cfg);
263 GLib.debug("Spawn: %s", sp.output);
270 GitMonitor.gitmonitor.start();
272 GitRepo.updateAll("show_clones");
278 // user defined functions