[FOSS-GPS] Instance-IDs for osm-gps-map's `image' API

Sander van Grieken sander at 3v8.net
Sat May 22 06:18:48 EDT 2010


On Friday 21 May 2010 15:44:02 Joshua Judson Rosen wrote:
> John Stowers <john.stowers.lists at gmail.com> writes:
> > On Thu, May 20, 2010 at 5:14 PM, Joshua Judson Rosen <rozzin at geekspace.com>
> > wrote:
> > >
> > > Indeed--not just the interface, but the implementation would also be
> > > identical. Ideally, I'd suggest just adding the extra argument to
> > > osm_gps_map_image_remove(), and changing the osm_gps_image_add() so
> > > that it returns its image_t pointer as the opaque identifier
> > > (cf. attached patch).
> [...]
> > Looking over the patch, I wonder if this implementation is flexible
> > enough, while not making the API too confusing, for the behavior you
> > are trying to enable (removing either a single poi/image, or a whole
> > group of pois/images).
> > 
> > The limitation appears to be the assumption that the same pixbuf be
> > used as a handle for a group of pois/images. Is this something that is
> > useful/true in practice or will the app still need to keep around the
> > pointer to each added poi/image anyway (in which case we might as well
> > keep the implementation simple, and thus remove() only accepts the
> > opaque pointer)
> > 
> > What do you think?
> 
> Speaking only for FoxtrotGPS, I have a patch that I'm going to want to
> integrate at some point that enables distinct items in the same general class
> (e.g.: different POIs) to have have different icons; so we're ultimately
> not going to find much use in osm-gps-map's current remove_image() behaviour.
> 
> For maximal flexibility, I'd probably also add a `user_data' member
> to image_t, add an add_image_with_data() function that associates
> its `data' argument with the newly_created image_t, make add_image()
> associate the newly-created image_t with *itself* and return the same
> pointer; then you can drop the old GdkPixbuf argument from remove_image().
> It'd also be good to add a foreach_image() function that can be used to
> to iterate over all of the images with at least a 2-argument (key, userparm)
> callback like they have in various places in GLib and GTK+.

Why would you want to put so much image management functionality in osm-gps-map? We need 
to manage these things in the application anyway, in order to know what to put in and take 
out of the view, if it's being clicked on, etc.

If osm-gps-map simply provides the add/remove image functions that work with unique 
image_t* pointers for each image instance, we can manage everything from the outside. The 
code is already there. If you want many more different icons, that should be no problem 
since we can already pass any pixbuf.

It was on my wishlist too BTW, these POI class specific icons, but I don't want to start 
with new functionality before my branch gets merged to trunk. Can you please consider 
merging my branch soon? Everything is now integrated (so also the friends, POI and photo 
icons), quite a number of pre-existing bugs are fixed too, and the few things that are not 
yet possible with the current osm-gps-map (like line-drawing in distance mode) are 
annotated with TODOs in the code. The code has changed much, so any work based on trunk 
now will be difficult to merge later.

grtz,
Sander


More information about the FOSS-GPS mailing list