[gtk/wip/hadess/listbox-fixes: 1/2] listbox: Binding a model is compatible with filtering




commit 524589f9af59dfc318942ff61bee3d6a20e00a35
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Nov 25 12:22:30 2021 +0100

    listbox: Binding a model is compatible with filtering
    
    Filters set in the list box do work an elements are correctly filtered,
    but still generate a warning.
    
    Correct the documentation and the compatibility check to match the
    implementation.
    
    Closes: #4088

 gtk/gtklistbox.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index 95120f8cef..fb746af3e5 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -1204,7 +1204,7 @@ gtk_list_box_get_selection_mode (GtkListBox *box)
  * [method@Gtk.ListBoxRow.changed]) or when [method@Gtk.ListBox.invalidate_filter]
  * is called.
  *
- * Note that using a filter function is incompatible with using a model
+ * Using a filter function is compatible with using a model
  * (see [method@Gtk.ListBox.bind_model]).
  */
 void
@@ -3673,9 +3673,8 @@ gtk_list_box_bound_model_changed (GListModel *list,
 static void
 gtk_list_box_check_model_compat (GtkListBox *box)
 {
-  if (box->bound_model &&
-      (box->sort_func || box->filter_func))
-    g_warning ("GtkListBox with a model will ignore sort and filter functions");
+  if (box->bound_model && box->sort_func)
+    g_warning ("GtkListBox with a model will ignore sort function");
 }
 
 /**
@@ -3699,8 +3698,8 @@ gtk_list_box_check_model_compat (GtkListBox *box)
  * It is undefined to add or remove widgets directly (for example, with
  * [method@Gtk.ListBox.insert]) while @box is bound to a model.
  *
- * Note that using a model is incompatible with the filtering and sorting
- * functionality in `GtkListBox`. When using a model, filtering and sorting
+ * Note that using a model is incompatible with the sorting
+ * functionality in `GtkListBox`. When using a model, sorting
  * should be implemented by the model.
  */
 void


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