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:09:27 +0200
commit1d00e553a372dc498f9dc6ff95eb7651bcf6f5f5 (patch)
treec3e66990b424762127ff4e84be2b3ec90a9fdeb3
parentb8e180ca43e577a0ad3741eb9fa21c8cf6ca3829 (diff)
downloadefl-1d00e553a372dc498f9dc6ff95eb7651bcf6f5f5.tar.gz
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
efreet_menu_handle_default_merge_dirs(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
{
Eina_List *dirs;
- char path[PATH_MAX], *p, *pp;
+ char path[PATH_MAX], *p = NULL;
+ const char *pp;
#ifndef STRICT_SPEC
char parent_path[PATH_MAX];
#endif
@@ -1573,14 +1574,31 @@ efreet_menu_handle_default_merge_dirs(Efreet_Menu_Internal *parent, Efreet_Xml *
}
else
{
- char *s;
size_t len;
- len = strlen(parent->file.name) + 1;
- p = alloca(len);
- memcpy(p, parent->file.name, len);
- s = strrchr(p, '.');
- if (s) *s = '\0';
+ len = strlen(efreet_menu_prefix);
+ if (!strncmp(parent->file.name, efreet_menu_prefix, len))
+ {
+ pp = parent->file.name;
+ pp += len;
+ if (!strcmp(pp, "applications.menu"))
+ {
+ p = alloca(sizeof("applications"));
+ memcpy(p, "applications", sizeof("applications"));
+ }
+ }
+
+ if (!p)
+ {
+ char *s;
+ size_t len;
+
+ len = strlen(parent->file.name) + 1;
+ p = alloca(len);
+ memcpy(p, parent->file.name, len);
+ s = strrchr(p, '.');
+ if (s) *s = '\0';
+ }
}
snprintf(path, sizeof(path), "menus/%s-merged", p);