Commit Graph

3360 Commits

Author SHA1 Message Date
Matthias Clasen
5629ac3c63 Add a list dnd example
Add a test for dnd with listview, gridview and columnview.
2020-06-19 15:26:10 -04:00
Emmanuele Bassi
c7916c8e48 Use the appropriate name for Juneteenth
Juneteenth (a portmanteau of June and nineteenth)[2] (also known as
Freedom Day,[3] Jubilee Day,[4] and Liberation Day,[5]) is an unofficial
American holiday celebrated annually on the 19th of June in the United
States.
        -- https://en.wikipedia.org/wiki/Juneteenth
2020-06-18 17:43:46 +01:00
Matthias Clasen
86718439be testdropdown: Add some more tests
Add a homegrown combobox entry replacement that
combines a dropdown with a plain entry.
2020-06-12 08:49:01 -04:00
Matthias Clasen
8c670b3b5d testcolumnview: Add recent file support
Use testcolumnview --recent to see recent files.
2020-06-11 16:14:47 -04:00
Emmanuele Bassi
6b096e5c5b Make tooltip properties idiomatic
The tooltip handling in GtkWidget is "special":

 - the string is stored inside the qdata instead of the private
   instance data
 - the accessors call g_object_set() and g_object_get(), and the
   logic is all inside the property implementation, instead of
   being the other way around
 - the getters return a copy of the string
 - the setters don't really notify all the involved properties

The GtkWidgetAccessible uses the (escaped) tooltip text as a source for
the accessible object description, which means it has to store the
tooltip inside the object qdata, and update its copy at construction and
property notification time.

We can simplify this whole circus by making the tooltip properties (text
and markup) more idiomatic:

 - notify all side-effect properties
 - return a constant string from the getter
 - if tooltip-text is set:
   - store the text as is
   - escape the markup and store it separately for the markup getter
 - if tooltip-markup is set:
   - store the markup as is
   - parse the markup and store it separately for the text getter

The part of the testtooltips interactive test that checks that the
getters are doing the right thing is now part of the gtk testsuite, so
we ensure we don't regress in behaviour.
2020-06-05 20:32:26 +01:00
Matthias Clasen
371dab51bb Add GtkDropDown
This is a simple drop down control using list models.
2020-05-30 19:31:38 -04:00
Matthias Clasen
e3ce99988f Add GtkTreeListRowSorter
This is a special-purpose sorter that can
apply the sorting of another sorter to the
levels of a GtkTreeListModel.
2020-05-30 19:30:14 -04:00
Benjamin Otte
fb78f1ef8e testcolumnview: Add sorters 2020-05-30 19:28:30 -04:00
Benjamin Otte
9f19699806 tests: Add testcolumnview 2020-05-30 19:26:46 -04:00
Benjamin Otte
30f09ea10b listitem: Make this a GObject
This splits GtkListItem into 2 parts:

1. GtkListItem
   This is purely a GObject with public API for developers who want to
   populate lists. There is no chance to cause conflict with GtkWidget
   properties that the list implementation assumed control over and
   defines a clear boundary.
2. GtkListItemWidget
   The widget part of the listitem. This is not only fully in control of
   the list machinery, the machinery can also use different widget
   implementations for different list widgets like I inted to for
   GtkColumnView.
2020-05-30 19:26:46 -04:00
Benjamin Otte
affd2737d5 gridview: Implement minimum row height
We only allocate a certain amount of widgets - and we don't want to run
out of them. So we make all widgets high enough for this to never
happen.
2020-05-30 19:26:46 -04:00
Benjamin Otte
7451e51619 Add GtkTreeExpander
This is a container widget that takes over all the duties of tree
expanding and collapsing.
It has to be a container so it can capture keybindings while focus is
inside the listitem.

So far, this widget does not allow interacting with it, but it shows the
expander arrow in its correct state.

