Commit Graph

2211 Commits

Author SHA1 Message Date
Timm Bäder
3a1e019e83 print-editor: Fix a wrong comparison
If error is NULL, replacing the file contents worked and we don't
show the error dialog. The previous version pretty explicitly
dereferenced a NULL pointer by first ensuring that error is NULL and
then accessing error->message.

Found by scan-build
2020-10-22 17:46:33 +02:00
Matthias Clasen
44c6619660 gtk-demo: Speed up image demo
The progressive loading demo here was so slow as to appear
broken. Make it faster, and ensure that it updates regularly.
2020-10-22 07:51:44 -04:00
Matthias Clasen
ef7499a31b gtk-demo: Add alternative text to a GtkPicture
This lets us text GtkPicture a11y support.
2020-10-22 07:51:44 -04:00
Matthias Clasen
80e0e3fe4f gtk-demo: Set an accessible role
Set the expected accessible role on the tagged entry
widget in the demo of the same name. Accessible tools
may decide to ignore widgets that have the wrong role,
so setting an appropriate role is important.
2020-10-19 12:56:50 -04:00
Matthias Clasen
92585b75fa Fix compiler warnings 2020-10-15 16:33:35 -04:00
Matthias Clasen
0bd5a96d71 gtk-demo: Fix some issues with the multi view demo
The nested window was not modal, causing it to be
inoperable. And the nested views within were all
shrunk down to nothingness. Give them some width.

Fixes: #3257
2020-10-15 14:42:43 -04:00
Matthias Clasen
8cf955731f gtk-demo: Fix up image handling in the clipboard demo
Using GtkIconPaintable+GtkPicture is not good for symbolic
icons - they don't get properly colored that way. So change
things around to use the icon name if we have it.

Fixes: #3252
2020-10-15 09:19:17 -04:00
Timm Bäder
20bd8e56ee gtk4-demo: Add missing margin-bottom
This was setting margin-end twice
2020-10-14 15:06:12 -04:00
Timm Bäder
df2d7c56c7 gtk4-demo: Remove connection to removed signal 2020-10-14 15:06:12 -04:00
Timm Bäder
0dc0b03d6f glarea demo: Add min size to gl area 2020-10-14 15:06:12 -04:00
Matthias Clasen
8a361f901d gtk-demo: Keep undisplayable resources out of view
No point in showing an apologetic tab for a blob of binary data.
gtk4-demo shows the resources under /DEMONAME/ for each demo,
so move the data to /DEMONAME_data/.
2020-10-14 15:05:46 -04:00
Matthias Clasen
2273e27808 gtk-demo: Ellipsize columns in the characters demo
some of the columns have uneven widths, causing them
to bounce around as you scroll. Ellipsize them and
give them a fixed with.
2020-10-14 15:05:46 -04:00
Emmanuele Bassi
43300b4047 Tone down a user visible message
Self-deprecating humour badly translates to a demo message.
2020-10-09 10:14:41 +01:00
Matthias Clasen
3d9eb61bba gtk-demo: Fix an off-by-one error
This was found by the asan build in our ci.
2020-10-07 15:16:31 -04:00
Matthias Clasen
5a9547da41 gtk-demo: Add an svg paintable demo
It is a little annoying that this demo will not show up
if we don't find librsvg, but I think showing how easy
this paintable is outweights the annoyance.
2020-10-06 15:12:09 -04:00
Matthias Clasen
25cbc1a15a gtk-demo: Recognize .svg as images
We can't guarantee that we can load it, but worst
case you'll get a missing image.
2020-10-06 15:11:08 -04:00
Matthias Clasen
67c6f0a08a gtk-demo: Mention dataset size for Characters 2020-10-05 14:43:38 -04:00
Matthias Clasen
74d99766e4 gtk-demo: Fix up the Characters demo
Move the Unicode names to a separate source file,
and only build the demo if we have harfbuzz (since
we use script names, and those are only available
with harfbuzz).

