diff --git a/Makefile.am b/Makefile.am
index ba5e54dd5..c8b3de923 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,7 @@ include $(top_srcdir)/build/autotools/Makefile.am.silent
NULL =
-SUBDIRS = clutter tests doc po build
+SUBDIRS = clutter tests examples doc po build
# XXX - this is a massive hack to make autoreconf honour the ACLOCAL_FLAGS
# that jhbuild sets while still retaining build/autotools as the authoritative
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 025d1a147..56b13d38e 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -105,7 +105,7 @@
* of children from a ClutterActor, use the #ClutterContainer::actor-removed
* signal.
*
- *
+ *
* FIXME: MISSING XINCLUDE CONTENT
*
*
diff --git a/clutter/clutter-bin-layout.c b/clutter/clutter-bin-layout.c
index f8245b14b..8ba2157e8 100644
--- a/clutter/clutter-bin-layout.c
+++ b/clutter/clutter-bin-layout.c
@@ -52,7 +52,7 @@
*
* How to pack actors inside a BinLayout
*
- *
+ *
* FIXME: MISSING XINCLUDE CONTENT
*
*
diff --git a/clutter/clutter-bind-constraint.c b/clutter/clutter-bind-constraint.c
index 51b3e35ef..c645873e3 100644
--- a/clutter/clutter-bind-constraint.c
+++ b/clutter/clutter-bind-constraint.c
@@ -80,7 +80,7 @@
*
* Animating the offset property of ClutterBindConstraint
*
- *
+ *
* FIXME: MISSING XINCLUDE CONTENT
*
*
diff --git a/clutter/clutter-canvas.c b/clutter/clutter-canvas.c
index 4e6e76621..de2948999 100644
--- a/clutter/clutter-canvas.c
+++ b/clutter/clutter-canvas.c
@@ -38,7 +38,7 @@
*
*
*
- *
+ *
* FIXME: MISSING XINCLUDE CONTENT
*
*
diff --git a/clutter/clutter-constraint.c b/clutter/clutter-constraint.c
index 61f6fc6c4..9b481b572 100644
--- a/clutter/clutter-constraint.c
+++ b/clutter/clutter-constraint.c
@@ -91,7 +91,9 @@
*
*
*
- *FIXME: MISSING XINCLUDE CONTENT
+ *
+ * FIXME: MISSING XINCLUDE CONTENT
+ *
*
* You can try resizing interactively the #ClutterStage and verify
* that the three #ClutterActors maintain the same position and
diff --git a/clutter/clutter-drag-action.c b/clutter/clutter-drag-action.c
index 0de8c9962..cd25ecd69 100644
--- a/clutter/clutter-drag-action.c
+++ b/clutter/clutter-drag-action.c
@@ -57,7 +57,7 @@
*
* A simple draggable actor
*
- *
+ *
* FIXME: MISSING XINCLUDE CONTENT
*
*
diff --git a/clutter/clutter-drop-action.c b/clutter/clutter-drop-action.c
index 90b238fb9..e91a3cdcc 100644
--- a/clutter/clutter-drop-action.c
+++ b/clutter/clutter-drop-action.c
@@ -52,7 +52,7 @@
*
* Drop targets
*
- *
+ *
* FIXME: MISSING XINCLUDE CONTENT
*
*
diff --git a/clutter/clutter-image.c b/clutter/clutter-image.c
index d1c766a66..95d88b27a 100644
--- a/clutter/clutter-image.c
+++ b/clutter/clutter-image.c
@@ -31,7 +31,7 @@
* image data.
*
*
- *
+ *
* FIXME: MISSING XINCLUDE CONTENT
*
*
diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c
index a412f67f6..7e4bef8c2 100644
--- a/clutter/clutter-main.c
+++ b/clutter/clutter-main.c
@@ -81,7 +81,7 @@
*
* A worker thread example
*
- *
+ *
* FIXME: MISSING XINCLUDE CONTENT
*
*
diff --git a/configure.ac b/configure.ac
index 686505e90..18b792380 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1121,6 +1121,8 @@ AC_CONFIG_FILES([
tests/micro-bench/Makefile
tests/performance/Makefile
+ examples/Makefile
+
doc/Makefile
doc/reference/Makefile
doc/reference/clutter/Makefile
diff --git a/examples/Makefile.am b/examples/Makefile.am
new file mode 100644
index 000000000..3f46d21bd
--- /dev/null
+++ b/examples/Makefile.am
@@ -0,0 +1,39 @@
+include $(top_srcdir)/build/autotools/Makefile.am.silent
+
+all_examples = \
+ basic-actor \
+ bind-constraint \
+ canvas \
+ constraints \
+ drag-action \
+ drop-action \
+ threads
+
+if PIXBUF_TESTS
+all_examples += \
+ bin-layout \
+ image-content
+endif
+
+INCLUDES = \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/clutter \
+ -I$(top_builddir)/clutter
+
+LDADD = \
+ $(top_builddir)/clutter/libclutter-@CLUTTER_API_VERSION@.la \
+ $(CLUTTER_LIBS) \
+ $(GDK_PIXBUF_LIBS) \
+ -lm
+
+AM_CFLAGS = $(CLUTTER_CFLAGS) $(GDK_PIXBUF_CFLAGS)
+
+AM_CPPFLAGS = \
+ -DTESTS_DATADIR=\""$(abs_top_srcdir)/tests/data"\" \
+ -DG_DISABLE_SINGLE_INCLUDES \
+ -DGLIB_DISABLE_DEPRECATION_WARNINGS \
+ -DCLUTTER_DISABLE_DEPRECATION_WARNINGS
+
+noinst_PROGRAMS = $(all_examples)
+
+-include $(top_srcdir)/build/autotools/Makefile.am.gitignore
diff --git a/examples/README b/examples/README
new file mode 100644
index 000000000..d3e35564f
--- /dev/null
+++ b/examples/README
@@ -0,0 +1,10 @@
+The code in this directory is meant to be XIncluded into the Clutter API
+reference, and thus is to be considered part of the Clutter documentation.
+
+As such, the code MUST be:
+
+ - correct;
+ - idiomatic, i.e. show how a task is meant to be achieved using the
+ best possible practices given the current API;
+ - well documented;
+ - ready for copy and paste.
diff --git a/tests/interactive/test-actor.c b/examples/basic-actor.c
similarity index 96%
rename from tests/interactive/test-actor.c
rename to examples/basic-actor.c
index 9801fc105..577822336 100644
--- a/tests/interactive/test-actor.c
+++ b/examples/basic-actor.c
@@ -1,5 +1,4 @@
#include
-#include
#include
#define SIZE 128
@@ -84,8 +83,8 @@ animate_rotation (ClutterActor *actor,
return CLUTTER_EVENT_STOP;
}
-G_MODULE_EXPORT int
-test_actor_main (int argc, char *argv[])
+int
+main (int argc, char *argv[])
{
ClutterActor *stage, *vase;
ClutterActor *flowers[3];
@@ -152,9 +151,3 @@ test_actor_main (int argc, char *argv[])
return EXIT_SUCCESS;
}
-
-G_MODULE_EXPORT const char *
-test_actor_describe (void)
-{
- return "Basic example of actor usage.";
-}
diff --git a/tests/interactive/test-bin-layout.c b/examples/bin-layout.c
similarity index 98%
rename from tests/interactive/test-bin-layout.c
rename to examples/bin-layout.c
index 807d5f249..048f3b4c9 100644
--- a/tests/interactive/test-bin-layout.c
+++ b/examples/bin-layout.c
@@ -1,5 +1,4 @@
#include
-#include
#include
#include
#include
@@ -160,8 +159,8 @@ redraw_canvas (ClutterActor *actor,
clutter_actor_get_height (actor));
}
-G_MODULE_EXPORT int
-test_bin_layout_main (int argc, char *argv[])
+int
+main (int argc, char *argv[])
{
ClutterActor *stage, *box, *bg, *icon, *emblem, *label;
ClutterLayoutManager *layout;
@@ -306,9 +305,3 @@ test_bin_layout_main (int argc, char *argv[])
return EXIT_SUCCESS;
}
-
-G_MODULE_EXPORT const char *
-test_bin_layout_describe (void)
-{
- return "BinLayout layout manager example";
-}
diff --git a/tests/interactive/test-constraints.c b/examples/bind-constraint.c
similarity index 97%
rename from tests/interactive/test-constraints.c
rename to examples/bind-constraint.c
index 172ba9b72..4278e1821 100644
--- a/tests/interactive/test-constraints.c
+++ b/examples/bind-constraint.c
@@ -1,5 +1,4 @@
#include
-#include
#include
#define RECT_SIZE 128
@@ -155,8 +154,8 @@ on_button_release (ClutterActor *actor,
return TRUE;
}
-G_MODULE_EXPORT int
-test_constraints_main (int argc, char *argv[])
+int
+main (int argc, char *argv[])
{
ClutterActor *stage, *rect;
ClutterConstraint *constraint;
@@ -245,9 +244,3 @@ test_constraints_main (int argc, char *argv[])
return EXIT_SUCCESS;
}
-
-G_MODULE_EXPORT const char *
-test_constraints_describe (void)
-{
- return "Visualize usage of Bind and Align constraints";
-}
diff --git a/tests/interactive/test-canvas.c b/examples/canvas.c
similarity index 95%
rename from tests/interactive/test-canvas.c
rename to examples/canvas.c
index 01f11c9e1..c4e2aa3cc 100644
--- a/tests/interactive/test-canvas.c
+++ b/examples/canvas.c
@@ -80,8 +80,8 @@ invalidate_clock (gpointer data_)
return TRUE;
}
-G_MODULE_EXPORT int
-test_canvas_main (int argc, char *argv[])
+int
+main (int argc, char *argv[])
{
ClutterActor *stage, *actor;
ClutterContent *canvas;
@@ -131,9 +131,3 @@ test_canvas_main (int argc, char *argv[])
return EXIT_SUCCESS;
}
-
-G_MODULE_EXPORT const char *
-test_canvas_describe (void)
-{
- return "Simple 2D clock using the Canvas content";
-}
diff --git a/tests/interactive/test-snap-constraint.c b/examples/constraints.c
similarity index 97%
rename from tests/interactive/test-snap-constraint.c
rename to examples/constraints.c
index 6a492d1f8..532eb3243 100644
--- a/tests/interactive/test-snap-constraint.c
+++ b/examples/constraints.c
@@ -1,11 +1,8 @@
#include
-#include
-
#include
-G_MODULE_EXPORT int
-test_snap_constraint_main (int argc,
- char *argv[])
+int
+main (int argc, char *argv[])
{
ClutterActor *stage, *layer_a, *layer_b, *layer_c;
diff --git a/tests/interactive/test-drag.c b/examples/drag-action.c
similarity index 98%
rename from tests/interactive/test-drag.c
rename to examples/drag-action.c
index 05bc5cdb0..ee5a83966 100644
--- a/tests/interactive/test-drag.c
+++ b/examples/drag-action.c
@@ -1,5 +1,4 @@
#include
-#include
#include
static gboolean
@@ -148,8 +147,8 @@ static GOptionEntry entries[] = {
{ NULL }
};
-G_MODULE_EXPORT int
-test_drag_main (int argc, char *argv[])
+int
+main (int argc, char *argv[])
{
ClutterActor *stage, *handle;
ClutterAction *action;
diff --git a/tests/interactive/test-drop.c b/examples/drop-action.c
similarity index 98%
rename from tests/interactive/test-drop.c
rename to examples/drop-action.c
index 0427b02e0..f14d145d4 100644
--- a/tests/interactive/test-drop.c
+++ b/examples/drop-action.c
@@ -169,8 +169,8 @@ on_target_drop (ClutterDropAction *action,
add_drag_object (actor);
}
-G_MODULE_EXPORT int
-test_drop_main (int argc, char *argv[])
+int
+main (int argc, char *argv[])
{
ClutterActor *dummy;
@@ -243,9 +243,3 @@ test_drop_main (int argc, char *argv[])
return EXIT_SUCCESS;
}
-
-G_MODULE_EXPORT const char *
-test_drop_describe (void)
-{
- return "Drop action support";
-}
diff --git a/tests/interactive/test-image-box.c b/examples/image-content.c
similarity index 95%
rename from tests/interactive/test-image-box.c
rename to examples/image-content.c
index c4b8244ff..2c7ad6d71 100644
--- a/tests/interactive/test-image-box.c
+++ b/examples/image-content.c
@@ -1,5 +1,4 @@
#include
-#include
#include
#include
@@ -47,14 +46,8 @@ on_clicked (ClutterClickAction *action,
cur_gravity = 0;
}
-G_MODULE_EXPORT const char *
-test_image_box_describe (void)
-{
- return "A test with image content.";
-}
-
-G_MODULE_EXPORT int
-test_image_box_main (int argc, char *argv[])
+int
+main (int argc, char *argv[])
{
ClutterActor *stage, *box, *text;
ClutterContent *image;
diff --git a/tests/interactive/test-threads.c b/examples/threads.c
similarity index 97%
rename from tests/interactive/test-threads.c
rename to examples/threads.c
index 31baa8832..e0fd6a89f 100644
--- a/tests/interactive/test-threads.c
+++ b/examples/threads.c
@@ -1,6 +1,5 @@
#include
#include
-#include
#include
/* our thread-specific data */
@@ -195,8 +194,8 @@ on_key_press_event (ClutterStage *stage,
return FALSE;
}
-G_MODULE_EXPORT int
-test_threads_main (int argc, char *argv[])
+int
+main (int argc, char *argv[])
{
ClutterActor *stage;
ClutterActor *rect;
@@ -273,9 +272,3 @@ test_threads_main (int argc, char *argv[])
return EXIT_SUCCESS;
}
-
-const char *
-test_threads_describe (void)
-{
- return "Multi-threading programming with Clutter";
-}
diff --git a/tests/interactive/Makefile.am b/tests/interactive/Makefile.am
index 72b545dbf..3669c3641 100644
--- a/tests/interactive/Makefile.am
+++ b/tests/interactive/Makefile.am
@@ -8,8 +8,6 @@ UNIT_TESTS = \
test-scale.c \
test-actors.c \
test-shader-effects.c \
- test-depth.c \
- test-threads.c \
test-script.c \
test-grab.c \
test-cogl-shader-arbfp.c \
@@ -43,21 +41,15 @@ UNIT_TESTS = \
test-flow-layout.c \
test-box-layout.c \
test-stage-sizing.c \
- test-drag.c \
- test-constraints.c \
test-scrolling.c \
test-swipe-action.c \
test-cogl-point-sprites.c \
test-table-layout.c \
test-path-constraint.c \
- test-snap-constraint.c \
test-state-script.c \
- test-drop.c \
test-devices.c \
- test-actor.c \
test-transitions.c \
test-content.c \
- test-canvas.c \
test-keyframe-transition.c \
test-scroll-actor.c
@@ -67,9 +59,7 @@ endif
if PIXBUF_TESTS
UNIT_TESTS += \
- test-bin-layout.c \
- test-image.c \
- test-image-box.c
+ test-image.c
endif
if OS_WIN32