elm widget.c: Code refactorying. Check sobj first. We do not need to check sobj twice.
authorseoz <seoz@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 19 Oct 2011 17:07:15 +0000 (17:07 +0000)
committerseoz <seoz@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 19 Oct 2011 17:07:15 +0000 (17:07 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@64182 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/elm_widget.c

index f6e0cd2..d63a717 100644 (file)
@@ -1010,55 +1010,53 @@ elm_widget_resize_object_set(Evas_Object *obj,
              if (elm_widget_focus_get(sd->resize_obj)) _unfocus_parents(obj);
           }
      }
+
+   if (!sobj) return;
+
    // orphan new resize obj
-   if (sobj)
+   evas_object_data_del(sobj, "elm-parent");
+   if (_elm_widget_is(sobj))
      {
-        evas_object_data_del(sobj, "elm-parent");
-        if (_elm_widget_is(sobj))
-          {
-             Smart_Data *sd2 = evas_object_smart_data_get(sobj);
-             if (sd2) sd2->parent_obj = NULL;
-             evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_HIDE,
-                                                 _sub_obj_hide, sd);
-          }
-        evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL,
-                                            _sub_obj_del, sd);
-        evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_MOUSE_UP,
-                                            _sub_obj_mouse_up, sd);
-        evas_object_smart_member_del(sobj);
-        if (_elm_widget_is(sobj))
-          {
-             if (elm_widget_focus_get(sobj)) _unfocus_parents(obj);
-          }
+        Smart_Data *sd2 = evas_object_smart_data_get(sobj);
+        if (sd2) sd2->parent_obj = NULL;
+        evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_HIDE,
+                                            _sub_obj_hide, sd);
+     }
+   evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL,
+                                       _sub_obj_del, sd);
+   evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_MOUSE_UP,
+                                       _sub_obj_mouse_up, sd);
+   evas_object_smart_member_del(sobj);
+   if (_elm_widget_is(sobj))
+     {
+        if (elm_widget_focus_get(sobj)) _unfocus_parents(obj);
      }
+
    // set the resize obj up
    sd->resize_obj = sobj;
-   if (sd->resize_obj)
+   if (_elm_widget_is(sd->resize_obj))
      {
-        if (_elm_widget_is(sd->resize_obj))
-          {
-             Smart_Data *sd2 = evas_object_smart_data_get(sd->resize_obj);
-             if (sd2)
-               {
-                  sd2->parent_obj = obj;
-                  sd2->top_win_focused = sd->top_win_focused;
-               }
-             evas_object_event_callback_add(sobj, EVAS_CALLBACK_HIDE,
-                                            _sub_obj_hide, sd);
-          }
-        evas_object_clip_set(sobj, evas_object_clip_get(obj));
-        evas_object_smart_member_add(sobj, obj);
-        evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL,
-                                       _sub_obj_del, sd);
-        evas_object_event_callback_add(sobj, EVAS_CALLBACK_MOUSE_UP,
-                                       _sub_obj_mouse_up, sd);
-        _smart_reconfigure(sd);
-        evas_object_data_set(sobj, "elm-parent", obj);
-        evas_object_smart_callback_call(obj, "sub-object-add", sobj);
-        if (_elm_widget_is(sobj))
+        Smart_Data *sd2 = evas_object_smart_data_get(sd->resize_obj);
+        if (sd2)
           {
-             if (elm_widget_focus_get(sobj)) _focus_parents(obj);
+             sd2->parent_obj = obj;
+             sd2->top_win_focused = sd->top_win_focused;
           }
+        evas_object_event_callback_add(sobj, EVAS_CALLBACK_HIDE,
+                                       _sub_obj_hide, sd);
+     }
+   evas_object_clip_set(sobj, evas_object_clip_get(obj));
+   evas_object_smart_member_add(sobj, obj);
+   evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL,
+                                  _sub_obj_del, sd);
+   evas_object_event_callback_add(sobj, EVAS_CALLBACK_MOUSE_UP,
+                                  _sub_obj_mouse_up, sd);
+   _smart_reconfigure(sd);
+   evas_object_data_set(sobj, "elm-parent", obj);
+   evas_object_smart_callback_call(obj, "sub-object-add", sobj);
+   if (_elm_widget_is(sobj))
+     {
+        if (elm_widget_focus_get(sobj)) _focus_parents(obj);
      }
 }