changeset 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 d7206703d90f
children 6026466313b2
files src/bar_histogram.c src/bar_keywords.c src/cache-loader.c src/cache-loader.h src/cache_maint.c src/collect-io.c src/collect-table.c src/color-man.c src/color-man.h src/dupe.c src/dupe.h src/filedata.c src/fullscreen.c src/histogram.c src/image-load.c src/image-load.h src/image-overlay.c src/lirc.c src/metadata.c src/pan-types.h src/pan-view.c src/pixbuf-renderer.c src/pixbuf-renderer.h src/print.c src/remote.c src/search.c src/slideshow.c src/thumb.c src/thumb_standard.c src/typedefs.h src/ui_spinner.c src/ui_tree_edit.c src/utilops.c src/view_dir.c src/view_dir_tree.c src/view_file.c src/view_file_icon.c src/view_file_list.c
diffstat 38 files changed, 236 insertions(+), 235 deletions(-) [+]
line wrap: on
line diff
--- a/src/bar_histogram.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/bar_histogram.c	Mon Apr 06 22:13:54 2009 +0000
@@ -43,7 +43,7 @@
 	GdkPixbuf *pixbuf;
 	FileData *fd;
 	gboolean need_update;
-	gint idle_id;
+	guint idle_id; /* event source id */
 };
 
 static gboolean bar_pane_histogram_update_cb(gpointer data);
@@ -63,7 +63,10 @@
 	   FIXME: this does not work for fullscreen*/
 	if (GTK_WIDGET_DRAWABLE(phd->drawing_area))
 		{
-		if (phd->idle_id == -1) phd->idle_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, bar_pane_histogram_update_cb, phd, NULL);
+		if (!phd->idle_id)
+			{
+			phd->idle_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, bar_pane_histogram_update_cb, phd, NULL);
+			}
 		}
 	else
 		{
@@ -76,7 +79,7 @@
 	const HistMap *histmap;
 	PaneHistogramData *phd = data;
 
-	phd->idle_id = -1;
+	phd->idle_id = 0;
 	phd->need_update = FALSE;
 	
 	gtk_widget_queue_draw_area(GTK_WIDGET(phd->drawing_area), 0, 0, phd->histogram_width, phd->histogram_height);
@@ -182,7 +185,7 @@
 {
 	PaneHistogramData *phd = data;
 	
-	g_source_remove(phd->idle_id);
+	if (phd->idle_id) g_source_remove(phd->idle_id);
 	file_data_unregister_notify_func(bar_pane_histogram_notify_cb, phd);
 
 	file_data_unref(phd->fd);
@@ -346,7 +349,6 @@
 	phd->pane.type = PANE_HISTOGRAM;
 
 	phd->pane.expanded = expanded;
-	phd->idle_id = -1;
 	
 	phd->histogram = histogram_new();
 
--- a/src/bar_keywords.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/bar_keywords.c	Mon Apr 06 22:13:54 2009 +0000
@@ -110,7 +110,7 @@
 	gboolean collapse_unchecked;
 	gboolean hide_unchecked;
 
-	gint idle_id;	
+	guint idle_id; /* event source id */	
 	FileData *fd;
 	gchar *key;
 };
@@ -426,7 +426,7 @@
 	bar_pane_keywords_write(pkd);
 	bar_keyword_tree_sync(pkd);
 	file_data_register_notify_func(bar_pane_keywords_notify_cb, pkd, NOTIFY_PRIORITY_LOW);
-	pkd->idle_id = -1;
+	pkd->idle_id = 0;
 	return FALSE;
 }
 
@@ -434,7 +434,7 @@
 {
 	PaneKeywordsData *pkd = data;
 
-	if (pkd->idle_id != -1) return;
+	if (pkd->idle_id) return;
 	/* higher prio than redraw */
 	pkd->idle_id = g_idle_add_full(G_PRIORITY_HIGH_IDLE, bar_pane_keywords_changed_idle_cb, pkd, NULL);
 }
@@ -1196,7 +1196,7 @@
 	PaneKeywordsData *pkd = data;
 
         if (pkd->click_tpath) gtk_tree_path_free(pkd->click_tpath);
-	if (pkd->idle_id != -1) g_source_remove(pkd->idle_id);
+	if (pkd->idle_id) g_source_remove(pkd->idle_id);
 	file_data_unregister_notify_func(bar_pane_keywords_notify_cb, pkd);
 
 	file_data_unref(pkd->fd);
@@ -1231,8 +1231,6 @@
 	
 	pkd->expand_checked = TRUE;
 	
-	pkd->idle_id = -1;
-
 	hbox = gtk_hbox_new(FALSE, PREF_PAD_GAP);
 
 	pkd->widget = hbox;
--- a/src/cache-loader.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/cache-loader.c	Mon Apr 06 22:13:54 2009 +0000
@@ -174,7 +174,7 @@
 			g_free(base);
 			}
 
-		cl->idle_id = -1;
+		cl->idle_id = 0;
 
 		if (cl->done_func)
 			{
@@ -232,10 +232,10 @@
 {
 	if (!cl) return;
 
-	if (cl->idle_id != -1)
+	if (cl->idle_id)
 		{
 		g_source_remove(cl->idle_id);
-		cl->idle_id = -1;
+		cl->idle_id = 0;
 		}
 
 	image_loader_free(cl->il);
--- a/src/cache-loader.h	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/cache-loader.h	Mon Apr 06 22:13:54 2009 +0000
@@ -45,7 +45,7 @@
 	gboolean error;
 
 	ImageLoader *il;
-	gint idle_id;
+	guint idle_id; /* event source id */
 };
 
 
--- a/src/cache_maint.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/cache_maint.c	Mon Apr 06 22:13:54 2009 +0000
@@ -30,7 +30,7 @@
 {
 	GList *list;
 	GList *done_list;
-	gint idle_id;
+	guint idle_id; /* event source id */
 	GenericDialog *gd;
 	GtkWidget *entry;
 	GtkWidget *spinner;
@@ -111,7 +111,7 @@
 
 static void cache_maintain_home_close(CMData *cm)
 {
-	if (cm->idle_id != -1) g_source_remove(cm->idle_id);
+	if (cm->idle_id) g_source_remove(cm->idle_id);
 	if (cm->gd) generic_dialog_close(cm->gd);
 	filelist_free(cm->list);
 	g_list_free(cm->done_list);
@@ -120,10 +120,10 @@
 
 static void cache_maintain_home_stop(CMData *cm)
 {
-	if (cm->idle_id != -1)
+	if (cm->idle_id)
 		{
 		g_source_remove(cm->idle_id);
-		cm->idle_id = -1;
+		cm->idle_id = 0;
 		}
 
 	gtk_entry_set_text(GTK_ENTRY(cm->entry), _("done"));
@@ -158,7 +158,7 @@
 	if (!cm->list)
 		{
 		DEBUG_1("purge chk done.");
-		cm->idle_id = -1;
+		cm->idle_id = 0;
 		cache_maintain_home_stop(cm);
 		return FALSE;
 		}
@@ -689,7 +689,7 @@
 	gboolean local;
 	gboolean recurse;
 
-	gint idle_id;
+	guint idle_id; /* event source id */
 };
 
 static void cache_manager_render_reset(CleanData *cd)
@@ -937,10 +937,10 @@
 	gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(cd->progress), 1.0);
 	gtk_progress_bar_set_text(GTK_PROGRESS_BAR(cd->progress), _("done"));
 
-	if (cd->idle_id != -1)
+	if (cd->idle_id)
 		{
 		g_source_remove(cd->idle_id);
-		cd->idle_id = -1;
+		cd->idle_id = 0;
 		}
 
 	thumb_loader_std_thumb_file_validate_cancel(cd->tl);
@@ -983,7 +983,7 @@
 		return TRUE;
 		}
 
-	cd->idle_id = -1;
+	cd->idle_id = 0;
 	cache_manager_standard_clean_done(cd);
 	return FALSE;
 }
