From b8c0d34a79877cbc882ef932924b22b51c139dcc Mon Sep 17 00:00:00 2001 From: "Jonas M. Gastal" Date: Mon, 6 Aug 2012 20:44:45 +0000 Subject: [PATCH] elementary: Minimalist Elementary Web widget example. Author: Joao Paulo Fernandes Ventura SVN revision: 74949 --- legacy/elementary/doc/examples.dox | 10 ++-- legacy/elementary/src/examples/Makefile.am | 6 ++- .../elementary/src/examples/web_example_01.c | 49 +++++++++++++++++++ .../{web_example.c => web_example_02.c} | 2 +- legacy/elementary/src/lib/elm_web.h | 3 +- 5 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 legacy/elementary/src/examples/web_example_01.c rename legacy/elementary/src/examples/{web_example.c => web_example_02.c} (99%) diff --git a/legacy/elementary/doc/examples.dox b/legacy/elementary/doc/examples.dox index 0ce4b13198..ecbe4bbab2 100644 --- a/legacy/elementary/doc/examples.dox +++ b/legacy/elementary/doc/examples.dox @@ -5932,7 +5932,7 @@ */ /** - * @page web_example_01 Web - Simple example + * @page web_example_02 Web - Simple example * * WebKit-EFL is independent of any particular toolkit, such as Elementary, * so using it on applications requires that the programmer writes a lot of @@ -5958,7 +5958,7 @@ * some WebKit functions on it, thus we need to include the necessary headers * first. * - * @dontinclude web_example.c + * @dontinclude web_example_02.c * @skip include * @until EWebKit * @@ -6052,10 +6052,10 @@ * @until ELM_MAIN * * Some parts of the code were left out, as they are not relevant to the - * example, but the full listing can be found at @ref web_example.c - * "web_example.c". + * example, but the full listing can be found at @ref web_example_02.c + * "web_example_02.c". * - * @example web_example.c + * @example web_example_02.c */ /** diff --git a/legacy/elementary/src/examples/Makefile.am b/legacy/elementary/src/examples/Makefile.am index 0eee3b178b..9b1d553874 100644 --- a/legacy/elementary/src/examples/Makefile.am +++ b/legacy/elementary/src/examples/Makefile.am @@ -132,7 +132,8 @@ transit_example_01.c \ transit_example_02.c \ transit_example_03.c \ transit_example_04.c \ -web_example.c \ +web_example_01.c \ +web_example_02.c \ win_example.c .edc.edj: @@ -243,7 +244,8 @@ transit_example_01 \ transit_example_02 \ transit_example_03 \ transit_example_04 \ -web_example \ +web_example_01 \ +web_example_02 \ win_example if ELEMENTARY_WINDOWS_BUILD diff --git a/legacy/elementary/src/examples/web_example_01.c b/legacy/elementary/src/examples/web_example_01.c new file mode 100644 index 0000000000..2ccfaf360a --- /dev/null +++ b/legacy/elementary/src/examples/web_example_01.c @@ -0,0 +1,49 @@ +/* + * gcc -o web_example_01 web_example_01.c `pkg-config --cflags --libs elementary ewebkit` -D_GNU_SOURCE + */ + +#define _GNU_SOURCE +#include +#ifdef HAVE_ELEMENTARY_WEB +#include +#endif + +#define URL "http://www.enlightenment.org" + +EAPI_MAIN int +elm_main(int argc, char *argv[]) +{ + Evas_Object *win, *bg, *web; + + /* The program will proceed only if Ewebkit library is available. */ + if (elm_need_web() == EINA_FALSE) + return -1; + + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + /* Window */ + win = elm_win_add(NULL, "Elementary Webkit Widget", ELM_WIN_BASIC); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_resize(win, 720, 600); + evas_object_show(win); + + /* Web */ + web = elm_web_add(win); + evas_object_size_hint_weight_set(web, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_web_window_create_hook_set(web, NULL, NULL); + elm_win_resize_object_add(win, web); + elm_web_history_enabled_set(web, EINA_FALSE); + + if (!elm_web_uri_set(web, URL)) + { + printf("URL NOT LOADED"); + return -1; + } + evas_object_show(web); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/examples/web_example.c b/legacy/elementary/src/examples/web_example_02.c similarity index 99% rename from legacy/elementary/src/examples/web_example.c rename to legacy/elementary/src/examples/web_example_02.c index 0158315cae..875fa8e191 100644 --- a/legacy/elementary/src/examples/web_example.c +++ b/legacy/elementary/src/examples/web_example_02.c @@ -1,5 +1,5 @@ /* - * gcc -o web_example web_example.c `pkg-config --cflags --libs elementary ewebkit` -D_GNU_SOURCE + * gcc -o web_example_02 web_example_02.c `pkg-config --cflags --libs elementary ewebkit` -D_GNU_SOURCE */ #define _GNU_SOURCE diff --git a/legacy/elementary/src/lib/elm_web.h b/legacy/elementary/src/lib/elm_web.h index 8ac51d17c9..c10a142e0c 100644 --- a/legacy/elementary/src/lib/elm_web.h +++ b/legacy/elementary/src/lib/elm_web.h @@ -80,7 +80,8 @@ * * An example of use of web: * - * - @ref web_example_01 TBD + * - @ref web_example_01 + * - @ref web_example_02 */ /**