From eaca60f3ec2c5e49a2157049061bff741cb7898e 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 --- doc/examples.dox | 10 ++--- src/examples/Makefile.am | 6 ++- src/examples/web_example_01.c | 49 ++++++++++++++++++++++++ src/examples/{web_example.c => web_example_02.c} | 2 +- src/lib/elm_web.h | 3 +- 5 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 src/examples/web_example_01.c rename src/examples/{web_example.c => web_example_02.c} (99%) diff --git a/doc/examples.dox b/doc/examples.dox index 0ce4b13..ecbe4bb 100644 --- a/doc/examples.dox +++ b/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/src/examples/Makefile.am b/src/examples/Makefile.am index 0eee3b1..9b1d553 100644 --- a/src/examples/Makefile.am +++ b/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/src/examples/web_example_01.c b/src/examples/web_example_01.c new file mode 100644 index 0000000..2ccfaf3 --- /dev/null +++ b/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/src/examples/web_example.c b/src/examples/web_example_02.c similarity index 99% rename from src/examples/web_example.c rename to src/examples/web_example_02.c index 0158315..875fa8e 100644 --- a/src/examples/web_example.c +++ b/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/src/lib/elm_web.h b/src/lib/elm_web.h index 8ac51d1..c10a142 100644 --- a/src/lib/elm_web.h +++ b/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 */ /** -- 2.7.4