[glide] Undo machinery for setting slide backgrounds



commit 550c15420d0e5327adcf11e66d7aa825c3054707
Author: Robert Carr <racarr Valentine localdomain>
Date:   Thu Apr 29 05:02:54 2010 -0400

    Undo machinery for setting slide backgrounds

 src/glide-slide.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/glide-slide.c b/src/glide-slide.c
index 833ccb6..d957347 100644
--- a/src/glide-slide.c
+++ b/src/glide-slide.c
@@ -314,7 +314,7 @@ glide_slide_paint (ClutterActor *actor)
 			    paint_opacity * priv->color.alpha/255);
   cogl_rectangle(0, 0, width, height);
   
-  if (priv->background_material) 
+  if (priv->background && priv->background_material) 
     {
       
       cogl_material_set_color4ub (priv->background_material,
@@ -725,19 +725,23 @@ void
 glide_slide_set_background (GlideSlide *slide, const gchar *background)
 {
   gchar *resource, *resource_file;
-  if (!background)
-    return;
   
   if (slide->priv->background)
     g_free (slide->priv->background);
+  if (slide->priv->background_material)
+    cogl_handle_unref (slide->priv->background_material);
+  
+  if (background == NULL)
+    {
+      slide->priv->background = NULL;
+      return;
+    }
   
   resource = glide_actor_add_resource (GLIDE_ACTOR (slide), background);
   slide->priv->background = resource;
   
   resource_file = glide_actor_get_resource_path (GLIDE_ACTOR (slide), resource);
-  
-  if (slide->priv->background_material)
-    cogl_handle_unref (slide->priv->background_material);
+
   slide->priv->background_material = glide_slide_material_for_file (resource_file);
   
   g_free (resource_file);



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