[libchamplain] Unselect All when clicking around markers



commit c2b099262534a813b8eddc4a4956f08a74cc5966
Author: Pierre-Luc Beaudoin <pierre-luc pierlux com>
Date:   Mon Jul 27 20:33:26 2009 -0400

    Unselect All when clicking around markers

 champlain/champlain-view.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index 61329b3..e168df6 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -932,6 +932,27 @@ champlain_view_class_init (ChamplainViewClass *champlainViewClass)
 
 }
 
+static gboolean
+button_release_cb (ClutterActor *actor,
+                ClutterEvent *event,
+                ChamplainView *view)
+{
+  GList *children = NULL;
+  ChamplainViewPrivate *priv = view->priv;
+
+  children = clutter_container_get_children (CLUTTER_CONTAINER (priv->user_layers));
+  for (;children != NULL; children = g_list_next (children))
+    {
+      if (CHAMPLAIN_IS_SELECTION_LAYER (children->data))
+        champlain_selection_layer_unselect_all (CHAMPLAIN_SELECTION_LAYER (children->data));
+    }
+
+  g_list_free (children);
+
+  return FALSE;
+}
+
+
 static void
 champlain_view_init (ChamplainView *view)
 {
@@ -991,6 +1012,10 @@ champlain_view_init (ChamplainView *view)
   clutter_container_add_actor (CLUTTER_CONTAINER (priv->viewport),
       priv->map_layer);
 
+  clutter_actor_set_reactive (CLUTTER_ACTOR (priv->stage), TRUE);
+  g_signal_connect_after (G_OBJECT (priv->stage), "button-release-event",
+      G_CALLBACK (button_release_cb), view);
+
   g_signal_connect (priv->finger_scroll, "button-press-event",
       G_CALLBACK (finger_scroll_button_press_cb), view);
 



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