Also, fix a forgotten type name.
2020-10-05 09:56:04 -04:00
Matthias Clasen
5d26d11868 gtk-demo: Add a column view demo
Make a column view that is showing some Unicode data.
2020-10-04 22:53:45 -04:00
Matthias Clasen
34f33b36f8 Prevent a crash with script names
We can't pass NULL to gettext().
2020-10-04 21:20:48 -04:00
Matthias Clasen
bea3bc5d27 Update the copy in gtk-demo too 2020-10-04 19:48:46 -04:00
Matthias Clasen
8ca612c966 scale: Make draw-value default to FALSE
This is rarely what you want, so lets turn it off
by default.

Update the one place in our demos where we want to
draw a value, add support for this to gtk-builder-tool,
add a test and mention this change in the migration
guide.
2020-10-04 08:26:44 -04:00
Matthias Clasen
9a2faf2197 widget-factory: Enable emoji completion somewhere
Without a quick way to test this, it is bound to
fall apart. As it has.
2020-10-03 19:41:26 -04:00
Matthias Clasen
5640208f31 node-editor: Don't insert hyphens
This can be a bit confusing in multi-line strings.
2020-10-03 13:11:20 -04:00
Matthias Clasen
279d3c08a9 gtk-demo: Rename the transition shader files
Easier to find them when their name matches the title
that we show in the UI.
2020-10-03 00:01:25 -04:00
Matthias Clasen
19d760f9dd gtk-demo: Fix a typo 2020-10-02 23:54:15 -04:00
Matthias Clasen
72eb89eda7 gtk-demo: Add the shader paintable sources
This is currently not public GTK api, just part of
the demo. So we should show it here.
2020-09-30 15:41:05 -04:00
Matthias Clasen
fd631937f3 transition demo: Make buttons symbolic
It looks better.
2020-09-30 13:43:36 -04:00
Matthias Clasen
77ec961126 Merge branch 'ebassi/for-master' into 'master'
demo: Replace g_print with g_debug

See merge request GNOME/gtk!2645
2020-09-30 15:22:57 +00:00
Matthias Clasen
924e510512 gtk-demo: Update text for the transitions demo
The fire is gone, but we have wobbly widgets!
2020-09-30 11:19:12 -04:00
Alexander Larsson
d6648871b1 gtk-demo/gltransition: Replace fire background with more mellow blobs 2020-09-30 16:38:50 +02:00
Alexander Larsson
5d4a6940fa gtk-demo: Use duck in transitions to get some alpha example 2020-09-30 16:25:30 +02:00
Emmanuele Bassi
b0a0f07bd7 demo: Replace g_print with g_debug
The GtkGears widget is a bit too chatty, especially when used inside
demos like the fishbowl. Let's use g_debug() instead of g_print() for
the GL debugging message.
2020-09-30 12:35:31 +01:00
Alexander Larsson
e9885f9cde gtk-demo: Make gltransitions demo a bit snazzier
This adds a bunch of snazz to the gltransitions demo. It is perhaps
a bit overloaded now, but it demos everything that we can do.

Changes:
 * The fire shader is now not a bin, it just renders an animating
   background with no textures involved.
 * The stacks don't all start on the same page.
 * The shaderbin passes the mouse coordinate to the shader.
 * The shaderbin allows specifying a "border" so that you can
   cause effects outside the bin child (something that is new to gtk4).
 * All the buttons and the stacks are now in shader-bins that runs
   a wobbly-widget effect based on the mouse position that
   wobbles outside the child allocation.
2020-09-30 11:40:37 +02:00
Alexander Larsson
e76cb3e1e4 gtk-demo: Add a shader paintable to the fishbowl
This gets around 500 instances at 60fps on my system.
2020-09-29 09:51:16 +02:00
Alexander Larsson
8bcb031418 gtk-demo: Add GskGLShaderNode demo
Add adds a demo showing off GskGLShaderNode in various ways.

It has a transistion widget, using some examples from
gl-transitions.com, with child widgets being both images, a GL area
and real widgets (that let you edit the transition shaders
themselves.

It also has a fancy fire effect on hove on the buttons.
2020-09-29 09:51:16 +02:00
Alexander Larsson
16cdb33c6c shadertoy demo: Fix GLSL on GLES
I was getting "assignment to varying fragColor" errors
2020-09-29 09:51:16 +02:00
Florian Müllner
12189bc10f buildable: Rename set_name() to set_buildable_id()
GtkBuildable's get_name()/set_name() methods may shadow
GtkWidget's methods. Avoid that by renaming the API to
get_buildable_id()/set_buildable_id(), which also reflects
the name of the XML attribute the API refers to.

https://gitlab.gnome.org/GNOME/gtk/-/issues/3191
2020-09-26 02:16:05 +02:00
Matthias Clasen
d5e315c470 gtk-demo: Improve the pickers demo
"Two of every kind..." Add some customized pickers
here. This found a number of issues that have been
fixed in the preceding commits.
2020-09-21 11:53:48 -04:00
Matthias Clasen
6b708e9b60 textbuffer: Redo insert markup a little bit
Redo the tag insertion function to avoid quadratic
behavior, and at the same time, fix handling of
alpha for color attributes.

Update the copy of this function in gtk4-demo
as well.
2020-09-19 14:17:28 -04:00
Matthias Clasen
a8adbfbc9f gtk-demo: Cosmetic changes
Polish the text view demos a little bit.
2020-09-17 21:38:10 -04:00
Matthias Clasen
cf1ed3a72a gtk-demo: Fix toggle- vs checkbutton confusion 2020-09-16 23:07:21 -04:00
Matthias Clasen
18e46bd6f8 gtk-demo: Beef up the hypertext demo
Its almost a dictionary.
2020-09-16 23:01:49 -04:00
Matthias Clasen
a1e21c1acb Merge branch 'wip/sadiq/headerbar-demo' into 'master'
gtk-demo: Add a switch to headerbar demo

See merge request GNOME/gtk!2571
2020-09-16 23:12:26 +00:00
Matthias Clasen
d71337513f gtk-demo: Add another demo
Show how to add a context menu to a custom widget,
and how to make a GtkPicture lookalike.
2020-09-15 22:40:13 -04:00
Matthias Clasen
e4d29ba9fd Merge branch 'master.win32' into 'master'
Some more fixes for Windows

Closes #3157

See merge request GNOME/gtk!2580
2020-09-15 11:12:27 +00:00
Matthias Clasen
9eb4eef48b Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2582
2020-09-15 11:04:54 +00:00
Chun-wei Fan
c766e31e8f demos: Fix minesweeper demos on Windows
Make sure the callback functions in the .ui files are exported, so that
those functions can be recognized at runtime so that things run
properly.
2020-09-15 15:53:20 +08:00
Timm Bäder
d0f182757a sizegroup demo: Fix a checkbutton/togglebutton mixup 2020-09-15 05:21:54 +02:00
Matthias Clasen
50400879e0 gtk-demo: Add more detail to the dnd demo text 2020-09-14 17:49:16 -04:00
Matthias Clasen
b20e67dc83 gtk-demo: Add some keywords
Make the builder demo show up in searches for toolbar and
menubar.
2020-09-14 17:33:12 -04:00
Matthias Clasen
a3dcfafba6 gtk-demo: Improve the builder demo
Make the keyboard shortcuts work.
2020-09-14 17:06:34 -04:00
Matthias Clasen
82ce1a9d6b gtk-demo: Improve the builder demo
Make the toolbar look right.
2020-09-14 16:51:05 -04:00
Matthias Clasen
cc6faeab50 gtk-demo: More space
Increase the inter-paragraph spacing in the info
text, to make paragraphs more clearly separated.
2020-09-14 16:21:13 -04:00
Matthias Clasen
aa32613beb gtk-demo: Cosmetic change 2020-09-14 16:20:52 -04:00
Matthias Clasen
6a3e12cfae gtk-demo: Add some details 2020-09-14 16:11:11 -04:00
Matthias Clasen
7a2400c8a1 widget-factory: Fix the toggle buttons on page 3
They should not both be active initially.
2020-09-14 11:19:39 -04:00
Jakub Steiner
7dd819dffc icon-browser: use content-view
- make content prominent by using content-view style for the main grid.
2020-09-14 14:18:52 +02:00
Mohammed Sadiq
bd900fe8c9 gtk-demo: Add a switch to headerbar demo
We don't have any demos with a switch in headerbar.
2020-09-14 17:11:13 +05:30
Matthias Clasen
9f03462ffb gtk-demo: Improve the scrolling demo
Add an fps label to the scrolling demo.
2020-09-13 23:43:45 -04:00
Matthias Clasen
3b11896581 gtk-demo: Impove the fishbowl demo
Use tnum for the fps label to avoid jiggling.
2020-09-13 23:43:45 -04:00
Matthias Clasen
c66a8cb941 gtk-demo: Use gdk_frame_clock_get_fps
Remove another copy of this code in the theme
switching benchmark.
2020-09-13 23:43:45 -04:00
Matthias Clasen
9d6990fdb9 gtk-demo: Don't offer to run titles
When a group is selected (such as 'Benchmark'),
make the run button insensitive - there is nothing
to run.
2020-09-13 17:55:10 -04:00
Matthias Clasen
3f1fa66479 Demo thyself
Make gtk-demo show itself as a useful example.
2020-09-13 17:54:58 -04:00
Matthias Clasen
d732c869c2 gtk-demo: Add keywords to demos
Add the names of the main widgets as keywords to
our demos, but also things like "game". This helps
finding relevant demos in our growing list. You
can now for example type "label", and find the
"error states" and "links" demos showing GtkLabel
features.
2020-09-13 15:00:14 -04:00
Matthias Clasen
691261c71a gtk-demo: Support keywords for search
Filter the sidebar on keywords that can be provided
by the demos. We extract keywords from the doc comment
at the top of each demo source by looking for words that
look like class names. We also allow to specify keywords
explicitly.
2020-09-13 15:00:14 -04:00
Matthias Clasen
fe6f70efe1 gtk-demo: Ignore some lines in info
Ignore lines starting with # in the info comment at
the top of source files. This will be used to add
keywords for search in following commits.
2020-09-13 14:42:03 -04:00
Matthias Clasen
a90801e696 gtk-demo: Add another demo
This one is a more or less direct copy of the
settings dialog from widget-factory, demonstrating
error states and builder scopes.
2020-09-13 12:36:30 -04:00
Matthias Clasen
7518fd0d70 gtk-demo: Make F11 toggle fullscreen
In the video player demo, we have a button to make
the window fullscreen, but no easy way back. Add
the usual F11 keybinding, to make things at least
somewhat recoverable.
2020-09-13 02:31:41 -04:00
Matthias Clasen
52304fe7da gtk-demo: Add some example videos
Add buttons to show the gtk-logo animation and
the Big Buck Bunny trailer.
2020-09-13 01:51:55 -04:00
Matthias Clasen
8f593827cf widget-factory: Fix error states demo
Fix a corner case of input validation in the settings
dialog.
2020-09-13 00:17:19 -04:00
Matthias Clasen
fc720b57e2 gtk-demo: Don't refer to removed demos
The animated background demos was referring to the
pixbuf demo that was removed a while ago. Reword
the text accordingly.
2020-09-13 00:17:19 -04:00
Matthias Clasen
71ea619274 gtk-demo: Add an emblem demo
Add a simple demo for adding emblems to icons
using GdkPaintable.
2020-09-11 21:09:41 -04:00
Matthias Clasen
f679ba566e gtk-demo: Tweak the animated paintable
Make it possible to have no background in
the animated paintable. This will be used
in a future demo.

Update all users.
2020-09-11 21:08:36 -04:00
Matthias Clasen
2679e29375 gtk-demo: Fix a few crash
The paintable demos were forgetting to clear
their window variable.
2020-09-11 21:07:10 -04:00
Matthias Clasen
93078e52c0 gdk: Rename GdkSurfaceState to GdkToplevelState
That is what it is.

Fixes: #2790
2020-09-10 00:39:03 -04:00
Matthias Clasen
d6807b966c shadertoy demo: Cosmetic fixes 2020-09-08 20:08:23 -04:00
Matthias Clasen
3921476504 Merge branch 'shadertoy-demo' into 'master'
gtk-demo: Add shadertoy demo

See merge request GNOME/gtk!2540
2020-09-08 23:47:54 +00:00
Andreas Persson
81c835c418 Fix warning in listview_settings demo
Fix a warning introduced when sorter constructors were changed to return
exact types.
2020-09-08 18:48:54 +02:00
Matthias Clasen
cb2b0688ca Merge branch 'filter-constructors' into 'master'
Filter constructors

See merge request GNOME/gtk!2360
2020-09-08 12:58:27 +00:00
Alexander Larsson
0092a08dfc gtk-demo: Add shadertoy demo
This adds a small demo of using OpenGL shaders, it renders a quad
over the entire widget with a custom fragment shader. The coordinates
and the uniform names are compatible with the ones on shadertoy.com
(although some features, like texture inputs are missing currently).

The default shader in the demo is
https://www.shadertoy.com/view/wsjBD3 which is CC0, so it is
redistributable by Gtk+ (most other shaders are CC-BY-NC-SA which
isn't obviously compatible). I also added a set of buttons loading
a few other CC0 shaders I found.
2020-09-08 09:56:25 +02:00
Matthias Clasen
8c8baa9aa6 gtk-demo: Add some comments
Add some comments to the math in the transforms demo.
2020-09-06 08:43:58 -04:00
Matthias Clasen
8b38d1895c gtk-demo: Simplify the constraints demos
Give them all a close button in the header.
2020-09-05 22:54:16 -04:00
Matthias Clasen
24389a0ef5 Make sorter constructors return exact types
Make functions like gtk_custom_sorter_new() return
the actual type they construct.

Update all callers.
2020-09-05 21:50:15 -04:00
Matthias Clasen
dfabe74c59 Make filter constructors return exact types
Make functions like gtk_custom_filter_new() return
the actual type they construct.

Update all callers.
2020-09-05 21:43:42 -04:00
Ahmed Eldemery
cbd3158d91 add a missing comma 2020-09-05 13:49:01 +02:00
Matthias Clasen
c1bf9f3b41 layoutmanager demo: Make icons come out upright
Rearrange the vertices so that the icons show
up in the proper orientation.
2020-09-04 13:40:10 -04:00
Benjamin Otte
1a445d79c4 Merge branch 'demo_css_pixbufs_fix' into 'master'
gtk-demo: Fix CSS in pixbufs demo

See merge request GNOME/gtk!2529
2020-09-04 14:40:36 +00:00
Björn Daase
3bcbb4a7cc gtk-demo: Fix CSS in pixbufs demo 2020-09-04 16:14:09 +02:00
Matthias Clasen
acc2516b3c Add another layout manager demo
This demo uses transforms to place icons on a sphere.
2020-09-03 10:09:22 -04:00
Matthias Clasen
fd7a9069ce Cosmetic improvement to the layout manager demo
Give this a better title, since we will have more
than one layout manager demo soon.
2020-09-03 10:09:22 -04:00
Matthias Clasen
b628338db3 list widgets: Simplify the constructors
Now that both arguments to the _new_with_factory() constructors
are nullable, there's no good reason to keep a separate _new()
around. Just make gtk_list_view_new() and gtk_grid_view_new()
take both a model and a factory.
2020-09-01 12:24:06 -04:00
Matthias Clasen
8d79a32c50 list widgets: Use selection models in the api
Change the apis in GtkListView, GtkColumnView and
GtkGridView to be explicitly about GtkSelectionModel,
to make it obvious that the widgets handle selection.

Update all users.
2020-08-31 17:15:05 -04:00
Matthias Clasen
ccb447da02 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

Closes #2777

See merge request GNOME/gtk!2503
2020-08-31 16:30:21 +00:00
Matthias Clasen
b98352de3e widget-factory: Stop using radio buttons
Use grouped toggle buttons for the view switcher
on page 2.
2020-08-30 22:17:31 -04:00
Matthias Clasen
1125a4379c iconbrowser: Stop using radio buttons
Replace them with grouped toggle buttons.
2020-08-30 22:14:05 -04:00
Matthias Clasen
f085ac837c fontrendering demo: Stop using radio buttons
Replace them with grouped toggled buttons.
2020-08-30 22:14:05 -04:00
Matthias Clasen
2c5c938f0d Clean up uses of gtk_toggle_button_get/set_active
Replace all uses on check buttons by the corresponding
check button api.
2020-08-30 21:23:25 -04:00
Matthias Clasen
c9eb497989 gtk-demo: Fix up the fontrendering demo 2020-08-30 21:23:14 -04:00
Matthias Clasen
7a05381825 gtk-demo: Port to font explorer to grouped checkbuttons
Stop using radio buttons here.
2020-08-30 17:59:23 -04:00