elementary - backport 81117
authorChunEon Park <hermet@hermet.pe.kr>
Mon, 17 Dec 2012 11:59:56 +0000 (11:59 +0000)
committerChunEon Park <hermet@hermet.pe.kr>
Mon, 17 Dec 2012 11:59:56 +0000 (11:59 +0000)
SVN revision: 81126

ChangeLog
NEWS
src/lib/elc_popup.c

index d3be6858420d666477a1ce6280042f63ff1a8555..9e98b7ec959cc3cfe9e28d02cb832f86619ada8d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 
        * Add XML output to doc
        * Add installation rule for doc
+
+2012-12-17  Chueon Park (Hermet)
+
+       * Fix the popup that returned invalid action buttons.
diff --git a/NEWS b/NEWS
index baae169f4a201ddded992b04631bfd2798335b4b..3ace5472ed1bcaade409870beff215985561cf60 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ Fixes:
    * Correctly handle failure case in _x11_notify_handler_image.
    * Fix missuse of EINA_INLIST_FOREACH in elm_transit.c.
    * Now, dummy object is always smart member of naviframe.
+   * Fix the popup that returned invalid action buttons.
 
 
 Elementary 1.7.3
index d83ab4b30477378b61216968bc224b5fc88c4cbf..a59d67ee9bf7d5dea4da35dd8a2383ee8e5962d2 100644 (file)
@@ -922,13 +922,12 @@ _content_get(Evas_Object *obj)
 static Evas_Object *
 _action_button_get(Evas_Object *obj, unsigned int idx)
 {
-   unsigned int num = idx - 1;
    Evas_Object *button = NULL;
    Widget_Data *wd = elm_widget_data_get(obj);
 
    if (!wd || !wd->button_count) return NULL;
-   if (wd->buttons[num])
-     button = wd->buttons[num]->btn;
+   if (wd->buttons[idx])
+     button = wd->buttons[idx]->btn;
    return button;
 }
 
@@ -937,7 +936,6 @@ _content_get_hook(Evas_Object *obj, const char *part)
 {
    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
    Evas_Object *content = NULL;
-   char buff[3];
    unsigned int i;
    Widget_Data *wd = elm_widget_data_get(obj);
 
@@ -948,19 +946,18 @@ _content_get_hook(Evas_Object *obj, const char *part)
      content = _title_icon_get(obj);
    else if (!strncmp(part, "button", 6))
      {
-        part += 6;
-        for (i = 0; i < ELM_POPUP_ACTION_BUTTON_MAX; i++)
-          {
-             snprintf(buff, sizeof(buff), "%u", i+1);
-             if (!strncmp(part, buff, sizeof(buff)))
-               {
-                  content = _action_button_get(obj, i+1);
-                  break;
-               }
-          }
+        i = atoi(part + 6) - 1;
+
+        if (i >= ELM_POPUP_ACTION_BUTTON_MAX)
+          goto err;
+
+        content = _action_button_get(obj, i);
       }
    else
-     WRN("The part name is invalid! : popup=%p", obj);
+     goto err;
+   return content;
+err:
+   WRN("The part name is invalid! : popup=%p", obj);
    return content;
 }