Mercurial > geeqie.yaz
diff src/image-overlay.c @ 1523:24a12aa0cb54
Fix up event source ids type: gint -> guint.
Functions like g_timeout_add() or g_idle_add() return a guint
greater than 0, but in most places it was wrongly stored as int
and initialized to -1.
This broke assertions matching in g_source_remove() for example
since id was always greater than 0 even when timer was not set
(-1 was casted to the biggest guint).
author | zas_ |
---|---|
date | Mon, 06 Apr 2009 22:13:54 +0000 |
parents | 5f49f305a6b6 |
children | 7f91f906f9c2 |
line wrap: on
line diff
--- a/src/image-overlay.c Mon Apr 06 21:52:49 2009 +0000 +++ b/src/image-overlay.c Mon Apr 06 22:13:54 2009 +0000 @@ -51,8 +51,8 @@ gint icon_time[IMAGE_OSD_COUNT]; gint icon_id[IMAGE_OSD_COUNT]; - gint idle_id; - gint timer_id; + guint idle_id; /* event source id */ + guint timer_id; /* event source id */ gulong destroy_id; }; @@ -890,7 +890,7 @@ osd->changed_states = IMAGE_STATE_NONE; osd->notify = 0; - osd->idle_id = -1; + osd->idle_id = 0; return FALSE; } @@ -898,7 +898,7 @@ { if (force) osd->changed_states |= IMAGE_STATE_IMAGE; - if (osd->idle_id == -1) + if (!osd->idle_id) { osd->idle_id = g_idle_add_full(G_PRIORITY_HIGH, image_osd_update_cb, osd, NULL); } @@ -941,7 +941,7 @@ if (done) { - osd->timer_id = -1; + osd->timer_id = 0; return FALSE; } @@ -950,7 +950,7 @@ static void image_osd_timer_schedule(OverlayStateData *osd) { - if (osd->timer_id == -1) + if (!osd->timer_id) { osd->timer_id = g_timeout_add(100, image_osd_timer_cb, osd); } @@ -981,8 +981,8 @@ { if (!osd) return; - if (osd->idle_id != -1) g_source_remove(osd->idle_id); - if (osd->timer_id != -1) g_source_remove(osd->timer_id); + if (osd->idle_id) g_source_remove(osd->idle_id); + if (osd->timer_id) g_source_remove(osd->timer_id); file_data_unregister_notify_func(image_osd_notify_cb, osd); @@ -1025,8 +1025,6 @@ { osd = g_new0(OverlayStateData, 1); osd->imd = imd; - osd->idle_id = -1; - osd->timer_id = -1; osd->show = OSD_SHOW_NOTHING; osd->x = options->image_overlay.x; osd->y = options->image_overlay.y;