forked from enlightenment/enlightenment
accpet an icon class as a comma-delimited list, so you can do multiple
classes to match more than one eg: firefox,mozilla,web_browser,browser,application ie the app (lets say it was firefox) is a member of multiple classes - the first matched will be used, if none match, the .eap provided internal icon will be used. SVN revision: 15953
This commit is contained in:
parent
cc12b1097d
commit
63d89d34cd
|
@ -1748,7 +1748,7 @@ e_border_icon_add(E_Border *bd, Evas *evas)
|
||||||
if (a)
|
if (a)
|
||||||
{
|
{
|
||||||
o = edje_object_add(evas);
|
o = edje_object_add(evas);
|
||||||
if (!e_util_edje_icon_set(o, a->icon_class))
|
if (!e_util_edje_icon_list_set(o, a->icon_class))
|
||||||
edje_object_file_set(o, a->path, "icon");
|
edje_object_file_set(o, a->path, "icon");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,29 +256,118 @@ e_util_immortal_check(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
e_util_ejde_icon_list_set(Evas_Object *obj, char *list)
|
||||||
|
{
|
||||||
|
char *buf;
|
||||||
|
char *p, *c;
|
||||||
|
|
||||||
|
buf = malloc(strlen(list) + 1);
|
||||||
|
p = list;
|
||||||
|
while (p)
|
||||||
|
{
|
||||||
|
c = strchr(p, ',');
|
||||||
|
if (c)
|
||||||
|
{
|
||||||
|
strncpy(buf, p, c - p);
|
||||||
|
buf[c - p] = 0;
|
||||||
|
if (e_util_edje_icon_set(obj, buf))
|
||||||
|
{
|
||||||
|
free(buf);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
p = c + 1;
|
||||||
|
if (!*p)
|
||||||
|
{
|
||||||
|
free(buf);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy(buf, p);
|
||||||
|
if (e_util_edje_icon_set(obj, buf))
|
||||||
|
{
|
||||||
|
free(buf);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(buf);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
e_util_menu_item_ejde_icon_list_set(E_Menu_Item *mi, char *list)
|
||||||
|
{
|
||||||
|
char *buf;
|
||||||
|
char *p, *c;
|
||||||
|
|
||||||
|
buf = malloc(strlen(list) + 1);
|
||||||
|
p = list;
|
||||||
|
while (p)
|
||||||
|
{
|
||||||
|
c = strchr(p, ',');
|
||||||
|
if (c)
|
||||||
|
{
|
||||||
|
strncpy(buf, p, c - p);
|
||||||
|
buf[c - p] = 0;
|
||||||
|
if (e_util_menu_item_edje_icon_set(mi, buf))
|
||||||
|
{
|
||||||
|
free(buf);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
p = c + 1;
|
||||||
|
if (!*p)
|
||||||
|
{
|
||||||
|
free(buf);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy(buf, p);
|
||||||
|
if (e_util_menu_item_edje_icon_set(mi, buf))
|
||||||
|
{
|
||||||
|
free(buf);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(buf);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
e_util_edje_icon_set(Evas_Object *obj, char *name)
|
e_util_edje_icon_set(Evas_Object *obj, char *name)
|
||||||
{
|
{
|
||||||
char *file;
|
char *file;
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
|
|
||||||
if (!name) return 0;
|
if ((!name) || (!name[0])) return 0;
|
||||||
snprintf(buf, sizeof(buf), "icons/%s", name);
|
snprintf(buf, sizeof(buf), "icons/%s", name);
|
||||||
file = (char *)e_theme_edje_file_get("base/theme/icons", buf);
|
file = (char *)e_theme_edje_file_get("base/theme/icons", buf);
|
||||||
if (!file[0]) return;
|
if (file[0])
|
||||||
edje_object_file_set(obj, file, buf);
|
{
|
||||||
return 1;
|
edje_object_file_set(obj, file, buf);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int
|
||||||
e_util_menu_item_edje_icon_set(E_Menu_Item *mi, char *name)
|
e_util_menu_item_edje_icon_set(E_Menu_Item *mi, char *name)
|
||||||
{
|
{
|
||||||
char *file;
|
char *file;
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
|
|
||||||
if (!name) return;
|
if ((!name) || (!name[0])) return 0;
|
||||||
snprintf(buf, sizeof(buf), "icons/%s", name);
|
snprintf(buf, sizeof(buf), "icons/%s", name);
|
||||||
file = (char *)e_theme_edje_file_get("base/theme/icons", buf);
|
file = (char *)e_theme_edje_file_get("base/theme/icons", buf);
|
||||||
if (!file[0]) return;
|
if (file[0])
|
||||||
e_menu_item_icon_edje_set(mi, file, buf);
|
{
|
||||||
|
e_menu_item_icon_edje_set(mi, file, buf);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,10 @@ EAPI int e_util_head_exec(int head, char *cmd);
|
||||||
EAPI int e_util_strcmp(char *s1, char *s2);
|
EAPI int e_util_strcmp(char *s1, char *s2);
|
||||||
EAPI int e_util_both_str_empty(char *s1, char *s2);
|
EAPI int e_util_both_str_empty(char *s1, char *s2);
|
||||||
EAPI int e_util_immortal_check(void);
|
EAPI int e_util_immortal_check(void);
|
||||||
|
EAPI int e_util_ejde_icon_list_set(Evas_Object *obj, char *list);
|
||||||
|
EAPI int e_util_menu_item_ejde_icon_list_set(E_Menu_Item *mi, char *list);
|
||||||
EAPI int e_util_edje_icon_set(Evas_Object *obj, char *name);
|
EAPI int e_util_edje_icon_set(Evas_Object *obj, char *name);
|
||||||
EAPI void e_util_menu_item_edje_icon_set(E_Menu_Item *mi, char *name);
|
EAPI int e_util_menu_item_edje_icon_set(E_Menu_Item *mi, char *name);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue