Re: Why Gtk::Builder::get_widget(_derived) returns void?
- From: Krzesimir Nowak <qdlacz gmail com>
- To: Murray Cumming <murrayc murrayc com>
- Cc: gtkmm mailing list <gtkmm-list gnome org>
- Subject: Re: Why Gtk::Builder::get_widget(_derived) returns void?
- Date: Mon, 27 Apr 2009 13:00:28 +0200
On Fri, 2009-04-24 at 14:01 +0200, Murray Cumming wrote:
> On Thu, 2009-04-23 at 22:31 +0200, Krzesimir Nowak wrote:
> > Well, question is asked in topic.
> >
> > In libglademm such methods of Glade::Xml return a pointer to widget we
> > are getting from glade file. Which was neat, because it could be used in
> > constructor's initializer list.
>
> I guess I thought it was confusing to have the same thing returned as
> the result and via an output parameter, and I preferred having an output
> parameter to avoid using the callthis<WithThisType>() syntax that would
> be unfamiliar to many people.
>
Sorry for late response.
It's understandable that using callthis<WithThisType>() would be a
labourous syntax, but I don't agree with confusion about returning a
pointer via result and output parameter:
- It already existed in libglademm and was ok.
- If something was confusing, then it would be easy to explain in
documentation (as it was somewhat in libglademm documentation - there
was an example).
- Porting from Glade::Xml to Gtk::Builder involves splitting statements
like:
Gtk::Window* window(ref_glade->get_widget("w", window));
into:
Gtk::Window* window = 0;
ref->glade->get_widget("w", window);
so it's not simply "find and replace" anymore in simple cases.
- It doesn't allow to use nice method call chains like
ref_builder->get_widget<Type>("widget_name")->get_something().do_it();
Since gtkmm is API compatible with earlier version, these methods
(probably) won't be changed until upcoming API break (probably next
year), so I really be glad to see at least templated methods returning a
pointer to widget (that is: callthis<WithThisType>) as an API addition.
Krzesimir Nowak
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]