express: Add a user count label to channel userlist to show total

number of users

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-02-20 11:22:39 -05:00
parent 43f50c761d
commit 6c195d3e38
1 changed files with 40 additions and 1 deletions

View File

@ -27,6 +27,8 @@ struct _Channel
{
Evas_Object *o_frame;
Evas_Object *o_spacer;
Evas_Object *o_box;
Evas_Object *o_label;
Evas_Object *o_list;
Evas_Object *o_dismiss;
Eina_Bool visible : 1;
@ -339,6 +341,31 @@ _channel_userlist_create(Channel *chl)
edje_object_part_swallow(chl->o_base, "userlist.content", o);
}
if (!chl->userlist.o_box)
{
Evas_Object *o;
o = elm_box_add(chl->o_win);
elm_box_align_set(o, 0.5, 0.0);
elm_box_padding_set(o, 2, 2);
evas_object_show(o);
chl->userlist.o_box = o;
elm_object_content_set(chl->userlist.o_frame, o);
}
if (!chl->userlist.o_label)
{
Evas_Object *o;
o = elm_label_add(chl->o_win);
elm_label_line_wrap_set(o, ELM_WRAP_NONE);
evas_object_show(o);
chl->userlist.o_label = o;
elm_box_pack_end(chl->userlist.o_box, o);
}
if (!chl->userlist.o_list)
{
Evas_Object *o;
@ -347,9 +374,10 @@ _channel_userlist_create(Channel *chl)
WEIGHT_SET(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
ALIGN_SET(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_focus_allow_set(o, EINA_FALSE);
evas_object_show(o);
chl->userlist.o_list = o;
elm_object_content_set(chl->userlist.o_frame, o);
elm_box_pack_end(chl->userlist.o_box, o);
}
if (!chl->userlist.o_spacer)
@ -486,6 +514,8 @@ _channel_destroy(Channel *chl)
if (chl->userlist.o_dismiss) evas_object_del(chl->userlist.o_dismiss);
if (chl->userlist.o_list) evas_object_del(chl->userlist.o_list);
if (chl->userlist.o_label) evas_object_del(chl->userlist.o_label);
if (chl->userlist.o_box) evas_object_del(chl->userlist.o_box);
if (chl->userlist.o_spacer) evas_object_del(chl->userlist.o_spacer);
if (chl->userlist.o_frame) evas_object_del(chl->userlist.o_frame);
@ -845,6 +875,9 @@ _channel_network_set(Channel *chl, Express_Network *net)
void
_channel_userlist_user_append(Channel *chl, const char *user, Eina_Bool op)
{
char users[PATH_MAX];
static int opcount;
if ((!user) || (strlen(user) < 1)) return;
/* append to list of users for autocomplete */
@ -873,7 +906,13 @@ _channel_userlist_user_append(Channel *chl, const char *user, Eina_Bool op)
elm_list_item_sorted_insert(chl->userlist.o_list, user, icon, NULL,
NULL, &data, _cb_userlist_compare);
opcount++;
}
snprintf(users, sizeof(users), "(%d ops, %d total)",
opcount, eina_list_count(chl->userlist.users));
elm_object_text_set(chl->userlist.o_label, users);
}
void