[eog] Add the new EogClutterView widget for clutter bling.



commit 617b9315db7b1744f97f3b230d3ab880ca8b8704
Author: Gustavo Noronha Silva <kov debian org>
Date:   Wed Nov 4 15:15:08 2009 -0200

    Add the new EogClutterView widget for clutter bling.

 bindings/python/Makefile.am |    2 +-
 bindings/python/eog.defs    |   30 ++--
 configure.ac                |   23 ++
 src/Makefile.am             |   18 ++-
 src/eog-clutter-view.c      |  487 +++++++++++++++++++++++++++++++++++++++++++
 src/eog-clutter-view.h      |   55 +++++
 src/eog-window.c            |   16 +-
 src/main.c                  |    7 +
 8 files changed, 616 insertions(+), 22 deletions(-)
---
diff --git a/bindings/python/Makefile.am b/bindings/python/Makefile.am
index d57d5c9..360ead5 100644
--- a/bindings/python/Makefile.am
+++ b/bindings/python/Makefile.am
@@ -46,7 +46,7 @@ BINDING_EOG_HEADERS_SRCDIR_IN = 			\
 	src/eog-statusbar.h				\
 	src/eog-thumb-nav.h				\
 	src/eog-image.h					\
-	src/eog-scroll-view.h				\
+	src/eog-view.h					\
 	src/eog-thumb-view.h				\
 	src/eog-list-store.h				\
 	src/eog-job-queue.h				\
diff --git a/bindings/python/eog.defs b/bindings/python/eog.defs
index b83abc9..08b40ed 100644
--- a/bindings/python/eog.defs
+++ b/bindings/python/eog.defs
@@ -98,12 +98,12 @@
   (gtype-id "EOG_TYPE_PROPERTIES_DIALOG")
 )
 
