+ if (!it->separator)
+ it->prio.visible = (*iw <= vw);
+ else
+ {
+ prev = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
+ it->prio.visible = prev->prio.visible;
+ }
+ }
+}
+
+static void
+_fix_items_visibility_by_number(Widget_Data *wd, unsigned int *count)
+{
+ Elm_Toolbar_Item *it, *prev, *next, *max = NULL;
+ Eina_List *sorted = NULL;
+ *count = 0;
+
+ EINA_INLIST_FOREACH(wd->items, it)
+ {
+ if (it->separator)
+ {
+ prev = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
+ it->prio.priority = prev->prio.priority;
+ }
+ }
+
+ EINA_INLIST_FOREACH(wd->items, it)
+ {
+ sorted = eina_list_sorted_insert(sorted,
+ _toolbar_item_prio_compare_cb, it);
+ }
+
+ EINA_LIST_FREE(sorted, it)
+ {
+ *count += 1;
+ if(*count <= wd->item_max)
+ {
+ it->prio.visible = EINA_TRUE;
+ it->in_box = wd->bx;
+ if (*count == wd->item_max)
+ max = it;
+ }
+ else
+ {
+ it->prio.visible = EINA_FALSE;
+ if (wd->item_count < (wd->item_max * 2) ||
+ *count <= (wd->item_count + wd->item_max) / 2)
+ it->in_box = wd->bx_more;
+ else
+ it->in_box = wd->bx_more2;
+
+ if (max)
+ {
+ max->prio.visible = EINA_FALSE;
+ max->in_box = wd->bx_more;
+ next = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(max)->next);
+ if (next && next->separator)
+ {
+ next->prio.visible = max->prio.visible;
+ next->in_box = max->in_box;
+ }
+ max = NULL;
+ }
+ }