aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin
diff options
context:
space:
mode:
authorkiwi <kiwi>2007-04-30 22:23:00 +0000
committerkiwi <kiwi@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2007-04-30 22:23:00 +0000
commit629fcbbc65ab444c260458e3b7597021001ef2c1 (patch)
tree3e3227b35738b4ffcad1d34b2f885abdaa94d37b /src/bin
parentStandardize some config dialog class names. (diff)
downloadenlightenment-629fcbbc65ab444c260458e3b7597021001ef2c1.tar.gz
confirm dialogs can now be deleted via e_object_del() call
SVN revision: 29782
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/e_confirm_dialog.c51
-rw-r--r--src/bin/e_confirm_dialog.h33
2 files changed, 53 insertions, 31 deletions
diff --git a/src/bin/e_confirm_dialog.c b/src/bin/e_confirm_dialog.c
index ab3f9dea9..147484ad8 100644
--- a/src/bin/e_confirm_dialog.c
+++ b/src/bin/e_confirm_dialog.c
@@ -3,47 +3,25 @@
*/
#include "e.h"
-typedef struct _E_Confirm_Dialog E_Confirm_Dialog;
-
-struct _E_Confirm_Dialog
-{
- struct
- {
- void *data;
- void (*func)(void *data);
- } yes;
-
- struct
- {
- void *data;
- void (*func)(void *data);
- } no;
-
- struct
- {
- void *data;
- void (*func)(void *data);
- } del;
- E_Dialog *dia;
-};
-
-
/******** private function definitions **********/
+static void _e_confirm_dialog_free(E_Confirm_Dialog *cd);
static void _e_confirm_dialog_delete(E_Win *win);
static void _e_confirm_dialog_yes(void *data, E_Dialog *dia);
static void _e_confirm_dialog_no(void *data, E_Dialog *dia);
/********** externally accesible functions ****************/
-EAPI void
+EAPI E_Confirm_Dialog *
e_confirm_dialog_show(const char *title, const char *icon, const char *text,
- const char *button_text, const char *button2_text, void (*func)(void *data),
- void (*func2)(void *data), void *data, void *data2, void (*del_func)(void *data), void *del_data)
+ const char *button_text, const char *button2_text,
+ void (*func)(void *data), void (*func2)(void *data),
+ void *data, void *data2,
+ void (*del_func)(void *data), void *del_data)
{
E_Confirm_Dialog *cd;
E_Dialog *dia;
- cd = E_NEW(E_Confirm_Dialog, 1);
+ cd = E_OBJECT_ALLOC(E_Confirm_Dialog, E_CONFIRM_DIALOG_TYPE, _e_confirm_dialog_free);
cd->yes.func = func;
cd->yes.data = data;
cd->no.func = func2;
@@ -72,10 +50,23 @@ e_confirm_dialog_show(const char *title, const char *icon, const char *text,
e_dialog_button_focus_num(dia, 1);
e_win_centered_set(dia->win, 1);
e_dialog_show(dia);
+
+ return cd;
}
/********* private function bodies ************/
static void
+_e_confirm_dialog_free(E_Confirm_Dialog *cd)
+{
+ E_Dialog *dia;
+ E_Win *win;
+
+ dia = cd->dia;
+ win = dia->win;
+ _e_confirm_dialog_delete(win);
+}
+
+static void
_e_confirm_dialog_yes(void *data, E_Dialog *dia)
{
E_Confirm_Dialog *cd;
@@ -84,6 +75,7 @@ _e_confirm_dialog_yes(void *data, E_Dialog *dia)
if (cd->yes.func) cd->yes.func(cd->yes.data);
_e_confirm_dialog_delete(cd->dia->win);
}
+
static void
_e_confirm_dialog_no(void *data, E_Dialog *dia)
{
@@ -93,6 +85,7 @@ _e_confirm_dialog_no(void *data, E_Dialog *dia)
if (cd->no.func) cd->no.func(cd->no.data);
_e_confirm_dialog_delete(cd->dia->win);
}
+
static void
_e_confirm_dialog_delete(E_Win *win)
{
diff --git a/src/bin/e_confirm_dialog.h b/src/bin/e_confirm_dialog.h
index c05b6c27d..48f9de88d 100644
--- a/src/bin/e_confirm_dialog.h
+++ b/src/bin/e_confirm_dialog.h
@@ -1,12 +1,39 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
-#ifdef E_TYPEDEF
+#ifdef E_TYPEDEFS
+
+typedef struct _E_Confirm_Dialog E_Confirm_Dialog;
#else
#ifndef E_CONFIRM_DIALOG_H
#define E_CONFIRM_DIALOG_H
+#define E_CONFIRM_DIALOG_TYPE 0x16f5904e
+
+struct _E_Confirm_Dialog
+{
+ E_Object e_obj_inherit;
+
+ E_Dialog *dia;
+
+ struct
+ {
+ void *data;
+ void (*func)(void *data);
+ } yes;
+ struct
+ {
+ void *data;
+ void (*func)(void *data);
+ } no;
+ struct
+ {
+ void *data;
+ void (*func)(void *data);
+ } del;
+};
+
/*
* @title - dialog title
* @icon - dialog icon
@@ -17,8 +44,10 @@
* func2 - the function to call if no is pressed
* data - the pointer passed to func
* data2 - the pointer passed to func2
+ * del_func - the function to call before dialog is deleted
+ * del_data - the pointer passer to del_func
*/
-EAPI void e_confirm_dialog_show(const char *title, const char *icon, const char *text, const char *button_text, const char *button2_text, void (*func)(void *data), void (*func2)(void *data), void *data, void *data2, void (*del_func)(void *data), void * del_data);
+EAPI E_Confirm_Dialog *e_confirm_dialog_show(const char *title, const char *icon, const char *text, const char *button_text, const char *button2_text, void (*func)(void *data), void (*func2)(void *data), void *data, void *data2, void (*del_func)(void *data), void * del_data);
#endif
#endif