[clutter-tutorial] Fix the build.
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Subject: [clutter-tutorial] Fix the build.
- Date: Thu, 30 Apr 2009 13:46:19 -0400 (EDT)
commit bd10d0e7b6ecd62439bdaa2edb88df7a33ff23f4
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Apr 30 19:45:58 2009 +0200
Fix the build.
* configure.ac:
* examples/text/Makefile.am: Added this file and mentioned it to fix the
build.
* examples/text/main.c, examples/scrolling/main.c: Correct formatting.
---
ChangeLog | 9 +++++
configure.ac | 1 +
examples/scrolling/main.c | 77 +++++++++++++++++++++------------------------
examples/text/Makefile.am | 7 ++++
examples/text/main.c | 2 +-
5 files changed, 54 insertions(+), 42 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fbf52ab..20d2d62 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-04-30 Murray Cumming <murrayc murrayc com>
+
+ Fix the build.
+
+ * configure.ac:
+ * examples/text/Makefile.am: Added this file and mentioned it to fix the
+ build.
+ * examples/text/main.c, examples/scrolling/main.c: Correct formatting.
+
2009-04-29 Johannes Schmid <jschmid openismus com>
* examples/text/main.c:
diff --git a/configure.ac b/configure.ac
index 393d691..f5de84c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -110,5 +110,6 @@ AC_OUTPUT([
examples/scrolling/Makefile
examples/stage/Makefile
examples/stage_widget/Makefile
+ examples/text/Makefile
examples/timeline/Makefile
])
diff --git a/examples/scrolling/main.c b/examples/scrolling/main.c
index d590fa4..c2a227e 100644
--- a/examples/scrolling/main.c
+++ b/examples/scrolling/main.c
@@ -22,15 +22,8 @@
int
main (int argc, char *argv[])
{
- /* Clutter */
- ClutterActor *stage, *viewport, *tex;
- ClutterColor stage_color = { 0x61, 0x64, 0x8c, 0xff };
+ ClutterColor stage_color = { 0x61, 0x64, 0x8c, 0xff };
- /* Gtk+ */
- GtkWidget *window, *embed;
- GtkWidget *table, *scrollbar;
- GtkAdjustment *h_adjustment, *v_adjustment;
-
/* Call gtk_clutter_init() to init both clutter and gtk+ */
if (gtk_clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
g_error ("Unable to initialize GtkClutter");
@@ -38,61 +31,63 @@ main (int argc, char *argv[])
if (argc != 2)
g_error ("Usage: example <image file>");
- /* Create a toplevel window */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ /* Create a toplevel window: */
+ GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
- /* Create a table to hold the scrollbars and the ClutterEmbed widget */
- table = gtk_table_new (2, 2, FALSE);
+ /* Create a table to hold the scrollbars and the ClutterEmbed widget: */
+ GtkWidget *table = gtk_table_new (2, 2, FALSE);
gtk_container_add (GTK_CONTAINER (window), table);
gtk_widget_show (table);
- /* Create ClutterEmbed widget for the stage */
- embed = gtk_clutter_embed_new ();
+ /* Create ClutterEmbed widget for the stage: */
+ GtkWidget *embed = gtk_clutter_embed_new ();
gtk_table_attach (GTK_TABLE (table), embed,
- 0, 1,
- 0, 1,
- GTK_EXPAND | GTK_FILL,
- GTK_EXPAND | GTK_FILL,
- 0, 0);
+ 0, 1,
+ 0, 1,
+ GTK_EXPAND | GTK_FILL,
+ GTK_EXPAND | GTK_FILL,
+ 0, 0);
gtk_widget_show (embed);
- /* Init stage */
- stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (embed));
+ /* Init the stage: */
+ ClutterActor *stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (embed));
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
clutter_actor_set_size (stage, 640, 480);
- /* Create viewport actor to be able to scroll actor. By passing NULL it
- * will create new GtkAdjustments */
- viewport = gtk_clutter_viewport_new (NULL, NULL);
+ /* Createa a viewport actor to be able to scroll actor. By passing NULL it
+ * will create new GtkAdjustments. */
+ ClutterActor *viewport = gtk_clutter_viewport_new (NULL, NULL);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), viewport);
- /* Load image from first command line argument and add it to viewport*/
- tex = clutter_texture_new_from_file (argv[1], NULL);
- clutter_container_add_actor (CLUTTER_CONTAINER (viewport), tex);
- clutter_actor_set_position (tex, 0, 0);
- clutter_actor_set_position (tex, 0, 0);
+ /* Load image from first command line argument and add it to viewport: */
+ ClutterActor *texture = clutter_texture_new_from_file (argv[1], NULL);
+ clutter_container_add_actor (CLUTTER_CONTAINER (viewport), texture);
+ clutter_actor_set_position (texture, 0, 0);
+ clutter_actor_set_position (texture, 0, 0);
clutter_actor_set_position (viewport, 0, 0);
clutter_actor_set_size (viewport, 640, 480);
- /* Create scrollbars and connect them to viewport */
+ /* Create scrollbars and connect them to viewport: */
+ GtkAdjustment *h_adjustment = NULL;
+ GtkAdjustment *v_adjustment = NULL;
gtk_clutter_scrollable_get_adjustments (GTK_CLUTTER_SCROLLABLE (viewport),
- &h_adjustment,
- &v_adjustment);
- scrollbar = gtk_vscrollbar_new (v_adjustment);
+ &h_adjustment, &v_adjustment);
+ GtkWidget *scrollbar = gtk_vscrollbar_new (v_adjustment);
gtk_table_attach (GTK_TABLE (table), scrollbar,
- 1, 2,
- 0, 1,
- 0, GTK_EXPAND | GTK_FILL,
- 0, 0);
+ 1, 2,
+ 0, 1,
+ 0, GTK_EXPAND | GTK_FILL,
+ 0, 0);
gtk_widget_show (scrollbar);
+
scrollbar = gtk_hscrollbar_new (h_adjustment);
gtk_table_attach (GTK_TABLE (table), scrollbar,
- 0, 1,
- 1, 2,
- GTK_EXPAND | GTK_FILL, 0,
- 0, 0);
+ 0, 1,
+ 1, 2,
+ GTK_EXPAND | GTK_FILL, 0,
+ 0, 0);
gtk_widget_show (scrollbar);
gtk_widget_show (window);
diff --git a/examples/text/Makefile.am b/examples/text/Makefile.am
new file mode 100644
index 0000000..f389d29
--- /dev/null
+++ b/examples/text/Makefile.am
@@ -0,0 +1,7 @@
+include $(top_srcdir)/examples/Makefile.am_fragment
+
+#Build the executable, but don't install it.
+noinst_PROGRAMS = example
+
+example_SOURCES = main.c
+
diff --git a/examples/text/main.c b/examples/text/main.c
index 8972cac..120ac10 100644
--- a/examples/text/main.c
+++ b/examples/text/main.c
@@ -38,7 +38,7 @@ int main(int argc, char *argv[])
clutter_text_set_color (CLUTTER_TEXT (text), &actor_color);
clutter_text_set_text (CLUTTER_TEXT (text),
"Wizard imps and sweat sock pimps, interstellar mongrel nymphs.");
- clutter_text_set_font_name (CLUTTER_TEXT (text), "Sans 12");
+ clutter_text_set_font_name (CLUTTER_TEXT (text), "Sans 12");
clutter_text_set_editable (CLUTTER_TEXT (text), TRUE);
clutter_text_set_line_wrap (CLUTTER_TEXT (text), TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]