libgum
app-utils
pkgmgr-info
- notification
tv-service
ecore-wayland
ui-gadget-1
"icon": "@IMAGEDIR@/ic_user_08_nor.png",
"focus_icon": "@IMAGEDIR@/ic_user_08_foc.png",
"select_action": "push",
- "parameter": "VIEW_USER",
- "notification": false
+ "parameter": "VIEW_USER"
},
{
"name": "Media Hub",
"icon": "@IMAGEDIR@/btn_menu_media_nor.png",
"focus_icon": "@IMAGEDIR@/btn_menu_media_foc.png",
"select_action": "launch",
- "parameter": "org.tizen.mediahub",
- "notification": false
+ "parameter": "org.tizen.mediahub"
},
{
"name": "APP",
"icon": "@IMAGEDIR@/btn_menu_app_nor.png",
"focus_icon": "@IMAGEDIR@/btn_menu_app_foc.png",
"select_action": "launch",
- "parameter": "org.tizen.apps",
- "notification": false
+ "parameter": "org.tizen.apps"
},
{
"name": "Notification",
"icon": "@IMAGEDIR@/btn_menu_notification_nor.png",
"focus_icon": "@IMAGEDIR@/btn_menu_notification_foc.png",
"select_action": "launch",
- "parameter": "org.tizen.infosquare",
- "notification": true
+ "parameter": "org.tizen.infosquare"
},
{
"name": "Settings",
"icon": "@IMAGEDIR@/btn_menu_setting_nor.png",
"focus_icon": "@IMAGEDIR@/btn_menu_setting_foc.png",
"select_action": "launch",
- "parameter": "org.tizen.settings",
- "notification": false
+ "parameter": "org.tizen.settings"
}
]
}
rel2.to, PART_BAR_ITEM_TITLE;
}
}
- part {
- name, "pad.badge";
- type, RECT;
- scale, 1;
- description {
- state, "default" 0.0;
- min, 40 14;
- rel1.relative, 1.0 0.0;
- rel2.relative, 1.0 0.0;
- align, 1.0 0.0;
- fixed, 1 1;
- visible, 0;
- }
- }
- part {
- name, PART_BAR_ITEM_BADGE;
- type, SWALLOW;
- scale, 1;
- description {
- state, "default" 0.0;
- min, 36 36;
- rel1 {
- to, "pad.badge";
- relative, 0.0 1.0;
- }
- rel2 {
- to, "pad.badge";
- relative, 0.0 1.0;
- }
- align, 1.0 0.0;
- fixed, 1 1;
- }
- }
- part {
- name, PART_BAR_ITEM_BADGE_COUNT;
- type, TEXT;
- scale, 1;
- description {
- state, "default" 0.0;
- rel1.to, PART_BAR_ITEM_BADGE;
- rel2.to, PART_BAR_ITEM_BADGE;
- fixed, 1 1;
- text {
- size, 24;
- font, FONT_LIGHT;
- }
- color, 255 255 255 255;
- }
- }
}
}
char *icon;
char *focus_icon;
char *parameter;
- bool noti;
enum datamgr_item_select_action action;
int type;
time_t time;
#define PART_BAR_ITEM_ICON_FOCUS "part.bar.item.icon.focus"
#define PART_BAR_ITEM_TITLE "part.bar.item.title"
#define PART_BAR_ITEM_TITLE_FOCUS "part.bar.item.title.focus"
-#define PART_BAR_ITEM_BADGE "part.bar.item.badge"
-#define PART_BAR_ITEM_BADGE_COUNT "part.bar.item.badge.count"
#define PART_BAR_ITEM_LOCK "part.bar.item.lock"
#define PART_BAR_ITEM_LOCK_FOCUS "part.bar.item.lock.focus"
#define PART_BAR_ITEM_MASK "part.bar.item.mask"
#define IMAGE_SWITCH_ON IMAGEDIR"/btn_switch_on_nor.png"
#define IMAGE_SWITCH_OFF IMAGEDIR"/btn_switch_off_nor.png"
#define IMAGE_MASK IMAGEDIR"/mask_user_nor.png"
-#define IMAGE_BADGE IMAGEDIR"/badge_bg.png"
#define IMAGE_USER_ADD IMAGEDIR"/btn_user_add_nor.png"
#define IMAGE_USER_ADD_FOCUS IMAGEDIR"/btn_user_add_foc.png"
#define IMAGE_USER_DEFAULT IMAGEDIR"/ic_user_01_nor.png"
Evas_Object *utils_add_toast(Evas_Object *base, char *message);
bundle *utils_add_bundle(char *key, char *value, char *uri);
bool utils_launch_app(const char *pkg, bundle *b);
-int utils_get_notification_count(void);
#endif /* __AIR_HOME_UTILS_H__ */
enum update_type {
UPDATE_TYPE_EDIT,
UPDATE_TYPE_PHOTO,
- UPDATE_TYPE_NOTI,
UPDATE_TYPE_USER,
UPDATE_TYPE_RESET,
UPDATE_TYPE_MENU,
BuildRequires: pkgconfig(app-utils)
BuildRequires: pkgconfig(pkgmgr-info)
BuildRequires: pkgconfig(tv-service)
-BuildRequires: pkgconfig(notification)
BuildRequires: pkgconfig(ecore-wayland)
BuildRequires: pkgconfig(ui-gadget-1)
BuildRequires: pkgconfig(capi-web-history)
#include <stdbool.h>
#include <Evas.h>
#include <viewmgr.h>
-#include <notification.h>
-#include <notification_internal.h>
#include <gum/gum-user.h>
#include "data_home.h"
#define MEMBER_STR_FOCUS_ICON "focus_icon"
#define MEMBER_STR_SELECT_ACTION "select_action"
#define MEMBER_STR_PARAMETER "parameter"
-#define MEMBER_INT_NOTIFICATION "notification"
#define MAX_BUF 64
}
static struct datamgr_item *_new_datamgr_item(char *name, char *icon,
- char *focus_icon, char *parameter, char *action, bool noti)
+ char *focus_icon, char *parameter, char *action)
{
struct datamgr_item *di;
- char buf[MAX_BUF];
di = calloc(1, sizeof(*di));
if (!di) {
}
di->parameter = strdup(parameter);
- di->noti = noti;
- if (noti) {
- snprintf(buf, sizeof(buf), "%d",
- utils_get_notification_count());
- di->subtitle = strdup(buf);
- }
if (!strcmp(action, STR_SELECT_ACTION_PUSH) && _get_login_user(di)) {
di->action = ITEM_SELECT_ACTION_PUSH;
di->action = ITEM_SELECT_ACTION_LAUNCH;
} else {
free(di->parameter);
- free(di->subtitle);
free(di);
return NULL;
}
static struct datamgr_item *_pack_home_item(JsonReader *reader, int i)
{
char *name, *icon, *parameter, *focus_icon, *action;
- gboolean noti;
if (!reader) {
_ERR("Invalid argument");
action = _read_string(reader, MEMBER_STR_SELECT_ACTION);
parameter = _read_string(reader, MEMBER_STR_PARAMETER);
- noti = _read_boolean(reader, MEMBER_INT_NOTIFICATION);
json_reader_end_element(reader);
- return _new_datamgr_item(name, icon, focus_icon, parameter, action,
- noti);
+ return _new_datamgr_item(name, icon, focus_icon, parameter, action);
err:
json_reader_end_element(reader);
return NULL;
free(di->icon);
free(di->focus_icon);
free(di->parameter);
- free(di->subtitle);
free(di);
}
return dm->list;
}
-static void _notification_cb(void *data, notification_type_e type)
-{
- Eina_List *l;
- struct datamgr *dm;
- struct datamgr_item *di;
- char buf[MAX_BUF];
-
- if (!data) {
- _ERR("Invalid argument");
- return;
- }
-
- dm = data;
-
- EINA_LIST_FOREACH(dm->list, l, di) {
- if (!di->noti)
- continue;
-
- snprintf(buf, sizeof(buf), "%d",
- utils_get_notification_count());
- viewmgr_update_view(VIEW_HOME, UPDATE_TYPE_NOTI, buf);
- free(di->subtitle);
- di->subtitle = strdup(buf);
- }
-}
-
static void _fini(struct datamgr *dm)
{
if (!dm) {
}
_unload_home(dm);
-
- notification_unresister_changed_cb(_notification_cb);
}
static bool _init(struct datamgr *dm)
return false;
}
- notification_resister_changed_cb(_notification_cb, dm);
-
return _load_home(dm);
}
return -1;
}
-static bool _load_recent_notification(struct datamgr *dm)
-{
- struct datamgr_item *di;
- struct thumbnail_data *thumbnail;
- int time, count;
- char buf[MAX_BUF];
-
- count = utils_get_notification_count();
-
- if (count > 0)
- snprintf(buf, sizeof(buf), "%d Unread Noti.", count);
- else
- buf[0] = '\0';
-
- app_contents_get_basis_time(CONTENTS_NOTI, &time);
- if (time < 0) {
- _ERR("Invalid time");
- return false;
- }
-
- di = _new_datamgr_item(MESSAGE_NOTIFICATION, buf, APP_ID_INFOSQUARE,
- NULL, NULL, NULL, IMAGE_RECENT_ICON_APP, 0, time);
- if (di) {
- thumbnail = calloc(1, sizeof(*thumbnail));
- if (thumbnail) {
- thumbnail->file = strdup(IMAGE_RECENT_THUMB_NOTI);
- thumbnail->type = THUMBNAIL_FILE;
- di->thumbnail = thumbnail;
- }
- dm->list = eina_list_append(dm->list, di);
- }
-
- return true;
-}
-
static Eina_List *_get_items(struct datamgr *dm)
{
if (!dm) {
if (!_load_recent(dm, CONTENTS_MUSIC, 1, _music_list_foreach))
_ERR("failed to load recent music contents");
- if (!_load_recent_notification(dm))
- _ERR("failed to load recent notification contents");
-
if (!_load_recent(dm, CONTENTS_WEB, 1, _web_list_foreach))
_ERR("failed to load recent web contents");
#include <app_debug.h>
#include <stdbool.h>
#include <app.h>
-#include <notification.h>
-#include <notification_internal.h>
#include <app_contents.h>
#include <bundle.h>
return true;
}
-
-static void _get_notification_count(notification_type_e type, int *count)
-{
- int basis_time, r;
- time_t noti_time;
- notification_list_h list = NULL;
- notification_h noti;
-
- app_contents_get_basis_time(CONTENTS_NOTI, &basis_time);
- if (basis_time < 0) {
- _ERR("failed to get basis time");
- return;
- }
-
- notification_get_list(type, -1, &list);
- if (!list)
- return;
-
- while (list) {
- noti = notification_list_get_data(list);
- if (!noti) {
- _ERR("failed to get noti data");
- list = notification_list_get_next(list);
- continue;
- }
-
- r = notification_get_insert_time(noti, ¬i_time);
- if (r != NOTIFICATION_ERROR_NONE) {
- _ERR("failed to get time of notification");
- list = notification_list_get_next(list);
- continue;
- }
-
- if (noti_time < basis_time)
- break;
-
- (*count)++;
- list = notification_list_get_next(list);
- }
-
- notification_free_list(list);
-}
-
-int utils_get_notification_count(void)
-{
- int count = 0;
-
- _get_notification_count(NOTIFICATION_TYPE_ONGOING, &count);
- _get_notification_count(NOTIFICATION_TYPE_NOTI, &count);
-
- if (count > 99)
- count = 99;
-
- return count;
-}
struct bar_item {
Evas_Object *eo;
- Evas_Object *badge;
struct datamgr_item *di;
struct _priv *priv;
return true;
}
-static Evas_Object *_add_notification_badge(Evas_Object *eo, char *noti)
-{
- Evas_Object *badge;
-
- if (!strcmp(noti, "0"))
- return NULL;
-
- badge = utils_add_icon(eo, IMAGE_BADGE, PART_BAR_ITEM_BADGE);
- if (!badge) {
- _ERR("failed to add badge");
- return NULL;
- }
- elm_object_part_text_set(eo, PART_BAR_ITEM_BADGE_COUNT, noti);
-
- return badge;
-}
-
static struct bar_item *_pack_bar_item(struct _priv *priv, Evas_Object *box,
struct datamgr_item *di)
{
COLOR_DEFAULT_B, COLOR_DEFAULT_A);
}
- if (di->noti)
- bi->badge = _add_notification_badge(eo, di->subtitle);
-
inputmgr_add_callback(eo, INPUT_HANDLER_TYPE_EO, &handler, bi);
elm_box_pack_end(box, eo);
evas_object_show(eo);
free(priv);
}
-static void _update(void *view_data, int update_type, void *data)
-{
- struct _priv *priv;
- struct bar_item *bi;
- Eina_List *list;
- Evas_Object *badge;
-
- if (!view_data) {
- _ERR("Invalid argument");
- return;
- }
-
- priv = view_data;
-
- switch (update_type) {
- case UPDATE_TYPE_NOTI:
- if (!priv->list)
- return;
-
- EINA_LIST_FOREACH(priv->list, list, bi) {
- if (!bi->di->noti)
- continue;
-
- badge = _add_notification_badge(bi->eo, data);
- if (!badge && bi->badge) {
- evas_object_del(bi->badge);
- elm_object_part_text_set(bi->eo,
- PART_BAR_ITEM_BADGE_COUNT, "");
- }
- evas_object_show(bi->eo);
- bi->badge = badge;
- }
- break;
- default:
- _ERR("Invalid type");
- return;
- }
-}
-
static view_class vclass = {
.view_id = VIEW_HOME,
.create = _create,
.show = _show,
.hide = _hide,
- .destroy = _destroy,
- .update = _update
+ .destroy = _destroy
};
view_class *view_home_get_vclass(void)