Elm_Object_Item *
contact_list_item_add(struct ContactListData *list_data,
		      GHashTable *entry, int sortin)
{
	GHashTable *other;
	Elm_Object_Item *glit;

	if (sortin) {
		/* find the correct position to insert the new one */
		glit = elm_genlist_first_item_get(list_data->list);
		while (glit) {
			other = (GHashTable *)elm_object_item_data_get(glit);
			if (phoneui_utils_contact_compare(entry, other) < 0)
				break;
			glit = elm_genlist_item_next_get(glit);
		}
		if (glit) {
			return elm_genlist_item_insert_before(list_data->list,
					&itc, g_hash_table_ref(entry), NULL, glit,
					ELM_GENLIST_ITEM_NONE, NULL, NULL);
		}
	}
	return elm_genlist_item_append(list_data->list, &itc,
				     g_hash_table_ref(entry) /*item data */ ,
				     NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
}
Пример #2
0
void GenlistItemBase::InsertBefore(Evas_Object *_genlist, GenlistItemBase *before, GenlistItemBase *gparent)
{
    genlist = _genlist;
    item = elm_genlist_item_insert_before(genlist,
                                          &item_class,
                                          this,
                                          (gparent)?gparent->item:NULL, /* parent item */
                                          before->item,
                                          flags,
                                          _item_sel_cb, /* select function */
                                          this); /* select function data */
    elm_object_item_data_set(item, this);
    itemAdded();
}
static void
_insert_before_cb(void *data, Evas_Object *o, void *event_info)
{
   Evas_Object *list = data;
   Elm_Object_Item *glit = elm_genlist_selected_item_get(list);

   if (!glit) return;

   elm_genlist_item_insert_before(list, _itc,
                                  (void *)(long)nitems++, NULL,
                                  glit, ELM_GENLIST_ITEM_NONE,
                                  _item_sel_cb, NULL);

}