Fix the forcestop/uninstall button style
authorEunmi Son <eunmi.son@samsung.com>
Mon, 10 Dec 2012 06:06:16 +0000 (15:06 +0900)
committerEunmi Son <eunmi.son@samsung.com>
Mon, 10 Dec 2012 06:06:16 +0000 (15:06 +0900)
Change-Id: Idf6eea7a4d4d667732c99c4bc14d58e53a52566e

view/src/mgr-app-view-app-info.c

index 175104f..2cfb361 100755 (executable)
 #define ELM_TEXT_2                                     "elm.text.2"
 #define ELM_TEXT                                       "elm.text"
 #define ELM_ICON                                       "elm.icon"
+#define ELM_ICON_SWALLOW_1                     "elm.slide.swallow.1"
+#define ELM_ICON_SWALLOW_2                     "elm.slide.swallow.2"
 #define ELM_BUTTON_STYLE                       "popup_button/default"
 
 #define ITC_ITEM_STYLE                         "dialogue/2text.1icon.2"
-//#define ITC_LIFE_ITEM_STYLE                  "dialogue/bg/2icon"
-#define ITC_LIFE_ITEM_STYLE                    "1icon/with_no_line"
+#define ITC_LIFE_ITEM_STYLE                    "mode/slide2"
 #define ITC_STO_TITLE_ITEM_STYLE       "dialogue/title"
 #define ITC_STO_TOTAL_ITEM_STYLE       "dialogue/2text.2"
 #define ITC_STO_APP_ITEM_STYLE                 "dialogue/2text.2"
@@ -102,8 +103,7 @@ mgr_app_view_t mgr_app_view_app_info = {
 };
 
 static Elm_Genlist_Item_Class *itc                     = NULL;
-static Elm_Genlist_Item_Class *itc_forcestop= NULL;
-static Elm_Genlist_Item_Class *itc_uninstall= NULL;
+static Elm_Genlist_Item_Class *itc_life                = NULL;
 static Elm_Genlist_Item_Class *itc_sto_title= NULL;
 static Elm_Genlist_Item_Class *itc_sto_total= NULL;
 static Elm_Genlist_Item_Class *itc_sto_app     = NULL;
@@ -148,8 +148,7 @@ void _app_info_back_cb(void *data, Evas_Object *obj, void *event_info)
 
        elm_genlist_item_class_free(itc_sep);
        elm_genlist_item_class_free(itc);
-       elm_genlist_item_class_free(itc_forcestop);
-       elm_genlist_item_class_free(itc_uninstall);
+       elm_genlist_item_class_free(itc_life);
        elm_genlist_item_class_free(itc_sto_title);
        elm_genlist_item_class_free(itc_sto_total);
        elm_genlist_item_class_free(itc_sto_app);
@@ -845,7 +844,7 @@ static Evas_Object *_gl_icon_get(void *data, Evas_Object *obj, const char *part)
        return icon;
 }
 
-static Evas_Object *_gl_icon_get_forcestop(void *data, Evas_Object *obj, const char *part)
+static Evas_Object *_gl_icon_get_life(void *data, Evas_Object *obj, const char *part)
 {
        MGR_APP_BEGIN();
 
@@ -854,13 +853,25 @@ static Evas_Object *_gl_icon_get_forcestop(void *data, Evas_Object *obj, const c
        mgr_app_app_info_t *app_info = _app_info;
 
        Evas_Object *button = NULL;
-       if (0 == strcmp(part, ELM_ICON)) {
+       if (0 == strcmp(part, ELM_ICON_SWALLOW_2)) {
                button = elm_button_add(obj);
                if (button) {
+                       elm_object_text_set(button, dgettext(PACKAGE, "IDS_ST_BUTTON_UNINSTALL"));
+                       elm_object_style_set(button, ELM_BUTTON_STYLE);
+                       evas_object_smart_callback_add(button, "clicked", _uninstall_clicked_cb, (void*)data);
                        elm_object_disabled_set(button, EINA_TRUE);
+
+                       if (app_info->removable) {
+                               elm_object_disabled_set(button, EINA_FALSE);
+                       }
+               }
+       } else if (0 == strcmp(part, ELM_ICON_SWALLOW_1)) {
+               button = elm_button_add(obj);
+               if (button) {
                        elm_object_text_set(button, dgettext(PACKAGE, "IDS_ST_BUTTON_FORCE_STOP"));
                        elm_object_style_set(button, ELM_BUTTON_STYLE);
                        evas_object_smart_callback_add(button, "clicked", _force_stop_clicked_cb, (void*)data);
+                       elm_object_disabled_set(button, EINA_TRUE);
 
                        if (app_info->taskmanage) {
                                bool is_running = false;
@@ -891,36 +902,6 @@ static Evas_Object *_gl_icon_get_forcestop(void *data, Evas_Object *obj, const c
        return button;
 }
 
-static Evas_Object *_gl_icon_get_uninstall(void *data, Evas_Object *obj, const char *part)
-{
-       MGR_APP_BEGIN();
-
-       MGR_APP_DEBUG("part:%s\n", part);
-       retv_if(_app_info == NULL, NULL);
-       mgr_app_app_info_t *app_info = _app_info;
-
-       Evas_Object *button = NULL;
-       if (0 == strcmp(part, ELM_ICON)) {
-               button = elm_button_add(obj);
-               if (button) {
-                       elm_object_disabled_set(button, EINA_TRUE);
-                       elm_object_text_set(button, dgettext(PACKAGE, "IDS_ST_BUTTON_UNINSTALL"));
-                       elm_object_style_set(button, ELM_BUTTON_STYLE);
-                       evas_object_smart_callback_add(button, "clicked", _uninstall_clicked_cb, (void*)data);
-
-                       if (app_info->removable) {
-                               elm_object_disabled_set(button, EINA_FALSE);
-                       }
-               }
-       } else {
-               MGR_APP_DEBUG_ERR("elm icon part is wrong");
-               button = NULL;
-       }
-
-       MGR_APP_END();
-       return button;
-}
-
 static Evas_Object *_gl_icon_get_data(void *data, Evas_Object *obj, const char *part)
 {
        MGR_APP_BEGIN();
@@ -989,8 +970,7 @@ static Evas_Object *__create_genlist_app_info(Evas_Object *parent, void *data)
        struct ug_data *ugd = (struct ug_data*)data;
 
        Elm_Object_Item *item_app                       = NULL;
-       Elm_Object_Item *item_forcestop = NULL;
-       Elm_Object_Item *item_uninstall = NULL;
+       Elm_Object_Item *item_life                      = NULL;
        Elm_Object_Item *item_sto_title         = NULL;
        Elm_Object_Item *item_sto_total = NULL;
        Elm_Object_Item *item_sto_app           = NULL;
@@ -1012,10 +992,8 @@ static Evas_Object *__create_genlist_app_info(Evas_Object *parent, void *data)
        retv_if(itc_sep == NULL, NULL);
        itc = elm_genlist_item_class_new();
        retv_if(itc == NULL, NULL);
-       itc_forcestop = elm_genlist_item_class_new();
-       retv_if(itc_forcestop == NULL, NULL);
-       itc_uninstall = elm_genlist_item_class_new();
-       retv_if(itc_uninstall == NULL, NULL);
+       itc_life = elm_genlist_item_class_new();
+       retv_if(itc_life == NULL, NULL);
        itc_sto_title = elm_genlist_item_class_new();
        retv_if(itc_sto_title == NULL, NULL);
        itc_sto_total = elm_genlist_item_class_new();
@@ -1041,23 +1019,17 @@ static Evas_Object *__create_genlist_app_info(Evas_Object *parent, void *data)
        itc_sep->func.state_get         = NULL;
        itc_sep->func.del                       = NULL;
 
-       itc->item_style                                 = ITC_ITEM_STYLE;
-       itc->func.text_get                              = _gl_label_get;
-       itc->func.content_get                   = _gl_icon_get;
-       itc->func.state_get                             = NULL;
-       itc->func.del                                   = NULL;
-
-       itc_forcestop->item_style               = ITC_LIFE_ITEM_STYLE;
-       itc_forcestop->func.text_get    = NULL;
-       itc_forcestop->func.content_get = _gl_icon_get_forcestop;
-       itc_forcestop->func.state_get   = NULL;
-       itc_forcestop->func.del                         = NULL;
+       itc->item_style                         = ITC_ITEM_STYLE;
+       itc->func.text_get                      = _gl_label_get;
+       itc->func.content_get           = _gl_icon_get;
+       itc->func.state_get                     = NULL;
+       itc->func.del                           = NULL;
 
-       itc_uninstall->item_style               = ITC_LIFE_ITEM_STYLE;
-       itc_uninstall->func.text_get    = NULL;
-       itc_uninstall->func.content_get = _gl_icon_get_uninstall;
-       itc_uninstall->func.state_get   = NULL;
-       itc_uninstall->func.del                 = NULL;
+       itc_life->item_style            = ITC_LIFE_ITEM_STYLE;
+       itc_life->func.text_get         = NULL;
+       itc_life->func.content_get      = _gl_icon_get_life;
+       itc_life->func.state_get        = NULL;
+       itc_life->func.del                      = NULL;
 
        itc_sto_title->item_style               = ITC_STO_TITLE_ITEM_STYLE;
        itc_sto_title->func.text_get    = _gl_label_get_title;
@@ -1165,12 +1137,9 @@ static Evas_Object *__create_genlist_app_info(Evas_Object *parent, void *data)
                elm_genlist_item_select_mode_set(item_app, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
 
        /* Force stop & Uninstall */
-       item_forcestop = elm_genlist_item_append(genlist, itc_forcestop, ELM_STATE_DEFAULT, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
-       if (item_forcestop)
-               elm_genlist_item_select_mode_set(item_forcestop, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
-       item_uninstall = elm_genlist_item_append(genlist, itc_uninstall, ELM_STATE_DEFAULT, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
-       if (item_uninstall)
-               elm_genlist_item_select_mode_set(item_uninstall, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+       item_life = elm_genlist_item_append(genlist, itc_life, ELM_STATE_DEFAULT, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+       if (item_life)
+               elm_genlist_item_select_mode_set(item_life, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
 
        /* separator with no bottom line */
        item_sep = elm_genlist_item_append(genlist, itc_sep, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);