ui_manager : initial version
authorJin Yoon <jinny.yoon@samsung.com>
Sun, 2 Aug 2015 13:54:42 +0000 (22:54 +0900)
committerJin Yoon <jinny.yoon@samsung.com>
Sun, 2 Aug 2015 13:54:42 +0000 (22:54 +0900)
18 files changed:
inc/adventure.h
inc/item.h [deleted file]
inc/item_info.h [deleted file]
inc/path.h
inc/path_group.h
inc/point.h
inc/scroller.h
inc/search.h [deleted file]
inc/search_path.h [moved from src/write.c with 100% similarity]
inc/ui_manager.h
inc/write_path.h [new file with mode: 0644]
res/edje/ui_manager.edc [new file with mode: 0644]
src/adventure.c
src/item.c [deleted file]
src/item_info.c [deleted file]
src/search_path.c [moved from src/search.c with 100% similarity]
src/ui_manager.c
src/write_path.c [moved from inc/write.h with 100% similarity]

index fcb4d0d..06797bd 100644 (file)
@@ -42,6 +42,7 @@ struct _adventure_info_s {
        Evas_Object *adventure;
        Evas_Object *initial;
        Evas_Object *loading;
+       Evas_Object *ui_manager;
 
        Ecore_Timer *initial_timer;
 
@@ -52,11 +53,37 @@ struct _adventure_info_s {
 };
 typedef struct _adventure_info_s adventure_info_s;
 
-struct _view_info_s {
-       char *name;
-       Evas_Object *view;
+struct _path_info_s {
+       int path_id;
+       int created_time;
+       int duration;
+       int rate;
+
+       char *title;
+       char *title_image;
+       char *content;
+       char *author;
 };
-typedef struct _view_info_s view_info_s;
+typedef struct _path_info_s path_info_s;
+
+struct _point_info_s {
+       int point_id;
+       int path_id;
 
+       char *title;
+       char *nation;
+       char *district;
+       char *title_image;
+       char *content;
+       char *map_image;
+       char *duration;
+};
+typedef struct _point_info_s point_info_s;
+
+struct _user_info_s {
+       char *user_id;
+       char *password;
+};
+typedef struct _user_info_s user_info_s;
 
 #endif /* __ADVENTURE_H__ */
diff --git a/inc/item.h b/inc/item.h
deleted file mode 100644 (file)
index ecfe389..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __ITEM_H__
-#define __ITEM_H__
-
-#include <Elementary.h>
-#include "item_info.h"
-
-extern Evas_Object *item_create(Evas_Object *parent, item_info_s *item_info);
-extern void item_destroy(Evas_Object *item);
-
-#endif /* __ITEM_H__ */
diff --git a/inc/item_info.h b/inc/item_info.h
deleted file mode 100644 (file)
index 1a2cbf6..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __ITEM_INFO_H__
-#define __ITEM_INFO_H__
-
-struct _item_info_s {
-       /* Innate features */
-       char *id;
-       char *name;
-       char *icon_path;
-
-       /* Acquire features */
-       Evas_Object *icon;
-       int width;
-       int height;
-};
-typedef struct _item_info_s item_info_s;
-
-extern item_info_s *item_info_create(const char *id);
-extern void item_info_destroy(item_info_s *item_info);
-
-#endif /* __ITEM_INFO_H__ */
index e69de29..200920a 100644 (file)
@@ -0,0 +1,10 @@
+#ifndef __PATH_H__
+#define __PATH_H__
+
+#include <Elementary.h>
+#include "adventure.h"
+
+extern Evas_Object *path_create(Evas_Object *parent, path_info_s *path_info);
+extern void *path_destroy(Evas_Object *path);
+
+#endif /* __PATH_H__ */
index e69de29..c7da0d8 100644 (file)
@@ -0,0 +1,16 @@
+#ifndef __PATH_GROUP_H__
+#define __PATH_GROUP_H__
+
+#include <Elementary.h>
+
+enum {
+       PATH_GROUP_TYPE_PLACE = 0,
+       PATH_GROUP_TYPE_BUY_LIST,
+       PATH_GROUP_TYEP_MY_LIST,
+       PATH_GROUP_TYPE_ALL,
+};
+
+extern Evas_Object *path_group_create(Evas_Object *parent, int type, void *data);
+extern void *path_group_destroy(Evas_Object *path_group);
+
+#endif /* __PATH_GROUP_H__ */
index e69de29..0cd61d6 100644 (file)
@@ -0,0 +1,10 @@
+#ifndef __POINT_H__
+#define __POINT_H__
+
+#include <Elementary.h>
+#include "adventure.h"
+
+extern Evas_Object *point_create(Evas_Object *parent, point_info_s *point_info);
+extern void *point_destroy(Evas_Object *point);
+
+#endif /* __POINT_H__ */
index beb7c62..7fa2368 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __SCROLLER_INFO_H__
-#define __SCROLLER_INFO_H__
+#ifndef __SCROLLER_H__
+#define __SCROLLER_H__
 
 #include <Elementary.h>
 
@@ -22,4 +22,4 @@ extern void scroller_bring_in_item(Evas_Object *scroller, Evas_Object *item);
 extern int scroller_register_event_cb(Evas_Object *scroller, int event_type, void (*event_cb)(Evas_Object *scroller, int event_type, void *event_info, void *user_data), void *user_data);
 extern int scroller_unregister_event_cb(Evas_Object *scroller, int event_type, void (*event_cb)(Evas_Object *scroller, int event_type, void *event_info, void *user_data));
 
-#endif /* __SCROLLER_INFO_H__ */
+#endif /* __SCROLLER_H__ */
diff --git a/inc/search.h b/inc/search.h
deleted file mode 100644 (file)
index e69de29..0000000
similarity index 100%
rename from src/write.c
rename to inc/search_path.h
index 6157cf2..dc8cae8 100644 (file)
@@ -1,6 +1,10 @@
+#ifndef __UI_MANAGER_H__
+#define __UI_MANAGER_H__
+
 #include <Elementary.h>
+#include "adventure.h"
 
-extern Evas_Object *ui_manager_create(Evas_Object *parent);
+extern Evas_Object *ui_manager_create(Evas_Object *parent, adventure_info_s *adventure_info);
 extern void ui_manager_destroy(Evas_Object *ui_manager);
 
-
+#endif /* __UI_MANAGER_H__ */
diff --git a/inc/write_path.h b/inc/write_path.h
new file mode 100644 (file)
index 0000000..84bbddb
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef __WRITE_PATH_H__
+#define __WRITE_PATH_H__
+
+#include <Elementary.h>
+#include "adventure.h"
+
+extern Evas_Object *write_path_create(Evas_Object *parent);
+extern void *write_path_destroy(Evas_Object *write_path);
+
+#endif /* __WRITE_PATH_H__ */
diff --git a/res/edje/ui_manager.edc b/res/edje/ui_manager.edc
new file mode 100644 (file)
index 0000000..86a9854
--- /dev/null
@@ -0,0 +1,47 @@
+images {
+       image: "Aventure01_background.png" COMP;
+}
+
+
+collections {
+       group { name: "main";
+               parts {
+                       part {
+                               name: "bg";
+                               type: SWALLOW;
+                               description {
+                                       state: "default" 0.0;
+                                       align: 0.0 0.0;
+                                       rel1 { relative: 0.0 0.0; }
+                                       rel2 { relative: 1.0 1.0; }
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "bg_img";
+                               type: IMAGE;
+                               scale: 1;
+                               mouse_events: 0;
+                               description { state: "default" 0.0;
+                                       rel1 { relative: 0.0 0.0; to: "bg"; }
+                                       rel2 { relative: 1.0 1.0; to: "bg"; }
+                                       image {
+                                               normal: "Aventure01_background.png";
+                                       }
+                                       visible: 1;
+                         }
+                       }
+                       part {
+                               name: "scroller";
+                               type: SWALLOW;
+                               description {
+                                       rel1 { relative: 0.0 0.0; }
+                                       rel2 { relative: 1.0 1.0; }
+                                       visible: 1;
+                               }
+                       }
+               }
+               programs {
+               }
+       }
+}
index 1dfe21b..fecc567 100644 (file)
@@ -67,9 +67,14 @@ Eina_Bool _destroy_initial_cb(void *data)
        initial_destroy(adventure_info->initial);
        adventure_info->initial_timer = NULL;
 
+       adventure_info->ui_manager = ui_manager_create(adventure_info->conformant, adventure_info);
+       retv_if(!adventure_info->ui_manager, ECORE_CALLBACK_CANCEL);
+
+#if 0
        adventure_info->loading = loading_create(adventure_info->adventure, adventure_info->width, adventure_info->height);
        retv_if(!adventure_info->loading, ECORE_CALLBACK_CANCEL);
        elm_object_part_content_set(adventure_info->adventure, "loading", adventure_info->loading);
+#endif
 
        return ECORE_CALLBACK_CANCEL;
 }
@@ -139,6 +144,9 @@ app_terminate(void *data)
 {
        adventure_info_s *adventure_info = data;
 
+       if (adventure_info->ui_manager)
+               ui_manager_destroy(adventure_info->ui_manager);
+
        if (adventure_info->adventure)
                _destroy_adventure(adventure_info->adventure);
 
diff --git a/src/item.c b/src/item.c
deleted file mode 100644 (file)
index 8a468c2..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-#include <Elementary.h>
-#include <app.h>
-
-#include "util.h"
-#include "log.h"
-#include "item.h"
-#include "item_info.h"
-
-
-
-#define DEFAULT_ICON "/usr/share/icons/A01-1_icon_Menu.png"
-#define ITEM_ICON_WIDTH 112
-#define ITEM_ICON_HEIGHT 112
-
-
-
-const char *const ITEM_EDJE = "item.edj";
-
-
-
-static Evas_Object *__add_icon(Evas_Object *parent, const char *file)
-{
-       Evas_Object *icon = NULL;
-
-       retv_if(!parent, NULL);
-
-       icon = elm_icon_add(parent);
-       retv_if(!icon, NULL);
-
-       if (elm_image_file_set(icon, file, NULL) == EINA_FALSE) {
-               _E("Icon file is not accessible (%s)", file);
-               evas_object_del(icon);
-               return NULL;
-       }
-
-       evas_object_size_hint_min_set(icon, ELM_SCALE_SIZE(ITEM_ICON_WIDTH), ELM_SCALE_SIZE(ITEM_ICON_HEIGHT));
-
-       elm_image_preload_disabled_set(icon, EINA_TRUE);
-       elm_image_smooth_set(icon, EINA_TRUE);
-       elm_image_no_scale_set(icon, EINA_FALSE);
-       evas_object_show(icon);
-
-       return icon;
-}
-
-
-
-static void __item_clicked_cb(void *data, Evas_Object *obj, void *event_info)
-{
-       item_info_s *item_info = data;
-
-       ret_if(!item_info);
-}
-
-
-
-Evas_Object *item_create(Evas_Object *parent, item_info_s *item_info)
-{
-       Evas_Object *item = NULL;
-       Evas_Object *item_bg = NULL;
-       Evas_Object *icon = NULL;
-       Evas_Object *button = NULL;
-       Evas *e = NULL;
-
-       char *path = NULL;
-       char *name = NULL;
-       char full_path[PATH_LEN] = {0, };
-
-       retv_if(!parent, NULL);
-
-       path = app_get_resource_path();
-       retv_if(!path, NULL);
-
-       snprintf(full_path, sizeof(full_path), "%s/edje/%s", path, ITEM_EDJE);
-       free(path);
-
-       item = elm_layout_add(parent);
-       retv_if(!item, NULL);
-       elm_layout_file_set(item, full_path, "item");
-
-       e = evas_object_evas_get(parent);
-       goto_if(!e, ERROR);
-
-       item_bg = evas_object_rectangle_add(e);
-       goto_if(!item_bg, ERROR);
-       evas_object_size_hint_weight_set(item_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       evas_object_size_hint_min_set(item_bg, ELM_SCALE_SIZE(item_info->width), ELM_SCALE_SIZE(item_info->height));
-       evas_object_color_set(item_bg, 0, 0, 0, 0);
-       evas_object_repeat_events_set(item_bg, EINA_TRUE);
-       evas_object_show(item_bg);
-       elm_object_part_content_set(item, "bg", item_bg);
-       evas_object_show(item);
-
-       icon = __add_icon(item, item_info->icon_path);
-       goto_if(!icon, ERROR);
-       elm_object_part_content_set(item, "icon", icon);
-
-       name = item_info->name;
-       goto_if(!name, ERROR);
-       elm_object_part_text_set(item, "name", name);
-
-       button = elm_button_add(item);
-       goto_if(!button, ERROR);
-
-       elm_object_style_set(button, "focus");
-       elm_object_part_content_set(item, "button", button);
-       evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       evas_object_show(button);
-       evas_object_smart_callback_add(button, "clicked", __item_clicked_cb, item_info);
-
-       return item;
-
-ERROR:
-       item_destroy(item);
-       return NULL;
-
-}
-
-
-
-void item_destroy(Evas_Object *item)
-{
-       Evas_Object *bg = NULL;
-       Evas_Object *button = NULL;
-       Evas_Object *icon = NULL;
-
-       ret_if(!item);
-
-       button = elm_object_part_content_unset(item, "button");
-       if (button) {
-               evas_object_smart_callback_del(button, "clicked", __item_clicked_cb);
-       }
-
-       icon = elm_object_part_content_unset(item, "icon");
-       if (icon) {
-               evas_object_del(icon);
-       }
-       bg = elm_object_part_content_unset(item, "bg");
-       if (bg) {
-               evas_object_del(bg);
-       }
-       evas_object_del(item);
-}
diff --git a/src/item_info.c b/src/item_info.c
deleted file mode 100644 (file)
index d85c1d1..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <Evas.h>
-#include <Elementary.h>
-
-#include "util.h"
-#include "log.h"
-#include "item_info.h"
-
-
-
-item_info_s *item_info_create(const char *id)
-{
-       item_info_s *item_info = NULL;
-
-       retv_if(!id, NULL);
-
-       item_info = calloc(1, sizeof(item_info_s));
-       retv_if(!item_info, NULL);
-
-       return item_info;
-}
-
-
-
-void item_info_destroy(item_info_s *item_info)
-{
-       ret_if(!item_info);
-       free(item_info);
-}
similarity index 100%
rename from src/search.c
rename to src/search_path.c
index e69de29..4e63861 100644 (file)
@@ -0,0 +1,51 @@
+#include <Elementary.h>
+#include "adventure.h"
+#include "log.h"
+
+const char *const UI_MANAGER_EDJE = "ui_manager.edj";
+
+Evas_Object *ui_manager_create(Evas_Object *parent, adventure_info_s *adventure_info)
+{
+       Evas_Object *ui_manager = NULL;
+       Evas_Object *rect = NULL;
+       char *path = NULL;
+       char full_path[PATH_LEN] = {0, };
+
+       retv_if(!parent, NULL);
+
+       path = app_get_resource_path();
+       retv_if(!path, NULL);
+
+       snprintf(full_path, sizeof(full_path), "%s/edje/%s", path, UI_MANAGER_EDJE);
+       free(path);
+
+       ui_manager = elm_layout_add(parent);
+       retv_if(!ui_manager, NULL);
+       elm_layout_file_set(ui_manager, full_path, "main");
+       evas_object_size_hint_weight_set(ui_manager, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_show(ui_manager);
+
+       rect = evas_object_rectangle_add(evas_object_evas_get(parent));
+       if (rect) {
+               evas_object_size_hint_min_set(rect, width, height);
+               evas_object_show(rect);
+               elm_object_part_content_set(ui_manager, "bg", rect);
+       }
+
+       return ui_manager;
+}
+
+
+
+extern void ui_manager_destroy(Evas_Object *ui_manager)
+{
+       Evas_Object *rect = NULL;
+
+       ret_if(!ui_manager);
+
+       rect = elm_object_part_content_unset(ui_manager, "bg");
+       if (rect)
+               evas_object_del(rect);
+
+       evas_object_del(ui_manager);
+}
similarity index 100%
rename from inc/write.h
rename to src/write_path.c