sort operators in userlist by available 'data'. we cannot sort by if

they have an icon or not because the 'icon' does not actually get set
until the item is realized.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-02-13 16:00:44 -05:00
parent 701f204bc6
commit 7c191eef05
1 changed files with 9 additions and 8 deletions

View File

@ -169,7 +169,7 @@ _cb_userlist_compare(const void *data1, const void *data2)
{
const char *label1, *label2;
const Elm_Object_Item *item1, *item2;
const Evas_Object *icon1, *icon2;
char *item_data1, *item_data2;
item1 = data1;
item2 = data2;
@ -177,14 +177,14 @@ _cb_userlist_compare(const void *data1, const void *data2)
label1 = elm_object_item_text_get(item1);
label2 = elm_object_item_text_get(item2);
icon1 = elm_object_item_part_content_get(item1, "elm.swallow.icon");
icon2 = elm_object_item_part_content_get(item2, "elm.swallow.icon");
item_data1 = elm_object_item_data_get(item1);
item_data2 = elm_object_item_data_get(item2);
if ((icon1) && (icon2))
if ((item_data1) && (item_data2))
return strcasecmp(label1, label2);
else if ((icon1) && (!icon2))
return 1;
else if ((!icon1) && (icon2))
else if ((item_data1) && (!item_data2))
return -1;
else if ((!item_data1) && (item_data2))
return 1;
return strcasecmp(label1, label2);
@ -858,6 +858,7 @@ _channel_userlist_user_append(Channel *chl, const char *user, Eina_Bool op)
{
Evas_Object *icon;
char buff[PATH_MAX];
static char data[] = "1";
icon = elm_icon_add(chl->o_bg);
elm_image_resizable_set(icon, EINA_TRUE, EINA_TRUE);
@ -871,7 +872,7 @@ _channel_userlist_user_append(Channel *chl, const char *user, Eina_Bool op)
evas_object_show(icon);
elm_list_item_sorted_insert(chl->userlist.o_list, user, icon, NULL,
NULL, NULL, _cb_userlist_compare);
NULL, &data, _cb_userlist_compare);
}
}