summaryrefslogtreecommitdiff
path: root/src/lib/efreet
diff options
context:
space:
mode:
authorSebastian Dransfeld <sd@tango.flipp.net>2014-06-11 11:00:30 +0200
committerSebastian Dransfeld <sd@tango.flipp.net>2014-06-11 11:04:23 +0200
commit9415f8a7ef24e051a5ebf812324fe0f659cf89ea (patch)
tree7e77e14221469c0ca6eee5ee3de9ab6ceb045b51 /src/lib/efreet
parenta10d4167f11074f338f9d8cf6f8f8023fc438b05 (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
Diffstat (limited to 'src/lib/efreet')
-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 f0d5bad327..29c89d60d3 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
@@ -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