forked from enlightenment/enlightenment
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
This commit is contained in:
parent
915fb958d1
commit
8408de28cf
|
@ -378,14 +378,43 @@ _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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue