Elm entry-anchor: Don't show anchor if there's none.
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 14 Mar 2012 08:28:04 +0000 (08:28 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 14 Mar 2012 08:28:04 +0000 (08:28 +0000)
It's currently kinda hackish, but this can't be nicely solved without some
really needed (anyway) features in smart object callbacks. In the meanwhile
it's nice and working.

Thanks to WooHyun for the catch.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@69324 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/elm_entry.c

index 4c12cad..0a2343d 100644 (file)
@@ -3868,7 +3868,22 @@ _entry_hover_anchor_clicked(void *data, Evas_Object *obj, void *event_info)
 
    evas_object_smart_callback_call(data, SIG_ANCHOR_HOVER_OPENED, &ei);
    evas_object_smart_callback_add(wd->anchor_hover.hover, "clicked", _anchor_hover_clicked, data);
-   evas_object_show(wd->anchor_hover.hover);
+
+   /* FIXME: Should just check if there's any callback registered to the smart
+    * events instead.
+    * This is used to determine if anyone cares about the hover or not. */
+   if (!elm_object_part_content_get(wd->anchor_hover.hover, "middle") &&
+         !elm_object_part_content_get(wd->anchor_hover.hover, "left") &&
+         !elm_object_part_content_get(wd->anchor_hover.hover, "right") &&
+         !elm_object_part_content_get(wd->anchor_hover.hover, "top") &&
+         !elm_object_part_content_get(wd->anchor_hover.hover, "bottom"))
+     {
+        evas_object_del(wd->anchor_hover.hover);
+     }
+   else
+     {
+        evas_object_show(wd->anchor_hover.hover);
+     }
 }
 /* END - ANCHOR HOVER */