GNOME Bugzilla – Bug 628194
Add new API peas_engine_get_default()
Last modified: 2010-10-03 21:42:08 UTC
This allows applications to access the engine instance from anywhere. In particular we do not need to pass the engine to the widgets we create.
Created attachment 168950 [details] [review] Add new API peas_engine_get_default()
Created attachment 168951 [details] [review] Drop "engine" construct properties from libpeas-gtk widgets. We can use peas_engine_get_default() instead, and hopefully be able to construct the widgets from GtkBuilder.
Review of attachment 168950 [details] [review]: ::: libpeas/peas-engine.c @@ +1156,3 @@ + */ +PeasEngine * +peas_engine_get_default (void) Why not remove the peas_engine_new and have only the get_default?
Oh well I see the issue, the new has the app name parameter. Not sure I like this approach. We could have several instances, do you check on peas_engine_new that an instance already exists?
Actually I'd like the app name to be specified in some other way (so using _new() would be limited to people subclassing PeasEngine) but I don't know how to do that nicely.
Created attachment 171574 [details] [review] Add new API peas_engine_get_default()
Comment on attachment 171574 [details] [review] Add new API peas_engine_get_default() Attachment 171574 [details] pushed as b579068 - Add new API peas_engine_get_default()
Not sure I like this patch :( I think we should also remove the peas_engine_new and rework the get_default as I don't like too much how it is created right now in the init. Any thoughts on this?
Well, I guess the _new() could be dropped. Anyway, I see default_engine being set in _init() as a feature: it means you can initialize your own PeasEngine subclass instance before _get_default() has a chance, and use this one instead of ours.
Created attachment 171616 [details] [review] Drop peas_engine_new() People should not be using peas_engine_new() at all: either they should use peas_engine_get_default() or provide their own subclass.
Comment on attachment 171616 [details] [review] Drop peas_engine_new() Attachment 171616 [details] pushed as 6b95f31 - Drop peas_engine_new()
Attachment 168951 [details] pushed as 3a7e467 - Drop "engine" construct properties from libpeas-gtk widgets.