From: <enl...@li...> - 2005-10-14 09:48:24
|
Enlightenment CVS committal Author : raster Project : e17 Module : apps/e Dir : e17/apps/e/src/bin Modified Files: e_config_dialog.c e_config_dialog.h e_int_config_focus.c Log Message: realised we need to approve if the dialog will close on an ok - as there may be an error and we need to complain to the user. add some comments too. =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_config_dialog.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- e_config_dialog.c 14 Oct 2005 08:34:12 -0000 1.4 +++ e_config_dialog.c 14 Oct 2005 09:48:13 -0000 1.5 @@ -130,13 +130,14 @@ _e_config_dialog_cb_ok(void *data, E_Dialog *dia) { E_Config_Dialog *cfd; - + int ok = 0; + cfd = dia->data; if (cfd->view_type == E_CONFIG_DIALOG_CFDATA_TYPE_BASIC) - cfd->view.basic.apply_cfdata(cfd, cfd->cfdata); + ok = cfd->view.basic.apply_cfdata(cfd, cfd->cfdata); else - cfd->view.advanced.apply_cfdata(cfd, cfd->cfdata); - e_object_del(E_OBJECT(cfd)); + ok = cfd->view.advanced.apply_cfdata(cfd, cfd->cfdata); + if (ok) e_object_del(E_OBJECT(cfd)); } static void =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_config_dialog.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_config_dialog.h 14 Oct 2005 08:34:12 -0000 1.2 +++ e_config_dialog.h 14 Oct 2005 09:48:13 -0000 1.3 @@ -23,7 +23,7 @@ void *(*create_cfdata) (E_Config_Dialog *cfd); void (*free_cfdata) (E_Config_Dialog *cfd, void *cfdata); struct { - void (*apply_cfdata) (E_Config_Dialog *cfd, void *cfdata); + int (*apply_cfdata) (E_Config_Dialog *cfd, void *cfdata); Evas_Object *(*create_widgets) (E_Config_Dialog *cfd, Evas *evas, void *cfdata); } basic, advanced; }; =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_int_config_focus.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_int_config_focus.c 14 Oct 2005 08:34:12 -0000 1.2 +++ e_int_config_focus.c 14 Oct 2005 09:48:13 -0000 1.3 @@ -3,16 +3,17 @@ */ #include "e.h" -/* PROTOTYPES */ +/* PROTOTYPES - same all the time */ typedef struct _CFData CFData; static void *_create_data(E_Config_Dialog *cfd); static void _free_data(E_Config_Dialog *cfd, CFData *cfdata); -static void _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata); -static void _advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata); +static int _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata); +static int _advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata); static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata); static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata); +/* Actual config data we will be playing with whil the dialog is active */ struct _CFData { /*- BASIC -*/ @@ -25,7 +26,9 @@ int always_click_to_focus; }; -void e_int_config_focus(E_Container *con) +/* a nice easy setup function that does the dirty work */ +void +e_int_config_focus(E_Container *con) { E_Config_Dialog *cfd; E_Config_Dialog_View v; @@ -45,6 +48,10 @@ static void * _create_data(E_Config_Dialog *cfd) { + /* Create cfdata - cfdata is a temporary block of config data that this + * dialog will be dealing with while configuring. it will be applied to + * the running systems/config in the apply methods + */ CFData *cfdata; cfdata = E_NEW(CFData, 1); @@ -62,13 +69,15 @@ static void _free_data(E_Config_Dialog *cfd, CFData *cfdata) { + /* Free the cfdata */ free(cfdata); } /**--APPLY--**/ -static void +static int _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata) { + /* Actually take our cfdata settings and apply them in real life */ e_border_button_bindings_ungrab_all(); if (cfdata->mode == E_FOCUS_CLICK) { @@ -96,11 +105,13 @@ } e_border_button_bindings_grab_all(); e_config_save_queue(); + return 1; /* Apply was OK */ } -static void +static int _advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata) { + /* Actually take our cfdata settings and apply them in real life */ e_border_button_bindings_ungrab_all(); e_config->focus_policy = cfdata->focus_policy; e_config->focus_setting = cfdata->focus_setting; @@ -109,14 +120,17 @@ e_config->always_click_to_focus = cfdata->always_click_to_focus; e_border_button_bindings_grab_all(); e_config_save_queue(); + return 1; /* Apply was OK */ } /**--GUI--**/ static Evas_Object * _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata) { + /* generate the core widget layout for a basic dialog */ Evas_Object *o, *ob; E_Radio_Group *rg; + o = e_widget_list_add(evas, 0, 0); rg = e_widget_radio_group_new(&(cfdata->mode)); ob = e_widget_radio_add(evas, _("Click Window to Focus"), E_FOCUS_CLICK, rg); @@ -131,6 +145,7 @@ static Evas_Object * _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata) { + /* generate the core widget layout for an advanced dialog */ Evas_Object *o, *ob, *of; E_Radio_Group *rg; |