Also, testlistview uses this widget now instead of implementing
expanding itself.
2020-05-30 19:26:45 -04:00
Benjamin Otte
626c525706 listview: Expose GtkListItemFactory APIs
Due to the many different ways to set factories, it makes sense to
expose them as custom objects.

This makes the actual APIs for the list widgets simpler, because they
can just have a regular "factory" property.

As a convenience function, gtk_list_view_new_with_factory() was added
to make this whole approach easy to use from C.
2020-05-30 19:26:45 -04:00
Benjamin Otte
360a728d77 tests: Add a rough form of multiselection
Just store a "filechooser::selected" attribute in the GFileInfo if
the file is meant to be selected.
2020-05-30 19:26:45 -04:00
Benjamin Otte
7c38ac1954 testlistview: Load icons async
Speeds up loading by 4x, because out of view icons aren't loaded
anymore.
2020-05-30 19:26:45 -04:00
Benjamin Otte
dbe802f685 testlistview: Port to directory list 2020-05-30 19:26:45 -04:00
Benjamin Otte
d8eec549f0 testlistview: Create widgets only once
Previously, we were recreating all widgets every time the list item was
rebound, which caused a lot of extra work every time we scrolled.

Now we keep the widgets around and only set their properties again when
the item changes.
2020-05-30 19:26:45 -04:00
Benjamin Otte
7389e704dc testlistview: Show the row number
Always show the current row. This is mostly useful for debugging, not
for beauty.
2020-05-30 19:26:45 -04:00
Benjamin Otte
e5add36a17 listview: Change how binding is done
We now don't let the functions create widgets for the item from the
listmodel, instead we hand out a GtkListItem for them to add a widget
to.

GtkListItems are created in advance and can only be filled in by the
binding code by gtk_container_add()ing a widget.
However, they are GObjects, so they can provide properties that the
binding code can make use of - either via notify signals or GBinding.
2020-05-30 19:26:45 -04:00
Benjamin Otte
378a573cf4 tests: Make animating listview do random resorts 2020-05-30 19:26:45 -04:00
Benjamin Otte
d03a55599b tests: Add a test for a permanently changing listview
This is mostly for dealing with proper anchoring and can be used to
check that things don't scroll or that selection and focus handling
properly works.

For comparison purposes, a ListBox is provided next to it.
2020-05-30 19:26:44 -04:00
Benjamin Otte
c835ae2a02 listview: Make widget actually do something
The thing we're actually doing is create and maintain a widget for every
row. That's it.

Also add a testcase using this. The testcase quickly allocates too many
rows though and then becomes unresponsive though. You have been warned.
2020-05-30 19:26:44 -04:00
Benjamin Otte
b1090ac8e2 tests: Remove testtreemodel test
testlistview does everything this test does.
2020-05-30 12:30:23 -04:00
Yuri Chornoivan
01bd4cc4e1 Fix minor typos 2020-05-28 11:00:03 +03:00
Timm Bäder
eebc2f20fa testgtk: Add G_GNUC_NORETURN to usage() 2020-05-19 08:32:33 +02:00
Matthias Clasen
75d9310986 Change coordinate translation apis to take doubles
Change gtk_widget_translate_coordinates and
gtk_native_get_surface_transform to operate
on doubles. Update all callers.
2020-05-17 17:17:31 -04:00
Matthias Clasen
c0faf0c6b6 Merge branch 'toplevel-move-resize' into 'master'
Toplevel move resize

See merge request GNOME/gtk!1923
2020-05-17 19:15:46 +00:00
Benjamin Otte
b353221185 Merge branch 'wip/otte/monitors' into 'master'
various GDK cleanups

See merge request GNOME/gtk!1920
2020-05-17 16:57:52 +00:00
Matthias Clasen
f316fe0f58 window: Use toplevel begin_move/resize api
The GdkSurface api for this is going away.
2020-05-17 12:49:26 -04:00
Benjamin Otte
4c7914dc49 display: Remove unneeded getters
Applications can use the listmodel instead.
2020-05-17 07:32:37 +02:00
Timm Bäder
c4363e2706 showrendernode: Set widget overflow 2020-05-16 22:04:00 +02:00
Matthias Clasen
dcfb4690c3 tests: Drop testdnd3
This has been integrated in gtk4-demo as the
DND example.

