Mercurial > geeqie
diff src/view_file.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 | c9ed5a43c576 |
children | c03a8e19a43a |
line wrap: on
line diff
--- a/src/view_file.c Mon Apr 06 21:52:49 2009 +0000 +++ b/src/view_file.c Mon Apr 06 22:13:54 2009 +0000 @@ -709,7 +709,6 @@ vf->type = type; vf->sort_method = SORT_NAME; vf->sort_ascend = TRUE; - vf->refresh_idle_id = -1; vf->scrolled = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vf->scrolled), GTK_SHADOW_IN); @@ -822,20 +821,23 @@ ViewFile *vf = data; vf_refresh(vf); - vf->refresh_idle_id = -1; + vf->refresh_idle_id = 0; return FALSE; } void vf_refresh_idle_cancel(ViewFile *vf) { - if (vf->refresh_idle_id != -1) g_source_remove(vf->refresh_idle_id); - vf->refresh_idle_id = -1; + if (vf->refresh_idle_id) + { + g_source_remove(vf->refresh_idle_id); + vf->refresh_idle_id = 0; + } } void vf_refresh_idle(ViewFile *vf) { - if (vf->refresh_idle_id == -1) + if (!vf->refresh_idle_id) { vf->refresh_idle_id = g_idle_add(vf_refresh_idle_cb, vf); } @@ -850,7 +852,7 @@ if (vf->marks_enabled) interested |= NOTIFY_MARKS | NOTIFY_METADATA; /* FIXME: NOTIFY_METADATA should be checked by the keyword-to-mark functions and converted to NOTIFY_MARKS only if there was a change */ - if (!(type & interested) || vf->refresh_idle_id != -1 || !vf->dir_fd) return; + if (!(type & interested) || vf->refresh_idle_id || !vf->dir_fd) return; refresh = (fd == vf->dir_fd);