Index: src/yelp-pager.c
===================================================================
RCS file: /cvs/gnome/yelp/src/yelp-pager.c,v
retrieving revision 1.16
diff -p -u -u -p -r1.16 yelp-pager.c
--- src/yelp-pager.c	16 May 2005 21:09:48 -0000	1.16
+++ src/yelp-pager.c	28 Jan 2006 16:04:12 -0000
@@ -47,6 +47,8 @@ struct _YelpPagerPriv {
     GError          *error;
 
     GHashTable      *page_hash;
+ 
+    guint            process_id;
 };
 
 enum {
@@ -200,14 +202,14 @@ pager_set_property (GObject      *object
 		    GParamSpec   *pspec)
 {
     YelpPager *pager = YELP_PAGER (object);
+    YelpPagerPriv *priv = pager->priv;
 
     switch (prop_id) {
     case PROP_DOCINFO:
-	if (pager->priv->doc_info)
-	    yelp_doc_info_unref (pager->priv->doc_info);
-	pager->priv->doc_info =
-	    (YelpDocInfo *) g_value_get_pointer (value);
-	yelp_doc_info_ref (pager->priv->doc_info);
+	if (priv->doc_info)
+	    yelp_doc_info_unref (priv->doc_info);
+	priv->doc_info = (YelpDocInfo *) g_value_get_pointer (value);
+	yelp_doc_info_ref (priv->doc_info);
 	break;
     default:
 	break;
@@ -235,34 +237,65 @@ static void
 pager_dispose (GObject *object)
 {
     YelpPager *pager = YELP_PAGER (object);
+    YelpPagerPriv *priv = pager->priv;
 
-    if (pager->priv->doc_info)
-	yelp_doc_info_unref (pager->priv->doc_info);
+    if (priv->process_id != 0) {
+        g_source_remove (priv->process_id);
+        priv->process_id = 0;
+    }
 
-    if (pager->priv->error)
-	g_error_free (pager->priv->error);
+    if (priv->doc_info) {
+	yelp_doc_info_unref (priv->doc_info);
+	priv->doc_info = NULL;
+    }
 
-    g_hash_table_destroy (pager->priv->page_hash);
+    if (priv->error) {
+	g_error_free (priv->error);
+	priv->error = NULL;
+    }
 
-    g_free (pager->priv);
+    if (priv->page_hash) {
+        g_hash_table_destroy (pager->priv->page_hash);
+	priv->page_hash = NULL;    
+    }
 
     G_OBJECT_CLASS (parent_class)->dispose (object);
 }
 
 /******************************************************************************/
 
+static gboolean
+process_cb (YelpPager *pager)
+{
+    YelpPagerPriv *priv = pager->priv;
+    YelpPagerClass *klass = YELP_PAGER_GET_CLASS (pager);
+    gboolean retval;
+
+    retval = klass->process (pager);
+
+    if (!retval) {
+        priv->process_id = 0;
+    }
+
+    return retval;
+}
+
 gboolean
 yelp_pager_start (YelpPager *pager)
 {
-    g_return_val_if_fail (pager != NULL, FALSE);
+    YelpPagerPriv *priv;
+
     g_return_val_if_fail (YELP_IS_PAGER (pager), FALSE);
-    g_return_val_if_fail (pager->priv->state == YELP_PAGER_STATE_NEW ||
-			  pager->priv->state == YELP_PAGER_STATE_INVALID,
+
+    priv = pager->priv;
+    g_return_val_if_fail (priv->state == YELP_PAGER_STATE_NEW ||
+			  priv->state == YELP_PAGER_STATE_INVALID,
 			  FALSE);
+    g_return_val_if_fail (priv->process_id == 0, FALSE);
+
+    priv->state = YELP_PAGER_STATE_STARTED;
 
-    pager->priv->state = YELP_PAGER_STATE_STARTED;
-    gtk_idle_add ((GtkFunction) (YELP_PAGER_GET_CLASS (pager)->process),
-		  pager);
+    priv->process_id = g_idle_add ((GSourceFunc) process_cb, pager);
 
     return TRUE;
 }
@@ -270,10 +303,17 @@ yelp_pager_start (YelpPager *pager)
 void
 yelp_pager_cancel (YelpPager *pager)
 {
-    g_return_if_fail (pager != NULL);
+    YelpPagerPriv *priv;
+
     g_return_if_fail (YELP_IS_PAGER (pager));
 
+    priv = pager->priv;
     d (g_print ("yelp_pager_cancel\n"));
+
+    if (priv->process_id != 0) {
+        g_source_remove (priv->process_id);
+        priv->process_id = 0;
+    }
 
     yelp_pager_set_state (pager, YELP_PAGER_STATE_INVALID);
 
Index: src/yelp-search-pager.c
===================================================================
RCS file: /cvs/gnome/yelp/src/yelp-search-pager.c,v
retrieving revision 1.9
diff -p -u -u -p -r1.9 yelp-search-pager.c
--- src/yelp-search-pager.c	23 Jan 2006 14:59:46 -0000	1.9
+++ src/yelp-search-pager.c	28 Jan 2006 16:04:12 -0000
@@ -86,6 +86,11 @@ struct _YelpSearchPagerPriv {
     char *search_terms;
     GPtrArray *hits;
     int   snippet_request_count;
+ 
+    guint search_process_id;
+    guint slow_search_setup_process_id;
+    guint slow_search_process_id;
+    guint xslt_process_id;
 };
 
 struct _YelpListing {
@@ -259,8 +264,27 @@ static void
 search_pager_dispose (GObject *object)
 {
     YelpSearchPager *pager = YELP_SEARCH_PAGER (object);
+    YelpSearchPagerPriv *priv = pager->priv;
+ 
+    if (priv->search_process_id != 0) {
+        g_source_remove (priv->search_process_id);
+	priv->search_process_id = 0;
+    }
+
+    if (priv->xslt_process_id != 0) {
+        g_source_remove (priv->xslt_process_id);
+	priv->xslt_process_id = 0;
+    }
 
-    g_free (pager->priv);
+    if (priv->slow_search_process_id != 0) {
+        g_source_remove (priv->slow_search_process_id);
+	priv->slow_search_process_id = 0;
+    }
+
+    if (priv->slow_search_setup_process_id != 0) {
+        g_source_remove (priv->slow_search_setup_process_id);
+	priv->slow_search_setup_process_id = 0;
+    }
 
     G_OBJECT_CLASS (parent_class)->dispose (object);
 }
@@ -371,6 +395,11 @@ search_pager_finish (YelpPager   *pager)
 gboolean
 search_pager_process (YelpPager *pager)
 {
+    YelpSearchPager *spager = YELP_SEARCH_PAGER (pager);
+    YelpSearchPagerPriv *priv = spager->priv;
+
+    g_return_val_if_fail (priv->search_process_id == 0, FALSE);
+
     d (g_print ("search_pager_process\n"));
 
 #ifdef ENABLE_BEAGLE
@@ -391,9 +420,11 @@ search_pager_process (YelpPager *pager)
     yelp_pager_set_state (pager, YELP_PAGER_STATE_RUNNING);
     g_signal_emit_by_name (pager, "start");
 
-    gtk_idle_add_priority (G_PRIORITY_LOW,
-			   (GtkFunction) search_pager_process_idle,
-			   pager);
+    priv->search_process_id =
+	g_idle_add_full (G_PRIORITY_LOW,
+			 (GSourceFunc) search_pager_process_idle,
+			 pager, NULL);
+
     return FALSE;
 }
 
@@ -417,10 +448,14 @@ search_pager_get_sections (YelpPager *pa
 static void
 check_finished (YelpSearchPager *pager)
 {
-    if (pager->priv->snippet_request_count == 0) {
-	gtk_idle_add_priority (G_PRIORITY_LOW,
-			       (GtkFunction) process_xslt,
-			       pager);
+    YelpSearchPagerPriv *priv = pager->priv;
+
+    if (priv->snippet_request_count == 0 &&
+        priv->xslt_process_id == 0) {
+        priv->xslt_process_id =
+            g_idle_add_full (G_PRIORITY_LOW,
+			     (GSourceFunc) process_xslt,
+			     pager, NULL);
     }
 }
 
@@ -656,10 +691,12 @@ search_pager_process_idle (YelpSearchPag
 #endif /* ENABLE_BEAGLE */
 
 #ifndef ENABLE_BEAGLE
-    gtk_idle_add ((GtkFunction) slow_search_setup,
-		  pager);
+    g_return_val_if_fail (priv->slow_search_process_id == 0, FALSE);
+    priv->slow_search_setup_process_id =
+        g_idle_add ((GSourceFunc) slow_search_setup, pager);
 #endif
 
+    priv->search_process_id = 0;
     return FALSE;
 }
 
@@ -749,6 +786,8 @@ process_xslt (YelpSearchPager *pager)
     }
 
     g_signal_emit_by_name (pager, "finish");
+
+    priv->xslt_process_id = 0;
     return FALSE;
 }
 
@@ -1058,6 +1097,7 @@ static xmlSAXHandler handlers = {
 static gboolean
 slow_search_setup (YelpSearchPager *pager)
 {
+    YelpSearchPagerPriv *priv = pager->priv;
     gchar  *content_list;
     gchar  *stderr_str;
     gchar  *lang;
@@ -1171,18 +1211,21 @@ slow_search_setup (YelpSearchPager *page
 
     }
 
-    gtk_idle_add ((GtkFunction) slow_search_process,
-		  pager);
+    g_return_val_if_fail (priv->slow_search_process_id == 0, FALSE);
+    priv->slow_search_process_id =
+        g_idle_add ((GSourceFunc) slow_search_process, pager);
+
     if (parser)
 	xmlFreeParserCtxt (parser);
 
+    priv->slow_search_setup_process_id = 0;
     return FALSE;
-
 }
 
 static gboolean 
 slow_search_process (YelpSearchPager *pager)
 {
+    YelpSearchPagerPriv *priv = pager->priv;
     SearchContainer *c;
     GSList *first = pending_searches;
 
@@ -1218,6 +1261,8 @@ slow_search_process (YelpSearchPager *pa
     if (pending_searches) {
 	g_strfreev (c->search_term);
 	g_free (c);
+
+	/* run again */
 	return TRUE;
     }
     else {
@@ -1230,9 +1275,16 @@ slow_search_process (YelpSearchPager *pa
 	g_strfreev (c->search_term);
 	g_free (c);
 
-	gtk_idle_add_priority (G_PRIORITY_LOW,
-			       (GtkFunction) process_xslt,
-			       pager);
+	priv->slow_search_process_id = 0;
+
+	g_return_val_if_fail (priv->xslt_process_id == 0, FALSE);
+
+	priv->xslt_process_id =
+	    g_idle_add_full (G_PRIORITY_LOW,
+			     (GSourceFunc) process_xslt,
+			     pager, NULL);
+
+	/* don't run again */
 	return FALSE;
     }
 }
Index: src/yelp-toc-pager.c
===================================================================
RCS file: /cvs/gnome/yelp/src/yelp-toc-pager.c,v
retrieving revision 1.62
diff -p -u -u -p -r1.62 yelp-toc-pager.c
--- src/yelp-toc-pager.c	25 Jan 2006 11:32:12 -0000	1.62
+++ src/yelp-toc-pager.c	28 Jan 2006 16:04:13 -0000
@@ -99,6 +99,8 @@ struct _YelpTocPagerPriv {
 
     xsltStylesheetPtr       stylesheet;
     xsltTransformContextPtr transformContext;
+
+    guint process_id;
 };
 
 struct _YelpListing {
@@ -262,21 +264,27 @@ yelp_toc_pager_pause (YelpTocPager *page
 void
 yelp_toc_pager_unpause (YelpTocPager *pager)
 {
-    g_return_if_fail (pager != NULL);
+    YelpTocPagerPriv *priv;
+
+    g_return_if_fail (YELP_IS_TOC_PAGER (pager));
+
+    priv = pager->priv;
 
     d (g_print ("yelp_toc_pager_unpause\n"));
     d (g_print ("  pause_caunt = %i\n", pager->priv->pause_count - 1));
 
-    pager->priv->pause_count = pager->priv->pause_count - 1;
-    if (pager->priv->pause_count < 0) {
+    priv->pause_count = priv->pause_count - 1;
+    if (priv->pause_count < 0) {
 	g_warning (_("YelpTocPager: Pause count is negative."));
-	pager->priv->pause_count = 0;
+	priv->pause_count = 0;
     }
 
-    if (pager->priv->pause_count < 1) {
-	gtk_idle_add_priority (G_PRIORITY_LOW,
-			       (GtkFunction) toc_process_pending,
-			       pager);
+    if (priv->pause_count < 1 &&
+       priv->process_id == 0) {
+        priv->process_id =
+            g_idle_add_full (G_PRIORITY_LOW,
+			     (GSourceFunc) toc_process_pending,
+			     pager, NULL);
     }
 }
 
@@ -323,9 +331,13 @@ toc_pager_process (YelpPager *pager)
 
     priv->pending_func = (ProcessFunction) process_read_menu;
 
-    gtk_idle_add_priority (G_PRIORITY_LOW,
-			   (GtkFunction) toc_process_pending,
-			   pager);
+    if (priv->process_id == 0) {
+       priv->process_id =
+           g_idle_add_full (G_PRIORITY_LOW,
+			    (GSourceFunc) toc_process_pending,
+			    pager, NULL);
+    }
+
     return FALSE;
 }
 
@@ -1490,7 +1502,7 @@ xslt_yelp_document (xsltTransformContext
     new_doc->intSubset = dtd;
     new_doc->extSubset = dtd;
     new_doc->charset = XML_CHAR_ENCODING_UTF8;
-    new_doc->encoding = g_strdup ("utf-8");
+    new_doc->encoding = xmlStrdup (BAD_CAST "utf-8");
     new_doc->dict = ctxt->dict;
     xmlDictReference (new_doc->dict);
 
Index: src/gtkentryaction.c
===================================================================
RCS file: /cvs/gnome/yelp/src/gtkentryaction.c,v
retrieving revision 1.3
diff -p -u -u -p -r1.3 gtkentryaction.c
--- src/gtkentryaction.c	15 Jan 2006 17:17:28 -0000	1.3
+++ src/gtkentryaction.c	28 Jan 2006 16:04:13 -0000
@@ -260,7 +260,6 @@ gtk_entry_action_finalize (GObject *obje
   GtkEntryActionPrivate *priv = action->priv;
 
   g_free (priv->text);
-  g_free (priv);
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
