projects
/
gitlive
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
NewBranch.bjs
[gitlive]
/
RooProject.vala
diff --git
a/RooProject.vala
b/RooProject.vala
index
7ac83f9
..
57e1c01
100644
(file)
--- a/
RooProject.vala
+++ b/
RooProject.vala
@@
-3,15
+3,20
@@
static RooProject _RooProject;
public class RooProject : Object
{
static RooProject _RooProject;
public class RooProject : Object
{
+ static Gee.ArrayList<RooProject> _projects;
+ static int loadcount = 0;
+ const string roourl = "https://roojs.com/admin.php/Roo";
+
+
public static RooProject singleton()
{
public static RooProject singleton()
{
-
+ if (_RooProject == null) {
_RooProject = new RooProject();
_RooProject = new RooProject();
-
- Roo
Ticke
t.loadProjects();
+ RooProject.loadcount = 0;
+ Roo
Projec
t.loadProjects();
}
}
- return _Roo
Ticke
t;
+ return _Roo
Projec
t;
}
public string id; // not really important that they are numbers..
}
public string id; // not really important that they are numbers..
@@
-19,7
+24,7
@@
public class RooProject : Object
public string name;
public string type;
public string name;
public string type;
- static Gee.ArrayList<RooProject> _projects;
+
public static Gee.ArrayList<RooProject> projects()
{
RooProject.singleton();
public static Gee.ArrayList<RooProject> projects()
{
RooProject.singleton();
@@
-27,9
+32,8
@@
public class RooProject : Object
return RooProject._projects;
}
return RooProject._projects;
}
-
static public
RooProject addProject(Json.Object t)
+
public static
RooProject addProject(Json.Object t)
{
{
-
RooProject.singleton(); // init...
var add = new RooProject();
RooProject.singleton(); // init...
var add = new RooProject();
@@
-41,13
+45,21
@@
public class RooProject : Object
GLib.debug("ADD project %s : %s : %s", add.id, add.code, add.name);
return add;
}
GLib.debug("ADD project %s : %s : %s", add.id, add.code, add.name);
return add;
}
-
+
+ static void reloadProjects() /// has to be called on singleton..
+ {
+ RooProject.loadcount = 0;
+ RooProject.singleton();
+ if (RooProject.loadcount == 0 ) {
+ RooProject.loadProjects();
+ }
+ }
static void loadProjects() // called from singleton...
{
static void loadProjects() // called from singleton...
{
- Roo
Ticke
t._projects = new Gee.ArrayList<RooProject>();
+ Roo
Projec
t._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");
var table = new GLib.HashTable<string, string>(str_hash, str_equal);
table.insert("query[project_filter]","P,N,U");
@@
-86,9
+98,9
@@
public class RooProject : Object
var rd = response.get_array_member ("data");
// got a valid result...
var rd = response.get_array_member ("data");
// got a valid result...
- var _this = RooTicket.singleton();
+
for(var i = 0; i < rd.get_length(); i++) {
for(var i = 0; i < rd.get_length(); i++) {
-
_this
.addProject(rd.get_object_element(i));
+
RooProject
.addProject(rd.get_object_element(i));
}
}