[ease/themes] Fix appearance of image backgrounds in theme previews.



commit 6e691b133b2f3d668f796661678a3b06778a99c8
Author: Nate Stedman <natesm gmail com>
Date:   Sat Jun 5 12:04:33 2010 -0400

    Fix appearance of image backgrounds in theme previews.

 src/Element.vala      |   13 +++++++++++++
 src/ImageActor.vala   |    5 ++---
 src/Slide.vala        |    8 +++++++-
 src/WelcomeActor.vala |    1 +
 4 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/src/Element.vala b/src/Element.vala
index 86cc783..be9a9af 100644
--- a/src/Element.vala
+++ b/src/Element.vala
@@ -550,5 +550,18 @@ public class Ease.Element : GLib.Object
 		owned get { return data.get("filename"); }
 		set	{ data.set("filename", value); }
 	}
+	
+	/**
+	 * The full path to a media file. Applies to "image" and "video"
+	 * Elements. Cannot be set.
+	 */
+	public string full_filename
+	{
+		owned get
+		{
+			var str = Path.build_path("/", parent.parent.path, filename);
+			return str;
+		}
+	}
 }
 
diff --git a/src/ImageActor.vala b/src/ImageActor.vala
index 8b1d1f9..85fea5d 100644
--- a/src/ImageActor.vala
+++ b/src/ImageActor.vala
@@ -37,14 +37,13 @@ public class Ease.ImageActor : Actor
 	public ImageActor(Element e, ActorContext c)
 	{
 		base(e, c);
-		
 		try
 		{
-			contents = new Clutter.Texture.from_file(Path.build_path("/", e.parent.parent.path, e.get("filename")));
+			contents = new Clutter.Texture.from_file(e.full_filename);
 		}
 		catch (GLib.Error e)
 		{
-			stdout.printf(_("Error loading ImageActor: %s"), e.message);
+			stdout.printf(_("Error loading ImageActor: %s\n"), e.message);
 		}
 		finally
 		{
diff --git a/src/Slide.vala b/src/Slide.vala
index 8182e5c..200af22 100644
--- a/src/Slide.vala
+++ b/src/Slide.vala
@@ -80,7 +80,8 @@ public class Ease.Slide
 	{
 		owned get
 		{
-			return Path.build_path("/",parent.path, background_image);
+			string p = parent == null ? theme.path : parent.path;
+			return Path.build_path("/", p, background_image);
 		}
 	}
 	
@@ -95,6 +96,11 @@ public class Ease.Slide
 	public Document parent { get; set; }
 	
 	/**
+	 * The { link Theme} that this Slide is based on.
+	 */
+	public Theme theme { get; set; }
+	
+	/**
 	 * The number of { link Element}s on this Slide
 	 */
 	public int count { get { return elements.size; } }
diff --git a/src/WelcomeActor.vala b/src/WelcomeActor.vala
index 227dbe9..3852dd2 100644
--- a/src/WelcomeActor.vala
+++ b/src/WelcomeActor.vala
@@ -81,6 +81,7 @@ public class Ease.WelcomeActor : Clutter.Group
 		
 		slide = new Slide.from_master(master, null,
 		                              (int)WIDTH, (int)slide_height);
+		slide.theme = theme;
 		slide_actor = new SlideActor.with_dimensions(w, h, slide, true,
 		                                             ActorContext.PRESENTATION);
 		



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