[gspell: 7/8] Entry: g_signal_connect_swapped() on notify::language



commit cc71b67795cab4d8d593ef3c5ebf9c7cc8a687fd
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Nov 26 17:57:58 2016 +0100

    Entry: g_signal_connect_swapped() on notify::language
    
    To simplify a little the code. More GspellChecker signals will be
    connected to emit_changed_signal(), so they can all be disconnected
    easily.

 gspell/gspell-entry.c |   18 +++++-------------
 1 files changed, 5 insertions(+), 13 deletions(-)
---
diff --git a/gspell/gspell-entry.c b/gspell/gspell-entry.c
index 8533187..392fbb7 100644
--- a/gspell/gspell-entry.c
+++ b/gspell/gspell-entry.c
@@ -313,14 +313,6 @@ notify_attributes_cb (GtkEntry    *gtk_entry,
 }
 
 static void
-notify_language_cb (GspellChecker *checker,
-                   GParamSpec    *pspec,
-                   GspellEntry   *gspell_entry)
-{
-       emit_changed_signal (gspell_entry);
-}
-
-static void
 set_checker (GspellEntry   *gspell_entry,
             GspellChecker *checker)
 {
@@ -332,7 +324,7 @@ set_checker (GspellEntry   *gspell_entry,
        if (gspell_entry->checker != NULL)
        {
                g_signal_handlers_disconnect_by_func (gspell_entry->checker,
-                                                     notify_language_cb,
+                                                     emit_changed_signal,
                                                      gspell_entry);
 
                g_object_unref (gspell_entry->checker);
@@ -342,10 +334,10 @@ set_checker (GspellEntry   *gspell_entry,
 
        if (gspell_entry->checker != NULL)
        {
-               g_signal_connect (gspell_entry->checker,
-                                 "notify::language",
-                                 G_CALLBACK (notify_language_cb),
-                                 gspell_entry);
+               g_signal_connect_swapped (gspell_entry->checker,
+                                         "notify::language",
+                                         G_CALLBACK (emit_changed_signal),
+                                         gspell_entry);
 
                g_object_ref (gspell_entry->checker);
        }


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