diff options
author | Gustavo Sverzut Barbieri <barbieri@gmail.com> | 2009-07-12 00:24:11 +0000 |
---|---|---|
committer | Gustavo Sverzut Barbieri <barbieri@gmail.com> | 2009-07-12 00:24:11 +0000 |
commit | e9942f09de06f5c787686545e2f5411f6f79d80b (patch) | |
tree | 054c9bd994da0f7b90868979cf4f820b574c9dd4 /src/bin/e_config_dialog.c | |
parent | 9da81cfce6df5b4e4605a6121f7e19b8ad916f87 (diff) | |
download | enlightenment-e9942f09de06f5c787686545e2f5411f6f79d80b.tar.gz |
e_config_dialog: reuse e_dialog on changes between basic and advanced.
This patch will reuse the same e_dialog and thus window while changing
contents between basic and advanced. The benefit, among many, is to
avoid titlebar flashing like hell when you click the toggle button.
By: manio
SVN revision: 41314
Diffstat (limited to 'src/bin/e_config_dialog.c')
-rw-r--r-- | src/bin/e_config_dialog.c | 83 |
1 files changed, 33 insertions, 50 deletions
diff --git a/src/bin/e_config_dialog.c b/src/bin/e_config_dialog.c index cc18623ccb..cf02f84d1b 100644 --- a/src/bin/e_config_dialog.c +++ b/src/bin/e_config_dialog.c @@ -94,7 +94,6 @@ e_config_dialog_find(const char *name, const char *class) z = e_util_zone_current_get(e_manager_current_get()); e_border_uniconify(cfd->dia->win->border); - e_dialog_show(cfd->dia); e_win_raise(cfd->dia->win); if (z->container == cfd->dia->win->border->zone->container) e_border_desk_set(cfd->dia->win->border, e_desk_current_get(z)); @@ -172,12 +171,19 @@ _e_config_dialog_go(E_Config_Dialog *cfd, E_Config_Dialog_CFData_Type type) snprintf(buf, sizeof(buf), "%s...%s", cfd->class, "BASIC"); else snprintf(buf, sizeof(buf), "%s...%s", cfd->class, "ADVANCED"); - if ((cfd->view->normal_win) || (e_config->cfgdlg_normal_wins)) - cfd->dia = e_dialog_normal_win_new(cfd->con, cfd->name, buf); - else - cfd->dia = e_dialog_new(cfd->con, cfd->name, buf); + + if (!pdia) /* creating window for the first time */ + { + if ((cfd->view->normal_win) || (e_config->cfgdlg_normal_wins)) + cfd->dia = e_dialog_normal_win_new(cfd->con, cfd->name, buf); + else + cfd->dia = e_dialog_new(cfd->con, cfd->name, buf); + e_object_del_attach_func_set(E_OBJECT(cfd->dia), _e_config_dialog_cb_dialog_del); + } /* window was created before - deleting content only */ + else if (cfd->dia->content_object) + evas_object_del(cfd->dia->content_object); + cfd->dia->data = cfd; - e_object_del_attach_func_set(E_OBJECT(cfd->dia), _e_config_dialog_cb_dialog_del); e_dialog_title_set(cfd->dia, cfd->title); if (!cfd->cfdata) cfd->cfdata = cfd->view->create_cfdata(cfd); @@ -243,52 +249,29 @@ _e_config_dialog_go(E_Config_Dialog *cfd, E_Config_Dialog_CFData_Type type) e_widget_min_size_get(o, &mw, &mh); e_widget_on_change_hook_set(o, _e_config_dialog_cb_changed, cfd); e_dialog_content_set(cfd->dia, o, mw, mh); - - 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); - if (!pdia) - { - if (!cfd->view->normal_win) - e_win_centered_set(cfd->dia->win, 1); - e_dialog_show(cfd->dia); - if (cfd->icon) e_dialog_border_icon_set(cfd->dia, cfd->icon); - } - else - { - int x, y; - - e_dialog_show(cfd->dia); - if (cfd->icon) e_dialog_border_icon_set(cfd->dia, cfd->icon); - x = pdia->win->x; - y = pdia->win->y; - if (x < 0) x = 0; - if (y < 0) y = 0; - if ((x + cfd->dia->win->w) > (pdia->win->container->w)) - x = pdia->win->container->w - cfd->dia->win->w; - if ((y + cfd->dia->win->h) > (pdia->win->container->h)) - y = pdia->win->container->h - cfd->dia->win->h; - e_win_move(cfd->dia->win, x, y); - e_win_placed_set(cfd->dia->win, 1); - } - cfd->view_type = type; - if (pdia) + if (!pdia) /* dialog window was created in this function call - need to create buttons once */ { - e_object_del_attach_func_set(E_OBJECT(pdia), NULL); - e_util_defer_object_del(E_OBJECT(pdia)); - } + 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); + } + + e_dialog_show(cfd->dia); + if (cfd->icon) e_dialog_border_icon_set(cfd->dia, cfd->icon); + + cfd->view_type = type; } static int |