Commit Graph

1959 Commits

Author SHA1 Message Date
Benjamin Otte
bb7968ba77 demo: Add a GSettings tree demo
It is meant to look somewhat like dconf-editor when it is done.

So far, it's just a list.
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
2ef2148fb5 gtk-demo: Add a rough start at a Weather demo
This demos a horizontal listview.
2020-05-30 19:26:45 -04:00
Benjamin Otte
d3dc9c41b4 gtk-demo: Make fishbowl info text use bindings
It's a good demo for how bindings can format multiple properties into an
informative string with 1 line of code (and 5 lines of XML).
2020-05-30 19:26:44 -04:00
Benjamin Otte
4abdf695e3 filterlistmodel: Rewrite to use GtkFilter 2020-05-30 12:30:23 -04:00
Alexander Larsson
0bd039a524 gtk-demo: Don't show main window if --run is passed in
Also, in that case, exit when the demo window is closed.
2020-05-29 13:51:31 +02:00
Matthias Clasen
1f4130b927 widget-factory: Add a mnemonic conflict
Make Alt-e the mnemionic for both the Edit menu
and the Select button on page 2. This shows that
mnemonic cycling doesn't currently work, we always
open the menu.
2020-05-28 08:34:06 -04:00
Yuri Chornoivan
01bd4cc4e1 Fix minor typos 2020-05-28 11:00:03 +03:00
Matthias Clasen
5317e4bc07 constraint-editor: Don't use g_type_ensure
This isn't necessary if we export the get_type function.
2020-05-25 14:14:28 -04:00
Matthias Clasen
ffa5334a2d Merge branch 'matthiasc/for-master' into 'master'
gtk-demo: Fix the dnd demo drop highlight

See merge request GNOME/gtk!1958
2020-05-23 00:05:16 +00:00
Matthias Clasen
5f6d072459 gtk-demo: Fix the dnd demo drop highlight
We want the drop highlight to be around the label,
not around the item containing it, so move the drop
target gesture to the right widget.
2020-05-22 18:52:56 -04:00
Matthias Clasen
d5da3b9199 print-editor: Stop using appmenu apis
The appmenu-related GtkApplication apis are going away.
2020-05-22 17:31:05 -04:00
Matthias Clasen
ca1c570c21 gtk-demo: Stop using appmenu apis
The appmenu-related GtkApplication apis are going away.
2020-05-22 17:31:05 -04:00
Matthias Clasen
0f053d1804 gtk-demo: Improve rotation in the dnd demo
Make the drag icon preserve the rotation, and improve
placement for the editor and for dnd to take the offset
into account.
2020-05-22 15:38:02 -04:00
Matthias Clasen
7fac6b37db gtk-demo: Improve editing in the dnd demo
Add a scale for the angle, make the edits apply immediately,
and keep the item visible.
2020-05-22 14:06:00 -04:00
Matthias Clasen
d2f979ffaf gtk-demo: Improve drag icon handling in dnd example
Make the opacity change only apply to the 'ghost' of
the item, not the drag icon.
2020-05-22 13:25:17 -04:00
Matthias Clasen
e54060bac2 gtk-demo: Fix entry position in dnd demo
gtk_fixed_get_child_position does not work if children
have transforms that are not just 2D translations.
Use gtk_widget_translate_coordinates instead.
2020-05-22 13:17:59 -04:00
Matthias Clasen
965483eb67 gtk-demo: Reorganize the dnd demo
Introduce a CanvasItem widget to make things a
bit less ad hoc.
2020-05-22 12:35:18 -04:00
Matthias Clasen
028bccc188 gtk-demo: Use proper drag icons in the dnd demo
Use a widget paintable to make the drag icon appear
in two places at once.
2020-05-22 10:50:09 -04:00
Matthias Clasen
8f5444c75b gtk-demo: Fix breakage in a css demo
This is fallout from container api changes. We
were treating a GtkOverlay like a GtkBox, which
it isn't.
2020-05-21 16:24:56 -04:00
Matthias Clasen
96c0fbf209 gtk-demo: Plug another leak
We were leaking the builder in the css blendmodes demo,
by creating a ref cycle. This was showing up as
the list entry not going back to upright after
closing the window.
2020-05-21 16:24:20 -04:00
Matthias Clasen
98178d8823 gtk-demo: Plug another leak
We were leaking the builder in the revealers demo,
by creating a ref cycle. This was showing up as
the list entry not going back to upright after
closing the window.
2020-05-21 16:23:42 -04:00
Matthias Clasen
3f6dd34b18 gtk-demo: Plug another leak
We were leaking the builder in the cursors demo,
by creating a ref cycle. This was showing up as
the list entry not going back to upright after
closing the window.
2020-05-21 15:41:54 -04:00
Matthias Clasen
aaed61de66 gtk-demo: Plug a leak
We were leaking the builder in the builder demo,
by creating a ref cycle. This was showing up as
the list entry not going back to upright after
closing the window.
2020-05-21 15:41:48 -04:00
Timm Bäder
4b5a8c45b4 gtk4-demo: Fix css_basics demo 2020-05-20 10:29:50 +02:00
Timm Bäder
ae54517b33 gtk4-demo: Fix sliding puzzle demo 2020-05-20 10:29:50 +02:00
Chun-wei Fan
a4416e389a print-editor demo: Fix linking on Visual Studio
We need to pass in '/entry:mainCRTStartup' as we did for the other demo
programs that have 'gui_app: true' in their Meson build settings.
2020-05-18 11:35:52 +08:00
Matthias Clasen
3035bf1e39 widget-factory: Cosmetics
Add a frame around the white background in the background
selection dialog. Otherwise, it is not really visible.
2020-05-16 21:54:14 -04:00
Alexander Larsson
32f58e6c0b gtk-demo/dnd: Fix up drag_cancel
This needs to return a boolean, also it should not call end because
that will be called anyway by Gtk+ after cancel, and this was causing
warnings due to the opacity being unset with no dragged widget set.
2020-05-14 10:45:38 +02:00
Alexander Larsson
707229ce17 gtk-demo/dnd: Use gtk_popover_set_child(), not gtk_box_append 2020-05-14 10:13:05 +02:00
Matthias Clasen
7eaa10dd8e gtk-demo: Fix a problem with the dnd demo
When I move this into gtk-demo, I broke the hack
that ensures the GtkColorSwatch type is registered.
Bring it back.
2020-05-14 01:16:56 -04:00
Matthias Clasen
102e7d0838 widget-factory: Ensure we have some backgrounds
The flowbox demo is otherwise less than useful,
if /usr/share/gnome/backgrounds isn't present.

