After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 300142 - Simpler append_column() API.
Simpler append_column() API.
Status: RESOLVED WONTFIX
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
2.6.x
Other Linux
: Normal normal
: Small API
Assigned To: gtktreeview-bugs
gtktreeview-bugs
Depends on:
Blocks:
 
 
Reported: 2005-04-11 02:24 UTC by Murray Cumming
Modified: 2005-08-24 20:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
treeview_simpler_api.patch (15.76 KB, patch)
2005-04-11 02:25 UTC, Murray Cumming
rejected Details | Review
gtktreeview_defaults_test.c (2.21 KB, text/x-csrc)
2005-04-11 08:29 UTC, Murray Cumming
  Details

Description Murray Cumming 2005-04-11 02:24:33 UTC
This patch adds convenience functions that create appropriate default cell
renderers for the model columns and configure them appropriately. This saves a
lot of code and confusion.

There are some TODO comments in the patch that suggest a) how this might be
improved with changes elsewhere, and b) 1 or 2 basic gobject things I'm not sure
about.
Comment 1 Murray Cumming 2005-04-11 02:25:55 UTC
Created attachment 45119 [details] [review]
treeview_simpler_api.patch
Comment 2 Murray Cumming 2005-04-11 08:29:43 UTC
Created attachment 45124 [details]
gtktreeview_defaults_test.c 

Example to show how to use this API, and how it uses less code.
Comment 3 Sven Neumann 2005-04-11 09:38:10 UTC
IMHO this should end up being in extra files. gtktreeview.[ch] is more than
large enough already.
Comment 4 Benoît Dejean 2005-04-11 09:59:22 UTC
about the TODOs

int/long   -> value_number = strtol (new_text, NULL, 0);
uint/ulong -> value_number = strtoul (new_text, NULL, 0);
Comment 5 Jonathan Blandford 2005-04-11 18:37:08 UTC
I really don't like this approach to simplifying GtkTreeView.  First of all, I
think that any _with_defaults() function is right, as no one knows what the
defualts are.  Secondly, it doesn't address the bigger problem people have with
GtkTreeView, which is the M/V/C split.  If we're going to provide a simpler API,
I'd rather see it be of the form:

list = gtk_simple_list_new (G_TYPE_BOOLEAN, GDK_TYPE_PIXBUF, G_TYPE_STRING,
G_TYPE_POINTER);
gtk_simple_list_append (list, FALSE, pixbuf, "Foo", my_data);

Which would create a GtkTreeView with 3 columns, each with one renderer (toggle,
pixbuf, and string).
Comment 6 Murray Cumming 2005-04-11 22:30:10 UTC
> no one knows what the defaultts are.
We can document them, and they are pretty obvious anyway. We have been doing
this successfully in gtkmm since 2.0.

>we're going to provide a simpler API, I'd rather see it be of the form:
>
> list = gtk_simple_list_new (G_TYPE_BOOLEAN, GDK_TYPE_PIXBUF, G_TYPE_STRING,
G_TYPE_POINTER);

That would do much the same thing, and could in fact be implemented with these
functions.

And these functions would still be useful in order to make changes to the
default without implementing the whole thing. For instance, you can add a
default cell renderer but provide your own validation of edited values. That's
common enough to be worth API.
Comment 7 Kristian Rietveld 2005-06-19 22:40:11 UTC
I fully agree with Jonathan on this point. Also, I don't really see why the
_with_default() functions are useful, they might save typing, but that's about
everything I can come up with.