-(define-object ScrollView
-  (in-module "Eog")
-  (parent "GtkTable")
-  (c-name "EogScrollView")
-  (gtype-id "EOG_TYPE_SCROLL_VIEW")
-)
+;;; (define-object ScrollView
+;;;   (in-module "Eog")
+;;;   (parent "GtkTable")
+;;;   (c-name "EogScrollView")
+;;;   (gtype-id "EOG_TYPE_SCROLL_VIEW")
+;;; )
 
 (define-object Sidebar
   (in-module "Eog")
@@ -892,16 +892,16 @@
 
 ;; From eog-scroll-view.h
 
-(define-function eog_scroll_view_get_type
-  (c-name "eog_scroll_view_get_type")
-  (return-type "GType")
-)
+;;(define-function eog_scroll_view_get_type
+;;  (c-name "eog_scroll_view_get_type")
+;;  (return-type "GType")
+;;)
 
-(define-function eog_scroll_view_new
-  (c-name "eog_scroll_view_new")
-  (is-constructor-of "EogScrollView")
-  (return-type "GtkWidget*")
-)
+;;(define-function eog_scroll_view_new
+;;  (c-name "eog_scroll_view_new")
+;;  (is-constructor-of "EogScrollView")
+;;  (return-type "GtkWidget*")
+;;)
 
 
 
diff --git a/configure.ac b/configure.ac
index b08b264..59db69c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -225,6 +225,28 @@ AC_ARG_WITH(libjpeg, AC_HELP_STRING([--without-libjpeg], [disable special JPEG s
 AC_SUBST(LIBJPEG)
 AM_CONDITIONAL(ENABLE_JPEG, test x$have_jpeg = xyes)
 
+# ******************
+# Clutter (optional)
+# ******************
+
+CLUTTER_REQUIRED=0.8.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,
+                    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"
+fi
+
+AM_CONDITIONAL([WITH_CLUTTER_BACKEND], [test "x$have_clutter" = "xyes"])
+
 # ****************
 # D-Bus activation
 # ****************
@@ -438,4 +460,5 @@ Configure summary:
 	JPEG support ...............:  ${have_jpeg}
 	Colour management support ..:  ${have_lcms}
 	D-Bus activation............:  ${have_dbus}
+	Clutter backend.............:  ${have_clutter}
 "
diff --git a/src/Makefile.am b/src/Makefile.am
index f82525d..a2edcad 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -61,7 +61,6 @@ INST_H_FILES =				\
 	eog-image.h			\
 	eog-enums.h			\
 	eog-image-save-info.h		\
-	eog-scroll-view.h		\
 	eog-view.h			\
 	eog-thumb-view.h		\
 	eog-list-store.h		\
@@ -70,6 +69,14 @@ INST_H_FILES =				\
 	eog-jobs.h			\
 	eog-plugin.h
 
+if WITH_CLUTTER_BACKEND
+INST_H_FILES += 			\
+	eog-clutter-view.h
+else
+INST_H_FILES += 			\
+	eog-scroll-view.h
+endif
+
 libeog_la_SOURCES =			\
 	eog-application.c		\
 	eog-session.c			\
@@ -90,7 +97,6 @@ libeog_la_SOURCES =			\
 	eog-image.c			\
 	eog-image-jpeg.c		\
 	eog-image-save-info.c		\
-	eog-scroll-view.c		\
 	eog-view.c			\
 	eog-thumb-view.c		\
 	eog-list-store.c		\
@@ -144,6 +150,14 @@ libeog_la_SOURCES +=			\
 	eog-exif-details.c
 endif HAVE_EXEMPI
 
+if WITH_CLUTTER_BACKEND
+libeog_la_SOURCES += 			\
+	eog-clutter-view.c
+else
+libeog_la_SOURCES += 			\
+	eog-scroll-view.c
+endif
+
 libeog_la_CFLAGS =						\
 	-I$(top_srcdir)/jpegutils				\
 	-I$(top_srcdir)/cut-n-paste/toolbar-editor		\
diff --git a/src/eog-clutter-view.c b/src/eog-clutter-view.c
new file mode 100644
index 0000000..73dbb67
--- /dev/null
+++ b/src/eog-clutter-view.c
@@ -0,0 +1,487 @@
+/* Eye of GNOME -- Clutter Powered Image Viewing Widget
+ *
+ * Copyright (C) 2008 The Free Software Foundation
+ *
+ * Author: Claudio Saavedra  <csaavedra gnome org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <clutter/clutter.h>
+#include <clutter-gtk/gtk-clutter-embed.h>
+
+#include "eog-clutter-view.h"
+#include "eog-image.h"
+#include "eog-view.h"
+#include "zoom.h"
+
+#define IMAGE_VIEW_ZOOM_MULTIPLIER 1.05
+
+struct _EogClutterViewPrivate {
+	EogImage *image;
+
+	/* Timeline for the image switching process. */
+	ClutterTimeline *timeline;
+
+	ClutterActor *texture_in;
+	ClutterActor *texture;
+
+	ClutterBehaviour *behaviour_in;
+	ClutterBehaviour *behaviour_out;
+
+	ClutterActor *stage;
+
+	gdouble zoom;
+	gdouble zoom_multiplier;
+};
+
+/* EogView interface implementation */
+
+static void     eog_clutter_view_class_init (EogClutterViewClass *klass);
+static void     eog_clutter_view_iface_init (EogViewClass *iface);
+static void     eog_clutter_view_init (EogClutterView *clutter_view);
+static void     eog_clutter_view_dispose (GObject *object);
+/* static void     eog_clutter_view_finalize (GObject *object); */
+
+/* loading stuff */
+static void     eog_clutter_view_set_image        (EogView *view, EogImage *image);
+
+/* general properties */
+static void     eog_clutter_view_set_scroll_wheel_zoom (EogView *view, gboolean scroll_wheel_zoom);
+static void     eog_clutter_view_set_zoom_upscale      (EogView *view, gboolean upscale);
+static void     eog_clutter_view_set_zoom_multiplier   (EogView *view, gdouble multiplier);
+static void     eog_clutter_view_set_antialiasing_in   (EogView *view, gboolean state);
+static void     eog_clutter_view_set_antialiasing_out  (EogView *view, gboolean state);
+static void     eog_clutter_view_set_transparency      (EogView *view, EogTransparencyStyle style, GdkColor *color);
+static gboolean eog_clutter_view_scrollbars_visible    (EogView *view);
+static void	eog_clutter_view_set_popup             (EogView *view, GtkMenu *menu);
+static void     eog_clutter_view_set_bg_color          (EogView *view, GdkColor *color);
+
+/* zoom api */
+static void     eog_clutter_view_zoom_in          (EogView *view, gboolean smooth);
+static void     eog_clutter_view_zoom_out         (EogView *view, gboolean smooth);
+static void     eog_clutter_view_zoom_fit         (EogView *view);
+static void     eog_clutter_view_set_zoom         (EogView *view, double zoom);
+static double   eog_clutter_view_get_zoom         (EogView *view);
+static gboolean eog_clutter_view_get_zoom_is_min  (EogView *view);
+static gboolean eog_clutter_view_get_zoom_is_max  (EogView *view);
+static void     eog_clutter_view_show_cursor      (EogView *view);
+static void     eog_clutter_view_hide_cursor      (EogView *view);
+
+static gint     eog_clutter_view_expose           (GtkWidget *view, GdkEventExpose *event);
+
+static void switch_timeline_completed_cb (ClutterTimeline *timeline, gpointer user_data);
+static void eog_clutter_view_place_texture (EogClutterView *clutter_view, ClutterTexture *texture);
+
+#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_IMPLEMENT_INTERFACE (EOG_TYPE_VIEW,
+						eog_clutter_view_iface_init))
+
+static void
+eog_clutter_view_class_init (EogClutterViewClass *klass)
+{
+	GObjectClass *gobject_class;
+	GtkWidgetClass *widget_class;
+
+	gobject_class = G_OBJECT_CLASS (klass);
+	widget_class = GTK_WIDGET_CLASS (klass);
+
+	gobject_class->dispose = eog_clutter_view_dispose;
+	/* gobject_class->finalize = eog_clutter_view_finalize; */
+
+	widget_class->expose_event = eog_clutter_view_expose;
+
+	g_type_class_add_private (klass, sizeof (EogClutterViewPrivate));
+}
+
+static void
+eog_clutter_view_iface_init (EogViewClass *iface)
+{
+	iface->set_image = eog_clutter_view_set_image;
+	iface->set_scroll_wheel_zoom = eog_clutter_view_set_scroll_wheel_zoom;
+	iface->set_zoom_upscale = eog_clutter_view_set_zoom_upscale;
+	iface->set_zoom_multiplier = eog_clutter_view_set_zoom_multiplier;
+	iface->set_antialiasing_in = eog_clutter_view_set_antialiasing_in;
+	iface->set_antialiasing_out = eog_clutter_view_set_antialiasing_out;
+	iface->set_transparency = eog_clutter_view_set_transparency;
+	iface->scrollbars_visible = eog_clutter_view_scrollbars_visible;
+	iface->set_popup = eog_clutter_view_set_popup;
+	iface->set_bg_color = eog_clutter_view_set_bg_color;
+	iface->zoom_in = eog_clutter_view_zoom_in;
+	iface->zoom_out = eog_clutter_view_zoom_out;
+	iface->zoom_fit = eog_clutter_view_zoom_fit;
+	iface->set_zoom = eog_clutter_view_set_zoom;
+	iface->get_zoom = eog_clutter_view_get_zoom;
+	iface->get_zoom_is_max = eog_clutter_view_get_zoom_is_max;
+	iface->get_zoom_is_min = eog_clutter_view_get_zoom_is_min;
+	iface->show_cursor = eog_clutter_view_show_cursor;
+	iface->hide_cursor = eog_clutter_view_hide_cursor;
+}
+
+static void
+eog_clutter_view_init (EogClutterView *clutter_view)
+{
+	EogClutterViewPrivate *priv;
+	ClutterAlpha *alpha_in, *alpha_out;
+
+	clutter_view->priv = priv = EOG_CLUTTER_VIEW_GET_PRIVATE (clutter_view);
+
+	priv->stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter_view));
+
+	eog_clutter_view_set_bg_color (EOG_VIEW (clutter_view), NULL);
+
+	priv->image = NULL;
+	priv->texture = NULL;
+	priv->texture_in = NULL;
+
+	priv->timeline = clutter_timeline_new (15, 30);
+	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);
+
+	priv->behaviour_in = clutter_behaviour_opacity_new (alpha_in, 0x00, 0xFF);
+	priv->behaviour_out = clutter_behaviour_opacity_new (alpha_out, 0x00, 0xFF);
+
+	priv->zoom_multiplier = IMAGE_VIEW_ZOOM_MULTIPLIER;
+	priv->zoom = 1.0;
+}
+
+GtkWidget *
+eog_clutter_view_new (void)
+{
+	EogClutterView *view;
+
+	view = g_object_new (EOG_TYPE_CLUTTER_VIEW,
+			     NULL);
+
+	return GTK_WIDGET (view);
+}
+
+static void
+eog_clutter_view_dispose (GObject *object)
+{
+	EogClutterView *view;
+	EogClutterViewPrivate *priv;
+
+	g_return_if_fail (EOG_IS_CLUTTER_VIEW (object));
+
+	view = EOG_CLUTTER_VIEW (object);
+	priv = view->priv;
+
+	if (priv->image) {
+		g_object_unref (priv->image);
+		priv->image = NULL;
+	}
+
+	if (priv->timeline) {
+		g_object_unref (priv->timeline);
+		priv->timeline = NULL;
+	}
+
+	G_OBJECT_CLASS (eog_clutter_view_parent_class)->dispose (object);
+}
+
+#if 0
+static void
+eog_clutter_view_finalize (GObject *object)
+{
+	EogClutterView *view;
+	EogClutterViewPrivate *priv;
+
+	g_return_if_fail (EOG_IS_CLUTTER_VIEW (object));
+
+	view = EOG_CLUTTER_VIEW (object);
+	priv = view->priv;
+}
+#endif
+
+static gint
+eog_clutter_view_expose (GtkWidget *widget, GdkEventExpose *event)
+{
+	EogClutterView *view;
+
+	view = EOG_CLUTTER_VIEW (widget);
+
+	if (view->priv->texture) {
+		eog_clutter_view_place_texture (view, CLUTTER_TEXTURE (view->priv->texture));
+	}
+
+	if (GTK_WIDGET_CLASS (eog_clutter_view_parent_class)->expose_event) {
+		return GTK_WIDGET_CLASS (eog_clutter_view_parent_class)->expose_event (widget, event);
+	}
+
+	return FALSE;
+}
+
+static void
+eog_clutter_view_place_texture (EogClutterView *clutter_view, ClutterTexture *texture)
+{
+	EogClutterViewPrivate *priv;
+	GdkPixbuf *pixbuf;
+	gint width, height, stage_width, stage_height, x, y;
+
+	priv = clutter_view->priv;
+
+	pixbuf = eog_image_get_pixbuf (priv->image);
+
+	stage_width = clutter_actor_get_width (priv->stage);
+	stage_height = clutter_actor_get_height (priv->stage);
+
+	width = gdk_pixbuf_get_width (pixbuf);
+	height = gdk_pixbuf_get_height (pixbuf);
+	g_object_unref (pixbuf);
+
+	width *= priv->zoom;
+	height *= priv->zoom;
+
+	clutter_actor_set_size (CLUTTER_ACTOR (texture), width, height);
+
+	x = (stage_width - width)/2;
+	y = (stage_height - height)/2;
+
+	clutter_actor_set_position (CLUTTER_ACTOR (texture),
+				    x, y);
+}
+
+static void
+eog_clutter_view_set_zoom_fit (EogClutterView *clutter_view)
+{
+	EogClutterViewPrivate *priv;
+	gint stage_width, stage_height;
+	gint width, height;
+
+	priv = clutter_view->priv;
+
+	stage_width = clutter_actor_get_width (priv->stage);
+	stage_height = clutter_actor_get_height (priv->stage);
+
+	eog_image_get_size (priv->image, &width, &height);
+
+	priv->zoom = zoom_fit_scale (stage_width, stage_height,
+				     width, height, FALSE);
+}
+
+static void
+eog_clutter_view_set_image (EogView *view, EogImage *image)
+{
+	EogClutterView *clutter_view;
+	EogClutterViewPrivate *priv;
+	GdkPixbuf *pixbuf;
+
+	g_return_if_fail (EOG_IS_CLUTTER_VIEW (view));
+
+	clutter_view = EOG_CLUTTER_VIEW (view);
+	priv = clutter_view->priv;
+
+	if (priv->image == image) {
+		return;
+	}
+
+	if (priv->image) {
+		eog_image_data_unref (priv->image);
+		g_object_unref (priv->image);
+		priv->image = NULL;
+	}
+
+	if (image) {
+		priv->image = g_object_ref (image);
+		eog_image_data_ref (priv->image);
+
+		if (priv->texture_in == NULL) {
+			priv->texture_in = clutter_texture_new ();
+			clutter_container_add_actor (CLUTTER_CONTAINER (priv->stage), priv->texture_in);
+		}
+
+		pixbuf = eog_image_get_pixbuf (priv->image);
+		gtk_clutter_texture_set_from_pixbuf (CLUTTER_TEXTURE (priv->texture_in), pixbuf);
+		g_object_unref (pixbuf);
+
+		eog_clutter_view_set_zoom_fit (clutter_view);
+		eog_clutter_view_place_texture (clutter_view, CLUTTER_TEXTURE (priv->texture_in));
+
+		clutter_behaviour_apply (priv->behaviour_in, priv->texture_in);
+		clutter_actor_set_opacity (priv->texture_in, 0);
+
+		clutter_actor_show (priv->texture_in);
+	}
+
+	if (priv->texture) {
+		clutter_behaviour_apply (priv->behaviour_out, priv->texture);
+	}
+
+	clutter_timeline_rewind (priv->timeline);
+	clutter_timeline_start (priv->timeline);
+}
+
+static void
+eog_clutter_view_set_scroll_wheel_zoom (EogView *view, gboolean scroll_wheel_zoom)
+{
+
+}
+
+static void
+eog_clutter_view_set_zoom_upscale (EogView *view, gboolean upscale)
+{
+
+}
+
+static void
+eog_clutter_view_set_zoom_multiplier (EogView *view, gdouble multiplier)
+{
+
+}
+
+static void
+eog_clutter_view_set_antialiasing_in (EogView *view, gboolean state)
+{
+
+}
+
+static void
+eog_clutter_view_set_antialiasing_out (EogView *view, gboolean state)
+{
+
+}
+
+static void
+eog_clutter_view_set_transparency (EogView *view, EogTransparencyStyle style, GdkColor *color)
+{
+
+}
+
+static gboolean
+eog_clutter_view_scrollbars_visible (EogView *view)
+{
+	return FALSE;
+}
+
+static void
+eog_clutter_view_set_popup (EogView *view, GtkMenu *menu)
+{
+
+}
+
+static void
+eog_clutter_view_set_bg_color (EogView *view,
+			       GdkColor *color)
+{
+	EogClutterViewPrivate *priv;
+	ClutterColor clutter_color;
+
+	g_return_if_fail (EOG_IS_CLUTTER_VIEW (view));
+
+	priv = EOG_CLUTTER_VIEW_GET_PRIVATE (view);
+
+	if (color == NULL) {
+		clutter_color.red   = GTK_WIDGET (view)->style->bg[GTK_STATE_NORMAL].red;
+		clutter_color.green = GTK_WIDGET (view)->style->bg[GTK_STATE_NORMAL].green;
+		clutter_color.blue  = GTK_WIDGET (view)->style->bg[GTK_STATE_NORMAL].blue;
+	} else {
+		clutter_color.red   = color->red;
+		clutter_color.green = color->green;
+		clutter_color.blue  = color->blue;
+	}
+
+	clutter_stage_set_color (CLUTTER_STAGE (priv->stage), &clutter_color);
+}
+
+static void
+eog_clutter_view_zoom_in (EogView *view, gboolean smooth)
+{
+
+}
+
+static void
+eog_clutter_view_zoom_out (EogView *view, gboolean smooth)
+{
+
+}
+
+static void
+eog_clutter_view_zoom_fit (EogView *view)
+{
+	g_return_if_fail (EOG_IS_CLUTTER_VIEW (view));
+
+	eog_clutter_view_set_zoom_fit (EOG_CLUTTER_VIEW (view));
+}
+
+static void
+eog_clutter_view_set_zoom (EogView *view, double zoom)
+{
+
+}
+
+static double
+eog_clutter_view_get_zoom (EogView *view)
+{
+	g_return_val_if_fail (EOG_IS_CLUTTER_VIEW (view), 0.);
+
+	return EOG_CLUTTER_VIEW (view)->priv->zoom;
+}
+
+static gboolean
+eog_clutter_view_get_zoom_is_min (EogView *view)
+{
+	return FALSE;
+}
+
+static gboolean
+eog_clutter_view_get_zoom_is_max (EogView *view)
+{
+	return FALSE;
+}
+
+static void
+eog_clutter_view_show_cursor (EogView *view)
+{
+
+}
+
+static void
+eog_clutter_view_hide_cursor (EogView *view)
+{
+
+}
+
+static void
+switch_timeline_completed_cb (ClutterTimeline *timeline,
+			      gpointer user_data)
+{
+	EogClutterView *view;
+	EogClutterViewPrivate *priv;
+	ClutterActor *tmp_texture;
+
+	g_return_if_fail (EOG_IS_CLUTTER_VIEW (user_data));
+
+	view = EOG_CLUTTER_VIEW (user_data);
+	priv = view->priv;
+
+	clutter_behaviour_remove_all (priv->behaviour_in);
+	clutter_behaviour_remove_all (priv->behaviour_out);
+
+	tmp_texture =  priv->texture;
+	priv->texture = priv->texture_in;
+	priv->texture_in = tmp_texture;
+}
diff --git a/src/eog-clutter-view.h b/src/eog-clutter-view.h
new file mode 100644
index 0000000..75da886
--- /dev/null
+++ b/src/eog-clutter-view.h
@@ -0,0 +1,55 @@
+/* Eye of GNOME -- Clutter Powered Image Viewing Widget
+ *
+ * Copyright (C) 2008 The Free Software Foundation
+ *
+ * Author: Claudio Saavedra  <csaavedra gnome org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _EOG_CLUTTER_VIEW_H_
+#define _EOG_CLUTTER_VIEW_H_
+
+#include <clutter/clutter.h>
+#include <clutter-gtk/gtk-clutter-embed.h>
+
+G_BEGIN_DECLS
+
+typedef struct _EogClutterView EogClutterView;
+typedef struct _EogClutterViewClass EogClutterViewClass;
+typedef struct _EogClutterViewPrivate EogClutterViewPrivate;
+
+#define EOG_TYPE_CLUTTER_VIEW              (eog_clutter_view_get_type ())
+#define EOG_CLUTTER_VIEW(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), EOG_TYPE_CLUTTER_VIEW, EogClutterView))
+#define EOG_CLUTTER_VIEW_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), EOG_TYPE_CLUTTER_VIEW, EogClutterViewClass))
+#define EOG_IS_CLUTTER_VIEW(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EOG_TYPE_CLUTTER_VIEW))
+#define EOG_IS_CLUTTER_VIEW_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), EOG_TYPE_CLUTTER_VIEW))
+
+struct _EogClutterView {
+	GtkClutterEmbed widget;
+
+	EogClutterViewPrivate *priv;
+};
+
+struct _EogClutterViewClass {
+	GtkClutterEmbedClass parent_class;
+};
+
+GType eog_clutter_view_get_type (void) G_GNUC_CONST;
+GtkWidget *eog_clutter_view_new (void);
+
+G_END_DECLS
+
+#endif /* _EOG_CLUTTER_VIEW_H_ */
diff --git a/src/eog-window.c b/src/eog-window.c
index c9462cc..34b89a8 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -34,6 +34,11 @@
 #include "eog-window.h"
 #include "eog-scroll-view.h"
 #include "eog-view.h"
+#ifdef WITH_CLUTTER_BACKEND
+#include "eog-clutter-view.h"
+#else
+#include "eog-scroll-view.h"
+#endif
 #include "eog-debug.h"
 #include "eog-file-chooser.h"
 #include "eog-thumb-view.h"
@@ -4205,7 +4210,11 @@ eog_window_construct_ui (EogWindow *window)
 				G_CALLBACK (eog_window_sidebar_page_removed),
 				window);
 
- 	priv->view = eog_scroll_view_new ();
+#ifdef WITH_CLUTTER_BACKEND
+	priv->view = eog_clutter_view_new ();
+#else
+	priv->view = eog_scroll_view_new ();
+#endif
 	gtk_widget_set_size_request (GTK_WIDGET (priv->view), 100, 100);
 	g_signal_connect (G_OBJECT (priv->view),
 			  "zoom_changed",
@@ -4214,7 +4223,7 @@ eog_window_construct_ui (EogWindow *window)
 
 	view_popup = gtk_ui_manager_get_widget (priv->ui_mgr, "/ViewPopup");
 	eog_view_set_popup (EOG_VIEW (priv->view),
-				   GTK_MENU (view_popup));
+			    GTK_MENU (view_popup));
 
 	frame = gtk_widget_new (GTK_TYPE_FRAME,
 				"shadow-type", GTK_SHADOW_IN,
@@ -4232,8 +4241,6 @@ eog_window_construct_ui (EogWindow *window)
 			 TRUE,
 			 FALSE);
 
