[libchamplain] Don't expose the layout manager in ChamplainView



commit da73899a4ef6cf7ff7d452543dd40f62f09c8356
Author: JiÅ?í Techet <techet gmail com>
Date:   Thu Feb 17 23:30:44 2011 +0100

    Don't expose the layout manager in ChamplainView
    
    Use dedicated function for actor layout instead.

 champlain/champlain-view.c               |   34 +++++++++++++++++------------
 champlain/champlain-view.h               |    7 +++++-
 demos/launcher-gtk.c                     |    8 ++----
 docs/reference/libchamplain-sections.txt |    2 +-
 4 files changed, 30 insertions(+), 21 deletions(-)
---
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index b3da3e2..8cd7acc 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -1066,9 +1066,9 @@ champlain_view_init (ChamplainView *view)
   /* Setup license */
   priv->license_actor = g_object_ref (champlain_license_new ());
   champlain_license_connect_view (CHAMPLAIN_LICENSE (priv->license_actor), view);
-  clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (priv->layout_manager), priv->license_actor,
-                          CLUTTER_BIN_ALIGNMENT_END,
-                          CLUTTER_BIN_ALIGNMENT_END);
+  champlain_view_bin_layout_add (view, priv->license_actor,
+                                 CLUTTER_BIN_ALIGNMENT_END,
+                                 CLUTTER_BIN_ALIGNMENT_END);
 
   priv->state = CHAMPLAIN_STATE_DONE;
   g_object_notify (G_OBJECT (view), "state");
@@ -2571,26 +2571,32 @@ champlain_view_get_zoom_on_double_click (ChamplainView *view)
 
 
 /**
- * champlain_view_get_layout_manager:
+ * champlain_view_bin_layout_add:
  * @view: The view
+ * @child: The child to be inserted
+ * @x_align: x alignment
+ * @y_align: y alignment
  *
- * Returns the #ClutterBinLayout manager. The manager can be used to align
- * user provided actors on top of the map.
- *
- * Returns: (transfer none): the layout manager
+ * This function iserts a custom actor to the undrelying #ClutterBinLayout
+ * manager. The inserted actors appear on top of the map. See clutter_bin_layout_add()
+ * for reference.
  *
  * Since: 0.10
  */
-ClutterBinLayout *
-champlain_view_get_layout_manager (ChamplainView *view)
+void champlain_view_bin_layout_add (ChamplainView *view,
+  ClutterActor *child,
+  ClutterBinAlignment x_align,
+  ClutterBinAlignment y_align)
 {
+  ChamplainViewPrivate *priv = view->priv;
+  ClutterBinLayout *layout_manager;
+
   DEBUG_LOG ()
 
-  g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), FALSE);
-  
-  ChamplainViewPrivate *priv = view->priv;
+  g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
   
-  return CLUTTER_BIN_LAYOUT (priv->layout_manager);
+  layout_manager = CLUTTER_BIN_LAYOUT (priv->layout_manager);
+  clutter_bin_layout_add (layout_manager, child, x_align, y_align);
 }
 
 
diff --git a/champlain/champlain-view.h b/champlain/champlain-view.h
index b253b6b..a68b7d4 100644
--- a/champlain/champlain-view.h
+++ b/champlain/champlain-view.h
@@ -133,10 +133,15 @@ gdouble champlain_view_latitude_to_y (ChamplainView *view,
 
 void champlain_view_get_viewport_origin (ChamplainView *view, gdouble *x, gdouble *y);
 
-ClutterBinLayout *champlain_view_get_layout_manager (ChamplainView *view); 
+void champlain_view_bin_layout_add (ChamplainView *view,
+  ClutterActor *child,
+  ClutterBinAlignment x_align,
+  ClutterBinAlignment y_align);
 
 ChamplainLicense *champlain_view_get_license_actor (ChamplainView *view);
 
+
+
 G_END_DECLS
 
 #endif
diff --git a/demos/launcher-gtk.c b/demos/launcher-gtk.c
index 642132f..6b9aae9 100644
--- a/demos/launcher-gtk.c
+++ b/demos/launcher-gtk.c
@@ -218,7 +218,6 @@ main (int argc,
   ChamplainView *view;
   ChamplainMarkerLayer *layer;
   ClutterActor *scale;
-  ClutterBinLayout *layout_manager;
   ChamplainLicense *license_actor;
   ChamplainPathLayer *path;
 
@@ -258,10 +257,9 @@ main (int argc,
   champlain_scale_connect_view (CHAMPLAIN_SCALE (scale), view);
   
   /* align to the bottom left */
-  layout_manager = champlain_view_get_layout_manager (view);
-  clutter_bin_layout_add (layout_manager, scale,
-                          CLUTTER_BIN_ALIGNMENT_START,
-                          CLUTTER_BIN_ALIGNMENT_END);
+  champlain_view_bin_layout_add (view, scale,
+                                 CLUTTER_BIN_ALIGNMENT_START,
+                                 CLUTTER_BIN_ALIGNMENT_END);
   
   license_actor = champlain_view_get_license_actor (view);
   champlain_license_set_extra_text (license_actor, "Don't eat cereals with orange juice\nIt tastes bad");
diff --git a/docs/reference/libchamplain-sections.txt b/docs/reference/libchamplain-sections.txt
index f528596..edaccb0 100644
--- a/docs/reference/libchamplain-sections.txt
+++ b/docs/reference/libchamplain-sections.txt
@@ -150,7 +150,7 @@ champlain_view_y_to_latitude
 champlain_view_longitude_to_x
 champlain_view_latitude_to_y
 champlain_view_get_viewport_origin
-champlain_view_get_layout_manager
+champlain_view_bin_layout_add
 champlain_view_get_license_actor
 <SUBSECTION Standard>
 CHAMPLAIN_VIEW



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]