},
{
"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",
+ "| 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 foreach(var newrepo in RooRepo.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)",
el.set_value(iter, 1, "-- select a repo --");
_this.reposel.el.set_active_iter(iter);
-
- var projects = rt.projects;
- foreach(var newrepo in rt.repos) {
+
+ foreach(var newrepo in RooRepo.repos()) {
var has_repo = false;
foreach(var repo in gr.cache.values) {
if (newrepo.shortname == repo.name) {
"response" : "(self, response_id) => { \n \n this.el.hide();\n \n}"
},
"boolean deletable" : true,
+ "| void loadAndShow" : "() {\n\t\n\t_this.el.show_all();\n\t\n\t_this.toolbar.el.hide();\n\t_this.scrolled.el.hide();\n\t_this.spinner.el.show();\n\t_this.spinner.el.start();\t\n\t\n\tGitRepo.updateAll(\"show_clones\");\n\tthis.el.set_deletable(true);\n this.el.set_gravity(Gdk.Gravity.NORTH);\n this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);\n this.el.set_keep_above(true);\n this.el.set_default_size(\n\t\t\tint.min(1024,Gdk.Screen.width()),\n\t\t\tint.max(500,Gdk.Screen.height() - 300)\n\t);\n \n \n\t\n\t\n}\n\n",
"default_width" : 1024,
- "| void show" : "() {\n\n \n this.el.set_deletable(true);\n this.el.set_gravity(Gdk.Gravity.NORTH);\n this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);\n \n this.el.set_default_size(\n\t\t\tint.min(1024,Gdk.Screen.width()),\n\t\t\tint.max(500,Gdk.Screen.height() - 300)\n\t);\n \n this.el.show_all();\n _this.reposStore.load();\n this.el.set_keep_above(true);\n this.el.run();\n // load clones..\n// this.get('/reposStore').load();\n \n //this.get('/ok_button').el.set_sensitive(false);\n \n // block until we return.\n// var run_ret = this.el.run();\n// if (run_ret < 1 ) {\n// return \"DONE\";\n// }\n// print(\"RUN RETURN : \" + run_ret);\n// return \"DONE\";\n //print(JSON.stringify(this.get('bug').getValue()));\n // return this.get('bug').getValue();\n //this.success = c.success;\n}\n",
+ "| void show" : "() {\n\n this.el.show_all();\n\t_this.spinner.el.stop();\n\t_this.spinner.el.hide();\t\n\t_this.toolbar.el.show();\n\t_this.scrolled.el.show();\t\n \n this.el.set_deletable(true);\n this.el.set_gravity(Gdk.Gravity.NORTH);\n this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);\n this.el.set_keep_above(true);\n this.el.set_default_size(\n\t\t\tint.min(1024,Gdk.Screen.width()),\n\t\t\tint.max(500,Gdk.Screen.height() - 300)\n\t);\n \n\n _this.reposStore.load();\n \n GLib.debug(\"show clones = run?\");\n this.el.run();\n // load clones..\n// this.get('/reposStore').load();\n \n //this.get('/ok_button').el.set_sensitive(false);\n \n // block until we return.\n// var run_ret = this.el.run();\n// if (run_ret < 1 ) {\n// return \"DONE\";\n// }\n// print(\"RUN RETURN : \" + run_ret);\n// return \"DONE\";\n //print(JSON.stringify(this.get('bug').getValue()));\n // return this.get('bug').getValue();\n //this.success = c.success;\n}\n",
"title" : "Manage Clones",
"xtype" : "Dialog",
"default_height" : 500,
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
"items" : [
{
+ "id" : "spinner",
+ "bool hexpand" : true,
+ "* pack" : "add",
+ "xtype" : "Spinner",
+ "$ xns" : "Gtk",
+ "bool vexpand" : true
+ },
+ {
+ "id" : "toolbar",
"bool homogeneous" : true,
"xtype" : "Box",
"* pack" : "pack_start,false,false,0",
]
},
{
+ "id" : "scrolled",
"* init" : " {\n \n this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n}\n",
"bool expand" : true,
"bool hexpand" : true,
}
return _Clones;
}
+ public Xcls_spinner spinner;
+ public Xcls_toolbar toolbar;
+ public Xcls_scrolled scrolled;
public Xcls_reposView reposView;
public Xcls_reposStore reposStore;
public Xcls_tv_autocommit tv_autocommit;
}
// user defined functions
+ public void loadAndShow () {
+
+ _this.el.show_all();
+
+ _this.toolbar.el.hide();
+ _this.scrolled.el.hide();
+ _this.spinner.el.show();
+ _this.spinner.el.start();
+
+ GitRepo.updateAll("show_clones");
+ this.el.set_deletable(true);
+ this.el.set_gravity(Gdk.Gravity.NORTH);
+ this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);
+ this.el.set_keep_above(true);
+ this.el.set_default_size(
+ int.min(1024,Gdk.Screen.width()),
+ int.max(500,Gdk.Screen.height() - 300)
+ );
+
+
+
+
+ }
public void show () {
-
+ this.el.show_all();
+ _this.spinner.el.stop();
+ _this.spinner.el.hide();
+ _this.toolbar.el.show();
+ _this.scrolled.el.show();
+
this.el.set_deletable(true);
this.el.set_gravity(Gdk.Gravity.NORTH);
this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);
-
+ this.el.set_keep_above(true);
this.el.set_default_size(
int.min(1024,Gdk.Screen.width()),
int.max(500,Gdk.Screen.height() - 300)
);
- this.el.show_all();
+
_this.reposStore.load();
- this.el.set_keep_above(true);
+
+ GLib.debug("show clones = run?");
this.el.run();
// load clones..
// this.get('/reposStore').load();
// my vars (dec)
// set gobject values
- var child_0 = new Xcls_Box3( _this );
+ var child_0 = new Xcls_spinner( _this );
child_0.ref();
- this.el.pack_start ( child_0.el , false,false,0 );
- var child_1 = new Xcls_ScrolledWindow5( _this );
+ this.el.add ( child_0.el );
+ var child_1 = new Xcls_toolbar( _this );
child_1.ref();
- this.el.pack_end ( child_1.el , true,true,0 );
+ this.el.pack_start ( child_1.el , false,false,0 );
+ var child_2 = new Xcls_scrolled( _this );
+ child_2.ref();
+ this.el.pack_end ( child_2.el , true,true,0 );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_spinner : Object
+ {
+ public Gtk.Spinner el;
+ private Clones _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_spinner(Clones _owner )
+ {
+ _this = _owner;
+ _this.spinner = this;
+ this.el = new Gtk.Spinner();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
}
// user defined functions
}
- public class Xcls_Box3 : Object
+
+ public class Xcls_toolbar : Object
{
public Gtk.Box el;
private Clones _this;
// my vars (def)
// ctor
- public Xcls_Box3(Clones _owner )
+ public Xcls_toolbar(Clones _owner )
{
_this = _owner;
+ _this.toolbar = this;
this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
// my vars (dec)
// set gobject values
this.el.homogeneous = true;
- var child_0 = new Xcls_Button4( _this );
+ var child_0 = new Xcls_Button5( _this );
child_0.ref();
this.el.add ( child_0.el );
}
// user defined functions
}
- public class Xcls_Button4 : Object
+ public class Xcls_Button5 : Object
{
public Gtk.Button el;
private Clones _this;
// my vars (def)
// ctor
- public Xcls_Button4(Clones _owner )
+ public Xcls_Button5(Clones _owner )
{
_this = _owner;
this.el = new Gtk.Button();
}
- public class Xcls_ScrolledWindow5 : Object
+ public class Xcls_scrolled : Object
{
public Gtk.ScrolledWindow el;
private Clones _this;
// my vars (def)
// ctor
- public Xcls_ScrolledWindow5(Clones _owner )
+ public Xcls_scrolled(Clones _owner )
{
_this = _owner;
+ _this.scrolled = this;
this.el = new Gtk.ScrolledWindow( null, null );
// my vars (dec)
}
var first = this.queue.get(0);
var delay = true;
- if (!first.repo.is_wip_branch() && first.repo.is_auto_branch()) {
+
+ // eg. on master.... and is_auto branch
+ if (first.repo.is_master_branch() && first.repo.is_auto_branch()) {
delay = false;
}
}
foreach(var q in this.queue) {
- if (!q.shouldIgnore() && !q.repo.is_wip_branch() && q.repo.is_auto_branch()) {
+ if (!q.shouldIgnore() && q.repo.is_master_branch() && q.repo.is_auto_branch()) {
var oldq = this.queue;
this.queue = new Gee.ArrayList<GitMonitorQueue>();
NewBranch.singleton().show(q.repo, oldq);
var gitpath = cmd.gitpath;
var repo = GitRepo.get( gitpath );
- if ( !repo.is_wip_branch() && repo.is_auto_branch()) {
+ if ( repo.is_master_branch() && repo.is_auto_branch()) {
leave_queued.add(cmd);
continue;
}
public string git_working_dir;
public bool debug = false;
public bool has_local_changes = false;
+ public string host = "";
public string git_status;
public string git_diff;
public string ahead_or_behind = "";
public Gee.HashMap<string,GitBranch> branches; // accessed in GitBranch..
public RooTicket? activeTicket;
public Gee.HashMap<string,GitRepo> cache;
+ public Gee.HashMap<string,string> config_cache;
*
*/
- private GitRepo(string path) {
+ private GitRepo(string path)
+ {
// cal parent?
this.name = File.new_for_path(path).get_basename();
this.ignore_files = new Gee.HashMap<string,bool>();
if ( !cache.has_key(path) ) {
cache.set( path, this);
}
+
+ var r = this.git({ "remote" , "get-url" , "--push" , "origin"});
+ var uri = new Soup.URI(r);
+ this.host = uri.get_host();
+ this.init_config();
+
this.loadBranches();
this.loadActiveTicket();
this.loadStatus();
}
- public bool is_wip_branch()
+ public bool is_master_branch()
{
- return this.currentBranch.name.has_prefix("wip_");
+ // special branches that do not allow autopushing now...
+ return this.currentBranch.name == "master" || this.currentBranch.name == "roojs";
}
-
- public bool is_managed()
+ public void init_config()
{
- // is it a roojs origin?
- var r = this.git({ "remote" , "get-url" , "--push" , "origin"});
- var uri = new Soup.URI(r);
- if (uri.get_host() != "git.roojs.com") { // we can only push to this url. -- unless we have forced it to be managed.
- return FileUtils.test(this.gitdir + "/.gitlive-managed" , FileTest.EXISTS);
+ this.config_cache = new Gee.HashMap<string,string>();
+ // managed =
+ if (this.get_config("managed") == "") {
+ this.set_config("managed", this.host == "git.roojs.com" ? "1" : "0");
+ }
+ if (this.get_config("autocommit") == "") {
+ this.set_config("autocommit", this.host == "git.roojs.com" ? "1" : "0");
+ }
+ if (this.get_config("autopush") == "") {
+ this.set_config("autopush", this.host == "git.roojs.com" ? "1" : "0");
+ }
+
+ }
+
+
+
+ public string get_config(string key) {
+
+ if (this.config_cache.has_key(key)) {
+ //GLib.debug("get_config %s = '%s'", key, this.config_cache.get(key));
+ return this.config_cache.get(key);
+ }
+ try {
+ var ret = this.git({ "config" , "gitlive." + key }).strip();
+ this.config_cache.set(key, ret);
+ //GLib.debug("get_config %s = '%s'", key, ret);
+ return ret;
+ } catch (Error e) {
+ this.config_cache.set(key, "");
+ //GLib.debug("get_config (fail) %s = '%s'", key, "");
+ return ""; // happens when there is nothing set...
}
- // otherwise see if unmanaged is set to disable it..
- return !FileUtils.test(this.gitdir + "/.gitlive-unmanaged" , FileTest.EXISTS);
+ }
+ public void set_config(string key, string value) {
+ this.git({ "config" , "gitlive." + key, value });
+ this.config_cache.set(key,value);
+ }
+
+ public bool is_managed()
+ {
+ return this.get_config("managed") == "1";
}
public bool is_autocommit ()
- {
- return !FileUtils.test(this.gitdir + "/.gitlive-disable-autocommit" , FileTest.EXISTS);
+ {
+ return this.get_config("autocommit") == "1";
}
+
public void set_autocommit(bool val)
{
-
- var cur = this.is_autocommit();
- GLib.debug("SET auto commit : %s <= %s", val ? "ON" : "OFF", cur ? "ON" : "OFF");
- if (cur == val) {
- return; // no change..
- }
- if (!val) {
- FileUtils.set_contents(this.gitdir + "/.gitlive-disable-autocommit" , "x");
- } else {
- // it exists...
- FileUtils.remove(this.gitdir + "/.gitlive-disable-autocommit" );
- }
+ this.set_config("autocommit", val ? "1" : "0");
}
public bool is_auto_branch ()
{
- return FileUtils.test(this.gitdir + "/.gitlive-enable-auto-branch" , FileTest.EXISTS);
+ if (this.name == "gitlog") {
+ return false;
+ }
+ // check remote...
+ if (this.is_managed()) {
+ return true;
+ }
+ return false;
+
+
}
public void set_auto_branch(bool val)
{
-
- var cur = this.is_auto_branch();
- GLib.debug("SET auto branch : %s <= %s", val ? "ON" : "OFF", cur ? "ON" : "OFF");
-
- if (cur == val) {
- return; // no change..
- }
- if (val) {
- FileUtils.set_contents(this.gitdir + "/.gitlive-enable-auto-branch" , "x");
- } else {
- // it exists...
- FileUtils.remove(this.gitdir + "/.gitlive-enable-auto-branch" );
+ if (this.name == "gitlog") {
+ return;
}
+ this.set_config("managed", val ? "1" : "0");
}
public bool is_autopush ()
{
- return !FileUtils.test(this.gitdir + "/.gitlive-disable-autopush" , FileTest.EXISTS);
+ return this.get_config("autopush") == "1";
}
public void set_autopush(bool val)
{
-
- var cur = this.is_autopush();
- GLib.debug("SET auto push : %s <= %s", val ? "ON" : "OFF", cur ? "ON" : "OFF");
- if (cur == val) {
- return; // no change..
- }
- if (!val) {
- FileUtils.set_contents(this.gitdir + "/.gitlive-disable-autopush" , "");
- } else {
- // it exists...
- FileUtils.remove(this.gitdir + "/.gitlive-disable-autopush" );
- }
-
+ this.set_config("autopush", val ? "1" : "0");
}
public void loadActiveTicket()
{
this.activeTicket = null;
- if (!FileUtils.test(this.gitdir + "/.gitlive-active-ticket" , FileTest.EXISTS)) {
- return;
- }
- string ticket_id;
- FileUtils.get_contents(this.gitdir + "/.gitlive-active-ticket" , out ticket_id);
+ var ticket_id = this.get_config("ticket");
+
if (ticket_id.length < 1) {
return;
}
public bool setActiveTicket(RooTicket? ticket, string branchname)
{
+ this.set_config("ticket", "");
if (!this.createBranchNamed(branchname)) {
return false;
}
- if (ticket != null) {
- FileUtils.set_contents(this.gitdir + "/.gitlive-active-ticket" , ticket.id);
- } else {
- FileUtils.remove(this.gitdir + "/.gitlive-active-ticket" );
- }
+ this.set_config("ticket", ticket == null ? "": ticket.id);
this.activeTicket = ticket;
return true;
}
// may throw error...
var sp = new Spawn(cfg);
+ //GLib.debug( "GOT result: %d" , sp.result);
+
// diff output is a bit big..
if (args_in[0] != "diff") {
GLib.debug( "GOT: %s" , sp.output);
}
repo.update_async(updateAllCallback);
}
-
+ GLib.debug("calls total = %d", (int) update_all_total);
}
public static void updateAllCallback(GitRepo repo, int err, string res)
{
repo.loadStatus();
update_all_total--;
+ GLib.debug("calls remaining = %d", (int)update_all_total);
if (update_all_total > 0 ) {
+
return;
}
+ GLib.debug("call after load = %s", update_all_after);
+
switch (update_all_after) {
case "show_clones":
Clones.singleton().show();
break;
default:
+ GLib.debug("Unkown call after load = %s", update_all_after);
break;
}
return;
--pkg libcanberra \
--pkg libsoup-2.4 \
--pkg json-glib-1.0 \
- --pkg gtksourceview-3.0
+ --pkg gtksourceview-3.0 \
+ --pkg webkit2gtk-4.0
+
Gitlive_SOURCES = \
Gitlive.vala \
GitRepo.vala \
GitBranch.vala \
RooTicket.vala \
+ RooProject.vala \
+ RooRepo.vala \
c/xorg_idletime.c \
WindowLog.vala \
Clones.vala \
{
"listeners" : {
"delete_event" : "(self, event) => {\n this.el.hide();\n return true; \n //test \n}\n ",
- "response" : " (self, response_id) => { \n \n\tGLib.debug(\"got %d\", (int) response_id);\n\tif (response_id == 0) {\n\t _this.el.hide();\t\n\t this.running = false; \n \tGitMonitor.gitmonitor.start();\n\t \treturn;\n\t}\n\t /*\n\t// have they selected a ticket..\n\t// make that the current active ticket?\n\t// we really need to store locally what ticket is being worked on..\n\t// in theory we could be working on multiple project and not merging..\n\t// -- each repo would have their active ticket (only one per repo)\n\t// -- so we could just store that in there\n\t// -- initial load can check the contents of the ticket files on first scan.\n\tvar ticket_id = _this.ticketsel.selectedTicketId();\n\t\n if (this.repo != null) {\n \tvar bn = _this.name.el.get_text();\n \tif (ticket_id != \"\" ) {\n\t\t\tthis.repo.setActiveTicket( RooTicket.singleton().getById(ticket_id), bn);\n\t\t} else {\n\t\t\tthis.repo.createBranchNamed(bn);\n\t\t}\n }\n\t*/\n\t\n\tif (this.repo != null) {\n\t\trepo.doMerge(\n\t\t\t_this.actionsel.selectedAction(), \n\t\t\t_this.ticketsel.selectedTicketId(),\n\t\t\t_this.name.el.get_text()\n\t\t);\n\t\n\t} else {\n\t\tGitRepo.doMerges(\n\t\t\t_this.actionsel.selectedAction(), \n\t\t\t_this.ticketsel.selectedTicketId(),\n\t\t\t_this.name.el.get_text()\n\t\t);\n\t}\n\tthis.running = false; \n\n\t \n\t_this.el.hide();\t\n \tGitMonitor.gitmonitor.start();\n\n\t \n}",
- "show" : "(self) => {\n \n\n //test\n}"
+ "response" : " (self, response_id) => { \n \n\tGLib.debug(\"got %d\", (int) response_id);\n\tif (response_id < 1) {\n\t _this.el.hide();\t\n\t this.running = false; \n \tGitMonitor.gitmonitor.start();\n\t \treturn;\n\t}\n\t /*\n\t// have they selected a ticket..\n\t// make that the current active ticket?\n\t// we really need to store locally what ticket is being worked on..\n\t// in theory we could be working on multiple project and not merging..\n\t// -- each repo would have their active ticket (only one per repo)\n\t// -- so we could just store that in there\n\t// -- initial load can check the contents of the ticket files on first scan.\n\tvar ticket_id = _this.ticketsel.selectedTicketId();\n\t\n if (this.repo != null) {\n \tvar bn = _this.name.el.get_text();\n \tif (ticket_id != \"\" ) {\n\t\t\tthis.repo.setActiveTicket( RooTicket.singleton().getById(ticket_id), bn);\n\t\t} else {\n\t\t\tthis.repo.createBranchNamed(bn);\n\t\t}\n }\n\t*/\n\t\n\tif (this.repo != null) {\n\t\trepo.doMerge(\n\t\t\t_this.actionsel.selectedAction(), \n\t\t\t_this.ticketsel.selectedTicketId(),\n\t\t\t_this.name.el.get_text()\n\t\t);\n\t\n\t} else {\n\t\tGitRepo.doMerges(\n\t\t\t_this.actionsel.selectedAction(), \n\t\t\t_this.ticketsel.selectedTicketId(),\n\t\t\t_this.name.el.get_text()\n\t\t);\n\t}\n\tthis.running = false; \n\n\t \n\t_this.el.hide();\t\n \tGitMonitor.gitmonitor.start();\n\n\t \n}"
},
"default_width" : 500,
"$ deletable" : true,
"# GitRepo repo" : "",
"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\t_this.el.show_all();\n\t\n\t_this.table.el.hide();\n\t_this.scrolled_window.el.hide();\n\t_this.spinner.el.show();\n\t_this.spinner.el.start();\t\n\tthis.el.set_keep_above(true); \n\tthis.el.move((Gdk.Screen.width() / 2)- 250 ,0);\n \tGLib.debug(\"Loading tickets\"); \n\n\n\t\n\t\n this.ticket = ticket;\n this.repo = repo;\n \n\t\n\tTimeout.add_seconds(1, () => {\n\t\t\n\t\t// if we are not working on a ticket, then we should be able to pick one?\n\t \t_this.dbmodel.loadTickets();\n\t \t_this.actionmodel.loadActions();\n\t\t_this.view.loadTicket(ticket.id);\n\t\t_this.spinner.el.stop();\n\t\t_this.spinner.el.hide();\t\n\n\t\tthis.table.el.show();\n\t\treturn false;\n\t});\n\t\n\tthis.el.run();\n\t \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" : [
{
+ "id" : "table",
"bool homogeneous" : false,
"xtype" : "Table",
"* pack" : "pack_start,false,false,0",
"n_columns" : 2,
"$ xns" : "Gtk",
"n_rows" : 2,
+ "bool vexpand" : false,
"int margin" : 2,
"items" : [
{
},
{
"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" : "dbmodel",
"* pack" : "set_model",
- "xtype" : "ListStore",
"| 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"
+ }
+ ]
+ },
+ {
+ "id" : "spinner",
+ "bool hexpand" : true,
+ "* pack" : "add",
+ "xtype" : "Spinner",
+ "$ xns" : "Gtk",
+ "bool vexpand" : true
}
]
},
},
{
"label" : "Do Merge",
+ "* init" : "{\n this.el.get_style_context().add_class(\"suggested-action\");\n}\n",
+ "xtype" : "Button",
"* pack" : "add_action_widget,1",
"xtype" : "Button",
"$ xns" : "Gtk"
}
return _MergeBranch;
}
+ public Xcls_table table;
public Xcls_actionsel actionsel;
public Xcls_actioncellrenderer actioncellrenderer;
public Xcls_actionmodel actionmodel;
public Xcls_dbcellrenderer dbcellrenderer;
public Xcls_dbmodel dbmodel;
public Xcls_name name;
+ public Xcls_scrolled_window scrolled_window;
+ public Xcls_view view;
+ public Xcls_spinner spinner;
// my vars (def)
public GitRepo repo;
this.el.default_width = 500;
this.el.deletable = true;
this.el.modal = true;
- var child_0 = new Xcls_VBox2( _this );
+ var child_0 = new Xcls_Box2( _this );
child_0.ref();
this.el.get_content_area().add ( child_0.el );
- var child_1 = new Xcls_Button14( _this );
+ var child_1 = new Xcls_Button17( _this );
child_1.ref();
this.el.add_action_widget ( child_1.el , 0 );
- var child_2 = new Xcls_Button15( _this );
+ var child_2 = new Xcls_Button18( _this );
child_2.ref();
this.el.add_action_widget ( child_2.el , 1 );
this.el.response.connect( (self, response_id) => {
GLib.debug("got %d", (int) response_id);
- if (response_id == 0) {
+ if (response_id < 1) {
_this.el.hide();
this.running = false;
GitMonitor.gitmonitor.start();
});
- this.el.show.connect( (self) => {
-
-
- //test
- });
}
// user defined functions
}
GitMonitor.gitmonitor.stop();
- this.ticket = ticket;
- this.repo = repo;
-
+ _this.el.show_all();
+
+ _this.table.el.hide();
+ _this.scrolled_window.el.hide();
+ _this.spinner.el.show();
+ _this.spinner.el.start();
+ this.el.set_keep_above(true);
this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
GLib.debug("Loading tickets");
- this.el.show_all();
- _this.dbmodel.loadTickets();
- _this.actionmodel.loadActions();
-
+
+
+ this.ticket = ticket;
+ this.repo = repo;
+
+
+ Timeout.add_seconds(1, () => {
+
+ // if we are not working on a ticket, then we should be able to pick one?
+ _this.dbmodel.loadTickets();
+ _this.actionmodel.loadActions();
+ _this.view.loadTicket(ticket.id);
+ _this.spinner.el.stop();
+ _this.spinner.el.hide();
+ this.table.el.show();
+ return false;
+ });
+
+ this.el.run();
+
}
- public class Xcls_VBox2 : Object
+ public class Xcls_Box2 : Object
{
- public Gtk.VBox el;
+ public Gtk.Box el;
private MergeBranch _this;
// my vars (def)
// ctor
- public Xcls_VBox2(MergeBranch _owner )
+ public Xcls_Box2(MergeBranch _owner )
{
_this = _owner;
- this.el = new Gtk.VBox( true, 0 );
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
// my vars (dec)
// set gobject values
- var child_0 = new Xcls_Table3( _this );
+ var child_0 = new Xcls_table( _this );
child_0.ref();
this.el.pack_start ( child_0.el , false,false,0 );
+ var child_1 = new Xcls_scrolled_window( _this );
+ child_1.ref();
+ this.el.add ( child_1.el );
+ var child_2 = new Xcls_spinner( _this );
+ child_2.ref();
+ this.el.add ( child_2.el );
}
// user defined functions
}
- public class Xcls_Table3 : Object
+ public class Xcls_table : Object
{
public Gtk.Table el;
private MergeBranch _this;
// my vars (def)
// ctor
- public Xcls_Table3(MergeBranch _owner )
+ public Xcls_table(MergeBranch _owner )
{
_this = _owner;
+ _this.table = this;
this.el = new Gtk.Table( 2, 2, false );
// my vars (dec)
// set gobject values
this.el.margin = 2;
this.el.column_spacing = 2;
+ this.el.vexpand = false;
var child_0 = new Xcls_Label4( _this );
child_0.ref();
this.el.attach_defaults ( child_0.el , 0,1,0,1 );
this.el = new Gtk.ComboBox();
// my vars (dec)
- this.loading = false;
+ this.loading = true;
// set gobject values
var child_0 = new Xcls_dbcellrenderer( _this );
if (this.loading) {
return;
}
-
+ _this.view.loadTicket(this.selectedTicketId());
_this.name.updateText();
//_this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
}
+ public class Xcls_scrolled_window : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private MergeBranch _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_scrolled_window(MergeBranch _owner )
+ {
+ _this = _owner;
+ _this.scrolled_window = this;
+ this.el = new Gtk.ScrolledWindow( null, null );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.height_request = 500;
+ this.el.vexpand = true;
+ var child_0 = new Xcls_view( _this );
+ child_0.ref();
+ this.el.add ( child_0.el );
+
+ // init method
+
+ {
+ this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+ }
+ }
+
+ // user defined functions
+ }
+ public class Xcls_view : Object
+ {
+ public WebKit.WebView el;
+ private MergeBranch _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_view(MergeBranch _owner )
+ {
+ _this = _owner;
+ _this.view = this;
+ this.el = new WebKit.WebView();
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ public void loadTicket (string tid) {
+ int h,w;
+ _this.el.get_size(out w, out h);
+
+ if (tid == "") {
+ _this.scrolled_window.el.hide();
+ _this.el.resize(w, 150);
+ } else {
+ _this.scrolled_window.el.show();
+ _this.el.resize(w, 800);
+ }
+
+ var rs = RooTicket.singleton();
+ var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
+ var hd = uri.get_http_headers();
+ var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
+ hd.append("Authorization", "Basic %s".printf(authCode));
+
+ this.el.load_request(uri);
+ }
+ }
+
+
+ public class Xcls_spinner : Object
+ {
+ public Gtk.Spinner el;
+ private MergeBranch _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_spinner(MergeBranch _owner )
+ {
+ _this = _owner;
+ _this.spinner = this;
+ this.el = new Gtk.Spinner();
+
+ // my vars (dec)
- public class Xcls_Button14 : Object
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_Button17 : Object
{
public Gtk.Button el;
private MergeBranch _this;
// my vars (def)
// ctor
- public Xcls_Button14(MergeBranch _owner )
+ public Xcls_Button17(MergeBranch _owner )
{
_this = _owner;
this.el = new Gtk.Button();
// user defined functions
}
- public class Xcls_Button15 : Object
+ public class Xcls_Button18 : Object
{
public Gtk.Button el;
private MergeBranch _this;
// my vars (def)
// ctor
- public Xcls_Button15(MergeBranch _owner )
+ public Xcls_Button18(MergeBranch _owner )
{
_this = _owner;
this.el = new Gtk.Button();
// set gobject values
this.el.label = "Do Merge";
+
+ // init method
+
+ {
+ this.el.get_style_context().add_class("suggested-action");
+ }
}
// user defined functions
"title" : "Create a working branch ",
"xtype" : "Dialog",
"# GitRepo? repo" : "null",
- "| void show" : "( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = \"\" ) \n{\n // this.el.set_gravity(Gdk.Gravity.NORTH);\n if (this.running) { // should not happen!!\n \tGLib.error(\"new branch show called, when already being displayed?\");\n\t}\n\tthis.queue = queue;\n\t\n\tthis.running = true;\n\tGitMonitor.gitmonitor.stop();\n\t\n this.repo = repo;\n \n \n \n\tthis.el.move((Gdk.Screen.width() / 2)- 250 ,0);\n\tthis.el.set_default_size( 500,200); // not sure why it grows..\n GLib.debug(\"Loading tickets\"); \n \n\n this.el.show_all();\n this.el.set_keep_above(true);\n \n \n var curproj = RooTicket.singleton().getProjectByRepo(this.repo);\n _this.prmodel.loadProjects(curproj == null ? \"\" : curproj.id);\n \n \t_this.dbmodel.loadTickets(curproj == null ? \"\": curproj.id, tid);\n \tthis.el.run();\n\n}",
- "default_height" : 200,
+ "| void show" : "( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = \"\" ) \n{\n // this.el.set_gravity(Gdk.Gravity.NORTH);\n if (this.running) { // should not happen!!\n \tGLib.error(\"new branch show called, when already being displayed?\");\n\t}\n\tthis.queue = queue;\n\t\n\tthis.running = true;\n\tGitMonitor.gitmonitor.stop();\n\t\n this.repo = repo;\n \n \n \n\tthis.el.move((Gdk.Screen.width() / 2)- 250 ,0);\n\tthis.el.set_default_size( 500,200); // not sure why it grows..\n GLib.debug(\"Loading tickets\"); \n \n\n this.el.show_all();\n this.el.set_keep_above(true);\n \n \n var curproj = RooProject.getProjectByRepo(this.repo);\n _this.prmodel.loadProjects(curproj == null ? \"\" : curproj.id);\n \n \t_this.dbmodel.loadTickets(curproj == null ? \"\": curproj.id, tid);\n\n \tif (tid != \"\") {\n\t \tvar name = RooTicket.singleton().usernameLocal();\n \t\tvar ticket = RooTicket.singleton().getById(tid);\n\t\t_this.name.el.set_text(\"wip_%s_T%s_%s\".printf(name,ticket.id, ticket.summaryToBranchName()));\n\n\n\t}\n _this.view.loadTicket(tid);\n \tthis.el.run();\n\n}",
+ "default_height" : 500,
"$ xns" : "Gtk",
"# bool running" : false,
"# Gee.ArrayList<GitMonitorQueue> queue" : "null",
"bool modal" : true,
"items" : [
{
- "xtype" : "VBox",
+ "xtype" : "Box",
"$ pack" : "get_content_area().add",
"$ xns" : "Gtk",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
"items" : [
{
"bool homogeneous" : true,
"changed" : "() => {\n\tif (this.loading) {\n\t\treturn;\n\t}\n\tvar project_id = this.selectedProjectId();\n\t_this.dbmodel.loadTickets(project_id);\n\t\n\t\n\t/*if (this.loading) {\n\t\treturn;\n\t}\n\tvar ticket_id = this.selectedTicketId();\n\t\n\tvar name = RooTicket.singleton().usernameLocal();\n\t\n\tif (ticket_id == \"\" || ticket_id == null) {\n\t\n\t\tvar dt = new DateTime.now_local();\n\t\t_this.name.el.set_text(\"wip_%s_%s\".printf(name,dt.format(\"%Y_%b_%d\")));\n\t\treturn;\n\t}\n\t\n\t\n\tvar ticket = RooTicket.singleton().getById(ticket_id);\n \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\t*/\n}"
},
"* ctor" : "new Gtk.ComboBox.with_entry()",
- "| string selectedProjectId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.prmodel.el.get_value (iter, 0, out val1);\n \n\n\treturn (string) val1;\n\t\n\t\n\t\n\t\n}\n",
"id" : "projectsel",
+ "| string selectedProjectId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.prmodel.el.get_value (iter, 0, out val1);\n \n\n\treturn (string) val1;\n\t\n\t\n\t\n\t\n}\n",
"* init" : "this.el.set_entry_text_column(1);",
"* pack" : "attach_defaults,0,1,1,2",
"xtype" : "ComboBox",
"items" : [
{
"id" : "prcellrenderer",
- "* pack" : "pack_start,true",
"xtype" : "CellRendererText",
+ "* pack" : "pack_start,true",
"$ xns" : "Gtk"
},
{
- "| void loadProjects" : " (string id) {\n\n var rt = RooTicket.singleton();\n rt.loadProjects();\n \n _this.projectsel.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 project --\");\n if (id == \"\") {\n\t _this.projectsel.el.set_active_iter(iter);\n }\n var projects = rt.projects;\n foreach(var project in projects) {\n \n el.append(out iter);\n \n el.set_value(iter, 0, project.id);\n el.set_value(iter, 1, project.name );\n if (id == project.id) {\n\t \t _this.projectsel.el.set_active_iter(iter);\n\t } \n \n }\n \n _this.projectsel.loading = false;\n //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); \n \n}\n",
+ "| void loadProjects" : " (string id) {\n\n\n \n _this.projectsel.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 project --\");\n if (id == \"\") {\n\t _this.projectsel.el.set_active_iter(iter);\n }\n \n foreach(var project in RooProject.projects()) {\n \n el.append(out iter);\n \n el.set_value(iter, 0, project.id);\n el.set_value(iter, 1, project.name );\n if (id == project.id) {\n\t \t _this.projectsel.el.set_active_iter(iter);\n\t } \n \n }\n \n _this.projectsel.loading = false;\n //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); \n \n}\n",
"id" : "prmodel",
"* pack" : "set_model",
"xtype" : "ListStore",
},
{
"listeners" : {
- "changed" : "() => {\n\tif (this.loading) {\n\t\treturn;\n\t}\n\tvar ticket_id = this.selectedTicketId();\n\t\n\tvar name = RooTicket.singleton().usernameLocal();\n\t\n\tif (ticket_id == \"\" || ticket_id == null) {\n\t\n\t\tvar dt = new DateTime.now_local();\n\t\t_this.name.el.set_text(\"wip_%s_%s\".printf(name,dt.format(\"%Y_%b_%d\")));\n\t\treturn;\n\t}\n\t\n\t\n\tvar ticket = RooTicket.singleton().getById(ticket_id);\n \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\tvar ticket_id = this.selectedTicketId();\n\t\n\tvar name = RooTicket.singleton().usernameLocal();\n\t\n\tif (ticket_id == \"\" || ticket_id == null) {\n\t\n\t\tvar dt = new DateTime.now_local();\n\t\t_this.name.el.set_text(\"wip_%s_%s\".printf(name,dt.format(\"%Y_%b_%d\")));\n\t\t_this.view.loadTicket(\"\");\t\t\n\t\treturn;\n\t}\n\t\n\t\n\tvar ticket = RooTicket.singleton().getById(ticket_id);\n \n\t_this.name.el.set_text(\"wip_%s_T%s_%s\".printf(name,ticket.id, ticket.summaryToBranchName()));\n\t_this.scrolled_window.el.show();\n\t \n\t_this.view.loadTicket(ticket.id);\n\t//GLib.debug (//\"Selection: %s, %s\\n\", (string) val1, (string) val2);\n}"
},
"* ctor" : "new Gtk.ComboBox.with_entry()",
"id" : "ticketsel",
"items" : [
{
"id" : "dbcellrenderer",
- "xtype" : "CellRendererText",
"* pack" : "pack_start,true",
+ "xtype" : "CellRendererText",
"$ xns" : "Gtk"
},
{
"id" : "dbmodel",
- "xtype" : "ListStore",
"* pack" : "set_model",
+ "xtype" : "ListStore",
"| void loadTickets" : "(string project_id , string tid = \"\") {\n\n\n \n // fixme .. get project id from selection..\n \n RooTicket.singleton().loadTickets(\n \t\t\tproject_id,\n \t\t\t_this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,\n \t\t\t _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE\n\t\t );\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\n \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 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 \n if (ticket.id == tid) {\n\t\t _this.ticketsel.el.set_active_iter(iter);\n }\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,
"clicked" : "() => {\n _this.el.response(-1);\n\tTicket.singleton().show(_this.repo);\n\n}"
},
"bool expand" : false,
- "* pack" : "attach_defaults,4,5,1,2",
"xtype" : "Button",
+ "* pack" : "attach_defaults,4,5,1,2",
"string label" : "New Ticket",
"$ xns" : "Gtk"
},
"toggled" : "() => {\n\tvar project_id = _this.projectsel.selectedProjectId();\n\t_this.dbmodel.loadTickets(project_id);\t\n}"
},
"id" : "btn_not_me",
- "* pack" : "add",
"string label" : "Show tickets not assigned to me",
+ "* pack" : "add",
"xtype" : "CheckButton",
"$ xns" : "Gtk"
},
"toggled" : "() => {\n \tvar project_id = _this.projectsel.selectedProjectId();\n\t_this.dbmodel.loadTickets(project_id);\t\n\t \n}"
},
"id" : "btn_closed",
- "string label" : "Show closed Tickets",
"xtype" : "CheckButton",
+ "string label" : "Show closed Tickets",
"* pack" : "add",
"$ xns" : "Gtk"
},
{
"listeners" : {
- "activate_link" : "(uri) => {\n\tif (uri == \"refresh\") {\n\t\tvar curproj = RooTicket.singleton().getProjectByRepo(_this.repo);\n\t\t _this.prmodel.loadProjects(curproj == null ? \"\": curproj.id);\n\n\t\t_this.dbmodel.loadTickets(curproj == null ? \"\": curproj.id);\t\t\n\t}\n\treturn true;\n}"
+ "activate_link" : "(uri) => {\n\tif (uri == \"refresh\") {\n\t\tRooProject.reload();\n\t\tvar curproj = RooProject.getProjectByRepo(_this.repo);\n\t\t _this.prmodel.loadProjects(curproj == null ? \"\": curproj.id);\n\n\t\t_this.dbmodel.loadTickets(curproj == null ? \"\": curproj.id);\t\t\n\t}\n\treturn true;\n}"
},
"bool use_markup" : true,
"Gtk.Align halign" : "Gtk.Align.END",
]
}
]
+ },
+ {
+ "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"
+ }
+ ]
}
]
}
public Xcls_name name;
public Xcls_btn_not_me btn_not_me;
public Xcls_btn_closed btn_closed;
+ public Xcls_scrolled_window scrolled_window;
+ public Xcls_view view;
// my vars (def)
public GitRepo? repo;
// set gobject values
this.el.title = "Create a working branch ";
- this.el.default_height = 200;
+ this.el.default_height = 500;
this.el.default_width = 500;
this.el.deletable = true;
this.el.modal = true;
- var child_0 = new Xcls_VBox2( _this );
+ var child_0 = new Xcls_Box2( _this );
child_0.ref();
this.el.get_content_area().add ( child_0.el );
this.el.set_keep_above(true);
- var curproj = RooTicket.singleton().getProjectByRepo(this.repo);
+ var curproj = RooProject.getProjectByRepo(this.repo);
_this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
_this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
+
+ if (tid != "") {
+ var name = RooTicket.singleton().usernameLocal();
+ var ticket = RooTicket.singleton().getById(tid);
+ _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
+
+
+ }
+ _this.view.loadTicket(tid);
this.el.run();
}
- public class Xcls_VBox2 : Object
+ public class Xcls_Box2 : Object
{
- public Gtk.VBox el;
+ public Gtk.Box el;
private NewBranch _this;
// my vars (def)
// ctor
- public Xcls_VBox2(NewBranch _owner )
+ public Xcls_Box2(NewBranch _owner )
{
_this = _owner;
- this.el = new Gtk.VBox( true, 0 );
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
// my vars (dec)
var child_0 = new Xcls_Table3( _this );
child_0.ref();
this.el.pack_start ( child_0.el , false,false,0 );
+ var child_1 = new Xcls_scrolled_window( _this );
+ child_1.ref();
+ this.el.add ( child_1.el );
}
// user defined functions
// user defined functions
public void loadProjects (string id) {
- var rt = RooTicket.singleton();
- rt.loadProjects();
+
_this.projectsel.loading = true;
if (id == "") {
_this.projectsel.el.set_active_iter(iter);
}
- var projects = rt.projects;
- foreach(var project in projects) {
+
+ foreach(var project in RooProject.projects()) {
el.append(out iter);
var dt = new DateTime.now_local();
_this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
+ _this.view.loadTicket("");
return;
}
var ticket = RooTicket.singleton().getById(ticket_id);
_this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
-
+ _this.scrolled_window.el.show();
+
+ _this.view.loadTicket(ticket.id);
//GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
});
}
//listeners
this.el.activate_link.connect( (uri) => {
if (uri == "refresh") {
- var curproj = RooTicket.singleton().getProjectByRepo(_this.repo);
+ RooProject.reload();
+ var curproj = RooProject.getProjectByRepo(_this.repo);
_this.prmodel.loadProjects(curproj == null ? "": curproj.id);
_this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
+ public class Xcls_scrolled_window : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private NewBranch _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_scrolled_window(NewBranch _owner )
+ {
+ _this = _owner;
+ _this.scrolled_window = this;
+ this.el = new Gtk.ScrolledWindow( null, null );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.height_request = 500;
+ this.el.vexpand = true;
+ var child_0 = new Xcls_view( _this );
+ child_0.ref();
+ this.el.add ( child_0.el );
+
+ // init method
+
+ {
+ this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+ }
+ }
+
+ // user defined functions
+ }
+ public class Xcls_view : Object
+ {
+ public WebKit.WebView el;
+ private NewBranch _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_view(NewBranch _owner )
+ {
+ _this = _owner;
+ _this.view = this;
+ this.el = new WebKit.WebView();
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ public void loadTicket (string tid) {
+ int h,w;
+ _this.el.get_size(out w, out h);
+
+ if (tid == "") {
+ _this.scrolled_window.el.hide();
+ _this.el.resize(w, 150);
+ } else {
+ _this.scrolled_window.el.show();
+ _this.el.resize(w, 800);
+ }
+
+ var rs = RooTicket.singleton();
+ var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
+ var hd = uri.get_http_headers();
+ var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
+ hd.append("Authorization", "Basic %s".printf(authCode));
+
+ this.el.load_request(uri);
+ }
+ }
+
+
}
"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, 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\tif (repo.activeTicket == null) {\n\t\t_this.btn_merge.el.set_sensitive(false);\n\t} else {\n\t\t_this.btn_merge.el.set_sensitive(true);\n\t}\n\t_this.btn_create.el.set_sensitive(repo.is_master_branch());\n\t\n\t_this.btn_stash.el.set_sensitive(repo.has_local_changes);\n\t_this.btn_commit.el.set_sensitive(repo.has_local_changes);\n\t_this.btn_reset.el.set_sensitive(repo.has_local_changes);\n\t_this.btn_pull.el.set_sensitive(repo.ahead_or_behind == \"B\");\t\n\t\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",
"xtype" : "Popover",
"Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
"$ xns" : "Gtk",
"$ homogeneous" : false,
"items" : [
{
- "* pack" : "pack_start,true,true,0",
+ "* pack" : "pack_start,false,false,0",
+ "xtype" : "Box",
+ "gboolean expand" : false,
+ "$ xns" : "Gtk",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "$ homogeneous" : true,
+ "gboolean vexpand" : false,
+ "items" : [
+ {
+ "Gtk.ToolbarStyle toolbar_style" : "Gtk.ToolbarStyle.BOTH_HORIZ",
+ "xtype" : "Toolbar",
+ "* pack" : "add",
+ "$ xns" : "Gtk",
+ "items" : [
+ {
+ "listeners" : {
+ "clicked" : "() => {\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 \n}"
+ },
+ "label" : "Stash Changes",
+ "* ctor" : "new Gtk.ToolButton(new Gtk.Image.from_icon_name (\"gtk-undo\", Gtk.IconSize.SMALL_TOOLBAR), null);",
+ "id" : "btn_stash",
+ "xtype" : "ToolButton",
+ "* pack" : "add",
+ "$ xns" : "Gtk",
+ "bool is_important" : true
+ },
+ {
+ "listeners" : {
+ "clicked" : "() => {\n _this.el.hide();\n GitMonitor.gitmonitor.stop();\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\n Clones.singleton().reposStore.load();\n GitMonitor.gitmonitor.start();\n \n}"
+ },
+ "label" : "Commit Changes",
+ "* ctor" : "new Gtk.ToolButton(new Gtk.Image.from_icon_name (\"gtk-save\", Gtk.IconSize.SMALL_TOOLBAR), null);",
+ "id" : "btn_commit",
+ "* pack" : "add",
+ "xtype" : "ToolButton",
+ "$ xns" : "Gtk",
+ "bool is_important" : true
+ },
+ {
+ "listeners" : {
+ "clicked" : "() => {\n \n \n GitMonitor.gitmonitor.stop();\n _this.repo.git({ \"reset\" , \"--hard\" });\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 \n}"
+ },
+ "label" : "Reset / clear changes",
+ "* ctor" : "new Gtk.ToolButton(new Gtk.Image.from_icon_name (\"gtk-revert-to-saved\", Gtk.IconSize.SMALL_TOOLBAR), null);",
+ "id" : "btn_reset",
+ "* pack" : "add",
+ "xtype" : "ToolButton",
+ "$ xns" : "Gtk",
+ "bool is_important" : true
+ },
+ {
+ "listeners" : {
+ "clicked" : "() => {\n \n \n GitMonitor.gitmonitor.stop();\n _this.repo.git({ \"pull\" , \"--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 \n}"
+ },
+ "label" : "Pull updates",
+ "* ctor" : "new Gtk.ToolButton(new Gtk.Image.from_icon_name (\"gtk-goto-bottom\", Gtk.IconSize.SMALL_TOOLBAR), null);",
+ "id" : "btn_pull",
+ "xtype" : "ToolButton",
+ "* pack" : "add",
+ "$ xns" : "Gtk",
+ "bool is_important" : true
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "* pack" : "add",
"xtype" : "Notebook",
"$ xns" : "Gtk",
+ "bool vexpand" : true,
"items" : [
{
"id" : "label_status",
"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",
- "xtype" : "Button",
- "* pack" : "add",
- "$ 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",
- "xtype" : "Button",
- "* pack" : "add",
- "$ xns" : "Gtk"
- },
- {
- "listeners" : {
- "button_press_event" : "() => {\n var oldq = new Gee.ArrayList<GitMonitorQueue>(); \n\n\tClones.singleton().el.response(-1);\n\tNewBranch.singleton().show(_this.repo, oldq);\n\n return false;\n}"
- },
- "label" : "Create Branch",
- "* pack" : "add",
- "xtype" : "Button",
- "$ xns" : "Gtk"
- },
- {
- "listeners" : {
- "button_press_event" : "() => {\n _this.el.hide();\n return false;\n}"
- },
- "label" : "Ignore for now",
+ "Gtk.ToolbarStyle toolbar_style" : "Gtk.ToolbarStyle.BOTH_HORIZ",
"* pack" : "add",
- "xtype" : "Button",
- "$ xns" : "Gtk"
+ "xtype" : "Toolbar",
+ "$ xns" : "Gtk",
+ "items" : [
+ {
+ "listeners" : {
+ "clicked" : "() => {\n var oldq = new Gee.ArrayList<GitMonitorQueue>(); \n\n\tClones.singleton().el.response(-1);\n\tNewBranch.singleton().show(_this.repo, oldq);\n\n \n}"
+ },
+ "label" : "Create Branch / Start ticket",
+ "* ctor" : "new Gtk.ToolButton(new Gtk.Image.from_icon_name (\"gtk-add\", Gtk.IconSize.SMALL_TOOLBAR), null);",
+ "id" : "btn_create",
+ "xtype" : "ToolButton",
+ "* pack" : "add",
+ "$ xns" : "Gtk",
+ "bool is_important" : true
+ },
+ {
+ "listeners" : {
+ "clicked" : "() => {\n\n _this.el.hide();\n Clones.singleton().el.response(-1);\n if (_this.repo.activeTicket != null) {\n\t MergeBranch.singleton().show(_this.repo.activeTicket, null); \n }\n \n}"
+ },
+ "label" : "Merge branch / Complete ticket",
+ "* ctor" : "new Gtk.ToolButton(new Gtk.Image.from_icon_name (\"gtk-goto-top\", Gtk.IconSize.SMALL_TOOLBAR), null);",
+ "id" : "btn_merge",
+ "xtype" : "ToolButton",
+ "* pack" : "add",
+ "$ xns" : "Gtk",
+ "bool is_important" : true
+ },
+ {
+ "listeners" : {
+ "clicked" : "() => {\n \n\n\n Clones.singleton().el.response(-1);\n \n _this.el.hide();\n Ticket.singleton().show( _this.repo);\n \n}"
+ },
+ "label" : "Create Ticket",
+ "* ctor" : "new Gtk.ToolButton(new Gtk.Image.from_icon_name (\"gtk-new\", Gtk.IconSize.SMALL_TOOLBAR), null);",
+ "* pack" : "add",
+ "xtype" : "ToolButton",
+ "$ xns" : "Gtk",
+ "bool is_important" : true
+ }
+ ]
}
]
}
}
return _RepoStatusPopover;
}
+ public Xcls_btn_stash btn_stash;
+ public Xcls_btn_commit btn_commit;
+ public Xcls_btn_reset btn_reset;
+ public Xcls_btn_pull btn_pull;
public Xcls_label_status label_status;
public Xcls_label_diff label_diff;
public Xcls_status_view status_view;
public Xcls_diff_view diff_view;
+ public Xcls_btn_create btn_create;
+ public Xcls_btn_merge btn_merge;
// my vars (def)
public GitRepo repo;
//this.el.set_position(Gtk.PositionType.RIGHT);
+ if (repo.activeTicket == null) {
+ _this.btn_merge.el.set_sensitive(false);
+ } else {
+ _this.btn_merge.el.set_sensitive(true);
+ }
+ _this.btn_create.el.set_sensitive(repo.is_master_branch());
+
+ _this.btn_stash.el.set_sensitive(repo.has_local_changes);
+ _this.btn_commit.el.set_sensitive(repo.has_local_changes);
+ _this.btn_reset.el.set_sensitive(repo.has_local_changes);
+ _this.btn_pull.el.set_sensitive(repo.ahead_or_behind == "B");
+
// window + header?
GLib.debug("SHOWALL - POPIP\n");
this.el.show_all();
// set gobject values
this.el.homogeneous = false;
this.el.border_width = 5;
- var child_0 = new Xcls_Notebook3( _this );
+ var child_0 = new Xcls_Box3( _this );
child_0.ref();
- this.el.pack_start ( child_0.el , true,true,0 );
- var child_1 = new Xcls_Box12( _this );
+ this.el.pack_start ( child_0.el , false,false,0 );
+ var child_1 = new Xcls_Notebook9( _this );
child_1.ref();
- this.el.pack_end ( child_1.el , false,false,0 );
+ this.el.add ( child_1.el );
+ var child_2 = new Xcls_Box18( _this );
+ child_2.ref();
+ this.el.pack_end ( child_2.el , false,false,0 );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Box3 : Object
+ {
+ public Gtk.Box el;
+ private RepoStatusPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box3(RepoStatusPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.homogeneous = true;
+ this.el.expand = false;
+ this.el.vexpand = false;
+ var child_0 = new Xcls_Toolbar4( _this );
+ child_0.ref();
+ this.el.add ( child_0.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Toolbar4 : Object
+ {
+ public Gtk.Toolbar el;
+ private RepoStatusPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Toolbar4(RepoStatusPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Toolbar();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.toolbar_style = Gtk.ToolbarStyle.BOTH_HORIZ;
+ var child_0 = new Xcls_btn_stash( _this );
+ child_0.ref();
+ this.el.add ( child_0.el );
+ var child_1 = new Xcls_btn_commit( _this );
+ child_1.ref();
+ this.el.add ( child_1.el );
+ var child_2 = new Xcls_btn_reset( _this );
+ child_2.ref();
+ this.el.add ( child_2.el );
+ var child_3 = new Xcls_btn_pull( _this );
+ child_3.ref();
+ this.el.add ( child_3.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_btn_stash : Object
+ {
+ public Gtk.ToolButton el;
+ private RepoStatusPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_btn_stash(RepoStatusPopover _owner )
+ {
+ _this = _owner;
+ _this.btn_stash = this;
+ this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-undo", Gtk.IconSize.SMALL_TOOLBAR), null);;
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.label = "Stash Changes";
+ this.el.is_important = true;
+
+ //listeners
+ this.el.clicked.connect( () => {
+
+
+ GitMonitor.gitmonitor.stop();
+ _this.repo.git({ "stash" , "--all" });
+ _this.repo.loadStatus();
+ GitMonitor.gitmonitor.start();
+ _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
+ _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
+ Clones.singleton().reposStore.load();
+
+ _this.el.hide();
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_btn_commit : Object
+ {
+ public Gtk.ToolButton el;
+ private RepoStatusPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_btn_commit(RepoStatusPopover _owner )
+ {
+ _this = _owner;
+ _this.btn_commit = this;
+ this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-save", Gtk.IconSize.SMALL_TOOLBAR), null);;
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.label = "Commit Changes";
+ this.el.is_important = true;
+
+ //listeners
+ this.el.clicked.connect( () => {
+ _this.el.hide();
+ GitMonitor.gitmonitor.stop();
+ _this.repo.git({ "commit" , "-a" ,"-m", "Uncommited changes synced" });
+ _this.repo.push();
+ _this.repo.loadStatus();
+
+ _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
+ _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
+
+
+ Clones.singleton().reposStore.load();
+ GitMonitor.gitmonitor.start();
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_btn_reset : Object
+ {
+ public Gtk.ToolButton el;
+ private RepoStatusPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_btn_reset(RepoStatusPopover _owner )
+ {
+ _this = _owner;
+ _this.btn_reset = this;
+ this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-revert-to-saved", Gtk.IconSize.SMALL_TOOLBAR), null);;
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.label = "Reset / clear changes";
+ this.el.is_important = true;
+
+ //listeners
+ this.el.clicked.connect( () => {
+
+
+ GitMonitor.gitmonitor.stop();
+ _this.repo.git({ "reset" , "--hard" });
+ _this.repo.loadStatus();
+ GitMonitor.gitmonitor.start();
+ _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
+ _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
+ Clones.singleton().reposStore.load();
+
+ _this.el.hide();
+
+ });
}
// user defined functions
}
- public class Xcls_Notebook3 : Object
+
+ public class Xcls_btn_pull : Object
+ {
+ public Gtk.ToolButton el;
+ private RepoStatusPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_btn_pull(RepoStatusPopover _owner )
+ {
+ _this = _owner;
+ _this.btn_pull = this;
+ this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-goto-bottom", Gtk.IconSize.SMALL_TOOLBAR), null);;
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.label = "Pull updates";
+ this.el.is_important = true;
+
+ //listeners
+ this.el.clicked.connect( () => {
+
+
+ GitMonitor.gitmonitor.stop();
+ _this.repo.git({ "pull" , "--all" });
+ _this.repo.loadStatus();
+ GitMonitor.gitmonitor.start();
+ _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
+ _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
+ Clones.singleton().reposStore.load();
+
+ _this.el.hide();
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+
+ public class Xcls_Notebook9 : Object
{
public Gtk.Notebook el;
private RepoStatusPopover _this;
// my vars (def)
// ctor
- public Xcls_Notebook3(RepoStatusPopover _owner )
+ public Xcls_Notebook9(RepoStatusPopover _owner )
{
_this = _owner;
this.el = new Gtk.Notebook();
// my vars (dec)
// set gobject values
+ this.el.vexpand = true;
var child_0 = new Xcls_label_status( _this );
child_0.ref();
var child_1 = new Xcls_label_diff( _this );
child_1.ref();
- var child_2 = new Xcls_Box6( _this );
+ var child_2 = new Xcls_Box12( _this );
child_2.ref();
this.el.append_page ( child_2.el , _this.label_status.el );
- var child_3 = new Xcls_Box9( _this );
+ var child_3 = new Xcls_Box15( _this );
child_3.ref();
this.el.append_page ( child_3.el , _this.label_diff.el );
}
// user defined functions
}
- public class Xcls_Box6 : Object
+ public class Xcls_Box12 : Object
{
public Gtk.Box el;
private RepoStatusPopover _this;
// my vars (def)
// ctor
- public Xcls_Box6(RepoStatusPopover _owner )
+ public Xcls_Box12(RepoStatusPopover _owner )
{
_this = _owner;
this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
// set gobject values
this.el.homogeneous = false;
- var child_0 = new Xcls_ScrolledWindow7( _this );
+ var child_0 = new Xcls_ScrolledWindow13( _this );
child_0.ref();
this.el.pack_start ( child_0.el , true,true,0 );
}
// user defined functions
}
- public class Xcls_ScrolledWindow7 : Object
+ public class Xcls_ScrolledWindow13 : Object
{
public Gtk.ScrolledWindow el;
private RepoStatusPopover _this;
// my vars (def)
// ctor
- public Xcls_ScrolledWindow7(RepoStatusPopover _owner )
+ public Xcls_ScrolledWindow13(RepoStatusPopover _owner )
{
_this = _owner;
this.el = new Gtk.ScrolledWindow( null, null );
- public class Xcls_Box9 : Object
+ public class Xcls_Box15 : Object
{
public Gtk.Box el;
private RepoStatusPopover _this;
// my vars (def)
// ctor
- public Xcls_Box9(RepoStatusPopover _owner )
+ public Xcls_Box15(RepoStatusPopover _owner )
{
_this = _owner;
this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
// set gobject values
this.el.homogeneous = false;
- var child_0 = new Xcls_ScrolledWindow10( _this );
+ var child_0 = new Xcls_ScrolledWindow16( _this );
child_0.ref();
this.el.pack_start ( child_0.el , true,true,0 );
}
// user defined functions
}
- public class Xcls_ScrolledWindow10 : Object
+ public class Xcls_ScrolledWindow16 : Object
{
public Gtk.ScrolledWindow el;
private RepoStatusPopover _this;
// my vars (def)
// ctor
- public Xcls_ScrolledWindow10(RepoStatusPopover _owner )
+ public Xcls_ScrolledWindow16(RepoStatusPopover _owner )
{
_this = _owner;
this.el = new Gtk.ScrolledWindow( null, null );
- public class Xcls_Box12 : Object
+ public class Xcls_Box18 : Object
{
public Gtk.Box el;
private RepoStatusPopover _this;
// my vars (def)
// ctor
- public Xcls_Box12(RepoStatusPopover _owner )
+ public Xcls_Box18(RepoStatusPopover _owner )
{
_this = _owner;
this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
this.el.homogeneous = true;
this.el.expand = false;
this.el.vexpand = false;
- var child_0 = new Xcls_Button13( _this );
+ var child_0 = new Xcls_Toolbar19( _this );
child_0.ref();
this.el.add ( child_0.el );
- var child_1 = new Xcls_Button14( _this );
- child_1.ref();
- this.el.add ( child_1.el );
- var child_2 = new Xcls_Button15( _this );
- child_2.ref();
- this.el.add ( child_2.el );
- var child_3 = new Xcls_Button16( _this );
- child_3.ref();
- this.el.add ( child_3.el );
}
// user defined functions
}
- public class Xcls_Button13 : Object
+ public class Xcls_Toolbar19 : Object
{
- public Gtk.Button el;
+ public Gtk.Toolbar el;
private RepoStatusPopover _this;
// my vars (def)
// ctor
- public Xcls_Button13(RepoStatusPopover _owner )
+ public Xcls_Toolbar19(RepoStatusPopover _owner )
{
_this = _owner;
- this.el = new Gtk.Button();
+ this.el = new Gtk.Toolbar();
// my vars (dec)
// set gobject values
- this.el.label = "Stash Changes";
-
- //listeners
- this.el.button_press_event.connect( () => {
-
-
- GitMonitor.gitmonitor.stop();
- _this.repo.git({ "stash" , "--all" });
- _this.repo.loadStatus();
- GitMonitor.gitmonitor.start();
- _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
- _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
- Clones.singleton().reposStore.load();
-
- _this.el.hide();
- return false;
- });
+ this.el.toolbar_style = Gtk.ToolbarStyle.BOTH_HORIZ;
+ var child_0 = new Xcls_btn_create( _this );
+ child_0.ref();
+ this.el.add ( child_0.el );
+ var child_1 = new Xcls_btn_merge( _this );
+ child_1.ref();
+ this.el.add ( child_1.el );
+ var child_2 = new Xcls_ToolButton22( _this );
+ child_2.ref();
+ this.el.add ( child_2.el );
}
// user defined functions
}
-
- public class Xcls_Button14 : Object
+ public class Xcls_btn_create : Object
{
- public Gtk.Button el;
+ public Gtk.ToolButton el;
private RepoStatusPopover _this;
// my vars (def)
// ctor
- public Xcls_Button14(RepoStatusPopover _owner )
+ public Xcls_btn_create(RepoStatusPopover _owner )
{
_this = _owner;
- this.el = new Gtk.Button();
+ _this.btn_create = this;
+ this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-add", Gtk.IconSize.SMALL_TOOLBAR), null);;
// my vars (dec)
// set gobject values
- this.el.label = "Commit Changes";
+ this.el.label = "Create Branch / Start ticket";
+ this.el.is_important = true;
//listeners
- this.el.button_press_event.connect( () => {
- _this.repo.git({ "commit" , "-a" ,"-m", "Uncommited changes synced" });
- _this.repo.push();
- _this.repo.loadStatus();
-
- _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
- _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
+ this.el.clicked.connect( () => {
+ var oldq = new Gee.ArrayList<GitMonitorQueue>();
+
+ Clones.singleton().el.response(-1);
+ NewBranch.singleton().show(_this.repo, oldq);
+
- _this.el.hide();
- Clones.singleton().reposStore.load();
-
- return false;
});
}
// user defined functions
}
- public class Xcls_Button15 : Object
+ public class Xcls_btn_merge : Object
{
- public Gtk.Button el;
+ public Gtk.ToolButton el;
private RepoStatusPopover _this;
// my vars (def)
// ctor
- public Xcls_Button15(RepoStatusPopover _owner )
+ public Xcls_btn_merge(RepoStatusPopover _owner )
{
_this = _owner;
- this.el = new Gtk.Button();
+ _this.btn_merge = this;
+ this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-goto-top", Gtk.IconSize.SMALL_TOOLBAR), null);;
// my vars (dec)
// set gobject values
- this.el.label = "Create Branch";
+ this.el.label = "Merge branch / Complete ticket";
+ this.el.is_important = true;
//listeners
- this.el.button_press_event.connect( () => {
- var oldq = new Gee.ArrayList<GitMonitorQueue>();
+ this.el.clicked.connect( () => {
- Clones.singleton().el.response(-1);
- NewBranch.singleton().show(_this.repo, oldq);
-
- return false;
+ _this.el.hide();
+ Clones.singleton().el.response(-1);
+ if (_this.repo.activeTicket != null) {
+ MergeBranch.singleton().show(_this.repo.activeTicket, null);
+ }
+
});
}
// user defined functions
}
- public class Xcls_Button16 : Object
+ public class Xcls_ToolButton22 : Object
{
- public Gtk.Button el;
+ public Gtk.ToolButton el;
private RepoStatusPopover _this;
// my vars (def)
// ctor
- public Xcls_Button16(RepoStatusPopover _owner )
+ public Xcls_ToolButton22(RepoStatusPopover _owner )
{
_this = _owner;
- this.el = new Gtk.Button();
+ this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-new", Gtk.IconSize.SMALL_TOOLBAR), null);;
// my vars (dec)
// set gobject values
- this.el.label = "Ignore for now";
+ this.el.label = "Create Ticket";
+ this.el.is_important = true;
//listeners
- this.el.button_press_event.connect( () => {
- _this.el.hide();
- return false;
+ this.el.clicked.connect( () => {
+
+
+
+ Clones.singleton().el.response(-1);
+
+ _this.el.hide();
+ Ticket.singleton().show( _this.repo);
+
});
}
+
}
--- /dev/null
+/**
+This a mostly a static class that manages an array of it'self...
+
+*/
+
+static RooProject _RooProject;
+public class RooProject : Object
+{
+
+ public string id; // not really important that they are numbers..
+ public string code;
+ public string name;
+ public string type;
+
+
+ // --- static from here on....
+
+
+
+ static Gee.ArrayList<RooProject> _projects;
+ static int loadcount = 0;
+ const string roourl = "https://roojs.com/admin.php/Roo";
+
+
+ static RooProject singleton()
+ {
+ if (_RooProject == null) {
+ _RooProject = new RooProject();
+ RooProject.loadcount = 0;
+ RooProject.loadProjects();
+
+ }
+ return _RooProject;
+ }
+
+
+ public static Gee.ArrayList<RooProject> projects()
+ {
+ RooProject.singleton();
+
+ return RooProject._projects;
+ }
+
+
+ public static RooProject? getProjectByRepo(GitRepo repo)
+ {
+ RooProject.singleton(); // init...
+
+ // fixme -- needs to get from rep list..
+
+ var pid = "";
+ foreach(var roo_repo in RooRepo.repos()) {
+ if (roo_repo.shortname == repo.name) {
+ pid = roo_repo.project_id;
+ break;
+ }
+ }
+ if (pid == "") {
+ GLib.debug("getProjectByRepo: repo has no project");
+ return null;
+ }
+ // get project by id...
+ foreach(var roo_project in RooProject.projects()) {
+ if (roo_project.id == pid) {
+ GLib.debug("getProjectByRepo: project_id = %s", pid);
+ return roo_project;
+ }
+ }
+ GLib.debug("getProjectByRepo: can not find project");
+ return null;
+
+ }
+
+
+ public static RooProject addProject(Json.Object t)
+ {
+ RooProject.singleton(); // init...
+
+ var add = new RooProject();
+ add.id = t.get_string_member("id");
+ add.name = t.get_string_member("name");
+ add.type = t.get_string_member("type");
+ add.code = t.get_string_member("code");
+ RooProject._projects.add(add);
+ GLib.debug("ADD project %s : %s : %s", add.id, add.code, add.name);
+ return add;
+ }
+
+ public static void reload() /// has to be called on singleton..
+ {
+ RooProject.loadcount = 0;
+ RooProject.singleton();
+ if (RooProject.loadcount == 0 ) {
+ RooProject.loadProjects();
+ }
+ }
+
+ static void loadProjects() // called from singleton...
+ {
+ RooProject._projects = new Gee.ArrayList<RooProject>();
+
+ RooProject.loadcount ++;
+ var table = new GLib.HashTable<string, string>(str_hash, str_equal);
+
+ table.insert("query[project_filter]","P,N,U");
+ table.insert("limit","200");
+ table.insert("sort","name");
+ table.insert("dir","ASC");
+
+ var params = Soup.Form.encode_hash(table);
+
+ var url = "%s/%s?%s" . printf(roourl, "core_project", params);
+
+ GLib.debug("request %s", url);
+
+ var session = new Soup.Session ();
+ session.timeout = 0;
+ var message = new Soup.Message ("GET", url);
+
+
+ RooTicket.setAuth(message);
+
+ session.send_message (message);
+
+ var data = (string) message.response_body.flatten().data;
+ //GLib.debug("got %s", data);
+ try {
+ var parser = new Json.Parser ();
+ parser.load_from_data (data, -1);
+
+ var response = parser.get_root().get_object();
+ var status = response.get_boolean_member("success");
+
+ if(!status){
+ GLib.error(response.get_string_member("errorMsg"));
+ return;
+ }
+ var rd = response.get_array_member ("data");
+
+ // got a valid result...
+
+ for(var i = 0; i < rd.get_length(); i++) {
+ RooProject.addProject(rd.get_object_element(i));
+ }
+
+
+ } catch (Error e) {
+ GLib.error(e.message);
+ return;
+ }
+
+ }
+
+
+
+
+
+}
+
--- /dev/null
+
+
+static RooRepo _RooRepo ;
+
+public class RooRepo : Object
+{
+
+
+ public string id; // not really important that they are numbers..
+ public string project_id;
+ public string description;
+ public string shortname;
+
+
+ // -- static below...
+ const string roourl = "https://roojs.com/admin.php/Roo";
+ static Gee.ArrayList<RooRepo> _repos; // only available for singletonn.
+ static int loadcount = 0;
+
+ static RooRepo init()
+ {
+ if (_RooRepo == null) {
+ _RooRepo = new RooRepo();
+ RooRepo.loadcount = 0;
+ RooRepo.load();
+ }
+ return _RooRepo;
+ }
+
+
+ public static Gee.ArrayList<RooRepo> repos() {
+ RooRepo.init();
+ return RooRepo._repos;
+ }
+
+ static RooRepo add(Json.Object t)
+ {
+ var add = new RooRepo();
+ add.id = t.get_string_member("id");
+ add.shortname = t.get_string_member("shortname");
+ add.description = t.get_string_member("description");
+ add.project_id = t.get_string_member("project_id");
+ RooRepo._repos.add(add);
+ GLib.debug("ADD project %s : %s : %s", add.id, add.shortname, add.project_id);
+ return add;
+ }
+
+ public static void reload() /// has to be called on singleton..
+ {
+ RooRepo.loadcount = 0;
+ RooRepo.init();
+ if (RooRepo.loadcount == 0 ) {
+ RooRepo.load();
+ }
+ }
+
+ static void load() // only called from above
+ {
+
+ RooRepo._repos = new Gee.ArrayList<RooRepo>();
+
+
+ var table = new GLib.HashTable<string, string>(str_hash, str_equal);
+
+
+ table.insert("limit","200");
+ table.insert("sort","shortname");
+ table.insert("dir","ASC");
+
+ var params = Soup.Form.encode_hash(table);
+
+ var url = "%s/%s?%s" . printf(roourl, "mtrack_repos", params);
+
+ GLib.debug("request %s", url);
+
+ var session = new Soup.Session ();
+ session.timeout = 0;
+ var message = new Soup.Message ("GET", url);
+
+
+ RooTicket.setAuth(message);
+
+ session.send_message (message);
+
+ var data = (string) message.response_body.flatten().data;
+ //GLib.debug("got %s", data);
+ try {
+ var parser = new Json.Parser ();
+ parser.load_from_data (data, -1);
+
+ var response = parser.get_root().get_object();
+ var status = response.get_boolean_member("success");
+
+ if(!status){
+ GLib.error(response.get_string_member("errorMsg"));
+ return;
+ }
+ var rd = response.get_array_member ("data");
+
+ // got a valid result...
+
+ for(var i = 0; i < rd.get_length(); i++) {
+ RooRepo.add(rd.get_object_element(i));
+ }
+
+
+ } catch (Error e) {
+ GLib.error(e.message);
+ return;
+ }
+
+ }
+
+
+
+}
*/
-public class RooRepo : Object
-{
-
-
-
- public string id; // not really important that they are numbers..
- public string project_id;
- public string description;
- public string shortname;
-
-
-}
public class RooOption : Object
{
}
-public class RooProject : Object
-{
- public string id; // not really important that they are numbers..
- public string code;
- public string name;
- public string type;
-
-}
-
-
static RooTicket _RooTicket;
if (_RooTicket == null) {
_RooTicket = new RooTicket();
_RooTicket.tickets = new Gee.ArrayList<RooTicket>();
- _RooTicket.projects = new Gee.ArrayList<RooProject>();
- _RooTicket.repos = new Gee.ArrayList<RooRepo>();
- _RooTicket.loadRepos(); // initalize it..
+
+
+
}
return _RooTicket;
}
public Gee.ArrayList<RooTicket> tickets; // only available for singletonn.
- public Gee.ArrayList<RooProject> projects; // only available for singletonn.
- public Gee.ArrayList<RooRepo> repos; // only available for singletonn.
+
+
public Gee.ArrayList<RooOption> milestones;
public Gee.ArrayList<RooOption> priorities;
GLib.debug("ADD ticket %s : %s : %s", add.id, add.summary, add.project_id_name);
return add;
}
- public RooProject addProject(Json.Object t)
- {
- var add = new RooProject();
- add.id = t.get_string_member("id");
- add.name = t.get_string_member("name");
- add.type = t.get_string_member("type");
- add.code = t.get_string_member("code");
- this.projects.add(add);
- GLib.debug("ADD project %s : %s : %s", add.id, add.code, add.name);
- return add;
- }
-
- public RooRepo addRepo(Json.Object t)
- {
- var add = new RooRepo();
- add.id = t.get_string_member("id");
- add.shortname = t.get_string_member("shortname");
- add.description = t.get_string_member("description");
- add.project_id = t.get_string_member("project_id");
- this.repos.add(add);
- GLib.debug("ADD project %s : %s : %s", add.id, add.shortname, add.project_id);
- return add;
- }
-
- public RooProject? getProjectByRepo(GitRepo repo)
- {
- var rt = RooTicket.singleton();
-
- if (rt.repos.size < 1) {
- rt.loadRepos();
- }
- if (rt.projects.size < 1) {
- rt.loadProjects();
- }
-
- var pid = "";
- foreach(var roo_repo in rt.repos) {
- if (roo_repo.shortname == repo.name) {
- pid = roo_repo.project_id;
- break;
- }
- }
- if (pid == "") {
- GLib.debug("getProjectByRepo: repo has no project");
- return null;
- }
- // get project by id...
- foreach(var roo_project in rt.projects) {
- if (roo_project.id == pid) {
- GLib.debug("getProjectByRepo: project_id = %s", pid);
- return roo_project;
- }
- }
- GLib.debug("getProjectByRepo: can not find project");
- return null;
-
- }
+
+
+
public static RooTicket fakeTicket()
}
-
- public void loadProjects()
- {
- RooTicket.singleton().projects = new Gee.ArrayList<RooProject>();
-
-
- var table = new GLib.HashTable<string, string>(str_hash, str_equal);
-
- table.insert("query[project_filter]","P,N,U");
- table.insert("limit","200");
- table.insert("sort","name");
- table.insert("dir","ASC");
-
- var params = Soup.Form.encode_hash(table);
-
- var url = "%s/%s?%s" . printf(roourl, "core_project", params);
-
- GLib.debug("request %s", url);
-
- var session = new Soup.Session ();
- session.timeout = 0;
- var message = new Soup.Message ("GET", url);
-
-
- RooTicket.setAuth(message);
-
- session.send_message (message);
-
- var data = (string) message.response_body.flatten().data;
- //GLib.debug("got %s", data);
- try {
- var parser = new Json.Parser ();
- parser.load_from_data (data, -1);
-
- var response = parser.get_root().get_object();
- var status = response.get_boolean_member("success");
-
- if(!status){
- GLib.error(response.get_string_member("errorMsg"));
- return;
- }
- var rd = response.get_array_member ("data");
-
- // got a valid result...
- var _this = RooTicket.singleton();
- for(var i = 0; i < rd.get_length(); i++) {
- _this.addProject(rd.get_object_element(i));
- }
-
-
- } catch (Error e) {
- GLib.error(e.message);
- return;
- }
-
- }
- public void loadRepos()
- {
- RooTicket.singleton().repos = new Gee.ArrayList<RooRepo>();
-
-
- var table = new GLib.HashTable<string, string>(str_hash, str_equal);
-
-
- table.insert("limit","200");
- table.insert("sort","shortname");
- table.insert("dir","ASC");
-
- var params = Soup.Form.encode_hash(table);
-
- var url = "%s/%s?%s" . printf(roourl, "mtrack_repos", params);
-
- GLib.debug("request %s", url);
-
- var session = new Soup.Session ();
- session.timeout = 0;
- var message = new Soup.Message ("GET", url);
-
-
- RooTicket.setAuth(message);
-
- session.send_message (message);
-
- var data = (string) message.response_body.flatten().data;
- //GLib.debug("got %s", data);
- try {
- var parser = new Json.Parser ();
- parser.load_from_data (data, -1);
-
- var response = parser.get_root().get_object();
- var status = response.get_boolean_member("success");
-
- if(!status){
- GLib.error(response.get_string_member("errorMsg"));
- return;
- }
- var rd = response.get_array_member ("data");
-
- // got a valid result...
- var _this = RooTicket.singleton();
- for(var i = 0; i < rd.get_length(); i++) {
- _this.addRepo(rd.get_object_element(i));
- }
-
-
- } catch (Error e) {
- GLib.error(e.message);
- return;
- }
-
- }
+
public void loadProjectOptions(string pid)
{
var rt = RooTicket.singleton();
string project_id,
string milestone_id,
string priority_id,
+ string severity_id,
string classification_id,
string developer_id,
string summary,
table.insert("project_id", project_id);
table.insert("milestone_id", milestone_id);
table.insert("priority_id", priority_id);
+ table.insert("severity_id", classification_id);
table.insert("classification_id", classification_id);
table.insert("developer_id", developer_id);
table.insert("summary", summary);
/**
* @property result {Number} execution result.
*/
- int result= 0;
+ public int result= 0;
/**
* @property pid {Number} pid of child process (of false if it's not running)
*/
}
foreach(var r in GitRepo.singleton().cache.values ) {
GLib.debug("checking %s for branch = %s", r.name, r.currentBranch.name);
- if (!r.is_wip_branch()) {
+ if (r.is_master_branch()) {
continue;
}
GLib.debug("checking for activeTicket");
{
var image = new Gtk.Image();
- image.set_from_stock(Gtk.Stock.FULLSCREEN,Gtk.IconSize.MENU );
+ image.set_from_stock(Gtk.Stock.GOTO_BOTTOM,Gtk.IconSize.MENU );
this.set_image (image);
this.label= "Pull (Refresh) All";
this.always_show_image = true;
GitMonitor.gitmonitor.pauseError(this.pull_all_error_message);
return;
}
-
+
statusicon.set_tooltip_text("Gitlive");
GitMonitor.gitmonitor.start();
{
var image = new Gtk.Image();
- image.set_from_stock(Gtk.Stock.FULLSCREEN,Gtk.IconSize.MENU );
+ image.set_from_stock(Gtk.Stock.JUSTIFY_FILL,Gtk.IconSize.MENU );
this.set_image (image);
this.label= "Manage Clones";
this.always_show_image = true;
this.accel_group = null;
this.activate.connect( () => {
- GitRepo.updateAll("show_clones");
+ //GitRepo.updateAll("show_clones");
+ Clones.singleton().loadAndShow();
// Clones.singleton().show();
});
{
var image = new Gtk.Image();
- image.set_from_stock(Gtk.Stock.FULLSCREEN,Gtk.IconSize.MENU );
+ image.set_from_stock(Gtk.Stock.NEW,Gtk.IconSize.MENU );
this.set_image (image);
this.label= "New Ticket";
this.always_show_image = true;
{
"listeners" : {
"delete_event" : "(self, event) => {\n this.el.hide();\n return true; \n //test \n}\n ",
- "response" : " (self, response_id) => { \n \n\tGLib.debug(\"got %d\", (int) response_id);\n\tif (response_id < 1) {\n\t _this.el.hide();\t\n\t this.running = false; \n\t \treturn;\n\t}\n\t \n\t \n\tvar tid = RooTicket.singleton().createTicket(\n\t\n\t\t_this.project_id.selectedProjectId(),\n\t\n\t\t_this.milestone_id.selectedMilestoneId(),\n\t\t_this.priority_id.selectedPriorityId() ,\n\t\t_this.classification_id.selectedClassificationId() ,\n\t\t_this.developer_id.selectedDeveloperId(),\n\t\t_this.summary.el.get_text() ,\n\t\t_this.description.el.buffer.text \n\t);\n\t\n\tif (this.repo != null) {\n\t \tNewBranch.singleton().show(this.repo, new Gee.ArrayList<GitMonitorQueue>(), tid);\n \t}\n\t \n\n\t \n}"
+ "response" : " (self, response_id) => { \n \n\tGLib.debug(\"got %d\", (int) response_id);\n\tif (response_id < 1) {\n\t _this.el.hide();\t\n\t this.running = false; \n\t \treturn;\n\t}\n\t \n\t \n\tvar tid = RooTicket.singleton().createTicket(\n\t\n\t\t_this.project_id.selectedProjectId(),\n\t\n\t\t_this.milestone_id.selectedMilestoneId(),\n\t\t_this.priority_id.selectedPriorityId() ,\n\t\t_this.severity_id.selectedSeverityId() ,\t\t\n\t\t_this.classification_id.selectedClassificationId() ,\n\t\t_this.developer_id.selectedDeveloperId(),\n\t\t_this.summary.el.get_text() ,\n\t\t_this.description.el.buffer.text \n\t);\n\tthis.el.hide();\n this.running = false; \n\tif (this.repo != null) {\n\t \tNewBranch.singleton().show(this.repo, new Gee.ArrayList<GitMonitorQueue>(), tid);\n \t}\n\n \n\t \n}"
},
"default_width" : 500,
"$ deletable" : true,
"title" : "Create a Ticket",
"xtype" : "Dialog",
"# GitRepo? repo" : "null",
- "| void show" : "( GitRepo? repo ) \n{\n // this.el.set_gravity(Gdk.Gravity.NORTH);\n if (this.running) { // should not happen!!\n \tGLib.error(\"new branch show called, when already being displayed?\");\n\t}\n \n\t\n\tthis.running = true;\n\t//GitMonitor.gitmonitor.stop();\n\t\n this.repo = repo;\n \n \n \n \n\tthis.el.move((Gdk.Screen.width() / 2)- 250 ,0);\n\tthis.el.set_default_size( 500,200); // not sure why it grows..\n GLib.debug(\"Loading tickets\"); \n \n\n this.el.show_all();\n this.el.set_keep_above(true);\n \n\n\tRooProject? curproj = null;\n if (this.repo != null) {\n\t curproj = RooTicket.singleton().getProjectByRepo(this.repo);\n }\n\t_this.prmodel.loadProjects(curproj == null ? \"\" : curproj.id);\n if (curproj != null) {\n \n\t\t\n\t\tvar rt = RooTicket.singleton();\n\t\trt.loadProjectOptions(curproj.id);\n\t\t\n\t\t_this.msmodel.loadMilestones();\n\t\t_this.primodel.loadPriorities();\n\t\t_this.sevmodel.loadSeverities();\n\t\t_this.clmodel.loadClassifications();\t\n\t\t_this.devmodel.loadDevelopers();\t\n\t\t\n }\n \n \tthis.el.run();\n\n}",
+ "| void show" : "( GitRepo? repo ) \n{\n // this.el.set_gravity(Gdk.Gravity.NORTH);\n if (this.running) { // should not happen!!\n \tGLib.error(\"new branch show called, when already being displayed?\");\n\t}\n \tthis.running = true;\n \n \t_this.el.show_all();\n\t\n\t_this.table.el.hide();\n\n\t_this.spinner.el.show();\n\t_this.spinner.el.start();\t\n\tthis.el.set_keep_above(true); \n\tthis.el.move((Gdk.Screen.width() / 2)- 250 ,0);\n\tthis.el.set_default_size( 500,200); // not sure why it grows..\n\t\n\tGLib.debug(\"Showing dialog?\"); \n Timeout.add_seconds(1, () => {\n\t\t\n\t\t\n\t\t\n\n\t\t//GitMonitor.gitmonitor.stop();\n\t\t\n\t\tthis.repo = repo;\n\t\t\n\t\t\n\t\t\n\t\t\n\t// GLib.debug(\"Loading tickets\"); \n\t\t \n\n\n\t\tRooProject? curproj = null;\n\t\tif (this.repo != null) {\n\t\t\tcurproj = RooProject.getProjectByRepo(this.repo);\n\t\t}\n\t\t_this.prmodel.loadProjects(curproj == null ? \"\" : curproj.id);\n\t\tif (curproj != null) {\n\t \n\t\t\t\n\t\t\tvar rt = RooTicket.singleton();\n\t\t\trt.loadProjectOptions(curproj.id);\n\t\t\t\n\t\t\t_this.msmodel.loadMilestones();\n\t\t\t_this.primodel.loadPriorities();\n\t\t\t_this.sevmodel.loadSeverities();\n\t\t\t_this.clmodel.loadClassifications();\t\n\t\t\t_this.devmodel.loadDevelopers();\t\n\t\t\t\n\t\t}\n\t\t_this.summary.el.set_text(\"\");\n\t\t_this.description.el.buffer.text = \"\"; \n\t\t_this.spinner.el.stop();\n\t\t_this.spinner.el.hide();\t\n\n\t\tthis.table.el.show();\n\t \n\n\t \n\n\t \n\t \t\n\t \treturn false;\n \t});\n \tthis.el.run();\n \t\n\n}",
"default_height" : 200,
"$ xns" : "Gtk",
"# bool running" : false,
"bool modal" : true,
"items" : [
{
- "xtype" : "VBox",
+ "xtype" : "Box",
"$ pack" : "get_content_area().add",
"$ xns" : "Gtk",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
"items" : [
{
+ "id" : "table",
"bool homogeneous" : true,
"bool expand" : false,
"xtype" : "Table",
"$ xns" : "Gtk"
},
{
- "| void loadProjects" : " (string id) {\n\n var rt = RooTicket.singleton();\n rt.loadProjects();\n \n _this.project_id.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 project --\");\n if (id == \"\") {\n\t _this.project_id.el.set_active_iter(iter);\n }\n var projects = rt.projects;\n foreach(var project in projects) {\n \n el.append(out iter);\n \n el.set_value(iter, 0, project.id);\n el.set_value(iter, 1, project.name );\n if (id == project.id) {\n\t \t _this.project_id.el.set_active_iter(iter);\n\t } \n \n }\n \n _this.project_id.loading = false;\n //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); \n \n}\n",
+ "| void loadProjects" : " (string id) {\n\n \n _this.project_id.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 project --\");\n if (id == \"\") {\n\t _this.project_id.el.set_active_iter(iter);\n }\n\n foreach(var project in RooProject.projects()) {\n \n el.append(out iter);\n \n el.set_value(iter, 0, project.id);\n el.set_value(iter, 1, project.name );\n if (id == project.id) {\n\t \t _this.project_id.el.set_active_iter(iter);\n\t } \n \n }\n \n _this.project_id.loading = false;\n //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); \n \n}\n",
"id" : "prmodel",
"* pack" : "set_model",
"xtype" : "ListStore",
"$ xns" : "Gtk"
}
]
+ },
+ {
+ "id" : "spinner",
+ "bool hexpand" : true,
+ "* pack" : "add",
+ "xtype" : "Spinner",
+ "$ xns" : "Gtk",
+ "bool vexpand" : true
}
]
}
}
return _Ticket;
}
+ public Xcls_table table;
public Xcls_project_id project_id;
public Xcls_prcellrenderer prcellrenderer;
public Xcls_prmodel prmodel;
public Xcls_clmodel clmodel;
public Xcls_developer_id developer_id;
public Xcls_devmodel devmodel;
+ public Xcls_spinner spinner;
// my vars (def)
public GitRepo? repo;
this.el.default_width = 500;
this.el.deletable = true;
this.el.modal = true;
- var child_0 = new Xcls_VBox2( _this );
+ var child_0 = new Xcls_Box2( _this );
child_0.ref();
this.el.get_content_area().add ( child_0.el );
_this.milestone_id.selectedMilestoneId(),
_this.priority_id.selectedPriorityId() ,
+ _this.severity_id.selectedSeverityId() ,
_this.classification_id.selectedClassificationId() ,
_this.developer_id.selectedDeveloperId(),
_this.summary.el.get_text() ,
_this.description.el.buffer.text
);
-
+ this.el.hide();
+ this.running = false;
if (this.repo != null) {
NewBranch.singleton().show(this.repo, new Gee.ArrayList<GitMonitorQueue>(), tid);
}
-
+
});
}
if (this.running) { // should not happen!!
GLib.error("new branch show called, when already being displayed?");
}
+ this.running = true;
+ _this.el.show_all();
- this.running = true;
- //GitMonitor.gitmonitor.stop();
-
- this.repo = repo;
-
-
-
-
+ _this.table.el.hide();
+
+ _this.spinner.el.show();
+ _this.spinner.el.start();
+ this.el.set_keep_above(true);
this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
this.el.set_default_size( 500,200); // not sure why it grows..
- GLib.debug("Loading tickets");
-
-
- this.el.show_all();
- this.el.set_keep_above(true);
-
+
+ GLib.debug("Showing dialog?");
+ Timeout.add_seconds(1, () => {
+
+
+
- RooProject? curproj = null;
- if (this.repo != null) {
- curproj = RooTicket.singleton().getProjectByRepo(this.repo);
- }
- _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
- if (curproj != null) {
-
+ //GitMonitor.gitmonitor.stop();
- var rt = RooTicket.singleton();
- rt.loadProjectOptions(curproj.id);
+ this.repo = repo;
- _this.msmodel.loadMilestones();
- _this.primodel.loadPriorities();
- _this.sevmodel.loadSeverities();
- _this.clmodel.loadClassifications();
- _this.devmodel.loadDevelopers();
- }
-
+
+
+ // GLib.debug("Loading tickets");
+
+
+
+ RooProject? curproj = null;
+ if (this.repo != null) {
+ curproj = RooProject.getProjectByRepo(this.repo);
+ }
+ _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
+ if (curproj != null) {
+
+
+ var rt = RooTicket.singleton();
+ rt.loadProjectOptions(curproj.id);
+
+ _this.msmodel.loadMilestones();
+ _this.primodel.loadPriorities();
+ _this.sevmodel.loadSeverities();
+ _this.clmodel.loadClassifications();
+ _this.devmodel.loadDevelopers();
+
+ }
+ _this.summary.el.set_text("");
+ _this.description.el.buffer.text = "";
+ _this.spinner.el.stop();
+ _this.spinner.el.hide();
+
+ this.table.el.show();
+
+
+
+
+
+
+ return false;
+ });
this.el.run();
+
}
- public class Xcls_VBox2 : Object
+ public class Xcls_Box2 : Object
{
- public Gtk.VBox el;
+ public Gtk.Box el;
private Ticket _this;
// my vars (def)
// ctor
- public Xcls_VBox2(Ticket _owner )
+ public Xcls_Box2(Ticket _owner )
{
_this = _owner;
- this.el = new Gtk.VBox( true, 0 );
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
// my vars (dec)
// set gobject values
- var child_0 = new Xcls_Table3( _this );
+ var child_0 = new Xcls_table( _this );
child_0.ref();
this.el.pack_start ( child_0.el , false,false,0 );
+ var child_1 = new Xcls_spinner( _this );
+ child_1.ref();
+ this.el.add ( child_1.el );
}
// user defined functions
}
- public class Xcls_Table3 : Object
+ public class Xcls_table : Object
{
public Gtk.Table el;
private Ticket _this;
// my vars (def)
// ctor
- public Xcls_Table3(Ticket _owner )
+ public Xcls_table(Ticket _owner )
{
_this = _owner;
+ _this.table = this;
this.el = new Gtk.Table( 14, 4, true );
// my vars (dec)
// user defined functions
public void loadProjects (string id) {
- var rt = RooTicket.singleton();
- rt.loadProjects();
_this.project_id.loading = true;
if (id == "") {
_this.project_id.el.set_active_iter(iter);
}
- var projects = rt.projects;
- foreach(var project in projects) {
+
+ foreach(var project in RooProject.projects()) {
el.append(out iter);
}
+ public class Xcls_spinner : Object
+ {
+ public Gtk.Spinner el;
+ private Ticket _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_spinner(Ticket _owner )
+ {
+ _this = _owner;
+ _this.spinner = this;
+ this.el = new Gtk.Spinner();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ }
+
+ // user defined functions
+ }
+
}
"..//gitlive/MergeBranch.vala",
"..//gitlive/RepoStatusPopover.vala",
"..//gitlive/Clone.vala",
- "..//gitlive/Ticket.vala"
+ "..//gitlive/Ticket.vala",
+ "..//gitlive/RooProject.vala",
+ "..//gitlive/RooRepo.vala"
],
"packages" : [
]
"gtk+-3.0",
"json-glib-1.0",
"libsoup-2.4",
- "gtksourceview-3.0"
+ "gtksourceview-3.0",
+ "webkit2gtk-4.0"
]
}
]
\ No newline at end of file
gtksourceview-3.0
libnotify
libwnck-3.0
+ webkit2gtk-4.0
libcanberra
- libsoup-2.4 >= 2.56.0
+ libsoup-2.4 >= 2.56.0
json-glib-1.0
])