forked from enlightenment/enlightenment
E: No need to store static lists of borders, comps, shelves, etc.
Those static lists were only used in config dialogs, so they are not 'required' to be static and existing while E is running. The config dialogs can just call the e_theme_*_list functions when they need to. NB: This reduces E's memory footprint !! :) SVN revision: 63529
This commit is contained in:
parent
3dd38d3446
commit
a0a0b42146
|
@ -410,6 +410,7 @@ _fill_styles(E_Config_Dialog_Data *cfdata, Evas_Object *obj)
|
|||
Evas *evas;
|
||||
Eina_List *l, *styles;
|
||||
char *style;
|
||||
const char *str;
|
||||
int mw, n = 0;
|
||||
|
||||
evas = evas_object_evas_get(obj);
|
||||
|
@ -443,6 +444,9 @@ _fill_styles(E_Config_Dialog_Data *cfdata, Evas_Object *obj)
|
|||
e_widget_ilist_thaw(obj);
|
||||
edje_thaw();
|
||||
evas_event_thaw(evas);
|
||||
|
||||
EINA_LIST_FREE(styles, str)
|
||||
eina_stringshare_del(str);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -22,10 +22,6 @@ static Eina_Hash *mappings = NULL;
|
|||
static Eina_Hash *group_cache = NULL;
|
||||
|
||||
static Eina_List *categories = NULL;
|
||||
static Eina_List *transitions = NULL;
|
||||
static Eina_List *borders = NULL;
|
||||
static Eina_List *shelfs = NULL;
|
||||
static Eina_List *comps = NULL;
|
||||
static E_Fm2_Mime_Handler *theme_hdl = NULL;
|
||||
|
||||
/* externally accessible functions */
|
||||
|
@ -55,11 +51,6 @@ e_theme_init(void)
|
|||
e_theme_file_set(buf, et->file);
|
||||
}
|
||||
|
||||
/* Find transitions */
|
||||
transitions = _e_theme_collection_items_find("base/theme/transitions", "e/transitions");
|
||||
borders = _e_theme_collection_items_find("base/theme/borders", "e/widgets/border");
|
||||
shelfs = _e_theme_collection_items_find("base/theme/shelf", "e/shelf");
|
||||
comps = _e_theme_collection_items_find("base/theme/borders", "e/comp");
|
||||
if (!mappings) mappings = eina_hash_string_superfast_new(NULL);
|
||||
group_cache = eina_hash_string_superfast_new(NULL);
|
||||
|
||||
|
@ -89,14 +80,7 @@ e_theme_shutdown(void)
|
|||
}
|
||||
EINA_LIST_FREE(categories, str)
|
||||
eina_stringshare_del(str);
|
||||
EINA_LIST_FREE(transitions, str)
|
||||
eina_stringshare_del(str);
|
||||
EINA_LIST_FREE(borders, str)
|
||||
eina_stringshare_del(str);
|
||||
EINA_LIST_FREE(shelfs, str)
|
||||
eina_stringshare_del(str);
|
||||
EINA_LIST_FREE(comps, str)
|
||||
eina_stringshare_del(str);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -425,57 +409,102 @@ e_theme_category_list(void)
|
|||
EAPI int
|
||||
e_theme_transition_find(const char *transition)
|
||||
{
|
||||
if (eina_list_search_sorted(transitions, EINA_COMPARE_CB(strcmp), transition))
|
||||
return 1;
|
||||
return 0;
|
||||
Eina_List *trans = NULL;
|
||||
int found = 0;
|
||||
const char *str;
|
||||
|
||||
trans =
|
||||
_e_theme_collection_items_find("base/theme/transitions", "e/transitions");
|
||||
|
||||
if (eina_list_search_sorted(trans, EINA_COMPARE_CB(strcmp), transition))
|
||||
found = 1;
|
||||
|
||||
EINA_LIST_FREE(trans, str)
|
||||
eina_stringshare_del(str);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
EAPI Eina_List *
|
||||
e_theme_transition_list(void)
|
||||
{
|
||||
return transitions;
|
||||
return _e_theme_collection_items_find("base/theme/transitions",
|
||||
"e/transitions");
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_theme_border_find(const char *border)
|
||||
{
|
||||
if (eina_list_search_sorted(borders, EINA_COMPARE_CB(strcmp), border))
|
||||
return 1;
|
||||
return 0;
|
||||
Eina_List *bds = NULL;
|
||||
int found = 0;
|
||||
const char *str;
|
||||
|
||||
bds =
|
||||
_e_theme_collection_items_find("base/theme/borders", "e/widgets/border");
|
||||
|
||||
if (eina_list_search_sorted(bds, EINA_COMPARE_CB(strcmp), border))
|
||||
found = 1;
|
||||
|
||||
EINA_LIST_FREE(bds, str)
|
||||
eina_stringshare_del(str);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
EAPI Eina_List *
|
||||
e_theme_border_list(void)
|
||||
{
|
||||
return borders;
|
||||
return _e_theme_collection_items_find("base/theme/borders",
|
||||
"e/widgets/border");
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_theme_shelf_find(const char *shelf)
|
||||
{
|
||||
Eina_List *shelfs = NULL;
|
||||
int found = 0;
|
||||
const char *str;
|
||||
|
||||
shelfs =
|
||||
_e_theme_collection_items_find("base/theme/shelf", "e/shelf");
|
||||
|
||||
if (eina_list_search_sorted(shelfs, EINA_COMPARE_CB(strcmp), shelf))
|
||||
return 1;
|
||||
return 0;
|
||||
found = 1;
|
||||
|
||||
EINA_LIST_FREE(shelfs, str)
|
||||
eina_stringshare_del(str);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
EAPI Eina_List *
|
||||
e_theme_shelf_list(void)
|
||||
{
|
||||
return shelfs;
|
||||
return _e_theme_collection_items_find("base/theme/shelf", "e/shelf");
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_theme_comp_find(const char *comp)
|
||||
{
|
||||
Eina_List *comps = NULL;
|
||||
int found = 0;
|
||||
const char *str;
|
||||
|
||||
comps = _e_theme_collection_items_find("base/theme/borders", "e/comp");
|
||||
|
||||
if (eina_list_search_sorted(comps, EINA_COMPARE_CB(strcmp), comp))
|
||||
return 1;
|
||||
return 0;
|
||||
found = 1;
|
||||
|
||||
EINA_LIST_FREE(comps, str)
|
||||
eina_stringshare_del(str);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
EAPI Eina_List *
|
||||
e_theme_comp_list(void)
|
||||
{
|
||||
return comps;
|
||||
return _e_theme_collection_items_find("base/theme/borders", "e/comp");
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -597,10 +626,8 @@ _e_theme_collection_items_find(const char *base, const char *collname)
|
|||
{
|
||||
Eina_List *list = NULL;
|
||||
E_Theme_Result *res;
|
||||
char *category, *p, *p2;
|
||||
int collname_len;
|
||||
char *category, *p;
|
||||
|
||||
collname_len = strlen(collname);
|
||||
category = alloca(strlen(base) + 1);
|
||||
strcpy(category, base);
|
||||
do
|
||||
|
@ -629,12 +656,14 @@ _e_theme_collection_items_find(const char *base, const char *collname)
|
|||
if (coll)
|
||||
{
|
||||
const char *c;
|
||||
int collname_len;
|
||||
|
||||
collname_len = strlen(collname);
|
||||
EINA_LIST_FOREACH(coll, l, c)
|
||||
{
|
||||
if (!strncmp(c, collname, collname_len))
|
||||
{
|
||||
char *trans;
|
||||
char *trans, *p2;
|
||||
|
||||
trans = strdup(c);
|
||||
p = trans + collname_len + 1;
|
||||
|
|
|
@ -353,6 +353,7 @@ _style_selector(Evas *evas,
|
|||
Evas_Object *oi, *ob, *oo, *obd, *orec, *oly, *orec0;
|
||||
Eina_List *styles, *l, *style_shadows = NULL, *style_list;
|
||||
char *style;
|
||||
const char *str;
|
||||
int n, sel;
|
||||
Evas_Coord wmw, wmh;
|
||||
Ecore_Timer *timer;
|
||||
|
@ -435,6 +436,9 @@ _style_selector(Evas *evas,
|
|||
e_widget_ilist_selected_set(oi, sel);
|
||||
e_widget_ilist_go(oi);
|
||||
|
||||
EINA_LIST_FREE(styles, str)
|
||||
eina_stringshare_del(str);
|
||||
|
||||
return oi;
|
||||
}
|
||||
|
||||
|
|
|
@ -190,7 +190,8 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
Eina_List *borders, *l;
|
||||
int n, sel = 0;
|
||||
char *tmp;
|
||||
|
||||
const char *str;
|
||||
|
||||
if (cfdata->border)
|
||||
tmp = strdup(cfdata->border->client.border.name);
|
||||
else
|
||||
|
@ -247,7 +248,10 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
&(cfdata->remember_border));
|
||||
e_widget_list_object_append(o, ob, 1, 0, 0.0);
|
||||
}
|
||||
|
||||
|
||||
EINA_LIST_FREE(borders, str)
|
||||
eina_stringshare_del(str);
|
||||
|
||||
E_FREE(tmp);
|
||||
e_dialog_resizable_set(cfd->dia, 1);
|
||||
return o;
|
||||
|
|
|
@ -80,14 +80,25 @@ _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
|||
static int
|
||||
_basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Eina_List *trans = NULL;
|
||||
const char *str;
|
||||
|
||||
trans = e_theme_transition_list();
|
||||
|
||||
if (e_config->transition_start)
|
||||
eina_stringshare_del(e_config->transition_start);
|
||||
e_config->transition_start = NULL;
|
||||
if (cfdata->transition_start)
|
||||
{
|
||||
if (e_theme_transition_find(cfdata->transition_start))
|
||||
e_config->transition_start =
|
||||
eina_stringshare_add(cfdata->transition_start);
|
||||
if (eina_list_search_sorted(trans, EINA_COMPARE_CB(strcmp),
|
||||
cfdata->transition_start))
|
||||
{
|
||||
e_config->transition_start =
|
||||
eina_stringshare_add(cfdata->transition_start);
|
||||
}
|
||||
/* if (e_theme_transition_find(cfdata->transition_start)) */
|
||||
/* e_config->transition_start = */
|
||||
/* eina_stringshare_add(cfdata->transition_start); */
|
||||
}
|
||||
|
||||
if (e_config->transition_desk)
|
||||
|
@ -95,8 +106,14 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
|||
e_config->transition_desk = NULL;
|
||||
if (cfdata->transition_desk)
|
||||
{
|
||||
if (e_theme_transition_find(cfdata->transition_desk))
|
||||
e_config->transition_desk = eina_stringshare_add(cfdata->transition_desk);
|
||||
if (eina_list_search_sorted(trans, EINA_COMPARE_CB(strcmp),
|
||||
cfdata->transition_desk))
|
||||
{
|
||||
e_config->transition_desk =
|
||||
eina_stringshare_add(cfdata->transition_desk);
|
||||
}
|
||||
/* if (e_theme_transition_find(cfdata->transition_desk)) */
|
||||
/* e_config->transition_desk = eina_stringshare_add(cfdata->transition_desk); */
|
||||
}
|
||||
|
||||
if (e_config->transition_change)
|
||||
|
@ -104,11 +121,21 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
|||
e_config->transition_change = NULL;
|
||||
if (cfdata->transition_change)
|
||||
{
|
||||
if (e_theme_transition_find(cfdata->transition_change))
|
||||
e_config->transition_change = eina_stringshare_add(cfdata->transition_change);
|
||||
if (eina_list_search_sorted(trans, EINA_COMPARE_CB(strcmp),
|
||||
cfdata->transition_change))
|
||||
{
|
||||
e_config->transition_change =
|
||||
eina_stringshare_add(cfdata->transition_change);
|
||||
}
|
||||
/* if (e_theme_transition_find(cfdata->transition_change)) */
|
||||
/* e_config->transition_change = eina_stringshare_add(cfdata->transition_change); */
|
||||
}
|
||||
|
||||
e_config_save_queue();
|
||||
|
||||
EINA_LIST_FREE(trans, str)
|
||||
eina_stringshare_del(str);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -151,12 +178,17 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
|||
edje_freeze();
|
||||
e_widget_ilist_freeze(il);
|
||||
e_widget_ilist_append(il, NULL, _("None"), _trans_cb_changed, cfdata, NULL);
|
||||
|
||||
for (l = e_theme_transition_list(); l; l = l->next)
|
||||
{
|
||||
t = l->data;
|
||||
if (!t) continue;
|
||||
e_widget_ilist_append(il, NULL, t, _trans_cb_changed, cfdata, NULL);
|
||||
t = l->data;
|
||||
if (!t) continue;
|
||||
e_widget_ilist_append(il, NULL, t, _trans_cb_changed, cfdata, NULL);
|
||||
}
|
||||
|
||||
EINA_LIST_FREE(l, t)
|
||||
eina_stringshare_del(t);
|
||||
|
||||
e_widget_ilist_go(il);
|
||||
e_widget_ilist_thaw(il);
|
||||
edje_thaw();
|
||||
|
@ -170,6 +202,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
|||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||
|
||||
e_dialog_resizable_set(cfd->dia, 1);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue