[libchamplain] Call viewport_pos_changed_cb() only when we want to



commit 891f991d8af5a22972a99c1203f6f7c40cb04ce3
Author: JiÅ?í Techet <techet gmail com>
Date:   Fri Mar 19 01:32:58 2010 +0100

    Call viewport_pos_changed_cb() only when we want to
    
    We don't want to unnecessarily update viewport within another update
    so block the signal in these functions when updating viewport.
    
    Signed-off-by: JiÅ?í Techet <techet gmail com>

 champlain/champlain-view.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index a0f2531..cd21630 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -306,9 +306,12 @@ update_viewport (ChamplainView *view,
       diff.y = priv->anchor.y - old_anchor.y;
 
       DEBUG("Relocating the viewport by %f, %f", diff.x, diff.y);
+
+      g_signal_handlers_block_by_func (priv->viewport, G_CALLBACK (viewport_pos_changed_cb), view);
       tidy_viewport_set_origin (TIDY_VIEWPORT (priv->viewport),
           x - diff.x, y - diff.y, 0);
-      return;
+      g_signal_handlers_unblock_by_func (priv->viewport, G_CALLBACK (viewport_pos_changed_cb), view);
+ //     return;
     }
 
   priv->viewport_size.x = x;
@@ -1781,10 +1784,12 @@ champlain_view_center_on (ChamplainView *view,
   priv->viewport_size.x = x - priv->anchor.x - priv->viewport_size.width / 2.0;
   priv->viewport_size.y = y - priv->anchor.y - priv->viewport_size.height / 2.0;
 
+  g_signal_handlers_block_by_func (priv->viewport, G_CALLBACK (viewport_pos_changed_cb), view);
   tidy_viewport_set_origin (TIDY_VIEWPORT (priv->viewport),
     priv->viewport_size.x,
     priv->viewport_size.y,
     0);
+  g_signal_handlers_unblock_by_func (priv->viewport, G_CALLBACK (viewport_pos_changed_cb), view);
 
   g_object_notify (G_OBJECT (view), "longitude");
   g_object_notify (G_OBJECT (view), "latitude");



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