libxfce4menu filesystem monitoring
jannis at xfce.org
Sat Sep 29 13:10:36 CEST 2007
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.
As there will be only one root menu most times, it doesn't really
matter whether the monitor works per-XfceMenu or not.
> And even if there were, it's possible that that XfceDesktopMenu will
> get destroyed and replaced with something else, e.g., if the user
> disables and reenables the desktop menu.
> It looks like you're only allowed to call _set_vtable() once, so this
> just doesn't work for me. (Well, I assume you intended it to be that
> way, even if you've forgotten to set xfce_menu_monitor_vtable_set to
> TRUE after _set_vtable() is called.)
I used the xfce_menu_monitor_set flag to avoid that the monitor handles
returned by the vtable functions become invalid when the vtable
functions are changed. E.g. if you'd monitor a menu and then change the
monitor vtable so that a different file monitor is used which cannot
handle the monitor handles returned by the previously used monitor.
But I guess this will almost never be the case, so I could as well
allow to redefine the vtable so that the user_data pointer can be
changed as well.
> Not really sure where to proceed from here; this API isn't really
> sufficient. At minimum, I'd like to see the vtable be a
> per-XfceMenu-instance thing.
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.
Being able to redefine the vtable or at least the user_data pointer
sounds reasonable though.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 189 bytes
Desc: not available
More information about the Xfce4-dev