diff options
author | jinwoo.shin <jw0227.shin@samsung.com> | 2015-07-30 19:01:35 +0900 |
---|---|---|
committer | jinwoo.shin <jw0227.shin@samsung.com> | 2015-07-30 19:02:28 +0900 |
commit | 358b9e182c4d15260883f734062e28630af16129 (patch) | |
tree | 0958ec9a485a386640799a3308a8f6eaf9a000e5 | |
parent | ef19d459054fd78bb50324a683dbd429d412d83f (diff) | |
download | air_infosquare-accepted/tizen/tv/20150731.005354.tar.gz air_infosquare-accepted/tizen/tv/20150731.005354.tar.bz2 air_infosquare-accepted/tizen/tv/20150731.005354.zip |
Update notification display servicesubmit/tizen/20150730.133600accepted/tizen/tv/20150731.005354
Change-Id: I38ca85154854a8a5f982e02b6324aebef4aafb3e
Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
-rw-r--r-- | daemon/notification-display.service | 2 | ||||
-rw-r--r-- | daemon/notification_display_service.c | 73 |
2 files changed, 66 insertions, 9 deletions
diff --git a/daemon/notification-display.service b/daemon/notification-display.service index 8dccc65..3907696 100644 --- a/daemon/notification-display.service +++ b/daemon/notification-display.service @@ -1,6 +1,6 @@ [Unit] Description=Notifications Display daemon -Requires=notifications.service display-manager-run.service +Requires=notifications.service display-manager-run.service tizen-system-env.service After=notifications.service display-manager-run.service [Service] diff --git a/daemon/notification_display_service.c b/daemon/notification_display_service.c index fa6d773..09699b3 100644 --- a/daemon/notification_display_service.c +++ b/daemon/notification_display_service.c @@ -14,9 +14,11 @@ SET_TAG(SERVICE_NAME) struct _priv { Evas_Object *win; Evas_Object *popup; + + time_t last_time; }; -static void _timeout(void *data, Evas_Object *obj, void *event_info) +static void _hide(void *data, Evas_Object *obj, void *event_info) { evas_object_hide(data); } @@ -38,10 +40,13 @@ void _show_notification(struct _priv *priv, notification_h noti) void _notification_changed_cb(void *data, notification_type_e notif_type) { struct _priv *priv; - + time_t latest_time; notification_h noti = NULL; notification_list_h noti_list = NULL; + if (notif_type != NOTIFICATION_TYPE_NOTI) + return; + if (!data) { _ERR("failed to get data"); return; @@ -51,15 +56,60 @@ void _notification_changed_cb(void *data, notification_type_e notif_type) notification_get_list(NOTIFICATION_TYPE_NOTI, -1, ¬i_list); if (noti_list) { noti = notification_list_get_data(noti_list); - if (noti) - _show_notification(priv, noti); + if (noti) { + notification_get_insert_time(noti, &latest_time); + + if (latest_time > priv->last_time) { + _show_notification(priv, noti); + priv->last_time = latest_time; + } + } + } + + notification_free_list(noti_list); +} + +static void _clear_notification(void) +{ + notification_list_h noti_list = NULL; + notification_h noti; + + notification_get_list(NOTIFICATION_TYPE_NOTI, -1, ¬i_list); + if (!noti_list) + return; + + while (noti_list != NULL) { + noti = notification_list_get_data(noti_list); + notification_delete(noti); + + noti_list = notification_list_remove(noti_list, noti); + notification_free(noti); + } +} + +time_t _get_last_time(void) +{ + time_t last_time = 0; + notification_h noti = NULL; + notification_list_h noti_list = NULL; + + notification_get_list(NOTIFICATION_TYPE_NOTI, -1, ¬i_list); + if (noti_list) { + noti = notification_list_get_data(noti_list); + if (noti) { + notification_get_insert_time(noti, &last_time); + } } notification_free_list(noti_list); + + return last_time; } int _create_popup(struct _priv *priv) { + Evas_Object *btn; + priv->win = elm_win_add(NULL, "popup", ELM_WIN_BASIC); if (!priv->win) { _ERR("elm_win_add failed"); @@ -74,10 +124,12 @@ int _create_popup(struct _priv *priv) _ERR("elm_win_add failed"); return -1; } - elm_popup_timeout_set(priv->popup, HIDE_TIME); - elm_popup_orient_set(priv->popup, ELM_POPUP_ORIENT_BOTTOM_RIGHT); - evas_object_smart_callback_add(priv->popup, "timeout", - _timeout, priv->win); + elm_popup_orient_set(priv->popup, ELM_POPUP_ORIENT_BOTTOM_LEFT); + + btn = elm_button_add(priv->popup); + elm_object_text_set(btn, "OK"); + elm_object_part_content_set(priv->popup, "button1", btn); + evas_object_smart_callback_add(btn, "clicked", _hide, priv->win); return 0; } @@ -107,6 +159,11 @@ int main(int argc, char **argv) return 0; } + /* NOTE: Odroid specific code to workaround time issue */ + _clear_notification(); + + priv->last_time = _get_last_time(); + error_n = NOTIFICATION_ERROR_SERVICE_NOT_READY; while (error_n != NOTIFICATION_ERROR_NONE) { error_n = notification_resister_changed_cb( |