make popupmenu's items disable conditionally 97/249397/1 accepted/tizen/unified/20201211.124256 submit/tizen/20201211.063541
authorKiseok Chang <kiso.chang@samsung.com>
Fri, 11 Dec 2020 05:49:37 +0000 (14:49 +0900)
committerKiseok Chang <kiso.chang@samsung.com>
Fri, 11 Dec 2020 05:52:28 +0000 (14:52 +0900)
- make "Delete" and "Sort by" items in popupmenu disable when there's no item in the Misc list

Change-Id: I99e62934126fb69f02b32d66df22b5d9452f2767
Signed-off-by: Kiseok Chang <kiso.chang@samsung.com>
setting-storage/src/setting-storage-miscellaneous.c

index 2183970ebc4ec3520b59e6652197df11770c06f6..c4704ed795e013294fe9ad0fa880cc3a1c6d75eb 100755 (executable)
@@ -188,11 +188,16 @@ static void __create_more_main_menu(SettingStorage *ad)
 {
        ad->main_menu_popup = __create_ctxpopup(ad);
 
-       elm_ctxpopup_item_append(ad->main_menu_popup, _("IDS_ST_BODY_DELETE"),
+       Elm_Object_Item *it = NULL;
+       it = elm_ctxpopup_item_append(ad->main_menu_popup, _("IDS_ST_BODY_DELETE"),
                                NULL, __ctx_delete_click_cb, ad);
-       elm_ctxpopup_item_append(ad->main_menu_popup,
+       elm_object_item_disabled_set(it,
+                               (elm_genlist_items_count(ad->misces_genlist) == 0));
+       it = elm_ctxpopup_item_append(ad->main_menu_popup,
                                _("IDS_ST_HEADER_SORT_BY"), NULL,
                                __show_sort_by_menu_cb, ad);
+       elm_object_item_disabled_set(it,
+                               (elm_genlist_items_count(ad->misces_genlist) == 0));
 }
 
 static void __show_more_menu_cb(void *data, Evas_Object *obj,