2005-10-13 08:15:27 -07:00
|
|
|
#include "e.h"
|
|
|
|
|
|
|
|
/* local subsystem functions */
|
2012-06-26 01:40:08 -07:00
|
|
|
static void _e_config_dialog_free(E_Config_Dialog *cfd);
|
|
|
|
static void _e_config_dialog_go(E_Config_Dialog *cfd, E_Config_Dialog_CFData_Type type);
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool _e_config_dialog_cb_auto_apply_timer(void *data);
|
2012-06-26 01:40:08 -07:00
|
|
|
static void _e_config_dialog_cb_dialog_del(void *obj);
|
|
|
|
static void _e_config_dialog_cb_ok(void *data, E_Dialog *dia);
|
|
|
|
static void _e_config_dialog_cb_apply(void *data, E_Dialog *dia);
|
|
|
|
static void _e_config_dialog_cb_advanced(void *data, void *data2);
|
|
|
|
static void _e_config_dialog_cb_basic(void *data, void *data2);
|
|
|
|
static int _e_config_dialog_check_changed(E_Config_Dialog *cfd, unsigned char def);
|
|
|
|
static void _e_config_dialog_cb_changed(void *data, Evas_Object *obj);
|
|
|
|
static void _e_config_dialog_cb_close(void *data, E_Dialog *dia);
|
2005-10-13 08:15:27 -07:00
|
|
|
|
|
|
|
/* local subsystem globals */
|
2008-10-22 04:49:33 -07:00
|
|
|
static Eina_List *_e_config_dialog_list = NULL;
|
2005-10-13 08:15:27 -07:00
|
|
|
|
|
|
|
/* externally accessible functions */
|
|
|
|
|
2013-01-11 02:34:29 -08:00
|
|
|
/**
|
|
|
|
* Creates a new dialog
|
2012-07-06 03:53:22 -07:00
|
|
|
*
|
2014-11-02 18:35:13 -08:00
|
|
|
* @param parent the parent dialog
|
2012-07-06 03:53:22 -07:00
|
|
|
* @param title to display for the dialog
|
|
|
|
* @param name the name used to register the window in e
|
|
|
|
* @param class the call used to register the window in e
|
|
|
|
* @param icon the path to the icon file
|
|
|
|
* @param icon_size is of the width and height of the icon
|
|
|
|
* @param view the callbacks used to create the dialog and save the settings
|
|
|
|
* @param data additional data to attach to the dialog, will be passed to the callbacks
|
|
|
|
* @return returns the created dialog. Null on failure
|
|
|
|
*/
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API E_Config_Dialog *
|
2014-11-02 18:35:13 -08:00
|
|
|
e_config_dialog_new(Evas_Object *parent, const char *title, const char *name, const char *class, const char *icon, int icon_size, E_Config_Dialog_View *view, void *data)
|
2005-10-13 08:15:27 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd;
|
2009-08-22 19:03:30 -07:00
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
cfd = E_OBJECT_ALLOC(E_Config_Dialog, E_CONFIG_DIALOG_TYPE,
|
2009-08-22 19:03:30 -07:00
|
|
|
_e_config_dialog_free);
|
2006-01-22 06:18:20 -08:00
|
|
|
cfd->view = view;
|
2014-11-02 18:35:13 -08:00
|
|
|
cfd->parent = parent;
|
2008-10-15 08:12:56 -07:00
|
|
|
cfd->title = eina_stringshare_add(title);
|
|
|
|
cfd->name = eina_stringshare_add(name);
|
|
|
|
cfd->class = eina_stringshare_add(class);
|
2005-10-14 20:09:46 -07:00
|
|
|
if (icon)
|
|
|
|
{
|
2012-06-26 01:40:08 -07:00
|
|
|
cfd->icon = eina_stringshare_add(icon);
|
|
|
|
cfd->icon_size = icon_size;
|
2005-10-14 20:09:46 -07:00
|
|
|
}
|
2005-10-14 01:34:12 -07:00
|
|
|
cfd->data = data;
|
2006-01-21 03:48:30 -08:00
|
|
|
cfd->hide_buttons = 1;
|
2006-02-13 07:36:56 -08:00
|
|
|
cfd->cfg_changed = 0;
|
2008-09-21 09:21:25 -07:00
|
|
|
cfd->cfg_changed_auto = 1;
|
2006-01-21 03:48:30 -08:00
|
|
|
|
2006-02-15 12:29:33 -08:00
|
|
|
if (cfd->view->override_auto_apply)
|
|
|
|
{
|
2012-06-26 01:40:08 -07:00
|
|
|
/* Dialog Requested To Not Auto-Apply */
|
|
|
|
if ((cfd->view->basic.apply_cfdata) ||
|
2009-08-22 19:03:30 -07:00
|
|
|
(cfd->view->advanced.apply_cfdata))
|
2012-06-26 01:40:08 -07:00
|
|
|
cfd->hide_buttons = 0;
|
2006-02-15 12:29:33 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-06-26 01:40:08 -07:00
|
|
|
/* Ok To Override, Or Not Specified. Use Config Value */
|
|
|
|
if (e_config->cfgdlg_auto_apply)
|
|
|
|
cfd->hide_buttons = 1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((cfd->view->basic.apply_cfdata) ||
|
2009-08-22 19:03:30 -07:00
|
|
|
(cfd->view->advanced.apply_cfdata))
|
2012-06-26 01:40:08 -07:00
|
|
|
cfd->hide_buttons = 0;
|
|
|
|
}
|
2006-02-15 12:29:33 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (e_config->cfgdlg_default_mode)
|
|
|
|
{
|
|
|
|
case E_CONFIG_DIALOG_CFDATA_TYPE_BASIC:
|
2012-06-26 01:40:08 -07:00
|
|
|
if (cfd->view->basic.create_widgets)
|
|
|
|
_e_config_dialog_go(cfd, E_CONFIG_DIALOG_CFDATA_TYPE_BASIC);
|
|
|
|
break;
|
|
|
|
|
2006-02-15 12:29:33 -08:00
|
|
|
case E_CONFIG_DIALOG_CFDATA_TYPE_ADVANCED:
|
2012-06-26 01:40:08 -07:00
|
|
|
if (cfd->view->advanced.create_widgets)
|
|
|
|
_e_config_dialog_go(cfd, E_CONFIG_DIALOG_CFDATA_TYPE_ADVANCED);
|
|
|
|
else if (cfd->view->basic.create_widgets)
|
|
|
|
_e_config_dialog_go(cfd, E_CONFIG_DIALOG_CFDATA_TYPE_BASIC);
|
|
|
|
break;
|
2006-02-15 12:29:33 -08:00
|
|
|
}
|
2008-10-22 04:49:33 -07:00
|
|
|
_e_config_dialog_list = eina_list_append(_e_config_dialog_list, cfd);
|
2009-08-22 19:03:30 -07:00
|
|
|
|
2005-10-13 08:15:27 -07:00
|
|
|
return cfd;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2006-10-08 01:04:18 -07:00
|
|
|
e_config_dialog_find(const char *name, const char *class)
|
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2006-10-08 01:04:18 -07:00
|
|
|
E_Config_Dialog *cfd;
|
2009-08-22 19:03:30 -07:00
|
|
|
|
2009-08-21 08:08:49 -07:00
|
|
|
EINA_LIST_FOREACH(_e_config_dialog_list, l, cfd)
|
2006-10-08 01:04:18 -07:00
|
|
|
{
|
2012-06-26 01:40:08 -07:00
|
|
|
if ((!e_util_strcmp(name, cfd->name)) &&
|
|
|
|
(!e_util_strcmp(class, cfd->class)))
|
|
|
|
{
|
|
|
|
E_Zone *z;
|
2014-11-02 18:35:13 -08:00
|
|
|
E_Client *ec;
|
2012-06-26 01:40:08 -07:00
|
|
|
|
2015-03-13 14:47:36 -07:00
|
|
|
z = e_zone_current_get();
|
2014-11-02 18:35:13 -08:00
|
|
|
ec = e_win_client_get(cfd->dia->win);
|
|
|
|
e_client_uniconify(ec);
|
|
|
|
elm_win_raise(cfd->dia->win);
|
2015-09-15 09:46:46 -07:00
|
|
|
ec->hidden = 0;
|
2015-03-13 14:44:24 -07:00
|
|
|
e_client_desk_set(ec, e_desk_current_get(z));
|
2014-11-02 18:35:13 -08:00
|
|
|
if (ec->shaded || ec->shading)
|
|
|
|
e_client_unshade(ec, ec->shade_dir);
|
2012-06-26 01:40:08 -07:00
|
|
|
if ((e_config->focus_setting == E_FOCUS_NEW_DIALOG) ||
|
|
|
|
(e_config->focus_setting == E_FOCUS_NEW_WINDOW))
|
2014-11-02 18:35:13 -08:00
|
|
|
evas_object_focus_set(ec->frame, 1);
|
2012-06-26 01:40:08 -07:00
|
|
|
return 1;
|
|
|
|
}
|
2006-10-08 01:04:18 -07:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API E_Config_Dialog *
|
2012-06-20 23:19:43 -07:00
|
|
|
e_config_dialog_get(const char *name, const char *class)
|
2006-11-30 02:01:02 -08:00
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2009-08-21 08:08:49 -07:00
|
|
|
E_Config_Dialog *cfd;
|
2009-04-21 10:57:38 -07:00
|
|
|
|
2009-08-21 08:08:49 -07:00
|
|
|
EINA_LIST_FOREACH(_e_config_dialog_list, l, cfd)
|
2006-11-30 02:01:02 -08:00
|
|
|
{
|
2012-06-26 01:40:08 -07:00
|
|
|
if (!cfd) continue;
|
|
|
|
if ((!e_util_strcmp(name, cfd->name)) &&
|
|
|
|
(!e_util_strcmp(class, cfd->class)))
|
|
|
|
{
|
|
|
|
return cfd;
|
|
|
|
}
|
2006-11-30 02:01:02 -08:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2005-10-13 08:15:27 -07:00
|
|
|
/* local subsystem functions */
|
|
|
|
static void
|
|
|
|
_e_config_dialog_free(E_Config_Dialog *cfd)
|
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
_e_config_dialog_list = eina_list_remove(_e_config_dialog_list, cfd);
|
2006-05-10 03:17:59 -07:00
|
|
|
if (cfd->auto_apply_timer) _e_config_dialog_cb_auto_apply_timer(cfd);
|
2008-10-15 08:12:56 -07:00
|
|
|
if (cfd->title) eina_stringshare_del(cfd->title);
|
|
|
|
if (cfd->name) eina_stringshare_del(cfd->name);
|
|
|
|
if (cfd->class) eina_stringshare_del(cfd->class);
|
|
|
|
if (cfd->icon) eina_stringshare_del(cfd->icon);
|
2012-12-12 08:54:48 -08:00
|
|
|
if (cfd->view->free_cfdata)
|
2005-10-13 08:15:27 -07:00
|
|
|
{
|
2012-06-26 01:40:08 -07:00
|
|
|
cfd->view->free_cfdata(cfd, cfd->cfdata);
|
|
|
|
cfd->cfdata = NULL;
|
2005-10-13 08:15:27 -07:00
|
|
|
}
|
|
|
|
if (cfd->dia)
|
|
|
|
{
|
2012-06-26 01:40:08 -07:00
|
|
|
e_object_del_attach_func_set(E_OBJECT(cfd->dia), NULL);
|
|
|
|
e_object_del(E_OBJECT(cfd->dia));
|
|
|
|
cfd->dia = NULL;
|
2005-10-13 08:15:27 -07:00
|
|
|
}
|
2006-01-22 06:18:20 -08:00
|
|
|
E_FREE(cfd->view);
|
2009-08-22 19:03:30 -07:00
|
|
|
E_FREE(cfd);
|
2005-10-13 08:15:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_config_dialog_go(E_Config_Dialog *cfd, E_Config_Dialog_CFData_Type type)
|
|
|
|
{
|
2009-08-22 19:03:30 -07:00
|
|
|
Evas *evas;
|
2005-10-13 08:15:27 -07:00
|
|
|
E_Dialog *pdia;
|
2008-09-26 10:00:32 -07:00
|
|
|
Evas_Object *o, *ob, *sf;
|
2006-08-14 08:22:46 -07:00
|
|
|
char buf[256];
|
2015-01-15 00:04:42 -08:00
|
|
|
int mw = -1, mh = -1;
|
2012-08-23 23:53:32 -07:00
|
|
|
void *cfdata;
|
2009-04-21 10:57:38 -07:00
|
|
|
|
2005-10-13 08:15:27 -07:00
|
|
|
pdia = cfd->dia;
|
2006-08-14 08:22:46 -07:00
|
|
|
/* FIXME: get name/class form new call and use here */
|
2009-09-21 13:36:35 -07:00
|
|
|
/* if (type == E_CONFIG_DIALOG_CFDATA_TYPE_BASIC)
|
|
|
|
* snprintf(buf, sizeof(buf), "%s...%s", cfd->class, "BASIC");
|
|
|
|
* else
|
|
|
|
* snprintf(buf, sizeof(buf), "%s...%s", cfd->class, "ADVANCED"); */
|
|
|
|
snprintf(buf, sizeof(buf), "_config::%s", cfd->class);
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2009-07-11 17:24:11 -07:00
|
|
|
if (!pdia) /* creating window for the first time */
|
|
|
|
{
|
2012-06-26 01:40:08 -07:00
|
|
|
if ((cfd->view->normal_win) || (e_config->cfgdlg_normal_wins))
|
2014-11-02 18:35:13 -08:00
|
|
|
cfd->dia = e_dialog_normal_win_new(cfd->parent, cfd->name, buf);
|
2012-06-26 01:40:08 -07:00
|
|
|
else
|
2016-07-25 10:06:59 -07:00
|
|
|
cfd->dia = e_dialog_new(cfd->parent, cfd->name, buf);
|
2012-06-26 01:40:08 -07:00
|
|
|
e_object_del_attach_func_set(E_OBJECT(cfd->dia),
|
|
|
|
_e_config_dialog_cb_dialog_del);
|
|
|
|
} /* window was created before - deleting content only */
|
2009-07-11 17:24:11 -07:00
|
|
|
else if (cfd->dia->content_object)
|
|
|
|
evas_object_del(cfd->dia->content_object);
|
|
|
|
|
2009-12-28 00:19:52 -08:00
|
|
|
cfd->view_type = type;
|
2005-10-13 08:15:27 -07:00
|
|
|
cfd->dia->data = cfd;
|
|
|
|
e_dialog_title_set(cfd->dia, cfd->title);
|
2012-08-23 23:53:32 -07:00
|
|
|
cfdata = cfd->cfdata;
|
2020-05-13 12:09:46 -07:00
|
|
|
if (cfd->view->create_cfdata && (!cfd->cfdata))
|
2014-06-19 06:31:07 -07:00
|
|
|
cfd->cfdata = cfd->view->create_cfdata(cfd);
|
2008-05-06 02:30:21 -07:00
|
|
|
|
2014-11-02 18:35:13 -08:00
|
|
|
evas = evas_object_evas_get(cfd->dia->win);
|
2005-10-13 08:15:27 -07:00
|
|
|
if (type == E_CONFIG_DIALOG_CFDATA_TYPE_BASIC)
|
|
|
|
{
|
2012-06-26 01:40:08 -07:00
|
|
|
if (cfd->view->advanced.create_widgets)
|
|
|
|
{
|
2012-07-03 06:26:57 -07:00
|
|
|
o = e_widget_list_add(evas, 0, 0);
|
2012-06-26 01:40:08 -07:00
|
|
|
ob = cfd->view->basic.create_widgets(cfd, evas, cfd->cfdata);
|
|
|
|
if (cfd->view->scroll)
|
|
|
|
{
|
|
|
|
e_widget_size_min_resize(ob);
|
|
|
|
sf = e_widget_scrollframe_simple_add(evas, ob);
|
|
|
|
e_widget_list_object_append(o, sf, 1, 1, 0.0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
e_widget_list_object_append(o, ob, 1, 1, 0.0);
|
|
|
|
ob = e_widget_button_add(evas,
|
|
|
|
_("Advanced"), "go-next",
|
|
|
|
_e_config_dialog_cb_advanced, cfd, NULL);
|
|
|
|
e_widget_list_object_append(o, ob, 0, 0, 1.0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
o = cfd->view->basic.create_widgets(cfd, evas, cfd->cfdata);
|
|
|
|
if (cfd->view->scroll)
|
|
|
|
{
|
|
|
|
e_widget_size_min_resize(o);
|
|
|
|
o = e_widget_scrollframe_simple_add(evas, o);
|
|
|
|
}
|
|
|
|
}
|
2005-10-13 08:15:27 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-06-26 01:40:08 -07:00
|
|
|
if (cfd->view->basic.create_widgets)
|
|
|
|
{
|
|
|
|
o = e_widget_list_add(evas, 0, 0);
|
|
|
|
ob = cfd->view->advanced.create_widgets(cfd, evas, cfd->cfdata);
|
|
|
|
if (cfd->view->scroll)
|
|
|
|
{
|
|
|
|
e_widget_size_min_resize(ob);
|
|
|
|
sf = e_widget_scrollframe_simple_add(evas, ob);
|
|
|
|
e_widget_list_object_append(o, sf, 1, 1, 0.0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
e_widget_list_object_append(o, ob, 1, 1, 0.0);
|
|
|
|
ob = e_widget_button_add(evas,
|
|
|
|
_("Basic"), "go-next",
|
|
|
|
_e_config_dialog_cb_basic, cfd, NULL);
|
|
|
|
e_widget_list_object_append(o, ob, 0, 0, 1.0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
o = cfd->view->advanced.create_widgets(cfd, evas, cfd->cfdata);
|
|
|
|
if (cfd->view->scroll)
|
|
|
|
{
|
|
|
|
e_widget_size_min_resize(o);
|
|
|
|
o = e_widget_scrollframe_simple_add(evas, o);
|
|
|
|
}
|
|
|
|
}
|
2005-10-13 08:15:27 -07:00
|
|
|
}
|
2009-08-22 19:03:30 -07:00
|
|
|
|
2015-01-14 19:03:28 -08:00
|
|
|
e_widget_on_change_hook_set(o, _e_config_dialog_cb_changed, cfd);
|
2015-01-15 00:04:42 -08:00
|
|
|
e_widget_size_min_get(o, &mw, &mh);
|
2005-10-13 08:15:27 -07:00
|
|
|
e_dialog_content_set(cfd->dia, o, mw, mh);
|
2009-07-11 17:24:11 -07:00
|
|
|
|
|
|
|
if (!pdia) /* dialog window was created in this function call - need to create buttons once */
|
2005-12-27 09:16:58 -08:00
|
|
|
{
|
2012-06-26 01:40:08 -07:00
|
|
|
if (!cfd->hide_buttons)
|
|
|
|
{
|
|
|
|
e_dialog_button_add(cfd->dia, _("OK"), NULL,
|
|
|
|
_e_config_dialog_cb_ok, cfd);
|
|
|
|
e_dialog_button_add(cfd->dia, _("Apply"), NULL,
|
|
|
|
_e_config_dialog_cb_apply, cfd);
|
|
|
|
if (!cfd->cfg_changed)
|
|
|
|
{
|
|
|
|
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,
|
|
|
|
_e_config_dialog_cb_close, cfd);
|
|
|
|
}
|
2005-12-27 09:16:58 -08:00
|
|
|
|
2012-08-23 23:53:32 -07:00
|
|
|
if (cfdata && cfd->cfg_changed_auto)
|
2009-12-28 00:19:52 -08:00
|
|
|
{
|
2012-06-26 01:40:08 -07:00
|
|
|
int changed;
|
2009-12-28 00:19:52 -08:00
|
|
|
|
2012-06-26 01:40:08 -07:00
|
|
|
changed = _e_config_dialog_check_changed(cfd, 0);
|
|
|
|
e_config_dialog_changed_set(cfd, changed);
|
2009-12-28 00:19:52 -08:00
|
|
|
}
|
|
|
|
|
2009-07-11 17:24:11 -07:00
|
|
|
e_dialog_show(cfd->dia);
|
|
|
|
if (cfd->icon) e_dialog_border_icon_set(cfd->dia, cfd->icon);
|
2005-10-13 08:15:27 -07:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2006-05-10 03:17:59 -07:00
|
|
|
_e_config_dialog_cb_auto_apply_timer(void *data)
|
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd;
|
|
|
|
|
|
|
|
cfd = data;
|
2009-04-21 10:57:38 -07:00
|
|
|
|
2006-05-10 03:17:59 -07:00
|
|
|
if (cfd->auto_apply_timer) ecore_timer_del(cfd->auto_apply_timer);
|
|
|
|
cfd->auto_apply_timer = NULL;
|
2009-04-21 10:57:38 -07:00
|
|
|
|
2006-05-10 03:17:59 -07:00
|
|
|
if (cfd->view_type == E_CONFIG_DIALOG_CFDATA_TYPE_BASIC)
|
|
|
|
{
|
2012-06-26 01:40:08 -07:00
|
|
|
if (cfd->view->basic.apply_cfdata)
|
|
|
|
cfd->view->basic.apply_cfdata(cfd, cfd->cfdata);
|
2006-05-10 03:17:59 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-06-26 01:40:08 -07:00
|
|
|
if (cfd->view->advanced.apply_cfdata)
|
|
|
|
cfd->view->advanced.apply_cfdata(cfd, cfd->cfdata);
|
2006-05-10 03:17:59 -07:00
|
|
|
}
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
2006-05-10 03:17:59 -07:00
|
|
|
}
|
|
|
|
|
2005-10-13 08:15:27 -07:00
|
|
|
static void
|
|
|
|
_e_config_dialog_cb_dialog_del(void *obj)
|
|
|
|
{
|
|
|
|
E_Dialog *dia;
|
|
|
|
E_Config_Dialog *cfd;
|
2006-01-22 06:18:20 -08:00
|
|
|
|
2005-10-13 08:15:27 -07:00
|
|
|
dia = obj;
|
|
|
|
cfd = dia->data;
|
2006-05-10 03:17:59 -07:00
|
|
|
if (cfd->auto_apply_timer) _e_config_dialog_cb_auto_apply_timer(cfd);
|
2005-10-13 08:15:27 -07:00
|
|
|
cfd->dia = NULL;
|
|
|
|
e_object_del(E_OBJECT(cfd));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_config_dialog_cb_ok(void *data EINA_UNUSED, E_Dialog *dia)
|
2005-10-13 08:15:27 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd;
|
2005-10-14 02:48:13 -07:00
|
|
|
int ok = 0;
|
2009-04-21 10:57:38 -07:00
|
|
|
|
2005-10-13 08:15:27 -07:00
|
|
|
cfd = dia->data;
|
|
|
|
if (cfd->view_type == E_CONFIG_DIALOG_CFDATA_TYPE_BASIC)
|
2009-08-22 19:03:30 -07:00
|
|
|
{
|
|
|
|
if (cfd->view->basic.apply_cfdata)
|
|
|
|
ok = cfd->view->basic.apply_cfdata(cfd, cfd->cfdata);
|
|
|
|
}
|
2005-10-13 08:15:27 -07:00
|
|
|
else
|
2009-08-22 19:03:30 -07:00
|
|
|
{
|
|
|
|
if (cfd->view->advanced.apply_cfdata)
|
|
|
|
ok = cfd->view->advanced.apply_cfdata(cfd, cfd->cfdata);
|
|
|
|
}
|
2012-06-20 23:19:43 -07:00
|
|
|
if (ok)
|
2007-05-04 08:55:24 -07:00
|
|
|
e_util_defer_object_del(E_OBJECT(cfd));
|
2005-10-13 08:15:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_config_dialog_cb_apply(void *data EINA_UNUSED, E_Dialog *dia)
|
2005-10-13 08:15:27 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd;
|
2005-10-20 05:49:47 -07:00
|
|
|
int ok = 0;
|
2005-10-13 08:15:27 -07:00
|
|
|
|
|
|
|
cfd = dia->data;
|
|
|
|
if (cfd->view_type == E_CONFIG_DIALOG_CFDATA_TYPE_BASIC)
|
2009-08-22 19:03:30 -07:00
|
|
|
{
|
|
|
|
if (cfd->view->basic.apply_cfdata)
|
|
|
|
ok = cfd->view->basic.apply_cfdata(cfd, cfd->cfdata);
|
|
|
|
}
|
2005-10-13 08:15:27 -07:00
|
|
|
else
|
2009-08-22 19:03:30 -07:00
|
|
|
{
|
|
|
|
if (cfd->view->advanced.apply_cfdata)
|
|
|
|
ok = cfd->view->advanced.apply_cfdata(cfd, cfd->cfdata);
|
|
|
|
}
|
2006-01-21 03:48:30 -08:00
|
|
|
if ((ok) && (!cfd->hide_buttons))
|
2005-10-20 05:49:47 -07:00
|
|
|
{
|
2012-06-26 01:40:08 -07:00
|
|
|
cfd->cfg_changed = 0;
|
|
|
|
e_dialog_button_disable_num_set(cfd->dia, 0, 1);
|
|
|
|
e_dialog_button_disable_num_set(cfd->dia, 1, 1);
|
2005-10-20 05:49:47 -07:00
|
|
|
}
|
2005-10-13 08:15:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_config_dialog_cb_advanced(void *data, void *data2 EINA_UNUSED)
|
2005-10-13 08:15:27 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd;
|
2009-04-21 10:57:38 -07:00
|
|
|
|
2005-10-13 08:15:27 -07:00
|
|
|
cfd = data;
|
2006-05-10 03:17:59 -07:00
|
|
|
if (cfd->auto_apply_timer) _e_config_dialog_cb_auto_apply_timer(cfd);
|
2005-10-13 08:15:27 -07:00
|
|
|
_e_config_dialog_go(cfd, E_CONFIG_DIALOG_CFDATA_TYPE_ADVANCED);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_config_dialog_cb_basic(void *data, void *data2 EINA_UNUSED)
|
2005-10-13 08:15:27 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd;
|
2009-04-21 10:57:38 -07:00
|
|
|
|
2005-10-13 08:15:27 -07:00
|
|
|
cfd = data;
|
2006-05-10 03:17:59 -07:00
|
|
|
if (cfd->auto_apply_timer) _e_config_dialog_cb_auto_apply_timer(cfd);
|
2005-10-13 08:15:27 -07:00
|
|
|
_e_config_dialog_go(cfd, E_CONFIG_DIALOG_CFDATA_TYPE_BASIC);
|
|
|
|
}
|
2005-10-16 00:32:12 -07:00
|
|
|
|
|
|
|
static void
|
2008-09-21 09:21:25 -07:00
|
|
|
_e_config_dialog_changed(E_Config_Dialog *cfd)
|
2005-10-16 00:32:12 -07:00
|
|
|
{
|
2006-01-21 03:48:30 -08:00
|
|
|
if (!cfd->hide_buttons)
|
2008-09-21 09:21:25 -07:00
|
|
|
{
|
2012-06-26 01:40:08 -07:00
|
|
|
cfd->cfg_changed = 1;
|
|
|
|
e_dialog_button_disable_num_set(cfd->dia, 0, 0);
|
|
|
|
e_dialog_button_disable_num_set(cfd->dia, 1, 0);
|
2008-09-21 09:21:25 -07:00
|
|
|
}
|
2006-02-15 12:29:33 -08:00
|
|
|
else
|
|
|
|
{
|
2012-06-26 01:40:08 -07:00
|
|
|
if (cfd->auto_apply_timer) ecore_timer_del(cfd->auto_apply_timer);
|
2009-08-22 19:03:30 -07:00
|
|
|
cfd->auto_apply_timer = NULL;
|
2012-06-26 01:40:08 -07:00
|
|
|
cfd->auto_apply_timer =
|
2017-02-03 13:52:28 -08:00
|
|
|
ecore_timer_loop_add(0.5, _e_config_dialog_cb_auto_apply_timer, cfd);
|
2008-09-21 09:21:25 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-21 10:08:30 -07:00
|
|
|
static void
|
|
|
|
_e_config_dialog_unchanged(E_Config_Dialog *cfd)
|
|
|
|
{
|
|
|
|
if (!cfd->hide_buttons)
|
|
|
|
{
|
2012-06-26 01:40:08 -07:00
|
|
|
e_dialog_button_disable_num_set(cfd->dia, 0, 1);
|
|
|
|
e_dialog_button_disable_num_set(cfd->dia, 1, 1);
|
2008-09-21 10:08:30 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-06-26 01:40:08 -07:00
|
|
|
if (cfd->auto_apply_timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(cfd->auto_apply_timer);
|
|
|
|
cfd->auto_apply_timer = NULL;
|
|
|
|
}
|
2008-09-21 10:08:30 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-28 00:19:52 -08:00
|
|
|
static int
|
|
|
|
_e_config_dialog_check_changed(E_Config_Dialog *cfd, unsigned char def)
|
|
|
|
{
|
2010-01-14 15:48:59 -08:00
|
|
|
int changed = 0;
|
2009-12-28 00:19:52 -08:00
|
|
|
|
|
|
|
if (cfd->view_type == E_CONFIG_DIALOG_CFDATA_TYPE_BASIC)
|
|
|
|
{
|
|
|
|
if (cfd->view->basic.check_changed)
|
2010-03-01 12:40:49 -08:00
|
|
|
changed = cfd->view->basic.check_changed(cfd, cfd->cfdata);
|
2012-06-26 01:40:08 -07:00
|
|
|
else
|
2010-03-01 12:40:49 -08:00
|
|
|
changed = def;
|
2009-12-28 00:19:52 -08:00
|
|
|
}
|
|
|
|
else if (cfd->view_type == E_CONFIG_DIALOG_CFDATA_TYPE_ADVANCED)
|
2012-06-26 01:40:08 -07:00
|
|
|
{
|
|
|
|
if (cfd->view->advanced.check_changed)
|
|
|
|
changed = cfd->view->advanced.check_changed(cfd, cfd->cfdata);
|
|
|
|
else
|
|
|
|
changed = def;
|
|
|
|
}
|
2009-12-28 00:19:52 -08:00
|
|
|
|
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
|
2008-09-21 09:21:25 -07:00
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_config_dialog_cb_changed(void *data, Evas_Object *obj EINA_UNUSED)
|
2008-09-21 09:21:25 -07:00
|
|
|
{
|
2010-08-18 12:48:57 -07:00
|
|
|
E_Config_Dialog *cfd;
|
2009-12-28 00:19:52 -08:00
|
|
|
int changed;
|
2008-09-21 10:08:30 -07:00
|
|
|
|
2010-08-18 12:48:57 -07:00
|
|
|
cfd = data;
|
2009-04-21 10:57:38 -07:00
|
|
|
if (!cfd->cfg_changed_auto) return;
|
2009-12-28 00:19:52 -08:00
|
|
|
changed = _e_config_dialog_check_changed(cfd, 1);
|
2008-09-21 10:08:30 -07:00
|
|
|
|
|
|
|
e_config_dialog_changed_set(cfd, changed);
|
2005-10-16 00:32:12 -07:00
|
|
|
}
|
2006-01-21 04:44:48 -08:00
|
|
|
|
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_config_dialog_cb_close(void *data EINA_UNUSED, E_Dialog *dia)
|
2006-01-21 04:44:48 -08:00
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd;
|
|
|
|
int ok = 1;
|
|
|
|
|
|
|
|
cfd = dia->data;
|
2006-05-10 03:17:59 -07:00
|
|
|
if (cfd->auto_apply_timer) _e_config_dialog_cb_auto_apply_timer(cfd);
|
2006-01-22 06:18:20 -08:00
|
|
|
if (cfd->view->close_cfdata)
|
2006-10-04 19:57:33 -07:00
|
|
|
ok = cfd->view->close_cfdata(cfd, cfd->cfdata);
|
2009-04-21 10:57:38 -07:00
|
|
|
if (ok) e_util_defer_object_del(E_OBJECT(cfd));
|
2006-01-21 04:44:48 -08:00
|
|
|
}
|
2008-09-21 09:21:25 -07:00
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2008-09-21 09:21:25 -07:00
|
|
|
e_config_dialog_changed_auto_set(E_Config_Dialog *cfd, unsigned char value)
|
|
|
|
{
|
2009-04-21 10:57:38 -07:00
|
|
|
if (!cfd) return;
|
2008-09-21 09:21:25 -07:00
|
|
|
cfd->cfg_changed_auto = !!value;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2008-09-21 09:21:25 -07:00
|
|
|
e_config_dialog_changed_set(E_Config_Dialog *cfd, unsigned char value)
|
|
|
|
{
|
2009-04-21 10:57:38 -07:00
|
|
|
if (!cfd) return;
|
2008-09-21 09:21:25 -07:00
|
|
|
cfd->cfg_changed = !!value;
|
|
|
|
if (cfd->cfg_changed)
|
|
|
|
_e_config_dialog_changed(cfd);
|
|
|
|
else
|
2008-09-21 10:08:30 -07:00
|
|
|
_e_config_dialog_unchanged(cfd);
|
2008-09-21 09:21:25 -07:00
|
|
|
}
|
2012-06-26 01:40:08 -07:00
|
|
|
|