At the same time, give the scale in the listbox
some function.
2020-05-14 00:28:03 -04:00
Matthias Clasen
ce949c0f25 widget-factory: Cosmetic changes
Change which rows in the listbox on page 2 are activatable,
and trigger a dialog. It did not really make sense that this
would happen when clicking on the spin button to focus it.
2020-05-13 19:22:31 -04:00
Matthias Clasen
e9d966488b gtk-demo: Don't overdraw the fishbowl
Set overflow to hidden for the fishbowl widget, so the
blur buttons don't leak out into the window shadow.
2020-05-13 19:21:00 -04:00
Matthias Clasen
e87bc3d33d gtk-demo: Plug a memory leak
This leak was there all along. But with the new
gtk_window_destroy(), it shows up as an unclosable
window. Very noticable.
2020-05-13 17:24:57 -04:00
Alexander Mikhaylenko
3bf6bdae73 demo: Remove double borders from the treeview 2020-05-13 20:57:00 +05:00
Matthias Clasen
ab148c0135 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

Closes #2740, #2742, and #2741

See merge request GNOME/gtk!1890
2020-05-13 12:08:29 +00:00
Matthias Clasen
10813ddc23 Merge branch 'gtk-demo-expander-fix' into 'master'
gtk-demo: Fix expander demo

See merge request GNOME/gtk!1889
2020-05-13 11:44:11 +00:00
Alexander Larsson
a02c588b19 gtk-demo: InfoBar is not a GtkBox anymore
Use gtk_info_bar_add_child to add children
2020-05-13 11:04:49 +02:00
Alexander Larsson
fede7cd81c gtk-demo: Fix expander demo
GtkExpander is not a GtkBox anymore, so use the new gtk_expander_set_child()
API.
2020-05-13 10:50:41 +02:00
Alexander Larsson
fcbc972c2a print-editor: Fix crash
We're trying to g_free a GFile, which is not good...
2020-05-13 10:18:17 +02:00
Timm Bäder
949eb8d17a node-editor: Monitor file and reload on changes 2020-05-13 08:07:55 +02:00
Matthias Clasen
e7bf4a3de8 tests: Move testcairo into gtk4-demo
Replace the boring checkboard pattern with this
exciting drawing, and save one test binary at the
same time!
2020-05-12 15:43:43 -04:00
Matthias Clasen
694daa1d20 Move print-editor to demos
It is too demo-esque for languishing in tests/.
2020-05-12 15:43:43 -04:00
Emmanuele Bassi
4d09bf3b9b demos: Remove gtk_dialog_run()
Use modal dialogs and the "response" signal.
2020-05-12 13:12:08 +01:00
Matthias Clasen
2a24b8c653 Replace most remaining uses of container api
These are all on GtkBox or enumerating children.
2020-05-11 22:38:21 -04:00
Matthias Clasen
88141103cd Don't use container api on GtkListBox 2020-05-11 22:21:39 -04:00
Matthias Clasen
3bff7d3a37 Stop using container api on GtkFlowBox
GtkContainer is going away.
2020-05-11 22:21:39 -04:00
Matthias Clasen
0d57abfe65 Stop using container api on GtkFixed
GtkContainer is going away.
2020-05-11 22:21:39 -04:00
Matthias Clasen
932aa58237 Avoid container api on grids
GtkContainer is going away.
2020-05-11 22:21:39 -04:00
Matthias Clasen
bc6643f3c2 paned: Redo the api
This commit is porting GtkPaned to be derived
from GtkWidget instead of GtkContainer, while adding
start-child and end-child properties. The existing
properties are renamed to follow the start/end naming
scheme, and we add proper getters and setters.

Update all users.

See #2719
2020-05-11 22:21:33 -04:00
Matthias Clasen
a7abb394e8 Fix a leftover list box child
We were still using container api on a list box child here.
2020-05-11 15:42:52 -04:00
Matthias Clasen
025375ff5f Replace gtk_widget_destroy everywhere
Replace all remaining uses of gtk_widget_destroy
by gtk_container_remove or g_object_unref.
2020-05-11 12:20:59 -04:00
Matthias Clasen
cd0081d08a Use gtk_window_destroy
Replace calls to gtk_widget_destroy on windows
with gtk_window_destroy.
2020-05-11 12:20:57 -04:00
Matthias Clasen
8f9c3ed44a Stop using gtk_widget_destroyed
Replace all internal use of gtk_widget_destroyed
by g_object_add_weak_pointer.
2020-05-11 12:19:37 -04:00
Matthias Clasen
2415c02bbd Merge branch 'wip/exalm/polish' into 'master'
Random polish

See merge request GNOME/gtk!1850
2020-05-06 21:47:47 +00:00
Matthias Clasen
e09287a109 nodeeditor: Don't use container api on list box rows
GtkListBoxRow is not a container anymore.
2020-05-06 17:03:12 -04:00
Alexander Mikhaylenko
efe21869fb widget-factory: Remove duplicate margin-start 2020-05-07 01:29:33 +05:00
Alexander Mikhaylenko
2f898e8bb9 widget-factory: Align spinbutton in the list on page 2 2020-05-07 01:29:20 +05:00
Matthias Clasen
cad890ee29 gtk-demo: Use GtkDrawingArea::resize
This signal is a replacement for this (ab)use
of ::size-allocate.
2020-05-06 14:27:45 -04:00
Matthias Clasen
84944f1c63 gtk-demo: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:25:29 -04:00
Matthias Clasen
0070cff32d widget-factory: Use symboli icons in the toolbar
That is the style that is commonly used nowadays, even
in traditional apps.
2020-05-05 10:45:47 -04:00
Matthias Clasen
88e890c29c widget-factory: Remove unused css
We no longer show the various frame styles.
2020-05-05 10:45:47 -04:00
Matthias Clasen
fa848e94d2 gtk-demo: Port blur demo from GtkBin 2020-05-04 22:53:08 -04:00
Matthias Clasen
ec394e805b Use gtk_combo_box_set_child throughout 2020-05-04 22:53:08 -04:00
Matthias Clasen
77af8e303d Use gtk_overlay_set_child throughout
Replace all uses of gtk_container_add on overlays
by gtk_overlay_set_child.
2020-05-04 22:53:08 -04:00
Matthias Clasen
99ef14b59f Use gtk_search_bar_set_child throughout 2020-05-04 22:53:08 -04:00
Matthias Clasen
12ecbd1508 listboxrow: Derive from GtkWidget
We want to remove GtkBin and GtkContainer as they don't
provide much useful functionality anymore.

See #2681
2020-05-04 22:53:08 -04:00
Matthias Clasen
b8d1a9eb0d flowboxchild: Derive from GtkWidget
We want to remove GtkBin and GtkContainer as they don't
provide much useful functionality anymore.

See #2681
2020-05-04 22:53:08 -04:00
Matthias Clasen
f59f355190 Use gtk_window_set_child throughout
Replace all uses of gtk_container_add on windows
by gtk_window_set_child.
2020-05-04 22:53:08 -04:00
Matthias Clasen
af6e0ee2b3 Use gtk_button_set_child throughout
Replace all uses of gtk_container_add on buttons
by gtk_button_set_child.
2020-05-04 22:53:07 -04:00
Matthias Clasen
67759d4c3e Use gtk_scrolled_window_set_child throughout
Replace all uses of gtk_container_add on popovers
by gtk_scrolled_window_set_child.
2020-05-04 22:53:07 -04:00
Matthias Clasen
8e261056b9 Use gtk_popover_set_child throughout
Replace all uses of gtk_container_add on popovers
by gtk_popover_set_child.
2020-05-04 22:53:07 -04:00
Matthias Clasen
71433d01b3 aspect frame use fixup 2020-05-04 17:01:18 -04:00
Matthias Clasen
4a133b4eef fishbow: fixup premature popover 2020-05-04 17:01:18 -04:00
Matthias Clasen
1f63896c6b Use gtk_aspect_frame_set_child throughout
Replace all uses of gtk_container_add on aspect frames
by gtk_aspect_frame_set_child.
2020-05-04 17:01:18 -04:00
Matthias Clasen
1706b80815 Use gtk_frame_set_child throughout
Replace all uses of gtk_container_add for
frames with gtk_frame_set_child.
2020-05-04 17:01:18 -04:00
Matthias Clasen
8bd2043a40 widget-factory: Add .toolbar
We dropped GtkToobar, but we still want to present
something that looks the part here, so add a style
class.
2020-05-04 10:50:34 -04:00
Matthias Clasen
fd1fe0eed5 Merge branch 'matthiasc/for-master' into 'master'
docs: Add more detail to the drawing overview

See merge request GNOME/gtk!1811
2020-05-01 21:09:38 +00:00
Matthias Clasen
e393465fd7 widget-factory: Fix a typo
We wanted to move the conflicting global shortcuts
to the bubble phase, so they don't override the
entry bindings.
2020-05-01 14:24:21 -04:00
Alexander Mikhaylenko
c2e4e1af73 headerbar: Remove user-settable title
Use window title, or custom title widget if it's set. Remove 'title'
property.

Update demos and tests to set the title on the window instead of
headerbar.
2020-05-01 19:48:05 +05:00
Alexander Mikhaylenko
35d50f88c8 headerbar: Remove subtitle
Also remove the box containing title and subtitle, as there's only one
label now.
2020-05-01 19:48:05 +05:00
Alexander Mikhaylenko
43a453e465 headerbar: Remove has-subtitle property
Subtitle will go too in the next commit, but has-subtitle goes first as
it's broken right now anyway.
2020-05-01 19:48:05 +05:00
Matthias Clasen
b1bedbc71a widget-factory: Improve demo keynav
We have example cut/copy/paste actions for which we want
the usual shortcuts to show up in the menus, but they should
not break the expected shortcuts in entries. So, move them
to a capture phase shortcut controller.
2020-04-30 20:08:15 -04:00
Matthias Clasen
f31c85ff99 widget-factory: Add mnemonics to the stack pages 2020-04-30 19:18:09 -04:00
Matthias Clasen
ccb890f065 Use a slightly larger version of the logo animation
This is large enough to not make the media controls
slider shrink to nothing.
2020-04-28 14:00:52 -04:00
Matthias Clasen
80185b0f2a widget-factory: Enable page transitions by default
No need to make this an easter egg.
2020-04-27 14:33:07 -04:00
Matthias Clasen
a3368ab7e9 widget-factory: Revamp transition effects
Use a quick crossfade for the main pages, and use
the rotation for the small stack on page 2, where
it looks less out of place.
2020-04-26 22:30:34 -04:00
Matthias Clasen
1ae898bf0b gtk-demo: Add a shortcuts window
Its not very impressive here, but still good to have.
2020-04-26 22:14:10 -04:00
Matthias Clasen
91c7b24815 icon-browser: Add a gear menu
Add an about dialog, and make the inspector available.
2020-04-26 22:00:18 -04:00
Matthias Clasen
af2903d263 widget-factory: Improve the textview on page 3
Remove an extra frame, make the buttons linked, and
add tooltips.
2020-04-26 21:13:16 -04:00
Matthias Clasen
9ca2a09427 widget-factory: Move the password entry
Move the password entry to the other entries. That
fits the overall organization better, and makes all
the typographical styles fit.
2020-04-26 20:54:09 -04:00
Matthias Clasen
50b930fb1c widget-factory: Make the list on page 2 grow to the bottom
Add a few more items to the list to make it fill up the space.
2020-04-26 20:35:51 -04:00
Matthias Clasen
3ed285ab71 widget-factory: Show typographical style classes
This nicely fills the gap on page 1.
2020-04-26 20:25:11 -04:00
Matthias Clasen
34862dbbb6 gtk-demo: Include pango version in about dialog
This is useful information.
2020-04-26 20:02:10 -04:00
Matthias Clasen
1bdaa99347 widget-factory: Include pango version in about dialog
This is useful information.
2020-04-26 20:01:31 -04:00
Matthias Clasen
ad22c463b8 widget-factory: Add a password entry
Thats a new widget that was missing.
2020-04-26 19:34:36 -04:00
Matthias Clasen
9f579edfdb widget-factory: Put a video widget in
The designers wanted the frame column gone for a long
time, since inset/outset/groove etc are not the coolest
features anymore.

Keep one frame, and put a GtkVideo in it.

This opens up some real estate on page 1. Suggestions
welcome for how to fill it.
2020-04-26 14:08:40 -04:00
Matthias Clasen
f6af2d63b0 widget-factory: Implement the print action
Implement enough here to show a print dialog.
2020-04-26 14:08:35 -04:00
Matthias Clasen
8de774dde1 widget-factory: Make print a window action
We want to pass the parent window when opening
a print dialog, so this is naturally a window
action.
2020-04-26 10:45:40 -04:00
Matthias Clasen
8410e6f129 widget-factory: Some cosmetics
Hook the Print button on page 3 up to the app.print
action. This doesn't do anything now, but we might
use it to show a print dialog.
2020-04-26 10:02:11 -04:00
Matthias Clasen
ecf8e6f692 widget-factory: Improve the layout on page 3
Make the entries in the third column expand,
to align things.
2020-04-26 10:00:14 -04:00
Matthias Clasen
6f7bd37aeb widget-factory: Update copyright year 2020-04-26 00:45:06 -04:00
Matthias Clasen
f645c063fb gtk-demo: Update copyright year 2020-04-26 00:44:48 -04:00
Matthias Clasen
44e31855ca gtk-demo: Remove the colorsel demo
We already have a color selector demo in "Pickers".
2020-04-26 00:28:13 -04:00
Matthias Clasen
c6fc7d88c2 gtk-demo: Minor cosmetic fixes
Some minor cosmetic fixes to some of the demos.
2020-04-26 00:28:13 -04:00
Matthias Clasen
f6c8af6609 gtk-demo: Improve the dnd demo
The DND demo didn't have DND, since it was first created!
Time to fix this. Copying most of testdnd3.c here.
2020-04-26 00:28:13 -04:00
Matthias Clasen
f8f391ceb9 gtk-demo: Polish the clipboard demo
The DND part of this demo was broken by recent
icon theme changes. Make it work again.

