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 667808 - Accept -1 as the position where insert an element in list and tree stores
Accept -1 as the position where insert an element in list and tree stores
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
Depends on:
Blocks:
 
 
Reported: 2012-01-12 19:25 UTC by Colomban Wendling
Modified: 2012-07-12 12:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Accept -1 as the position where insert an element in list and tree stores (7.41 KB, patch)
2012-01-12 19:25 UTC, Colomban Wendling
accepted-commit_now Details | Review
Consistently allow -1 to mean 'append' in tree models (5.43 KB, patch)
2012-07-12 12:41 UTC, Matthias Clasen
committed Details | Review
Ensure that XDG_DATA_HOME is created before using it (1.54 KB, patch)
2012-07-12 12:41 UTC, Matthias Clasen
committed Details | Review

Description Colomban Wendling 2012-01-12 19:25:18 UTC
Created attachment 205128 [details] [review]
Accept -1 as the position where insert an element in list and tree stores

Using position -1 to append to a store is convenient and was already partially supported by the list and tree stores [1], and is already used by some applications (SoundJuicer, Rhythmbox, maybe others).
However, the feature wasn't documented and gtk_list_store_insert() didn't support it, in contrast to gtk_list_store_insert_with_values() for example.

So, document this and fix gtk_list_store_insert() to accept it too, as does the other insert functions.


[1] their underlying data structures, namely GSequence and GNode, did support it
Comment 1 Matthias Clasen 2012-07-11 03:36:32 UTC
Review of attachment 205128 [details] [review]:

Looks fine to me.
Comment 2 Matthias Clasen 2012-07-12 12:41:08 UTC
The following fixes have been pushed:
0b5f129 Consistently allow -1 to mean 'append' in tree models
3d7a2d7 Ensure that XDG_DATA_HOME is created before using it
Comment 3 Matthias Clasen 2012-07-12 12:41:11 UTC
Created attachment 218617 [details] [review]
Consistently allow -1 to mean 'append' in tree models

Both GtkListStore and GtkTreeStore had a few methods that allowed
-1 to mean 'append' when specified as a position, but others that
demanded positive position arguments. Make this consistent by
always allowing -1.
Comment 4 Matthias Clasen 2012-07-12 12:41:14 UTC
Created attachment 218618 [details] [review]
Ensure that XDG_DATA_HOME is created before using it

The recently-used.xbel storage for recently used files is located inside
the $XDG_DATA_HOME directory; there's no actual guarantee that the
directory has been created already, even though it's very highly
probable on any modern distribution. We should create it, along with its
intermediate parents, before constructing the file monitor that we use
to get change notifications.

https://bugzilla.gnome.org/show_bug.cgi?id=671817