-	gtk_widget_show_all (hpaned);
-
 	gtk_box_pack_start (GTK_BOX (priv->layout), hpaned, TRUE, TRUE, 0);
 
 	priv->thumbview = eog_thumb_view_new ();
@@ -4259,6 +4266,7 @@ eog_window_construct_ui (EogWindow *window)
 
 	gtk_box_pack_end (GTK_BOX (priv->cbox), priv->layout, TRUE, TRUE, 0);
 
+	gtk_widget_show_all (hpaned);
 
 	entry = gconf_client_get_entry (priv->client,
 					EOG_CONF_VIEW_EXTRAPOLATE,
diff --git a/src/main.c b/src/main.c
index f1e746d..bdf1f30 100644
--- a/src/main.c
+++ b/src/main.c
@@ -47,6 +47,9 @@
 #if HAVE_EXEMPI
 #include <exempi/xmp.h>
 #endif
+#ifdef WITH_CLUTTER_BACKEND
+#include <clutter/clutter.h>
+#endif
 
 static EogStartupFlags flags;
 
@@ -216,6 +219,10 @@ main (int argc, char **argv)
 	}
 #endif /* HAVE_DBUS */
 
+#ifdef WITH_CLUTTER_BACKEND
+	gtk_clutter_init (&argc, &argv);
+#endif
+
 #ifdef HAVE_EXEMPI
  	xmp_init();
 #endif



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