[glide] Add a list options callback to glide animations



commit 830b4b69254cabaaef146eaea779a55109be6024
Author: Robert Carr <racarr Valentine localdomain>
Date:   Tue Apr 27 03:44:47 2010 -0400

    Add a list options callback to glide animations

 src/Makefile.am                |    4 ++--
 src/glide-animation-manager.c  |   19 +++++++++++--------
 src/glide-animation-manager.h  |    5 ++++-
 src/glide-vala-animations.vala |   33 ++++++++++++++++++---------------
 src/glide.vapi                 |   29 ++++++++++++++++-------------
 5 files changed, 51 insertions(+), 39 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 866c97f..4fbb6e9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,8 +28,8 @@ glide_VALABUILTSOURCES += glide-vala-animations.h
 
 if MAINTAINER_MODE
 BUILT_SOURCES += vala.stamp	
-vala.stamp: $(glide_VALASOURCES)
-	$(VALAC) --pkg clutter-1.0 -C -H glide-vala-animations.h $^ glide.vapi
+vala.stamp: $(glide_VALASOURCES) glide.vapi
+	$(VALAC) --pkg clutter-1.0 -C -H glide-vala-animations.h $^ 
 	touch $@
 endif
 
diff --git a/src/glide-animation-manager.c b/src/glide-animation-manager.c
index 4893946..52028a6 100644
--- a/src/glide-animation-manager.c
+++ b/src/glide-animation-manager.c
@@ -29,12 +29,15 @@
 static GList *animations = NULL;
 
 void
-glide_animation_manager_register_animation (GlideAnimationCallback callback, const gchar *name)
+glide_animation_manager_register_animation (GlideAnimationCallback callback, 
+					    GlideAnimationListOptionsCallback list_options,
+					    const gchar *name)
 {
   GlideAnimation *animation = g_malloc (sizeof (GlideAnimation));
   
   animation->name = g_strdup (name);
   animation->animate = callback;
+  animation->list_options = list_options;
   
   animations = g_list_append (animations, animation);
 }
