On Wed, 2005-05-25 at 01:23, Bryce Harrington wrote:
Btw, this is intended to only be an interim solution. Ultimately, I would like to see a mechanism that allows the dialogs to be registered in a way that would allow invoking them without passing a string. I.e., instead of a switch statement with cases to handle each verb define as above, you could replace the entire switch statement with just:
dt->_dlg_mgt->showDialog(reinterpret_cast<std::size_t>(data));
...
Hmm. I'm not overly fond of this approach.
It seems to be refactoring the wrong pieces to me. I'd like to stick with strings or GQuarks to identify dialogs. There's no reason to tie dialogs to verbs directly. Refactorings should follow abstraction boundaries.
Rather than having a special case for verbs that spawn dialogs, it seems a better idea to provide the ability for a dynamically loaded extension to register a general-purpose callback as a verb. Remember, a verb that shows a dialog might well want to do some preparatory work on the document too.
Also, showDialog("dialogName") doesn't seem like an inordinate amount of code. I'd be more concerned about eliminating the cut-and-pasting of dt->_dlg_mgr and the associated exposure of internal details.
-mental