Enlightenment CVS committal
Author : onefang
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
e_config_dialog.c e_config_dialog.h
Log Message:
Add a close button callback hook at the request of devilhorns.
If the callback returns zero, the dialog is NOT closed.
Seems that every user of config_dialog allocates E_Config_Dialog_View on
the stack and doesn't clear it, so I can't rely on the close_cfdata member
being NULL. I currently set it to NULL in e_config_dialog_new() and if
you want to use it, set it in create_widgets(); I suspect that allocating
a structure on the stack that lives beyond the function call is just
asking for trouble.
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_config_dialog.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- e_config_dialog.c 21 Jan 2006 11:48:30 -0000 1.17
+++ e_config_dialog.c 21 Jan 2006 12:44:48 -0000 1.18
@@ -12,6 +12,7 @@
static void _e_config_dialog_cb_advanced(void *data, void *data2);
static void _e_config_dialog_cb_basic(void *data, void *data2);
static void _e_config_dialog_cb_changed(void *data, Evas_Object *obj);
+static void _e_config_dialog_cb_close(void *data, E_Dialog *dia);
/* local subsystem globals */
@@ -22,8 +23,16 @@
{
E_Config_Dialog *cfd;
+
cfd = E_OBJECT_ALLOC(E_Config_Dialog, E_CONFIG_DIALOG_TYPE,
_e_config_dialog_free);
cfd->view = *view;
+ /* Seems that every user of this allocates view it on the stack and doesn't
clear it,
+ * so I can't rely on this being NULL. I currently set it to NULL in
e_config_dialog_new()
+ * and if you want to use it, set it in create_widgets();
+ * I suspect that allocating a structure on the stack that lives beyond the
function
+ * call is just asking for trouble.
+ */
+ cfd->view.close_cfdata = NULL;
cfd->con = con;
cfd->title = evas_stringshare_add(title);
if (icon)
@@ -122,7 +131,7 @@
e_dialog_button_disable_num_set(cfd->dia, 0, 1);
e_dialog_button_disable_num_set(cfd->dia, 1, 1);
}
- e_dialog_button_add(cfd->dia, _("Close"), NULL, NULL, NULL);
+ e_dialog_button_add(cfd->dia, _("Close"), NULL, _e_config_dialog_cb_close,
cfd);
if (!pdia)
{
e_win_centered_set(cfd->dia->win, 1);
@@ -239,3 +248,17 @@
e_dialog_button_disable_num_set(cfd->dia, 1, 0);
}
}
+
+static void
+_e_config_dialog_cb_close(void *data, E_Dialog *dia)
+{
+ E_Config_Dialog *cfd;
+ int ok = 1;
+
+ cfd = dia->data;
+ if (cfd->view.close_cfdata)
+ ok = cfd->view.close_cfdata(cfd, cfd->cfdata);
+
+ if (ok)
+ e_object_del(E_OBJECT(dia));
+}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_config_dialog.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- e_config_dialog.h 14 Jan 2006 16:05:35 -0000 1.6
+++ e_config_dialog.h 21 Jan 2006 12:44:48 -0000 1.7
@@ -23,6 +23,11 @@
{
void *(*create_cfdata) (E_Config_Dialog *cfd);
void (*free_cfdata) (E_Config_Dialog *cfd,
E_Config_Dialog_Data *cfdata);
+ /* Seems that every user of this structure allocates it on the stack and
doesn't clear it,
+ * so I can't rely on this being NULL. I currently set it to NULL in
e_config_dialog_new()
+ * and if you want to use it, set it in create_widgets();
+ */
+ int (*close_cfdata) (E_Config_Dialog *cfd,
E_Config_Dialog_Data *cfdata);
struct {
int (*apply_cfdata) (E_Config_Dialog *cfd,
E_Config_Dialog_Data *cfdata);
Evas_Object *(*create_widgets) (E_Config_Dialog *cfd, Evas *evas,
E_Config_Dialog_Data *cfdata);
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs