viking

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

commit 7b734a949fb8525dfdc38bc14c254d69878e7be3
parent 4ee86fdf4e3c7adf8ec5a123a64c29f842bc799f
Author: Kyle Milz <kmilz@ucalgary.ca>
Date:   Fri, 21 Sep 2012 20:11:05 -0600

buffers: new buffer open behaviour

now when requesting a new buffer a new uri must be supplied at creation
time. this is in contrast to how it was before when a tab would open and
then request a uri.

Diffstat:
Mcommands.c | 10++++++++--
Mcommands.h | 2+-
Mmain.c | 46++++++++++++----------------------------------
Mmain.h | 9+++++----
4 files changed, 26 insertions(+), 41 deletions(-)

diff --git a/commands.c b/commands.c @@ -546,8 +546,14 @@ open_arg(const Arg *arg, void *data) // webkit_web_view_load_uri(webview, new); elm_web_uri_set(ad->current_web, new); free(new); - } // else - // g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL); + } else { + Tab_Data *td = tab_add(ad); + buffer_current_set(td); + a.i = TargetCurrent; + a.s = strdup(arg->s); // not sure if strdup necessary + open_arg(&a, data); + free(a.s); + } return TRUE; } diff --git a/commands.h b/commands.h @@ -62,7 +62,7 @@ static Command commands[COMMANDSIZE] = { { "qt", search_tag, {0} }, { "st", navigate, {NavigationCancel} }, { "stop", navigate, {NavigationCancel} }, - { "t", add_tab, {0} }, + { "t", open_arg, {0} }, { "tabopen", open_arg, {TargetNew} }, { "print", print_frame, {0} }, { "bma", bookmark, {0} }, diff --git a/main.c b/main.c @@ -55,6 +55,7 @@ static void webview_inspector_cb (void *, Evas_Object *, void *); static Eina_Bool process_keypress (void *, void*); static void webview_keypress_cb (void *, Evas *, Evas_Object *, void *); static void webview_mousewheel_cb (void *, Evas *, Evas_Object *, void *); +Evas_Object *webview_create_window_cb(void*, Evas_Object*, Eina_Bool, const Elm_Web_Window_Features*); /* static WebKitWebView* inspector_inspect_web_view_cb(gpointer inspector, WebKitWebView* web_view); @@ -1249,26 +1250,20 @@ inputbox_changed_cb(void *data, Evas_Object *obj, void *event_info) } } - - -Tab_Data *tab_add(App_Data *); - -static Evas_Object * +Evas_Object * webview_create_window_cb(void *data, Evas_Object *obj, Eina_Bool js, const Elm_Web_Window_Features *wf) { - App_Data *ad = data; - Tab_Data *td; + App_Data *ad = data; + Tab_Data *td = tab_add(ad); - td = tab_add(ad); - buffer_current_set(td); - return td->web; + return td->web; } static void _win_del_request_cb(void *data, Evas_Object *obj, void *event_info) { - App_Data *ad = data; - ad->exiting = EINA_TRUE; + App_Data *ad = data; + ad->exiting = EINA_TRUE; } void @@ -1298,7 +1293,6 @@ buffer_current_set(Tab_Data *td) // elm_object_text_set(td->app->url, uri); // if (uri) update_url(uri, td->app); - elm_naviframe_item_simple_promote(td->app->naviframe, td->web); } @@ -1321,21 +1315,7 @@ _web_free_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) free(td); } -Eina_Bool -add_tab(const Arg *arg, void *data) -{ - App_Data *ad = data; - Tab_Data *td = tab_add(ad); - buffer_current_set(td); - elm_object_text_set(ad->status_url, ""); - elm_object_text_set(ad->status_state, ""); - input(arg, data); - // elm_object_focus_set(ad->url, EINA_TRUE); - - return EINA_TRUE; -} - -Tab_Data * +Tab_Data* tab_add(App_Data *ad) { Tab_Data *td; @@ -1383,7 +1363,7 @@ tab_add(App_Data *ad) // evas_object_event_callback_add(td->web, EVAS_CALLBACK_MOUSE_UP, notify_event_cb, td); evas_object_event_callback_add(td->web, EVAS_CALLBACK_MOUSE_WHEEL, webview_mousewheel_cb, td); - buffer_current_set(td); + // buffer_current_set(td); return td; } @@ -1396,7 +1376,6 @@ elm_main(int argc, char *argv[]) Evas_Object *status_state, *event_box, *web_inspector; Evas *e; Evas_Modifier_Mask mask; - Arg a; App_Data *ad; unsigned int i; @@ -1516,10 +1495,9 @@ elm_main(int argc, char *argv[]) ad->buf_total = 0; - a.i = TargetCurrent; - a.s = strdup_printf(":open %s", startpage); - add_tab(&a, ad); - free(a.s); + Tab_Data *td = tab_add(ad); + buffer_current_set(td); + elm_web_uri_set(td->web, startpage); evas_object_resize(win, 480, 640); evas_object_show(win); diff --git a/main.h b/main.h @@ -12,10 +12,6 @@ typedef struct _Tab_Data Tab_Data; -void update_state(void *); -Eina_Bool echo(const Arg *arg, void *); -void buffer_current_set(Tab_Data *td); - typedef struct { Evas_Object *win; @@ -75,5 +71,10 @@ struct dl { long int dlnow; }; +void update_state(void *); +Eina_Bool echo(const Arg *arg, void *); +void buffer_current_set(Tab_Data *td); +Tab_Data *tab_add(App_Data *ad); + #endif