summaryrefslogtreecommitdiff
path: root/src/widgets/widgets_manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/widgets_manager.c')
-rwxr-xr-xsrc/widgets/widgets_manager.c78
1 files changed, 78 insertions, 0 deletions
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;
+}