And make the demo nicer by breaking out a
DemoImage widget.
2020-04-25 21:29:39 -04:00
Matthias Clasen
79e1c66657 gsk: Don't autoinclude backend-specific headers
Don't install headers for code that we don't build.
And don't include those headers in gsk.h.

Just as we do in gdk, require applications to include
the backend-specific headers they need explicitly.

Update the one affected demo, gtk4-node-editor.
2020-04-24 21:40:30 -04:00
Matthias Clasen
02fa948914 widget-factory: Improve the theme selector
Implement the "Current style" choice using
gtk_settings_reset_property, so we go back to
following the settings changes.
2020-04-24 21:12:20 -04:00
Carlos Garnacho
ccfffb2578 demos: Initialize brush size in "paint" demo
Otherwise lines end up with 0 thickness.
2020-04-24 22:20:09 +02:00
Matthias Clasen
250036259a widget-factory: Make color swatches non-focusable 2020-04-18 03:29:13 -04:00
Matthias Clasen
19dbbf6fa5 aspectframe: Modernize
Make GtkAspectFrame not derive from GtkFrame anymore,
since frames now always draw, well, a frame. Also,
add proper setters for the properties of GtkAspectFrame.

Update our sole user.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2627
2020-04-17 17:38:52 -04:00
Matthias Clasen
5a362c6759 nodeeditor: Don't set has-focus
That is now a readonly property. Set focus-widget
on the toplevel instead.
2020-04-17 16:17:01 -04:00
Matthias Clasen
416d82c81e widget-factory: Add a menu section title
If you can't see it, you can't theme it.
2020-04-17 13:29:56 -04:00
Matthias Clasen
12d5fdd457 menubutton: Drop relief
We are only using this as a boolean, so change it
to a boolean property named has-frame.
2020-04-17 10:57:36 -04:00
Matthias Clasen
df1816a29c button: Drop relief
We are only using this as a boolean, so change it
to a boolean property named has-frame.
2020-04-17 10:57:36 -04:00
Matthias Clasen
edae2a8dc5 frame: Drop shadow-type
Frames that don't draw frames are not very useful,
so just drop the shadow-type property.
2020-04-17 10:57:36 -04:00
Matthias Clasen
285aa226e5 scrolledwindow: Drop shadow-type
We were only using this as a boolean, so change it
to a boolean property named has-frame.
2020-04-17 10:57:36 -04:00
Matthias Clasen
3469a63453 widget-factory: Use a model for the complex menu
We had the model already in the ui file, but weren't
using it.
2020-04-17 09:07:17 -04:00
Matthias Clasen
4a20a3fdb2 widget-factory: Catch errors
This speeds up the debugging when doing quick experimental
changes to widget-factory.ui.
2020-04-17 08:55:56 -04:00
Matthias Clasen
b072ad9993 widget-factory: Add menu style class in popovers
We have a hand-rolled popover menu on page 3 that looks
really bad right now. Adding the menu style class makes
it all better.
2020-04-15 11:36:09 -04:00
Matthias Clasen
638508fa20 gtk-demo: Group the OpenGL demos 2020-04-12 21:58:07 -04:00
Matthias Clasen
ce6c7bae51 gtk-demo: Add a gears demo 2020-04-12 20:52:15 -04:00
Matthias Clasen
394ea32e93 Use gtk_widget_add/remove_css_class more
Replace most uses of gtk_style_context_add/remove_class
by the new APIs. The only remaining uses of the old API
are in save/restore situations.
2020-04-10 12:09:57 -04:00
Matthias Clasen
822c2aba36 scalebutton: Don't derive from GtkButton
Make GtkScaleButton a widget that has a toggle button
as a child, just like all the other button widgets now.
The immediate benefit of this arrangement is to avoid
the "double focus" problem when we pop up the popup.

Update accessible, demos and tests to match.
2020-04-09 20:43:45 -04:00
Matthias Clasen
22e1827f84 Change the default value of GtkWidget:can-focus
Make widgets can-focus by default, and change the semantics
of can-focus to be recursive . If it is set to FALSE, focus
can not enter the widget or its descendents at all anymore.

This commit temporarily breaks focus behavior of widgets
that did not expect to receive focus.
2020-04-09 17:50:29 -04:00
Matthias Clasen
0b17658a82 Replace most uses of <Primary> with <Control>
The only place where we are still using <Primary> is
in tests, to ensure we keep parsing it. Otherwise,
<Control> is now the preferred syntax.
2020-04-06 17:05:52 -04:00
Matthias Clasen
33928a52c3 gtk-demo: Fix a crash
Using the assistant demo repeatedly was crashing.
2020-04-04 15:35:18 -04:00
Matthias Clasen
b636df7784 Merge branch 'matthiasc/for-master' into 'master'
shortcuts: documentation fixes

See merge request GNOME/gtk!1628
2020-04-04 15:33:41 -04:00
Matthias Clasen
f2d6a7b36a demos: Remove can-focus from ui files 2020-04-04 00:28:34 -04:00
Matthias Clasen
e31bbb41d2 gtk-demo: Remove the popover demo
It doesn't work anymore, since popovers now need
support in the parent, and we don't really need
a demo just for popovers. They are used everywhere
already.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2429
2020-04-01 15:45:13 -04:00
Jakub Steiner
e9082fd9f3 widget-factory: avoid the T word
- style variant sound more appropriate
2020-03-30 14:28:47 +02:00
Matthias Clasen
f3d061e879 gtk-demo: Fix the stack demo
The GtkSpinner:active property was renamed to :spinning.
2020-03-28 00:08:12 -04:00
Matthias Clasen
e2c327e025 gtk-demo: Fix the sliding puzzle
Update for a change in gtk_shortcut_controller_add_shortcut
behavior.
2020-03-28 00:08:12 -04:00
Matthias Clasen
48910a6d8e gtk-demo: Fix the shortcuts demo
We don't have margins anymore.
2020-03-28 00:08:12 -04:00
Matthias Clasen
fbed55dff9 gtk-demo: Fix the rotated text demo
Off-by-one on the heart!
2020-03-28 00:08:12 -04:00
Matthias Clasen
059917b83c gtk-demo: Fix the overlay demo
We must use two separate boxes for the label and
the entry, otherwise we can't keep their can-target
properties apart.
2020-03-28 00:08:12 -04:00
Matthias Clasen
163aa82d45 gtk-demo: Use mnemonics in menu buttons
Use GtkMenuButton:use-underline in the modelbutton demo.
2020-03-28 00:08:12 -04:00
Matthias Clasen
bc2c341d60 gtk-demo: Visual fixes to the model button demo 2020-03-28 00:08:12 -04:00
Matthias Clasen
93d54ba10b gtk-demo: Fix the search entry demo
Avoid critical warnings when setting up the context
menu actions.
2020-03-27 16:24:20 -04:00
Matthias Clasen
5d07a66d1d widget-factory: Fix the radio button example
We only want one of the sensitive buttons to be active,
so don't tell them all to be active.
2020-03-27 16:06:03 -04:00
Matthias Clasen
8ab2e31b58 widget-factory: Add theme switch
Add a submenu to test the builtin themes. This is mainly
for the benefit of the artists working on those themes.
2020-03-26 13:51:59 -04:00
Matthias Clasen
80b988ef6c gtk-demo: Stop emitting ::popup-menu
The signal was not used anyway, in the font explorer demo.
2020-03-25 23:14:45 -04:00
Benjamin Otte
bb4fbe3d8f accels: Remove GtkAccelGroup 2020-03-25 23:14:44 -04:00
Benjamin Otte
1ec950d14a gtk-demo: Port the sliding puzzle demo to shortcuts 2020-03-25 23:14:27 -04:00
Benjamin Otte
92e20deca1 shortcut: Change the API for creating shortcuts
When creating shortcuts, there almost always are a trigger and an action
available for use. So make gtk_shortcut_new() take those as arguments.

Also add gtk_shortcut_new_with_arguments() so people can easily pass
those in, too.
2020-03-25 23:14:27 -04:00
Benjamin Otte
cd0332aad5 shortcut: Add GtkShortcutAction
Similar to GtkShortcutTrigger, GtkShortCutAction provides all the
different ways to activate a shortcut.

So far, these different ways are supported:

 - do nothing
 - Call a user-provided callback
 - Call gtk_widget_activate()
 - Call gtk_widget_mnemonic_activate()
 - Emit an action signal
 - Activate an action from the widget's action muxer
2020-03-25 23:14:27 -04:00
Benjamin Otte
c3af47f5d9 gtk-demo: Add a dumb demo for shortcut triggers 2020-03-25 23:14:27 -04:00
Matthias Clasen
923a245a80 gtk-demo: Add hyphenation control to the markup demo 2020-03-20 23:58:33 -04:00
Matthias Clasen
38f1dbaba3 gtk-demo: Allow word breaking in the markup demo
We want to show hyphenation control here.
2020-03-20 23:58:33 -04:00
Matthias Clasen
31db615885 Revert "Merge branch 'disable-window-test' into 'master'"
This reverts commit 3ac4c76b18, reversing
changes made to 6ec96d2e98.
2020-03-19 18:03:16 -04:00
Matthias Clasen
98011e6273 gtk-demo: Stop emitting ::popup-menu
The signal was not used anyway, in the font explorer demo.
2020-03-18 23:00:51 -04:00
Benjamin Otte
ff6df33b6a accels: Remove GtkAccelGroup 2020-03-18 23:00:51 -04:00
Benjamin Otte
067bd7019c gtk-demo: Port the sliding puzzle demo to shortcuts 2020-03-18 23:00:51 -04:00
Benjamin Otte
4a4bfa0766 shortcut: Change the API for creating shortcuts
When creating shortcuts, there almost always are a trigger and an action
available for use. So make gtk_shortcut_new() take those as arguments.

Also add gtk_shortcut_new_with_arguments() so people can easily pass
those in, too.
2020-03-18 23:00:51 -04:00
Benjamin Otte
e6d0560a82 shortcut: Add GtkShortcutAction
Similar to GtkShortcutTrigger, GtkShortCutAction provides all the
different ways to activate a shortcut.

So far, these different ways are supported:

 - do nothing
 - Call a user-provided callback
 - Call gtk_widget_activate()
 - Call gtk_widget_mnemonic_activate()
 - Emit an action signal
 - Activate an action from the widget's action muxer
 - Activate a GAction
2020-03-18 23:00:51 -04:00
Benjamin Otte
662a8a2885 gtk-demo: Add a dumb demo for shortcut triggers 2020-03-18 23:00:50 -04:00
Matthias Clasen
66a0a8d53e Merge branch 'wip/baedert/test-cflags' into 'master'
Pass (almost) all our cflags to tests, testsuite, examples, demos, ...

