diff src/bar_keywords.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 bd8001efdccc
line wrap: on
line diff
--- 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;