char *get_app_id(struct app_data *adata);
char *get_app_name(struct app_data *adata);
char *get_app_icon(struct app_data *adata);
-bool get_app_favorite(struct app_data *adata);
+bool get_app_favorite(struct app_data *adata, bool *isfavorite);
+bool set_app_favorite(struct app_data *adata, bool isfavorite);
bool get_app_icon_bg_color(struct app_data *adata,
int *r, int *g, int *b, int *a);
bool get_app_text_bg_color(struct app_data *adata,
#define PART_GENGRID "part.gengrid"
#define PART_APP_COUNT "part.app.count"
#define PART_CONTENTS_TEXT "part.contents.text"
-#define PART_FAVORITE_ICON "part.favorite.icon"
#define PART_THUMB_BG "part.thumb.bg"
#define PART_THUMB_ICON "part.thumb.icon"
#define PART_TEXT_BG "part.text.bg"
#define STYLE_FAVORITE "style.favorite"
#define STYLE_LIVETV_BTN "style.livetv.button"
#define STYLE_ACTION_MENU_FAV_BTN "style.action.menu.favorite.button"
-#define STYLE_ACTION_MENU_LOCK_BTN "style.action.menu.lock.button"
#define STYLE_ACTION_MENU_UNINSTALL_BTN "style.action.menu.uninstall.button"
/* Signal */
#define SIG_ITEM_SELECTED "item_selected"
#define SIG_SOURCE_EDC "edc"
#define SIG_FAVORITE "favorite"
+#define SIG_UNFAVORITE "unfavorite"
#define SIG_VISIBLE "visible"
#define SIG_INVISIBLE "invisible"
#define SIG_DISABLE "elm,state,disabled"
#define SIG_TOGGLE "toggle"
+#define SIG_NO_CONTENT "no.content"
+#define SIG_CONTENT "content"
/* Signal Source */
#define SRC_MYAPPS "source.myapps"
#define SRC_SORT_BTN "source.sort.btn"
#define SRC_LIVETV_BTN "source.livetv.btn"
#define SRC_ACTION_BTN "source.action.btn"
+#define SRC_FAVORITE_AREA "source.favorite.area"
+#define SRC_FAVORITE_ICON "source.favorite.icon"
/* Font */
#define FONT_TIZENSANS_REGULAR "TizenSans"
#define STR_NOT_SUPPORTED "Not Supported"
#define STR_LIVETV "Live TV"
#define STR_FAVORITE "Favorite"
-#define STR_LOCK "Lock"
#define STR_UNINSTALL "Uninstall"
+#define STR_LIVETV_ID "org.tizen.live-tv"
+#define STR_NO_FAVORITE "No favorite contents"
/* Count */
#define MENU_COUNT 2
#define SORT_COUNT 3
-#define ACTION_MENU_COUNT 3
+#define ACTION_MENU_COUNT 2
/* Size */
#define SIZE_MYAPPS_GRID_WIDTH (212 + 26)
/* Image */
#define DEFAULT_APP_ICON_PNG IMGDIR"/ico_default.png"
-#define FAVORITE_ICON_PNG IMGDIR"/ic_thumbnail_favorite_01.png"
+#define FAVORITE_ICON_PNG "ic_thumbnail_favorite_01.png"
#define BROWSER_ICON_PNG IMGDIR"/ic_apps_web.png"
#define ARROW_ICON_UP_PNG "btn_option_arrow_nor.png"
#define ARROW_ICON_UP_FOC_PNG "btn_option_arrow_foc_up.png"
#define ACTION_FAV_FOC_PNG "btn_menu_favorite_foc.png"
#define ACTION_FAV_SEL_PNG "btn_menu_favorite_sel.png"
#define ACTION_FAV_DIS_PNG "btn_menu_favorite_dis.png"
-#define ACTION_UNLOCK_NOR_PNG "btn_menu_unlock_nor.png"
-#define ACTION_UNLOCK_FOC_PNG "btn_menu_unlock_foc.png"
-#define ACTION_LOCK_NOR_PNG "btn_menu_lock_nor.png"
-#define ACTION_LOCK_FOC_PNG "btn_menu_lock_foc.png"
-#define ACTION_LOCK_SEL_PNG "btn_menu_lock_sel.png"
-#define ACTION_LOCK_DIS_PNG "btn_menu_lock_dis.png"
#define ACTION_UNINSTALL_NOR_PNG "btn_menu_del_nor.png"
#define ACTION_UNINSTALL_FOC_PNG "btn_menu_del_foc.png"
#define ACTION_UNINSTALL_SEL_PNG "btn_menu_del_sel.png"
+++ /dev/null
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __AIR_APPS_VIEW_ACTION_MENU_H__
-#define __AIR_APPS_VIEW_ACTION_MENU_H__
-
-view_class *view_action_menu_get_vclass(void);
-
-#endif /* __AIR_APPS_VIEW_ACTION_MENU_H__ */
to, "part.menu.divider.up";
relative, 0.0 1.0;
}
- min, 375 124;
+ min, 250 124;
align, 0.0 0.0;
fixed, 1 1;
}
}
part {
- name, "padding.favorite.topleft";
+ name, "padding.favorite.top";
type, SPACER;
scale, 1;
description {
description {
state, "default" 0.0;
rel1 {
- to, "padding.favorite.topleft";
+ to, "padding.favorite.top";
relative, 0.0 1.0;
}
rel2 {
}
}
}
+
+ part {
+ name, "padding.no.content.bottomright";
+ type, SPACER;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 30 32;
+ rel1 {
+ to, "bg";
+ relative, 1.0 1.0;
+ }
+ rel2.to, "bg";
+ align, 1.0 1.0;
+ fixed, 1 1;
+ }
+ }
+
+ part {
+ name, "part.no.content.bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 229 229 229 255;
+ rel1 {
+ to, "padding.favorite.top";
+ relative, 0.0 1.0;
+ }
+ rel2 {
+ to, "padding.no.content.bottomright";
+ relative, 0.0 0.0;
+ }
+ visible, 0;
+ }
+ description {
+ state, "visible" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ }
+
+ part {
+ name, "part.no.content.text";
+ type, TEXT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 0 0 0 178;
+ rel1.to, "part.no.content.bg";
+ rel2.to, "part.no.content.bg";
+ text {
+ text, STR_NO_FAVORITE;
+ font, FONT_TIZENSANS_LIGHT;
+ size, 28;
+ align, 0.5 0.5;
+ }
+ visible, 0;
+ }
+ description {
+ state, "visible" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ }
+ }
+
+ programs {
+ program {
+ name, SIG_NO_CONTENT;
+ signal, SIG_NO_CONTENT;
+ source, SRC_FAVORITE_AREA;
+ action, STATE_SET "visible" 0.0;
+ target, "part.no.content.bg";
+ target, "part.no.content.text";
+ }
+ }
+
+ programs {
+ program {
+ name, SIG_CONTENT;
+ signal, SIG_CONTENT;
+ source, SRC_FAVORITE_AREA;
+ action, STATE_SET "default" 0.0;
+ target, "part.no.content.bg";
+ target, "part.no.content.text";
+ }
}
}
transition, TRANSITION_FOCUS;
}
- program {
- name, SIG_SELECTED;
- signal, SIG_SELECTED;
- source, SRC_ACTION_BTN;
- script {
- new state;
- state = get_int(cur_state);
- if (state == STATE_NORMAL) {
- set_int(cur_state, STATE_TOGGLE);
- set_state(PART:"part.icon", "focused.toggle", 0.0);
- } else if (state == STATE_TOGGLE) {
- set_int(cur_state, STATE_NORMAL);
- set_state(PART:"part.icon", "focused", 0.0);
- }
- }
- }
-
program {
name, SIG_DISABLE;
signal, SIG_DISABLE;
}
}
-group {
- name, "elm/button/base/style.action.menu.lock.button";
- inherit, "elm/button/base/style.action.menu.favorite.button";
- data.item, "focus_highlight" "on";
- images {
- image, ACTION_UNLOCK_NOR_PNG COMP;
- image, ACTION_UNLOCK_FOC_PNG COMP;
- image, ACTION_LOCK_NOR_PNG COMP;
- image, ACTION_LOCK_FOC_PNG COMP;
- image, ACTION_LOCK_SEL_PNG COMP;
- image, ACTION_LOCK_DIS_PNG COMP;
- }
- parts {
- part {
- name, "part.icon";
- type, IMAGE;
- scale, 1;
- description {
- state, "default" 0.0;
- rel1 {
- to, "part.icon.bg";
- relative, 0.5 0.5;
- }
- rel2 {
- to, "part.icon.bg";
- relative, 0.5 0.5;
- }
- align, 0.5 0.5;
- fixed, 1 1;
- min, 60 60;
- image.normal, ACTION_UNLOCK_NOR_PNG;
- }
- description {
- state, "default.toggle" 0.0;
- inherit, "default" 0.0;
- image.normal, ACTION_LOCK_NOR_PNG;
- }
- description {
- state, "focused" 0.0;
- inherit, "default" 0.0;
- image.normal, ACTION_UNLOCK_FOC_PNG;
- }
- description {
- state, "focused.toggle" 0.0;
- inherit, "default" 0.0;
- image.normal, ACTION_LOCK_FOC_PNG;
- }
- description {
- state, "selected" 0.0;
- inherit, "default" 0.0;
- image.normal, ACTION_LOCK_SEL_PNG;
- }
- description {
- state, "disable" 0.0;
- inherit, "default" 0.0;
- image.normal, ACTION_LOCK_DIS_PNG;
- }
- }
- }
-}
-
group {
name, "elm/button/base/style.action.menu.uninstall.button";
inherit, "elm/button/base/style.action.menu.favorite.button";
name, "elm/gengrid/item/style.myapp/default";
data.item, "focus_highlight" "on";
data.item, "texts" "part.thumb.text part.thumb.text.browser";
- data.item, "contents" "part.thumb.icon part.thumb.bg part.text.bg part.favorite.icon";
+ data.item, "contents" "part.thumb.icon part.thumb.bg part.text.bg";
images {
image, FAVORITE_ICON_PNG COMP;
}
}
part {
- name, PART_FAVORITE_ICON;
- type, SWALLOW;
+ name, "part.favorite.icon";
+ type, IMAGE;
scale, 1;
description {
state, "default" 0.0;
rel2.to, "padding.favorite";
align, 0.0 0.0;
fixed, 1 1;
- map {
- perspective_on, 1;
- perspective, "map";
- }
+ image.normal, FAVORITE_ICON_PNG;
+ visible, 0;
}
description {
- state, "focused" 0.0;
+ state, "visible" 0.0;
inherit, "default" 0.0;
- map.on, 1;
+ visible, 1;
}
}
action, STATE_SET "focused" 0.0;
target, PART_THUMB_BG;
target, PART_THUMB_ICON;
- target, PART_FAVORITE_ICON;
target, "part.focus.up";
target, "part.focus.left";
target, "part.focus.down";
action, STATE_SET "default" 0.0;
target, PART_THUMB_BG;
target, PART_THUMB_ICON;
- target, PART_FAVORITE_ICON;
target, "part.focus.up";
target, "part.focus.left";
target, "part.focus.down";
target, "part.inside.line.right";
target, "part.divide.line";
}
+
+ program {
+ name, SIG_FAVORITE;
+ signal, SIG_FAVORITE;
+ source, SRC_FAVORITE_ICON;
+ action, STATE_SET "visible" 0.0;
+ target, "part.favorite.icon";
+ }
+
+ program {
+ name, SIG_UNFAVORITE;
+ signal, SIG_UNFAVORITE;
+ source, SRC_FAVORITE_ICON;
+ action, STATE_SET "default" 0.0;
+ target, "part.favorite.icon";
+ }
}
}
char *name;
char *icon;
bool is_locked;
- bool is_favorite;
struct color_data icon_bg;
struct color_data text_bg;
};
Eina_List **list;
struct app_data *adata;
char *appid, *name, *icon;
- bool is_favorite, nodisplay;
- int r;
+ bool nodisplay;
if (!data)
return -1;
if (pkgmgrinfo_appinfo_get_icon(handle, &icon) != PMINFO_R_OK)
return 0;
- r = app_contents_favorite_check(CONTENTS_APP, appid, &is_favorite);
- if (r != APP_CONTENTS_ERROR_NONE)
- return 0;
-
adata = calloc(1, sizeof(*adata));
if (!adata) {
_ERR("Calloc failed.");
if (icon)
adata->icon = strdup(icon);
- adata->is_favorite = is_favorite;
-
if (!strcmp(appid, STR_BROWSER_ID)) {
_set_default_color(&adata->icon_bg);
_set_default_color(&adata->text_bg);
return adata->icon;
}
-bool get_app_favorite(struct app_data *adata)
+bool get_app_favorite(struct app_data *adata, bool *isfavorite)
{
- if (!adata) {
+ int r;
+
+ if (!adata || !adata->appid) {
_ERR("Invalid argument.");
- return NULL;
+ return false;
}
- return adata->is_favorite;
+ r = app_contents_favorite_check(CONTENTS_APP, adata->appid,
+ isfavorite);
+ if (r != APP_CONTENTS_ERROR_NONE)
+ return false;
+
+ return true;
+}
+
+bool set_app_favorite(struct app_data *adata, bool isfavorite)
+{
+ int r;
+
+ if (!adata || !adata->appid) {
+ _ERR("Invalid argument.");
+ return false;
+ }
+
+ r = app_contents_favorite_set(CONTENTS_APP, adata->appid, isfavorite);
+ if (r != APP_CONTENTS_ERROR_NONE)
+ return false;
+
+ return true;
}
bool get_app_icon_bg_color(struct app_data *adata,
{
Eina_List *list = NULL, *l = NULL, *fav_list = NULL;
struct app_data *adata;
+ bool isfavorite;
list = get_app_list();
if (!list)
return NULL;
EINA_LIST_FOREACH(list, l, adata) {
- if (adata && get_app_favorite(adata))
+ if (adata && get_app_favorite(adata, &isfavorite) && isfavorite)
fav_list = eina_list_append(fav_list, adata);
}
evas_object_color_set(text_bg, r, g, b, a);
return text_bg;
- } else if (!strcmp(part, PART_FAVORITE_ICON)) {
- if (!get_app_favorite(adata))
- return NULL;
-
- img = elm_image_add(obj);
- if (!img) {
- _ERR("elm_image_add failed.");
- return NULL;
- }
-
- elm_image_file_set(img, FAVORITE_ICON_PNG, NULL);
- evas_object_show(img);
-
- return img;
}
return NULL;
#include <viewmgr.h>
#include <inputmgr.h>
#include <gridmgr.h>
-#include <app_contents.h>
#include <app_debug.h>
#include "define.h"
};
struct _priv {
- const char *appid;
+ struct app_data *adata;
Evas_Object *win;
Evas_Object *base;
Evas_Object *grid;
const char *title;
const char *style;
Eina_Bool disable;
- Eina_Bool toggle;
};
static struct _action_info action_info[] = {
.style = STYLE_ACTION_MENU_FAV_BTN,
.disable = EINA_FALSE
},
- {
- .id = BTN_LOCK,
- .title = STR_LOCK,
- .style = STYLE_ACTION_MENU_LOCK_BTN,
- .disable = EINA_TRUE,
- .toggle = EINA_FALSE
- },
{
.id = BTN_UNINSTALL,
.title = STR_UNINSTALL,
.style = STYLE_ACTION_MENU_UNINSTALL_BTN,
- .disable = EINA_TRUE,
- .toggle = EINA_FALSE
+ .disable = EINA_TRUE
}
};
elm_object_focus_set(obj, EINA_TRUE);
}
-static void _livetv_selected(void *data, Evas_Object *obj)
+static void _livetv_selected(void)
{
- /* It will be implemented later */
+ if (!utils_launch_app(STR_LIVETV_ID)) {
+ _ERR("Launch live tv failed.");
+ return;
+ }
+
+ viewmgr_hide_view(VIEW_ACTION_MENU);
}
-static void _favorite_selected(void *data, Evas_Object *obj)
+static void _favorite_selected(struct _priv *priv)
{
- struct _priv *priv;
- int r;
bool isfavorite;
- if (!data) {
- _ERR("Invalid argument.");
- return;
- }
- priv = data;
-
- if (!priv->appid)
- return;
-
- r = app_contents_favorite_check(CONTENTS_APP, priv->appid, &isfavorite);
- if (r != APP_CONTENTS_ERROR_NONE) {
- _ERR("Favorite check failed.");
+ if (!get_app_favorite(priv->adata, &isfavorite)) {
+ _ERR("Get favorite value failed.");
return;
}
- r = app_contents_favorite_set(CONTENTS_APP, priv->appid, !isfavorite);
- if (r != APP_CONTENTS_ERROR_NONE) {
- _ERR("Favorite set failed.");
+ if (!set_app_favorite(priv->adata, !isfavorite)) {
+ _ERR("Set favorite value faild.");
return;
}
- elm_object_signal_emit(obj, SIG_SELECTED, SRC_ACTION_BTN);
+ viewmgr_update_view(VIEW_BASE, UPDATE_FAVORITE, priv->adata);
+ viewmgr_hide_view(VIEW_ACTION_MENU);
}
static void _clicked_cb(int id, void *data, Evas_Object *obj)
{
+ struct _priv *priv;
+
+ if (!data)
+ return;
+
+ priv = data;
+
switch (id) {
case BTN_LIVETV:
- _livetv_selected(data, obj);
+ _livetv_selected();
break;
case BTN_FAVORITE:
- _favorite_selected(data, obj);
- break;
-
- case BTN_LOCK:
- /* It is not supported yet. */
+ _favorite_selected(priv);
break;
case BTN_UNINSTALL:
static void _grid_realized_cb(int id, void *data, Evas_Object *obj,
Elm_Object_Item *item)
{
+ struct app_data *adata;
+
if (!data || !item) {
_ERR("Invalid argument.");
return;
}
+ adata = elm_object_item_data_get(item);
+
elm_object_item_signal_callback_add(item, SIG_ITEM_SELECTED,
SIG_SOURCE_EDC, _grid_item_selected_cb, data);
+
+ if (!strcmp(get_app_id(adata), STR_BROWSER_ID))
+ elm_object_item_signal_emit(item, SIG_VISIBLE,
+ PART_INSIDE_LINE);
}
static void _grid_unrealized_cb(int id, void *data, Evas_Object *obj,
{
Evas_Object *btn;
- if (!priv || !priv->base) {
- _ERR("Invalid argument.");
- return false;
- }
-
btn = utils_add_button(priv->base,
PART_TOP_BTN, STR_LIVETV, STYLE_LIVETV_BTN);
if (!btn) {
return true;
}
-void _set_action_state(int idx, Evas_Object *btn, const char *appid)
+void _set_action_state(int idx, Evas_Object *btn, struct app_data *adata)
{
bool isfavorite;
- if (!btn || !appid) {
- _ERR("Invalid argument.");
- return;
- }
-
if (action_info[idx].disable) {
elm_object_disabled_set(btn, EINA_TRUE);
return;
}
if (action_info[idx].id == BTN_FAVORITE) {
- app_contents_favorite_check(CONTENTS_APP, appid, &isfavorite);
- if (isfavorite)
- action_info[idx].toggle = EINA_TRUE;
- else
- action_info[idx].toggle = EINA_FALSE;
+ if (get_app_favorite(adata, &isfavorite) && isfavorite)
+ elm_object_signal_emit(btn, SIG_TOGGLE, SRC_ACTION_BTN);
}
-
- if (action_info[idx].toggle)
- elm_object_signal_emit(btn, SIG_TOGGLE, SRC_ACTION_BTN);
}
static bool _draw_action_area(struct _priv *priv)
Evas_Object *table, *btn;
int i, row = 0, col = 0;
- if (!priv || !priv->base) {
- _ERR("Invalid argument.");
- return false;
- }
-
table = utils_add_table(priv->base, PART_MENU,
SIZE_ACTION_TABLE_BORDER, SIZE_ACTION_TABLE_BORDER);
if (!table) {
inputmgr_add_callback(btn, action_info[i].id,
&_btn_input_handler, priv);
- _set_action_state(i, btn, priv->appid);
+ _set_action_state(i, btn, priv->adata);
col = i % SIZE_COL_MAX;
row = i / SIZE_COL_MAX;
ELM_FOCUS_LEFT);
elm_object_focus_next_object_set(priv->menu_btn[0], priv->menu_btn[0],
ELM_FOCUS_RIGHT);
- elm_object_focus_next_object_set(priv->live_btn, priv->menu_btn[0],
+ elm_object_focus_next_object_set(priv->menu_btn[0], priv->menu_btn[0],
ELM_FOCUS_DOWN);
- elm_object_focus_next_object_set(priv->menu_btn[0], priv->grid,
+ elm_object_focus_next_object_set(priv->live_btn, priv->menu_btn[0],
ELM_FOCUS_DOWN);
- elm_object_focus_next_object_set(priv->grid, priv->menu_btn[0],
- ELM_FOCUS_UP);
+
+ if (priv->fav_list) {
+ elm_object_focus_next_object_set(priv->menu_btn[0], priv->grid,
+ ELM_FOCUS_DOWN);
+ elm_object_focus_next_object_set(priv->grid, priv->menu_btn[0],
+ ELM_FOCUS_UP);
+ }
return true;
}
static bool _draw_favorite_area(struct _priv *priv)
{
- if (!priv || !priv->base) {
- _ERR("Invalid argument.");
- return false;
- }
-
priv->fav_list = get_app_favorite_list();
if (!priv->fav_list) {
- /* FIXME: No content message will be displayed */
+ elm_object_signal_emit(priv->base,
+ SIG_NO_CONTENT, SRC_FAVORITE_AREA);
return true;
}
+ elm_object_signal_emit(priv->base, SIG_CONTENT, SRC_FAVORITE_AREA);
+
if (!gridmgr_append_list(priv->gmgr, STR_FAVORITE, priv->fav_list)) {
_ERR("Gridmgr append list failed.");
return false;
struct grid_class *gclass;
Evas_Object *grid;
- if (!priv || !priv->base || !priv->gmgr) {
- _ERR("Invalid argument.");
- return NULL;
- }
-
grid = utils_add_gengrid(priv->base, EINA_FALSE,
SIZE_FAVORITE_GRID_WIDTH, SIZE_FAVORITE_GRID_HEIGHT);
if (!grid) {
}
_draw_livetv_area(priv);
- _draw_favorite_area(priv);
return base;
static void _update(void *view_data, int update_type, void *data)
{
struct _priv *priv;
- struct app_data *adata;
if (!view_data) {
_ERR("Get data failed.");
if (!data)
return;
- adata = data;
- priv->appid = get_app_id(adata);
+ priv->adata = data;
_draw_action_area(priv);
+ _draw_favorite_area(priv);
}
}
Eina_List *l = NULL;
int r;
- if (!priv || !priv->app_list) {
- _ERR("Invalid argument.");
- return;
- }
-
r = app_contents_get_recent_list(CONTENTS_APP, -1, &recent_l);
if (r != APP_CONTENTS_ERROR_NONE) {
_ERR("Get recent list failed.");
static void _sort_option_selected(struct _priv *priv, int id, Evas_Object *obj)
{
- if (!priv || !obj) {
- _ERR("Invalid argument.");
- return;
- }
-
if (!priv->app_list)
return;
Evas_Coord x, y, w, h;
int i;
- if (!priv || !priv->sort_btn) {
- _ERR("Invalid argument.");
- return false;
- }
-
elm_object_signal_emit(priv->sort_btn, SIG_SELECTED, SRC_SORT_BTN);
ctxpopup = elm_ctxpopup_add(priv->base);
Elm_Object_Item *item)
{
struct app_data *adata;
+ bool isfavorite;
if (!data || !item) {
_ERR("Invalid argument.");
if (!strcmp(get_app_id(adata), STR_BROWSER_ID))
elm_object_item_signal_emit(item, SIG_VISIBLE,
PART_INSIDE_LINE);
+
+ if (get_app_favorite(adata, &isfavorite) && isfavorite)
+ elm_object_item_signal_emit(item, SIG_FAVORITE,
+ SRC_FAVORITE_ICON);
}
static void _grid_unrealized_cb(int id, void *data, Evas_Object *obj,
Evas_Object *box, *btn;
int i;
- if (!priv || !priv->base) {
- _ERR("Invalid argument.");
- return false;
- }
-
elm_object_part_text_set(priv->base, PART_TOP_TITLE, STR_APPS);
box = utils_add_box(priv->base, PART_MENU, EINA_TRUE,
char str[SIZE_STR];
int c;
- if (!priv || !priv->base) {
- _ERR("Invalid argument.");
- return false;
- }
-
btn = utils_add_button(priv->base, PART_SORT,
str_sort[priv->sort_type], STYLE_SORT_BTN);
if (!btn) {
static bool _draw_myapps_grid(struct _priv *priv)
{
- if (!priv || !priv->gmgr || !priv->base || !priv->grid) {
- _ERR("Invalid argument.");
- return false;
- }
-
priv->app_list = get_app_list();
if (!priv->app_list)
return true;
struct grid_class *gclass;
Evas_Object *grid;
- if (!priv || !priv->base || !priv->gmgr) {
- _ERR("Invalid argument.");
- return NULL;
- }
-
grid = utils_add_gengrid(priv->base, EINA_TRUE,
SIZE_MYAPPS_GRID_WIDTH, SIZE_MYAPPS_GRID_HEIGHT);
if (!grid) {
static void _draw_view_content(struct _priv *priv)
{
- if (!priv) {
- _ERR("Invalid argument.");
- return;
- }
-
if (!_draw_top_area(priv)) {
_ERR("Draw top area failed.");
return;
evas_object_hide(priv->base);
}
+static void _update(void *view_data, int update_type, void *data)
+{
+ struct _priv *priv;
+ struct app_data *adata;
+ bool isfavorite;
+
+ if (!view_data) {
+ _ERR("Get data failed.");
+ return;
+ }
+ priv = view_data;
+ adata = data;
+
+ if (update_type == UPDATE_FAVORITE) {
+ if (!adata)
+ return;
+
+ if (!get_app_favorite(adata, &isfavorite))
+ return;
+
+ if (isfavorite)
+ elm_object_item_signal_emit(priv->focused_item,
+ SIG_FAVORITE, SRC_FAVORITE_ICON);
+ else
+ elm_object_item_signal_emit(priv->focused_item,
+ SIG_UNFAVORITE, SRC_FAVORITE_ICON);
+ }
+}
+
static void _destroy(void *data)
{
struct _priv *priv;
.create = _create,
.show = _show,
.hide = _hide,
+ .update = _update,
.destroy = _destroy,
};