summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@openedhand.com>2008-04-21 15:06:30 +0000
committerEmmanuele Bassi <ebassi@openedhand.com>2008-04-21 15:06:30 +0000
commit8d35a251859de3b9052665d7149430d8c4cb75c4 (patch)
tree2201923bc3ed250e1928defeffbe0129a007e9e5 /examples
parent8c75c4535a2ab9578b1d42684d102f2882072610 (diff)
downloadclutter-gtk-8d35a251859de3b9052665d7149430d8c4cb75c4.tar.gz
2008-04-21 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-gtk/gtk-clutter-util.h: * clutter-gtk/gtk-clutter-util.c: (gtk_clutter_texture_new_from_pixbuf), (gtk_clutter_texture_new_from_stock), (gtk_clutter_texture_new_from_icon_name): Add utility functions to create a ClutterTexture from a Pixbuf (to replace the clutter_texture_from_pixbuf() call when it will be removed from Clutter core); from a stock id; and from an icon name. * examples/Makefile.am: Clean up. * examples/gtk-clutter-events.c: * examples/gtk-clutter-multistage.c: Use the new utility API.
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile.am39
-rw-r--r--examples/gtk-clutter-events.c2
-rw-r--r--examples/gtk-clutter-multistage.c26
3 files changed, 38 insertions, 29 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 8e4855e..87d7740 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,33 +1,34 @@
-noinst_PROGRAMS = gtk-clutter-test gtk-clutter-events gtk-clutter-multistage
+NULL =
+
+noinst_PROGRAMS = \
+ gtk-clutter-test \
+ gtk-clutter-events \
+ gtk-clutter-multistage
INCLUDES = \
-I$(srcdir) \
- -I$(top_srcdir) \
- $(CLUTTER_CFLAGS) \
- $(GTK_CFLAGS)
+ -I$(top_srcdir)
+
+AM_CPPFLAGS = $(CLUTTER_CFLAGS) $(GTK_CFLAGS)
-gtk_clutter_test_DEPENDENCIES = \
+common_deps = \
$(top_builddir)/clutter-gtk/libclutter-gtk-0.7.la
-gtk_clutter_test_SOURCES = gtk-clutter-test.c
-gtk_clutter_test_LDADD = \
+
+common_ldadd = \
$(top_builddir)/clutter-gtk/libclutter-gtk-0.7.la \
$(CLUTTER_LIBS) \
$(GTK_LIBS)
-gtk_clutter_events_DEPENDENCIES = \
- $(top_builddir)/clutter-gtk/libclutter-gtk-0.7.la
+gtk_clutter_test_SOURCES = gtk-clutter-test.c
+gtk_clutter_test_DEPENDENCIES = $(common_deps)
+gtk_clutter_test_LDADD = $(common_ldadd)
+
gtk_clutter_events_SOURCES = gtk-clutter-events.c
-gtk_clutter_events_LDADD = \
- $(top_builddir)/clutter-gtk/libclutter-gtk-0.7.la \
- $(CLUTTER_LIBS) \
- $(GTK_LIBS)
+gtk_clutter_events_DEPENDENCIES = $(common_deps)
+gtk_clutter_events_LDADD = $(common_ldadd)
-gtk_clutter_multistage_DEPENDENCIES = \
- $(top_builddir)/clutter-gtk/libclutter-gtk-0.7.la
gtk_clutter_multistage_SOURCES = gtk-clutter-multistage.c
-gtk_clutter_multistage_LDADD = \
- $(top_builddir)/clutter-gtk/libclutter-gtk-0.7.la \
- $(CLUTTER_LIBS) \
- $(GTK_LIBS)
+gtk_clutter_multistage_DEPENDENCIES = $(common_deps)
+gtk_clutter_multistage_LDADD = $(common_ldadd)
EXTRA_DIST = redhand.png
diff --git a/examples/gtk-clutter-events.c b/examples/gtk-clutter-events.c
index 43a9b29..3143bc9 100644
--- a/examples/gtk-clutter-events.c
+++ b/examples/gtk-clutter-events.c
@@ -148,7 +148,7 @@ main (gint argc, gchar **argv)
if (pixbuf == NULL)
g_error ("Unable to load pixbuf\n");
- actor = clutter_texture_new_from_pixbuf (pixbuf);
+ actor = gtk_clutter_texture_new_from_pixbuf (pixbuf);
app->hand = actor;
clutter_group_add (CLUTTER_GROUP (app->stage), actor);
clutter_actor_get_size (actor, &width, &height);
diff --git a/examples/gtk-clutter-multistage.c b/examples/gtk-clutter-multistage.c
index 292a9fc..34abe32 100644
--- a/examples/gtk-clutter-multistage.c
+++ b/examples/gtk-clutter-multistage.c
@@ -1,6 +1,8 @@
#include <gtk/gtk.h>
#include <clutter/clutter.h>
+
#include <clutter-gtk/gtk-clutter-embed.h>
+#include <clutter-gtk/gtk-clutter-util.h>
int
main (int argc, char *argv[])
@@ -18,14 +20,6 @@ main (int argc, char *argv[])
if (gtk_clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
g_error ("Unable to initialize GtkClutter");
- pixbuf = gdk_pixbuf_new_from_file ("redhand.png", NULL);
-
- if (!pixbuf)
- g_error("pixbuf load failed");
-
- tex1 = clutter_texture_new_from_pixbuf (pixbuf);
- tex2 = clutter_clone_texture_new (tex1);
-
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
@@ -37,15 +31,29 @@ main (int argc, char *argv[])
gtk_widget_set_size_request (clutter1, 320, 240);
stage1 = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter1));
clutter_stage_set_color (CLUTTER_STAGE(stage1), &col1);
+ tex1 = gtk_clutter_texture_new_from_stock (clutter1,
+ GTK_STOCK_DIALOG_INFO,
+ GTK_ICON_SIZE_DIALOG);
+ clutter_actor_set_anchor_point (tex1,
+ clutter_actor_get_width (tex1) / 2,
+ clutter_actor_get_height (tex1) / 2);
+ clutter_actor_set_position (tex1, 160, 120);
clutter_stage_add (stage1, tex1);
+ clutter_actor_show (tex1);
gtk_container_add (GTK_CONTAINER (vbox), clutter1);
clutter2 = gtk_clutter_embed_new ();
gtk_widget_set_size_request (clutter2, 320, 240);
stage2 = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter2));
-
clutter_stage_set_color (CLUTTER_STAGE(stage2), &col2);
+ tex2 = gtk_clutter_texture_new_from_icon_name (clutter1,
+ "user-info",
+ GTK_ICON_SIZE_BUTTON);
+ clutter_actor_set_anchor_point (tex2,
+ clutter_actor_get_width (tex2) / 2,
+ clutter_actor_get_height (tex2) / 2);
+ clutter_actor_set_position (tex2, 160, 120);
clutter_stage_add (stage2, tex2);
gtk_container_add (GTK_CONTAINER (vbox), clutter2);