2014-01-19 03:11:32 -08:00
|
|
|
#include "private.h"
|
|
|
|
#include "channel.h"
|
|
|
|
#include "config.h"
|
|
|
|
#include "theme.h"
|
|
|
|
#include "window.h"
|
|
|
|
#include "grid.h"
|
2015-02-12 11:02:24 -08:00
|
|
|
#include "utils.h"
|
2014-01-19 03:11:32 -08:00
|
|
|
|
|
|
|
struct _Channel
|
|
|
|
{
|
|
|
|
const char *name;
|
2014-12-11 11:14:34 -08:00
|
|
|
const char *server;
|
2014-01-19 03:11:32 -08:00
|
|
|
|
|
|
|
Evas *evas;
|
2015-02-07 08:48:15 -08:00
|
|
|
Evas_Object *o_win;
|
2014-01-19 03:11:32 -08:00
|
|
|
Evas_Object *o_base;
|
|
|
|
Evas_Object *o_bg;
|
|
|
|
Evas_Object *o_grid;
|
|
|
|
Evas_Object *o_spacer;
|
2015-02-11 06:50:01 -08:00
|
|
|
Evas_Object *o_tab_spacer;
|
|
|
|
Evas_Object *o_tabregion_bg;
|
|
|
|
Evas_Object *o_tabregion_base;
|
2014-01-19 03:11:32 -08:00
|
|
|
Evas_Object *o_img;
|
2014-12-18 13:33:17 -08:00
|
|
|
Evas_Object *o_entry;
|
2014-01-19 03:11:32 -08:00
|
|
|
|
2015-01-30 10:03:35 -08:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
Evas_Object *o_frame;
|
|
|
|
Evas_Object *o_spacer;
|
|
|
|
Evas_Object *o_list;
|
2015-02-06 08:50:30 -08:00
|
|
|
Evas_Object *o_dismiss;
|
2015-01-30 10:03:35 -08:00
|
|
|
Eina_Bool visible : 1;
|
2015-02-11 12:55:47 -08:00
|
|
|
Eina_List *users;
|
2015-01-30 10:03:35 -08:00
|
|
|
} userlist;
|
|
|
|
|
2015-02-11 06:50:01 -08:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
Evas_Object *o_box;
|
|
|
|
Eina_List *tabs;
|
|
|
|
} l, r;
|
|
|
|
} tabbar;
|
|
|
|
|
2014-01-19 03:11:32 -08:00
|
|
|
int step_x, step_y;
|
|
|
|
int min_w, min_h;
|
|
|
|
int req_w, req_h;
|
|
|
|
|
2015-02-11 06:50:01 -08:00
|
|
|
Eina_Bool active : 1;
|
2014-01-19 03:11:32 -08:00
|
|
|
Eina_Bool size_done : 1;
|
|
|
|
Eina_Bool translucent : 1;
|
|
|
|
Eina_Bool focused : 1;
|
|
|
|
Eina_Bool unswallowed : 1;
|
|
|
|
Eina_Bool missed : 1;
|
2014-12-19 12:08:09 -08:00
|
|
|
|
|
|
|
Express_Network *net;
|
2014-01-19 03:11:32 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_theme_reload(Channel *chl)
|
|
|
|
{
|
2014-12-02 09:28:24 -08:00
|
|
|
Edje_Message_Int msg;
|
|
|
|
|
2014-01-19 03:11:32 -08:00
|
|
|
chl->translucent = _ex_cfg->gui.translucent;
|
|
|
|
|
|
|
|
if (chl->translucent)
|
2014-12-02 09:28:24 -08:00
|
|
|
msg.val = _ex_cfg->gui.opacity;
|
2014-01-19 03:11:32 -08:00
|
|
|
else
|
2014-12-02 09:28:24 -08:00
|
|
|
msg.val = 100;
|
|
|
|
|
|
|
|
edje_object_message_send(chl->o_bg, EDJE_MESSAGE_INT, 1, &msg);
|
|
|
|
edje_object_message_send(chl->o_base, EDJE_MESSAGE_INT, 1, &msg);
|
2014-01-19 03:11:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_size_hint(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj, void *event EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Channel *chl;
|
|
|
|
Evas_Coord mw, mh, rw, rh, w = 0, h = 0;
|
|
|
|
|
|
|
|
chl = data;
|
|
|
|
|
|
|
|
evas_object_size_hint_min_get(obj, &mw, &mh);
|
|
|
|
evas_object_size_hint_request_get(obj, &rw, &rh);
|
|
|
|
|
|
|
|
edje_object_size_min_calc(chl->o_base, &w, &h);
|
|
|
|
evas_object_size_hint_min_set(chl->o_base, w, h);
|
|
|
|
|
|
|
|
edje_object_size_min_calc(chl->o_bg, &w, &h);
|
|
|
|
evas_object_size_hint_min_set(chl->o_bg, w, h);
|
|
|
|
|
|
|
|
chl->step_x = mw;
|
|
|
|
chl->step_y = mh;
|
|
|
|
chl->min_w = (w - mw);
|
|
|
|
chl->min_h = (h - mh);
|
|
|
|
chl->req_w = (w - mw + rw);
|
|
|
|
chl->req_h = (h - mh + rh);
|
2014-12-02 12:10:54 -08:00
|
|
|
|
2015-02-11 06:50:01 -08:00
|
|
|
if (chl->active) _window_size_update();
|
2014-01-19 03:11:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_prev(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Channel *chl, *pchl = NULL;
|
|
|
|
|
|
|
|
chl = data;
|
2015-02-11 06:50:01 -08:00
|
|
|
if (chl->active)
|
2014-01-19 03:11:32 -08:00
|
|
|
{
|
|
|
|
if ((pchl = _window_channel_previous_get(chl)))
|
|
|
|
_window_channel_switch(chl, pchl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_next(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Channel *chl, *nchl = NULL;
|
|
|
|
|
|
|
|
chl = data;
|
2015-02-11 06:50:01 -08:00
|
|
|
if (chl->active)
|
2014-01-19 03:11:32 -08:00
|
|
|
{
|
|
|
|
if ((nchl = _window_channel_next_get(chl)))
|
|
|
|
_window_channel_switch(chl, nchl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_count_go(void *data, Evas_Object *obj EINA_UNUSED, const char *sig EINA_UNUSED, const char *source EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Channel *chl;
|
|
|
|
|
|
|
|
chl = data;
|
|
|
|
_window_channel_switch(chl, chl);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_count_prev(void *data, Evas_Object *obj EINA_UNUSED, const char *sig EINA_UNUSED, const char *source EINA_UNUSED)
|
|
|
|
{
|
|
|
|
_cb_prev(data, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_count_next(void *data, Evas_Object *obj EINA_UNUSED, const char *sig EINA_UNUSED, const char *source EINA_UNUSED)
|
|
|
|
{
|
|
|
|
_cb_next(data, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2015-01-30 10:03:35 -08:00
|
|
|
static void
|
|
|
|
_cb_userlist_go(void *data, Evas_Object *obj EINA_UNUSED, const char *sig EINA_UNUSED, const char *source EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Channel *chl;
|
|
|
|
|
|
|
|
chl = data;
|
|
|
|
if (!chl->userlist.visible)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(chl->o_base, "userlist,show", PACKAGE_NAME);
|
|
|
|
chl->userlist.visible = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(chl->o_base, "userlist,hide", PACKAGE_NAME);
|
|
|
|
chl->userlist.visible = EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-06 08:02:19 -08:00
|
|
|
static int
|
|
|
|
_cb_userlist_compare(const void *data1, const void *data2)
|
|
|
|
{
|
|
|
|
const char *label1, *label2;
|
|
|
|
const Elm_Object_Item *item1, *item2;
|
|
|
|
const Evas_Object *icon1, *icon2;
|
|
|
|
|
|
|
|
item1 = data1;
|
|
|
|
item2 = 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");
|
|
|
|
|
|
|
|
if ((icon1) && (icon2))
|
|
|
|
return strcasecmp(label1, label2);
|
|
|
|
else if ((icon1) && (!icon2))
|
|
|
|
return 1;
|
|
|
|
else if ((!icon1) && (icon2))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return strcasecmp(label1, label2);
|
|
|
|
}
|
|
|
|
|
2015-02-06 08:50:30 -08:00
|
|
|
static void
|
|
|
|
_cb_userlist_dismiss_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
|
|
|
|
{
|
|
|
|
_cb_userlist_go(data, NULL, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_userlist_done(void *data, Evas_Object *obj EINA_UNUSED, const char *sig EINA_UNUSED, const char *source EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Channel *chl;
|
|
|
|
|
|
|
|
chl = data;
|
|
|
|
chl->userlist.o_dismiss = NULL;
|
|
|
|
}
|
|
|
|
|
2014-01-19 03:11:32 -08:00
|
|
|
static void
|
|
|
|
_cb_options_done(void *data)
|
|
|
|
{
|
|
|
|
Channel *chl;
|
|
|
|
|
|
|
|
chl = data;
|
2015-02-11 11:04:25 -08:00
|
|
|
if (chl->active) elm_object_focus_set(chl->o_entry, EINA_TRUE);
|
2014-01-19 03:11:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_options(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Channel *chl;
|
|
|
|
|
|
|
|
chl = data;
|
|
|
|
_window_options_toggle(chl->o_grid, _cb_options_done, chl);
|
|
|
|
}
|
|
|
|
|
2014-12-19 11:01:35 -08:00
|
|
|
static void
|
|
|
|
_cb_entry_go(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Channel *chl;
|
|
|
|
char *txt;
|
|
|
|
|
|
|
|
chl = data;
|
2014-12-19 12:08:09 -08:00
|
|
|
if (!chl->net) return;
|
|
|
|
|
2014-12-19 11:01:35 -08:00
|
|
|
if ((txt = (char *)elm_entry_entry_get(chl->o_entry)))
|
|
|
|
{
|
|
|
|
if ((txt = elm_entry_markup_to_utf8(txt)))
|
|
|
|
{
|
2014-12-19 12:08:09 -08:00
|
|
|
char buff[PATH_MAX];
|
2015-01-29 07:50:30 -08:00
|
|
|
const char *nick;
|
2014-12-19 12:08:09 -08:00
|
|
|
|
|
|
|
snprintf(buff, sizeof(buff), "%s\r\n", txt);
|
|
|
|
express_network_channel_priv_send(chl->net, chl->name, buff);
|
|
|
|
|
2015-01-29 07:50:30 -08:00
|
|
|
nick = express_network_nickname_get(chl->net);
|
|
|
|
_channel_text_append(chl, nick, buff);
|
2014-12-19 12:08:09 -08:00
|
|
|
|
2015-01-29 07:50:30 -08:00
|
|
|
elm_entry_entry_set(chl->o_entry, "");
|
2014-12-19 11:01:35 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-12 11:02:24 -08:00
|
|
|
static void
|
|
|
|
_cb_entry_key_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Evas_Event_Key_Down *ev;
|
|
|
|
|
|
|
|
ev = event;
|
|
|
|
|
|
|
|
if (!strcmp(ev->key, "Tab"))
|
|
|
|
{
|
|
|
|
Channel *chl;
|
|
|
|
const char *usr, *str;
|
|
|
|
Eina_List *l;
|
2015-02-12 11:46:31 -08:00
|
|
|
Eina_Strbuf *sb;
|
|
|
|
char *s;
|
2015-02-12 11:02:24 -08:00
|
|
|
|
|
|
|
chl = data;
|
|
|
|
|
|
|
|
str = elm_entry_entry_get(chl->o_entry);
|
|
|
|
if ((!str) || (strlen(str) < 1)) return;
|
|
|
|
|
2015-02-12 11:46:31 -08:00
|
|
|
sb = eina_strbuf_new();
|
2015-02-12 11:02:24 -08:00
|
|
|
EINA_LIST_FOREACH(chl->userlist.users, l, usr)
|
|
|
|
{
|
|
|
|
if (_util_str_has_prefix(usr, str))
|
|
|
|
{
|
2015-02-12 11:46:31 -08:00
|
|
|
eina_strbuf_append_length(sb, usr, strlen(usr));
|
|
|
|
eina_strbuf_append_char(sb, ' ');
|
2015-02-12 11:02:24 -08:00
|
|
|
}
|
|
|
|
}
|
2015-02-12 11:46:31 -08:00
|
|
|
|
|
|
|
if (eina_strbuf_length_get(sb) < 1)
|
|
|
|
{
|
|
|
|
eina_strbuf_free(sb);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
eina_strbuf_append_char(sb, '\r');
|
|
|
|
eina_strbuf_append_char(sb, '\n');
|
|
|
|
|
|
|
|
s = eina_strbuf_string_steal(sb);
|
|
|
|
eina_strbuf_free(sb);
|
|
|
|
|
|
|
|
_channel_text_append(chl, "*", s);
|
2015-02-12 11:02:24 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-11 06:50:01 -08:00
|
|
|
static void
|
|
|
|
_cb_tabregion_change(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj, void *event EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Channel *chl;
|
|
|
|
Evas_Coord w = 0, h = 0;
|
|
|
|
|
|
|
|
chl = data;
|
|
|
|
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
|
|
|
|
evas_object_size_hint_min_set(chl->o_tabregion_base, w, h);
|
|
|
|
edje_object_part_swallow(chl->o_base, "channel.tabregion",
|
|
|
|
chl->o_tabregion_base);
|
|
|
|
}
|
|
|
|
|
2015-01-30 10:03:35 -08:00
|
|
|
static void
|
|
|
|
_channel_userlist_create(Channel *chl)
|
|
|
|
{
|
|
|
|
if (!chl->userlist.o_frame)
|
|
|
|
{
|
|
|
|
Evas_Object *o;
|
|
|
|
|
2015-02-07 08:48:15 -08:00
|
|
|
o = elm_frame_add(chl->o_win);
|
2015-01-30 10:03:35 -08:00
|
|
|
WEIGHT_SET(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
ALIGN_SET(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
elm_object_text_set(o, "Users");
|
2015-02-11 11:04:25 -08:00
|
|
|
elm_object_focus_allow_set(o, EINA_FALSE);
|
2015-01-30 10:03:35 -08:00
|
|
|
|
|
|
|
chl->userlist.o_frame = o;
|
|
|
|
edje_object_part_swallow(chl->o_base, "userlist.content", o);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!chl->userlist.o_list)
|
|
|
|
{
|
|
|
|
Evas_Object *o;
|
|
|
|
|
2015-02-07 08:48:15 -08:00
|
|
|
o = elm_list_add(chl->o_win);
|
2015-01-30 10:03:35 -08:00
|
|
|
WEIGHT_SET(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
ALIGN_SET(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2015-02-11 11:04:25 -08:00
|
|
|
elm_object_focus_allow_set(o, EINA_FALSE);
|
2015-01-30 10:03:35 -08:00
|
|
|
|
|
|
|
chl->userlist.o_list = o;
|
|
|
|
elm_object_content_set(chl->userlist.o_frame, o);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!chl->userlist.o_spacer)
|
|
|
|
{
|
|
|
|
Evas_Object *o;
|
|
|
|
Evas_Coord w = 0, h = 0;
|
|
|
|
|
2015-02-07 08:48:15 -08:00
|
|
|
o = elm_icon_add(chl->o_win);
|
2015-01-30 10:03:35 -08:00
|
|
|
elm_icon_standard_set(o, "user-idle");
|
|
|
|
elm_coords_finger_size_adjust(1, &w, 1, &h);
|
|
|
|
evas_object_size_hint_min_set(o, w, h);
|
2015-02-11 11:04:25 -08:00
|
|
|
elm_object_focus_allow_set(o, EINA_FALSE);
|
2015-01-30 10:03:35 -08:00
|
|
|
|
|
|
|
chl->userlist.o_spacer = o;
|
|
|
|
edje_object_part_swallow(chl->o_bg, "userlist.control", o);
|
|
|
|
}
|
2015-02-06 08:50:30 -08:00
|
|
|
|
|
|
|
if (!chl->userlist.o_dismiss)
|
|
|
|
{
|
2015-02-07 08:48:15 -08:00
|
|
|
chl->userlist.o_dismiss = evas_object_rectangle_add(chl->evas);
|
2015-02-06 08:50:30 -08:00
|
|
|
evas_object_color_set(chl->userlist.o_dismiss, 0, 0, 0, 0);
|
|
|
|
evas_object_event_callback_add(chl->userlist.o_dismiss,
|
|
|
|
EVAS_CALLBACK_MOUSE_DOWN,
|
|
|
|
_cb_userlist_dismiss_mouse_down, chl);
|
|
|
|
edje_object_signal_callback_add(chl->o_base, "userlist,hide,done",
|
|
|
|
PACKAGE_NAME, _cb_userlist_done, chl);
|
|
|
|
edje_object_part_swallow(chl->o_base, "userlist.dismiss",
|
|
|
|
chl->userlist.o_dismiss);
|
|
|
|
}
|
2015-01-30 10:03:35 -08:00
|
|
|
}
|
|
|
|
|
2014-01-19 03:11:32 -08:00
|
|
|
/* external functions */
|
|
|
|
Channel *
|
2015-02-07 08:48:15 -08:00
|
|
|
_channel_create(Evas *evas, Evas_Object *win, const char *name, const char *server)
|
2014-01-19 03:11:32 -08:00
|
|
|
{
|
|
|
|
Channel *chl;
|
|
|
|
|
|
|
|
/* try to allocate space for channel structure */
|
|
|
|
if (!(chl = calloc(1, sizeof(Channel)))) return NULL;
|
|
|
|
|
|
|
|
/* set channel to the opposite of config translucent
|
|
|
|
* NB: This is done so that first time through the signals get sent */
|
|
|
|
chl->translucent = !_ex_cfg->gui.translucent;
|
|
|
|
|
|
|
|
chl->evas = evas;
|
2015-02-07 08:48:15 -08:00
|
|
|
chl->o_win = win;
|
2014-01-19 03:11:32 -08:00
|
|
|
|
|
|
|
/* store channel name */
|
|
|
|
if (name) chl->name = eina_stringshare_add(name);
|
|
|
|
|
2014-12-11 11:14:34 -08:00
|
|
|
/* store channel server */
|
|
|
|
if (server) chl->server = eina_stringshare_add(server);
|
|
|
|
|
2014-01-19 03:11:32 -08:00
|
|
|
/* add base object */
|
|
|
|
chl->o_base = edje_object_add(evas);
|
|
|
|
_theme_apply(chl->o_base, "express/channel");
|
|
|
|
_theme_reload_enable(chl->o_base);
|
|
|
|
evas_object_data_set(chl->o_base, "theme_reload_func", _cb_theme_reload);
|
|
|
|
evas_object_data_set(chl->o_base, "theme_reload_func_data", chl);
|
|
|
|
|
|
|
|
/* add bg object */
|
|
|
|
chl->o_bg = edje_object_add(evas);
|
|
|
|
WEIGHT_SET(chl->o_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
FILL_SET(chl->o_bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
_theme_apply(chl->o_bg, "express/background");
|
|
|
|
_theme_reload_enable(chl->o_bg);
|
|
|
|
evas_object_data_set(chl->o_bg, "theme_reload_func", _cb_theme_reload);
|
|
|
|
evas_object_data_set(chl->o_bg, "theme_reload_func_data", chl);
|
|
|
|
|
2015-02-11 06:50:01 -08:00
|
|
|
/* add tabregion */
|
|
|
|
chl->o_tabregion_bg = evas_object_rectangle_add(evas);
|
|
|
|
evas_object_color_set(chl->o_tabregion_bg, 0, 0, 0, 0);
|
|
|
|
evas_object_event_callback_add(chl->o_tabregion_bg, EVAS_CALLBACK_MOVE,
|
|
|
|
_cb_tabregion_change, chl);
|
|
|
|
evas_object_event_callback_add(chl->o_tabregion_bg, EVAS_CALLBACK_RESIZE,
|
|
|
|
_cb_tabregion_change, chl);
|
|
|
|
edje_object_part_swallow(chl->o_bg, "channel.tabregion",
|
|
|
|
chl->o_tabregion_bg);
|
|
|
|
|
|
|
|
chl->o_tabregion_base = evas_object_rectangle_add(evas);
|
|
|
|
evas_object_color_set(chl->o_tabregion_base, 0, 0, 0, 0);
|
|
|
|
edje_object_part_swallow(chl->o_base, "channel.tabregion",
|
|
|
|
chl->o_tabregion_base);
|
|
|
|
|
2014-01-19 03:11:32 -08:00
|
|
|
/* add grid */
|
|
|
|
chl->o_grid = _grid_add(evas);
|
|
|
|
WEIGHT_SET(chl->o_grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
FILL_SET(chl->o_grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2014-12-02 12:10:54 -08:00
|
|
|
|
2015-01-30 10:03:35 -08:00
|
|
|
/* add userlist */
|
|
|
|
_channel_userlist_create(chl);
|
|
|
|
|
2014-12-02 12:10:54 -08:00
|
|
|
evas_object_event_callback_add(chl->o_grid,
|
|
|
|
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_cb_size_hint, chl);
|
|
|
|
|
2014-01-19 03:11:32 -08:00
|
|
|
evas_object_smart_callback_add(chl->o_grid, "options", _cb_options, chl);
|
|
|
|
evas_object_smart_callback_add(chl->o_grid, "prev", _cb_prev, chl);
|
|
|
|
evas_object_smart_callback_add(chl->o_grid, "next", _cb_next, chl);
|
|
|
|
|
|
|
|
/* swallow parts */
|
|
|
|
edje_object_part_swallow(chl->o_base, "channel.content", chl->o_grid);
|
|
|
|
edje_object_part_swallow(chl->o_bg, "background.content", chl->o_base);
|
|
|
|
|
|
|
|
/* add handlers for chlcount signals */
|
|
|
|
edje_object_signal_callback_add(chl->o_bg, "chlcount,go", PACKAGE_NAME,
|
|
|
|
_cb_count_go, chl);
|
|
|
|
edje_object_signal_callback_add(chl->o_bg, "chlcount,prev", PACKAGE_NAME,
|
|
|
|
_cb_count_prev, chl);
|
|
|
|
edje_object_signal_callback_add(chl->o_bg, "chlcount,next", PACKAGE_NAME,
|
|
|
|
_cb_count_next, chl);
|
|
|
|
|
2015-01-30 10:03:35 -08:00
|
|
|
/* add handlers for userlist signals */
|
|
|
|
edje_object_signal_callback_add(chl->o_bg, "userlist,go", PACKAGE_NAME,
|
|
|
|
_cb_userlist_go, chl);
|
|
|
|
|
2014-01-19 03:11:32 -08:00
|
|
|
return chl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_destroy(Channel *chl)
|
|
|
|
{
|
2015-02-12 11:02:24 -08:00
|
|
|
const char *usr;
|
|
|
|
|
2015-02-11 06:50:01 -08:00
|
|
|
/* delete tabregion stuff */
|
|
|
|
_channel_tabbar_clear(chl);
|
|
|
|
if (chl->o_tabregion_bg) evas_object_del(chl->o_tabregion_bg);
|
|
|
|
if (chl->o_tabregion_base) evas_object_del(chl->o_tabregion_base);
|
|
|
|
if (chl->o_tab_spacer) evas_object_del(chl->o_tab_spacer);
|
|
|
|
|
2015-02-07 08:48:15 -08:00
|
|
|
/* delete channel userlist objects */
|
2015-02-12 11:02:24 -08:00
|
|
|
EINA_LIST_FREE(chl->userlist.users, usr)
|
|
|
|
eina_stringshare_del(usr);
|
|
|
|
|
2015-02-07 08:48:15 -08:00
|
|
|
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_spacer) evas_object_del(chl->userlist.o_spacer);
|
|
|
|
if (chl->userlist.o_frame) evas_object_del(chl->userlist.o_frame);
|
|
|
|
|
2014-12-11 11:14:34 -08:00
|
|
|
/* delete channel objects */
|
2014-12-02 10:48:43 -08:00
|
|
|
if (chl->o_img) evas_object_del(chl->o_img);
|
|
|
|
if (chl->o_spacer) evas_object_del(chl->o_spacer);
|
2014-12-18 13:33:17 -08:00
|
|
|
if (chl->o_entry) evas_object_del(chl->o_entry);
|
2014-12-02 10:48:43 -08:00
|
|
|
if (chl->o_grid) evas_object_del(chl->o_grid);
|
|
|
|
if (chl->o_bg) evas_object_del(chl->o_bg);
|
|
|
|
if (chl->o_base) evas_object_del(chl->o_base);
|
|
|
|
|
2014-01-19 03:11:32 -08:00
|
|
|
/* delete channel name */
|
|
|
|
if (chl->name) eina_stringshare_del(chl->name);
|
|
|
|
|
2014-12-11 11:14:34 -08:00
|
|
|
/* delete channel server name */
|
|
|
|
if (chl->server) eina_stringshare_del(chl->server);
|
|
|
|
|
2014-01-19 03:11:32 -08:00
|
|
|
/* free allocated channel structure */
|
|
|
|
free(chl);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_update(Channel *chl)
|
|
|
|
{
|
|
|
|
chl->size_done = EINA_FALSE;
|
|
|
|
|
|
|
|
/* update channel transparency */
|
|
|
|
_cb_theme_reload(chl);
|
|
|
|
|
|
|
|
/* update grid config */
|
|
|
|
_grid_update(chl->o_grid);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_focused_set(Channel *chl, Eina_Bool focus)
|
|
|
|
{
|
|
|
|
chl->focused = focus;
|
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool
|
|
|
|
_channel_focused_get(Channel *chl)
|
|
|
|
{
|
|
|
|
return chl->focused;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_focus(Channel *chl)
|
|
|
|
{
|
2014-12-17 10:49:15 -08:00
|
|
|
if (chl->focused) return;
|
|
|
|
|
2014-01-19 03:11:32 -08:00
|
|
|
edje_object_signal_emit(chl->o_bg, "focus,in", PACKAGE_NAME);
|
|
|
|
edje_object_signal_emit(chl->o_base, "focus,in", PACKAGE_NAME);
|
2014-12-17 10:49:15 -08:00
|
|
|
|
|
|
|
chl->focused = EINA_TRUE;
|
2014-01-19 03:11:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_unfocus(Channel *chl)
|
|
|
|
{
|
2014-12-17 10:49:15 -08:00
|
|
|
if (!chl->focused) return;
|
|
|
|
|
2014-01-19 03:11:32 -08:00
|
|
|
edje_object_signal_emit(chl->o_bg, "focus,out", PACKAGE_NAME);
|
|
|
|
edje_object_signal_emit(chl->o_base, "focus,out", PACKAGE_NAME);
|
2014-12-17 10:49:15 -08:00
|
|
|
|
|
|
|
chl->focused = EINA_FALSE;
|
2014-01-19 03:11:32 -08:00
|
|
|
}
|
|
|
|
|
2015-02-11 06:50:01 -08:00
|
|
|
void
|
|
|
|
_channel_active_set(Channel *chl, Eina_Bool active)
|
|
|
|
{
|
|
|
|
chl->active = active;
|
2015-02-11 11:04:25 -08:00
|
|
|
elm_object_focus_allow_set(chl->o_entry, active);
|
2015-02-11 10:09:20 -08:00
|
|
|
elm_object_focus_set(chl->o_entry, active);
|
2015-02-11 06:50:01 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool
|
|
|
|
_channel_active_get(Channel *chl)
|
|
|
|
{
|
|
|
|
return chl->active;
|
|
|
|
}
|
|
|
|
|
2014-01-19 03:11:32 -08:00
|
|
|
const char *
|
|
|
|
_channel_name_get(Channel *chl)
|
|
|
|
{
|
|
|
|
return chl->name;
|
|
|
|
}
|
|
|
|
|
2014-12-11 11:14:34 -08:00
|
|
|
const char *
|
|
|
|
_channel_server_name_get(Channel *chl)
|
|
|
|
{
|
|
|
|
return chl->server;
|
|
|
|
}
|
|
|
|
|
2014-01-19 03:11:32 -08:00
|
|
|
void
|
|
|
|
_channel_size_update(Channel *chl)
|
|
|
|
{
|
|
|
|
_cb_size_hint(chl, NULL, chl->o_grid, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_size_min_get(Channel *chl, int *w, int *h)
|
|
|
|
{
|
|
|
|
evas_object_size_hint_min_get(chl->o_bg, w, h);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_size_step_get(Channel *chl, int *w, int *h)
|
|
|
|
{
|
|
|
|
if (w) *w = chl->step_x;
|
|
|
|
if (h) *h = chl->step_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_size_request_get(Channel *chl, int *w, int *h)
|
|
|
|
{
|
|
|
|
if (w) *w = chl->req_w;
|
|
|
|
if (h) *h = chl->req_h;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_size_done_set(Channel *chl, Eina_Bool done)
|
|
|
|
{
|
|
|
|
chl->size_done = done;
|
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool
|
|
|
|
_channel_size_done_get(Channel *chl)
|
|
|
|
{
|
|
|
|
return chl->size_done;
|
|
|
|
}
|
|
|
|
|
|
|
|
Evas_Object *
|
|
|
|
_channel_background_get(Channel *chl)
|
|
|
|
{
|
|
|
|
return chl->o_bg;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_background_hide(Channel *chl)
|
|
|
|
{
|
|
|
|
evas_object_hide(chl->o_bg);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_background_show(Channel *chl)
|
|
|
|
{
|
|
|
|
evas_object_show(chl->o_bg);
|
|
|
|
}
|
|
|
|
|
|
|
|
Evas_Object *
|
|
|
|
_channel_base_get(Channel *chl)
|
|
|
|
{
|
|
|
|
return chl->o_base;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_base_unswallow(Channel *chl)
|
|
|
|
{
|
|
|
|
edje_object_part_unswallow(chl->o_bg, chl->o_base);
|
|
|
|
evas_object_lower(chl->o_base);
|
|
|
|
evas_object_move(chl->o_base, -9999, -9999);
|
|
|
|
evas_object_show(chl->o_base);
|
|
|
|
evas_object_clip_unset(chl->o_base);
|
|
|
|
#if (EVAS_VERSION_MAJOR > 1) || (EVAS_VERSION_MINOR >= 8)
|
|
|
|
evas_object_image_source_visible_set(chl->o_img, EINA_FALSE);
|
|
|
|
#endif
|
|
|
|
chl->unswallowed = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
Evas_Object *
|
|
|
|
_channel_image_get(Channel *chl)
|
|
|
|
{
|
|
|
|
return chl->o_img;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_image_unset(Channel *chl)
|
|
|
|
{
|
|
|
|
#if (EVAS_VERSION_MAJOR > 1) || (EVAS_VERSION_MINOR >= 8)
|
|
|
|
evas_object_image_source_visible_set(chl->o_img, EINA_TRUE);
|
|
|
|
#endif
|
|
|
|
chl->o_img = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_image_create(Channel *chl)
|
|
|
|
{
|
|
|
|
Evas_Coord w = 0, h = 0;
|
|
|
|
|
|
|
|
chl->o_img = evas_object_image_filled_add(chl->evas);
|
|
|
|
evas_object_image_source_set(chl->o_img, chl->o_base);
|
|
|
|
evas_object_geometry_get(chl->o_base, NULL, NULL, &w, &h);
|
|
|
|
evas_object_resize(chl->o_img, w, h);
|
|
|
|
evas_object_data_set(chl->o_img, "grid", chl->o_grid);
|
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool
|
|
|
|
_channel_missed_get(Channel *chl)
|
|
|
|
{
|
|
|
|
return chl->missed;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_missed_set(Channel *chl, Eina_Bool missed)
|
|
|
|
{
|
|
|
|
chl->missed = missed;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_missed_count_set(Channel *chl, int count)
|
|
|
|
{
|
|
|
|
if (count > 0)
|
|
|
|
{
|
|
|
|
char buff[32];
|
|
|
|
|
|
|
|
snprintf(buff, sizeof(buff), "%i", count);
|
|
|
|
edje_object_part_text_set(chl->o_bg, "chlmissed.label", buff);
|
|
|
|
}
|
2014-12-17 10:49:15 -08:00
|
|
|
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);
|
2014-01-19 03:11:32 -08:00
|
|
|
else
|
|
|
|
edje_object_signal_emit(chl->o_bg, "chlmissed,off", PACKAGE_NAME);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_count_set(Channel *chl, int count, int total)
|
|
|
|
{
|
|
|
|
if (total > 1)
|
|
|
|
{
|
|
|
|
char buff[32];
|
|
|
|
|
|
|
|
snprintf(buff, sizeof(buff), "%i/%i", count, total);
|
|
|
|
edje_object_part_text_set(chl->o_bg, "chlcount.label", buff);
|
|
|
|
edje_object_signal_emit(chl->o_bg, "chlcount,on", PACKAGE_NAME);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
edje_object_signal_emit(chl->o_bg, "chlcount,off", PACKAGE_NAME);
|
|
|
|
}
|
|
|
|
|
2015-01-30 10:03:35 -08:00
|
|
|
void
|
|
|
|
_channel_userlist_show(Channel *chl)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(chl->o_bg, "userlist,on", PACKAGE_NAME);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_userlist_hide(Channel *chl)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(chl->o_bg, "userlist,off", PACKAGE_NAME);
|
|
|
|
}
|
|
|
|
|
2014-01-19 03:11:32 -08:00
|
|
|
Eina_Bool
|
|
|
|
_channel_unswallowed_get(Channel *chl)
|
|
|
|
{
|
|
|
|
return chl->unswallowed;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_unswallowed_set(Channel *chl, Eina_Bool swallowed)
|
|
|
|
{
|
|
|
|
chl->unswallowed = swallowed;
|
|
|
|
if (!swallowed)
|
|
|
|
{
|
|
|
|
edje_object_part_swallow(chl->o_base, "channel.content", chl->o_grid);
|
|
|
|
edje_object_part_swallow(chl->o_bg, "background.content", chl->o_base);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_spacer_create(Channel *chl)
|
|
|
|
{
|
|
|
|
if (!chl->o_spacer)
|
|
|
|
{
|
2014-12-17 10:49:15 -08:00
|
|
|
Evas_Coord w = 0, h = 0;
|
|
|
|
|
2014-01-19 03:11:32 -08:00
|
|
|
chl->o_spacer = evas_object_rectangle_add(chl->evas);
|
|
|
|
evas_object_color_set(chl->o_spacer, 0, 0, 0, 0);
|
2014-12-17 10:49:15 -08:00
|
|
|
|
|
|
|
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);
|
2014-01-19 03:11:32 -08:00
|
|
|
}
|
|
|
|
}
|
2014-01-20 09:31:26 -08:00
|
|
|
|
|
|
|
void
|
2014-12-16 11:26:18 -08:00
|
|
|
_channel_text_append(Channel *chl, const char *user, const char *txt)
|
2014-01-20 09:31:26 -08:00
|
|
|
{
|
2014-12-16 08:14:01 -08:00
|
|
|
/* fprintf(stderr, "Channel %s Append: %s", chl->name, txt); */
|
2014-12-11 11:48:01 -08:00
|
|
|
|
2014-12-12 12:09:42 -08:00
|
|
|
/* write buff to grid */
|
2014-12-16 11:26:18 -08:00
|
|
|
if (user)
|
|
|
|
{
|
|
|
|
_grid_text_append(chl->o_grid, user, strlen(user));
|
|
|
|
_grid_text_append(chl->o_grid, "\t", strlen("\t"));
|
|
|
|
}
|
|
|
|
|
2014-12-12 12:09:42 -08:00
|
|
|
_grid_text_append(chl->o_grid, txt, strlen(txt));
|
2014-12-17 10:49:15 -08:00
|
|
|
|
2015-02-11 06:50:01 -08:00
|
|
|
if (!chl->active) chl->missed = EINA_TRUE;
|
2014-12-17 10:49:15 -08:00
|
|
|
else chl->missed = EINA_FALSE;
|
|
|
|
|
|
|
|
_window_channel_count_update();
|
2015-02-11 08:11:03 -08:00
|
|
|
|
|
|
|
if (chl->missed) _window_tabbar_update(chl);
|
2014-01-20 09:31:26 -08:00
|
|
|
}
|
2014-12-02 10:31:41 -08:00
|
|
|
|
|
|
|
void
|
|
|
|
_channel_window_set(Channel *chl, Evas_Object *win)
|
|
|
|
{
|
|
|
|
_grid_window_set(chl->o_grid, win);
|
2014-12-12 12:09:42 -08:00
|
|
|
_grid_theme_set(chl->o_grid, chl->o_bg);
|
2014-12-18 13:33:17 -08:00
|
|
|
|
|
|
|
if (chl->o_entry) return;
|
|
|
|
|
|
|
|
chl->o_entry = elm_entry_add(win);
|
2015-02-11 11:04:25 -08:00
|
|
|
WEIGHT_SET(chl->o_entry, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
ALIGN_SET(chl->o_entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2014-12-18 13:33:17 -08:00
|
|
|
elm_entry_single_line_set(chl->o_entry, EINA_TRUE);
|
|
|
|
elm_entry_scrollable_set(chl->o_entry, EINA_TRUE);
|
2015-02-11 11:04:25 -08:00
|
|
|
elm_entry_line_wrap_set(chl->o_entry, ELM_WRAP_NONE);
|
2014-12-18 13:33:17 -08:00
|
|
|
elm_scroller_policy_set(chl->o_entry, ELM_SCROLLER_POLICY_OFF,
|
|
|
|
ELM_SCROLLER_POLICY_OFF);
|
|
|
|
elm_entry_input_panel_layout_set(chl->o_entry,
|
|
|
|
ELM_INPUT_PANEL_LAYOUT_TERMINAL);
|
|
|
|
elm_entry_autocapital_type_set(chl->o_entry, ELM_AUTOCAPITAL_TYPE_NONE);
|
|
|
|
elm_entry_input_panel_enabled_set(chl->o_entry, EINA_TRUE);
|
|
|
|
elm_entry_input_panel_language_set(chl->o_entry,
|
|
|
|
ELM_INPUT_PANEL_LANG_ALPHABET);
|
|
|
|
elm_entry_input_panel_return_key_type_set(chl->o_entry,
|
|
|
|
ELM_INPUT_PANEL_RETURN_KEY_TYPE_GO);
|
2015-02-11 11:04:25 -08:00
|
|
|
elm_entry_prediction_allow_set(chl->o_entry, EINA_TRUE);
|
2015-02-12 11:02:24 -08:00
|
|
|
elm_entry_cnp_mode_set(chl->o_entry, ELM_CNP_MODE_PLAINTEXT);
|
2014-12-18 13:33:17 -08:00
|
|
|
|
2015-02-11 12:55:47 -08:00
|
|
|
evas_object_smart_callback_add(chl->o_entry, "activated",
|
|
|
|
_cb_entry_go, chl);
|
2014-12-18 13:33:17 -08:00
|
|
|
|
2015-02-12 11:02:24 -08:00
|
|
|
/* NB: This is messed up. Elm_Entry in single-line mode does not
|
|
|
|
* generate a changed event when pressing the Tab key */
|
|
|
|
evas_object_event_callback_add(chl->o_entry, EVAS_CALLBACK_KEY_DOWN,
|
|
|
|
_cb_entry_key_down, chl);
|
|
|
|
|
2014-12-18 13:33:17 -08:00
|
|
|
edje_object_part_swallow(chl->o_base, "channel.entry", chl->o_entry);
|
|
|
|
elm_entry_entry_set(chl->o_entry, "");
|
2015-02-11 11:04:25 -08:00
|
|
|
elm_object_focus_allow_set(chl->o_entry, EINA_FALSE);
|
2014-12-02 10:31:41 -08:00
|
|
|
}
|
2014-12-19 12:08:09 -08:00
|
|
|
|
|
|
|
void
|
|
|
|
_channel_network_set(Channel *chl, Express_Network *net)
|
|
|
|
{
|
|
|
|
chl->net = net;
|
2015-02-12 11:08:06 -08:00
|
|
|
_grid_nicklen_set(chl->o_grid, express_network_nickname_length_get(net));
|
2014-12-19 12:08:09 -08:00
|
|
|
}
|
2015-01-30 11:54:15 -08:00
|
|
|
|
|
|
|
void
|
|
|
|
_channel_userlist_user_append(Channel *chl, const char *user, Eina_Bool op)
|
|
|
|
{
|
2015-02-12 11:02:24 -08:00
|
|
|
if ((!user) || (strlen(user) < 1)) return;
|
|
|
|
|
2015-02-11 12:55:47 -08:00
|
|
|
/* append to list of users for autocomplete */
|
2015-02-12 11:02:24 -08:00
|
|
|
chl->userlist.users =
|
|
|
|
eina_list_append(chl->userlist.users, eina_stringshare_add(user));
|
2015-02-11 12:55:47 -08:00
|
|
|
|
2015-01-30 11:54:15 -08:00
|
|
|
if (!op)
|
2015-02-06 08:02:19 -08:00
|
|
|
elm_list_item_sorted_insert(chl->userlist.o_list, user, NULL, NULL,
|
|
|
|
NULL, NULL, _cb_userlist_compare);
|
2015-01-30 11:54:15 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
Evas_Object *icon;
|
|
|
|
char buff[PATH_MAX];
|
|
|
|
|
|
|
|
icon = elm_icon_add(chl->o_bg);
|
|
|
|
elm_image_resizable_set(icon, EINA_TRUE, EINA_TRUE);
|
|
|
|
WEIGHT_SET(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
ALIGN_SET(icon, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2015-02-11 11:04:25 -08:00
|
|
|
elm_object_focus_allow_set(icon, EINA_FALSE);
|
2015-01-30 11:54:15 -08:00
|
|
|
|
|
|
|
snprintf(buff, sizeof(buff), "%s/images/operator.png",
|
|
|
|
elm_app_data_dir_get());
|
|
|
|
elm_image_file_set(icon, buff, NULL);
|
|
|
|
evas_object_show(icon);
|
|
|
|
|
2015-02-06 08:02:19 -08:00
|
|
|
elm_list_item_sorted_insert(chl->userlist.o_list, user, icon, NULL,
|
|
|
|
NULL, NULL, _cb_userlist_compare);
|
2015-01-30 11:54:15 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_userlist_go(Channel *chl)
|
|
|
|
{
|
|
|
|
elm_list_go(chl->userlist.o_list);
|
|
|
|
}
|
2015-02-11 06:50:01 -08:00
|
|
|
|
|
|
|
void
|
|
|
|
_channel_tabbar_lbox_create(Channel *chl, Evas_Object *win)
|
|
|
|
{
|
|
|
|
if (!chl->tabbar.l.o_box)
|
|
|
|
{
|
|
|
|
chl->tabbar.l.o_box = elm_box_add(win);
|
|
|
|
elm_box_horizontal_set(chl->tabbar.l.o_box, EINA_TRUE);
|
|
|
|
elm_box_homogeneous_set(chl->tabbar.l.o_box, EINA_TRUE);
|
|
|
|
WEIGHT_SET(chl->tabbar.l.o_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
FILL_SET(chl->tabbar.l.o_box, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
edje_object_part_swallow(chl->o_bg, "tabl.content", chl->tabbar.l.o_box);
|
2015-02-11 11:04:25 -08:00
|
|
|
elm_object_focus_allow_set(chl->tabbar.l.o_box, EINA_FALSE);
|
2015-02-11 06:50:01 -08:00
|
|
|
evas_object_show(chl->tabbar.l.o_box);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_tabbar_rbox_create(Channel *chl, Evas_Object *win)
|
|
|
|
{
|
|
|
|
if (!chl->tabbar.r.o_box)
|
|
|
|
{
|
|
|
|
chl->tabbar.r.o_box = elm_box_add(win);
|
|
|
|
elm_box_horizontal_set(chl->tabbar.r.o_box, EINA_TRUE);
|
|
|
|
elm_box_homogeneous_set(chl->tabbar.r.o_box, EINA_TRUE);
|
|
|
|
WEIGHT_SET(chl->tabbar.r.o_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
FILL_SET(chl->tabbar.r.o_box, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
edje_object_part_swallow(chl->o_bg, "tabr.content", chl->tabbar.r.o_box);
|
2015-02-11 11:04:25 -08:00
|
|
|
elm_object_focus_allow_set(chl->tabbar.r.o_box, EINA_FALSE);
|
2015-02-11 06:50:01 -08:00
|
|
|
evas_object_show(chl->tabbar.r.o_box);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_tabbar_lbox_append(Channel *chl, Evas_Object *o)
|
|
|
|
{
|
|
|
|
chl->tabbar.l.tabs = eina_list_append(chl->tabbar.l.tabs, o);
|
|
|
|
elm_box_pack_end(chl->tabbar.l.o_box, o);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_tabbar_rbox_append(Channel *chl, Evas_Object *o)
|
|
|
|
{
|
|
|
|
chl->tabbar.r.tabs = eina_list_append(chl->tabbar.r.tabs, o);
|
|
|
|
elm_box_pack_end(chl->tabbar.r.o_box, o);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_tabbar_clear(Channel *chl)
|
|
|
|
{
|
|
|
|
Evas_Object *o;
|
|
|
|
|
|
|
|
if (chl->tabbar.l.o_box)
|
|
|
|
{
|
|
|
|
EINA_LIST_FREE(chl->tabbar.l.tabs, o)
|
|
|
|
evas_object_del(o);
|
|
|
|
evas_object_del(chl->tabbar.l.o_box);
|
|
|
|
chl->tabbar.l.o_box = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (chl->tabbar.r.o_box)
|
|
|
|
{
|
|
|
|
EINA_LIST_FREE(chl->tabbar.r.tabs, o)
|
|
|
|
evas_object_del(o);
|
|
|
|
evas_object_del(chl->tabbar.r.o_box);
|
|
|
|
chl->tabbar.r.o_box = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-11 08:11:03 -08:00
|
|
|
void
|
|
|
|
_channel_tabbar_update(Channel *chl)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Evas_Object *o;
|
|
|
|
Channel *pchl;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(chl->tabbar.l.tabs, l, o)
|
|
|
|
{
|
|
|
|
pchl = evas_object_data_get(o, "channel");
|
|
|
|
if ((pchl) && (pchl != chl))
|
|
|
|
{
|
|
|
|
if (pchl->missed)
|
|
|
|
edje_object_signal_emit(o, "tabmissed,on", PACKAGE_NAME);
|
|
|
|
else
|
|
|
|
edje_object_signal_emit(o, "tabmissed,off", PACKAGE_NAME);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(chl->tabbar.r.tabs, l, o)
|
|
|
|
{
|
|
|
|
pchl = evas_object_data_get(o, "channel");
|
|
|
|
if ((pchl) && (pchl != chl))
|
|
|
|
{
|
|
|
|
if (pchl->missed)
|
|
|
|
edje_object_signal_emit(o, "tabmissed,on", PACKAGE_NAME);
|
|
|
|
else
|
|
|
|
edje_object_signal_emit(o, "tabmissed,off", PACKAGE_NAME);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-11 06:50:01 -08:00
|
|
|
void
|
|
|
|
_channel_tabspacer_create(Channel *chl, double v1, double v2)
|
|
|
|
{
|
|
|
|
if (!chl->o_tab_spacer)
|
|
|
|
{
|
|
|
|
Evas_Coord w = 0, h = 0;
|
|
|
|
|
|
|
|
chl->o_tab_spacer = evas_object_rectangle_add(chl->evas);
|
|
|
|
evas_object_color_set(chl->o_tab_spacer, 0, 0, 0, 0);
|
|
|
|
elm_coords_finger_size_adjust(1, &w, 1, &h);
|
|
|
|
evas_object_size_hint_min_set(chl->o_tab_spacer, w, h);
|
|
|
|
edje_object_part_swallow(chl->o_bg, "tab", chl->o_tab_spacer);
|
|
|
|
edje_object_part_drag_value_set(chl->o_bg, "tabl", v1, 0.0);
|
|
|
|
edje_object_part_drag_value_set(chl->o_bg, "tabr", v2, 0.0);
|
|
|
|
edje_object_part_text_set(chl->o_bg, "tab.title", chl->name);
|
|
|
|
edje_object_signal_emit(chl->o_bg, "tabbar,on", PACKAGE_NAME);
|
|
|
|
edje_object_message_signal_process(chl->o_bg);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
edje_object_part_drag_value_set(chl->o_bg, "tabl", v1, 0.0);
|
|
|
|
edje_object_part_drag_value_set(chl->o_bg, "tabr", v2, 0.0);
|
|
|
|
edje_object_message_signal_process(chl->o_bg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_channel_tabspacer_destroy(Channel *chl)
|
|
|
|
{
|
|
|
|
if (chl->o_tab_spacer)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(chl->o_bg, "tabbar,off", PACKAGE_NAME);
|
|
|
|
evas_object_del(chl->o_tab_spacer);
|
|
|
|
chl->o_tab_spacer = NULL;
|
|
|
|
edje_object_message_signal_process(chl->o_bg);
|
|
|
|
}
|
|
|
|
}
|