[gitg] Added wrappers for GgitRef and GgitBranch



commit 5a1efe6b7f77af1218305930003eed45db689ef6
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date:   Tue Oct 16 20:26:12 2012 +0200

    Added wrappers for GgitRef and GgitBranch

 libgitg/Makefile.am           |    3 +++
 libgitg/gitg-branch-base.vala |   39 +++++++++++++++++++++++++++++++++++++++
 libgitg/gitg-branch.vala      |   28 ++++++++++++++++++++++++++++
 libgitg/gitg-init.vala        |    5 ++++-
 libgitg/gitg-ref-base.vala    |   39 +++++++++++++++++++++++++++++++++++++++
 libgitg/gitg-ref.vala         |   17 +++++++----------
 6 files changed, 120 insertions(+), 11 deletions(-)
---
diff --git a/libgitg/Makefile.am b/libgitg/Makefile.am
index 07bc4ab..5eff96d 100644
--- a/libgitg/Makefile.am
+++ b/libgitg/Makefile.am
@@ -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			\
diff --git a/libgitg/gitg-branch-base.vala b/libgitg/gitg-branch-base.vala
new file mode 100644
index 0000000..8dd5ad9
--- /dev/null
+++ b/libgitg/gitg-branch-base.vala
@@ -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
diff --git a/libgitg/gitg-branch.vala b/libgitg/gitg-branch.vala
new file mode 100644
index 0000000..aa2e756
--- /dev/null
+++ b/libgitg/gitg-branch.vala
@@ -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
diff --git a/libgitg/gitg-init.vala b/libgitg/gitg-init.vala
index 6ea1b6a..b4043f4 100644
--- a/libgitg/gitg-init.vala
+++ b/libgitg/gitg-init.vala
@@ -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));
diff --git a/libgitg/gitg-ref-base.vala b/libgitg/gitg-ref-base.vala
new file mode 100644
index 0000000..67dfa85
--- /dev/null
+++ b/libgitg/gitg-ref-base.vala
@@ -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
diff --git a/libgitg/gitg-ref.vala b/libgitg/gitg-ref.vala
index a65259c..387348e 100644
--- a/libgitg/gitg-ref.vala
+++ b/libgitg/gitg-ref.vala
@@ -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)
 	{



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]