Hello,
I've made a patch that makes the genlist capable of configuring the
timeout for the longpress event.

The patch compiles but I haven't tested it yet. However it's very
simple, it should work out of the box.
Patch is the output of "svn diff" from revision 49809.
-- 
daniele_athome
Index: elm_genlist.c
===================================================================
--- elm_genlist.c	(revisione 49809)
+++ elm_genlist.c	(copia locale)
@@ -269,6 +269,7 @@
    int item_width;
    int item_height;
    int max_items_per_block;
+   double longpress_timeout;
 };
 
 struct _Item_Block
@@ -681,6 +682,8 @@
    Evas_Coord x, y;
 
    if (ev->button != 1) return;
+   Widget_Data *wd = elm_widget_data_get(it->wd->obj);
+
    it->down = 1;
    it->dragging  = 0;
    evas_object_geometry_get(obj, &x, &y, NULL, NULL);
@@ -695,7 +698,7 @@
      evas_object_smart_callback_call(it->wd->obj, "clicked", it);
    if (it->long_timer) ecore_timer_del(it->long_timer);
    if (it->realized)
-     it->long_timer = ecore_timer_add(1.0, _long_press, it);
+     it->long_timer = ecore_timer_add(wd->longpress_timeout, _long_press, it);
    else
      it->long_timer = NULL;
 }
@@ -1495,6 +1498,7 @@
    wd->obj = obj;
    wd->mode = ELM_LIST_SCROLL;
    wd->max_items_per_block = 32;
+   wd->longpress_timeout = 1.0;
 
    evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
    evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
@@ -3145,3 +3149,37 @@
    if (!wd) return 0;
    return wd->max_items_per_block;
 }
+
+/**
+ * Set the timeout in seconds for the longpress event
+ * 
+ * @param obj The genlist object
+ * @param timeout timeout in seconds
+ * 
+ * @ingroup Genlist
+ */
+EAPI void
+elm_genlist_longpress_timeout_set(const Evas_Object *obj, double timeout)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) 0;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return 0;
+   wd->longpress_timeout = timeout;
+}
+
+/**
+ * Get the timeout in seconds for the longpress event
+ * 
+ * @param obj The genlist object
+ * @return timeout in seconds
+ * 
+ * @ingroup Genlist
+ */
+EAPI double
+elm_genlist_longpress_timeout_get(const Evas_Object *obj)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) 0;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return 0;
+   return wd->longpress_timeout;
+}
Index: Elementary.h.in
===================================================================
--- Elementary.h.in	(revisione 49809)
+++ Elementary.h.in	(copia locale)
@@ -1104,7 +1104,10 @@
    EAPI Eina_Bool         elm_genlist_homogeneous_get(const Evas_Object *obj);
    EAPI void              elm_genlist_block_count_set(Evas_Object *obj, int n);
    EAPI int               elm_genlist_block_count_get(const Evas_Object *obj);
+   EAPI void              elm_genlist_longpress_timeout_set(const Evas_Object *obj, double timeout);
+   EAPI double            elm_genlist_longpress_timeout_get(const Evas_Object *obj);
 
+
    /* operations to add items */
    EAPI Elm_Genlist_Item *elm_genlist_item_append(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Genlist_Item *parent, Elm_Genlist_Item_Flags flags, Evas_Smart_Cb func, const void *func_data);
    EAPI Elm_Genlist_Item *elm_genlist_item_prepend(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Genlist_Item *parent, Elm_Genlist_Item_Flags flags, Evas_Smart_Cb func, const void *func_data);
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to