ajwillia-ms pushed a commit to branch master. http://git.enlightenment.org/tools/examples.git/commit/?id=74cd796cbad93e7b26821f94962c6dbe6c2b9f8d
commit 74cd796cbad93e7b26821f94962c6dbe6c2b9f8d Author: Xavi Artigas <[email protected]> Date: Mon Nov 20 10:36:28 2017 +0100 Adapt source code to tutorial text Minor modifications only. The header file grouping all headers will be introduced in the multiinherit tutorial, along with the shape interface. --- tutorial/c/eo-inherit/src/eo_inherit.h | 15 ---------- tutorial/c/eo-inherit/src/eo_inherit_main.c | 40 +++++++++++++++++---------- tutorial/c/eo-inherit/src/example_rectangle.c | 2 -- tutorial/c/eo-inherit/src/example_square.c | 3 +- tutorial/c/eo-inherit/src/meson.build | 1 - 5 files changed, 26 insertions(+), 35 deletions(-) diff --git a/tutorial/c/eo-inherit/src/eo_inherit.h b/tutorial/c/eo-inherit/src/eo_inherit.h deleted file mode 100644 index 3a1b18a..0000000 --- a/tutorial/c/eo-inherit/src/eo_inherit.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _EO_CLASSES_H -#define _EO_CLASSES_H 1 - -#define EFL_EO_API_SUPPORT 1 -#ifndef EFL_BETA_API_SUPPORT -#define EFL_BETA_API_SUPPORT 1 -#endif - -#include <Eina.h> -#include <Efl_Core.h> - -#include "example_rectangle.eo.h" -#include "example_square.eo.h" - -#endif diff --git a/tutorial/c/eo-inherit/src/eo_inherit_main.c b/tutorial/c/eo-inherit/src/eo_inherit_main.c index 8a2a2cb..94c2597 100644 --- a/tutorial/c/eo-inherit/src/eo_inherit_main.c +++ b/tutorial/c/eo-inherit/src/eo_inherit_main.c @@ -1,4 +1,10 @@ -#include "eo_inherit.h" +#define EFL_EO_API_SUPPORT 1 +#define EFL_BETA_API_SUPPORT 1 + +#include <Eina.h> +#include <Efl_Core.h> +#include "example_rectangle.eo.h" +#include "example_square.eo.h" Example_Rectangle * _rectangle_create() @@ -13,7 +19,7 @@ _rectangle_create() return rectangle; } -Example_Rectangle * +Example_Square * _square_create() { Example_Square *square; @@ -25,24 +31,28 @@ _square_create() return square; } -void -_shape_print(Example_Rectangle *shape) -{ - printf("Shape named %s has area %d\n", efl_name_get(shape), example_rectangle_area(shape)); -} - EAPI_MAIN void efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) { - Eo *shape; + Eo *rectangle, *square; + + rectangle = _rectangle_create(); + + printf("Rectangle is %dx%d, area is %d\n", + example_rectangle_width_get(rectangle), + example_rectangle_height_get(rectangle), + example_rectangle_area(rectangle)); + + efl_unref(rectangle); + + square = _square_create(); - shape = _rectangle_create(); - _shape_print(shape); - efl_unref(shape); + printf("Square is %dx%d, area is %d\n", + example_rectangle_width_get(square), + example_rectangle_height_get(square), + example_rectangle_area(square)); - shape = _square_create(); - _shape_print(shape); - efl_unref(shape); + efl_unref(square); efl_exit(0); } diff --git a/tutorial/c/eo-inherit/src/example_rectangle.c b/tutorial/c/eo-inherit/src/example_rectangle.c index f0befe6..30b7377 100644 --- a/tutorial/c/eo-inherit/src/example_rectangle.c +++ b/tutorial/c/eo-inherit/src/example_rectangle.c @@ -2,8 +2,6 @@ #include <Eo.h> #include "example_rectangle.eo.h" -#include "eo_inherit.h" - typedef struct { int width, height; diff --git a/tutorial/c/eo-inherit/src/example_square.c b/tutorial/c/eo-inherit/src/example_square.c index 8ebb696..7d57509 100644 --- a/tutorial/c/eo-inherit/src/example_square.c +++ b/tutorial/c/eo-inherit/src/example_square.c @@ -1,8 +1,7 @@ #define EFL_BETA_API_SUPPORT #include <Eo.h> #include "example_square.eo.h" - -#include "eo_inherit.h" +#include "example_rectangle.eo.h" typedef struct { diff --git a/tutorial/c/eo-inherit/src/meson.build b/tutorial/c/eo-inherit/src/meson.build index 48c9478..fcb7c9c 100644 --- a/tutorial/c/eo-inherit/src/meson.build +++ b/tutorial/c/eo-inherit/src/meson.build @@ -19,7 +19,6 @@ foreach eo : eo_src endforeach src = files([ - 'eo_inherit.h', 'eo_inherit_main.c', ]) --
