elementary: Minimalist Elementary Web widget example.
authorJonas M. Gastal <jgastal@profusion.mobi>
Mon, 6 Aug 2012 20:44:45 +0000 (20:44 +0000)
committerJonas M. Gastal <jgastal@profusion.mobi>
Mon, 6 Aug 2012 20:44:45 +0000 (20:44 +0000)
Author:    Joao Paulo Fernandes Ventura <ventura@profusion.mobi>

SVN revision: 74949

doc/examples.dox
src/examples/Makefile.am
src/examples/web_example_01.c [new file with mode: 0644]
src/examples/web_example_02.c [moved from src/examples/web_example.c with 99% similarity]
src/lib/elm_web.h

index 0ce4b13..ecbe4bb 100644 (file)
  */
 
 /**
- * @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
  * 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
  *
  * @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
  */
 
 /**
index 0eee3b1..9b1d553 100644 (file)
@@ -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 (file)
index 0000000..2ccfaf3
--- /dev/null
@@ -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 <Elementary.h>
+#ifdef HAVE_ELEMENTARY_WEB
+#include <EWebKit.h>
+#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()
similarity index 99%
rename from src/examples/web_example.c
rename to src/examples/web_example_02.c
index 0158315..875fa8e 100644 (file)
@@ -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
index 8ac51d1..c10a142 100644 (file)
@@ -80,7 +80,8 @@
  *
  * An example of use of web:
  *
- * - @ref web_example_01 TBD
+ * - @ref web_example_01
+ * - @ref web_example_02
  */
 
 /**