They way you use it is correct.
The problem is, to speed up applications and avoid locks, I make it asynchronous.
You have to register a reload callback.
When the menu loading is finished or when it should be reloaded, that callback will be called. In that callback, you can get its root item.

Menu-cache is an import piece of LXDE as it's used in many places. However, it's not stable enough and has some limitations. I'm now looking for a good replacement. At least its IPC related parts can be replaced with dbus.
Before I can find any better replacement, for now we use menu-cache, which does cache for generated xdg menus.

On Sun, Sep 18, 2011 at 1:09 AM, Joost van der Hoff <2noob2banoob@gmail.com> wrote:
Hi all,

I am currently trying to write a MintMenu-like menu in C. Since it will
be mainly intended for LXDE I will use menu-cache. However I am
unfamiliar with menu-cache and would like to know where to start.

I have found menu-cache.h, and based on it's contents I have figured out
quite a bit on how it should work. However, the following code (which
compiles fine) seems to fail in getting the root directory:

menu_cache_init(0);
MenuCache* mc = menu_cache_lookup("applications.menu");
MenuCacheDir* dir = menu_cache_get_root_dir(mc);
if(dir==NULL) printf("Could not retrieve root directory\n");

Since menu-cache is undocumented, I have no way of figuring out what I
am doing wrong. Can anyone shed some light on this?

2noob2banoob

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
_______________________________________________
Lxde-list mailing list
Lxde-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxde-list