[gtksourceview] CompletionWords: simplify the dispose()



commit ffcfb2487ad87053893b7dfa7206e0c65b5ff4a1
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat May 25 15:49:15 2013 +0200

    CompletionWords: simplify the dispose()

 .../words/gtksourcecompletionwords.c               |   19 ++++++-------------
 1 files changed, 6 insertions(+), 13 deletions(-)
---
diff --git a/gtksourceview/completion-providers/words/gtksourcecompletionwords.c 
b/gtksourceview/completion-providers/words/gtksourcecompletionwords.c
index 90f2a15..16e526e 100644
--- a/gtksourceview/completion-providers/words/gtksourcecompletionwords.c
+++ b/gtksourceview/completion-providers/words/gtksourcecompletionwords.c
@@ -298,26 +298,19 @@ gtk_source_completion_words_populate (GtkSourceCompletionProvider *provider,
 }
 
 static void
-remove_buffer (BufferBinding *binding)
-{
-       g_object_set_data (G_OBJECT (gtk_source_completion_words_buffer_get_buffer (binding->buffer)),
-                          BUFFER_KEY,
-                          NULL);
-}
-
-static void
 gtk_source_completion_words_dispose (GObject *object)
 {
        GtkSourceCompletionWords *provider = GTK_SOURCE_COMPLETION_WORDS (object);
-       GList *cp;
 
        population_finished (provider);
 
-       cp = g_list_copy (provider->priv->buffers);
-       g_list_foreach (cp, (GFunc)remove_buffer, NULL);
+       while (provider->priv->buffers != NULL)
+       {
+               BufferBinding *binding = provider->priv->buffers->data;
+               GtkTextBuffer *buffer = gtk_source_completion_words_buffer_get_buffer (binding->buffer);
 
-       g_list_free (cp);
-       g_list_free (provider->priv->buffers);
+               gtk_source_completion_words_unregister (provider, buffer);
+       }
 
        g_free (provider->priv->name);
        provider->priv->name = NULL;


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