summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dransfeld <sd@tango.flipp.net>2014-06-11 11:00:30 +0200
committerThanatermesis <thanatermesis@gmail.com>2014-06-12 15:44:09 +0200
commit03218976919bf51d5ba9a562ed3b73a538b95271 (patch)
tree4405392ba66fb103fbc6ef3f92333979a31ce01c
parent8096976d60998654f18ead51154908492d0ac4ac (diff)
efreet: improve handling of merged menus
If the menu is of the format ${XDG_MENU_PREFIX}applications.menu, we want to merge applications-merged/, not ${XDG_MENU_PREFIX}applications-merged (cherry picked from commit 9415f8a7ef24e051a5ebf812324fe0f659cf89ea) Signed-off-by: Thanatermesis <thanatermesis@gmail.com>
-rw-r--r--src/lib/efreet/efreet_menu.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/lib/efreet/efreet_menu.c b/src/lib/efreet/efreet_menu.c
index b0e27467da..730f153532 100644
--- a/src/lib/efreet/efreet_menu.c
+++ b/src/lib/efreet/efreet_menu.c
@@ -1550,7 +1550,8 @@ static int
1550efreet_menu_handle_default_merge_dirs(Efreet_Menu_Internal *parent, Efreet_Xml *xml) 1550efreet_menu_handle_default_merge_dirs(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
1551{ 1551{
1552 Eina_List *dirs; 1552 Eina_List *dirs;
1553 char path[PATH_MAX], *p, *pp; 1553 char path[PATH_MAX], *p = NULL;
1554 const char *pp;
1554#ifndef STRICT_SPEC 1555#ifndef STRICT_SPEC
1555 char parent_path[PATH_MAX]; 1556 char parent_path[PATH_MAX];
1556#endif 1557#endif
@@ -1569,14 +1570,31 @@ efreet_menu_handle_default_merge_dirs(Efreet_Menu_Internal *parent, Efreet_Xml *
1569 } 1570 }
1570 else 1571 else
1571 { 1572 {
1572 char *s;
1573 size_t len; 1573 size_t len;
1574 1574
1575 len = strlen(parent->file.name) + 1; 1575 len = strlen(efreet_menu_prefix);
1576 p = alloca(len); 1576 if (!strncmp(parent->file.name, efreet_menu_prefix, len))
1577 memcpy(p, parent->file.name, len); 1577 {
1578 s = strrchr(p, '.'); 1578 pp = parent->file.name;
1579 if (s) *s = '\0'; 1579 pp += len;
1580 if (!strcmp(pp, "applications.menu"))
1581 {
1582 p = alloca(sizeof("applications"));
1583 memcpy(p, "applications", sizeof("applications"));
1584 }
1585 }
1586
1587 if (!p)
1588 {
1589 char *s;
1590 size_t len;
1591
1592 len = strlen(parent->file.name) + 1;
1593 p = alloca(len);
1594 memcpy(p, parent->file.name, len);
1595 s = strrchr(p, '.');
1596 if (s) *s = '\0';
1597 }
1580 } 1598 }
1581 snprintf(path, sizeof(path), "menus/%s-merged", p); 1599 snprintf(path, sizeof(path), "menus/%s-merged", p);
1582 1600