Still c implementation is unstable. 89/74489/2
authorHermet Park <hermet@hermet.pe.kr>
Tue, 14 Jun 2016 10:24:09 +0000 (19:24 +0900)
committerHermet Park <hermet@hermet.pe.kr>
Tue, 14 Jun 2016 10:27:20 +0000 (19:27 +0900)
We are still on building up its bodies here and there.

Change-Id: I38f81dc82fde761b5578635836d305c90e1b760f

18 files changed:
src/examples/efl/c/main.cpp
src/examples/efl/c/main.h
src/examples/efl/c/page1.cpp
src/examples/efl/cpp/page1.h
src/examples/efl/cpp/page10.h
src/examples/efl/cpp/page11.h
src/examples/efl/cpp/page12.h
src/examples/efl/cpp/page13.h
src/examples/efl/cpp/page14.h
src/examples/efl/cpp/page2.h
src/examples/efl/cpp/page3.h
src/examples/efl/cpp/page4.h
src/examples/efl/cpp/page5.h
src/examples/efl/cpp/page6.h
src/examples/efl/cpp/page7.h
src/examples/efl/cpp/page8.h
src/include/efl/mobile/c/ui_app.h
src/lib/efl/mobile/c/ui_app.cpp

index 59620628217570c6f3b0f0c399809384085d0bad..838c1aee1f02f5d257d19e10fa81fd7ed8de9c87 100644 (file)
@@ -11,22 +11,27 @@ app_create(void *data)
 int
 main(int argc, char *argv[])
 {
-       appdata_s ad = {0,};
-       int ret = 0;
+       ui_app_lifecycle_callback_s lifecycle_callback = {0, };
 
-       ui_app_lifecycle_callback_s lifecycle_callback = {0,};
-
-       ret = ui_app_init(PACKAGE, LOCALE_DIR);
-       if (!ret) {
+       if (!ui_app_init(PACKAGE, LOCALE_DIR))
+       {
                dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_init() is failed. err = %d", ret);
+               return ret;
        }
 
        lifecycle_callback.create = app_create;
 
-       ret = ui_app_run(argc, argv, &lifecycle_callback, NULL, &ad);
-       if (ret != APP_ERROR_NONE) {
+       if (!ui_app_run(argc, argv, &lifecycle_callback, NULL, NULL))
+       {
                dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_run() is failed. err = %d", ret);
+               return ret;
+       }
+
+       if (!ui_app_term())
+       {
+               dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_term() is failed. err = %d", ret);
+               return ret;
        }
 
-       return ret;
+       return 0;
 }
index 5406440317306e4cd5e4018da5c1588f05a6d015..b86546008ac3174a8f41507364572a62d23cc2fd 100644 (file)
 #define PACKAGE "ui-viewmgr"
 #endif
 
-typedef struct appdata {
-       Evas_Object *win;
-       Evas_Object *conform;
-       Evas_Object *layout;
-       Evas_Object *nf;
-       Evas_Object *tabbar;
-} appdata_s;
-
-
 Evas_Object* create_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb);
 Evas_Object* create_landscape_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb);
 Evas_Object* create_title_handle_content(Evas_Object *parent, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb,
index f10f6c69ea6364092200ef169f6c27d23e9165f5..7f6429140dca87aa4788cf5e5f57cc9e11c593ff 100644 (file)
@@ -37,7 +37,7 @@ view1_load_cb(ui_view *view, void *data)
        Evas_Object *content = create_content(base_layout, "ViewMgr Demo<br>Basic View",
                        view1_prev_btn_clicked_cb, view1_next_btn_clicked_cb);
 
-       ui_standard_view_content_set(view, content, "Page1 C example", NULL, NULL, NULL);
+       ui_standard_view_content_set(view, content, "Page1", NULL, NULL, NULL);
 
        return true;
 }
index b7b6046b9e2bcad82c53abc142f399f2aac18de1..37e4819f4030a3be75eac97a3ab43025c83fd768 100644 (file)
@@ -15,7 +15,7 @@
  *
  */
 
-/** This example create a simple view which is inheritance ui_standard_view.
+/** This example create a simple view which is inheritance of an ui_standard_view.
  *  Then push in viewmgr.
  */
 class page1: public ui_standard_view
@@ -27,7 +27,7 @@ protected:
                ui_standard_view::on_load();
 
                //Create a main content.
-               Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Basic View",
+               Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo<br>Basic View",
                                //Prev Button Callback
                                [](void *data, Evas_Object *obj, void *event_info) -> void
                                {
@@ -38,7 +38,7 @@ protected:
                                {
                                        UI_VIEWMGR->push_view(new page2());
                                });
-               this->set_content(content, "Page1 C++ example");
+               this->set_content(content, "Page1");
        }
 
 public:
index 8f7de8cb6b7190c2d3ae3c436ffb7d685cea6075..a4cce67b4f3d408d2888ad21140ddc3a36655567 100644 (file)
@@ -34,7 +34,7 @@ protected:
                //Portrait
                if (this->get_degree() == 0 || this->get_degree() == 180)
                {
-                       Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Rotation",
+                       Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo<br>Rotation",
                                        //Prev Button Callback
                                        [](void *data, Evas_Object *obj, void *event_info) -> void
                                        {
@@ -52,7 +52,7 @@ protected:
                //Landscape
                else
                {
-                       Evas_Object *content = create_landscape_content(this->get_base(), "ViewMgr Demo<br>Rotation",
+                       Evas_Object *content = create_landscape_content(this->get_base(), "ViewMgr++ Demo<br>Rotation",
                                        //Prev Button Callback
                                        [](void *data, Evas_Object *obj, void *event_info) -> void
                                        {
index 34e14b70f1978bfbf4ca3c71349c735a1cc4eb48..b752d404e32c4fbc9d865b69146476529aa7ed93 100644 (file)
@@ -34,7 +34,7 @@ protected:
                ui_standard_view::on_load();
 
                //Create a main content.
-               Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Menu Popup",
+               Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo<br>Menu Popup",
                                //Prev Button Callback
                                [](void *data, Evas_Object *obj, void *event_info) -> void
                                {
index fdfafcf8814bbea173546e0a4ca727a722cc9ad5..cbe11f10720961ef994c75ffb288a47f2c22e565 100644 (file)
@@ -37,7 +37,7 @@ protected:
                ui_standard_view::on_load();
 
                //Create a main content.
-               Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Popup",
+               Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo<br>Popup",
                                //Prev Button Callback
                                [](void *data, Evas_Object *obj, void *event_info) -> void
                                {
index 1ca40a43990b41f292428f4201923536f17daac9..7f7d4878bef2f0249f0dfa96c6c3c09a47d78199 100644 (file)
@@ -28,7 +28,7 @@ protected:
                ui_standard_view::on_load();
 
                //Create a main content.
-               Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Fade Transition",
+               Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo<br>Fade Transition",
                                //Prev Button Callback
                                [](void *data, Evas_Object *obj, void *event_info) -> void
                                {
index 36080ef2e41a33ad4ad845091a7b915b06bd021f..f588ba8c71d50e7abe8d15b23c516b32044b9bdc 100644 (file)
@@ -28,7 +28,7 @@ protected:
                ui_standard_view::on_load();
 
                //Create a main content.
-               Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>None Transition",
+               Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo<br>None Transition",
                                //Prev Button Callback
                                [](void *data, Evas_Object *obj, void *event_info) -> void
                                {
index ae4b49670833df56c1687f5294826841f91c6bd1..aaf1f319189cb8cc312bac97ef230e7434a0345a 100644 (file)
@@ -26,7 +26,7 @@ protected:
                ui_standard_view::on_load();
 
                //Create a main content.
-               Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Title Buttons",
+               Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo<br>Title Buttons",
                //Prev Button Callback
                        [](void *data, Evas_Object *obj, void *event_info) -> void
                        {
index 9de47eac636e58432ecdacbe0d888b49754f63b7..d2d13d1e78a2370e4fadf960c8494c14b0d54156 100644 (file)
@@ -26,7 +26,7 @@ protected:
                ui_standard_view::on_load();
 
                //Create a main content.
-               Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Subtitle",
+               Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo<br>Subtitle",
                                //Prev Button Callback
                                [](void *data, Evas_Object *obj, void *event_info) -> void
                                {
index 8bfc0a5518c9124d61cb3f2af22525cdc69c0a5b..eda5a39b51d37197b86419596107d261c8f2b2ea 100644 (file)
@@ -27,7 +27,7 @@ protected:
                ui_standard_view::on_load();
 
                //Create a main content.
-               Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Title Badge",
+               Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo<br>Title Badge",
                                //Prev Button Callback
                                [](void *data, Evas_Object *obj, void *event_info) -> void
                                {
index 8ec899803cd5f3f6b11a6fc434c7bd392fef06cd..df8da247844c1390f7f36c3b9a3a917d67d20c1e 100644 (file)
@@ -26,7 +26,7 @@ protected:
                ui_view::on_load();
 
                //Create a main content.
-               Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Full View",
+               Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo<br>Full View",
                                //Prev Button Callback
                                [](void *data, Evas_Object *obj, void *event_info) -> void
                                {
index 5f569525e68e4306a42f01f3b6fb0ac28c20e966..633be3ff784e3c100ab0134b3ecc9f7538c32fad 100644 (file)
@@ -25,7 +25,7 @@ protected:
                ui_standard_view::on_load();
 
                //Create a main content.
-               Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Toolbar",
+               Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo<br>Toolbar",
                                //Prev Button Callback
                                [](void *data, Evas_Object *obj, void *event_info) -> void
                                {
index 27f5df805da7822cf30c2b09541fade0bc949bca..dd45eddd93981c53766eb106a8a30f98c611c9a5 100644 (file)
@@ -25,7 +25,7 @@ protected:
                ui_standard_view::on_load();
 
                //Create a main content.
-               Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Navigationbar",
+               Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo<br>Navigationbar",
                                //Prev Button Callback
                                [](void *data, Evas_Object *obj, void *event_info) -> void
                                {
index 723553b04ec49895bba0f807520feeea863e754a..078d856988f0a7dad4d9710adeb9ff8f06866c1f 100644 (file)
@@ -23,7 +23,7 @@ public:
        page8() : ui_standard_view("page8")
        {
                //Create a main content.
-               Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Content Preloading",
+               Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo<br>Content Preloading",
                        //Prev Button Callback
                        [](void *data, Evas_Object *obj, void *event_info) -> void
                        {
index 9394d38ee099f4fb5cc7eae433d2b01f588d316a..f180f13926e77c974e1ff1c6e2833ea35d66b03c 100644 (file)
@@ -1,12 +1,10 @@
 #ifndef _UI_APP_C_H_
 #define _UI_APP_C_H_
 
-namespace efl_viewmanager
-{
-
 #ifdef __cplusplus
 extern "C" {
 #endif
+
        typedef void (*ui_app_event_low_battery_cb) (app_event_info_h event_info, void *data);
        typedef void (*ui_app_event_low_memory_cb) (app_event_info_h event_info, void *data);
        typedef void (*ui_app_event_orient_changed_cb) (app_event_info_h event_info, void *data);
@@ -23,16 +21,13 @@ extern "C" {
        } ui_app_event_callback_s;
 
        bool ui_app_init(const char *pkg, const char *locale_dir);
-
-       int ui_app_run(int argc, char **argv, ui_app_lifecycle_callback_s *lifecycle_callback,
-                          ui_app_event_callback_s *event_callback, void *data);
-
+       int ui_app_run(int argc, char **argv, ui_app_lifecycle_callback_s *lifecycle_callback, ui_app_event_callback_s *event_callback, void *data);
        ui_viewmgr *ui_app_viewmgr_get();
+       bool ui_app_term(void);
+
 
-       ui_app *ui_app_app_get();
 #ifdef __cplusplus
 }
 #endif
 
-}
 #endif /* _UI_APP_C_H_ */
index 04ee5c3842ab71c768b8d43aeeb91f7fb110e4c2..20de888891605ef6d775f3d24912baa30f613eb7 100644 (file)
@@ -118,30 +118,46 @@ public:
        }
 };
 
-extern "C" {
-       static ui_app_capi *app = NULL;
 
-       bool ui_app_init(const char *pkg, const char *locale_dir)
-       {
-               app = new ui_app_capi(pkg, locale_dir);
+static ui_app_capi *g_app = NULL;
 
-               if (app) return true;
-               else return false;
-       }
+bool ui_app_init(const char *pkg, const char *locale_dir)
+{
+       ui_app_capi *app = g_app;
+       if (app) return true;
 
-       int ui_app_run(int argc, char **argv, ui_app_lifecycle_callback_s *lifecycle_callback,
-                          ui_app_event_callback_s *event_callback, void *data)
+       app = new ui_app_capi(pkg, locale_dir);
+       if (!app)
        {
-               return app->run(argc, argv, lifecycle_callback, event_callback, data);
+               LOGE("Failed to create new ui_app_capi()!");
+               return false;
        }
 
-       ui_viewmgr *ui_app_viewmgr_get()
-       {
-               return app->get_viewmgr();
-       }
+       g_app = app;
 
-       ui_app *ui_app_app_get()
-       {
-               return app;
-       }
+       return true;
+}
+
+int ui_app_run(int argc, char **argv, ui_app_lifecycle_callback_s *lifecycle_callback, ui_app_event_callback_s *event_callback, void *data)
+{
+       ui_app_capi *app = g_app;
+       if (!app) return -1;
+
+       return app->run(argc, argv, lifecycle_callback, event_callback, data);
+}
+
+ui_viewmgr *ui_app_viewmgr_get()
+{
+       ui_app_capi *app = g_app;
+       if (!app) return NULL;
+
+       return app->get_viewmgr();
+}
+
+bool ui_app_term(void)
+{
+       ui_app_capi *app = g_app;
+       if (app) delete (app);
+
+       return true;
 }