summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYoungHun Cho <hoon.cho@samsung.com>2017-01-02 11:22:45 +0900
committerYoungHun Cho <hoon.cho@samsung.com>2017-01-02 11:22:45 +0900
commit62a62ce51d7250d8459957d481713bd2df505e8c (patch)
tree491c4e855454d950aea3c763443ed52a2411f80f /src
parente9da500001fba0a0e4226702a9326a4ec9914d54 (diff)
downloadw3-home-62a62ce51d7250d8459957d481713bd2df505e8c.tar.gz
w3-home-62a62ce51d7250d8459957d481713bd2df505e8c.tar.bz2
w3-home-62a62ce51d7250d8459957d481713bd2df505e8c.zip
tmp backuprefactor
Change-Id: I3f9349443c08de197b1ed56cf36275e3e60982ac Signed-off-by: YoungHun Cho <hoon.cho@samsung.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/add-widget/add-widget_manager.c60
-rwxr-xr-xsrc/apps/apps_manager.c60
-rwxr-xr-xsrc/clock/clock_manager.c87
-rwxr-xr-xsrc/clock/clock_scroller.c51
-rwxr-xr-xsrc/clock/clock_view.c76
-rwxr-xr-xsrc/common/callback_handler.c120
-rwxr-xr-xsrc/common/conf.c64
-rwxr-xr-xsrc/common/util.c54
-rwxr-xr-xsrc/home/home_manager.c152
-rwxr-xr-xsrc/home/home_scroller.c144
-rwxr-xr-xsrc/home/home_scroller_page.c94
-rwxr-xr-xsrc/home/home_state.c53
-rwxr-xr-xsrc/home/home_win.c84
-rwxr-xr-xsrc/main.c44
-rwxr-xr-xsrc/moments/moment_manager.c62
-rwxr-xr-xsrc/notifications/noti_event_manager.c99
-rwxr-xr-xsrc/notifications/noti_full_popup.c22
-rwxr-xr-xsrc/notifications/noti_manager.c91
-rwxr-xr-xsrc/notifications/noti_popup_manager.c53
-rwxr-xr-xsrc/notifications/noti_small_popup.c22
-rwxr-xr-xsrc/notifications/noti_view.c85
-rwxr-xr-xsrc/widgets/widgets_manager.c78
-rwxr-xr-xsrc/widgets/widgets_view.c80
23 files changed, 1735 insertions, 0 deletions
diff --git a/src/add-widget/add-widget_manager.c b/src/add-widget/add-widget_manager.c
new file mode 100755
index 0000000..edae1ae
--- /dev/null
+++ b/src/add-widget/add-widget_manager.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "add-widget/add-widget.h"
+
+static struct __add_widget_manager_s {
+ HOME_STATE *state;
+} s_info = {
+ .state = NULL,
+};
+
+static bool __add_widget_init(void);
+static void __add_widget_fini(void);
+static HOME_STATE *__add_widget_state_new(void);
+
+extern HOME_STATE *home_state_new(void);
+
+HOME_STATE *add_widget_new(void)
+{
+ __add_widget_init();
+
+ s_info.state = __add_widget_state_new();
+
+ return s_info.state;
+}
+
+static bool __add_widget_init(void)
+{
+ _D("%s", __func__);
+
+ return true;
+}
+
+static void __add_widget_fini(void)
+{
+
+}
+
+static HOME_STATE *__add_widget_state_new(void)
+{
+ HOME_STATE *state = home_state_new();
+ state->type = ADD_WIDGET;
+ state->destroy_cb = __add_widget_fini;
+
+ return state;
+}
diff --git a/src/apps/apps_manager.c b/src/apps/apps_manager.c
new file mode 100755
index 0000000..703e6b4
--- /dev/null
+++ b/src/apps/apps_manager.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "apps/apps.h"
+
+static struct __apps_manager_s {
+ HOME_STATE *state;
+} s_info = {
+ .state = NULL,
+};
+
+static bool __apps_init(void);
+static void __apps_fini(void);
+static HOME_STATE *__apps_state_new(void);
+
+extern HOME_STATE *home_state_new(void);
+
+HOME_STATE *apps_new(void)
+{
+ __apps_init();
+
+ s_info.state = __apps_state_new();
+
+ return s_info.state;
+}
+
+static bool __apps_init(void)
+{
+ _D("%s", __func__);
+
+ return true;
+}
+
+static void __apps_fini(void)
+{
+
+}
+
+static HOME_STATE *__apps_state_new(void)
+{
+ HOME_STATE *state = home_state_new();
+ state->type = APPS;
+ state->destroy_cb = __apps_fini;
+
+ return state;
+}
diff --git a/src/clock/clock_manager.c b/src/clock/clock_manager.c
new file mode 100755
index 0000000..1e6eb1e
--- /dev/null
+++ b/src/clock/clock_manager.c
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "clock/clock.h"
+#include "clock/clock_view.h"
+
+static struct __clock_manager_s {
+ HOME_STATE *state;
+} s_info = {
+ .state = NULL,
+};
+
+static bool __clock_init(void);
+static void __clock_fini(void);
+static HOME_STATE *__clock_state_new(void);
+
+extern HOME_STATE *home_state_new(void);
+
+HOME_STATE *clock_new()
+{
+ _D("%s", __func__);
+
+ if (__clock_init() == false) {
+ goto __fail;
+ }
+
+ s_info.state = __clock_state_new();
+ if (s_info.state == NULL) {
+ goto __fail;
+ }
+
+ return s_info.state;
+
+__fail:
+ home_state_destroy(s_info.state);
+ __clock_fini();
+ return NULL;
+}
+
+static bool __clock_init(void)
+{
+ _D("%s", __func__);
+
+ if (clock_view_create_base_ui() == false) {
+ _E("failed to create clock ui");
+ return false;
+ }
+
+
+ return true;
+}
+
+static void __clock_fini(void)
+{
+ _D("%s", __func__);
+
+ s_info.state = NULL;
+ clock_view_destroy();
+}
+
+static HOME_STATE *__clock_state_new(void)
+{
+ _D("%s", __func__);
+
+ HOME_STATE *state = home_state_new();
+ if (state == NULL) {
+ return NULL;
+ }
+ state->type = CLOCK;
+ state->destroy_cb = __clock_fini;
+
+ return state;
+}
diff --git a/src/clock/clock_scroller.c b/src/clock/clock_scroller.c
new file mode 100755
index 0000000..44acfa3
--- /dev/null
+++ b/src/clock/clock_scroller.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "common/conf.h"
+#include "home/home_scroller.h"
+
+static struct __clock_scroller_s {
+ home_scroller_t *home_scroller;
+} s_info = {
+ .home_scroller = NULL,
+};
+
+bool clock_scroller_init(void)
+{
+ s_info.home_scroller = home_scroller_get();
+ if (s_info.home_scroller == NULL) {
+ _E("failed to get scroller");
+ return false;
+ }
+
+ return true;
+}
+
+bool clock_scroller_push_clock(clock_info_t *clock_info)
+{
+
+}
+
+void clock_scroller_pop_clock(void)
+{
+
+}
+
+void clock_scroller_scroll_to_clock(bool need_animation)
+{
+
+}
diff --git a/src/clock/clock_view.c b/src/clock/clock_view.c
new file mode 100755
index 0000000..af1dd87
--- /dev/null
+++ b/src/clock/clock_view.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "common/conf.h"
+#include "clock/clock_view.h"
+#include "clock/clock_scroller.h"
+#include "clock/clock_info.h"
+
+#include <stdlib.h>
+
+static struct __clock_veiw_s {
+ Evas_Object *base_layout;
+} s_info = {
+ .base_layout = NULL,
+};
+
+static bool __create_base_ui(void);
+static void __destroy_base_ui(void);
+
+bool clock_view_create_base_ui(void)
+{
+ if (clock_scroller_init() == false) {
+ _E("failed to get clock scroller");
+ return false;
+ }
+
+ if (__create_base_ui() == false) {
+ _E("failed to create clock ui");
+ return false;
+ }
+
+ return true;
+}
+
+void clock_view_destroy(void)
+{
+ __destroy_base_ui();
+}
+
+static bool __create_base_ui(void)
+{
+ s_info.base_layout = clock_scroller_get_parent();
+ clock_info_t *tmp_clock = clock_info_new(s_info.base_layout);
+
+ Evas_Object *tmp_object = elm_label_add(s_info.base_layout);
+ elm_object_text_set(tmp_object, "<align=center>CLOCK</align>");
+ evas_object_size_hint_weight_set(tmp_object, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(tmp_object, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_min_set(tmp_object, WINDOW_W, WINDOW_H);
+ evas_object_resize(tmp_object, WINDOW_W, WINDOW_H);
+ evas_object_show(tmp_object);
+
+ clock_info_set_content(tmp_clock, tmp_object);
+ clock_scroller_push_clock(tmp_clock);
+
+ return true;
+}
+
+static void __destroy_base_ui(void)
+{
+ clock_scroller_pop_clock();
+}
diff --git a/src/common/callback_handler.c b/src/common/callback_handler.c
new file mode 100755
index 0000000..8c23b7a
--- /dev/null
+++ b/src/common/callback_handler.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "common/callback_handler.h"
+
+#include <stdlib.h>
+
+callback_h *callback_handler_new(const char *key)
+{
+ callback_h *cb_h = (callback_h *)malloc(sizeof(callback_h));
+ if (cb_h == NULL) {
+ _E("failed to malloc");
+ return NULL;
+ }
+
+ cb_h->key = key == NULL ? NULL : strdup(key);
+ cb_h->cb_count = 0;
+
+ return cb_h;
+}
+
+void callback_handler_free(callback_h *cb_h)
+{
+ if (cb_h == NULL) {
+ return ;
+ }
+
+ free(cb_h->key);
+ free(cb_h);
+}
+
+bool callback_handler_add_cb(callback_h *cb_h, void(*cb)(void *data))
+{
+ if (cb_h == NULL) {
+ _E("callback handler is null");
+ return false;
+ }
+
+ if (cb_h->cb_count >= MAX_CB_CNT) {
+ _E("[%s] callback handler is full", cb_h->key);
+ return false;
+ }
+
+ int idx = 0;
+ for (idx = 0; idx < cb_h->cb_count; idx++) {
+ if (cb == cb_h->cb_list[idx]) {
+ _E("[%s] %p callback is already registered", cb_h->key, cb);
+ return false;
+ }
+ }
+ cb_h->cb_list[cb_h->cb_count] = cb;
+ cb_h->cb_count += 1;
+
+ _D("[%s] current callback count is %d", cb_h->key, cb_h->cb_count);
+
+ return true;
+}
+
+void callback_handler_del_cb(callback_h *cb_h, void(*cb)(void *data))
+{
+ if (cb_h == NULL) {
+ _E("callback handler is null");
+ return ;
+ }
+
+ if (cb_h->cb_count == MAX_CB_CNT) {
+ _E("[%s] callback handler is empty", cb_h->key);
+ return ;
+ }
+
+ int idx = 0;
+ for (idx = 0; idx < cb_h->cb_count; idx++) {
+ if (cb == cb_h->cb_list[idx]) {
+ break;
+ }
+ }
+
+ if (idx == cb_h->cb_count) {
+ _E("[%s] %p cb is not found", cb_h->key, cb);
+ return ;
+ }
+
+ int cur = 0;
+ for (cur = idx + 1; cur < cb_h->cb_count; cur++) {
+ cb_h->cb_list[cur - 1] = cb_h->cb_list[cur];
+ cb_h->cb_list[cur] = NULL;
+ }
+ cb_h->cb_count -= 1;
+
+ _D("[%s] current callback count is %d", cb_h->key, cb_h->cb_count);
+}
+
+void callback_handler_execute_cb(callback_h *cb_h, void *data)
+{
+ if (cb_h == NULL) {
+ _D("callback handler is null");
+ return ;
+ }
+
+ int idx = 0;
+ for (idx = 0; idx < cb_h->cb_count; idx++) {
+ if (cb_h->cb_list[idx] != NULL) {
+ (*cb_h->cb_list[idx])(data);
+ }
+ }
+}
diff --git a/src/common/conf.c b/src/common/conf.c
new file mode 100755
index 0000000..04e6ff2
--- /dev/null
+++ b/src/common/conf.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "common/conf.h"
+
+static int window_width = 360;
+static int window_height = 360;
+static double resolution_scale_h = 1.0;
+static double resolution_scale_w = 1.0;
+
+static int supported_resolution[10][2] = { {320, 320}, {360, 360}, {360, 480}, {0, 0}, };
+
+int _get_window_h(void)
+{
+ return window_height;
+}
+
+int _get_window_w(void)
+{
+ return window_width;
+}
+
+double _get_resolution_scale_h()
+{
+ return resolution_scale_h;
+}
+
+double _get_resolution_scale_w()
+{
+ return resolution_scale_w;
+}
+
+void conf_set_resolution(int w, int h)
+{
+ _I("set resolution [%d x %d]", w, h);
+ window_width = w;
+ window_height = h;
+ resolution_scale_w = (double)window_width / 360;
+ resolution_scale_h = (double)window_height / 360;
+}
+
+bool conf_is_supported_resolution(int w, int h)
+{
+ int idx = 0;
+ for (idx = 0; supported_resolution[idx][0] > 0; idx++) {
+ if (w == supported_resolution[idx][0] && h == supported_resolution[idx][1])
+ break;
+ }
+ return supported_resolution[idx][0] == 0 ? false : true;
+}
diff --git a/src/common/util.c b/src/common/util.c
new file mode 100755
index 0000000..c7bb27f
--- /dev/null
+++ b/src/common/util.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "common/util.h"
+
+#include <app.h>
+#include <Elementary.h>
+
+#define PATH_MAX_LEN 1024
+
+const char *util_get_file_path(enum directory_path dir, const char *file)
+{
+ static char buf[PATH_MAX_LEN];
+ char *prefix;
+
+ switch (dir) {
+ case DATA:
+ prefix = app_get_data_path();
+ break;
+ case RESOURCE:
+ prefix = app_get_resource_path();
+ break;
+ default:
+ _E("Not handled directory type.");
+ return NULL;
+ }
+ if (prefix == NULL) {
+ _E("Failed to get prefix");
+ return NULL;
+ }
+
+ size_t res = eina_file_path_join(buf, sizeof(buf), prefix, file);
+ free(prefix);
+ if (res > sizeof(buf)) {
+ _E("Path exceeded PATH_MAX");
+ return NULL;
+ }
+
+ return &buf[0];
+}
diff --git a/src/home/home_manager.c b/src/home/home_manager.c
new file mode 100755
index 0000000..b4b28a4
--- /dev/null
+++ b/src/home/home_manager.c
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "common/callback_handler.h"
+#include "home/home_manager.h"
+#include "home/home_win.h"
+#include "clock/clock.h"
+#include "apps/apps.h"
+#include "notifications/notifications.h"
+#include "moment/moment.h"
+#include "widgets/widgets.h"
+#include "add-widget/add-widget.h"
+
+static struct __home_manager_s {
+ HOME_STATE *clock;
+ HOME_STATE *notifications;
+ HOME_STATE *widgets;
+ HOME_STATE *apps;
+ HOME_STATE *moment;
+ HOME_STATE *add_widget;
+ HOME_STATE *current_state;
+ callback_h *terminate_cb_handler;
+} s_info = {
+ .clock = NULL,
+ .notifications = NULL,
+ .widgets = NULL,
+ .apps = NULL,
+ .moment = NULL,
+ .add_widget = NULL,
+ .current_state = NULL,
+ .terminate_cb_handler = NULL,
+};
+
+static bool __create_home_state(void);
+static void __destroy_home_state(void);
+
+bool home_create_cb(void *data)
+{
+ _D("%s", __func__);
+
+ if (__create_home_state() == false){
+ _E("failed to create home state");
+ goto __fail;
+ }
+
+ (*s_info.current_state->step_in_cb)();
+
+ return true;
+
+__fail :
+ home_terminate_cb(data);
+ return false;
+}
+
+void home_app_control_cb(app_control_h app_control, void *data)
+{
+ _D("%s", __func__);
+}
+
+void home_resume_cb(void *data)
+{
+ _D("%s", __func__);
+}
+
+void home_pause_cb(void *data)
+{
+ _D("%s", __func__);
+}
+
+void home_terminate_cb(void *data)
+{
+ _D("%s", __func__);
+
+ __destroy_home_state();
+
+ callback_handler_execute_cb(s_info.terminate_cb_handler, NULL);
+ callback_handler_free(s_info.terminate_cb_handler);
+ s_info.terminate_cb_handler = NULL;
+}
+
+void home_language_changed_cb(app_event_info_h event_info, void *user_data)
+{
+ _D("home lang changed cb");
+}
+
+HOME_STATE *home_get_current_state(void)
+{
+ return s_info.current_state;
+}
+
+void home_add_terminate_cb(void(*cb)(void *data))
+{
+ if (s_info.terminate_cb_handler == NULL) {
+ s_info.terminate_cb_handler = callback_handler_new("home_manager");
+ }
+
+ callback_handler_add_cb(s_info.terminate_cb_handler, cb);
+}
+
+void home_del_terminate_cb(void(*cb)(void *data))
+{
+ callback_handler_del_cb(s_info.terminate_cb_handler, cb);
+}
+
+static bool __create_home_state(void)
+{
+ s_info.clock = clock_new();
+ s_info.widgets = widgets_new();
+ s_info.notifications = notifications_new();
+ s_info.apps = apps_new();
+ s_info.moment = moment_new();
+ s_info.add_widget = add_widget_new();
+
+ if (!s_info.clock || !s_info.widgets || !s_info.notifications || !s_info.apps || !s_info.moment || !s_info.add_widget)
+ return false;
+
+ s_info.current_state = s_info.clock;
+
+ return true;
+}
+
+static void __destroy_home_state(void)
+{
+ s_info.current_state = NULL;
+
+ home_state_destroy(s_info.add_widget);
+ s_info.add_widget = NULL;
+ home_state_destroy(s_info.moment);
+ s_info.moment = NULL;
+ home_state_destroy(s_info.apps);
+ s_info.apps = NULL;
+ home_state_destroy(s_info.notifications);
+ s_info.notifications = NULL;
+ home_state_destroy(s_info.widgets);
+ s_info.widgets = NULL;
+ home_state_destroy(s_info.clock);
+ s_info.clock = NULL;
+}
diff --git a/src/home/home_scroller.c b/src/home/home_scroller.c
new file mode 100755
index 0000000..9418802
--- /dev/null
+++ b/src/home/home_scroller.c
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "common/conf.h"
+#include "home/home_win.h"
+#include "home/home_scroller.h"
+#include "home/home_manager.h"
+
+#include <app.h>
+#include <stdlib.h>
+
+static struct __home_scroller_s {
+ home_scroller_t *home_scroller;
+} s_info = {
+ .home_scroller = NULL,
+};
+
+static home_scroller_t *__home_scroller_new(void);
+static void __destroy_home_scroller(void *data);
+static Evas_Object *__create_main_scroller(Evas_Object *parent);
+static Evas_Object *__create_main_box(Evas_Object *parent);
+
+home_scroller_t *home_scroller_get(void)
+{
+ if (s_info.home_scroller == NULL) {
+ s_info.home_scroller = __home_scroller_new();
+ home_add_terminate_cb(__destroy_home_scroller);
+ }
+
+ return s_info.home_scroller;
+}
+
+static home_scroller_t *__home_scroller_new(void)
+{
+ home_scroller_t *home_scroller = NULL;
+
+ home_scroller = (home_scroller_t *)malloc(sizeof(home_scroller_t));
+ if (home_scroller == NULL) {
+ _E("failed to malloc");
+ return NULL;
+ }
+
+ home_scroller->parent = home_win_get();
+ if (home_scroller->parent == NULL) {
+ _E("failed to get win");
+ free(home_scroller);
+ return NULL;
+ }
+
+ home_scroller->scroller = __create_main_scroller(home_scroller->parent);
+ if (home_scroller->scroller == NULL) {
+ _E("failed to create scroller");
+ free(home_scroller);
+ return NULL;
+ }
+
+ s_info.home_scroller->box = __create_main_box(s_info.home_scroller->scroller);
+ if (s_info.home_scroller->box == NULL) {
+ _E("failed to create box");
+ evas_object_del(home_scroller->scroller);
+ free(home_scroller);
+ return NULL;
+ }
+
+ elm_object_content_set(s_info.home_scroller->scroller, s_info.home_scroller->box);
+
+ s_info.home_scroller->clock_page = NULL;
+ s_info.home_scroller->noti_first_page = NULL;
+ s_info.home_scroller->widgets_first_page = NULL;
+
+ return home_scroller;
+}
+
+static void __destroy_home_scroller(void *data)
+{
+ if (s_info.home_scroller == NULL) {
+ return ;
+ }
+
+ if (s_info.home_scroller->box) {
+ evas_object_del(s_info.home_scroller->box);
+ }
+
+ if (s_info.home_scroller->scroller) {
+ evas_object_del(s_info.home_scroller->scroller);
+ }
+
+ free(s_info.home_scroller);
+ s_info.home_scroller = NULL;
+}
+
+static Evas_Object *__create_main_scroller(Evas_Object *parent)
+{
+ Evas_Object *scroller = NULL;
+ scroller = elm_scroller_add(parent);
+
+ if (scroller == NULL) {
+ return NULL;
+ }
+
+ elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_FALSE);
+ elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+ elm_scroller_page_scroll_limit_set(scroller, 1, 0);
+ elm_scroller_single_direction_set(scroller, ELM_SCROLLER_SINGLE_DIRECTION_HARD);
+ elm_scroller_page_size_set(scroller, WINDOW_W, WINDOW_H);
+ elm_object_style_set(scroller, "effect");
+ elm_object_scroll_lock_y_set(scroller, EINA_TRUE);
+ evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_resize(scroller, WINDOW_W, WINDOW_H);
+ evas_object_move(scroller, 0, 0);
+ evas_object_show(scroller);
+
+ return scroller;
+}
+
+static Evas_Object *__create_main_box(Evas_Object *parent)
+{
+ Evas_Object *box = NULL;
+ box = elm_box_add(parent);
+ if (box == NULL) {
+ return NULL;
+ }
+
+ elm_box_horizontal_set(box, EINA_TRUE);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(box, 0, 0);
+ evas_object_show(box);
+
+ return box;
+}
diff --git a/src/home/home_scroller_page.c b/src/home/home_scroller_page.c
new file mode 100755
index 0000000..d9e7311
--- /dev/null
+++ b/src/home/home_scroller_page.c
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "common/conf.h"
+#include "common/util.h"
+#include "common/edje_conf.h"
+#include "home/home_scroller_page.h"
+
+#include <stdlib.h>
+
+home_scroller_page_t *home_scroller_page_new(Evas_Object *parent)
+{
+ home_scroller_page_t *page = (home_scroller_page_t *)malloc(sizeof(home_scroller_page_t));
+ if (page == NULL) {
+ _E("failed to malloc");
+ goto __fail;
+ }
+
+ page->page_idx = 0;
+ page->parent = parent;
+ page->layout = elm_layout_add(parent);
+ if (page->layout == NULL) {
+ _E("failed to elm_layout_add");
+ return false;
+ }
+
+ elm_layout_file_set(page->layout, util_get_res_file_path(EDJE_DIR"/page.edj"), GROUP_HOME_PAGE_LAYOUT);
+ evas_object_size_hint_align_set(page->layout, 0, 0);
+ evas_object_size_hint_weight_set(page->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(page->layout);
+
+ Evas_Object *rect = evas_object_rectangle_add(evas_object_evas_get(page->layout));
+ evas_object_size_hint_min_set(rect, PAGE_W, PAGE_H);
+ evas_object_size_hint_align_set(rect, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_color_set(rect, 0, 0, 0, 0);
+ evas_object_show(rect);
+
+ elm_object_part_content_set(page->layout, SIZE_SETTER, rect);
+
+ return page;
+
+__fail:
+ home_scroller_page_del(page);
+ return NULL;
+}
+
+void home_scroller_page_del(home_scroller_page_t *page)
+{
+ if (page == NULL) {
+ return ;
+ }
+
+ if (page->layout) {
+ evas_object_del(page->layout);
+ }
+ free(page);
+}
+
+bool home_scroller_page_set_content(home_scroller_page_t *page, Evas_Object *content)
+{
+ if (page == NULL || page->layout == NULL || content == NULL) {
+ _E("failed to set content on page");
+ return false;
+ }
+
+ elm_object_part_content_set(page->layout, PART_PAGE_CONTENT, content);
+
+ return true;
+}
+
+Evas_Object *home_scroller_page_get_content(home_scroller_page_t *page)
+{
+ if (page == NULL || page->layout == NULL) {
+ _E("failed to get content from page");
+ return NULL;
+ }
+
+ return elm_object_item_part_content_get(page->layout, PART_PAGE_CONTENT);
+}
diff --git a/src/home/home_state.c b/src/home/home_state.c
new file mode 100755
index 0000000..fdafa1c
--- /dev/null
+++ b/src/home/home_state.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "home/home_state.h"
+
+#include <stdlib.h>
+
+static bool __dummy_is_visible(void) { _D("do nothing"); return false;}
+static void __dummy_step_in(void) { _D("do nothing"); }
+static void __dummy_step_out(void) { _D("do nothing"); }
+static void __dummy_destroy(void) { _D("do nothing"); }
+
+HOME_STATE *home_state_new(void)
+{
+ HOME_STATE *state = (HOME_STATE *)malloc(sizeof(HOME_STATE));
+ if(state == NULL) {
+ _E("failed to malloc");
+ return NULL;
+ }
+
+ state->type = DUMMY;
+ state->is_visible_cb = __dummy_is_visible;
+ state->step_in_cb = __dummy_step_in;
+ state->step_out_cb = __dummy_step_out;
+ state->destroy_cb = __dummy_destroy;
+
+ return state;
+}
+
+void home_state_destroy(HOME_STATE *state)
+{
+ if (state == NULL)
+ return ;
+
+ if (state->destroy_cb) {
+ (*state->destroy_cb)();
+ }
+ free(state);
+}
diff --git a/src/home/home_win.c b/src/home/home_win.c
new file mode 100755
index 0000000..a237e8c
--- /dev/null
+++ b/src/home/home_win.c
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "common/conf.h"
+#include "home/home_win.h"
+#include "home/home_manager.h"
+
+static struct __home_win_s {
+ Evas_Object *main_win;
+} s_info = {
+ .main_win = NULL,
+};
+
+static Evas_Object *__create_main_win(void);
+static void __destroy_main_win(void *data);
+
+Evas_Object *home_win_get(void)
+{
+ if (s_info.main_win == NULL) {
+ s_info.main_win = __create_main_win();
+ home_add_terminate_cb(__destroy_main_win);
+ }
+
+ return s_info.main_win;
+}
+
+Evas_Object *__create_main_win(void)
+{
+ Evas_Object *win = NULL;
+
+ elm_config_accel_preference_set("3d");
+
+ win = elm_win_add(NULL, "W-Home", ELM_WIN_BASIC);
+ if (win == NULL) {
+ _E("failed to create window");
+ return NULL;
+ }
+
+ int w, h;
+ elm_win_screen_size_get(win, NULL, NULL, &w, &h);
+ if (!conf_is_supported_resolution(w, h)) {
+ _E("%dx%d is not supported", w, h);
+ evas_object_del(win);
+ return NULL;
+ }
+ conf_set_resolution(w, h);
+
+ elm_win_title_set(win, "W-Home");
+ elm_win_borderless_set(win, EINA_TRUE);
+ elm_win_alpha_set(win, EINA_FALSE);
+ elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_SHOW);
+ elm_win_indicator_opacity_set(win, ELM_WIN_INDICATOR_OPAQUE);
+ elm_win_aux_hint_add(win, "wm.policy.win.gesture.disable", "1");
+
+ evas_object_resize(win, w, h);
+ evas_object_show(win);
+
+ return win;
+}
+
+static void __destroy_main_win(void *data)
+{
+ if (s_info.main_win == NULL) {
+ return ;
+ }
+
+ evas_object_del(s_info.main_win);
+ s_info.main_win = NULL;
+}
+
diff --git a/src/main.c b/src/main.c
new file mode 100755
index 0000000..ee057f7
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "home/home_manager.h"
+
+int main(int argc, char *argv[])
+{
+ _I("Starting w-home");
+
+ ui_app_lifecycle_callback_s lifecycle_callback = {0, };
+ app_event_handler_h event_handlers[5] = {NULL, };
+
+ lifecycle_callback.create = home_create_cb;
+ lifecycle_callback.app_control = home_app_control_cb;
+ lifecycle_callback.resume = home_resume_cb;
+ lifecycle_callback.pause = home_pause_cb;
+ lifecycle_callback.terminate = home_terminate_cb;
+
+ ui_app_add_event_handler(&event_handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, NULL, NULL);
+ ui_app_add_event_handler(&event_handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, NULL, NULL);
+ ui_app_add_event_handler(&event_handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, NULL, NULL);
+ ui_app_add_event_handler(&event_handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, home_language_changed_cb, NULL);
+ ui_app_add_event_handler(&event_handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, NULL, NULL);
+
+ int ret = ui_app_main(argc, argv, &lifecycle_callback, NULL);
+ if (ret) {
+ _E("app_main() is failed. err = %d", ret);
+ }
+ return ret;
+}
diff --git a/src/moments/moment_manager.c b/src/moments/moment_manager.c
new file mode 100755
index 0000000..214929a
--- /dev/null
+++ b/src/moments/moment_manager.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "moment/moment.h"
+
+#include <app.h>
+
+static struct __moment_manager_s {
+ HOME_STATE *state;
+} s_info = {
+ .state = NULL,
+};
+
+static bool __moment_init(void);
+static void __moment_fini(void);
+static HOME_STATE *__moment_state_new(void);
+
+extern HOME_STATE *home_state_new(void);
+
+HOME_STATE *moment_new(void)
+{
+ __moment_init();
+
+ s_info.state = __moment_state_new();
+
+ return s_info.state;
+}
+
+static bool __moment_init(void)
+{
+ _D("%s", __func__);
+
+ return true;
+}
+
+static void __moment_fini(void)
+{
+
+}
+
+static HOME_STATE *__moment_state_new(void)
+{
+ HOME_STATE *state = home_state_new();
+ state->type = MOMENT;
+ state->destroy_cb = __moment_fini;
+
+ return state;
+}
diff --git a/src/notifications/noti_event_manager.c b/src/notifications/noti_event_manager.c
new file mode 100755
index 0000000..609d7b6
--- /dev/null
+++ b/src/notifications/noti_event_manager.c
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "common/callback_handler.h"
+#include "notifications/noti_event_manager.h"
+
+#include <stdlib.h>
+
+static struct __noti_event_s {
+ callback_h *changed_cb_handler;
+} s_info = {
+ .changed_cb_handler = NULL,
+};
+
+static void __notification_changed_cb(void *data, notification_type_e type, notification_op *operation_list, int operation_count);
+
+bool noti_event_manager_init(void)
+{
+ _D("%s", __func__);
+
+ int ret = NOTIFICATION_ERROR_NONE;
+
+ ret = notification_register_detailed_changed_cb(__notification_changed_cb, NULL);
+
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ _E("notification_register_detailed_changed_cb failed [%d]", ret);
+ return false;
+ }
+
+ return true;
+}
+
+void noti_event_manager_fini(void)
+{
+ callback_handler_free(s_info.changed_cb_handler);
+ s_info.changed_cb_handler = NULL;
+
+ int ret = NOTIFICATION_ERROR_NONE;
+ ret = notification_unregister_detailed_changed_cb(__notification_changed_cb, NULL);
+
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ _E("notification_unregister_detailed_changed_cb failed [%d]", ret);
+ }
+}
+
+void noti_event_manager_add_changed_cb(void(*cb)(void *noti_info))
+{
+ if (s_info.changed_cb_handler == NULL) {
+ s_info.changed_cb_handler = callback_handler_new("noti_manager");
+ }
+
+ callback_handler_add_cb(s_info.changed_cb_handler, cb);
+}
+
+void noti_event_manager_del_changed_cb(void(*cb)(void *noti_info))
+{
+ callback_handler_del_cb(s_info.changed_cb_handler, cb);
+}
+
+static void __notification_changed_cb(void *data, notification_type_e type, notification_op *operation_list, int operation_count)
+{
+ if (operation_list == NULL || operation_count < 1) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ int i = 0;
+ noti_message_t *info = (noti_message_t *)malloc(sizeof(noti_message_t));
+ if (info == NULL) {
+ _E("failed to malloc");
+ return ;
+ }
+
+ info->id = 0;
+ info->noti_handler = NULL;
+ info->operation_type = NOTIFICATION_OP_NONE;
+ for (i = 0; i < operation_count; i++) {
+ notification_op_get_data(operation_list + i, NOTIFICATION_OP_DATA_NOTI, &info->noti_handler);
+ notification_op_get_data(operation_list + i, NOTIFICATION_OP_DATA_PRIV_ID, &info->id);
+ notification_op_get_data(operation_list + i, NOTIFICATION_OP_DATA_TYPE, &info->operation_type);
+
+ _D("notification id [%d], operation type [%d]", info->id, info->operation_type);
+ callback_handler_execute_cb(s_info.changed_cb_handler, info);
+ }
+}
diff --git a/src/notifications/noti_full_popup.c b/src/notifications/noti_full_popup.c
new file mode 100755
index 0000000..526fb02
--- /dev/null
+++ b/src/notifications/noti_full_popup.c
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "notifications/noti_full_popup.h"
+
+void noti_full_popup_show(notification_h noti_handler)
+{
+
+}
diff --git a/src/notifications/noti_manager.c b/src/notifications/noti_manager.c
new file mode 100755
index 0000000..c7f9091
--- /dev/null
+++ b/src/notifications/noti_manager.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "home/home_state.h"
+#include "notifications/notifications.h"
+#include "notifications/noti_event_manager.h"
+#include "notifications/noti_popup_manager.h"
+#include "notifications/noti_view.h"
+
+static struct __noti_manager_s {
+ HOME_STATE *state;
+} s_info = {
+ .state = NULL,
+};
+
+static bool __noti_init(void);
+static void __noti_fini(void);
+static HOME_STATE *__noti_state_new(void);
+
+extern HOME_STATE *home_state_new(void);
+
+HOME_STATE *notifications_new()
+{
+ if (__noti_init() == false) {
+ goto __fail;
+ }
+
+ s_info.state = __noti_state_new();
+ if (s_info.state == NULL) {
+ goto __fail;
+ }
+
+ return s_info.state;
+
+__fail:
+ home_state_destroy(s_info.state);
+ __noti_fini();
+ return NULL;
+}
+
+static bool __noti_init(void)
+{
+ _D("%s", __func__);
+
+ if (noti_event_manager_init() == false) {
+ _E("failed to initialize notification event manager");
+ }
+
+ if (noti_popup_manager_init() == false) {
+ _E("failed to initialize notification popup manager");
+ }
+
+ if (noti_view_create_base_ui() == false) {
+ _E("failed to create notifications ui");
+ return false;
+ }
+
+ return true;
+}
+
+static void __noti_fini(void)
+{
+ s_info.state = NULL;
+ noti_view_destroy();
+
+ noti_popup_manager_fini();
+ noti_event_manager_fini();
+}
+
+static HOME_STATE *__noti_state_new(void)
+{
+ HOME_STATE *state = home_state_new();
+ state->type = NOTIFICATIONS;
+ state->destroy_cb = __noti_fini;
+
+ return state;
+}
diff --git a/src/notifications/noti_popup_manager.c b/src/notifications/noti_popup_manager.c
new file mode 100755
index 0000000..1ffa314
--- /dev/null
+++ b/src/notifications/noti_popup_manager.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "home/home_manager.h"
+#include "notifications/noti_info.h"
+#include "notifications/noti_event_manager.h"
+#include "notifications/noti_popup_manager.h"
+#include "notifications/noti_full_popup.h"
+#include "notifications/noti_small_popup.h"
+
+static void __show_popup(void *noti_info);
+
+bool noti_popup_manager_init(void)
+{
+ noti_event_manager_add_changed_cb(__show_popup);
+
+ return true;
+}
+
+void noti_popup_manager_fini(void)
+{
+ noti_event_manager_del_changed_cb(__show_popup);
+}
+
+static void __show_popup(void *noti_info)
+{
+ noti_message_t *info = (noti_message_t *)noti_info;
+ if (info->operation_type != NOTIFICATION_OP_INSERT) {
+ return ;
+ }
+
+ HOME_STATE *state = home_get_current_state();
+ if (state && state->type == CLOCK && state->is_visible_cb) {
+ noti_full_popup_show(info->noti_handler);
+ return ;
+ }
+
+ noti_small_popup_show(info->noti_handler);
+}
+
diff --git a/src/notifications/noti_small_popup.c b/src/notifications/noti_small_popup.c
new file mode 100755
index 0000000..4e778e2
--- /dev/null
+++ b/src/notifications/noti_small_popup.c
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "notifications/noti_full_popup.h"
+
+void noti_small_popup_show(notification_h noti_handler)
+{
+
+}
diff --git a/src/notifications/noti_view.c b/src/notifications/noti_view.c
new file mode 100755
index 0000000..11f892f
--- /dev/null
+++ b/src/notifications/noti_view.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "common/conf.h"
+#include "home/home_win.h"
+#include "notifications/noti_view.h"
+#include "notifications/noti_scroller.h"
+#include "notifications/noti_info.h"
+
+#include <stdlib.h>
+
+static struct __noti_veiw_s {
+ home_scroller_t *scroller;
+ Evas_Object *base_layout;
+} s_info = {
+ .scroller = NULL,
+ .base_layout = NULL,
+};
+
+static bool __create_base_ui(void);
+static void __destroy_base_ui(void);
+
+bool noti_view_create_base_ui(void)
+{
+ s_info.scroller = noti_scroller_get();
+
+ if (s_info.scroller == NULL) {
+ _E("failed to get scroller");
+ return false;
+ }
+
+ if (__create_base_ui() == false) {
+ _E("failed to create notifications ui");
+ return false;
+ }
+
+ return true;
+}
+
+void noti_view_destroy(void)
+{
+ __destroy_base_ui();
+}
+
+static bool __create_base_ui(void)
+{
+ s_info.base_layout = s_info.scroller->box;
+ noti_message_t *tmp_noti = noti_info_new(s_info.base_layout);
+
+ Evas_Object *tmp_object = elm_label_add(s_info.base_layout);
+ elm_object_text_set(tmp_object, "<align=center>NOTI</align>");
+ evas_object_size_hint_weight_set(tmp_object, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(tmp_object, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_min_set(tmp_object, WINDOW_W, WINDOW_H);
+ evas_object_resize(tmp_object, WINDOW_W, WINDOW_H);
+ evas_object_show(tmp_object);
+
+ noti_info_set_content(tmp_noti, tmp_object);
+ noti_scroller_push_noti(tmp_noti);
+
+ return true;
+
+__fail:
+ __destroy_base_ui();
+ return false;
+}
+
+static void __destroy_base_ui(void)
+{
+
+}
diff --git a/src/widgets/widgets_manager.c b/src/widgets/widgets_manager.c
new file mode 100755
index 0000000..f793a0d
--- /dev/null
+++ b/src/widgets/widgets_manager.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "widgets/widgets.h"
+#include "widgets/widgets_view.h"
+
+static struct __widgets_manager_s {
+ HOME_STATE *state;
+} s_info = {
+ .state = NULL,
+};
+
+static bool __widgets_init(void);
+static void __widgets_fini(void);
+static HOME_STATE *__widgets_state_new(void);
+
+extern HOME_STATE *home_state_new(void);
+
+HOME_STATE *widgets_new()
+{
+ if (__widgets_init() == false) {
+ _E("failed to create widget ui");
+ goto __fail;
+ }
+
+ s_info.state = __widgets_state_new();
+ if (s_info.state == NULL) {
+ goto __fail;
+ }
+
+ return s_info.state;
+
+__fail:
+ home_state_destroy(s_info.state);
+ __widgets_fini();
+ return false;
+}
+
+static bool __widgets_init(void)
+{
+ _D("%s", __func__);
+
+ if (widgets_view_create_base_ui() == false) {
+ _E("failed to create clock ui");
+ return false;
+ }
+
+ return true;
+}
+
+static void __widgets_fini(void)
+{
+ s_info.state = NULL;
+ widgets_view_destroy();
+}
+
+static HOME_STATE *__widgets_state_new(void)
+{
+ HOME_STATE *state = home_state_new();
+ state->type = WIDGETS;
+ state->destroy_cb = __widgets_fini;
+
+ return state;
+}
diff --git a/src/widgets/widgets_view.c b/src/widgets/widgets_view.c
new file mode 100755
index 0000000..b45ba33
--- /dev/null
+++ b/src/widgets/widgets_view.c
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2013 - 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/log.h"
+#include "common/conf.h"
+#include "widgets/widgets_view.h"
+#include "widgets/widgets_scroller.h"
+#include "widgets/widget_info.h"
+
+#include <stdlib.h>
+
+static struct __widgets_veiw_s {
+ home_scroller_t *scroller;
+ Evas_Object *base_layout;
+} s_info = {
+ .scroller = NULL,
+ .base_layout = NULL,
+};
+
+static bool __create_base_ui(void);
+static void __destroy_base_ui(void);
+
+bool widgets_view_create_base_ui(void)
+{
+ s_info.scroller = widgets_scroller_get();
+
+ if (s_info.scroller == NULL) {
+ _E("failed to get scroller");
+ return false;
+ }
+
+ if (__create_base_ui() == false) {
+ _E("failed to create widgets ui");
+ return false;
+ }
+
+ return true;
+}
+
+void widgets_view_destroy(void)
+{
+ __destroy_base_ui();
+}
+
+static bool __create_base_ui(void)
+{
+ s_info.base_layout = s_info.scroller->box;
+ widget_info_t *tmp_widget = widget_info_new(s_info.base_layout);
+
+ Evas_Object *tmp_object = elm_label_add(s_info.base_layout);
+ elm_object_text_set(tmp_object, "<align=center>WIDGETS</align>");
+ evas_object_size_hint_weight_set(tmp_object, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(tmp_object, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_min_set(tmp_object, WINDOW_W, WINDOW_H);
+ evas_object_resize(tmp_object, WINDOW_W, WINDOW_H);
+ evas_object_show(tmp_object);
+
+ widget_info_set_content(tmp_widget, tmp_object);
+ widgets_scroller_push_widget(tmp_widget);
+
+ return true;
+}
+
+static void __destroy_base_ui(void)
+{
+ widgets_scroller_pop_all();
+}