summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdarsh Shree Ram <adarsh.ram@samsung.com>2016-09-20 20:36:58 +0530
committerAdarsh Shree Ram <adarsh.ram@samsung.com>2016-09-20 20:36:58 +0530
commit978d156b5758291186f49f5eeb4c0a0372e3ff0b (patch)
tree796e772db8538b494aabddb8b978ee95abfe1f29
parent7dc528175a1edff0bef9c6fa35c90381bd3ef016 (diff)
downloadalarm-978d156b5758291186f49f5eeb4c0a0372e3ff0b.tar.gz
alarm-978d156b5758291186f49f5eeb4c0a0372e3ff0b.tar.bz2
alarm-978d156b5758291186f49f5eeb4c0a0372e3ff0b.zip
Timepicker issue resolved.submit/tizen/20160920.152823
Change-Id: Ib30347a3581c73a3247214f17deb10eb24b19442
-rwxr-xr-xalarm_alert/inc/log.h146
-rwxr-xr-xalarm_alert/src/alarm_db.c63
-rwxr-xr-xalarm_alert/src/ring.c72
-rwxr-xr-xalarm_alert/src/sound.c28
-rwxr-xr-xinc/alarm.h2
-rwxr-xr-xinc/data.h2
-rwxr-xr-xinc/log.h146
-rwxr-xr-xinc/view.h13
-rwxr-xr-xsrc/alarm_engine.c166
-rwxr-xr-xsrc/data.c88
-rwxr-xr-xsrc/main.c297
-rwxr-xr-xsrc/view.c283
12 files changed, 871 insertions, 435 deletions
diff --git a/alarm_alert/inc/log.h b/alarm_alert/inc/log.h
new file mode 100755
index 0000000..894106b
--- /dev/null
+++ b/alarm_alert/inc/log.h
@@ -0,0 +1,146 @@
+/*
+ * Samsung API
+ * Copyright (c) 2013 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.
+ */
+
+#ifndef __SAMPLE_APP_LOG_H__
+#define __SAMPLE_APP_LOG_H__
+
+#include <unistd.h>
+#include <dlog.h>
+
+#define FONT_COLOR_RESET "\033[0m"
+#define FONT_COLOR_RED "\033[31m"
+#define FONT_COLOR_GREEN "\033[32m"
+#define FONT_COLOR_YELLOW "\033[33m"
+#define FONT_COLOR_BLUE "\033[34m"
+#define FONT_COLOR_PURPLE "\033[35m"
+#define FONT_COLOR_CYAN "\033[36m"
+#define FONT_COLOR_GRAY "\033[37m"
+
+#define WCOLOR_RED "\033[0;31m"
+#define WCOLOR_GREEN "\033[0;32m"
+#define WCOLOR_BROWN "\033[0;33m"
+#define WCOLOR_BLUE "\033[0;34m"
+#define WCOLOR_PURPLE "\033[0;35m"
+#define WCOLOR_CYAN "\033[0;36m"
+#define WCOLOR_LIGHTBLUE "\033[0;37m"
+#define WCOLOR_END "\033[0;m"
+#define MODULE_INFO (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
+
+#undef LOG_TAG
+#define LOG_TAG "alarm"
+
+#if !defined(_D)
+#define _D(fmt, arg...) dlog_print(DLOG_DEBUG, \
+ LOG_TAG, "%s: %s(%d) > " WCOLOR_GREEN fmt WCOLOR_END, MODULE_INFO, \
+ __func__, __LINE__, ##arg)
+#endif
+
+#if !defined(_W)
+#define _W(fmt, arg...) (dlog_print(DLOG_WARN, \
+ LOG_TAG, "%s: %s(%d) > " WCOLOR_GREEN fmt WCOLOR_END, MODULE_INFO, \
+ __func__, __LINE__, ##arg))
+#endif
+
+#if !defined(_E)
+#define _E(fmt,arg...) (dlog_print(DLOG_ERROR, \
+ LOG_TAG, "%s: %s(%d) > " WCOLOR_RED fmt WCOLOR_END, MODULE_INFO, \
+ __func__, __LINE__, ##arg))
+#endif
+
+#if !defined(ALM_INFO)
+#define ALM_INFO(fmt, arg...) (dlog_print(DLOG_DEBUG, \
+ LOG_TAG, "%s: %s(%d) > " WCOLOR_GREEN fmt WCOLOR_END, MODULE_INFO, \
+ __func__, __LINE__, ##arg))
+#endif
+
+#if !defined(ALM_SINFO)
+#define ALM_SINFO(fmt, arg...) (dlog_print(DLOG_DEBUG, \
+ LOG_TAG, "%s: %s(%d) > " WCOLOR_GREEN fmt WCOLOR_END, MODULE_INFO, \
+ __func__, __LINE__, ##arg))
+#endif
+
+#if !defined(ALM_ERR)
+#define ALM_ERR(fmt,arg...) (dlog_print(DLOG_ERROR, \
+ LOG_TAG, "%s: %s(%d) > " WCOLOR_RED fmt WCOLOR_END, MODULE_INFO, \
+ __func__, __LINE__, ##arg))
+#endif
+
+#if !defined(_ALM_ENTER_)
+#define _ALM_ENTER_ _D("%s - Entry", __func__)
+#endif
+
+#if !defined(DBG)
+#define DBG(fmt , args...) \
+ do { \
+ dlog_print(DLOG_DEBUG, \
+ LOG_TAG, "%s: %s(%d) > " WCOLOR_GREEN fmt WCOLOR_END, MODULE_INFO, \
+ __func__, __LINE__, ##arg)\
+ } while (0)
+#endif
+
+#define retvm_if(expr, val, fmt, arg...) do { \
+ if(expr) { \
+ _E(fmt, ##arg); \
+ _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return val; \
+ } \
+} while (0)
+
+#define retv_if(expr, val) do { \
+ if(expr) { \
+ _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return (val); \
+ } \
+} while (0)
+
+#define retm_if(expr, fmt, arg...) do { \
+ if(expr) { \
+ _E(fmt, ##arg); \
+ _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return; \
+ } \
+} while (0)
+
+#define ret_if(expr) do { \
+ if(expr) { \
+ _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return; \
+ } \
+} while (0)
+
+#define goto_if(expr, val) do { \
+ if(expr) { \
+ _E("(%s) -> goto", #expr); \
+ goto val; \
+ } \
+} while (0)
+
+#define break_if(expr) { \
+ if(expr) { \
+ _E("(%s) -> break", #expr); \
+ break; \
+ } \
+}
+
+#define continue_if(expr) { \
+ if(expr) { \
+ _E("(%s) -> continue", #expr); \
+ continue; \
+ } \
+}
+
+#endif /* __SAMPLE_APP_LOG_H__ */
diff --git a/alarm_alert/src/alarm_db.c b/alarm_alert/src/alarm_db.c
index 948b07a..5106acf 100755
--- a/alarm_alert/src/alarm_db.c
+++ b/alarm_alert/src/alarm_db.c
@@ -16,6 +16,7 @@
#include <app_alarm.h>
#include <sqlite3.h>
+#include "log.h"
#include "ring.h"
#include "alarm_db.h"
#include "defines.h"
@@ -28,21 +29,21 @@ sqlite3 *sampleDb;
int open_db()
{
- dlog_print(DLOG_INFO, LOG_TAG, "open_db");
+ _ALM_ENTER_;
char * dataPath = app_get_data_path(); /*fetched package path available physically in the device*/
- dlog_print(DLOG_INFO, LOG_TAG, "datapath is %s", dataPath);
+ ALM_INFO("datapath is %s", dataPath);
int size = 1024;
char * path = malloc(sizeof(char)*size);
strncpy(path, dataPath, BUFLEN);
strncat(path, DB_NAME, size);
- dlog_print(DLOG_INFO, LOG_TAG, "path is %s", path);
+ ALM_INFO("path is %s", path);
int ret = sqlite3_open_v2(path , &sampleDb, SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE, NULL);
if (ret != SQLITE_OK)
- dlog_print(DLOG_ERROR, LOG_TAG, "db could not open %s ", sqlite3_errmsg(sampleDb));
+ ALM_ERR("db could not open %s ", sqlite3_errmsg(sampleDb));
else
- dlog_print(DLOG_INFO, LOG_TAG, "database made ");
+ ALM_INFO("database made ");
free(dataPath);
free(path);
@@ -53,12 +54,12 @@ int open_db()
int close_db()
{
- dlog_print(DLOG_INFO, LOG_TAG, "close_db");
+ ALM_INFO("close_db");
return sqlite3_close(sampleDb);
}
static int read_alarm_details_cb(void *data, int argc, char **argv, char **azColName)
{
- dlog_print(DLOG_INFO, LOG_TAG, "readAlarmDetailsCb Columns number %d ", argc);
+ ALM_INFO("readAlarmDetailsCb Columns number %d ", argc);
int ret = -1;
alarm_details* details = (alarm_details*)data;
if(!details)
@@ -71,18 +72,18 @@ static int read_alarm_details_cb(void *data, int argc, char **argv, char **azCol
details->snz_hour = atoi(argv[5]);
details->snz_min = atoi(argv[6]);
- dlog_print(DLOG_INFO, LOG_TAG, "Stored value alarm_id %d", details->alarm_id);
- dlog_print(DLOG_INFO, LOG_TAG, "Stored value hour %d", details->hour);
- dlog_print(DLOG_INFO, LOG_TAG, "Stored value min %d",details->min);
- dlog_print(DLOG_INFO, LOG_TAG, "Stored value snz_cnt %d",details->snz_cnt);
- dlog_print(DLOG_INFO, LOG_TAG, "Stored value snz_hour %d",details->snz_hour);
- dlog_print(DLOG_INFO, LOG_TAG, "Stored value snz_min %d",details->snz_min);
+ ALM_INFO("Stored value alarm_id %d", details->alarm_id);
+ ALM_INFO("Stored value hour %d", details->hour);
+ ALM_INFO("Stored value min %d",details->min);
+ ALM_INFO("Stored value snz_cnt %d",details->snz_cnt);
+ ALM_INFO("Stored value snz_hour %d",details->snz_hour);
+ ALM_INFO("Stored value snz_min %d",details->snz_min);
return 0;
}
int read_alarm_details(int dbid, alarm_details** details)
{
- dlog_print(DLOG_INFO, LOG_TAG, "readAlarmDetails");
+ ALM_INFO("readAlarmDetails");
int ret = -1;
if(!dbid)
return ret;
@@ -92,21 +93,21 @@ int read_alarm_details(int dbid, alarm_details** details)
ret = open_db();
if (ret != SQLITE_OK)
{
- dlog_print(DLOG_INFO, LOG_TAG, "ERORR 1");
+ ALM_INFO("ERORR 1");
return ret;
}/*create database instance*/
char sql[BUFLEN];
char *ErrMsg;
snprintf(sql, BUFLEN, "SELECT DB_ID, ALARM_ID, HOUR, MINS, SNZ_CNT,NXT_SNZ_TIME_HOUR,NXT_SNZ_TIME_MIN FROM ALARM_TABLE WHERE DB_ID = %d;",dbid);
- dlog_print(DLOG_INFO, LOG_TAG, "sql query %s", sql);
+ ALM_INFO("sql query %s", sql);
ret = sqlite3_exec(sampleDb, sql, read_alarm_details_cb, alm_details, &ErrMsg); /*execute query*/
if (ret != SQLITE_OK) {
- dlog_print(DLOG_ERROR, LOG_TAG, "reading db Error! [%s]", sqlite3_errmsg(sampleDb));
+ ALM_ERR("reading db Error! [%s]", sqlite3_errmsg(sampleDb));
sqlite3_free(ErrMsg);
close_db(); /*close db instance for failed case*/
return ret;
} else
- dlog_print(DLOG_INFO, LOG_TAG, "reading done");
+ ALM_INFO("reading done");
close_db();
*details = alm_details;
@@ -115,7 +116,7 @@ int read_alarm_details(int dbid, alarm_details** details)
int update_alarm_off(alarm_details* details)
{
- dlog_print(DLOG_INFO, LOG_TAG, "updateAlarmOff");
+ ALM_INFO("updateAlarmOff");
int ret = -1;
if(!details)
return ret;
@@ -125,26 +126,26 @@ int update_alarm_off(alarm_details* details)
ret = open_db();
if (ret != SQLITE_OK)
{
- dlog_print(DLOG_INFO, LOG_TAG, "ERORR 1");
+ ALM_INFO("ERORR 1");
return ret;
}/*create database instance*/
snprintf(sql, BUFLEN, "UPDATE ALARM_TABLE SET ALARM_ON = 0, SNZ_CNT = 0, NXT_SNZ_TIME_HOUR = 0, NXT_SNZ_TIME_MIN = 0 WHERE DB_ID = %d AND WEEKLY = 0;",details->id);
- dlog_print(DLOG_INFO, LOG_TAG, "sql updated query %s", sql);
+ ALM_INFO("sql updated query %s", sql);
ret = sqlite3_exec(sampleDb, sql, NULL,0 , &ErrMsg); /*execute query*/
if (ret != SQLITE_OK) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Update Error! [%s]", sqlite3_errmsg(sampleDb));
+ ALM_ERR("Update Error! [%s]", sqlite3_errmsg(sampleDb));
sqlite3_free(ErrMsg);
close_db(); /*close db instance for failed case*/
return ret;
} else
- dlog_print(DLOG_INFO, LOG_TAG, "update db with off");
+ ALM_INFO("update db with off");
close_db();
return 0;
}
int snooze_alarm(alarm_details* details)
{
- dlog_print(DLOG_INFO, LOG_TAG, "snoozeAlarm");
+ ALM_INFO("snoozeAlarm");
int ret = -1;
if(!details)
return ret;
@@ -165,7 +166,7 @@ int snooze_alarm(alarm_details* details)
app_control_h app_control;
if(app_control_create(&app_control)!= APP_CONTROL_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Cannot create app control");
+ ALM_ERR("Cannot create app control");
return ret;
}
app_control_set_operation(app_control, APP_CONTROL_OPERATION_ALARM_ONTIME);
@@ -175,29 +176,29 @@ int snooze_alarm(alarm_details* details)
app_control_add_extra_data(app_control, APP_CONTROL_ALARM_DB_ID, strdbid);
app_control_set_launch_mode(app_control, APP_CONTROL_LAUNCH_MODE_GROUP);
ret = alarm_schedule_once_at_date(app_control, snz_time, &alarm_id);
- dlog_print(DLOG_INFO, LOG_TAG, "new alarm id:%d",alarm_id);
+ ALM_INFO("new alarm id:%d",alarm_id);
if (ret != ALARM_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "ALARM ERROR %d , error:%s", ret, get_error_message(ret));
+ ALM_ERR("ALARM ERROR %d , error:%s", ret, get_error_message(ret));
return ret;
}
ret = open_db();
if (ret != SQLITE_OK)
{
- dlog_print(DLOG_INFO, LOG_TAG, "ERORR 1");
+ ALM_INFO("ERORR 1");
return ret;
}/*create database instance*/
details->snz_hour = snz_time->tm_hour;
details->snz_min = snz_time->tm_min;
snprintf(sql, BUFLEN, "UPDATE ALARM_TABLE SET SNZ_CNT = %d, NXT_SNZ_TIME_HOUR = %d, NXT_SNZ_TIME_MIN = %d WHERE DB_ID = %d", details->snz_cnt+1, details->snz_hour, details->snz_min, details->id);
- dlog_print(DLOG_INFO, LOG_TAG, "sql updated query %s", sql);
+ ALM_INFO("sql updated query %s", sql);
ret = sqlite3_exec(sampleDb, sql, NULL,0 , &ErrMsg); /*execute query*/
if (ret != SQLITE_OK) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Update Error! [%s]", sqlite3_errmsg(sampleDb));
+ ALM_ERR("Update Error! [%s]", sqlite3_errmsg(sampleDb));
sqlite3_free(ErrMsg);
close_db(); /*close db instance for failed case*/
return ret;
} else
- dlog_print(DLOG_INFO, LOG_TAG, "snooze update success");
+ ALM_INFO("snooze update success");
close_db();
return 0;
}
diff --git a/alarm_alert/src/ring.c b/alarm_alert/src/ring.c
index 314bfbb..3696604 100755
--- a/alarm_alert/src/ring.c
+++ b/alarm_alert/src/ring.c
@@ -18,7 +18,7 @@
#include "sound.h"
#include "app_alarm.h"
#include "alarm_db.h"
-
+#include "log.h"
typedef struct appdata{
Evas_Object* win;
@@ -42,13 +42,13 @@ bool ignore_multiple_calls = false;
void dismiss_or_snooze()
{
- dlog_print(DLOG_INFO, LOG_TAG, "dismiss_or_snooze");
+ ALM_INFO("dismiss_or_snooze");
if(ignore_multiple_calls) {
- dlog_print(DLOG_INFO, LOG_TAG, "ignore multiple calls");
+ ALM_INFO("ignore multiple calls");
return;
}
if(!alm_details) {
- dlog_print(DLOG_INFO, LOG_TAG, "alm_details are not fetched");
+ ALM_INFO("alm_details are not fetched");
return;
}
ignore_multiple_calls = true;
@@ -133,7 +133,7 @@ create_base_gui(appdata_s *ad)
}
static void _ring_main_snooze_cb(void *data, Evas_Object *obj, const char *emission, const char *source){
- dlog_print(DLOG_INFO, LOG_TAG, "_ring_main_snooze_cb");
+ ALM_INFO("_ring_main_snooze_cb");
ignore_multiple_calls = true;
ring_stop_player();
elm_naviframe_item_pop((Evas_Object*)data);
@@ -144,7 +144,7 @@ static void _ring_main_snooze_cb(void *data, Evas_Object *obj, const char *emiss
}
static void _ring_main_dismiss_cb(void *data, Evas_Object *obj, const char *emission, const char *source){
- dlog_print(DLOG_INFO, LOG_TAG, "_ring_main_dismiss_cb");
+ ALM_INFO("_ring_main_dismiss_cb");
ignore_multiple_calls = true;
ring_stop_player();
elm_naviframe_item_pop((Evas_Object*)data);
@@ -158,7 +158,7 @@ static void _ring_main_dismiss_cb(void *data, Evas_Object *obj, const char *emis
static void _ring_main_dismiss_timer_cb(void *data, Evas_Object *obj, const char *emission, const char *source){
- dlog_print(DLOG_INFO, LOG_TAG, "_ring_main_dismiss_cb");
+ ALM_INFO("_ring_main_dismiss_cb");
ring_stop_player();
elm_naviframe_item_pop((Evas_Object*)data);
delay_count = 0;
@@ -170,33 +170,33 @@ static void _ring_main_dismiss_timer_cb(void *data, Evas_Object *obj, const char
Evas_Object *view_create_layout(Evas_Object *parent, const char *file_path, const char *group_name, Eext_Event_Cb cb_function, void *user_data)
{
- dlog_print(DLOG_INFO, LOG_TAG, "view_create_layout >>");
+ ALM_INFO("view_create_layout >>");
Evas_Object *layout = NULL;
if (parent == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
+ ALM_ERR("parent is NULL.");
return NULL;
}
- dlog_print(DLOG_INFO, LOG_TAG, "view_create_layout 0");
+ ALM_INFO("view_create_layout 0");
layout = elm_layout_add(parent);
- dlog_print(DLOG_INFO, LOG_TAG, "view_create_layout file_path:%s, group_name:%s", file_path, group_name);
+ ALM_INFO("view_create_layout file_path:%s, group_name:%s", file_path, group_name);
int ret = elm_layout_file_set(layout, file_path, group_name);
- dlog_print(DLOG_INFO, LOG_TAG, "view_create_layout ret : %d",ret);
+ ALM_INFO("view_create_layout ret : %d",ret);
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- dlog_print(DLOG_INFO, LOG_TAG, "view_create_layout 2");
+ ALM_INFO("view_create_layout 2");
if (cb_function)
eext_object_event_callback_add(layout, EEXT_CALLBACK_BACK, cb_function, user_data);
- dlog_print(DLOG_INFO, LOG_TAG, "view_create_layout 3");
+ ALM_INFO("view_create_layout 3");
evas_object_show(layout);
- dlog_print(DLOG_INFO, LOG_TAG, "view_create_layout <<");
+ ALM_INFO("view_create_layout <<");
return layout;
}
void view_set_text(Evas_Object *parent, const char *part_name, const char *text)
{
- dlog_print(DLOG_ERROR, LOG_TAG, "view_set_text");
+ ALM_ERR("view_set_text");
if (parent == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
+ ALM_ERR("parent is NULL.");
return;
}
@@ -209,12 +209,12 @@ Elm_Object_Item* view_push_item_to_naviframe(Evas_Object *nf, Evas_Object *item,
Elm_Object_Item* nf_it = NULL;
if (nf == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "naviframe is NULL.");
+ ALM_ERR("naviframe is NULL.");
return NULL;
}
if (item == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "item is NULL.");
+ ALM_ERR("item is NULL.");
return NULL;
}
@@ -235,12 +235,12 @@ static Eina_Bool _update_ring_view_by_timer_cb(void *data)
void ring_view_add_by_timer(Evas_Object *parent)
{
- dlog_print(DLOG_INFO, LOG_TAG, "_create_layout_ring_alarm >>");
+ ALM_INFO("_create_layout_ring_alarm >>");
Evas_Object *ly_main = NULL;
char file_path[BUF_LEN] = {0, };
if (parent == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to get parent.");
+ ALM_ERR("failed to get parent.");
return;
}
@@ -248,10 +248,10 @@ void ring_view_add_by_timer(Evas_Object *parent)
* Create a layout that shows when the alarm sounds.
*/
data_get_resource_path("edje/ring.edj", file_path, sizeof(file_path));
- dlog_print(DLOG_ERROR, LOG_TAG, "file_path:%s", file_path);
+ ALM_ERR("file_path:%s", file_path);
ly_main = view_create_layout(parent, file_path, "timer", NULL, NULL);
if (ly_main == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a layout.");
+ ALM_ERR("failed to create a layout.");
return;
}
@@ -281,7 +281,7 @@ void ring_view_add_by_timer(Evas_Object *parent)
Eina_Bool item_pop_cb(void *data, Elm_Object_Item *it)
{
- dlog_print(DLOG_INFO, LOG_TAG, "item_pop_cb");
+ ALM_INFO("item_pop_cb");
dismiss_or_snooze();
//elm_naviframe_item_pop((Evas_Object*)data);
return EINA_TRUE;
@@ -289,7 +289,7 @@ Eina_Bool item_pop_cb(void *data, Elm_Object_Item *it)
static void _create_layout_ring_alarm(Evas_Object *parent)
{
- dlog_print(DLOG_INFO, LOG_TAG, "_create_layout_ring_alarm >>");
+ ALM_INFO("_create_layout_ring_alarm >>");
Evas_Object *layout = NULL;
char buf[BUF_LEN] = {0, };
char buf1[BUF_LEN] = {0, };
@@ -297,7 +297,7 @@ static void _create_layout_ring_alarm(Evas_Object *parent)
char tbuf[256] = { 0 };
if (parent == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to get parent.");
+ ALM_ERR("failed to get parent.");
return;
}
@@ -305,14 +305,14 @@ static void _create_layout_ring_alarm(Evas_Object *parent)
* Create a layout that shows when the alarm sounds.
*/
data_get_resource_path("edje/ring.edj", file_path, sizeof(file_path));
- dlog_print(DLOG_ERROR, LOG_TAG, "file_path:%s", file_path);
+ ALM_ERR("file_path:%s", file_path);
if(alm_details->snz_cnt >= 2) {
layout = view_create_layout(parent, file_path, "timer", NULL, NULL);
} else {
layout = view_create_layout(parent, file_path, "alarm,ring", NULL, NULL);
}
if (layout == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a layout.");
+ ALM_ERR("failed to create a layout.");
return;
}
@@ -320,7 +320,7 @@ static void _create_layout_ring_alarm(Evas_Object *parent)
struct tm saved_time;
localtime_r(&cur_time, &saved_time);
- dlog_print(DLOG_ERROR, LOG_TAG, "if true");
+ ALM_ERR("if true");
strftime(buf, sizeof(buf) - 1, "%l:%M %p", &saved_time);
snprintf(tbuf, sizeof(tbuf),
"<+ font=Tizen style=Roman font_size=%d align=center color=#FFFFFF>%s</>",
@@ -333,7 +333,7 @@ static void _create_layout_ring_alarm(Evas_Object *parent)
elm_object_text_set(time_label, tbuf);
}
if(alm_details->snz_cnt > 0 && alm_details->snz_cnt < 3) {
- dlog_print(DLOG_ERROR, LOG_TAG, "if true");
+ ALM_ERR("if true");
saved_time.tm_hour = alm_details->hour;
saved_time.tm_min = alm_details->min;
strftime(buf1, sizeof(buf1) - 1, "%l:%M %p", &saved_time);
@@ -379,18 +379,18 @@ static void
app_control(app_control_h app_control, void *data)
{
/* Handle the launch request. */
- dlog_print(DLOG_INFO, LOG_TAG, "app_control >>");
+ ALM_INFO("app_control >>");
appdata_s *ad = (appdata_s*)data;
int id = 0;
int ret = app_control_get_extra_data(app_control, APP_CONTROL_ALARM_DB_ID, &tid);
- dlog_print(DLOG_INFO, LOG_TAG, "app_control ret : %d",ret);
+ ALM_INFO("app_control ret : %d",ret);
if(!tid) {
- dlog_print(DLOG_INFO, LOG_TAG, "alarm id null");
+ ALM_INFO("alarm id null");
return;
}
id = atoi(tid);
- dlog_print(DLOG_INFO, LOG_TAG, "alarm id tid:%s, id:%d",tid,id);
+ ALM_INFO("alarm id tid:%s, id:%d",tid,id);
//Fetch alarm time, snz count, snztime from db using alarm id
read_alarm_details(id,&alm_details);
@@ -433,7 +433,7 @@ ui_app_lang_changed(app_event_info_h event_info, void *user_data)
ret = app_event_get_language(event_info, &language);
if (ret != APP_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "app_event_get_language() failed. Err = %d.", ret);
+ ALM_ERR("app_event_get_language() failed. Err = %d.", ret);
return;
}
@@ -491,7 +491,7 @@ main(int argc, char *argv[])
ret = ui_app_main(argc, argv, &event_callback, &ad);
if (ret != APP_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_main() is failed. err = %d", ret);
+ ALM_ERR("ui_app_main() is failed. err = %d", ret);
}
return ret;
diff --git a/alarm_alert/src/sound.c b/alarm_alert/src/sound.c
index 8471cc9..3dca166 100755
--- a/alarm_alert/src/sound.c
+++ b/alarm_alert/src/sound.c
@@ -24,10 +24,10 @@
#include <widget_service.h>
#include <widget_errno.h>
#include "sound.h"
-
+#include "log.h"
static void _ring_player_error_cb(int error_code, void *data)
{
- dlog_print(DLOG_ERROR, LOG_TAG, "player error Code: %x",error_code);
+ ALM_ERR("player error Code: %x",error_code);
}
static Eina_Bool _ring_player_start_cb(void *data)
@@ -40,10 +40,10 @@ static Eina_Bool _ring_player_start_cb(void *data)
if (play_state == PLAYER_STATE_PAUSED || play_state == PLAYER_STATE_READY) {
ret = player_start(*mm_player);
if (ret != PLAYER_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "player error Code: %x",ret);
+ ALM_ERR("player error Code: %x",ret);
}
} else {
- dlog_print(DLOG_ERROR, LOG_TAG, "Player state = %d. Do not start player", play_state);
+ ALM_ERR("Player state = %d. Do not start player", play_state);
}
player_start_timer = NULL;
return ECORE_CALLBACK_CANCEL;
@@ -52,7 +52,7 @@ static Eina_Bool _ring_player_start_cb(void *data)
void ring_stop_player(void)
{
if (mm_player == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "mm_player = NULL. Returnr");
+ ALM_ERR("mm_player = NULL. Returnr");
return;
}
@@ -62,7 +62,7 @@ void ring_stop_player(void)
ret = player_unprepare(*(mm_player));
player_state_e play_state;
player_get_state(*(mm_player), &play_state);
- dlog_print(DLOG_INFO, LOG_TAG, "After unprepare play_state: %d", play_state);
+ ALM_INFO("After unprepare play_state: %d", play_state);
if (mm_player) {
player_destroy(*(mm_player));
@@ -72,7 +72,7 @@ void ring_stop_player(void)
void ring_create_player(void)
{
- dlog_print(DLOG_INFO, LOG_TAG, "player create");
+ ALM_INFO("player create");
int ret = SUCCESS;
/* Player create */
@@ -81,14 +81,14 @@ void ring_create_player(void)
player_h *player = (player_h *)calloc(1, sizeof(player_h));
ret = player_create(player);
if (PLAYER_ERROR_NONE != ret) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Create player failed Error ID: %x",ret);
+ ALM_ERR("Create player failed Error ID: %x",ret);
FREEIF(player);
return;
}
if(player_set_looping(*player, true) != PLAYER_ERROR_NONE)
{
- dlog_print(DLOG_ERROR, LOG_TAG, "looping player failed Error ID: %x",ret);
+ ALM_ERR("looping player failed Error ID: %x",ret);
FREEIF(player);
return;
}
@@ -101,7 +101,7 @@ void ring_create_player(void)
if (play_state == PLAYER_STATE_IDLE) {
ret = player_set_uri(*(mm_player), RING_DEFALT_TONE);
if (PLAYER_ERROR_NONE != ret) {
- dlog_print(DLOG_ERROR, LOG_TAG, "player_set_uri Error ID: %x",ret);
+ ALM_ERR("player_set_uri Error ID: %x",ret);
player_destroy(*(mm_player));
FREEIF(mm_player);
return;
@@ -111,7 +111,7 @@ void ring_create_player(void)
/* Player set sound type */
ret = player_set_sound_type(*(mm_player), SOUND_TYPE_ALARM);
if (PLAYER_ERROR_NONE != ret) {
- dlog_print(DLOG_ERROR, LOG_TAG, "player_set_sound_type Error ID: %x",ret);
+ ALM_ERR("player_set_sound_type Error ID: %x",ret);
player_destroy(*(mm_player));
FREEIF(mm_player);
return;
@@ -126,15 +126,15 @@ void ring_create_player(void)
// ret = player_prepare_async(*(mm_player), _ring_player_prepare_cb, NULL);
ret = player_prepare(*(mm_player));
if (PLAYER_ERROR_NONE != ret) {
- dlog_print(DLOG_ERROR, LOG_TAG, "player_prepare Error ID: %x",ret);
+ ALM_ERR("player_prepare Error ID: %x",ret);
player_destroy(*(mm_player));
FREEIF(mm_player);
return;
}
if (mm_player != NULL) {
- dlog_print(DLOG_INFO, LOG_TAG, "player ring_paused = %d", ring_paused);
+ ALM_INFO("player ring_paused = %d", ring_paused);
if(ring_paused) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Player is not started because app already pause state");
+ ALM_ERR("Player is not started because app already pause state");
return;
}
/* Add timer for player context separate */
diff --git a/inc/alarm.h b/inc/alarm.h
index 7b56509..f72c962 100755
--- a/inc/alarm.h
+++ b/inc/alarm.h
@@ -57,7 +57,7 @@ typedef enum {
NORMAL_MODE ,
EDIT_MODE,
} mode_type;
-void update_genlist(int last_alarm_id,int edit_mode,int type);
+void update_genlist(int last_alarm_id, int edit_mode, int type);
void update_genlist_first();
void populate_genlist();
void end_genlist();
diff --git a/inc/data.h b/inc/data.h
index 37e386d..a8b8a9e 100755
--- a/inc/data.h
+++ b/inc/data.h
@@ -66,5 +66,5 @@ void data_alarm_destroy_genlist_item_data(struct genlist_item_data *gendata);
char *data_get_popup_text(struct tm *saved_time);
char *data_get_popup_text_new(int diffinsec);
-int find_diff(struct tm *current_time,struct tm *saved_time);
+int find_diff(struct tm *current_time, struct tm *saved_time);
#endif
diff --git a/inc/log.h b/inc/log.h
new file mode 100755
index 0000000..894106b
--- /dev/null
+++ b/inc/log.h
@@ -0,0 +1,146 @@
+/*
+ * Samsung API
+ * Copyright (c) 2013 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.
+ */
+
+#ifndef __SAMPLE_APP_LOG_H__
+#define __SAMPLE_APP_LOG_H__
+
+#include <unistd.h>
+#include <dlog.h>
+
+#define FONT_COLOR_RESET "\033[0m"
+#define FONT_COLOR_RED "\033[31m"
+#define FONT_COLOR_GREEN "\033[32m"
+#define FONT_COLOR_YELLOW "\033[33m"
+#define FONT_COLOR_BLUE "\033[34m"
+#define FONT_COLOR_PURPLE "\033[35m"
+#define FONT_COLOR_CYAN "\033[36m"
+#define FONT_COLOR_GRAY "\033[37m"
+
+#define WCOLOR_RED "\033[0;31m"
+#define WCOLOR_GREEN "\033[0;32m"
+#define WCOLOR_BROWN "\033[0;33m"
+#define WCOLOR_BLUE "\033[0;34m"
+#define WCOLOR_PURPLE "\033[0;35m"
+#define WCOLOR_CYAN "\033[0;36m"
+#define WCOLOR_LIGHTBLUE "\033[0;37m"
+#define WCOLOR_END "\033[0;m"
+#define MODULE_INFO (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
+
+#undef LOG_TAG
+#define LOG_TAG "alarm"
+
+#if !defined(_D)
+#define _D(fmt, arg...) dlog_print(DLOG_DEBUG, \
+ LOG_TAG, "%s: %s(%d) > " WCOLOR_GREEN fmt WCOLOR_END, MODULE_INFO, \
+ __func__, __LINE__, ##arg)
+#endif
+
+#if !defined(_W)
+#define _W(fmt, arg...) (dlog_print(DLOG_WARN, \
+ LOG_TAG, "%s: %s(%d) > " WCOLOR_GREEN fmt WCOLOR_END, MODULE_INFO, \
+ __func__, __LINE__, ##arg))
+#endif
+
+#if !defined(_E)
+#define _E(fmt,arg...) (dlog_print(DLOG_ERROR, \
+ LOG_TAG, "%s: %s(%d) > " WCOLOR_RED fmt WCOLOR_END, MODULE_INFO, \
+ __func__, __LINE__, ##arg))
+#endif
+
+#if !defined(ALM_INFO)
+#define ALM_INFO(fmt, arg...) (dlog_print(DLOG_DEBUG, \
+ LOG_TAG, "%s: %s(%d) > " WCOLOR_GREEN fmt WCOLOR_END, MODULE_INFO, \
+ __func__, __LINE__, ##arg))
+#endif
+
+#if !defined(ALM_SINFO)
+#define ALM_SINFO(fmt, arg...) (dlog_print(DLOG_DEBUG, \
+ LOG_TAG, "%s: %s(%d) > " WCOLOR_GREEN fmt WCOLOR_END, MODULE_INFO, \
+ __func__, __LINE__, ##arg))
+#endif
+
+#if !defined(ALM_ERR)
+#define ALM_ERR(fmt,arg...) (dlog_print(DLOG_ERROR, \
+ LOG_TAG, "%s: %s(%d) > " WCOLOR_RED fmt WCOLOR_END, MODULE_INFO, \
+ __func__, __LINE__, ##arg))
+#endif
+
+#if !defined(_ALM_ENTER_)
+#define _ALM_ENTER_ _D("%s - Entry", __func__)
+#endif
+
+#if !defined(DBG)
+#define DBG(fmt , args...) \
+ do { \
+ dlog_print(DLOG_DEBUG, \
+ LOG_TAG, "%s: %s(%d) > " WCOLOR_GREEN fmt WCOLOR_END, MODULE_INFO, \
+ __func__, __LINE__, ##arg)\
+ } while (0)
+#endif
+
+#define retvm_if(expr, val, fmt, arg...) do { \
+ if(expr) { \
+ _E(fmt, ##arg); \
+ _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return val; \
+ } \
+} while (0)
+
+#define retv_if(expr, val) do { \
+ if(expr) { \
+ _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return (val); \
+ } \
+} while (0)
+
+#define retm_if(expr, fmt, arg...) do { \
+ if(expr) { \
+ _E(fmt, ##arg); \
+ _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return; \
+ } \
+} while (0)
+
+#define ret_if(expr) do { \
+ if(expr) { \
+ _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return; \
+ } \
+} while (0)
+
+#define goto_if(expr, val) do { \
+ if(expr) { \
+ _E("(%s) -> goto", #expr); \
+ goto val; \
+ } \
+} while (0)
+
+#define break_if(expr) { \
+ if(expr) { \
+ _E("(%s) -> break", #expr); \
+ break; \
+ } \
+}
+
+#define continue_if(expr) { \
+ if(expr) { \
+ _E("(%s) -> continue", #expr); \
+ continue; \
+ } \
+}
+
+#endif /* __SAMPLE_APP_LOG_H__ */
diff --git a/inc/view.h b/inc/view.h
index 2d39386..523615a 100755
--- a/inc/view.h
+++ b/inc/view.h
@@ -34,18 +34,19 @@ Evas_Object *view_get_conformant(void);
void view_free_s_info();
void view_create(void);
void view_alarm_create(void);
- char* _gl_text_get(void *data, Evas_Object *obj, const char *part);
- Evas_Object* _gl_alarm_set_icon_get(void *data, Evas_Object *obj, const char *part);
- void _gl_del(void *data, Evas_Object *obj);
+char* _gl_text_get(void *data, Evas_Object *obj, const char *part);
+Evas_Object* _gl_alarm_set_icon_get(void *data, Evas_Object *obj, const char *part);
+void _gl_del(void *data, Evas_Object *obj);
+Evas_Object *view_get_timepicker(void);
Evas_Object *view_create_win(const char *pkg_name);
Evas_Object *view_create_conformant_without_indicator(Evas_Object *win);
Evas_Object *view_create_layout(Evas_Object *parent, const char *file_path, const char *group_name, Eext_Event_Cb cb_function, void *user_data);
Evas_Object *view_create_layout_by_theme(Evas_Object *parent, const char *classname, const char *group, const char *style);
Evas_Object *view_create_datetime(Evas_Object *parent, const char *style ,Eext_Circle_Surface *local_circle_surface);
struct tm *view_get_datetime();
- Eina_Bool view_get_is_select_mode(void);
- void view_set_is_select_mode( Eina_Bool is_edit_mode);
- void go_to_normal();
+Eina_Bool view_get_is_select_mode(void);
+void view_set_is_select_mode( Eina_Bool is_edit_mode);
+void go_to_normal();
void view_destroy(void);
void view_alarm_destroy(void);
diff --git a/src/alarm_engine.c b/src/alarm_engine.c
index d0cec92..598935b 100755
--- a/src/alarm_engine.c
+++ b/src/alarm_engine.c
@@ -21,6 +21,7 @@
#include <app.h>
#include <app_alarm.h>
#include <sqlite3.h>
+#include "log.h"
#include "alarm.h"
#include "data.h"
#include "view.h"
@@ -35,21 +36,21 @@ int alarm_count = 0;
int temp_alarm_id = 0;
int open_db()
{
- dlog_print(DLOG_INFO, LOG_TAG, "in init_open_db");
+ _ALM_ENTER_;
char * dataPath = app_get_data_path(); /*fetched package path available physically in the device*/
- dlog_print(DLOG_INFO, LOG_TAG, "datapath is %s", dataPath);
+ ALM_INFO("datapath is %s", dataPath);
int size = 1024;
char * path = malloc(sizeof(char)*size);
strncpy(path, dataPath, BUFLEN);
strncat(path, DB_NAME, size);
- dlog_print(DLOG_INFO, LOG_TAG, "path is %s", path);
+ ALM_INFO("path is %s", path);
int ret = sqlite3_open_v2(path , &sampleDb, SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE, NULL);
if (ret != SQLITE_OK)
- dlog_print(DLOG_ERROR, LOG_TAG, "db could not open %s ", sqlite3_errmsg(sampleDb));
+ ALM_ERR("db could not open %s ", sqlite3_errmsg(sampleDb));
else
- dlog_print(DLOG_INFO, LOG_TAG, "database made ");
+ ALM_INFO("database made ");
free(dataPath);
free(path);
@@ -59,6 +60,7 @@ int open_db()
int write_into_db(int db_id, int alarm_id, struct tm * new_time, int weekly)
{
+ _ALM_ENTER_;
if (open_db() != SQLITE_OK) /*create database instance*/
return SQLITE_ERROR;
@@ -67,36 +69,38 @@ int write_into_db(int db_id, int alarm_id, struct tm * new_time, int weekly)
int ret;
snprintf(sql, BUFLEN, "INSERT INTO ALARM_TABLE (DB_ID, ALARM_ID, HOUR, MINS, WEEKLY, DAY, MONTH, YEAR, W_DAY, ALARM_ON, SNZ_CNT, NXT_SNZ_TIME_HOUR, NXT_SNZ_TIME_MIN) VALUES (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d );",
db_id, alarm_id, new_time->tm_hour, new_time->tm_min, weekly, new_time->tm_mday, new_time->tm_mon, new_time->tm_year, new_time->tm_wday , 1, 0, 0, 0);
- dlog_print(DLOG_INFO, LOG_TAG, "sql query %s", sql);
+ ALM_INFO("sql query %s", sql);
ret = sqlite3_exec(sampleDb, sql, NULL, 0, &ErrMsg); /*execute query*/
if (ret != SQLITE_OK) {
if (alarm_cancel(alarm_id) != ALARM_ERROR_NONE)
- dlog_print(DLOG_ERROR, LOG_TAG, "could not remove alarm");
- dlog_print(DLOG_ERROR, LOG_TAG, "Insertion Error! [%s]", sqlite3_errmsg(sampleDb));
+ ALM_ERR("could not remove alarm");
+ ALM_ERR("Insertion Error! [%s]", sqlite3_errmsg(sampleDb));
sqlite3_free(ErrMsg);
sqlite3_close(sampleDb); /*close db instance for failed case*/
return SQLITE_ERROR;
} else
- dlog_print(DLOG_INFO, LOG_TAG, "insert done");
+ ALM_INFO("insert done");
sqlite3_close(sampleDb); /*close db instance for success case*/
return SQLITE_OK;
}
+
int delete_alarm(int alarm_id)
{
+ _ALM_ENTER_;
if (open_db() != SQLITE_OK) /*create database instance*/
return SQLITE_ERROR;
- dlog_print(DLOG_INFO, LOG_TAG, "inside delete alarm %d", alarm_id);
+ ALM_INFO("inside delete alarm %d", alarm_id);
char sql[BUFLEN];
char *ErrMsg;
int ret;
snprintf(sql, BUFLEN, "DELETE FROM ALARM_TABLE WHERE ALARM_ID=%d;", alarm_id);
- dlog_print(DLOG_INFO, LOG_TAG, "sql query %s", sql);
+ ALM_INFO("sql query %s", sql);
//dont check return value. if one time alarm is created and it expires alarm_cancel will return error as it already expires
//so dont check return value for alarm_cancel.
alarm_cancel(alarm_id);
ret = sqlite3_exec(sampleDb, sql, NULL, 0, &ErrMsg); /*execute query*/
if (ret != SQLITE_OK) {
- dlog_print(DLOG_ERROR, LOG_TAG, "query failed [%s]", sqlite3_errmsg(sampleDb));
+ ALM_ERR("query failed [%s]", sqlite3_errmsg(sampleDb));
sqlite3_free(ErrMsg);
sqlite3_close(sampleDb); /*close db instance for failed case*/
return SQLITE_ERROR;
@@ -107,13 +111,14 @@ int delete_alarm(int alarm_id)
static int checkcb(void *data, int argc, char **argv, char **azColName)
{
- dlog_print(DLOG_INFO, LOG_TAG, "inside callback");
+ _ALM_ENTER_;
temp_alarm_id = atoi(argv[1]); //get already set alarm id
return 1;
}
int check_duplicate(struct tm * new_time , int weekly)
{
+ _ALM_ENTER_;
if (open_db() != SQLITE_OK) /*create database instance*/
return SQLITE_ERROR;
@@ -122,15 +127,15 @@ int check_duplicate(struct tm * new_time , int weekly)
int ret;
snprintf(sql, BUFLEN, "SELECT * FROM ALARM_TABLE WHERE HOUR = %d AND MINS = %d AND WEEKLY =%d;", new_time->tm_hour, new_time->tm_min, weekly);
- dlog_print(DLOG_INFO, LOG_TAG, "sql query %s", sql);
+ ALM_INFO("sql query %s", sql);
ret = sqlite3_exec(sampleDb, sql, checkcb, 0 , &ErrMsg); /*execute query*/
if (ret == SQLITE_ABORT) {
- dlog_print(DLOG_ERROR, LOG_TAG, " function returned non-zero [%s]", sqlite3_errmsg(sampleDb));
- dlog_print(DLOG_ERROR, LOG_TAG, " temp_alarm_id %d", temp_alarm_id);
+ ALM_ERR(" function returned non-zero [%s]", sqlite3_errmsg(sampleDb));
+ ALM_ERR(" temp_alarm_id %d", temp_alarm_id);
sqlite3_close(sampleDb);
return temp_alarm_id;
} else {
- dlog_print(DLOG_ERROR, LOG_TAG, " no duplicate [%s]", sqlite3_errmsg(sampleDb));
+ ALM_ERR(" no duplicate [%s]", sqlite3_errmsg(sampleDb));
sqlite3_close(sampleDb);
return -1;
}
@@ -138,6 +143,7 @@ int check_duplicate(struct tm * new_time , int weekly)
static int checkduplicate_cb(void *data, int argc, char **argv, char **azColName)
{
+ _ALM_ENTER_;
int *exist = (int*)data;
*exist = 1;
return 0;
@@ -145,12 +151,13 @@ static int checkduplicate_cb(void *data, int argc, char **argv, char **azColName
int check_duplicate_withoutopen(struct tm * new_time , int weekly)
{
+ _ALM_ENTER_;
char sql[BUFLEN];
char *ErrMsg;
int ret;
snprintf(sql, BUFLEN, "SELECT * FROM ALARM_TABLE WHERE HOUR = %d AND MINS = %d AND WEEKLY =%d;", new_time->tm_hour, new_time->tm_min, weekly);
- dlog_print(DLOG_INFO, LOG_TAG, "sql query %s", sql);
+ ALM_INFO("sql query %s", sql);
int exist = 0;
ret = sqlite3_exec(sampleDb, sql, checkduplicate_cb, &exist , &ErrMsg); /*execute query*/
return exist;
@@ -158,15 +165,16 @@ int check_duplicate_withoutopen(struct tm * new_time , int weekly)
}
static int callback_count(void *data, int argc, char **argv, char **azColName)
{
- dlog_print(DLOG_INFO, LOG_TAG, "inside callback callback_count");
+ _ALM_ENTER_;
int *al_count = (int*)data;
*al_count = atoi(argv[0]);
- dlog_print(DLOG_INFO, LOG_TAG, "count is %d ", *al_count);
+ ALM_INFO("count is %d ", *al_count);
return 0;
}
int get_alarm_count(int *count)
{
+ _ALM_ENTER_;
if (open_db() != SQLITE_OK) /*create database instance*/
return -1;
@@ -175,10 +183,10 @@ int get_alarm_count(int *count)
int ret;
snprintf(sql, BUFLEN, "SELECT COUNT(*) FROM ALARM_TABLE");
int loc_count = 0;
- dlog_print(DLOG_INFO, LOG_TAG, "sql query %s", sql);
+ ALM_INFO("sql query %s", sql);
ret = sqlite3_exec(sampleDb, sql, callback_count, &loc_count , &ErrMsg); /*execute query*/
if (ret != SQLITE_OK) {
- dlog_print(DLOG_ERROR, LOG_TAG, "query failed [%s]", sqlite3_errmsg(sampleDb));
+ ALM_ERR("query failed [%s]", sqlite3_errmsg(sampleDb));
sqlite3_free(ErrMsg);
sqlite3_close(sampleDb); /*close db instance for failed case*/
return -1;
@@ -190,6 +198,7 @@ int get_alarm_count(int *count)
int update_alarm_state(int alarm_id, int state)
{
+ _ALM_ENTER_;
if (open_db() != SQLITE_OK) /*create database instance*/
return -1;
@@ -198,10 +207,10 @@ int update_alarm_state(int alarm_id, int state)
int ret;
//snprintf(sql, BUFLEN, "SELECT ALARM_ID, HOUR, MINS, WEEKLY, DAY, MONTH, YEAR, W_DAY, ALARM_ON FROM ALARM_TABLE;");
snprintf(sql, BUFLEN, "UPDATE ALARM_TABLE SET ALARM_ON=%d WHERE ALARM_ID=%d;", state, alarm_id);
- dlog_print(DLOG_INFO, LOG_TAG, "sql query %s", sql);
+ ALM_INFO("sql query %s", sql);
ret = sqlite3_exec(sampleDb, sql, NULL, 0 , &ErrMsg); /*execute query*/
if (ret != SQLITE_OK) {
- dlog_print(DLOG_ERROR, LOG_TAG, "query failed [%s]", sqlite3_errmsg(sampleDb));
+ ALM_ERR("query failed [%s]", sqlite3_errmsg(sampleDb));
sqlite3_free(ErrMsg);
sqlite3_close(sampleDb); /*close db instance for failed case*/
return -1;
@@ -213,14 +222,15 @@ int update_alarm_state(int alarm_id, int state)
static int callback(void *data, int argc, char **argv, char **azColName)
{
+ _ALM_ENTER_;
Eina_List **local_data = (Eina_List **)data;
- dlog_print(DLOG_INFO, LOG_TAG, " local count callback before append%d ", eina_list_count(*local_data));
+ ALM_INFO(" local count callback before append%d ", eina_list_count(*local_data));
struct genlist_item_data *gendata = data_alarm_create_genlist_item_data();
int i = 0;
- dlog_print(DLOG_INFO, LOG_TAG, "number of coulumns %d", argc);
+ ALM_INFO("number of coulumns %d", argc);
for (i = 0; i < argc ; i++) {
gendata->alarm_id = atoi(argv[0]);
- dlog_print(DLOG_INFO, LOG_TAG, " alrm_id %d", gendata->alarm_id);
+ ALM_INFO(" alrm_id %d", gendata->alarm_id);
gendata->saved_time.tm_hour = atoi(argv[1]);
gendata->saved_time.tm_min = atoi(argv[2]);
gendata->weekly = atoi(argv[3]);
@@ -234,13 +244,13 @@ static int callback(void *data, int argc, char **argv, char **azColName)
//Eina_List *local_data = view_get_local_data();
*local_data = eina_list_append(*local_data, (void *)gendata);
- dlog_print(DLOG_INFO, LOG_TAG, " local count callback after append%d ", eina_list_count(*local_data));
- // view_set_local_data(local_data);
- return 0;
+ ALM_INFO(" local count callback after append%d ", eina_list_count(*local_data));
+ return 0;
}
int populate_local_data(Eina_List **local_data)
{
+ _ALM_ENTER_;
if (open_db() != SQLITE_OK) /*create database instance*/
return -1;
@@ -249,16 +259,16 @@ int populate_local_data(Eina_List **local_data)
int ret;
snprintf(sql, BUFLEN, "SELECT ALARM_ID, HOUR, MINS, WEEKLY, DAY, MONTH, YEAR, W_DAY, ALARM_ON FROM ALARM_TABLE ORDER BY HOUR,MINS;");
Eina_List *temp = NULL;
- dlog_print(DLOG_INFO, LOG_TAG, "sql query %s", sql);
+ ALM_INFO("sql query %s", sql);
ret = sqlite3_exec(sampleDb, sql, callback, &temp , &ErrMsg); /*execute query*/
if (ret != SQLITE_OK) {
- dlog_print(DLOG_ERROR, LOG_TAG, "query failed [%s]", sqlite3_errmsg(sampleDb));
+ ALM_ERR("query failed [%s]", sqlite3_errmsg(sampleDb));
sqlite3_free(ErrMsg);
sqlite3_close(sampleDb); /*close db instance for failed case*/
return -1;
} else {
sqlite3_close(sampleDb);
- dlog_print(DLOG_INFO, LOG_TAG, "eina_list_count(temp) populate_local_data%d ", eina_list_count(temp));
+ ALM_INFO("eina_list_count(temp) populate_local_data%d ", eina_list_count(temp));
*local_data = temp;
return 0;
}
@@ -267,44 +277,45 @@ int populate_local_data(Eina_List **local_data)
static int getdbidfromDB_cb(void *data, int argc, char **argv, char **azColName)
{
- dlog_print(DLOG_INFO, LOG_TAG, "getdbidfromDB_cb Columns number %d ", argc);
+ _ALM_ENTER_;
+ ALM_INFO("getdbidfromDB_cb Columns number %d ", argc);
int *pid = (int*)data;
*pid = atoi(argv[0]);
- dlog_print(DLOG_INFO, LOG_TAG, "db id %d", *pid);
+ ALM_INFO("db id %d", *pid);
return 0;
}
int getdbidfromDB(int alarm_id, int *dbid)
{
- dlog_print(DLOG_INFO, LOG_TAG, "getdbidfromDB");
+ _ALM_ENTER_;
char sql[BUFLEN];
char *ErrMsg;
int ret;
int tempid = 0;
snprintf(sql, BUFLEN, "SELECT DB_ID FROM ALARM_TABLE WHERE ALARM_ID = %d;", alarm_id);
- dlog_print(DLOG_INFO, LOG_TAG, "sql query %s", sql);
+ ALM_INFO("sql query %s", sql);
ret = sqlite3_exec(sampleDb, sql, getdbidfromDB_cb, &tempid , &ErrMsg); /*execute query*/
if (ret != SQLITE_OK) {
- dlog_print(DLOG_ERROR, LOG_TAG, "update Error! [%s]", sqlite3_errmsg(sampleDb));
+ ALM_ERR("update Error! [%s]", sqlite3_errmsg(sampleDb));
sqlite3_free(ErrMsg);
}
*dbid = tempid;
- dlog_print(DLOG_ERROR, LOG_TAG, "getdbidfromDB db id[%d]", tempid);
+ ALM_ERR("getdbidfromDB db id[%d]", tempid);
return ret;
}
int updateDBwithnewalarmid(int dbid, int alarm_id, struct tm * new_time, int weekly)
{
- dlog_print(DLOG_INFO, LOG_TAG, "updateDBwithnewalarmid");
+ _ALM_ENTER_;
char sql[BUFLEN];
char *ErrMsg;
int ret;
snprintf(sql, BUFLEN, "UPDATE ALARM_TABLE SET ALARM_ID = %d,HOUR = %d, MINS = %d, WEEKLY = %d, DAY = %d, MONTH= %d, YEAR = %d, W_DAY = %d, ALARM_ON = 1 WHERE DB_ID=%d;", alarm_id, new_time->tm_hour, new_time->tm_min, weekly, new_time->tm_mday, new_time->tm_mon, new_time->tm_year, new_time->tm_wday, dbid);
- dlog_print(DLOG_INFO, LOG_TAG, "sql query %s", sql);
+ ALM_INFO("sql query %s", sql);
ret = sqlite3_exec(sampleDb, sql, NULL, NULL , &ErrMsg); /*execute query*/
if (ret != SQLITE_OK) {
- dlog_print(DLOG_ERROR, LOG_TAG, "update Error! [%s]", sqlite3_errmsg(sampleDb));
+ ALM_ERR("update Error! [%s]", sqlite3_errmsg(sampleDb));
sqlite3_free(ErrMsg);
}
return ret;
@@ -312,13 +323,14 @@ int updateDBwithnewalarmid(int dbid, int alarm_id, struct tm * new_time, int wee
int update_alarm(int alarm_id, struct tm * new_time, int weekly, mode_update e)
{
+ _ALM_ENTER_;
if (open_db() != SQLITE_OK) /*create database instance*/
return -1;
int new_alarm_id = 0;
int ret;
if ((!check_duplicate_withoutopen(new_time, weekly)) || (e == NO_CANCEL)) {
- dlog_print(DLOG_INFO, LOG_TAG, "HERE");
- dlog_print(DLOG_INFO, LOG_TAG, "old alarm id %d", alarm_id);
+ ALM_INFO("HERE");
+ ALM_INFO("old alarm id %d", alarm_id);
//no need to check return type. if alarm is expired and if we call alarm_cancel it will fail
if (e == CANCEL)
alarm_cancel(alarm_id);
@@ -326,16 +338,16 @@ int update_alarm(int alarm_id, struct tm * new_time, int weekly, mode_update e)
app_control_temp = _create_alarm_manager_app_control(APP_CONTROL_OPERATION_ALARM_RECURRING, ALERT_APP_ID);
if (app_control_temp == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create a app control handle.");
+ ALM_ERR("Failed to create a app control handle.");
sqlite3_close(sampleDb);
return -1;
} else {
char strdbid[BUFLEN] = {0,};
int dbid = 0;
ret = getdbidfromDB(alarm_id, &dbid);
- dlog_print(DLOG_INFO, LOG_TAG, "db id:%d for alarm ID [%d]", dbid, alarm_id);
+ ALM_INFO("db id:%d for alarm ID [%d]", dbid, alarm_id);
if (ret != SQLITE_OK) {
- dlog_print(DLOG_ERROR, LOG_TAG, "db id fetch Error! [%s]", sqlite3_errmsg(sampleDb));
+ ALM_ERR("db id fetch Error! [%s]", sqlite3_errmsg(sampleDb));
sqlite3_close(sampleDb);
return -1;
}
@@ -346,8 +358,8 @@ int update_alarm(int alarm_id, struct tm * new_time, int weekly, mode_update e)
ret = alarm_schedule_with_recurrence_week_flag(app_control_temp, new_time, weekly, &new_alarm_id);
if (ret != ALARM_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "error value from alarm managerd , error:%s", ret, get_error_message(ret));
- dlog_print(DLOG_INFO, LOG_TAG, "alarm ID is [%d]", alarm_id);
+ ALM_ERR("error value from alarm managerd , error:%s", ret, get_error_message(ret));
+ ALM_INFO("alarm ID is [%d]", alarm_id);
sqlite3_close(sampleDb);
return -1;
} else {
@@ -355,7 +367,7 @@ int update_alarm(int alarm_id, struct tm * new_time, int weekly, mode_update e)
//fetch db_id with alarm_id, and then update the new alarm id for that db_id.
ret = updateDBwithnewalarmid(dbid, new_alarm_id, new_time, weekly);
if (ret != SQLITE_OK) {
- dlog_print(DLOG_ERROR, LOG_TAG, "update Error! [%s]", sqlite3_errmsg(sampleDb));
+ ALM_ERR("update Error! [%s]", sqlite3_errmsg(sampleDb));
sqlite3_close(sampleDb);
return -1;
}
@@ -363,7 +375,7 @@ int update_alarm(int alarm_id, struct tm * new_time, int weekly, mode_update e)
}
}
} else {
- dlog_print(DLOG_ERROR, LOG_TAG, "could not insert due to duplicate");
+ ALM_ERR("could not insert due to duplicate");
sqlite3_close(sampleDb);
return -1;
}
@@ -372,6 +384,7 @@ int update_alarm(int alarm_id, struct tm * new_time, int weekly, mode_update e)
int init_db()
{
+ _ALM_ENTER_;
if (open_db() != SQLITE_OK) /*create database instance*/
return SQLITE_ERROR;
@@ -393,43 +406,44 @@ int init_db()
"SNZ_CNT INTEGER," \
"NXT_SNZ_TIME_HOUR INTEGER,"\
"NXT_SNZ_TIME_MIN INTEGER );";
- dlog_print(DLOG_INFO, LOG_TAG, "sql query is %s", sql);
+ ALM_INFO("sql query is %s", sql);
ret = sqlite3_exec(sampleDb, sql, NULL, 0, &ErrMsg); /*execute query*/
if (ret != SQLITE_OK) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Table Create Error! [%s]", ErrMsg);
+ ALM_ERR("Table Create Error! [%s]", ErrMsg);
sqlite3_free(ErrMsg);
sqlite3_close(sampleDb); /*close db instance as instance is still open*/
return SQLITE_ERROR;
}
sql = "CREATE TABLE IF NOT EXISTS DB_ID_TABLE(DB_ID INTEGER NOT NULL);";
- dlog_print(DLOG_INFO, LOG_TAG, "sql query is %s", sql);
+ ALM_INFO("sql query is %s", sql);
ret = sqlite3_exec(sampleDb, sql, NULL, 0, &ErrMsg); /*execute query*/
if (ret != SQLITE_OK) {
- dlog_print(DLOG_ERROR, LOG_TAG, "db_id Table Create Error! [%s]", ErrMsg);
+ ALM_ERR("db_id Table Create Error! [%s]", ErrMsg);
sqlite3_free(ErrMsg);
sqlite3_close(sampleDb); /*close db instance as instance is still open*/
return SQLITE_ERROR;
}
- dlog_print(DLOG_INFO, LOG_TAG, "Db Table created successfully!");
+ ALM_INFO("Db Table created successfully!");
sqlite3_close(sampleDb); /*close the db instance as operation is done here*/
return SQLITE_OK;
}
static int generate_db_id_cb(void *data, int argc, char **argv, char **azColName)
{
- dlog_print(DLOG_INFO, LOG_TAG, "generate_db_id_cb Columns number %d ", argc);
+ _ALM_ENTER_;
+ ALM_INFO("generate_db_id_cb Columns number %d ", argc);
int *id = (int*)data;
- dlog_print(DLOG_INFO, LOG_TAG, "generate_db_id_cb Columns argv[0 %s ", argv[0]);
+ ALM_INFO("generate_db_id_cb Columns argv[0 %s ", argv[0]);
int i = atoi(argv[0]);
- dlog_print(DLOG_INFO, LOG_TAG, "Maxdb id i %d", i);
+ ALM_INFO("Maxdb id i %d", i);
*id = i;
- dlog_print(DLOG_INFO, LOG_TAG, "Maxdb id %d", *id);
+ ALM_INFO("Maxdb id %d", *id);
return 0;
}
int generate_db_id()
{
- dlog_print(DLOG_INFO, LOG_TAG, "generate_db_id");
+ _ALM_ENTER_;
char sql[BUFLEN];
char *ErrMsg;
@@ -437,27 +451,27 @@ int generate_db_id()
int dbid = -1;
snprintf(sql, BUFLEN, "SELECT DB_ID FROM DB_ID_TABLE;");
- dlog_print(DLOG_INFO, LOG_TAG, "sql query %s", sql);
+ ALM_INFO("sql query %s", sql);
ret = sqlite3_exec(sampleDb, sql, generate_db_id_cb, &dbid , &ErrMsg); /*execute query*/
if (ret != SQLITE_OK) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Selection Error! [%s]", sqlite3_errmsg(sampleDb));
+ ALM_ERR("Selection Error! [%s]", sqlite3_errmsg(sampleDb));
sqlite3_free(ErrMsg);
sqlite3_close(sampleDb); /*close db instance for failed case*/
return ret;
} else
- dlog_print(DLOG_INFO, LOG_TAG, "db id read done");
+ ALM_INFO("db id read done");
if (dbid == -1) {
dbid = 1;
snprintf(sql, BUFLEN, "INSERT INTO DB_ID_TABLE (DB_ID) VALUES (%d);", dbid);
- dlog_print(DLOG_INFO, LOG_TAG, "insert sql query %s", sql);
+ ALM_INFO("insert sql query %s", sql);
ret = sqlite3_exec(sampleDb, sql, NULL, 0, &ErrMsg); /*execute query*/
if (ret != SQLITE_OK) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Insertion Error! [%s]", sqlite3_errmsg(sampleDb));
+ ALM_ERR("Insertion Error! [%s]", sqlite3_errmsg(sampleDb));
sqlite3_free(ErrMsg);
sqlite3_close(sampleDb); /*close db instance for failed case*/
return SQLITE_ERROR;
} else
- dlog_print(DLOG_INFO, LOG_TAG, "insert dbid done");
+ ALM_INFO("insert dbid done");
} else {
@@ -467,15 +481,15 @@ int generate_db_id()
dbid = 0;
}
snprintf(sql, BUFLEN, "UPDATE DB_ID_TABLE SET DB_ID = %d;", dbid);
- dlog_print(DLOG_INFO, LOG_TAG, "sql updated query %s", sql);
+ ALM_INFO("sql updated query %s", sql);
ret = sqlite3_exec(sampleDb, sql, NULL, 0 , &ErrMsg); /*execute query*/
if (ret != SQLITE_OK) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Update Error! [%s]", sqlite3_errmsg(sampleDb));
+ ALM_ERR("Update Error! [%s]", sqlite3_errmsg(sampleDb));
sqlite3_free(ErrMsg);
sqlite3_close(sampleDb); /*close db instance for failed case*/
return ret;
} else
- dlog_print(DLOG_INFO, LOG_TAG, "update db id done");
+ ALM_INFO("update db id done");
}
return dbid;
@@ -483,13 +497,13 @@ int generate_db_id()
int insert_db(struct tm * new_time, int weekly)
{
-
+ _ALM_ENTER_;
if (open_db() != SQLITE_OK) /*create database instance*/
return -1;
app_control_h app_control_temp;
app_control_temp = _create_alarm_manager_app_control(APP_CONTROL_OPERATION_ALARM_RECURRING, ALERT_APP_ID);
if (app_control_temp == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create a app control handle.");
+ ALM_ERR("Failed to create a app control handle.");
sqlite3_close(sampleDb);
return -1;
} else {
@@ -502,21 +516,21 @@ int insert_db(struct tm * new_time, int weekly)
app_control_set_launch_mode(app_control_temp, APP_CONTROL_LAUNCH_MODE_GROUP);
int ret = alarm_schedule_with_recurrence_week_flag(app_control_temp, new_time, weekly, &alarm_id);
if (ret != ALARM_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "check values %d , error:%s", ret, get_error_message(ret));
- dlog_print(DLOG_INFO, LOG_TAG, "alarm ID is [%d]", alarm_id);
+ ALM_ERR("check values %d , error:%s", ret, get_error_message(ret));
+ ALM_INFO("alarm ID is [%d]", alarm_id);
sqlite3_close(sampleDb);
return -1;
} else {
if (dbid < 0)
- dlog_print(DLOG_ERROR, LOG_TAG, "reading max db id error ret:%d %s", dbid, get_error_message(ret));
+ ALM_ERR("reading max db id error ret:%d %s", dbid, get_error_message(ret));
ret = write_into_db(dbid, alarm_id, new_time, weekly);
if (ret != SQLITE_OK) {
sqlite3_close(sampleDb); /*close db instance for failed case*/
return -1;
} else {
- dlog_print(DLOG_INFO, LOG_TAG, "written done");
+ ALM_INFO("written done");
sqlite3_close(sampleDb);
return alarm_id;
}
diff --git a/src/data.c b/src/data.c
index 0be4464..b762a8d 100755
--- a/src/data.c
+++ b/src/data.c
@@ -21,6 +21,7 @@
#include <app.h>
#include <app_alarm.h>
#include <sqlite3.h>
+#include "log.h"
#include "alarm.h"
#include "data.h"
#include "view.h"
@@ -49,6 +50,7 @@ static void _destroy_app_control(app_control_h app_control);
*/
void data_initialize(void)
{
+ _ALM_ENTER_;
/*
* If you need to initialize managing data,
* please use this function.
@@ -59,7 +61,7 @@ void data_initialize(void)
*/
s_info.app_control = _create_app_control(APP_CONTROL_OPERATION_ALARM_ONTIME, PACKAGE);
if (s_info.app_control == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a app control handle.");
+ ALM_ERR("failed to create a app control handle.");
return;
}
open_db();
@@ -69,7 +71,7 @@ void data_initialize(void)
*/
s_info.b = data_create_bundle();
if (s_info.b == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a bundle.");
+ ALM_ERR("failed to create a bundle.");
_destroy_app_control(s_info.app_control);
s_info.app_control = NULL;
return;
@@ -83,6 +85,7 @@ void data_initialize(void)
*/
void data_finalize(void)
{
+ _ALM_ENTER_;
/*
* If you need to finalize managing data,
* please use this function.
@@ -101,7 +104,8 @@ void data_finalize(void)
struct tm *data_get_saved_time_from_gendata(struct genlist_item_data *gendata)
{
- dlog_print(DLOG_INFO, LOG_TAG, "saved time before(%d:%d)", gendata->saved_time.tm_hour, gendata->saved_time.tm_min);
+ _ALM_ENTER_;
+ ALM_INFO("saved time before(%d:%d)", gendata->saved_time.tm_hour, gendata->saved_time.tm_min);
return &gendata->saved_time;
}
@@ -112,6 +116,7 @@ struct tm *data_get_saved_time_from_gendata(struct genlist_item_data *gendata)
*/
void data_set_saved_time_to_gendata(struct genlist_item_data *gendata, struct tm *saved_time)
{
+ _ALM_ENTER_;
memcpy(&gendata->saved_time, saved_time, sizeof(gendata->saved_time));
}
@@ -121,6 +126,7 @@ void data_set_saved_time_to_gendata(struct genlist_item_data *gendata, struct tm
*/
int data_get_alarm_id_from_gendata(struct genlist_item_data *gendata)
{
+ _ALM_ENTER_;
return gendata->alarm_id;
}
@@ -131,6 +137,7 @@ int data_get_alarm_id_from_gendata(struct genlist_item_data *gendata)
*/
void data_set_alarm_id_to_gendata(struct genlist_item_data *gendata, int alarm_id)
{
+ _ALM_ENTER_;
gendata->alarm_id = alarm_id;
}
/*
@@ -139,6 +146,7 @@ void data_set_alarm_id_to_gendata(struct genlist_item_data *gendata, int alarm_i
*/
Eina_Bool data_get_check_state_from_gendata(struct genlist_item_data *gendata)
{
+ _ALM_ENTER_;
return gendata->check_state;
}
@@ -149,6 +157,7 @@ Eina_Bool data_get_check_state_from_gendata(struct genlist_item_data *gendata)
*/
void data_set_check_state_to_gendata(struct genlist_item_data *gendata, Eina_Bool check_state)
{
+ _ALM_ENTER_;
gendata->check_state = check_state;
}
@@ -157,6 +166,7 @@ void data_set_check_state_to_gendata(struct genlist_item_data *gendata, Eina_Boo
*/
app_control_h data_get_app_control(void)
{
+ _ALM_ENTER_;
return s_info.app_control;
}
@@ -165,6 +175,7 @@ app_control_h data_get_app_control(void)
*/
bundle *data_get_bundle(void)
{
+ _ALM_ENTER_;
return s_info.b;
}
@@ -176,10 +187,11 @@ bundle *data_get_bundle(void)
*/
void data_get_resource_path(const char *file_in, char *file_path_out, int file_path_max)
{
+ _ALM_ENTER_;
char *res_path = app_get_resource_path();
if (res_path) {
snprintf(file_path_out, file_path_max, "%s%s", res_path, file_in);
- dlog_print(DLOG_INFO, LOG_TAG, "inside get resource path %s", file_path_out);
+ ALM_INFO("inside get resource path %s", file_path_out);
free(res_path);
}
}
@@ -192,6 +204,7 @@ void data_get_resource_path(const char *file_in, char *file_path_out, int file_p
*/
char *data_get_title_text(void *data, Evas_Object *obj, const char *part)
{
+ _ALM_ENTER_;
char buf[BUF_LEN] = {0, };
snprintf(buf, sizeof(buf), "%s", "Alarm");
@@ -206,6 +219,7 @@ char *data_get_title_text(void *data, Evas_Object *obj, const char *part)
*/
char *data_get_saved_time_text(void *data, Evas_Object *obj, const char *part)
{
+ _ALM_ENTER_;
struct genlist_item_data *gendata = data;
char buf[BUF_LEN] = {0, };
@@ -224,6 +238,7 @@ char *data_get_saved_time_text(void *data, Evas_Object *obj, const char *part)
*/
bundle *data_create_bundle(void)
{
+ _ALM_ENTER_;
bundle *b = NULL;
bundle_raw * r = NULL;
char *str = NULL;
@@ -233,11 +248,11 @@ bundle *data_create_bundle(void)
* Check whether the bundle already exists or not.
*/
if (PREFERENCE_ERROR_NONE != preference_get_string("DATA_KEY_BUNDLE_RAW", &str)) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Failed at preference_get_string()");
+ ALM_ERR("Failed at preference_get_string()");
return NULL;
}
if (PREFERENCE_ERROR_NONE != preference_get_int("DATA_KEY_BUNDLE_RAW_LEN", &len)) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Failed at preference_get_string()");
+ ALM_ERR("Failed at preference_get_string()");
return NULL;
}
r = (bundle_raw *)str;
@@ -261,13 +276,14 @@ bundle *data_create_bundle(void)
*/
void data_bundle_destroy(bundle *b)
{
+ _ALM_ENTER_;
if (b == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "bundle is NULL.");
+ ALM_ERR("bundle is NULL.");
return;
}
if (BUNDLE_ERROR_NONE != bundle_free(b))
- dlog_print(DLOG_ERROR, LOG_TAG, "failed at bundle_free(). Can't destroy bundle.");
+ ALM_ERR("failed at bundle_free(). Can't destroy bundle.");
}
/*
@@ -277,11 +293,12 @@ void data_bundle_destroy(bundle *b)
*/
void data_add_bundle_by_str(const char *bundle_key, const char *bundle_data)
{
+ _ALM_ENTER_;
bundle_raw * r;
int len;
if (s_info.b == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "bundle is NULL.");
+ ALM_ERR("bundle is NULL.");
return;
}
@@ -289,7 +306,7 @@ void data_add_bundle_by_str(const char *bundle_key, const char *bundle_data)
* Add a (int)alarm ID that was converted into string type into a bundle.
*/
/*if (BUNDLE_ERROR_NONE != bundle_add_str(s_info.b, bundle_key, bundle_data)) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Failed at bundle_add_str(). Can't add bundle by using string.");
+ ALM_ERR("Failed at bundle_add_str(). Can't add bundle by using string.");
}*/
/*
@@ -301,10 +318,10 @@ void data_add_bundle_by_str(const char *bundle_key, const char *bundle_data)
* Sets a value(string) & length(int) using preference API.
*/
if (PREFERENCE_ERROR_NONE != preference_set_string("DATA_KEY_BUNDLE_RAW", (const char *)r))
- dlog_print(DLOG_ERROR, LOG_TAG, "Failed at preference_set_string()");
+ ALM_ERR("Failed at preference_set_string()");
if (PREFERENCE_ERROR_NONE != preference_set_int("DATA_KEY_BUNDLE_RAW_LEN", len))
- dlog_print(DLOG_ERROR, LOG_TAG, "Failed at preference_set_int()");
+ ALM_ERR("Failed at preference_set_int()");
}
/*
@@ -313,16 +330,17 @@ void data_add_bundle_by_str(const char *bundle_key, const char *bundle_data)
*/
void data_delete_bundle(const char *key)
{
+ _ALM_ENTER_;
bundle_raw * r;
int len;
if (s_info.b == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "bundle is NULL.");
+ ALM_ERR("bundle is NULL.");
return;
}
if (BUNDLE_ERROR_NONE != bundle_del(s_info.b, key)) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Failed at bundle_del(). Can't delete bundle.");
+ ALM_ERR("Failed at bundle_del(). Can't delete bundle.");
return;
}
@@ -335,10 +353,10 @@ void data_delete_bundle(const char *key)
* Sets a value(string) & length(int) using preference API.
*/
if (PREFERENCE_ERROR_NONE != preference_set_string("DATA_KEY_BUNDLE_RAW", (const char *)r))
- dlog_print(DLOG_ERROR, LOG_TAG, "Failed at preference_set_string()");
+ ALM_ERR("Failed at preference_set_string()");
if (PREFERENCE_ERROR_NONE != preference_set_int("DATA_KEY_BUNDLE_RAW_LEN", len))
- dlog_print(DLOG_ERROR, LOG_TAG, "Failed at preference_set_int()");
+ ALM_ERR("Failed at preference_set_int()");
}
/*
@@ -346,10 +364,11 @@ void data_delete_bundle(const char *key)
*/
int data_get_bundle_count(void)
{
+ _ALM_ENTER_;
int count = 0;
if (s_info.b == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "bundle is NULL.");
+ ALM_ERR("bundle is NULL.");
return 0;
}
@@ -363,14 +382,15 @@ int data_get_bundle_count(void)
*/
struct genlist_item_data *data_alarm_create_genlist_item_data(void)
{
+ _ALM_ENTER_;
struct genlist_item_data *gendata;
gendata = malloc(sizeof(*gendata));
if (gendata == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "gendata cannot be allocated.");
+ ALM_ERR("gendata cannot be allocated.");
return NULL;
}
- dlog_print(DLOG_INFO, LOG_TAG, "memory allocated for gendata");
+ ALM_INFO("memory allocated for gendata");
gendata->check_state = EINA_TRUE;
return gendata;
@@ -381,30 +401,32 @@ struct genlist_item_data *data_alarm_create_genlist_item_data(void)
*/
void data_alarm_destroy_genlist_item_data(struct genlist_item_data *gendata)
{
+ _ALM_ENTER_;
free(gendata);
}
int find_diff(struct tm *current_time, struct tm *saved_time)
{
+ _ALM_ENTER_;
int diffinsec = 0;
if (saved_time == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to get saved time.");
+ ALM_ERR("failed to get saved time.");
return -1;
}
int savetimesec = (saved_time->tm_hour * MINS_AN_HOUR * MINS_AN_HOUR) + (saved_time->tm_min * MINS_AN_HOUR);
int currtimesec = (current_time->tm_hour * MINS_AN_HOUR * MINS_AN_HOUR) + (current_time->tm_min * MINS_AN_HOUR);
- dlog_print(DLOG_INFO, LOG_TAG, "savetimesec=%d, currtimesec=%d", savetimesec, currtimesec);
+ ALM_INFO("savetimesec=%d, currtimesec=%d", savetimesec, currtimesec);
if (savetimesec == currtimesec) {
- dlog_print(DLOG_INFO, LOG_TAG, "savetimesec == currtimesec");
+ ALM_INFO("savetimesec == currtimesec");
diffinsec = 0;
} else if (savetimesec < currtimesec) {
//if currenttime is less than savetime, then alarm should set for next day. (dayend time 24:00 - currenttime hh:mm+ savetime hh:mm)
- dlog_print(DLOG_INFO, LOG_TAG, "savetimesec < currtimesec");
+ ALM_INFO("savetimesec < currtimesec");
diffinsec = ((HOURS_A_DAY * MINS_AN_HOUR * MINS_AN_HOUR) - currtimesec) + savetimesec;
} else {
//if currenttime is greater than savetime, then alarm should set for same day. (savetime hh:mm- currenttime hh:mm)
- dlog_print(DLOG_INFO, LOG_TAG, "savetimesec > currtimesec");
+ ALM_INFO("savetimesec > currtimesec");
diffinsec = (savetimesec - currtimesec);
}
return diffinsec;
@@ -416,6 +438,7 @@ int find_diff(struct tm *current_time, struct tm *saved_time)
char *data_get_popup_text(struct tm *saved_time)
{
+ _ALM_ENTER_;
time_t t;
struct tm *current_time;
int hour_val, min_val;
@@ -424,7 +447,7 @@ char *data_get_popup_text(struct tm *saved_time)
char time_text[BUF_LEN] = {0, };
if (saved_time == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to get saved time.");
+ ALM_ERR("failed to get saved time.");
return NULL;
}
/*
@@ -487,7 +510,7 @@ char *data_get_popup_text(struct tm *saved_time)
snprintf(time_text, sizeof(time_text), "%s %s %s %s", ALARM_SET_FOR, hour_text, min_text, "from now.");
}
}
- dlog_print(DLOG_INFO, LOG_TAG, "Popup text : %s", time_text);
+ ALM_INFO("Popup text : %s", time_text);
return strdup(time_text);
}
@@ -495,6 +518,7 @@ char *data_get_popup_text(struct tm *saved_time)
char *data_get_popup_text_new(int diffinsec)
{
+ _ALM_ENTER_;
int diffinmin = diffinsec/60;
char time_text[BUF_LEN] = {0, };
char hour_text[BUF_LEN] = {0, };
@@ -535,11 +559,12 @@ char *data_get_popup_text_new(int diffinsec)
*/
app_control_h _create_app_control(const char *operation, const char *app_id)
{
+ _ALM_ENTER_;
app_control_h app_control;
//app_control_create(&app_control);
if (app_control_create(&app_control) != APP_CONTROL_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Cannot create app control");
+ ALM_ERR("Cannot create app control");
return NULL;
}
app_control_set_operation(app_control, operation);
@@ -551,12 +576,14 @@ app_control_h _create_app_control(const char *operation, const char *app_id)
return app_control;
}
+
app_control_h _create_alarm_manager_app_control(const char *operation, const char *app_id)
{
+ _ALM_ENTER_;
app_control_h app_control;
if (app_control_create(&app_control) != APP_CONTROL_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Cannot create app control");
+ ALM_ERR("Cannot create app control");
return NULL;
}
app_control_set_operation(app_control, operation);
@@ -576,13 +603,14 @@ app_control_h _create_alarm_manager_app_control(const char *operation, const cha
*/
static void _destroy_app_control(app_control_h app_control)
{
+ _ALM_ENTER_;
if (app_control == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "app_control is NULL");
+ ALM_ERR("app_control is NULL");
return;
}
if (APP_CONTROL_ERROR_NONE != app_control_destroy(app_control))
- dlog_print(DLOG_ERROR, LOG_TAG, "Failed at app_control_destroy(). Can't destroy app_control.");
+ ALM_ERR("Failed at app_control_destroy(). Can't destroy app_control.");
}
/* End of file */
diff --git a/src/main.c b/src/main.c
index bfd9fae..3f5599f 100755
--- a/src/main.c
+++ b/src/main.c
@@ -20,6 +20,7 @@
#include <dlog.h>
#include <system_settings.h>
#include <sqlite3.h>
+#include "log.h"
#include "alarm.h"
#include "data.h"
#include "view.h"
@@ -116,16 +117,18 @@ void end_genlist();
*/
static bool app_create(void *user_data)
{
+ _ALM_ENTER_;
Evas_Object *layout = NULL;
Evas_Object *nf = NULL;
char edje_path[BUF_LEN] = {0, };
- dlog_print(DLOG_INFO, LOG_TAG, "App create");
+ ALM_INFO("App create");
+ ALM_INFO("App create");
data_get_resource_path("edje/alarm_main_genlist.edj", edje_path, sizeof(edje_path));
elm_theme_extension_add(th , edje_path);
data_initialize();
- dlog_print(DLOG_INFO, LOG_TAG, "App create 2");
+ ALM_INFO("App create 2");
/*
* Create base GUI.
*/
@@ -145,7 +148,7 @@ static bool app_create(void *user_data)
layout = _create_layout_no_alarmlist(nf, edje_path, "base_alarm");
if (layout == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a layout of no alarm.");
+ ALM_ERR("failed to create a layout of no alarm.");
return false;
}
@@ -164,7 +167,7 @@ static bool app_create(void *user_data)
*/
int data_count = 0;
get_alarm_count(&data_count);
- dlog_print(DLOG_INFO, LOG_TAG, " Data count in app create %d", data_count);
+ ALM_INFO(" Data count in app create %d", data_count);
if (data_count < 1)
view_send_signal_to_edje(layout, "genlist.hide", "alarm");
else{
@@ -197,6 +200,7 @@ static bool app_create(void *user_data)
*/
static void app_control(app_control_h app_control, void *user_data)
{
+ _ALM_ENTER_;
char *operation = NULL;
char *alarm_id = NULL;
Elm_Object_Item *item = NULL;
@@ -206,22 +210,22 @@ static void app_control(app_control_h app_control, void *user_data)
struct tm *saved_time = NULL;
int ret;
- dlog_print(DLOG_INFO, LOG_TAG, "App control");
+ ALM_INFO("App control");
/*
* When it comes time to sound alarm that has set alarm_schedule_at_date(),
* alarm API calls app_control(), with operation that has set by app_control_set_operation() in advance.
*/
if (app_control_get_operation(app_control, &operation) != APP_CONTROL_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Failed to app_control_get_operation().");
+ ALM_ERR("Failed to app_control_get_operation().");
return;
}
- dlog_print(DLOG_INFO, LOG_TAG, "operation = %s", operation);
+ ALM_INFO("operation = %s", operation);
if (!strncmp(APP_CONTROL_OPERATION_ALARM_ONTIME, operation, strlen(APP_CONTROL_OPERATION_ALARM_ONTIME))) {
ret = app_control_get_extra_data(app_control, APP_CONTROL_DATA_ALARM_ID, &alarm_id);
if (ret != APP_CONTROL_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Failed to app_control_get_extra_data(). Can't get extra data.");
+ ALM_ERR("Failed to app_control_get_extra_data(). Can't get extra data.");
free(operation);
return;
}
@@ -237,13 +241,13 @@ static void app_control(app_control_h app_control, void *user_data)
genlist = view_get_genlist();
item = view_alarm_find_item_from_genlist(genlist, alarm_id);
if (item == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "genlist's item is NULL.");
+ ALM_ERR("genlist's item is NULL.");
return;
}
gendata = elm_object_item_data_get(item);
if (gendata == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Failed at elm_object_item_data_get(). Gendata is NULL.");
+ ALM_ERR("Failed at elm_object_item_data_get(). Gendata is NULL.");
return;
}
@@ -271,7 +275,7 @@ static void app_control(app_control_h app_control, void *user_data)
static void app_pause(void *user_data)
{
/* Take necessary actions when application becomes invisible. */
- dlog_print(DLOG_INFO, LOG_TAG, "App pause");
+ _ALM_ENTER_;
}
/*
@@ -281,11 +285,11 @@ static void app_pause(void *user_data)
static void app_resume(void *user_data)
{
/* Take necessary actions when application becomes visible. */
- dlog_print(DLOG_INFO, LOG_TAG, "App resume");
+ _ALM_ENTER_;
//update_genlist(0,0,0);
int data_count = 0;
get_alarm_count(&data_count);
- dlog_print(DLOG_INFO, LOG_TAG, " Data count in app create %d", data_count);
+ ALM_INFO(" Data count in app resume %d", data_count);
if (data_count >= 1) {
Evas_Object *layout = NULL;
layout = view_get_base_layout();
@@ -302,7 +306,7 @@ static void app_terminate(void *user_data)
/*
* Release all resources.
*/
- dlog_print(DLOG_INFO, LOG_TAG, "App terminate");
+ _ALM_ENTER_;
view_free_s_info();
@@ -311,13 +315,7 @@ static void app_terminate(void *user_data)
view_destroy();
data_finalize();
-#if 0
- if(s_info.pd_create)
- free(s_info.pd_create);
- if(s_info.pd_edit)
- free(s_info.pd_edit);
-#endif
- dlog_print(DLOG_INFO, LOG_TAG, "App terminate end");
+ ALM_INFO("App terminate end");
}
/*
@@ -325,6 +323,7 @@ static void app_terminate(void *user_data)
*/
static void ui_app_lang_changed(app_event_info_h event_info, void *user_data)
{
+ _ALM_ENTER_;
/*APP_EVENT_LANGUAGE_CHANGED*/
char *locale = NULL;
@@ -343,6 +342,7 @@ static void ui_app_lang_changed(app_event_info_h event_info, void *user_data)
*/
int main(int argc, char *argv[])
{
+ _ALM_ENTER_;
int ret;
ui_app_lifecycle_callback_s event_callback = {0, };
@@ -362,13 +362,14 @@ int main(int argc, char *argv[])
ret = ui_app_main(argc, argv, &event_callback, NULL);
if (ret != APP_ERROR_NONE)
- dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_main() is failed. err = %d", ret);
+ ALM_ERR("ui_app_main() is failed. err = %d", ret);
return ret;
}
+
static void _gl_main_sel(void *data, Evas_Object *obj, void *event_info)
{
-
+ _ALM_ENTER_;
//struct genlist_item_data *gendata = (genlist_item_data *)data;
Evas_Object *nf = NULL;
nf = view_get_naviframe();
@@ -378,13 +379,13 @@ static void _gl_main_sel(void *data, Evas_Object *obj, void *event_info)
void populate_genlist()
{
- dlog_print(DLOG_INFO, LOG_TAG, "populating list main");
+ _ALM_ENTER_;
Evas_Object *genlist = NULL;
genlist = view_get_genlist();
Eina_List *local_data = view_get_local_data();
struct genlist_item_data *gendata = NULL;
int loc_count = eina_list_count(local_data);
- dlog_print(DLOG_INFO, LOG_TAG, "populate_genlist %d", loc_count);
+ ALM_INFO("populate_genlist %d", loc_count);
if (loc_count > 0) {
Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
//itc->item_style = "2text.1icon.1";
@@ -398,24 +399,24 @@ void populate_genlist()
for (int i = 0; i < loc_count; i++) {
gendata = (struct genlist_item_data *)eina_list_nth(local_data, i);
if (gendata) {
- dlog_print(DLOG_INFO, LOG_TAG, "Going to append");
- dlog_print(DLOG_INFO, LOG_TAG, "populating list main id %d", gendata->alarm_id);
- dlog_print(DLOG_INFO, LOG_TAG, "populating list main hour %d", gendata->saved_time.tm_hour);
- dlog_print(DLOG_INFO, LOG_TAG, "populating list main min %d", gendata->saved_time.tm_min);
+ ALM_INFO("Going to append");
+ ALM_INFO("populating list main id %d", gendata->alarm_id);
+ ALM_INFO("populating list main hour %d", gendata->saved_time.tm_hour);
+ ALM_INFO("populating list main min %d", gendata->saved_time.tm_min);
elm_genlist_item_append(genlist, itc, (void *)gendata, NULL, ELM_GENLIST_ITEM_NONE, _gl_main_sel, gendata);
}
}
}
} else
- dlog_print(DLOG_INFO, LOG_TAG, " NO ITEMS ");
+ ALM_INFO(" NO ITEMS ");
}
static void _dayselector_mouse_up_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
{
- dlog_print(DLOG_INFO, LOG_TAG, "_dayselector_mouse_up_cb");
+ _ALM_ENTER_;
Evas_Object *ad = (Evas_Object*)data;
//Evas_Event_Mouse_Up *ev = event_info;
char signal[64] = { '\0' };
@@ -427,15 +428,15 @@ static void _dayselector_mouse_up_cb(void *data, Evas * e, Evas_Object * obj, vo
break;
}
if (i == REPEAT_DAY_NUM) {
- dlog_print(DLOG_ERROR, LOG_TAG, "None of the days");
+ ALM_ERR("None of the days");
} else {
- dlog_print(DLOG_INFO, LOG_TAG, "inside dayselector unpress 2");
+ ALM_INFO("inside dayselector unpress 2");
//if i is REPEAT_DAY_NUM
if (s_info.moveout) {
if (s_info.is_pressed[i] == EINA_FALSE) {
snprintf(signal, sizeof(signal), "%s.default", s_info.dsource);
//edje_object_signal_emit(elm_layout_edje_get(ad), signal, s_info.dsource);
- dlog_print(DLOG_INFO, LOG_TAG, "inside dayselector unpress 3");
+ ALM_INFO("inside dayselector unpress 3");
elm_layout_signal_emit(ad, signal, s_info.dsource);
if (!strcmp(repeat_set[i].part_text, "IDS_ALM_BODY_SUN")) {
snprintf(signal, sizeof(signal), "%s.text.sun", repeat_set[i].day_name);
@@ -452,7 +453,7 @@ static void _dayselector_mouse_up_cb(void *data, Evas * e, Evas_Object * obj, vo
} else {
if (s_info.is_pressed[i] == EINA_TRUE) {
s_info.is_pressed[i] = EINA_FALSE;
- dlog_print(DLOG_INFO, LOG_TAG, "inside dayselector unpress 4");
+ ALM_INFO("inside dayselector unpress 4");
snprintf(signal, sizeof(signal), "%s.default", s_info.dsource);
//edje_object_signal_emit(elm_layout_edje_get(ad), signal, s_info.dsource);
elm_layout_signal_emit(ad, signal, s_info.dsource);
@@ -484,7 +485,7 @@ static void _dayselector_mouse_up_cb(void *data, Evas * e, Evas_Object * obj, vo
void _dayselector_mouse_down_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
{
- dlog_print(DLOG_INFO, LOG_TAG, "_dayselector_mouse_down_cb");
+ _ALM_ENTER_;
Evas_Object *ad = (Evas_Object*)data;
char signal[64] = { '\0' };
char source[64] = { '\0' };
@@ -497,10 +498,10 @@ void _dayselector_mouse_down_cb(void *data, Evas * e, Evas_Object * obj, void *e
for (i = 0; i < REPEAT_DAY_NUM; i++) {
char tmp[256] = { 0, };
snprintf(tmp, sizeof(tmp), "%s.touch", repeat_set[i].day_name);
- dlog_print(DLOG_INFO, LOG_TAG, "tmp is = %s", tmp);
+ ALM_INFO("tmp is = %s", tmp);
day = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(ad), tmp);
if (!day) {
- dlog_print(DLOG_INFO, LOG_TAG, "No day");
+ ALM_INFO("No day");
continue;
} else {
evas_object_geometry_get(day, &s_info.rect.x, &s_info.rect.y, &s_info.rect.w, &s_info.rect.h);
@@ -509,22 +510,22 @@ void _dayselector_mouse_down_cb(void *data, Evas * e, Evas_Object * obj, void *e
&& (ev->output.y >= s_info.rect.y)
&& (ev->output.y <= (s_info.rect.y + s_info.rect.h))) {
strncpy(s_info.dsource, repeat_set[i].day_name, strlen(repeat_set[i].day_name));
- dlog_print(DLOG_ERROR, LOG_TAG, "s_info.dsource is = %s", s_info.dsource);
+ ALM_ERR("s_info.dsource is = %s", s_info.dsource);
snprintf(signal, sizeof(signal), "%s.pressed", repeat_set[i].day_name);
//edje_object_signal_emit(elm_layout_edje_get(ad), signal, repeat_set[i].day_name);
elm_layout_signal_emit(ad, signal, repeat_set[i].day_name);
if (!strcmp(repeat_set[i].part_text, "IDS_ALM_BODY_SUN")) {
snprintf(signal, sizeof(signal), "%s.text.sun.pressed", repeat_set[i].day_name);
- dlog_print(DLOG_INFO, LOG_TAG, "signal is = %s", signal);
+ ALM_INFO("signal is = %s", signal);
snprintf(source, sizeof(source), "%s.text", repeat_set[i].day_name);
- dlog_print(DLOG_INFO, LOG_TAG, "source is = %s", source);
+ ALM_INFO("source is = %s", source);
//edje_object_signal_emit(elm_layout_edje_get(ad), signal, source);
elm_layout_signal_emit(ad, signal, source);
} else {
snprintf(signal, sizeof(signal), "%s.text.default.pressed", repeat_set[i].day_name);
- dlog_print(DLOG_INFO, LOG_TAG, "signal is = %s", signal);
+ ALM_INFO("signal is = %s", signal);
snprintf(source, sizeof(source), "%s.text", repeat_set[i].day_name);
- dlog_print(DLOG_INFO, LOG_TAG, "source is = %s", source);
+ ALM_INFO("source is = %s", source);
//edje_object_signal_emit(elm_layout_edje_get(ad), signal, source);
elm_layout_signal_emit(ad, signal, source);
}
@@ -536,6 +537,7 @@ void _dayselector_mouse_down_cb(void *data, Evas * e, Evas_Object * obj, void *e
static Eina_Bool animator_cb(void *data)
{
+ _ALM_ENTER_;
int i, num_items;
page_data *pd = (page_data *)data;
num_items = pd->max_page + 1;
@@ -548,6 +550,7 @@ static Eina_Bool animator_cb(void *data)
static void _index_refresh(void *data)
{
+ _ALM_ENTER_;
int i, num_index;
page_data *pd = (page_data *)data;
num_index = pd->max_page + 1;
@@ -574,6 +577,7 @@ static void _index_refresh(void *data)
static void
_index_sync(void *data)
{
+ _ALM_ENTER_;
page_data *pd = (page_data *)data;
Elm_Object_Item *it;
it = elm_index_item_find(pd->index, (void *)pd->cur_page);
@@ -588,6 +592,7 @@ _index_sync(void *data)
static void
_layout_del_cb(void *data , Evas *e, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
page_data *pd = (page_data *)data;
free(pd);
}
@@ -596,6 +601,7 @@ _layout_del_cb(void *data , Evas *e, Evas_Object *obj, void *event_info)
static void
_on_index_mouse_down_cb(void *data, Evas *e, Evas_Object *o, void *event_info)
{
+ _ALM_ENTER_;
page_data *pd = (page_data *)data;
/* Keep the last index item active and save the selected index item */
@@ -605,9 +611,11 @@ _on_index_mouse_down_cb(void *data, Evas *e, Evas_Object *o, void *event_info)
pd->new_it = elm_index_selected_item_get(o, level);
elm_index_item_selected_set(pd->last_it, EINA_TRUE);
}
+
static void
_on_index_mouse_move_cb(void *data, Evas *e, Evas_Object *o, void *event_info)
{
+ _ALM_ENTER_;
page_data *pd = (page_data *)data;
/* Keep the last index item active and save the currently selected index item */
@@ -617,9 +625,11 @@ _on_index_mouse_move_cb(void *data, Evas *e, Evas_Object *o, void *event_info)
pd->new_it = elm_index_selected_item_get(o, level);
elm_index_item_selected_set(pd->last_it, EINA_TRUE);
}
+
static void
_on_index_mouse_up_cb(void *data, Evas *e, Evas_Object *o, void *event_info)
{
+ _ALM_ENTER_;
page_data *pd = (page_data *)data;
/* Keep the last index item active and move to the page of the currently selected index item */
@@ -636,6 +646,7 @@ _on_index_mouse_up_cb(void *data, Evas *e, Evas_Object *o, void *event_info)
static void
_layout_resize_cb(void *data , Evas *e, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
int w1, h1, w2, h2;
page_data *pd = (page_data *)data;
@@ -648,9 +659,19 @@ _layout_resize_cb(void *data , Evas *e, Evas_Object *obj, void *event_info)
static void _scroll(void *data, Evas_Object *obj, void *ei)
{
+ _ALM_ENTER_;
int cur_page;
+ Evas_Object *datetime = NULL;
page_data *pd = (page_data *)data;
elm_scroller_current_page_get(pd->scroller, &cur_page, NULL);
+ ALM_INFO("elm_scroller_current_page_get %d ", cur_page);
+ if (cur_page == 0) {
+ datetime = view_get_timepicker();
+ eext_rotary_object_event_activated_set(datetime, EINA_TRUE);
+ } else {
+ datetime = view_get_timepicker();
+ eext_rotary_object_event_activated_set(datetime, EINA_FALSE);
+ }
if (cur_page != pd->cur_page) {
printf("scroll: %d\n", pd->cur_page);
pd->prev_page = pd->cur_page;
@@ -659,6 +680,7 @@ static void _scroll(void *data, Evas_Object *obj, void *ei)
return;
elm_object_signal_emit(pd->page_layout[pd->cur_page], "elm,state,thumbnail,select", "elm");
elm_object_signal_emit(pd->page_layout[pd->prev_page], "elm,state,thumbnail,unselect", "elm");
+
_index_sync(pd);
}
@@ -666,10 +688,11 @@ static void _scroll(void *data, Evas_Object *obj, void *ei)
Evas_Object* _gl_add_button_get(void *data, Evas_Object *obj, const char *part)
{
+ _ALM_ENTER_;
Evas_Object *btn = NULL;
btn = elm_button_add(obj);
if (btn == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create button.");
+ ALM_ERR("failed to create button.");
return NULL;
}
@@ -685,6 +708,7 @@ Evas_Object* _gl_add_button_get(void *data, Evas_Object *obj, const char *part)
static char* _gl_menu_title_text_get(void *data, Evas_Object *obj, const char *part)
{
+ _ALM_ENTER_;
char buf[1024];
snprintf(buf, 1023, "%s", "Alarm");
@@ -694,20 +718,21 @@ static char* _gl_menu_title_text_get(void *data, Evas_Object *obj, const char *p
static void _save_button_pressed_edit(void *data, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
Evas_Object *layout = (Evas_Object *)data;
struct genlist_item_data *gendata = (struct genlist_item_data *)evas_object_data_get(layout, "control_edit");
//struct genlist_item_data *gendata = (struct genlist_item_data *)data;
- dlog_print(DLOG_ERROR, LOG_TAG, "inside _save_button_pressed edit");
+ ALM_ERR("inside _save_button_pressed edit");
int weekly = 0, i = 0;
for (i = 0; i < REPEAT_DAY_NUM; i++) {
if (s_info.is_pressed[i] == 1) {
weekly |= 1 << i;
- dlog_print(DLOG_INFO, LOG_TAG, " weekly %d", weekly);
+ ALM_INFO(" weekly %d", weekly);
}
}
- dlog_print(DLOG_INFO, LOG_TAG, " Final weekly %d", weekly);
+ ALM_INFO(" Final weekly %d", weekly);
struct tm *saved_time = NULL;
saved_time = view_get_datetime();
@@ -721,36 +746,36 @@ static void _save_button_pressed_edit(void *data, Evas_Object *obj, void *event_
current_time = localtime(&t);
saved_time->tm_sec = 0;
Evas_Object *layout2 = view_get_base_layout();
- dlog_print(DLOG_INFO, LOG_TAG, "saved time (%d:%d) %d %d %d", saved_time->tm_hour, saved_time->tm_min, saved_time->tm_mday, saved_time->tm_mon, saved_time->tm_year);
- dlog_print(DLOG_INFO, LOG_TAG, "current_time time (%d:%d) %d %d %d", current_time->tm_hour, current_time->tm_min, current_time->tm_mday, current_time->tm_mon, current_time->tm_year);
+ ALM_INFO("saved time (%d:%d) %d %d %d", saved_time->tm_hour, saved_time->tm_min, saved_time->tm_mday, saved_time->tm_mon, saved_time->tm_year);
+ ALM_INFO("current_time time (%d:%d) %d %d %d", current_time->tm_hour, current_time->tm_min, current_time->tm_mday, current_time->tm_mon, current_time->tm_year);
int diff = find_diff(current_time, saved_time);
if (diff != -1) {
- dlog_print(DLOG_INFO, LOG_TAG, "time differnce is [%d]", diff);
+ ALM_INFO("time differnce is [%d]", diff);
time_t newt = t+diff;
struct tm *new_time = localtime(&newt);
new_time->tm_sec = 0;
- dlog_print(DLOG_INFO, LOG_TAG, " new time (%d-%d-%d %d:%d) ----- %d sec", new_time->tm_mday, new_time->tm_mon, new_time->tm_year, new_time->tm_hour, new_time->tm_min, new_time->tm_sec);
+ ALM_INFO(" new time (%d-%d-%d %d:%d) ----- %d sec", new_time->tm_mday, new_time->tm_mon, new_time->tm_year, new_time->tm_hour, new_time->tm_min, new_time->tm_sec);
/*
* Set alarm by using alarm API.
*/
char *popup_text = NULL;
int temp_alarm_id = check_duplicate(new_time , weekly);
- dlog_print(DLOG_INFO, LOG_TAG, "RETURNED last alarm id %d ", temp_alarm_id);
+ ALM_INFO("RETURNED last alarm id %d ", temp_alarm_id);
if (temp_alarm_id == -1) {
popup_text = data_get_popup_text_new(diff);
int last_alarm_id = update_alarm(gendata->alarm_id, new_time, weekly, CANCEL);
if (last_alarm_id != -1) {
- dlog_print(DLOG_INFO, LOG_TAG, "save button pressed last alarm id %d ", last_alarm_id);
+ ALM_INFO("save button pressed last alarm id %d ", last_alarm_id);
global_latest_alarm_id = last_alarm_id;
view_create_text_popup(layout2, 2.0, popup_text, last_alarm_id , NORMAL_MODE);
- dlog_print(DLOG_INFO, LOG_TAG, "HERE");
+ ALM_INFO("HERE");
}
if (popup_text)
free(popup_text);
if (saved_time)
free(saved_time);
} else {
- dlog_print(DLOG_INFO, LOG_TAG, " ELSE PART ");
+ ALM_INFO(" ELSE PART ");
char time_text[BUF_LEN] = {0, };
//popup_text = "Alarm already set for"
if (new_time->tm_hour == 0)
@@ -761,9 +786,9 @@ static void _save_button_pressed_edit(void *data, Evas_Object *obj, void *event_
snprintf(time_text, sizeof(time_text), " Alarm already set for %02d:%02d P.M", new_time->tm_hour-12, new_time->tm_min);
global_latest_alarm_id = temp_alarm_id;
- dlog_print(DLOG_ERROR, LOG_TAG, "GLOBAL LAST ALARM ID %d", global_latest_alarm_id);
+ ALM_ERR("GLOBAL LAST ALARM ID %d", global_latest_alarm_id);
view_create_text_popup(layout2, 2.0, time_text, -1, NORMAL_MODE);
- dlog_print(DLOG_ERROR, LOG_TAG, "could not insert due to duplicate");
+ ALM_ERR("could not insert due to duplicate");
if (saved_time)
free(saved_time);
}
@@ -776,9 +801,9 @@ static void _save_button_pressed_edit(void *data, Evas_Object *obj, void *event_
//Eina_Bool change_button(void *data, Evas_Object *obj, Eext_Rotary_Event_Info *info)
void change_button(void *data, Evas_Object *obj, void *event_info)
{
-
+ _ALM_ENTER_;
Evas_Object *layout = (Evas_Object *)data;
- dlog_print(DLOG_INFO, LOG_TAG, "change_button ");
+ ALM_INFO("change_button ");
//Evas_Object *layout = view_get_base_layout();
void *temp_data = evas_object_data_get(layout, "control");
view_set_button(layout, "elm.swallow.btn", "bottom", NULL, "NEXT", NULL, NULL, _set_clicked_cb, temp_data);
@@ -788,6 +813,7 @@ void change_button(void *data, Evas_Object *obj, void *event_info)
static void _edit_screen_layout(Evas_Object *parent, char *layout_file, char *index_style, char it_style[][20], void *data)
{
+ _ALM_ENTER_;
Evas_Object *layout, *scroller, *box, *index, *layout1, *layout2, *layout3;
Elm_Object_Item *nf_it;
struct genlist_item_data *gendata = (struct genlist_item_data *)data;
@@ -797,7 +823,7 @@ static void _edit_screen_layout(Evas_Object *parent, char *layout_file, char *in
for (i = 0; i < REPEAT_DAY_NUM; i++)
s_info.is_pressed[i] = 0;
for (i = 0; i < REPEAT_DAY_NUM; i++)
- dlog_print(DLOG_INFO, LOG_TAG, "BEFORE CHECKING %d", s_info.is_pressed[i]);
+ ALM_INFO("BEFORE CHECKING %d", s_info.is_pressed[i]);
/* Create Layout */
layout = elm_layout_add(parent);
data_get_resource_path("edje/main.edj", file_path, sizeof(file_path));
@@ -849,7 +875,7 @@ static void _edit_screen_layout(Evas_Object *parent, char *layout_file, char *in
evas_object_data_set(layout3, "control", data);
layout1 = _create_layout_set_time(layout3, pd , EDIT_MODE);//edit_mode
if (layout1 == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a layout of setting time.");
+ ALM_ERR("failed to create a layout of setting time.");
free(pd);
return;
}
@@ -861,16 +887,16 @@ static void _edit_screen_layout(Evas_Object *parent, char *layout_file, char *in
layout2 = view_create_layout(box, file_path, "dayselector", NULL, NULL);
if (layout2 == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a layout.");
+ ALM_ERR("failed to create a layout.");
free(pd);
return;
}
view_set_text(layout2, "elm.text", "Repeat");
evas_object_data_set(layout2, "control_edit", data);
view_set_button(layout2, "elm.swallow.btn", "bottom", NULL, "SAVE", NULL, NULL, _save_button_pressed_edit, layout2);
- dlog_print(DLOG_INFO, LOG_TAG, "BEFORE CHECKING PRESSED ");
+ ALM_INFO("BEFORE CHECKING PRESSED ");
for (i = 0; i < REPEAT_DAY_NUM; i++)
- dlog_print(DLOG_INFO, LOG_TAG, "BEFORE CHECKING %d", s_info.is_pressed[i]);
+ ALM_INFO("BEFORE CHECKING %d", s_info.is_pressed[i]);
int loc_weekly = gendata->weekly;
char signal[64] = { '\0' };
for (i = 0 ; i < 7 ; i++) {
@@ -949,7 +975,7 @@ static void _edit_screen_layout(Evas_Object *parent, char *layout_file, char *in
void update_genlist_first()
{
- dlog_print(DLOG_INFO, LOG_TAG, "update_genlist_first");
+ _ALM_ENTER_;
Evas_Object *genlist = NULL;
Evas_Object *nf = NULL;
Evas_Object *layout = view_get_base_layout();
@@ -958,7 +984,7 @@ void update_genlist_first()
nf = view_get_naviframe();
if (genlist)
elm_genlist_clear(genlist);
- dlog_print(DLOG_INFO, LOG_TAG, "reached 1");
+ ALM_INFO("reached 1");
local_data = eina_list_free(local_data);
view_set_local_data(local_data);
@@ -972,11 +998,11 @@ void update_genlist_first()
populate_local_data(&local_data);
view_set_local_data(local_data);
int loc_count = eina_list_count(local_data);
- dlog_print(DLOG_INFO, LOG_TAG, " update_genlist local count %d ", loc_count);
+ ALM_INFO(" update_genlist local count %d ", loc_count);
if (loc_count > 0) {
populate_genlist();
end_genlist();
- //dlog_print(DLOG_INFO, LOG_TAG, "local data count after %d ",loc_count);
+ //ALM_INFO("local data count after %d ",loc_count);
view_send_signal_to_edje(layout, "genlist.show", "alarm");
local_data = view_get_local_data();
loc_count = eina_list_count(local_data);
@@ -987,20 +1013,20 @@ void update_genlist_first()
int last_alarm_id = gendata->alarm_id;
- dlog_print(DLOG_INFO, LOG_TAG, " update_genlist last_alarm_id gendata->alarm_id; %d %d ", last_alarm_id , gendata->alarm_id);
+ ALM_INFO(" update_genlist last_alarm_id gendata->alarm_id; %d %d ", last_alarm_id , gendata->alarm_id);
for (int i = 0; i < loc_count ; i++) {
gendata = (struct genlist_item_data *)eina_list_nth(local_data, i);
if (last_alarm_id == gendata->alarm_id) {
- dlog_print(DLOG_INFO, LOG_TAG, "reached the focus ");
+ ALM_INFO("reached the focus ");
it = elm_genlist_nth_item_get(genlist, i+2);
elm_genlist_item_show(it, ELM_GENLIST_ITEM_SCROLLTO_IN);
break;
}
}
- dlog_print(DLOG_INFO, LOG_TAG, "reached 2");
+ ALM_INFO("reached 2");
} else {
- dlog_print(DLOG_INFO, LOG_TAG, "reached 3");
+ ALM_INFO("reached 3");
view_send_signal_to_edje(layout, "genlist.hide", "alarm");
}
@@ -1008,7 +1034,7 @@ void update_genlist_first()
void update_genlist(int last_alarm_id, int edit_mode, int type)
{
- dlog_print(DLOG_INFO, LOG_TAG, "Updating the genlist for each item added .");
+ _ALM_ENTER_;
Evas_Object *genlist = NULL;
Evas_Object *nf = NULL;
Evas_Object *layout = view_get_base_layout();
@@ -1017,7 +1043,7 @@ void update_genlist(int last_alarm_id, int edit_mode, int type)
nf = view_get_naviframe();
if (genlist)
elm_genlist_clear(genlist);
- dlog_print(DLOG_INFO, LOG_TAG, "reached 1");
+ ALM_INFO("reached 1");
local_data = eina_list_free(local_data);
view_set_local_data(local_data);
@@ -1031,11 +1057,11 @@ void update_genlist(int last_alarm_id, int edit_mode, int type)
populate_local_data(&local_data);
view_set_local_data(local_data);
int loc_count = eina_list_count(local_data);
- dlog_print(DLOG_INFO, LOG_TAG, " update_genlist local count %d ", loc_count);
+ ALM_INFO(" update_genlist local count %d ", loc_count);
if (loc_count > 0) {
populate_genlist();
end_genlist();
- //dlog_print(DLOG_INFO, LOG_TAG, "local data count after %d ",loc_count);
+ //ALM_INFO("local data count after %d ",loc_count);
view_send_signal_to_edje(layout, "genlist.show", "alarm");
local_data = view_get_local_data();
loc_count = eina_list_count(local_data);
@@ -1055,36 +1081,30 @@ void update_genlist(int last_alarm_id, int edit_mode, int type)
last_alarm_id = global_latest_alarm_id;
}
- dlog_print(DLOG_INFO, LOG_TAG, " update_genlist last_alarm_id %d ", last_alarm_id);
+ ALM_INFO(" update_genlist last_alarm_id %d ", last_alarm_id);
for (int i = 0; i < loc_count ; i++) {
gendata = (struct genlist_item_data *)eina_list_nth(local_data, i);
if (last_alarm_id == gendata->alarm_id) {
- dlog_print(DLOG_INFO, LOG_TAG, "reached the focus ");
+ ALM_INFO("reached the focus ");
it = elm_genlist_nth_item_get(genlist, i+2);
elm_genlist_item_show(it, ELM_GENLIST_ITEM_SCROLLTO_IN);
break;
}
}
- dlog_print(DLOG_INFO, LOG_TAG, "reached 2");
+ ALM_INFO("reached 2");
int e_m = view_get_is_select_mode();
- dlog_print(DLOG_INFO, LOG_TAG, "select_mode %d ", e_m);
-#if 0
- if (!e_m)
- elm_naviframe_item_pop(nf);
-#endif
+ ALM_INFO("select_mode %d ", e_m);
+
if (e_m) {
view_set_is_select_mode(EINA_FALSE);
go_to_normal();
}
} else {
- dlog_print(DLOG_INFO, LOG_TAG, "reached 3");
+ ALM_INFO("reached 3");
view_send_signal_to_edje(layout, "genlist.hide", "alarm");
int e_m = view_get_is_select_mode();
-#if 0
- if (!e_m)
- elm_naviframe_item_pop(nf);
-#endif
+
if (e_m) {
view_set_is_select_mode(EINA_FALSE);
go_to_normal();
@@ -1092,25 +1112,27 @@ void update_genlist(int last_alarm_id, int edit_mode, int type)
}
}
+
static void _save_button_pressed(void *data, Evas_Object *obj, void *event_info)
{
- Evas_Object *layout = (Evas_Object *)data;
+ _ALM_ENTER_;
+ //Evas_Object *layout = (Evas_Object *)data;
//save_alarm()_
- dlog_print(DLOG_ERROR, LOG_TAG, "inside _save_button_pressed");
+ ALM_ERR("inside _save_button_pressed");
//view_get_datetime();
- dlog_print(DLOG_INFO, LOG_TAG, " CHECKING PRESSED ");
+ ALM_INFO(" CHECKING PRESSED ");
#if 0
for (int i = 0; i < REPEAT_DAY_NUM; i++)
- dlog_print(DLOG_INFO, LOG_TAG, " CHECKING %d", s_info.is_pressed[i]);
+ ALM_INFO(" CHECKING %d", s_info.is_pressed[i]);
#endif
int weekly = 0, i = 0;
for (i = 0; i < REPEAT_DAY_NUM; i++) {
if (s_info.is_pressed[i] == 1) {
weekly |= 1 << i;
- dlog_print(DLOG_INFO, LOG_TAG, " weekly %d", weekly);
+ ALM_INFO(" weekly %d", weekly);
}
}
- dlog_print(DLOG_INFO, LOG_TAG, " Final weekly %d", weekly);
+ ALM_INFO(" Final weekly %d", weekly);
struct tm *saved_time = NULL;
saved_time = view_get_datetime();
@@ -1124,15 +1146,15 @@ static void _save_button_pressed(void *data, Evas_Object *obj, void *event_info)
current_time = localtime(&t);
saved_time->tm_sec = 0;
Evas_Object *layout2 = view_get_base_layout();
- dlog_print(DLOG_INFO, LOG_TAG, "saved time (%d:%d) %d %d %d", saved_time->tm_hour, saved_time->tm_min, saved_time->tm_mday, saved_time->tm_mon, saved_time->tm_year);
- dlog_print(DLOG_INFO, LOG_TAG, "current_time time (%d:%d) %d %d %d", current_time->tm_hour, current_time->tm_min, current_time->tm_mday, current_time->tm_mon, current_time->tm_year);
+ ALM_INFO("saved time (%d:%d) %d %d %d", saved_time->tm_hour, saved_time->tm_min, saved_time->tm_mday, saved_time->tm_mon, saved_time->tm_year);
+ ALM_INFO("current_time time (%d:%d) %d %d %d", current_time->tm_hour, current_time->tm_min, current_time->tm_mday, current_time->tm_mon, current_time->tm_year);
int diff = find_diff(current_time, saved_time);
if (diff != -1) {
- dlog_print(DLOG_INFO, LOG_TAG, "time differnce is [%d]", diff);
+ ALM_INFO("time differnce is [%d]", diff);
time_t newt = t+diff;
struct tm *new_time = localtime(&newt);
new_time->tm_sec = 0;
- dlog_print(DLOG_INFO, LOG_TAG, " new time (%d-%d-%d %d:%d) ----- %d sec", new_time->tm_mday, new_time->tm_mon, new_time->tm_year, new_time->tm_hour, new_time->tm_min, new_time->tm_sec);
+ ALM_INFO(" new time (%d-%d-%d %d:%d) ----- %d sec", new_time->tm_mday, new_time->tm_mon, new_time->tm_year, new_time->tm_hour, new_time->tm_min, new_time->tm_sec);
/*
* Set alarm by using alarm API.
*/
@@ -1145,10 +1167,10 @@ static void _save_button_pressed(void *data, Evas_Object *obj, void *event_info)
popup_text = data_get_popup_text_new(diff);
int last_alarm_id = insert_db(new_time, weekly);
if (last_alarm_id != -1) {
- dlog_print(DLOG_INFO, LOG_TAG, "save button pressed last alarm id %d ", last_alarm_id);
+ ALM_INFO("save button pressed last alarm id %d ", last_alarm_id);
global_latest_alarm_id = last_alarm_id;
view_create_text_popup(layout2, 2.0, popup_text, last_alarm_id , NORMAL_MODE);
- dlog_print(DLOG_INFO, LOG_TAG, "HERE");
+ ALM_INFO("HERE");
}
if (popup_text)
free(popup_text);
@@ -1166,7 +1188,7 @@ static void _save_button_pressed(void *data, Evas_Object *obj, void *event_info)
snprintf(time_text, sizeof(time_text), " Alarm already set for %02d:%02d P.M", new_time->tm_hour-12, new_time->tm_min);
global_latest_alarm_id = temp_alarm_id;
view_create_text_popup(layout2, 2.0, time_text, -1, NORMAL_MODE);
- dlog_print(DLOG_ERROR, LOG_TAG, "could not insert due to duplicate");
+ ALM_ERR("could not insert due to duplicate");
if (saved_time)
free(saved_time);
}
@@ -1177,6 +1199,7 @@ static void _save_button_pressed(void *data, Evas_Object *obj, void *event_info)
static void
_create_view_layout(Evas_Object *parent, char *layout_file, char *index_style, char it_style[][20], Eina_Bool even_num)
{
+ _ALM_ENTER_;
Evas_Object *layout, *scroller, *box, *index, *layout1, *layout2, *layout3, *layout4;
Elm_Object_Item *nf_it;
@@ -1186,7 +1209,7 @@ _create_view_layout(Evas_Object *parent, char *layout_file, char *index_style, c
for (i = 0; i < REPEAT_DAY_NUM; i++)
s_info.is_pressed[i] = 0;
for (i = 0; i < REPEAT_DAY_NUM; i++)
- dlog_print(DLOG_INFO, LOG_TAG, "BEFORE CHECKING %d", s_info.is_pressed[i]);
+ ALM_INFO("BEFORE CHECKING %d", s_info.is_pressed[i]);
/* Create Layout */
layout = elm_layout_add(parent);
data_get_resource_path("edje/main.edj", file_path, sizeof(file_path));
@@ -1238,7 +1261,7 @@ _create_view_layout(Evas_Object *parent, char *layout_file, char *index_style, c
layout2 = _create_layout_set_time(layout1, pd, NORMAL_MODE);
if (layout2 == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a layout of setting time.");
+ ALM_ERR("failed to create a layout of setting time.");
free(pd);
return;
}
@@ -1247,16 +1270,18 @@ _create_view_layout(Evas_Object *parent, char *layout_file, char *index_style, c
layout3 = view_create_layout(box, file_path, "dayselector_test2", NULL, NULL);
layout4 = view_create_layout(layout3, file_path, "dayselector", NULL, NULL);
if (layout3 == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a layout.");
+ ALM_ERR("failed to create a layout.");
free(pd);
return;
}
+ //datetime = view_get_timepicker();
+ //eext_rotary_object_event_activated_set(datetime, EINA_FALSE);
elm_object_part_content_set(layout3, "layout_swallow", layout4);
view_set_text(layout4, "elm.text", "Repeat");
view_set_button(layout4, "elm.swallow.btn", "bottom", NULL, "SAVE", NULL, NULL, _save_button_pressed, layout4);
- dlog_print(DLOG_INFO, LOG_TAG, "BEFORE CHECKING PRESSED ");
+ ALM_INFO("BEFORE CHECKING PRESSED ");
for (i = 0; i < REPEAT_DAY_NUM; i++)
- dlog_print(DLOG_INFO, LOG_TAG, "BEFORE CHECKING %d", s_info.is_pressed[i]);
+ ALM_INFO("BEFORE CHECKING %d", s_info.is_pressed[i]);
evas_object_event_callback_add(layout4, EVAS_CALLBACK_MOUSE_UP, _dayselector_mouse_up_cb, layout4);
evas_object_event_callback_add(layout4, EVAS_CALLBACK_MOUSE_DOWN, _dayselector_mouse_down_cb, layout4);
evas_object_size_hint_weight_set(layout4, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -1323,14 +1348,15 @@ _create_view_layout(Evas_Object *parent, char *layout_file, char *index_style, c
*/
static Evas_Object *_create_layout_no_alarmlist(Evas_Object *parent, const char *edje_path, const char *group_name)
{
+ _ALM_ENTER_;
Evas_Object *layout = NULL;
if (parent == NULL)
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to get parent.");
+ ALM_ERR("failed to get parent.");
layout = view_create_layout(parent, edje_path, "base_alarm", NULL, NULL);
if (layout == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a layout of base alarm.");
+ ALM_ERR("failed to create a layout of base alarm.");
return NULL;
}
@@ -1351,44 +1377,47 @@ static Evas_Object *_create_layout_no_alarmlist(Evas_Object *parent, const char
*/
static void _set_layout_exist_alarmlist(Evas_Object *layout)
{
+ _ALM_ENTER_;
// elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, genlist, "empty");
Evas_Object *genlist = NULL;
Elm_Genlist_Item_Class *ttc = elm_genlist_item_class_new();
Elm_Genlist_Item_Class *ptc = elm_genlist_item_class_new();
if (!layout) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to get layout.");
+ ALM_ERR("failed to get layout.");
return;
}
- dlog_print(DLOG_INFO, LOG_TAG, " here 1");
+ ALM_INFO(" here 1");
genlist = view_create_circle_genlist(layout);
if (genlist == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a genlist of saving alarm.");
+ ALM_ERR("failed to create a genlist of saving alarm.");
return;
}
- dlog_print(DLOG_INFO, LOG_TAG, " here 2");
+ ALM_INFO(" here 2");
ttc->item_style = "title";
ttc->func.text_get = _gl_menu_title_text_get;
ptc->item_style = "alm_list_add";
ptc->func.content_get = _gl_add_button_get;
- dlog_print(DLOG_INFO, LOG_TAG, " here 3");
+ ALM_INFO(" here 3");
elm_genlist_item_append(genlist, ttc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
#if 0
s_info.padding_item = elm_genlist_item_append(genlist, ptc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
if (s_info.padding_item == NULL) {
free(genlist);
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create padding item of genlist.");
+ ALM_ERR("failed to create padding item of genlist.");
return;
}
#endif
- dlog_print(DLOG_INFO, LOG_TAG, " here 4");
+ ALM_INFO(" here 4");
elm_genlist_item_class_free(ttc);
elm_genlist_item_class_free(ptc);
view_set_content_to_part(layout, "swallow.genlist", genlist);
view_set_genlist(genlist);
}
+
static void delete_alarm_cb(void *data, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
//void *temp_data = evas_object_data_get (layout,"control");
Evas_Object *layout = (Evas_Object *)data;
struct genlist_item_data *gendata = (struct genlist_item_data *)evas_object_data_get(layout, "control_delete");;
@@ -1402,6 +1431,7 @@ static void delete_alarm_cb(void *data, Evas_Object *obj, void *event_info)
*/
static Evas_Object *_create_layout_set_time(Evas_Object *parent, void *data , mode_type e)
{
+ _ALM_ENTER_;
Evas_Object *layout = NULL;
Eext_Circle_Surface *circle_surface = NULL;
struct genlist_item_data *gendata = evas_object_data_get(parent, "control");
@@ -1409,7 +1439,7 @@ static Evas_Object *_create_layout_set_time(Evas_Object *parent, void *data , mo
char image_path[BUF_LEN] = {0, };
if (!parent) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to get parent.");
+ ALM_ERR("failed to get parent.");
return NULL;
}
//struct genlist_item_data *gendata = (struct genlist_item_data *)data;
@@ -1454,7 +1484,7 @@ static Evas_Object *_create_layout_weekly_alarm(Evas_Object *parent)
layout = view_create_layout(parent, file_path, "dayselector", NULL, NULL);
if (layout == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a layout.");
+ ALM_ERR("failed to create a layout.");
return;
}
@@ -1468,7 +1498,8 @@ static Evas_Object *_create_layout_weekly_alarm(Evas_Object *parent)
*/
void end_genlist()
{
- dlog_print(DLOG_INFO, LOG_TAG, "Ending the genlist");
+ _ALM_ENTER_;
+ ALM_INFO("Ending the genlist");
Elm_Genlist_Item_Class *ptc = elm_genlist_item_class_new();
ptc->item_style = "alm_list_add";
ptc->func.content_get = _gl_add_button_get;
@@ -1480,12 +1511,13 @@ void end_genlist()
}
static void _create_layout_ring_alarm(Evas_Object *parent, struct tm *saved_time)
{
+ _ALM_ENTER_;
Evas_Object *layout = NULL;
char buf[BUF_LEN] = {0, };
char file_path[BUF_LEN] = {0, };
if (parent == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to get parent.");
+ ALM_ERR("failed to get parent.");
return;
}
@@ -1496,7 +1528,7 @@ static void _create_layout_ring_alarm(Evas_Object *parent, struct tm *saved_time
layout = view_create_layout(parent, file_path, "ringing_alarm", NULL, NULL);
if (layout == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a layout.");
+ ALM_ERR("failed to create a layout.");
return;
}
@@ -1522,7 +1554,7 @@ static void _create_layout_ring_alarm(Evas_Object *parent, struct tm *saved_time
*/
static Eina_Bool _naviframe_pop_cb(void *data, Elm_Object_Item *it)
{
- dlog_print(DLOG_ERROR, LOG_TAG, "_naviframe_pop_cb");
+ _ALM_ENTER_;
ui_app_exit();
//elm_exit();
@@ -1538,10 +1570,11 @@ static Eina_Bool _naviframe_pop_cb(void *data, Elm_Object_Item *it)
*/
static void _no_alarm_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
Evas_Object *layout = data;
if (layout == NULL)
- dlog_print(DLOG_ERROR, LOG_TAG, "Failed to get layout.");
+ ALM_ERR("Failed to get layout.");
view_send_signal_to_edje(layout, "mouse.down", "button");
}
@@ -1555,10 +1588,11 @@ static void _no_alarm_down_cb(void *data, Evas *e, Evas_Object *obj, void *event
*/
static void _no_alarm_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
Evas_Object *layout = data;
if (layout == NULL)
- dlog_print(DLOG_ERROR, LOG_TAG, "Failed to get layout.");
+ ALM_ERR("Failed to get layout.");
view_send_signal_to_edje(layout, "mouse.up", "button");
}
@@ -1571,6 +1605,7 @@ static void _no_alarm_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_i
*/
static void _no_alarm_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
Evas_Object *nf = NULL;
/*
* Add layout that is able to set time to naviframe.
@@ -1580,7 +1615,7 @@ static void _no_alarm_clicked_cb(void *data, Evas_Object *obj, void *event_info)
#if 0
layout = _create_layout_set_time(nf);
if (layout == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a layout of setting time.");
+ ALM_ERR("failed to create a layout of setting time.");
return;
}
view_push_item_to_naviframe(nf, layout, NULL, NULL);
@@ -1596,12 +1631,13 @@ static void _no_alarm_clicked_cb(void *data, Evas_Object *obj, void *event_info)
static void _add_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
/*
* Add layout that is able to set time to naviframe.
*/
int al_count = 0;
get_alarm_count(&al_count);
- dlog_print(DLOG_ERROR, LOG_TAG, "al_count %d" , al_count);
+ ALM_ERR("al_count %d" , al_count);
Evas_Object *nf = NULL;
nf = view_get_naviframe();
if (al_count < ALARM_LIMIT) {
@@ -1625,13 +1661,17 @@ static void _add_clicked_cb(void *data, Evas_Object *obj, void *event_info)
*/
static void _set_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
+ Evas_Object *datetime = NULL;
page_data *pd = NULL;
- dlog_print(DLOG_ERROR, LOG_TAG, "_set_clicked_cb");
+ ALM_ERR("_set_clicked_cb");
pd = (page_data *)data;
if (pd == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "no page data");
+ ALM_ERR("no page data");
return;
}
+ datetime = view_get_timepicker();
+ eext_rotary_object_event_activated_set(datetime, EINA_FALSE);
elm_scroller_page_bring_in(pd->scroller, 1, 0);
}
@@ -1644,6 +1684,7 @@ static void _set_clicked_cb(void *data, Evas_Object *obj, void *event_info)
*/
static void _dismiss_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
Evas_Object *layout = NULL;
Evas_Object *nf = NULL;
Evas_Object *genlist = NULL;
diff --git a/src/view.c b/src/view.c
index 411f0e0..a46ebc3 100755
--- a/src/view.c
+++ b/src/view.c
@@ -24,6 +24,7 @@
#include <app_preference.h>
#include <stdio.h>
#include <stdlib.h>
+#include "log.h"
#include "alarm.h"
#include "data.h"
#include "view.h"
@@ -73,20 +74,28 @@ static void _popup_hide_cb(void *data, Evas_Object *obj, void *event_info);
static void _block_clicked_cb(void *data, Evas_Object *obj, void *event_info);
static void go_to_normal_mode_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED);
//static void _timeout_cb(void *data, Evas_Object *obj, void *event_info);
+
+Evas_Object *view_get_timepicker(void)
+{
+ _ALM_ENTER_;
+ return s_info.datetime;
+}
+
void view_free_s_info()
{
+ _ALM_ENTER_;
eina_list_free(s_info.local_data);
}
Eina_Bool view_get_is_select_mode(void)
{
- dlog_print(DLOG_INFO, LOG_TAG, "view_get_is_select_mode ");
+ _ALM_ENTER_;
return s_info.is_select_mode;
}
void view_set_is_select_mode(Eina_Bool is_select_mode)
{
- dlog_print(DLOG_INFO, LOG_TAG, " view_set_is_select_mode");
+ _ALM_ENTER_;
s_info.is_select_mode = is_select_mode;
}
@@ -98,19 +107,20 @@ void _gl_del(void *data, Evas_Object *obj)
Evas_Object *load_edj(Evas_Object * parent, const char *file, const char *group)
{
+ _ALM_ENTER_;
Evas_Object *eo = NULL;
int r;
- dlog_print(DLOG_INFO, LOG_TAG, " just before loading edc ");
+ ALM_INFO(" just before loading edc ");
eo = elm_layout_add(parent);
if (eo) {
- dlog_print(DLOG_INFO, LOG_TAG, "loading edc ");
+ ALM_INFO("loading edc ");
r = elm_layout_file_set(eo, file, group);
if (!r) {
evas_object_del(eo);
- dlog_print(DLOG_INFO, LOG_TAG, "could not load edc ");
+ ALM_INFO("could not load edc ");
return NULL;
}
- dlog_print(DLOG_INFO, LOG_TAG, "loaded edc ");
+ ALM_INFO("loaded edc ");
evas_object_show(eo);
return eo;
}
@@ -119,24 +129,23 @@ Evas_Object *load_edj(Evas_Object * parent, const char *file, const char *group)
static void _alarm_main_enable_alarm_down_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
{
- dlog_print(DLOG_INFO, LOG_TAG, " _alarm_main_enable_alarm_down_cb ");
+ _ALM_ENTER_;
struct genlist_item_data *gendata = (struct genlist_item_data *)data;
if (gendata == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a window.");
+ ALM_ERR("failed to create a window.");
return;
}
if (gendata->check_state) {
- dlog_print(DLOG_INFO, LOG_TAG, " if part Checked state %d ", gendata->check_state);
+ ALM_INFO(" if part Checked state %d ", gendata->check_state);
gendata->check_state = 0;
- if (update_alarm_state(gendata->alarm_id, 0) == 0) {
+ if (update_alarm_state(gendata->alarm_id, 0) == 0)
alarm_cancel(gendata->alarm_id);
- }
evas_object_color_set(obj, 255, 255, 255, 255*30/100);
} else {
- dlog_print(DLOG_INFO, LOG_TAG, "else part Checked state %d ", gendata->check_state);
+ ALM_INFO("else part Checked state %d ", gendata->check_state);
gendata->check_state = 1;
if (update_alarm_state(gendata->alarm_id, 1) == 0) {
- dlog_print(DLOG_INFO, LOG_TAG, "generating and updating db on alarm on ");
+ ALM_INFO("generating and updating db on alarm on ");
update_alarm(gendata->alarm_id, &gendata->saved_time, gendata->weekly, NO_CANCEL);
}
evas_object_color_set(obj, 77, 207, 255, 255);
@@ -145,22 +154,23 @@ static void _alarm_main_enable_alarm_down_cb(void *data, Evas * e, Evas_Object *
static void _gl_main_check_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
struct genlist_item_data *gendata = (struct genlist_item_data *)data;
Eina_Bool state = elm_check_state_get(obj);
if (gendata == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a window.");
+ ALM_ERR("failed to create a window.");
return;
}
gendata->select_check_state = state;
s_info.select_mode_check_count += state ? 1 : -1;
- dlog_print(DLOG_INFO, LOG_TAG, "_gl_main_check_clicked_cb %d", s_info.select_mode_check_count);
+ ALM_INFO("_gl_main_check_clicked_cb %d", s_info.select_mode_check_count);
char buf[16] = { 0 };
snprintf(buf, 5, "%.2d", s_info.select_mode_check_count);
elm_object_text_set(s_info.edit_button, buf);
Evas_Object *action_btn = s_info.delete_button;
if (!action_btn) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Action button failed.");
+ ALM_ERR("Action button failed.");
return;
}
@@ -173,20 +183,21 @@ static void _gl_main_check_clicked_cb(void *data, Evas_Object *obj, void *event_
Evas_Object* _gl_alarm_set_icon_get(void *data, Evas_Object *obj, const char *part)
{
+ _ALM_ENTER_;
Evas_Object *ic = NULL;
Evas_Object *bg = NULL;
Evas_Object *ly = NULL;
struct genlist_item_data *gendata = (struct genlist_item_data *)data;
char file_path[BUF_LEN] = {0, };
-// dlog_print(DLOG_INFO, LOG_TAG, " icon get %s",part);
+// ALM_INFO(" icon get %s",part);
//if (strcmp(part, "elm.icon")) return NULL;
if (strcmp(part, "elm.icon") == 0) {
- dlog_print(DLOG_INFO, LOG_TAG, "Inside elm.icon ");
+ ALM_INFO("Inside elm.icon ");
data_get_resource_path("edje/main.edj", file_path, sizeof(file_path));
ly = load_edj(obj, file_path, "icon_layout");
ic = elm_image_add(ly);
data_get_resource_path("edje/images/alarm_list_icon.png", file_path, sizeof(file_path));
- dlog_print(DLOG_INFO, LOG_TAG, "File path of alarm_list_icon %s", file_path);
+ ALM_INFO("File path of alarm_list_icon %s", file_path);
elm_image_file_set(ic, file_path, NULL);
elm_object_part_content_set(ly, "content", ic);
evas_object_propagate_events_set(ic, EINA_FALSE);
@@ -194,17 +205,17 @@ Evas_Object* _gl_alarm_set_icon_get(void *data, Evas_Object *obj, const char *pa
bg = elm_image_add(ly);
data_get_resource_path("edje/images/alarm_list_icon_bg.png", file_path, sizeof(file_path));
- dlog_print(DLOG_INFO, LOG_TAG, "File path of alarm_list_icon_bg %s", file_path);
+ ALM_INFO("File path of alarm_list_icon_bg %s", file_path);
elm_image_file_set(bg, file_path, NULL);
elm_object_part_content_set(ly, "content,bg", bg);
evas_object_propagate_events_set(bg, EINA_FALSE);
- if (gendata->check_state) {
+ if (gendata->check_state)
evas_object_color_set(ly, 7, 207, 255, 255);
- } else {
+ else
evas_object_color_set(ly, 255, 255, 255, 255*30/100);
- }
+
evas_object_event_callback_add(ly, EVAS_CALLBACK_MOUSE_DOWN, _alarm_main_enable_alarm_down_cb, data);
@@ -214,18 +225,18 @@ Evas_Object* _gl_alarm_set_icon_get(void *data, Evas_Object *obj, const char *pa
} else if (strcmp(part, "elm.swallow.center_check") == 0) {
int is_select_mode = view_get_is_select_mode();
if (is_select_mode) {
- dlog_print(DLOG_INFO, LOG_TAG, " cheeck 1");
+ ALM_INFO(" cheeck 1");
ic = elm_check_add(obj);
elm_object_style_set(ic, "genlist/select_mode");
- dlog_print(DLOG_INFO, LOG_TAG, " cheeck 2");
+ ALM_INFO(" cheeck 2");
elm_check_state_set(ic, gendata->select_check_state);
evas_object_smart_callback_add(ic, "changed", _gl_main_check_clicked_cb, data);
evas_object_repeat_events_set(ic, EINA_FALSE);
- if (elm_config_access_get() == EINA_FALSE) {
+ if (elm_config_access_get() == EINA_FALSE)
evas_object_propagate_events_set(ic, EINA_FALSE);
- } else {
+ else
evas_object_propagate_events_set(ic, EINA_TRUE);
- }
+
evas_object_show(ic);
elm_access_object_unregister(ic);
}
@@ -234,9 +245,11 @@ Evas_Object* _gl_alarm_set_icon_get(void *data, Evas_Object *obj, const char *pa
return NULL;
}
+
char* _gl_text_get(void *data, Evas_Object *obj, const char *part)
{
- //dlog_print(DLOG_INFO, LOG_TAG, " called here again ");
+ _ALM_ENTER_;
+ //ALM_INFO(" called here again ");
char buf[BUF_LEN];
struct genlist_item_data *gendata = (struct genlist_item_data *)data;
int hour = gendata->saved_time.tm_hour;
@@ -301,7 +314,7 @@ char* _gl_text_get(void *data, Evas_Object *obj, const char *part)
} else {
for (int i = 0 ; i < 7 ; i++) {
if (loc_weekly & (1 << i)) {
- dlog_print(DLOG_INFO, LOG_TAG, " day selected in genlist");
+ ALM_INFO(" day selected in genlist");
if (i == 0) {
strncat(buf, "<color=#4DCFFF>S</color> ", BUF_LEN);
} else if (i == 1) {
@@ -320,7 +333,7 @@ char* _gl_text_get(void *data, Evas_Object *obj, const char *part)
} else {
if (i == 0) {
strncat(buf, "<color=#FFFFE3>S</color> ", BUF_LEN);
- dlog_print(DLOG_INFO, LOG_TAG, "TEXT %s", buf);
+ ALM_INFO("TEXT %s", buf);
} else if (i == 1) {
strncat(buf, " <color=#FFFFE3>M</color> ", BUF_LEN);
} else if (i == 2) {
@@ -333,12 +346,12 @@ char* _gl_text_get(void *data, Evas_Object *obj, const char *part)
strncat(buf, " <color=#FFFFE3>F</color> ", BUF_LEN);
} else if (i == 6) {
strncat(buf, " <color=#FFFFE3>S</color>", BUF_LEN);
- // dlog_print(DLOG_INFO, LOG_TAG, "TEXT %s",buf);
+ // ALM_INFO("TEXT %s",buf);
}
}
}
}
- // dlog_print(DLOG_INFO, LOG_TAG, "TEXT %s",buf);
+ // ALM_INFO("TEXT %s",buf);
return strdup(buf);
}
return strdup(buf);
@@ -346,13 +359,13 @@ char* _gl_text_get(void *data, Evas_Object *obj, const char *part)
Eina_List *view_get_local_data(void)
{
- dlog_print(DLOG_INFO, LOG_TAG, " view_get_local_data ");
+ _ALM_ENTER_;
return s_info.local_data;
}
void view_set_local_data(Eina_List *local_data)
{
- dlog_print(DLOG_INFO, LOG_TAG, " view_set_local_data ");
+ _ALM_ENTER_;
s_info.local_data = local_data;
}
/*
@@ -360,7 +373,7 @@ void view_set_local_data(Eina_List *local_data)
*/
Evas_Object *view_get_base_layout(void)
{
- dlog_print(DLOG_INFO, LOG_TAG, " view_get_base_layout ");
+ _ALM_ENTER_;
return s_info.layout;
}
@@ -370,6 +383,7 @@ Evas_Object *view_get_base_layout(void)
*/
void view_set_base_layout(Evas_Object *layout)
{
+ _ALM_ENTER_;
s_info.layout = layout;
}
@@ -378,7 +392,7 @@ void view_set_base_layout(Evas_Object *layout)
*/
Evas_Object *view_get_naviframe(void)
{
- dlog_print(DLOG_INFO, LOG_TAG, " view_get_naviframe ");
+ _ALM_ENTER_;
return s_info.nf;
}
@@ -387,7 +401,7 @@ Evas_Object *view_get_naviframe(void)
*/
Evas_Object *view_get_genlist(void)
{
- dlog_print(DLOG_INFO, LOG_TAG, " view_get_genlist ");
+ _ALM_ENTER_;
return s_info.genlist;
}
@@ -397,6 +411,7 @@ Evas_Object *view_get_genlist(void)
*/
void view_set_genlist(Evas_Object *genlist)
{
+ _ALM_ENTER_;
s_info.genlist = genlist;
}
/*
@@ -404,10 +419,11 @@ void view_set_genlist(Evas_Object *genlist)
*/
void view_create(void)
{
+ _ALM_ENTER_;
/* Create window */
s_info.win = view_create_win(PACKAGE);
if (s_info.win == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a window.");
+ ALM_ERR("failed to create a window.");
return;
}
@@ -415,7 +431,7 @@ void view_create(void)
s_info.conform = view_create_conformant_without_indicator(s_info.win);
if (s_info.conform == NULL) {
evas_object_del(s_info.win);
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a conformant");
+ ALM_ERR("failed to create a conformant");
return;
}
@@ -428,9 +444,10 @@ void view_create(void)
*/
void view_alarm_create(void)
{
+ _ALM_ENTER_;
s_info.nf = view_create_naviframe(s_info.conform);
if (s_info.nf == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a naviframe.");
+ ALM_ERR("failed to create a naviframe.");
return;
}
@@ -444,6 +461,7 @@ void view_alarm_create(void)
*/
Evas_Object *view_create_win(const char *pkg_name)
{
+ _ALM_ENTER_;
Evas_Object *win = NULL;
/*
@@ -471,6 +489,7 @@ Evas_Object *view_create_win(const char *pkg_name)
*/
Evas_Object *view_create_conformant_without_indicator(Evas_Object *win)
{
+ _ALM_ENTER_;
Evas_Object *conform = NULL;
/* Conformant
@@ -480,7 +499,7 @@ Evas_Object *view_create_conformant_without_indicator(Evas_Object *win)
*/
if (win == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "window is NULL.");
+ ALM_ERR("window is NULL.");
return NULL;
}
@@ -502,10 +521,11 @@ Evas_Object *view_create_conformant_without_indicator(Evas_Object *win)
*/
Evas_Object *view_create_layout(Evas_Object *parent, const char *file_path, const char *group_name, Eext_Event_Cb cb_function, void *user_data)
{
+ _ALM_ENTER_;
Evas_Object *layout = NULL;
if (parent == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
+ ALM_ERR("parent is NULL.");
return NULL;
}
@@ -533,7 +553,7 @@ Evas_Object *view_create_layout(Evas_Object *parent, const char *file_path, cons
*/
Evas_Object *view_create_layout_by_theme(Evas_Object *parent, const char *class, const char *group, const char *style)
{
-
+ _ALM_ENTER_;
Eext_Circle_Surface *circle_surface = NULL;
/*
* Layout
@@ -542,27 +562,38 @@ Evas_Object *view_create_layout_by_theme(Evas_Object *parent, const char *class,
*/
Evas_Object *layout = NULL;
+ Evas_Object *layout2 = NULL;
+ Evas_Object *layout3 = NULL;
if (parent == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
+ ALM_ERR("parent is NULL.");
return NULL;
}
-
+ layout2 = view_get_base_layout();
+ layout3 = elm_layout_add(layout2);
+ circle_surface = eext_circle_surface_layout_add(layout3);
+ s_info.c_s_time = circle_surface;
+ evas_object_resize(layout3, 360, 360);
+ evas_object_show(layout3);
layout = elm_layout_add(parent);
- dlog_print(DLOG_ERROR, LOG_TAG, "setting circular surface here");
+#if 0
+ ALM_ERR("setting circular surface here");
circle_surface = eext_circle_surface_layout_add(layout);
s_info.c_s_time = circle_surface;
+ evas_object_resize(layout, 360, 360);
+#endif
elm_layout_theme_set(layout, class, group, style);
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-// evas_object_show(layout);
+ evas_object_show(layout);
return layout;
}
struct tm *view_get_datetime()
{
+ _ALM_ENTER_;
struct tm *curr = (struct tm *)malloc(sizeof(struct tm));
elm_datetime_value_get(s_info.datetime, curr);
- dlog_print(DLOG_INFO, LOG_TAG, "view.c time is %d", curr->tm_hour);
- dlog_print(DLOG_INFO, LOG_TAG, "view.c time is %d", curr->tm_min);
+ ALM_INFO("view.c time is %d", curr->tm_hour);
+ ALM_INFO("view.c time is %d", curr->tm_min);
return curr;
}
@@ -573,20 +604,20 @@ struct tm *view_get_datetime()
*/
Evas_Object *view_create_datetime(Evas_Object *parent, const char *style, Eext_Circle_Surface *local_circle_surface)
{
-
+ _ALM_ENTER_;
if (parent == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to get parent.");
+ ALM_ERR("failed to get parent.");
return NULL;
}
if (s_info.circle_surface == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to get circle_surface.");
+ ALM_ERR("failed to get circle_surface.");
return NULL;
}
s_info.datetime = elm_datetime_add(parent);
- //eext_circle_object_datetime_add(s_info.datetime,s_info.c_s_time);
- eext_circle_object_datetime_add(s_info.datetime, s_info.circle_surface);
+ eext_circle_object_datetime_add(s_info.datetime, s_info.c_s_time);
+ //eext_circle_object_datetime_add(s_info.datetime, s_info.circle_surface);
eext_rotary_object_event_activated_set(s_info.datetime, EINA_TRUE);
elm_datetime_format_set(s_info.datetime, FORMAT);
@@ -603,8 +634,9 @@ Evas_Object *view_create_datetime(Evas_Object *parent, const char *style, Eext_C
*/
void view_destroy(void)
{
+ _ALM_ENTER_;
if (s_info.win == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "window is NULL.");
+ ALM_ERR("window is NULL.");
return;
}
@@ -616,6 +648,7 @@ void view_destroy(void)
*/
void view_alarm_destroy(void)
{
+ _ALM_ENTER_;
struct genlist_data *gendata;
Elm_Object_Item *item;
int item_count;
@@ -641,10 +674,11 @@ void view_alarm_destroy(void)
*/
void view_set_image(Evas_Object *parent, const char *part_name, const char *image_path)
{
+ _ALM_ENTER_;
Evas_Object *image = NULL;
if (parent == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
+ ALM_ERR("parent is NULL.");
return;
}
@@ -652,7 +686,7 @@ void view_set_image(Evas_Object *parent, const char *part_name, const char *imag
if (image == NULL) {
image = elm_image_add(parent);
if (image == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create an image object.");
+ ALM_ERR("failed to create an image object.");
return;
}
@@ -660,7 +694,7 @@ void view_set_image(Evas_Object *parent, const char *part_name, const char *imag
}
if (EINA_FALSE == elm_image_file_set(image, image_path, NULL)) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to set image.");
+ ALM_ERR("failed to set image.");
return;
}
@@ -677,8 +711,9 @@ void view_set_image(Evas_Object *parent, const char *part_name, const char *imag
*/
void view_set_text(Evas_Object *parent, const char *part_name, const char *text)
{
+ _ALM_ENTER_;
if (parent == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
+ ALM_ERR("parent is NULL.");
return;
}
@@ -693,6 +728,7 @@ void view_set_text(Evas_Object *parent, const char *part_name, const char *text)
*/
Evas_Object *view_create_naviframe(Evas_Object *parent)
{
+ _ALM_ENTER_;
/*
* Naviframe
* Create and initialize elm_naviframe.
@@ -703,7 +739,7 @@ Evas_Object *view_create_naviframe(Evas_Object *parent)
Evas_Object *nf = NULL;
if (parent == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
+ ALM_ERR("parent is NULL.");
return NULL;
}
@@ -727,15 +763,16 @@ Evas_Object *view_create_naviframe(Evas_Object *parent)
*/
Elm_Object_Item* view_push_item_to_naviframe(Evas_Object *nf, Evas_Object *item, Elm_Naviframe_Item_Pop_Cb _pop_cb, void *cb_data)
{
+ _ALM_ENTER_;
Elm_Object_Item* nf_it = NULL;
if (nf == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "naviframe is NULL.");
+ ALM_ERR("naviframe is NULL.");
return NULL;
}
if (item == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "item is NULL.");
+ ALM_ERR("item is NULL.");
return NULL;
}
@@ -749,6 +786,7 @@ Elm_Object_Item* view_push_item_to_naviframe(Evas_Object *nf, Evas_Object *item,
static void _gl_ctxpopup_select_all_cb(void *data, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
char buf[5];
Evas_Object *genlist = view_get_genlist();
Evas_Object *edit_btn = s_info.edit_button;
@@ -759,17 +797,17 @@ static void _gl_ctxpopup_select_all_cb(void *data, Evas_Object *obj, void *event
while (it) {
struct genlist_item_data *gendata = (struct genlist_item_data *)elm_object_item_data_get(it);
if (!gendata) {
- dlog_print(DLOG_ERROR, LOG_TAG, "gendata is NULL.");
+ ALM_ERR("gendata is NULL.");
break;
}
- dlog_print(DLOG_ERROR, LOG_TAG, "gendata alarmid _gl_ctxpopup_select_all_cb %d", gendata->alarm_id);
+ ALM_ERR("gendata alarmid _gl_ctxpopup_select_all_cb %d", gendata->alarm_id);
// For realized items, set state of real check object
Evas_Object *ck = elm_object_item_part_content_get(it, "elm.swallow.center_check");
gendata->select_check_state = EINA_TRUE;
if (ck)
elm_check_state_set(ck, EINA_TRUE);
else
- dlog_print(DLOG_INFO, LOG_TAG, "ck is null.");
+ ALM_INFO("ck is null.");
// For all items (include unrealized), just set pointer state
it = elm_genlist_item_next_get(it);
}
@@ -782,7 +820,7 @@ static void _gl_ctxpopup_select_all_cb(void *data, Evas_Object *obj, void *event
Evas_Object *action_btn = s_info.delete_button;
if (!action_btn) {
- dlog_print(DLOG_ERROR, LOG_TAG, "action_btn is null.");
+ ALM_ERR("action_btn is null.");
return;
}
@@ -793,7 +831,7 @@ static void _gl_ctxpopup_select_all_cb(void *data, Evas_Object *obj, void *event
static void _gl_ctxpopup_deselect_all_cb(void *data, Evas_Object *obj, void *event_info)
{
-
+ _ALM_ENTER_;
char buf[5];
Evas_Object *genlist = view_get_genlist();
Evas_Object *edit_btn = s_info.edit_button;
@@ -803,7 +841,7 @@ static void _gl_ctxpopup_deselect_all_cb(void *data, Evas_Object *obj, void *eve
while (it) {
struct genlist_item_data *gendata = (struct genlist_item_data *)elm_object_item_data_get(it);
if (!gendata) {
- dlog_print(DLOG_ERROR, LOG_TAG, "gendata is NULL.");
+ ALM_ERR("gendata is NULL.");
break;
}
// For realized items, set state of real check object
@@ -824,7 +862,7 @@ static void _gl_ctxpopup_deselect_all_cb(void *data, Evas_Object *obj, void *eve
Evas_Object *action_btn = s_info.delete_button;
if (!action_btn) {
- dlog_print(DLOG_ERROR, LOG_TAG, "action_btn is null.");
+ ALM_ERR("action_btn is null.");
return;
}
@@ -837,7 +875,7 @@ static void _gl_ctxpopup_deselect_all_cb(void *data, Evas_Object *obj, void *eve
static void _gl_dismissed_cb(void *data, Evas_Object *obj, void *event_info)
{
//struct appdata *ad = (struct appdata *) data;
-
+ _ALM_ENTER_;
evas_object_smart_callback_del(s_info.edit_ctxpopup, "dismissed", _gl_dismissed_cb);
evas_object_del(s_info.edit_ctxpopup);
s_info.edit_ctxpopup = NULL;
@@ -845,6 +883,7 @@ static void _gl_dismissed_cb(void *data, Evas_Object *obj, void *event_info)
static void _gl_move_ctxpopup(Evas_Object *ctxpopup, Evas_Object *btn)
{
+ _ALM_ENTER_;
Evas_Coord x, y, w , h;
evas_object_geometry_get(btn, &x, &y, &w, &h);
evas_object_move(ctxpopup, x + (w / 2), 70);
@@ -852,6 +891,7 @@ static void _gl_move_ctxpopup(Evas_Object *ctxpopup, Evas_Object *btn)
static void _create_ctxpopup_action_button(void *data, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
Evas_Object *layout = view_get_base_layout();
Evas_Object *ctxpopup;
Evas_Object *genlist;
@@ -894,28 +934,27 @@ static void _create_ctxpopup_action_button(void *data, Evas_Object *obj, void *e
void go_to_normal()
{
-
- dlog_print(DLOG_INFO, LOG_TAG, "go_to_normal");
+ _ALM_ENTER_;
Elm_Object_Item *it = NULL;
Evas_Object *genlist = view_get_genlist();
if (elm_config_access_get() == EINA_FALSE) {
- dlog_print(DLOG_INFO, LOG_TAG, "elm_config_access_get() == EINA_FALSE ");
+ ALM_INFO("elm_config_access_get() == EINA_FALSE ");
it = elm_genlist_first_item_get(genlist);
elm_genlist_item_fields_update(it, "elm.text", ELM_GENLIST_ITEM_FIELD_TEXT);
it = elm_genlist_item_next_get(it);
while (it) {
struct genlist_item_data *gendata = (struct genlist_item_data *)elm_object_item_data_get(it);
if (!gendata) {
- dlog_print(DLOG_ERROR, LOG_TAG, "gendata is NULL.");
+ ALM_ERR("gendata is NULL.");
break;
}
gendata->select_check_state = EINA_FALSE;
- dlog_print(DLOG_INFO, LOG_TAG, "elm.swallow.center_check update ");
+ ALM_INFO("elm.swallow.center_check update ");
elm_genlist_item_fields_update(it, "elm.swallow.center_check", ELM_GENLIST_ITEM_FIELD_CONTENT);
it = elm_genlist_item_next_get(it);
}
} else {
- dlog_print(DLOG_INFO, LOG_TAG, "elm_config_access_get() == EINA_TRUE ");
+ ALM_INFO("elm_config_access_get() == EINA_TRUE ");
}
EVAS_OBJECT_DELIF(s_info.edit_button);
EVAS_OBJECT_DELIF(s_info.delete_button);
@@ -929,28 +968,28 @@ void go_to_normal()
static void go_to_normal_mode_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
{
- dlog_print(DLOG_ERROR, LOG_TAG, "go_to_normal_mode_cb");
+ _ALM_ENTER_;
view_set_is_select_mode(EINA_FALSE);
Elm_Object_Item *it = NULL;
Evas_Object *genlist = view_get_genlist();
if (elm_config_access_get() == EINA_FALSE) {
- dlog_print(DLOG_INFO, LOG_TAG, "elm_config_access_get() == EINA_FALSE ");
+ ALM_INFO("elm_config_access_get() == EINA_FALSE ");
it = elm_genlist_first_item_get(genlist);
elm_genlist_item_fields_update(it, "elm.text", ELM_GENLIST_ITEM_FIELD_TEXT);
it = elm_genlist_item_next_get(it);
while (it) {
struct genlist_item_data *gendata = (struct genlist_item_data *)elm_object_item_data_get(it);
if (!gendata) {
- dlog_print(DLOG_ERROR, LOG_TAG, "gendata is NULL.");
+ ALM_ERR("gendata is NULL.");
break;
}
gendata->select_check_state = EINA_FALSE;
- dlog_print(DLOG_INFO, LOG_TAG, "elm.swallow.center_check update ");
+ ALM_INFO("elm.swallow.center_check update ");
elm_genlist_item_fields_update(it, "elm.swallow.center_check", ELM_GENLIST_ITEM_FIELD_CONTENT);
it = elm_genlist_item_next_get(it);
}
} else {
- dlog_print(DLOG_INFO, LOG_TAG, "elm_config_access_get() == EINA_TRUE ");
+ ALM_INFO("elm_config_access_get() == EINA_TRUE ");
}
EVAS_OBJECT_DELIF(s_info.edit_button);
@@ -965,6 +1004,7 @@ static void go_to_normal_mode_cb(void *data EINA_UNUSED, Evas_Object *obj, void
static void _delete_multiple_alarm(void *data, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
int select_mode = view_get_is_select_mode();
if (select_mode) {
Eina_List *local_data = view_get_local_data();
@@ -972,23 +1012,24 @@ static void _delete_multiple_alarm(void *data, Evas_Object *obj, void *event_inf
struct genlist_item_data *gendata = NULL;
for (int i = 0 ; i < loc_count ; i++) {
gendata = (struct genlist_item_data *)eina_list_nth(local_data, i);
- dlog_print(DLOG_INFO, LOG_TAG, "populating list main id %d", gendata->alarm_id);
+ ALM_INFO("populating list main id %d", gendata->alarm_id);
if (gendata->select_check_state)
delete_alarm(gendata->alarm_id);
}
Evas_Object *layout = view_get_base_layout();
- view_create_text_popup(layout, 2.0, "Deleted", -1, NORMAL_MODE);
+ view_create_text_popup(layout, 2.0, "Deleted", -1, EDIT_MODE);
}
}
static void _gl_longpress_cb(void *data, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
Evas_Object *nf = NULL;
nf = view_get_naviframe();
eext_object_event_callback_del(nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb);
- dlog_print(DLOG_ERROR, LOG_TAG, "_gl_longpress_cb");
+ ALM_ERR("_gl_longpress_cb");
Elm_Object_Item *it = (Elm_Object_Item *)event_info;
elm_genlist_item_selected_set(it, EINA_FALSE);
view_set_is_select_mode(EINA_TRUE);
@@ -997,9 +1038,9 @@ static void _gl_longpress_cb(void *data, Evas_Object *obj, void *event_info)
eext_object_event_callback_add(layout, EEXT_CALLBACK_BACK, go_to_normal_mode_cb, NULL);
struct genlist_item_data *gendata = (struct genlist_item_data *)elm_object_item_data_get(it);
if (gendata == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to get parent.");
+ ALM_ERR("failed to get parent.");
} else {
- dlog_print(DLOG_INFO, LOG_TAG, "gendata in longpress %d ", gendata->alarm_id);
+ ALM_INFO("gendata in longpress %d ", gendata->alarm_id);
gendata->select_check_state = EINA_TRUE;
s_info.select_mode_check_count++;
}
@@ -1008,12 +1049,12 @@ static void _gl_longpress_cb(void *data, Evas_Object *obj, void *event_info)
Evas_Object *btn = elm_button_add(layout);
elm_object_style_set(btn, "select_mode");
snprintf(buf, 5, "%.2d", s_info.select_mode_check_count);
- dlog_print(DLOG_INFO, LOG_TAG, "long pressed count 1%d ", s_info.select_mode_check_count);
+ ALM_INFO("long pressed count 1%d ", s_info.select_mode_check_count);
elm_object_text_set(btn, buf);
evas_object_smart_callback_add(btn, "clicked", _create_ctxpopup_action_button, NULL);
evas_object_show(btn);
elm_layout_content_set(layout, "button,add", btn);
- dlog_print(DLOG_INFO, LOG_TAG, "long pressed count 2%d ", s_info.select_mode_check_count);
+ ALM_INFO("long pressed count 2%d ", s_info.select_mode_check_count);
s_info.edit_button = btn;
//view_set_button(layout, "elm.swallow.btn", "select_mode", NULL, buf, NULL, NULL, NULL , NULL);
Evas_Object *delete_button = view_set_button(layout, "swallow.genlist.button", "bottom", NULL, "DELETE", NULL, NULL, _delete_multiple_alarm , NULL);
@@ -1024,17 +1065,17 @@ static void _gl_longpress_cb(void *data, Evas_Object *obj, void *event_info)
Elm_Object_Item *item_last = NULL;
if (elm_config_access_get() == EINA_FALSE) {
- dlog_print(DLOG_INFO, LOG_TAG, "elm_config_access_get() == EINA_FALSE ");
+ ALM_INFO("elm_config_access_get() == EINA_FALSE ");
it = elm_genlist_first_item_get(genlist);
elm_genlist_item_fields_update(it, "elm.text", ELM_GENLIST_ITEM_FIELD_TEXT);
it = elm_genlist_item_next_get(it);
while (it) {
- dlog_print(DLOG_INFO, LOG_TAG, "elm.swallow.center_check update ");
+ ALM_INFO("elm.swallow.center_check update ");
elm_genlist_item_fields_update(it, "elm.swallow.center_check", ELM_GENLIST_ITEM_FIELD_CONTENT);
it = elm_genlist_item_next_get(it);
}
} else {
- dlog_print(DLOG_INFO, LOG_TAG, "elm_config_access_get() == EINA_TRUE ");
+ ALM_INFO("elm_config_access_get() == EINA_TRUE ");
}
if (elm_config_access_get()) {
@@ -1069,16 +1110,17 @@ static void _gl_longpress_cb(void *data, Evas_Object *obj, void *event_info)
*/
Evas_Object *view_create_circle_genlist(Evas_Object *parent)
{
+ _ALM_ENTER_;
Evas_Object *genlist = NULL;
Evas_Object *circle_genlist = NULL;
if (parent == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
+ ALM_ERR("parent is NULL.");
return NULL;
}
if (s_info.circle_surface == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "circle surface is NULL.");
+ ALM_ERR("circle surface is NULL.");
return NULL;
}
@@ -1117,16 +1159,17 @@ Evas_Object *view_create_circle_genlist(Evas_Object *parent)
Elm_Object_Item *view_append_item_to_genlist(Evas_Object *genlist, const char *style,
const void *data, Evas_Smart_Cb _clicked_cb, const void *cb_data)
{
+ _ALM_ENTER_;
Elm_Genlist_Item_Class *item_class;
Elm_Object_Item *item;
if (genlist == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "genlist is NULL.");
+ ALM_ERR("genlist is NULL.");
return NULL;
}
if (style == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "item style is NULL.");
+ ALM_ERR("item style is NULL.");
return NULL;
}
@@ -1146,6 +1189,7 @@ Elm_Object_Item *view_append_item_to_genlist(Evas_Object *genlist, const char *s
*/
Elm_Object_Item *view_alarm_find_item_from_genlist(Evas_Object *genlist, const char *val)
{
+ _ALM_ENTER_;
Elm_Object_Item *item = NULL;
struct genlist_item_data *gendata = NULL;
int item_count = 0;
@@ -1153,7 +1197,7 @@ Elm_Object_Item *view_alarm_find_item_from_genlist(Evas_Object *genlist, const c
int i;
if (genlist == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "genlist is NULL.");
+ ALM_ERR("genlist is NULL.");
return NULL;
}
@@ -1191,16 +1235,17 @@ Elm_Object_Item *view_alarm_find_item_from_genlist(Evas_Object *genlist, const c
Evas_Object *view_set_button(Evas_Object *parent, const char *part_name, const char *style, const char *image_path, const char *text,
Evas_Object_Event_Cb down_cb, Evas_Object_Event_Cb up_cb, Evas_Smart_Cb clicked_cb, void *data)
{
+ _ALM_ENTER_;
Evas_Object *btn = NULL;
if (parent == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
+ ALM_ERR("parent is NULL.");
return NULL;
}
btn = elm_button_add(parent);
if (btn == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "failed to create button.");
+ ALM_ERR("failed to create button.");
return NULL;
}
@@ -1237,11 +1282,12 @@ Evas_Object *view_set_button(Evas_Object *parent, const char *part_name, const c
//1 for edit_mode
void view_create_text_popup(Evas_Object *parent, double timeout, const char *text, int id , mode_type e)
{
+ _ALM_ENTER_;
Evas_Object *popup = NULL;
Evas_Object *nf = view_get_naviframe();
int e_m = view_get_is_select_mode();
if (parent == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
+ ALM_ERR("parent is NULL.");
return ;
}
popup = elm_popup_add(parent);
@@ -1253,14 +1299,14 @@ void view_create_text_popup(Evas_Object *parent, double timeout, const char *tex
elm_object_part_text_set(popup, "elm.text", text);
evas_object_smart_callback_add(popup, "block,clicked", _block_clicked_cb, NULL);
- if(!e_m) {
- if(e != EDIT_MODE)
+ if (!e_m) {
+ if (e != EDIT_MODE)
view_send_signal_to_edje(parent, "genlist.show", "alarm");
elm_naviframe_item_pop(nf);
}
elm_popup_timeout_set(popup, 2.0);
- dlog_print(DLOG_INFO, LOG_TAG, "view_create_text_popup last alarm id %d ", id);
+ ALM_INFO("view_create_text_popup last alarm id %d ", id);
if (e == EDIT_MODE)
evas_object_smart_callback_add(popup, "timeout", _timeout_del_cb, &id);
else if (e == NORMAL_MODE)
@@ -1281,6 +1327,7 @@ void view_create_text_popup(Evas_Object *parent, double timeout, const char *tex
*/
Evas_Object *view_create_checkbox(Evas_Object *parent, const char *event, Evas_Smart_Cb cb_func, void *data)
{
+ _ALM_ENTER_;
struct genlist_item_data *gendata = data;
Evas_Object *check = NULL;
@@ -1301,6 +1348,7 @@ Evas_Object *view_create_checkbox(Evas_Object *parent, const char *event, Evas_S
*/
void view_set_content_to_part(Evas_Object *layout, const char *part_name, Evas_Object *content)
{
+ _ALM_ENTER_;
elm_object_part_content_set(layout, part_name, content);
}
@@ -1312,6 +1360,7 @@ void view_set_content_to_part(Evas_Object *layout, const char *part_name, Evas_O
*/
void view_send_signal_to_edje(Evas_Object *layout, const char *signal, const char *source)
{
+ _ALM_ENTER_;
elm_object_signal_emit(layout, signal, source);
}
@@ -1321,16 +1370,17 @@ void view_send_signal_to_edje(Evas_Object *layout, const char *signal, const cha
*/
void view_alarm_schedule_alarm(struct genlist_item_data *gendata)
{
+ _ALM_ENTER_;
app_control_h app_control;
struct tm *saved_time = NULL;
int alarm_id = 0;
if (gendata == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Failed to get gendata.");
+ ALM_ERR("Failed to get gendata.");
return;
}
saved_time = data_get_saved_time_from_gendata(gendata);
- dlog_print(DLOG_INFO, LOG_TAG, "saved time 1(%d:%d)", saved_time->tm_hour, saved_time->tm_min);
+ ALM_INFO("saved time 1(%d:%d)", saved_time->tm_hour, saved_time->tm_min);
elm_datetime_value_get(s_info.datetime, saved_time);
/*
@@ -1338,7 +1388,7 @@ void view_alarm_schedule_alarm(struct genlist_item_data *gendata)
*/
saved_time->tm_sec = 0;
- dlog_print(DLOG_INFO, LOG_TAG, "saved time (%d:%d)", saved_time->tm_hour, saved_time->tm_min);
+ ALM_INFO("saved time (%d:%d)", saved_time->tm_hour, saved_time->tm_min);
/*
* Set alarm by using alarm API.
@@ -1346,8 +1396,8 @@ void view_alarm_schedule_alarm(struct genlist_item_data *gendata)
app_control = data_get_app_control();
if (ALARM_ERROR_NONE != alarm_schedule_at_date(app_control, saved_time, 0, &alarm_id))
- dlog_print(DLOG_ERROR, LOG_TAG, "Failed at alarm_schedule_at_date(). Alarm is not set.");
- dlog_print(DLOG_INFO, LOG_TAG, "alarm ID is [%d]", alarm_id);
+ ALM_ERR("Failed at alarm_schedule_at_date(). Alarm is not set.");
+ ALM_INFO("alarm ID is [%d]", alarm_id);
/*
* Store alarm ID in gendata with the generated alarm ID.
@@ -1367,10 +1417,11 @@ void view_alarm_schedule_alarm(struct genlist_item_data *gendata)
*/
static Elm_Genlist_Item_Class *_set_genlist_item_class(const char *style)
{
+ _ALM_ENTER_;
Elm_Genlist_Item_Class *item_class = NULL;
if (style == NULL) {
- dlog_print(DLOG_ERROR, LOG_TAG, "style is NULL.");
+ ALM_ERR("style is NULL.");
return NULL;
}
@@ -1416,6 +1467,7 @@ static Elm_Genlist_Item_Class *_set_genlist_item_class(const char *style)
*/
static Evas_Object* _get_check_icon(void *data, Evas_Object *obj, const char *part)
{
+ _ALM_ENTER_;
struct genlist_item_data *gendata = data;
Evas_Object *content = NULL;
@@ -1433,6 +1485,7 @@ static Evas_Object* _get_check_icon(void *data, Evas_Object *obj, const char *pa
*/
static void _del_data(void *data, Evas_Object *obj)
{
+ _ALM_ENTER_;
data_alarm_destroy_genlist_item_data(data);
}
@@ -1444,6 +1497,7 @@ static void _del_data(void *data, Evas_Object *obj)
*/
static void _icon_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
struct genlist_item_data *gendata = data;
struct tm *saved_time = NULL;
int alarm_id = 0;
@@ -1500,7 +1554,7 @@ static void _icon_clicked_cb(void *data, Evas_Object *obj, void *event_info)
data_delete_bundle(buf);
}
- dlog_print(DLOG_INFO, LOG_TAG, "icon state is [%d], alarm ID [%d], saved time (%d:%d)", state, alarm_id, saved_time->tm_hour, saved_time->tm_min);
+ ALM_INFO("icon state is [%d], alarm ID [%d], saved time (%d:%d)", state, alarm_id, saved_time->tm_hour, saved_time->tm_min);
}
/*
@@ -1511,6 +1565,7 @@ static void _icon_clicked_cb(void *data, Evas_Object *obj, void *event_info)
*/
static void _popup_hide_finished_cb(void *data, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
if (obj == NULL)
return;
@@ -1522,24 +1577,27 @@ static void _popup_hide_finished_cb(void *data, Evas_Object *obj, void *event_in
static void _block_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
if (!obj) return;
elm_popup_dismiss(obj);
}
void _timeout_del_cb(void *data, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
if (!obj) return;
int last_alarm_id = (int)data;
- dlog_print(DLOG_INFO, LOG_TAG, " _timeout_del_cb last_alarm_id temp %ld ", last_alarm_id);
+ ALM_INFO(" _timeout_del_cb last_alarm_id temp %ld ", last_alarm_id);
elm_popup_dismiss(obj);
update_genlist(last_alarm_id , 1, 0);
}
void _timeout_cb(void *data, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
if (!obj) return;
int last_alarm_id = (int)data;
- dlog_print(DLOG_INFO, LOG_TAG, " _timeout_cb last_alarm_id temp %ld ", last_alarm_id);
+ ALM_INFO(" _timeout_cb last_alarm_id temp %ld ", last_alarm_id);
elm_popup_dismiss(obj);
update_genlist(last_alarm_id , 0, 0);
}
@@ -1552,6 +1610,7 @@ void _timeout_cb(void *data, Evas_Object *obj, void *event_info)
*/
static void _popup_hide_cb(void *data, Evas_Object *obj, void *event_info)
{
+ _ALM_ENTER_;
if (obj == NULL)
return;