[ease/inspector] Created a SlideSet base class for Document and Theme.
- From: Nate Stedman <natesm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ease/inspector] Created a SlideSet base class for Document and Theme.
- Date: Wed, 9 Jun 2010 21:57:11 +0000 (UTC)
commit 21cf45a1309f9969b6f4a03147836e0af1baa51c
Author: Nate Stedman <natesm gmail com>
Date: Thu Jun 3 04:57:24 2010 -0400
Created a SlideSet base class for Document and Theme.
Makefile.am | 1 +
src/Document.vala | 22 +++++++---------------
src/SlideSet.vala | 43 +++++++++++++++++++++++++++++++++++++++++++
src/Theme.vala | 11 ++++++++++-
4 files changed, 61 insertions(+), 16 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 7582234..53fb212 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -37,6 +37,7 @@ ease_SOURCES = \
src/SlideButtonPanel.vala \
src/SlideButton.vala \
src/SlidePane.vala \
+ src/SlideSet.vala \
src/Slide.vala \
src/TextActor.vala \
src/Theme.vala \
diff --git a/src/Document.vala b/src/Document.vala
index 7873314..c186c5b 100644
--- a/src/Document.vala
+++ b/src/Document.vala
@@ -21,9 +21,11 @@
* The Ease Document class is generated from XML and writes back to XML
* when saved.
*/
-public class Ease.Document : GLib.Object
+public class Ease.Document : SlideSet
{
- public Gee.ArrayList<Slide> slides { get; set; }
+ /**
+ * The { link Theme} linked to this Document.
+ */
public Theme theme { get; set; }
/**
@@ -45,11 +47,6 @@ public class Ease.Document : GLib.Object
* The file path of the Document.
*/
public string path { get; set; }
-
- /**
- * The number of { link Slide}s in the Document.
- */
- public int length { get { return slides.size; } }
/**
* Default constructor, used for new documents.
@@ -57,10 +54,7 @@ public class Ease.Document : GLib.Object
* Creates a new, empty document with no slides. Used for creating new
* documents (which can then add a default slide).
*/
- public Document()
- {
- slides = new Gee.ArrayList<Slide>();
- }
+ public Document() { }
/**
* Inserts a new { link Slide} into the Document
@@ -68,17 +62,15 @@ public class Ease.Document : GLib.Object
* @param s The { link Slide} to insert.
* @param index The position of the new { link Slide} in the Document.
*/
- public void add_slide(int index, Slide s)
+ public override void add_slide(int index, Slide s)
{
s.parent = this;
- slides.insert(index, s);
+ base.add_slide(index, s);
}
/**
* Returns whether or not the Document has a { link Slide} after the
* passed in { link Slide}.
- *
- * @param slide
*/
public bool has_next_slide(Slide slide)
{
diff --git a/src/SlideSet.vala b/src/SlideSet.vala
new file mode 100644
index 0000000..0fceeaf
--- /dev/null
+++ b/src/SlideSet.vala
@@ -0,0 +1,43 @@
+/* Ease, a GTK presentation application
+ Copyright (C) 2010 Nate Stedman
+
+ This program 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * A base class for { link Document} and { link Theme}.
+ */
+public abstract class Ease.SlideSet : Object
+{
+ /**
+ * All { link Slide}s in this SlideSet.
+ */
+ public Gee.ArrayList<Slide> slides = new Gee.ArrayList<Slide>();
+
+ /**
+ * The number of { link Slide}s in the SlideSet.
+ */
+ public int length { get { return slides.size; } }
+
+ /**
+ * Inserts a new { link Slide} into the SlideSet
+ *
+ * @param s The { link Slide} to insert.
+ * @param index The position of the new { link Slide} in the SlideSet.
+ */
+ public virtual void add_slide(int index, Slide s)
+ {
+ slides.insert(index, s);
+ }
+}
diff --git a/src/Theme.vala b/src/Theme.vala
index 16eef27..ad3f891 100644
--- a/src/Theme.vala
+++ b/src/Theme.vala
@@ -18,7 +18,16 @@
/**
* Internal representation of Ease themes
*/
-public class Ease.Theme : GLib.Object
+public class Ease.Theme : SlideSet
{
+ /**
+ * The title of the Theme.
+ */
+ public string title { get; set; }
+
+ /**
+ * Creates an empty Theme.
+ */
+ public Theme() { }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]