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);
}
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;
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");
_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;
}
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(