Dear developers
I made a patch to add elm_genlist_item_fields_update function.
It can be used to updating genlist's item part without realize/unrealize
itself.
Prototype is
elm_genlist_item_fields_update
(Elm_Genlist_Item *it, const char *part, Elm_Genlist_Item_Field_Flags itf)
Part supports globbing. Passing "*" to part means updating all parts.
Item field can be one of icon, content and state.
I think it's useful to speed up if an app updates frequently.
Thanks
Index: elementary/src/lib/elm_genlist.c
===================================================================
--- elementary/src/lib/elm_genlist.c (由щ퉬�쟾 64419)
+++ elementary/src/lib/elm_genlist.c (�옉�뾽 �궗蹂�)
@@ -1663,7 +1663,8 @@
static void
_item_label_realize(Elm_Gen_Item *it,
Evas_Object *target,
- Eina_List **source)
+ Eina_List **source,
+ const char *wanted)
{
if (it->itc->func.label_get)
{
@@ -1673,6 +1674,9 @@
*source = elm_widget_stringlist_get(edje_object_data_get(target,
"labels"));
EINA_LIST_FOREACH(*source, l, key)
{
+ if (wanted && fnmatch(wanted, key, FNM_PERIOD))
+ continue;
+
char *s = it->itc->func.label_get
((void *)it->base.data, WIDGET(it), key);
@@ -1692,7 +1696,8 @@
static Eina_List *
_item_content_realize(Elm_Gen_Item *it,
Evas_Object *target,
- Eina_List **source)
+ Eina_List **source,
+ const char *wanted)
{
Eina_List *res = NULL;
@@ -1705,6 +1710,9 @@
*source = elm_widget_stringlist_get(edje_object_data_get(target,
"contents"));
EINA_LIST_FOREACH(*source, l, key)
{
+ if (wanted && fnmatch(wanted, key, FNM_PERIOD))
+ continue;
+
if (it->itc->func.content_get)
ic = it->itc->func.content_get
((void *)it->base.data, WIDGET(it), key);
@@ -1726,7 +1734,8 @@
static void
_item_state_realize(Elm_Gen_Item *it,
Evas_Object *target,
- Eina_List **source)
+ Eina_List **source,
+ const char *wanted)
{
if (it->itc->func.state_get)
{
@@ -1737,6 +1746,9 @@
*source = elm_widget_stringlist_get(edje_object_data_get(target,
"states"));
EINA_LIST_FOREACH(*source, l, key)
{
+ if (wanted && fnmatch(wanted, key, FNM_PERIOD))
+ continue;
+
Eina_Bool on = it->itc->func.state_get
((void *)it->base.data, WIDGET(it), key);
@@ -1895,9 +1907,9 @@
will clean our mess */
assert(eina_list_count(it->content_objs) == 0);
- _item_label_realize(it, VIEW(it), &it->labels);
- it->content_objs = _item_content_realize(it, VIEW(it), &it->contents);
- _item_state_realize(it, VIEW(it), &it->states);
+ _item_label_realize(it, VIEW(it), &it->labels, NULL);
+ it->content_objs = _item_content_realize(it, VIEW(it), &it->contents,
NULL);
+ _item_state_realize(it, VIEW(it), &it->states, NULL);
if (!it->item->mincalcd)
{
@@ -2870,11 +2882,11 @@
will clean our mess */
assert(eina_list_count(it->item->mode_content_objs) == 0);
- _item_label_realize(it, it->item->mode_view, &it->item->mode_labels);
- it->item->mode_content_objs = _item_content_realize(it,
- it->item->mode_view,
- &it->item->mode_contents);
- _item_state_realize(it, it->item->mode_view, &it->item->mode_states);
+ _item_label_realize(it, it->item->mode_view, &it->item->mode_labels, NULL);
+ it->item->mode_content_objs =
+ _item_content_realize(it, it->item->mode_view,
+ &it->item->mode_contents, NULL);
+ _item_state_realize(it, it->item->mode_view, &it->item->mode_states, NULL);
edje_object_part_swallow(it->item->mode_view,
edje_object_data_get(it->item->mode_view,
"mode_part"),
@@ -4181,6 +4193,23 @@
}
EAPI void
+elm_genlist_item_fields_update(Elm_Genlist_Item *it,
+ const char *part,
+ Elm_Genlist_Item_Field_Flags itf)
+{
+ ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
+ if (!it->item->block) return;
+ if (it->delete_me) return;
+
+ if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_LABEL))
+ _item_label_realize(it, it->base.view, &it->labels, part);
+ if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_ICON))
+ _item_content_realize(it, it->base.view, &it->contents, part);
+ if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_STATE))
+ _item_state_realize(it, it->base.view, &it->states, part);
+}
+
+EAPI void
elm_genlist_item_item_class_update(Elm_Gen_Item *it,
const Elm_Genlist_Item_Class *itc)
{
Index: elementary/src/lib/Elementary.h.in
===================================================================
--- elementary/src/lib/Elementary.h.in (由щ퉬�쟾 64419)
+++ elementary/src/lib/Elementary.h.in (�옉�뾽 �궗蹂�)
@@ -18196,6 +18196,13 @@
ELM_GENLIST_ITEM_SUBITEMS = (1 << 0), /**< may expand and have child
items */
ELM_GENLIST_ITEM_GROUP = (1 << 1) /**< index of a group of items */
} Elm_Genlist_Item_Flags;
+ typedef enum _Elm_Genlist_Item_Field_Flags
+ {
+ ELM_GENLIST_ITEM_FIELD_ALL = 0,
+ ELM_GENLIST_ITEM_FIELD_LABEL = (1 << 0),
+ ELM_GENLIST_ITEM_FIELD_ICON = (1 << 1),
+ ELM_GENLIST_ITEM_FIELD_STATE = (1 << 2)
+ } Elm_Genlist_Item_Field_Flags;
typedef struct _Elm_Genlist_Item_Class Elm_Genlist_Item_Class; /**<
Genlist item class definition structs */
#define Elm_Genlist_Item_Class Elm_Gen_Item_Class
typedef struct _Elm_Genlist_Item Elm_Genlist_Item; /**< Item of
Elm_Genlist. Sub-type of Elm_Widget_Item */
@@ -19230,6 +19237,25 @@
*/
EAPI void elm_genlist_item_update(Elm_Genlist_Item *item)
EINA_ARG_NONNULL(1);
/**
+ * Update the part of an item
+ *
+ * @param it The item
+ * @param part The name of item's part
+ * @param itf The flags of item's part type
+ *
+ * This updates an item's part by calling item's fetching functions again
+ * to get the icons, labels and states. Use this when the original
+ * item data has changed and the changes are desired to be reflected.
+ *
+ * Use elm_genlist_realized_items_update() to update an item's all
+ * property.
+ *
+ * @see elm_genlist_item_update()
+ *
+ * @ingroup Genlist
+ */
+ EAPI void elm_genlist_item_fields_update(Elm_Genlist_Item
*it, const char *part, Elm_Genlist_Item_Field_Flags itf) EINA_ARG_NONNULL(1);
+ /**
* Update the item class of an item
*
* @param it The item
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel