[*]Un-Rollback to 'Merge [elm_multibuttonentry]Changed edc TEXT part to TEXTBLOCK...
[framework/uifw/elementary.git] / src / lib / elm_button.c
index c0e348e..33ed125 100644 (file)
@@ -19,17 +19,19 @@ struct _Widget_Data
 {
    Evas_Object *btn, *icon;
    const char *label;
-   Eina_Bool autorepeat;
-   Eina_Bool repeating;
    double ar_threshold;
    double ar_interval;
    Ecore_Timer *timer;
    const char *statelabel[4];
    int statetype[4];
+   Eina_Bool autorepeat : 1;
+   Eina_Bool repeating : 1;
+   Eina_Bool delete_me : 1;
 };
 
 static const char *widtype = NULL;
 static void _del_hook(Evas_Object *obj);
+static void _del_pre_hook(Evas_Object *obj);
 static void _theme_hook(Evas_Object *obj);
 static void _disable_hook(Evas_Object *obj);
 static void _sizing_eval(Evas_Object *obj);
@@ -79,6 +81,14 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty
 }
 
 static void
+_del_pre_hook(Evas_Object *obj)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   wd->delete_me = EINA_TRUE;
+}
+
+static void
 _del_hook(Evas_Object *obj)
 {
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -207,6 +217,7 @@ _sizing_eval(Evas_Object *obj)
    Evas_Coord w, h;
 
    if (!wd) return;
+   if (wd->delete_me) return;
    elm_coords_finger_size_adjust(1, &minw, 1, &minh);
    edje_object_size_min_restricted_calc(wd->btn, &minw, &minh, minw, minh);
    elm_coords_finger_size_adjust(1, &minw, 1, &minh);
@@ -386,6 +397,7 @@ elm_button_add(Evas_Object *parent)
    elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
    elm_widget_data_set(obj, wd);
    elm_widget_del_hook_set(obj, _del_hook);
+   elm_widget_del_pre_hook_set(obj, _del_pre_hook);
    elm_widget_theme_hook_set(obj, _theme_hook);
    elm_widget_disable_hook_set(obj, _disable_hook);
    elm_widget_can_focus_set(obj, EINA_TRUE);