View: Deleted lock button and enabled favorite view be updated 09/46609/3
authorHyojung Jo <hj903.jo@samsung.com>
Mon, 24 Aug 2015 05:43:03 +0000 (14:43 +0900)
committerHyojung Jo <hj903.jo@samsung.com>
Tue, 25 Aug 2015 00:53:58 +0000 (09:53 +0900)
Change-Id: I9712015383b882ca695f9c56c1413ffa1c3c9cba
Signed-off-by: Hyojung Jo <hj903.jo@samsung.com>
16 files changed:
include/data/app.h
include/define.h
include/view_action_menu.h [deleted file]
res/images/btn_menu_lock_dis.png [deleted file]
res/images/btn_menu_lock_foc.png [deleted file]
res/images/btn_menu_lock_nor.png [deleted file]
res/images/btn_menu_lock_sel.png [deleted file]
res/images/btn_menu_unlock_foc.png [deleted file]
res/images/btn_menu_unlock_nor.png [deleted file]
res/view/action_menu.edc
res/widget/button.edc
res/widget/gengrid.edc
src/data/app.c
src/grid/grid.c
src/view/view_action_menu.c
src/view/view_base.c

index 8468ca7e0ec1eea39d1ca5ba0f83432f0214a814..3447b4ac0d6b8bc7e1d555fd72c312e95aaa2292 100644 (file)
@@ -25,7 +25,8 @@ Eina_List *get_app_list(void);
 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,
index d2918fe7e29e18d30276a7485ca271a3c3c1f6e2..2971d4bb758fca8854afb3c812dfb7024e1939b5 100644 (file)
@@ -35,7 +35,6 @@
 #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"
@@ -54,7 +53,6 @@
 #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"
@@ -77,6 +78,8 @@
 #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"
diff --git a/include/view_action_menu.h b/include/view_action_menu.h
deleted file mode 100644 (file)
index 7c75e51..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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__ */
diff --git a/res/images/btn_menu_lock_dis.png b/res/images/btn_menu_lock_dis.png
deleted file mode 100644 (file)
index d5827a0..0000000
Binary files a/res/images/btn_menu_lock_dis.png and /dev/null differ
diff --git a/res/images/btn_menu_lock_foc.png b/res/images/btn_menu_lock_foc.png
deleted file mode 100644 (file)
index 5671cfc..0000000
Binary files a/res/images/btn_menu_lock_foc.png and /dev/null differ
diff --git a/res/images/btn_menu_lock_nor.png b/res/images/btn_menu_lock_nor.png
deleted file mode 100644 (file)
index 5f38494..0000000
Binary files a/res/images/btn_menu_lock_nor.png and /dev/null differ
diff --git a/res/images/btn_menu_lock_sel.png b/res/images/btn_menu_lock_sel.png
deleted file mode 100644 (file)
index 1baa790..0000000
Binary files a/res/images/btn_menu_lock_sel.png and /dev/null differ
diff --git a/res/images/btn_menu_unlock_foc.png b/res/images/btn_menu_unlock_foc.png
deleted file mode 100644 (file)
index 8e35489..0000000
Binary files a/res/images/btn_menu_unlock_foc.png and /dev/null differ
diff --git a/res/images/btn_menu_unlock_nor.png b/res/images/btn_menu_unlock_nor.png
deleted file mode 100644 (file)
index fb89ee9..0000000
Binary files a/res/images/btn_menu_unlock_nor.png and /dev/null differ
index 26dc401c84389a249b762f87ed870ca4e9f6dd65..72702f5d9ba93757572813bfb4da26c14239207c 100644 (file)
@@ -128,7 +128,7 @@ group {
                                        to, "part.menu.divider.up";
                                        relative, 0.0 1.0;
                                }
-                               min, 375 124;
+                               min, 250 124;
                                align, 0.0 0.0;
                                fixed, 1 1;
                        }
@@ -220,7 +220,7 @@ group {
                }
 
                part {
-                       name, "padding.favorite.topleft";
+                       name, "padding.favorite.top";
                        type, SPACER;
                        scale, 1;
                        description {
@@ -260,7 +260,7 @@ group {
                        description {
                                state, "default" 0.0;
                                rel1 {
-                                       to, "padding.favorite.topleft";
+                                       to, "padding.favorite.top";
                                        relative, 0.0 1.0;
                                }
                                rel2 {
@@ -269,5 +269,92 @@ group {
                                }
                        }
                }
+
+               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";
+               }
        }
 }
index 6790f23c1fb72b8d457eb3beddda55a7700305e1..f5507d35c2725ece9f42937b28d16ebfc9822482 100644 (file)
@@ -1314,23 +1314,6 @@ group {
                        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;
@@ -1353,67 +1336,6 @@ group {
        }
 }
 
-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";
index bc3bb21138a2f74c54a08698bdd0376d644fc08d..8cac833498c9e0dc2bd8382d1cf3619371213bca 100644 (file)
@@ -18,7 +18,7 @@ group {
        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;
        }
