summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-08-03 15:54:42 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-09-05 21:50:15 -0400
commit24389a0ef5063944aa9909a40239658c4eedb230 (patch)
tree7daba4b0cca5a7dbc9e892325815f651d4ecc88b
parentdfabe74c593b876f50e56903e6c5f7f11f332781 (diff)
downloadgtk+-filter-constructors.tar.gz
Make sorter constructors return exact typesfilter-constructors
Make functions like gtk_custom_sorter_new() return the actual type they construct. Update all callers.
-rw-r--r--demos/gtk-demo/listview_colors.c20
-rw-r--r--gtk/gtkcolumnview.c2
-rw-r--r--gtk/gtkcolumnviewsorter.c2
-rw-r--r--gtk/gtkcolumnviewsorterprivate.h2
-rw-r--r--gtk/gtkcustomsorter.c6
-rw-r--r--gtk/gtkcustomsorter.h2
-rw-r--r--gtk/gtkmultisorter.c4
-rw-r--r--gtk/gtkmultisorter.h2
-rw-r--r--gtk/gtknumericsorter.c6
-rw-r--r--gtk/gtknumericsorter.h2
-rw-r--r--gtk/gtkprintunixdialog.c2
-rw-r--r--gtk/gtkstringsorter.c6
-rw-r--r--gtk/gtkstringsorter.h2
-rw-r--r--gtk/gtktreelistrowsorter.c6
-rw-r--r--gtk/gtktreelistrowsorter.h2
-rw-r--r--gtk/inspector/actions.c4
-rw-r--r--gtk/inspector/controllers.c2
-rw-r--r--gtk/inspector/prop-list.c12
-rw-r--r--gtk/inspector/resource-list.c14
-rw-r--r--tests/testcolumnview.c4
-rw-r--r--tests/testlistview-animating.c2
-rw-r--r--tests/testlistview.c2
-rw-r--r--testsuite/gtk/sorter.c36
-rw-r--r--testsuite/gtk/sortlistmodel-exhaustive.c6
-rw-r--r--testsuite/gtk/sortlistmodel.c10
-rw-r--r--testsuite/gtk/treesorter.c8
26 files changed, 83 insertions, 83 deletions
diff --git a/demos/gtk-demo/listview_colors.c b/demos/gtk-demo/listview_colors.c
index e46e7d8b3c..aa4cdf1468 100644
--- a/demos/gtk-demo/listview_colors.c
+++ b/demos/gtk-demo/listview_colors.c
@@ -1022,31 +1022,31 @@ do_listview_colors (GtkWidget *do_widget)
/* An empty multisorter doesn't do any sorting and the sortmodel is
* smart enough to know that.
*/
- sorter = gtk_multi_sorter_new ();
+ sorter = GTK_SORTER (gtk_multi_sorter_new ());
set_title (sorter, "Unsorted");
g_list_store_append (sorters, sorter);
g_object_unref (sorter);
- sorter = gtk_string_sorter_new (gtk_property_expression_new (GTK_TYPE_COLOR, NULL, "name"));
+ sorter = GTK_SORTER (gtk_string_sorter_new (gtk_property_expression_new (GTK_TYPE_COLOR, NULL, "name")));
set_title (sorter, "Name");
g_list_store_append (sorters, sorter);
g_object_unref (sorter);
- multi_sorter = gtk_multi_sorter_new ();
+ multi_sorter = GTK_SORTER (gtk_multi_sorter_new ());
- sorter = gtk_numeric_sorter_new (gtk_property_expression_new (GTK_TYPE_COLOR, NULL, "red"));
+ sorter = GTK_SORTER (gtk_numeric_sorter_new (gtk_property_expression_new (GTK_TYPE_COLOR, NULL, "red")));
gtk_numeric_sorter_set_sort_order (GTK_NUMERIC_SORTER (sorter), GTK_SORT_DESCENDING);
set_title (sorter, "Red");
g_list_store_append (sorters, sorter);
gtk_multi_sorter_append (GTK_MULTI_SORTER (multi_sorter), sorter);
- sorter = gtk_numeric_sorter_new (gtk_property_expression_new (GTK_TYPE_COLOR, NULL, "green"));
+ sorter = GTK_SORTER (gtk_numeric_sorter_new (gtk_property_expression_new (GTK_TYPE_COLOR, NULL, "green")));
gtk_numeric_sorter_set_sort_order (GTK_NUMERIC_SORTER (sorter), GTK_SORT_DESCENDING);
set_title (sorter, "Green");
g_list_store_append (sorters, sorter);
gtk_multi_sorter_append (GTK_MULTI_SORTER (multi_sorter), sorter);
- sorter = gtk_numeric_sorter_new (gtk_property_expression_new (GTK_TYPE_COLOR, NULL, "blue"));
+ sorter = GTK_SORTER (gtk_numeric_sorter_new (gtk_property_expression_new (GTK_TYPE_COLOR, NULL, "blue")));
gtk_numeric_sorter_set_sort_order (GTK_NUMERIC_SORTER (sorter), GTK_SORT_DESCENDING);
set_title (sorter, "Blue");
g_list_store_append (sorters, sorter);
@@ -1056,21 +1056,21 @@ do_listview_colors (GtkWidget *do_widget)
g_list_store_append (sorters, multi_sorter);
g_object_unref (multi_sorter);
- multi_sorter = gtk_multi_sorter_new ();
+ multi_sorter = GTK_SORTER (gtk_multi_sorter_new ());
- sorter = gtk_numeric_sorter_new (gtk_property_expression_new (GTK_TYPE_COLOR, NULL, "hue"));
+ sorter = GTK_SORTER (gtk_numeric_sorter_new (gtk_property_expression_new (GTK_TYPE_COLOR, NULL, "hue")));
gtk_numeric_sorter_set_sort_order (GTK_NUMERIC_SORTER (sorter), GTK_SORT_DESCENDING);
set_title (sorter, "Hue");
g_list_store_append (sorters, sorter);
gtk_multi_sorter_append (GTK_MULTI_SORTER (multi_sorter), sorter);
- sorter = gtk_numeric_sorter_new (gtk_property_expression_new (GTK_TYPE_COLOR, NULL, "saturation"));
+ sorter = GTK_SORTER (gtk_numeric_sorter_new (gtk_property_expression_new (GTK_TYPE_COLOR, NULL, "saturation")));
gtk_numeric_sorter_set_sort_order (GTK_NUMERIC_SORTER (sorter), GTK_SORT_DESCENDING);
set_title (sorter, "Saturation");
g_list_store_append (sorters, sorter);
gtk_multi_sorter_append (GTK_MULTI_SORTER (multi_sorter), sorter);
- sorter = gtk_numeric_sorter_new (gtk_property_expression_new (GTK_TYPE_COLOR, NULL, "value"));
+ sorter = GTK_SORTER (gtk_numeric_sorter_new (gtk_property_expression_new (GTK_TYPE_COLOR, NULL, "value")));
gtk_numeric_sorter_set_sort_order (GTK_NUMERIC_SORTER (sorter), GTK_SORT_DESCENDING);
set_title (sorter, "Value");
g_list_store_append (sorters, sorter);
diff --git a/gtk/gtkcolumnview.c b/gtk/gtkcolumnview.c
index c3cb62839e..0448d6edcd 100644
--- a/gtk/gtkcolumnview.c
+++ b/gtk/gtkcolumnview.c
@@ -1163,7 +1163,7 @@ gtk_column_view_init (GtkColumnView *self)
g_signal_connect (controller, "leave", G_CALLBACK (gtk_column_view_drag_leave), NULL);
gtk_widget_add_controller (GTK_WIDGET (self), controller);
- self->sorter = gtk_column_view_sorter_new ();
+ self->sorter = GTK_SORTER (gtk_column_view_sorter_new ());
self->factory = gtk_column_list_item_factory_new (self);
self->listview = GTK_LIST_VIEW (gtk_list_view_new (NULL,
GTK_LIST_ITEM_FACTORY (g_object_ref (self->factory))));
diff --git a/gtk/gtkcolumnviewsorter.c b/gtk/gtkcolumnviewsorter.c
index fa8cf8607a..28f2e7e677 100644
--- a/gtk/gtkcolumnviewsorter.c
+++ b/gtk/gtkcolumnviewsorter.c
@@ -146,7 +146,7 @@ gtk_column_view_sorter_init (GtkColumnViewSorter *self)
self->sorters = g_sequence_new (free_sorter);
}
-GtkSorter *
+GtkColumnViewSorter *
gtk_column_view_sorter_new (void)
{
return g_object_new (GTK_TYPE_COLUMN_VIEW_SORTER, NULL);
diff --git a/gtk/gtkcolumnviewsorterprivate.h b/gtk/gtkcolumnviewsorterprivate.h
index c81c565252..9d47d0a105 100644
--- a/gtk/gtkcolumnviewsorterprivate.h
+++ b/gtk/gtkcolumnviewsorterprivate.h
@@ -34,7 +34,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (GtkColumnViewSorter, gtk_column_view_sorter, GTK, COLUMN_VIEW_SORTER, GtkSorter)
-GtkSorter * gtk_column_view_sorter_new (void);
+GtkColumnViewSorter * gtk_column_view_sorter_new (void);
gboolean gtk_column_view_sorter_add_column (GtkColumnViewSorter *self,
GtkColumnViewColumn *column);
diff --git a/gtk/gtkcustomsorter.c b/gtk/gtkcustomsorter.c
index f1bddd954b..cbc07a60de 100644
--- a/gtk/gtkcustomsorter.c
+++ b/gtk/gtkcustomsorter.c
@@ -110,9 +110,9 @@ gtk_custom_sorter_init (GtkCustomSorter *self)
*
* If @sort_func is %NULL, all items are considered equal.
*
- * Returns: a new #GtkSorter
+ * Returns: a new #GtkCustomSorter
*/
-GtkSorter *
+GtkCustomSorter *
gtk_custom_sorter_new (GCompareDataFunc sort_func,
gpointer user_data,
GDestroyNotify user_destroy)
@@ -123,7 +123,7 @@ gtk_custom_sorter_new (GCompareDataFunc sort_func,
gtk_custom_sorter_set_sort_func (sorter, sort_func, user_data, user_destroy);
- return GTK_SORTER (sorter);
+ return sorter;
}
/**
diff --git a/gtk/gtkcustomsorter.h b/gtk/gtkcustomsorter.h
index 50cf090637..6846d01d46 100644
--- a/gtk/gtkcustomsorter.h
+++ b/gtk/gtkcustomsorter.h
@@ -34,7 +34,7 @@ GDK_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (GtkCustomSorter, gtk_custom_sorter, GTK, CUSTOM_SORTER, GtkSorter)
GDK_AVAILABLE_IN_ALL
-GtkSorter * gtk_custom_sorter_new (GCompareDataFunc sort_func,
+GtkCustomSorter * gtk_custom_sorter_new (GCompareDataFunc sort_func,
gpointer user_data,
GDestroyNotify user_destroy);
diff --git a/gtk/gtkmultisorter.c b/gtk/gtkmultisorter.c
index bbdaf13cc6..5690d6d1d0 100644
--- a/gtk/gtkmultisorter.c
+++ b/gtk/gtkmultisorter.c
@@ -375,9 +375,9 @@ gtk_multi_sorter_init (GtkMultiSorter *self)
* no sorter has been added to it, it will always compare
* items as equal.
*
- * Returns: a new #GtkSorter
+ * Returns: a new #GtkMultiSorter
*/
-GtkSorter *
+GtkMultiSorter *
gtk_multi_sorter_new (void)
{
return g_object_new (GTK_TYPE_MULTI_SORTER, NULL);
diff --git a/gtk/gtkmultisorter.h b/gtk/gtkmultisorter.h
index 4f265bf6a2..d634711d51 100644
--- a/gtk/gtkmultisorter.h
+++ b/gtk/gtkmultisorter.h
@@ -34,7 +34,7 @@ GDK_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (GtkMultiSorter, gtk_multi_sorter, GTK, MULTI_SORTER, GtkSorter)
GDK_AVAILABLE_IN_ALL
-GtkSorter * gtk_multi_sorter_new (void);
+GtkMultiSorter * gtk_multi_sorter_new (void);
GDK_AVAILABLE_IN_ALL
void gtk_multi_sorter_append (GtkMultiSorter *self,
diff --git a/gtk/gtknumericsorter.c b/gtk/gtknumericsorter.c
index 895570bc73..936a9723c3 100644
--- a/gtk/gtknumericsorter.c
+++ b/gtk/gtknumericsorter.c
@@ -587,12 +587,12 @@ gtk_numeric_sorter_init (GtkNumericSorter *self)
* Smaller numbers will be sorted first. You can call
* gtk_numeric_sorter_set_sort_order() to change this.
*
- * Returns: a new #GtkSorter
+ * Returns: a new #GtkNumericSorter
*/
-GtkSorter *
+GtkNumericSorter *
gtk_numeric_sorter_new (GtkExpression *expression)
{
- GtkSorter *result;
+ GtkNumericSorter *result;
result = g_object_new (GTK_TYPE_NUMERIC_SORTER,
"expression", expression,
diff --git a/gtk/gtknumericsorter.h b/gtk/gtknumericsorter.h
index 39bb48e212..b7460f5bca 100644
--- a/gtk/gtknumericsorter.h
+++ b/gtk/gtknumericsorter.h
@@ -34,7 +34,7 @@ GDK_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (GtkNumericSorter, gtk_numeric_sorter, GTK, NUMERIC_SORTER, GtkSorter)
GDK_AVAILABLE_IN_ALL
-GtkSorter * gtk_numeric_sorter_new (GtkExpression *expression);
+GtkNumericSorter * gtk_numeric_sorter_new (GtkExpression *expression);
GDK_AVAILABLE_IN_ALL
GtkExpression * gtk_numeric_sorter_get_expression (GtkNumericSorter *self);
diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c
index f4bdaa0f04..35eb897044 100644
--- a/gtk/gtkprintunixdialog.c
+++ b/gtk/gtkprintunixdialog.c
@@ -811,7 +811,7 @@ gtk_print_unix_dialog_init (GtkPrintUnixDialog *dialog)
/* Load backends */
model = load_print_backends (dialog);
- sorter = gtk_custom_sorter_new (default_printer_list_sort_func, NULL, NULL);
+ sorter = GTK_SORTER (gtk_custom_sorter_new (default_printer_list_sort_func, NULL, NULL));
sorted = G_LIST_MODEL (gtk_sort_list_model_new (model, sorter));
filter = GTK_FILTER (gtk_every_filter_new ());
diff --git a/gtk/gtkstringsorter.c b/gtk/gtkstringsorter.c
index 135fc542e3..cce80d1418 100644
--- a/gtk/gtkstringsorter.c
+++ b/gtk/gtkstringsorter.c
@@ -333,12 +333,12 @@ gtk_string_sorter_init (GtkStringSorter *self)
* Unless an expression is set on it, this sorter will always
* compare items as invalid.
*
- * Returns: a new #GtkSorter
+ * Returns: a new #GtkStringSorter
*/
-GtkSorter *
+GtkStringSorter *
gtk_string_sorter_new (GtkExpression *expression)
{
- GtkSorter *result;
+ GtkStringSorter *result;
result = g_object_new (GTK_TYPE_STRING_SORTER,
"expression", expression,
diff --git a/gtk/gtkstringsorter.h b/gtk/gtkstringsorter.h
index e7323aacdc..c340c6fa8d 100644
--- a/gtk/gtkstringsorter.h
+++ b/gtk/gtkstringsorter.h
@@ -34,7 +34,7 @@ GDK_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (GtkStringSorter, gtk_string_sorter, GTK, STRING_SORTER, GtkSorter)
GDK_AVAILABLE_IN_ALL
-GtkSorter * gtk_string_sorter_new (GtkExpression *expression);
+GtkStringSorter * gtk_string_sorter_new (GtkExpression *expression);
GDK_AVAILABLE_IN_ALL
GtkExpression * gtk_string_sorter_get_expression (GtkStringSorter *self);
diff --git a/gtk/gtktreelistrowsorter.c b/gtk/gtktreelistrowsorter.c
index a35996e9ac..740a2ec17f 100644
--- a/gtk/gtktreelistrowsorter.c
+++ b/gtk/gtktreelistrowsorter.c
@@ -567,12 +567,12 @@ gtk_tree_list_row_sorter_init (GtkTreeListRowSorter *self)
* Note that this sorter relies on #GtkTreeListModel:passthrough
* being %FALSE as it can only sort #GtkTreeListRows.
*
- * Returns: a new #GtkSorter
+ * Returns: a new #GtkTreeListRowSorter
*/
-GtkSorter *
+GtkTreeListRowSorter *
gtk_tree_list_row_sorter_new (GtkSorter *sorter)
{
- GtkSorter *result;
+ GtkTreeListRowSorter *result;
g_return_val_if_fail (sorter == NULL || GTK_IS_SORTER (sorter), NULL);
diff --git a/gtk/gtktreelistrowsorter.h b/gtk/gtktreelistrowsorter.h
index 8f2db0e51a..b5b190cff3 100644
--- a/gtk/gtktreelistrowsorter.h
+++ b/gtk/gtktreelistrowsorter.h
@@ -34,7 +34,7 @@ GDK_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (GtkTreeListRowSorter, gtk_tree_list_row_sorter, GTK, TREE_LIST_ROW_SORTER, GtkSorter)
GDK_AVAILABLE_IN_ALL
-GtkSorter * gtk_tree_list_row_sorter_new (GtkSorter *sorter);
+GtkTreeListRowSorter * gtk_tree_list_row_sorter_new (GtkSorter *sorter);
GDK_AVAILABLE_IN_ALL
GtkSorter * gtk_tree_list_row_sorter_get_sorter (GtkTreeListRowSorter *self);
diff --git a/gtk/inspector/actions.c b/gtk/inspector/actions.c
index 830a31b65c..265a86ed69 100644
--- a/gtk/inspector/actions.c
+++ b/gtk/inspector/actions.c
@@ -389,11 +389,11 @@ constructed (GObject *object)
g_signal_connect_swapped (sl->button, "clicked",
G_CALLBACK (refresh_all), sl);
- sorter = gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING,
+ sorter = GTK_SORTER (gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING,
NULL,
0, NULL,
(GCallback)holder_name,
- NULL, NULL));
+ NULL, NULL)));
gtk_column_view_column_set_sorter (sl->name, sorter);
g_object_unref (sorter);
diff --git a/gtk/inspector/controllers.c b/gtk/inspector/controllers.c
index 4f41ba3a56..fc5b7b7a6e 100644
--- a/gtk/inspector/controllers.c
+++ b/gtk/inspector/controllers.c
@@ -246,7 +246,7 @@ gtk_inspector_controllers_set_object (GtkInspectorControllers *self,
flatten_model = gtk_flatten_list_model_new (G_LIST_MODEL (map_model));
- sorter = gtk_custom_sorter_new (compare_controllers, NULL, NULL);
+ sorter = GTK_SORTER (gtk_custom_sorter_new (compare_controllers, NULL, NULL));
sort_model = gtk_sort_list_model_new (G_LIST_MODEL (flatten_model), sorter);
gtk_list_box_bind_model (GTK_LIST_BOX (self->listbox),
diff --git a/gtk/inspector/prop-list.c b/gtk/inspector/prop-list.c
index b74ded47a1..92e3cd3471 100644
--- a/gtk/inspector/prop-list.c
+++ b/gtk/inspector/prop-list.c
@@ -116,10 +116,10 @@ gtk_inspector_prop_list_init (GtkInspectorPropList *pl)
pl->priv->filter = gtk_string_filter_new (NULL);
gtk_string_filter_set_match_mode (pl->priv->filter, GTK_STRING_FILTER_MATCH_MODE_SUBSTRING);
- sorter = gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
+ sorter = GTK_SORTER (gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
0, NULL,
(GCallback)holder_prop,
- NULL, NULL));
+ NULL, NULL)));
gtk_string_filter_set_expression (pl->priv->filter,
gtk_string_sorter_get_expression (GTK_STRING_SORTER (sorter)));
@@ -127,18 +127,18 @@ gtk_inspector_prop_list_init (GtkInspectorPropList *pl)
gtk_column_view_column_set_sorter (pl->priv->name, sorter);
g_object_unref (sorter);
- sorter = gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
+ sorter = GTK_SORTER (gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
0, NULL,
(GCallback)holder_type,
- NULL, NULL));
+ NULL, NULL)));
gtk_column_view_column_set_sorter (pl->priv->type, sorter);
g_object_unref (sorter);
- sorter = gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
+ sorter = GTK_SORTER (gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
0, NULL,
(GCallback)holder_origin,
- NULL, NULL));
+ NULL, NULL)));
gtk_column_view_column_set_sorter (pl->priv->origin, sorter);
g_object_unref (sorter);
diff --git a/gtk/inspector/resource-list.c b/gtk/inspector/resource-list.c
index 2530fcb7a6..ded5a1d3fb 100644
--- a/gtk/inspector/resource-list.c
+++ b/gtk/inspector/resource-list.c
@@ -652,26 +652,26 @@ gtk_inspector_resource_list_init (GtkInspectorResourceList *rl)
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (rl->search_bar),
GTK_EDITABLE (rl->search_entry));
- sorter = gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
+ sorter = GTK_SORTER (gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
0, NULL,
(GCallback)holder_name,
- NULL, NULL));
+ NULL, NULL)));
gtk_column_view_column_set_sorter (rl->path, sorter);
g_object_unref (sorter);
- sorter = gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_INT, NULL,
+ sorter = GTK_SORTER (gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_INT, NULL,
0, NULL,
(GCallback)holder_count,
- NULL, NULL));
+ NULL, NULL)));
gtk_column_view_column_set_sorter (rl->count, sorter);
g_object_unref (sorter);
- sorter = gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT64, NULL,
+ sorter = GTK_SORTER (gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT64, NULL,
0, NULL,
(GCallback)holder_size,
- NULL, NULL));
+ NULL, NULL)));
gtk_column_view_column_set_sorter (rl->size, sorter);
g_object_unref (sorter);
@@ -709,7 +709,7 @@ constructed (GObject *object)
NULL);
column_sorter = gtk_column_view_get_sorter (GTK_COLUMN_VIEW (rl->list));
- sorter = gtk_tree_list_row_sorter_new (g_object_ref (column_sorter));
+ sorter = GTK_SORTER (gtk_tree_list_row_sorter_new (g_object_ref (column_sorter)));
sort_model = G_LIST_MODEL (gtk_sort_list_model_new (g_object_ref (G_LIST_MODEL (rl->tree_model)), sorter));
rl->selection = gtk_single_selection_new (sort_model);
diff --git a/tests/testcolumnview.c b/tests/testcolumnview.c
index 2c5643cb23..aa7e769393 100644
--- a/tests/testcolumnview.c
+++ b/tests/testcolumnview.c
@@ -665,7 +665,7 @@ add_extra_columns (GtkColumnView *view,
column = gtk_column_view_column_new_with_factory (extra_columns[i].title,
gtk_builder_list_item_factory_new_from_bytes (scope, bytes));
g_bytes_unref (bytes);
- sorter = gtk_custom_sorter_new (compare_file_attribute, (gpointer) extra_columns[i].attribute, NULL);
+ sorter = GTK_SORTER (gtk_custom_sorter_new (compare_file_attribute, (gpointer) extra_columns[i].attribute, NULL));
gtk_column_view_column_set_sorter (column, sorter);
g_object_unref (sorter);
gtk_column_view_append_column (view, column);
@@ -753,7 +753,7 @@ main (int argc, char *argv[])
create_list_model_for_file_info,
NULL, NULL);
- sorter = gtk_tree_list_row_sorter_new (g_object_ref (gtk_column_view_get_sorter (GTK_COLUMN_VIEW (view))));
+ sorter = GTK_SORTER (gtk_tree_list_row_sorter_new (g_object_ref (gtk_column_view_get_sorter (GTK_COLUMN_VIEW (view)))));
sort = gtk_sort_list_model_new (G_LIST_MODEL (tree), sorter);
custom_filter = GTK_FILTER (gtk_custom_filter_new (match_file, g_object_ref (search_entry), g_object_unref));
diff --git a/tests/testlistview-animating.c b/tests/testlistview-animating.c
index 33c69e3565..9554f6fc97 100644
--- a/tests/testlistview-animating.c
+++ b/tests/testlistview-animating.c
@@ -126,7 +126,7 @@ main (int argc,
store = g_list_store_new (G_TYPE_OBJECT);
for (i = 0; i < AVERAGE; i++)
add (store);
- sorter = gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL));
+ sorter = GTK_SORTER (gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL)));
sort = gtk_sort_list_model_new (G_LIST_MODEL (store), sorter);
win = gtk_window_new ();
diff --git a/tests/testlistview.c b/tests/testlistview.c
index 2eeb89fe54..47e54e1023 100644
--- a/tests/testlistview.c
+++ b/tests/testlistview.c
@@ -325,7 +325,7 @@ create_list_model_for_directory (gpointer file)
return NULL;
dir = create_directory_list (file);
- sorter = gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, (GCallback) get_file_path, NULL, NULL));
+ sorter = GTK_SORTER (gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, (GCallback) get_file_path, NULL, NULL)));
return G_LIST_MODEL (gtk_sort_list_model_new (G_LIST_MODEL (dir), sorter));
}
diff --git a/testsuite/gtk/sorter.c b/testsuite/gtk/sorter.c
index e7a299dfcb..ad6d94ebbb 100644
--- a/testsuite/gtk/sorter.c
+++ b/testsuite/gtk/sorter.c
@@ -274,7 +274,7 @@ test_simple (void)
model = new_model (20, NULL);
assert_not_model (model, "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20");
- sorter = gtk_custom_sorter_new (compare_numbers, NULL, NULL);
+ sorter = GTK_SORTER (gtk_custom_sorter_new (compare_numbers, NULL, NULL));
gtk_sort_list_model_set_sorter (model, sorter);
g_object_unref (sorter);
@@ -296,7 +296,7 @@ test_string (void)
model = new_model (20, NULL);
assert_not_model (model, "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20");
- sorter = gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, (GCallback)get_string, NULL, NULL));
+ sorter = GTK_SORTER (gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, (GCallback)get_string, NULL, NULL)));
gtk_sort_list_model_set_sorter (model, sorter);
g_object_unref (sorter);
@@ -330,7 +330,7 @@ test_change (void)
GtkExpression *expression;
int counter = 0;
- sorter = gtk_string_sorter_new (NULL);
+ sorter = GTK_SORTER (gtk_string_sorter_new (NULL));
g_signal_connect (sorter, "changed", G_CALLBACK (inc_counter), &counter);
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, (GCallback)get_string, NULL, NULL);
@@ -360,7 +360,7 @@ test_numeric (void)
model = new_model (20, NULL);
assert_not_model (model, "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20");
- sorter = gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL));
+ sorter = GTK_SORTER (gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL)));
gtk_sort_list_model_set_sorter (model, sorter);
assert_model (model, "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20");
@@ -409,7 +409,7 @@ test_multi (void)
model = new_model (20, NULL);
assert_not_model (model, "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20");
- sorter2 = gtk_numeric_sorter_new (NULL);
+ sorter2 = GTK_SORTER (gtk_numeric_sorter_new (NULL));
gtk_sort_list_model_set_sorter (model, sorter2);
expression = gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL);
gtk_numeric_sorter_set_expression (GTK_NUMERIC_SORTER (sorter2), expression);
@@ -417,10 +417,10 @@ test_multi (void)
assert_model (model, "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20");
- sorter = gtk_multi_sorter_new ();
+ sorter = GTK_SORTER (gtk_multi_sorter_new ());
gtk_sort_list_model_set_sorter (model, sorter);
- sorter1 = gtk_custom_sorter_new (compare_even, NULL, NULL);
+ sorter1 = GTK_SORTER (gtk_custom_sorter_new (compare_even, NULL, NULL));
gtk_multi_sorter_append (GTK_MULTI_SORTER (sorter), sorter1);
gtk_multi_sorter_append (GTK_MULTI_SORTER (sorter), sorter2);
@@ -446,8 +446,8 @@ test_multi_destruct (void)
{
GtkSorter *multi, *sorter;
- multi = gtk_multi_sorter_new ();
- sorter = gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL));
+ multi = GTK_SORTER (gtk_multi_sorter_new ());
+ sorter = GTK_SORTER (gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL)));
gtk_multi_sorter_append (GTK_MULTI_SORTER (multi), g_object_ref (sorter));
g_object_unref (multi);
@@ -470,13 +470,13 @@ test_multi_changes (void)
model = gtk_sort_list_model_new (G_LIST_MODEL (new_store (1, 20, 1)), NULL);
assert_model (model, "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20");
- multi = gtk_multi_sorter_new ();
+ multi = GTK_SORTER (gtk_multi_sorter_new ());
g_signal_connect (multi, "changed", G_CALLBACK (inc_counter), &counter);
gtk_sort_list_model_set_sorter (model, multi);
assert_model (model, "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20");
g_assert_cmpint (counter, ==, 0);
- sorter1 = gtk_numeric_sorter_new (NULL);
+ sorter1 = GTK_SORTER (gtk_numeric_sorter_new (NULL));
gtk_multi_sorter_append (GTK_MULTI_SORTER (multi), sorter1);
assert_model (model, "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20");
g_assert_cmpint (counter, ==, 1);
@@ -491,7 +491,7 @@ test_multi_changes (void)
assert_model (model, "4 9 14 19 3 8 13 18 2 7 12 17 1 6 11 16 5 10 15 20");
g_assert_cmpint (counter, ==, 3);
- sorter2 = gtk_custom_sorter_new (compare_even, NULL, NULL);
+ sorter2 = GTK_SORTER (gtk_custom_sorter_new (compare_even, NULL, NULL));
gtk_multi_sorter_append (GTK_MULTI_SORTER (multi), sorter2);
assert_model (model, "4 14 9 19 8 18 3 13 2 12 7 17 6 16 1 11 10 20 5 15");
g_assert_cmpint (counter, ==, 4);
@@ -500,7 +500,7 @@ test_multi_changes (void)
assert_model (model, "10 20 5 15 6 16 1 11 2 12 7 17 8 18 3 13 4 14 9 19");
g_assert_cmpint (counter, ==, 5);
- sorter3 = gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, (GCallback)get_spelled_out, NULL, NULL));
+ sorter3 = GTK_SORTER (gtk_string_sorter_new (gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, (GCallback)get_spelled_out, NULL, NULL)));
gtk_multi_sorter_append (GTK_MULTI_SORTER (multi), sorter3);
assert_model (model, "10 20 15 5 6 16 11 1 12 2 7 17 8 18 13 3 4 14 9 19");
g_assert_cmpint (counter, ==, 6);
@@ -524,13 +524,13 @@ test_multi_changes (void)
static GtkSorter *
even_odd_sorter_new (void)
{
- return gtk_custom_sorter_new (compare_even, NULL, NULL);
+ return GTK_SORTER (gtk_custom_sorter_new (compare_even, NULL, NULL));
}
static GtkSorter *
numeric_sorter_new (void)
{
- return gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL));
+ return GTK_SORTER (gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL)));
}
static void
@@ -615,8 +615,8 @@ test_stable (void)
GtkSorter *multi, *a, *b;
guint i;
- a = gtk_multi_sorter_new ();
- b = gtk_multi_sorter_new ();
+ a = GTK_SORTER (gtk_multi_sorter_new ());
+ b = GTK_SORTER (gtk_multi_sorter_new ());
/* We create 2 setups:
* 1. sortmodel (multisorter [a, b])
* 2. sortmodel (b) => sortmodel (a)
@@ -627,7 +627,7 @@ test_stable (void)
* All we do is make a and b random sorters and assert that the 2 setups
* produce the same order every time.
*/
- multi = gtk_multi_sorter_new ();
+ multi = GTK_SORTER (gtk_multi_sorter_new ());
gtk_multi_sorter_append (GTK_MULTI_SORTER (multi), a);
gtk_multi_sorter_append (GTK_MULTI_SORTER (multi), b);
model1 = new_model (20, multi);
diff --git a/testsuite/gtk/sortlistmodel-exhaustive.c b/testsuite/gtk/sortlistmodel-exhaustive.c
index 9b4fd7f20f..4b8e2bacbb 100644
--- a/testsuite/gtk/sortlistmodel-exhaustive.c
+++ b/testsuite/gtk/sortlistmodel-exhaustive.c
@@ -252,12 +252,12 @@ create_sorter (gsize id)
switch (id)
{
case 0:
- return gtk_string_sorter_new (NULL);
+ return GTK_SORTER (gtk_string_sorter_new (NULL));
case 1:
case 2:
/* match all As, Bs and nothing */
- sorter = gtk_string_sorter_new (gtk_property_expression_new (GTK_TYPE_STRING_OBJECT, NULL, "string"));
+ sorter = GTK_SORTER (gtk_string_sorter_new (gtk_property_expression_new (GTK_TYPE_STRING_OBJECT, NULL, "string")));
if (id == 1)
gtk_string_sorter_set_ignore_case (GTK_STRING_SORTER (sorter), TRUE);
return sorter;
@@ -304,7 +304,7 @@ test_two_sorters (gconstpointer model_id)
model2 = create_sort_list_model (model_id, TRUE, source, NULL);
/* can't track changes from a sortmodel, where the same items get reordered */
model1 = create_sort_list_model (model_id, FALSE, G_LIST_MODEL (model2), NULL);
- every = gtk_multi_sorter_new ();
+ every = GTK_SORTER (gtk_multi_sorter_new ());
compare = create_sort_list_model (model_id, TRUE, source, every);
g_object_unref (every);
g_object_unref (source);
diff --git a/testsuite/gtk/sortlistmodel.c b/testsuite/gtk/sortlistmodel.c
index 4a84b36a88..5c63cff27d 100644
--- a/testsuite/gtk/sortlistmodel.c
+++ b/testsuite/gtk/sortlistmodel.c
@@ -219,7 +219,7 @@ new_model (gpointer model)
{
GtkSorter *sorter;
- sorter = gtk_custom_sorter_new (compare, NULL, NULL);
+ sorter = GTK_SORTER (gtk_custom_sorter_new (compare, NULL, NULL));
result = gtk_sort_list_model_new (g_object_ref (model), sorter);
}
else
@@ -312,7 +312,7 @@ test_set_sorter (void)
assert_model (sort, "2 4 6 8 10");
assert_changes (sort, "");
- sorter = gtk_custom_sorter_new (compare_modulo, GUINT_TO_POINTER (5), NULL);
+ sorter = GTK_SORTER (gtk_custom_sorter_new (compare_modulo, GUINT_TO_POINTER (5), NULL));
gtk_sort_list_model_set_sorter (sort, sorter);
g_object_unref (sorter);
assert_model (sort, "10 6 2 8 4");
@@ -322,7 +322,7 @@ test_set_sorter (void)
assert_model (sort, "4 8 2 6 10");
assert_changes (sort, "0-5+5");
- sorter = gtk_custom_sorter_new (compare, NULL, NULL);
+ sorter = GTK_SORTER (gtk_custom_sorter_new (compare, NULL, NULL));
gtk_sort_list_model_set_sorter (sort, sorter);
g_object_unref (sorter);
assert_model (sort, "2 4 6 8 10");
@@ -424,7 +424,7 @@ test_stability (void)
assert_model (sort, "1 11 21 31");
assert_changes (sort, "");
- sorter = gtk_custom_sorter_new (compare_modulo, GUINT_TO_POINTER (5), NULL);
+ sorter = GTK_SORTER (gtk_custom_sorter_new (compare_modulo, GUINT_TO_POINTER (5), NULL));
gtk_sort_list_model_set_sorter (sort, sorter);
g_object_unref (sorter);
assert_model (sort, "11 31 21 1");
@@ -467,7 +467,7 @@ test_incremental_remove (void)
gtk_sort_list_model_set_model (model, G_LIST_MODEL (store));
- sorter = gtk_custom_sorter_new (compare, NULL, NULL);
+ sorter = GTK_SORTER (gtk_custom_sorter_new (compare, NULL, NULL));
gtk_sort_list_model_set_sorter (model, sorter);
g_object_unref (sorter);
diff --git a/testsuite/gtk/treesorter.c b/testsuite/gtk/treesorter.c
index 25d43a3d40..650cfa39fb 100644
--- a/testsuite/gtk/treesorter.c
+++ b/testsuite/gtk/treesorter.c
@@ -175,7 +175,7 @@ test_simple (void)
model = new_model (3);
assert_model (model, "1 2 21 3 31 32 321");
- sorter = gtk_tree_list_row_sorter_new (NULL);
+ sorter = GTK_SORTER (gtk_tree_list_row_sorter_new (NULL));
sort = gtk_sort_list_model_new (model, sorter);
assert_model (sort, "1 2 21 3 31 32 321");
@@ -185,7 +185,7 @@ test_simple (void)
static GtkSorter *
new_numeric_sorter (void)
{
- return gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL));
+ return GTK_SORTER (gtk_numeric_sorter_new (gtk_cclosure_expression_new (G_TYPE_UINT, NULL, 0, NULL, (GCallback)get_number, NULL, NULL)));
}
static void
@@ -198,7 +198,7 @@ test_compare_total_order (void)
model = new_model (3);
assert_model (model, "1 2 21 3 31 32 321");
- sorter = gtk_tree_list_row_sorter_new (new_numeric_sorter ());
+ sorter = GTK_SORTER (gtk_tree_list_row_sorter_new (new_numeric_sorter ()));
n = g_list_model_get_n_items (model);
for (i = 0; i < n; i++)
@@ -228,7 +228,7 @@ test_compare_no_order (void)
model = new_model (3);
assert_model (model, "1 2 21 3 31 32 321");
- sorter = gtk_tree_list_row_sorter_new (NULL);
+ sorter = GTK_SORTER (gtk_tree_list_row_sorter_new (NULL));
n = g_list_model_get_n_items (model);
for (i = 0; i < n; i++)