@@ -1118,7 +1118,7 @@
 
 	cd->days = 30;
 	cd->tl = NULL;
-	cd->idle_id = -1;
+	cd->idle_id = 0;
 
 	gtk_widget_show(cd->gd->dialog);
 }
--- a/src/collect-io.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/collect-io.c	Mon Apr 06 22:13:54 2009 +0000
@@ -447,7 +447,7 @@
 static GList *collection_manager_entry_list = NULL;
 static GList *collection_manager_action_list = NULL;
 static GList *collection_manager_action_tail = NULL;
-static gint collection_manager_timer_id = -1;
+static guint collection_manager_timer_id = 0; /* event source id */
 
 
 static CollectManagerAction *collect_manager_action_new(const gchar *oldpath, const gchar *newpath,
@@ -833,18 +833,18 @@
 
 	g_idle_add_full(G_PRIORITY_LOW, collect_manager_process_cb, NULL, NULL);
 
-	collection_manager_timer_id = -1;
+	collection_manager_timer_id = 0;
 	return FALSE;
 }
 
 static void collect_manager_timer_push(gint stop)
 {
-	if (collection_manager_timer_id != -1)
+	if (collection_manager_timer_id)
 		{
 		if (!stop) return;
 
 		g_source_remove(collection_manager_timer_id);
-		collection_manager_timer_id = -1;
+		collection_manager_timer_id = 0;
 		}
 
 	if (!stop)
--- a/src/collect-table.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/collect-table.c	Mon Apr 06 22:13:54 2009 +0000
@@ -552,11 +552,11 @@
 {
 	CollectTable *ct = data;
 
-	if (ct->tip_delay_id == -1) return FALSE;
+	if (!ct->tip_delay_id) return FALSE;
 
 	tip_show(ct);
 
-	ct->tip_delay_id = -1;
+	ct->tip_delay_id = 0;
 	return FALSE;
 }
 
@@ -564,10 +564,10 @@
 {
 	tip_hide(ct);
 
-	if (ct->tip_delay_id != -1)
+	if (ct->tip_delay_id)
 		{
 		g_source_remove(ct->tip_delay_id);
-		ct->tip_delay_id = -1;
+		ct->tip_delay_id = 0;
 		}
 
 	ct->tip_delay_id = g_timeout_add(ct->show_text ? COLLECT_TABLE_TIP_DELAY_PATH : COLLECT_TABLE_TIP_DELAY, tip_schedule_cb, ct);
@@ -577,8 +577,11 @@
 {
 	tip_hide(ct);
 
-	if (ct->tip_delay_id != -1) g_source_remove(ct->tip_delay_id);
-	ct->tip_delay_id = -1;
+	if (ct->tip_delay_id)
+		{
+		g_source_remove(ct->tip_delay_id);
+		ct->tip_delay_id = 0;
+		}
 }
 
 static void tip_update(CollectTable *ct, CollectInfo *info)
@@ -1452,7 +1455,7 @@
 	gint x, y;
 	gint w, h;
 
-	if (ct->drop_idle_id == -1) return FALSE;
+	if (!ct->drop_idle_id) return FALSE;
 
 	window = ct->listview->window;
 	gdk_window_get_pointer(window, &x, &y, NULL);
@@ -1462,7 +1465,7 @@
 		collection_table_motion_update(ct, x, y, TRUE);
 		}
 
-	ct->drop_idle_id = -1;
+	ct->drop_idle_id = 0;
 	return FALSE;
 }
 
@@ -1470,7 +1473,10 @@
 {
 	CollectTable *ct = data;
 
-	if (ct->drop_idle_id == -1) ct->drop_idle_id = g_idle_add(collection_table_auto_scroll_idle_cb, ct);
+	if (!ct->drop_idle_id)
+		{
+		ct->drop_idle_id = g_idle_add(collection_table_auto_scroll_idle_cb, ct);
+		}
 
 	return TRUE;
 }
