/**
* @brief Main application's data structure.
*/
-typedef struct ug_data_t
-{
+typedef struct ug_data_t {
Evas_Object *win; /**< @brief Application's window.*/
Evas_Object *layout; /**< @brief Application's base layout.*/
Evas_Object *naviframe; /**< @brief Naviframe.*/
#define HAPI __attribute__((visibility("hidden")))
#define NOTISET_TRACE_BEGIN \
- LOG(LOG_DEBUG, LOG_TAG, "[ENTER]\n");
+ LOG(LOG_DEBUG, LOG_TAG, "[ENTER]\n");
#if !defined(FREEIF)
-#define FREEIF(p) ({if (p) {free(p); p = NULL; }})
+#define FREEif (p) ({if (p) {free(p); p = NULL; } })
#endif
#if !defined(EVAS_OBJECT_DELIF)
-#define EVAS_OBJECT_DELIF(p) ({if (p) {evas_object_del(p); p = NULL; }})
+#define EVAS_OBJECT_DELif (p) ({if (p) {evas_object_del(p); p = NULL; } })
#endif
#if !defined(_D)
} \
} while (0)
-#define retvm_if(expr, val, fmt, arg...) do { \
- if(expr) { \
+#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) { \
+#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) { \
+#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) { \
+#define ret_if (expr) do { \
+ if (expr) { \
_E("(%s) -> %s() return", #expr, __FUNCTION__); \
return; \
} \
} while (0)
-#define goto_if(expr, val) do { \
- if(expr) { \
+#define goto_if (expr, val) do { \
+ if (expr) { \
_E("(%s) -> goto", #expr); \
goto val; \
} \
} while (0)
-#define break_if(expr) { \
- if(expr) { \
+#define break_if (expr) { \
+ if (expr) { \
_E("(%s) -> break", #expr); \
break; \
} \
}
-#define continue_if(expr) { \
- if(expr) { \
+#define continue_if (expr) { \
+ if (expr) { \
_E("(%s) -> continue", #expr); \
continue; \
} \
#include "sys_setting.h"
typedef struct _setting_info_t {
- Eina_List *not_excepted_list;
- Eina_List *excepted_list;
- Eina_List *apps_noti_allowed_list;
- Eina_List *apps_noti_blocked_list;
- Eina_List *first_allowed_list;
- Eina_List *first_excepted_list;
- Eina_List *show_all_content_list;
- Eina_List *hide_sensitive_content_list;
- Eina_List *lower_noti_list;
+ Eina_List *not_excepted_list;
+ Eina_List *excepted_list;
+ Eina_List *apps_noti_allowed_list;
+ Eina_List *apps_noti_blocked_list;
+ Eina_List *first_allowed_list;
+ Eina_List *first_excepted_list;
+ Eina_List *show_all_content_list;
+ Eina_List *hide_sensitive_content_list;
+ Eina_List *lower_noti_list;
} setting_info_s;
/**
#include <notification_setting_internal.h>
#define PREF_PREFX "db/private/org.tizen.setting-notification/"
-#define DO_NOT_SHOW_CONTACT_POPUP_AGAIN PREF_PREFX "/do_not_show_contact_popup_again"
-#define DO_NOT_SHOW_FAVORITE_POPUP_AGAIN PREF_PREFX "/do_not_show_favorite_popup_again"
-#define DO_NOT_SHOW_NOBODY_POPUP_AGAIN PREF_PREFX "/do_not_show_nobody_popup_again"
+#define DO_NOT_SHOW_CONTACT_POPUP_AGAIN PREF_PREFX "/do_not_show_contact_popup_again"
+#define DO_NOT_SHOW_FAVORITE_POPUP_AGAIN PREF_PREFX "/do_not_show_favorite_popup_again"
+#define DO_NOT_SHOW_NOBODY_POPUP_AGAIN PREF_PREFX "/do_not_show_nobody_popup_again"
bool check_state = false;
static char *items[4] = {
- "IDS_ST_MBODY_EVERYONE_ABB",
- "IDS_CST_OPT_CONTACTS_ONLY",
- "IDS_ST_MBODY_FAVOURITE_CONTACTS_ONLY_ABB",
- "IDS_ST_MBODY_NOBODY_ABB"
+ "IDS_ST_MBODY_EVERYONE_ABB",
+ "IDS_CST_OPT_CONTACTS_ONLY",
+ "IDS_ST_MBODY_FAVOURITE_CONTACTS_ONLY_ABB",
+ "IDS_ST_MBODY_NOBODY_ABB"
};
static void set_do_not_show_contact_popup_again(bool value)
{
- preference_set_boolean(DO_NOT_SHOW_CONTACT_POPUP_AGAIN, value);
+ preference_set_boolean(DO_NOT_SHOW_CONTACT_POPUP_AGAIN, value);
}
static bool get_do_not_show_contact_popup_again()
{
- bool value = false;
- preference_get_boolean(DO_NOT_SHOW_CONTACT_POPUP_AGAIN, &value);
- return value;
+ bool value = false;
+ preference_get_boolean(DO_NOT_SHOW_CONTACT_POPUP_AGAIN, &value);
+ return value;
}
static bool is_existing_do_not_show_contact_popup_again()
{
- bool value = false;
- preference_is_existing(DO_NOT_SHOW_CONTACT_POPUP_AGAIN, &value);
- return value;
+ bool value = false;
+ preference_is_existing(DO_NOT_SHOW_CONTACT_POPUP_AGAIN, &value);
+ return value;
}
static void set_do_not_show_favorite_popup_again(bool value)
{
- preference_set_boolean(DO_NOT_SHOW_FAVORITE_POPUP_AGAIN, value);
+ preference_set_boolean(DO_NOT_SHOW_FAVORITE_POPUP_AGAIN, value);
}
static bool get_do_not_show_favorite_popup_again()
{
- bool value = false;
- preference_get_boolean(DO_NOT_SHOW_FAVORITE_POPUP_AGAIN, &value);
- return value;
+ bool value = false;
+ preference_get_boolean(DO_NOT_SHOW_FAVORITE_POPUP_AGAIN, &value);
+ return value;
}
static bool is_existing_do_not_show_favorite_popup_again()
{
- bool value = false;
- preference_is_existing(DO_NOT_SHOW_FAVORITE_POPUP_AGAIN, &value);
- return value;
+ bool value = false;
+ preference_is_existing(DO_NOT_SHOW_FAVORITE_POPUP_AGAIN, &value);
+ return value;
}
static void set_do_not_show_nobody_popup_again(bool value)
{
- preference_set_boolean(DO_NOT_SHOW_NOBODY_POPUP_AGAIN, value);
+ preference_set_boolean(DO_NOT_SHOW_NOBODY_POPUP_AGAIN, value);
}
static bool get_do_not_show_nobody_popup_again()
{
- bool value = false;
- preference_get_boolean(DO_NOT_SHOW_NOBODY_POPUP_AGAIN, &value);
- return value;
+ bool value = false;
+ preference_get_boolean(DO_NOT_SHOW_NOBODY_POPUP_AGAIN, &value);
+ return value;
}
static bool is_existing_do_not_show_nobody_popup_again()
{
- bool value = false;
- preference_is_existing(DO_NOT_SHOW_NOBODY_POPUP_AGAIN, &value);
- return value;
+ bool value = false;
+ preference_is_existing(DO_NOT_SHOW_NOBODY_POPUP_AGAIN, &value);
+ return value;
}
const char *get_allowed_calls_string()
{
- NOTISET_TRACE_BEGIN;
- int value = 0;
- notification_system_setting_get_dnd_allow_exceptions(get_system_setting(), NOTIFICATION_DND_ALLOWED_CALLS, &value);
- return items[value];
+ NOTISET_TRACE_BEGIN;
+ int value = 0;
+ notification_system_setting_get_dnd_allow_exceptions(get_system_setting(), NOTIFICATION_DND_ALLOWED_CALLS, &value);
+ return items[value];
}
static void popup_hide_cb(void *data, Evas_Object *obj, void *event_info)
{
- evas_object_del(obj);
+ evas_object_del(obj);
}
static char *gl_text_get_cb(void *data, Evas_Object *obj, const char *part)
{
- if (!strcmp(part, "elm.text")) {
- int index = (int)data;
- return strdup(APP_STRING(items[index]));
- }
- return NULL;
+ if (!strcmp(part, "elm.text")) {
+ int index = (int)data;
+ return strdup(APP_STRING(items[index]));
+ }
+ return NULL;
}
static void popup_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
- NOTISET_TRACE_BEGIN;
- Evas_Object *popup = data;
- evas_object_del(popup);
-
- if (check_state) {
- int value = 0;
- notification_system_setting_get_dnd_allow_exceptions(get_system_setting(), NOTIFICATION_DND_ALLOWED_CALLS, &value);
- if (value == NOTIFICATION_DND_ALLOWED_CALLS_CONTACT)
- set_do_not_show_contact_popup_again(false);
- else if (value == NOTIFICATION_DND_ALLOWED_CALLS_FAVORITE)
- set_do_not_show_favorite_popup_again(false);
- else
- set_do_not_show_nobody_popup_again(false);
- }
+ NOTISET_TRACE_BEGIN;
+ Evas_Object *popup = data;
+ evas_object_del(popup);
+
+ if (check_state) {
+ int value = 0;
+ notification_system_setting_get_dnd_allow_exceptions(get_system_setting(), NOTIFICATION_DND_ALLOWED_CALLS, &value);
+ if (value == NOTIFICATION_DND_ALLOWED_CALLS_CONTACT)
+ set_do_not_show_contact_popup_again(false);
+ else if (value == NOTIFICATION_DND_ALLOWED_CALLS_FAVORITE)
+ set_do_not_show_favorite_popup_again(false);
+ else
+ set_do_not_show_nobody_popup_again(false);
+ }
}
static void popup_check_item_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
- NOTISET_TRACE_BEGIN;
- check_state = elm_check_state_get(obj);
+ NOTISET_TRACE_BEGIN;
+ check_state = elm_check_state_get(obj);
}
static void update_allowed_calls_item()
{
- elm_genlist_item_update(elm_genlist_item_prev_get(elm_genlist_last_item_get(get_app_ui_data()->list_main)));
+ elm_genlist_item_update(elm_genlist_item_prev_get(elm_genlist_last_item_get(get_app_ui_data()->list_main)));
}
static void create_reject_calls_popup(const char *title_text, const char *content)
{
- Evas_Object *popup;
- Evas_Object *layout;
- Evas_Object *btn;
- Evas_Object *scroller;
- Evas_Object *label;
- Evas_Object *check;
- Evas_Object *win;
- ug_data *ug_main = get_app_ui_data();
- ret_if(ug_main == NULL);
-
- win = ug_main->win;
-
- popup = elm_popup_add(win);
- elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
- elm_object_part_text_set(popup, "title,text", APP_STRING(title_text));
- evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
- eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, popup_hide_cb, NULL);
-
- /* layout */
- layout = elm_layout_add(popup);
- char *res_path = app_get_resource_path();
- if (res_path) {
- char edj_path[PATH_MAX] = { 0, };
- snprintf(edj_path, PATH_MAX, "%s%s", res_path, "edje/reject_calls_popup.edj");
- elm_layout_file_set(layout, edj_path, "popup_checkview_layout");
- free(res_path);
- }
- evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
- /* ok button */
- btn = elm_button_add(popup);
- elm_object_style_set(btn, "bottom");
- elm_object_text_set(btn, APP_STRING("IDS_ST_BUTTON_OK_ABB6"));
- elm_object_part_content_set(popup, "button1", btn);
- evas_object_smart_callback_add(btn, "clicked", popup_btn_clicked_cb, popup);
-
- /* check */
- check = elm_check_add(popup);
- elm_object_text_set(check, APP_STRING("IDS_ST_OPT_DONT_SHOW_AGAIN_ABB"));
- elm_object_part_content_set(layout, "elm.swallow.end", check);
- evas_object_smart_callback_add(check, "changed", popup_check_item_clicked_cb, NULL);
-
- /* scroller */
- scroller = elm_scroller_add(layout);
- elm_scroller_bounce_set(scroller, EINA_TRUE, EINA_TRUE);
- elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
- elm_object_part_content_set(layout, "elm.swallow.content", scroller);
-
- /* label */
- label = elm_label_add(scroller);
- elm_object_style_set(label, "popup/default");
- elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
- elm_object_text_set(label, APP_STRING(content));
- evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
- evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_show(label);
- elm_object_content_set(scroller, label);
-
- elm_object_content_set(popup, layout);
-
- evas_object_show(popup);
+ Evas_Object *popup;
+ Evas_Object *layout;
+ Evas_Object *btn;
+ Evas_Object *scroller;
+ Evas_Object *label;
+ Evas_Object *check;
+ Evas_Object *win;
+ ug_data *ug_main = get_app_ui_data();
+ ret_if(ug_main == NULL);
+
+ win = ug_main->win;
+
+ popup = elm_popup_add(win);
+ elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+ elm_object_part_text_set(popup, "title,text", APP_STRING(title_text));
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, popup_hide_cb, NULL);
+
+ /* layout */
+ layout = elm_layout_add(popup);
+ char *res_path = app_get_resource_path();
+ if (res_path) {
+ char edj_path[PATH_MAX] = { 0, };
+ snprintf(edj_path, PATH_MAX, "%s%s", res_path, "edje/reject_calls_popup.edj");
+ elm_layout_file_set(layout, edj_path, "popup_checkview_layout");
+ free(res_path);
+ }
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ /* ok button */
+ btn = elm_button_add(popup);
+ elm_object_style_set(btn, "bottom");
+ elm_object_text_set(btn, APP_STRING("IDS_ST_BUTTON_OK_ABB6"));
+ elm_object_part_content_set(popup, "button1", btn);
+ evas_object_smart_callback_add(btn, "clicked", popup_btn_clicked_cb, popup);
+
+ /* check */
+ check = elm_check_add(popup);
+ elm_object_text_set(check, APP_STRING("IDS_ST_OPT_DONT_SHOW_AGAIN_ABB"));
+ elm_object_part_content_set(layout, "elm.swallow.end", check);
+ evas_object_smart_callback_add(check, "changed", popup_check_item_clicked_cb, NULL);
+
+ /* scroller */
+ scroller = elm_scroller_add(layout);
+ elm_scroller_bounce_set(scroller, EINA_TRUE, EINA_TRUE);
+ elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ elm_object_part_content_set(layout, "elm.swallow.content", scroller);
+
+ /* label */
+ label = elm_label_add(scroller);
+ elm_object_style_set(label, "popup/default");
+ elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
+ elm_object_text_set(label, APP_STRING(content));
+ evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(label);
+ elm_object_content_set(scroller, label);
+
+ elm_object_content_set(popup, layout);
+
+ evas_object_show(popup);
}
static void everyone_item_clicked()
{
- NOTISET_TRACE_BEGIN;
- notification_system_setting_set_dnd_allow_exceptions(get_system_setting(), NOTIFICATION_DND_ALLOWED_CALLS, NOTIFICATION_DND_ALLOWED_CALLS_EVERYONE);
- update_allowed_calls_item();
+ NOTISET_TRACE_BEGIN;
+ notification_system_setting_set_dnd_allow_exceptions(get_system_setting(), NOTIFICATION_DND_ALLOWED_CALLS, NOTIFICATION_DND_ALLOWED_CALLS_EVERYONE);
+ update_allowed_calls_item();
}
static void contacts_only_clicked()
{
- NOTISET_TRACE_BEGIN;
+ NOTISET_TRACE_BEGIN;
- notification_system_setting_set_dnd_allow_exceptions(get_system_setting(), NOTIFICATION_DND_ALLOWED_CALLS, NOTIFICATION_DND_ALLOWED_CALLS_CONTACT);
- update_allowed_calls_item();
+ notification_system_setting_set_dnd_allow_exceptions(get_system_setting(), NOTIFICATION_DND_ALLOWED_CALLS, NOTIFICATION_DND_ALLOWED_CALLS_CONTACT);
+ update_allowed_calls_item();
- if (!is_existing_do_not_show_contact_popup_again())
- set_do_not_show_contact_popup_again(true);
+ if (!is_existing_do_not_show_contact_popup_again())
+ set_do_not_show_contact_popup_again(true);
- if (get_do_not_show_contact_popup_again())
- create_reject_calls_popup("IDS_ST_HEADER_REJECT_CALLS_ABB2",
- "IDS_ST_BODY_INCOMING_CALLS_FROM_CONTACTS_YOU_HAVE_NOT_ALLOWED_WILL_BE_REJECTED_AUTOMATICALLY");
+ if (get_do_not_show_contact_popup_again())
+ create_reject_calls_popup("IDS_ST_HEADER_REJECT_CALLS_ABB2",
+ "IDS_ST_BODY_INCOMING_CALLS_FROM_CONTACTS_YOU_HAVE_NOT_ALLOWED_WILL_BE_REJECTED_AUTOMATICALLY");
}
static void favorite_contacts_only_clicked()
{
- NOTISET_TRACE_BEGIN;
+ NOTISET_TRACE_BEGIN;
- notification_system_setting_set_dnd_allow_exceptions(get_system_setting(), NOTIFICATION_DND_ALLOWED_CALLS, NOTIFICATION_DND_ALLOWED_CALLS_FAVORITE);
- update_allowed_calls_item();
+ notification_system_setting_set_dnd_allow_exceptions(get_system_setting(), NOTIFICATION_DND_ALLOWED_CALLS, NOTIFICATION_DND_ALLOWED_CALLS_FAVORITE);
+ update_allowed_calls_item();
- if (!is_existing_do_not_show_favorite_popup_again())
- set_do_not_show_favorite_popup_again(true);
+ if (!is_existing_do_not_show_favorite_popup_again())
+ set_do_not_show_favorite_popup_again(true);
- if (get_do_not_show_favorite_popup_again())
- create_reject_calls_popup("IDS_ST_HEADER_REJECT_CALLS_ABB2",
- "IDS_ST_BODY_INCOMING_CALLS_FROM_CONTACTS_YOU_HAVE_NOT_ALLOWED_WILL_BE_REJECTED_AUTOMATICALLY");
+ if (get_do_not_show_favorite_popup_again())
+ create_reject_calls_popup("IDS_ST_HEADER_REJECT_CALLS_ABB2",
+ "IDS_ST_BODY_INCOMING_CALLS_FROM_CONTACTS_YOU_HAVE_NOT_ALLOWED_WILL_BE_REJECTED_AUTOMATICALLY");
}
static void nobody_item_clicked()
{
- NOTISET_TRACE_BEGIN;
+ NOTISET_TRACE_BEGIN;
- notification_system_setting_set_dnd_allow_exceptions(get_system_setting(), NOTIFICATION_DND_ALLOWED_CALLS, NOTIFICATION_DND_ALLOWED_CALLS_NOBODY);
- update_allowed_calls_item();
+ notification_system_setting_set_dnd_allow_exceptions(get_system_setting(), NOTIFICATION_DND_ALLOWED_CALLS, NOTIFICATION_DND_ALLOWED_CALLS_NOBODY);
+ update_allowed_calls_item();
- if (!is_existing_do_not_show_nobody_popup_again())
- set_do_not_show_nobody_popup_again(true);
+ if (!is_existing_do_not_show_nobody_popup_again())
+ set_do_not_show_nobody_popup_again(true);
- if (get_do_not_show_nobody_popup_again())
- create_reject_calls_popup("IDS_ST_HEADER_REJECT_ALL_CALLS_ABB", "IDS_ST_POP_ALL_INCOMING_CALLS_WILL_BE_REJECTED_AUTOMATICALLY");
+ if (get_do_not_show_nobody_popup_again())
+ create_reject_calls_popup("IDS_ST_HEADER_REJECT_ALL_CALLS_ABB", "IDS_ST_POP_ALL_INCOMING_CALLS_WILL_BE_REJECTED_AUTOMATICALLY");
}
static void gl_sel_cb(void *data, Evas_Object *obj, void *event_info)
{
- Evas_Object *popup = data;
- int index = 0;
- Elm_Object_Item *item = event_info;
-
- index = (int)elm_object_item_data_get(item);
- switch (index) {
- case 0:
- everyone_item_clicked();
- break;
- case 1:
- contacts_only_clicked();
- break;
- case 2:
- favorite_contacts_only_clicked();
- break;
- case 3:
- nobody_item_clicked();
- break;
- }
- update_system_settings();
- evas_object_del(popup);
+ Evas_Object *popup = data;
+ int index = 0;
+ Elm_Object_Item *item = event_info;
+
+ index = (int)elm_object_item_data_get(item);
+ switch (index) {
+ case 0:
+ everyone_item_clicked();
+ break;
+ case 1:
+ contacts_only_clicked();
+ break;
+ case 2:
+ favorite_contacts_only_clicked();
+ break;
+ case 3:
+ nobody_item_clicked();
+ break;
+ }
+ update_system_settings();
+ evas_object_del(popup);
}
static void create_allow_calls_from_popup()
{
- NOTISET_TRACE_BEGIN;
- static Elm_Genlist_Item_Class itc;
- Evas_Object *popup;
- Evas_Object *box;
- Evas_Object *genlist;
- int i;
- Evas_Object *win;
- ug_data *ug_main = get_app_ui_data();
- ret_if(ug_main == NULL);
-
- win = ug_main->win;
-
- popup = elm_popup_add(win);
- elm_popup_orient_set(popup, ELM_POPUP_ORIENT_BOTTOM);
- elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
- elm_object_part_text_set(popup, "title,text", APP_STRING("IDS_ST_HEADER_ALLOW_CALLS_FROM_ABB"));
- evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(popup, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
- eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, popup_hide_cb, NULL);
- evas_object_smart_callback_add(popup, "dismissed", popup_hide_cb, NULL);
- evas_object_smart_callback_add(popup, "block,clicked", popup_hide_cb, NULL);
-
- /* box */
- box = elm_box_add(popup);
- elm_box_homogeneous_set(box, EINA_FALSE);
- evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_show(box);
- elm_object_content_set(popup, box);
-
- /* genlist */
- genlist = elm_genlist_add(box);
-
- itc.item_style = "type1";
- itc.func.text_get = gl_text_get_cb;
- itc.func.content_get = NULL;
- itc.func.state_get = NULL;
- itc.func.del = NULL;
-
- for (i = 0; i < 4; i++) {
- elm_genlist_item_append(genlist, &itc, (void *)i, NULL, ELM_GENLIST_ITEM_NONE, gl_sel_cb, popup);
- }
-
- evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_genlist_mode_set(genlist, ELM_LIST_EXPAND);
- evas_object_show(genlist);
- elm_box_pack_end(box, genlist);
-
- evas_object_show(popup);
+ NOTISET_TRACE_BEGIN;
+ static Elm_Genlist_Item_Class itc;
+ Evas_Object *popup;
+ Evas_Object *box;
+ Evas_Object *genlist;
+ int i;
+ Evas_Object *win;
+ ug_data *ug_main = get_app_ui_data();
+ ret_if(ug_main == NULL);
+
+ win = ug_main->win;
+
+ popup = elm_popup_add(win);
+ elm_popup_orient_set(popup, ELM_POPUP_ORIENT_BOTTOM);
+ elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+ elm_object_part_text_set(popup, "title,text", APP_STRING("IDS_ST_HEADER_ALLOW_CALLS_FROM_ABB"));
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(popup, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, popup_hide_cb, NULL);
+ evas_object_smart_callback_add(popup, "dismissed", popup_hide_cb, NULL);
+ evas_object_smart_callback_add(popup, "block,clicked", popup_hide_cb, NULL);
+
+ /* box */
+ box = elm_box_add(popup);
+ elm_box_homogeneous_set(box, EINA_FALSE);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(box);
+ elm_object_content_set(popup, box);
+
+ /* genlist */
+ genlist = elm_genlist_add(box);
+
+ itc.item_style = "type1";
+ itc.func.text_get = gl_text_get_cb;
+ itc.func.content_get = NULL;
+ itc.func.state_get = NULL;
+ itc.func.del = NULL;
+
+ for (i = 0; i < 4; i++) {
+ elm_genlist_item_append(genlist, &itc, (void *)i, NULL, ELM_GENLIST_ITEM_NONE, gl_sel_cb, popup);
+ }
+
+ evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_genlist_mode_set(genlist, ELM_LIST_EXPAND);
+ evas_object_show(genlist);
+ elm_box_pack_end(box, genlist);
+
+ evas_object_show(popup);
}
void gl_allowed_calls_selected()
{
- create_allow_calls_from_popup();
+ create_allow_calls_from_popup();
}
#define AMOUNT_OF_CONTENT_ITEMS 3
typedef enum {
- APP_DETAILS_ALLOW_NOTI = 1,
- APP_DETAILS_GROUP_INDEX,
- APP_DETAILS_POPUP_NOTI,
- APP_DETAILS_APP_BADGE,
- APP_DETAILS_NOTI_ON_LOCK,
- APP_DETAILS_MAX
+ APP_DETAILS_ALLOW_NOTI = 1,
+ APP_DETAILS_GROUP_INDEX,
+ APP_DETAILS_POPUP_NOTI,
+ APP_DETAILS_APP_BADGE,
+ APP_DETAILS_NOTI_ON_LOCK,
+ APP_DETAILS_MAX
} App_Details_Items;
item_info_s *g_app_info = NULL;
Evas_Object *g_app_notification_genlist = NULL;
static char *items[AMOUNT_OF_CONTENT_ITEMS] = {
- "IDS_QP_OPT_SHOW_ALL_CONTENT_ABB",
- "IDS_QP_OPT_HIDE_SENSITIVE_CONTENT_ABB",
- "IDS_QP_OPT_DONT_SHOW_NOTIFICATIONS_ABB"
+ "IDS_QP_OPT_SHOW_ALL_CONTENT_ABB",
+ "IDS_QP_OPT_HIDE_SENSITIVE_CONTENT_ABB",
+ "IDS_QP_OPT_DONT_SHOW_NOTIFICATIONS_ABB"
};
static void close_app_details_cb(void *data, Evas_Object *obj, void *event_info)
{
- NOTISET_TRACE_BEGIN;
- ret_if(!data);
- elm_naviframe_item_pop(data);
+ NOTISET_TRACE_BEGIN;
+ ret_if(!data);
+ elm_naviframe_item_pop(data);
}
static Eina_Bool allow_noti_status_get()
{
- return get_allow_to_nofity(g_app_info->appid);
+ return get_allow_to_nofity(g_app_info->appid);
}
static void allow_noti_status_set(Eina_Bool value)
{
- set_allow_to_nofity(g_app_info->appid, value);
+ set_allow_to_nofity(g_app_info->appid, value);
}
static void allow_noti_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
{
- Eina_Bool state = elm_check_state_get(obj);
- allow_noti_status_set(state);
+ Eina_Bool state = elm_check_state_get(obj);
+ allow_noti_status_set(state);
}
static Eina_Bool popup_noti_status_get()
{
- NOTISET_TRACE_BEGIN;
+ NOTISET_TRACE_BEGIN;
- bool state = false;
- notification_setting_h setting = NULL;
+ bool state = false;
+ notification_setting_h setting = NULL;
- int err = notification_setting_get_setting_by_package_name(g_app_info->appid, &setting);
- if (err != NOTIFICATION_ERROR_NONE) {
- NOTISET_ERR("notification_setting_get_setting_by_package_name [%d]\n", err);
- } else if (setting == NULL) {
- NOTISET_ERR("Notification setting is NULL\n");
- } else {
- notification_setting_get_pop_up_notification(setting, &state);
- NOTISET_DBG("notification_setting_get_pop_up_notification [%d]\n", state);
- }
+ int err = notification_setting_get_setting_by_package_name(g_app_info->appid, &setting);
+ if (err != NOTIFICATION_ERROR_NONE) {
+ NOTISET_ERR("notification_setting_get_setting_by_package_name [%d]\n", err);
+ } else if (setting == NULL) {
+ NOTISET_ERR("Notification setting is NULL\n");
+ } else {
+ notification_setting_get_pop_up_notification(setting, &state);
+ NOTISET_DBG("notification_setting_get_pop_up_notification [%d]\n", state);
+ }
- if (setting)
- notification_setting_free_notification(setting);
+ if (setting)
+ notification_setting_free_notification(setting);
- return state;
+ return state;
}
static void popup_noti_status_set(Eina_Bool value)
{
- NOTISET_TRACE_BEGIN;
- notification_setting_h setting = NULL;
-
- int err = notification_setting_get_setting_by_package_name(g_app_info->appid, &setting);
- if (err != NOTIFICATION_ERROR_NONE) {
- NOTISET_ERR("notification_setting_get_setting_by_package_name [%d]\n", err);
- } else if (setting == NULL) {
- NOTISET_ERR("Notification setting is NULL\n");
- } else {
- notification_setting_set_pop_up_notification(setting, value);
- NOTISET_DBG("notification_setting_set_pop_up_notification [%d]\n", value);
-
- err = notification_setting_update_setting(setting);
- if (err != NOTIFICATION_ERROR_NONE)
- NOTISET_ERR("notification_setting_update_setting err[%d]\n", err);
- }
-
- if (setting)
- notification_setting_free_notification(setting);
+ NOTISET_TRACE_BEGIN;
+ notification_setting_h setting = NULL;
+
+ int err = notification_setting_get_setting_by_package_name(g_app_info->appid, &setting);
+ if (err != NOTIFICATION_ERROR_NONE) {
+ NOTISET_ERR("notification_setting_get_setting_by_package_name [%d]\n", err);
+ } else if (setting == NULL) {
+ NOTISET_ERR("Notification setting is NULL\n");
+ } else {
+ notification_setting_set_pop_up_notification(setting, value);
+ NOTISET_DBG("notification_setting_set_pop_up_notification [%d]\n", value);
+
+ err = notification_setting_update_setting(setting);
+ if (err != NOTIFICATION_ERROR_NONE)
+ NOTISET_ERR("notification_setting_update_setting err[%d]\n", err);
+ }
+
+ if (setting)
+ notification_setting_free_notification(setting);
}
static void popup_noti_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
{
- Eina_Bool state = elm_check_state_get(obj);
- popup_noti_status_set(state);
+ Eina_Bool state = elm_check_state_get(obj);
+ popup_noti_status_set(state);
}
static Eina_Bool app_badge_status_get()
{
- unsigned int value = EINA_TRUE;
- badge_get_display(g_app_info->appid, &value);
- return value;
+ unsigned int value = EINA_TRUE;
+ badge_get_display(g_app_info->appid, &value);
+ return value;
}
static void app_badge_status_set(Eina_Bool value)
{
- badge_set_display(g_app_info->appid, value);
+ badge_set_display(g_app_info->appid, value);
}
static void app_badge_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
{
- Eina_Bool state = elm_check_state_get(obj);
- app_badge_status_set(state);
+ Eina_Bool state = elm_check_state_get(obj);
+ app_badge_status_set(state);
}
static int noti_on_lock_screen_status_get()
{
- NOTISET_TRACE_BEGIN;
+ NOTISET_TRACE_BEGIN;
- lock_screen_content_level_e level = SHOW_ALL_CONTENT;
- notification_setting_h setting = NULL;
+ lock_screen_content_level_e level = SHOW_ALL_CONTENT;
+ notification_setting_h setting = NULL;
- int err = notification_setting_get_setting_by_package_name(g_app_info->appid, &setting);
- if (err != NOTIFICATION_ERROR_NONE) {
- NOTISET_ERR("notification_setting_get_setting_by_package_name [%d]\n", err);
- } else if (setting == NULL) {
- NOTISET_ERR("Notification setting is NULL\n");
- } else {
- notification_setting_get_lock_screen_content(setting, &level);
- NOTISET_DBG("notification_setting_get_lock_screen_content [%d]\n", level);
- }
+ int err = notification_setting_get_setting_by_package_name(g_app_info->appid, &setting);
+ if (err != NOTIFICATION_ERROR_NONE) {
+ NOTISET_ERR("notification_setting_get_setting_by_package_name [%d]\n", err);
+ } else if (setting == NULL) {
+ NOTISET_ERR("Notification setting is NULL\n");
+ } else {
+ notification_setting_get_lock_screen_content(setting, &level);
+ NOTISET_DBG("notification_setting_get_lock_screen_content [%d]\n", level);
+ }
- if (setting)
- notification_setting_free_notification(setting);
+ if (setting)
+ notification_setting_free_notification(setting);
- return level;
+ return level;
}
static char *app_details_gl_text_get_cb(void *data, Evas_Object *obj, const char *part)
{
- retv_if(!data, NULL);
- App_Details_Items item = (App_Details_Items)data;
-
- switch (item) {
- case APP_DETAILS_ALLOW_NOTI:
- if (!strcmp(part, "elm.text")) {
- return strdup(APP_STRING("IDS_ST_MBODY_ALLOW_NOTIFICATIONS"));
- }
- break;
- case APP_DETAILS_GROUP_INDEX:
- if (!strcmp(part, "elm.text")) {
- return strdup(APP_STRING("IDS_ST_HEADER_ADVANCED_SETTINGS_ABB2"));
- }
- break;
- case APP_DETAILS_POPUP_NOTI:
- if (!strcmp(part, "elm.text")) {
- return strdup(APP_STRING("IDS_ST_MBODY_POP_UP_NOTIFICATIONS_ABB"));
- } else if (!strcmp(part, "elm.text.multiline")) {
- return strdup(APP_STRING("IDS_ST_SBODY_SHOW_POP_UP_NOTIFICATIONS_AT_THE_TOP_OF_THE_SCREEN"));
- }
- break;
- case APP_DETAILS_APP_BADGE:
- if (!strcmp(part, "elm.text")) {
- return strdup(APP_STRING("IDS_ST_MBODY_APP_BADGES_ABB"));
- } else if (!strcmp(part, "elm.text.sub")) {
- return strdup(APP_STRING("IDS_ST_SBODY_SHOW_BADGES_ON_THE_APP_ICON"));
- }
- break;
- case APP_DETAILS_NOTI_ON_LOCK:
- if (!strcmp(part, "elm.text")) {
- return strdup(APP_STRING("IDS_QP_TMBODY_NOTIFICATIONS_ON_LOCK_SCREEN"));
- } else if (!strcmp(part, "elm.text.sub")) {
- int level = noti_on_lock_screen_status_get();
- if (level == SHOW_ALL_CONTENT)
- return strdup(APP_STRING("IDS_QP_OPT_SHOW_ALL_CONTENT_ABB"));
- else if (level == HIDE_SENSITIVE_CONTENT)
- return strdup(APP_STRING("IDS_QP_OPT_HIDE_SENSITIVE_CONTENT_ABB"));
- else if (level == DO_NOT_SHOW_NOTIFICATIONS)
- return strdup(APP_STRING("IDS_QP_OPT_DONT_SHOW_NOTIFICATIONS_ABB"));
- }
- break;
- default:
- NOTISET_ERR("Wrong App_Details_Items value used");
- break;
- }
- return NULL;
+ retv_if(!data, NULL);
+ App_Details_Items item = (App_Details_Items)data;
+
+ switch (item) {
+ case APP_DETAILS_ALLOW_NOTI:
+ if (!strcmp(part, "elm.text")) {
+ return strdup(APP_STRING("IDS_ST_MBODY_ALLOW_NOTIFICATIONS"));
+ }
+ break;
+ case APP_DETAILS_GROUP_INDEX:
+ if (!strcmp(part, "elm.text")) {
+ return strdup(APP_STRING("IDS_ST_HEADER_ADVANCED_SETTINGS_ABB2"));
+ }
+ break;
+ case APP_DETAILS_POPUP_NOTI:
+ if (!strcmp(part, "elm.text")) {
+ return strdup(APP_STRING("IDS_ST_MBODY_POP_UP_NOTIFICATIONS_ABB"));
+ } else if (!strcmp(part, "elm.text.multiline")) {
+ return strdup(APP_STRING("IDS_ST_SBODY_SHOW_POP_UP_NOTIFICATIONS_AT_THE_TOP_OF_THE_SCREEN"));
+ }
+ break;
+ case APP_DETAILS_APP_BADGE:
+ if (!strcmp(part, "elm.text")) {
+ return strdup(APP_STRING("IDS_ST_MBODY_APP_BADGES_ABB"));
+ } else if (!strcmp(part, "elm.text.sub")) {
+ return strdup(APP_STRING("IDS_ST_SBODY_SHOW_BADGES_ON_THE_APP_ICON"));
+ }
+ break;
+ case APP_DETAILS_NOTI_ON_LOCK:
+ if (!strcmp(part, "elm.text")) {
+ return strdup(APP_STRING("IDS_QP_TMBODY_NOTIFICATIONS_ON_LOCK_SCREEN"));
+ } else if (!strcmp(part, "elm.text.sub")) {
+ int level = noti_on_lock_screen_status_get();
+ if (level == SHOW_ALL_CONTENT)
+ return strdup(APP_STRING("IDS_QP_OPT_SHOW_ALL_CONTENT_ABB"));
+ else if (level == HIDE_SENSITIVE_CONTENT)
+ return strdup(APP_STRING("IDS_QP_OPT_HIDE_SENSITIVE_CONTENT_ABB"));
+ else if (level == DO_NOT_SHOW_NOTIFICATIONS)
+ return strdup(APP_STRING("IDS_QP_OPT_DONT_SHOW_NOTIFICATIONS_ABB"));
+ }
+ break;
+ default:
+ NOTISET_ERR("Wrong App_Details_Items value used");
+ break;
+ }
+ return NULL;
}
static Evas_Object *app_details_gl_content_get_cb(void *data, Evas_Object *obj, const char *part)
{
- Evas_Object *check = NULL;
- retv_if(!data, NULL);
- App_Details_Items item = (App_Details_Items)data;
-
- switch (item) {
- case APP_DETAILS_ALLOW_NOTI:
- if (!strcmp(part, "elm.swallow.end")) {
- check = create_on_off_check(obj);
- elm_check_state_set(check, allow_noti_status_get());
- evas_object_smart_callback_add(check, "changed", allow_noti_check_changed_cb, NULL);
- return check;
- } else if (!strcmp(part, "elm.swallow.icon")) {
- return create_icon(obj, g_app_info->icon);
- }
- break;
- case APP_DETAILS_POPUP_NOTI:
- if (!strcmp(part, "elm.swallow.end")) {
- check = create_on_off_check(obj);
- elm_check_state_set(check, popup_noti_status_get());
- evas_object_smart_callback_add(check, "changed", popup_noti_check_changed_cb, NULL);
- return check;
- }
- break;
- case APP_DETAILS_APP_BADGE:
- if (!strcmp(part, "elm.swallow.end")) {
- check = create_on_off_check(obj);
- elm_check_state_set(check, app_badge_status_get());
- evas_object_smart_callback_add(check, "changed", app_badge_check_changed_cb, NULL);
- return check;
- }
- break;
- default:
- NOTISET_ERR("Wrong App_Details_Items value used");
- break;
- }
- return NULL;
+ Evas_Object *check = NULL;
+ retv_if(!data, NULL);
+ App_Details_Items item = (App_Details_Items)data;
+
+ switch (item) {
+ case APP_DETAILS_ALLOW_NOTI:
+ if (!strcmp(part, "elm.swallow.end")) {
+ check = create_on_off_check(obj);
+ elm_check_state_set(check, allow_noti_status_get());
+ evas_object_smart_callback_add(check, "changed", allow_noti_check_changed_cb, NULL);
+ return check;
+ } else if (!strcmp(part, "elm.swallow.icon")) {
+ return create_icon(obj, g_app_info->icon);
+ }
+ break;
+ case APP_DETAILS_POPUP_NOTI:
+ if (!strcmp(part, "elm.swallow.end")) {
+ check = create_on_off_check(obj);
+ elm_check_state_set(check, popup_noti_status_get());
+ evas_object_smart_callback_add(check, "changed", popup_noti_check_changed_cb, NULL);
+ return check;
+ }
+ break;
+ case APP_DETAILS_APP_BADGE:
+ if (!strcmp(part, "elm.swallow.end")) {
+ check = create_on_off_check(obj);
+ elm_check_state_set(check, app_badge_status_get());
+ evas_object_smart_callback_add(check, "changed", app_badge_check_changed_cb, NULL);
+ return check;
+ }
+ break;
+ default:
+ NOTISET_ERR("Wrong App_Details_Items value used");
+ break;
+ }
+ return NULL;
}
static void app_details_gl_del_cb(void *data, Evas_Object *obj EINA_UNUSED)
static void popup_hide_cb(void *data, Evas_Object *obj, void *event_info)
{
- evas_object_del(obj);
+ evas_object_del(obj);
}
static char *gl_text_get_cb(void *data, Evas_Object *obj, const char *part)
{
- if (!strcmp(part, "elm.text")) {
- int index = (int)data;
- return strdup(APP_STRING(items[index]));
- }
- return NULL;
+ if (!strcmp(part, "elm.text")) {
+ int index = (int)data;
+ return strdup(APP_STRING(items[index]));
+ }
+ return NULL;
}
static Evas_Object *gl_content_get_cb(void *data, Evas_Object *obj, const char *part)
{
- if (!strcmp(part, "elm.swallow.end")) {
- int index = (int)data;
- Evas_Object *radio = NULL;
- Evas_Object *radio_main = evas_object_data_get(obj, "radio");
- radio = elm_radio_add(obj);
- elm_radio_group_add(radio, radio_main);
- elm_radio_state_value_set(radio, index);
- evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL);
- return radio;
- }
-
- return NULL;
+ if (!strcmp(part, "elm.swallow.end")) {
+ int index = (int)data;
+ Evas_Object *radio = NULL;
+ Evas_Object *radio_main = evas_object_data_get(obj, "radio");
+ radio = elm_radio_add(obj);
+ elm_radio_group_add(radio, radio_main);
+ elm_radio_state_value_set(radio, index);
+ evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ return radio;
+ }
+
+ return NULL;
}
static void gl_radio_sel_cb(void *data, Evas_Object *obj, void *event_info)
{
- NOTISET_TRACE_BEGIN;
-
- notification_setting_h setting = NULL;
- lock_screen_content_level_e level = SHOW_ALL_CONTENT;
- Elm_Object_Item *it = event_info;
-
- Evas_Object *radio = NULL;
-
- elm_genlist_item_selected_set(it, EINA_FALSE);
- radio = elm_object_item_part_content_get(it, "elm.swallow.end");
- int index = (int)elm_object_item_data_get(it);
- elm_radio_value_set(radio, index);
-
- int err = notification_setting_get_setting_by_package_name(g_app_info->appid, &setting);
- if (err != NOTIFICATION_ERROR_NONE) {
- NOTISET_ERR("notification_setting_get_setting_by_package_name [%d]\n", err);
- } else if (setting == NULL) {
- NOTISET_ERR("Notification setting is NULL\n");
- } else {
- switch (index) {
- case 0:
- level = SHOW_ALL_CONTENT;
- break;
- case 1:
- level = HIDE_SENSITIVE_CONTENT;
- break;
- case 2:
- level = DO_NOT_SHOW_NOTIFICATIONS;
- break;
- default:
- NOTISET_ERR("Incorrect index");
- break;
- }
-
- notification_setting_set_lock_screen_content(setting, level);
- NOTISET_DBG("notification_setting_set_lock_screen_content [%d]\n", level);
-
- err = notification_setting_update_setting(setting);
- if (err != NOTIFICATION_ERROR_NONE)
- NOTISET_ERR("notification_setting_update_setting err[%d]\n", err);
- }
-
- if (setting)
- notification_setting_free_notification(setting);
-
- elm_genlist_item_update(elm_genlist_last_item_get(get_app_ui_data()->list_sub));
- evas_object_del(data);
+ NOTISET_TRACE_BEGIN;
+
+ notification_setting_h setting = NULL;
+ lock_screen_content_level_e level = SHOW_ALL_CONTENT;
+ Elm_Object_Item *it = event_info;
+
+ Evas_Object *radio = NULL;
+
+ elm_genlist_item_selected_set(it, EINA_FALSE);
+ radio = elm_object_item_part_content_get(it, "elm.swallow.end");
+ int index = (int)elm_object_item_data_get(it);
+ elm_radio_value_set(radio, index);
+
+ int err = notification_setting_get_setting_by_package_name(g_app_info->appid, &setting);
+ if (err != NOTIFICATION_ERROR_NONE) {
+ NOTISET_ERR("notification_setting_get_setting_by_package_name [%d]\n", err);
+ } else if (setting == NULL) {
+ NOTISET_ERR("Notification setting is NULL\n");
+ } else {
+ switch (index) {
+ case 0:
+ level = SHOW_ALL_CONTENT;
+ break;
+ case 1:
+ level = HIDE_SENSITIVE_CONTENT;
+ break;
+ case 2:
+ level = DO_NOT_SHOW_NOTIFICATIONS;
+ break;
+ default:
+ NOTISET_ERR("Incorrect index");
+ break;
+ }
+
+ notification_setting_set_lock_screen_content(setting, level);
+ NOTISET_DBG("notification_setting_set_lock_screen_content [%d]\n", level);
+
+ err = notification_setting_update_setting(setting);
+ if (err != NOTIFICATION_ERROR_NONE)
+ NOTISET_ERR("notification_setting_update_setting err[%d]\n", err);
+ }
+
+ if (setting)
+ notification_setting_free_notification(setting);
+
+ elm_genlist_item_update(elm_genlist_last_item_get(get_app_ui_data()->list_sub));
+ evas_object_del(data);
}
static void show_noti_on_lock_popup()
{
- NOTISET_TRACE_BEGIN;
- static Elm_Genlist_Item_Class itc;
- Evas_Object *popup = NULL;
- Evas_Object *genlist = NULL;
- ug_data *ug_main = get_app_ui_data();
- ret_if(ug_main == NULL);
-
- popup = elm_popup_add(ug_main->win);
- elm_popup_orient_set(popup, ELM_POPUP_ORIENT_BOTTOM);
- elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
- elm_object_part_text_set(popup, "title,text", APP_STRING("IDS_QP_TMBODY_NOTIFICATIONS_ON_LOCK_SCREEN"));
- evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(popup, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
- eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, popup_hide_cb, NULL);
- evas_object_smart_callback_add(popup, "dismissed", popup_hide_cb, NULL);
- evas_object_smart_callback_add(popup, "block,clicked", popup_hide_cb, NULL);
-
- /* genlist */
- genlist = elm_genlist_add(popup);
- elm_scroller_content_min_limit(genlist, EINA_FALSE, EINA_TRUE);
- elm_object_content_set(popup, genlist);
-
- Evas_Object *radio = elm_radio_add(genlist);
- evas_object_data_set(genlist, "radio", radio);
-
- itc.item_style = "type1";
- itc.func.text_get = gl_text_get_cb;
- itc.func.content_get = gl_content_get_cb;
- itc.func.state_get = NULL;
- itc.func.del = NULL;
-
- int i = 0;
- for (; i < AMOUNT_OF_CONTENT_ITEMS; i++) {
- elm_genlist_item_append(genlist, &itc, (void *)i, NULL, ELM_GENLIST_ITEM_NONE, gl_radio_sel_cb, popup);
- }
-
- evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_genlist_mode_set(genlist, ELM_LIST_EXPAND);
- evas_object_show(genlist);
-
- int index = noti_on_lock_screen_status_get();
- elm_radio_value_set(radio, index);
-
- evas_object_show(popup);
+ NOTISET_TRACE_BEGIN;
+ static Elm_Genlist_Item_Class itc;
+ Evas_Object *popup = NULL;
+ Evas_Object *genlist = NULL;
+ ug_data *ug_main = get_app_ui_data();
+ ret_if(ug_main == NULL);
+
+ popup = elm_popup_add(ug_main->win);
+ elm_popup_orient_set(popup, ELM_POPUP_ORIENT_BOTTOM);
+ elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+ elm_object_part_text_set(popup, "title,text", APP_STRING("IDS_QP_TMBODY_NOTIFICATIONS_ON_LOCK_SCREEN"));
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(popup, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, popup_hide_cb, NULL);
+ evas_object_smart_callback_add(popup, "dismissed", popup_hide_cb, NULL);
+ evas_object_smart_callback_add(popup, "block,clicked", popup_hide_cb, NULL);
+
+ /* genlist */
+ genlist = elm_genlist_add(popup);
+ elm_scroller_content_min_limit(genlist, EINA_FALSE, EINA_TRUE);
+ elm_object_content_set(popup, genlist);
+
+ Evas_Object *radio = elm_radio_add(genlist);
+ evas_object_data_set(genlist, "radio", radio);
+
+ itc.item_style = "type1";
+ itc.func.text_get = gl_text_get_cb;
+ itc.func.content_get = gl_content_get_cb;
+ itc.func.state_get = NULL;
+ itc.func.del = NULL;
+
+ int i = 0;
+ for (; i < AMOUNT_OF_CONTENT_ITEMS; i++) {
+ elm_genlist_item_append(genlist, &itc, (void *)i, NULL, ELM_GENLIST_ITEM_NONE, gl_radio_sel_cb, popup);
+ }
+
+ evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_genlist_mode_set(genlist, ELM_LIST_EXPAND);
+ evas_object_show(genlist);
+
+ int index = noti_on_lock_screen_status_get();
+ elm_radio_value_set(radio, index);
+
+ evas_object_show(popup);
}
static void app_details_gl_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
{
- App_Details_Items detail = (App_Details_Items)data;
+ App_Details_Items detail = (App_Details_Items)data;
- Elm_Object_Item *it = (Elm_Object_Item *)event_info;
- elm_genlist_item_selected_set(it, EINA_FALSE);
+ Elm_Object_Item *it = (Elm_Object_Item *)event_info;
+ elm_genlist_item_selected_set(it, EINA_FALSE);
- if (detail == APP_DETAILS_NOTI_ON_LOCK) {
- show_noti_on_lock_popup();
- return;
- }
+ if (detail == APP_DETAILS_NOTI_ON_LOCK) {
+ show_noti_on_lock_popup();
+ return;
+ }
- Evas_Object *check = elm_object_item_part_content_get(it, "elm.swallow.end");
- if (check) {
- elm_check_state_set(check, !elm_check_state_get(check));
- evas_object_smart_callback_call(check, "changed", NULL);
- }
+ Evas_Object *check = elm_object_item_part_content_get(it, "elm.swallow.end");
+ if (check) {
+ elm_check_state_set(check, !elm_check_state_get(check));
+ evas_object_smart_callback_call(check, "changed", NULL);
+ }
}
static void app_details_gl_append(Evas_Object *genlist, char *style, App_Details_Items item_name)
{
- NOTISET_TRACE_BEGIN;
- Elm_Object_Item *gen_item = NULL;
- Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
- ret_if(!itc);
-
- itc->item_style = style;
- itc->func.text_get = app_details_gl_text_get_cb;
- itc->func.content_get = app_details_gl_content_get_cb;
- itc->func.del = app_details_gl_del_cb;
-
- gen_item = elm_genlist_item_append(genlist, /* genlist object */
- itc, /* item class */
- (void *)item_name, /* item class user data */
- NULL, /* parent item */
- ELM_GENLIST_ITEM_NONE, /* item type */
- app_details_gl_selected_cb, /* select smart callback */
- (void *)item_name); /* smart callback user data */
- if (style && !strcmp(style, "group_index"))
- elm_genlist_item_select_mode_set(gen_item, ELM_OBJECT_SELECT_MODE_NONE);
- elm_genlist_item_class_free(itc);
+ NOTISET_TRACE_BEGIN;
+ Elm_Object_Item *gen_item = NULL;
+ Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
+ ret_if(!itc);
+
+ itc->item_style = style;
+ itc->func.text_get = app_details_gl_text_get_cb;
+ itc->func.content_get = app_details_gl_content_get_cb;
+ itc->func.del = app_details_gl_del_cb;
+
+ gen_item = elm_genlist_item_append(genlist, /* genlist object */
+ itc, /* item class */
+ (void *)item_name, /* item class user data */
+ NULL, /* parent item */
+ ELM_GENLIST_ITEM_NONE, /* item type */
+ app_details_gl_selected_cb, /* select smart callback */
+ (void *)item_name); /* smart callback user data */
+ if (style && !strcmp(style, "group_index"))
+ elm_genlist_item_select_mode_set(gen_item, ELM_OBJECT_SELECT_MODE_NONE);
+ elm_genlist_item_class_free(itc);
}
static void fill_app_noti_gl(Evas_Object *genlist)
{
- append_gl_item_list(genlist, get_apps_noti_allowed_list(), ITEM_STYLE_TYPE_ONE, "app-notification-details");
- append_gl_start_option(genlist, "group_index", "blocked-noti");
- append_gl_item_list(genlist, get_apps_noti_blocked_list(), ITEM_STYLE_TYPE_ONE, "app-notification-details");
+ append_gl_item_list(genlist, get_apps_noti_allowed_list(), ITEM_STYLE_TYPE_ONE, "app-notification-details");
+ append_gl_start_option(genlist, "group_index", "blocked-noti");
+ append_gl_item_list(genlist, get_apps_noti_blocked_list(), ITEM_STYLE_TYPE_ONE, "app-notification-details");
}
static Eina_Bool app_details_pop_cb(void *data, Elm_Object_Item * it)
{
- update_app_notification_list_on_item(g_app_info);
- elm_genlist_clear(g_app_notification_genlist);
- fill_app_noti_gl(g_app_notification_genlist);
- return EINA_TRUE;
+ update_app_notification_list_on_item(g_app_info);
+ elm_genlist_clear(g_app_notification_genlist);
+ fill_app_noti_gl(g_app_notification_genlist);
+ return EINA_TRUE;
}
void app_details_create_view(ug_data *data, item_info_s *app_info)
{
- ret_if(!data || !app_info);
+ ret_if(!data || !app_info);
- g_app_info = app_info;
+ g_app_info = app_info;
- Evas_Object *back_btn = elm_button_add(data->naviframe);
- elm_object_style_set(back_btn, "naviframe/back_btn/default");
- evas_object_smart_callback_add(back_btn, "clicked", close_app_details_cb, data->naviframe);
+ Evas_Object *back_btn = elm_button_add(data->naviframe);
+ elm_object_style_set(back_btn, "naviframe/back_btn/default");
+ evas_object_smart_callback_add(back_btn, "clicked", close_app_details_cb, data->naviframe);
- /* Push to naviframe */
- Evas_Object *genlist = elm_genlist_add(data->naviframe);
- elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
- evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ /* Push to naviframe */
+ Evas_Object *genlist = elm_genlist_add(data->naviframe);
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+ evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
- app_details_gl_append(genlist, "type1", APP_DETAILS_ALLOW_NOTI);
- app_details_gl_append(genlist, "group_index", APP_DETAILS_GROUP_INDEX);
- app_details_gl_append(genlist, "multiline", APP_DETAILS_POPUP_NOTI);
- app_details_gl_append(genlist, "type1", APP_DETAILS_APP_BADGE);
- app_details_gl_append(genlist, "type1", APP_DETAILS_NOTI_ON_LOCK);
+ app_details_gl_append(genlist, "type1", APP_DETAILS_ALLOW_NOTI);
+ app_details_gl_append(genlist, "group_index", APP_DETAILS_GROUP_INDEX);
+ app_details_gl_append(genlist, "multiline", APP_DETAILS_POPUP_NOTI);
+ app_details_gl_append(genlist, "type1", APP_DETAILS_APP_BADGE);
+ app_details_gl_append(genlist, "type1", APP_DETAILS_NOTI_ON_LOCK);
- Elm_Object_Item *navi_item = elm_naviframe_item_push(data->naviframe, g_app_info->name, back_btn, NULL, genlist, NULL);
- elm_naviframe_item_pop_cb_set(navi_item, app_details_pop_cb, NULL);
+ Elm_Object_Item *navi_item = elm_naviframe_item_push(data->naviframe, g_app_info->name, back_btn, NULL, genlist, NULL);
+ elm_naviframe_item_pop_cb_set(navi_item, app_details_pop_cb, NULL);
- data->list_sub = genlist;
+ data->list_sub = genlist;
}
Evas_Object *create_app_notification_gl(ug_data *ugd)
{
- Evas_Object *parent = ugd->naviframe;
- Evas_Object *genlist;
-
- genlist = elm_genlist_add(parent);
- elm_genlist_mode_set(genlist, ELM_LIST_SCROLL);
- elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
- evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_genlist_block_count_set(genlist, 8);
-
- /* Add Smart Callback */
- evas_object_smart_callback_add(genlist, "contracted", gl_contracted_cb, NULL);
-
- fill_app_noti_gl(genlist);
- g_app_notification_genlist = genlist;
- return genlist;
+ Evas_Object *parent = ugd->naviframe;
+ Evas_Object *genlist;
+
+ genlist = elm_genlist_add(parent);
+ elm_genlist_mode_set(genlist, ELM_LIST_SCROLL);
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+ evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_genlist_block_count_set(genlist, 8);
+
+ /* Add Smart Callback */
+ evas_object_smart_callback_add(genlist, "contracted", gl_contracted_cb, NULL);
+
+ fill_app_noti_gl(genlist);
+ g_app_notification_genlist = genlist;
+ return genlist;
}
void gl_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
{
- Elm_Object_Item *it = (Elm_Object_Item *) event_info;
- elm_genlist_item_selected_set(it, EINA_FALSE);
-
- if (data) {
- void *item_data = elm_object_item_data_get(it);
- if (item_data && !strcmp(data, "app-notification-details")) {
- app_details_create_view(g_ug_data, (item_info_s *)item_data);
- return;
- }
-
- if (!strcmp(data, "set-schedule-multiline")) {
- gl_set_schedule_selected(g_ug_data);
- }
-
- if (!strcmp(data, "allowed-calls")) {
- gl_allowed_calls_selected();
- }
-
- if (!strcmp(data, "start-time")) {
- create_start_time_popup();
- }
- if (!strcmp(data, "end-time")) {
- create_end_time_popup();
- }
- }
-
- Evas_Object *check = elm_object_item_part_content_get(it, "elm.swallow.end");
- if (!check) {
- check = elm_object_item_part_content_get(it, "elm.icon.right");
- }
-
- if (check) {
- elm_check_state_set(check, !elm_check_state_get(check));
- evas_object_smart_callback_call(check, "changed", NULL);
- }
+ Elm_Object_Item *it = (Elm_Object_Item *) event_info;
+ elm_genlist_item_selected_set(it, EINA_FALSE);
+
+ if (data) {
+ void *item_data = elm_object_item_data_get(it);
+ if (item_data && !strcmp(data, "app-notification-details")) {
+ app_details_create_view(g_ug_data, (item_info_s *)item_data);
+ return;
+ }
+
+ if (!strcmp(data, "set-schedule-multiline")) {
+ gl_set_schedule_selected(g_ug_data);
+ }
+
+ if (!strcmp(data, "allowed-calls")) {
+ gl_allowed_calls_selected();
+ }
+
+ if (!strcmp(data, "start-time")) {
+ create_start_time_popup();
+ }
+ if (!strcmp(data, "end-time")) {
+ create_end_time_popup();
+ }
+ }
+
+ Evas_Object *check = elm_object_item_part_content_get(it, "elm.swallow.end");
+ if (!check) {
+ check = elm_object_item_part_content_get(it, "elm.icon.right");
+ }
+
+ if (check) {
+ elm_check_state_set(check, !elm_check_state_get(check));
+ evas_object_smart_callback_call(check, "changed", NULL);
+ }
}
void gl_contracted_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
- Elm_Object_Item *it = event_info;
- elm_genlist_item_subitems_clear(it);
+ Elm_Object_Item *it = event_info;
+ elm_genlist_item_subitems_clear(it);
}
void gl_del_cb(void *data, Evas_Object *obj EINA_UNUSED)
Evas_Object *create_on_off_check(Evas_Object *parent)
{
- Evas_Object *check = elm_check_add(parent);
- elm_object_style_set(check, "on&off");
- evas_object_show(check);
- evas_object_pass_events_set(check, 1);
- evas_object_propagate_events_set(check, 0);
- return check;
+ Evas_Object *check = elm_check_add(parent);
+ elm_object_style_set(check, "on&off");
+ evas_object_show(check);
+ evas_object_pass_events_set(check, 1);
+ evas_object_propagate_events_set(check, 0);
+ return check;
}
Evas_Object *create_custom_layout(Evas_Object *parent, char* group_name)
{
- Evas_Object *layout = create_layout(parent);
- char edj_path[PATH_MAX] = {0, };
+ Evas_Object *layout = create_layout(parent);
+ char edj_path[PATH_MAX] = {0, };
- char *res_path = app_get_resource_path();
- if (res_path) {
- snprintf(edj_path, PATH_MAX, "%s%s", res_path, "edje/setting_notification.edj");
- free(res_path);
- }
+ char *res_path = app_get_resource_path();
+ if (res_path) {
+ snprintf(edj_path, PATH_MAX, "%s%s", res_path, "edje/setting_notification.edj");
+ free(res_path);
+ }
- elm_layout_file_set(layout, edj_path, group_name);
- return layout;
+ elm_layout_file_set(layout, edj_path, group_name);
+ return layout;
}
static void _do_not_disturb_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
{
- NOTISET_TRACE_BEGIN;
+ NOTISET_TRACE_BEGIN;
- Eina_Bool state = elm_check_state_get(obj);
- set_do_not_disturb(state);
- update_system_settings();
- NOTISET_DBG("do_not_disturb check value = %s", state == false ? "FALSE" : "TRUE");
+ Eina_Bool state = elm_check_state_get(obj);
+ set_do_not_disturb(state);
+ update_system_settings();
+ NOTISET_DBG("do_not_disturb check value = %s", state == false ? "FALSE" : "TRUE");
}
static Evas_Object *gl_content_get_cb(void *data, Evas_Object *obj, const char *part)
{
- retv_if(!data, NULL);
-
- Evas_Object *content = NULL;
-
- item_info_s *data_list = data;
- if (!strcmp(part, "elm.swallow.icon") || !strcmp(part, "elm.icon.left")) {
- if (data_list->item_style != ITEM_STYLE_RADIO) {
- Evas_Object *icon = create_icon(obj, data_list->icon);
- evas_object_show(icon);
- return icon;
- }
- }
-
- if (!strcmp(part, "elm.swallow.end")) {
- if (data_list->item_style == ITEM_STYLE_TYPE_ONE) {
- return NULL;
- } else if (data_list->item_style == ITEM_STYLE_DEFAULT) {
- content = create_on_off_check(obj);
- elm_check_state_set(content, data_list->do_not_disturb_except);
- evas_object_smart_callback_add(content, "changed", _excepted_check_changed_cb, data_list);
- return content;
- } else if (data_list->item_style == ITEM_STYLE_RADIO) {
- int count = data_list->index;
- Evas_Object *radio = NULL;
- Evas_Object *radio_main = evas_object_data_get(obj, "radio");
- radio = elm_radio_add(obj);
- elm_radio_group_add(radio, radio_main);
- elm_radio_state_value_set(radio, count);
- evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL);
- return radio;
- }
- }
-
- return content;
+ retv_if(!data, NULL);
+
+ Evas_Object *content = NULL;
+
+ item_info_s *data_list = data;
+ if (!strcmp(part, "elm.swallow.icon") || !strcmp(part, "elm.icon.left")) {
+ if (data_list->item_style != ITEM_STYLE_RADIO) {
+ Evas_Object *icon = create_icon(obj, data_list->icon);
+ evas_object_show(icon);
+ return icon;
+ }
+ }
+
+ if (!strcmp(part, "elm.swallow.end")) {
+ if (data_list->item_style == ITEM_STYLE_TYPE_ONE) {
+ return NULL;
+ } else if (data_list->item_style == ITEM_STYLE_DEFAULT) {
+ content = create_on_off_check(obj);
+ elm_check_state_set(content, data_list->do_not_disturb_except);
+ evas_object_smart_callback_add(content, "changed", _excepted_check_changed_cb, data_list);
+ return content;
+ } else if (data_list->item_style == ITEM_STYLE_RADIO) {
+ int count = data_list->index;
+ Evas_Object *radio = NULL;
+ Evas_Object *radio_main = evas_object_data_get(obj, "radio");
+ radio = elm_radio_add(obj);
+ elm_radio_group_add(radio, radio_main);
+ elm_radio_state_value_set(radio, count);
+ evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ return radio;
+ }
+ }
+
+ return content;
}
static char *gl_text_get_cb(void *data, Evas_Object *obj, const char *part)
static void gl_radio_sel_cb(void *data, Evas_Object *obj, void *event_info)
{
- NOTISET_TRACE_BEGIN;
- Elm_Object_Item *it = event_info;
- int index = (int)data;
-
- Evas_Object *radio = NULL;
-
- elm_genlist_item_selected_set(it, EINA_FALSE);
- radio = elm_object_item_part_content_get(it, "elm.swallow.end");
- elm_radio_value_set(radio, index);
-
- switch (index) {
- case 0:
- show_all_content_clicked();
- break;
- case 1:
- hide_sensitive_content_clicked();
- break;
- case 2:
- do_not_show_notifications_clicked();
- break;
- }
+ NOTISET_TRACE_BEGIN;
+ Elm_Object_Item *it = event_info;
+ int index = (int)data;
+
+ Evas_Object *radio = NULL;
+
+ elm_genlist_item_selected_set(it, EINA_FALSE);
+ radio = elm_object_item_part_content_get(it, "elm.swallow.end");
+ elm_radio_value_set(radio, index);
+
+ switch (index) {
+ case 0:
+ show_all_content_clicked();
+ break;
+ case 1:
+ hide_sensitive_content_clicked();
+ break;
+ case 2:
+ do_not_show_notifications_clicked();
+ break;
+ }
}
void append_gl_radio_item_list(Evas_Object *genlist, Eina_List* list, char *style)
{
- NOTISET_TRACE_BEGIN;
- Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
- ret_if(!itc);
-
- item_info_s *item;
- int count = 0;
-
- Evas_Object *radio = elm_radio_add(genlist);
- evas_object_data_set(genlist, "radio", radio);
-
- itc->item_style = style;
- itc->func.text_get = gl_text_get_cb;
- itc->func.content_get = gl_content_get_cb;
- itc->func.del = gl_del_cb;
-
- while (list) {
- item = (item_info_s *)eina_list_data_get(list);
- item->index = count;
- item->item_style = ITEM_STYLE_RADIO;
- elm_genlist_item_append(genlist, /* genlist object */
- itc, /* item class */
- item, /* item class user data */
- NULL, /* parent item */
- ELM_GENLIST_ITEM_NONE, /* item type */
- gl_radio_sel_cb, /* select smart callback */
- (void *)count); /* smart callback user data */
- list = eina_list_next(list);
- ++count;
- }
- elm_genlist_item_class_free(itc);
-
- int index = get_lock_screen_content_setting();
- elm_radio_value_set(radio, index);
- gl_radio_sel_cb((void *)index, genlist, NULL);
+ NOTISET_TRACE_BEGIN;
+ Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
+ ret_if(!itc);
+
+ item_info_s *item;
+ int count = 0;
+
+ Evas_Object *radio = elm_radio_add(genlist);
+ evas_object_data_set(genlist, "radio", radio);
+
+ itc->item_style = style;
+ itc->func.text_get = gl_text_get_cb;
+ itc->func.content_get = gl_content_get_cb;
+ itc->func.del = gl_del_cb;
+
+ while (list) {
+ item = (item_info_s *)eina_list_data_get(list);
+ item->index = count;
+ item->item_style = ITEM_STYLE_RADIO;
+ elm_genlist_item_append(genlist, /* genlist object */
+ itc, /* item class */
+ item, /* item class user data */
+ NULL, /* parent item */
+ ELM_GENLIST_ITEM_NONE, /* item type */
+ gl_radio_sel_cb, /* select smart callback */
+ (void *)count); /* smart callback user data */
+ list = eina_list_next(list);
+ ++count;
+ }
+ elm_genlist_item_class_free(itc);
+
+ int index = get_lock_screen_content_setting();
+ elm_radio_value_set(radio, index);
+ gl_radio_sel_cb((void *)index, genlist, NULL);
}
void append_gl_item_list(Evas_Object *genlist, Eina_List *list, int style, char *ugName)
{
- NOTISET_TRACE_BEGIN;
+ NOTISET_TRACE_BEGIN;
- Elm_Object_Item *gen_item = NULL;
+ Elm_Object_Item *gen_item = NULL;
Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
ret_if(!itc);
}
itc->func.text_get = gl_text_get_cb;
itc->func.content_get = gl_content_get_cb;
- itc->func.del = gl_del_cb;
+ itc->func.del = gl_del_cb;
count = eina_list_count(list);
NOTISET_DBG("count %d", count);
while (list) {
item = (item_info_s *)eina_list_data_get(list);
item->item_style = style;
- gen_item = elm_genlist_item_append(genlist, /* genlist object */
+ gen_item = elm_genlist_item_append(genlist, /* genlist object */
itc, /* item class */
item, /* item class user data */
NULL, /* parent item */
ELM_GENLIST_ITEM_NONE, /* item type */
- gl_selected_cb, /* select smart callback */
- ugName); /* smart callback user data */
+ gl_selected_cb, /* select smart callback */
+ ugName); /* smart callback user data */
elm_object_item_data_set(gen_item, item);
list = eina_list_next(list);
}
{
char buf[MAX_TEXT_SIZE] = {0,};
- retv_if(!data, NULL);
- if (!strcmp(data, "do-not-disturb")) {
- if (!strcmp("elm.text.multiline", part)) {
- snprintf(buf, sizeof(buf), "<font_size=30>%s</font_size>", APP_STRING("IDS_ST_BODY_MUTE_ALL_ALERTS_AND_ONLY_SHOW_NOTIFICATIONS_IN_THE_NOTIFICATION_PANEL_ADD_APPS_BELOW_TO_ALLOW_EXCEPTIONS"));
- return strdup(buf);
- }
-
- if (!strcmp(part, "elm.text")) {
- return strdup(APP_STRING("IDS_ST_HEADER_DO_NOT_DISTURB_ABB"));
- }
- } else if (!strcmp(data, "set-schedule-multiline")) {
- if (!strcmp("elm.text", part)) {
- return strdup(APP_STRING("IDS_ST_MBODY_SET_SCHEDULE_M_TIME"));
- }
- if (!strcmp("elm.text.multiline", part)) {
- if (get_schedule()) {
- int dndSchedule = load_dnd_schedule_day();
-
- struct tm start_time;
- struct tm end_time;
- load_dnd_schedule_time(&start_time, &end_time);
-
- snprintf(buf, sizeof(buf), "<font_size=30>%s<br/>%s</font_size>",
- get_day_string(dndSchedule), get_time_string(&start_time, &end_time));
- } else
- snprintf(buf, sizeof(buf), "<font_size=30>%s</font_size>", APP_STRING("WDS_ST_ACBUTTON_OFF_ABB2"));
-
- return strdup(buf);
- }
- } else if (!strcmp(data, "set-schedule")) {
- if (!strcmp("elm.text", part)) {
- return strdup(APP_STRING("IDS_ST_MBODY_SET_SCHEDULE_M_TIME"));
- }
- } else if (!strcmp(data, "start-time") && !strcmp("elm.text", part)) {
- return strdup(APP_STRING("IDS_ST_BODY_START_TIME"));
- } else if (!strcmp(data, "end-time") && !strcmp("elm.text", part)) {
- return strdup(APP_STRING("IDS_ST_BODY_END_TIME"));
- } else if (!strcmp(data, "end-time") && !strcmp("elm.text.sub", part) && is_next_day()) {
- return strdup(APP_STRING("IDS_ST_SBODY_NEXT_DAY_M_LC_ABB"));
- } else if (!strcmp(data, "allowed-calls")) {
- if (!strcmp("elm.text.multiline", part)) {
- snprintf(buf, sizeof(buf), "<font_size=30>%s</font_size>", APP_STRING(get_allowed_calls_string()));
- return strdup(buf);
- }
- if (!strcmp("elm.text", part)) {
- return strdup(APP_STRING("IDS_ST_MBODY_ALLOWED_CALLS_ABB"));
- }
- } else if (!strcmp(data, "show-all-content")) {
-
- if (!strcmp("elm.text", part))
- return strdup("Picture.jpg");
- else if (!strcmp("elm.text.sub", part))
- return strdup("Download complete");
- else if (!strcmp("elm.text.sub.end", part))
- return strdup(APP_STRING("IDS_ST_HEADER_TIME"));
- } else if (!strcmp(data, "hide-sensitive-content")) {
- if (!strcmp("elm.text", part))
- return strdup("Download manager");
- else if (!strcmp("elm.text.sub", part))
- return strdup(APP_STRING("IDS_ST_OPT_CONTENT_HIDDEN"));
- else if (!strcmp("elm.text.sub.end", part))
- return strdup(APP_STRING("IDS_ST_BODY_DATE"));
- } else if (!strcmp(data, "blocked-noti")) {
- if (!strcmp("elm.text", part))
- return strdup(APP_STRING("IDS_ST_HEADER_BLOCKED_NOTIFICATIONS_ABB"));
- }
+ retv_if(!data, NULL);
+ if (!strcmp(data, "do-not-disturb")) {
+ if (!strcmp("elm.text.multiline", part)) {
+ snprintf(buf, sizeof(buf), "<font_size=30>%s</font_size>", APP_STRING("IDS_ST_BODY_MUTE_ALL_ALERTS_AND_ONLY_SHOW_NOTIFICATIONS_IN_THE_NOTIFICATION_PANEL_ADD_APPS_BELOW_TO_ALLOW_EXCEPTIONS"));
+ return strdup(buf);
+ }
+
+ if (!strcmp(part, "elm.text")) {
+ return strdup(APP_STRING("IDS_ST_HEADER_DO_NOT_DISTURB_ABB"));
+ }
+ } else if (!strcmp(data, "set-schedule-multiline")) {
+ if (!strcmp("elm.text", part)) {
+ return strdup(APP_STRING("IDS_ST_MBODY_SET_SCHEDULE_M_TIME"));
+ }
+ if (!strcmp("elm.text.multiline", part)) {
+ if (get_schedule()) {
+ int dndSchedule = load_dnd_schedule_day();
+
+ struct tm start_time;
+ struct tm end_time;
+ load_dnd_schedule_time(&start_time, &end_time);
+
+ snprintf(buf, sizeof(buf), "<font_size=30>%s<br/>%s</font_size>",
+ get_day_string(dndSchedule), get_time_string(&start_time, &end_time));
+ } else
+ snprintf(buf, sizeof(buf), "<font_size=30>%s</font_size>", APP_STRING("WDS_ST_ACBUTTON_OFF_ABB2"));
+
+ return strdup(buf);
+ }
+ } else if (!strcmp(data, "set-schedule")) {
+ if (!strcmp("elm.text", part)) {
+ return strdup(APP_STRING("IDS_ST_MBODY_SET_SCHEDULE_M_TIME"));
+ }
+ } else if (!strcmp(data, "start-time") && !strcmp("elm.text", part)) {
+ return strdup(APP_STRING("IDS_ST_BODY_START_TIME"));
+ } else if (!strcmp(data, "end-time") && !strcmp("elm.text", part)) {
+ return strdup(APP_STRING("IDS_ST_BODY_END_TIME"));
+ } else if (!strcmp(data, "end-time") && !strcmp("elm.text.sub", part) && is_next_day()) {
+ return strdup(APP_STRING("IDS_ST_SBODY_NEXT_DAY_M_LC_ABB"));
+ } else if (!strcmp(data, "allowed-calls")) {
+ if (!strcmp("elm.text.multiline", part)) {
+ snprintf(buf, sizeof(buf), "<font_size=30>%s</font_size>", APP_STRING(get_allowed_calls_string()));
+ return strdup(buf);
+ }
+ if (!strcmp("elm.text", part)) {
+ return strdup(APP_STRING("IDS_ST_MBODY_ALLOWED_CALLS_ABB"));
+ }
+ } else if (!strcmp(data, "show-all-content")) {
+
+ if (!strcmp("elm.text", part))
+ return strdup("Picture.jpg");
+ else if (!strcmp("elm.text.sub", part))
+ return strdup("Download complete");
+ else if (!strcmp("elm.text.sub.end", part))
+ return strdup(APP_STRING("IDS_ST_HEADER_TIME"));
+ } else if (!strcmp(data, "hide-sensitive-content")) {
+ if (!strcmp("elm.text", part))
+ return strdup("Download manager");
+ else if (!strcmp("elm.text.sub", part))
+ return strdup(APP_STRING("IDS_ST_OPT_CONTENT_HIDDEN"));
+ else if (!strcmp("elm.text.sub.end", part))
+ return strdup(APP_STRING("IDS_ST_BODY_DATE"));
+ } else if (!strcmp(data, "blocked-noti")) {
+ if (!strcmp("elm.text", part))
+ return strdup(APP_STRING("IDS_ST_HEADER_BLOCKED_NOTIFICATIONS_ABB"));
+ }
return NULL;
}
static Evas_Object *_gl_option_content_get_cb(void *data, Evas_Object *obj, const char *part)
{
- retv_if(!data, NULL);
-
- if (!strcmp(data, "do-not-disturb") && !strcmp(part, "elm.swallow.end")) {
- Evas_Object *check = NULL;
- check = create_on_off_check(obj);
- elm_check_state_set(check, get_do_not_disturb());
- evas_object_smart_callback_add(check, "changed", _do_not_disturb_check_changed_cb, NULL);
- return check;
- }
-
- if (!strcmp(data, "set-schedule") && !strcmp("elm.swallow.end", part)) {
- Evas_Object *check = create_on_off_check(obj);
- elm_check_state_set(check, get_schedule());
- evas_object_smart_callback_add(check, "changed", set_schedule_check_changed_cb, NULL);
- return check;
- }
-
- if (!strcmp(data, "start-time") && !strcmp("elm.swallow.end", part)) {
- return start_end_time_item(obj, true);
- }
-
- if (!strcmp(data, "end-time") && !strcmp("elm.swallow.end", part)) {
- return start_end_time_item(obj, false);
- }
-
- if ((!strcmp(data, "hide-sensitive-content") || !strcmp(data, "show-all-content")) && !strcmp(part, "elm.swallow.icon")) {
- return create_icon(obj, NULL);
- }
-
- return NULL;
+ retv_if(!data, NULL);
+
+ if (!strcmp(data, "do-not-disturb") && !strcmp(part, "elm.swallow.end")) {
+ Evas_Object *check = NULL;
+ check = create_on_off_check(obj);
+ elm_check_state_set(check, get_do_not_disturb());
+ evas_object_smart_callback_add(check, "changed", _do_not_disturb_check_changed_cb, NULL);
+ return check;
+ }
+
+ if (!strcmp(data, "set-schedule") && !strcmp("elm.swallow.end", part)) {
+ Evas_Object *check = create_on_off_check(obj);
+ elm_check_state_set(check, get_schedule());
+ evas_object_smart_callback_add(check, "changed", set_schedule_check_changed_cb, NULL);
+ return check;
+ }
+
+ if (!strcmp(data, "start-time") && !strcmp("elm.swallow.end", part)) {
+ return start_end_time_item(obj, true);
+ }
+
+ if (!strcmp(data, "end-time") && !strcmp("elm.swallow.end", part)) {
+ return start_end_time_item(obj, false);
+ }
+
+ if ((!strcmp(data, "hide-sensitive-content") || !strcmp(data, "show-all-content")) && !strcmp(part, "elm.swallow.icon")) {
+ return create_icon(obj, NULL);
+ }
+
+ return NULL;
}
void append_gl_start_option(Evas_Object *genlist, char *style, char *ugName)
{
- NOTISET_TRACE_BEGIN;
-
- Elm_Object_Item *gen_item = NULL;
- Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
- ret_if(!itc);
-
- itc->item_style = style;
- itc->func.text_get = _gl_option_text_get_cb;
- itc->func.content_get = _gl_option_content_get_cb;
- itc->func.del = gl_del_cb;
-
- gen_item = elm_genlist_item_append(genlist, /* genlist object */
- itc, /* item class */
- ugName, /* item class user data */
- NULL, /* parent item */
- ELM_GENLIST_ITEM_NONE, /* item type */
- gl_selected_cb, /* select smart callback */
- ugName); /* smart callback user data */
-
- if (style && !strcmp(style, "group_index"))
- elm_genlist_item_select_mode_set(gen_item, ELM_OBJECT_SELECT_MODE_NONE);
- elm_genlist_item_class_free(itc);
+ NOTISET_TRACE_BEGIN;
+
+ Elm_Object_Item *gen_item = NULL;
+ Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
+ ret_if(!itc);
+
+ itc->item_style = style;
+ itc->func.text_get = _gl_option_text_get_cb;
+ itc->func.content_get = _gl_option_content_get_cb;
+ itc->func.del = gl_del_cb;
+
+ gen_item = elm_genlist_item_append(genlist, /* genlist object */
+ itc, /* item class */
+ ugName, /* item class user data */
+ NULL, /* parent item */
+ ELM_GENLIST_ITEM_NONE, /* item type */
+ gl_selected_cb, /* select smart callback */
+ ugName); /* smart callback user data */
+
+ if (style && !strcmp(style, "group_index"))
+ elm_genlist_item_select_mode_set(gen_item, ELM_OBJECT_SELECT_MODE_NONE);
+ elm_genlist_item_class_free(itc);
}
void cancel_button_noti_ls_cb(void *data, Evas_Object *obj, void *event_info)
{
- NOTISET_TRACE_BEGIN;
- ug_data *u_data = data;
- ret_if(!data);
- elm_naviframe_item_pop(u_data->naviframe);
-
- EVAS_OBJECT_DELIF(u_data->done_button);
- EVAS_OBJECT_DELIF(u_data->cancel_button);
- EVAS_OBJECT_DELIF(u_data->list_sub);
- EVAS_OBJECT_DELIF(u_data->list_main);
+ NOTISET_TRACE_BEGIN;
+ ug_data *u_data = data;
+ ret_if(!data);
+ elm_naviframe_item_pop(u_data->naviframe);
+
+ EVAS_OBJECT_DELIF(u_data->done_button);
+ EVAS_OBJECT_DELIF(u_data->cancel_button);
+ EVAS_OBJECT_DELIF(u_data->list_sub);
+ EVAS_OBJECT_DELIF(u_data->list_main);
}
void done_button_noti_ls_cb(void *data, Evas_Object *obj, void *event_info)
{
- NOTISET_TRACE_BEGIN;
- update_lock_screen_noti_settings();
- ret_if(!data);
- ug_data *u_data = (ug_data *)data;
- elm_naviframe_item_pop(u_data->naviframe);
-
- EVAS_OBJECT_DELIF(u_data->done_button);
- EVAS_OBJECT_DELIF(u_data->cancel_button);
- EVAS_OBJECT_DELIF(u_data->list_sub);
- EVAS_OBJECT_DELIF(u_data->list_main);
+ NOTISET_TRACE_BEGIN;
+ update_lock_screen_noti_settings();
+ ret_if(!data);
+ ug_data *u_data = (ug_data *)data;
+ elm_naviframe_item_pop(u_data->naviframe);
+
+ EVAS_OBJECT_DELIF(u_data->done_button);
+ EVAS_OBJECT_DELIF(u_data->cancel_button);
+ EVAS_OBJECT_DELIF(u_data->list_sub);
+ EVAS_OBJECT_DELIF(u_data->list_main);
}
void back_button_cb(void *data, Evas_Object *obj, void *event_info)
* @brief This struct stands for helping to generate a full content-layout of item added to genlist.
*/
typedef struct {
- /**
- * A callback raised from genlist item class'es content_get callback that should create genlist
- * item's content.
- * */
- Evas_Object *(*fullContentCb)(Evas_Object *parent, void *data);
- void *cbData; /**< User-data passed to fullContentCb.*/
+ /**
+ * A callback raised from genlist item class'es content_get callback that should create genlist
+ * item's content.
+ * */
+ Evas_Object *(*fullContentCb)(Evas_Object *parent, void *data);
+ void *cbData; /**< User-data passed to fullContentCb.*/
} full_content_data_s;
static Evas_Object *_gl_full_content_get_cb(void *data, Evas_Object *obj, const char *part)
{
- retv_if(!data, NULL);
- full_content_data_s *content_data = (full_content_data_s *)data;
- if (!strcmp(part, "elm.swallow.content")) {
- if (content_data->fullContentCb)
- return content_data->fullContentCb(obj, content_data->cbData);
- }
- return NULL;
+ retv_if(!data, NULL);
+ full_content_data_s *content_data = (full_content_data_s *)data;
+ if (!strcmp(part, "elm.swallow.content")) {
+ if (content_data->fullContentCb)
+ return content_data->fullContentCb(obj, content_data->cbData);
+ }
+ return NULL;
}
static void _gl_full_content_del_cb(void *data, Evas_Object *obj)
{
- ret_if(!data);
- free(data);
+ ret_if(!data);
+ free(data);
}
void append_gl_full_item(Evas_Object *genlist, Evas_Object *(*fullContentCb)(Evas_Object* parent, void *data), void *cbData)
{
- Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
- ret_if(!itc);
-
- full_content_data_s *data = calloc(1, sizeof(full_content_data_s));
- if (!data) {
- elm_genlist_item_class_free(itc);
- return;
- }
- data->fullContentCb = fullContentCb;
- data->cbData = cbData;
- itc->item_style = "full";
- itc->func.content_get = _gl_full_content_get_cb;
- itc->func.del = _gl_full_content_del_cb;
-
- Elm_Object_Item *genlist_item = elm_genlist_item_append(genlist, /* genlist object */
- itc, /* item class */
- data, /* item class user data */
- NULL, /* parent item */
- ELM_GENLIST_ITEM_NONE, /* item type */
- gl_selected_cb, /* select smart callback */
- NULL); /* smart callback user data */
- elm_genlist_item_select_mode_set(genlist_item, ELM_OBJECT_SELECT_MODE_NONE);
- elm_genlist_item_class_free(itc);
+ Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
+ ret_if(!itc);
+
+ full_content_data_s *data = calloc(1, sizeof(full_content_data_s));
+ if (!data) {
+ elm_genlist_item_class_free(itc);
+ return;
+ }
+ data->fullContentCb = fullContentCb;
+ data->cbData = cbData;
+ itc->item_style = "full";
+ itc->func.content_get = _gl_full_content_get_cb;
+ itc->func.del = _gl_full_content_del_cb;
+
+ Elm_Object_Item *genlist_item = elm_genlist_item_append(genlist, /* genlist object */
+ itc, /* item class */
+ data, /* item class user data */
+ NULL, /* parent item */
+ ELM_GENLIST_ITEM_NONE, /* item type */
+ gl_selected_cb, /* select smart callback */
+ NULL); /* smart callback user data */
+ elm_genlist_item_select_mode_set(genlist_item, ELM_OBJECT_SELECT_MODE_NONE);
+ elm_genlist_item_class_free(itc);
}
void do_not_disturb_append_items_in_list(Evas_Object *genlist)
{
- append_gl_start_option(genlist, "multiline", "do-not-disturb");
- append_gl_start_option(genlist, "multiline", "set-schedule-multiline");
- append_gl_start_option(genlist, "multiline", "allowed-calls");
- Eina_List *list = eina_list_clone(get_excepted_apps_list());
- Eina_List *allowed_list = eina_list_merge(get_first_excepted_apps_list(), list);
- append_gl_full_item(genlist, do_not_disturb_allowed_apps_cont_cb, allowed_list);
+ append_gl_start_option(genlist, "multiline", "do-not-disturb");
+ append_gl_start_option(genlist, "multiline", "set-schedule-multiline");
+ append_gl_start_option(genlist, "multiline", "allowed-calls");
+ Eina_List *list = eina_list_clone(get_excepted_apps_list());
+ Eina_List *allowed_list = eina_list_merge(get_first_excepted_apps_list(), list);
+ append_gl_full_item(genlist, do_not_disturb_allowed_apps_cont_cb, allowed_list);
}
Evas_Object *do_not_disturb_allowed_apps_cont_cb(Evas_Object* parent, void *data)
ug_data *ug_main = get_app_ui_data();
retv_if(ug_main == NULL, NULL);
- Evas_Object *full_layout = create_custom_layout(parent, ALLOWED_LAYOUT_NAME);
- elm_object_part_text_set(full_layout, ALLOWED_LAYOUT_TEXT_PART, APP_STRING("IDS_QP_HEADER_ALLOW_NOTIFICATIONS_FROM_ABB"));
+ Evas_Object *full_layout = create_custom_layout(parent, ALLOWED_LAYOUT_NAME);
+ elm_object_part_text_set(full_layout, ALLOWED_LAYOUT_TEXT_PART, APP_STRING("IDS_QP_HEADER_ALLOW_NOTIFICATIONS_FROM_ABB"));
- Evas_Object *select_button = elm_button_add(full_layout);
- evas_object_size_hint_weight_set(select_button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(select_button, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_object_text_set(select_button, APP_STRING("IDS_ST_SK_SELECT_LITE"));
+ Evas_Object *select_button = elm_button_add(full_layout);
+ evas_object_size_hint_weight_set(select_button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(select_button, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_text_set(select_button, APP_STRING("IDS_ST_SK_SELECT_LITE"));
- evas_object_smart_callback_add(select_button, "clicked", exception_application_clicked_cb, ug_main);
- evas_object_show(select_button);
+ evas_object_smart_callback_add(select_button, "clicked", exception_application_clicked_cb, ug_main);
+ evas_object_show(select_button);
- elm_object_part_content_set(full_layout, ALLOWED_LAYOUT_BUTTON_PART, select_button);
+ elm_object_part_content_set(full_layout, ALLOWED_LAYOUT_BUTTON_PART, select_button);
- retv_if(!data, full_layout);
- Eina_List *allowed_apps_list = (Eina_List *)data;
+ retv_if(!data, full_layout);
+ Eina_List *allowed_apps_list = (Eina_List *)data;
- Evas_Object *table = elm_table_add(full_layout);
- elm_table_homogeneous_set(table, true);
- int count = eina_list_count(allowed_apps_list);
+ Evas_Object *table = elm_table_add(full_layout);
+ elm_table_homogeneous_set(table, true);
+ int count = eina_list_count(allowed_apps_list);
- int height = (APP_LAYOUT_HEIGHT + APP_LAYOUT_PAD) * (count / ITEMS_PER_ROW + (count % ITEMS_PER_ROW != 0 ? 1 : 0)) + APP_LAYOUT_HEADER;
- evas_object_size_hint_min_set(table, 0, height);
+ int height = (APP_LAYOUT_HEIGHT + APP_LAYOUT_PAD) * (count / ITEMS_PER_ROW + (count % ITEMS_PER_ROW != 0 ? 1 : 0)) + APP_LAYOUT_HEADER;
+ evas_object_size_hint_min_set(table, 0, height);
- int row_number = 0;
- while (allowed_apps_list) {
- int items_in_row = 0;
- while (allowed_apps_list && items_in_row < ITEMS_PER_ROW) {
- item_info_s *item = (item_info_s *)eina_list_data_get(allowed_apps_list);
- Evas_Object *app_layout = create_custom_layout(table, APP_LAYOUT_NAME);
+ int row_number = 0;
+ while (allowed_apps_list) {
+ int items_in_row = 0;
+ while (allowed_apps_list && items_in_row < ITEMS_PER_ROW) {
+ item_info_s *item = (item_info_s *)eina_list_data_get(allowed_apps_list);
+ Evas_Object *app_layout = create_custom_layout(table, APP_LAYOUT_NAME);
- evas_object_show(app_layout);
- Evas_Object *icon = create_icon(app_layout, item->icon);
- evas_object_show(icon);
- elm_object_part_content_set(app_layout, APP_LAYOUT_ICON_PART, icon);
- elm_object_part_text_set(app_layout, APP_LAYOUT_TEXT_PART, item->name);
- elm_table_pack(table, app_layout, items_in_row, row_number, 1, 1);
+ evas_object_show(app_layout);
+ Evas_Object *icon = create_icon(app_layout, item->icon);
+ evas_object_show(icon);
+ elm_object_part_content_set(app_layout, APP_LAYOUT_ICON_PART, icon);
+ elm_object_part_text_set(app_layout, APP_LAYOUT_TEXT_PART, item->name);
+ elm_table_pack(table, app_layout, items_in_row, row_number, 1, 1);
- allowed_apps_list = eina_list_next(allowed_apps_list);
- items_in_row++;
- }
- row_number++;
- }
+ allowed_apps_list = eina_list_next(allowed_apps_list);
+ items_in_row++;
+ }
+ row_number++;
+ }
- elm_object_part_content_set(full_layout, ALLOWED_LAYOUT_GRID_PART, table);
+ elm_object_part_content_set(full_layout, ALLOWED_LAYOUT_GRID_PART, table);
- return full_layout;
+ return full_layout;
}
static Evas_Object *_create_edit_exception_apps_list(ug_data *ugd)
{
- Evas_Object *parent = ugd->naviframe;
- Evas_Object *genlist;
+ Evas_Object *parent = ugd->naviframe;
+ Evas_Object *genlist;
- genlist = elm_genlist_add(parent);
- elm_genlist_mode_set(genlist, ELM_LIST_SCROLL);
- elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+ genlist = elm_genlist_add(parent);
+ elm_genlist_mode_set(genlist, ELM_LIST_SCROLL);
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
- /* Add Smart Callback */
- evas_object_smart_callback_add(genlist, "contracted", gl_contracted_cb, NULL);
+ /* Add Smart Callback */
+ evas_object_smart_callback_add(genlist, "contracted", gl_contracted_cb, NULL);
- append_gl_item_list(genlist, get_first_allowed_apps_list(), ITEM_STYLE_DEFAULT, NULL);
- append_gl_item_list(genlist, get_excepted_apps_list(), ITEM_STYLE_DEFAULT, NULL);
- append_gl_item_list(genlist, get_not_excepted_apps_list(), ITEM_STYLE_DEFAULT, NULL);
+ append_gl_item_list(genlist, get_first_allowed_apps_list(), ITEM_STYLE_DEFAULT, NULL);
+ append_gl_item_list(genlist, get_excepted_apps_list(), ITEM_STYLE_DEFAULT, NULL);
+ append_gl_item_list(genlist, get_not_excepted_apps_list(), ITEM_STYLE_DEFAULT, NULL);
- return genlist;
+ return genlist;
}
static bool is_list_main_need_to_be_update(item_info_s *app_data)
{
- if (!state_list) {
- state_list = eina_list_append(state_list, app_data);
- } else {
- if (eina_list_data_find(state_list, app_data))
- state_list = eina_list_remove(state_list, app_data);
- else
- state_list = eina_list_append(state_list, app_data);
- }
- NOTISET_DBG("eina_list_count(state_list) = %d", eina_list_count(state_list));
- return eina_list_count(state_list) == 0 ? false : true;
+ if (!state_list) {
+ state_list = eina_list_append(state_list, app_data);
+ } else {
+ if (eina_list_data_find(state_list, app_data))
+ state_list = eina_list_remove(state_list, app_data);
+ else
+ state_list = eina_list_append(state_list, app_data);
+ }
+ NOTISET_DBG("eina_list_count(state_list) = %d", eina_list_count(state_list));
+ return eina_list_count(state_list) == 0 ? false : true;
}
static void cancel_changes()
{
- NOTISET_TRACE_BEGIN;
- while (state_list) {
- item_info_s *app_data = eina_list_data_get(state_list);
- app_data->do_not_disturb_except = !app_data->do_not_disturb_except;
- state_list = eina_list_next(state_list);
- }
+ NOTISET_TRACE_BEGIN;
+ while (state_list) {
+ item_info_s *app_data = eina_list_data_get(state_list);
+ app_data->do_not_disturb_except = !app_data->do_not_disturb_except;
+ state_list = eina_list_next(state_list);
+ }
}
static void remove_state_list()
{
- if (state_list)
- state_list = eina_list_free(state_list);
+ if (state_list)
+ state_list = eina_list_free(state_list);
}
void _excepted_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
{
- NOTISET_TRACE_BEGIN;
- item_info_s *data_list = data;
- ret_if(!data_list);
+ NOTISET_TRACE_BEGIN;
+ item_info_s *data_list = data;
+ ret_if(!data_list);
- Eina_Bool state = elm_check_state_get(obj);
- data_list->do_not_disturb_except = state;
- is_need_to_update = is_list_main_need_to_be_update(data_list);
+ Eina_Bool state = elm_check_state_get(obj);
+ data_list->do_not_disturb_except = state;
+ is_need_to_update = is_list_main_need_to_be_update(data_list);
- NOTISET_DBG("appid = %s state = %d", data_list->appid, state);
+ NOTISET_DBG("appid = %s state = %d", data_list->appid, state);
}
static void _done_button_cb(void *data, Evas_Object *obj, void *event_info)
{
- NOTISET_TRACE_BEGIN;
+ NOTISET_TRACE_BEGIN;
- ug_data *u_data = data;
+ ug_data *u_data = data;
- EVAS_OBJECT_DELIF(u_data->done_button);
- EVAS_OBJECT_DELIF(u_data->cancel_button);
- EVAS_OBJECT_DELIF(u_data->list_sub);
+ EVAS_OBJECT_DELIF(u_data->done_button);
+ EVAS_OBJECT_DELIF(u_data->cancel_button);
+ EVAS_OBJECT_DELIF(u_data->list_sub);
- if (u_data->list_main && is_need_to_update) {
- update_do_not_disturb_application_list();
- elm_genlist_clear(u_data->list_main);
- do_not_disturb_append_items_in_list(u_data->list_main);
- is_need_to_update = false;
- }
+ if (u_data->list_main && is_need_to_update) {
+ update_do_not_disturb_application_list();
+ elm_genlist_clear(u_data->list_main);
+ do_not_disturb_append_items_in_list(u_data->list_main);
+ is_need_to_update = false;
+ }
- remove_state_list();
- update_system_settings();
- elm_naviframe_item_pop(u_data->naviframe);
+ remove_state_list();
+ update_system_settings();
+ elm_naviframe_item_pop(u_data->naviframe);
}
void _cancel_button_cb(void *data, Evas_Object *obj, void *event_info)
{
- NOTISET_TRACE_BEGIN;
- ug_data *u_data = data;
- ret_if(!data);
+ NOTISET_TRACE_BEGIN;
+ ug_data *u_data = data;
+ ret_if(!data);
- EVAS_OBJECT_DELIF(u_data->done_button);
- EVAS_OBJECT_DELIF(u_data->cancel_button);
- EVAS_OBJECT_DELIF(u_data->list_sub);
+ EVAS_OBJECT_DELIF(u_data->done_button);
+ EVAS_OBJECT_DELIF(u_data->cancel_button);
+ EVAS_OBJECT_DELIF(u_data->list_sub);
- elm_naviframe_item_pop(u_data->naviframe);
+ elm_naviframe_item_pop(u_data->naviframe);
}
static Eina_Bool _back_button_cb(void *data, Elm_Object_Item *it)
{
- NOTISET_TRACE_BEGIN;
- if (is_need_to_update)
- cancel_changes();
- return EINA_TRUE;
+ NOTISET_TRACE_BEGIN;
+ if (is_need_to_update)
+ cancel_changes();
+ return EINA_TRUE;
}
void exception_application_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
- NOTISET_TRACE_BEGIN;
- ug_data *u_data = data;
- ret_if(!u_data);
-
- Elm_Object_Item *navi_item = NULL;
- Evas_Object *cancel_btn = NULL;
- Evas_Object *done_btn = NULL;
-
- u_data->list_sub = _create_edit_exception_apps_list(u_data);
-
- /* Push to naviframe */
- navi_item = elm_naviframe_item_push(u_data->naviframe, APP_STRING("IDS_ST_HEADER_MANAGE_ALLOWED_NOTI_ABB2"), NULL, NULL, u_data->list_sub, NULL);
- elm_naviframe_item_pop_cb_set(navi_item, _back_button_cb, u_data);
-
- /* Title Cancel Button */
- cancel_btn = elm_button_add(u_data->naviframe);
- elm_object_style_set(cancel_btn, "naviframe/title_left");
- evas_object_smart_callback_add(cancel_btn, "clicked", _cancel_button_cb, u_data);
- elm_object_text_set(cancel_btn, APP_STRING("IDS_TPLATFORM_ACBUTTON_CANCEL_ABB"));
- elm_object_item_part_content_set(navi_item, "title_left_btn", cancel_btn);
- u_data->cancel_button = cancel_btn;
-
- /* Title Done Button */
- done_btn = elm_button_add(u_data->naviframe);
- elm_object_style_set(done_btn, "naviframe/title_right");
- evas_object_smart_callback_add(done_btn, "clicked", _done_button_cb, u_data);
- elm_object_text_set(done_btn, APP_STRING("IDS_TPLATFORM_ACBUTTON_DONE_ABB"));
- elm_object_item_part_content_set(navi_item, "title_right_btn", done_btn);
- u_data->done_button = done_btn;
+ NOTISET_TRACE_BEGIN;
+ ug_data *u_data = data;
+ ret_if(!u_data);
+
+ Elm_Object_Item *navi_item = NULL;
+ Evas_Object *cancel_btn = NULL;
+ Evas_Object *done_btn = NULL;
+
+ u_data->list_sub = _create_edit_exception_apps_list(u_data);
+
+ /* Push to naviframe */
+ navi_item = elm_naviframe_item_push(u_data->naviframe, APP_STRING("IDS_ST_HEADER_MANAGE_ALLOWED_NOTI_ABB2"), NULL, NULL, u_data->list_sub, NULL);
+ elm_naviframe_item_pop_cb_set(navi_item, _back_button_cb, u_data);
+
+ /* Title Cancel Button */
+ cancel_btn = elm_button_add(u_data->naviframe);
+ elm_object_style_set(cancel_btn, "naviframe/title_left");
+ evas_object_smart_callback_add(cancel_btn, "clicked", _cancel_button_cb, u_data);
+ elm_object_text_set(cancel_btn, APP_STRING("IDS_TPLATFORM_ACBUTTON_CANCEL_ABB"));
+ elm_object_item_part_content_set(navi_item, "title_left_btn", cancel_btn);
+ u_data->cancel_button = cancel_btn;
+
+ /* Title Done Button */
+ done_btn = elm_button_add(u_data->naviframe);
+ elm_object_style_set(done_btn, "naviframe/title_right");
+ evas_object_smart_callback_add(done_btn, "clicked", _done_button_cb, u_data);
+ elm_object_text_set(done_btn, APP_STRING("IDS_TPLATFORM_ACBUTTON_DONE_ABB"));
+ elm_object_item_part_content_set(navi_item, "title_right_btn", done_btn);
+ u_data->done_button = done_btn;
}
void show_all_content_clicked()
{
- NOTISET_TRACE_BEGIN;
- ug_data *ugd = get_app_ui_data();
+ NOTISET_TRACE_BEGIN;
+ ug_data *ugd = get_app_ui_data();
- Elm_Object_Item *genlist_item = elm_genlist_first_item_get(ugd->list_sub);
+ Elm_Object_Item *genlist_item = elm_genlist_first_item_get(ugd->list_sub);
- if (genlist_item)
- elm_genlist_clear(ugd->list_sub);
- g_lock_screen_content_level = SHOW_ALL_CONTENT;
- append_gl_start_option(ugd->list_sub, "type1", "show-all-content");
+ if (genlist_item)
+ elm_genlist_clear(ugd->list_sub);
+ g_lock_screen_content_level = SHOW_ALL_CONTENT;
+ append_gl_start_option(ugd->list_sub, "type1", "show-all-content");
}
void hide_sensitive_content_clicked()
{
- NOTISET_TRACE_BEGIN;
- ug_data *ugd = get_app_ui_data();
+ NOTISET_TRACE_BEGIN;
+ ug_data *ugd = get_app_ui_data();
- Elm_Object_Item *genlist_item = elm_genlist_first_item_get(ugd->list_sub);
+ Elm_Object_Item *genlist_item = elm_genlist_first_item_get(ugd->list_sub);
- if (genlist_item)
- elm_genlist_clear(ugd->list_sub);
- g_lock_screen_content_level = HIDE_SENSITIVE_CONTENT;
- append_gl_start_option(ugd->list_sub, "type1", "hide-sensitive-content");
+ if (genlist_item)
+ elm_genlist_clear(ugd->list_sub);
+ g_lock_screen_content_level = HIDE_SENSITIVE_CONTENT;
+ append_gl_start_option(ugd->list_sub, "type1", "hide-sensitive-content");
}
void do_not_show_notifications_clicked()
{
- NOTISET_TRACE_BEGIN;
- ug_data *ugd = get_app_ui_data();
+ NOTISET_TRACE_BEGIN;
+ ug_data *ugd = get_app_ui_data();
- elm_genlist_clear(ugd->list_sub);
- g_lock_screen_content_level = DO_NOT_SHOW_NOTIFICATIONS;
+ elm_genlist_clear(ugd->list_sub);
+ g_lock_screen_content_level = DO_NOT_SHOW_NOTIFICATIONS;
}
void update_lock_screen_noti_settings()
{
- set_lock_screen_content_setting(g_lock_screen_content_level);
- update_system_settings();
+ set_lock_screen_content_setting(g_lock_screen_content_level);
+ update_system_settings();
}
static Eina_Bool _notifiacation_setting_main_pop_cb(void *data, Elm_Object_Item * it)
{
- NOTISET_TRACE_BEGIN;
+ NOTISET_TRACE_BEGIN;
ug_data *ugd = (ug_data *) data;
retv_if(!ugd, EINA_FALSE);
if (ugd->init_thread)
Evas_Object *_create_lockscreen_content(ug_data *ugd)
{
- Evas_Object *layout = create_custom_layout(ugd->naviframe, LAYOUT_NAME);
-
- /* Upper genlist */
- Evas_Object *upper_genlist = elm_genlist_add(layout);
- evas_object_size_hint_weight_set(upper_genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(upper_genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_genlist_mode_set(upper_genlist, ELM_LIST_COMPRESS);
- elm_scroller_content_min_limit(upper_genlist, false, true);
- evas_object_show(upper_genlist);
- ugd->list_sub = upper_genlist;
-
- elm_object_part_content_set(layout, "first_item", upper_genlist);
-
- /* Lower genlist */
- Evas_Object *lower_genlist = elm_genlist_add(layout);
- append_gl_radio_item_list(lower_genlist, get_lower_noti_list(), "default");
- evas_object_size_hint_weight_set(lower_genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(lower_genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_genlist_mode_set(lower_genlist, ELM_LIST_COMPRESS);
- elm_scroller_content_min_limit(lower_genlist, false, true);
- evas_object_show(lower_genlist);
-
- elm_object_part_content_set(layout, "list", lower_genlist);
- evas_object_show(layout);
-
- return layout;
+ Evas_Object *layout = create_custom_layout(ugd->naviframe, LAYOUT_NAME);
+
+ /* Upper genlist */
+ Evas_Object *upper_genlist = elm_genlist_add(layout);
+ evas_object_size_hint_weight_set(upper_genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(upper_genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_genlist_mode_set(upper_genlist, ELM_LIST_COMPRESS);
+ elm_scroller_content_min_limit(upper_genlist, false, true);
+ evas_object_show(upper_genlist);
+ ugd->list_sub = upper_genlist;
+
+ elm_object_part_content_set(layout, "first_item", upper_genlist);
+
+ /* Lower genlist */
+ Evas_Object *lower_genlist = elm_genlist_add(layout);
+ append_gl_radio_item_list(lower_genlist, get_lower_noti_list(), "default");
+ evas_object_size_hint_weight_set(lower_genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(lower_genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_genlist_mode_set(lower_genlist, ELM_LIST_COMPRESS);
+ elm_scroller_content_min_limit(lower_genlist, false, true);
+ evas_object_show(lower_genlist);
+
+ elm_object_part_content_set(layout, "list", lower_genlist);
+ evas_object_show(layout);
+
+ return layout;
}
static void *_update_dnd_view(void *data)
static void _create_do_not_disturb_view(void *data)
{
- NOTISET_TRACE_BEGIN;
- ug_data *ugd = (ug_data *) data;
- ret_if(!ugd);
-
- /* back Button */
- Evas_Object *back_btn = elm_button_add(ugd->naviframe);
- elm_object_style_set(back_btn, "naviframe/back_btn/default");
- evas_object_smart_callback_add(back_btn, "clicked", back_button_cb, ugd->naviframe);
-
- /* Loading Layout */
- Evas_Object *load_layout = create_layout(ugd->naviframe);
- elm_layout_theme_set(load_layout, "layout", "nocontents", "text");
- elm_object_text_set(load_layout, APP_STRING("IDS_ST_HEADER_LOADING_ING_ABB"));
-
- /* Push to naviframe */
- ugd->navi_item = elm_naviframe_item_push(ugd->naviframe, APP_STRING("IDS_ST_HEADER_DO_NOT_DISTURB_ABB"), back_btn, NULL, load_layout, NULL);
- elm_naviframe_item_pop_cb_set(ugd->navi_item, _notifiacation_setting_main_pop_cb, ugd);
-
- /* run lazy init */
- ugd->init_thread = ecore_thread_run(_init_dnd_app_list, _init_finish_dnd_app_list, _init_finish_dnd_app_list, ugd);
+ NOTISET_TRACE_BEGIN;
+ ug_data *ugd = (ug_data *) data;
+ ret_if(!ugd);
+
+ /* back Button */
+ Evas_Object *back_btn = elm_button_add(ugd->naviframe);
+ elm_object_style_set(back_btn, "naviframe/back_btn/default");
+ evas_object_smart_callback_add(back_btn, "clicked", back_button_cb, ugd->naviframe);
+
+ /* Loading Layout */
+ Evas_Object *load_layout = create_layout(ugd->naviframe);
+ elm_layout_theme_set(load_layout, "layout", "nocontents", "text");
+ elm_object_text_set(load_layout, APP_STRING("IDS_ST_HEADER_LOADING_ING_ABB"));
+
+ /* Push to naviframe */
+ ugd->navi_item = elm_naviframe_item_push(ugd->naviframe, APP_STRING("IDS_ST_HEADER_DO_NOT_DISTURB_ABB"), back_btn, NULL, load_layout, NULL);
+ elm_naviframe_item_pop_cb_set(ugd->navi_item, _notifiacation_setting_main_pop_cb, ugd);
+
+ /* run lazy init */
+ ugd->init_thread = ecore_thread_run(_init_dnd_app_list, _init_finish_dnd_app_list, _init_finish_dnd_app_list, ugd);
}
static void _create_notif_on_lock_screen_view(void *data)
{
- NOTISET_TRACE_BEGIN;
- ug_data *u_data = (ug_data *)data;
- ret_if(!u_data);
-
- create_notification_on_ls_list();
-
- /* Create genlist */
- Evas_Object *layout = _create_lockscreen_content(u_data);
-
- /* Push to naviframe */
- u_data->navi_item = elm_naviframe_item_push(u_data->naviframe, strdup(APP_STRING("IDS_QP_HEADER_LOCK_SCREEN_CONTENT_ABB")), NULL, NULL, layout, NULL);
- elm_naviframe_item_pop_cb_set(u_data->navi_item, _notifiacation_setting_main_pop_cb, u_data);
-
- /* Title Cancel Button */
- Evas_Object *cancel_btn = elm_button_add(u_data->naviframe);
- elm_object_style_set(cancel_btn, "naviframe/title_left");
- evas_object_smart_callback_add(cancel_btn, "clicked", cancel_button_noti_ls_cb, u_data);
- elm_object_text_set(cancel_btn, APP_STRING("IDS_TPLATFORM_ACBUTTON_CANCEL_ABB"));
- elm_object_item_part_content_set(u_data->navi_item, "title_left_btn", cancel_btn);
- u_data->cancel_button = cancel_btn;
-
- /* Title Done Button */
- Evas_Object *done_btn = elm_button_add(u_data->naviframe);
- elm_object_style_set(done_btn, "naviframe/title_right");
- evas_object_smart_callback_add(done_btn, "clicked", done_button_noti_ls_cb, u_data);
- elm_object_text_set(done_btn, APP_STRING("IDS_TPLATFORM_ACBUTTON_DONE_ABB"));
- elm_object_item_part_content_set(u_data->navi_item, "title_right_btn", done_btn);
- u_data->done_button = done_btn;
+ NOTISET_TRACE_BEGIN;
+ ug_data *u_data = (ug_data *)data;
+ ret_if(!u_data);
+
+ create_notification_on_ls_list();
+
+ /* Create genlist */
+ Evas_Object *layout = _create_lockscreen_content(u_data);
+
+ /* Push to naviframe */
+ u_data->navi_item = elm_naviframe_item_push(u_data->naviframe, strdup(APP_STRING("IDS_QP_HEADER_LOCK_SCREEN_CONTENT_ABB")), NULL, NULL, layout, NULL);
+ elm_naviframe_item_pop_cb_set(u_data->navi_item, _notifiacation_setting_main_pop_cb, u_data);
+
+ /* Title Cancel Button */
+ Evas_Object *cancel_btn = elm_button_add(u_data->naviframe);
+ elm_object_style_set(cancel_btn, "naviframe/title_left");
+ evas_object_smart_callback_add(cancel_btn, "clicked", cancel_button_noti_ls_cb, u_data);
+ elm_object_text_set(cancel_btn, APP_STRING("IDS_TPLATFORM_ACBUTTON_CANCEL_ABB"));
+ elm_object_item_part_content_set(u_data->navi_item, "title_left_btn", cancel_btn);
+ u_data->cancel_button = cancel_btn;
+
+ /* Title Done Button */
+ Evas_Object *done_btn = elm_button_add(u_data->naviframe);
+ elm_object_style_set(done_btn, "naviframe/title_right");
+ evas_object_smart_callback_add(done_btn, "clicked", done_button_noti_ls_cb, u_data);
+ elm_object_text_set(done_btn, APP_STRING("IDS_TPLATFORM_ACBUTTON_DONE_ABB"));
+ elm_object_item_part_content_set(u_data->navi_item, "title_right_btn", done_btn);
+ u_data->done_button = done_btn;
}
static void _create_notif_view(void *data)
{
- NOTISET_TRACE_BEGIN;
+ NOTISET_TRACE_BEGIN;
ug_data *ugd = (ug_data *) data;
ret_if(!ugd);
if (!create_app_notification_list()) {
- ui_app_exit();
- return;
+ ui_app_exit();
+ return;
}
/* Create genlist */
static Evas_Object *_create_fullview(Evas_Object *parent, ug_data *ugd, app_type type)
{
- NOTISET_TRACE_BEGIN;
- retv_if(!ugd, NULL);
+ NOTISET_TRACE_BEGIN;
+ retv_if(!ugd, NULL);
- switch (type) {
- case NOTIF_APP_TYPE:
- _create_notif_view(ugd);
- break;
+ switch (type) {
+ case NOTIF_APP_TYPE:
+ _create_notif_view(ugd);
+ break;
- case DO_NOT_DISTURB_APP_TYPE:
- _create_do_not_disturb_view(ugd);
- break;
+ case DO_NOT_DISTURB_APP_TYPE:
+ _create_do_not_disturb_view(ugd);
+ break;
- case NOTIFICATION_ON_LOCK_SCREEN_APP_TYPE:
- _create_notif_on_lock_screen_view(ugd);
- break;
+ case NOTIFICATION_ON_LOCK_SCREEN_APP_TYPE:
+ _create_notif_on_lock_screen_view(ugd);
+ break;
- default:
- NOTISET_DBG("Unknown app type");
- break;
- }
+ default:
+ NOTISET_DBG("Unknown app type");
+ break;
+ }
- return ugd->layout;
+ return ugd->layout;
}
static bool on_create(void *priv)
{
- NOTISET_TRACE_BEGIN;
+ NOTISET_TRACE_BEGIN;
ug_data *ugd = priv;
elm_app_base_scale_set(2.6);
- update_character_orientation();
+ update_character_orientation();
/* Create window */
ugd->win = _create_win();
static void on_destroy(void *priv)
{
- NOTISET_TRACE_BEGIN;
+ NOTISET_TRACE_BEGIN;
ug_data *ugd = priv;
remove_apps_noti_allowed_list();
remove_apps_noti_blocked_list();
static void on_app_control(app_control_h app_control, void *user_data)
{
- NOTISET_TRACE_BEGIN;
+ NOTISET_TRACE_BEGIN;
- ug_data *ugd = user_data;
- char *op_str = NULL;
+ ug_data *ugd = user_data;
+ char *op_str = NULL;
- app_control_get_operation(app_control, &op_str);
+ app_control_get_operation(app_control, &op_str);
- if (!op_str) {
- NOTISET_DBG("app_control operation is null");
- return;
- }
+ if (!op_str) {
+ NOTISET_DBG("app_control operation is null");
+ return;
+ }
- NOTISET_DBG("%s", op_str);
+ NOTISET_DBG("%s", op_str);
- app_type type = NOTIF_APP_TYPE;
- if (strcmp(DO_NOT_DISTURB_OP, op_str) == 0) {
- type = DO_NOT_DISTURB_APP_TYPE;
- } else if (strcmp(NOTIFICATIONS_ON_LOCK_SCREEN_OP, op_str) == 0) {
- type = NOTIFICATION_ON_LOCK_SCREEN_APP_TYPE;
- }
+ app_type type = NOTIF_APP_TYPE;
+ if (strcmp(DO_NOT_DISTURB_OP, op_str) == 0) {
+ type = DO_NOT_DISTURB_APP_TYPE;
+ } else if (strcmp(NOTIFICATIONS_ON_LOCK_SCREEN_OP, op_str) == 0) {
+ type = NOTIFICATION_ON_LOCK_SCREEN_APP_TYPE;
+ }
- ugd->layout = _create_fullview(ugd->win, ugd, type);
- elm_object_content_set(ugd->win, ugd->layout);
+ ugd->layout = _create_fullview(ugd->win, ugd, type);
+ elm_object_content_set(ugd->win, ugd->layout);
- free(op_str);
+ free(op_str);
}
static void update_character_orientation()
{
- char *lang = NULL;
- system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &lang);
- if (lang) {
- NOTISET_DBG("Language: %s", lang);
- elm_language_set(lang);
-
- i18n_ulocale_layout_type_e layout = I18N_ULOCALE_LAYOUT_UNKNOWN;
- if (i18n_ulocale_get_character_orientation(lang, &layout) == I18N_ERROR_NONE) {
- if (layout == I18N_ULOCALE_LAYOUT_LTR)
- elm_config_mirrored_set(false);
- else if (layout == I18N_ULOCALE_LAYOUT_RTL)
- elm_config_mirrored_set(true);
- else
- NOTISET_ERR("Unsupported character orientation type: %s", layout);
- }
- free(lang);
- }
+ char *lang = NULL;
+ system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &lang);
+ if (lang) {
+ NOTISET_DBG("Language: %s", lang);
+ elm_language_set(lang);
+
+ i18n_ulocale_layout_type_e layout = I18N_ULOCALE_LAYOUT_UNKNOWN;
+ if (i18n_ulocale_get_character_orientation(lang, &layout) == I18N_ERROR_NONE) {
+ if (layout == I18N_ULOCALE_LAYOUT_LTR)
+ elm_config_mirrored_set(false);
+ else if (layout == I18N_ULOCALE_LAYOUT_RTL)
+ elm_config_mirrored_set(true);
+ else
+ NOTISET_ERR("Unsupported character orientation type: %s", layout);
+ }
+ free(lang);
+ }
}
static void on_language(app_event_info_h event_info, void *user_data)
{
- update_character_orientation();
+ update_character_orientation();
}
int main(int argc, char *argv[])
NOTISET_TRACE_BEGIN;
ug_data *ug_main = calloc(1, sizeof(ug_data));
- if (!ug_main) {
- NOTISET_ERR("CALLOC ERROR");
- ug_main = NULL;
- assert(false);
- }
+ if (!ug_main) {
+ NOTISET_ERR("CALLOC ERROR");
+ ug_main = NULL;
+ assert(false);
+ }
set_app_ui_data(ug_main);
Eina_Bool create_app_notification_list()
{
- NOTISET_TRACE_BEGIN;
- int i = 0;
- int count = 0;
- char *package_name = NULL;
- bool allow_to_notify = false;
- bool do_not_disturb_except = false;
- notification_setting_h setting_array = NULL;
- notification_setting_h temp = NULL;
- item_info_s *item_info = NULL;
-
- remove_apps_noti_allowed_list();
- remove_apps_noti_blocked_list();
- setting_info = calloc(1, sizeof(setting_info_s));
- retv_if(!setting_info, EINA_FALSE);
-
- notification_setting_get_setting_array(&setting_array, &count);
- retv_if(!setting_array, EINA_FALSE);
- NOTISET_DBG("count %d", count);
-
- for (i = 0; i < count; i++) {
- item_info = calloc(1, sizeof(item_info_s));
- retv_if(!item_info, EINA_FALSE);
-
- temp = setting_array + i;
-
- notification_setting_get_appid(temp, &package_name);
- item_info->appid = package_name;
-
- notification_setting_get_allow_to_notify(temp, &allow_to_notify);
- item_info->allow_to_notify = allow_to_notify;
-
- notification_setting_get_do_not_disturb_except(temp, &do_not_disturb_except);
- item_info->do_not_disturb_except = do_not_disturb_except;
-
- item_info->icon = get_app_icon(package_name);
- item_info->name = get_app_name(package_name);
-
- item_info->index = i;
-
- if (item_info->name && strcmp(package_name, VOICE_CALL_PACKAGE)
- && strcmp(package_name, CALENDAR_PACKAGE)
- && strcmp(package_name, CLOCK_PACKAGE)) {
- if (item_info->allow_to_notify)
- setting_info->apps_noti_allowed_list = eina_list_append(setting_info->apps_noti_allowed_list, item_info);
- else
- setting_info->apps_noti_blocked_list = eina_list_append(setting_info->apps_noti_blocked_list, item_info);
- } else {
- FREEIF(package_name);
- FREEIF(item_info->name);
- FREEIF(item_info->icon);
- FREEIF(item_info);
- }
- }
-
- setting_info->apps_noti_allowed_list = eina_list_sort(setting_info->apps_noti_allowed_list, eina_list_count(setting_info->apps_noti_allowed_list), apps_sort_cb);
- setting_info->apps_noti_blocked_list = eina_list_sort(setting_info->apps_noti_blocked_list, eina_list_count(setting_info->apps_noti_blocked_list), apps_sort_cb);
- notification_setting_free_notification(setting_array);
- return EINA_TRUE;
+ NOTISET_TRACE_BEGIN;
+ int i = 0;
+ int count = 0;
+ char *package_name = NULL;
+ bool allow_to_notify = false;
+ bool do_not_disturb_except = false;
+ notification_setting_h setting_array = NULL;
+ notification_setting_h temp = NULL;
+ item_info_s *item_info = NULL;
+
+ remove_apps_noti_allowed_list();
+ remove_apps_noti_blocked_list();
+ setting_info = calloc(1, sizeof(setting_info_s));
+ retv_if(!setting_info, EINA_FALSE);
+
+ notification_setting_get_setting_array(&setting_array, &count);
+ retv_if(!setting_array, EINA_FALSE);
+ NOTISET_DBG("count %d", count);
+
+ for (i = 0; i < count; i++) {
+ item_info = calloc(1, sizeof(item_info_s));
+ retv_if(!item_info, EINA_FALSE);
+
+ temp = setting_array + i;
+
+ notification_setting_get_appid(temp, &package_name);
+ item_info->appid = package_name;
+
+ notification_setting_get_allow_to_notify(temp, &allow_to_notify);
+ item_info->allow_to_notify = allow_to_notify;
+
+ notification_setting_get_do_not_disturb_except(temp, &do_not_disturb_except);
+ item_info->do_not_disturb_except = do_not_disturb_except;
+
+ item_info->icon = get_app_icon(package_name);
+ item_info->name = get_app_name(package_name);
+
+ item_info->index = i;
+
+ if (item_info->name && strcmp(package_name, VOICE_CALL_PACKAGE)
+ && strcmp(package_name, CALENDAR_PACKAGE)
+ && strcmp(package_name, CLOCK_PACKAGE)) {
+ if (item_info->allow_to_notify)
+ setting_info->apps_noti_allowed_list = eina_list_append(setting_info->apps_noti_allowed_list, item_info);
+ else
+ setting_info->apps_noti_blocked_list = eina_list_append(setting_info->apps_noti_blocked_list, item_info);
+ } else {
+ FREEIF(package_name);
+ FREEIF(item_info->name);
+ FREEIF(item_info->icon);
+ FREEIF(item_info);
+ }
+ }
+
+ setting_info->apps_noti_allowed_list = eina_list_sort(setting_info->apps_noti_allowed_list, eina_list_count(setting_info->apps_noti_allowed_list), apps_sort_cb);
+ setting_info->apps_noti_blocked_list = eina_list_sort(setting_info->apps_noti_blocked_list, eina_list_count(setting_info->apps_noti_blocked_list), apps_sort_cb);
+ notification_setting_free_notification(setting_array);
+ return EINA_TRUE;
}
void update_app_notification_list_on_item(item_info_s *item_info)
{
- ret_if(!item_info);
-
- setting_info->apps_noti_allowed_list = eina_list_remove(setting_info->apps_noti_allowed_list, item_info);
- setting_info->apps_noti_blocked_list = eina_list_remove(setting_info->apps_noti_blocked_list, item_info);
- if (get_allow_to_nofity(item_info->appid))
- setting_info->apps_noti_allowed_list = eina_list_sorted_insert(setting_info->apps_noti_allowed_list, apps_sort_cb, item_info);
- else
- setting_info->apps_noti_blocked_list = eina_list_sorted_insert(setting_info->apps_noti_blocked_list, apps_sort_cb, item_info);
+ ret_if(!item_info);
+
+ setting_info->apps_noti_allowed_list = eina_list_remove(setting_info->apps_noti_allowed_list, item_info);
+ setting_info->apps_noti_blocked_list = eina_list_remove(setting_info->apps_noti_blocked_list, item_info);
+ if (get_allow_to_nofity(item_info->appid))
+ setting_info->apps_noti_allowed_list = eina_list_sorted_insert(setting_info->apps_noti_allowed_list, apps_sort_cb, item_info);
+ else
+ setting_info->apps_noti_blocked_list = eina_list_sorted_insert(setting_info->apps_noti_blocked_list, apps_sort_cb, item_info);
}
void create_do_not_disturb_application_list()
{
- NOTISET_TRACE_BEGIN;
- int i = 0;
- int count = 0;
- char *package_name = NULL;
- bool allow_to_notify = false;
- bool do_not_disturb_except = false;
- notification_setting_h setting_array = NULL;
- notification_setting_h temp = NULL;
-
- remove_excepted_apps_list();
-
- setting_info = calloc(1, sizeof(setting_info_s));
- ret_if(!setting_info);
-
- notification_setting_get_setting_array(&setting_array, &count);
- ret_if(!setting_array);
- NOTISET_DBG("count %d", count);
-
- item_info_s *item_info = NULL;
- for (i = 0; i < count; i++) {
- item_info = calloc(1, sizeof(item_info_s));
- if (item_info) {
- temp = setting_array + i;
-
- notification_setting_get_package_name(temp, &package_name);
- item_info->appid = package_name;
-
- notification_setting_get_allow_to_notify(temp, &allow_to_notify);
- item_info->allow_to_notify = allow_to_notify;
-
- notification_setting_get_do_not_disturb_except(temp, &do_not_disturb_except);
- item_info->do_not_disturb_except = do_not_disturb_except;
-
- item_info->icon = get_app_icon(package_name);
-
- if (!strcmp(package_name, CALENDAR_PACKAGE))
- item_info->name = strdup(APP_STRING("IDS_COM_BODY_CALENDAR_EVENTS"));
- else if (!strcmp(package_name, CLOCK_PACKAGE))
- item_info->name = strdup(APP_STRING("IDS_ST_BODY_ALARMS"));
- else
- item_info->name = get_app_name(package_name);
-
- item_info->index = i;
-
- if (item_info->name) {
- if ((allow_to_notify && !strcmp(package_name, MESSAGES_PACKAGE)) || !strcmp(package_name, CLOCK_PACKAGE)
- || !strcmp(package_name, CALENDAR_PACKAGE)) {
- setting_info->first_allowed_list = eina_list_append(setting_info->first_allowed_list, item_info);
- if (do_not_disturb_except) {
- setting_info->first_excepted_list = eina_list_append(setting_info->first_excepted_list, item_info);
- }
- }
-
- if (allow_to_notify && strcmp(package_name, MESSAGES_PACKAGE)
- && strcmp(package_name, CALENDAR_PACKAGE)
- && strcmp(package_name, CLOCK_PACKAGE)) {
- if (do_not_disturb_except) {
- setting_info->excepted_list = eina_list_append(setting_info->excepted_list, item_info);
- } else {
- setting_info->not_excepted_list = eina_list_append(setting_info->not_excepted_list, item_info);
- }
- }
- } else {
- FREEIF(package_name);
- FREEIF(item_info->name);
- FREEIF(item_info->icon);
- FREEIF(item_info);
- }
-
- }
- }
-
- setting_info->first_excepted_list = eina_list_sort(setting_info->first_excepted_list, eina_list_count(setting_info->first_excepted_list), apps_sort_cb);
- setting_info->first_allowed_list = eina_list_sort(setting_info->first_allowed_list, eina_list_count(setting_info->first_allowed_list), apps_sort_cb);
- setting_info->excepted_list = eina_list_sort(setting_info->excepted_list, eina_list_count(setting_info->excepted_list), apps_sort_cb);
- setting_info->not_excepted_list = eina_list_sort(setting_info->not_excepted_list, eina_list_count(setting_info->not_excepted_list), apps_sort_cb);
-
- notification_setting_free_notification(setting_array);
+ NOTISET_TRACE_BEGIN;
+ int i = 0;
+ int count = 0;
+ char *package_name = NULL;
+ bool allow_to_notify = false;
+ bool do_not_disturb_except = false;
+ notification_setting_h setting_array = NULL;
+ notification_setting_h temp = NULL;
+
+ remove_excepted_apps_list();
+
+ setting_info = calloc(1, sizeof(setting_info_s));
+ ret_if(!setting_info);
+
+ notification_setting_get_setting_array(&setting_array, &count);
+ ret_if(!setting_array);
+ NOTISET_DBG("count %d", count);
+
+ item_info_s *item_info = NULL;
+ for (i = 0; i < count; i++) {
+ item_info = calloc(1, sizeof(item_info_s));
+ if (item_info) {
+ temp = setting_array + i;
+
+ notification_setting_get_package_name(temp, &package_name);
+ item_info->appid = package_name;
+
+ notification_setting_get_allow_to_notify(temp, &allow_to_notify);
+ item_info->allow_to_notify = allow_to_notify;
+
+ notification_setting_get_do_not_disturb_except(temp, &do_not_disturb_except);
+ item_info->do_not_disturb_except = do_not_disturb_except;
+
+ item_info->icon = get_app_icon(package_name);
+
+ if (!strcmp(package_name, CALENDAR_PACKAGE))
+ item_info->name = strdup(APP_STRING("IDS_COM_BODY_CALENDAR_EVENTS"));
+ else if (!strcmp(package_name, CLOCK_PACKAGE))
+ item_info->name = strdup(APP_STRING("IDS_ST_BODY_ALARMS"));
+ else
+ item_info->name = get_app_name(package_name);
+
+ item_info->index = i;
+
+ if (item_info->name) {
+ if ((allow_to_notify && !strcmp(package_name, MESSAGES_PACKAGE))
+ || !strcmp(package_name, CLOCK_PACKAGE)
+ || !strcmp(package_name, CALENDAR_PACKAGE)) {
+ setting_info->first_allowed_list = eina_list_append(setting_info->first_allowed_list, item_info);
+ if (do_not_disturb_except) {
+ setting_info->first_excepted_list = eina_list_append(setting_info->first_excepted_list, item_info);
+ }
+ }
+
+ if (allow_to_notify && strcmp(package_name, MESSAGES_PACKAGE)
+ && strcmp(package_name, CALENDAR_PACKAGE)
+ && strcmp(package_name, CLOCK_PACKAGE)) {
+ if (do_not_disturb_except) {
+ setting_info->excepted_list = eina_list_append(setting_info->excepted_list, item_info);
+ } else {
+ setting_info->not_excepted_list = eina_list_append(setting_info->not_excepted_list, item_info);
+ }
+ }
+ } else {
+ FREEIF(package_name);
+ FREEIF(item_info->name);
+ FREEIF(item_info->icon);
+ FREEIF(item_info);
+ }
+ }
+ }
+
+ setting_info->first_excepted_list = eina_list_sort(setting_info->first_excepted_list, eina_list_count(setting_info->first_excepted_list), apps_sort_cb);
+ setting_info->first_allowed_list = eina_list_sort(setting_info->first_allowed_list, eina_list_count(setting_info->first_allowed_list), apps_sort_cb);
+ setting_info->excepted_list = eina_list_sort(setting_info->excepted_list, eina_list_count(setting_info->excepted_list), apps_sort_cb);
+ setting_info->not_excepted_list = eina_list_sort(setting_info->not_excepted_list, eina_list_count(setting_info->not_excepted_list), apps_sort_cb);
+
+ notification_setting_free_notification(setting_array);
}
void update_do_not_disturb_application_list()
{
- NOTISET_TRACE_BEGIN;
-
- setting_info->first_excepted_list = NULL;
- Eina_List *sub_list = NULL;
-
- Eina_List *list = get_first_allowed_apps_list();
- while (list) {
- item_info_s *item = (item_info_s *) eina_list_data_get(list);
- if (item->do_not_disturb_except)
- setting_info->first_excepted_list = eina_list_append(setting_info->first_excepted_list, item);
-
- list = eina_list_next(list);
- }
-
- list = get_excepted_apps_list();
- while (list) {
- item_info_s *item = (item_info_s *) eina_list_data_get(list);
- if (item->do_not_disturb_except)
- sub_list = eina_list_append(sub_list, item);
- else
- setting_info->not_excepted_list = eina_list_sorted_insert(setting_info->not_excepted_list, apps_sort_cb, item);
-
- list = eina_list_next(list);
- }
- setting_info->excepted_list = sub_list;
-
- list = get_not_excepted_apps_list();
- sub_list = NULL;
- while (list) {
- item_info_s *item = (item_info_s *)eina_list_data_get(list);
- if (item->do_not_disturb_except)
- setting_info->excepted_list = eina_list_sorted_insert(setting_info->excepted_list, apps_sort_cb, item);
- else
- sub_list = eina_list_append(sub_list, item);
-
- list = eina_list_next(list);
- }
- setting_info->not_excepted_list = sub_list;
+ NOTISET_TRACE_BEGIN;
+
+ setting_info->first_excepted_list = NULL;
+ Eina_List *sub_list = NULL;
+
+ Eina_List *list = get_first_allowed_apps_list();
+ while (list) {
+ item_info_s *item = (item_info_s *) eina_list_data_get(list);
+ if (item->do_not_disturb_except)
+ setting_info->first_excepted_list = eina_list_append(setting_info->first_excepted_list, item);
+
+ list = eina_list_next(list);
+ }
+
+ list = get_excepted_apps_list();
+ while (list) {
+ item_info_s *item = (item_info_s *) eina_list_data_get(list);
+ if (item->do_not_disturb_except)
+ sub_list = eina_list_append(sub_list, item);
+ else
+ setting_info->not_excepted_list = eina_list_sorted_insert(setting_info->not_excepted_list, apps_sort_cb, item);
+
+ list = eina_list_next(list);
+ }
+ setting_info->excepted_list = sub_list;
+
+ list = get_not_excepted_apps_list();
+ sub_list = NULL;
+ while (list) {
+ item_info_s *item = (item_info_s *)eina_list_data_get(list);
+ if (item->do_not_disturb_except)
+ setting_info->excepted_list = eina_list_sorted_insert(setting_info->excepted_list, apps_sort_cb, item);
+ else
+ sub_list = eina_list_append(sub_list, item);
+
+ list = eina_list_next(list);
+ }
+ setting_info->not_excepted_list = sub_list;
}
void create_notification_on_ls_list()
{
- NOTISET_TRACE_BEGIN;
+ NOTISET_TRACE_BEGIN;
- remove_lower_noti_list();
+ remove_lower_noti_list();
- setting_info = calloc(1, sizeof(setting_info_s));
- ret_if(!setting_info);
- item_info_s *item_info = NULL;
+ setting_info = calloc(1, sizeof(setting_info_s));
+ ret_if(!setting_info);
+ item_info_s *item_info = NULL;
- item_info = calloc(1, sizeof(item_info_s));
- ret_if(!item_info);
- item_info->name = strdup(APP_STRING("IDS_QP_OPT_SHOW_ALL_CONTENT_ABB"));
- setting_info->lower_noti_list = eina_list_append(setting_info->lower_noti_list, item_info);
+ item_info = calloc(1, sizeof(item_info_s));
+ ret_if(!item_info);
+ item_info->name = strdup(APP_STRING("IDS_QP_OPT_SHOW_ALL_CONTENT_ABB"));
+ setting_info->lower_noti_list = eina_list_append(setting_info->lower_noti_list, item_info);
- item_info = calloc(1, sizeof(item_info_s));
- ret_if(!item_info);
- item_info->name = strdup(APP_STRING("IDS_QP_OPT_HIDE_SENSITIVE_CONTENT_ABB"));
- setting_info->lower_noti_list = eina_list_append(setting_info->lower_noti_list, item_info);
+ item_info = calloc(1, sizeof(item_info_s));
+ ret_if(!item_info);
+ item_info->name = strdup(APP_STRING("IDS_QP_OPT_HIDE_SENSITIVE_CONTENT_ABB"));
+ setting_info->lower_noti_list = eina_list_append(setting_info->lower_noti_list, item_info);
- item_info = calloc(1, sizeof(item_info_s));
- ret_if(!item_info);
- item_info->name = strdup(APP_STRING("IDS_QP_OPT_DONT_SHOW_NOTIFICATIONS_ABB"));
- setting_info->lower_noti_list = eina_list_append(setting_info->lower_noti_list, item_info);
- NOTISET_TRACE_BEGIN;
+ item_info = calloc(1, sizeof(item_info_s));
+ ret_if(!item_info);
+ item_info->name = strdup(APP_STRING("IDS_QP_OPT_DONT_SHOW_NOTIFICATIONS_ABB"));
+ setting_info->lower_noti_list = eina_list_append(setting_info->lower_noti_list, item_info);
+ NOTISET_TRACE_BEGIN;
}
Eina_List *get_lower_noti_list()
{
- NOTISET_TRACE_BEGIN;
- return setting_info->lower_noti_list;
+ NOTISET_TRACE_BEGIN;
+ return setting_info->lower_noti_list;
}
Eina_List *get_excepted_apps_list()
{
- NOTISET_TRACE_BEGIN;
- return setting_info->excepted_list;
+ NOTISET_TRACE_BEGIN;
+ return setting_info->excepted_list;
}
Eina_List *get_apps_noti_allowed_list()
{
- NOTISET_TRACE_BEGIN;
- return setting_info->apps_noti_allowed_list;
+ NOTISET_TRACE_BEGIN;
+ return setting_info->apps_noti_allowed_list;
}
Eina_List *get_apps_noti_blocked_list()
{
- NOTISET_TRACE_BEGIN;
- return setting_info->apps_noti_blocked_list;
+ NOTISET_TRACE_BEGIN;
+ return setting_info->apps_noti_blocked_list;
}
Eina_List *get_first_allowed_apps_list()
{
- NOTISET_TRACE_BEGIN;
- return setting_info->first_allowed_list;
+ NOTISET_TRACE_BEGIN;
+ return setting_info->first_allowed_list;
}
Eina_List *get_first_excepted_apps_list()
{
- NOTISET_TRACE_BEGIN;
- return setting_info->first_excepted_list;
+ NOTISET_TRACE_BEGIN;
+ return setting_info->first_excepted_list;
}
Eina_List *get_not_excepted_apps_list()
{
- NOTISET_TRACE_BEGIN;
- return setting_info->not_excepted_list;
+ NOTISET_TRACE_BEGIN;
+ return setting_info->not_excepted_list;
}
bool get_do_not_disturb()
{
- NOTISET_TRACE_BEGIN;
- bool do_not_disturb = false;
+ NOTISET_TRACE_BEGIN;
+ bool do_not_disturb = false;
- notification_system_setting_get_do_not_disturb(get_system_setting(), &do_not_disturb);
- NOTISET_DBG("do_not_disturb [%d]\n", do_not_disturb);
+ notification_system_setting_get_do_not_disturb(get_system_setting(), &do_not_disturb);
+ NOTISET_DBG("do_not_disturb [%d]\n", do_not_disturb);
- return do_not_disturb;
+ return do_not_disturb;
}
void set_do_not_disturb(bool state)
{
- NOTISET_TRACE_BEGIN;
+ NOTISET_TRACE_BEGIN;
- notification_system_setting_set_do_not_disturb(get_system_setting(), state);
- NOTISET_DBG("set do_not_disturb [%d]\n", state);
+ notification_system_setting_set_do_not_disturb(get_system_setting(), state);
+ NOTISET_DBG("set do_not_disturb [%d]\n", state);
}
bool get_allow_to_nofity(char *pkg_name)
{
- NOTISET_TRACE_BEGIN;
- int err = NOTIFICATION_ERROR_NONE;
- bool state = false;
- notification_setting_h setting = NULL;
+ NOTISET_TRACE_BEGIN;
+ int err = NOTIFICATION_ERROR_NONE;
+ bool state = false;
+ notification_setting_h setting = NULL;
- err = notification_setting_get_setting_by_package_name(pkg_name, &setting);
- if (err != NOTIFICATION_ERROR_NONE || setting == NULL) {
- NOTISET_ERR("notification_setting_get_setting_by_package_name [%d]\n", err);
- goto out;
- }
+ err = notification_setting_get_setting_by_package_name(pkg_name, &setting);
+ if (err != NOTIFICATION_ERROR_NONE || setting == NULL) {
+ NOTISET_ERR("notification_setting_get_setting_by_package_name [%d]\n", err);
+ goto out;
+ }
- notification_setting_get_allow_to_notify(setting, &state);
- NOTISET_DBG("notification_setting_get_allow_to_notify [%d]\n", state);
+ notification_setting_get_allow_to_notify(setting, &state);
+ NOTISET_DBG("notification_setting_get_allow_to_notify [%d]\n", state);
out:
- if (setting)
- notification_setting_free_notification(setting);
- return state;
+ if (setting)
+ notification_setting_free_notification(setting);
+ return state;
}
lock_screen_content_level_e get_lock_screen_content_setting()
{
- lock_screen_content_level_e value = SHOW_ALL_CONTENT;
- notification_system_setting_get_lock_screen_content(get_system_setting(), &value);
- return value;
+ lock_screen_content_level_e value = SHOW_ALL_CONTENT;
+ notification_system_setting_get_lock_screen_content(get_system_setting(), &value);
+ return value;
}
void set_lock_screen_content_setting(lock_screen_content_level_e value)
{
- notification_system_setting_set_lock_screen_content(get_system_setting(), value);
+ notification_system_setting_set_lock_screen_content(get_system_setting(), value);
}
bool set_allow_to_nofity(char *pkg_name, bool state)
{
- NOTISET_TRACE_BEGIN;
- int err = NOTIFICATION_ERROR_NONE;
+ NOTISET_TRACE_BEGIN;
+ int err = NOTIFICATION_ERROR_NONE;
- notification_setting_h setting = NULL;
+ notification_setting_h setting = NULL;
- err = notification_setting_get_setting_by_package_name(pkg_name, &setting);
- if (err != NOTIFICATION_ERROR_NONE || setting == NULL) {
- NOTISET_ERR("notification_setting_get_setting_by_package_name [%d]\n", err);
- goto out;
- }
+ err = notification_setting_get_setting_by_package_name(pkg_name, &setting);
+ if (err != NOTIFICATION_ERROR_NONE || setting == NULL) {
+ NOTISET_ERR("notification_setting_get_setting_by_package_name [%d]\n", err);
+ goto out;
+ }
- notification_setting_set_allow_to_notify(setting, state);
- NOTISET_DBG("notification_setting_set_allow_to_notify [%d]\n", state);
+ notification_setting_set_allow_to_notify(setting, state);
+ NOTISET_DBG("notification_setting_set_allow_to_notify [%d]\n", state);
- err = notification_setting_update_setting(setting);
- if (err != NOTIFICATION_ERROR_NONE) {
- NOTISET_ERR("notification_setting_update_setting [%d]\n", err);
- goto out;
- }
+ err = notification_setting_update_setting(setting);
+ if (err != NOTIFICATION_ERROR_NONE) {
+ NOTISET_ERR("notification_setting_update_setting [%d]\n", err);
+ goto out;
+ }
- if (setting)
- notification_setting_free_notification(setting);
- return true;
+ if (setting)
+ notification_setting_free_notification(setting);
+ return true;
out:
- if (setting)
- notification_setting_free_notification(setting);
- return false;
+ if (setting)
+ notification_setting_free_notification(setting);
+ return false;
}
bool set_excepted_apps(char *pkg_name, bool state)
{
- NOTISET_TRACE_BEGIN;
+ NOTISET_TRACE_BEGIN;
- int err = NOTIFICATION_ERROR_NONE;
+ int err = NOTIFICATION_ERROR_NONE;
- notification_setting_h setting = NULL;
+ notification_setting_h setting = NULL;
- err = notification_setting_get_setting_by_package_name(pkg_name, &setting);
- if (err != NOTIFICATION_ERROR_NONE || setting == NULL) {
- NOTISET_ERR("notification_setting_get_setting_by_package_name [%d]\n", err);
- goto out;
- }
+ err = notification_setting_get_setting_by_package_name(pkg_name, &setting);
+ if (err != NOTIFICATION_ERROR_NONE || setting == NULL) {
+ NOTISET_ERR("notification_setting_get_setting_by_package_name [%d]\n", err);
+ goto out;
+ }
- notification_setting_set_do_not_disturb_except(setting, state);
- NOTISET_DBG("notification_setting_set_do_not_disturb_except [%s] [%d]\n", pkg_name, state);
+ notification_setting_set_do_not_disturb_except(setting, state);
+ NOTISET_DBG("notification_setting_set_do_not_disturb_except [%s] [%d]\n", pkg_name, state);
- err = notification_setting_update_setting(setting);
- if (err != NOTIFICATION_ERROR_NONE) {
- NOTISET_ERR("notification_setting_update_setting err[%d]\n", err);
- }
+ err = notification_setting_update_setting(setting);
+ if (err != NOTIFICATION_ERROR_NONE) {
+ NOTISET_ERR("notification_setting_update_setting err[%d]\n", err);
+ }
- if (setting)
- notification_setting_free_notification(setting);
- return true;
+ if (setting)
+ notification_setting_free_notification(setting);
+ return true;
out:
- if (setting)
- notification_setting_free_notification(setting);
+ if (setting)
+ notification_setting_free_notification(setting);
- return false;
+ return false;
}
static void _remove_apps_list(Eina_List *input_list)
{
- NOTISET_TRACE_BEGIN;
- item_info_s *item_info = NULL;
-
- if (input_list) {
- EINA_LIST_FREE(input_list, item_info)
- {
- FREEIF(item_info->appid);
- FREEIF(item_info->name);
- FREEIF(item_info->icon);
- FREEIF(item_info);
- }
- }
+ NOTISET_TRACE_BEGIN;
+ item_info_s *item_info = NULL;
+
+ if (input_list) {
+ EINA_LIST_FREE(input_list, item_info)
+ {
+ FREEIF(item_info->appid);
+ FREEIF(item_info->name);
+ FREEIF(item_info->icon);
+ FREEIF(item_info);
+ }
+ }
}
void remove_lower_noti_list()
{
- NOTISET_TRACE_BEGIN;
- if (setting_info)
- _remove_apps_list(setting_info->lower_noti_list);
+ NOTISET_TRACE_BEGIN;
+ if (setting_info)
+ _remove_apps_list(setting_info->lower_noti_list);
}
void remove_apps_noti_allowed_list()
{
- NOTISET_TRACE_BEGIN;
- if (setting_info) {
- _remove_apps_list(setting_info->apps_noti_allowed_list);
- }
+ NOTISET_TRACE_BEGIN;
+ if (setting_info) {
+ _remove_apps_list(setting_info->apps_noti_allowed_list);
+ }
}
void remove_apps_noti_blocked_list()
{
- NOTISET_TRACE_BEGIN;
- if (setting_info) {
- _remove_apps_list(setting_info->apps_noti_blocked_list);
- }
+ NOTISET_TRACE_BEGIN;
+ if (setting_info) {
+ _remove_apps_list(setting_info->apps_noti_blocked_list);
+ }
}
void remove_excepted_apps_list()
{
- NOTISET_TRACE_BEGIN;
- if (setting_info) {
- _remove_apps_list(setting_info->first_excepted_list);
- _remove_apps_list(setting_info->excepted_list);
- _remove_apps_list(setting_info->first_allowed_list);
- _remove_apps_list(setting_info->not_excepted_list);
- }
+ NOTISET_TRACE_BEGIN;
+ if (setting_info) {
+ _remove_apps_list(setting_info->first_excepted_list);
+ _remove_apps_list(setting_info->excepted_list);
+ _remove_apps_list(setting_info->first_allowed_list);
+ _remove_apps_list(setting_info->not_excepted_list);
+ }
}
void update_apps_settings_info()
{
- NOTISET_TRACE_BEGIN;
- if (setting_info) {
- Eina_List *first_list = eina_list_merge(setting_info->first_allowed_list, setting_info->excepted_list);
- setting_info->first_allowed_list = NULL;
- setting_info->excepted_list = NULL;
-
- Eina_List *list = eina_list_merge(first_list, setting_info->not_excepted_list);
- first_list = NULL;
- setting_info->not_excepted_list = NULL;
-
- while (list) {
- item_info_s *item = (item_info_s *)eina_list_data_get(list);
- set_excepted_apps(item->appid, item->do_not_disturb_except);
- list = eina_list_next(list);
- }
- }
+ NOTISET_TRACE_BEGIN;
+ if (setting_info) {
+ Eina_List *first_list = eina_list_merge(setting_info->first_allowed_list, setting_info->excepted_list);
+ setting_info->first_allowed_list = NULL;
+ setting_info->excepted_list = NULL;
+
+ Eina_List *list = eina_list_merge(first_list, setting_info->not_excepted_list);
+ first_list = NULL;
+ setting_info->not_excepted_list = NULL;
+
+ while (list) {
+ item_info_s *item = (item_info_s *)eina_list_data_get(list);
+ set_excepted_apps(item->appid, item->do_not_disturb_except);
+ list = eina_list_next(list);
+ }
+ }
}
#include <utils_i18n_ucalendar.h>
enum TimeFormat {
- time_format_unknown,
- time_format_24H,
- time_format_12H
+ time_format_unknown,
+ time_format_24H,
+ time_format_12H
};
#define POPUP_TIME_12_FORMAT "%d/%b/%Y %I:%M %p"
#define GREY_TEXT_MAIN "<color=#97e57b>%s</color>"
typedef struct changecolor {
- dnd_schedule_week_flag_e week;
- const char *text;
- bool change_color;
- Evas_Object *label;
+ dnd_schedule_week_flag_e week;
+ const char *text;
+ bool change_color;
+ Evas_Object *label;
} changecolor_s;
typedef struct datetime {
- Evas_Object *button;
- Evas_Object *datetime;
- Evas_Object *popup;
- struct tm saved_time;
- struct tm default_time;
- bool is_start_time;
+ Evas_Object *button;
+ Evas_Object *datetime;
+ Evas_Object *popup;
+ struct tm saved_time;
+ struct tm default_time;
+ bool is_start_time;
} datetime_s;
datetime_s start_time_p, end_time_p;
static bool is_empty_str(const char *str)
{
- if (NULL == str || '\0' == str[0])
- return true;
- return false;
+ if (NULL == str || '\0' == str[0])
+ return true;
+ return false;
}
static int safe_str_len(const char *str)
{
- if (is_empty_str(str)) {
- return 0;
- } else {
- return strlen(str);
- }
+ if (is_empty_str(str)) {
+ return 0;
+ } else {
+ return strlen(str);
+ }
}
static char *get_date_pattern(const char *locale, const char *skeleton)
{
- NOTISET_TRACE_BEGIN;
- i18n_udatepg_h generator = NULL;
- i18n_uchar best_pattern[MAX_UCHAR_LEN] = {0,};
- char best_pattern_string[MAX_CHAR_LEN] = {0,};
- int32_t best_pattern_capacity = MAX_UCHAR_LEN;
- int best_pattern_len = 0;
- i18n_uchar custom_skeleton[MAX_UCHAR_LEN] = {0,};
- int skeleton_length = safe_str_len(skeleton);
+ NOTISET_TRACE_BEGIN;
+ i18n_udatepg_h generator = NULL;
+ i18n_uchar best_pattern[MAX_UCHAR_LEN] = {0,};
+ char best_pattern_string[MAX_CHAR_LEN] = {0,};
+ int32_t best_pattern_capacity = MAX_UCHAR_LEN;
+ int best_pattern_len = 0;
+ i18n_uchar custom_skeleton[MAX_UCHAR_LEN] = {0,};
+ int skeleton_length = safe_str_len(skeleton);
- /* convert char to uchar */
- skeleton_length = skeleton_length <= MAX_UCHAR_LEN ? skeleton_length : MAX_UCHAR_LEN;
- i18n_ustring_copy_ua_n(custom_skeleton, skeleton, skeleton_length);
+ /* convert char to uchar */
+ skeleton_length = skeleton_length <= MAX_UCHAR_LEN ? skeleton_length : MAX_UCHAR_LEN;
+ i18n_ustring_copy_ua_n(custom_skeleton, skeleton, skeleton_length);
- i18n_udatepg_create(locale, &generator);
+ i18n_udatepg_create(locale, &generator);
- /* get bestpattern from customskeletom of uchar */
- skeleton_length = i18n_ustring_get_length(custom_skeleton);
- i18n_udatepg_get_best_pattern(generator, custom_skeleton, skeleton_length, best_pattern, best_pattern_capacity, &best_pattern_len);
- /* convert uchar to char to know bestPattern */
- i18n_ustring_copy_au_n(best_pattern_string, best_pattern, best_pattern_len);
+ /* get bestpattern from customskeletom of uchar */
+ skeleton_length = i18n_ustring_get_length(custom_skeleton);
+ i18n_udatepg_get_best_pattern(generator, custom_skeleton, skeleton_length, best_pattern, best_pattern_capacity, &best_pattern_len);
+ /* convert uchar to char to know bestPattern */
+ i18n_ustring_copy_au_n(best_pattern_string, best_pattern, best_pattern_len);
- i18n_udatepg_destroy(generator);
+ i18n_udatepg_destroy(generator);
- return strdup(best_pattern_string);
+ return strdup(best_pattern_string);
}
int get_date_format(const char *locale, const i18n_uchar *pattern, i18n_udate_format_h date_format)
{
- return i18n_udate_create(I18N_UDATE_PATTERN, I18N_UDATE_PATTERN, locale, NULL, -1, pattern, -1, date_format);
+ return i18n_udate_create(I18N_UDATE_PATTERN, I18N_UDATE_PATTERN, locale, NULL, -1, pattern, -1, date_format);
}
static char *get_timezone()
{
- NOTISET_TRACE_BEGIN;
- char buf[DEF_BUF_LEN] = {0,};
- ssize_t len = readlink("/opt/etc/localtime", buf, sizeof(buf) - 1);
+ NOTISET_TRACE_BEGIN;
+ char buf[DEF_BUF_LEN] = {0,};
+ ssize_t len = readlink("/opt/etc/localtime", buf, sizeof(buf) - 1);
- if (len != -1) {
- buf[len] = '\0';
- } else {
- NOTISET_ERR("Getting default timezone failed, use system settings value");
+ if (len != -1) {
+ buf[len] = '\0';
+ } else {
+ NOTISET_ERR("Getting default timezone failed, use system settings value");
- char res[MAX_CHAR_LEN] = {0,};
- char *time_zone = NULL;
+ char res[MAX_CHAR_LEN] = {0,};
+ char *time_zone = NULL;
- system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, &time_zone);
- if (time_zone) {
- strncpy(res, time_zone, safe_str_len(time_zone));
- free(time_zone);
- }
- return strdup(res);
- }
+ system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, &time_zone);
+ if (time_zone) {
+ strncpy(res, time_zone, safe_str_len(time_zone));
+ free(time_zone);
+ }
+ return strdup(res);
+ }
- return strdup(buf + FILE_PATH_LENGTH);
+ return strdup(buf + FILE_PATH_LENGTH);
}
static char *get_formatted_date(const char *locale, const char *best_pattern, time_t time)
{
- NOTISET_TRACE_BEGIN;
- int status = I18N_ERROR_NONE;
- i18n_udate date;
- i18n_udate_format_h date_format = NULL;
- i18n_uchar u_timezone_id[DEF_BUF_LEN] = {0,};
- i18n_uchar u_best_pattern[MAX_UCHAR_LEN] = {0,};
- i18n_uchar formatted[MAX_UCHAR_LEN] = {0,};
- char formatted_string[MAX_CHAR_LEN] = {0,};
- char *time_zone = get_timezone();
- int32_t formatted_capacity = MAX_UCHAR_LEN;
- int formatted_length = 0;
- int pattern_length = safe_str_len(best_pattern);
-
- /* convert char to uchar */
- pattern_length = pattern_length <= MAX_UCHAR_LEN ? pattern_length : MAX_UCHAR_LEN;
- i18n_ustring_copy_ua_n(u_best_pattern, best_pattern, pattern_length);
-
- /* get current timezone and set as default timezone */
- i18n_ustring_copy_ua_n(u_timezone_id, time_zone, safe_str_len(time_zone));
-
- status = i18n_ucalendar_set_default_timezone(u_timezone_id);
- if (status != I18N_ERROR_NONE)
- NOTISET_ERR("default timezone set error");
-
- /* convert time_t to UDate, if it is */
- if (time)
- date = (i18n_udate)time * 1000;
- else
- i18n_ucalendar_get_now(&date);
-
- status = get_date_format(locale, u_best_pattern, &date_format);
- if (status == I18N_ERROR_NONE) {
- /* get formatted string */
- i18n_udate_format_date(date_format, date, formatted, formatted_capacity, NULL, &formatted_length);
- /* convert uchar to char */
- i18n_ustring_copy_au(formatted_string, formatted);
- }
-
- i18n_udate_destroy(date_format);
- return strdup(formatted_string);
+ NOTISET_TRACE_BEGIN;
+ int status = I18N_ERROR_NONE;
+ i18n_udate date;
+ i18n_udate_format_h date_format = NULL;
+ i18n_uchar u_timezone_id[DEF_BUF_LEN] = {0,};
+ i18n_uchar u_best_pattern[MAX_UCHAR_LEN] = {0,};
+ i18n_uchar formatted[MAX_UCHAR_LEN] = {0,};
+ char formatted_string[MAX_CHAR_LEN] = {0,};
+ char *time_zone = get_timezone();
+ int32_t formatted_capacity = MAX_UCHAR_LEN;
+ int formatted_length = 0;
+ int pattern_length = safe_str_len(best_pattern);
+
+ /* convert char to uchar */
+ pattern_length = pattern_length <= MAX_UCHAR_LEN ? pattern_length : MAX_UCHAR_LEN;
+ i18n_ustring_copy_ua_n(u_best_pattern, best_pattern, pattern_length);
+
+ /* get current timezone and set as default timezone */
+ i18n_ustring_copy_ua_n(u_timezone_id, time_zone, safe_str_len(time_zone));
+
+ status = i18n_ucalendar_set_default_timezone(u_timezone_id);
+ if (status != I18N_ERROR_NONE)
+ NOTISET_ERR("default timezone set error");
+
+ /* convert time_t to UDate, if it is */
+ if (time)
+ date = (i18n_udate)time * 1000;
+ else
+ i18n_ucalendar_get_now(&date);
+
+ status = get_date_format(locale, u_best_pattern, &date_format);
+ if (status == I18N_ERROR_NONE) {
+ /* get formatted string */
+ i18n_udate_format_date(date_format, date, formatted, formatted_capacity, NULL, &formatted_length);
+ /* convert uchar to char */
+ i18n_ustring_copy_au(formatted_string, formatted);
+ }
+
+ i18n_udate_destroy(date_format);
+ return strdup(formatted_string);
}
static char *make_time_string(time_t curr_time)
{
- NOTISET_TRACE_BEGIN;
- char *lang = NULL;
- system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &lang);
- if (lang) {
- struct tm msgTimeTm;
- localtime_r(&curr_time, &msgTimeTm);
- const char *time_format = get_time_format() == time_format_12H ? TIME_12H : TIME_24H;
- return get_formatted_date(lang, get_date_pattern(lang, time_format), curr_time);
- }
- return NULL;
+ NOTISET_TRACE_BEGIN;
+ char *lang = NULL;
+ system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &lang);
+ if (lang) {
+ struct tm msgTimeTm;
+ localtime_r(&curr_time, &msgTimeTm);
+ const char *time_format = get_time_format() == time_format_12H ? TIME_12H : TIME_24H;
+ return get_formatted_date(lang, get_date_pattern(lang, time_format), curr_time);
+ }
+ return NULL;
}
bool load_dnd_schedule_time(struct tm *start_time_out, struct tm *end_time_out)
{
- time_t local_time = time(0);
- struct tm *time_info = localtime(&local_time);
+ time_t local_time = time(0);
+ struct tm *time_info = localtime(&local_time);
- start_time_p.saved_time = *time_info;
- start_time_p.saved_time.tm_sec = 0;
+ start_time_p.saved_time = *time_info;
+ start_time_p.saved_time.tm_sec = 0;
- end_time_p.saved_time = *time_info;
- end_time_p.saved_time.tm_sec = 0;
+ end_time_p.saved_time = *time_info;
+ end_time_p.saved_time.tm_sec = 0;
- notification_system_setting_dnd_schedule_get_start_time(get_system_setting(), &start_time_p.saved_time.tm_hour, &start_time_p.saved_time.tm_min);
- if (start_time_p.saved_time.tm_hour == 0 && start_time_p.saved_time.tm_min == 0) {
- start_time_p.saved_time.tm_hour = 22;
- notification_system_setting_dnd_schedule_set_start_time(get_system_setting(), start_time_p.saved_time.tm_hour, start_time_p.saved_time.tm_min);
- }
+ notification_system_setting_dnd_schedule_get_start_time(get_system_setting(), &start_time_p.saved_time.tm_hour, &start_time_p.saved_time.tm_min);
+ if (start_time_p.saved_time.tm_hour == 0 && start_time_p.saved_time.tm_min == 0) {
+ start_time_p.saved_time.tm_hour = 22;
+ notification_system_setting_dnd_schedule_set_start_time(get_system_setting(), start_time_p.saved_time.tm_hour, start_time_p.saved_time.tm_min);
+ }
- notification_system_setting_dnd_schedule_get_end_time(get_system_setting(), &end_time_p.saved_time.tm_hour, &end_time_p.saved_time.tm_min);
- if (end_time_p.saved_time.tm_hour == 0 && end_time_p.saved_time.tm_min == 0) {
- end_time_p.saved_time.tm_hour = 8;
- notification_system_setting_dnd_schedule_set_start_time(get_system_setting(), end_time_p.saved_time.tm_hour, end_time_p.saved_time.tm_min);
- }
+ notification_system_setting_dnd_schedule_get_end_time(get_system_setting(), &end_time_p.saved_time.tm_hour, &end_time_p.saved_time.tm_min);
+ if (end_time_p.saved_time.tm_hour == 0 && end_time_p.saved_time.tm_min == 0) {
+ end_time_p.saved_time.tm_hour = 8;
+ notification_system_setting_dnd_schedule_set_start_time(get_system_setting(), end_time_p.saved_time.tm_hour, end_time_p.saved_time.tm_min);
+ }
- start_time_p.default_time = start_time_p.saved_time;
- end_time_p.default_time = end_time_p.saved_time;
+ start_time_p.default_time = start_time_p.saved_time;
+ end_time_p.default_time = end_time_p.saved_time;
- *start_time_out = start_time_p.default_time;
- *end_time_out = end_time_p.default_time;
+ *start_time_out = start_time_p.default_time;
+ *end_time_out = end_time_p.default_time;
- return true;
+ return true;
}
const char *get_time_string(struct tm *start_time, struct tm *end_time)
{
- char *buff_start = NULL;
- char *buff_end = NULL;
- static char buff[TIME_STRING_SIZE] = {0};
+ char *buff_start = NULL;
+ char *buff_end = NULL;
+ static char buff[TIME_STRING_SIZE] = {0};
- buff_start = make_time_string(mktime(start_time));
- buff_end = make_time_string(mktime(end_time));
+ buff_start = make_time_string(mktime(start_time));
+ buff_end = make_time_string(mktime(end_time));
- if (buff_start && buff_end) {
- snprintf(buff, TIME_STRING_SIZE, "%s ~ %s %s", buff_start, buff_end, is_next_day() ? APP_STRING("IDS_ST_SBODY_NEXT_DAY_M_LC_ABB") : "");
- }
+ if (buff_start && buff_end) {
+ snprintf(buff, TIME_STRING_SIZE, "%s ~ %s %s", buff_start, buff_end, is_next_day() ? APP_STRING("IDS_ST_SBODY_NEXT_DAY_M_LC_ABB") : "");
+ }
- if (buff_start) {
- free(buff_start);
- buff_start = NULL;
- }
- if (buff_end) {
- free(buff_end);
- buff_end = NULL;
- }
+ if (buff_start) {
+ free(buff_start);
+ buff_start = NULL;
+ }
+ if (buff_end) {
+ free(buff_end);
+ buff_end = NULL;
+ }
- return buff;
+ return buff;
}
static void make_color_text(int dayCode, dnd_schedule_week_flag_e week_day, const char *text, char* outBuf)
{
- char formattedDay[DAY_MAX_LENGTH] = { 0 };
- if ((dayCode & week_day) == 0)
- snprintf(formattedDay, DAY_MAX_LENGTH, GREEN_TEXT_MAIN, text);
- else
- snprintf(formattedDay, DAY_MAX_LENGTH, GREY_TEXT_MAIN, text);
+ char formattedDay[DAY_MAX_LENGTH] = { 0 };
+ if ((dayCode & week_day) == 0)
+ snprintf(formattedDay, DAY_MAX_LENGTH, GREEN_TEXT_MAIN, text);
+ else
+ snprintf(formattedDay, DAY_MAX_LENGTH, GREY_TEXT_MAIN, text);
- strncat(outBuf, formattedDay, DAY_MAX_LENGTH);
+ strncat(outBuf, formattedDay, DAY_MAX_LENGTH);
}
int load_dnd_schedule_day()
{
- int res = 0;
+ int res = 0;
- notification_system_setting_dnd_schedule_get_day(get_system_setting(), &res);
- default_dnd_schedule_weekday = res;
- new_dnd_schedule_weekday = res;
+ notification_system_setting_dnd_schedule_get_day(get_system_setting(), &res);
+ default_dnd_schedule_weekday = res;
+ new_dnd_schedule_weekday = res;
- return res;
+ return res;
}
const char *get_day_string(int dnd_schedule)
{
- NOTISET_TRACE_BEGIN;
- static char buff[WEEK_MAX_STRING] = { 0 };
- buff[0] = 0;
-
- make_color_text(dnd_schedule, DND_SCHEDULE_WEEK_FLAG_MONDAY, APP_STRING("WDS_ALM_BUTTON_M_M_MONDAY_ABB"), buff);
- strncat(buff, " ", WEEK_MAX_STRING);
- make_color_text(dnd_schedule, DND_SCHEDULE_WEEK_FLAG_TUESDAY, APP_STRING("WDS_ALM_BUTTON_T_M_TUESDAY_ABB"), buff);
- strncat(buff, " ", WEEK_MAX_STRING);
- make_color_text(dnd_schedule, DND_SCHEDULE_WEEK_FLAG_WEDNESDAY, APP_STRING("WDS_ALM_BUTTON_W_M_WEDNESDAY_ABB"), buff);
- strncat(buff, " ", WEEK_MAX_STRING);
- make_color_text(dnd_schedule, DND_SCHEDULE_WEEK_FLAG_THURSDAY, APP_STRING("WDS_ALM_BUTTON_T_M_THURSDAY_ABB"), buff);
- strncat(buff, " ", WEEK_MAX_STRING);
- make_color_text(dnd_schedule, DND_SCHEDULE_WEEK_FLAG_FRIDAY, APP_STRING("WDS_ALM_BUTTON_F_M_FRIDAY_ABB"), buff);
- strncat(buff, " ", WEEK_MAX_STRING);
- make_color_text(dnd_schedule, DND_SCHEDULE_WEEK_FLAG_SATURDAY, APP_STRING("WDS_ALM_BUTTON_S_M_SATURDAY_ABB"), buff);
- strncat(buff, " ", WEEK_MAX_STRING);
- make_color_text(dnd_schedule, DND_SCHEDULE_WEEK_FLAG_SUNDAY, APP_STRING("WDS_ALM_BUTTON_S_M_SUNDAY_ABB"), buff);
- return buff;
+ NOTISET_TRACE_BEGIN;
+ static char buff[WEEK_MAX_STRING] = { 0 };
+ buff[0] = 0;
+
+ make_color_text(dnd_schedule, DND_SCHEDULE_WEEK_FLAG_MONDAY, APP_STRING("WDS_ALM_BUTTON_M_M_MONDAY_ABB"), buff);
+ strncat(buff, " ", WEEK_MAX_STRING);
+ make_color_text(dnd_schedule, DND_SCHEDULE_WEEK_FLAG_TUESDAY, APP_STRING("WDS_ALM_BUTTON_T_M_TUESDAY_ABB"), buff);
+ strncat(buff, " ", WEEK_MAX_STRING);
+ make_color_text(dnd_schedule, DND_SCHEDULE_WEEK_FLAG_WEDNESDAY, APP_STRING("WDS_ALM_BUTTON_W_M_WEDNESDAY_ABB"), buff);
+ strncat(buff, " ", WEEK_MAX_STRING);
+ make_color_text(dnd_schedule, DND_SCHEDULE_WEEK_FLAG_THURSDAY, APP_STRING("WDS_ALM_BUTTON_T_M_THURSDAY_ABB"), buff);
+ strncat(buff, " ", WEEK_MAX_STRING);
+ make_color_text(dnd_schedule, DND_SCHEDULE_WEEK_FLAG_FRIDAY, APP_STRING("WDS_ALM_BUTTON_F_M_FRIDAY_ABB"), buff);
+ strncat(buff, " ", WEEK_MAX_STRING);
+ make_color_text(dnd_schedule, DND_SCHEDULE_WEEK_FLAG_SATURDAY, APP_STRING("WDS_ALM_BUTTON_S_M_SATURDAY_ABB"), buff);
+ strncat(buff, " ", WEEK_MAX_STRING);
+ make_color_text(dnd_schedule, DND_SCHEDULE_WEEK_FLAG_SUNDAY, APP_STRING("WDS_ALM_BUTTON_S_M_SUNDAY_ABB"), buff);
+ return buff;
}
bool is_next_day()
{
- double diff_time = difftime(mktime(&end_time_p.saved_time), mktime(&start_time_p.saved_time));
- NOTISET_DBG("diff_time = %f", diff_time);
- return diff_time <= 0 ? true : false;
+ double diff_time = difftime(mktime(&end_time_p.saved_time), mktime(&start_time_p.saved_time));
+ NOTISET_DBG("diff_time = %f", diff_time);
+ return diff_time <= 0 ? true : false;
}
static void set_set_schedule(bool state)
{
- NOTISET_TRACE_BEGIN;
- notification_system_setting_dnd_schedule_set_enabled(get_system_setting(), state);
- NOTISET_DBG("set set_schedule [%d]\n", state);
+ NOTISET_TRACE_BEGIN;
+ notification_system_setting_dnd_schedule_set_enabled(get_system_setting(), state);
+ NOTISET_DBG("set set_schedule [%d]\n", state);
}
static void enable_time_items(bool enable)
{
- ug_data *ug_main = get_app_ui_data();
- ret_if(ug_main == NULL);
- unsigned int i = 1;
- unsigned int size = elm_genlist_items_count(ug_main->list_sub);
- Elm_Object_Item *item = elm_genlist_first_item_get(ug_main->list_sub);
- for (; i < size; ++i) {
- Elm_Object_Item *next = elm_genlist_item_next_get(item);
- elm_object_item_disabled_set(next, !enable);
- item = next;
- }
+ ug_data *ug_main = get_app_ui_data();
+ ret_if(ug_main == NULL);
+ unsigned int i = 1;
+ unsigned int size = elm_genlist_items_count(ug_main->list_sub);
+ Elm_Object_Item *item = elm_genlist_first_item_get(ug_main->list_sub);
+ for (; i < size; ++i) {
+ Elm_Object_Item *next = elm_genlist_item_next_get(item);
+ elm_object_item_disabled_set(next, !enable);
+ item = next;
+ }
}
void set_schedule_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
{
- NOTISET_TRACE_BEGIN;
- ug_data *ug_main = get_app_ui_data();
- ret_if(ug_main == NULL);
- bool check = elm_check_state_get(obj);
- enable_time_items(check);
- set_set_schedule(check);
- update_system_settings();
- elm_genlist_item_update(elm_genlist_item_next_get(elm_genlist_first_item_get(ug_main->list_main)));
+ NOTISET_TRACE_BEGIN;
+ ug_data *ug_main = get_app_ui_data();
+ ret_if(ug_main == NULL);
+ bool check = elm_check_state_get(obj);
+ enable_time_items(check);
+ set_set_schedule(check);
+ update_system_settings();
+ elm_genlist_item_update(elm_genlist_item_next_get(elm_genlist_first_item_get(ug_main->list_main)));
}
int get_time_format()
{
- NOTISET_TRACE_BEGIN;
- bool timeFormat = false;
- if (system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, &timeFormat) < 0)
- return time_format_unknown;
- return timeFormat ? time_format_24H : time_format_12H;
+ NOTISET_TRACE_BEGIN;
+ bool timeFormat = false;
+ if (system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, &timeFormat) < 0)
+ return time_format_unknown;
+ return timeFormat ? time_format_24H : time_format_12H;
}
static Evas_Object *_create_set_schedule_disturb_gl(ug_data *ugd)
{
- NOTISET_TRACE_BEGIN;
- Evas_Object *parent = ugd->naviframe;
+ NOTISET_TRACE_BEGIN;
+ Evas_Object *parent = ugd->naviframe;
- Evas_Object *genlist = elm_genlist_add(parent);
- elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
- evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ Evas_Object *genlist = elm_genlist_add(parent);
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+ evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
- return genlist;
+ return genlist;
}
bool get_schedule()
{
- NOTISET_TRACE_BEGIN;
- bool set_schedule = false;
+ NOTISET_TRACE_BEGIN;
+ bool set_schedule = false;
- notification_system_setting_dnd_schedule_get_enabled(get_system_setting(), &set_schedule);
+ notification_system_setting_dnd_schedule_get_enabled(get_system_setting(), &set_schedule);
- NOTISET_DBG("get_schedule [%d]\n", set_schedule);
- return set_schedule;
+ NOTISET_DBG("get_schedule [%d]\n", set_schedule);
+ return set_schedule;
}
static Evas_Object *create_week_repeat_layout(Evas_Object* parent)
{
- Evas_Object *layout = elm_layout_add(parent);
+ Evas_Object *layout = elm_layout_add(parent);
- char *res_path = app_get_resource_path();
- if (res_path) {
- char edj_path[PATH_MAX] = { 0, };
- snprintf(edj_path, PATH_MAX, "%s%s", res_path, "edje/repeat_weekly_item.edj");
- elm_layout_file_set(layout, edj_path, "weekly_item");
- free(res_path);
- }
+ char *res_path = app_get_resource_path();
+ if (res_path) {
+ char edj_path[PATH_MAX] = { 0, };
+ snprintf(edj_path, PATH_MAX, "%s%s", res_path, "edje/repeat_weekly_item.edj");
+ elm_layout_file_set(layout, edj_path, "weekly_item");
+ free(res_path);
+ }
- evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_show(layout);
+ evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(layout);
- return layout;
+ return layout;
}
static void save_dnd_weekday(int dayCode)
{
- notification_system_setting_dnd_schedule_set_day(get_system_setting(), dayCode);
+ notification_system_setting_dnd_schedule_set_day(get_system_setting(), dayCode);
}
static bool same_time(struct tm *timeA, struct tm *timeB)
{
- time_t t1 = mktime(timeA);
- time_t t2 = mktime(timeB);
- return difftime(t1, t2) == 0.0;
+ time_t t1 = mktime(timeA);
+ time_t t2 = mktime(timeB);
+ return difftime(t1, t2) == 0.0;
}
static void save_date_time(datetime_s *dt)
{
- if (dt->saved_time.tm_hour == start_time_p.saved_time.tm_hour && dt->saved_time.tm_min == start_time_p.saved_time.tm_min)
- notification_system_setting_dnd_schedule_set_start_time(get_system_setting(), dt->saved_time.tm_hour, dt->saved_time.tm_min);
- else
- notification_system_setting_dnd_schedule_set_end_time(get_system_setting(), dt->saved_time.tm_hour, dt->saved_time.tm_min);
+ if (dt->saved_time.tm_hour == start_time_p.saved_time.tm_hour && dt->saved_time.tm_min == start_time_p.saved_time.tm_min)
+ notification_system_setting_dnd_schedule_set_start_time(get_system_setting(), dt->saved_time.tm_hour, dt->saved_time.tm_min);
+ else
+ notification_system_setting_dnd_schedule_set_end_time(get_system_setting(), dt->saved_time.tm_hour, dt->saved_time.tm_min);
}
static void week_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
- NOTISET_TRACE_BEGIN;
- ug_data *ug_main = get_app_ui_data();
- ret_if(ug_main == NULL);
- changecolor_s *cc = data;
- char buf[BUTTON_TEXT_SIZE] = {0, };
+ NOTISET_TRACE_BEGIN;
+ ug_data *ug_main = get_app_ui_data();
+ ret_if(ug_main == NULL);
+ changecolor_s *cc = data;
+ char buf[BUTTON_TEXT_SIZE] = {0, };
- if (cc->change_color) {
- new_dnd_schedule_weekday ^= cc->week;
- snprintf(buf, sizeof(buf), GREEN_TEXT_COLOR, cc->text);
- elm_object_text_set(cc->label, buf);
- } else {
- new_dnd_schedule_weekday |= cc->week;
- snprintf(buf, sizeof(buf), GREY_TEXT_COLOR, cc->text);
- elm_object_text_set(cc->label, buf);
- }
+ if (cc->change_color) {
+ new_dnd_schedule_weekday ^= cc->week;
+ snprintf(buf, sizeof(buf), GREEN_TEXT_COLOR, cc->text);
+ elm_object_text_set(cc->label, buf);
+ } else {
+ new_dnd_schedule_weekday |= cc->week;
+ snprintf(buf, sizeof(buf), GREY_TEXT_COLOR, cc->text);
+ elm_object_text_set(cc->label, buf);
+ }
- calc_label_size(cc->label);
- cc->change_color = !cc->change_color;
+ calc_label_size(cc->label);
+ cc->change_color = !cc->change_color;
- update_system_settings();
+ update_system_settings();
}
static Evas_Object *create_week_button(Evas_Object *parent, const char *text, dnd_schedule_week_flag_e week)
{
- /*add buttons*/
- char buf[BUTTON_TEXT_SIZE] = {0, };
- Evas_Object *button = elm_button_add(parent);
- evas_object_size_hint_max_set(button, WEEK_BUTTON_SIZE, WEEK_BUTTON_SIZE);
- evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_style_set(button, "transparent");
-
- Evas_Object *label = elm_label_add(button);
- evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
- changecolor_s *cc = calloc(1, sizeof(changecolor_s));
- if (!cc)
- return NULL;
-
- cc->week = week;
- cc->label = label;
- cc->text = text;
-
- if ((default_dnd_schedule_weekday & week) == 0) {
- snprintf(buf, sizeof(buf), GREEN_TEXT_COLOR, text);
- cc->change_color = false;
- } else {
- snprintf(buf, sizeof(buf), GREY_TEXT_COLOR, text);
- cc->change_color = true;
- }
- elm_object_text_set(label, buf);
- calc_label_size(label);
- evas_object_show(label);
-
- evas_object_smart_callback_add(button, "clicked", week_button_clicked_cb, cc);
- elm_object_content_set(button, label);
- evas_object_show(button);
- elm_box_pack_end(parent, button);
- return button;
+ /*add buttons*/
+ char buf[BUTTON_TEXT_SIZE] = {0, };
+ Evas_Object *button = elm_button_add(parent);
+ evas_object_size_hint_max_set(button, WEEK_BUTTON_SIZE, WEEK_BUTTON_SIZE);
+ evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_style_set(button, "transparent");
+
+ Evas_Object *label = elm_label_add(button);
+ evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ changecolor_s *cc = calloc(1, sizeof(changecolor_s));
+ if (!cc)
+ return NULL;
+
+ cc->week = week;
+ cc->label = label;
+ cc->text = text;
+
+ if ((default_dnd_schedule_weekday & week) == 0) {
+ snprintf(buf, sizeof(buf), GREEN_TEXT_COLOR, text);
+ cc->change_color = false;
+ } else {
+ snprintf(buf, sizeof(buf), GREY_TEXT_COLOR, text);
+ cc->change_color = true;
+ }
+ elm_object_text_set(label, buf);
+ calc_label_size(label);
+ evas_object_show(label);
+
+ evas_object_smart_callback_add(button, "clicked", week_button_clicked_cb, cc);
+ elm_object_content_set(button, label);
+ evas_object_show(button);
+ elm_box_pack_end(parent, button);
+ return button;
}
static Evas_Object *repeat_weekly_layout_cb(Evas_Object* parent, void *data)
{
- Evas_Object *layout = create_week_repeat_layout(parent);
- char buf[MAX_TEXT_SIZE] = {0, };
- /* Set text into layout */
- Evas_Object *text = elm_label_add(layout);
- elm_label_ellipsis_set(text, EINA_TRUE);
- evas_object_size_hint_weight_set(text, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(text, EVAS_HINT_FILL, EVAS_HINT_FILL);
- snprintf(buf, sizeof(buf), "<font_size=40>%s</font_size>", APP_STRING("IDS_ST_BODY_REPEAT_WEEKLY_ABB"));
- elm_object_text_set(text, strdup(buf));
- elm_object_part_content_set(layout, "elm.swallow.text", text);
- evas_object_show(text);
-
- Evas_Object *box = elm_box_add(layout);
- elm_box_homogeneous_set(box, EINA_FALSE);
- evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_box_horizontal_set(box, EINA_TRUE);
- elm_object_part_content_set(layout, "elm.box.content", box);
-
- create_week_button(box, APP_STRING("WDS_ALM_BUTTON_M_M_MONDAY_ABB"), DND_SCHEDULE_WEEK_FLAG_MONDAY);
- create_week_button(box, APP_STRING("WDS_ALM_BUTTON_T_M_TUESDAY_ABB"), DND_SCHEDULE_WEEK_FLAG_TUESDAY);
- create_week_button(box, APP_STRING("WDS_ALM_BUTTON_W_M_WEDNESDAY_ABB"), DND_SCHEDULE_WEEK_FLAG_WEDNESDAY);
- create_week_button(box, APP_STRING("WDS_ALM_BUTTON_T_M_THURSDAY_ABB"), DND_SCHEDULE_WEEK_FLAG_THURSDAY);
- create_week_button(box, APP_STRING("WDS_ALM_BUTTON_F_M_FRIDAY_ABB"), DND_SCHEDULE_WEEK_FLAG_FRIDAY);
- create_week_button(box, APP_STRING("WDS_ALM_BUTTON_S_M_SATURDAY_ABB"), DND_SCHEDULE_WEEK_FLAG_SATURDAY);
- create_week_button(box, APP_STRING("WDS_ALM_BUTTON_S_M_SUNDAY_ABB"), DND_SCHEDULE_WEEK_FLAG_SUNDAY);
-
- evas_object_show(box);
- elm_box_recalculate(box);
- return layout;
+ Evas_Object *layout = create_week_repeat_layout(parent);
+ char buf[MAX_TEXT_SIZE] = {0, };
+ /* Set text into layout */
+ Evas_Object *text = elm_label_add(layout);
+ elm_label_ellipsis_set(text, EINA_TRUE);
+ evas_object_size_hint_weight_set(text, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(text, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ snprintf(buf, sizeof(buf), "<font_size=40>%s</font_size>", APP_STRING("IDS_ST_BODY_REPEAT_WEEKLY_ABB"));
+ elm_object_text_set(text, strdup(buf));
+ elm_object_part_content_set(layout, "elm.swallow.text", text);
+ evas_object_show(text);
+
+ Evas_Object *box = elm_box_add(layout);
+ elm_box_homogeneous_set(box, EINA_FALSE);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_horizontal_set(box, EINA_TRUE);
+ elm_object_part_content_set(layout, "elm.box.content", box);
+
+ create_week_button(box, APP_STRING("WDS_ALM_BUTTON_M_M_MONDAY_ABB"), DND_SCHEDULE_WEEK_FLAG_MONDAY);
+ create_week_button(box, APP_STRING("WDS_ALM_BUTTON_T_M_TUESDAY_ABB"), DND_SCHEDULE_WEEK_FLAG_TUESDAY);
+ create_week_button(box, APP_STRING("WDS_ALM_BUTTON_W_M_WEDNESDAY_ABB"), DND_SCHEDULE_WEEK_FLAG_WEDNESDAY);
+ create_week_button(box, APP_STRING("WDS_ALM_BUTTON_T_M_THURSDAY_ABB"), DND_SCHEDULE_WEEK_FLAG_THURSDAY);
+ create_week_button(box, APP_STRING("WDS_ALM_BUTTON_F_M_FRIDAY_ABB"), DND_SCHEDULE_WEEK_FLAG_FRIDAY);
+ create_week_button(box, APP_STRING("WDS_ALM_BUTTON_S_M_SATURDAY_ABB"), DND_SCHEDULE_WEEK_FLAG_SATURDAY);
+ create_week_button(box, APP_STRING("WDS_ALM_BUTTON_S_M_SUNDAY_ABB"), DND_SCHEDULE_WEEK_FLAG_SUNDAY);
+
+ evas_object_show(box);
+ elm_box_recalculate(box);
+ return layout;
}
static void popup_cancel_btn_clicked_cb(void *data , Evas_Object *obj , void *event_info)
{
- evas_object_del(data);
+ evas_object_del(data);
}
static void popup_set_btn_clicked_cb(void *data , Evas_Object *obj , void *event_info)
{
- NOTISET_TRACE_BEGIN;
- ug_data *ug_main = get_app_ui_data();
- ret_if(ug_main == NULL);
- char *buff = NULL;
- datetime_s *dt = data;
+ NOTISET_TRACE_BEGIN;
+ ug_data *ug_main = get_app_ui_data();
+ ret_if(ug_main == NULL);
+ char *buff = NULL;
+ datetime_s *dt = data;
- elm_datetime_value_get(dt->datetime, &dt->saved_time);
+ elm_datetime_value_get(dt->datetime, &dt->saved_time);
- if (dt->is_start_time)
- notification_system_setting_dnd_schedule_set_start_time(get_system_setting(), dt->saved_time.tm_hour, dt->saved_time.tm_min);
- else
- notification_system_setting_dnd_schedule_set_end_time(get_system_setting(), dt->saved_time.tm_hour, dt->saved_time.tm_min);
+ if (dt->is_start_time)
+ notification_system_setting_dnd_schedule_set_start_time(get_system_setting(), dt->saved_time.tm_hour, dt->saved_time.tm_min);
+ else
+ notification_system_setting_dnd_schedule_set_end_time(get_system_setting(), dt->saved_time.tm_hour, dt->saved_time.tm_min);
- buff = make_time_string(mktime(&dt->saved_time));
- if (buff) {
- elm_object_text_set(dt->button, buff);
- free(buff);
- buff = NULL;
- }
+ buff = make_time_string(mktime(&dt->saved_time));
+ if (buff) {
+ elm_object_text_set(dt->button, buff);
+ free(buff);
+ buff = NULL;
+ }
- elm_genlist_item_update(elm_genlist_last_item_get(ug_main->list_sub));
+ elm_genlist_item_update(elm_genlist_last_item_get(ug_main->list_sub));
- evas_object_del(dt->popup);
+ evas_object_del(dt->popup);
- update_system_settings();
+ update_system_settings();
}
static void create_datetime_popup(datetime_s *dt)
{
- Evas_Object *set_btn, *cancel_btn;
- ug_data *ug_main = get_app_ui_data();
- ret_if(ug_main == NULL);
+ Evas_Object *set_btn, *cancel_btn;
+ ug_data *ug_main = get_app_ui_data();
+ ret_if(ug_main == NULL);
- dt->popup = elm_popup_add(ug_main->naviframe);
- eext_object_event_callback_add(dt->popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL);
- evas_object_size_hint_weight_set(dt->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_popup_align_set(dt->popup, ELM_NOTIFY_ALIGN_FILL, 0.5);
+ dt->popup = elm_popup_add(ug_main->naviframe);
+ eext_object_event_callback_add(dt->popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL);
+ evas_object_size_hint_weight_set(dt->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_popup_align_set(dt->popup, ELM_NOTIFY_ALIGN_FILL, 0.5);
- cancel_btn = elm_button_add(dt->popup);
- elm_object_style_set(cancel_btn, "popup");
- elm_object_text_set(cancel_btn, APP_STRING("IDS_ST_BUTTON_CANCEL"));
- elm_object_part_content_set(dt->popup, "button1", cancel_btn);
- evas_object_smart_callback_add(cancel_btn, "clicked", popup_cancel_btn_clicked_cb, dt->popup);
+ cancel_btn = elm_button_add(dt->popup);
+ elm_object_style_set(cancel_btn, "popup");
+ elm_object_text_set(cancel_btn, APP_STRING("IDS_ST_BUTTON_CANCEL"));
+ elm_object_part_content_set(dt->popup, "button1", cancel_btn);
+ evas_object_smart_callback_add(cancel_btn, "clicked", popup_cancel_btn_clicked_cb, dt->popup);
- set_btn = elm_button_add(dt->popup);
- elm_object_style_set(set_btn, "popup");
- elm_object_text_set(set_btn, APP_STRING("IDS_ST_BUTTON_SET"));
- elm_object_part_content_set(dt->popup, "button2", set_btn);
- evas_object_smart_callback_add(set_btn, "clicked", popup_set_btn_clicked_cb, dt);
+ set_btn = elm_button_add(dt->popup);
+ elm_object_style_set(set_btn, "popup");
+ elm_object_text_set(set_btn, APP_STRING("IDS_ST_BUTTON_SET"));
+ elm_object_part_content_set(dt->popup, "button2", set_btn);
+ evas_object_smart_callback_add(set_btn, "clicked", popup_set_btn_clicked_cb, dt);
}
static void create_popup(datetime_s *dt)
{
- create_datetime_popup(dt);
- Evas_Object *box = elm_box_add(dt->popup);
- ug_data *ug_main = get_app_ui_data();
- ret_if(ug_main == NULL);
+ create_datetime_popup(dt);
+ Evas_Object *box = elm_box_add(dt->popup);
+ ug_data *ug_main = get_app_ui_data();
+ ret_if(ug_main == NULL);
- dt->datetime = elm_datetime_add(ug_main->naviframe);
+ dt->datetime = elm_datetime_add(ug_main->naviframe);
- char *format = get_time_format() == time_format_12H ? TIME_12_FORMAT : TIME_24_FORMAT;
- bool fmt12hours = !strcmp(format, TIME_12_FORMAT);
- const char *fmt = fmt12hours ? TIME_12_LAYOUT : TIME_24_LAYOUT;
- const char *timeMask = fmt12hours ? POPUP_TIME_12_FORMAT : POPUP_TIME_24_FORMAT;
+ char *format = get_time_format() == time_format_12H ? TIME_12_FORMAT : TIME_24_FORMAT;
+ bool fmt12hours = !strcmp(format, TIME_12_FORMAT);
+ const char *fmt = fmt12hours ? TIME_12_LAYOUT : TIME_24_LAYOUT;
+ const char *timeMask = fmt12hours ? POPUP_TIME_12_FORMAT : POPUP_TIME_24_FORMAT;
- elm_object_style_set(dt->datetime, fmt);
- elm_datetime_format_set(dt->datetime, timeMask);
+ elm_object_style_set(dt->datetime, fmt);
+ elm_datetime_format_set(dt->datetime, timeMask);
- elm_datetime_value_set(dt->datetime, &dt->saved_time);
- evas_object_size_hint_align_set(dt->datetime, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_datetime_value_set(dt->datetime, &dt->saved_time);
+ evas_object_size_hint_align_set(dt->datetime, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_show(dt->datetime);
- elm_box_pack_end(box, dt->datetime);
- elm_object_content_set(dt->popup, box);
+ evas_object_show(dt->datetime);
+ elm_box_pack_end(box, dt->datetime);
+ elm_object_content_set(dt->popup, box);
- evas_object_show(dt->popup);
+ evas_object_show(dt->popup);
}
void create_start_time_popup()
{
- create_popup(&start_time_p);
+ create_popup(&start_time_p);
}
void create_end_time_popup()
{
- create_popup(&end_time_p);
+ create_popup(&end_time_p);
}
static void launch_popup_cb(void *data, Evas_Object *obj , void *event_info)
{
- datetime_s *dt = data;
- create_popup(dt);
+ datetime_s *dt = data;
+ create_popup(dt);
}
static Evas_Object *create_time_button(Evas_Object *parent, const char *text, const char *format, datetime_s *dt)
{
- Evas_Object *button = elm_button_add(parent);
- elm_object_style_set(button, "datetime");
- evas_object_propagate_events_set(button, EINA_FALSE);
- elm_object_text_set(button, text);
- evas_object_show(button);
- evas_object_data_set(button, "format", format);
- evas_object_smart_callback_add(button, "clicked", launch_popup_cb, dt);
- elm_object_part_content_set(parent, "elm.swallow.content", button);
- evas_object_show(parent);
+ Evas_Object *button = elm_button_add(parent);
+ elm_object_style_set(button, "datetime");
+ evas_object_propagate_events_set(button, EINA_FALSE);
+ elm_object_text_set(button, text);
+ evas_object_show(button);
+ evas_object_data_set(button, "format", format);
+ evas_object_smart_callback_add(button, "clicked", launch_popup_cb, dt);
+ elm_object_part_content_set(parent, "elm.swallow.content", button);
+ evas_object_show(parent);
- return button;
+ return button;
}
static Evas_Object *create_start_end_time_layout(Evas_Object* parent)
{
- Evas_Object *layout = elm_layout_add(parent);
+ Evas_Object *layout = elm_layout_add(parent);
- char *res_path = app_get_resource_path();
- if (res_path) {
- char edj_path[PATH_MAX] = { 0, };
- snprintf(edj_path, PATH_MAX, "%s%s", res_path, "edje/time_button_layout.edj");
- elm_layout_file_set(layout, edj_path, "button_layout");
- free(res_path);
- }
+ char *res_path = app_get_resource_path();
+ if (res_path) {
+ char edj_path[PATH_MAX] = { 0, };
+ snprintf(edj_path, PATH_MAX, "%s%s", res_path, "edje/time_button_layout.edj");
+ elm_layout_file_set(layout, edj_path, "button_layout");
+ free(res_path);
+ }
- evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_show(layout);
- return layout;
+ evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(layout);
+ return layout;
}
Evas_Object *start_end_time_item(Evas_Object *parent, bool is_start_time_item)
{
- Evas_Object *layout = create_start_end_time_layout(parent);
- char *buff = NULL;
- datetime_s dt;
- time_t local_time = time(0);
- struct tm *time_info = localtime(&local_time);
-
- dt.is_start_time = is_start_time_item;
- dt.saved_time = *time_info;
- dt.saved_time.tm_sec = 0;
-
- if (is_start_time_item) {
- notification_system_setting_dnd_schedule_get_start_time(get_system_setting(), &dt.saved_time.tm_hour, &dt.saved_time.tm_min);
- start_time_p = dt;
- } else {
- notification_system_setting_dnd_schedule_get_end_time(get_system_setting(), &dt.saved_time.tm_hour, &dt.saved_time.tm_min);
- end_time_p = dt;
- }
-
- char *timeFormat = get_time_format() == time_format_12H ? TIME_12_FORMAT : TIME_24_FORMAT;
- if (is_start_time_item) {
- buff = make_time_string(mktime(&start_time_p.saved_time));
- NOTISET_DBG("start_time_p = %s", buff);
- start_time_p.button = create_time_button(layout, buff, timeFormat, &start_time_p);
- } else {
- buff = make_time_string(mktime(&end_time_p.saved_time));
- NOTISET_DBG("ent_time_p = %s", buff);
- end_time_p.button = create_time_button(layout, buff, timeFormat, &end_time_p);
- }
-
- if (buff) {
- free(buff);
- buff = NULL;
- }
- return layout;
+ Evas_Object *layout = create_start_end_time_layout(parent);
+ char *buff = NULL;
+ datetime_s dt;
+ time_t local_time = time(0);
+ struct tm *time_info = localtime(&local_time);
+
+ dt.is_start_time = is_start_time_item;
+ dt.saved_time = *time_info;
+ dt.saved_time.tm_sec = 0;
+
+ if (is_start_time_item) {
+ notification_system_setting_dnd_schedule_get_start_time(get_system_setting(), &dt.saved_time.tm_hour, &dt.saved_time.tm_min);
+ start_time_p = dt;
+ } else {
+ notification_system_setting_dnd_schedule_get_end_time(get_system_setting(), &dt.saved_time.tm_hour, &dt.saved_time.tm_min);
+ end_time_p = dt;
+ }
+
+ char *timeFormat = get_time_format() == time_format_12H ? TIME_12_FORMAT : TIME_24_FORMAT;
+ if (is_start_time_item) {
+ buff = make_time_string(mktime(&start_time_p.saved_time));
+ NOTISET_DBG("start_time_p = %s", buff);
+ start_time_p.button = create_time_button(layout, buff, timeFormat, &start_time_p);
+ } else {
+ buff = make_time_string(mktime(&end_time_p.saved_time));
+ NOTISET_DBG("ent_time_p = %s", buff);
+ end_time_p.button = create_time_button(layout, buff, timeFormat, &end_time_p);
+ }
+
+ if (buff) {
+ free(buff);
+ buff = NULL;
+ }
+ return layout;
}
static void calc_label_size(Evas_Object *label)
{
- Evas_Object *edje_label = elm_layout_edje_get(label);
- const Evas_Object *text_block = edje_object_part_object_get(edje_label, "elm.text");
- Evas_Coord ww = 0;
- Evas_Coord hh = 0;
- evas_object_textblock_size_native_get(text_block, &ww, &hh);
- evas_object_size_hint_min_set(label, ww, hh);
+ Evas_Object *edje_label = elm_layout_edje_get(label);
+ const Evas_Object *text_block = edje_object_part_object_get(edje_label, "elm.text");
+ Evas_Coord ww = 0;
+ Evas_Coord hh = 0;
+ evas_object_textblock_size_native_get(text_block, &ww, &hh);
+ evas_object_size_hint_min_set(label, ww, hh);
}
static void close_set_schedule_cb(void *data, Evas_Object *obj, void *event_info)
{
- NOTISET_TRACE_BEGIN;
- ret_if(!data);
- ug_data *ugd = (ug_data *)data;
- bool update_ui = false;
- if (new_dnd_schedule_weekday != default_dnd_schedule_weekday) {
- save_dnd_weekday(new_dnd_schedule_weekday);
- update_ui = true;
- }
+ NOTISET_TRACE_BEGIN;
+ ret_if(!data);
+ ug_data *ugd = (ug_data *)data;
+ bool update_ui = false;
+ if (new_dnd_schedule_weekday != default_dnd_schedule_weekday) {
+ save_dnd_weekday(new_dnd_schedule_weekday);
+ update_ui = true;
+ }
- if (!same_time(&start_time_p.saved_time, &start_time_p.default_time)) {
- save_date_time(&start_time_p);
- update_ui = true;
- }
+ if (!same_time(&start_time_p.saved_time, &start_time_p.default_time)) {
+ save_date_time(&start_time_p);
+ update_ui = true;
+ }
- if (!same_time(&end_time_p.saved_time, &end_time_p.default_time)) {
- save_date_time(&end_time_p);
- update_ui = true;
- }
+ if (!same_time(&end_time_p.saved_time, &end_time_p.default_time)) {
+ save_date_time(&end_time_p);
+ update_ui = true;
+ }
- if (update_ui)
- elm_genlist_item_update(elm_genlist_item_next_get(elm_genlist_first_item_get(ugd->list_main)));
+ if (update_ui)
+ elm_genlist_item_update(elm_genlist_item_next_get(elm_genlist_first_item_get(ugd->list_main)));
- elm_naviframe_item_pop(ugd->naviframe);
+ elm_naviframe_item_pop(ugd->naviframe);
}
void gl_set_schedule_selected(ug_data *data)
{
- NOTISET_TRACE_BEGIN;
- ug_data *ugd = data;
- ret_if(!ugd);
-
- /* back Button */
- Evas_Object *back_btn = elm_button_add(ugd->naviframe);
- elm_object_style_set(back_btn, "naviframe/back_btn/default");
- evas_object_smart_callback_add(back_btn, "clicked", close_set_schedule_cb, ugd);
- eext_object_event_callback_add(ugd->naviframe, EEXT_CALLBACK_BACK, close_set_schedule_cb, ugd);
- load_dnd_schedule_day();
-
- /* Push to naviframe */
- ugd->list_sub = _create_set_schedule_disturb_gl(ugd);
- append_gl_start_option(ugd->list_sub, "type1", "set-schedule");
- append_gl_full_item(ugd->list_sub, repeat_weekly_layout_cb, NULL);
- append_gl_start_option(ugd->list_sub, "type1", "start-time");
- append_gl_start_option(ugd->list_sub, "type1", "end-time");
- ugd->navi_item = elm_naviframe_item_push(ugd->naviframe, APP_STRING("IDS_ST_MBODY_SET_SCHEDULE_M_TIME"), back_btn, NULL, ugd->list_sub, NULL);
- enable_time_items(get_schedule());
+ NOTISET_TRACE_BEGIN;
+ ug_data *ugd = data;
+ ret_if(!ugd);
+
+ /* back Button */
+ Evas_Object *back_btn = elm_button_add(ugd->naviframe);
+ elm_object_style_set(back_btn, "naviframe/back_btn/default");
+ evas_object_smart_callback_add(back_btn, "clicked", close_set_schedule_cb, ugd);
+ eext_object_event_callback_add(ugd->naviframe, EEXT_CALLBACK_BACK, close_set_schedule_cb, ugd);
+ load_dnd_schedule_day();
+
+ /* Push to naviframe */
+ ugd->list_sub = _create_set_schedule_disturb_gl(ugd);
+ append_gl_start_option(ugd->list_sub, "type1", "set-schedule");
+ append_gl_full_item(ugd->list_sub, repeat_weekly_layout_cb, NULL);
+ append_gl_start_option(ugd->list_sub, "type1", "start-time");
+ append_gl_start_option(ugd->list_sub, "type1", "end-time");
+ ugd->navi_item = elm_naviframe_item_push(ugd->naviframe, APP_STRING("IDS_ST_MBODY_SET_SCHEDULE_M_TIME"), back_btn, NULL, ugd->list_sub, NULL);
+ enable_time_items(get_schedule());
}
notification_system_setting_h get_system_setting()
{
- NOTISET_TRACE_BEGIN;
- if (!system_setting)
- load_system_setting();
+ NOTISET_TRACE_BEGIN;
+ if (!system_setting)
+ load_system_setting();
- return system_setting;
+ return system_setting;
}
void update_system_settings()
{
- NOTISET_TRACE_BEGIN;
- int err = NOTIFICATION_ERROR_NONE;
- if (system_setting) {
- err = notification_system_setting_update_system_setting(system_setting);
- if (err != NOTIFICATION_ERROR_NONE)
- NOTISET_ERR("notification_setting_update_setting [%d]\n", err);
-
- if (system_setting)
- notification_system_setting_free_system_setting(system_setting);
-
- system_setting = NULL;
- }
+ NOTISET_TRACE_BEGIN;
+ int err = NOTIFICATION_ERROR_NONE;
+ if (system_setting) {
+ err = notification_system_setting_update_system_setting(system_setting);
+ if (err != NOTIFICATION_ERROR_NONE)
+ NOTISET_ERR("notification_setting_update_setting [%d]\n", err);
+
+ if (system_setting)
+ notification_system_setting_free_system_setting(system_setting);
+
+ system_setting = NULL;
+ }
}
static void load_system_setting()
{
- if (!system_setting) {
- int err = notification_system_setting_load_system_setting(&system_setting);
- if (err != NOTIFICATION_ERROR_NONE || system_setting == NULL) {
- NOTISET_ERR("notification_system_setting_load_system_setting failed [%d]\n", err);
- if (system_setting)
- notification_system_setting_free_system_setting(system_setting);
-
- system_setting = NULL;
- }
- }
+ if (!system_setting) {
+ int err = notification_system_setting_load_system_setting(&system_setting);
+ if (err != NOTIFICATION_ERROR_NONE || system_setting == NULL) {
+ NOTISET_ERR("notification_system_setting_load_system_setting failed [%d]\n", err);
+ if (system_setting)
+ notification_system_setting_free_system_setting(system_setting);
+
+ system_setting = NULL;
+ }
+ }
}