@@ -158,8 +158,8 @@ group {
                }
 
                part {
-                       name, PART_FAVORITE_ICON;
-                       type, SWALLOW;
+                       name, "part.favorite.icon";
+                       type, IMAGE;
                        scale, 1;
                        description {
                                state, "default" 0.0;
@@ -171,15 +171,13 @@ group {
                                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;
                        }
                }
 
@@ -583,7 +581,6 @@ group {
                        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";
@@ -618,7 +615,6 @@ group {
                        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";
@@ -671,6 +667,22 @@ group {
                        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";
+               }
        }
 }
 
index 31c92c8e03e775e6c5c985ccce5a5ef059ec2c2a..9034e48d713a8553a279f2ee5bf538a2802cca6b 100644 (file)
@@ -26,7 +26,6 @@ struct app_data {
        char *name;
        char *icon;
        bool is_locked;
-       bool is_favorite;
        struct color_data icon_bg;
        struct color_data text_bg;
 };
@@ -44,8 +43,7 @@ static int _get_app_data_foreach(pkgmgrinfo_appinfo_h handle, void *data)
        Eina_List **list;
        struct app_data *adata;
        char *appid, *name, *icon;
-       bool is_favorite, nodisplay;
-       int r;
+       bool nodisplay;
 
        if (!data)
                return -1;
@@ -67,10 +65,6 @@ static int _get_app_data_foreach(pkgmgrinfo_appinfo_h handle, void *data)
        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.");
@@ -84,8 +78,6 @@ static int _get_app_data_foreach(pkgmgrinfo_appinfo_h handle, void *data)
        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);
@@ -138,14 +130,37 @@ char *get_app_icon(struct app_data *adata)
        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,
@@ -204,13 +219,14 @@ Eina_List *get_app_favorite_list(void)
 {
        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);
        }
 
index b1c88e134b81d6fd33c20d83390732a874cb72e4..5245133bac70531b384f8416cd6faf6d84745bcb 100644 (file)
@@ -109,20 +109,6 @@ static Evas_Object *_content_get(void *data, Evas_Object *obj, const char *part)
                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;
index a7ae121a78ab1b783f19a34c5aa9b81fddab25f0..43473b698418803787063f258f43e6e96718118e 100644 (file)
@@ -18,7 +18,6 @@
 #include <viewmgr.h>
 #include <inputmgr.h>
 #include <gridmgr.h>
-#include <app_contents.h>
 #include <app_debug.h>
 
 #include "define.h"
@@ -35,7 +34,7 @@ enum action_type {
 };
 
 struct _priv {
-       const char *appid;
+       struct app_data *adata;
        Evas_Object *win;
        Evas_Object *base;
        Evas_Object *grid;
@@ -50,7 +49,6 @@ struct _action_info {
        const char *title;
        const char *style;
        Eina_Bool disable;
-       Eina_Bool toggle;
 };
 
 static struct _action_info action_info[] = {
@@ -60,19 +58,11 @@ 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
        }
 };
 
@@ -88,54 +78,50 @@ static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj,
                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:
@@ -199,13 +185,21 @@ static void _grid_item_selected_cb(void *data, Elm_Object_Item *it,
 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,
@@ -250,11 +244,6 @@ static bool _draw_livetv_area(struct _priv *priv)
 {
        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) {
@@ -273,30 +262,19 @@ static bool _draw_livetv_area(struct _priv *priv)
        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)
@@ -304,11 +282,6 @@ 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) {
@@ -328,7 +301,7 @@ static bool _draw_action_area(struct _priv *priv)
                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;
@@ -343,29 +316,32 @@ static bool _draw_action_area(struct _priv *priv)
                        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;
@@ -384,11 +360,6 @@ static Evas_Object *_add_grid(struct _priv *priv)
        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) {
@@ -464,7 +435,6 @@ static Evas_Object *_create(Evas_Object *win, void *data)
        }
 
        _draw_livetv_area(priv);
-       _draw_favorite_area(priv);
 
        return base;
 
@@ -508,7 +478,6 @@ static void _hide(void *data)
 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.");
@@ -520,10 +489,10 @@ static void _update(void *view_data, int update_type, void *data)
                if (!data)
                        return;
 
-               adata = data;
-               priv->appid = get_app_id(adata);
+               priv->adata = data;
 
                _draw_action_area(priv);
+               _draw_favorite_area(priv);
        }
 }
 
index 254f1e84940d42a19f7b78b187aaf62b2f7bea70..decd680de070fad7d7a211ffd364ac91cd9b163e 100644 (file)
@@ -236,11 +236,6 @@ static void _sort_by_recently_used(struct _priv *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.");
@@ -266,11 +261,6 @@ static void _sort_by_recently_used(struct _priv *priv)
 
 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;
 
@@ -348,11 +338,6 @@ static bool _draw_sort_option(struct _priv *priv)
        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);
@@ -560,6 +545,7 @@ static void _grid_realized_cb(int id, void *data, Evas_Object *obj,
                Elm_Object_Item *item)
 {
        struct app_data *adata;
+       bool isfavorite;
 
        if (!data || !item) {
                _ERR("Invalid argument.");
@@ -576,6 +562,10 @@ static void _grid_realized_cb(int id, void *data, Evas_Object *obj,
        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,
@@ -645,11 +635,6 @@ static bool _draw_top_area(struct _priv *priv)
        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,
@@ -693,11 +678,6 @@ static bool _draw_bottom_area(struct _priv *priv)
        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) {
@@ -727,11 +707,6 @@ static bool _draw_bottom_area(struct _priv *priv)
 
 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;
@@ -755,11 +730,6 @@ static Evas_Object *_add_grid(struct _priv *priv)
        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) {
@@ -787,11 +757,6 @@ static Evas_Object *_add_grid(struct _priv *priv)
 
 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;
@@ -895,6 +860,35 @@ static void _hide(void *data)
                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;
@@ -919,6 +913,7 @@ static view_class _vclass = {
        .create = _create,
        .show = _show,
        .hide = _hide,
+       .update = _update,
        .destroy = _destroy,
 };