Commit Graph

59696 Commits

Author SHA1 Message Date
Benjamin Otte
c692b454f8 sortlistmodel: Redo the way we store the items
We need to keep this data around for changes in future commits where we
make the sorting stable.

An important part of the new data handling is that the unsorted list
needs to always be dealt with before the sorted list - upon creation we
rely on the unsorted iter and upon destruction, the sorted sequence
frees the entry leaving the unsorted sequence pointer invalid.

This change does not do any behavioral changes.
2019-12-12 07:47:43 +01:00
Matthias Clasen
3d451f040a Redo sort list model with GtkSorter
Reshuffle the api to take full advantage
of GtkSorter. Update all callers.
2019-12-12 07:47:43 +01:00
Matthias Clasen
72ab1a3b21 Add GtkNumericSorter
This sorter compares numbers obtained from items
by evaluating an expression.
2019-12-12 07:47:43 +01:00
Matthias Clasen
6aea70cb80 Add GtkMultiSorter
This is a sorter that tries multiple sorters in turn.
2019-12-12 07:47:43 +01:00
Matthias Clasen
f496b5892c Add GtkStringSorter
This is a GtkSorter implementation collating strings
2019-12-12 07:47:43 +01:00
Matthias Clasen
451c3cbe35 Add GtkCustomSorter
This is a GtkSorter implementation which uses a GCompareDataFunc.
2019-12-12 07:47:43 +01:00
Matthias Clasen
5b7a386f45 Add GtkSorter
This is a helper object for sorting, similar to GtkFilter.
2019-12-12 07:47:41 +01:00
Benjamin Otte
b88499d49d Add GtkOrdering
This is an enum that we're gonna use soon and it's worth introducing as a
separate commit.

The intention is to have meaningful names for return values in
comparison functions.
2019-12-12 07:47:25 +01:00
Matthias Clasen
de6e65c8cc More expression tests
Test type mismatches, and the this pointer
during evaluation.
2019-12-12 04:39:05 +01:00
Benjamin Otte
88ed0db609 expression: Invalidate bindings before destroying them
Use a weak ref to invalidate bindings. Make sure that this happens
before creating any watches, so that notifies from the
watched expression about changes will not trigger set_property() calls
during dispose()/finalize().

Invalidating also ensures that the watches aren't removed, which can
trigger warnings if the watches are watching the object itself, and the
weak refs cannot be removed anymore.
2019-12-12 04:39:05 +01:00
Benjamin Otte
d1d1708c87 expression: Add gtk_expression_bind()
Add a simple way to bind expressions to object properties. This is
essentially the thing to replace g_object_bind_property().
2019-12-12 04:39:05 +01:00
Benjamin Otte
a1e3d2511c testsuite: Add expression tests 2019-12-12 04:39:05 +01:00
Benjamin Otte
d4e31033a1 expression: Add the ability to watch an expression 2019-12-12 04:39:05 +01:00
Benjamin Otte
62d6a97837 builder: Add support for parsing expressions 2019-12-12 04:39:05 +01:00
Benjamin Otte
b2c5580bb8 filter: Add tests
Some basic tests for GtkFilter
2019-12-12 04:39:05 +01:00
Benjamin Otte
74b5780192 Add GtkMultiFilter, GtkAnyFilter, GtkEveryFilter
GtkMultiFilter is the abstract base class for managing multiple child
filter.
GtkAnyFilter and GtkEveryFilter are the actual implementations.
2019-12-12 04:39:05 +01:00
Benjamin Otte
48861b6d96 filter: Add GtkStringFilter
Users provide a search filter and an expression that evaluates the items
to a string and then the filter goes and matches those strings to the
search term.
2019-12-12 04:39:05 +01:00
Benjamin Otte
3baee2c661 expression: Make property expression allow subexpressions 2019-12-12 04:25:59 +01:00
Benjamin Otte
0b101897fb expression: Add GtkObjectExpression
Weak refs break cycles...
2019-12-12 04:25:59 +01:00
Benjamin Otte
4b4a933b49 Add GtkExpression
GtkExpressions allow looking up values from objects.

There are a few simple expressions, but the main one is the closure
expression that just calls a user-provided closure.
2019-12-12 04:25:59 +01:00
Benjamin Otte
c99c7dcb1e filterlistmodel: Rewrite to use GtkFilter 2019-12-12 04:25:59 +01:00
Benjamin Otte
87b9cb3964 tests: Remove testtreemodel test
testlistview does everything this test does.
2019-12-12 04:25:59 +01:00
Benjamin Otte
381ec83f8a Add GtkCustomFilter 2019-12-12 04:25:59 +01:00
Benjamin Otte
9d43d57f1a Add GtkFilter 2019-12-12 04:25:59 +01:00
Benjamin Otte
56ff557f9f Add GtkDirectoryList
Adds a new listmodel called GtkDirectoryList that lists the children of
a GFile as GFileInfos.

This is supposed to be used by the filechooser.
2019-12-12 04:25:59 +01:00
Benjamin Otte
f2c9d657d8 builder: Turn last dlsym() function into a scope API
Looking up a get_type function by its name is now also part of
GtkBuilderScope.
2019-12-12 04:25:59 +01:00
Benjamin Otte
366fbdc0e5 builder: Add GtkBuilderScope
GtkBuilderScope is an interface that provides the scope that a builder
instance operates in.
It creates closures and resolves types. Language bindings are meant to
use this interface to customize the behavior of builder files, in
particular when instantiating templates.

