e/connman: focus first mandatory entry

SVN revision: 76579
This commit is contained in:
Bruno Dilly 2012-09-13 06:25:06 +00:00
parent a8ef12a337
commit 7373927847
2 changed files with 11 additions and 10 deletions

View File

@ -9,8 +9,5 @@
- Streamline the Cancel() and Release() callbacks because they are very - Streamline the Cancel() and Release() callbacks because they are very
similar similar
- When we request user input, give focus to the first 'Mandatory'
entry field
- Search for entries with the same type when we receive an - Search for entries with the same type when we receive an
'Informational' field so we can use it in an useful manner 'Informational' field so we can use it in an useful manner

View File

@ -171,19 +171,25 @@ _dialog_field_add(E_Connman_Agent *agent, struct Connman_Field *field)
Evas_Object *toolbook, *list, *framelist, *entry; Evas_Object *toolbook, *list, *framelist, *entry;
E_Connman_Agent_Input *input; E_Connman_Agent_Input *input;
Eina_List *input_list; Eina_List *input_list;
Eina_Bool mandatory;
char header[64]; char header[64];
Evas *evas; Evas *evas;
evas = agent->dialog->win->evas; evas = agent->dialog->win->evas;
toolbook = agent->dialog->content_object; toolbook = agent->dialog->content_object;
mandatory = !strcmp(field->requirement, "mandatory");
if ((strcmp(field->requirement, "mandatory")) && if ((!mandatory) && (strcmp(field->requirement, "alternate")))
(strcmp(field->requirement, "alternate")))
{ {
WRN("Field not handled: %s %s", field->name, field->type); WRN("Field not handled: %s %s", field->name, field->type);
return; return;
} }
input = E_NEW(E_Connman_Agent_Input, 1);
input->key = strdup(field->name);
entry = e_widget_entry_add(evas, &(input->value), NULL, NULL, NULL);
evas_object_show(entry);
list = evas_object_data_get(toolbook, field->requirement); list = evas_object_data_get(toolbook, field->requirement);
if (!list) if (!list)
{ {
@ -195,10 +201,10 @@ _dialog_field_add(E_Connman_Agent *agent, struct Connman_Field *field)
e_widget_toolbook_page_show(toolbook, 0); e_widget_toolbook_page_show(toolbook, 0);
evas_object_event_callback_add(list, EVAS_CALLBACK_DEL, evas_object_event_callback_add(list, EVAS_CALLBACK_DEL,
_page_del, NULL); _page_del, NULL);
}
input = E_NEW(E_Connman_Agent_Input, 1); if (mandatory)
input->key = strdup(field->name); e_widget_focus_set(entry, 1);
}
input_list = evas_object_data_get(list, "input_list"); input_list = evas_object_data_get(list, "input_list");
input_list = eina_list_append(input_list, input); input_list = eina_list_append(input_list, input);
@ -210,8 +216,6 @@ _dialog_field_add(E_Connman_Agent *agent, struct Connman_Field *field)
evas_object_show(framelist); evas_object_show(framelist);
e_widget_list_object_append(list, framelist, 1, 1, 0.5); e_widget_list_object_append(list, framelist, 1, 1, 0.5);
entry = e_widget_entry_add(evas, &(input->value), NULL, NULL, NULL);
evas_object_show(entry);
e_widget_framelist_object_append(framelist, entry); e_widget_framelist_object_append(framelist, entry);
} }