@@ -291,11 +294,11 @@ glide_param_spec_animation_info (const gchar *name,
 void 
 glide_animation_manager_register_animations ()
 {
-  glide_animation_manager_register_animation ((GlideAnimationCallback)glide_animate_fade, "Fade");
-  glide_animation_manager_register_animation (glide_animations_animate_drop, "Drop");
-  glide_animation_manager_register_animation (glide_animations_animate_zoom, "Zoom");
-  glide_animation_manager_register_animation (glide_animations_animate_zoom_contents, "Zoom Contents");
-  glide_animation_manager_register_animation (glide_animations_animate_pivot, "Pivot");
-  glide_animation_manager_register_animation (glide_animations_animate_slide, "Slide");
-  glide_animation_manager_register_animation (glide_animations_animate_doorway, "Doorway");
+  glide_animation_manager_register_animation ((GlideAnimationCallback)glide_animate_fade, NULL, "Fade");
+  glide_animation_manager_register_animation (glide_animations_animate_drop, NULL, "Drop");
+  glide_animation_manager_register_animation (glide_animations_animate_zoom, NULL, "Zoom");
+  glide_animation_manager_register_animation (glide_animations_animate_zoom_contents, NULL, "Zoom Contents");
+  glide_animation_manager_register_animation (glide_animations_animate_pivot, NULL, "Pivot");
+  glide_animation_manager_register_animation (glide_animations_animate_slide, NULL, "Slide");
+  glide_animation_manager_register_animation (glide_animations_animate_doorway, NULL, "Doorway");
 }
diff --git a/src/glide-animation-manager.h b/src/glide-animation-manager.h
index 32be110..ffe95bb 100644
--- a/src/glide-animation-manager.h
+++ b/src/glide-animation-manager.h
@@ -22,6 +22,7 @@
 
 #include <glib-object.h>
 #include <clutter/clutter.h>
+#include <glib.h>
 
 G_BEGIN_DECLS
 
@@ -31,10 +32,12 @@ typedef struct _GlideAnimation GlideAnimation;
 typedef ClutterTimeline *(*GlideAnimationCallback) (const GlideAnimationInfo *info,
 						   ClutterActor *a,
 						   ClutterActor *b);
+typedef GList *(*GlideAnimationListOptionsCallback) (void);
 
 struct _GlideAnimation {
   gchar *name;
   GlideAnimationCallback animate;
+  GlideAnimationListOptionsCallback list_options;
 };
 
 struct _GlideAnimationInfo {
@@ -42,7 +45,7 @@ struct _GlideAnimationInfo {
   guint duration;
 };
 
-void glide_animation_manager_register_animation (GlideAnimationCallback callback, const gchar *name);
+void glide_animation_manager_register_animation (GlideAnimationCallback callback, GlideAnimationListOptionsCallback list_options, const gchar *name);
 const GList *glide_animation_manager_get_animations ();
 const GlideAnimation *glide_animation_manager_get_animation (const gchar *animation);
 
diff --git a/src/glide-vala-animations.vala b/src/glide-vala-animations.vala
index 0159080..318332f 100644
--- a/src/glide-vala-animations.vala
+++ b/src/glide-vala-animations.vala
@@ -1,19 +1,22 @@
 namespace Glide {
-    public static Clutter.Timeline animate_fade (AnimationInfo info, Clutter.Actor a,  Clutter.Actor b)
-    {
-	var timeline = new Clutter.Timeline (info.duration);
-	
-	b.opacity = 0x00;
-	b.show_all ();
-	
-	b.raise (a);
-	b.animate_with_timeline (Clutter.AnimationMode.LINEAR, timeline, "opacity", 255);
+    public static 
+	Clutter.Timeline animate_fade (AnimationInfo info, 
+								   Clutter.Actor a,  
+								   Clutter.Actor b){
+		var timeline = new Clutter.Timeline (info.duration);
+		
+		b.opacity = 0x00;
+		b.show_all ();
+		
+		b.raise (a);
+		b.animate_with_timeline (Clutter.AnimationMode.LINEAR, 
+								 timeline, "opacity", 255);
 				
-	timeline.completed.connect((t) => {
-		a.opacity = 0xff;
-		a.hide();
-        });	
-
-	return timeline;
+		timeline.completed.connect((t) => {
+				a.opacity = 0xff;
+				a.hide();
+			});	
+		
+		return timeline;
     }	
 }
\ No newline at end of file
diff --git a/src/glide.vapi b/src/glide.vapi
index 7fbf43d..6f7fca2 100644
--- a/src/glide.vapi
+++ b/src/glide.vapi
@@ -1,16 +1,19 @@
 [CCode (cprefix = "Glide", lower_case_cprefix = "glide_")]
 namespace Glide {
-	  [CCode (cheader_filename = "glide-animation-manager.h")]
-	  public delegate Clutter.Timeline AnimationCallback (AnimationInfo info, Clutter.Actor a, Clutter.Actor b);
+	[CCode (cheader_filename = "glide-animation-manager.h")]
+	public delegate Clutter.Timeline AnimationCallback (AnimationInfo info, Clutter.Actor a, Clutter.Actor b);
+	[CCode (cheader_filename = "glide-animation-manager.h")]
+	public delegate GLib.List AnimationListOptionsCallback ();
 	  
-	  [CCode (type_id = "GLIDE_TYPE_ANIMATION_INFO", cheader_filename = "glide-animation-manager.h")]
-	  public struct AnimationInfo {
-	  	 Animation animation;
-                 uint duration;
-          }	  
-         [CCode (cheader_filename = "glide-animation-manager.h")]
-         public struct Animation {
-	 	string name;
-		AnimationCallback animate;
-	 }
-}
\ No newline at end of file
+		[CCode (type_id = "GLIDE_TYPE_ANIMATION_INFO", cheader_filename = "glide-animation-manager.h")]
+		public struct AnimationInfo {
+			Animation animation;
+			uint duration;
+		}	  
+		[CCode (cheader_filename = "glide-animation-manager.h")]
+		public struct Animation {
+			string name;
+			AnimationCallback animate;
+			AnimationListOptionsCallback list_options;
+		}
+		}
\ No newline at end of file



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