forked from enlightenment/enlightenment
E_Ilist
- Remove tons of nasty whitespace. - Initialize some list vars to NULL before use. - Reduce some 2 line checks (x = data; if !x return) into single line. - When setting an ilist item to selectable via API, check that the item is not a header as these are not selectable currently. - Add some NBs for if/when headers do become selectable. Modules Dialog: - Initialize some list vars to NULL before use. - Reduce some 2 line checks (x = data; if !x return) into single line. - When loading/unload module(s), attempt to reselect the next item in the list(s). sshh...I wasn't here ;) SVN revision: 34303
This commit is contained in:
parent
2706ecfece
commit
e3e488a9b6
|
@ -11,8 +11,7 @@ typedef struct _E_Smart_Data E_Smart_Data;
|
||||||
struct _E_Smart_Data
|
struct _E_Smart_Data
|
||||||
{
|
{
|
||||||
Evas_Coord x, y, w, h, iw, ih;
|
Evas_Coord x, y, w, h, iw, ih;
|
||||||
Evas_Object *o_smart;
|
Evas_Object *o_smart, *o_box;
|
||||||
Evas_Object *o_box;
|
|
||||||
Evas_List *items;
|
Evas_List *items;
|
||||||
int selected;
|
int selected;
|
||||||
unsigned char selector : 1;
|
unsigned char selector : 1;
|
||||||
|
@ -268,12 +267,13 @@ EAPI void
|
||||||
e_ilist_clear(Evas_Object *obj)
|
e_ilist_clear(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
API_ENTRY return;
|
API_ENTRY return;
|
||||||
|
|
||||||
e_ilist_freeze(obj);
|
e_ilist_freeze(obj);
|
||||||
while (sd->items)
|
while (sd->items)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si = NULL;
|
||||||
|
|
||||||
si = sd->items->data;
|
if (!(si = sd->items->data)) continue;
|
||||||
sd->items = evas_list_remove_list(sd->items, sd->items);
|
sd->items = evas_list_remove_list(sd->items, sd->items);
|
||||||
if (si->o_icon) evas_object_del(si->o_icon);
|
if (si->o_icon) evas_object_del(si->o_icon);
|
||||||
evas_object_del(si->o_base);
|
evas_object_del(si->o_base);
|
||||||
|
@ -342,17 +342,17 @@ e_ilist_min_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
|
||||||
EAPI void
|
EAPI void
|
||||||
e_ilist_unselect(Evas_Object *obj)
|
e_ilist_unselect(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
Evas_List *l;
|
Evas_List *l = NULL;
|
||||||
|
|
||||||
API_ENTRY return;
|
API_ENTRY return;
|
||||||
|
|
||||||
if (!sd->items) return;
|
if (!sd->items) return;
|
||||||
if (sd->selected < 0) return;
|
if (sd->selected < 0) return;
|
||||||
for (l = sd->items; l; l = l->next)
|
for (l = sd->items; l; l = l->next)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si = NULL;
|
||||||
|
|
||||||
si = l->data;
|
if (!(si = l->data)) continue;
|
||||||
if (!si) continue;
|
|
||||||
if (!si->selected) continue;
|
if (!si->selected) continue;
|
||||||
edje_object_signal_emit(si->o_base, "e,state,unselected", "e");
|
edje_object_signal_emit(si->o_base, "e,state,unselected", "e");
|
||||||
si->selected = 0;
|
si->selected = 0;
|
||||||
|
@ -363,8 +363,8 @@ e_ilist_unselect(Evas_Object *obj)
|
||||||
EAPI void
|
EAPI void
|
||||||
e_ilist_selected_set(Evas_Object *obj, int n)
|
e_ilist_selected_set(Evas_Object *obj, int n)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si = NULL;
|
||||||
Evas_List *l;
|
Evas_List *l = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
API_ENTRY return;
|
API_ENTRY return;
|
||||||
|
@ -376,15 +376,17 @@ e_ilist_selected_set(Evas_Object *obj, int n)
|
||||||
|
|
||||||
for (l = sd->items; l; l = l->next)
|
for (l = sd->items; l; l = l->next)
|
||||||
{
|
{
|
||||||
si = l->data;
|
if (!(si = l->data)) continue;
|
||||||
if (!si) continue;
|
if ((!si->selected) || (si->header)) continue;
|
||||||
if (!si->selected) continue;
|
|
||||||
edje_object_signal_emit(si->o_base, "e,state,unselected", "e");
|
edje_object_signal_emit(si->o_base, "e,state,unselected", "e");
|
||||||
si->selected = 0;
|
si->selected = 0;
|
||||||
}
|
}
|
||||||
sd->selected = -1;
|
sd->selected = -1;
|
||||||
si = evas_list_nth(sd->items, n);
|
if (!(si = evas_list_nth(sd->items, n))) return;
|
||||||
if (!si) return;
|
|
||||||
|
/* NB: Remove this if headers ever become selectable */
|
||||||
|
if (si->header) return;
|
||||||
|
|
||||||
si->selected = 1;
|
si->selected = 1;
|
||||||
sd->selected = n;
|
sd->selected = n;
|
||||||
evas_object_raise(si->o_base);
|
evas_object_raise(si->o_base);
|
||||||
|
@ -400,7 +402,7 @@ e_ilist_selected_set(Evas_Object *obj, int n)
|
||||||
EAPI int
|
EAPI int
|
||||||
e_ilist_selected_get(Evas_Object *obj)
|
e_ilist_selected_get(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
Evas_List *l;
|
Evas_List *l = NULL;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
API_ENTRY return -1;
|
API_ENTRY return -1;
|
||||||
|
@ -412,10 +414,9 @@ e_ilist_selected_get(Evas_Object *obj)
|
||||||
j = -1;
|
j = -1;
|
||||||
for (i = 0, l = sd->items; l; l = l->next, i++)
|
for (i = 0, l = sd->items; l; l = l->next, i++)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *li;
|
E_Ilist_Item *li = NULL;
|
||||||
|
|
||||||
li = l->data;
|
if (!(li = l->data)) continue;
|
||||||
if (!li) continue;
|
|
||||||
if (li->selected) j = i;
|
if (li->selected) j = i;
|
||||||
}
|
}
|
||||||
return j;
|
return j;
|
||||||
|
@ -425,7 +426,7 @@ e_ilist_selected_get(Evas_Object *obj)
|
||||||
EAPI const char *
|
EAPI const char *
|
||||||
e_ilist_selected_label_get(Evas_Object *obj)
|
e_ilist_selected_label_get(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si = NULL;
|
||||||
|
|
||||||
API_ENTRY return NULL;
|
API_ENTRY return NULL;
|
||||||
if (!sd->items) return NULL;
|
if (!sd->items) return NULL;
|
||||||
|
@ -439,7 +440,7 @@ e_ilist_selected_label_get(Evas_Object *obj)
|
||||||
EAPI void *
|
EAPI void *
|
||||||
e_ilist_selected_data_get(Evas_Object *obj)
|
e_ilist_selected_data_get(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si = NULL;
|
||||||
|
|
||||||
API_ENTRY return NULL;
|
API_ENTRY return NULL;
|
||||||
if (!sd->items) return NULL;
|
if (!sd->items) return NULL;
|
||||||
|
@ -453,7 +454,7 @@ e_ilist_selected_data_get(Evas_Object *obj)
|
||||||
EAPI void *
|
EAPI void *
|
||||||
e_ilist_selected_data2_get(Evas_Object *obj)
|
e_ilist_selected_data2_get(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si = NULL;
|
||||||
|
|
||||||
API_ENTRY return NULL;
|
API_ENTRY return NULL;
|
||||||
if (!sd->items) return NULL;
|
if (!sd->items) return NULL;
|
||||||
|
@ -467,7 +468,7 @@ e_ilist_selected_data2_get(Evas_Object *obj)
|
||||||
EAPI Evas_Object *
|
EAPI Evas_Object *
|
||||||
e_ilist_selected_icon_get(Evas_Object *obj)
|
e_ilist_selected_icon_get(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si = NULL;
|
||||||
|
|
||||||
API_ENTRY return NULL;
|
API_ENTRY return NULL;
|
||||||
if (!sd->items) return NULL;
|
if (!sd->items) return NULL;
|
||||||
|
@ -481,13 +482,12 @@ e_ilist_selected_icon_get(Evas_Object *obj)
|
||||||
EAPI void
|
EAPI void
|
||||||
e_ilist_selected_geometry_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
e_ilist_selected_geometry_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si = NULL;
|
||||||
|
|
||||||
API_ENTRY return;
|
API_ENTRY return;
|
||||||
if (!sd->items) return;
|
if (!sd->items) return;
|
||||||
if (sd->selected < 0) return;
|
if (sd->selected < 0) return;
|
||||||
si = evas_list_nth(sd->items, sd->selected);
|
if (!(si = evas_list_nth(sd->items, sd->selected))) return;
|
||||||
if (!si) return;
|
|
||||||
evas_object_geometry_get(si->o_base, x, y, w, h);
|
evas_object_geometry_get(si->o_base, x, y, w, h);
|
||||||
*x -= sd->x;
|
*x -= sd->x;
|
||||||
*y -= sd->y;
|
*y -= sd->y;
|
||||||
|
@ -503,10 +503,9 @@ e_ilist_selected_count_get(Evas_Object *obj)
|
||||||
if (!sd->items) return 0;
|
if (!sd->items) return 0;
|
||||||
for (l = sd->items; l; l = l->next)
|
for (l = sd->items; l; l = l->next)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si = NULL;
|
||||||
|
|
||||||
si = l->data;
|
if (!(si = l->data)) continue;
|
||||||
if (!si) continue;
|
|
||||||
if (si->selected) count++;
|
if (si->selected) count++;
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
|
@ -515,12 +514,11 @@ e_ilist_selected_count_get(Evas_Object *obj)
|
||||||
EAPI void
|
EAPI void
|
||||||
e_ilist_remove_num(Evas_Object *obj, int n)
|
e_ilist_remove_num(Evas_Object *obj, int n)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si = NULL;
|
||||||
|
|
||||||
API_ENTRY return;
|
API_ENTRY return;
|
||||||
if (!sd->items) return;
|
if (!sd->items) return;
|
||||||
si = evas_list_nth(sd->items, n);
|
if (!(si = evas_list_nth(sd->items, n))) return;
|
||||||
if (!si) return;
|
|
||||||
sd->items = evas_list_remove(sd->items, si);
|
sd->items = evas_list_remove(sd->items, si);
|
||||||
if (sd->selected == n) sd->selected = -1;
|
if (sd->selected == n) sd->selected = -1;
|
||||||
if (si->o_icon) evas_object_del(si->o_icon);
|
if (si->o_icon) evas_object_del(si->o_icon);
|
||||||
|
@ -531,7 +529,7 @@ e_ilist_remove_num(Evas_Object *obj, int n)
|
||||||
EAPI const char *
|
EAPI const char *
|
||||||
e_ilist_nth_label_get(Evas_Object *obj, int n)
|
e_ilist_nth_label_get(Evas_Object *obj, int n)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si = NULL;
|
||||||
|
|
||||||
API_ENTRY return NULL;
|
API_ENTRY return NULL;
|
||||||
if (!sd->items) return NULL;
|
if (!sd->items) return NULL;
|
||||||
|
@ -543,11 +541,13 @@ e_ilist_nth_label_get(Evas_Object *obj, int n)
|
||||||
EAPI void
|
EAPI void
|
||||||
e_ilist_nth_label_set(Evas_Object *obj, int n, const char *label)
|
e_ilist_nth_label_set(Evas_Object *obj, int n, const char *label)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si = NULL;
|
||||||
|
|
||||||
|
/* check for a NULL label first...simplier, faster check then doing
|
||||||
|
* API_ENTRY check first */
|
||||||
|
if (!label) return;
|
||||||
API_ENTRY return;
|
API_ENTRY return;
|
||||||
if (!sd->items) return;
|
if (!sd->items) return;
|
||||||
if (!label) return;
|
|
||||||
si = evas_list_nth(sd->items, n);
|
si = evas_list_nth(sd->items, n);
|
||||||
if (si) edje_object_part_text_set(si->o_base, "e.text.label", label);
|
if (si) edje_object_part_text_set(si->o_base, "e.text.label", label);
|
||||||
}
|
}
|
||||||
|
@ -555,7 +555,7 @@ e_ilist_nth_label_set(Evas_Object *obj, int n, const char *label)
|
||||||
EAPI Evas_Object *
|
EAPI Evas_Object *
|
||||||
e_ilist_nth_icon_get(Evas_Object *obj, int n)
|
e_ilist_nth_icon_get(Evas_Object *obj, int n)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si = NULL;
|
||||||
|
|
||||||
API_ENTRY return NULL;
|
API_ENTRY return NULL;
|
||||||
if (!sd->items) return NULL;
|
if (!sd->items) return NULL;
|
||||||
|
@ -567,12 +567,11 @@ e_ilist_nth_icon_get(Evas_Object *obj, int n)
|
||||||
EAPI void
|
EAPI void
|
||||||
e_ilist_nth_icon_set(Evas_Object *obj, int n, Evas_Object *icon)
|
e_ilist_nth_icon_set(Evas_Object *obj, int n, Evas_Object *icon)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si = NULL;
|
||||||
|
|
||||||
API_ENTRY return;
|
API_ENTRY return;
|
||||||
if (!sd->items) return;
|
if (!sd->items) return;
|
||||||
si = evas_list_nth(sd->items, n);
|
if (!(si = evas_list_nth(sd->items, n))) return;
|
||||||
if (!si) return;
|
|
||||||
if (si->o_icon)
|
if (si->o_icon)
|
||||||
{
|
{
|
||||||
edje_object_part_unswallow(si->o_base, si->o_icon);
|
edje_object_part_unswallow(si->o_base, si->o_icon);
|
||||||
|
@ -590,7 +589,7 @@ e_ilist_nth_icon_set(Evas_Object *obj, int n, Evas_Object *icon)
|
||||||
EAPI int
|
EAPI int
|
||||||
e_ilist_nth_is_header(Evas_Object *obj, int n)
|
e_ilist_nth_is_header(Evas_Object *obj, int n)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si = NULL;
|
||||||
|
|
||||||
API_ENTRY return 0;
|
API_ENTRY return 0;
|
||||||
if (!sd->items) return 0;
|
if (!sd->items) return 0;
|
||||||
|
@ -602,14 +601,11 @@ e_ilist_nth_is_header(Evas_Object *obj, int n)
|
||||||
EAPI void
|
EAPI void
|
||||||
e_ilist_nth_geometry_get(Evas_Object *obj, int n, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
e_ilist_nth_geometry_get(Evas_Object *obj, int n, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si = NULL;
|
||||||
|
|
||||||
API_ENTRY return;
|
API_ENTRY return;
|
||||||
if (!sd->items) return;
|
if (!sd->items) return;
|
||||||
|
if (!(si = evas_list_nth(sd->items, n))) return;
|
||||||
si = evas_list_nth(sd->items, n);
|
|
||||||
if (!si) return;
|
|
||||||
|
|
||||||
evas_object_geometry_get(si->o_base, x, y, w, h);
|
evas_object_geometry_get(si->o_base, x, y, w, h);
|
||||||
*x -= sd->x;
|
*x -= sd->x;
|
||||||
*y -= sd->y;
|
*y -= sd->y;
|
||||||
|
@ -618,7 +614,7 @@ e_ilist_nth_geometry_get(Evas_Object *obj, int n, Evas_Coord *x, Evas_Coord *y,
|
||||||
EAPI void
|
EAPI void
|
||||||
e_ilist_icon_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
|
e_ilist_icon_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
|
||||||
{
|
{
|
||||||
Evas_List *l;
|
Evas_List *l = NULL;
|
||||||
|
|
||||||
API_ENTRY return;
|
API_ENTRY return;
|
||||||
if ((sd->iw == w) && (sd->ih == h)) return;
|
if ((sd->iw == w) && (sd->ih == h)) return;
|
||||||
|
@ -626,11 +622,10 @@ e_ilist_icon_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
|
||||||
sd->ih = h;
|
sd->ih = h;
|
||||||
for (l = sd->items; l; l = l->next)
|
for (l = sd->items; l; l = l->next)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si = NULL;
|
||||||
Evas_Coord mw = 0, mh = 0;
|
Evas_Coord mw = 0, mh = 0;
|
||||||
|
|
||||||
si = l->data;
|
if (!(si = l->data)) continue;
|
||||||
if (!si) continue;
|
|
||||||
if (!si->o_icon) continue;
|
if (!si->o_icon) continue;
|
||||||
edje_extern_object_min_size_set(si->o_icon, w, h);
|
edje_extern_object_min_size_set(si->o_icon, w, h);
|
||||||
edje_object_part_swallow(si->o_base, "e.swallow.icon", si->o_icon);
|
edje_object_part_swallow(si->o_base, "e.swallow.icon", si->o_icon);
|
||||||
|
@ -650,7 +645,7 @@ e_ilist_items_get(Evas_Object *obj)
|
||||||
EAPI void
|
EAPI void
|
||||||
e_ilist_multi_select(Evas_Object *obj, int n)
|
e_ilist_multi_select(Evas_Object *obj, int n)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
API_ENTRY return;
|
API_ENTRY return;
|
||||||
|
@ -661,8 +656,7 @@ e_ilist_multi_select(Evas_Object *obj, int n)
|
||||||
if (n >= i) n = i - 1;
|
if (n >= i) n = i - 1;
|
||||||
else if (n < 0) n = 0;
|
else if (n < 0) n = 0;
|
||||||
|
|
||||||
si = evas_list_nth(sd->items, n);
|
if (!(si = evas_list_nth(sd->items, n))) return;
|
||||||
if (!si) return;
|
|
||||||
sd->selected = n;
|
sd->selected = n;
|
||||||
if (si->selected)
|
if (si->selected)
|
||||||
{
|
{
|
||||||
|
@ -690,7 +684,7 @@ e_ilist_multi_select(Evas_Object *obj, int n)
|
||||||
EAPI void
|
EAPI void
|
||||||
e_ilist_range_select(Evas_Object *obj, int n)
|
e_ilist_range_select(Evas_Object *obj, int n)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si = NULL;
|
||||||
int i, j, dir;
|
int i, j, dir;
|
||||||
|
|
||||||
API_ENTRY return;
|
API_ENTRY return;
|
||||||
|
@ -704,8 +698,7 @@ e_ilist_range_select(Evas_Object *obj, int n)
|
||||||
if (n < sd->selected) dir = 0;
|
if (n < sd->selected) dir = 0;
|
||||||
else dir = 1;
|
else dir = 1;
|
||||||
|
|
||||||
si = evas_list_nth(sd->items, n);
|
if (!(si = evas_list_nth(sd->items, n))) return;
|
||||||
if (!si) return;
|
|
||||||
if (dir == 1)
|
if (dir == 1)
|
||||||
{
|
{
|
||||||
for (j = (sd->selected + 1); ((j < i) && (j <= n)); j++)
|
for (j = (sd->selected + 1); ((j < i) && (j <= n)); j++)
|
||||||
|
@ -844,7 +837,7 @@ _e_smart_event_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_
|
||||||
E_Smart_Data *sd;
|
E_Smart_Data *sd;
|
||||||
Evas_Event_Mouse_Down *ev;
|
Evas_Event_Mouse_Down *ev;
|
||||||
E_Ilist_Item *si;
|
E_Ilist_Item *si;
|
||||||
Evas_List *l;
|
Evas_List *l = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ev = event_info;
|
ev = event_info;
|
||||||
|
@ -854,7 +847,9 @@ _e_smart_event_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_
|
||||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) sd->on_hold = 1;
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) sd->on_hold = 1;
|
||||||
else sd->on_hold = 0;
|
else sd->on_hold = 0;
|
||||||
|
|
||||||
|
/* NB: Remove if headers ever become selectable */
|
||||||
if (si->header) return;
|
if (si->header) return;
|
||||||
|
|
||||||
if (!sd->items) return;
|
if (!sd->items) return;
|
||||||
for (i = 0, l = sd->items; l; l = l->next, i++)
|
for (i = 0, l = sd->items; l; l = l->next, i++)
|
||||||
{
|
{
|
||||||
|
@ -893,11 +888,12 @@ _e_smart_event_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_in
|
||||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) sd->on_hold = 1;
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) sd->on_hold = 1;
|
||||||
else sd->on_hold = 0;
|
else sd->on_hold = 0;
|
||||||
|
|
||||||
|
/* NB: Remove if headers ever become selectable */
|
||||||
if (si->header) return;
|
if (si->header) return;
|
||||||
|
|
||||||
if (!sd->items) return;
|
if (!sd->items) return;
|
||||||
if (!sd->selector) return;
|
if (!sd->selector) return;
|
||||||
si = evas_list_nth(sd->items, sd->selected);
|
if (!(si = evas_list_nth(sd->items, sd->selected))) return;
|
||||||
if (!si) return;
|
|
||||||
if (sd->on_hold)
|
if (sd->on_hold)
|
||||||
{
|
{
|
||||||
sd->on_hold = 0;
|
sd->on_hold = 0;
|
||||||
|
@ -931,7 +927,7 @@ _e_smart_event_key_down(void *data, Evas *evas, Evas_Object *obj, void *event_in
|
||||||
n = ns;
|
n = ns;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
-- n;
|
--n;
|
||||||
si = evas_list_nth(sd->items, n);
|
si = evas_list_nth(sd->items, n);
|
||||||
}
|
}
|
||||||
while ((si) && (si->header));
|
while ((si) && (si->header));
|
||||||
|
@ -957,7 +953,7 @@ _e_smart_event_key_down(void *data, Evas *evas, Evas_Object *obj, void *event_in
|
||||||
n = ns;
|
n = ns;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++ n;
|
++n;
|
||||||
si = evas_list_nth(sd->items, n);
|
si = evas_list_nth(sd->items, n);
|
||||||
}
|
}
|
||||||
while ((si) && (si->header));
|
while ((si) && (si->header));
|
||||||
|
@ -983,7 +979,7 @@ _e_smart_event_key_down(void *data, Evas *evas, Evas_Object *obj, void *event_in
|
||||||
n = ns;
|
n = ns;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++ n;
|
++n;
|
||||||
si = evas_list_nth(sd->items, n);
|
si = evas_list_nth(sd->items, n);
|
||||||
}
|
}
|
||||||
while ((si) && (si->header));
|
while ((si) && (si->header));
|
||||||
|
@ -1009,7 +1005,7 @@ _e_smart_event_key_down(void *data, Evas *evas, Evas_Object *obj, void *event_in
|
||||||
n = ns;
|
n = ns;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
-- n;
|
--n;
|
||||||
si = evas_list_nth(sd->items, n);
|
si = evas_list_nth(sd->items, n);
|
||||||
}
|
}
|
||||||
while ((si) && (si->header));
|
while ((si) && (si->header));
|
||||||
|
|
|
@ -34,7 +34,8 @@ struct _E_Config_Dialog_Data
|
||||||
|
|
||||||
/* Key pairs for module types
|
/* Key pairs for module types
|
||||||
*
|
*
|
||||||
* Should be in alphabetic order */
|
* Should be in alphabetic order
|
||||||
|
*/
|
||||||
const CFTypes _types[] =
|
const CFTypes _types[] =
|
||||||
{
|
{
|
||||||
{"appearance", N_("Appearance")},
|
{"appearance", N_("Appearance")},
|
||||||
|
@ -119,6 +120,7 @@ _create_data(E_Config_Dialog *cfd)
|
||||||
|
|
||||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||||
if (!cfdata) return NULL;
|
if (!cfdata) return NULL;
|
||||||
|
|
||||||
_fill_data(cfdata);
|
_fill_data(cfdata);
|
||||||
return cfdata;
|
return cfdata;
|
||||||
}
|
}
|
||||||
|
@ -136,8 +138,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
E_Path_Dir *epd = NULL;
|
E_Path_Dir *epd = NULL;
|
||||||
|
|
||||||
epd = l->data;
|
if (!(epd = l->data)) continue;
|
||||||
if (!epd) continue;
|
|
||||||
if (!ecore_file_is_dir(epd->dir)) continue;
|
if (!ecore_file_is_dir(epd->dir)) continue;
|
||||||
_load_modules(epd->dir);
|
_load_modules(epd->dir);
|
||||||
}
|
}
|
||||||
|
@ -229,8 +230,7 @@ _load_modules(const char *dir)
|
||||||
char *mod = NULL;
|
char *mod = NULL;
|
||||||
|
|
||||||
if (!dir) return;
|
if (!dir) return;
|
||||||
files = ecore_file_ls(dir);
|
if (!(files = ecore_file_ls(dir))) return;
|
||||||
if (!files) return;
|
|
||||||
|
|
||||||
/* get all modules in this path_dir */
|
/* get all modules in this path_dir */
|
||||||
ecore_list_first_goto(files);
|
ecore_list_first_goto(files);
|
||||||
|
@ -245,8 +245,7 @@ _load_modules(const char *dir)
|
||||||
/* check that we have a desktop file for this module */
|
/* check that we have a desktop file for this module */
|
||||||
snprintf(buf, sizeof(buf), "%s/%s/module.desktop", dir, mod);
|
snprintf(buf, sizeof(buf), "%s/%s/module.desktop", dir, mod);
|
||||||
if (!ecore_file_exists(buf)) continue;
|
if (!ecore_file_exists(buf)) continue;
|
||||||
desk = efreet_desktop_get(buf);
|
if (!(desk = efreet_desktop_get(buf))) continue;
|
||||||
if (!desk) continue;
|
|
||||||
|
|
||||||
/* does the ModuleType exist in desktop? */
|
/* does the ModuleType exist in desktop? */
|
||||||
if (desk->x)
|
if (desk->x)
|
||||||
|
@ -308,8 +307,7 @@ _fill_list(Evas_Object *obj, int enabled)
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
if (!_types[i].key) continue;
|
if (!_types[i].key) continue;
|
||||||
cft = evas_hash_find(types_hash, _types[i].key);
|
if (!(cft = evas_hash_find(types_hash, _types[i].key))) continue;
|
||||||
if (!cft) continue;
|
|
||||||
if (cft->modules)
|
if (cft->modules)
|
||||||
{
|
{
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
|
@ -324,6 +322,7 @@ _fill_list(Evas_Object *obj, int enabled)
|
||||||
if (l) evas_list_free(l);
|
if (l) evas_list_free(l);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We have at least one, append header */
|
/* We have at least one, append header */
|
||||||
e_widget_ilist_header_append(obj, NULL, cft->name);
|
e_widget_ilist_header_append(obj, NULL, cft->name);
|
||||||
|
|
||||||
|
@ -351,8 +350,7 @@ _types_hash_cb_free(const Evas_Hash *hash __UNUSED__, const char *key __UNUSED__
|
||||||
{
|
{
|
||||||
CFType *type = NULL;
|
CFType *type = NULL;
|
||||||
|
|
||||||
type = data;
|
if (!(type = data)) return 1;
|
||||||
if (!type) return 1;
|
|
||||||
if (type->key) evas_stringshare_del(type->key);
|
if (type->key) evas_stringshare_del(type->key);
|
||||||
if (type->name) evas_stringshare_del(type->name);
|
if (type->name) evas_stringshare_del(type->name);
|
||||||
if (type->modules)
|
if (type->modules)
|
||||||
|
@ -371,8 +369,7 @@ _mod_hash_cb_free(const Evas_Hash *hash __UNUSED__, const char *key __UNUSED__,
|
||||||
{
|
{
|
||||||
CFModule *mod = NULL;
|
CFModule *mod = NULL;
|
||||||
|
|
||||||
mod = data;
|
if (!(mod = data)) return 1;
|
||||||
if (!mod) return 1;
|
|
||||||
if (mod->short_name) evas_stringshare_del(mod->short_name);
|
if (mod->short_name) evas_stringshare_del(mod->short_name);
|
||||||
if (mod->name) evas_stringshare_del(mod->name);
|
if (mod->name) evas_stringshare_del(mod->name);
|
||||||
if (mod->icon) evas_stringshare_del(mod->icon);
|
if (mod->icon) evas_stringshare_del(mod->icon);
|
||||||
|
@ -436,8 +433,7 @@ _list_widget_load(Evas_Object *obj, Evas_List *list)
|
||||||
char *path;
|
char *path;
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
|
|
||||||
mod = ml->data;
|
if (!(mod = ml->data)) continue;
|
||||||
if (!mod) continue;
|
|
||||||
if (mod->orig_path)
|
if (mod->orig_path)
|
||||||
{
|
{
|
||||||
path = ecore_file_dir_get(mod->orig_path);
|
path = ecore_file_dir_get(mod->orig_path);
|
||||||
|
@ -458,8 +454,7 @@ _avail_list_cb_change(void *data, Evas_Object *obj)
|
||||||
{
|
{
|
||||||
E_Config_Dialog_Data *cfdata = NULL;
|
E_Config_Dialog_Data *cfdata = NULL;
|
||||||
|
|
||||||
cfdata = data;
|
if (!(cfdata = data)) return;
|
||||||
if (!cfdata) return;
|
|
||||||
|
|
||||||
/* Unselect all in loaded list & disable buttons */
|
/* Unselect all in loaded list & disable buttons */
|
||||||
e_widget_ilist_unselect(cfdata->l_loaded);
|
e_widget_ilist_unselect(cfdata->l_loaded);
|
||||||
|
@ -484,8 +479,7 @@ _load_list_cb_change(void *data, Evas_Object *obj)
|
||||||
{
|
{
|
||||||
E_Config_Dialog_Data *cfdata = NULL;
|
E_Config_Dialog_Data *cfdata = NULL;
|
||||||
|
|
||||||
cfdata = data;
|
if (!(cfdata = data)) return;
|
||||||
if (!cfdata) return;
|
|
||||||
|
|
||||||
/* Unselect all in avail list & disable button */
|
/* Unselect all in avail list & disable button */
|
||||||
e_widget_ilist_unselect(cfdata->l_avail);
|
e_widget_ilist_unselect(cfdata->l_avail);
|
||||||
|
@ -530,8 +524,7 @@ _mod_hash_unselect(const Evas_Hash *hash __UNUSED__, const char *key __UNUSED__,
|
||||||
{
|
{
|
||||||
CFModule *mod = NULL;
|
CFModule *mod = NULL;
|
||||||
|
|
||||||
mod = data;
|
if (!(mod = data)) return 1;
|
||||||
if (!mod) return 1;
|
|
||||||
mod->selected = 0;
|
mod->selected = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -543,8 +536,7 @@ _select_all_modules(Evas_Object *obj, void *data)
|
||||||
E_Config_Dialog_Data *cfdata = NULL;
|
E_Config_Dialog_Data *cfdata = NULL;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
cfdata = data;
|
if (!(cfdata = data)) return;
|
||||||
if (!cfdata) return;
|
|
||||||
for (i = 0, l = e_widget_ilist_items_get(obj); l; l = l->next, i++)
|
for (i = 0, l = e_widget_ilist_items_get(obj); l; l = l->next, i++)
|
||||||
{
|
{
|
||||||
E_Ilist_Item *item = NULL;
|
E_Ilist_Item *item = NULL;
|
||||||
|
@ -552,8 +544,7 @@ _select_all_modules(Evas_Object *obj, void *data)
|
||||||
|
|
||||||
item = l->data;
|
item = l->data;
|
||||||
if ((!item) || (!item->selected)) continue;
|
if ((!item) || (!item->selected)) continue;
|
||||||
mod = e_widget_ilist_nth_data_get(obj, i);
|
if (!(mod = e_widget_ilist_nth_data_get(obj, i))) continue;
|
||||||
if (!mod) continue;
|
|
||||||
mod->selected = 1;
|
mod->selected = 1;
|
||||||
if (mod->comment)
|
if (mod->comment)
|
||||||
e_widget_textblock_markup_set(cfdata->o_desc, mod->comment);
|
e_widget_textblock_markup_set(cfdata->o_desc, mod->comment);
|
||||||
|
@ -568,30 +559,50 @@ static void
|
||||||
_btn_cb_unload(void *data, void *data2)
|
_btn_cb_unload(void *data, void *data2)
|
||||||
{
|
{
|
||||||
E_Config_Dialog_Data *cfdata = NULL;
|
E_Config_Dialog_Data *cfdata = NULL;
|
||||||
|
int sel = -1;
|
||||||
|
|
||||||
cfdata = data;
|
if (!(cfdata = data)) return;
|
||||||
if (!cfdata) return;
|
|
||||||
|
/* get what is currently selected in the list */
|
||||||
|
sel = e_widget_ilist_selected_get(cfdata->l_loaded);
|
||||||
|
|
||||||
_enable_modules(0);
|
_enable_modules(0);
|
||||||
e_widget_disabled_set(cfdata->b_unload, 1);
|
e_widget_disabled_set(cfdata->b_unload, 1);
|
||||||
e_widget_textblock_markup_set(cfdata->o_desc, _("Description: Unavailable"));
|
e_widget_textblock_markup_set(cfdata->o_desc, _("Description: Unavailable"));
|
||||||
|
|
||||||
|
/* 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_avail, 0);
|
||||||
_fill_list(cfdata->l_loaded, 1);
|
_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);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_btn_cb_load(void *data, void *data2)
|
_btn_cb_load(void *data, void *data2)
|
||||||
{
|
{
|
||||||
E_Config_Dialog_Data *cfdata = NULL;
|
E_Config_Dialog_Data *cfdata = NULL;
|
||||||
|
int sel = -1;
|
||||||
|
|
||||||
cfdata = data;
|
if (!(cfdata = data)) return;
|
||||||
if (!cfdata) return;
|
|
||||||
|
/* get what is currently selected in the list */
|
||||||
|
sel = e_widget_ilist_selected_get(cfdata->l_avail);
|
||||||
|
|
||||||
_enable_modules(1);
|
_enable_modules(1);
|
||||||
e_widget_disabled_set(cfdata->b_load, 1);
|
e_widget_disabled_set(cfdata->b_load, 1);
|
||||||
e_widget_textblock_markup_set(cfdata->o_desc, _("Description: Unavailable"));
|
e_widget_textblock_markup_set(cfdata->o_desc, _("Description: Unavailable"));
|
||||||
|
|
||||||
|
/* 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_avail, 0);
|
||||||
_fill_list(cfdata->l_loaded, 1);
|
_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_avail, sel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue