2005-09-19 08:25:23 -07:00
|
|
|
#include "e.h"
|
|
|
|
|
2005-11-11 21:27:58 -08:00
|
|
|
typedef struct _E_Configure_CB E_Configure_CB;
|
|
|
|
|
|
|
|
struct _E_Configure_CB
|
|
|
|
{
|
|
|
|
E_Configure *eco;
|
|
|
|
E_Config_Dialog *(*func) (E_Container *con);
|
|
|
|
};
|
|
|
|
|
2005-09-20 06:12:25 -07:00
|
|
|
static void _e_configure_free(E_Configure *app);
|
2005-11-11 21:27:58 -08:00
|
|
|
static void _e_configure_cb_del_req(E_Win *win);
|
2005-09-20 06:12:25 -07:00
|
|
|
static void _e_configure_cb_resize(E_Win *win);
|
2005-11-11 21:27:58 -08:00
|
|
|
static void _e_configure_cb_standard(void *data);
|
2005-09-20 06:12:25 -07:00
|
|
|
|
2005-09-19 08:25:23 -07:00
|
|
|
E_Configure *
|
|
|
|
e_configure_show(E_Container *con)
|
|
|
|
{
|
2005-11-11 21:27:58 -08:00
|
|
|
E_Configure *eco;
|
2005-09-20 06:12:25 -07:00
|
|
|
E_Manager *man;
|
|
|
|
Evas_Coord w, h, ew, eh;
|
|
|
|
|
|
|
|
if (!con)
|
2005-10-08 21:22:19 -07:00
|
|
|
{
|
|
|
|
man = e_manager_current_get();
|
|
|
|
if (!man) return NULL;
|
|
|
|
con = e_container_current_get(man);
|
|
|
|
if (!con) con = e_container_number_get(man, 0);
|
|
|
|
if (!con) return NULL;
|
|
|
|
}
|
2005-11-11 21:27:58 -08:00
|
|
|
|
|
|
|
eco = E_OBJECT_ALLOC(E_Configure, E_CONFIGURE_TYPE, _e_configure_free);
|
|
|
|
if (!eco) return NULL;
|
|
|
|
eco->win = e_win_new(con);
|
|
|
|
if (!eco->win)
|
2005-10-08 21:22:19 -07:00
|
|
|
{
|
2005-11-11 21:27:58 -08:00
|
|
|
free(eco);
|
2005-10-08 21:22:19 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
2005-11-11 21:27:58 -08:00
|
|
|
eco->win->data = eco;
|
2005-10-08 21:22:19 -07:00
|
|
|
|
2005-11-11 21:27:58 -08:00
|
|
|
eco->con = con;
|
2005-09-20 06:12:25 -07:00
|
|
|
|
2005-11-11 21:27:58 -08:00
|
|
|
e_win_title_set(eco->win, _("Enlightenment Configuration"));
|
|
|
|
e_win_name_class_set(eco->win, "E", "_configure");
|
|
|
|
eco->evas = e_win_evas_get(eco->win);
|
|
|
|
e_win_delete_callback_set(eco->win, _e_configure_cb_del_req);
|
|
|
|
e_win_resize_callback_set(eco->win, _e_configure_cb_resize);
|
|
|
|
e_win_centered_set(eco->win, 1);
|
2005-09-20 06:12:25 -07:00
|
|
|
|
2005-11-11 21:27:58 -08:00
|
|
|
eco->edje = edje_object_add(eco->evas);
|
|
|
|
e_theme_edje_object_set(eco->edje, "base/theme/configure",
|
|
|
|
"widgets/configure/main");
|
2005-10-08 21:22:19 -07:00
|
|
|
|
2005-11-11 21:27:58 -08:00
|
|
|
eco->ilist = e_widget_ilist_add(eco->evas, 48, 48, NULL);
|
|
|
|
e_widget_ilist_selector_set(eco->ilist, 1);
|
|
|
|
edje_object_part_swallow(eco->edje, "item", eco->ilist);
|
|
|
|
edje_object_part_text_set(eco->edje, "title", _("Configuration Panel"));
|
|
|
|
|
|
|
|
/* add items here */
|
|
|
|
e_configure_standard_item_add(eco, "enlightenment/e", _("Focus Settings"), e_int_config_focus);
|
2005-12-19 17:01:52 -08:00
|
|
|
e_configure_standard_item_add(eco, "enlightenment/desktops", _("Desktop Settings"), e_int_config_desks);
|
|
|
|
e_configure_standard_item_add(eco, "enlightenment/favorites", _("Menu Settings"), e_int_config_menus);
|
|
|
|
e_configure_standard_item_add(eco, "enlightenment/windows", _("Window Manipulation"), e_int_config_window_manipulation);
|
|
|
|
e_configure_standard_item_add(eco, "enlightenment/windows", _("Window Display"), e_int_config_window_display);
|
2005-12-18 02:44:55 -08:00
|
|
|
e_configure_standard_item_add(eco, "enlightenment/desktops", _("Background Settings"), e_int_config_background);
|
2005-12-19 06:42:43 -08:00
|
|
|
e_configure_standard_item_add(eco, "enlightenment/themes", _("Theme Selector"), e_int_config_theme);
|
2005-12-17 03:21:54 -08:00
|
|
|
e_configure_standard_item_add(eco, "enlightenment/modules", _("Module Settings"), e_int_config_modules);
|
2005-11-18 22:10:52 -08:00
|
|
|
|
2005-11-11 21:27:58 -08:00
|
|
|
/* FIXME: we should have a way for modules to hook in here and add their
|
|
|
|
* own entries
|
|
|
|
*/
|
|
|
|
|
|
|
|
edje_object_size_min_calc(eco->edje, &ew, &eh);
|
|
|
|
e_win_resize(eco->win, ew, eh);
|
|
|
|
e_win_size_min_set(eco->win, ew, eh);
|
2005-09-19 16:55:44 -07:00
|
|
|
|
2005-11-11 21:27:58 -08:00
|
|
|
evas_object_show(eco->ilist);
|
|
|
|
evas_object_show(eco->edje);
|
2005-09-20 06:12:25 -07:00
|
|
|
|
2005-11-11 21:27:58 -08:00
|
|
|
e_win_show(eco->win);
|
2005-09-20 06:12:25 -07:00
|
|
|
|
2005-11-11 21:27:58 -08:00
|
|
|
e_widget_focus_set(eco->ilist, 1);
|
|
|
|
e_widget_ilist_go(eco->ilist);
|
|
|
|
|
|
|
|
return eco;
|
2005-09-19 08:25:23 -07:00
|
|
|
}
|
|
|
|
|
2005-11-11 21:27:58 -08:00
|
|
|
void
|
|
|
|
e_configure_standard_item_add(E_Configure *eco, char *icon, char *label, E_Config_Dialog *(*func) (E_Container *con))
|
2005-09-19 08:25:23 -07:00
|
|
|
{
|
2005-11-11 21:27:58 -08:00
|
|
|
Evas_Object *o;
|
|
|
|
E_Configure_CB *ecocb;
|
|
|
|
|
|
|
|
o = edje_object_add(eco->evas);
|
|
|
|
e_util_edje_icon_set(o, icon);
|
|
|
|
ecocb = E_NEW(E_Configure_CB, 1);
|
|
|
|
ecocb->eco = eco;
|
|
|
|
ecocb->func = func;
|
|
|
|
eco->cblist = evas_list_append(eco->cblist, ecocb);
|
|
|
|
e_widget_ilist_append(eco->ilist, o, label, _e_configure_cb_standard, ecocb, NULL);
|
2005-09-19 08:25:23 -07:00
|
|
|
}
|
|
|
|
|
2005-11-11 21:27:58 -08:00
|
|
|
/* local subsystem functions */
|
2005-09-19 08:25:23 -07:00
|
|
|
static void
|
2005-11-11 21:27:58 -08:00
|
|
|
_e_configure_free(E_Configure *eco)
|
2005-09-19 08:25:23 -07:00
|
|
|
{
|
2005-11-11 21:27:58 -08:00
|
|
|
while (eco->cblist)
|
2005-09-19 08:25:23 -07:00
|
|
|
{
|
2005-11-11 21:27:58 -08:00
|
|
|
free(eco->cblist->data);
|
|
|
|
eco->cblist = evas_list_remove_list(eco->cblist, eco->cblist);
|
2005-09-19 08:25:23 -07:00
|
|
|
}
|
2005-11-11 21:27:58 -08:00
|
|
|
evas_object_del(eco->edje);
|
|
|
|
evas_object_del(eco->ilist);
|
|
|
|
e_object_del(E_OBJECT(eco->win));
|
|
|
|
free(eco);
|
2005-09-19 08:25:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-11-11 21:27:58 -08:00
|
|
|
_e_configure_cb_del_req(E_Win *win)
|
2005-09-19 08:25:23 -07:00
|
|
|
{
|
2005-11-11 21:27:58 -08:00
|
|
|
E_Configure *eco;
|
2005-09-19 08:25:23 -07:00
|
|
|
|
2005-11-11 21:27:58 -08:00
|
|
|
eco = win->data;
|
|
|
|
if (eco) e_object_del(E_OBJECT(eco));
|
2005-09-19 08:25:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-11-11 21:27:58 -08:00
|
|
|
_e_configure_cb_resize(E_Win *win)
|
2005-09-19 08:25:23 -07:00
|
|
|
{
|
2005-11-11 21:27:58 -08:00
|
|
|
Evas_Coord w, h;
|
|
|
|
E_Configure *eco;
|
|
|
|
|
|
|
|
ecore_evas_geometry_get(win->ecore_evas, NULL, NULL, &w, &h);
|
|
|
|
eco = win->data;
|
|
|
|
evas_object_resize(eco->edje, w, h);
|
2005-09-19 08:25:23 -07:00
|
|
|
}
|
2005-09-20 06:12:25 -07:00
|
|
|
|
|
|
|
static void
|
2005-11-11 21:27:58 -08:00
|
|
|
_e_configure_cb_standard(void *data)
|
2005-09-20 06:12:25 -07:00
|
|
|
{
|
2005-11-11 21:27:58 -08:00
|
|
|
E_Configure_CB *ecocb;
|
|
|
|
|
|
|
|
ecocb = data;
|
|
|
|
ecocb->func(ecocb->eco->con);
|
2005-09-20 06:12:25 -07:00
|
|
|
}
|