viking

webkit based web browser for Enlightenment
Log | Files | Refs | LICENSE

commit 471a2c5ce580355c83daccb34451340360ba305c
parent 2a5131e0fd053a38f3c0b10dab764b6144a84dec
Author: Kyle Milz <kmilz@ucalgary.ca>
Date:   Sun, 14 Oct 2012 09:24:40 -0600

clean up inputbox_changed_cb function

Diffstat:
Msrc/callbacks.c | 147+++++++++++++++++++++++++++++++++++++------------------------------------------
1 file changed, 68 insertions(+), 79 deletions(-)

diff --git a/src/callbacks.c b/src/callbacks.c @@ -777,91 +777,80 @@ inputbox_keyrelease_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) static void inputbox_changed_cb(void *data, Evas_Object *obj, void *event_info) { - Arg a; + Arg a; Window_Data *wd = data; const char *text = elm_entry_entry_get(wd->url); - uint16_t length = strlen(text); - Eina_Bool forward = FALSE; - - /* Update incremental search if the user changes the search text. - * - * Note: gtk_widget_is_focus() is a poor way to check if the change comes - * from the user. But if the entry is focused and the text is set - * through gtk_entry_set_text() in some asyncrounous operation, - * I would consider that a bug. - */ - - // if (gtk_widget_is_focus(GTK_WIDGET(entry)) && length > 1 && ((forward = text[0] == '/') || text[0] == '?')) { - if (elm_object_focus_get(wd->url) && length > 1 && ((forward = text[0] == '/') || text[0] == '?')) { + uint16_t length = strlen(text); + Eina_Bool forward = FALSE; + + /* Update incremental search if the user changes the search text. + * + * Note: gtk_widget_is_focus() is a poor way to check if the change comes + * from the user. But if the entry is focused and the text is set + * through gtk_entry_set_text() in some asyncrounous operation, + * I would consider that a bug. + */ + + if (elm_object_focus_get(wd->url) && length > 1 && ((forward = text[0] == '/') || text[0] == '?')) { ewk_view_text_find_highlight_clear(wd->cur_buf->view); ewk_view_text_find(wd->cur_buf->view, &text[1], EWK_FIND_OPTIONS_SHOW_HIGHLIGHT | EWK_FIND_OPTIONS_CASE_INSENSITIVE, 1000); - return; - // } else if (gtk_widget_is_focus(GTK_WIDGET(entry)) && length >= 1 && - } else if (elm_object_focus_get(wd->url) && length >= 1 && - (text[0] == '.' || text[0] == ',' || text[0] == ';')) { - a.i = Silent; - switch (text[0]) { - case '.': - // a.s = strconcat("hints.createHints('", text + 1, "', 'f');", NULL); - a.s = strdup_printf("hints.createHints('%s', 'f');", text + 1); - break; - - case ',': - // a.s = strconcat("hints.createHints('", text + 1, "', 'F');", NULL); - a.s = strdup_printf("hints.createHints('%s', 'F');", text + 1); - break; - - case ';': - a.s = NULL; - switch (text[1]) { - case 's': - // a.s = strconcat("hints.createHints('", text + 2, "', 's');", NULL); - a.s = strdup_printf("hints.createHints('%s', 's');", text + 2); - break; - case 'y': - // a.s = strconcat("hints.createHints('", text + 2, "', 'y');", NULL); - a.s = strdup_printf("hints.createHints('%s', 'y');", text + 2); - break; - case 'o': - // a.s = strconcat("hints.createHints('", text + 2, "', 'f');", NULL); - a.s = strdup_printf("hints.createHints('%s', 'f');", text + 2); - break; - case 't': case 'w': - // a.s = strconcat("hints.createHints('", text + 2, "', 'F');", NULL); - a.s = strdup_printf("hints.createHints('%s', 'F');", text + 2); - break; - case 'O': case 'T': case 'W': - // a.s = strconcat("hints.createHints('", text + 2, "', 'O');", NULL); - a.s = strdup_printf("hints.createHints('%s', 'O');", text + 2); - break; - case 'i': - // a.s = strconcat("hints.createHints('", text + 2, "', 'i');", NULL); - a.s = strdup_printf("hints.createHints('%s', 'i');", text + 2); - break; - case 'I': - // a.s = strconcat("hints.createHints('", text + 2, "', 'I');", NULL); - a.s = strdup_printf("hints.createHints('%s', 'I');", text + 2); - break; - } - break; - } - wd->count = 0; - if (a.s) { - script(&a, data); - free(a.s); - } + return; +} else if (elm_object_focus_get(wd->url) && length >= 1 && + (text[0] == '.' || text[0] == ',' || text[0] == ';')) { + a.i = Silent; + switch (text[0]) { + case '.': + a.s = strdup_printf("hints.createHints('%s', 'f');", text + 1); + break; - return; - } else if (length == 0 && wd->followTarget[0]) { - wd->mode = ModeNormal; - a.i = Silent; - a.s = strdup("hints.clearHints();"); - script(&a, data); - free(a.s); - wd->count = 0; - update_state(data); - } + case ',': + a.s = strdup_printf("hints.createHints('%s', 'F');", text + 1); + break; + + case ';': + a.s = NULL; + switch (text[1]) { + case 's': + a.s = strdup_printf("hints.createHints('%s', 's');", text + 2); + break; + case 'y': + a.s = strdup_printf("hints.createHints('%s', 'y');", text + 2); + break; + case 'o': + a.s = strdup_printf("hints.createHints('%s', 'f');", text + 2); + break; + case 't': case 'w': + a.s = strdup_printf("hints.createHints('%s', 'F');", text + 2); + break; + case 'O': case 'T': case 'W': + a.s = strdup_printf("hints.createHints('%s', 'O');", text + 2); + break; + case 'i': + a.s = strdup_printf("hints.createHints('%s', 'i');", text + 2); + break; + case 'I': + a.s = strdup_printf("hints.createHints('%s', 'I');", text + 2); + break; + } + break; + } + wd->count = 0; + if (a.s) { + script(&a, data); + free(a.s); + } + + return; +} else if (length == 0 && wd->followTarget[0]) { + wd->mode = ModeNormal; + a.i = Silent; + a.s = strdup("hints.clearHints();"); + script(&a, data); + free(a.s); + wd->count = 0; + update_state(data); +} }