1
/*
2
 * Copyright (C) 2010-2012 Jiri Techet <techet@gmail.com>
3
 *
4
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Lesser General Public
6
 * License as published by the Free Software Foundation; either
7
 * version 2.1 of the License, or (at your option) any later version.
8
 *
9
 * This library is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Lesser General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Lesser General Public
15
 * License along with this library; if not, write to the Free Software
16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
 */
18
19
#include <champlain/champlain.h>
20
21
static ClutterActor *stage;
22
23
static ClutterActor *
24
create_actor ()
25
{
26
  ClutterActor *actor;
27
28
  /* Create the map view */
29
  actor = champlain_view_new ();
30
  clutter_actor_set_size (CLUTTER_ACTOR (actor), 800, 600);
31
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor);
32
33
  champlain_view_set_zoom_level (CHAMPLAIN_VIEW (actor), 12);
34
  champlain_view_center_on (CHAMPLAIN_VIEW (actor), 45.466, -73.75);
35
  
36
  return actor;
37
}
38
39
40
static gboolean
41
callback (void *data)
42
{
43
  static ClutterActor *actor = NULL;
44
  
45
  if (!actor)
46
  {
47
    actor = create_actor();
48
  }
49
  else
50
  {
51
    clutter_actor_destroy (actor);
52
    actor = NULL;
53
  }
54
  
55
  return TRUE;
56
}
57
58
59
int
60
main (int argc, char *argv[])
61
{
62
  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
63
    return 1;
64
65
  stage = clutter_stage_new ();
66
  clutter_actor_set_size (stage, 800, 600);
67
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
68
69
  g_timeout_add (100, (GSourceFunc) callback, NULL);
70
71
  clutter_actor_show (stage);
72
  clutter_main ();
73
74
  return 0;
75
}