See merge request GNOME/gtk!1516
2020-03-13 18:40:46 +00:00
Matthias Clasen
703d69692f demo: stop using gdk_surface_get_state 2020-03-12 14:56:20 -04:00
Timm Bäder
7789d0e23f builder: Make object names a const array
We don't take ownership.
2020-03-07 15:30:38 +01:00
Timm Bäder
dc36c21835 demos/gtk-demo: Add common_cflags to build
With a few exceptions.
2020-03-07 15:30:35 +01:00
Timm Bäder
3c28f6d891 demos/widget-factory: Add common_cflags to build
And fix the generated warnings
2020-03-06 18:56:40 +01:00
Timm Bäder
6f6ed1e4af demos/node-editor: Add common_cflags to build
And fix the generated warnings
2020-03-06 18:54:37 +01:00
Timm Bäder
e444d7315c demos/icon-browser: Add common_cflags to build
And fix the generated warnings
2020-03-06 18:53:05 +01:00
Timm Bäder
5d1e006a95 demos/constraint-editor: Add common_cflags to build
And fix all the warnings and errors generated.
2020-03-06 18:51:10 +01:00
Benjamin Otte
3f7b401de0 gtk-demo: Add a simple peg solitaire DND demo 2020-03-02 03:18:55 +01:00
Benjamin Otte
a411959c91 droptarget: Redo
This is a huge reorganization of GtkDropTarget. I did not know how to
split this up, so it's unfortunately all one commit.

Highlights:

- Split GtkDropTarget into GtkDropTarget and GtkDropTargetAsync
  GtkDropTarget is the simple one that only works with GTypes and offers
  a synchronous interface.
  GtkDropTargetAsync retains the full old functionality and allows
  handling mime types.

- Drop events are handled differently
  Instead of picking a single drop target and sending all DND events to
  it, every event is sent to every drop target. The first one to handle
  the event gets to call gdk_drop_status(), further handlers do not
  interact with the GdkDrop.
  Of course, for the ultimate GDK_DROP_STARTING event, only the first
  one to accept the drop gets to handle it.
  This allows stacking DND event controllers that aren't necessarily
  interested in handling the event or that might decide later to drop
  it.

- Port all widgets to either of those
  Both have a somewhat changed API due to the new event handling.
  For the ones who should use the sync version, lots of cleanup was
  involved to operate on a sync API.
2020-03-02 03:18:55 +01:00
Matthias Clasen
b5bacb3be6 Drop the margin property
Replace it with margin-start, -end, -top, -bottom throughout.
2020-02-25 20:59:04 -05:00
Matthias Clasen
a9c05193a7 Drop the expand property
The hexpand and vexpand properties are sufficient.
2020-02-25 18:29:15 -05:00
Matthias Clasen
9d80db29de Merge branch 'spinning-spinner' into 'master'
Rename GtkSpinner::active to ::spinning

See merge request GNOME/gtk!1475
2020-02-25 04:04:46 +00:00
Matthias Clasen
e73a40733f Rename GtkSpinner::active to ::spinning
And add a setter and getter. The old name was
confusing with the widget state of the same
name. 'Active' is just too overloaded.
2020-02-24 22:37:02 -05:00
Matthias Clasen
a43d13aa74 popover: Drop ::relative-to
It is enough to just set the parent (and make the parent
call gtk_native_check_resize in size_allocate).

This commit removes the relative_to argument to the
constructors of GtkPopover and GtkPopoverMenu, and
updates all callers.
2020-02-24 20:46:41 -05:00
Emmanuele Bassi
b09e7df81b Remove GtkFileChooser:local-only
Now that the whole API goes through GFile we don't have the weird split
between local-only and non-local-only modes.
2020-02-22 15:22:06 +00:00
Emmanuele Bassi
063ad28b1a Remove overwrite confirmation machinery from GtkFileChooser
Overwrite confirmation should not be optional, and it should not loop
into application code to create their own dialog and user response.
2020-02-22 15:22:06 +00:00
Emmanuele Bassi
5f070ff233 Remove filename/URI API from GtkFileChooser
GtkFileChooser's API predates GIO by a few years, so it started off with
filenames and URI as character arrays. After introducing GIO as a
dependency, the API included GFile-based entry points.

It's much more appropriate to use GFile everywhere, as we want to
encourage people to use GIO instead of passing random bytes to low level
POSIX API.

See: #2455
2020-02-22 15:22:06 +00:00
Matthias Clasen
1c7191f45c gtk-demo: Stop using gtk_get_event_widget
This is convenience api that will be going away.
2020-02-21 00:51:03 -05:00
Matthias Clasen
b1eaa502df events: reorganize getters
Restructure the getters for event fields to
be more targeted at particular event types.

Update all callers, and replace all direct
event struct access with getters.

As a side-effect, this drops some unused getters.
2020-02-21 00:51:03 -05:00
Matthias Clasen
31bf9da63a Strip const from GdkEvent
Events are refcounted structs, and we generally don't
pass these as const.
2020-02-21 00:51:02 -05:00
Matthias Clasen
c343031a0e Stop using g_object_ref/unref on events
Use gdk_event_ref/unref instead of g_object_ref/unref.
Events will stop being object soon.
2020-02-21 00:47:53 -05:00
Matthias Clasen
66307f00f1 icontheme: Update the api
Add properties, and use string arrays instead of lists.