See #2738
2020-05-14 20:32:53 -04:00
Matthias Clasen
9e8d845a61 tests: Rename testheaderbar2 to testheaderbar
There is only one headerbar test now.
2020-05-14 20:15:59 -04:00
Matthias Clasen
1e2b5a9c19 tests: Consolidate all headerbar tests
No need to have several binaries for this.

See #2738
2020-05-14 20:15:31 -04:00
Matthias Clasen
4079b782d6 tests: Drop testorientable
Not really that interesting, and it only
tests a single case of orientable, a box.

See #2738
2020-05-14 19:48:08 -04:00
Matthias Clasen
dca142d5d2 tests: Drop testemblems
We no longer support emblems on icons.

See #2738
2020-05-14 19:44:54 -04:00
Matthias Clasen
52c630d994 tests: Drop testgiconpixbuf
More a pixbuf test, and we don't support
emblems anymore.

See #2738
2020-05-14 19:44:08 -04:00
Matthias Clasen
aadd9ae201 tests: Drop testbuttons
This does not really add much. We have plenty
of different button styles in our demos and
tests.

See #2738
2020-05-14 19:44:05 -04:00
Matthias Clasen
c1658903b7 Merge branch 'tests-cleanup' into 'master'
Tests cleanup

See merge request GNOME/gtk!1894
2020-05-13 22:19:55 +00:00
Matthias Clasen
8e6ec0b8a3 tests: Fix scrolling performance test
Maybe this should be added to the benchmarks section
in gtk-demo. For now, fix it to work again.
2020-05-13 17:10:00 -04:00
Matthias Clasen
25577e4fbf tests: Drop testnoscreen
It tests something that no longer works, and that
we probably don't want to guarantee anyway.

See #2738
2020-05-13 16:35:28 -04:00
Matthias Clasen
dc8c37120e tests: Drop testexpander
This was copied into gtk4-demo at some point.

See #2738
2020-05-13 16:23:48 -04:00
Matthias Clasen
a375c41510 tests: Drop testfontchooser
This test adds nothing over the font choosers in
our various demos.

See #2738
2020-05-13 16:18:50 -04:00
Matthias Clasen
b8e905eae7 tests: Drop testcolorchooser
We have plenty of color choosers in demos.
This test doesn't add anything.

See #2738
2020-05-13 16:15:09 -04:00
Matthias Clasen
b0fcf64544 tests: Drop testbox
Not useful enough to keep.

See #2738
2020-05-13 16:04:00 -04:00
Matthias Clasen
604f4cf8bf tests: Drop testcolorchooser2
This tests an embedded colorchooser. Just like we have in
widget-factory. And it doesn't work in !srcdir builds, so
it can go.

See: #2738
2020-05-13 15:55:29 -04:00
Matthias Clasen
1420e846b5 tests: Drop testicontheme
This is a command line utility for GtkIconTheme
that is probably not as useful as gtk4-icon-browser.

See: #2738
2020-05-13 15:55:21 -04:00
Matthias Clasen
c3aeac19bc tests: Drop testpixbuf-scale
This looks like a GdkPixbuf utility, and we
are moving away from GdkPixbuf anyway.

See: #2738
2020-05-13 15:55:18 -04:00
Matthias Clasen
deef018c68 tests: Drop testtoolbar2
This is just a tool bar styling test; we have
the same in the widget factory.

See: #2738
2020-05-13 15:37:21 -04:00
Matthias Clasen
fe6238d1c4 tests: Drop the visuals test
This was just a different way to load a ui file
and try it with dark mode. This can be done
with gtk-builder-tool preview and GTK_THEME.
2020-05-12 15:56:46 -04:00