GitRepo.vala
[gitlive] / GitRepo.vala
index e9a2cb1..90045d3 100644 (file)
@@ -176,7 +176,7 @@ public class GitRepo : Object
        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();
@@ -410,11 +410,8 @@ public class GitRepo : Object
     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;
                }
@@ -427,14 +424,11 @@ public class GitRepo : Object
     
     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;
     }