diff options
author | Gustavo Sverzut Barbieri <barbieri@gmail.com> | 2008-09-21 17:08:30 +0000 |
---|---|---|
committer | Gustavo Sverzut Barbieri <barbieri@gmail.com> | 2008-09-21 17:08:30 +0000 |
commit | 8408de28cfe1be16e39e01b1cb36403c5d491324 (patch) | |
tree | 30d09398cb3c8c99700dfdf3045b317f158049b9 /src | |
parent | 915fb958d10f62979c8f94907044957a0777c760 (diff) | |
download | enlightenment-8408de28cfe1be16e39e01b1cb36403c5d491324.tar.gz |
New features to enable setting 'changed' status of config dialogs.
This callback will make it easier for dialogs to filter if the status
is really changed or if it's back to original values without having to
listen individually to each children widget (we cannot hook into the
parent since e_config_dialog already does that).
SVN revision: 36154
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/e_config_dialog.c | 53 | ||||
-rw-r--r-- | src/bin/e_config_dialog.h | 1 | ||||
-rw-r--r-- | src/modules/conf_engine/e_int_config_engine.c | 9 |
3 files changed, 44 insertions, 19 deletions
diff --git a/src/bin/e_config_dialog.c b/src/bin/e_config_dialog.c index 7b19445408..35deab0ae8 100644 --- a/src/bin/e_config_dialog.c +++ b/src/bin/e_config_dialog.c @@ -379,13 +379,42 @@ _e_config_dialog_changed(E_Config_Dialog *cfd) } static void +_e_config_dialog_unchanged(E_Config_Dialog *cfd) +{ + if (!cfd->hide_buttons) + { + e_dialog_button_disable_num_set(cfd->dia, 0, 1); + e_dialog_button_disable_num_set(cfd->dia, 1, 1); + } + else + { + if (cfd->auto_apply_timer) + { + ecore_timer_del(cfd->auto_apply_timer); + cfd->auto_apply_timer = NULL; + } + } +} + +static void _e_config_dialog_cb_changed(void *data, Evas_Object *obj) { - E_Config_Dialog *cfd; + E_Config_Dialog *cfd = data; + int changed; - cfd = data; - if (cfd->cfg_changed_auto) - _e_config_dialog_changed(data); + if (!cfd->cfg_changed_auto) + return; + + if ((cfd->view_type == E_CONFIG_DIALOG_CFDATA_TYPE_BASIC) && + (cfd->view->basic.check_changed)) + changed = cfd->view->basic.check_changed(cfd, cfd->cfdata); + else if ((cfd->view_type == E_CONFIG_DIALOG_CFDATA_TYPE_ADVANCED) && + (cfd->view->advanced.check_changed)) + changed = cfd->view->advanced.check_changed(cfd, cfd->cfdata); + else + changed = 1; + + e_config_dialog_changed_set(cfd, changed); } static void @@ -423,19 +452,5 @@ e_config_dialog_changed_set(E_Config_Dialog *cfd, unsigned char value) if (cfd->cfg_changed) _e_config_dialog_changed(cfd); else - { - if (!cfd->hide_buttons) - { - e_dialog_button_disable_num_set(cfd->dia, 0, 1); - e_dialog_button_disable_num_set(cfd->dia, 1, 1); - } - else - { - if (cfd->auto_apply_timer) - { - ecore_timer_del(cfd->auto_apply_timer); - cfd->auto_apply_timer = NULL; - } - } - } + _e_config_dialog_unchanged(cfd); } diff --git a/src/bin/e_config_dialog.h b/src/bin/e_config_dialog.h index 214c57e1c4..343b41d444 100644 --- a/src/bin/e_config_dialog.h +++ b/src/bin/e_config_dialog.h @@ -32,6 +32,7 @@ struct _E_Config_Dialog_View 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); + int (*check_changed) (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); } basic, advanced; }; diff --git a/src/modules/conf_engine/e_int_config_engine.c b/src/modules/conf_engine/e_int_config_engine.c index ff6d00500f..b78882485a 100644 --- a/src/modules/conf_engine/e_int_config_engine.c +++ b/src/modules/conf_engine/e_int_config_engine.c @@ -5,6 +5,7 @@ static void _fill_data(E_Config_Dialog_Data *cfdata); static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata); +static int _basic_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static void _cb_composite_change(void *data, Evas_Object *obj); static void _cb_confirm_yes(void *data); static void _cb_confirm_no(void *data); @@ -31,6 +32,7 @@ e_int_config_engine(E_Container *con, const char *params __UNUSED__) v->free_cfdata = _free_data; v->basic.apply_cfdata = _basic_apply_data; v->basic.create_widgets = _basic_create_widgets; + v->basic.check_changed = _basic_check_changed; cfd = e_config_dialog_new(con, _("Engine Settings"), @@ -72,6 +74,13 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) return 1; } +static int +_basic_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) +{ + return !((cfdata->use_composite == e_config->use_composite) && + (cfdata->evas_engine_default == e_config->evas_engine_default)); +} + static Evas_Object * _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) { |