]> err.no Git - libchamplain/commitdiff
Make it possible to hide the scale scale
authorTollef Fog Heen <tfheen@err.no>
Mon, 16 Nov 2009 15:38:49 +0000 (16:38 +0100)
committerTollef Fog Heen <tfheen@err.no>
Mon, 16 Nov 2009 15:38:49 +0000 (16:38 +0100)
champlain/champlain-view.c
champlain/champlain-view.h

index f5acee41c799dfff117392398934c4259642bd26..6ea10da57c0c00b784174bd689300abf9bf0c34f 100644 (file)
@@ -1017,6 +1017,12 @@ update_scale (gpointer *unused,
   if (! priv || !priv->map || !priv->map->current_level) {
     return;
   }
+  if (priv->display_scale) {
+    clutter_actor_show(priv->scale_actor);
+  } else {
+    clutter_actor_hide(priv->scale_actor);
+  }
+
   level = priv->map->current_level;
   tile = champlain_zoom_level_get_nth_tile(level, 0);
   m_per_pixel = 2 * M_PI * 6378100 * sin(M_PI/2 - M_PI / 180*priv->latitude) /
@@ -1044,6 +1050,8 @@ create_scale (ChamplainView *view)
                    view);
   g_signal_connect (priv->viewport, "notify::y-origin",
                    G_CALLBACK (update_scale), view);
+  g_signal_connect (view, "notify::display-scale",
+                   G_CALLBACK (update_scale), view);
 
   scale = clutter_cairo_texture_new (SCALE_WIDTH, SCALE_HEIGHT);
   cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (scale));
@@ -2786,3 +2794,21 @@ champlain_view_remove_polygon (ChamplainView *view,
 
   g_object_unref (polygon);
 }
+
+void
+champlain_view_show_scale (ChamplainView* view)
+{
+  g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
+
+  g_object_set (G_OBJECT (view), "display-scale", TRUE, NULL);
+}
+
+void
+champlain_view_hide_scale (ChamplainView* view)
+{
+  g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
+
+  g_object_set (G_OBJECT (view), "display-scale", FALSE, NULL);
+
+}
+
index 85eb0e818aef3917b4a8e496378a1084a8f73160..0549b0816c8fccb9c9a1da1a788fdfd43591023e 100644 (file)
@@ -147,6 +147,8 @@ void champlain_view_add_polygon (ChamplainView *view,
 void champlain_view_remove_polygon (ChamplainView *view,
     ChamplainPolygon *polygon);
 
+void champlain_view_show_scale (ChamplainView *view);
+void champlain_view_hide_scale (ChamplainView *view);
 
 G_END_DECLS