ensure that confirm dialogs call either the yes or no function when they are closed even if a button is not pressed

SVN revision: 76102
This commit is contained in:
Mike Blumenkrantz 2012-09-04 04:19:30 +00:00
parent 2424eef275
commit df9fd68281
2 changed files with 11 additions and 0 deletions

View File

@ -63,6 +63,14 @@ e_confirm_dialog_show(const char *title, const char *icon, const char *text,
static void
_e_confirm_dialog_free(E_Confirm_Dialog *cd)
{
if (!cd->no_run)
{
e_object_ref(E_OBJECT(cd));
cd->no_run = EINA_TRUE;
if (cd->no.func) cd->no.func(cd->no.data);
e_object_unref(E_OBJECT(cd));
return;
}
if (cd->del.func) cd->del.func(cd->del.data);
e_object_del(E_OBJECT(cd->dia));
free(cd);
@ -75,6 +83,7 @@ _e_confirm_dialog_yes(void *data, E_Dialog *dia __UNUSED__)
cd = data;
e_object_ref(data);
cd->no_run = EINA_TRUE;
if (cd->yes.func) cd->yes.func(cd->yes.data);
e_object_del(data);
e_object_unref(data);
@ -87,6 +96,7 @@ _e_confirm_dialog_no(void *data, E_Dialog *dia __UNUSED__)
cd = data;
e_object_ref(data);
cd->no_run = EINA_TRUE;
if (cd->no.func) cd->no.func(cd->no.data);
e_object_del(data);
e_object_unref(data);

View File

@ -29,6 +29,7 @@ struct _E_Confirm_Dialog
void *data;
void (*func)(void *data);
} del;
Eina_Bool no_run : 1;
};
/*