mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 10:20:07 +00:00
Make filter constructors return exact types
Make functions like gtk_custom_filter_new() return the actual type they construct. Update all callers.
This commit is contained in:
parent
716c7b2f21
commit
dfabe74c59
@ -177,11 +177,11 @@ constraint_view_init (ConstraintView *self)
|
||||
guides = gtk_constraint_layout_observe_guides (GTK_CONSTRAINT_LAYOUT (manager));
|
||||
|
||||
all_constraints = gtk_constraint_layout_observe_constraints (GTK_CONSTRAINT_LAYOUT (manager));
|
||||
filter = gtk_custom_filter_new (omit_internal, NULL, NULL);
|
||||
filter = GTK_FILTER (gtk_custom_filter_new (omit_internal, NULL, NULL));
|
||||
constraints = (GListModel *)gtk_filter_list_model_new (all_constraints, filter);
|
||||
|
||||
all_children = gtk_widget_observe_children (GTK_WIDGET (self));
|
||||
filter = gtk_custom_filter_new (omit_internal, NULL, NULL);
|
||||
filter = GTK_FILTER (gtk_custom_filter_new (omit_internal, NULL, NULL));
|
||||
children = (GListModel *)gtk_filter_list_model_new (all_children, filter);
|
||||
|
||||
list = g_list_store_new (G_TYPE_LIST_MODEL);
|
||||
|
@ -247,7 +247,7 @@ transform_settings_to_keys (GBinding *binding,
|
||||
sort_model = gtk_sort_list_model_new (G_LIST_MODEL (store),
|
||||
g_object_ref (gtk_column_view_get_sorter (GTK_COLUMN_VIEW (data))));
|
||||
|
||||
filter = gtk_string_filter_new (gtk_property_expression_new (SETTINGS_TYPE_KEY, NULL, "name"));
|
||||
filter = GTK_FILTER (gtk_string_filter_new (gtk_property_expression_new (SETTINGS_TYPE_KEY, NULL, "name")));
|
||||
g_set_object (¤t_filter, filter);
|
||||
filter_model = gtk_filter_list_model_new (G_LIST_MODEL (sort_model), filter);
|
||||
|
||||
|
@ -179,7 +179,7 @@ do_listview_words (GtkWidget *do_widget)
|
||||
}
|
||||
g_object_unref (file);
|
||||
|
||||
filter = gtk_string_filter_new (gtk_property_expression_new (GTK_TYPE_STRING_OBJECT, NULL, "string"));
|
||||
filter = GTK_FILTER (gtk_string_filter_new (gtk_property_expression_new (GTK_TYPE_STRING_OBJECT, NULL, "string")));
|
||||
filter_model = gtk_filter_list_model_new (G_LIST_MODEL (stringlist), filter);
|
||||
gtk_filter_list_model_set_incremental (filter_model, TRUE);
|
||||
|
||||
|
@ -695,9 +695,11 @@ filter_demo (GtkDemo *demo)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
demo_filter_by_name (GtkTreeListRow *row,
|
||||
GtkFilterListModel *model)
|
||||
demo_filter_by_name (gpointer item,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkTreeListRow *row = item;
|
||||
GtkFilterListModel *model = user_data;
|
||||
GListModel *children;
|
||||
GtkDemo *demo;
|
||||
guint i, n;
|
||||
@ -865,9 +867,10 @@ activate (GApplication *app)
|
||||
NULL,
|
||||
NULL);
|
||||
filter_model = gtk_filter_list_model_new (G_LIST_MODEL (treemodel), NULL);
|
||||
filter = gtk_custom_filter_new ((GtkCustomFilterFunc)demo_filter_by_name, filter_model, NULL);
|
||||
filter = GTK_FILTER (gtk_custom_filter_new (demo_filter_by_name, filter_model, NULL));
|
||||
gtk_filter_list_model_set_filter (filter_model, filter);
|
||||
g_object_unref (filter);
|
||||
|
||||
search_entry = GTK_WIDGET (gtk_builder_get_object (builder, "search-entry"));
|
||||
g_signal_connect (search_entry, "search-changed", G_CALLBACK (demo_search_changed_cb), filter);
|
||||
|
||||
|
@ -357,7 +357,7 @@ icon_browser_window_init (IconBrowserWindow *win)
|
||||
|
||||
filter = gtk_filter_list_model_get_filter (GTK_FILTER_LIST_MODEL (win->icon_filter_model));
|
||||
|
||||
win->name_filter = gtk_custom_filter_new (filter_by_icon_name, NULL, NULL);
|
||||
win->name_filter = GTK_FILTER (gtk_custom_filter_new (filter_by_icon_name, NULL, NULL));
|
||||
|
||||
gtk_multi_filter_append (GTK_MULTI_FILTER (filter), g_object_ref (win->name_filter));
|
||||
}
|
||||
|
@ -195,10 +195,10 @@ gtk_bool_filter_init (GtkBoolFilter *self)
|
||||
*
|
||||
* Returns: a new #GtkBoolFilter
|
||||
**/
|
||||
GtkFilter *
|
||||
GtkBoolFilter *
|
||||
gtk_bool_filter_new (GtkExpression *expression)
|
||||
{
|
||||
GtkFilter *result;
|
||||
GtkBoolFilter *result;
|
||||
|
||||
result = g_object_new (GTK_TYPE_BOOL_FILTER,
|
||||
"expression", expression,
|
||||
|
@ -34,7 +34,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
G_DECLARE_FINAL_TYPE (GtkBoolFilter, gtk_bool_filter, GTK, BOOL_FILTER, GtkFilter)
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkFilter * gtk_bool_filter_new (GtkExpression *expression);
|
||||
GtkBoolFilter * gtk_bool_filter_new (GtkExpression *expression);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkExpression * gtk_bool_filter_get_expression (GtkBoolFilter *self);
|
||||
|
@ -108,9 +108,9 @@ gtk_custom_filter_init (GtkCustomFilter *self)
|
||||
* If the filter func changes its filtering behavior,
|
||||
* gtk_filter_changed() needs to be called.
|
||||
*
|
||||
* Returns: a new #GtkFilter
|
||||
* Returns: a new #GtkCustomFilter
|
||||
**/
|
||||
GtkFilter *
|
||||
GtkCustomFilter *
|
||||
gtk_custom_filter_new (GtkCustomFilterFunc match_func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify user_destroy)
|
||||
@ -121,7 +121,7 @@ gtk_custom_filter_new (GtkCustomFilterFunc match_func,
|
||||
|
||||
gtk_custom_filter_set_filter_func (result, match_func, user_data, user_destroy);
|
||||
|
||||
return GTK_FILTER (result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,7 +45,7 @@ typedef gboolean (* GtkCustomFilterFunc) (gpointer item, gpointer user_data);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
G_DECLARE_FINAL_TYPE (GtkCustomFilter, gtk_custom_filter, GTK, CUSTOM_FILTER, GtkFilter)
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkFilter * gtk_custom_filter_new (GtkCustomFilterFunc match_func,
|
||||
GtkCustomFilter * gtk_custom_filter_new (GtkCustomFilterFunc match_func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify user_destroy);
|
||||
|
||||
|
@ -323,7 +323,7 @@ gtk_custom_paper_unix_dialog_init (GtkCustomPaperUnixDialog *dialog)
|
||||
|
||||
full_list = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (printer_list_list)));
|
||||
|
||||
filter = gtk_custom_filter_new (match_func, NULL, NULL);
|
||||
filter = GTK_FILTER (gtk_custom_filter_new (match_func, NULL, NULL));
|
||||
dialog->printer_list = G_LIST_MODEL (gtk_filter_list_model_new (full_list, filter));
|
||||
|
||||
dialog->custom_paper_list = g_list_store_new (GTK_TYPE_PAGE_SETUP);
|
||||
|
@ -203,11 +203,11 @@ update_filter (GtkDropDown *self)
|
||||
|
||||
if (self->expression)
|
||||
{
|
||||
filter = gtk_string_filter_new (gtk_expression_ref (self->expression));
|
||||
filter = GTK_FILTER (gtk_string_filter_new (gtk_expression_ref (self->expression)));
|
||||
gtk_string_filter_set_match_mode (GTK_STRING_FILTER (filter), GTK_STRING_FILTER_MATCH_MODE_PREFIX);
|
||||
}
|
||||
else
|
||||
filter = gtk_every_filter_new ();
|
||||
filter = GTK_FILTER (gtk_every_filter_new ());
|
||||
gtk_filter_list_model_set_filter (GTK_FILTER_LIST_MODEL (self->filter_model), filter);
|
||||
g_object_unref (filter);
|
||||
}
|
||||
|
@ -302,9 +302,9 @@ gtk_any_filter_init (GtkAnyFilter *self)
|
||||
* In particular, this means that if no filter has been added to
|
||||
* it, the filter matches no item.
|
||||
*
|
||||
* Returns: a new #GtkFilter
|
||||
* Returns: a new #GtkAnyFilter
|
||||
**/
|
||||
GtkFilter *
|
||||
GtkAnyFilter *
|
||||
gtk_any_filter_new (void)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_ANY_FILTER, NULL);
|
||||
@ -400,9 +400,9 @@ gtk_every_filter_init (GtkEveryFilter *self)
|
||||
* In particular, this means that if no filter has been added to
|
||||
* it, the filter matches every item.
|
||||
*
|
||||
* Returns: a new #GtkFilter
|
||||
* Returns: a new #GtkEveryFilter
|
||||
**/
|
||||
GtkFilter *
|
||||
GtkEveryFilter *
|
||||
gtk_every_filter_new (void)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_EVERY_FILTER, NULL);
|
||||
|
@ -44,13 +44,13 @@ void gtk_multi_filter_remove (GtkMultiFilter
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DECLARE_INTERNAL_TYPE (GtkAnyFilter, gtk_any_filter, GTK, ANY_FILTER, GtkMultiFilter)
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkFilter * gtk_any_filter_new (void);
|
||||
GtkAnyFilter * gtk_any_filter_new (void);
|
||||
|
||||
#define GTK_TYPE_EVERY_FILTER (gtk_every_filter_get_type ())
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DECLARE_INTERNAL_TYPE (GtkEveryFilter, gtk_every_filter, GTK, EVERY_FILTER, GtkMultiFilter)
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkFilter * gtk_every_filter_new (void);
|
||||
GtkEveryFilter * gtk_every_filter_new (void);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -324,7 +324,7 @@ gtk_page_setup_unix_dialog_init (GtkPageSetupUnixDialog *dialog)
|
||||
|
||||
full_list = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (printer_list_list)));
|
||||
|
||||
filter = gtk_custom_filter_new (match_func, NULL, NULL);
|
||||
filter = GTK_FILTER (gtk_custom_filter_new (match_func, NULL, NULL));
|
||||
dialog->printer_list = G_LIST_MODEL (gtk_filter_list_model_new (full_list, filter));
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
|
@ -742,7 +742,8 @@ gtk_print_unix_dialog_init (GtkPrintUnixDialog *dialog)
|
||||
GListModel *selection;
|
||||
GtkSorter *sorter;
|
||||
GtkFilter *filter;
|
||||
GtkFilter *filter1;
|
||||
GtkStringFilter *filter1;
|
||||
GtkCustomFilter *filter2;
|
||||
GtkListItemFactory *factory;
|
||||
GListStore *store;
|
||||
GListModel *paper_size_list;
|
||||
@ -813,19 +814,19 @@ gtk_print_unix_dialog_init (GtkPrintUnixDialog *dialog)
|
||||
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_every_filter_new ();
|
||||
filter = GTK_FILTER (gtk_every_filter_new ());
|
||||
|
||||
filter1 = gtk_string_filter_new (
|
||||
gtk_cclosure_expression_new (G_TYPE_STRING,
|
||||
NULL, 0, NULL,
|
||||
G_CALLBACK (get_printer_key),
|
||||
NULL, NULL));
|
||||
gtk_string_filter_set_match_mode (GTK_STRING_FILTER (filter1), GTK_STRING_FILTER_MATCH_MODE_SUBSTRING);
|
||||
gtk_string_filter_set_ignore_case (GTK_STRING_FILTER (filter1), TRUE);
|
||||
gtk_multi_filter_append (GTK_MULTI_FILTER (filter), filter1);
|
||||
gtk_string_filter_set_match_mode (filter1, GTK_STRING_FILTER_MATCH_MODE_SUBSTRING);
|
||||
gtk_string_filter_set_ignore_case (filter1, TRUE);
|
||||
gtk_multi_filter_append (GTK_MULTI_FILTER (filter), GTK_FILTER (filter1));
|
||||
|
||||
filter1 = gtk_custom_filter_new (is_printer_active, dialog, NULL);
|
||||
gtk_multi_filter_append (GTK_MULTI_FILTER (filter), filter1);
|
||||
filter2 = gtk_custom_filter_new (is_printer_active, dialog, NULL);
|
||||
gtk_multi_filter_append (GTK_MULTI_FILTER (filter), GTK_FILTER (filter2));
|
||||
|
||||
filtered = G_LIST_MODEL (gtk_filter_list_model_new (sorted, filter));
|
||||
|
||||
|
@ -313,10 +313,10 @@ gtk_string_filter_init (GtkStringFilter *self)
|
||||
*
|
||||
* Returns: a new #GtkStringFilter
|
||||
**/
|
||||
GtkFilter *
|
||||
GtkStringFilter *
|
||||
gtk_string_filter_new (GtkExpression *expression)
|
||||
{
|
||||
GtkFilter *result;
|
||||
GtkStringFilter *result;
|
||||
|
||||
result = g_object_new (GTK_TYPE_STRING_FILTER,
|
||||
"expression", expression,
|
||||
|
@ -51,7 +51,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
G_DECLARE_FINAL_TYPE (GtkStringFilter, gtk_string_filter, GTK, STRING_FILTER, GtkFilter)
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkFilter * gtk_string_filter_new (GtkExpression *expression);
|
||||
GtkStringFilter * gtk_string_filter_new (GtkExpression *expression);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
const char * gtk_string_filter_get_search (GtkStringFilter *self);
|
||||
|
@ -230,7 +230,7 @@ update_attributes (GtkInspectorA11y *sl)
|
||||
{
|
||||
GtkATContext *context;
|
||||
GListStore *store;
|
||||
GtkFilter *filter;
|
||||
GtkBoolFilter *filter;
|
||||
GtkFilterListModel *filter_model;
|
||||
GtkNoSelection *selection;
|
||||
GObject *obj;
|
||||
@ -311,9 +311,9 @@ update_attributes (GtkInspectorA11y *sl)
|
||||
g_type_class_unref (eclass);
|
||||
|
||||
filter = gtk_bool_filter_new (gtk_property_expression_new (accessible_attribute_get_type (), NULL, "is-default"));
|
||||
gtk_bool_filter_set_invert (GTK_BOOL_FILTER (filter), TRUE);
|
||||
gtk_bool_filter_set_invert (filter, TRUE);
|
||||
|
||||
filter_model = gtk_filter_list_model_new (G_LIST_MODEL (store), filter);
|
||||
filter_model = gtk_filter_list_model_new (G_LIST_MODEL (store), GTK_FILTER (filter));
|
||||
selection = gtk_no_selection_new (G_LIST_MODEL (filter_model));
|
||||
gtk_column_view_set_model (GTK_COLUMN_VIEW (sl->attributes), GTK_SELECTION_MODEL (selection));
|
||||
g_object_unref (selection);
|
||||
|
@ -1135,8 +1135,9 @@ toplevel_filter_func (gpointer item,
|
||||
static GListModel *
|
||||
create_root_model (GdkDisplay *display)
|
||||
{
|
||||
GtkFilter *custom_filter;
|
||||
GtkFilterListModel *filter;
|
||||
GtkFilter *filter;
|
||||
GtkFilterListModel *filter_model;
|
||||
GListModel *model;
|
||||
GListStore *list, *special;
|
||||
gpointer item;
|
||||
|
||||
@ -1150,12 +1151,11 @@ create_root_model (GdkDisplay *display)
|
||||
g_list_store_append (list, special);
|
||||
g_object_unref (special);
|
||||
|
||||
filter = gtk_filter_list_model_new (NULL, NULL);
|
||||
custom_filter = gtk_custom_filter_new (toplevel_filter_func, display, NULL);
|
||||
gtk_filter_list_model_set_filter (filter, custom_filter);
|
||||
gtk_filter_list_model_set_model (filter, gtk_window_get_toplevels ());
|
||||
g_list_store_append (list, filter);
|
||||
g_object_unref (filter);
|
||||
filter = GTK_FILTER (gtk_custom_filter_new (toplevel_filter_func, display, NULL));
|
||||
model = gtk_window_get_toplevels ();
|
||||
filter_model = gtk_filter_list_model_new (g_object_ref (model), filter);
|
||||
g_list_store_append (list, filter_model);
|
||||
g_object_unref (filter_model);
|
||||
|
||||
return G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (list)));
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ struct _GtkInspectorPropListPrivate
|
||||
GtkWidget *search_entry;
|
||||
GtkWidget *search_stack;
|
||||
GtkWidget *list;
|
||||
GtkFilter *filter;
|
||||
GtkStringFilter *filter;
|
||||
GtkColumnViewColumn *name;
|
||||
GtkColumnViewColumn *type;
|
||||
GtkColumnViewColumn *origin;
|
||||
@ -114,14 +114,14 @@ gtk_inspector_prop_list_init (GtkInspectorPropList *pl)
|
||||
pl->priv = gtk_inspector_prop_list_get_instance_private (pl);
|
||||
gtk_widget_init_template (GTK_WIDGET (pl));
|
||||
pl->priv->filter = gtk_string_filter_new (NULL);
|
||||
gtk_string_filter_set_match_mode (GTK_STRING_FILTER (pl->priv->filter), GTK_STRING_FILTER_MATCH_MODE_SUBSTRING);
|
||||
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,
|
||||
0, NULL,
|
||||
(GCallback)holder_prop,
|
||||
NULL, NULL));
|
||||
|
||||
gtk_string_filter_set_expression (GTK_STRING_FILTER (pl->priv->filter),
|
||||
gtk_string_filter_set_expression (pl->priv->filter,
|
||||
gtk_string_sorter_get_expression (GTK_STRING_SORTER (sorter)));
|
||||
|
||||
gtk_column_view_column_set_sorter (pl->priv->name, sorter);
|
||||
@ -217,7 +217,7 @@ update_filter (GtkInspectorPropList *pl,
|
||||
const char *text;
|
||||
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (pl->priv->filter), text);
|
||||
gtk_string_filter_set_search (pl->priv->filter, text);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -622,7 +622,7 @@ gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl,
|
||||
if (GTK_IS_WIDGET (object))
|
||||
g_signal_connect_object (object, "destroy", G_CALLBACK (cleanup_object), pl, G_CONNECT_SWAPPED);
|
||||
|
||||
filtered = G_LIST_MODEL (gtk_filter_list_model_new (G_LIST_MODEL (store), g_object_ref (pl->priv->filter)));
|
||||
filtered = G_LIST_MODEL (gtk_filter_list_model_new (G_LIST_MODEL (store), g_object_ref (GTK_FILTER (pl->priv->filter))));
|
||||
sorted = gtk_sort_list_model_new (filtered, NULL);
|
||||
list = G_LIST_MODEL (gtk_no_selection_new (G_LIST_MODEL (sorted)));
|
||||
|
||||
|
@ -756,7 +756,7 @@ main (int argc, char *argv[])
|
||||
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_custom_filter_new (match_file, g_object_ref (search_entry), g_object_unref);
|
||||
custom_filter = GTK_FILTER (gtk_custom_filter_new (match_file, g_object_ref (search_entry), g_object_unref));
|
||||
filter = gtk_filter_list_model_new (G_LIST_MODEL (sort), custom_filter);
|
||||
g_signal_connect (search_entry, "search-changed", G_CALLBACK (search_changed_cb), custom_filter);
|
||||
|
||||
|
@ -629,7 +629,7 @@ main (int argc, char *argv[])
|
||||
NULL, NULL);
|
||||
g_object_unref (root);
|
||||
|
||||
custom_filter = gtk_custom_filter_new (match_file, search_entry, NULL);
|
||||
custom_filter = GTK_FILTER (gtk_custom_filter_new (match_file, search_entry, NULL));
|
||||
filter = gtk_filter_list_model_new (G_LIST_MODEL (tree), custom_filter);
|
||||
g_signal_connect (search_entry, "search-changed", G_CALLBACK (search_changed_cb), custom_filter);
|
||||
|
||||
|
@ -38,7 +38,7 @@ test_property (void)
|
||||
GtkStringFilter *filter;
|
||||
guint counter = 0;
|
||||
|
||||
filter = GTK_STRING_FILTER (gtk_string_filter_new (NULL));
|
||||
filter = gtk_string_filter_new (NULL);
|
||||
expr = gtk_property_expression_new (GTK_TYPE_STRING_FILTER, NULL, "search");
|
||||
watch = gtk_expression_watch (expr, filter, inc_counter, &counter, NULL);
|
||||
|
||||
@ -192,7 +192,7 @@ test_nested (void)
|
||||
GtkExpression *list_expr;
|
||||
GtkExpression *filter_expr;
|
||||
GtkExpression *expr;
|
||||
GtkFilter *filter;
|
||||
GtkStringFilter *filter;
|
||||
GListModel *list;
|
||||
GtkFilterListModel *filtered;
|
||||
GValue value = G_VALUE_INIT;
|
||||
@ -201,9 +201,9 @@ test_nested (void)
|
||||
guint counter = 0;
|
||||
|
||||
filter = gtk_string_filter_new (NULL);
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (filter), "word");
|
||||
gtk_string_filter_set_search (filter, "word");
|
||||
list = G_LIST_MODEL (g_list_store_new (G_TYPE_OBJECT));
|
||||
filtered = gtk_filter_list_model_new (list, g_object_ref (filter));
|
||||
filtered = gtk_filter_list_model_new (list, g_object_ref (GTK_FILTER (filter)));
|
||||
|
||||
list_expr = gtk_object_expression_new (G_OBJECT (filtered));
|
||||
filter_expr = gtk_property_expression_new (GTK_TYPE_FILTER_LIST_MODEL, list_expr, "filter");
|
||||
@ -227,13 +227,13 @@ test_nested (void)
|
||||
g_assert_cmpstr (g_value_get_string (&value), ==, "salad");
|
||||
g_value_unset (&value);
|
||||
|
||||
gtk_filter_list_model_set_filter (filtered, filter);
|
||||
gtk_filter_list_model_set_filter (filtered, GTK_FILTER (filter));
|
||||
g_assert_cmpint (counter, ==, 0);
|
||||
|
||||
g_clear_object (&filter);
|
||||
filter = gtk_string_filter_new (NULL);
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (filter), "salad");
|
||||
gtk_filter_list_model_set_filter (filtered, filter);
|
||||
gtk_string_filter_set_search (filter, "salad");
|
||||
gtk_filter_list_model_set_filter (filtered, GTK_FILTER (filter));
|
||||
g_assert_cmpint (counter, ==, 1);
|
||||
counter = 0;
|
||||
|
||||
@ -242,7 +242,7 @@ test_nested (void)
|
||||
g_assert_cmpstr (g_value_get_string (&value), ==, "salad");
|
||||
g_value_unset (&value);
|
||||
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (filter), "bar");
|
||||
gtk_string_filter_set_search (filter, "bar");
|
||||
g_assert_cmpint (counter, ==, 1);
|
||||
counter = 0;
|
||||
|
||||
@ -279,7 +279,7 @@ test_nested_this_destroyed (void)
|
||||
GtkExpression *list_expr;
|
||||
GtkExpression *filter_expr;
|
||||
GtkExpression *expr;
|
||||
GtkFilter *filter;
|
||||
GtkStringFilter *filter;
|
||||
GListModel *list;
|
||||
GtkFilterListModel *filtered;
|
||||
GValue value = G_VALUE_INIT;
|
||||
@ -288,9 +288,9 @@ test_nested_this_destroyed (void)
|
||||
guint counter = 0;
|
||||
|
||||
filter = gtk_string_filter_new (NULL);
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (filter), "word");
|
||||
gtk_string_filter_set_search (filter, "word");
|
||||
list = G_LIST_MODEL (g_list_store_new (G_TYPE_OBJECT));
|
||||
filtered = gtk_filter_list_model_new (list, g_object_ref (filter));
|
||||
filtered = gtk_filter_list_model_new (list, g_object_ref (GTK_FILTER (filter)));
|
||||
|
||||
list_expr = gtk_object_expression_new (G_OBJECT (filtered));
|
||||
filter_expr = gtk_property_expression_new (GTK_TYPE_FILTER_LIST_MODEL, list_expr, "filter");
|
||||
@ -307,15 +307,15 @@ test_nested_this_destroyed (void)
|
||||
g_assert_cmpint (counter, ==, 0);
|
||||
|
||||
filter = gtk_string_filter_new (NULL);
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (filter), "salad");
|
||||
gtk_filter_list_model_set_filter (filtered, filter);
|
||||
gtk_string_filter_set_search (filter, "salad");
|
||||
gtk_filter_list_model_set_filter (filtered, GTK_FILTER (filter));
|
||||
g_assert_cmpint (counter, ==, 1);
|
||||
counter = 0;
|
||||
|
||||
res = gtk_expression_watch_evaluate (watch, &value);
|
||||
g_assert_false (res);
|
||||
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (filter), "bar");
|
||||
gtk_string_filter_set_search (filter, "bar");
|
||||
g_assert_cmpint (counter, ==, 0);
|
||||
|
||||
gtk_filter_list_model_set_filter (filtered, NULL);
|
||||
@ -346,7 +346,7 @@ test_type_mismatch (void)
|
||||
GValue value = G_VALUE_INIT;
|
||||
gboolean res;
|
||||
|
||||
filter = gtk_any_filter_new ();
|
||||
filter = GTK_FILTER (gtk_any_filter_new ());
|
||||
|
||||
expr = gtk_property_expression_new (GTK_TYPE_STRING_FILTER, gtk_constant_expression_new (GTK_TYPE_ANY_FILTER, filter), "search");
|
||||
|
||||
@ -362,8 +362,8 @@ test_type_mismatch (void)
|
||||
static void
|
||||
test_this (void)
|
||||
{
|
||||
GtkFilter *filter;
|
||||
GtkFilter *filter2;
|
||||
GtkStringFilter *filter;
|
||||
GtkStringFilter *filter2;
|
||||
GtkExpression *expr;
|
||||
GValue value = G_VALUE_INIT;
|
||||
gboolean res;
|
||||
@ -371,10 +371,10 @@ test_this (void)
|
||||
expr = gtk_property_expression_new (GTK_TYPE_STRING_FILTER, NULL, "search");
|
||||
|
||||
filter = gtk_string_filter_new (NULL);
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (filter), "word");
|
||||
gtk_string_filter_set_search (filter, "word");
|
||||
|
||||
filter2 = gtk_string_filter_new (NULL);
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (filter2), "sausage");
|
||||
gtk_string_filter_set_search (filter2, "sausage");
|
||||
|
||||
res = gtk_expression_evaluate (expr, filter, &value);
|
||||
g_assert_true (res);
|
||||
@ -417,8 +417,8 @@ test_constant_watch_this_destroyed (void)
|
||||
static void
|
||||
test_bind (void)
|
||||
{
|
||||
GtkFilter *target;
|
||||
GtkFilter *source;
|
||||
GtkStringFilter *target;
|
||||
GtkStringFilter *source;
|
||||
GtkExpression *expr;
|
||||
GtkExpressionWatch *watch;
|
||||
GValue value = G_VALUE_INIT;
|
||||
@ -427,25 +427,25 @@ test_bind (void)
|
||||
expr = gtk_property_expression_new (GTK_TYPE_STRING_FILTER, NULL, "search");
|
||||
|
||||
target = gtk_string_filter_new (NULL);
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (target), "word");
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (GTK_STRING_FILTER (target)), ==, "word");
|
||||
gtk_string_filter_set_search (target, "word");
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (target), ==, "word");
|
||||
|
||||
source = gtk_string_filter_new (NULL);
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (source), "sausage");
|
||||
gtk_string_filter_set_search (source, "sausage");
|
||||
|
||||
watch = gtk_expression_bind (expr, target, "search", source);
|
||||
gtk_expression_watch_ref (watch);
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (GTK_STRING_FILTER (target)), ==, "sausage");
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (target), ==, "sausage");
|
||||
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (source), "salad");
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (GTK_STRING_FILTER (target)), ==, "salad");
|
||||
gtk_string_filter_set_search (source, "salad");
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (target), ==, "salad");
|
||||
res = gtk_expression_watch_evaluate (watch, &value);
|
||||
g_assert_true (res);
|
||||
g_assert_cmpstr (g_value_get_string (&value), ==, "salad");
|
||||
g_value_unset (&value);
|
||||
|
||||
g_object_unref (source);
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (GTK_STRING_FILTER (target)), ==, "salad");
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (target), ==, "salad");
|
||||
res = gtk_expression_watch_evaluate (watch, &value);
|
||||
g_assert_false (res);
|
||||
g_assert_false (G_IS_VALUE (&value));
|
||||
@ -458,7 +458,7 @@ test_bind (void)
|
||||
static void
|
||||
test_bind_self (void)
|
||||
{
|
||||
GtkFilter *filter;
|
||||
GtkStringFilter *filter;
|
||||
GtkExpression *expr;
|
||||
|
||||
expr = gtk_property_expression_new (GTK_TYPE_STRING_FILTER,
|
||||
@ -466,11 +466,11 @@ test_bind_self (void)
|
||||
"ignore-case");
|
||||
|
||||
filter = gtk_string_filter_new (NULL);
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (filter), "word");
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (GTK_STRING_FILTER (filter)), ==, "word");
|
||||
gtk_string_filter_set_search (filter, "word");
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (filter), ==, "word");
|
||||
|
||||
gtk_expression_bind (expr, filter, "search", filter);
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (GTK_STRING_FILTER (filter)), ==, "TRUE");
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (filter), ==, "TRUE");
|
||||
|
||||
g_object_unref (filter);
|
||||
}
|
||||
@ -480,7 +480,7 @@ test_bind_self (void)
|
||||
static void
|
||||
test_bind_child (void)
|
||||
{
|
||||
GtkFilter *filter;
|
||||
GtkStringFilter *filter;
|
||||
GtkFilterListModel *child, *target;
|
||||
GtkExpression *expr;
|
||||
|
||||
@ -489,15 +489,15 @@ test_bind_child (void)
|
||||
"filter");
|
||||
|
||||
filter = gtk_string_filter_new (NULL);
|
||||
child = gtk_filter_list_model_new (NULL, filter);
|
||||
child = gtk_filter_list_model_new (NULL, GTK_FILTER (filter));
|
||||
target = gtk_filter_list_model_new (G_LIST_MODEL (child), NULL);
|
||||
|
||||
gtk_expression_bind (expr, target, "filter", child);
|
||||
g_assert_true (gtk_filter_list_model_get_filter (child) == gtk_filter_list_model_get_filter (target));
|
||||
|
||||
filter = gtk_string_filter_new (NULL);
|
||||
gtk_filter_list_model_set_filter (child, filter);
|
||||
g_assert_true (filter == gtk_filter_list_model_get_filter (target));
|
||||
gtk_filter_list_model_set_filter (child, GTK_FILTER (filter));
|
||||
g_assert_true (GTK_FILTER (filter) == gtk_filter_list_model_get_filter (target));
|
||||
g_assert_true (gtk_filter_list_model_get_filter (child) == gtk_filter_list_model_get_filter (target));
|
||||
g_object_unref (filter);
|
||||
|
||||
@ -508,9 +508,9 @@ test_bind_child (void)
|
||||
static void
|
||||
test_nested_bind (void)
|
||||
{
|
||||
GtkFilter *filter;
|
||||
GtkFilter *filter2;
|
||||
GtkFilter *filter3;
|
||||
GtkStringFilter *filter;
|
||||
GtkStringFilter *filter2;
|
||||
GtkStringFilter *filter3;
|
||||
GListModel *list;
|
||||
GtkFilterListModel *filtered;
|
||||
GtkExpression *expr;
|
||||
@ -519,10 +519,10 @@ test_nested_bind (void)
|
||||
GValue value = G_VALUE_INIT;
|
||||
|
||||
filter2 = gtk_string_filter_new (NULL);
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (filter2), "sausage");
|
||||
gtk_string_filter_set_search (filter2, "sausage");
|
||||
|
||||
list = G_LIST_MODEL (g_list_store_new (G_TYPE_OBJECT));
|
||||
filtered = gtk_filter_list_model_new (list, g_object_ref (filter2));
|
||||
filtered = gtk_filter_list_model_new (list, g_object_ref (GTK_FILTER (filter2)));
|
||||
|
||||
filter_expr = gtk_property_expression_new (GTK_TYPE_FILTER_LIST_MODEL,
|
||||
gtk_object_expression_new (G_OBJECT (filtered)),
|
||||
@ -530,17 +530,17 @@ test_nested_bind (void)
|
||||
expr = gtk_property_expression_new (GTK_TYPE_STRING_FILTER, gtk_expression_ref (filter_expr), "search");
|
||||
|
||||
filter = gtk_string_filter_new (NULL);
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (filter), "word");
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (GTK_STRING_FILTER (filter)), ==, "word");
|
||||
gtk_string_filter_set_search (filter, "word");
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (filter), ==, "word");
|
||||
|
||||
gtk_expression_bind (gtk_expression_ref (expr), filter, "search", NULL);
|
||||
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (filter2), "sausage");
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (GTK_STRING_FILTER (filter)), ==, "sausage");
|
||||
gtk_string_filter_set_search (filter2, "sausage");
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (filter), ==, "sausage");
|
||||
|
||||
filter3 = gtk_string_filter_new (NULL);
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (filter3), "banana");
|
||||
gtk_filter_list_model_set_filter (filtered, filter3);
|
||||
gtk_string_filter_set_search (filter3, "banana");
|
||||
gtk_filter_list_model_set_filter (filtered, GTK_FILTER (filter3));
|
||||
|
||||
/* check that the expressions evaluate correctly */
|
||||
res = gtk_expression_evaluate (filter_expr, NULL, &value);
|
||||
@ -554,7 +554,7 @@ test_nested_bind (void)
|
||||
g_value_unset (&value);
|
||||
|
||||
/* and the bind too */
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (GTK_STRING_FILTER (filter)), ==, "banana");
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (filter), ==, "banana");
|
||||
|
||||
g_object_unref (filter);
|
||||
g_object_unref (filter2);
|
||||
@ -592,8 +592,8 @@ test_double_bind (void)
|
||||
GtkExpression *filter_expr;
|
||||
GtkExpression *params[2];
|
||||
|
||||
filter1 = GTK_STRING_FILTER (gtk_string_filter_new (NULL));
|
||||
filter2 = GTK_STRING_FILTER (gtk_string_filter_new (NULL));
|
||||
filter1 = gtk_string_filter_new (NULL);
|
||||
filter2 = gtk_string_filter_new (NULL);
|
||||
|
||||
filter_expr = gtk_object_expression_new (G_OBJECT (filter1));
|
||||
|
||||
@ -607,11 +607,11 @@ test_double_bind (void)
|
||||
|
||||
gtk_expression_bind (gtk_expression_ref (expr), filter2, "search", NULL);
|
||||
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (filter1), "Banana");
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (GTK_STRING_FILTER (filter2)), ==, "banana");
|
||||
gtk_string_filter_set_search (filter1, "Banana");
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (filter2), ==, "banana");
|
||||
|
||||
gtk_string_filter_set_ignore_case (GTK_STRING_FILTER (filter1), FALSE);
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (GTK_STRING_FILTER (filter2)), ==, "Banana");
|
||||
gtk_string_filter_set_ignore_case (filter1, FALSE);
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (filter2), ==, "Banana");
|
||||
|
||||
gtk_expression_unref (expr);
|
||||
gtk_expression_unref (filter_expr);
|
||||
@ -633,9 +633,9 @@ test_binds (void)
|
||||
GtkExpression *filter2_expr;
|
||||
GtkExpression *params[2];
|
||||
|
||||
filter1 = GTK_STRING_FILTER (gtk_string_filter_new (NULL));
|
||||
filter2 = GTK_STRING_FILTER (gtk_string_filter_new (NULL));
|
||||
filter3 = GTK_STRING_FILTER (gtk_string_filter_new (NULL));
|
||||
filter1 = gtk_string_filter_new (NULL);
|
||||
filter2 = gtk_string_filter_new (NULL);
|
||||
filter3 = gtk_string_filter_new (NULL);
|
||||
|
||||
filter1_expr = gtk_object_expression_new (G_OBJECT (filter1));
|
||||
filter2_expr = gtk_object_expression_new (G_OBJECT (filter2));
|
||||
@ -653,20 +653,20 @@ test_binds (void)
|
||||
gtk_expression_bind (gtk_expression_ref (expr), filter3, "search", NULL);
|
||||
gtk_expression_bind (gtk_expression_ref (expr2), filter3, "ignore-case", NULL);
|
||||
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (filter1), "Banana");
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (GTK_STRING_FILTER (filter3)), ==, "banana");
|
||||
g_assert_true (gtk_string_filter_get_ignore_case (GTK_STRING_FILTER (filter3)));
|
||||
gtk_string_filter_set_search (filter1, "Banana");
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (filter3), ==, "banana");
|
||||
g_assert_true (gtk_string_filter_get_ignore_case (filter3));
|
||||
|
||||
gtk_string_filter_set_ignore_case (GTK_STRING_FILTER (filter2), FALSE);
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (GTK_STRING_FILTER (filter3)), ==, "Banana");
|
||||
g_assert_false (gtk_string_filter_get_ignore_case (GTK_STRING_FILTER (filter3)));
|
||||
gtk_string_filter_set_ignore_case (filter2, FALSE);
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (filter3), ==, "Banana");
|
||||
g_assert_false (gtk_string_filter_get_ignore_case (filter3));
|
||||
|
||||
/* invalidate the first bind */
|
||||
g_object_unref (filter1);
|
||||
|
||||
gtk_string_filter_set_ignore_case (GTK_STRING_FILTER (filter2), TRUE);
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (GTK_STRING_FILTER (filter3)), ==, "Banana");
|
||||
g_assert_true (gtk_string_filter_get_ignore_case (GTK_STRING_FILTER (filter3)));
|
||||
gtk_string_filter_set_ignore_case (filter2, TRUE);
|
||||
g_assert_cmpstr (gtk_string_filter_get_search (filter3), ==, "Banana");
|
||||
g_assert_true (gtk_string_filter_get_ignore_case (filter3));
|
||||
|
||||
gtk_expression_unref (expr);
|
||||
gtk_expression_unref (expr2);
|
||||
@ -681,7 +681,7 @@ test_binds (void)
|
||||
static void
|
||||
test_bind_object (void)
|
||||
{
|
||||
GtkFilter *filter;
|
||||
GtkStringFilter *filter;
|
||||
GListStore *store;
|
||||
GtkFilterListModel *model;
|
||||
GtkExpression *expr;
|
||||
@ -694,11 +694,11 @@ test_bind_object (void)
|
||||
|
||||
gtk_expression_bind (gtk_expression_ref (expr), model, "filter", NULL);
|
||||
|
||||
g_assert_true (gtk_filter_list_model_get_filter (model) == filter);
|
||||
g_assert_true (gtk_filter_list_model_get_filter (model) == GTK_FILTER (filter));
|
||||
|
||||
g_object_unref (filter);
|
||||
|
||||
g_assert_true (gtk_filter_list_model_get_filter (model) == filter);
|
||||
g_assert_true (gtk_filter_list_model_get_filter (model) == GTK_FILTER (filter));
|
||||
|
||||
gtk_expression_unref (expr);
|
||||
g_object_unref (model);
|
||||
|
@ -207,7 +207,7 @@ test_simple (void)
|
||||
GtkFilterListModel *model;
|
||||
GtkFilter *filter;
|
||||
|
||||
filter = gtk_custom_filter_new (divisible_by, GUINT_TO_POINTER (3), NULL);
|
||||
filter = GTK_FILTER (gtk_custom_filter_new (divisible_by, GUINT_TO_POINTER (3), NULL));
|
||||
model = new_model (20, filter);
|
||||
g_object_unref (filter);
|
||||
assert_model (model, "3 6 9 12 15 18");
|
||||
@ -220,9 +220,9 @@ test_any_simple (void)
|
||||
GtkFilterListModel *model;
|
||||
GtkFilter *any, *filter1, *filter2;
|
||||
|
||||
any = gtk_any_filter_new ();
|
||||
filter1 = gtk_custom_filter_new (divisible_by, GUINT_TO_POINTER (3), NULL);
|
||||
filter2 = gtk_custom_filter_new (divisible_by, GUINT_TO_POINTER (5), NULL);
|
||||
any = GTK_FILTER (gtk_any_filter_new ());
|
||||
filter1 = GTK_FILTER (gtk_custom_filter_new (divisible_by, GUINT_TO_POINTER (3), NULL));
|
||||
filter2 = GTK_FILTER (gtk_custom_filter_new (divisible_by, GUINT_TO_POINTER (5), NULL));
|
||||
|
||||
model = new_model (20, any);
|
||||
assert_model (model, "");
|
||||
@ -253,12 +253,12 @@ test_string_simple (void)
|
||||
GtkFilterListModel *model;
|
||||
GtkFilter *filter;
|
||||
|
||||
filter = gtk_string_filter_new (
|
||||
filter = GTK_FILTER (gtk_string_filter_new (
|
||||
gtk_cclosure_expression_new (G_TYPE_STRING,
|
||||
NULL,
|
||||
0, NULL,
|
||||
G_CALLBACK (get_string),
|
||||
NULL, NULL));
|
||||
NULL, NULL)));
|
||||
|
||||
model = new_model (20, filter);
|
||||
assert_model (model, "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20");
|
||||
@ -276,12 +276,12 @@ test_string_properties (void)
|
||||
GtkFilterListModel *model;
|
||||
GtkFilter *filter;
|
||||
|
||||
filter = gtk_string_filter_new (
|
||||
filter = GTK_FILTER (gtk_string_filter_new (
|
||||
gtk_cclosure_expression_new (G_TYPE_STRING,
|
||||
NULL,
|
||||
0, NULL,
|
||||
G_CALLBACK (get_spelled_out),
|
||||
NULL, NULL));
|
||||
NULL, NULL)));
|
||||
|
||||
model = new_model (1000, filter);
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (filter), "thirte");
|
||||
@ -316,12 +316,12 @@ test_bool_simple (void)
|
||||
GtkExpression *expr;
|
||||
GtkFilter *filter;
|
||||
|
||||
filter = gtk_bool_filter_new (
|
||||
filter = GTK_FILTER (gtk_bool_filter_new (
|
||||
gtk_cclosure_expression_new (G_TYPE_BOOLEAN,
|
||||
NULL,
|
||||
0, NULL,
|
||||
G_CALLBACK (divisible_by),
|
||||
GUINT_TO_POINTER (3), NULL));
|
||||
GUINT_TO_POINTER (3), NULL)));
|
||||
model = new_model (20, filter);
|
||||
assert_model (model, "3 6 9 12 15 18");
|
||||
|
||||
@ -358,10 +358,10 @@ test_every_dispose (void)
|
||||
{
|
||||
GtkFilter *filter, *filter1, *filter2;
|
||||
|
||||
filter = gtk_every_filter_new ();
|
||||
filter = GTK_FILTER (gtk_every_filter_new ());
|
||||
|
||||
filter1 = gtk_custom_filter_new (divisible_by, GUINT_TO_POINTER (3), NULL);
|
||||
filter2 = gtk_custom_filter_new (divisible_by, GUINT_TO_POINTER (5), NULL);
|
||||
filter1 = GTK_FILTER (gtk_custom_filter_new (divisible_by, GUINT_TO_POINTER (3), NULL));
|
||||
filter2 = GTK_FILTER (gtk_custom_filter_new (divisible_by, GUINT_TO_POINTER (5), NULL));
|
||||
|
||||
g_object_ref (filter1);
|
||||
g_object_ref (filter2);
|
||||
|
@ -217,11 +217,11 @@ create_filter (gsize id)
|
||||
{
|
||||
case 0:
|
||||
/* GTK_FILTER_MATCH_ALL */
|
||||
return gtk_string_filter_new (NULL);
|
||||
return GTK_FILTER (gtk_string_filter_new (NULL));
|
||||
|
||||
case 1:
|
||||
/* GTK_FILTER_MATCH_NONE */
|
||||
filter = gtk_string_filter_new (NULL);
|
||||
filter = GTK_FILTER (gtk_string_filter_new (NULL));
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (filter), "does not matter, because no expression");
|
||||
return filter;
|
||||
|
||||
@ -229,7 +229,7 @@ create_filter (gsize id)
|
||||
case 3:
|
||||
case 4:
|
||||
/* match all As, Bs and nothing */
|
||||
filter = gtk_string_filter_new (gtk_property_expression_new (GTK_TYPE_STRING_OBJECT, NULL, "string"));
|
||||
filter = GTK_FILTER (gtk_string_filter_new (gtk_property_expression_new (GTK_TYPE_STRING_OBJECT, NULL, "string")));
|
||||
if (id == 2)
|
||||
gtk_string_filter_set_search (GTK_STRING_FILTER (filter), "A");
|
||||
else if (id == 3)
|
||||
@ -302,7 +302,7 @@ test_two_filters (gconstpointer model_id)
|
||||
source = create_source_model (10, 10);
|
||||
model1 = create_filter_list_model (model_id, source, NULL);
|
||||
model2 = create_filter_list_model (model_id, G_LIST_MODEL (model1), NULL);
|
||||
every = gtk_every_filter_new ();
|
||||
every = GTK_FILTER (gtk_every_filter_new ());
|
||||
compare = create_filter_list_model (model_id, source, every);
|
||||
g_object_unref (every);
|
||||
g_object_unref (source);
|
||||
@ -364,7 +364,7 @@ test_model_changes (gconstpointer model_id)
|
||||
gsize i;
|
||||
|
||||
filter = create_random_filter (TRUE);
|
||||
multi = gtk_every_filter_new ();
|
||||
multi = GTK_FILTER (gtk_every_filter_new ());
|
||||
if (filter)
|
||||
gtk_multi_filter_append (GTK_MULTI_FILTER (multi), filter);
|
||||
|
||||
|
@ -164,7 +164,7 @@ new_model (guint size,
|
||||
GString *changes;
|
||||
|
||||
if (filter_func)
|
||||
filter = gtk_custom_filter_new (filter_func, data, NULL);
|
||||
filter = GTK_FILTER (gtk_custom_filter_new (filter_func, data, NULL));
|
||||
else
|
||||
filter = NULL;
|
||||
result = gtk_filter_list_model_new (g_object_ref (G_LIST_MODEL (new_store (1, size, 1))), filter);
|
||||
@ -234,9 +234,9 @@ test_empty_set_filter (void)
|
||||
{
|
||||
GtkFilterListModel *filter;
|
||||
GtkFilter *custom;
|
||||
|
||||
|
||||
filter = new_model (10, NULL, NULL);
|
||||
custom = gtk_custom_filter_new (is_smaller_than, GUINT_TO_POINTER (20), NULL);
|
||||
custom = GTK_FILTER (gtk_custom_filter_new (is_smaller_than, GUINT_TO_POINTER (20), NULL));
|
||||
gtk_filter_list_model_set_filter (filter, custom);
|
||||
g_object_unref (custom);
|
||||
assert_model (filter, "1 2 3 4 5 6 7 8 9 10");
|
||||
@ -244,7 +244,7 @@ test_empty_set_filter (void)
|
||||
g_object_unref (filter);
|
||||
|
||||
filter = new_model (10, NULL, NULL);
|
||||
custom = gtk_custom_filter_new (is_smaller_than, GUINT_TO_POINTER (7), NULL);
|
||||
custom = GTK_FILTER (gtk_custom_filter_new (is_smaller_than, GUINT_TO_POINTER (7), NULL));
|
||||
gtk_filter_list_model_set_filter (filter, custom);
|
||||
g_object_unref (custom);
|
||||
assert_model (filter, "1 2 3 4 5 6");
|
||||
@ -252,7 +252,7 @@ test_empty_set_filter (void)
|
||||
g_object_unref (filter);
|
||||
|
||||
filter = new_model (10, NULL, NULL);
|
||||
custom = gtk_custom_filter_new (is_smaller_than, GUINT_TO_POINTER (0), NULL);
|
||||
custom = GTK_FILTER (gtk_custom_filter_new (is_smaller_than, GUINT_TO_POINTER (0), NULL));
|
||||
gtk_filter_list_model_set_filter (filter, custom);
|
||||
g_object_unref (custom);
|
||||
assert_model (filter, "");
|
||||
@ -260,7 +260,7 @@ test_empty_set_filter (void)
|
||||
g_object_unref (filter);
|
||||
|
||||
filter = new_model (10, NULL, NULL);
|
||||
custom = gtk_custom_filter_new (is_larger_than, GUINT_TO_POINTER (0), NULL);
|
||||
custom = GTK_FILTER (gtk_custom_filter_new (is_larger_than, GUINT_TO_POINTER (0), NULL));
|
||||
gtk_filter_list_model_set_filter (filter, custom);
|
||||
g_object_unref (custom);
|
||||
assert_model (filter, "1 2 3 4 5 6 7 8 9 10");
|
||||
@ -268,7 +268,7 @@ test_empty_set_filter (void)
|
||||
g_object_unref (filter);
|
||||
|
||||
filter = new_model (10, NULL, NULL);
|
||||
custom = gtk_custom_filter_new (is_larger_than, GUINT_TO_POINTER (3), NULL);
|
||||
custom = GTK_FILTER (gtk_custom_filter_new (is_larger_than, GUINT_TO_POINTER (3), NULL));
|
||||
gtk_filter_list_model_set_filter (filter, custom);
|
||||
g_object_unref (custom);
|
||||
assert_model (filter, "4 5 6 7 8 9 10");
|
||||
@ -276,7 +276,7 @@ test_empty_set_filter (void)
|
||||
g_object_unref (filter);
|
||||
|
||||
filter = new_model (10, NULL, NULL);
|
||||
custom = gtk_custom_filter_new (is_larger_than, GUINT_TO_POINTER (20), NULL);
|
||||
custom = GTK_FILTER (gtk_custom_filter_new (is_larger_than, GUINT_TO_POINTER (20), NULL));
|
||||
gtk_filter_list_model_set_filter (filter, custom);
|
||||
g_object_unref (custom);
|
||||
assert_model (filter, "");
|
||||
@ -284,7 +284,7 @@ test_empty_set_filter (void)
|
||||
g_object_unref (filter);
|
||||
|
||||
filter = new_model (10, NULL, NULL);
|
||||
custom = gtk_custom_filter_new (is_near, GUINT_TO_POINTER (5), NULL);
|
||||
custom = GTK_FILTER (gtk_custom_filter_new (is_near, GUINT_TO_POINTER (5), NULL));
|
||||
gtk_filter_list_model_set_filter (filter, custom);
|
||||
g_object_unref (custom);
|
||||
assert_model (filter, "3 4 5 6 7");
|
||||
@ -292,7 +292,7 @@ test_empty_set_filter (void)
|
||||
g_object_unref (filter);
|
||||
|
||||
filter = new_model (10, NULL, NULL);
|
||||
custom = gtk_custom_filter_new (is_not_near, GUINT_TO_POINTER (5), NULL);
|
||||
custom = GTK_FILTER (gtk_custom_filter_new (is_not_near, GUINT_TO_POINTER (5), NULL));
|
||||
gtk_filter_list_model_set_filter (filter, custom);
|
||||
g_object_unref (custom);
|
||||
assert_model (filter, "1 2 8 9 10");
|
||||
@ -310,37 +310,37 @@ test_change_filter (void)
|
||||
assert_model (filter, "1 2 8 9 10");
|
||||
assert_changes (filter, "");
|
||||
|
||||
custom = gtk_custom_filter_new (is_not_near, GUINT_TO_POINTER (6), NULL);
|
||||
custom = GTK_FILTER (gtk_custom_filter_new (is_not_near, GUINT_TO_POINTER (6), NULL));
|
||||
gtk_filter_list_model_set_filter (filter, custom);
|
||||
g_object_unref (custom);
|
||||
assert_model (filter, "1 2 3 9 10");
|
||||
assert_changes (filter, "2-1+1");
|
||||
|
||||
custom = gtk_custom_filter_new (is_not_near, GUINT_TO_POINTER (9), NULL);
|
||||
custom = GTK_FILTER (gtk_custom_filter_new (is_not_near, GUINT_TO_POINTER (9), NULL));
|
||||
gtk_filter_list_model_set_filter (filter, custom);
|
||||
g_object_unref (custom);
|
||||
assert_model (filter, "1 2 3 4 5 6");
|
||||
assert_changes (filter, "3-2+3");
|
||||
|
||||
custom = gtk_custom_filter_new (is_smaller_than, GUINT_TO_POINTER (6), NULL);
|
||||
custom = GTK_FILTER (gtk_custom_filter_new (is_smaller_than, GUINT_TO_POINTER (6), NULL));
|
||||
gtk_filter_list_model_set_filter (filter, custom);
|
||||
g_object_unref (custom);
|
||||
assert_model (filter, "1 2 3 4 5");
|
||||
assert_changes (filter, "-5");
|
||||
|
||||
custom = gtk_custom_filter_new (is_larger_than, GUINT_TO_POINTER (4), NULL);
|
||||
custom = GTK_FILTER (gtk_custom_filter_new (is_larger_than, GUINT_TO_POINTER (4), NULL));
|
||||
gtk_filter_list_model_set_filter (filter, custom);
|
||||
g_object_unref (custom);
|
||||
assert_model (filter, "5 6 7 8 9 10");
|
||||
assert_changes (filter, "0-5+6");
|
||||
|
||||
custom = gtk_custom_filter_new (is_not_near, GUINT_TO_POINTER (2), NULL);
|
||||
custom = GTK_FILTER (gtk_custom_filter_new (is_not_near, GUINT_TO_POINTER (2), NULL));
|
||||
gtk_filter_list_model_set_filter (filter, custom);
|
||||
g_object_unref (custom);
|
||||
assert_model (filter, "5 6 7 8 9 10");
|
||||
assert_changes (filter, "");
|
||||
|
||||
custom = gtk_custom_filter_new (is_not_near, GUINT_TO_POINTER (4), NULL);
|
||||
custom = GTK_FILTER (gtk_custom_filter_new (is_not_near, GUINT_TO_POINTER (4), NULL));
|
||||
gtk_filter_list_model_set_filter (filter, custom);
|
||||
g_object_unref (custom);
|
||||
assert_model (filter, "1 7 8 9 10");
|
||||
@ -354,14 +354,14 @@ test_incremental (void)
|
||||
{
|
||||
GtkFilterListModel *filter;
|
||||
GtkFilter *custom;
|
||||
|
||||
|
||||
/* everything is filtered */
|
||||
filter = new_model (1000, is_larger_than, GUINT_TO_POINTER (10000));
|
||||
gtk_filter_list_model_set_incremental (filter, TRUE);
|
||||
assert_model (filter, "");
|
||||
assert_changes (filter, "");
|
||||
|
||||
custom = gtk_custom_filter_new (is_near, GUINT_TO_POINTER (512), NULL);
|
||||
custom = GTK_FILTER (gtk_custom_filter_new (is_near, GUINT_TO_POINTER (512), NULL));
|
||||
gtk_filter_list_model_set_filter (filter, custom);
|
||||
g_object_unref (custom);
|
||||
assert_model (filter, "");
|
||||
|
Loading…
Reference in New Issue
Block a user