A default implementation for C is provided via GtkBuilderCScope (to keep
with the awkward naming that glib uses for closures). It is derivable on
purpose so that languages or extensions that extend C can use it.

The reftest code in fact does derive GtkBuilderCScope for its own scope
implementation that implements looking up symbols in modules.

gtk-widget-factory was updated to use the new GtkBuilderCScope to add
its custom callback symbols.
So it does it different from gtk-demo, which uses the normal way of
exporting symbols for dlsym() and thereby makes the 2 demos test the 2
ways GtkBuilder uses for looking up symbols.
2019-12-12 04:25:59 +01:00
Benjamin Otte
a600b473ec builder: Add gtk_builder_set_current_object()
Use it as the default object for expression binds and when connecting
signals. It is intended to work kind of as the "this" object while
parsing. In fact, the term "current object" was stolen from the Java
docs and various C++ tutorials for the this pointer.

Set the current object in gtk_widget_init_template() and
GtkListItemBuilder.

This more-or-less replaces the object passed to
gtk_builder_connect_signals() in GTK3.
2019-12-12 04:25:58 +01:00
Benjamin Otte
864a265184 builder: Add gtk_builder_lookup_object()
... and use it. This function looks up an object like
gtk_builder_get_object() but generates an error on failure.

Unlike the evil function _gtk_builder_lookup_object() which also
generates an error but hides it for later lookup.

Use this to avoid continuing applying properties when an error was
encountered.
2019-12-12 04:25:58 +01:00
Benjamin Otte
72dc0cd5c3 gtk: Add GTK_DECLARE_EXPORTED_TYPE()
This is like G_DECLARE_FINAL_TYPE(), except it doesn't make the class
struct public, so internally all the subclassing in the world can
happen.

Port The whole event controller + gesture machinery to make use of it.

As a side effect, we gained a bunch of missing autocleanups.
2019-12-12 04:25:58 +01:00
Benjamin Otte
e12dae54ea gtk-demo: Don't include "gtk.h" 2019-12-12 04:25:58 +01:00
Benjamin Otte
721d5fcbd6 tests: Set an existing font in testfontchooser 2019-12-12 04:25:58 +01:00
Matthias Clasen
02bbe399df Merge branch 'matthiasc/for-master' into 'master'
widget factory: Fix more grid layout fallout

See merge request GNOME/gtk!1237
2019-12-10 03:05:09 +00:00
Matthias Clasen
41bb40feee widget factory: Fix more grid layout fallout 2019-12-09 21:29:03 -05:00
Benjamin Otte
336d652be5 a11y: We can peek here
Avoids instantiating a11y objects when we don't need to.
2019-12-09 16:35:41 +01:00
Benjamin Otte
d3e8678955 treeview: Don't create a cyclic reference
TreeRowReference refs the proxy object, so don't use proxies.
2019-12-09 16:35:41 +01:00
Benjamin Otte
503d988c1b label: Compute label baselines correctly
When we were switching smallest and widest, we were not switching the
baselines.
2019-12-09 16:35:41 +01:00
Matthias Clasen
9f6d12551f Add GtkTreeListRow type to the docs 2019-12-08 17:58:09 -05:00
Matthias Clasen
43c93d6f85 Add missing listmodel and selection types to the docs 2019-12-08 13:56:47 -05:00
Matthias Clasen
d683d085c0 tree list model: Add a missing annotation
The GtkTreeListModelCreateModelFunc returns
a new reference.
2019-12-08 00:30:32 -05:00
Matthias Clasen
92ab450983 inspector: Avoid critical warnings
We were still using this but it's not defined in the UI xml.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2295
2019-12-07 19:39:02 -05:00
Matthias Clasen
7b14c65b41 Merge branch 'inspector-display' into 'master'
Inspector display

See merge request GNOME/gtk!1234
2019-12-07 23:20:51 +00:00
Matthias Clasen
c89c652401 inspector: Make the css tree respect inspected display
The display is used here to force reparsing the theme
on the right settings object.
2019-12-07 18:07:44 -05:00
Matthias Clasen
f0f57d156b inspector: Make logs respect inspected display 2019-12-07 18:07:05 -05:00
Matthias Clasen
cecf4f2763 inspector: Make inspect button use inspected display
This may not matter, but just for cleanliness.
2019-12-07 18:07:05 -05:00
Matthias Clasen
4eeed47c7b inspector: Make general respect inspected display 2019-12-07 18:07:05 -05:00
Matthias Clasen
bd1f7e057a inspector: Make visual settings respect the inspected display
This is not quite complete, GTK and GSK debug flags
are not per display, and slowdown and text direction
are not either.
2019-12-07 18:07:05 -05:00
Matthias Clasen
174d8b72a5 inspector: Make css editor respect inspected display
Stop using gdk_display_get_default and use the
inspected display instead.
2019-12-07 18:07:05 -05:00
Matthias Clasen
1437b0856c inspector: Make object tree respect inspected display
Stop using gdk_display_get_dfault and use the
inspected display instead.
2019-12-07 14:59:49 -05:00
Matthias Clasen
917181cb67 window: Get rid of the inspector_window static
Use the new per-display inspector plumbing and
stop relying on a static variable.
2019-12-07 14:59:49 -05:00