Among other things, this renames gtk_icon_theme_list_icons
to gtk_icon_theme_get_icon_names.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2410
2020-02-18 20:32:17 -05:00
Benjamin Otte
b8cf7ea1c6 dnd: Port the TreeModel machinery to GValue DND 2020-02-18 02:40:00 +01:00
Benjamin Otte
80ba7fd682 dragdest: Make gtk_drop_target_new() args be transfer full
Saves tons of code.
2020-02-17 04:04:21 +01:00
Benjamin Otte
da83457a60 dnd: Remove gdk_content_provider_new_with_callback()
Content providers are meant to be immutable, apart from very special
cases, but in those cases they need to emit
gdk_content_provider_content_changed().

Having a constructor that just uses a get_func invites abuse of this
by not making developers aware of those requirments.
In fact, all users in GTK failed to do this.

Instead, code should use the GtkDragSource::prepare signal to create
content providers when needed.

The same problem exists with gdk_content_provider_new_with_formats(),
but this commit doesn't touch that.
2020-02-16 20:10:31 +01:00
Timm Bäder
78a5bf8e21 Remove gtk_info_bar_get_content_area() uses
We can just add() to the info bar directly.
2020-02-15 17:18:26 +01:00
Benjamin Otte
a278edab22 window: Remove type argument from gtk_window_new() 2020-02-14 21:18:49 +01:00
Emmanuele Bassi
cdd7e4c5ec Add a notify function to GdkContentProvider
The callback-based content providers need a GDestroyNotify function to
free the data passed to them on construction, otherwise they are going
to leak.
2020-02-13 14:53:25 +00:00
Alexander Larsson
1698369d52 Merge branch 'icon-theme-api-rework' into 'master'
Icon theme api rework

See merge request GNOME/gtk!1390
2020-02-10 12:45:56 +00:00
Alexander Larsson
904eecd1ed icon paintable: Replace get_filename and get_resource_path with get_file()
This returns a GFile which can represent both the above.
2020-02-10 12:33:17 +01:00
Matthias Clasen
55b60f6da9 gtk-demo: Don't call gtk_main_quit
It doesn't work with GtkApplications that do not
call gtk_main().
2020-02-07 16:25:02 -05:00
Benjamin Otte
44e153d8a8 GtkToolbar: remove 2020-02-07 14:08:26 +01:00
Benjamin Otte
e00030dff2 css: Remove .primary-toolbar
It's not used anywhere anymore.
2020-02-07 14:08:08 +01:00
Benjamin Otte
9cccb944ef css: Remove .inline-toolbar
It's not used anywhere anymore.
2020-02-07 14:08:08 +01:00
Benjamin Otte
1363cacb3a widget-factory: Get rid of toolbars 2020-02-07 14:08:08 +01:00
Benjamin Otte
68dbb3f31a gtk-demo: Get rid of toolbars 2020-02-07 14:08:08 +01:00
Alexander Larsson
8282698201 textview: Use paintables instead of textures, and fix the support
This changes gtk_text_buffer_insert_texture() to
gtk_text_buffer_insert_paintable() which is strictly more useful
(as textures are paintables). It also fixes the code to actually
support drawing the paintables (as well as tracking changes
to the paintables.
2020-02-06 17:47:56 +01:00
Alexander Larsson
d69f7fd63e IconTheme: Never fail a lookup or icon load
If icon lookup fails or if loading it fails later, just always
fall back to the built in image-missing icon. Nobody is handling
missing icons in a sane way anyway.

If you *truly* need to handle missing icons, you need to manually
use gtk_icon_theme_has_icon().

While changing the loading code I also fixed an issue where it
was always passing "png" to pixbuf, now it also handles "xpm" if
that is the filename suffix.
2020-02-06 09:38:25 +01:00
Alexander Larsson
b529f77827 IconTheme: Simplify icon scaling
We had a pretty complex setup where we tried to avoid scaling up themes from dirs
that specified a size. However, not only was it very complex, but it didn't quite
work with window scales, because when using e.g. a size 32 directory for 16@2x
the dir size is wrong anyway. Additionally it turns out most code either picks
an existing icon size, or uses the FORCE_SIZE flags, so it doesn't seem
like a useful behaviour.

This change drops the FORCE_SIZE flags, and always scales
icons. Additionally it moves the scaling of the icon to rendering,
which seems more modern, and allows us to (later) share icons loaded
for different sizes that happened to use the same source file (at
different scales).

Note that this changes the behaviour of
gtk_icon_paintable_download_texture() is it now returns the unscaled
source icon. However, ignore thats, as I plan to remove this function
and replace it with a way to render a paintable to a cairo-surface
instead.
2020-02-06 09:38:25 +01:00
Matthias Clasen
ac7dd02f8f Merge branch 'master.msvc' into 'master'
Fix building recent GTK master on Visual Studio

See merge request GNOME/gtk!1369
2020-02-05 18:26:22 +00:00
Alexander Larsson
410541f82b Rename GtkIcon to GtkIconPaintable 2020-02-04 17:19:22 +01:00