#include "e.h"
-static void _e_configure_gui_hide(E_Win *win);
-static void _e_configure_apps_load(E_Configure *app);
-static void _e_configure_apps_unload(E_Configure *app);
+typedef struct _E_Configure_CB E_Configure_CB;
+
+struct _E_Configure_CB
+{
+ E_Configure *eco;
+ E_Config_Dialog *(*func) (E_Container *con);
+};
+
static void _e_configure_free(E_Configure *app);
-static void _e_configure_apps_click(void *data, Evas_Object *obj, const char *emission, const char *source);
+static void _e_configure_cb_del_req(E_Win *win);
static void _e_configure_cb_resize(E_Win *win);
+static void _e_configure_cb_standard(void *data);
-
E_Configure *
e_configure_show(E_Container *con)
{
- E_Configure *app;
+ E_Configure *eco;
E_Manager *man;
Evas_Coord w, h, ew, eh;
if (!con) con = e_container_number_get(man, 0);
if (!con) return NULL;
}
- app = E_OBJECT_ALLOC(E_Configure, E_CONFIGURE_TYPE, _e_configure_free);
- if (!app) return NULL;
- app->win = e_win_new(con);
- if (!app->win)
+
+ 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)
{
- free(app);
+ free(eco);
return NULL;
}
+ eco->win->data = eco;
- app->con = con;
+ eco->con = con;
- e_win_delete_callback_set(app->win, _e_configure_gui_hide);
- e_win_title_set(app->win, _("Enlightenment Configuration"));
- e_win_name_class_set(app->win, "E", "_configure");
- app->evas = e_win_evas_get(app->win);
- ecore_evas_data_set(app->win->ecore_evas, "App", app);
- e_win_resize_callback_set(app->win, _e_configure_cb_resize);
- e_win_centered_set(app->win, 1);
+ 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);
- app->edje = edje_object_add(app->evas);
-
- e_theme_edje_object_set(app->edje, "base/theme/configure", "widgets/configure/main");
-
- app->box = e_box_add(app->evas);
-
- e_box_homogenous_set (app->box, 0);
-
- app->apps = e_app_new(PACKAGE_DATA_DIR "/config-apps", 0);
- app->icons = NULL;
- app->app_ref = NULL;
- _e_configure_apps_load(app);
-
- e_box_orientation_set(app->box, 1);
- e_box_align_set(app->box, 0.0, 0.0);
-
- edje_object_size_min_calc (app->edje, &ew, &eh);
- e_box_min_size_get(app->box, &w, &h);
-
- if (ew > w )
- w = ew;
- if (eh > h)
- h = eh;
+ eco->edje = edje_object_add(eco->evas);
+ e_theme_edje_object_set(eco->edje, "base/theme/configure",
+ "widgets/configure/main");
- edje_extern_object_min_size_set(app->box, w, h);
- e_win_size_base_set (app->win, w , h + eh);
- e_win_size_min_set (app->win, w, h + eh);
- e_win_resize(app->win, w, h + eh);
+ 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);
+ /* 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);
- edje_object_part_swallow(app->edje, "icon_swallow", app->box);
- evas_object_show(app->box);
-
- evas_object_show(app->edje);
-
- e_win_show(app->win);
-
+ evas_object_show(eco->ilist);
+ evas_object_show(eco->edje);
- return app;
-}
-
-static void
-_e_configure_cb_resize(E_Win *win)
-{
- Evas_Coord w, h;
- E_Configure *app;
+ e_win_show(eco->win);
- if (win)
- {
- ecore_evas_geometry_get(win->ecore_evas, NULL, NULL, &w, &h);
-
- app = (E_Configure *)ecore_evas_data_get(win->ecore_evas, "App");
- evas_object_resize(app->edje, w, h);
- }
+ e_widget_focus_set(eco->ilist, 1);
+ e_widget_ilist_go(eco->ilist);
+
+ return eco;
}
-
-
-static void
-_e_configure_gui_hide(E_Win *win)
+void
+e_configure_standard_item_add(E_Configure *eco, char *icon, char *label, E_Config_Dialog *(*func) (E_Container *con))
{
- E_Configure *app;
-
- app = (E_Configure *) ecore_evas_data_get(win->ecore_evas, "App");
- if (app)
- {
- _e_configure_apps_unload(app);
-
- edje_object_part_unswallow(app->edje, app->box);
- evas_object_del(app->box);
- evas_object_del(app->edje);
- e_object_del(E_OBJECT(app->win));
- }
+ 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);
}
+/* local subsystem functions */
static void
-_e_configure_apps_load(E_Configure *app)
+_e_configure_free(E_Configure *eco)
{
- E_App *a;
- Evas_List *l;
- Evas_Object *o, *icon;
- Evas_Coord w, h;
-
- if (!app->apps) return;
- e_app_subdir_scan(app->apps, 0);
- for (l = app->apps->subapps; l; l = l->next)
+ while (eco->cblist)
{
- a = l->data;
- e_object_ref(E_OBJECT(a));
- app->app_ref = evas_list_append(app->app_ref, a);
-
- o = edje_object_add(app->evas);
- e_theme_edje_object_set(o, "base/theme/configure", "widgets/configure/icon");
- icon = edje_object_add(app->evas);
- edje_object_file_set(icon, a->path, "icon");
-
- edje_extern_object_min_size_set(icon, 48, 48);
-
- edje_object_part_swallow(o, "icon_swallow", icon);
- edje_object_part_text_set(o, "title", a->name);
- evas_object_show(icon);
-
- edje_object_size_min_calc (o, &w, &h);
- edje_extern_object_min_size_set (o, w, h);
- e_box_pack_end(app->box, o);
- e_box_pack_options_set(o,
- 1, 0, /* fill */
- 1, 0, /* expand */
- 0.0, 0.0, /* align */
- w, h, /* min */
- 999, 999 //172, 72 /* max */
- );
-
- evas_object_show(o);
- app->icons = evas_list_append(app->icons, o);
- edje_object_signal_callback_add(o, "clicked", "",
- _e_configure_apps_click, a);
+ free(eco->cblist->data);
+ eco->cblist = evas_list_remove_list(eco->cblist, eco->cblist);
}
+ evas_object_del(eco->edje);
+ evas_object_del(eco->ilist);
+ e_object_del(E_OBJECT(eco->win));
+ free(eco);
}
static void
-_e_configure_apps_unload(E_Configure *app)
+_e_configure_cb_del_req(E_Win *win)
{
- E_App *a;
-
-/* while(app->icons)
- {
- icon = evas_list_data(app->icons);
-// FIXME unswallow icon and free
+ E_Configure *eco;
- app->icons = evas_list_remove(app->icons, icon);
- evas_object_del(icon);
- }*/
- while (app->app_ref)
- {
- a = evas_list_data(app->app_ref);
-
- app->app_ref = evas_list_remove(app->app_ref, a);
- e_object_unref(E_OBJECT(a));
- }
+ eco = win->data;
+ if (eco) e_object_del(E_OBJECT(eco));
}
static void
-_e_configure_apps_click(void *data, Evas_Object *obj, const char *emission, const char *source)
+_e_configure_cb_resize(E_Win *win)
{
- E_App *a;
-
- a = data;
- if (a)
- {
- Ecore_Exe *exe;
-
- exe = ecore_exe_run(a->exe, NULL);
- if (exe) ecore_exe_free(exe);
- }
+ 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);
}
static void
-_e_configure_free(E_Configure *app)
+_e_configure_cb_standard(void *data)
{
- _e_configure_apps_unload(app);
- e_object_del(E_OBJECT(app->win));
- free(app);
+ E_Configure_CB *ecocb;
+
+ ecocb = data;
+ ecocb->func(ecocb->eco->con);
}
Evas_List *items;
int selected;
Evas_Coord icon_w, icon_h;
+ unsigned char selector : 1;
};
struct _E_Smart_Item
/* local subsystem functions */
static void _e_smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void _e_smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_event_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_reconfigure(E_Smart_Data *sd);
static void _e_smart_add(Evas_Object *obj);
mw, mh, /* min */
99999, 99999 /* max */
);
- if (sd->selected == (evas_list_count(sd->items) - 1))
- {
- edje_object_signal_emit(si->base_obj, "active", "");
- if (si->func) si->func(si->data, si->data2);
- }
evas_object_lower(si->base_obj);
evas_object_event_callback_add(si->base_obj, EVAS_CALLBACK_MOUSE_DOWN, _e_smart_event_mouse_down, si);
+ evas_object_event_callback_add(si->base_obj, EVAS_CALLBACK_MOUSE_UP, _e_smart_event_mouse_up, si);
evas_object_show(si->base_obj);
}
{
evas_object_raise(si->base_obj);
edje_object_signal_emit(si->base_obj, "active", "");
- if (si->func) si->func(si->data, si->data2);
+ if (!sd->selector)
+ {
+ if (si->func) si->func(si->data, si->data2);
+ }
}
}
e_box_min_size_get(sd->box_obj, w, h);
}
+void
+e_ilist_selector_set(Evas_Object *obj, int selector)
+{
+ API_ENTRY return;
+ sd->selector = selector;
+}
+
+int
+e_ilist_selector_get(Evas_Object *obj)
+{
+ API_ENTRY return 0;
+ return sd->selector;
+}
+
/* local subsystem functions */
static void
_e_smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
}
}
+static void
+_e_smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Mouse_Up *ev;
+ E_Smart_Item *si;
+
+ si = data;
+ ev = event_info;
+ if (si->sd->selector)
+ {
+ si = evas_list_nth(si->sd->items, si->sd->selected);
+ if (si)
+ {
+ if (si->func) si->func(si->data, si->data2);
+ }
+ }
+}
+
static void
_e_smart_event_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
n = e_ilist_select_get(sd->smart_obj);
e_ilist_select_set(sd->smart_obj, n + 1);
}
+ else if ((!strcmp(ev->keyname, "Return")) ||
+ (!strcmp(ev->keyname, "space")))
+ {
+ E_Smart_Item *si;
+
+ si = evas_list_nth(sd->items, sd->selected);
+ if (si)
+ {
+ if (si->func) si->func(si->data, si->data2);
+ }
+ }
}
static void
sd->icon_w = 24;
sd->icon_h = 24;
+ sd->selected = -1;
+
sd->box_obj = e_box_add(evas_object_evas_get(obj));
e_box_align_set(sd->box_obj, 0.0, 0.0);
e_box_homogenous_set(sd->box_obj, 0);