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:42:17 +0200
commitfecdca678ca99ba978f8ec141118d5956e213fa7 (patch)
treed1def731da8e142621ba05f1ef9598931db8aa92
parentaee73ce08632072380256bd91f2e3e89a6e3df7b (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 bfcf72b943..d6841378ee 100644
--- a/src/lib/efreet/efreet_menu.c
+++ b/src/lib/efreet/efreet_menu.c
@@ -1554,7 +1554,8 @@ static int
1554efreet_menu_handle_default_merge_dirs(Efreet_Menu_Internal *parent, Efreet_Xml *xml) 1554efreet_menu_handle_default_merge_dirs(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
1555{ 1555{
1556 Eina_List *dirs; 1556 Eina_List *dirs;
1557 char path[PATH_MAX], *p, *pp; 1557 char path[PATH_MAX], *p = NULL;
1558 const char *pp;
1558#ifndef STRICT_SPEC 1559#ifndef STRICT_SPEC
1559 char parent_path[PATH_MAX]; 1560 char parent_path[PATH_MAX];
1560#endif 1561#endif
@@ -1573,14 +1574,31 @@ efreet_menu_handle_default_merge_dirs(Efreet_Menu_Internal *parent, Efreet_Xml *
1573 } 1574 }
1574 else 1575 else
1575 { 1576 {
1576 char *s;
1577 size_t len; 1577 size_t len;
1578 1578
1579 len = strlen(parent->file.name) + 1; 1579 len = strlen(efreet_menu_prefix);
1580 p = alloca(len); 1580 if (!strncmp(parent->file.name, efreet_menu_prefix, len))
1581 memcpy(p, parent->file.name, len); 1581 {
1582 s = strrchr(p, '.'); 1582 pp = parent->file.name;
1583 if (s) *s = '\0'; 1583 pp += len;
1584 if (!strcmp(pp, "applications.menu"))
1585 {
1586 p = alloca(sizeof("applications"));
1587 memcpy(p, "applications", sizeof("applications"));
1588 }
1589 }
1590
1591 if (!p)
1592 {
1593 char *s;
1594 size_t len;
1595
1596 len = strlen(parent->file.name) + 1;
1597 p = alloca(len);
1598 memcpy(p, parent->file.name, len);
1599 s = strrchr(p, '.');
1600 if (s) *s = '\0';
1601 }
1584 } 1602 }
1585 snprintf(path, sizeof(path), "menus/%s-merged", p); 1603 snprintf(path, sizeof(path), "menus/%s-merged", p);
1586 1604