@@ -1479,10 +1485,10 @@
 {
 	if (!scroll)
 		{
-		if (ct->drop_idle_id != -1)
+		if (ct->drop_idle_id)
 			{
 			g_source_remove(ct->drop_idle_id);
-			ct->drop_idle_id = -1;
+			ct->drop_idle_id = 0;
 			}
 		widget_auto_scroll_stop(ct->listview);
 		collection_table_insert_marker(ct, NULL, FALSE);
@@ -1810,8 +1816,9 @@
 {
 	CollectTable *ct = data;
 
-	if (ct->sync_idle_id == -1) return FALSE;
-	ct->sync_idle_id = -1;
+	if (!ct->sync_idle_id) return FALSE;
+	g_source_remove(ct->sync_idle_id);
+	ct->sync_idle_id = 0;
 
 	collection_table_sync(ct);
 	return FALSE;
@@ -1819,7 +1826,7 @@
 
 static void collection_table_sync_idle(CollectTable *ct)
 {
-	if (ct->sync_idle_id == -1)
+	if (!ct->sync_idle_id)
 		{
 		/* high priority, the view needs to be resynced before a redraw
 		 * may contain invalid pointers at this time
@@ -2416,7 +2423,7 @@
 		gtk_widget_destroy(ct->popup);
 		}
 
-	if (ct->sync_idle_id != -1) g_source_remove(ct->sync_idle_id);
+	if (ct->sync_idle_id) g_source_remove(ct->sync_idle_id);
 
 	tip_unschedule(ct);
 	collection_table_scroll(ct, FALSE);
@@ -2441,12 +2448,8 @@
 	ct = g_new0(CollectTable, 1);
 	
 	ct->cd = cd;
-	ct->tip_delay_id = -1;
 	ct->show_text = options->show_icon_names;
 
-	ct->sync_idle_id = -1;
-	ct->drop_idle_id = -1;
-
 	ct->scrolled = gtk_scrolled_window_new(NULL, NULL);
 	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(ct->scrolled), GTK_SHADOW_IN);
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ct->scrolled),
--- a/src/color-man.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/color-man.c	Mon Apr 06 22:13:54 2009 +0000
@@ -326,7 +326,7 @@
 	if (cm->imd &&
 	    cm->pixbuf != image_get_pixbuf(cm->imd))
 		{
-		cm->idle_id = -1;
+		cm->idle_id = 0;
 		color_man_done(cm, COLOR_RETURN_IMAGE_CHANGED);
 		return FALSE;
 		}
@@ -341,7 +341,7 @@
 			image_area_changed(cm->imd, 0, 0, width, height);
 			}
 
-		cm->idle_id = -1;
+		cm->idle_id = 0;
 		color_man_done(cm, COLOR_RETURN_SUCCESS);
 		return FALSE;
 		}
@@ -369,10 +369,6 @@
 	cm->pixbuf = pixbuf;
 	if (cm->pixbuf) g_object_ref(cm->pixbuf);
 
-	cm->incremental_sync = FALSE;
-	cm->row = 0;
-	cm->idle_id = -1;
-
 	has_alpha = pixbuf ? gdk_pixbuf_get_has_alpha(pixbuf) : FALSE;
 
 	cm->profile = color_man_cache_get(input_type, input_file, input_data, input_data_len,
@@ -415,7 +411,7 @@
 {
 	if (!cm) return;
 
-	if (cm->idle_id != -1) g_source_remove(cm->idle_id);
+	if (cm->idle_id) g_source_remove(cm->idle_id);
 	if (cm->pixbuf) g_object_unref(cm->pixbuf);
 
 	color_man_cache_unref(cm->profile);
--- a/src/color-man.h	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/color-man.h	Mon Apr 06 22:13:54 2009 +0000
@@ -40,7 +40,7 @@
 
 	gpointer profile;
 
-	gint idle_id;
+	guint idle_id; /* event source id */
 
 	ColorManDoneFunc func_done;
 	gpointer func_done_data;
--- a/src/dupe.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/dupe.c	Mon Apr 06 22:13:54 2009 +0000
@@ -1347,10 +1347,10 @@
 
 static void dupe_check_stop(DupeWindow *dw)
 {
-	if (dw->idle_id != -1 || dw->img_loader || dw->thumb_loader)
+	if (dw->idle_id || dw->img_loader || dw->thumb_loader)
 		{
 		g_source_remove(dw->idle_id);
-		dw->idle_id = -1;
+		dw->idle_id = 0;
 		dupe_window_update_progress(dw, NULL, 0.0, FALSE);
 		widget_set_cursor(dw->listview, -1);
 		}
@@ -1424,7 +1424,7 @@
 {
 	DupeWindow *dw = data;
 
-	if (dw->idle_id == -1) return FALSE;
+	if (!dw->idle_id) return FALSE;
 
 	if (!dw->setup_done)
 		{
@@ -1535,7 +1535,7 @@
 						dw->img_loader = NULL;
 						return TRUE;
 						}
-					dw->idle_id = -1;
+					dw->idle_id = 0;
 					return FALSE;
 					}
 
@@ -1559,7 +1559,7 @@
 			dupe_window_update_progress(dw, _("Sorting..."), 1.0, TRUE);
 			return TRUE;
 			}
-		dw->idle_id = -1;
+		dw->idle_id = 0;
 		dupe_window_update_progress(dw, NULL, 0.0, FALSE);
 
 		dupe_match_rank(dw);
@@ -1599,7 +1599,7 @@
 	dupe_window_update_count(dw, TRUE);
 	widget_set_cursor(dw->listview, GDK_WATCH);
 
-	if (dw->idle_id != -1) return;
+	if (dw->idle_id) return;
 
 	dw->idle_id = g_idle_add(dupe_check_cb, dw);
 }
@@ -3116,14 +3116,7 @@
 
 	dw = g_new0(DupeWindow, 1);
 
-	dw->list = NULL;
-	dw->dupes = NULL;
 	dw->match_mask = match_mask;
-	dw->show_thumbs = FALSE;
-
-	dw->idle_id = -1;
-
-	dw->second_set = FALSE;
 
 	dw->window = window_new(GTK_WINDOW_TOPLEVEL, "dupe", NULL, NULL, _("Find duplicates"));
 
--- a/src/dupe.h	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/dupe.h	Mon Apr 06 22:13:54 2009 +0000
@@ -81,7 +81,7 @@
 
 	gboolean show_thumbs;
 
-	gint idle_id;
+	guint idle_id; /* event source id */
 	GList *working;
 	gint setup_done;
 	gint setup_count;
--- a/src/filedata.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/filedata.c	Mon Apr 06 22:13:54 2009 +0000
@@ -2398,7 +2398,7 @@
 }
 
 static GHashTable *file_data_monitor_pool = NULL;
-static gint realtime_monitor_id = -1;
+static guint realtime_monitor_id = 0; /* event source id */
 
 static void realtime_monitor_check_cb(gpointer key, gpointer value, gpointer data)
 {
@@ -2432,7 +2432,7 @@
 	count++;
 	g_hash_table_insert(file_data_monitor_pool, fd, GINT_TO_POINTER(count));
 	
-	if (realtime_monitor_id == -1)
+	if (!realtime_monitor_id)
 		{
 		realtime_monitor_id = g_timeout_add(5000, realtime_monitor_cb, NULL);
 		}
@@ -2464,7 +2464,7 @@
 	if (g_hash_table_size(file_data_monitor_pool) == 0)
 		{
 		g_source_remove(realtime_monitor_id);
-		realtime_monitor_id = -1;
+		realtime_monitor_id = 0;
 		return FALSE;
 		}
 	
--- a/src/fullscreen.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/fullscreen.c	Mon Apr 06 22:13:54 2009 +0000
@@ -74,21 +74,22 @@
 {
 	FullScreenData *fs = data;
 
-	if (fs->hide_mouse_id == -1) return FALSE;
+	if (!fs->hide_mouse_id) return FALSE;
 
 	fs->cursor_state &= ~FULLSCREEN_CURSOR_NORMAL;
 	if (!(fs->cursor_state & FULLSCREEN_CURSOR_BUSY)) clear_mouse_cursor(fs->window, fs->cursor_state);
 
-	fs->hide_mouse_id = -1;
+	g_source_remove(fs->hide_mouse_id);
+	fs->hide_mouse_id = 0;
 	return FALSE;
 }
 
 static void fullscreen_hide_mouse_disable(FullScreenData *fs)
 {
-	if (fs->hide_mouse_id != -1)
+	if (fs->hide_mouse_id)
 		{
 		g_source_remove(fs->hide_mouse_id);
-		fs->hide_mouse_id = -1;
+		fs->hide_mouse_id = 0;
 		}
 }
 
@@ -114,10 +115,10 @@
 
 static void fullscreen_busy_mouse_disable(FullScreenData *fs)
 {
-	if (fs->busy_mouse_id != -1)
+	if (fs->busy_mouse_id)
 		{
 		g_source_remove(fs->busy_mouse_id);
-		fs->busy_mouse_id = -1;
+		fs->busy_mouse_id = 0;
 		}
 }
 
@@ -143,14 +144,14 @@
 {
 	FullScreenData *fs = data;
 
-	fs->busy_mouse_id = -1;
+	fs->busy_mouse_id = 0;
 	fullscreen_mouse_set_busy(fs, TRUE);
 	return FALSE;
 }
 
 static void fullscreen_mouse_set_busy_idle(FullScreenData *fs)
 {
-	if (fs->busy_mouse_id == -1)
+	if (!fs->busy_mouse_id)
 		{
 		fs->busy_mouse_id = g_timeout_add(FULL_SCREEN_BUSY_MOUSE_DELAY,
 						  fullscreen_mouse_set_busy_cb, fs);
@@ -227,8 +228,6 @@
 
 	fs = g_new0(FullScreenData, 1);
 
-	fs->hide_mouse_id = -1;
-	fs->busy_mouse_id = -1;
 	fs->cursor_state = FULLSCREEN_CURSOR_HIDDEN;
 
 	fs->normal_window = window;
@@ -335,7 +334,7 @@
 {
 	if (!fs) return;
 
-	g_source_remove(fs->saver_block_id);
+	if (fs->saver_block_id) g_source_remove(fs->saver_block_id);
 
 	fullscreen_hide_mouse_disable(fs);
 	fullscreen_busy_mouse_disable(fs);
--- a/src/histogram.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/histogram.c	Mon Apr 06 22:13:54 2009 +0000
@@ -32,7 +32,7 @@
 	gulong b[HISTMAP_SIZE];
 	gulong max[HISTMAP_SIZE];
 	
-	gint idle_id;
+	guint idle_id; /* event source id */
 	GdkPixbuf *pixbuf;
 	gint y;
 };
@@ -131,14 +131,13 @@
 static HistMap *histmap_new(void)
 {
 	HistMap *histmap = g_new0(HistMap, 1);
-	histmap->idle_id = -1;
 	return histmap;
 }
 
 void histmap_free(HistMap *histmap)
 {
 	if (!histmap) return;
-	if (histmap->idle_id != -1) g_source_remove(histmap->idle_id);
+	if (histmap->idle_id) g_source_remove(histmap->idle_id);
 	if (histmap->pixbuf) g_object_unref(histmap->pixbuf);
 	g_free(histmap);
 }
@@ -190,7 +189,7 @@
 
 const HistMap *histmap_get(FileData *fd)
 {
-	if (fd->histmap && fd->histmap->idle_id == -1) return fd->histmap; /* histmap exists and is finished */
+	if (fd->histmap && !fd->histmap->idle_id) return fd->histmap; /* histmap exists and is finished */
 	
 	return NULL;
 }
@@ -203,7 +202,7 @@
 		/* finished */
 		g_object_unref(fd->histmap->pixbuf); /*pixbuf is no longer needed */
 		fd->histmap->pixbuf = NULL;
-		fd->histmap->idle_id = -1;
+		fd->histmap->idle_id = 0;
 		file_data_send_notification(fd, NOTIFY_HISTMAP);
 		return FALSE;
 		}
--- a/src/image-load.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/image-load.c	Mon Apr 06 22:13:54 2009 +0000
@@ -72,7 +72,7 @@
 	ImageLoader *il = (ImageLoader *)instance;
 
 	il->pixbuf = NULL;
-	il->idle_id = -1;
+	il->idle_id = 0;
 	il->idle_priority = G_PRIORITY_DEFAULT_IDLE;
 	il->done = FALSE;
 	il->loader = NULL;
@@ -80,7 +80,7 @@
 	il->bytes_read = 0;
 	il->bytes_total = 0;
 
-	il->idle_done_id = -1;
+	il->idle_done_id = 0;
 
 	il->idle_read_loop_count = IMAGE_LOADER_IDLE_READ_LOOP_COUNT_DEFAULT;
 	il->read_buffer_size = IMAGE_LOADER_READ_BUFFER_SIZE_DEFAULT;
@@ -162,7 +162,11 @@
 
 	DEBUG_1("freeing image loader %p bytes_read=%d", il, il->bytes_read);
 
-	if (il->idle_done_id != -1) g_source_remove(il->idle_done_id);
+	if (il->idle_done_id)
+		{
+		g_source_remove(il->idle_done_id);
+		il->idle_done_id = 0;
+		}
 
 	while (g_source_remove_by_user_data(il)) 
 		{
@@ -683,10 +687,10 @@
 {
 	if (!il) return;
 
-	if (il->idle_id != -1)
+	if (il->idle_id)
 		{
 		g_source_remove(il->idle_id);
-		il->idle_id = -1;
+		il->idle_id = 0;
 		}
 		
 	if (il->thread)
@@ -743,7 +747,7 @@
 	gboolean ret = FALSE;
 	ImageLoader *il = data;
 
-	if (il->idle_id != -1)
+	if (il->idle_id)
 		{
 		ret = image_loader_continue(il);
 		}
--- a/src/image-load.h	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/image-load.h	Mon Apr 06 22:13:54 2009 +0000
@@ -38,13 +38,13 @@
 	gboolean shrunk;
 
 	gboolean done;
-	gint idle_id;
+	guint idle_id; /* event source id */
 	gint idle_priority;
 
 	GdkPixbufLoader *loader;
 	GError *error;
 
-	gint idle_done_id;
+	guint idle_done_id; /* event source id */
 	GList *area_param_list;
 	GList *area_param_delayed_list;
 	
--- 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;
--- a/src/lirc.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/lirc.c	Mon Apr 06 22:13:54 2009 +0000
@@ -16,7 +16,7 @@
 
 gint lirc_fd = -1;
 struct lirc_config *config = NULL;
-guint input_tag;
+guint input_tag = 0; /* event source id */
 GIOChannel *gio_chan;
 
 /*
--- a/src/metadata.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/metadata.c	Mon Apr 06 22:13:54 2009 +0000
@@ -47,7 +47,7 @@
  */
 
 static GList *metadata_write_queue = NULL;
-static gint metadata_write_idle_id = -1;
+static guint metadata_write_idle_id = 0; /* event source id */
 
 static void metadata_write_queue_add(FileData *fd)
 {
@@ -59,10 +59,10 @@
 		layout_status_update_write_all();
 		}
 
-	if (metadata_write_idle_id != -1) 
+	if (metadata_write_idle_id) 
 		{
 		g_source_remove(metadata_write_idle_id);
-		metadata_write_idle_id = -1;
+		metadata_write_idle_id = 0;
 		}
 	
 	if (options->metadata.confirm_after_timeout)
@@ -130,7 +130,7 @@
 static gboolean metadata_write_queue_idle_cb(gpointer data)
 {
 	metadata_write_queue_confirm(NULL, NULL);
-	metadata_write_idle_id = -1;
+	metadata_write_idle_id = 0;
 	return FALSE;
 }
 
--- a/src/pan-types.h	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/pan-types.h	Mon Apr 06 22:13:54 2009 +0000
@@ -192,8 +192,6 @@
 	GtkWidget *scrollbar_h;
 	GtkWidget *scrollbar_v;
 
-	gint overlay_id;
-
 	FileData *dir_fd;
 	PanLayoutType layout;
 	PanImageSize size;
--- a/src/pan-view.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/pan-view.c	Mon Apr 06 22:13:54 2009 +0000
@@ -1107,7 +1107,7 @@
 
 			if (pan_cache_step(pw)) return TRUE;
 
-			pw->idle_id = -1;
+			pw->idle_id = 0;
 			return FALSE;
 			}
 		}
@@ -1142,13 +1142,13 @@
 
 	pan_window_message(pw, NULL);
 
-	pw->idle_id = -1;
+	pw->idle_id = 0;
 	return FALSE;
 }
 
 static void pan_layout_update_idle(PanWindow *pw)
 {
-	if (pw->idle_id == -1)
+	if (!pw->idle_id)
 		{
 		pw->idle_id = g_idle_add(pan_layout_update_idle_cb, pw);
 		}
@@ -2301,7 +2301,7 @@
 	pref_list_int_set(PAN_PREF_GROUP, PAN_PREF_INFO_IMAGE, pw->info_image_size);
 	pref_list_int_set(PAN_PREF_GROUP, PAN_PREF_INFO_EXIF, pw->info_includes_exif);
 
-	if (pw->idle_id != -1)
+	if (pw->idle_id)
 		{
 		g_source_remove(pw->idle_id);
 		}
@@ -2359,8 +2359,7 @@
 
 	pw->ignore_symlinks = TRUE;
 
-	pw->overlay_id = -1;
-	pw->idle_id = -1;
+	pw->idle_id = 0;
 
 	pw->window = window_new(GTK_WINDOW_TOPLEVEL, "panview", NULL, NULL, _("Pan View"));
 
--- a/src/pixbuf-renderer.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/pixbuf-renderer.c	Mon Apr 06 22:13:54 2009 +0000
@@ -508,7 +508,7 @@
 
 	pr->scroll_reset = PR_SCROLL_RESET_TOPLEFT;
 
-	pr->draw_idle_id = -1;
+	pr->draw_idle_id = 0;
 
 	pr->tile_width = PR_TILE_SIZE;
 	pr->tile_height = PR_TILE_SIZE;
@@ -518,7 +518,7 @@
 
 	pr->tile_cache_max = PR_CACHE_SIZE_DEFAULT;
 
-	pr->scroller_id = -1;
+	pr->scroller_id = 0;
 	pr->scroller_overlay = -1;
 	
 	pr->x_mouse = -1;
@@ -1266,10 +1266,10 @@
 
 static void pr_scroller_timer_set(PixbufRenderer *pr, gboolean start)
 {
-	if (pr->scroller_id != -1)
+	if (pr->scroller_id)
 		{
 		g_source_remove(pr->scroller_id);
-		pr->scroller_id = -1;
+		pr->scroller_id = 0;
 		}
 
 	if (start)
@@ -1309,7 +1309,7 @@
 
 static void pr_scroller_stop(PixbufRenderer *pr)
 {
-	if (pr->scroller_id == -1) return;
+	if (!pr->scroller_id) return;
 
 	pixbuf_renderer_overlay_remove(pr, pr->scroller_overlay);
 	pr->scroller_overlay = -1;
@@ -2817,11 +2817,11 @@
 
 	if ((!pr->pixbuf && !pr->source_tiles_enabled) ||
 	    (!pr->draw_queue && !pr->draw_queue_2pass) ||
-	    pr->draw_idle_id == -1)
+	    !pr->draw_idle_id)
 		{
 		pr_render_complete_signal(pr);
 
-		pr->draw_idle_id = -1;
+		pr->draw_idle_id = 0;
 		return FALSE;
 		}
 
@@ -2893,7 +2893,7 @@
 		{
 		pr_render_complete_signal(pr);
 
-		pr->draw_idle_id = -1;
+		pr->draw_idle_id = 0;
 		return FALSE;
 		}
 
@@ -2928,8 +2928,11 @@
 	pr_queue_list_free(pr->draw_queue_2pass);
 	pr->draw_queue_2pass = NULL;
 
-	if (pr->draw_idle_id != -1) g_source_remove(pr->draw_idle_id);
-	pr->draw_idle_id = -1;
+	if (pr->draw_idle_id)
+		{
+		g_source_remove(pr->draw_idle_id);
+		pr->draw_idle_id = 0;
+		}
 }
 
 static void pr_queue_merge(QueueData *parent, QueueData *qd)
@@ -3087,9 +3090,13 @@
 	if (w < 1 || h < 1) return;
 
 	if (pr_queue_to_tiles(pr, nx, ny, w, h, clamp, render, new_data, only_existing) &&
-	    ((!pr->draw_queue && !pr->draw_queue_2pass) || pr->draw_idle_id == -1))
+	    ((!pr->draw_queue && !pr->draw_queue_2pass) || !pr->draw_idle_id))
 		{
-		if (pr->draw_idle_id != -1) g_source_remove(pr->draw_idle_id);
+		if (pr->draw_idle_id)
+			{
+			g_source_remove(pr->draw_idle_id);
+			pr->draw_idle_id = 0;
+			}
 		pr_queue_schedule_next_draw(pr, TRUE);
 		}
 }
@@ -3710,7 +3717,7 @@
 
 	pr = PIXBUF_RENDERER(widget);
 
-	if (pr->scroller_id != -1)
+	if (pr->scroller_id)
 		{
 		pr->scroller_xpos = bevent->x;
 		pr->scroller_ypos = bevent->y;
@@ -3759,7 +3766,7 @@
 
 	pr = PIXBUF_RENDERER(widget);
 
-	if (pr->scroller_id != -1) return TRUE;
+	if (pr->scroller_id) return TRUE;
 
 	switch (bevent->button)
 		{
@@ -3798,7 +3805,7 @@
 
 	pr = PIXBUF_RENDERER(widget);
 
-	if (pr->scroller_id != -1)
+	if (pr->scroller_id)
 		{
 		pr_scroller_stop(pr);
 		return TRUE;
@@ -3834,7 +3841,7 @@
 
 	pr = PIXBUF_RENDERER(widget);
 
-	if (pr->scroller_id != -1)
+	if (pr->scroller_id)
 		{
 		pr->scroller_xpos = pr->scroller_x;
 		pr->scroller_ypos = pr->scroller_y;
--- a/src/pixbuf-renderer.h	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/pixbuf-renderer.h	Mon Apr 06 22:13:54 2009 +0000
@@ -114,7 +114,7 @@
 	GList *draw_queue;	/* list of areas to redraw */
 	GList *draw_queue_2pass;/* list when 2 pass is enabled */
 
-	gint draw_idle_id;
+	guint draw_idle_id; /* event source id */
 
 	gboolean in_drag;
 	gint drag_last_x;
@@ -142,7 +142,7 @@
 	gboolean complete;
 	gboolean debug_updated; /* debug only */
 
-	gint scroller_id;
+	guint scroller_id; /* event source id */
 	gint scroller_overlay;
 	gint scroller_x;
 	gint scroller_y;
--- a/src/print.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/print.c	Mon Apr 06 22:13:54 2009 +0000
@@ -232,7 +232,7 @@
 	gdouble layout_width;
 	gdouble layout_height;
 
-	gint layout_idle_id;
+	guint layout_idle_id; /* event source id */
 
 	gdouble image_scale;
 
@@ -570,10 +570,10 @@
 
 static void print_window_layout_render_stop(PrintWindow *pw)
 {
-	if (pw->layout_idle_id != -1)
+	if (pw->layout_idle_id)
 		{
 		g_source_remove(pw->layout_idle_id);
-		pw->layout_idle_id = -1;
+		pw->layout_idle_id = 0;
 		}
 }
 
@@ -584,7 +584,7 @@
 	print_job_close(pw, FALSE);
 	print_job_start(pw, RENDER_FORMAT_PREVIEW, 0);
 
-	pw->layout_idle_id = -1;
+	pw->layout_idle_id = 0;
 	return FALSE;
 }
 
@@ -598,7 +598,7 @@
 
 	print_window_layout_status(pw);
 
-	if (pw->layout_idle_id == -1)
+	if (!pw->layout_idle_id)
 		{
 		pw->layout_idle_id = g_idle_add(print_window_layout_render_idle, pw);
 		}
@@ -750,7 +750,7 @@
 	vbox = pref_box_new(box, TRUE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
 	group = pref_frame_new(vbox, TRUE, _("Preview"), GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
 
-	pw->layout_idle_id = -1;
+	pw->layout_idle_id = 0;
 
 	pw->layout_image = image_new(FALSE);
 	gtk_widget_set_size_request(pw->layout_image->widget, PRINT_DLG_PREVIEW_WIDTH, PRINT_DLG_PREVIEW_HEIGHT);
--- a/src/remote.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/remote.c	Mon Apr 06 22:13:54 2009 +0000
@@ -47,7 +47,7 @@
 typedef struct _RemoteClient RemoteClient;
 struct _RemoteClient {
 	gint fd;
-	gint channel_id;
+	guint channel_id; /* event source id */
 	RemoteConnection *rc;
 };
 
--- a/src/search.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/search.c	Mon Apr 06 22:13:54 2009 +0000
@@ -179,8 +179,8 @@
 	gint search_total;
 	gint search_buffer_count;
 
-	gint search_idle_id;
-	gint update_idle_id;
+	guint search_idle_id; /* event source id */
+	guint update_idle_id; /* event source id */
 
 	ImageLoader *img_loader;
 	CacheData   *img_cd;
@@ -686,14 +686,17 @@
 
 	search_status_update(sd);
 
-	sd->update_idle_id = -1;
+	sd->update_idle_id = 0;
 	return FALSE;
 }
 
 static void search_result_update_idle_cancel(SearchData *sd)
 {
-	if (sd->update_idle_id != -1) g_source_remove(sd->update_idle_id);
-	sd->update_idle_id = -1;
+	if (sd->update_idle_id)
+		{
+		g_source_remove(sd->update_idle_id);
+		sd->update_idle_id = 0;
+		}
 }
 
 static gboolean search_result_select_cb(GtkTreeSelection *selection, GtkTreeModel *store,
@@ -701,7 +704,7 @@
 {
 	SearchData *sd = data;
 
-	if (sd->update_idle_id == -1)
+	if (!sd->update_idle_id)
 		{
 		sd->update_idle_id = g_idle_add(search_result_update_idle_cb, sd);
 		}
@@ -1479,10 +1482,10 @@
 
 static void search_stop(SearchData *sd)
 {
-	if (sd->search_idle_id != -1)
+	if (sd->search_idle_id)
 		{
 		g_source_remove(sd->search_idle_id);
-		sd->search_idle_id = -1;
+		sd->search_idle_id = 0;
 		}
 
 	image_loader_free(sd->img_loader);
@@ -1968,7 +1971,7 @@
 		{
 		if (search_file_next(sd))
 			{
-			sd->search_idle_id = -1;
+			sd->search_idle_id = 0;
 			return FALSE;
 			}
 		return TRUE;
@@ -1976,7 +1979,7 @@
 
 	if (!sd->search_file_list && !sd->search_folder_list)
 		{
-		sd->search_idle_id = -1;
+		sd->search_idle_id = 0;
 
 		search_stop(sd);
 		search_result_thumb_step(sd);
@@ -2636,9 +2639,6 @@
 		sd->search_similarity_path = g_strdup(example_file->path);
 		}
 
-	sd->search_idle_id = -1;
-	sd->update_idle_id = -1;
-
 	sd->window = window_new(GTK_WINDOW_TOPLEVEL, "search", NULL, NULL, _("Image search"));
 
 	gtk_window_set_resizable(GTK_WINDOW(sd->window), TRUE);
--- a/src/slideshow.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/slideshow.c	Mon Apr 06 22:13:54 2009 +0000
@@ -297,7 +297,7 @@
 
 	if (!slideshow_step(ss, TRUE))
 		{
-		ss->timeout_id = -1;
+		ss->timeout_id = 0;
 		slideshow_free(ss);
 		return FALSE;
 		}
@@ -307,17 +307,17 @@
 
 static void slideshow_timer_stop(SlideShowData *ss)
 {
-	if (ss->timeout_id == -1) return;
+	if (!ss->timeout_id) return;
 
 	g_source_remove(ss->timeout_id);
-	ss->timeout_id = -1;
+	ss->timeout_id = 0;
 }
 
 static void slideshow_timer_reset(SlideShowData *ss)
 {
 	if (options->slideshow.delay < 1) options->slideshow.delay = 1;
 
-	if (ss->timeout_id != -1) g_source_remove(ss->timeout_id);
+	if (ss->timeout_id) g_source_remove(ss->timeout_id);
 	ss->timeout_id = g_timeout_add(options->slideshow.delay * 1000 / SLIDESHOW_SUBSECOND_PRECISION,
 				       slideshow_loop_cb, ss);
 }
@@ -361,7 +361,6 @@
 	ss->filelist = filelist;
 	ss->cd = cd;
 	ss->layout = lw;
-	ss->timeout_id = -1;
 
 	if (ss->filelist)
 		{
--- a/src/thumb.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/thumb.c	Mon Apr 06 22:13:54 2009 +0000
@@ -250,7 +250,7 @@
 {
 	ThumbLoader *tl = data;
 
-	tl->idle_done_id = -1;
+	tl->idle_done_id = 0;
 
 	if (tl->func_done) tl->func_done(tl, tl->data);
 
@@ -259,7 +259,7 @@
 
 static void thumb_loader_delay_done(ThumbLoader *tl)
 {
-	if (tl->idle_done_id == -1) tl->idle_done_id = g_idle_add(thumb_loader_done_delay_cb, tl);
+	if (!tl->idle_done_id) tl->idle_done_id = g_idle_add(thumb_loader_done_delay_cb, tl);
 }
 
 static void thumb_loader_setup(ThumbLoader *tl, const gchar *path)
@@ -477,7 +477,6 @@
 	tl->percent_done = 0.0;
 	tl->max_w = width;
 	tl->max_h = height;
-	tl->idle_done_id = -1;
 
 	return tl;
 }
@@ -495,7 +494,7 @@
 	image_loader_free(tl->il);
 	file_data_unref(tl->fd);
 
-	if (tl->idle_done_id != -1) g_source_remove(tl->idle_done_id);
+	if (tl->idle_done_id) g_source_remove(tl->idle_done_id);
 
 	g_free(tl);
 }
--- a/src/thumb_standard.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/thumb_standard.c	Mon Apr 06 22:13:54 2009 +0000
@@ -738,7 +738,7 @@
 	void (*func_valid)(const gchar *path, gboolean valid, gpointer data);
 	gpointer data;
 
-	gint idle_id;
+	guint idle_id; /* event source id */
 };
 
 static void thumb_loader_std_thumb_file_validate_free(ThumbValidate *tv)
@@ -756,8 +756,11 @@
 
 	tv = tl->data;
 
-	if (tv->idle_id != -1) g_source_remove(tv->idle_id);
-	tv->idle_id = -1;
+	if (tv->idle_id)
+		{
+		g_source_remove(tv->idle_id);
+		tv->idle_id = 0;
+		}
 
 	thumb_loader_std_thumb_file_validate_free(tv);
 }
@@ -835,7 +838,7 @@
 {
 	ThumbValidate *tv = data;
 
-	tv->idle_id = -1;
+	tv->idle_id = 0;
 	thumb_loader_std_thumb_file_validate_finish(tv, FALSE);
 
 	return FALSE;
@@ -868,7 +871,7 @@
 		}
 	else
 		{
-		tv->idle_id = -1;
+		tv->idle_id = 0;
 		}
 
 	return tv->tl;
--- a/src/typedefs.h	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/typedefs.h	Mon Apr 06 22:13:54 2009 +0000
@@ -263,7 +263,7 @@
 
 	gpointer data;
 
-	gint idle_done_id;
+	guint idle_done_id; /* event source id */
 };
 
 struct _CollectInfo
@@ -316,7 +316,7 @@
 	CollectInfo *click_info;
 
 	GtkWidget *tip_window;
-	gint tip_delay_id;
+	guint tip_delay_id; /* event source id */
 	CollectInfo *tip_info;
 
 	GdkWindow *marker_window;
@@ -333,8 +333,8 @@
 	CollectInfo *drop_info;
 	GList *drop_list;
 
-	gint sync_idle_id;
-	gint drop_idle_id;
+	guint sync_idle_id; /* event source id */
+	guint drop_idle_id; /* event source id */
 
 	gboolean show_text;
 
@@ -681,7 +681,7 @@
 
 	FileData *drop_fd;
 	GList *drop_list;
-	gint drop_scroll_id;
+	guint drop_scroll_id; /* event source id */
 
 	/* func list */
 	void (*select_func)(ViewDir *vd, const gchar *path, gpointer data);
@@ -704,7 +704,7 @@
 
 struct _ViewDirInfoTree
 {
-	gint drop_expand_id;
+	guint drop_expand_id; /* event source id */
 	gint busy_ref;
 };
 
@@ -748,7 +748,7 @@
 	gint clicked_mark;
 	
 	/* refresh */
-	gint refresh_idle_id;
+	guint refresh_idle_id; /* event source id */
 
 	/* file list for edit menu */
 	GList *editmenu_fd_list;
@@ -761,7 +761,7 @@
 
 	gboolean thumbs_enabled;
 
-	gint select_idle_id;
+	guint select_idle_id; /* event source id */
 };
 
 struct _IconData;
@@ -776,7 +776,7 @@
 	struct _IconData *prev_selection;
 
 	GtkWidget *tip_window;
-	gint tip_delay_id;
+	guint tip_delay_id; /* event source id */
 	struct _IconData *tip_id;
 
 	struct _IconData *click_id;
@@ -803,7 +803,7 @@
 	FileData *slide_fd;
 
 	guint slide_count;
-	gint timeout_id;
+	guint timeout_id; /* event source id */
 
 	gboolean from_selection;
 
@@ -821,11 +821,12 @@
 	GtkWidget *normal_window;
 	ImageWindow *normal_imd;
 
-	gint hide_mouse_id;
-	gint busy_mouse_id;
+	guint hide_mouse_id; /* event source id */
+	guint busy_mouse_id; /* event source id */
+
 	gint cursor_state;
 
-	gint saver_block_id;
+	guint saver_block_id; /* event source id */
 
 	void (*stop_func)(FullScreenData *, gpointer);
 	gpointer stop_data;
--- a/src/ui_spinner.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/ui_spinner.c	Mon Apr 06 22:13:54 2009 +0000
@@ -42,7 +42,7 @@
 	GtkWidget *image;
 	GList *list;		/* list of pixbufs */
 	guint frame;
-	gint timer_id;
+	guint timer_id; /* event source id */
 };
 
 static void spinner_set_frame(SpinnerData *sp, guint frame)
@@ -75,10 +75,10 @@
 {
 	if (!sp) return;
 
-	if (sp->timer_id != -1)
+	if (sp->timer_id)
 		{
 		g_source_remove(sp->timer_id);
-		sp->timer_id = -1;
+		sp->timer_id = 0;
 		}
 
 	if (interval > 0)
@@ -117,8 +117,6 @@
 	SpinnerData *sp;
 
 	sp = g_new0(SpinnerData, 1);
-	sp->list = NULL;
-	sp->timer_id = -1;
 
 	if (path)
 		{
@@ -198,7 +196,7 @@
 	SpinnerData *sp;
 
 	sp = g_object_get_data(G_OBJECT(spinner), "spinner");
-	if (sp->timer_id != -1)
+	if (sp->timer_id)
 		{
 		log_printf("spinner warning: attempt to step with timer set\n");
 		return;
--- a/src/ui_tree_edit.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/ui_tree_edit.c	Mon Apr 06 22:13:54 2009 +0000
@@ -524,7 +524,7 @@
 typedef struct _AutoScrollData AutoScrollData;
 struct _AutoScrollData
 {
-	gint timer_id;
+	guint timer_id; /* event source id */
 	gint region_size;
 	GtkWidget *widget;
 	GtkAdjustment *adj;
@@ -542,7 +542,7 @@
 	if (!sd) return;
 	g_object_set_data(G_OBJECT(widget), "autoscroll", NULL);
 
-	if (sd->timer_id != -1) g_source_remove(sd->timer_id);
+	if (sd->timer_id) g_source_remove(sd->timer_id);
 	g_free(sd);
 }
 
@@ -565,7 +565,7 @@
 
 	if (x < 0 || x >= w || y < 0 || y >= h)
 		{
-		sd->timer_id = -1;
+		sd->timer_id = 0;
 		widget_auto_scroll_stop(sd->widget);
 		return FALSE;
 		}
@@ -596,7 +596,7 @@
 			/* only notify when scrolling is needed */
 			if (sd->notify_func && !sd->notify_func(sd->widget, x, y, sd->notify_data))
 				{
-				sd->timer_id = -1;
+				sd->timer_id = 0;
 				widget_auto_scroll_stop(sd->widget);
 				return FALSE;
 				}
--- a/src/utilops.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/utilops.c	Mon Apr 06 22:13:54 2009 +0000
@@ -283,9 +283,8 @@
 	GenericDialog *gd;
 	FileDialog *fdlg;
 	
-	gint update_idle_id;
-
-	gint perform_idle_id;
+	guint update_idle_id; /* event source id */
+	guint perform_idle_id; /* event source id */
 
 	gboolean with_sidecars; /* operate on grouped or single files; TRUE = use file_data_sc_, FALSE = use file_data_ functions */
 	
@@ -344,8 +343,6 @@
 	
 	ud->type = type;
 	ud->phase = UTILITY_PHASE_START;
-	ud->update_idle_id = -1;
-	ud->perform_idle_id = -1;
 	
 	return ud;
 }
@@ -354,8 +351,8 @@
 {
 	if (!ud) return;
 
-	if (ud->update_idle_id != -1) g_source_remove(ud->update_idle_id);
-	if (ud->perform_idle_id != -1) g_source_remove(ud->perform_idle_id);
+	if (ud->update_idle_id) g_source_remove(ud->update_idle_id);
+	if (ud->perform_idle_id) g_source_remove(ud->perform_idle_id);
 
 	file_data_unref(ud->dir_fd);
 	filelist_free(ud->content_list);
@@ -592,7 +589,7 @@
 {
 	UtilityData *ud = data;
 
-	if (ud->perform_idle_id == -1) 
+	if (!ud->perform_idle_id) 
 		{
 		/* this function was called directly
 		   just setup idle callback and wait until we are called again
@@ -1226,7 +1223,7 @@
 
 	file_util_rename_preview_update(ud);
 
-	ud->update_idle_id = -1;
+	ud->update_idle_id = 0;
 	return FALSE;
 }
 
@@ -1235,7 +1232,7 @@
 {
 	UtilityData *ud = data;
 
-	if (ud->update_idle_id != -1) return;
+	if (ud->update_idle_id) return;
 
 	ud->update_idle_id = g_idle_add(file_util_rename_idle_cb, ud);
 }
--- a/src/view_dir.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/view_dir.c	Mon Apr 06 22:13:54 2009 +0000
@@ -67,8 +67,6 @@
 
 	ViewDir *vd = g_new0(ViewDir, 1);
 
-	vd->drop_scroll_id = -1;
-
 	vd->widget = gtk_scrolled_window_new(NULL, NULL);
 	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vd->widget), GTK_SHADOW_IN);
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vd->widget),
@@ -803,8 +801,11 @@
 
 void vd_dnd_drop_scroll_cancel(ViewDir *vd)
 {
-	if (vd->drop_scroll_id != -1) g_source_remove(vd->drop_scroll_id);
-	vd->drop_scroll_id = -1;
+	if (vd->drop_scroll_id)
+		{
+		g_source_remove(vd->drop_scroll_id);
+		vd->drop_scroll_id = 0;
+		}
 }
 
 static gboolean vd_auto_scroll_idle_cb(gpointer data)
@@ -826,7 +827,7 @@
 			}
 		}
 
-	vd->drop_scroll_id = -1;
+	vd->drop_scroll_id = 0;
 	return FALSE;
 }
 
@@ -836,7 +837,7 @@
 
 	if (!vd->drop_fd || vd->drop_list) return FALSE;
 
-	if (vd->drop_scroll_id == -1) vd->drop_scroll_id = g_idle_add(vd_auto_scroll_idle_cb, vd);
+	if (!vd->drop_scroll_id) vd->drop_scroll_id = g_idle_add(vd_auto_scroll_idle_cb, vd);
 
 	return TRUE;
 }
--- a/src/view_dir_tree.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/view_dir_tree.c	Mon Apr 06 22:13:54 2009 +0000
@@ -173,14 +173,17 @@
 		vdtree_expand_by_data(vd, vd->drop_fd, TRUE);
 		}
 
-	VDTREE(vd)->drop_expand_id = -1;
+	VDTREE(vd)->drop_expand_id = 0;
 	return FALSE;
 }
 
 static void vdtree_dnd_drop_expand_cancel(ViewDir *vd)
 {
-	if (VDTREE(vd)->drop_expand_id != -1) g_source_remove(VDTREE(vd)->drop_expand_id);
-	VDTREE(vd)->drop_expand_id = -1;
+	if (VDTREE(vd)->drop_expand_id)
+		{
+		g_source_remove(VDTREE(vd)->drop_expand_id);
+		VDTREE(vd)->drop_expand_id = 0;
+		}
 }
 
 static void vdtree_dnd_drop_expand(ViewDir *vd)
@@ -959,7 +962,6 @@
 	vd->info = g_new0(ViewDirInfoTree, 1);
 
 	vd->type = DIRVIEW_TREE;
-	VDTREE(vd)->drop_expand_id = -1;
 
 	vd->dnd_drop_leave_func = vdtree_dnd_drop_expand_cancel;
 	vd->dnd_drop_update_func = vdtree_dnd_drop_expand;
--- 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);
 
--- a/src/view_file_icon.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/view_file_icon.c	Mon Apr 06 22:13:54 2009 +0000
@@ -442,7 +442,7 @@
 	ViewFile *vf = data;
 	GtkWidget *window;
 
-	if (VFICON(vf)->tip_delay_id == -1) return FALSE;
+	if (!VFICON(vf)->tip_delay_id) return FALSE;
 
 	window = gtk_widget_get_toplevel(vf->listview);
 
@@ -452,7 +452,7 @@
 		tip_show(vf);
 		}
 
-	VFICON(vf)->tip_delay_id = -1;
+	VFICON(vf)->tip_delay_id = 0;
 	return FALSE;
 }
 
@@ -460,10 +460,10 @@
 {
 	tip_hide(vf);
 
-	if (VFICON(vf)->tip_delay_id != -1)
+	if (VFICON(vf)->tip_delay_id)
 		{
 		g_source_remove(VFICON(vf)->tip_delay_id);
-		VFICON(vf)->tip_delay_id = -1;
+		VFICON(vf)->tip_delay_id = 0;
 		}
 
 	if (!VFICON(vf)->show_text)
@@ -476,8 +476,11 @@
 {
 	tip_hide(vf);
 
-	if (VFICON(vf)->tip_delay_id != -1) g_source_remove(VFICON(vf)->tip_delay_id);
-	VFICON(vf)->tip_delay_id = -1;
+	if (VFICON(vf)->tip_delay_id)
+		{
+		g_source_remove(VFICON(vf)->tip_delay_id);
+		VFICON(vf)->tip_delay_id = 0;
+		}
 }
 
 static void tip_update(ViewFile *vf, IconData *id)
@@ -2466,7 +2469,6 @@
 
 	vf->info = g_new0(ViewFileInfoIcon, 1);
 
-	VFICON(vf)->tip_delay_id = -1;
 	VFICON(vf)->show_text = options->show_icon_names;
 
 	store = gtk_list_store_new(1, G_TYPE_POINTER);
--- a/src/view_file_list.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/view_file_list.c	Mon Apr 06 22:13:54 2009 +0000
@@ -718,7 +718,7 @@
 
 	if (!vf->layout)
 		{
-		VFLIST(vf)->select_idle_id = -1;
+		VFLIST(vf)->select_idle_id = 0;
 		return FALSE;
 		}
 
@@ -730,14 +730,17 @@
 		VFLIST(vf)->select_fd = NULL;
 		}
 
-	VFLIST(vf)->select_idle_id = -1;
+	VFLIST(vf)->select_idle_id = 0;
 	return FALSE;
 }
 
 static void vflist_select_idle_cancel(ViewFile *vf)
 {
-	if (VFLIST(vf)->select_idle_id != -1) g_source_remove(VFLIST(vf)->select_idle_id);
-	VFLIST(vf)->select_idle_id = -1;
+	if (VFLIST(vf)->select_idle_id)
+		{
+		g_source_remove(VFLIST(vf)->select_idle_id);
+		VFLIST(vf)->select_idle_id = 0;
+		}
 }
 
 static gboolean vflist_select_cb(GtkTreeSelection *selection, GtkTreeModel *store, GtkTreePath *tpath,
@@ -757,7 +760,7 @@
 		}
 
 	if (vf->layout &&
-	    VFLIST(vf)->select_idle_id == -1)
+	    !VFLIST(vf)->select_idle_id)
 		{
 		VFLIST(vf)->select_idle_id = g_idle_add(vflist_select_idle_cb, vf);
 		}
@@ -1973,8 +1976,6 @@
 
 	vf->info = g_new0(ViewFileInfoList, 1);
 	
-	VFLIST(vf)->select_idle_id = -1;
-
 	flist_types[FILE_COLUMN_POINTER] = G_TYPE_POINTER;
 	flist_types[FILE_COLUMN_VERSION] = G_TYPE_INT;
 	flist_types[FILE_COLUMN_THUMB] = GDK_TYPE_PIXBUF;