[eog] Port to clutter 1.0



commit 4491818e0304cb59a96d3cc2c483f1355b1323d0
Author: Gustavo Noronha Silva <kov debian org>
Date:   Thu Nov 5 12:37:38 2009 -0200

    Port to clutter 1.0

 configure.ac           |    8 ++++----
 src/eog-clutter-view.c |   27 +++++++++++++++------------
 src/eog-clutter-view.h |    2 +-
 3 files changed, 20 insertions(+), 17 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 8d4a1c4..9979ec0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -229,20 +229,20 @@ AM_CONDITIONAL(ENABLE_JPEG, test x$have_jpeg = xyes)
 # Clutter (optional)
 # ******************
 
-CLUTTER_REQUIRED=0.8.0
+CLUTTER_REQUIRED=1.0.0
 
 AC_ARG_WITH([clutter], AC_HELP_STRING([--with-clutter], [enable Clutter backend]),
 		       [with_clutter=$withval], [with_clutter=no])
 have_clutter=no
 if test "x$with_clutter" != "xno"; then
   PKG_CHECK_MODULES(CLUTTER,
-                    clutter-0.8 >= $CLUTTER_REQUIRED dnl
-                    clutter-gtk-0.8,
+                    clutter-1.0 >= $CLUTTER_REQUIRED dnl
+                    clutter-gtk-0.10,
                     have_clutter=yes, have_clutter=no)
 fi
 if test "x$have_clutter" = "xyes"; then
   AC_DEFINE(WITH_CLUTTER_BACKEND, 1, [Clutter backend.])
-  EOG_MODULES="$EOG_MODULES clutter-0.8 >= $CLUTTER_REQUIRED clutter-gtk-0.8"
+  EOG_MODULES="$EOG_MODULES clutter-1.0 >= $CLUTTER_REQUIRED clutter-gtk-0.10"
 fi
 
 AM_CONDITIONAL([WITH_CLUTTER_BACKEND], [test "x$have_clutter" = "xyes"])
diff --git a/src/eog-clutter-view.c b/src/eog-clutter-view.c
index 73dbb67..1b30109 100644
--- a/src/eog-clutter-view.c
+++ b/src/eog-clutter-view.c
@@ -20,7 +20,7 @@
  */
 
 #include <clutter/clutter.h>
-#include <clutter-gtk/gtk-clutter-embed.h>
+#include <clutter-gtk/clutter-gtk.h>
 
 #include "eog-clutter-view.h"
 #include "eog-image.h"
@@ -88,7 +88,7 @@ static void eog_clutter_view_place_texture (EogClutterView *clutter_view, Clutte
 #define EOG_CLUTTER_VIEW_GET_PRIVATE(object)				\
 	(G_TYPE_INSTANCE_GET_PRIVATE ((object), EOG_TYPE_CLUTTER_VIEW, EogClutterViewPrivate))
 
-G_DEFINE_TYPE_WITH_CODE (EogClutterView, eog_clutter_view, GTK_TYPE_CLUTTER_EMBED,
+G_DEFINE_TYPE_WITH_CODE (EogClutterView, eog_clutter_view, GTK_CLUTTER_TYPE_EMBED,
 			 G_IMPLEMENT_INTERFACE (EOG_TYPE_VIEW,
 						eog_clutter_view_iface_init))
 
@@ -149,20 +149,16 @@ eog_clutter_view_init (EogClutterView *clutter_view)
 	priv->texture = NULL;
 	priv->texture_in = NULL;
 
-	priv->timeline = clutter_timeline_new (15, 30);
+	priv->timeline = clutter_timeline_new (1000);
 	g_signal_connect (priv->timeline, "completed",
 			  G_CALLBACK (switch_timeline_completed_cb),
 			  clutter_view);
 
-	alpha_in = clutter_alpha_new_full (priv->timeline,
-					   CLUTTER_ALPHA_SINE_INC,
-					   NULL, NULL);
-	alpha_out = clutter_alpha_new_full (priv->timeline,
-					    CLUTTER_ALPHA_SINE_DEC,
-					    NULL, NULL);
+	alpha_in = clutter_alpha_new_full (priv->timeline, CLUTTER_EASE_OUT_SINE);
+	alpha_out = clutter_alpha_new_full (priv->timeline, CLUTTER_EASE_IN_SINE);
 
 	priv->behaviour_in = clutter_behaviour_opacity_new (alpha_in, 0x00, 0xFF);
-	priv->behaviour_out = clutter_behaviour_opacity_new (alpha_out, 0x00, 0xFF);
+	priv->behaviour_out = clutter_behaviour_opacity_new (alpha_out, 0xFF, 0x00);
 
 	priv->zoom_multiplier = IMAGE_VIEW_ZOOM_MULTIPLIER;
 	priv->zoom = 1.0;
@@ -289,12 +285,15 @@ eog_clutter_view_set_image (EogView *view, EogImage *image)
 	EogClutterView *clutter_view;
 	EogClutterViewPrivate *priv;
 	GdkPixbuf *pixbuf;
+	GError *error = NULL;
 
 	g_return_if_fail (EOG_IS_CLUTTER_VIEW (view));
 
 	clutter_view = EOG_CLUTTER_VIEW (view);
 	priv = clutter_view->priv;
 
+	clutter_timeline_rewind (priv->timeline);
+
 	if (priv->image == image) {
 		return;
 	}
@@ -315,9 +314,14 @@ eog_clutter_view_set_image (EogView *view, EogImage *image)
 		}
 
 		pixbuf = eog_image_get_pixbuf (priv->image);
-		gtk_clutter_texture_set_from_pixbuf (CLUTTER_TEXTURE (priv->texture_in), pixbuf);
+		gtk_clutter_texture_set_from_pixbuf (CLUTTER_TEXTURE (priv->texture_in), pixbuf, &error);
 		g_object_unref (pixbuf);
 
+		if (error) {
+			g_warning ("Failed to fetch data from pixbuf");
+			g_error_free (error);
+		}
+
 		eog_clutter_view_set_zoom_fit (clutter_view);
 		eog_clutter_view_place_texture (clutter_view, CLUTTER_TEXTURE (priv->texture_in));
 
@@ -331,7 +335,6 @@ eog_clutter_view_set_image (EogView *view, EogImage *image)
 		clutter_behaviour_apply (priv->behaviour_out, priv->texture);
 	}
 
-	clutter_timeline_rewind (priv->timeline);
 	clutter_timeline_start (priv->timeline);
 }
 
diff --git a/src/eog-clutter-view.h b/src/eog-clutter-view.h
index 75da886..41eb02d 100644
--- a/src/eog-clutter-view.h
+++ b/src/eog-clutter-view.h
@@ -23,7 +23,7 @@
 #define _EOG_CLUTTER_VIEW_H_
 
 #include <clutter/clutter.h>
-#include <clutter-gtk/gtk-clutter-embed.h>
+#include <clutter-gtk/clutter-gtk.h>
 
 G_BEGIN_DECLS
 



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