Page MenuHomePhabricator

elm_naviframe_content_preserve_on_pop_set seems to not work
Closed, ResolvedPublic

Description

For long time, I have used a naviframe with elm_naviframe_content_preserve_on_pop_set to make sure that the object on second page will not be removed on pop. I issue the same object each time the push is needed. Somewhere between 1.20.0 an 1.21.0 something changed. The object seems to be removed during pop and is not drawn any more when push is issued. I have changed the naviframe example. When you run it, you see first page. Go next tab (click on button). The second page is shown. Go back (with prev button). First page is shown. Go next - nothing is shown at 1.21 but on 1.20 it is shown again.

//Compile with:
//gcc -g naviframe_example.c -o naviframe_example `pkg-config --cflags --libs elementary`

#include <Elementary.h>

Evas_Object *btn2 = NULL;

void
_btn_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
   Evas_Object *nf = data, *btn;
   if (!nf) return;

   elm_naviframe_item_push(nf, "Next Page", NULL, NULL, btn2, NULL);
}

EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
   Evas_Object *win, *nf, *btn;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("naviframe", "Naviframe");
   elm_win_autodel_set(win, EINA_TRUE);

   nf = elm_naviframe_add(win);

   elm_naviframe_content_preserve_on_pop_set(nf, EINA_TRUE);

   evas_object_size_hint_weight_set(nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, nf);
   evas_object_show(nf);

   btn = elm_button_add(nf);
   elm_object_text_set(btn, "Go to Second Page.");
   evas_object_smart_callback_add(btn, "clicked", _btn_cb, nf);

   btn2 = elm_button_add(nf);
   elm_object_text_set(btn2, "Go to Next Page.");
   evas_object_smart_callback_add(btn2, "clicked", _btn_cb, nf);

   elm_naviframe_item_push(nf, "First Page", NULL, NULL, btn, NULL);

   evas_object_resize(win, 400, 400);
   evas_object_show(win);

   elm_run();

   return 0;
}
ELM_MAIN()
Herald triaged this task as Showstopper Issues priority. · View Herald TranscriptAug 1 2018, 4:52 AM
zmike claimed this task.Aug 6 2018, 7:11 AM

@michalbutterweck could you test the patch Mike posted and confirm that this fixes your issue?

The patch works well. The naviframe's content is preserved. Thanks.

@michalbutterweck thanks for taking the time to test it.

I will make sure the patch lands before the final release. (it will not be in beta2 as I am uploading this one right now)

Hermet claimed this task.Aug 12 2018, 9:56 PM
Hermet added a subscriber: zmike.