[devhelp] BookManager: sanitize gboolean input in set_group_by_language()



commit 751ca83033721853855efce60795d56b9d08aaca
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Dec 22 20:25:11 2017 +0100

    BookManager: sanitize gboolean input in set_group_by_language()
    
    It's stored in a bitfield.
    And notify the property only if changed.

 src/dh-book-manager.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/dh-book-manager.c b/src/dh-book-manager.c
index 0d2fec3..27f6726 100644
--- a/src/dh-book-manager.c
+++ b/src/dh-book-manager.c
@@ -929,6 +929,10 @@ dh_book_manager_set_group_by_language (DhBookManager *book_manager,
 
         priv = dh_book_manager_get_instance_private (book_manager);
 
-        priv->group_by_language = group_by_language;
-        g_object_notify (G_OBJECT (book_manager), "group-by-language");
+        group_by_language = group_by_language != FALSE;
+
+        if (priv->group_by_language != group_by_language) {
+                priv->group_by_language = group_by_language;
+                g_object_notify (G_OBJECT (book_manager), "group-by-language");
+        }
 }


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