[glide] Fade is now implemented in Vala
- From: Robert Carr <racarr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glide] Fade is now implemented in Vala
- Date: Tue, 27 Apr 2010 08:49:28 +0000 (UTC)
commit a9e8358f39cdc771fe9e6fcfe0535268be164cd4
Author: Robert Carr <racarr Valentine localdomain>
Date: Tue Apr 27 03:26:01 2010 -0400
Fade is now implemented in Vala
configure.ac | 15 +++++++++++++--
src/Makefile.am | 26 ++++++++++++++++++++++++--
src/glide-animation-manager.c | 4 +++-
src/glide-slide.c | 2 ++
src/glide-vala-animations.vala | 19 +++++++++++++++++++
src/glide.vapi | 16 ++++++++++++++++
6 files changed, 77 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4d121ec..3f5e4c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,9 +5,9 @@ AC_PREREQ(2.62)
AC_INIT(glide, 0.1)
AC_CONFIG_MACRO_DIR([m4])
-AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
+AM_INIT_AUTOMAKE([1.11 dist-bzip2])
AC_CONFIG_HEADERS([config.h])
-AM_MAINTAINER_MODE
+AM_MAINTAINER_MODE()
AC_ISC_POSIX
AC_PROG_CC
@@ -38,6 +38,17 @@ PKG_CHECK_MODULES(CLUTTER_GTK, [clutter-gtk-0.90])
PKG_CHECK_MODULES(JSON_GLIB, json-glib-1.0)
PKG_CHECK_MODULES(GOBJECT_INTROSPECTION, gobject-introspection-1.0)
PKG_CHECK_MODULES(GMODULE, gmodule-2.0)
+
+if test "x$USE_MAINTAINER_MODE" = "xyes" ; then
+ AC_MSG_CHECKING([vala version >= 0.8.0])
+ AM_PROG_VALAC([0.8.0])
+ if test "x$VALAC" = "x" ; then
+ AC_MSG_ERROR([Cannot find the "valac" compiler in your PATH])
+ AC_MSG_RESULT(no)
+ else
+ AC_MSG_RESULT(yes)
+ fi
+fi
diff --git a/src/Makefile.am b/src/Makefile.am
index a44d2ab..866c97f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,6 +2,7 @@
## Created by Anjuta
+BUILT_SOURCES =
AM_CPPFLAGS = \
-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
@@ -19,6 +20,19 @@ AM_CFLAGS =\
-Wall \
-Werror
+glide_VALASOURCES = \
+ glide-vala-animations.vala
+
+glide_VALABUILTSOURCES = $(glide_VALASOURCES:.vala=.c)
+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
+ touch $@
+endif
+
bin_PROGRAMS = glide
glide_SOURCES = \
@@ -57,7 +71,8 @@ glide_SOURCES = \
glide-cairo-util.c \
glide-cairo-util.h \
glide-animation-manager.c \
- glide-animation-manager.h
+ glide-animation-manager.h \
+ $(glide_VALABUILTSOURCES)
glide_LDFLAGS = \
@@ -65,7 +80,14 @@ glide_LDFLAGS = \
glide_LDADD = $(GTK_LIBS) $(CLUTTER_LIBS) $(CLUTTER_GTK_LIBS) $(GOBJECT_INTROSPECTION_LIBS) $(JSON_GLIB_LIBS) $(GMODULE_LIBS)
-EXTRA_DIST = $(ui_DATA)
+EXTRA_DIST = $(ui_DATA) \
+ $(glide_VALASOURCES)
+
+if MAINTAINER_MODE
+CLEANFILES = \
+ $(BUILT_SOURCES) \
+ $(glide_VALABUILTSOURCES)
+endif
# Remove ui directory on uninstall
uninstall-local:
diff --git a/src/glide-animation-manager.c b/src/glide-animation-manager.c
index 41d31b2..4893946 100644
--- a/src/glide-animation-manager.c
+++ b/src/glide-animation-manager.c
@@ -21,7 +21,9 @@
#include <string.h>
#include "glide-animation-manager.h"
+
#include "glide-animations.h"
+#include "glide-vala-animations.h"
static GList *animations = NULL;
@@ -289,7 +291,7 @@ glide_param_spec_animation_info (const gchar *name,
void
glide_animation_manager_register_animations ()
{
- glide_animation_manager_register_animation (glide_animations_animate_fade, "Fade");
+ 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");
diff --git a/src/glide-slide.c b/src/glide-slide.c
index 79c6928..3d9ec13 100644
--- a/src/glide-slide.c
+++ b/src/glide-slide.c
@@ -653,6 +653,8 @@ glide_slide_construct_from_json (GlideSlide *slide, JsonObject *slide_obj, Glide
glide_json_object_get_animation (slide_obj, "animation", &info);
glide_slide_set_animation (slide, &info);
+
+
actors_l = json_array_get_elements (actors);
for (a = actors_l; a; a = a->next)
{
diff --git a/src/glide-vala-animations.vala b/src/glide-vala-animations.vala
new file mode 100644
index 0000000..0159080
--- /dev/null
+++ b/src/glide-vala-animations.vala
@@ -0,0 +1,19 @@
+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);
+
+ 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
new file mode 100644
index 0000000..7fbf43d
--- /dev/null
+++ b/src/glide.vapi
@@ -0,0 +1,16 @@
+[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 (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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]