hermet pushed a commit to branch master.

commit 8c8c1ed9a74ec9c6edccaf16d0b4d8454750e32b
Author: ChunEon Park <[email protected]>
Date:   Wed Jun 5 16:31:49 2013 +0900

    elementary/naviframe - fix the naviframe to recover the focus when top item 
is deleted
---
 ChangeLog               |  6 ++++++
 NEWS                    |  1 +
 src/lib/elc_naviframe.c | 24 +++++++++++++++++-------
 3 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8da13bd..32747d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1374,13 +1374,19 @@
         * Add ELM_INPUT_PANEL_LAYOUT_DATETIME.
 
 2013-05-27 Seunggyun Kim
+
         * Add elm_config_glayer_long_tap_start_timeout_set/get,
         elm_config_glayer_double_tap_timeout_set/get
 
 2013-05-30 ChunEon Park
+
         * Fix the mapbuf to be enabled before it's content is entirely rendered
         once.
 
 2013-06-05 Ryuan Choi (ryuan)
 
         * Fix elm_colorselector does not update color bar when picker changed 
color.
+
+2013-06-05 ChunEon Park (Hermet)
+
+        * Fix navifame to recover the focus for the prev page when top item is 
deleted.
diff --git a/NEWS b/NEWS
index 60df92a..5765b91 100644
--- a/NEWS
+++ b/NEWS
@@ -237,6 +237,7 @@ Fixes:
    * Fix elm_colorselector does not emit "changed" when clicked color palatte.
    * Fix elm_mapbuf to be enabled before it's content is entirely rendered 
once.     this will reduce the cases that content is not updated in the screen.
    * Fix elm_colorselector does not update color bar when picker changed color.
+   * Fix navifame to recover the focus for the prev page when top item is 
deleted.
 
 Removals:
 
diff --git a/src/lib/elc_naviframe.c b/src/lib/elc_naviframe.c
index 490f608..c0b9d8f 100644
--- a/src/lib/elc_naviframe.c
+++ b/src/lib/elc_naviframe.c
@@ -34,6 +34,19 @@ static const char SIG_CLICKED[] = "clicked";
 static void _on_item_back_btn_clicked(void *data, Evas_Object *obj, void 
*event_info __UNUSED__);
 
 static void
+_prev_page_focus_recover(Elm_Naviframe_Item *it)
+{
+   Evas_Object *newest;
+   unsigned int order;
+
+   newest = elm_widget_newest_focus_order_get(VIEW(it), &order, EINA_TRUE);
+   if (newest)
+     elm_object_focus_set(newest, EINA_TRUE);
+   else
+     elm_object_focus_set(VIEW(it), EINA_TRUE);
+}
+
+static void
 _elm_naviframe_smart_translate(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
 {
    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
@@ -449,6 +462,7 @@ _item_del_pre_hook(Elm_Object_Item *it)
    if (evas_object_data_get(VIEW(nit), "out_of_list"))
      goto end;
 
+   //FIXME: Really need?
    if (!sd->on_deletion)
      {
         nit->unfocusable = elm_widget_tree_unfocusable_get(VIEW(nit));
@@ -473,6 +487,8 @@ _item_del_pre_hook(Elm_Object_Item *it)
         evas_object_show(VIEW(prev_it));
         evas_object_raise(VIEW(prev_it));
 
+        _prev_page_focus_recover(prev_it);
+
         elm_object_signal_emit(VIEW(prev_it), "elm,state,visible", "elm");
      }
 
@@ -1041,8 +1057,6 @@ _on_item_show_finished(void *data,
                        const char *source __UNUSED__)
 {
    Elm_Naviframe_Item *it = data;
-   unsigned int order = 0;
-   Evas_Object *newest;
 
    ELM_NAVIFRAME_DATA_GET(WIDGET(it), sd);
 
@@ -1050,11 +1064,7 @@ _on_item_show_finished(void *data,
 
    elm_widget_tree_unfocusable_set(VIEW(it), it->unfocusable);
 
-   newest = elm_widget_newest_focus_order_get(VIEW(it), &order, EINA_TRUE);
-   if (newest)
-     elm_object_focus_set(newest, EINA_TRUE);
-   else
-     elm_object_focus_set(VIEW(it), EINA_TRUE);
+   _prev_page_focus_recover(it);
 
    if (sd->freeze_events)
      evas_object_freeze_events_set(VIEW(it), EINA_FALSE);

-- 

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j

Reply via email to