EditAlarmView: close popup after selecting alarm type. 29/120129/2
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Tue, 21 Mar 2017 15:41:11 +0000 (16:41 +0100)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Mon, 27 Mar 2017 13:49:51 +0000 (15:49 +0200)
Change-Id: I92fd18baf4ebdb67100d919f85e3fdfa26c7aa45

clock/inc/View/EditAlarmView.h
clock/src/View/EditAlarmView.cpp

index bf3421d..4bb99e1 100644 (file)
@@ -166,6 +166,7 @@ namespace view {
                        Evas_Object *main_radio_;
                        Evas_Object *icon_slider_;
                        Evas_Object *discard_popup_;
+                       Evas_Object *type_popup_;
 
                        /* child view of EditAlarmView */
                        WeekFlagsView week_flags_view_;
@@ -197,6 +198,7 @@ namespace view {
                        static void BackButtonOnMainClicked(void *data, Evas_Object *obj, void *event);
                        static void PopupCancelButtonClicked(void *data, Evas_Object *obj, void *event_info);
                        static void PopupDiscardButtonClicked(void *data, Evas_Object *obj, void *event_info);
+                       static void Del(void *data, Evas_Object *obj, void *event_info);
 
                        void CreateGenlistItems();
                        void ShowSetTypePopup();
index 06e8c07..ff684f1 100644 (file)
@@ -531,6 +531,11 @@ void EditAlarmView::PopupHide(void *data, Evas_Object *obj, void *event)
        view->data_.type = static_cast<Alarm::Type>(elm_radio_value_get(view->main_radio_));
        // refresh type item
        elm_genlist_item_update(view->type_it_);
+       elm_popup_dismiss(view->type_popup_);
+}
+
+void EditAlarmView::Del(void *data, Evas_Object *obj, void *event)
+{
        evas_object_del(obj);
 }
 
@@ -567,6 +572,10 @@ void EditAlarmView::ShowSetTypePopup()
        elm_object_content_set(popup, list);
        elm_radio_value_set(main_radio_, static_cast<int>(data_.type));
 
+       evas_object_smart_callback_add(list, "selected", EditAlarmView::PopupHide, this);
+       evas_object_smart_callback_add(popup, "dismissed", EditAlarmView::Del, nullptr);
+
+       type_popup_ = popup;
        evas_object_show(list);
        evas_object_show(popup);
 }