libxfce4menu filesystem monitoring

Brian J. Tarricone bjt23 at cornell.edu
Sat Sep 29 21:31:39 CEST 2007


On Sat, 29 Sep 2007 13:10:36 +0200 Jannis Pohlmann wrote:

> Am Fri, 28 Sep 2007 19:19:46 -0700
> schrieb "Brian J. Tarricone" <bjt23 at cornell.edu>:
> 
> > On Thu, 20 Sep 2007 21:59:37 +0200 Jannis Pohlmann wrote:
> > 
> > >   2. Call xfce_menu_monitor_set_vtable() before anything else (but
> > >      after xfce_menu_init()).
> > 
> > Hrm, why is this not per-XfceMenu?  How should this work with the
> > user_data parameter?  I call xfce_menu_init() in the menu module's
> > g_module_check_init() function; presumably I'd call _set_vtable()
> > there as well, but there's no XfceDesktopMenu at that time yet to
> > pass as user_data.
> 
> I didn't look deeply into the xfdesktop sourcecode, but I noticed that
> you call xfce_menu_init() in _generate_menu(). It would work pretty
> well there if you'd call xfce_menu_monitor_set_vtable() there as well
> and passed the desktop_menu as user_data parameter.

Well, I'd like to get rid of that call to xfce_menu_init().  That was
just a hack to work around your cacheing causing menu regenerations to
not work properly all the time -- presumably that isn't necessary
anymore.  (If it is, I think it's still a bug.)

> As there will be only one root menu most times, it doesn't really
> matter whether the monitor works per-XfceMenu or not.

Perhaps, but the API as-is is kinda awkward and unclear.
  
> I don't like the per-XfceMenu idea as it implies adding even more 
> complexity XfceMenu than we already have. Assuming that most times
> there will only be one root menu at a time we don't really need this.

Not necessarily -- to simplify things, you could maintain a hash of
XfceMenu -> (XfceMenuMonitorVtable,user_data) tuples, and look those up
in the monitoring code rather than just using the static/global
vtable/user_data pointers.  (Or the reverse of that mapping if that
makes more sense.)

> Being able to redefine the vtable or at least the user_data pointer
> sounds reasonable though.

At minimum the user_data pointer.  I imagine redefining the vtable is
less useful, though in a case where you actually have more than one
menu (no, I can't really think of a use case for that), it could be.

Really, though, right now the API just feels kinda kludgey.

	-brian



More information about the Xfce4-dev mailing list