[libchamplain/libchamplain-0-12] Get rid of clutter_stage_get_default()
- From: JiÅÃ Techet <jiritechet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplain/libchamplain-0-12] Get rid of clutter_stage_get_default()
- Date: Tue, 20 Dec 2011 01:14:43 +0000 (UTC)
commit 074f227ecc5b2b8ac6ba0e04677a5bd8dcfcb4af
Author: JiÅÃ Techet <techet gmail com>
Date: Sun Nov 20 18:42:23 2011 +0100
Get rid of clutter_stage_get_default()
It is deprecated in clutter now.
champlain/champlain-view.c | 6 +++---
champlain/champlain-viewport.c | 8 ++++++--
demos/animated-marker.c | 4 ++--
demos/create-destroy-test.c | 11 +++++------
demos/launcher.c | 4 ++--
demos/minimal.c | 5 ++---
demos/polygons.c | 4 ++--
demos/url-marker.c | 4 ++--
8 files changed, 24 insertions(+), 22 deletions(-)
---
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index f39cf0e..7838e82 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -525,7 +525,7 @@ static void
champlain_view_dispose (GObject *object)
{
DEBUG_LOG ()
-
+
ChamplainView *view = CHAMPLAIN_VIEW (object);
ChamplainViewPrivate *priv = view->priv;
@@ -662,6 +662,8 @@ champlain_view_realize (ClutterActor *actor)
clutter_actor_realize (actor);
+ clutter_actor_grab_key_focus (priv->kinetic_scroll);
+
/* Setup the viewport according to the zoom level */
/* resize_viewport (view); */
@@ -1103,8 +1105,6 @@ champlain_view_init (ChamplainView *view)
g_signal_connect (priv->kinetic_scroll, "button-press-event",
G_CALLBACK (kinetic_scroll_button_press_cb), view);
- clutter_stage_set_key_focus (CLUTTER_STAGE (clutter_stage_get_default ()),
- priv->kinetic_scroll);
g_signal_connect (priv->kinetic_scroll, "key-press-event",
G_CALLBACK (kinetic_scroll_key_press_cb), view);
diff --git a/champlain/champlain-viewport.c b/champlain/champlain-viewport.c
index 256c090..81eba47 100644
--- a/champlain/champlain-viewport.c
+++ b/champlain/champlain-viewport.c
@@ -475,10 +475,12 @@ champlain_viewport_get_adjustments (ChamplainViewport *viewport,
else
{
ChamplainAdjustment *adjustment;
+ ClutterActor *stage;
guint width, stage_width, increment;
width = clutter_actor_get_width (CLUTTER_ACTOR (viewport));
- stage_width = clutter_actor_get_width (clutter_stage_get_default ());
+ stage = clutter_actor_get_stage (CLUTTER_ACTOR (viewport));
+ stage_width = (stage != NULL) ? clutter_actor_get_width (stage) : 1;
increment = MAX (1, MIN (stage_width, width));
adjustment = champlain_adjustment_new (priv->x,
@@ -501,10 +503,12 @@ champlain_viewport_get_adjustments (ChamplainViewport *viewport,
else
{
ChamplainAdjustment *adjustment;
+ ClutterActor *stage;
guint height, stage_height, increment;
height = clutter_actor_get_height (CLUTTER_ACTOR (viewport));
- stage_height = clutter_actor_get_height (clutter_stage_get_default ());
+ stage = clutter_actor_get_stage (CLUTTER_ACTOR (viewport));
+ stage_height = (stage != NULL) ? clutter_actor_get_height (stage) : 1;
increment = MAX (1, MIN (stage_height, height));
adjustment = champlain_adjustment_new (priv->y,
diff --git a/demos/animated-marker.c b/demos/animated-marker.c
index d00b81d..e47af55 100644
--- a/demos/animated-marker.c
+++ b/demos/animated-marker.c
@@ -130,8 +130,9 @@ main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
- stage = clutter_stage_get_default ();
+ stage = clutter_stage_new ();
clutter_actor_set_size (stage, 800, 600);
+ g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
/* Create the map view */
actor = champlain_view_new ();
@@ -161,6 +162,5 @@ main (int argc, char *argv[])
clutter_actor_show (stage);
clutter_main ();
- clutter_actor_destroy (actor);
return 0;
}
diff --git a/demos/create-destroy-test.c b/demos/create-destroy-test.c
index efc3521..aa7e06e 100644
--- a/demos/create-destroy-test.c
+++ b/demos/create-destroy-test.c
@@ -18,12 +18,12 @@
#include <champlain/champlain.h>
+static ClutterActor *stage;
+
static ClutterActor *
create_actor ()
{
- ClutterActor *actor, *stage;
-
- stage = clutter_stage_get_default ();
+ ClutterActor *actor;
/* Create the map view */
actor = champlain_view_new ();
@@ -59,13 +59,12 @@ callback (void *data)
int
main (int argc, char *argv[])
{
- ClutterActor *stage;
-
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
- stage = clutter_stage_get_default ();
+ stage = clutter_stage_new ();
clutter_actor_set_size (stage, 800, 600);
+ g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
g_timeout_add (100, (GSourceFunc) callback, NULL);
diff --git a/demos/launcher.c b/demos/launcher.c
index 26e585f..a22b479 100644
--- a/demos/launcher.c
+++ b/demos/launcher.c
@@ -98,8 +98,9 @@ main (int argc,
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
- stage = clutter_stage_get_default ();
+ stage = clutter_stage_new ();
clutter_actor_set_size (stage, 800, 600);
+ g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
/* Create the map view */
actor = champlain_view_new ();
@@ -148,6 +149,5 @@ main (int argc,
clutter_actor_show (stage);
clutter_main ();
- clutter_actor_destroy (actor);
return 0;
}
diff --git a/demos/minimal.c b/demos/minimal.c
index b3ec2ef..fc631fc 100644
--- a/demos/minimal.c
+++ b/demos/minimal.c
@@ -26,8 +26,9 @@ main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
- stage = clutter_stage_get_default ();
+ stage = clutter_stage_new ();
clutter_actor_set_size (stage, 800, 600);
+ g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
/* Create the map view */
actor = champlain_view_new ();
@@ -37,7 +38,5 @@ main (int argc, char *argv[])
clutter_actor_show (stage);
clutter_main ();
- clutter_actor_destroy (actor);
-
return 0;
}
diff --git a/demos/polygons.c b/demos/polygons.c
index df54689..0e82839 100644
--- a/demos/polygons.c
+++ b/demos/polygons.c
@@ -87,8 +87,9 @@ main (int argc,
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
- stage = clutter_stage_get_default ();
+ stage = clutter_stage_new ();
clutter_actor_set_size (stage, 800, 600);
+ g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
/* Create the map view */
actor = champlain_view_new ();
@@ -153,6 +154,5 @@ main (int argc,
clutter_actor_show (stage);
clutter_main ();
- clutter_actor_destroy (actor);
return 0;
}
diff --git a/demos/url-marker.c b/demos/url-marker.c
index a73bd27..d0c2716 100644
--- a/demos/url-marker.c
+++ b/demos/url-marker.c
@@ -246,8 +246,9 @@ main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
- stage = clutter_stage_get_default ();
+ stage = clutter_stage_new ();
clutter_actor_set_size (stage, 800, 600);
+ g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
/* Create the map view */
view = champlain_view_new ();
@@ -275,6 +276,5 @@ main (int argc, char *argv[])
g_object_unref (session);
- clutter_actor_destroy (view);
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]