aboutsummaryrefslogtreecommitdiffstats
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
parentefreet: Correctly handle default merge dir (diff)
downloadefl-03218976919bf51d5ba9a562ed3b73a538b95271.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 b0e27467da..730f153532 100644
--- a/src/lib/efreet/efreet_menu.c
+++ b/src/lib/efreet/efreet_menu.c
@@ -1550,7 +1550,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
@@ -1569,14 +1570,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);