#include <app_debug.h>
#include <notification.h>
#include <notification_noti.h>
+#include <notification_internal.h>
#include "define.h"
}
static void _draw_notification(struct _priv *priv, int category,
- notification_list_h noti_list)
+ notification_list_h ongoing_list, notification_list_h noti_list)
{
notification_h noti;
int count = 0, col, w;
elm_gengrid_clear(priv->category[category]->grid);
+ while (ongoing_list != NULL) {
+ noti = notification_list_get_data(ongoing_list);
+ elm_gengrid_item_append(priv->category[category]->grid,
+ priv->grid_class, noti, NULL, noti);
+
+ ongoing_list = notification_list_remove(ongoing_list, noti);
+ count++;
+ }
+
while (noti_list != NULL) {
noti = notification_list_get_data(noti_list);
elm_gengrid_item_append(priv->category[category]->grid,
static void _update_list(struct _priv *priv)
{
- notification_list_h noti_list = NULL;
+ notification_list_h ongoing_list = NULL, noti_list = NULL;
Elm_Object_Item *it;
notification_get_list(NOTIFICATION_TYPE_NOTI, -1, ¬i_list);
- if (!noti_list) {
+ notification_get_list(NOTIFICATION_TYPE_ONGOING, -1, &ongoing_list);
+ if (!ongoing_list && !noti_list) {
elm_object_signal_emit(priv->base,
SIGNAL_NO_NOTIFICATION, SOURCE_PROGRAM);
elm_object_disabled_set(priv->clear_btn, EINA_TRUE);
if (!priv->category[CATEGORY_TODAY])
_draw_category(priv, CATEGORY_TODAY);
- _draw_notification(priv, CATEGORY_TODAY, noti_list);
+ _draw_notification(priv, CATEGORY_TODAY, ongoing_list, noti_list);
if (priv->category[CATEGORY_TODAY]) {
it = elm_gengrid_first_item_get(
notification_free(noti);
}
+static void _notification_changed_cb(void *data, notification_type_e type)
+{
+ struct _priv *priv = data;
+
+ if (priv)
+ _update_list(priv);
+}
+
static Evas_Object *_create(Evas_Object *win, void *data)
{
struct _priv *priv;
evas_object_show(priv->base);
_update_list(priv);
+
+ notification_resister_changed_cb(_notification_changed_cb, priv);
}
static void _hide(void *view_data)
priv = (struct _priv *) view_data;
+ notification_unresister_changed_cb(_notification_changed_cb);
+
evas_object_hide(priv->base);
}
}
}
+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);
+ }
+}
+
static void _clear_key_up_cb(int id, void *data, Evas *e,
Evas_Object *obj, Evas_Event_Key_Up *ev)
{
if (!strcmp(ev->keyname, KEY_ENTER))
- notification_delete_all(NOTIFICATION_TYPE_NOTI);
+ _clear_notification();
}
static void _clear_mouse_up_cb(int id, void *data, Evas *e,
Evas_Object *obj, Evas_Event_Mouse_Up *ev)
{
- notification_delete_all(NOTIFICATION_TYPE_NOTI);
+ _clear_notification();
}
static void _category_unfocused_cb(int id, void *data,