Re: Abstract string properties with getter/setter functions
- From: Emmanuele Bassi <ebassi gmail com>
- To: gtk-devel-list gnome org
- Subject: Re: Abstract string properties with getter/setter functions
- Date: Sat, 29 Sep 2007 09:20:36 +0100
On Fri, 2007-09-28 at 16:24 -0500, Federico Mena Quintero wrote:
> By the way, this is a *TERRIBLE* idea. I don't remember why I wrote the
> code that way. Please don't follow that broken pattern.
if I may guess, it's because otherwise you'd have to unref the returned
widget, which would be a bit odd in the gtk+ context. it also happens in
the ::get_filter() method of GtkFileChooser (and GtkRecentChooser), for
the same reason: the implementation owns the filter and it's just
returning a pointer to it.
when you call gtk_tree_view_get_model() you don't unref the returned
GtkTreeModel because the tree view widget holds a reference on the model
itself, as it happens in this case:
> [In the file chooser it works because the GtkFileChooser implementation
> always holds a reference to the preview widget.]
yep.
it's like returning a private string as a const-gchar*. in these cases
work because it has been documented and it's more or less consistent
with the rest of the gtk+ API.
ciao,
Emmanuele.
--
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]