aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2010-03-03 04:10:04 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2010-03-03 04:10:04 +0000
commit073a946433c4a3eeace00d289df9630265ec974d (patch)
tree2b4cd54ab277d0144c7d30de2fe81b80a34c91b3 /src/bin
parentRevert frametable change. Need better organization here. (diff)
downloadenlightenment-073a946433c4a3eeace00d289df9630265ec974d.tar.gz
new, single list module loader dialog.
This dialog was reworked to have one single list instead of two. This makes the internals way simpler and also fits small screens. Extra benefit is that we don't need to reload the list, so it's flicker-free and you don't loose context. Of course it will save some cpu cycles not having to do these list fills over and over again. the ilist had to be changed to include an "end" object, in the default theme it is at the right. It will use a part named e/widget/ilist/toggle_end to present the selected state. (The favorites/heart icon was choosen because it is red and thus easily visible in both black and white background -- selected/unselected). SVN revision: 46813
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/e_ilist.c172
-rw-r--r--src/bin/e_ilist.h14
-rw-r--r--src/bin/e_int_config_modules.c933
-rw-r--r--src/bin/e_widget_ilist.c176
-rw-r--r--src/bin/e_widget_ilist.h19
5 files changed, 734 insertions, 580 deletions
diff --git a/src/bin/e_ilist.c b/src/bin/e_ilist.c
index 6a52d4013..a4d1aeb83 100644
--- a/src/bin/e_ilist.c
+++ b/src/bin/e_ilist.c
@@ -59,7 +59,7 @@ e_ilist_add(Evas *evas)
}
EAPI void
-e_ilist_append(Evas_Object *obj, Evas_Object *icon, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2)
+e_ilist_append(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2)
{
E_Ilist_Item *si;
Evas_Coord mw = 0, mh = 0;
@@ -103,6 +103,20 @@ e_ilist_append(Evas_Object *obj, Evas_Object *icon, const char *label, int heade
edje_object_part_swallow(si->o_base, "e.swallow.icon", si->o_icon);
evas_object_show(si->o_icon);
}
+ si->o_end = end;
+ if (si->o_end)
+ {
+ Evas_Coord ew = 0, eh = 0;
+ evas_object_size_hint_min_get(si->o_end, &ew, &eh);
+ if ((ew <= 0) || (eh <= 0))
+ {
+ ew = sd->iw;
+ eh = sd->ih;
+ }
+ edje_extern_object_min_size_set(si->o_end, ew, eh);
+ edje_object_part_swallow(si->o_base, "e.swallow.end", si->o_end);
+ evas_object_show(si->o_end);
+ }
si->func = func;
si->func_hilight = func_hilight;
si->data = data;
@@ -132,7 +146,7 @@ e_ilist_append(Evas_Object *obj, Evas_Object *icon, const char *label, int heade
}
EAPI void
-e_ilist_append_relative(Evas_Object *obj, Evas_Object *icon, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2, int relative)
+e_ilist_append_relative(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2, int relative)
{
E_Ilist_Item *si, *ri;
Evas_Coord mw = 0, mh = 0;
@@ -176,6 +190,20 @@ e_ilist_append_relative(Evas_Object *obj, Evas_Object *icon, const char *label,
edje_object_part_swallow(si->o_base, "e.swallow.icon", si->o_icon);
evas_object_show(si->o_icon);
}
+ si->o_end = end;
+ if (si->o_end)
+ {
+ Evas_Coord ew = 0, eh = 0;
+ evas_object_size_hint_min_get(si->o_end, &ew, &eh);
+ if ((ew <= 0) || (eh <= 0))
+ {
+ ew = sd->iw;
+ eh = sd->ih;
+ }
+ edje_extern_object_min_size_set(si->o_end, ew, eh);
+ edje_object_part_swallow(si->o_base, "e.swallow.end", si->o_end);
+ evas_object_show(si->o_end);
+ }
si->func = func;
si->func_hilight = func_hilight;
si->data = data;
@@ -213,7 +241,7 @@ e_ilist_append_relative(Evas_Object *obj, Evas_Object *icon, const char *label,
}
EAPI void
-e_ilist_prepend(Evas_Object *obj, Evas_Object *icon, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2)
+e_ilist_prepend(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2)
{
E_Ilist_Item *si;
Evas_Coord mw = 0, mh = 0;
@@ -241,6 +269,20 @@ e_ilist_prepend(Evas_Object *obj, Evas_Object *icon, const char *label, int head
edje_object_part_swallow(si->o_base, "e.swallow.icon", si->o_icon);
evas_object_show(si->o_icon);
}
+ si->o_end = end;
+ if (si->o_end)
+ {
+ Evas_Coord ew = 0, eh = 0;
+ evas_object_size_hint_min_get(si->o_end, &ew, &eh);
+ if ((ew <= 0) || (eh <= 0))
+ {
+ ew = sd->iw;
+ eh = sd->ih;
+ }
+ edje_extern_object_min_size_set(si->o_end, ew, eh);
+ edje_object_part_swallow(si->o_base, "e.swallow.end", si->o_end);
+ evas_object_show(si->o_end);
+ }
si->func = func;
si->func_hilight = func_hilight;
si->data = data;
@@ -264,7 +306,7 @@ e_ilist_prepend(Evas_Object *obj, Evas_Object *icon, const char *label, int head
}
EAPI void
-e_ilist_prepend_relative(Evas_Object *obj, Evas_Object *icon, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2, int relative)
+e_ilist_prepend_relative(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2, int relative)
{
E_Ilist_Item *si, *ri;
Evas_Coord mw = 0, mh = 0;
@@ -292,6 +334,20 @@ e_ilist_prepend_relative(Evas_Object *obj, Evas_Object *icon, const char *label,
edje_object_part_swallow(si->o_base, "e.swallow.icon", si->o_icon);
evas_object_show(si->o_icon);
}
+ si->o_end = end;
+ if (si->o_end)
+ {
+ Evas_Coord ew = 0, eh = 0;
+ evas_object_size_hint_min_get(si->o_end, &ew, &eh);
+ if ((ew <= 0) || (eh <= 0))
+ {
+ ew = sd->iw;
+ eh = sd->ih;
+ }
+ edje_extern_object_min_size_set(si->o_end, ew, eh);
+ edje_object_part_swallow(si->o_base, "e.swallow.end", si->o_end);
+ evas_object_show(si->o_end);
+ }
si->func = func;
si->func_hilight = func_hilight;
si->data = data;
@@ -334,6 +390,7 @@ e_ilist_clear(Evas_Object *obj)
{
if (!si) continue;
if (si->o_icon) evas_object_del(si->o_icon);
+ if (si->o_end) evas_object_del(si->o_end);
evas_object_del(si->o_base);
E_FREE(si);
}
@@ -558,6 +615,20 @@ e_ilist_selected_icon_get(Evas_Object *obj)
return NULL;
}
+EAPI Evas_Object *
+e_ilist_selected_end_get(Evas_Object *obj)
+{
+ E_Ilist_Item *si = NULL;
+
+ API_ENTRY return NULL;
+ if (!sd->items) return NULL;
+ if (sd->multi_select) return NULL;
+ if (sd->selected < 0) return NULL;
+ si = eina_list_nth(sd->items, sd->selected);
+ if (si) return si->o_end;
+ return NULL;
+}
+
EAPI void
e_ilist_selected_geometry_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
{
@@ -605,6 +676,7 @@ e_ilist_remove_num(Evas_Object *obj, int n)
if (sd->selected == n) sd->selected = -1;
if (si->o_icon) evas_object_del(si->o_icon);
+ if (si->o_end) evas_object_del(si->o_end);
evas_object_del(si->o_base);
E_FREE(si);
}
@@ -669,7 +741,41 @@ e_ilist_nth_icon_set(Evas_Object *obj, int n, Evas_Object *icon)
}
}
-EAPI int
+EAPI Evas_Object *
+e_ilist_nth_end_get(Evas_Object *obj, int n)
+{
+ E_Ilist_Item *si = NULL;
+
+ API_ENTRY return NULL;
+ if (!sd->items) return NULL;
+ si = eina_list_nth(sd->items, n);
+ if (si) return si->o_end;
+ return NULL;
+}
+
+EAPI void
+e_ilist_nth_end_set(Evas_Object *obj, int n, Evas_Object *end)
+{
+ E_Ilist_Item *si = NULL;
+
+ API_ENTRY return;
+ if (!sd->items) return;
+ if (!(si = eina_list_nth(sd->items, n))) return;
+ if (si->o_end)
+ {
+ edje_object_part_unswallow(si->o_base, si->o_end);
+ evas_object_del(si->o_end);
+ }
+ si->o_end = end;
+ if (si->o_end)
+ {
+ edje_extern_object_min_size_set(si->o_end, sd->iw, sd->ih);
+ edje_object_part_swallow(si->o_base, "e.swallow.end", si->o_end);
+ evas_object_show(si->o_end);
+ }
+}
+
+EAPI Eina_Bool
e_ilist_nth_is_header(Evas_Object *obj, int n)
{
E_Ilist_Item *si = NULL;
@@ -712,6 +818,19 @@ e_ilist_icon_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
if (!si->o_icon) continue;
edje_extern_object_min_size_set(si->o_icon, w, h);
edje_object_part_swallow(si->o_base, "e.swallow.icon", si->o_icon);
+
+ if (si->o_end)
+ {
+ Evas_Coord ew = 0, eh = 0;
+ evas_object_size_hint_min_get(si->o_end, &ew, &eh);
+ if ((ew <= 0) || (eh <= 0))
+ {
+ ew = w;
+ eh = h;
+ }
+ edje_extern_object_min_size_set(si->o_end, ew, eh);
+ }
+
edje_object_size_min_calc(si->o_base, &mw, &mh);
e_box_pack_options_set(si->o_icon, 1, 1, 1, 0, 0.5, 0.5,
mw, mh, 99999, 99999);
@@ -806,24 +925,19 @@ _e_smart_init(void)
{
if (_e_smart) return;
{
- static const Evas_Smart_Class sc =
+ static Evas_Smart_Class sc = EVAS_SMART_CLASS_INIT_NAME_VERSION(SMART_NAME);
+ if (!sc.add)
{
- SMART_NAME,
- EVAS_SMART_CLASS_VERSION,
- _e_smart_add,
- _e_smart_del,
- _e_smart_move,
- _e_smart_resize,
- _e_smart_show,
- _e_smart_hide,
- _e_smart_color_set,
- _e_smart_clip_set,
- _e_smart_clip_unset,
- NULL,
- NULL,
- NULL,
- NULL
- };
+ sc.add = _e_smart_add;
+ sc.del = _e_smart_del;
+ sc.move = _e_smart_move;
+ sc.resize = _e_smart_resize;
+ sc.show = _e_smart_show;
+ sc.hide = _e_smart_hide;
+ sc.color_set = _e_smart_color_set;
+ sc.clip_set = _e_smart_clip_set;
+ sc.clip_unset = _e_smart_clip_unset;
+ }
_e_smart = evas_smart_class_new(&sc);
}
}
@@ -930,8 +1044,8 @@ _e_smart_reconfigure(E_Smart_Data *sd)
evas_object_resize(sd->o_box, sd->w, sd->h);
}
-static void
-_e_smart_event_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+static void
+_e_smart_event_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
{
E_Smart_Data *sd;
Evas_Event_Mouse_Down *ev;
@@ -951,8 +1065,8 @@ _e_smart_event_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_
evas_object_smart_callback_call(sd->o_smart, "selected", NULL);
}
-static void
-_e_smart_event_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+static void
+_e_smart_event_mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
{
E_Smart_Data *sd;
Evas_Event_Mouse_Up *ev;
@@ -1005,7 +1119,7 @@ _e_smart_event_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_in
}
static void
-_e_smart_event_key_down(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+_e_smart_event_key_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
{
Evas_Event_Key_Down *ev;
E_Smart_Data *sd;
@@ -1050,7 +1164,7 @@ _e_smart_event_key_down(void *data, Evas *evas, Evas_Object *obj, void *event_in
n = ns;
do
{
- if (n == (eina_list_count(sd->items) - 1))
+ if (n == ((int)eina_list_count(sd->items) - 1))
{
n = ns;
break;
@@ -1076,7 +1190,7 @@ _e_smart_event_key_down(void *data, Evas *evas, Evas_Object *obj, void *event_in
n = -1;
do
{
- if (n == (eina_list_count(sd->items) - 1))
+ if (n == ((int)eina_list_count(sd->items) - 1))
{
n = ns;
break;
diff --git a/src/bin/e_ilist.h b/src/bin/e_ilist.h
index e0fb45582..6b07b4961 100644
--- a/src/bin/e_ilist.h
+++ b/src/bin/e_ilist.h
@@ -12,6 +12,7 @@ struct _E_Ilist_Item
const char *label;
Evas_Object *o_base;
Evas_Object *o_icon;
+ Evas_Object *o_end;
unsigned char header : 1;
unsigned char selected : 1;
unsigned char queued : 1;
@@ -22,10 +23,10 @@ struct _E_Ilist_Item
};
EAPI Evas_Object *e_ilist_add (Evas *evas);
-EAPI void e_ilist_append (Evas_Object *obj, Evas_Object *icon, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2);
-EAPI void e_ilist_append_relative (Evas_Object *obj, Evas_Object *icon, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2, int relative);
-EAPI void e_ilist_prepend (Evas_Object *obj, Evas_Object *icon, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2);
-EAPI void e_ilist_prepend_relative (Evas_Object *obj, Evas_Object *icon, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2, int relative);
+EAPI void e_ilist_append (Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2);
+EAPI void e_ilist_append_relative (Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2, int relative);
+EAPI void e_ilist_prepend (Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2);
+EAPI void e_ilist_prepend_relative (Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2, int relative);
EAPI void e_ilist_clear (Evas_Object *obj);
EAPI void e_ilist_freeze (Evas_Object *obj);
EAPI void e_ilist_thaw (Evas_Object *obj);
@@ -42,6 +43,7 @@ EAPI const char *e_ilist_selected_label_get (Evas_Object *obj);
EAPI void *e_ilist_selected_data_get (Evas_Object *obj);
EAPI void *e_ilist_selected_data2_get (Evas_Object *obj);
EAPI Evas_Object *e_ilist_selected_icon_get (Evas_Object *obj);
+EAPI Evas_Object *e_ilist_selected_end_get (Evas_Object *obj);
EAPI void e_ilist_selected_geometry_get (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
EAPI int e_ilist_selected_count_get (Evas_Object *obj);
EAPI void e_ilist_remove_num (Evas_Object *obj, int n);
@@ -49,7 +51,9 @@ EAPI const char *e_ilist_nth_label_get (Evas_Object *obj, int n);
EAPI void e_ilist_nth_label_set (Evas_Object *obj, int n, const char *label);
EAPI Evas_Object *e_ilist_nth_icon_get (Evas_Object *obj, int n);
EAPI void e_ilist_nth_icon_set (Evas_Object *obj, int n, Evas_Object *icon);
-EAPI int e_ilist_nth_is_header (Evas_Object *obj, int n);
+EAPI Evas_Object *e_ilist_nth_end_get (Evas_Object *obj, int n);
+EAPI void e_ilist_nth_end_set (Evas_Object *obj, int n, Evas_Object *end);
+EAPI Eina_Bool e_ilist_nth_is_header (Evas_Object *obj, int n);
EAPI void e_ilist_nth_geometry_get (Evas_Object *obj, int n, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
EAPI void e_ilist_icon_size_set (Evas_Object *obj, Evas_Coord w, Evas_Coord h);
EAPI Eina_List *e_ilist_items_get (Evas_Object *obj);
diff --git a/src/bin/e_int_config_modules.c b/src/bin/e_int_config_modules.c
index 6cd4607b4..c02e0655e 100644
--- a/src/bin/e_int_config_modules.c
+++ b/src/bin/e_int_config_modules.c
@@ -2,82 +2,76 @@
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "e.h"
+#include <assert.h>
typedef struct _CFModule CFModule;
typedef struct _CFType CFType;
typedef struct _CFTypes CFTypes;
-struct _CFModule
+struct _CFModule
{
const char *short_name, *name, *comment;
const char *icon, *orig_path;
- int enabled, selected;
+ E_Module *module;
+ Evas_Object *end;
+ int idx;
+ Eina_Bool enabled : 1;
+ Eina_Bool selected : 1;
};
-struct _CFType
+struct _CFType
{
const char *key, *name, *icon;
- Eina_Hash *modules;
+ Eina_Hash *modules_hash; /* just used before constructing list */
+ Eina_List *modules; /* sorted and ready to be used */
};
-struct _CFTypes
+struct _E_Config_Dialog_Data
{
- const char *key, *name, *icon;
-};
-
-struct _E_Config_Dialog_Data
-{
- Evas_Object *l_avail, *l_loaded;
+ Evas *evas;
+ Evas_Object *l_modules;
Evas_Object *b_load, *b_unload;
Evas_Object *o_desc;
+ Eina_List *types;
+ struct {
+ Eina_List *loaded, *unloaded;
+ Ecore_Idler *idler;
+ } selected;
};
-/* Key pairs for module types
- *
- * Should be in alphabetic order
- */
-const CFTypes _types[] =
+struct _CFTypes
{
- {"appearance", N_("Appearance"), "preferences-appearance"},
- {"config", N_("Settings"), "preferences-system"},
- {"fileman", N_("File Manager"), "system-file-manager"},
- {"shelf", N_("Shelf"), "preferences-desktop-shelf"}, //FIXME use gadget icon
- {"system", N_("System"), "system"},
- {NULL, NULL, NULL}
+ size_t key_len;
+ const char *key, *name, *icon;
+};
+
+/* pre defined types (used to specify icon and i18n name) */
+static const CFTypes _types[] =
+{
+#define _CFT(k, n, i) \
+ {sizeof(k) - 1, k, n, i}
+ _CFT("appearance", N_("Appearance"), "preferences-appearance"),
+ _CFT("config", N_("Settings"), "preferences-system"),
+ _CFT("fileman", N_("File Manager"), "system-file-manager"),
+ _CFT("shelf", N_("Shelf"), "preferences-desktop-shelf"),
+ _CFT("system", N_("System"), "system"),
+#undef _CFT
+ {0, NULL, NULL, NULL}
};
/* local function protos */
+static Eina_Bool _fill_data(E_Config_Dialog_Data *cfdata);
+static void _cftype_free(CFType *cft);
+
+static void _widget_list_populate(E_Config_Dialog_Data *cfdata);
+static void _widget_list_selection_changed(void *data, Evas_Object *obj);
+
static void *_create_data(E_Config_Dialog *cfd);
-static void _fill_data(E_Config_Dialog_Data *cfdata);
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
-static void _fill_type_hash(void);
-static void _load_modules(const char *dir);
-static void _fill_list(Evas_Object *obj, int enabled);
-static Eina_Bool _fill_list_types_avail(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata);
-static Eina_Bool _fill_list_types_load(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata);
-static Eina_Bool _fill_list_types(Evas_Object *obj, CFType *cft, int enabled);
-static Eina_Bool _types_hash_cb_free(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__);
-static Eina_Bool _mod_hash_cb_free(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__);
-static Eina_Bool _mod_hash_avail_list(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata);
-static Eina_Bool _mod_hash_load_list(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata);
-static int _mod_list_sort(const void *data1, const void *data2);
-static void _list_widget_load(Evas_Object *obj, Eina_List *list);
-static void _avail_list_cb_change(void *data, Evas_Object *obj);
-static void _load_list_cb_change(void *data, Evas_Object *obj);
-static void _unselect_all_modules(void);
-static Eina_Bool _mod_hash_unselect(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__);
-static void _select_all_modules(Evas_Object *obj, void *data);
+
static void _btn_cb_unload(void *data, void *data2);
static void _btn_cb_load(void *data, void *data2);
-static Eina_Bool _mod_hash_load(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__);
-static Eina_Bool _mod_hash_unload(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__);
-static void _enable_modules(int enable);
-static Eina_Bool _enable_modules_types_enable(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata);
-static Eina_Bool _enable_modules_types_disable(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata);
-
-/* local variables */
-static Eina_Hash *types_hash = NULL;
EAPI E_Config_Dialog *
e_int_config_modules(E_Container *con, const char *params __UNUSED__)
@@ -95,626 +89,523 @@ e_int_config_modules(E_Container *con, const char *params __UNUSED__)
cfd = e_config_dialog_new(con, _("Module Settings"),
"E", "_config_modules_dialog",
"preferences-plugin", 0, v, NULL);
- e_dialog_resizable_set(cfd->dia, 1);
return cfd;
}
-/* local functions */
static void *
-_create_data(E_Config_Dialog *cfd)
+_create_data(E_Config_Dialog *cfd __UNUSED__)
{
- E_Config_Dialog_Data *cfdata = NULL;
-
- _fill_type_hash();
-
- cfdata = E_NEW(E_Config_Dialog_Data, 1);
+ E_Config_Dialog_Data *cfdata = E_NEW(E_Config_Dialog_Data, 1);
if (!cfdata) return NULL;
- _fill_data(cfdata);
- return cfdata;
-}
-
-static void
-_fill_data(E_Config_Dialog_Data *cfdata)
-{
- Eina_List *mdirs = NULL, *l = NULL;
- E_Path_Dir *epd = NULL;
-
- if (!cfdata) return;
-
- /* loop each path_modules dir and load modules for that path */
- mdirs = e_path_dir_list_get(path_modules);
- EINA_LIST_FOREACH(mdirs, l, epd)
+ if (!_fill_data(cfdata))
{
- if (!epd) continue;
- if (!ecore_file_is_dir(epd->dir)) continue;
- _load_modules(epd->dir);
+ E_FREE(cfdata);
+ return NULL;
}
- if (mdirs) e_path_dir_list_free(mdirs);
+
+ return cfdata;
}
static void
-_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
+_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
- if (types_hash)
- {
- eina_hash_foreach(types_hash, _types_hash_cb_free, NULL);
- eina_hash_free(types_hash);
- types_hash = NULL;
- }
+ CFType *cft;
+
+ EINA_LIST_FREE(cfdata->types, cft) _cftype_free(cft);
+
+ eina_list_free(cfdata->selected.loaded);
+ eina_list_free(cfdata->selected.unloaded);
+ if (cfdata->selected.idler) ecore_idler_del(cfdata->selected.idler);
E_FREE(cfdata);
}
static Evas_Object *
_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
- Evas_Object *o, *of, *ol;
+ Evas_Object *of, *ol;
- o = e_widget_table_add(evas, 0);
+ cfdata->evas = e_win_evas_get(cfd->dia->win);
- of = e_widget_frametable_add(evas, _("Available Modules"), 0);
+ of = e_widget_frametable_add(evas, _("Modules"), 0);
ol = e_widget_ilist_add(evas, 24, 24, NULL);
- cfdata->l_avail = ol;
+ cfdata->l_modules = ol;
e_widget_ilist_multi_select_set(ol, 1);
- e_widget_on_change_hook_set(ol, _avail_list_cb_change, cfdata);
- _fill_list(ol, 0);
- e_widget_frametable_object_append(of, ol, 0, 0, 1, 1, 1, 1, 1, 1);
- ol = e_widget_button_add(evas, _("Load Module"), "list-add",
- _btn_cb_load, cfdata, NULL);
+ e_widget_on_change_hook_set(ol, _widget_list_selection_changed, cfdata);
+ e_widget_frametable_object_append(of, ol, 0, 0, 2, 1, 1, 1, 1, 1);
+
+ ol = e_widget_button_add(evas, _("Load"), NULL, _btn_cb_load, cfdata, NULL);
cfdata->b_load = ol;
e_widget_disabled_set(ol, 1);
e_widget_frametable_object_append(of, ol, 0, 1, 1, 1, 1, 1, 1, 0);
- e_widget_table_object_append(o, of, 0, 0, 1, 1, 1, 1, 1, 1);
- of = e_widget_frametable_add(evas, _("Loaded Modules"), 0);
- ol = e_widget_ilist_add(evas, 24, 24, NULL);
- cfdata->l_loaded = ol;
- e_widget_ilist_multi_select_set(ol, 1);
- e_widget_on_change_hook_set(ol, _load_list_cb_change, cfdata);
- _fill_list(ol, 1);
- e_widget_frametable_object_append(of, ol, 0, 0, 1, 1, 1, 1, 1, 1);
- ol = e_widget_button_add(evas, _("Unload Module"), "list-remove",
- _btn_cb_unload, cfdata, NULL);
+ ol = e_widget_button_add(evas, _("Unload"), NULL, _btn_cb_unload, cfdata, NULL);
cfdata->b_unload = ol;
e_widget_disabled_set(ol, 1);
- e_widget_frametable_object_append(of, ol, 0, 1, 1, 1, 1, 1, 1, 0);
- e_widget_table_object_append(o, of, 1, 0, 1, 1, 1, 1, 1, 1);
+ e_widget_frametable_object_append(of, ol, 1, 1, 1, 1, 1, 1, 1, 0);
ol = e_widget_textblock_add(evas);
- e_widget_size_min_set(ol, (200 * e_scale), 70);
+ e_widget_size_min_set(ol, (200 * e_scale), 60 * e_scale);
cfdata->o_desc = ol;
- e_widget_textblock_markup_set(ol, _("Description: Unavailable"));
- e_widget_table_object_append(o, ol, 0, 1, 2, 1, 1, 0, 1, 0);
+ e_widget_textblock_markup_set(ol, _("No modules selected."));
+ e_widget_frametable_object_append(of, ol, 0, 2, 2, 1, 1, 0, 1, 0);
- return o;
-}
+ _widget_list_populate(cfdata);
-static void
-_fill_type_hash(void)
-{
- int i = 0;
+ e_dialog_resizable_set(cfd->dia, 1);
+ e_util_win_auto_resize_fill(cfd->dia->win);
+ e_win_centered_set(cfd->dia->win, 1);
- /* create the inital hash based on predefined list of types */
- for (i = 0; _types[i].name; i++)
- {
- CFType *cft = NULL;
-
- if (!_types[i].key) continue;
- if (eina_hash_find(types_hash, _types[i].key)) continue;
-
- cft = E_NEW(CFType, 1);
- if (!cft) continue;
- cft->key = eina_stringshare_add(_types[i].key);
- cft->name = eina_stringshare_add(_(_types[i].name));
- cft->icon = eina_stringshare_add(_types[i].icon);
- if (!types_hash) types_hash = eina_hash_string_superfast_new(NULL);
- eina_hash_direct_add(types_hash, cft->key, cft);
- }
+ return of;
}
-static void
-_load_modules(const char *dir)
+static CFModule *
+_module_new(const char *short_name, const Efreet_Desktop *desk)
{
- Eina_List *files = NULL, *l;
- char *mod = NULL, *file;
+ CFModule *cfm = E_NEW(CFModule, 1);
+ if (!cfm) return NULL;
+ cfm->short_name = eina_stringshare_add(short_name);
- if (!dir) return;
- if (!(files = ecore_file_ls(dir))) return;
+ if (desk->name)
+ cfm->name = eina_stringshare_add(desk->name);
+ else
+ cfm->name = eina_stringshare_ref(cfm->short_name);
- /* get all modules in this path_dir */
- EINA_LIST_FOREACH(files, l, mod)
- {
- Efreet_Desktop *desk = NULL;
- CFType *cft = NULL;
- CFModule *cfm = NULL;
- const char *type = NULL;
- char buf[PATH_MAX];
-
- /* check that we have a desktop file for this module */
- snprintf(buf, sizeof(buf), "%s/%s/module.desktop", dir, mod);
- if (!ecore_file_exists(buf)) continue;
- if (!(desk = efreet_desktop_get(buf))) continue;
-
- /* does the ModuleType exist in desktop? */
- if (desk->x)
- type = eina_hash_find(desk->x, "X-Enlightenment-ModuleType");
- if (!type) type = eina_stringshare_add("shelf");
+ cfm->icon = eina_stringshare_add(desk->icon);
+ cfm->comment = eina_stringshare_add(desk->comment);
+ cfm->orig_path = eina_stringshare_add(desk->orig_path);
+ return cfm;
+}
- /* do we have this module already in it's type hash ? */
- cft = eina_hash_find(types_hash, type);
- if (cft)
- {
- if ((cft->modules) && (eina_hash_find(cft->modules, mod)))
- {
- if ((!desk->x) && (type)) eina_stringshare_del(type);
- if (desk) efreet_desktop_free(desk);
- continue;
- }
- }
- else
- {
- char buf[1024];
-
- cft = E_NEW(CFType, 1);
- if (!cft) continue;
- cft->key = eina_stringshare_add(type);
- snprintf(buf, sizeof(buf), "%s", type);
- *buf = toupper(*buf);
- cft->name = eina_stringshare_add(buf);
- snprintf(buf, sizeof(buf), "enlightenment/%s", type);
- if (e_util_edje_icon_check(buf))
- cft->icon = eina_stringshare_add(buf);
- if (!types_hash) types_hash = eina_hash_string_superfast_new(NULL);
- eina_hash_direct_add(types_hash, cft->key, cft);
- }
+static void
+_module_free(CFModule *cfm)
+{
+ eina_stringshare_del(cfm->short_name);
+ eina_stringshare_del(cfm->name);
+ eina_stringshare_del(cfm->icon);
+ eina_stringshare_del(cfm->comment);
+ eina_stringshare_del(cfm->orig_path);
+ E_FREE(cfm);
+}
- /* module not in it's type hash, add */
- cfm = E_NEW(CFModule, 1);
- if (!cfm) continue;
- cfm->short_name = eina_stringshare_add(mod);
- if (desk->name) cfm->name = eina_stringshare_add(desk->name);
- if (desk->icon) cfm->icon = eina_stringshare_add(desk->icon);
- if (desk->comment) cfm->comment = eina_stringshare_add(desk->comment);
- if (desk->orig_path)
- cfm->orig_path = eina_stringshare_add(desk->orig_path);
- if ((!desk->x) && (type)) eina_stringshare_del(type);
- efreet_desktop_free(desk);
+static void
+_module_end_state_apply(CFModule *cfm)
+{
+ const char *sig;
+ if (!cfm->end) return;
+ sig = cfm->enabled ? "e,state,checked" : "e,state,unchecked";
+ edje_object_signal_emit(cfm->end, sig, "e");
+}
- if (e_module_find(mod)) cfm->enabled = 1;
- if (!cft->modules) cft->modules = eina_hash_string_superfast_new(NULL);
- eina_hash_direct_add(cft->modules, cfm->short_name, cfm);
- }
- free(mod);
- EINA_LIST_FREE(files, file)
- free(file);
+static CFType *
+_cftype_new(const char *key, const char *name, const char *icon)
+{
+ CFType * cft = E_NEW(CFType, 1);
+ if (!cft) return NULL;
+ cft->key = eina_stringshare_add(key);
+ cft->name = eina_stringshare_add(name);
+ cft->icon = eina_stringshare_add(icon);
+ return cft;
}
static void
-_fill_list(Evas_Object *obj, int enabled)
+_cftype_free(CFType *cft)
{
- Evas *evas;
- Evas_Coord w;
-
- /* freeze evas, edje, and list widget */
- evas = evas_object_evas_get(obj);
- evas_event_freeze(evas);
- edje_freeze();
- e_widget_ilist_freeze(obj);
- e_widget_ilist_clear(obj);
+ CFModule *cfm;
- if (types_hash)
- {
- if (!enabled)
- eina_hash_foreach(types_hash, _fill_list_types_avail, obj);
- else
- eina_hash_foreach(types_hash, _fill_list_types_load, obj);
- }
+ assert(cft->modules_hash == NULL); // must do it before calling this function
+ EINA_LIST_FREE(cft->modules, cfm)
+ _module_free(cfm);
- e_widget_ilist_go(obj);
- e_widget_size_min_get(obj, &w, NULL);
- e_widget_size_min_set(obj, (w * e_scale), (200 * e_scale));
-// e_widget_size_min_set(obj, w > (180 * e_scale) ? (w * e_scale) : (180 * e_scale),
-// (200 * e_scale));
- e_widget_ilist_thaw(obj);
- edje_thaw();
- evas_event_thaw(evas);
+ eina_stringshare_del(cft->key);
+ eina_stringshare_del(cft->name);
+ eina_stringshare_del(cft->icon);
+ E_FREE(cft);
}
-static Eina_Bool
-_fill_list_types_avail(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata)
+static CFType *
+_cftype_new_from_key(const char *key)
{
- CFType *cft;
- Evas_Object *obj;
+ const CFTypes *itr;
+ char name[1024], icon[1024];
+ size_t key_len = strlen(key);
- cft = data;
- obj = fdata;
+ for (itr = _types; itr->key_len > 0; itr++)
+ {
+ if (key_len != itr->key_len) continue;
+ if (strcmp(itr->key, key) != 0) continue;
+ return _cftype_new(itr->key, itr->name, itr->icon);
+ }
- return _fill_list_types(obj, cft, 0);
-}
+ if ((key_len + 1) >= sizeof(name)) return NULL;
+ if ((key_len + sizeof("enlightenment/")) >= sizeof(icon)) return NULL;
-static Eina_Bool
-_fill_list_types_load(const Eina_Hash *hash __UNUSED__,
- const void *key __UNUSED__, void *data, void *fdata)
-{
- CFType *cft;
- Evas_Object *obj;
+ memcpy(name, key, key_len + 1);
+ name[0] = toupper(name[0]);
- cft = data;
- obj = fdata;
+ memcpy(icon, "enlightenment/", sizeof("enlightenment/") - 1);
+ memcpy(icon + sizeof("enlightenment/") - 1, key, key_len + 1);
- return _fill_list_types(obj, cft, 1);
+ return _cftype_new(key, name, icon);
}
-static Eina_Bool
-_fill_list_types(Evas_Object *obj, CFType *cft, int enabled)
+static void
+_load_modules(const char *dir, Eina_Hash *types_hash)
{
- Evas *evas;
- Eina_List *l = NULL;
- Evas_Object *ic = NULL;
- int count;
+ Eina_List *files;
+ char modpath[PATH_MAX];
+ char *mod;
+ int modpathlen;
- evas = evas_object_evas_get(obj);
+ modpathlen = snprintf(modpath, sizeof(modpath), "%s/", dir);
+ if (modpathlen >= (int)sizeof(modpath)) return;
- if (cft->modules)
+ files = ecore_file_ls(dir);
+ EINA_LIST_FREE(files, mod)
{
- if (!enabled)
- eina_hash_foreach(cft->modules, _mod_hash_avail_list, &l);
+ Efreet_Desktop *desk;
+ CFType *cft;
+ CFModule *cfm;
+ const char *type;
+ Eina_Bool new_type;
+
+ snprintf(modpath + modpathlen, sizeof(modpath) - modpathlen,
+ "%s/module.desktop", mod);
+ if (!ecore_file_exists(modpath)) goto end_mod;
+ if (!(desk = efreet_desktop_get(modpath))) goto end_mod;
+
+ if (desk->x)
+ type = eina_hash_find(desk->x, "X-Enlightenment-ModuleType");
else
- eina_hash_foreach(cft->modules, _mod_hash_load_list, &l);
- }
+ type = NULL;
+ if (!type) type = "shelf"; // todo: warn?
- if (l) count = eina_list_count(l);
- else return EINA_TRUE;
+ cft = eina_hash_find(types_hash, type);
+ if (cft)
+ {
+ new_type = EINA_FALSE;
+ if ((cft->modules_hash) &&
+ (eina_hash_find(cft->modules_hash, mod)))
+ goto end_desktop;
+ }
+ else
+ {
+ cft = _cftype_new_from_key(type);
+ if (cft) new_type = EINA_TRUE;
+ else goto end_desktop;
+ }
- /* We have at least one, append header */
- if (cft->icon)
- {
- ic = e_icon_add(evas);
- e_util_icon_theme_set(ic, cft->icon);
- }
- e_widget_ilist_header_append(obj, ic, cft->name);
+ cfm = _module_new(mod, desk);
+ if (!cfm)
+ {
+ if (new_type) _cftype_free(cft);
+ goto end_desktop;
+ }
- /* sort the list if we have more than one */
- if (count > 1)
- l = eina_list_sort(l, -1, _mod_list_sort);
+ if (!cft->modules_hash)
+ cft->modules_hash = eina_hash_string_superfast_new(NULL);
+ if (!cft->modules_hash)
+ {
+ if (new_type) _cftype_free(cft);
+ goto end_desktop;
+ }
+ eina_hash_direct_add(cft->modules_hash, cfm->short_name, cfm);
+ // TODO be paranoid about hash add failure, otherwise it will leak
+
+ cft->modules = eina_list_append(cft->modules, cfm);
+ // TODO be paranoid about list append failure, otherwise it will leak
+ cfm->module = e_module_find(mod);
+ if (cfm->module)
+ cfm->enabled = e_module_enabled_get(cfm->module);
+ else
+ cfm->enabled = 0;
- _list_widget_load(obj, l);
+ if (new_type)
+ eina_hash_direct_add(types_hash, cft->key, cft);
+ // TODO be paranoid about hash add failure, otherwise it will leak
- if (l)
- {
- eina_list_free(l);
- l = NULL;
+ end_desktop:
+ efreet_desktop_free(desk);
+ end_mod:
+ free(mod);
}
+}
- return EINA_TRUE;
+static int
+_modules_list_sort(const void *data1, const void *data2)
+{
+ const CFModule *m1 = data1, *m2 = data2;
+ return strcmp(m1->name, m2->name);
}
static Eina_Bool
-_types_hash_cb_free(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__)
+_types_list_create_foreach_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata)
{
- CFType *type = NULL;
+ E_Config_Dialog_Data *cfdata = fdata;
+ CFType *cft = data;
- if (!(type = data)) return 1;
- if (type->key) eina_stringshare_del(type->key);
- if (type->name) eina_stringshare_del(type->name);
- if (type->icon) eina_stringshare_del(type->icon);
- if (type->modules)
- {
- eina_hash_foreach(type->modules, _mod_hash_cb_free, NULL);
- eina_hash_free(type->modules);
- type->modules = NULL;
- }
- E_FREE(type);
+ // otherwise it should not be here
+ assert(cft->modules);
+ assert(cft->modules_hash);
+
+ eina_hash_free(cft->modules_hash);
+ cft->modules_hash = NULL;
+
+ cft->modules = eina_list_sort(cft->modules, -1, _modules_list_sort);
+ cfdata->types = eina_list_append(cfdata->types, cft);
+ // TODO be paranoid about list append failure, otherwise leaks memory
return EINA_TRUE;
}
-static Eina_Bool
-_mod_hash_cb_free(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__)
+static int
+_types_list_sort(const void *data1, const void *data2)
{
- CFModule *mod = NULL;
-
- if (!(mod = data)) return 1;
- if (mod->short_name) eina_stringshare_del(mod->short_name);
- if (mod->name) eina_stringshare_del(mod->name);
- if (mod->icon) eina_stringshare_del(mod->icon);
- if (mod->comment) eina_stringshare_del(mod->comment);
- if (mod->orig_path) eina_stringshare_del(mod->orig_path);
- E_FREE(mod);
- return EINA_TRUE;
+ const CFType *t1 = data1, *t2 = data2;
+ return strcmp(t1->name, t2->name);
}
static Eina_Bool
-_mod_hash_avail_list(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata)
+_fill_data(E_Config_Dialog_Data *cfdata)
{
- Eina_List **l;
- CFModule *mod = NULL;
+ Eina_List *mdirs, *l;
+ E_Path_Dir *epd;
+ Eina_Hash *types_hash = eina_hash_string_superfast_new(NULL);
+ if (!types_hash) return EINA_FALSE;
- mod = data;
- if ((!mod) || (mod->enabled)) return 1;
- l = fdata;
- *l = eina_list_append(*l, mod);
- return EINA_TRUE;
-}
+ // TODO: postpone this to idler? segment the job?
+ /* loop each path_modules dir and load modules for that path */
+ mdirs = e_path_dir_list_get(path_modules);
+ EINA_LIST_FOREACH(mdirs, l, epd)
+ {
+ if (!ecore_file_is_dir(epd->dir)) continue;
+ _load_modules(epd->dir, types_hash);
+ }
+ if (mdirs) e_path_dir_list_free(mdirs);
-static Eina_Bool
-_mod_hash_load_list(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata)
-{
- Eina_List **l;
- CFModule *mod = NULL;
+ eina_hash_foreach(types_hash, _types_list_create_foreach_cb, cfdata);
+ eina_hash_free(types_hash);
+ cfdata->types = eina_list_sort(cfdata->types, -1, _types_list_sort);
- mod = data;
- if ((!mod) || (!mod->enabled)) return 1;
- l = fdata;
- *l = eina_list_append(*l, mod);
return EINA_TRUE;
}
-static int
-_mod_list_sort(const void *data1, const void *data2)
+static void
+_list_header_append(E_Config_Dialog_Data *cfdata, CFType *cft)
{
- const CFModule *m1, *m2;
-
- if (!(m1 = data1)) return 1;
- if (!(m2 = data2)) return -1;
- return (strcmp(m1->name, m2->name));
+ Evas_Object *icon = e_icon_add(cfdata->evas);
+ if (icon)
+ {
+ if (!e_util_icon_theme_set(icon, cft->icon))
+ {
+ evas_object_del(icon);
+ icon = NULL;
+ }
+ }
+ e_widget_ilist_header_append(cfdata->l_modules, icon, cft->name);
}
-/* nice generic function to load an ilist with items */
static void
-_list_widget_load(Evas_Object *obj, Eina_List *list)
+_list_item_append(E_Config_Dialog_Data *cfdata, CFModule *cfm)
{
- Evas *evas;
- Eina_List *ml = NULL;
- CFModule *mod;
+ Evas_Object *icon, *end;
- if ((!obj) || (!list)) return;
- evas = evas_object_evas_get(obj);
- EINA_LIST_FOREACH(list, ml, mod)
+ if (!cfm->icon)
+ icon = NULL;
+ else
{
- Evas_Object *ic = NULL;
- char *path;
- char buf[PATH_MAX];
-
- if (!mod) continue;
- if (mod->icon)
+ icon = e_icon_add(cfdata->evas);
+ if (icon)
{
- ic = e_icon_add(evas);
- if (!e_util_icon_theme_set(ic, mod->icon))
+ if (!e_util_icon_theme_set(icon, cfm->icon))
{
- if (mod->orig_path)
+ if (cfm->orig_path)
+ {
+ char *dir = ecore_file_dir_get(cfm->orig_path);
+ char buf[PATH_MAX];
+ snprintf(buf, sizeof(buf), "%s/%s.edj", dir, cfm->icon);
+ free(dir);
+
+ e_icon_file_edje_set(icon, buf, "icon");
+ }
+ else
{
- path = ecore_file_dir_get(mod->orig_path);
- snprintf(buf, sizeof(buf), "%s/%s.edj", path, mod->icon);
- e_icon_file_edje_set(ic, buf, "icon");
- free(path);
+ evas_object_del(icon);
+ icon = NULL;
}
}
}
- if (mod->name)
- e_widget_ilist_append(obj, ic, mod->name, NULL, mod, NULL);
- else if (mod->short_name)
- e_widget_ilist_append(obj, ic, mod->short_name, NULL, mod, NULL);
}
-}
-
-static void
-_avail_list_cb_change(void *data, Evas_Object *obj)
-{
- E_Config_Dialog_Data *cfdata = NULL;
-
- if (!(cfdata = data)) return;
-
- /* Unselect all in loaded list & disable buttons */
- e_widget_ilist_unselect(cfdata->l_loaded);
- e_widget_disabled_set(cfdata->b_unload, 1);
- e_widget_disabled_set(cfdata->b_load, 1);
-
- /* Unselect all modules */
- _unselect_all_modules();
-
- /* Make sure something is selected */
- if (e_widget_ilist_selected_count_get(cfdata->l_avail) < 1) return;
- /* Select all modules in avail list that user wants */
- _select_all_modules(cfdata->l_avail, cfdata);
+ end = edje_object_add(cfdata->evas);
+ if (end)
+ {
+ if (e_theme_edje_object_set(end, "base/theme/widgets",
+ "e/widgets/ilist/toggle_end"))
+ {
+ cfm->end = end;
+ _module_end_state_apply(cfm);
+ }
+ else
+ {
+ EINA_LOG_ERR("your theme misses 'e/widgets/ilist/toggle_end'!");
+ evas_object_del(end);
+ end = NULL;
+ }
+ }
- /* Enable load button */
- e_widget_disabled_set(cfdata->b_load, 0);
+ e_widget_ilist_append_full
+ (cfdata->l_modules, icon, end, cfm->name, NULL, cfm, NULL);
}
static void
-_load_list_cb_change(void *data, Evas_Object *obj)
+_widget_list_populate(E_Config_Dialog_Data *cfdata)
{
- E_Config_Dialog_Data *cfdata = NULL;
+ CFType *cft;
+ Evas_Coord w;
+ Eina_List *l_type;
+ int idx = 0;
- if (!(cfdata = data)) return;
+ // TODO postpone list fill to idler?
- /* Unselect all in avail list & disable button */
- e_widget_ilist_unselect(cfdata->l_avail);
- e_widget_disabled_set(cfdata->b_unload, 1);
- e_widget_disabled_set(cfdata->b_load, 1);
+ evas_event_freeze(cfdata->evas);
+ edje_freeze();
+ e_widget_ilist_freeze(cfdata->l_modules);
+ e_widget_ilist_clear(cfdata->l_modules);
- /* Unselect all modules */
- _unselect_all_modules();
+ EINA_LIST_FOREACH(cfdata->types, l_type, cft)
+ {
+ CFModule *cfm;
+ Eina_List *l_module;
- /* Make sure something is selected */
- if (e_widget_ilist_selected_count_get(cfdata->l_loaded) < 1) return;
+ _list_header_append(cfdata, cft);
+ idx++;
- /* Select all modules in loaded list that user wants */
- _select_all_modules(cfdata->l_loaded, cfdata);
+ EINA_LIST_FOREACH(cft->modules, l_module, cfm)
+ {
+ _list_item_append(cfdata, cfm);
+ cfm->idx = idx;
+ idx++;
+ }
+ }
- /* Enable unload button */
- e_widget_disabled_set(cfdata->b_unload, 0);
+ e_widget_ilist_go(cfdata->l_modules);
+ e_widget_size_min_get(cfdata->l_modules, &w, NULL);
+ if (w < 250 * e_scale) w = 250 * e_scale;
+ e_widget_size_min_set(cfdata->l_modules, w, (200 * e_scale));
+ e_widget_ilist_thaw(cfdata->l_modules);
+ edje_thaw();
+ evas_event_thaw(cfdata->evas);
}
-static void
-_unselect_all_modules(void)
+static int
+_widget_list_item_selected_postponed(void *data)
{
- int i = 0;
+ E_Config_Dialog_Data *cfdata = data;
+ const Eina_List *l;
+ const E_Ilist_Item *it;
+ unsigned int loaded = 0, unloaded = 0;
+ CFModule *cfm = NULL;
+ const char *description;
- if (!types_hash) return;
+ eina_list_free(cfdata->selected.loaded);
+ eina_list_free(cfdata->selected.unloaded);
+ cfdata->selected.loaded = NULL;
+ cfdata->selected.unloaded = NULL;
- /* loop types, getting all modules */
- for (i = 0; _types[i].name; i++)
+ EINA_LIST_FOREACH(e_widget_ilist_items_get(cfdata->l_modules), l, it)
{
- CFType *cft = NULL;
+ if ((!it->selected) || (it->header)) continue;
+ cfm = e_widget_ilist_item_data_get(it);
- if (!_types[i].key) continue;
- cft = eina_hash_find(types_hash, _types[i].key);
- if ((!cft) || (!cft->modules)) continue;
- eina_hash_foreach(cft->modules, _mod_hash_unselect, NULL);
+ if (cfm->enabled)
+ {
+ cfdata->selected.loaded = eina_list_append
+ (cfdata->selected.loaded, cfm);
+ loaded++;
+ }
+ else
+ {
+ cfdata->selected.unloaded = eina_list_append
+ (cfdata->selected.unloaded, cfm);
+ unloaded++;
+ }
}
-}
-static Eina_Bool
-_mod_hash_unselect(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__)
-{
- CFModule *mod = NULL;
+ e_widget_disabled_set(cfdata->b_load, !unloaded);
+ e_widget_disabled_set(cfdata->b_unload, !loaded);
- if (!(mod = data)) return 1;
- mod->selected = 0;
- return 1;
-}
+ if ((cfm) && (loaded + unloaded == 1))
+ description = cfm->comment;
+ else if (loaded + unloaded > 1)
+ description = _("More than one module selected.");
+ else
+ description = _("No modules selected.");
-static void
-_select_all_modules(Evas_Object *obj, void *data)
-{
- Eina_List *l = NULL;
- E_Ilist_Item *item = NULL;
- E_Config_Dialog_Data *cfdata = NULL;
- int i = -1;
+ e_widget_textblock_markup_set(cfdata->o_desc, description);
- if (!(cfdata = data)) return;
- EINA_LIST_FOREACH(e_widget_ilist_items_get(obj), l, item)
- {
- CFModule *mod = NULL;
-
- i++;
- if ((!item) || (!item->selected)) continue;
- if (!(mod = e_widget_ilist_nth_data_get(obj, i))) continue;
- mod->selected = 1;
- if (mod->comment)
- e_widget_textblock_markup_set(cfdata->o_desc, mod->comment);
- else
- e_widget_textblock_markup_set(cfdata->o_desc,
- _("Description: Unavailable"));
- }
+ cfdata->selected.idler = NULL;
+ return 0;
}
static void
-_btn_cb_unload(void *data, void *data2)
+_widget_list_selection_changed(void *data, Evas_Object *obj __UNUSED__)
{
- E_Config_Dialog_Data *cfdata = NULL;
- int sel = -1;
-
- if (!(cfdata = data)) return;
-
- /* get what is currently selected in the list */
- sel = e_widget_ilist_selected_get(cfdata->l_loaded);
-
- _enable_modules(0);
- e_widget_disabled_set(cfdata->b_unload, 1);
- e_widget_textblock_markup_set(cfdata->o_desc, _("Description: Unavailable"));
+ E_Config_Dialog_Data *cfdata = data;
- /* using a total reload here as it's simpler than parsing the list(s),
- * finding what was selected, removing it, checking for headers, etc */
- _fill_list(cfdata->l_avail, 0);
- _fill_list(cfdata->l_loaded, 1);
-
- /* move the selection down one if possible. Ilist itself will check
- * for headers, etc, etc */
- e_widget_ilist_selected_set(cfdata->l_loaded, sel);
+ if (cfdata->selected.idler)
+ ecore_idler_del(cfdata->selected.idler);
+ cfdata->selected.idler = ecore_idler_add
+ (_widget_list_item_selected_postponed, cfdata);
}
static void
-_btn_cb_load(void *data, void *data2)
+_btn_cb_unload(void *data, void *data2 __UNUSED__)
{
- E_Config_Dialog_Data *cfdata = NULL;
- int sel = -1;
-
- if (!(cfdata = data)) return;
+ E_Config_Dialog_Data *cfdata = data;
+ CFModule *cfm;
- /* get what is currently selected in the list */
- sel = e_widget_ilist_selected_get(cfdata->l_avail);
+ EINA_LIST_FREE(cfdata->selected.loaded, cfm)
+ {
+ if (!cfm->module)
+ cfm->module = e_module_find(cfm->short_name);
- _enable_modules(1);
- e_widget_disabled_set(cfdata->b_load, 1);
- e_widget_textblock_markup_set(cfdata->o_desc, _("Description: Unavailable"));
+ if (cfm->module)
+ {
+ e_module_disable(cfm->module);
+ cfm->enabled = e_module_enabled_get(cfm->module);
+ }
- /* using a total reload here as it's simpler than parsing the list(s),
- * finding what was selected, removing it, checking for headers, etc */
- _fill_list(cfdata->l_avail, 0);
- _fill_list(cfdata->l_loaded, 1);
+ // weird, but unselects it as it was already selected
+ e_widget_ilist_multi_select(cfdata->l_modules, cfm->idx);
+ _module_end_state_apply(cfm);
+ }
- /* move the selection down one if possible. Ilist itself will check
- * for headers, etc, etc */
- e_widget_ilist_selected_set(cfdata->l_avail, sel);
+ e_widget_disabled_set(cfdata->b_unload, 1);
}
static void
-_enable_modules(int enable)
-{
- if (!types_hash) return;
-
- if (enable)
- eina_hash_foreach(types_hash, _enable_modules_types_enable, NULL);
- else
- eina_hash_foreach(types_hash, _enable_modules_types_disable, NULL);
-}
-
-static Eina_Bool
-_enable_modules_types_enable(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata)
+_btn_cb_load(void *data, void *data2 __UNUSED__)
{
- CFType *cft;
-
- cft = data;
- if ((cft) && (cft->modules))
- eina_hash_foreach(cft->modules, _mod_hash_load, NULL);
- return 1;
-}
-
-static Eina_Bool
-_enable_modules_types_disable(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata)
-{
- CFType *cft;
+ E_Config_Dialog_Data *cfdata = data;
+ CFModule *cfm;
- cft = data;
- if ((cft) && (cft->modules))
- eina_hash_foreach(cft->modules, _mod_hash_unload, NULL);
- return 1;
-}
-
-static Eina_Bool
-_mod_hash_load(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__)
-{
- CFModule *mod = NULL;
- E_Module *module = NULL;
-
- mod = data;
- if ((!mod) || (!mod->selected)) return 1;
- module = e_module_find(mod->short_name);
- if (!module) module = e_module_new(mod->short_name);
- if (!module) return 1;
- mod->enabled = e_module_enable(module);
- mod->selected = 0;
- return 1;
-}
+ EINA_LIST_FREE(cfdata->selected.unloaded, cfm)
+ {
+ if (!cfm->module)
+ cfm->module = e_module_find(cfm->short_name);
+ if (!cfm->module)
+ cfm->module = e_module_new(cfm->short_name);
-static Eina_Bool
-_mod_hash_unload(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__)
-{
- CFModule *mod = NULL;
- E_Module *module = NULL;
+ if (cfm->module)
+ {
+ e_module_enable(cfm->module);
+ cfm->enabled = e_module_enabled_get(cfm->module);
+ }
- mod = data;
- if ((!mod) || (!mod->selected)) return 1;
- module = e_module_find(mod->short_name);
- if (module)
- {
- e_module_disable(module);
- e_object_del(E_OBJECT(module));
+ // weird, but unselects it as it was already selected
+ e_widget_ilist_multi_select(cfdata->l_modules, cfm->idx);
+ _module_end_state_apply(cfm);
}
- mod->enabled = 0;
- mod->selected = 0;
- return 1;
+
+ e_widget_disabled_set(cfdata->b_load, 1);
}
diff --git a/src/bin/e_widget_ilist.c b/src/bin/e_widget_ilist.c
index f55fb3a18..1590edc6e 100644
--- a/src/bin/e_widget_ilist.c
+++ b/src/bin/e_widget_ilist.c
@@ -31,6 +31,7 @@ struct _E_Widget_Queue_Item
{
int command;
Evas_Object *icon;
+ Evas_Object *end;
const char *label;
int header;
void (*func) (void *data);
@@ -50,7 +51,7 @@ static void _e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *even
static int _queue_timer(void *data);
static void _queue_queue(Evas_Object *obj);
-static void _queue_append(Evas_Object *obj, int command, Evas_Object *icon, const char *label, int header, void (*func) (void *data), void *data, const char *val, int relative, int use_relative, int item);
+static void _queue_append(Evas_Object *obj, int command, Evas_Object *icon, Evas_Object *end, const char *label, int header, void (*func) (void *data), void *data, const char *val, int relative, int use_relative, int item);
static void _queue_remove(Evas_Object *obj, E_Widget_Queue_Item *qi, int del);
static int
@@ -82,13 +83,13 @@ _queue_timer(void *data)
if (qi->use_relative == 0) // append
{
wd->callbacks = eina_list_append(wd->callbacks, wcb);
- e_ilist_append(wd->o_ilist, qi->icon, qi->label, qi->header,
+ e_ilist_append(wd->o_ilist, qi->icon, qi->end, qi->label, qi->header,
_e_wid_cb_item_sel, _e_wid_cb_item_hilight, wd, wcb);
}
else if (qi->use_relative == 2) // prepend
{
wd->callbacks = eina_list_append(wd->callbacks, wcb);
- e_ilist_prepend(wd->o_ilist, qi->icon, qi->label, qi->header,
+ e_ilist_prepend(wd->o_ilist, qi->icon, qi->end, qi->label, qi->header,
_e_wid_cb_item_sel, _e_wid_cb_item_hilight, wd, wcb);
}
else if (qi->use_relative == 1) // append relative
@@ -97,13 +98,13 @@ _queue_timer(void *data)
if (rcb)
{
wd->callbacks = eina_list_append_relative(wd->callbacks, wcb, rcb);
- e_ilist_append_relative(wd->o_ilist, qi->icon, qi->label, qi->header,
+ e_ilist_append_relative(wd->o_ilist, qi->icon, qi->end, qi->label, qi->header,
_e_wid_cb_item_sel, _e_wid_cb_item_hilight, wd, wcb, qi->relative);
}
else
{
wd->callbacks = eina_list_append(wd->callbacks, wcb);
- e_ilist_append(wd->o_ilist, qi->icon, qi->label, qi->header,
+ e_ilist_append(wd->o_ilist, qi->icon, qi->end, qi->label, qi->header,
_e_wid_cb_item_sel, _e_wid_cb_item_hilight, wd, wcb);
}
}
@@ -113,17 +114,18 @@ _queue_timer(void *data)
if (rcb)
{
wd->callbacks = eina_list_prepend_relative(wd->callbacks, wcb, rcb);
- e_ilist_prepend_relative(wd->o_ilist, qi->icon, qi->label, qi->header,
+ e_ilist_prepend_relative(wd->o_ilist, qi->icon, qi->end, qi->label, qi->header,
_e_wid_cb_item_sel, _e_wid_cb_item_hilight, wd, wcb, qi->relative);
}
else
{
wd->callbacks = eina_list_prepend(wd->callbacks, wcb);
- e_ilist_prepend(wd->o_ilist, qi->icon, qi->label, qi->header,
+ e_ilist_prepend(wd->o_ilist, qi->icon, qi->end, qi->label, qi->header,
_e_wid_cb_item_sel, _e_wid_cb_item_hilight, wd, wcb);
}
}
if (qi->icon) evas_object_show(qi->icon);
+ if (qi->end) evas_object_show(qi->end);
}
else if (qi->command == 1)
e_ilist_nth_label_set(wd->o_ilist, qi->item, qi->label);
@@ -169,6 +171,8 @@ _queue_timer(void *data)
e_ilist_multi_select(wd->o_ilist, qi->item);
else if (qi->command == 8)
e_ilist_range_select(wd->o_ilist, qi->item);
+ else if (qi->command == 9)
+ e_ilist_nth_end_set(wd->o_ilist, qi->item, qi->end);
_queue_remove(obj, qi, 0);
num++;
if (num >= 10) break;
@@ -194,6 +198,7 @@ static void
_queue_append(Evas_Object *obj,
int command,
Evas_Object *icon,
+ Evas_Object *end,
const char *label,
int header,
void (*func) (void *data),
@@ -211,6 +216,7 @@ _queue_append(Evas_Object *obj,
if (!qi) return;
qi->command = command;
qi->icon = icon;
+ qi->end = end;
qi->label = eina_stringshare_add(label);
qi->header = header;
qi->func = func;
@@ -233,6 +239,7 @@ _queue_remove(Evas_Object *obj, E_Widget_Queue_Item *qi, int del)
if (del)
{
if (qi->icon) evas_object_del(qi->icon);
+ if (qi->end) evas_object_del(qi->end);
}
eina_stringshare_del(qi->label);
eina_stringshare_del(qi->val);
@@ -311,7 +318,7 @@ e_widget_ilist_thaw(Evas_Object *obj)
EAPI void
e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, const char *label, void (*func) (void *data), void *data, const char *val)
{
- _queue_append(obj, 0, icon, label, 0, func, data, val, 0, 0, 0);
+ _queue_append(obj, 0, icon, NULL, label, 0, func, data, val, 0, 0, 0);
/*
E_Widget_Data *wd;
E_Widget_Callback *wcb;
@@ -330,9 +337,15 @@ e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, const char *label, vo
}
EAPI void
+e_widget_ilist_append_full(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, void (*func) (void *data), void *data, const char *val)
+{
+ _queue_append(obj, 0, icon, end, label, 0, func, data, val, 0, 0, 0);
+}
+
+EAPI void
e_widget_ilist_append_relative(Evas_Object *obj, Evas_Object *icon, const char *label, void (*func) (void *data), void *data, const char *val, int relative)
{
- _queue_append(obj, 0, icon, label, 0, func, data, val, relative,1, 0);
+ _queue_append(obj, 0, icon, NULL, label, 0, func, data, val, relative,1, 0);
/*
E_Widget_Data *wd;
E_Widget_Callback *wcb, *rcb;
@@ -362,9 +375,15 @@ e_widget_ilist_append_relative(Evas_Object *obj, Evas_Object *icon, const char *
}
EAPI void
+e_widget_ilist_append_relative_full(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, void (*func) (void *data), void *data, const char *val, int relative)
+{
+ _queue_append(obj, 0, icon, end, label, 0, func, data, val, relative,1, 0);
+}
+
+EAPI void
e_widget_ilist_prepend(Evas_Object *obj, Evas_Object *icon, const char *label, void (*func) (void *data), void *data, const char *val)
{
- _queue_append(obj, 0, icon, label, 0, func, data, val, 0, 2, 0);
+ _queue_append(obj, 0, icon, NULL, label, 0, func, data, val, 0, 2, 0);
/*
E_Widget_Data *wd;
E_Widget_Callback *wcb;
@@ -383,9 +402,15 @@ e_widget_ilist_prepend(Evas_Object *obj, Evas_Object *icon, const char *label, v
}
EAPI void
+e_widget_ilist_prepend_full(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, void (*func) (void *data), void *data, const char *val)
+{
+ _queue_append(obj, 0, icon, end, label, 0, func, data, val, 0, 2, 0);
+}
+
+EAPI void
e_widget_ilist_prepend_relative(Evas_Object *obj, Evas_Object *icon, const char *label, void (*func) (void *data), void *data, const char *val, int relative)
{
- _queue_append(obj, 0, icon, label, 0, func, data, val, relative, 3, 0);
+ _queue_append(obj, 0, icon, NULL, label, 0, func, data, val, relative, 3, 0);
/*
E_Widget_Data *wd;
E_Widget_Callback *wcb, *rcb;
@@ -415,9 +440,15 @@ e_widget_ilist_prepend_relative(Evas_Object *obj, Evas_Object *icon, const char
}
EAPI void
+e_widget_ilist_prepend_relative_full(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, void (*func) (void *data), void *data, const char *val, int relative)
+{
+ _queue_append(obj, 0, icon, end, label, 0, func, data, val, relative, 3, 0);
+}
+
+EAPI void
e_widget_ilist_header_append(Evas_Object *obj, Evas_Object *icon, const char *label)
{
- _queue_append(obj, 0, icon, label, 1, NULL, NULL, NULL, 0, 0, 0);
+ _queue_append(obj, 0, icon, NULL, label, 1, NULL, NULL, NULL, 0, 0, 0);
/*
E_Widget_Data *wd;
E_Widget_Callback *wcb;
@@ -499,7 +530,7 @@ e_widget_ilist_items_get(Evas_Object *obj)
return e_ilist_items_get(wd->o_ilist);
}
-EAPI int
+EAPI Eina_Bool
e_widget_ilist_nth_is_header(Evas_Object *obj, int n)
{
E_Widget_Data *wd;
@@ -511,7 +542,7 @@ e_widget_ilist_nth_is_header(Evas_Object *obj, int n)
EAPI void
e_widget_ilist_nth_label_set(Evas_Object *obj, int n, const char *label)
{
- _queue_append(obj, 1, NULL, label, 0, NULL, NULL, NULL, 0, 0, n);
+ _queue_append(obj, 1, NULL, NULL, label, 0, NULL, NULL, NULL, 0, 0, n);
/*
E_Widget_Data *wd;
@@ -532,7 +563,7 @@ e_widget_ilist_nth_label_get(Evas_Object *obj, int n)
EAPI void
e_widget_ilist_nth_icon_set(Evas_Object *obj, int n, Evas_Object *icon)
{
- _queue_append(obj, 2, icon, NULL, 0, NULL, NULL, NULL, 0, 0, n);
+ _queue_append(obj, 2, icon, NULL, NULL, 0, NULL, NULL, NULL, 0, 0, n);
/*
E_Widget_Data *wd;
@@ -550,6 +581,21 @@ e_widget_ilist_nth_icon_get(Evas_Object *obj, int n)
return e_ilist_nth_icon_get(wd->o_ilist, n);
}
+EAPI void
+e_widget_ilist_nth_end_set(Evas_Object *obj, int n, Evas_Object *end)
+{
+ _queue_append(obj, 9, NULL, end, NULL, 0, NULL, NULL, NULL, 0, 0, n);
+}
+
+EAPI Evas_Object *
+e_widget_ilist_nth_end_get(Evas_Object *obj, int n)
+{
+ E_Widget_Data *wd;
+
+ wd = e_widget_data_get(obj);
+ return e_ilist_nth_end_get(wd->o_ilist, n);
+}
+
EAPI void *
e_widget_ilist_nth_data_get(Evas_Object *obj, int n)
{
@@ -566,6 +612,79 @@ e_widget_ilist_nth_data_get(Evas_Object *obj, int n)
}
/**
+ * Return if the given item returned by e_widget_ilist_items_get()
+ * is a header.
+ *
+ * This avoid expensive lookups to the nth element, however it's not
+ * able to check any validity on the given pointer and may crash. Be
+ * sure to use only with valid return of e_widget_ilist_items_get().
+ */
+EAPI Eina_Bool
+e_widget_ilist_item_is_header(const E_Ilist_Item *it)
+{
+ return it->header;
+}
+
+/**
+ * Return the label of given item returned by e_widget_ilist_items_get().
+ *
+ * This avoid expensive lookups to the nth element, however it's not
+ * able to check any validity on the given pointer and may crash. Be
+ * sure to use only with valid return of e_widget_ilist_items_get().
+ */
+EAPI const char *
+e_widget_ilist_item_label_get(const E_Ilist_Item *it)
+{
+ return it->label;
+}
+
+/**
+ * Return the icon of given item returned by e_widget_ilist_items_get().
+ *
+ * This avoid expensive lookups to the nth element, however it's not
+ * able to check any validity on the given pointer and may crash. Be
+ * sure to use only with valid return of e_widget_ilist_items_get().
+ *
+ * Do not delete this object!
+ */
+EAPI Evas_Object *
+e_widget_ilist_item_icon_get(const E_Ilist_Item *it)
+{
+ return it->o_icon;
+}
+
+/**
+ * Return the end of given item returned by e_widget_ilist_items_get().
+ *
+ * This avoid expensive lookups to the nth element, however it's not
+ * able to check any validity on the given pointer and may crash. Be
+ * sure to use only with valid return of e_widget_ilist_items_get().
+ *
+ * Do not delete this object!
+ */
+EAPI Evas_Object *
+e_widget_ilist_item_end_get(const E_Ilist_Item *it)
+{
+ return it->o_end;
+}
+
+/**
+ * Return the data of given item returned by e_widget_ilist_items_get().
+ *
+ * This avoid expensive lookups to the nth element, however it's not
+ * able to check any validity on the given pointer and may crash. Be
+ * sure to use only with valid return of e_widget_ilist_items_get().
+ *
+ * Do not delete this object!
+ */
+EAPI void *
+e_widget_ilist_item_data_get(const E_Ilist_Item *it)
+{
+ E_Widget_Callback *wcb = it->data2;
+ return wcb->data;
+}
+
+/**
* Show the nth element of an ilist
* @param obj the ilist
* @param n the number of the element to show
@@ -575,7 +694,7 @@ e_widget_ilist_nth_data_get(Evas_Object *obj, int n)
EAPI void
e_widget_ilist_nth_show(Evas_Object *obj, int n, int top)
{
- _queue_append(obj, 3, NULL, NULL, 0, NULL, NULL, NULL, 0, top, n);
+ _queue_append(obj, 3, NULL, NULL, NULL, 0, NULL, NULL, NULL, 0, top, n);
/*
E_Widget_Data *wd;
Evas_Coord x, y, w, h;
@@ -592,7 +711,7 @@ e_widget_ilist_nth_show(Evas_Object *obj, int n, int top)
EAPI void
e_widget_ilist_selected_set(Evas_Object *obj, int n)
{
- _queue_append(obj, 4, NULL, NULL, 0, NULL, NULL, NULL, 0, 0, n);
+ _queue_append(obj, 4, NULL, NULL, NULL, 0, NULL, NULL, NULL, 0, 0, n);
/*
E_Widget_Data *wd;
@@ -628,6 +747,15 @@ e_widget_ilist_selected_icon_get(Evas_Object *obj)
return e_ilist_selected_icon_get(wd->o_ilist);
}
+EAPI Evas_Object *
+e_widget_ilist_selected_end_get(Evas_Object *obj)
+{
+ E_Widget_Data *wd;
+
+ wd = e_widget_data_get(obj);
+ return e_ilist_selected_end_get(wd->o_ilist);
+}
+
EAPI int
e_widget_ilist_selected_count_get(Evas_Object *obj)
{
@@ -640,7 +768,7 @@ e_widget_ilist_selected_count_get(Evas_Object *obj)
EAPI void
e_widget_ilist_unselect(Evas_Object *obj)
{
- _queue_append(obj, 5, NULL, NULL, 0, NULL, NULL, NULL, 0, 0, 0);
+ _queue_append(obj, 5, NULL, NULL, NULL, 0, NULL, NULL, NULL, 0, 0, 0);
/*
E_Widget_Data *wd;
@@ -695,7 +823,7 @@ e_widget_ilist_multi_select_get(Evas_Object *obj)
EAPI void
e_widget_ilist_multi_select(Evas_Object *obj, int n)
{
- _queue_append(obj, 7, NULL, NULL, 0, NULL, NULL, NULL, 0, 0, n);
+ _queue_append(obj, 7, NULL, NULL, NULL, 0, NULL, NULL, NULL, 0, 0, n);
/*
E_Widget_Data *wd;
@@ -707,7 +835,7 @@ e_widget_ilist_multi_select(Evas_Object *obj, int n)
EAPI void
e_widget_ilist_range_select(Evas_Object *obj, int n)
{
- _queue_append(obj, 8, NULL, NULL, 0, NULL, NULL, NULL, 0, 0, n);
+ _queue_append(obj, 8, NULL, NULL, NULL, 0, NULL, NULL, NULL, 0, 0, n);
/*
E_Widget_Data *wd;
@@ -767,7 +895,7 @@ _e_wid_focus_hook(Evas_Object *obj)
}
static void
-_e_wid_cb_scrollframe_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
+_e_wid_cb_scrollframe_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
Evas_Coord mw, mh, vw, vh, w, h;
@@ -807,7 +935,7 @@ _e_wid_cb_item_sel(void *data, void *data2)
}
static void
-_e_wid_cb_item_hilight(void *data, void *data2)
+_e_wid_cb_item_hilight(void *data, void *data2 __UNUSED__)
{
E_Widget_Data *wd;
Evas_Coord x, y, w, h;
@@ -818,13 +946,13 @@ _e_wid_cb_item_hilight(void *data, void *data2)
}
static void
-_e_wid_cb_selected(void *data, Evas_Object *obj, void *event_info)
+_e_wid_cb_selected(void *data, Evas_Object *obj __UNUSED__, void *event_info)
{
evas_object_smart_callback_call(data, "selected", event_info);
}
static void
-_e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *event_info)
+_e_wid_focus_steal(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
e_widget_focus_steal(data);
}
diff --git a/src/bin/e_widget_ilist.h b/src/bin/e_widget_ilist.h
index d3693600c..6b0287c9c 100644
--- a/src/bin/e_widget_ilist.h
+++ b/src/bin/e_widget_ilist.h
@@ -13,23 +13,40 @@ EAPI void e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, con
EAPI void e_widget_ilist_append_relative(Evas_Object *obj, Evas_Object *icon, const char *label, void (*func) (void *data), void *data, const char *val, int relative);
EAPI void e_widget_ilist_prepend(Evas_Object *obj, Evas_Object *icon, const char *label, void (*func) (void *data), void *data, const char *val);
EAPI void e_widget_ilist_prepend_relative(Evas_Object *obj, Evas_Object *icon, const char *label, void (*func) (void *data), void *data, const char *val, int relative);
+
+EAPI void e_widget_ilist_append_full(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, void (*func) (void *data), void *data, const char *val);
+EAPI void e_widget_ilist_append_relative_full(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, void (*func) (void *data), void *data, const char *val, int relative);
+EAPI void e_widget_ilist_prepend_full(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, void (*func) (void *data), void *data, const char *val);
+EAPI void e_widget_ilist_prepend_relative_full(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, void (*func) (void *data), void *data, const char *val, int relative);
+
EAPI void e_widget_ilist_header_append(Evas_Object *obj, Evas_Object *icon, const char *label);
EAPI void e_widget_ilist_selector_set(Evas_Object *obj, int selector);
EAPI void e_widget_ilist_go(Evas_Object *obj);
EAPI void e_widget_ilist_clear(Evas_Object *obj);
EAPI int e_widget_ilist_count(Evas_Object *obj);
EAPI Eina_List *e_widget_ilist_items_get(Evas_Object *obj);
-EAPI int e_widget_ilist_nth_is_header(Evas_Object *obj, int n);
+
+EAPI Eina_Bool e_widget_ilist_nth_is_header(Evas_Object *obj, int n);
EAPI void e_widget_ilist_nth_label_set(Evas_Object *obj, int n, const char *label);
EAPI const char *e_widget_ilist_nth_label_get(Evas_Object *obj, int n);
EAPI void e_widget_ilist_nth_icon_set(Evas_Object *obj, int n, Evas_Object *icon);
EAPI Evas_Object *e_widget_ilist_nth_icon_get(Evas_Object *obj, int n);
+EAPI void e_widget_ilist_nth_end_set(Evas_Object *obj, int n, Evas_Object *end);
+EAPI Evas_Object *e_widget_ilist_nth_end_get(Evas_Object *obj, int n);
EAPI void *e_widget_ilist_nth_data_get(Evas_Object *obj, int n);
+
+EAPI Eina_Bool e_widget_ilist_item_is_header(const E_Ilist_Item *it);
+EAPI const char *e_widget_ilist_item_label_get(const E_Ilist_Item *it);
+EAPI Evas_Object *e_widget_ilist_item_icon_get(const E_Ilist_Item *it);
+EAPI Evas_Object *e_widget_ilist_item_end_get(const E_Ilist_Item *it);
+EAPI void *e_widget_ilist_item_data_get(const E_Ilist_Item *it);
+
EAPI void e_widget_ilist_nth_show(Evas_Object *obj, int n, int top);
EAPI void e_widget_ilist_selected_set(Evas_Object *obj, int n);
EAPI int e_widget_ilist_selected_get(Evas_Object *obj);
EAPI const char *e_widget_ilist_selected_label_get(Evas_Object *obj);
EAPI Evas_Object *e_widget_ilist_selected_icon_get(Evas_Object *obj);
+EAPI Evas_Object *e_widget_ilist_selected_end_get(Evas_Object *obj);
EAPI int e_widget_ilist_selected_count_get(Evas_Object *obj);
EAPI void e_widget_ilist_unselect(Evas_Object *obj);
EAPI void e_widget_ilist_remove_num(Evas_Object *obj, int n);