2005-09-19 08:25:23 -07:00
|
|
|
#include "e.h"
|
|
|
|
|
2007-08-05 01:07:39 -07:00
|
|
|
Evas_List *e_configure_registry = NULL;
|
2007-07-03 08:19:09 -07:00
|
|
|
|
2007-08-05 01:07:39 -07:00
|
|
|
EAPI void
|
|
|
|
e_configure_init(void)
|
2007-07-03 08:19:09 -07:00
|
|
|
{
|
2007-08-05 01:07:39 -07:00
|
|
|
e_configure_registry_category_add("extensions", 90, _("Extensions"), NULL, "enlightenment/extensions");
|
|
|
|
e_configure_registry_item_add("extensions/modules", 10, _("Modules"), NULL, "enlightenment/modules", e_int_config_modules);
|
|
|
|
}
|
2007-07-03 08:19:09 -07:00
|
|
|
|
|
|
|
EAPI void
|
2007-07-04 04:11:03 -07:00
|
|
|
e_configure_registry_item_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, E_Config_Dialog *(*func) (E_Container *con, const char *params))
|
2007-07-03 08:19:09 -07:00
|
|
|
{
|
|
|
|
Evas_List *l;
|
|
|
|
char *cat;
|
|
|
|
const char *item;
|
|
|
|
E_Configure_It *eci;
|
|
|
|
|
|
|
|
/* path is "category/item" */
|
2007-07-25 10:01:04 -07:00
|
|
|
cat = ecore_file_dir_get(path);
|
2007-07-03 08:19:09 -07:00
|
|
|
if (!cat) return;
|
2007-07-25 10:01:04 -07:00
|
|
|
item = ecore_file_file_get(path);
|
2007-07-03 08:19:09 -07:00
|
|
|
eci = E_NEW(E_Configure_It, 1);
|
|
|
|
if (!eci) goto done;
|
|
|
|
|
|
|
|
eci->item = evas_stringshare_add(item);
|
|
|
|
eci->pri = pri;
|
|
|
|
eci->label = evas_stringshare_add(label);
|
|
|
|
if (icon_file) eci->icon_file = evas_stringshare_add(icon_file);
|
|
|
|
if (icon) eci->icon = evas_stringshare_add(icon);
|
|
|
|
eci->func = func;
|
|
|
|
|
2007-08-05 01:07:39 -07:00
|
|
|
for (l = e_configure_registry; l; l = l->next)
|
2007-07-03 08:19:09 -07:00
|
|
|
{
|
|
|
|
E_Configure_Cat *ecat;
|
|
|
|
|
|
|
|
ecat = l->data;
|
|
|
|
if (!strcmp(cat, ecat->cat))
|
|
|
|
{
|
|
|
|
Evas_List *ll;
|
|
|
|
|
|
|
|
for (ll = ecat->items; ll; ll = ll->next)
|
|
|
|
{
|
|
|
|
E_Configure_It *eci2;
|
|
|
|
|
|
|
|
eci2 = ll->data;
|
|
|
|
if (eci2->pri > eci->pri)
|
|
|
|
{
|
|
|
|
ecat->items = evas_list_prepend_relative_list(ecat->items, eci, ll);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ecat->items = evas_list_append(ecat->items, eci);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
done:
|
|
|
|
free(cat);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
e_configure_registry_item_del(const char *path)
|
|
|
|
{
|
|
|
|
Evas_List *l;
|
|
|
|
char *cat;
|
|
|
|
const char *item;
|
|
|
|
|
|
|
|
/* path is "category/item" */
|
2007-07-25 10:01:04 -07:00
|
|
|
cat = ecore_file_dir_get(path);
|
2007-07-03 08:19:09 -07:00
|
|
|
if (!cat) return;
|
2007-07-25 10:01:04 -07:00
|
|
|
item = ecore_file_file_get(path);
|
2007-08-05 01:07:39 -07:00
|
|
|
for (l = e_configure_registry; l; l = l->next)
|
2007-07-03 08:19:09 -07:00
|
|
|
{
|
|
|
|
E_Configure_Cat *ecat;
|
|
|
|
|
|
|
|
ecat = l->data;
|
|
|
|
if (!strcmp(cat, ecat->cat))
|
|
|
|
{
|
|
|
|
Evas_List *ll;
|
|
|
|
|
|
|
|
for (ll = ecat->items; ll; ll = ll->next)
|
|
|
|
{
|
|
|
|
E_Configure_It *eci;
|
|
|
|
|
|
|
|
eci = ll->data;
|
|
|
|
if (!strcmp(item, eci->item))
|
|
|
|
{
|
|
|
|
ecat->items = evas_list_remove_list(ecat->items, ll);
|
|
|
|
evas_stringshare_del(eci->item);
|
|
|
|
evas_stringshare_del(eci->label);
|
|
|
|
evas_stringshare_del(eci->icon);
|
2007-11-01 13:35:08 -07:00
|
|
|
if (eci->icon_file) evas_stringshare_del(eci->icon_file);
|
2007-07-03 08:19:09 -07:00
|
|
|
free(eci);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
done:
|
|
|
|
free(cat);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
e_configure_registry_category_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon)
|
|
|
|
{
|
2007-07-24 11:47:26 -07:00
|
|
|
E_Configure_Cat *ecat;
|
2007-07-03 08:19:09 -07:00
|
|
|
Evas_List *l;
|
|
|
|
|
|
|
|
ecat = E_NEW(E_Configure_Cat, 1);
|
|
|
|
if (!ecat) return;
|
|
|
|
|
|
|
|
ecat->cat = evas_stringshare_add(path);
|
|
|
|
ecat->pri = pri;
|
|
|
|
ecat->label = evas_stringshare_add(label);
|
|
|
|
if (icon_file) ecat->icon_file = evas_stringshare_add(icon_file);
|
|
|
|
if (icon) ecat->icon = evas_stringshare_add(icon);
|
2007-08-05 01:07:39 -07:00
|
|
|
for (l = e_configure_registry; l; l = l->next)
|
2007-07-03 08:19:09 -07:00
|
|
|
{
|
|
|
|
E_Configure_Cat *ecat2;
|
|
|
|
|
|
|
|
ecat2 = l->data;
|
|
|
|
if (ecat2->pri > ecat->pri)
|
|
|
|
{
|
2007-08-05 01:07:39 -07:00
|
|
|
e_configure_registry = evas_list_prepend_relative_list(e_configure_registry, ecat, l);
|
2007-07-03 08:19:09 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2007-08-05 01:07:39 -07:00
|
|
|
e_configure_registry = evas_list_append(e_configure_registry, ecat);
|
2007-07-03 08:19:09 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
e_configure_registry_category_del(const char *path)
|
|
|
|
{
|
|
|
|
Evas_List *l;
|
|
|
|
char *cat;
|
|
|
|
|
2007-07-25 10:01:04 -07:00
|
|
|
cat = ecore_file_dir_get(path);
|
2007-07-03 08:19:09 -07:00
|
|
|
if (!cat) return;
|
2007-08-05 01:07:39 -07:00
|
|
|
for (l = e_configure_registry; l; l = l->next)
|
2007-07-03 08:19:09 -07:00
|
|
|
{
|
|
|
|
E_Configure_Cat *ecat;
|
|
|
|
|
|
|
|
ecat = l->data;
|
|
|
|
if (!strcmp(cat, ecat->cat))
|
|
|
|
{
|
|
|
|
if (ecat->items) goto done;
|
2007-08-05 01:07:39 -07:00
|
|
|
e_configure_registry = evas_list_remove_list(e_configure_registry, l);
|
2007-07-03 08:19:09 -07:00
|
|
|
evas_stringshare_del(ecat->cat);
|
|
|
|
evas_stringshare_del(ecat->label);
|
|
|
|
if (ecat->icon) evas_stringshare_del(ecat->icon);
|
2007-11-01 13:35:08 -07:00
|
|
|
if (ecat->icon_file) evas_stringshare_del(ecat->icon_file);
|
2007-07-03 08:19:09 -07:00
|
|
|
free(ecat);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
done:
|
|
|
|
free(cat);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2007-07-04 04:11:03 -07:00
|
|
|
e_configure_registry_call(const char *path, E_Container *con, const char *params)
|
2007-07-03 08:19:09 -07:00
|
|
|
{
|
|
|
|
Evas_List *l;
|
|
|
|
char *cat;
|
|
|
|
const char *item;
|
|
|
|
|
|
|
|
/* path is "category/item" */
|
2007-07-25 10:01:04 -07:00
|
|
|
cat = ecore_file_dir_get(path);
|
2007-07-03 08:19:09 -07:00
|
|
|
if (!cat) return;
|
2007-07-25 10:01:04 -07:00
|
|
|
item = ecore_file_file_get(path);
|
2007-08-05 01:07:39 -07:00
|
|
|
for (l = e_configure_registry; l; l = l->next)
|
2007-07-03 08:19:09 -07:00
|
|
|
{
|
|
|
|
E_Configure_Cat *ecat;
|
|
|
|
|
|
|
|
ecat = l->data;
|
|
|
|
if (!strcmp(cat, ecat->cat))
|
|
|
|
{
|
|
|
|
Evas_List *ll;
|
|
|
|
|
|
|
|
for (ll = ecat->items; ll; ll = ll->next)
|
|
|
|
{
|
|
|
|
E_Configure_It *eci;
|
|
|
|
|
|
|
|
eci = ll->data;
|
|
|
|
if (!strcmp(item, eci->item))
|
|
|
|
{
|
2007-07-04 04:11:03 -07:00
|
|
|
if (eci->func) eci->func(con, params);
|
2007-07-03 08:19:09 -07:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
done:
|
|
|
|
free(cat);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
|
|
|
e_configure_registry_exists(const char *path)
|
|
|
|
{
|
|
|
|
Evas_List *l;
|
|
|
|
char *cat;
|
|
|
|
const char *item;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
/* path is "category/item" */
|
2007-07-25 10:01:04 -07:00
|
|
|
cat = ecore_file_dir_get(path);
|
2007-07-24 11:47:26 -07:00
|
|
|
if (!cat) return 0;
|
2007-07-25 10:01:04 -07:00
|
|
|
item = ecore_file_file_get(path);
|
2007-08-05 01:07:39 -07:00
|
|
|
for (l = e_configure_registry; l; l = l->next)
|
2007-07-03 08:19:09 -07:00
|
|
|
{
|
|
|
|
E_Configure_Cat *ecat;
|
|
|
|
|
|
|
|
ecat = l->data;
|
|
|
|
if (!strcmp(cat, ecat->cat))
|
|
|
|
{
|
|
|
|
Evas_List *ll;
|
|
|
|
|
|
|
|
if (!item)
|
|
|
|
{
|
|
|
|
ret = 1;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
for (ll = ecat->items; ll; ll = ll->next)
|
|
|
|
{
|
|
|
|
E_Configure_It *eci;
|
|
|
|
|
|
|
|
eci = ll->data;
|
|
|
|
if (!strcmp(item, eci->item))
|
|
|
|
{
|
|
|
|
ret = 1;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
done:
|
|
|
|
free(cat);
|
|
|
|
return ret;
|
|
|
|
}
|