John Stowers <[email protected]> writes:
> On Sat, 2010-05-15 at 16:33 -0400, Joshua Judson Rosen wrote:
> > Sander van Grieken <[email protected]> writes:
> > > On Friday 14 May 2010 14:04:34 John Stowers wrote:
> > > > Sander van Grieken <[email protected]> writes:
> > > > >
> > > > > - There seems to be no callback for download-progress-reporting
> > > > > (number of threads, queue depth). I'd hate to ditch the visual
> > > > > download feedback foxtrot currently has.
> > > > 
> > > > No callbacks is by design, the number of queued tiles is exposed as a
> > > > gobject property (tiles-queued). It can be polled at whatever frequency
> > > > the UI wishes (see python demo for example).
> > > 
> > > Well I actually meant signals instead of callbacks, but fair enough,
> > > this should suffice.  Is it also possible to inspect currently
> > > running download threads, and is there a way to cancel the queue?
> > 
> > Actually, shouldn't it be possible to listen for a "notify::tiles-queued"
> > GObject signal?
> 
> Possibly, I am not sure if I call g_object_set() with the tile value
> internally (as this triggers the signal emission) or just update the
> value of the private instance variable directly.
> 
> I suspect I do the former. If this is a problem then I could change to
> ensure that I set the property through the GObject machinery.

Looking it over, "tiles-queued" isn't even settable: but that makes
sense--I don't know what it would even mean to set something like that.

I believe you just need to include a call to g_object_notify() wherever
you're doing something that may change the reported value.

cf. attached patch.

-- 
"Don't be afraid to ask (λf.((λx.xx) (λr.f(rr))))."

>From 9e6dcd80f2b0bba130e5f53832d5f36984acb5f7 Mon Sep 17 00:00:00 2001
From: Joshua Judson Rosen <[email protected]>
Date: Sun, 16 May 2010 09:24:36 -0400
Subject: [PATCH] Provide a "notify" signal for OsmGpsMap's "tiles-queued" property.

---
 src/osm-gps-map.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/osm-gps-map.c b/src/osm-gps-map.c
index d784add..aea9e0b 100644
--- a/src/osm-gps-map.c
+++ b/src/osm-gps-map.c
@@ -763,6 +763,7 @@ osm_gps_map_tile_download_complete (SoupSession *session, SoupMessage *msg, gpoi
             osm_gps_map_map_redraw_idle (map);
         }
         g_hash_table_remove(priv->tile_queue, dl->uri);
+        g_object_notify(G_OBJECT(map), "tiles-queued");
 
         g_free(dl->uri);
         g_free(dl->folder);
@@ -776,6 +777,7 @@ osm_gps_map_tile_download_complete (SoupSession *session, SoupMessage *msg, gpoi
         {
             g_hash_table_insert(priv->missing_tiles, dl->uri, NULL);
             g_hash_table_remove(priv->tile_queue, dl->uri);
+            g_object_notify(G_OBJECT(map), "tiles-queued");
         }
         else if (msg->status_code == SOUP_STATUS_CANCELLED)
         {
@@ -855,6 +857,7 @@ osm_gps_map_download_tile (OsmGpsMap *map, int zoom, int x, int y, gboolean redr
 #endif
 
             g_hash_table_insert (priv->tile_queue, dl->uri, msg);
+            g_object_notify (G_OBJECT (map), "tiles-queued");
             soup_session_queue_message (priv->soup_session, msg, osm_gps_map_tile_download_complete, dl);
         } else {
             g_warning("Could not create soup message");
-- 
1.5.6.5

_______________________________________________
This message is sent to you from [email protected] mailing list.
Visit http://lists.osgeo.org/mailman/listinfo/foss-gps to manage your 
subscription
For more information, check http://wiki.osgeo.org/wiki/FOSS-GPS

Reply via email to