Added wrappers for GgitRef and GgitBranch

This commit is contained in:
Jesse van den Kieboom 2012-10-16 20:26:12 +02:00
parent 804296d794
commit 5a1efe6b7f
6 changed files with 120 additions and 11 deletions

View file

@ -31,8 +31,11 @@ libgitg.h: libgitg-1.0.la
VALA_FILES = \
gitg-assembly-info.vala \
gitg-branch.vala \
gitg-branch-base.vala \
gitg-repository.vala \
gitg-ref.vala \
gitg-ref-base.vala \
gitg-lane.vala \
gitg-lanes.vala \
gitg-color.vala \

View file

@ -0,0 +1,39 @@
/*
* This file is part of gitg
*
* Copyright (C) 2012 - Jesse van den Kieboom
*
* gitg is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* gitg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gitg. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Gitg
{
public class BranchBase : Ggit.Branch, Ref, Branch
{
protected ParsedRefName d_parsed_name { get; set; }
protected List<Ref>? d_pushes { get; owned set; }
public RefState state { get; set; }
public bool working { get; set; }
public new Gitg.Repository get_owner()
{
return (Gitg.Repository)base.get_owner();
}
}
}
// ex:set ts=4 noet

28
libgitg/gitg-branch.vala Normal file
View file

@ -0,0 +1,28 @@
/*
* This file is part of gitg
*
* Copyright (C) 2012 - Jesse van den Kieboom
*
* gitg is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* gitg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gitg. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Gitg
{
public interface Branch : Ggit.Branch, Ref
{
}
}
// ex:set ts=4 noet

View file

@ -30,7 +30,10 @@ public void init()
typeof(Gitg.Repository));
factory.register(typeof(Ggit.Ref),
typeof(Gitg.Ref));
typeof(Gitg.RefBase));
factory.register(typeof(Ggit.Branch),
typeof(Gitg.BranchBase));
factory.register(typeof(Ggit.Commit),
typeof(Gitg.Commit));

View file

@ -0,0 +1,39 @@
/*
* This file is part of gitg
*
* Copyright (C) 2012 - Jesse van den Kieboom
*
* gitg is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* gitg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gitg. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Gitg
{
public class RefBase : Ggit.Ref, Ref
{
protected ParsedRefName d_parsed_name { get; set; }
protected List<Ref>? d_pushes { get; owned set; }
public RefState state { get; set; }
public bool working { get; set; }
public new Gitg.Repository get_owner()
{
return (Gitg.Repository)base.get_owner();
}
}
}
// ex:set ts=4 noet

View file

@ -141,15 +141,15 @@ public class ParsedRefName : Object
}
}
public class Ref : Ggit.Ref
public interface Ref : Ggit.Ref
{
private List<Ref>? d_pushes;
private static Regex? s_remote_key_regex;
private ParsedRefName d_parsed_name;
public RefState state { get; set; }
public bool working { get; set; }
protected abstract ParsedRefName d_parsed_name { get; set; }
protected abstract List<Ref>? d_pushes { get; owned set; }
public abstract RefState state { get; set; }
public abstract bool working { get; set; }
public ParsedRefName parsed_name
{
@ -164,10 +164,7 @@ public class Ref : Ggit.Ref
}
}
public new Gitg.Repository get_owner()
{
return (Gitg.Repository)base.get_owner();
}
public abstract new Gitg.Repository get_owner();
private void add_push_ref(string spec)
{