
On Dec 29, 2009, at 1:36 PM, Ted Gould wrote:
The problem being that the action/verb system was never moved to C++ really -- so I think that this pattern is still appropriate. Now, whether the code should be migrated is a different story :)
True, but not quite what we do...
Checking one of the existing actions, I see
void FileVerb::perform(SPAction *action, void *data, void */*pdata*/)
First point is that the "data" void* pointer contains the enum value of the verb from verbs.h. (Technically we should be calling the glib routines to stuff an integer into the pointer, etc. but we're doing manual casts at the moment).
That enum value is then fed to a switch. Then the actual *user* data for that is the "pdata" parameter contains possible user data. However, we see from the helpful warning cleanup work that some oh so helpful person did (gee, I wonder who that was? :-) ) that the "pdata" parameter is not used anywhere, since it is commented out.
So I think Alex has hit up against a limitation of the current approach. One of the reasons we're not using that data pointer is that we don't have a simple way to keep the behavior consistent for the UI and command-line cases. This then extends into the scripting and D-Bus realm also...
... and speaking of command-line. I think that's the place for Alex to look. (next mail coming soon)
Oh, and yes, we *REALLY* need to get it migrated. I think the general plan to go with strings instead of enum values will help quite a lot.