Turn loaded/finished signals into properties
[laugh.git] / src / main.c
blobc76f5f2fef7c77cdb34ad3a587b490274e55e680
1 /*
2 * Laugh.
4 * An glib SMIL library.
6 * Authored By Koos Vriezen <koos.vriezen@gmail.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
24 #ifdef HAVE_CONFIG_H
25 #include "config.h"
26 #endif
28 #include "laugh-actor.h"
30 #include <glib/gprintf.h>
31 #include <clutter/clutter-main.h>
32 #include <clutter/clutter-container.h>
33 #include <clutter/clutter-stage.h>
35 void loaded_callback (LaughActor *actor, gpointer d)
37 (void) actor;
38 (void) d;
40 g_printf ("cb loaded\n");
43 void finished_callback (LaughActor *actor, gpointer d)
45 (void) actor;
46 (void) d;
48 g_printf ("cb stopped\n");
51 int main (int argc, char **argv)
53 ClutterActor *laugh;
54 ClutterActor *stage;
55 guint width, height;
57 if (argc < 2) {
58 g_printerr ("usage %s uri\n", argv[0]);
59 return 1;
62 g_thread_init (NULL);
63 clutter_gst_init (&argc, &argv);
65 stage = clutter_stage_get_default ();
66 clutter_actor_get_size (stage, &width, &height);
68 laugh = laugh_actor_new ();
69 laugh_actor_uri_set (LAUGH_ACTOR (laugh), argv[1]);
71 g_signal_connect (G_OBJECT (laugh), "notify::loaded",
72 (GCallback) loaded_callback, (gpointer) 0);
73 g_signal_connect (G_OBJECT (laugh), "notify::finished",
74 (GCallback) finished_callback, (gpointer) 0);
76 clutter_actor_set_size (laugh, width, height);
77 clutter_container_add_actor (CLUTTER_CONTAINER (stage), laugh);
79 laugh_actor_start (LAUGH_ACTOR (laugh));
80 clutter_actor_show (laugh);
82 clutter_actor_show_all (stage);
84 clutter_main ();
86 return 0;