fix up channel count and missed channel count to work properly

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2014-12-17 13:49:15 -05:00
parent dafbb86da9
commit af99dea79c
3 changed files with 36 additions and 21 deletions

View File

@ -248,18 +248,26 @@ _channel_focused_get(Channel *chl)
void
_channel_focus(Channel *chl)
{
if (chl->focused) return;
edje_object_signal_emit(chl->o_bg, "focus,in", PACKAGE_NAME);
edje_object_signal_emit(chl->o_base, "focus,in", PACKAGE_NAME);
elm_object_focus_set(chl->o_grid, EINA_TRUE);
chl->focused = EINA_TRUE;
chl->missed = EINA_FALSE;
}
void
_channel_unfocus(Channel *chl)
{
if (!chl->focused) return;
elm_object_focus_set(chl->o_grid, EINA_FALSE);
edje_object_signal_emit(chl->o_bg, "focus,out", PACKAGE_NAME);
edje_object_signal_emit(chl->o_base, "focus,out", PACKAGE_NAME);
chl->focused = EINA_FALSE;
}
const char *
@ -398,8 +406,12 @@ _channel_missed_count_set(Channel *chl, int count)
snprintf(buff, sizeof(buff), "%i", count);
edje_object_part_text_set(chl->o_bg, "chlmissed.label", buff);
edje_object_signal_emit(chl->o_bg, "chlmissed,on", PACKAGE_NAME);
}
else
edje_object_part_text_set(chl->o_bg, "chlmissed.label", NULL);
if (count > 0)
edje_object_signal_emit(chl->o_bg, "chlmissed,on", PACKAGE_NAME);
else
edje_object_signal_emit(chl->o_bg, "chlmissed,off", PACKAGE_NAME);
}
@ -439,16 +451,17 @@ _channel_unswallowed_set(Channel *chl, Eina_Bool swallowed)
void
_channel_spacer_create(Channel *chl)
{
Evas_Coord w = 0, h = 0;
if (!chl->o_spacer)
{
Evas_Coord w = 0, h = 0;
chl->o_spacer = evas_object_rectangle_add(chl->evas);
evas_object_color_set(chl->o_spacer, 0, 0, 0, 0);
elm_coords_finger_size_adjust(1, &w, 1, &h);
evas_object_size_hint_min_set(chl->o_spacer, w, h);
edje_object_part_swallow(chl->o_bg, "chlcount.control", chl->o_spacer);
}
elm_coords_finger_size_adjust(1, &w, 1, &h);
evas_object_size_hint_min_set(chl->o_spacer, w, h);
edje_object_part_swallow(chl->o_bg, "chlcount.control", chl->o_spacer);
}
void
@ -464,6 +477,11 @@ _channel_text_append(Channel *chl, const char *user, const char *txt)
}
_grid_text_append(chl->o_grid, txt, strlen(txt));
if (!chl->focused) chl->missed = EINA_TRUE;
else chl->missed = EINA_FALSE;
_window_channel_count_update();
}
void

View File

@ -501,7 +501,7 @@ _window_channel_create(const char *name, const char *server)
_channel_size_update(chl);
/* update channel count */
_window_channel_count_update(chl);
_window_channel_count_update();
return chl;
}
@ -567,17 +567,16 @@ _window_channel_focus(Channel *chl)
if (pchl != chl)
{
if (_channel_focused_get(pchl))
{
_channel_focused_set(pchl, EINA_FALSE);
_channel_unfocus(pchl);
}
_channel_unfocus(pchl);
}
}
/* focus this channel */
_channel_focused_set(chl, EINA_TRUE);
_channel_focus(chl);
/* update window channel count */
_window_channel_count_update();
/* set window title */
snprintf(buff, sizeof(buff), "%s - %s", elm_app_name_get(),
_channel_name_get(chl));
@ -692,11 +691,11 @@ _window_channel_switch(Channel *chl, Channel *new_chl)
}
void
_window_channel_count_update(Channel *chl)
_window_channel_count_update(void)
{
Eina_List *l = NULL;
Channel *pchl;
int missed = 0, cnt = 0, chl_cnt = 0, n = 0;
int missed = 0, cnt = 0, n = 0;
n = eina_list_count(_win->channels);
if (n < 1) return;
@ -705,15 +704,13 @@ _window_channel_count_update(Channel *chl)
{
if (_channel_missed_get(pchl)) missed++;
cnt++;
if (pchl == chl) chl_cnt = cnt;
_channel_spacer_create(pchl);
_channel_count_set(pchl, cnt, n);
}
EINA_LIST_FOREACH(_win->channels, l, pchl)
{
_channel_spacer_create(pchl);
_channel_count_set(pchl, chl_cnt, n);
_channel_missed_count_set(pchl, missed);
}
_channel_missed_count_set(pchl, missed);
}
void

View File

@ -18,7 +18,7 @@ Channel *_window_channel_focused_get(void);
Channel *_window_channel_previous_get(Channel *chl);
Channel *_window_channel_next_get(Channel *chl);
void _window_channel_switch(Channel *chl, Channel *new_chl);
void _window_channel_count_update(Channel *chl);
void _window_channel_count_update(void);
void _window_options_toggle(Evas_Object *grid, void (*cb_done)(void *data), void *data);