GdkCursor *cursor_hand_open;
GdkCursor *cursor_hand_closed;
+
+ guint width;
+ guint height;
};
{
case PROP_VIEW:
{
- ClutterActor *stage;
- stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (priv->clutter_embed));
-
- if (priv->view != NULL)
- {
- g_object_unref (priv->view);
- clutter_container_remove_actor (CLUTTER_CONTAINER (stage), CLUTTER_ACTOR (priv->view));
- }
+ ChamplainView *view;
- priv->view = g_value_dup_object (value);
- clutter_container_add_actor (CLUTTER_CONTAINER (stage), CLUTTER_ACTOR (priv->view));
+ view = g_value_get_object (value);
+ champlain_view_embed_set_view (CHAMPLAIN_VIEW_EMBED (object), view);
break;
}
default:
"Champlain view",
"The ChamplainView to embed into the Gtk+ widget",
CHAMPLAIN_TYPE_VIEW,
- CHAMPLAIN_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ CHAMPLAIN_PARAM_READWRITE));
}
static void
{
ChamplainViewEmbedPrivate *priv = view->priv;
- champlain_view_set_size(priv->view, allocation->width, allocation->height);
+ if (priv->view != NULL)
+ champlain_view_set_size (priv->view, allocation->width, allocation->height);
+
+ priv->width = allocation->width;
+ priv->height = allocation->height;
}
static gboolean
* Since: 0.2.1
*/
GtkWidget *
-champlain_view_embed_new (ChamplainView *view)
+champlain_view_embed_new ()
{
- g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), NULL);
-
- return g_object_new (CHAMPLAIN_TYPE_VIEW_EMBED, "champlain-view", view, NULL);
+ return g_object_new (CHAMPLAIN_TYPE_VIEW_EMBED, NULL);
}
ChamplainView *
ChamplainViewEmbedPrivate *priv = embed->priv;
return priv->view;
}
+
+void
+champlain_view_embed_set_view (ChamplainViewEmbed* embed,
+ ChamplainView *view)
+{
+ g_return_if_fail (CHAMPLAIN_IS_VIEW_EMBED(embed));
+ g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
+
+ ChamplainViewEmbedPrivate *priv = embed->priv;
+ ClutterActor *stage;
+
+ if (priv->view != NULL)
+ {
+ g_object_unref (priv->view);
+ clutter_container_remove_actor (CLUTTER_CONTAINER (stage), CLUTTER_ACTOR (priv->view));
+ }
+
+ priv->view = g_object_ref (view);
+ champlain_view_set_size (priv->view, priv->width, priv->height);
+
+ stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (priv->clutter_embed));
+ clutter_container_add_actor (CLUTTER_CONTAINER (stage), CLUTTER_ACTOR (priv->view));
+}
vbox = gtk_vbox_new(FALSE, 10);
- view = champlain_view_new ();
- widget = champlain_view_embed_new (CHAMPLAIN_VIEW (view));
+ widget = champlain_view_embed_new ();
+
+ view = champlain_view_embed_get_view (CHAMPLAIN_VIEW_EMBED (widget));
g_object_set (G_OBJECT (view), "scroll-mode", CHAMPLAIN_SCROLL_MODE_KINETIC,
"zoom-level", 5, NULL);
layer = create_marker_layer (CHAMPLAIN_VIEW (view));