Commit 31b13615 authored by Ludovic Fauvet's avatar Ludovic Fauvet

settings: dismiss popup with elm_popup_dismiss

parent 165b2a75
...@@ -273,7 +273,7 @@ settings_list_add_styled(settings_item *menu, int len, Settings_menu_callback gl ...@@ -273,7 +273,7 @@ settings_list_add_styled(settings_item *menu, int len, Settings_menu_callback gl
} }
static void static void
popup_close_cb(void *data, Evas_Object *obj, void *event_info) settings_popup_del(void *data, Evas_Object *obj, void *event_info)
{ {
evas_object_del(obj); evas_object_del(obj);
} }
...@@ -286,10 +286,20 @@ settings_popup_add(settings_item *menu, int menu_len, Settings_menu_callback glo ...@@ -286,10 +286,20 @@ settings_popup_add(settings_item *menu, int menu_len, Settings_menu_callback glo
elm_scroller_content_min_limit(genlist, EINA_TRUE, EINA_TRUE); elm_scroller_content_min_limit(genlist, EINA_TRUE, EINA_TRUE);
evas_object_smart_callback_add(popup, "block,clicked", popup_close_cb, NULL); evas_object_smart_callback_add(popup, "block,clicked", settings_popup_del, NULL);
elm_object_content_set(popup, genlist); elm_object_content_set(popup, genlist);
evas_object_show(genlist); evas_object_show(genlist);
return popup; return popup;
} }
void
settings_popup_close(Evas_Object *popup)
{
if (!popup)
return;
evas_object_smart_callback_add(popup, "dismissed", settings_popup_del, NULL);
elm_popup_dismiss(popup);
}
...@@ -100,4 +100,7 @@ settings_toggle_set_one_by_index(settings_item *menu, int menu_len, int index, b ...@@ -100,4 +100,7 @@ settings_toggle_set_one_by_index(settings_item *menu, int menu_len, int index, b
void void
settings_toggle_set_one_by_id(settings_item *menu, int menu_len, menu_id id, bool value, bool toggle_others); settings_toggle_set_one_by_id(settings_item *menu, int menu_len, menu_id id, bool value, bool toggle_others);
void
settings_popup_close(Evas_Object *popup);
#endif #endif
...@@ -210,17 +210,17 @@ settings_view_simple_save_toggle(settings_menu_selected *selected, view_sys* p_v ...@@ -210,17 +210,17 @@ settings_view_simple_save_toggle(settings_menu_selected *selected, view_sys* p_v
// Save the value // Save the value
preferences_set_enum(PREF_HWACCELERATION, selected->menu[selected->index].id); preferences_set_enum(PREF_HWACCELERATION, selected->menu[selected->index].id);
// Close the popup // Close the popup
evas_object_del(p_view_sys->popup); settings_popup_close(p_view_sys->popup);
break; break;
case SETTINGS_ID_SUBSENC: case SETTINGS_ID_SUBSENC:
settings_toggle_set_one_by_index(selected->menu, selected->menu_len, selected->index, true, true); settings_toggle_set_one_by_index(selected->menu, selected->menu_len, selected->index, true, true);
preferences_set_index(PREF_SUBSENC, selected->index); preferences_set_index(PREF_SUBSENC, selected->index);
evas_object_del(p_view_sys->popup); settings_popup_close(p_view_sys->popup);
break; break;
case SETTINGS_ID_VORIENTATION: case SETTINGS_ID_VORIENTATION:
settings_toggle_set_one_by_index(selected->menu, selected->menu_len, selected->index, true, true); settings_toggle_set_one_by_index(selected->menu, selected->menu_len, selected->index, true, true);
preferences_set_enum(PREF_ORIENTATION, selected->menu[selected->index].id); preferences_set_enum(PREF_ORIENTATION, selected->menu[selected->index].id);
evas_object_del(p_view_sys->popup); settings_popup_close(p_view_sys->popup);
break; break;
case SETTINGS_ID_PERFORMANCES: case SETTINGS_ID_PERFORMANCES:
{ {
...@@ -230,13 +230,13 @@ settings_view_simple_save_toggle(settings_menu_selected *selected, view_sys* p_v ...@@ -230,13 +230,13 @@ settings_view_simple_save_toggle(settings_menu_selected *selected, view_sys* p_v
preferences_set_bool(PREF_FRAME_SKIP, newvalue); preferences_set_bool(PREF_FRAME_SKIP, newvalue);
else if (selected->menu[selected->index].id == PERFORMANCE_STRETCH) else if (selected->menu[selected->index].id == PERFORMANCE_STRETCH)
preferences_set_bool(PREF_AUDIO_STRETCH, newvalue); preferences_set_bool(PREF_AUDIO_STRETCH, newvalue);
evas_object_del(p_view_sys->popup); settings_popup_close(p_view_sys->popup);
break; break;
} }
case SETTINGS_ID_DEBLOCKING: case SETTINGS_ID_DEBLOCKING:
settings_toggle_set_one_by_index(selected->menu, selected->menu_len, selected->index, true, true); settings_toggle_set_one_by_index(selected->menu, selected->menu_len, selected->index, true, true);
preferences_set_enum(PREF_DEBLOCKING, selected->menu[selected->index].id); preferences_set_enum(PREF_DEBLOCKING, selected->menu[selected->index].id);
evas_object_del(p_view_sys->popup); settings_popup_close(p_view_sys->popup);
break; break;
case SETTINGS_ID_DEVELOPER: case SETTINGS_ID_DEVELOPER:
{ {
...@@ -378,7 +378,7 @@ settings_event(view_sys *p_view_sys, interface_view_event event) ...@@ -378,7 +378,7 @@ settings_event(view_sys *p_view_sys, interface_view_event event)
if(event == INTERFACE_VIEW_EVENT_BACK && p_view_sys->popup) if(event == INTERFACE_VIEW_EVENT_BACK && p_view_sys->popup)
{ {
// Close any visible popup // Close any visible popup
evas_object_del(p_view_sys->popup); settings_popup_close(p_view_sys->popup);
p_view_sys->popup = NULL; p_view_sys->popup = NULL;
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment