const char *popup_title, const char *popup_text);
Evas_Object *utils_add_table(Evas_Object *parent, int padding_x, int padding_y);
Evas_Object *utils_add_ctxpopup(Evas_Object *parent, int opt_size, int *opt_id,
- const char **opt_text, void *opt_handler, void *data);
+ const char **opt_text, void *opt_handler, void *data, int selected);
Evas_Object *utils_add_gengrid(Evas_Object *parent, Eina_Bool horizontal,
int width, int height);
Evas_Object *utils_add_entry(Evas_Object *parent, const char *part,
}
Evas_Object *utils_add_ctxpopup(Evas_Object *parent, int opt_size, int *opt_id,
- const char **opt_text, void *opt_handler, void *data)
+ const char **opt_text, void *opt_handler, void *data, int selected)
{
- Evas_Object *ctxpopup, *box, *btn, *firstbtn;
+ Evas_Object *ctx_popup, *box, *btn, *first_btn;
int i;
if (!parent || opt_size <= 0 || !opt_text) {
return NULL;
}
- ctxpopup = elm_ctxpopup_add(parent);
- if (!ctxpopup) {
+ ctx_popup = elm_ctxpopup_add(parent);
+ if (!ctx_popup) {
_ERR("elm_ctxpopup_add failed.");
return NULL;
}
- box = utils_add_box(ctxpopup, NULL, EINA_FALSE, 0, 0);
+ box = utils_add_box(ctx_popup, NULL, EINA_FALSE, 0, 0);
if (!box) {
_ERR("Add box failed.");
- evas_object_del(ctxpopup);
+ evas_object_del(ctx_popup);
return NULL;
}
- elm_object_style_set(ctxpopup, STYLE_CTXPOPUP);
- elm_object_content_set(ctxpopup, box);
- elm_ctxpopup_direction_priority_set(ctxpopup, 0, 0, 0, 0);
- evas_object_show(ctxpopup);
+ elm_object_style_set(ctx_popup, STYLE_CTXPOPUP);
+ elm_object_content_set(ctx_popup, box);
+ elm_ctxpopup_direction_priority_set(ctx_popup, 0, 0, 0, 0);
+ evas_object_show(ctx_popup);
for (i = 0; i < opt_size; i++) {
btn = utils_add_button(box, NULL, STYLE_OPTION_LIST_BTN,
opt_text[i]);
if (!btn) {
_ERR("Add button failed.");
- evas_object_del(ctxpopup);
+ evas_object_del(ctx_popup);
return NULL;
}
opt_handler, data);
if (i == 0)
- firstbtn = btn;
+ first_btn = btn;
+
+ if (i == selected)
+ elm_object_focus_set(btn, EINA_TRUE);
}
- elm_object_focus_next_object_set(firstbtn, btn, ELM_FOCUS_UP);
- elm_object_focus_next_object_set(btn, firstbtn, ELM_FOCUS_DOWN);
+ elm_object_focus_next_object_set(first_btn, btn, ELM_FOCUS_UP);
+ elm_object_focus_next_object_set(btn, first_btn, ELM_FOCUS_DOWN);
- return ctxpopup;
+ return ctx_popup;
}
Evas_Object *utils_add_gengrid(Evas_Object *parent, Eina_Bool horizontal,
Evas_Object *preserve;
_destroy_network_type_popup(priv);
- elm_object_text_set(priv->network_type_btn, elm_object_text_get(obj));
+ elm_object_text_set(priv->network_type_btn, str_network_type_opt[id]);
switch (id) {
case TYPE_WIRELESS:
ctxpopup = utils_add_ctxpopup(priv->base, COUNT_NETWORK_TYPE,
id_network_type_opt, str_network_type_opt,
- &_network_type_option_input_handler, priv);
+ &_network_type_option_input_handler, priv, priv->cur_type);
if (!ctxpopup) {
_ERR("Add ctxpopup failed.");
return;
evas_object_size_hint_min_set(ctxpopup, w, 0);
priv->network_type_popup = ctxpopup;
-
- elm_object_focus_set(priv->network_type_popup, EINA_TRUE);
}
static void _network_type_mouse_down_cb(int id, void *data, Evas *e,
Evas_Object *btn1, *btn2;
btn1 = utils_add_button(priv->ly, PART_NETWORK_TYPE, STYLE_OPTION_BTN,
- STR_WIRELESS);
+ str_network_type_opt[priv->cur_type]);
if (!btn1) {
_ERR("Add button failed.");
return false;
priv->network_type_btn = btn1;
priv->action_btn = btn2;
- priv->cur_type = TYPE_WIRELESS;
return true;
}
priv->listmgr = listmgr;
priv->wireless_support = true;
priv->wireless_update_requested = false;
+ // TODO: detect currently selected network type
+ priv->cur_type = TYPE_WIRELESS;
if (!_draw_network_buttons(priv)) {
_ERR("Draw network buttons failed.");