[gtksourceview] Use gdk_threads_add_idle instead of g_idle_add



commit 36f0a41a87b952600571f4366584508906ba4806
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Sat Jan 7 15:09:52 2012 +0100

    Use gdk_threads_add_idle instead of g_idle_add

 .../words/gtksourcecompletionwords.c               |    6 +++---
 gtksourceview/gtksourcecontextengine.c             |   18 +++++-------------
 2 files changed, 8 insertions(+), 16 deletions(-)
---
diff --git a/gtksourceview/completion-providers/words/gtksourcecompletionwords.c b/gtksourceview/completion-providers/words/gtksourcecompletionwords.c
index ee8e579..d09a175 100644
--- a/gtksourceview/completion-providers/words/gtksourcecompletionwords.c
+++ b/gtksourceview/completion-providers/words/gtksourcecompletionwords.c
@@ -290,9 +290,9 @@ gtk_source_completion_words_populate (GtkSourceCompletionProvider *provider,
 	if (add_in_idle (words))
 	{
 		gtk_source_completion_words_library_lock (words->priv->library);
-		words->priv->idle_id = g_idle_add ((GSourceFunc)add_in_idle,
-		                                   words);
-	}	
+		words->priv->idle_id = gdk_threads_add_idle ((GSourceFunc)add_in_idle,
+		                                             words);
+	}
 }
 
 static void
diff --git a/gtksourceview/gtksourcecontextengine.c b/gtksourceview/gtksourcecontextengine.c
index 413ecdd..874b7f2 100644
--- a/gtksourceview/gtksourcecontextengine.c
+++ b/gtksourceview/gtksourcecontextengine.c
@@ -2360,8 +2360,6 @@ idle_worker (GtkSourceContextEngine *ce)
 
 	g_return_val_if_fail (ce->priv->buffer != NULL, FALSE);
 
-	gdk_threads_enter ();
-
 	/* analyze batch of text */
 	update_syntax (ce, NULL, INCREMENTAL_UPDATE_TIME_SLICE);
 	CHECK_TREE (ce);
@@ -2372,8 +2370,6 @@ idle_worker (GtkSourceContextEngine *ce)
 		retval = FALSE;
 	}
 
-	gdk_threads_leave ();
-
 	return retval;
 }
 
@@ -2390,8 +2386,6 @@ first_update_callback (GtkSourceContextEngine *ce)
 {
 	g_return_val_if_fail (ce->priv->buffer != NULL, FALSE);
 
-	gdk_threads_enter ();
-
 	/* analyze batch of text */
 	update_syntax (ce, NULL, FIRST_UPDATE_TIME_SLICE);
 	CHECK_TREE (ce);
@@ -2401,8 +2395,6 @@ first_update_callback (GtkSourceContextEngine *ce)
 	if (!all_analyzed (ce))
 		install_idle_worker (ce);
 
-	gdk_threads_leave ();
-
 	return FALSE;
 }
 
@@ -2419,8 +2411,8 @@ install_idle_worker (GtkSourceContextEngine *ce)
 {
 	if (ce->priv->first_update == 0 && ce->priv->incremental_update == 0)
 		ce->priv->incremental_update =
-			g_idle_add_full (INCREMENTAL_UPDATE_PRIORITY,
-					 (GSourceFunc) idle_worker, ce, NULL);
+			gdk_threads_add_idle_full (INCREMENTAL_UPDATE_PRIORITY,
+			                           (GSourceFunc) idle_worker, ce, NULL);
 }
 
 /**
@@ -2443,9 +2435,9 @@ install_first_update (GtkSourceContextEngine *ce)
 		}
 
 		ce->priv->first_update =
-			g_idle_add_full (FIRST_UPDATE_PRIORITY,
-					 (GSourceFunc) first_update_callback,
-					 ce, NULL);
+			gdk_threads_add_idle_full (FIRST_UPDATE_PRIORITY,
+			                           (GSourceFunc) first_update_callback,
+			                           ce, NULL);
 	}
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]