3 public class Clone : Object
8 public static Clone singleton()
15 public Xcls_projectsel projectsel;
16 public Xcls_prcellrenderer prcellrenderer;
17 public Xcls_prmodel prmodel;
26 this.el = new Gtk.Popover( null );
31 this.el.border_width = 0;
33 this.el.position = Gtk.PositionType.RIGHT;
34 var child_0 = new Xcls_Box2( _this );
36 this.el.add ( child_0.el );
39 // user defined functions
40 public void show (Gtk.Widget btn, Gdk.Rectangle rect, GitRepo repo) {
42 // get the active project.
43 var lm = Gtk.SourceLanguageManager.get_default();
45 // ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(
46 // lm.get_language("html")
50 //project.runhtml = project.runhtml || '';
51 _this.diff_view.el.get_buffer().set_text(repo.git_diff);
52 _this.status_view.el.get_buffer().set_text(repo.git_status);
54 //console.log('show all');
55 this.el.set_modal(true);
56 this.el.set_relative_to(btn);
57 this.el.set_pointing_to(rect);
59 //this.el.set_position(Gtk.PositionType.RIGHT);
62 GLib.debug("SHOWALL - POPIP\n");
64 //this.el.set_size_request(800,500);
65 // this.diff_view.el.grab_focus();
69 public class Xcls_Box2 : Object
78 public Xcls_Box2(Clone _owner )
81 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
86 this.el.homogeneous = false;
87 this.el.border_width = 5;
88 var child_0 = new Xcls_Box3( _this );
90 this.el.pack_end ( child_0.el , false,false,0 );
93 // user defined functions
95 public class Xcls_Box3 : Object
104 public Xcls_Box3(Clone _owner )
107 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
111 // set gobject values
112 this.el.homogeneous = true;
113 this.el.expand = false;
114 this.el.vexpand = false;
115 var child_0 = new Xcls_projectsel( _this );
117 this.el.attach_defaults ( child_0.el , 0,1,1,2 );
118 var child_1 = new Xcls_Button7( _this );
120 this.el.add ( child_1.el );
123 // user defined functions
125 public class Xcls_projectsel : Object
127 public Gtk.ComboBox el;
135 public Xcls_projectsel(Clone _owner )
138 _this.projectsel = this;
139 this.el = new Gtk.ComboBox.with_entry();
142 this.loading = false;
144 // set gobject values
145 var child_0 = new Xcls_prcellrenderer( _this );
147 this.el.pack_start ( child_0.el , true );
148 var child_1 = new Xcls_prmodel( _this );
150 this.el.set_model ( child_1.el );
154 this.el.set_entry_text_column(1);
157 this.el.changed.connect( () => {
161 var project_id = this.selectedProjectId();
162 _this.dbmodel.loadTickets(project_id);
165 /*if (this.loading) {
168 var ticket_id = this.selectedTicketId();
170 var name = RooTicket.singleton().usernameLocal();
172 if (ticket_id == "" || ticket_id == null) {
174 var dt = new DateTime.now_local();
175 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
180 var ticket = RooTicket.singleton().getById(ticket_id);
182 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
184 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
189 // user defined functions
190 public string selectedProjectId () {
195 this.el.get_active_iter (out iter);
196 _this.prmodel.el.get_value (iter, 0, out val1);
199 return (string) val1;
206 public class Xcls_prcellrenderer : Object
208 public Gtk.CellRendererText el;
215 public Xcls_prcellrenderer(Clone _owner )
218 _this.prcellrenderer = this;
219 this.el = new Gtk.CellRendererText();
223 // set gobject values
226 // user defined functions
229 public class Xcls_prmodel : Object
231 public Gtk.ListStore el;
238 public Xcls_prmodel(Clone _owner )
241 _this.prmodel = this;
242 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
246 // set gobject values
249 // user defined functions
250 public void loadProjects (string id) {
252 var rt = RooTicket.singleton();
255 _this.projectsel.loading = true;
264 el.set_value(iter, 0, "");
265 el.set_value(iter, 1, "-- select a project --");
267 _this.projectsel.el.set_active_iter(iter);
269 var projects = rt.projects;
270 foreach(var project in projects) {
274 el.set_value(iter, 0, project.id);
275 el.set_value(iter, 1, project.name );
276 if (id == project.id) {
277 _this.projectsel.el.set_active_iter(iter);
282 _this.projectsel.loading = false;
283 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
289 public class Xcls_Button7 : Object
291 public Gtk.Button el;
298 public Xcls_Button7(Clone _owner )
301 this.el = new Gtk.Button();
305 // set gobject values
306 this.el.label = "Checkout";
309 this.el.button_press_event.connect( () => {
315 // user defined functions