Compare commits

...

301 Commits

Author SHA1 Message Date
Matthias Clasen
abcf2e3bf7 node-editor: Don't use the ::query-tooltip signal
Use the vfunc, the signal is going away.
2020-05-09 23:24:59 -04:00
Matthias Clasen
a123d99fcd inspector: Don't use the ::query-tooltip signal
Use the vfunc, the signal is going away.
2020-05-09 22:49:55 -04:00
Matthias Clasen
4f760a9a2a volumebutton: Don't use the ::query-tooltip signal
Use the vfunc, the signal is going away.
2020-05-09 22:31:00 -04:00
Matthias Clasen
7e6be71d38 volumebutton: Enable the tooltips
Little point in having a query-tooltip handler if
we don't make sure ::query-tooltip is emitted.
2020-05-09 22:31:00 -04:00
Matthias Clasen
ed46982cc5 volumebutton: Remove broken a11y code
The accessible of a button is not an AtkImage,
so whatever this code was trying to do isn't
working. Remove it.
2020-05-09 22:30:59 -04:00
Matthias Clasen
e92270f928 iconview: Stop using the ::query-tooltip signal
Use the vfunc instead. The signal is going away.
2020-05-09 22:30:59 -04:00
Matthias Clasen
79a96b9bef treeview: Don't use the ::query-tooltip signal
Use the vfunc instead.
2020-05-09 22:30:59 -04:00
Matthias Clasen
ff55264e60 linkbutton: Don't use the ::query-tooltip signal
As a subclass, GtkLinkButton should override the
vfunc. The signal will be going away.
2020-05-09 22:30:59 -04:00
Daniel Șerbănescu
3d6fdffb7c Update Romanian translation 2020-05-09 18:19:28 +00:00
Florentina Mușat
b14339dc56 Update Romanian translation 2020-05-09 17:18:59 +00:00
Kristjan SCHMIDT
f2dce6d847 Update Esperanto translation 2020-05-09 10:20:43 +00:00
Matthias Clasen
53ca60adbf Merge branch 'carlosgc/content-provider-union-write' into 'master'
clipboard: GdkContentProviderUnion should return after writing the first matched format

See merge request GNOME/gtk!1856
2020-05-08 15:50:33 +00:00
Matthias Clasen
20f160495d Merge branch 'tintou/gsk-transform-autocleanup' into 'master'
gsk: Add GskTransform autocleanup definition

See merge request GNOME/gtk!1859
2020-05-08 15:05:50 +00:00
Matthias Clasen
61d39a09a5 Merge branch 'gbsneto/css-dequeue-fix' into 'master'
csswidgetnode: Don't check for container

See merge request GNOME/gtk!1861
2020-05-08 14:55:46 +00:00
Matthias Clasen
0e251906fb Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!1860
2020-05-08 14:51:59 +00:00
Georges Basile Stavracas Neto
2cc6c4d2d1 csswidgetnode: Don't check for container
The conditions to queue and dequeue a CSS validation
are different; while queueing checks if the widget is
a root, dequeueing checks that AND if the widget is
a container.

GtkWindow is not a GtkContainer anymore, and that is
causing validations to be queued, but never dequeued.

Don't require the widget to be a GtkContainer for
dequeuing.
2020-05-08 10:57:41 -03:00
Matthias Clasen
6efdaa9ffd placeview: Hide the protocols grid when its empty
Seeing just the bold headings at the bottom of the
popover is confusing, so just hide the entire grid
in this case.
2020-05-08 09:20:02 -04:00
Matthias Clasen
d06cdf6318 droptarget: Fix confusion around ::leave signal
The leave signal should not take any arguments,
don't pass the GdkDrop. Update the documentation,
fix the emission and update users to match.

This was showing up as crash when dragging files
over the places sidebar.
2020-05-08 08:50:44 -04:00
Corentin Noël
7df572d308 gsk: Add GskTransform autocleanup definition 2020-05-08 09:14:55 +02:00
Carlos Garcia Campos
739137ccf9 clipboard: GdkContentProviderUnion should return after writing the first matched format
It continues trying with the other providers due to a missing early
return.
2020-05-07 11:27:45 +02:00
Matthias Clasen
42ca760f9c Merge branch 'matthiasc/for-master' into 'master'
Fix an inspector crash

See merge request GNOME/gtk!1855
2020-05-07 02:56:04 +00:00
Matthias Clasen
57d3719583 Fix an inspector crash
Fix the listmodel semantics of the controller model,
by making get_item return a reference.
This was broken in 4b9e5304cc.
2020-05-06 22:25:51 -04:00
Matthias Clasen
0b5b350f3e Merge branch 'matthiasc/for-master' into 'master'
modelbutton: Unify activation code paths

See merge request GNOME/gtk!1854
2020-05-07 01:40:39 +00:00
Matthias Clasen
236fc57329 modelbutton: Unify activation code paths
Opening submenus by Enter or Space wasn't working,
because we had different code paths for activation
via keynav and via click. Unify them.
2020-05-06 20:27:04 -04:00
Emmanuele Bassi
7686b13a1e Merge branch 'ebassi/for-master' into 'master'
Ebassi/for master

See merge request GNOME/gtk!1853
2020-05-06 22:53:42 +00:00
Emmanuele Bassi
56d3a79990 Annotate gtk_text_child_anchor_get_widgets() correctly
We switched from returning a list to returning a C array, which means we
need to update the introspection annotation and the documentation to
match the implementation.
2020-05-06 23:09:53 +01:00
Emmanuele Bassi
ddd113ac98 Annotate gdk_motion_event_get_history() correctly
We moved from returning a list to returning a C array, and this requires
a change in the annotations.
2020-05-06 23:05:19 +01:00
Georges Basile Stavracas Neto
962de8f1ee Merge branch 'gbsneto/array-clear-func' into 'master'
icontheme: Don't free array element

Closes #2717

See merge request GNOME/gtk!1851
2020-05-06 22:02:17 +00: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
e25cb8b907 Merge branch 'matthiasc/for-master' into 'master'
nodeeditor: Don't use container api on list box rows

See merge request GNOME/gtk!1852
2020-05-06 21:35:08 +00:00
Georges Basile Stavracas Neto
6fc706f983 icontheme: Don't free array element
When setting a clear function on a GArray, unlike
most other places, this free func is expected to
*not* free the array element itself -- only its
contents.

Don't free the array element.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2717
2020-05-06 18:14:36 -03: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
Alexander Mikhaylenko
059cc3b818 video: Use more appropriate revealer transition 2020-05-07 01:21:26 +05:00
Matthias Clasen
68011e99ac Merge branch 'gbsneto/fix-text-child-header' into 'master'
textchild: Include <gtk/gtkwidget.h>

See merge request GNOME/gtk!1846
2020-05-06 20:13:22 +00:00
Matthias Clasen
d2b508d95c Merge branch 'master.struct.msvc' into 'master'
gtk/gtkaccelgroup.c: Fix build on Visual Studio

See merge request GNOME/gtk!1785
2020-05-06 20:02:27 +00:00
Matthias Clasen
433295127c Merge branch 'wip/exalm/row' into 'master'
placesview: Stop using gtk_container_add() for GtkListBoxRow

See merge request GNOME/gtk!1849
2020-05-06 20:01:45 +00:00
Alexander Mikhaylenko
24e3556c30 adwaita: Remove a redundant -gtk-icon-shadow: none
Buttons have no icon shadows anymore anyway.
2020-05-07 01:01:12 +05:00
Alexander Mikhaylenko
c17aa12235 adwaita: Don't style window menu button anymore
Those were removed with the introduction of GtkWindowControls, no need to
exclude them from the round style anymore.
2020-05-07 00:59:44 +05:00
Alexander Mikhaylenko
40c8d8ba9f adwaita: Use tabular figures where appropriate
Port 82b9be3297 from GTK3.
2020-05-07 00:37:55 +05:00
Matthias Clasen
92fc2156ff Merge branch 'drop-click-gesture-area' into 'master'
gestureclick: Drop the area

See merge request GNOME/gtk!1847
2020-05-06 19:25:32 +00:00
Matthias Clasen
4f08b4be9c Merge branch 'master-disable-introspection' into 'master'
CI: disable introspection with mingw to avoid flaky builds

See merge request GNOME/gtk!1848
2020-05-06 19:24:58 +00:00
Christoph Reiter
94202e6339 CI: use bash style variable expansion for the mingw cache key
It doesn't understand the powershell syntax which leads to the cache
key being empty which leads to cache restore being skipped
which leads to slow builds not using ccache.

See https://gitlab.com/gitlab-org/gitlab-runner/-/issues/2747
2020-05-06 21:23:14 +02:00
Jakub Steiner
5815604853 Merge branch 'wip/jimmac/HC-focus' into 'master'
HC: more contrasty focus rings

See merge request GNOME/gtk!1845
2020-05-06 19:22:27 +00:00
Alexander Mikhaylenko
f47aba05b0 adwaita: Make popover border transparent
Port 379669b153 from GTK3.
2020-05-07 00:19:27 +05:00
Matthias Clasen
8239186c26 Merge branch 'abolish-size-allocate' into 'master'
Abolish size allocate

Closes #2705

See merge request GNOME/gtk!1833
2020-05-06 19:15:31 +00:00
Alexander Mikhaylenko
3a5fdfcfda adwaita: Update app icon shadow
Port f95f3c707a from GTK3.
2020-05-07 00:15:19 +05:00
Alexander Mikhaylenko
8007891132 placesview: Stop using gtk_container_add() for GtkListBoxRow 2020-05-07 00:08:46 +05:00
Matthias Clasen
b0fe4dec2c Update CONTRIBUTING.md
Point to discourse, rather than mailing lists.
Based on a suggestion by sujiniku,

https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1763
2020-05-06 15:08:36 -04:00
Matthias Clasen
b86d81872c Merge branch 'matthiasc/for-master' into 'master'
keymap: Remove leftover code

See merge request GNOME/gtk!1844
2020-05-06 19:01:25 +00:00
Christoph Reiter
1e0f860a75 CI: disable introspection with mingw to avoid flaky builds
g-i has started to fail and it's not clear why, so disable it for
now to keep the build green.

See https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/340
2020-05-06 20:34:39 +02:00
Matthias Clasen
8efebbaf46 Merge branch 'wip/jimmac/dark-seuggested' into 'master'
Adwaita: tone down suggested focus ring for dark

See merge request GNOME/gtk!1843
2020-05-06 18:32:09 +00:00
Matthias Clasen
56e590bd31 widget: Drop the ::size-allocate signal
This signal is mainly used for bad things, and we
don't want to emit signals during layout if we can
avoid it.

If you are subclassing, you should either use a
layout manager or override the size_allocate vfunc.

If you are using a GtkDrawingArea or GtkGLArea,
use their ::resize signals to learn about size
changes.

Fixes: #2705
2020-05-06 14:27:45 -04:00
Matthias Clasen
64b673853b tooltipwindow: Stop using the ::size-allocate signal
Instead of connecting to ::size-allocate, call
gtk_native_set_tooltip and rely on the native
to allocate the tooltip window.
2020-05-06 14:27:45 -04:00
Matthias Clasen
3872da535f tooltipwindow: Drop some dead code 2020-05-06 14:27:45 -04:00
Matthias Clasen
1f0024a7f0 tooltip: Add private api to allocate the window
Add private gtk_tooltip_maybe_allocate() function
and use it from GtkWindow and GtkPopover.

This will let us stop using the ::size-allocate signal,
without having to redo all the tooltip management first.

That will happen later.
2020-05-06 14:27:45 -04:00
Emmanuele Bassi
cb94c7d69e Explicitly update widget a11y bounds when allocating
The a11y machinery is using signal subscription to get notified of size
changes and notify listeners in turn. This is suboptimal for a couple of
reasons:

 - if something connects to the GtkWidget::size-allocate signal we need
   to emit it; currently, we have an optimization in place that will
   skip the signal emission if there are no handlers, and it would be
   nice to go through the fast path
 - the accessibility implementation is part of GTK, and should not go
   through additional hoops like any out-of-tree API consumer
2020-05-06 14:27:45 -04:00
Matthias Clasen
82e92582bd tests: Stop using ::size-allocate 2020-05-06 14:27:45 -04:00
Matthias Clasen
92bcf4c7a7 inspector: Stop using ::size-allocate
This signal is going away. Currently, there is no
other way for the inspector to monitor the allocation.
2020-05-06 14:27:45 -04:00
Matthias Clasen
b21a027d10 examples: Use GtkDrawingArea::resize
This signal is a replacement for this (ab)use
of the ::size-allocate signal, which is going away.
2020-05-06 14:27:45 -04: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
e4894a69d4 drawingarea: Add a ::resize signal
This can be used as a replacement for ::size-allocate
to prepare size-dependent resources, like a backing
surface. It mirrors the GtkGLArea::resize signal.
2020-05-06 14:27:45 -04:00
Matthias Clasen
0aec11f292 a11y: Avoid a gratitious use of ::size-allocate
The paned widget has a position property, just
use it.
2020-05-06 14:27:45 -04:00
Matthias Clasen
7280618c7d cellarea: Cosmetics
Remove an occurrence of size-allocate in a comment.
2020-05-06 14:27:45 -04:00
Matthias Clasen
6c8f5f9d17 treeview: Cosmetic change
Remove an occurrence of size-allocate in a comment.
2020-05-06 14:27:45 -04:00
Matthias Clasen
91d261a0b3 window: Remove some outdated info from the docs
Remove references to ::size-allocate and ::configure-event
from the docs.
2020-05-06 14:27:45 -04:00
Matthias Clasen
77ffc1f9ed keymap: Remove leftover code
When I removed the 0-termination for the entries for
each keyval, I remove the code initializing the key,
but accidentally left the code that adds it to the
array, so gdk_keymap_get_cached_entries_for_keyval
returns one extra, uninitialized value at the end
of the array. Stop doing that.
2020-05-06 14:27:45 -04:00
Matthias Clasen
8ad49b33ed gestureclick: Drop the area
This is a rarely used api, and our general trend has been
to use widgets whenever we need an area singled out.
2020-05-06 14:19:50 -04:00
Georges Basile Stavracas Neto
79d6190684 textchild: Include <gtk/gtkwidget.h>
This header is exported, so it needs to include
the gtkwidget.h header with the gtk/ prefix.

This was broken in 289b157e32
2020-05-06 15:13:03 -03:00
Jakub Steiner
edc57e4282 HC: more contrasty focus rings 2020-05-06 19:28:05 +02:00
Matthias Clasen
baf82cdf7a keymap: Remove leftover code
When I removed the 0-termination for the entries for
each keyval, I remove the code initializing the key,
but accidentally left the code that adds it to the
array, so gdk_keymap_get_cached_entries_for_keyval
returns one extra, uninitialized value at the end
of the array. Stop doing that.
2020-05-06 13:15:45 -04:00
Jakub Steiner
3fa691a1ab Adwaita: tone down suggested focus ring for dark 2020-05-06 19:14:19 +02:00
Jakub Steiner
053617a283 Merge branch 'wip/exalm/focus-entries2' into 'master'
Adwaita: Make error/warning entry focus more subtle

See merge request GNOME/gtk!1842
2020-05-06 16:53:14 +00:00
Alexander Mikhaylenko
40926a28ee Adwaita: Make error/warning entry focus more subtle
Add 50% alpha to it like to the main focus color.
2020-05-06 20:23:26 +05:00
Jakub Steiner
e2058aaecd Merge branch 'wip/jimmac/suggested-destructive-focus' into 'master'
Adwaita: suggested destrictive button focus

Closes #2704

See merge request GNOME/gtk!1841
2020-05-06 15:23:01 +00:00
Jakub Steiner
efd009e6d8 Adwaita: suggested destrictive button focus
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2704
2020-05-06 16:12:57 +02:00
Jakub Steiner
b32519966f Merge branch 'wip/jimmac/global-var' into 'master'
Adwaita: make parser happy wrt global variables

Closes #2703

See merge request GNOME/gtk!1840
2020-05-06 13:29:29 +00:00
Matthias Clasen
8bb133072d Merge branch 'fix-inspector-popover' into 'master'
inspector: Fix css tree popovers

See merge request GNOME/gtk!1838
2020-05-06 12:55:18 +00:00
Jakub Steiner
926764be0d Adwaita: make parser happy wrt global variables
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2703
2020-05-06 14:12:44 +02:00
Matthias Clasen
b96509c030 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

See merge request GNOME/gtk!1828
2020-05-06 03:55:55 +00:00
Matthias Clasen
81c68b86ea inspector: Fix css tree popovers
Adding popovers to a treeview doesn't work. Instead,
attach them to the cssnodetree widget, which is using
a layout manager - popovers work in that case.
2020-05-05 23:51:37 -04:00
Matthias Clasen
824c730362 Merge branch 'abolish-destroy' into 'master'
Abolish destroy

See merge request GNOME/gtk!1835
2020-05-06 00:37:04 +00:00
Matthias Clasen
a4cfbec5c2 widget: Drop the destroy vfunc
We still emit the ::destroy signal, but if you
want a vfunc, use dispose.
2020-05-05 18:25:29 -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
1086acce92 container: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:25:29 -04:00
Matthias Clasen
d03b1524e6 placesview: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:25:28 -04:00
Matthias Clasen
82f4b1630c printunixdialog: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:54 -04:00
Matthias Clasen
77d15b1751 window: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:54 -04:00
Matthias Clasen
401f8a7f31 treeview: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:54 -04:00
Matthias Clasen
3d4bb76694 textview: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:54 -04:00
Matthias Clasen
327da3de9a statusbar: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:54 -04:00
Matthias Clasen
d46252ca21 notebook: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:54 -04:00
Matthias Clasen
d2cbc454f6 iconview: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:54 -04:00
Matthias Clasen
49fcf41693 shortcutssection: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:54 -04:00
Matthias Clasen
8baefaf4d8 radiobutton: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:54 -04:00
Matthias Clasen
c60ffeedfa range: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:54 -04:00
Matthias Clasen
c8066bcd8b spinbutton: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:54 -04:00
Matthias Clasen
9f4cea190a viewport: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:54 -04:00
Matthias Clasen
7639d3daa0 text: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:54 -04:00
Matthias Clasen
8683925fe0 modelbutton: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:53 -04:00
Matthias Clasen
4c7cafdba8 label: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:53 -04:00
Matthias Clasen
03f145e868 filechooserbutton: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:53 -04:00
Matthias Clasen
1b44a64ef7 expander: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:53 -04:00
Matthias Clasen
37e381e95d combobox: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:53 -04:00
Matthias Clasen
e0f95844c1 actionbar: Use dispose instead of destroy
The destroy vfunc is going away.
2020-05-05 18:23:53 -04:00
Matthias Clasen
539f06147a Merge branch 'misc-cleanups' into 'master'
Misc cleanups

See merge request GNOME/gtk!1832
2020-05-05 21:02:25 +00:00
Matthias Clasen
d2b55dff2d Merge branch 'wip/exalm/controls-dispose' into 'master'
windowcontrols: Unparent children in dispose rather than finalize

See merge request GNOME/gtk!1831
2020-05-05 18:19:00 +00: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
e33da18577 window: Lower the visible focus timeout
Five seconds felt too long for some people in
initial feedback, so lets lower the timeout to
3 seconds.
2020-05-05 10:45:47 -04:00
Matthias Clasen
cda1a25a5a assistant: Drop the Private struct 2020-05-05 10:45:47 -04:00
Matthias Clasen
a9103ccd7c placesview: Drop the Private struct 2020-05-05 10:45:47 -04:00
Matthias Clasen
8effa10e79 searchbar: Drop the Private struct 2020-05-05 10:45:47 -04:00
Alexander Mikhaylenko
7906f09c75 windowcontrols: Unparent children in dispose rather than finalize 2020-05-05 19:43:55 +05:00
Jakub Steiner
4cdb9ed322 Merge branch 'wip/jimmac/notebook-tab-focus' into 'master'
Adwaita: notebook tab focus ring

See merge request GNOME/gtk!1830
2020-05-05 13:42:25 +00:00
Matthias Clasen
b74a3de299 Merge branch 'bin-removal' into 'master'
Bin removal

See merge request GNOME/gtk!1820
2020-05-05 12:55:50 +00:00
Jakub Steiner
774d61c682 Adwaita: notebook tab focus ring
- prelight the tab, not a label (visually)
2020-05-05 13:57:33 +02:00
Jakub Steiner
642924a0f1 Merge branch 'wip/jimmac/oldstyle-toolbars' into 'master'
Adwaita: old style toolbar buttons

See merge request GNOME/gtk!1829
2020-05-05 09:53:05 +00:00
Jakub Steiner
d827fe711d Adwaita: old style toolbar buttons
- style toolbar buttons
2020-05-05 10:55:14 +02:00
Timm Bäder
d328374c94 shortcutcontroller: Check for NULL GtkNative of widget
And just continue in that case.
2020-05-05 08:20:10 +02:00
Timm Bäder
7f009b9952 label: Be more defensive against non-existant focus_link 2020-05-05 08:20:10 +02:00
Timm Bäder
27b4b5ee32 surface: remove double assignment 2020-05-05 08:20:10 +02:00
Timm Bäder
0e73bfa202 shortcutmanager: Speed up default_remove_controller a bit
Only call get_n_items on the model once and remove two unnecessary
casts.
2020-05-05 08:20:10 +02:00
Timm Bäder
fb9b54d4b2 shortcutcontroller: Use a GArray instead of a linked list 2020-05-05 08:20:10 +02:00
Timm Bäder
cdb4d71125 cssprovider: Pass a GtkArray around when matching
We just use the resulting GPtrArray to set the values on a GtkCssLookup
and it had mostly a size of 1, in extremes a size of 11.
2020-05-05 08:20:10 +02:00
Timm Bäder
8b4d84981e gtk.supp: Update
Make some rules more general and add some more epoxy/mesa suppressions.
2020-05-05 08:20:10 +02:00
Timm Bäder
4996097219 cssselector: Use a GtkArray to count exact matches
The list here is at most 3 elements long in my tests.
2020-05-05 08:20:10 +02:00
Timm Bäder
0c4dcd9d57 add GtkArray
Try to use stack space if we can and only fall back to the GPtrArray if
we must.
2020-05-05 08:20:10 +02:00
Timm Bäder
aaecb3d84b main: Save some type checks
We already have the typecheck-less versions of get_realized(),
get_parent() and is_sensitive() in gtkwidgetprivate.h, so use them here.
2020-05-05 08:20:10 +02:00
Timm Bäder
771b3ea6f3 eventcontroller: Remove some unnecessary casts
Instead of comparing two GtkWidget*s by casting the two GtkNative*s, we
can as well compare two GtkNative*s. Also if gtk_widget_get_native()
returns NULL, the code previously failed.
2020-05-05 08:20:10 +02:00
Timm Bäder
75e202f02b widget: Use an unchecked cast in _get_native()
This is either no chagne because we know for a fact that the returned
value is a GtkNative - after all thats's the type we pass to
gtk_widget_get_ancestor().

Or it is a bug fix since casting NULL to a GtkNative using GTK_NATIVE()
is not going to work, but the API contract of gtk_widget_get_native()
explicitly allows a NULL return value.
2020-05-05 08:20:10 +02:00
Timm Bäder
94d3fd84b5 window: Remove unused private function 2020-05-05 08:20:10 +02:00
Timm Bäder
a40abcf74d scalebutton: Shorten finalize() implementation 2020-05-05 08:20:09 +02:00
Timm Bäder
9f90eb41c8 scalebutton: Remove unused click_id member 2020-05-05 08:20:09 +02:00
Timm Bäder
4b9e5304cc widget: Save controllers list in a GPtrArray 2020-05-05 08:20:09 +02:00
Timm Bäder
ef623aaabc widget: Only do a IS_ROOT type check if the parent is unset
So we do less type checks
2020-05-05 08:20:09 +02:00
Timm Bäder
de40b0b061 placesview: Remove frame
We don't need a double border here.
2020-05-05 08:20:09 +02:00
Timm Bäder
356dea3349 cssselector: Avoid some GList allocations 2020-05-05 08:20:09 +02:00
Timm Bäder
63bbc79f48 icontheme: Save dir_mtimes in a GArray, not a GList 2020-05-05 08:20:09 +02:00
Timm Bäder
d80c130d7f GdkEvent: Save history in a GArray
Instead of a less efficient GList.
2020-05-05 08:20:09 +02:00
Timm Bäder
14b27446a3 stylecontext: Remove _list_classes() from public API
Applications can use gtk_widget_get_css_classes these days.
2020-05-05 08:20:09 +02:00
Timm Bäder
289b157e32 textchild: Return an array from get_widgets
Yay, one GList less.
2020-05-05 08:20:09 +02:00
Timm Bäder
85237c8665 gdkdisplay-wayland: Fix a possibly uninitialized out value 2020-05-05 08:20:09 +02:00
Timm Bäder
61195df7a3 widget: Use early-out style in gtk_widget_realize()
This is much more common in the current code base and reduces the
indentation level by one.
2020-05-05 08:20:09 +02:00
Timm Bäder
ce07c0559d shorthandproperty: Use alloca() when parsing properties 2020-05-05 08:20:09 +02:00
Timm Bäder
f4edbdfc1f shorthandproperty: Return unset/initial/inherit as-is
We don't even need an array value these days.
2020-05-05 08:20:09 +02:00
Timm Bäder
526187d36c shorthandproperty: Use alloc a for data array 2020-05-05 08:20:09 +02:00
Timm Bäder
96673d5106 popover: Remove an unused gtk_widget_get_allocation() call 2020-05-05 08:20:09 +02:00
Timm Bäder
88f5d4547c label: Remove a debug leftover 2020-05-05 08:20:09 +02:00
Timm Bäder
34976a791c gskpango: Make get_color a bit shorter
Don't copy from crenderer->fg_color just to override from the local
color again.
2020-05-05 08:20:09 +02:00
Timm Bäder
ad73afcd79 label: Unref style_attrs list 2020-05-05 08:20:09 +02:00
Matthias Clasen
4735d38e31 docs: Fixup for an uninitialized variable 2020-05-04 22:53:08 -04:00
Matthias Clasen
17c21513a8 testsuite: Update a testcase
Our testcase for flipping icons used media icons which
were recently changed to not do rtl flipping anymore.
2020-05-04 22:53:08 -04:00
Matthias Clasen
3c165b3b77 Drop GtkBin
It is no longer used anywhere.
2020-05-04 22:53:08 -04:00
Matthias Clasen
cac514f647 testtooltips: Derive demo from GtkWidget 2020-05-04 22:53:08 -04:00
Matthias Clasen
8d0773fad0 inspector: Derive recorder from GtkWidget 2020-05-04 22:53:08 -04:00
Matthias Clasen
fa848e94d2 gtk-demo: Port blur demo from GtkBin 2020-05-04 22:53:08 -04:00
Matthias Clasen
d8e47383cb Add a test for bin child conversion 2020-05-04 22:53:08 -04:00
Matthias Clasen
dec5707ca9 builder-tool: Convert former bin children
Convert from <child> elements to <property name="child">
for former GtkBin subclasses. Update test results
to match.
2020-05-04 22:53:08 -04:00
Matthias Clasen
0ec5a3f0d9 tooltipwindow: Derive from GtkWidget 2020-05-04 22:53:08 -04:00
Matthias Clasen
aae25c4fa0 combobox: 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
ec394e805b Use gtk_combo_box_set_child throughout 2020-05-04 22:53:08 -04:00
Matthias Clasen
5d26af06e4 combobox: Add a child property 2020-05-04 22:53:08 -04:00
Matthias Clasen
44f9a51827 testkineticscrolling: Make this work again
There was an errant g_free here, and lots of
redundant gtk_widget_show.
2020-05-04 22:53:08 -04:00
Matthias Clasen
e2781af16f testgtk: Fix g_object_new use
This is the kind of thing that happens with varargs apis.
2020-05-04 22:53:08 -04:00
Matthias Clasen
b96d7b62d1 Add gtk_overlay_remove_overlay
Now that GtkOverlay is not a container anymore,
gtk_container_remove can't be used for this anymore,
so add a separate api.
2020-05-04 22:53:08 -04:00
Matthias Clasen
edd5d36159 overlay: 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
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
53f9737dcf overlay: Add a child property 2020-05-04 22:53:08 -04:00
Matthias Clasen
3a9883b3ca searchbar: Derive from GtkWidget
We want to remove GtkBin and GtkContainer as they don't
provide much useful functionality anymore.

We have to implement GtkBuildable, in order to keep
the <child> element in ui files working for search bars.

See #2681
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
e2abe6dd29 searchbar: Add a child property 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
41322e2a7a revealer: Derive from GtkWidget
We want to remove GtkBin and GtkContainer as they don't
provide much useful functionality anymore. This requires
us to move get_request_mode and compute_expand down.

See #2681
2020-05-04 22:53:08 -04:00
Matthias Clasen
649ae635a7 Use gtk_revealer_set_child throughout
Replace all uses of gtk_container_add on revealers
with gtk_revealer_set_child.
2020-05-04 22:53:08 -04:00
Matthias Clasen
686be577d5 revealer: Add a child property 2020-05-04 22:53:08 -04:00
Matthias Clasen
9a65ed9ada window: Derive from GtkWidget
We want to remove GtkBin and GtkContainer as they don't
provide much useful functionality anymore. This requires
us to move get_request_mode and compute_expand down.

Update the accessible implementation to match, remove
remnants of container implementations in GtkWindow
subclasses, and fix livecycle issues around destroy
vs dispose in GtkAssistant.

After this commit, using gtk_container_add on window
subclasses is not allowed anymore, but adding childing
with <child> in ui files still works.

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
b9b1bf85e1 window: Add a child property 2020-05-04 22:53:07 -04:00
Matthias Clasen
4aa5fba0b5 button: Derive from GtkWidget
We want to remove GtkBin and GtkContainer as they don't
provide much useful functionality anymore. This requires
us to move get_request_mode and compute_expand down.

We have to implement GtkBuildable, in order to keep
the <child> element in ui files working for buttons.

See #2681
2020-05-04 22:53:07 -04:00
Matthias Clasen
97d0e8c6e0 css testsuite: Remove an obsolete test
This was testing something that shouldn't be possible
anyway: Adding more than one child to a bin. With the
bin removal, this now just overrides the child so
only one child is left in the end.

Just remove the test.
2020-05-04 22:53:07 -04:00
Matthias Clasen
07441ad000 css tests: Update expected results
Now that GtkCheckButton is using a box layout,
we are no longer reordering the css nodes according
to text direction.
2020-05-04 22:53:07 -04:00
Matthias Clasen
183431c918 checkbutton: Modernize
Stop implementing GtkContainer, and just use a box layout
instead of doing our own thing manually.
2020-05-04 22:53:07 -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
04e4a02cd0 button: Add a child property 2020-05-04 22:53:07 -04:00
Matthias Clasen
9d7b77f874 scrolledwindow: Derive from GtkWidget
We want to remove GtkBin and GtkContainer as they don't
provide much useful functionality anymore. This requires
us to move get_request_mode and compute_expand down.

We have to implement GtkBuildable, in order to keep
the <child> element in ui files working for aspect
frames.

See #2681
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
54b613392b scrolledwindow: Add a child property 2020-05-04 22:53:07 -04:00
Matthias Clasen
ee1f8d8d06 popover: Derive from GtkWidget 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
ee284a560a popover: Add a child property 2020-05-04 17:01:18 -04:00
Matthias Clasen
e098ffb88d viewport: Derive from GtkWidget
We want to remove GtkBin and GtkContainer as they don't
provide much useful functionality anymore. This requires
us to move get_request_mode and compute_expand down.

We have to implement GtkBuildable in order to keep
the <child> element working for viewports in ui files.
See #2681
2020-05-04 17:01:18 -04:00
Matthias Clasen
e9ddf0fda5 Use gtk_viewport_set_child throughout
Replace all uses of gtk_container_add on viewports
by gtk_viewport_set_child.
2020-05-04 17:01:18 -04:00
Matthias Clasen
937c94bab5 viewport: Add a child property 2020-05-04 17:01:18 -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
5b06b08a0e aspectframe: Derive from GtkWidget
We want to remove GtkBin and GtkContainer as they don't
provide much useful functionality anymore. This requires
us to move get_request_mode and compute_expand down.

We have to implement GtkBuildable, in order to keep
the <child> element in ui files working for aspect
frames.

See #2681
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
e137152520 aspectframe: Add a child property 2020-05-04 17:01:18 -04:00
Matthias Clasen
25826eafe3 frame: Derive from GtkWidget
We want to remove GtkBin and GtkContainer as they don't
provide much useful functionality anymore. This requires
us to move get_request_mode and compute_expand down.

See #2681
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
7f975472a7 frame: Add a child property 2020-05-04 17:01:18 -04:00
Matthias Clasen
8c1072fad1 Merge branch 'wip/jimmac/notebook-focus' into 'master'
Adwaita: notebook tab focus

See merge request GNOME/gtk!1825
2020-05-04 20:10:46 +00:00
Matthias Clasen
188a61f02d Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!1826
2020-05-04 19:02:40 +00:00
Jakub Steiner
2d1b7d128e Merge branch 'wip/jimmac/colorswatch-fix' into 'master'
Adwaita: colorswatch focus rings

Closes #2695

See merge request GNOME/gtk!1827
2020-05-04 18:07:38 +00:00
Jakub Steiner
9dfac6fe3f Adwaita: colorswatch focus rings
- there used to be different outline color for light and dark buttons,
  but it's complexity I can live without. blue focus rings fit all.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2695
2020-05-04 18:16:08 +02:00
Jakub Steiner
a3f042b5b4 Adwaita: notebook tab focus
- just like entries tabs need to be handled with focus-within
2020-05-04 17:54:12 +02:00
Jakub Steiner
d62e2faee6 Merge branch 'wip/exalm/entries' into 'master'
Adwaita: Convert entries to the new focus rings

See merge request GNOME/gtk!1824
2020-05-04 15:14:55 +00:00
Matthias Clasen
53d86d411a Adwaita: Style .toolbar
We don't have GtkToolbar anymore, so we are more likely
to meet a .toolbar style class, than a toolbar element.
2020-05-04 10:51:11 -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
Alexander Mikhaylenko
d2b5beffbf Adwaita: Convert entries to the new focus rings 2020-05-04 19:24:24 +05:00
Daniel Mustieles
d64d46912e Updated Spanish translation 2020-05-04 15:52:57 +02:00
Matthias Clasen
837b141747 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!1823
2020-05-04 12:31:25 +00:00
Matthias Clasen
92ac66f16a testframe: Drop padding
No need to emulate features that GtkFrame no longer has.
2020-05-04 07:37:38 -04:00
Matthias Clasen
130ae89e54 frame: Fix xalign handling
SEtting a nonzero xalign on frames had no
effect, since we were always using the full
allocation with here, instead of what the label
needs. Found by using testframe for a second.
2020-05-04 07:37:31 -04:00
Matthias Clasen
77cf6cd406 frame: Don't queue a resize if xalign changes
We only need to allocate children in this case.
While we touch it, rewrite the setter to modern
style.
2020-05-04 07:37:25 -04:00
Jakub Steiner
2dcb2400d1 Merge branch 'wip/jimmac/avoid-wobbly-windows' into 'master'
Adwaita: make transition offset more subtle

See merge request GNOME/gtk!1822
2020-05-04 10:24:32 +00:00
Jakub Steiner
8127d70b8a Adwaita: make transition offset more subtle
- be less like wobbly windows
2020-05-04 11:29:19 +02:00
Jakub Steiner
ab0ad4a0d7 Merge branch 'wip/jimmac/emphasize-focus-change' into 'master'
Adwaita: bring more attention to focus change

See merge request GNOME/gtk!1803
2020-05-04 08:49:40 +00:00
Cheng-Chia Tseng
05ad3c543a Update Chinese (Taiwan) translation 2020-05-03 13:29:03 +00:00
Matthias Clasen
b4d5ddcae5 Merge branch 'filechooser-translation' into 'master'
filechooser: Translate type column

Closes #2690

See merge request GNOME/gtk!1816
2020-05-03 01:10:24 +00:00
Matthias Clasen
817112ab3c filechooser: Translate type column
When the code for this was copied from nautilus,
we forgot to adapt it for running in a library
instead of an application - gettext() doesn't work
in a library.

Fixes: #2690
2020-05-02 19:57:38 -04:00
Matthias Clasen
0b4a1bb62f Merge branch 'wip/exalm/subtitle' into 'master'
appchooserdialog: Don't show subtitle label when subtitle is null

See merge request GNOME/gtk!1815
2020-05-02 20:06:08 +00:00
Alexander Mikhaylenko
80867acf94 appchooserdialog: Don't show subtitle label when subtitle is null
Looks like 67822d0c9a and
3f1bd3722d collided, and subtitle can be null
now. Add a check so that we don't end up with empty label in that case.
2020-05-02 23:35:44 +05:00
Yuri Chornoivan
32740a720a Update Ukrainian translation 2020-05-02 06:27:02 +00: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
Benjamin Otte
fa90747815 Merge branch 'wip/exalm/headerbar-title' into 'master'
Headerbar title/subtitle cleanups

See merge request GNOME/gtk!1807
2020-05-01 19:39:27 +00:00
Asier Sarasua Garmendia
c31431c5fa Update Basque translation 2020-05-01 19:25:55 +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
Matthias Clasen
8653a5e27b dragicon: Derive from GtkWidget
This wasn't meant to derive from GtkContainer.
2020-05-01 14:24:21 -04:00
Matthias Clasen
431545877e docs: Add more detail to the drawing overview 2020-05-01 14:24:21 -04:00
Matthias Clasen
c3c2bc513e Merge branch 'for-master' into 'master'
appchooserdialog: Don't show broken subtitles

See merge request GNOME/gtk!1809
2020-05-01 18:13:12 +00:00
Alexander Mikhaylenko
ab59562170 headerbar: Document GtkBuilder child types, add a title example 2020-05-01 21:39:32 +05:00
Florian Müllner
3f1bd3722d appchooserdialog: Don't show broken subtitles
Commit 07beb6dba2 made GtkAppChooserWidget useful with no content-type,
however when used in a GtkAppChooserDialog, this will lead to a confusing
"Opening (null) files" subtitle.

Fix this by omitting the subtitle altogether in that case.
2020-05-01 18:21:53 +02:00
Matthias Clasen
120f13c95d Merge branch 'matthiasc/for-master' into 'master'
docs: Some revisions of the input overview

See merge request GNOME/gtk!1808
2020-05-01 16:02:43 +00:00
Yuri Chornoivan
4822e02be3 Update Ukrainian translation 2020-05-01 15:56:57 +00:00
Alexander Mikhaylenko
6b4bed2c7a builder-tool: Rename GtkHeaderBar:custom-title to title-widget
Add a test.
2020-05-01 20:11:19 +05:00
Alexander Mikhaylenko
739f681076 headerbar: Rename custom-title to title-widget
Now that all the other title-related properties are gone, custom title can
have a more mundane name.
2020-05-01 20:11:19 +05: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
fa0509c473 filechooserdialog: Create title and subtitle manually
title and subtitle properties will go away in the following commits, stop
using them.
2020-05-01 19:48:05 +05:00
Alexander Mikhaylenko
67822d0c9a appchooserdialog: Create title and subtitle manually
title and subtitle properties will go away in the following commits, stop
using them.
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
74dcbae1f3 docs: Some revisions of the input overview
Remove some less than accurate details, and add
an illustration.
2020-05-01 09:26:06 -04:00
Matthias Clasen
850549ba83 Merge branch 'matthiasc/for-master' into 'master'
Keynav improvements for widget-factory

See merge request GNOME/gtk!1804
2020-05-01 12:02:13 +00:00
Piotr Drąg
689673188b Update POTFILES.in and POTFILES.skip 2020-05-01 11:56:37 +02: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
cb056a1e8f stack: Add a :use-underline property
Add GtkStackPage:use-underline, and use it when
constructing labels in the stack switcher.
2020-04-30 19:17:34 -04:00
Matthias Clasen
57bf4ac59a Merge branch 'speed-up-event-matching' into 'master'
keymap: Cache key info

See merge request GNOME/gtk!1800
2020-04-30 22:57:33 +00:00
Jakub Steiner
8165616b3c Adwaita: bring more attention to focus change
- as discussed in https://gitlab.gnome.org/GNOME/gtk/-/issues/2644 it's desirable to bring attention to what's focused. Instead of pressing `alt` just simply changing focus with `tab` can have a similar effect

Extends https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1802
2020-05-01 00:14:44 +02:00
Jakub Steiner
e3b9f9a3bf Merge branch 'theme-focus-ring-mixin' into 'master'
Adwaita: Use a mixin for visible focus rings

Closes #2653

See merge request GNOME/gtk!1802
2020-04-30 18:35:57 +00:00
Matthias Clasen
99c3928cec keymap: Cache key info
We currently calling gdk_display_map_keyval up to
once per key event per shortcut trigger, and that function
does an expensive loop over the entire keymap and
allocates an array. Avoid this by caching the entries
in a single array, and have a lookup table for finding
the entries for a keyval.

To do this, change the GdkKeymap.get_entries_for_keyval
signature, and change the ::keys-changed signal to be
RUN_FIRST, since we want to clear the cache in the class
handler before running signal handlers. These changes are
possible now, since keymaps are no longer public API.
2020-04-30 13:05:52 -04:00
nana-4
2fa876e839 Adwaita: Use a mixin for visible focus rings
The focus-ring() mixin allows we to flexibly style the focus ring for
each widget. By using this, we can get rid of the "Outlines" section,
which is out of place in the _common.scss file.

This commit also has the following changes:

- Transition the focus rings on most widgets.
- Add a missing focus ring to iconview.
- Move the expander-widget focus ring to its title.
- Move the notebook focus ring to its checked tab.

Closes https://gitlab.gnome.org/GNOME/gtk/-/issues/2653
2020-05-01 02:03:23 +09:00
Daniel Mustieles
700a2df110 Updated Spanish translation 2020-04-30 12:53:45 +02:00
Daniel Mustieles
efa4174828 Updated Spanish translation 2020-04-30 12:53:01 +02:00
Matthias Clasen
e5c430266e Merge branch 'matthiasc/for-master' into 'master'
docs: Move menu model docs

See merge request GNOME/gtk!1799
2020-04-30 01:31:36 +00:00
Matthias Clasen
3bbcaa9e8f docs: Move menu model docs
It makes more sense to document the menu model XML
format in the GtkPopoverMenu docs than in
GtkApplicationWindow.
2020-04-29 20:30:40 -04:00
Matthias Clasen
11351eb76b Merge branch 'win32-new-runner' into 'master'
CI: Switch to new Windows runners

See merge request GNOME/gtk!1797
2020-04-29 22:14:09 +00:00
Yuri Chornoivan
062f0fe0b2 Update Ukrainian translation 2020-04-29 20:16:31 +00:00
Yuri Chornoivan
02ac248541 Update Ukrainian translation 2020-04-29 20:15:38 +00:00
Christoph Reiter
662539acf7 CI: Switch to new Windows runners
They use powershell instead of cmd.exe, use the tag win32-ps instead of win32,
and run Windows 2016 instead of 2012r2.

The old runners will be switched off in the comming weeks.
2020-04-29 20:12:34 +02:00
Matthias Clasen
4a44c1b7bf Merge branch 'soundcheck' into 'master'
Add a quick sound test

See merge request GNOME/gtk!1796
2020-04-29 15:29:02 +00:00
Matthias Clasen
f8ef15b555 Add a quick sound test
Just to show that our media infrastructure is up
to playing little beeps and bings.
2020-04-29 10:54:40 -04:00
Emmanuele Bassi
76cc1cae00 Merge branch 'ebassi/for-master' into 'master'
Ebassi/for master

See merge request GNOME/gtk!1795
2020-04-29 13:39:44 +00:00
Emmanuele Bassi
1b64a17547 docs: Link the license file from the README 2020-04-29 12:49:35 +01:00
Emmanuele Bassi
f1741584e6 docs: Link the contribution guide from the README
Hopefully people will read it.
2020-04-29 12:49:05 +01:00
Emmanuele Bassi
55d2f190ef docs: Update link to the discussion forum
The README file still links to the old web page about mailing lists; the
link is now a 404 after the website redesign, and we don't use mailing
lists any more, in favour of Discourse.
2020-04-29 12:47:57 +01:00
Matthias Clasen
3209d0f937 Merge branch 'wip/jtojnar/join-paths' into 'master'
build: clean up .pc generation

See merge request GNOME/gtk!1793
2020-04-29 11:34:07 +00:00
Chun-wei Fan
d0a8d263ac gtk/gtkaccelgroup.c: Fix build on Visual Studio
Visual Studio does not allow one to initialize structure members with
non-constant expressions, caused by using strlen(s), so fix this by
using sizeof(s) - 1 instead.
2020-04-29 15:02:03 +08:00
Jan Tojnar
6d9db8610e build: clean up .pc generation
Path concatenation is much nicer than the unwieldy format method.
Since paths returned by get_option are relative to prefix, they will be joined as before.

As a bonus, this fixes weird platforms like NixOS that actually pass absolute includedir under a different prefix.
2020-04-29 07:42:53 +02:00
Matthias Clasen
ac3d3c647e Merge branch 'popup-positioning-fix' into 'master'
popover: Fix repositioning logic

See merge request GNOME/gtk!1792
2020-04-29 04:47:39 +00:00
Matthias Clasen
91d8c230f3 popover: Fix repositioning logic
When the arrow changes position, we need to queue
an allocation to ensure that gtk_widget_allocate
actually calls our ->size_allocate vfunc.
2020-04-28 23:26:19 -04:00
Matthias Clasen
b47e721ab6 Merge branch 'class-action-init' into 'master'
Reshuffle action muxer initialization

See merge request GNOME/gtk!1789
2020-04-29 02:04:37 +00:00
Matthias Clasen
0a2e0775b6 Merge branch 'drop-stack-homogeneous' into 'master'
Drop stack homogeneous

Closes #2673

See merge request GNOME/gtk!1791
2020-04-29 00:55:01 +00:00
Matthias Clasen
c4a47e218f Speed up class action hookup
No need to construct a detailed signal name for
every action when we can just look up the signal ID
once and use the quark that the GParamSpec already
has. Also, we don't need to loop over the actions
every time we get a notification.
2020-04-28 20:22:26 -04:00
Matthias Clasen
2e2121c7ad builder-tool: Replace GtkStack:homogeneous
Replace this property by h/vhomogeneous.

Add a test.
2020-04-28 20:00:51 -04:00
Matthias Clasen
5f01f6f36b Drop GtkStack:homogeneous
We have hhomogeneous and vhomogeneous properties
that can be set individually.

Fixes: #2673
2020-04-28 20:00:12 -04:00
Matthias Clasen
5ec53e6a11 Merge branch 'popup-controls-hiding' into 'master'
video: Don't hide the controls while the popup is shown

See merge request GNOME/gtk!1787
2020-04-28 22:41:16 +00:00
Matthias Clasen
b968ced567 Reshuffle action muxer initialization
We were having a problem where property actions were
not getting state updates because prop_actions_connect
was triggered from some instance_init function while
the widget class is not in place yet.

Delay that call until the widget is fully constructed,
so we can guarantee that we are dealing with the
correct class private struct, and see all class actions.
2020-04-28 18:37:43 -04:00
Matthias Clasen
3fee02808b Merge branch 'widget-factory-larger-logo' into 'master'
Widget factory larger logo

See merge request GNOME/gtk!1786
2020-04-28 20:29:36 +00:00
Matthias Clasen
dc7081599d video: Don't hide the controls while the popup is shown
We don't get motion events from the popup (due to grabs),
so just don't hide as long as we're grab shadowed. This
makes the controls stay up until the volume popup is
dismissed.
2020-04-28 15:11:26 -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
Daniel Mustieles
6784772c9d Updated Spanish translation 2020-04-28 17:49:39 +02:00
Emmanuele Bassi
65c56ea812 Merge branch 'drop-realize-invariant' into 'master'
Drop parent->realized => child->realized invariant

See merge request GNOME/gtk!1783
2020-04-28 14:11:55 +00:00
Emmanuele Bassi
064eb6a87f Merge branch 'ebassi/for-master' into 'master'
Ebassi/for master

See merge request GNOME/gtk!1782
2020-04-28 13:06:26 +00:00
Alexander Larsson
c6104fe7fd Drop parent->realized => child->realized invariant
We already dropped this invariant in gtk_widget_verify_invariants()
because it was not true in all cases. Also, it is not really useful
these days as we extended what it means to be a "child" to also
include widgets in different toplevels.

For example, a popup in a popup button need not be realized just
because the button is in a realized window. The main invariants
we want are:

 * Parent is realized before child
 * Widget is realized before it is mapped

This sounds like its not a huge deal, but in fact it is a massive win
for things like menus, because when we go between menus in a menubar
each switch between two open menus involves a lot of intermingled
crossing events to different surfaces and for each of these the
tooltip window of the toplevel gets assigned to the new surface.  This
shouldn't be a huge deal, as the tooltip window is not even visible,
but due to the realized invariant it get re-realized each time it gets
re-assigned.
2020-04-28 14:32:57 +02:00
Emmanuele Bassi
555230ec9c Annotate more functions returning GListModel
Now that we can have an element-type annotation, we should use it where
needed.
2020-04-28 13:31:59 +01:00
Emmanuele Bassi
2a11f5f889 Use attributes instead of element-type annotation
The `element-type` annotation is for GList and GSList only, and turns
out adding support for GListModel in gobject-introspection breaks Vala
and the GIR for GIO.

Instead of using `element-type`, we can use the `attributes` annotation,
which is ignored by code generators based on the GIR data.
2020-04-28 13:31:29 +01:00
Matthias Clasen
f66950f48c Merge branch 'inspector-media' into 'master'
Inspector media

See merge request GNOME/gtk!1781
2020-04-28 05:25:50 +00:00
Matthias Clasen
5477c1cdfe inspector: Show the media backend 2020-04-28 00:37:54 -04:00
Matthias Clasen
75c75e001c mediafile: Privately export function to the extension
We want to show this information in the inspector.
2020-04-28 00:37:54 -04:00
Matthias Clasen
af32092f16 Merge branch 'popover-flip-arrow-fix' into 'master'
popover: Allocate after setting final_position

Closes #2671

See merge request GNOME/gtk!1780
2020-04-28 03:42:01 +00:00
Matthias Clasen
b54ef5c398 Merge branch 'menu-section-title-fixup' into 'master'
popovermenu: Don't put a separator before the first section

Closes #2672

See merge request GNOME/gtk!1779
2020-04-28 01:55:24 +00:00
Matthias Clasen
473709fee3 popover: Allocate after setting final_position
When we find out that we've been flipped, set
final_position and final_rect before allocating
the popover. This prevents 'smashed-in beak' disease.

Fixes: #2671
2020-04-27 20:58:03 -04:00
Matthias Clasen
a837b57849 popovermenu: Don't put a separator before the first section
When we have section titles, we were not hiding the
separator before the first section as we should;
fix this.

Fixes: #2672
2020-04-27 20:27:39 -04:00
Matthias Clasen
12adf6362f Merge branch 'matthiasc/for-master' into 'master'
widget-factory: Enable page transitions by default

See merge request GNOME/gtk!1777
2020-04-27 23:15:40 +00: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
Daniel Mustieles
99dd33a9a3 Updated Spanish translation 2020-04-27 18:14:43 +02:00
458 changed files with 21799 additions and 19252 deletions

View File

@@ -99,12 +99,12 @@ release-build:
.mingw-defaults: &mingw-defaults
stage: build
tags:
- win32
- win32-ps
script:
- C:\msys64\usr\bin\pacman --noconfirm -Syyuu
- C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
cache:
key: "%CI_JOB_NAME%"
key: "$CI_JOB_NAME"
<<: *cache-paths
msys2-mingw32:

View File

@@ -34,7 +34,7 @@ pacman --noconfirm -S --needed \
mingw-w64-$MSYS2_ARCH-shared-mime-info
# https://gitlab.gnome.org/GNOME/gtk/issues/2243
wget "https://gitlab.gnome.org/creiter/gitlab-ci-win32-runner/raw/master/pango/mingw-w64-$MSYS2_ARCH-pango-1.44.7-1-any.pkg.tar.xz"
wget "https://gitlab.gnome.org/creiter/gitlab-ci-win32-runner-v2/raw/master/pango/mingw-w64-$MSYS2_ARCH-pango-1.44.7-1-any.pkg.tar.xz"
pacman --noconfirm -U "mingw-w64-$MSYS2_ARCH-pango-1.44.7-1-any.pkg.tar.xz"
mkdir -p _ccache
@@ -45,11 +45,14 @@ export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
ccache --zero-stats
ccache --show-stats
export CCACHE_DISABLE=true
# FIXME: introspection disabled for now because of
# https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/340
meson \
-Dx11-backend=false \
-Dwayland-backend=false \
-Dwin32-backend=true \
-Dvulkan=no \
-Dintrospection=false \
--werror \
_build
unset CCACHE_DISABLE

View File

@@ -22,12 +22,7 @@ Please, do not use the issue tracker for support questions. If you have
questions on how to use GTK effectively, you can use:
- the `#gtk` IRC channel on irc.gnome.org
- the [gtk](https://mail.gnome.org/mailman/listinfo/gtk-list) mailing list,
for general questions on GTK
- the [gtk-app-devel](https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list)
mailing list, for questions on application development with GTK
- the [gtk-devel](https://mail.gnome.org/mailman/listinfo/gtk-devel-list)
mailing list, for questions on developing GTK itself
- the [gtk tag on the GNOME Discourse instance](https://discourse.gnome.org/tag/gtk)
You can also look at the GTK tag on [Stack
Overflow](https://stackoverflow.com/questions/tagged/gtk).

View File

@@ -27,9 +27,9 @@ The official developers blog
- https://blog.gtk.org
Information about mailing lists can be found at
Discussion forum
- http://www.gtk.org/mailing-lists.php
- https://discourse.gnome.org/c/platform/core/
Nightly documentation can be found at
- Gtk: https://gnome.pages.gitlab.gnome.org/gtk/gtk/
@@ -140,6 +140,12 @@ In the bug report please include:
* Further information such as stack traces may be useful, but
is not necessary.
Contributing to GTK
-------------------
Please, follow the [contribution guide](./CONTRIBUTING.md) to know how to
start contributing to GTK.
Release notes
-------------
@@ -156,4 +162,4 @@ GTK is released under the terms of the GNU Lesser General Public License,
version 2.1 or, at your option, any later version, as published by the Free
Software Foundation.
Please, see the `COPYING` file for further information.
Please, see the [`COPYING`](./COPYING) file for further information.

View File

@@ -426,7 +426,7 @@ edit_constraint (ConstraintEditorWindow *win,
editor = constraint_editor_new (model, constraint);
gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (editor));
gtk_window_set_child (GTK_WINDOW (window), GTK_WIDGET (editor));
g_signal_connect (editor, "done", G_CALLBACK (constraint_editor_done), win);
@@ -460,7 +460,7 @@ edit_guide (ConstraintEditorWindow *win,
gtk_window_set_title (GTK_WINDOW (window), "Edit Guide");
editor = guide_editor_new (guide);
gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (editor));
gtk_window_set_child (GTK_WINDOW (window), GTK_WIDGET (editor));
g_signal_connect (editor, "done", G_CALLBACK (guide_editor_done), win);
gtk_widget_show (window);

View File

@@ -9,7 +9,6 @@
<property name="default-height">768</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="header">
<property name="title" translatable="yes">GTK Constraint Editor</property>
<property name="show-title-buttons">1</property>
<child type="start">
<object class="GtkButton">

View File

@@ -216,7 +216,7 @@ constraint_view_add_child (ConstraintView *view,
frame = gtk_frame_new (NULL);
gtk_widget_add_css_class (frame, "child");
gtk_widget_set_name (frame, name);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_frame_set_child (GTK_FRAME (frame), label);
gtk_widget_set_parent (frame, GTK_WIDGET (view));
update_weak_position (view, frame, 100, 100);
@@ -259,7 +259,7 @@ constraint_view_add_guide (ConstraintView *view,
frame = gtk_frame_new (NULL);
gtk_widget_add_css_class (frame, "guide");
g_object_set_data (G_OBJECT (frame), "internal", (char *)"yes");
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_frame_set_child (GTK_FRAME (frame), label);
gtk_widget_insert_after (frame, GTK_WIDGET (view), NULL);
g_object_set_data (G_OBJECT (guide), "frame", frame);

View File

@@ -503,13 +503,13 @@ demo_application_window_unrealize (GtkWidget *widget)
}
static void
demo_application_window_destroy (GtkWidget *widget)
demo_application_window_dispose (GObject *object)
{
DemoApplicationWindow *window = (DemoApplicationWindow *)widget;
DemoApplicationWindow *window = (DemoApplicationWindow *)object;
demo_application_window_store_state (window);
GTK_WIDGET_CLASS (demo_application_window_parent_class)->destroy (widget);
G_OBJECT_CLASS (demo_application_window_parent_class)->dispose (object);
}
static void
@@ -519,11 +519,11 @@ demo_application_window_class_init (DemoApplicationWindowClass *class)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->constructed = demo_application_window_constructed;
object_class->dispose = demo_application_window_dispose;
widget_class->size_allocate = demo_application_window_size_allocate;
widget_class->realize = demo_application_window_realize;
widget_class->unrealize = demo_application_window_unrealize;
widget_class->destroy = demo_application_window_destroy;
gtk_widget_class_set_template_from_resource (widget_class, "/application_demo/application.ui");
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, message);

View File

@@ -39,7 +39,7 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
static GQuark child_data_quark = 0;
G_DEFINE_TYPE (BlurOverlay, blur_overlay, GTK_TYPE_BIN)
G_DEFINE_TYPE (BlurOverlay, blur_overlay, GTK_TYPE_WIDGET)
static void
blur_overlay_set_overlay_child (GtkWidget *widget,
@@ -204,7 +204,7 @@ blur_overlay_size_allocate (GtkWidget *widget,
GtkWidget *child;
GtkWidget *main_widget;
main_widget = gtk_bin_get_child (GTK_BIN (overlay));
main_widget = overlay->main_widget;
if (main_widget && gtk_widget_get_visible (main_widget))
gtk_widget_size_allocate (main_widget,
&(GtkAllocation) {
@@ -290,43 +290,6 @@ blur_overlay_get_child_position (BlurOverlay *overlay,
return TRUE;
}
static void
blur_overlay_add (GtkContainer *container,
GtkWidget *widget)
{
BlurOverlay *overlay = BLUR_OVERLAY (container);
gtk_widget_insert_after (widget, GTK_WIDGET (container), NULL);
overlay->main_widget = widget;
}
static void
blur_overlay_remove (GtkContainer *container,
GtkWidget *widget)
{
BlurOverlay *overlay = BLUR_OVERLAY (container);
gtk_widget_unparent (widget);
if (overlay->main_widget == widget)
overlay->main_widget = NULL;
}
static void
blur_overlay_forall (GtkContainer *overlay,
GtkCallback callback,
gpointer callback_data)
{
GtkWidget *child;
child = gtk_widget_get_first_child (GTK_WIDGET (overlay));
while (child != NULL)
{
GtkWidget *next = gtk_widget_get_next_sibling (child);
(* callback) (child, callback_data);
child = next;
}
}
static void
blur_overlay_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
@@ -420,21 +383,32 @@ blur_overlay_snapshot (GtkWidget *widget,
gsk_render_node_unref (main_widget_node);
}
static void
blur_overlay_dispose (GObject *object)
{
BlurOverlay *overlay = BLUR_OVERLAY (object);
GtkWidget *child;
g_clear_pointer (&overlay->main_widget, gtk_widget_unparent);
while ((child = gtk_widget_get_first_child (GTK_WIDGET (overlay))))
gtk_widget_unparent (child);
G_OBJECT_CLASS (blur_overlay_parent_class)->dispose (object);
}
static void
blur_overlay_class_init (BlurOverlayClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
object_class->dispose = blur_overlay_dispose;
widget_class->measure = blur_overlay_measure;
widget_class->size_allocate = blur_overlay_size_allocate;
widget_class->snapshot = blur_overlay_snapshot;
container_class->add = blur_overlay_add;
container_class->remove = blur_overlay_remove;
container_class->forall = blur_overlay_forall;
klass->get_child_position = blur_overlay_get_child_position;
signals[GET_CHILD_POSITION] =
@@ -477,3 +451,11 @@ blur_overlay_add_overlay (BlurOverlay *overlay,
blur_overlay_set_overlay_child (widget, child);
}
void
blur_overlay_set_child (BlurOverlay *overlay,
GtkWidget *widget)
{
gtk_widget_insert_after (widget, GTK_WIDGET (overlay), NULL);
overlay->main_widget = widget;
}

View File

@@ -37,14 +37,14 @@ typedef struct _BlurOverlayClass BlurOverlayClass;
struct _BlurOverlay
{
GtkBin parent_instance;
GtkWidget parent_instance;
GtkWidget *main_widget;
};
struct _BlurOverlayClass
{
GtkBinClass parent_class;
GtkWidgetClass parent_class;
gboolean (*get_child_position) (BlurOverlay *overlay,
GtkWidget *widget,
@@ -59,6 +59,9 @@ GDK_AVAILABLE_IN_ALL
void blur_overlay_add_overlay (BlurOverlay *overlay,
GtkWidget *widget,
double blur);
GDK_AVAILABLE_IN_ALL
void blur_overlay_set_child (BlurOverlay *overlay,
GtkWidget *widget);
G_END_DECLS

View File

@@ -118,7 +118,7 @@ do_clipboard (GtkWidget *do_widget)
gtk_widget_set_margin_top (vbox, 8);
gtk_widget_set_margin_bottom (vbox, 8);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
label = gtk_label_new ("\"Copy\" will copy the text\nin the entry to the clipboard");

View File

@@ -324,7 +324,7 @@ do_combobox (GtkWidget *do_widget)
gtk_widget_set_margin_end (vbox, 10);
gtk_widget_set_margin_top (vbox, 10);
gtk_widget_set_margin_bottom (vbox, 10);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
/* A combobox demonstrating cell renderers, separators and
* insensitive rows
@@ -337,7 +337,7 @@ do_combobox (GtkWidget *do_widget)
gtk_widget_set_margin_end (box, 5);
gtk_widget_set_margin_top (box, 5);
gtk_widget_set_margin_bottom (box, 5);
gtk_container_add (GTK_CONTAINER (frame), box);
gtk_frame_set_child (GTK_FRAME (frame), box);
model = create_icon_store ();
combo = gtk_combo_box_new_with_model (model);
@@ -381,7 +381,7 @@ do_combobox (GtkWidget *do_widget)
gtk_widget_set_margin_end (box, 5);
gtk_widget_set_margin_top (box, 5);
gtk_widget_set_margin_bottom (box, 5);
gtk_container_add (GTK_CONTAINER (frame), box);
gtk_frame_set_child (GTK_FRAME (frame), box);
model = create_capital_store ();
combo = gtk_combo_box_new_with_model (model);
@@ -412,7 +412,7 @@ do_combobox (GtkWidget *do_widget)
gtk_widget_set_margin_end (box, 5);
gtk_widget_set_margin_top (box, 5);
gtk_widget_set_margin_bottom (box, 5);
gtk_container_add (GTK_CONTAINER (frame), box);
gtk_frame_set_child (GTK_FRAME (frame), box);
combo = gtk_combo_box_text_new_with_entry ();
fill_combo_entry (combo);
@@ -421,8 +421,7 @@ do_combobox (GtkWidget *do_widget)
entry = g_object_new (TYPE_MASK_ENTRY, NULL);
MASK_ENTRY (entry)->mask = "^([0-9]*|One|Two|2\302\275|Three)$";
gtk_container_remove (GTK_CONTAINER (combo), gtk_bin_get_child (GTK_BIN (combo)));
gtk_container_add (GTK_CONTAINER (combo), entry);
gtk_combo_box_set_child (GTK_COMBO_BOX (combo), entry);
/* A combobox with string IDs */
frame = gtk_frame_new ("String IDs");
@@ -433,7 +432,7 @@ do_combobox (GtkWidget *do_widget)
gtk_widget_set_margin_end (box, 5);
gtk_widget_set_margin_top (box, 5);
gtk_widget_set_margin_bottom (box, 5);
gtk_container_add (GTK_CONTAINER (frame), box);
gtk_frame_set_child (GTK_FRAME (frame), box);
combo = gtk_combo_box_text_new ();
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "never", "Not visible");

View File

@@ -21,23 +21,24 @@ struct _SimpleGrid
G_DEFINE_TYPE (SimpleGrid, simple_grid, GTK_TYPE_WIDGET)
static void
simple_grid_destroy (GtkWidget *widget)
simple_grid_dispose (GObject *object)
{
SimpleGrid *self = SIMPLE_GRID (widget);
SimpleGrid *self = SIMPLE_GRID (object);
g_clear_pointer (&self->button1, gtk_widget_destroy);
g_clear_pointer (&self->button2, gtk_widget_destroy);
g_clear_pointer (&self->button3, gtk_widget_destroy);
GTK_WIDGET_CLASS (simple_grid_parent_class)->destroy (widget);
G_OBJECT_CLASS (simple_grid_parent_class)->dispose (object);
}
static void
simple_grid_class_init (SimpleGridClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
widget_class->destroy = simple_grid_destroy;
object_class->dispose = simple_grid_dispose;
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_CONSTRAINT_LAYOUT);
}
@@ -257,16 +258,16 @@ do_constraints (GtkWidget *do_widget)
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Constraints");
header = gtk_header_bar_new ();
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Constraints");
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_add (GTK_CONTAINER (window), box);
gtk_window_set_child (GTK_WINDOW (window), box);
grid = g_object_new (simple_grid_get_type (), NULL);
gtk_widget_set_hexpand (grid, TRUE);

View File

@@ -22,23 +22,24 @@ struct _InteractiveGrid
G_DEFINE_TYPE (InteractiveGrid, interactive_grid, GTK_TYPE_WIDGET)
static void
interactive_grid_destroy (GtkWidget *widget)
interactive_grid_dispose (GObject *object)
{
InteractiveGrid *self = INTERACTIVE_GRID (widget);
InteractiveGrid *self = INTERACTIVE_GRID (object);
g_clear_pointer (&self->button1, gtk_widget_destroy);
g_clear_pointer (&self->button2, gtk_widget_destroy);
g_clear_pointer (&self->button3, gtk_widget_destroy);
GTK_WIDGET_CLASS (interactive_grid_parent_class)->destroy (widget);
G_OBJECT_CLASS (interactive_grid_parent_class)->dispose (object);
}
static void
interactive_grid_class_init (InteractiveGridClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
widget_class->destroy = interactive_grid_destroy;
object_class->dispose = interactive_grid_dispose;
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_CONSTRAINT_LAYOUT);
}
@@ -213,16 +214,16 @@ do_constraints2 (GtkWidget *do_widget)
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Constraints");
header = gtk_header_bar_new ();
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Constraints");
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_add (GTK_CONTAINER (window), box);
gtk_window_set_child (GTK_WINDOW (window), box);
grid = g_object_new (interactive_grid_get_type (), NULL);
gtk_widget_set_hexpand (grid, TRUE);

View File

@@ -20,23 +20,24 @@ struct _VflGrid
G_DEFINE_TYPE (VflGrid, vfl_grid, GTK_TYPE_WIDGET)
static void
vfl_grid_destroy (GtkWidget *widget)
vfl_grid_dispose (GObject *object)
{
VflGrid *self = VFL_GRID (widget);
VflGrid *self = VFL_GRID (object);
g_clear_pointer (&self->button1, gtk_widget_destroy);
g_clear_pointer (&self->button2, gtk_widget_destroy);
g_clear_pointer (&self->button3, gtk_widget_destroy);
GTK_WIDGET_CLASS (vfl_grid_parent_class)->destroy (widget);
G_OBJECT_CLASS (vfl_grid_parent_class)->dispose (object);
}
static void
vfl_grid_class_init (VflGridClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
widget_class->destroy = vfl_grid_destroy;
object_class->dispose = vfl_grid_dispose;
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_CONSTRAINT_LAYOUT);
}
@@ -133,16 +134,16 @@ do_constraints3 (GtkWidget *do_widget)
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Constraints");
header = gtk_header_bar_new ();
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Constraints");
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_add (GTK_CONTAINER (window), box);
gtk_window_set_child (GTK_WINDOW (window), box);
grid = g_object_new (vfl_grid_get_type (), NULL);
gtk_widget_set_hexpand (grid, TRUE);

View File

@@ -34,7 +34,7 @@ do_css_accordion (GtkWidget *do_widget)
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_halign (container, GTK_ALIGN_CENTER);
gtk_widget_set_valign (container, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (window), container);
gtk_window_set_child (GTK_WINDOW (window), container);
child = gtk_button_new_with_label ("This");
gtk_container_add (GTK_CONTAINER (container), child);

View File

@@ -92,7 +92,7 @@ do_css_basics (GtkWidget *do_widget)
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
container = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (window), container);
gtk_window_set_child (GTK_WINDOW (window), container);
child = gtk_text_view_new_with_buffer (text);
gtk_container_add (GTK_CONTAINER (container), child);
g_signal_connect (text, "changed",

View File

@@ -94,7 +94,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
container = gtk_overlay_new ();
gtk_container_add (GTK_CONTAINER (window), container);
gtk_window_set_child (GTK_WINDOW (window), container);
child = gtk_drawing_area_new ();
gtk_widget_set_name (child, "canvas");

View File

@@ -80,7 +80,7 @@ do_css_pixbufs (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_container_add (GTK_CONTAINER (window), paned);
gtk_window_set_child (GTK_WINDOW (window), paned);
/* Need a filler so we get a handle */
child = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);

View File

@@ -99,7 +99,7 @@ do_css_shadows (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_container_add (GTK_CONTAINER (window), paned);
gtk_window_set_child (GTK_WINDOW (window), paned);
child = create_toolbar ();
gtk_container_add (GTK_CONTAINER (paned), child);

View File

@@ -118,14 +118,14 @@ do_dialog (GtkWidget *do_widget)
gtk_widget_set_margin_end (frame, 8);
gtk_widget_set_margin_top (frame, 8);
gtk_widget_set_margin_bottom (frame, 8);
gtk_container_add (GTK_CONTAINER (window), frame);
gtk_window_set_child (GTK_WINDOW (window), frame);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_widget_set_margin_start (vbox, 8);
gtk_widget_set_margin_end (vbox, 8);
gtk_widget_set_margin_top (vbox, 8);
gtk_widget_set_margin_bottom (vbox, 8);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_frame_set_child (GTK_FRAME (frame), vbox);
/* Standard message dialog */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);

View File

@@ -443,7 +443,7 @@ do_dnd (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), box);
gtk_window_set_child (GTK_WINDOW (window), box);
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (box), box2);
@@ -474,7 +474,7 @@ do_dnd (GtkWidget *do_widget)
box3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_add_css_class (box3, "linked");
gtk_container_add (GTK_CONTAINER (sw), box3);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), box3);
for (i = 0; colors[i]; i++)
{

View File

@@ -42,7 +42,9 @@ create_surface (GtkWidget *widget)
}
static void
scribble_size_allocate (GtkWidget *widget)
scribble_resize (GtkWidget *widget,
int width,
int height)
{
create_surface (widget);
}
@@ -202,7 +204,7 @@ do_drawingarea (GtkWidget *do_widget)
gtk_widget_set_margin_end (vbox, 16);
gtk_widget_set_margin_top (vbox, 16);
gtk_widget_set_margin_bottom (vbox, 16);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
/*
* Create the checkerboard area
@@ -221,7 +223,7 @@ do_drawingarea (GtkWidget *do_widget)
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100);
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 100);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), checkerboard_draw, NULL, NULL);
gtk_container_add (GTK_CONTAINER (frame), da);
gtk_frame_set_child (GTK_FRAME (frame), da);
/*
* Create the scribble area
@@ -240,10 +242,10 @@ do_drawingarea (GtkWidget *do_widget)
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100);
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 100);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), scribble_draw, NULL, NULL);
gtk_container_add (GTK_CONTAINER (frame), da);
gtk_frame_set_child (GTK_FRAME (frame), da);
g_signal_connect (da, "size-allocate",
G_CALLBACK (scribble_size_allocate), NULL);
g_signal_connect (da, "resize",
G_CALLBACK (scribble_resize), NULL);
drag = gtk_gesture_drag_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), GDK_BUTTON_PRIMARY);

View File

@@ -360,7 +360,7 @@ do_editable_cells (GtkWidget *do_widget)
gtk_widget_set_margin_end (vbox, 5);
gtk_widget_set_margin_top (vbox, 5);
gtk_widget_set_margin_bottom (vbox, 5);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_label_new ("Shopping list (you can edit the cells!)"));
@@ -387,7 +387,7 @@ do_editable_cells (GtkWidget *do_widget)
g_object_unref (numbers_model);
g_object_unref (items_model);
gtk_container_add (GTK_CONTAINER (sw), treeview);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), treeview);
/* some buttons */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);

View File

@@ -59,7 +59,7 @@ do_entry_completion (GtkWidget *do_widget)
gtk_widget_set_margin_end (vbox, 5);
gtk_widget_set_margin_top (vbox, 5);
gtk_widget_set_margin_bottom (vbox, 5);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), "Completion demo, try writing <b>total</b> or <b>gnome</b> for example.");

View File

@@ -33,7 +33,7 @@ do_entry_undo (GtkWidget *do_widget)
gtk_widget_set_margin_end (vbox, 5);
gtk_widget_set_margin_top (vbox, 5);
gtk_widget_set_margin_bottom (vbox, 5);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),

View File

@@ -78,7 +78,7 @@ do_expander (GtkWidget *do_widget)
"A second paragraph will contain even more "
"innuendo, just to make you scroll down or "
"resize the window. Do it already !", -1);
gtk_container_add (GTK_CONTAINER (sw), tv);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
gtk_container_add (GTK_CONTAINER (expander), sw);
gtk_container_add (GTK_CONTAINER (area), expander);
g_signal_connect (expander, "notify::expanded",

View File

@@ -161,7 +161,7 @@ create_menu_button (void)
GtkWidget *w = gtk_menu_button_new ();
GtkWidget *popover = gtk_popover_new ();
gtk_container_add (GTK_CONTAINER (popover), gtk_button_new_with_label ("Hey!"));
gtk_popover_set_child (GTK_POPOVER (popover), gtk_button_new_with_label ("Hey!"));
gtk_popover_set_autohide (GTK_POPOVER (popover), FALSE);
gtk_menu_button_set_popover (GTK_MENU_BUTTON (w), popover);
g_signal_connect (w, "map", G_CALLBACK (mapped), NULL);
@@ -194,7 +194,7 @@ static void
set_widget_type (GtkFishbowl *fishbowl,
int widget_type_index)
{
GtkWidget *window, *headerbar;
GtkWidget *window;
if (widget_type_index == selected_widget_type)
return;
@@ -205,9 +205,8 @@ set_widget_type (GtkFishbowl *fishbowl,
widget_types[selected_widget_type].create_func);
window = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (fishbowl)));
headerbar = gtk_window_get_titlebar (GTK_WINDOW (window));
gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar),
widget_types[selected_widget_type].name);
gtk_window_set_title (GTK_WINDOW (window),
widget_types[selected_widget_type].name);
}
void

View File

@@ -131,10 +131,10 @@ create_demo_window (GtkWidget *do_widget)
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (window), sw);
gtk_window_set_child (GTK_WINDOW (window), sw);
fixed = gtk_fixed_new ();
gtk_container_add (GTK_CONTAINER (sw), fixed);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), fixed);
gtk_widget_set_halign (GTK_WIDGET (fixed), GTK_ALIGN_CENTER);
gtk_widget_set_valign (GTK_WIDGET (fixed), GTK_ALIGN_CENTER);

View File

@@ -37,7 +37,7 @@ color_swatch_new (const gchar *color)
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (area), 24);
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (area), 24);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (area), draw_color, (gpointer) color, NULL);
gtk_container_add (GTK_CONTAINER (button), area);
gtk_button_set_child (GTK_BUTTON (button), area);
return button;
}
@@ -735,8 +735,8 @@ do_flowbox (GtkWidget *do_widget)
gtk_flow_box_set_max_children_per_line (GTK_FLOW_BOX (flowbox), 30);
gtk_flow_box_set_selection_mode (GTK_FLOW_BOX (flowbox), GTK_SELECTION_NONE);
gtk_container_add (GTK_CONTAINER (scrolled), flowbox);
gtk_container_add (GTK_CONTAINER (window), scrolled);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), flowbox);
gtk_window_set_child (GTK_WINDOW (window), scrolled);
for (i = 0; colors[i]; i++)
gtk_container_add (GTK_CONTAINER (flowbox), color_swatch_new (colors[i]));

View File

@@ -4,10 +4,10 @@
<object class="GtkWindow" id="window">
<property name="default-width">600</property>
<property name="default-height">500</property>
<property name="title">Font Explorer</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="show-title-buttons">1</property>
<property name="title">Font Explorer</property>
<child>
<object class="GtkButton" id="reset">
<property name="receives-default">1</property>

View File

@@ -93,7 +93,7 @@ do_gears (GtkWidget *do_widget)
gtk_widget_set_margin_top (overlay, 12);
gtk_widget_set_margin_bottom (overlay, 12);
gtk_container_add (GTK_CONTAINER (window), overlay);
gtk_window_set_child (GTK_WINDOW (window), overlay);
frame = gtk_frame_new (NULL);
gtk_widget_set_halign (frame, GTK_ALIGN_START);
@@ -103,11 +103,11 @@ do_gears (GtkWidget *do_widget)
fps_label = gtk_label_new ("");
gtk_widget_set_halign (fps_label, GTK_ALIGN_START);
gtk_container_add (GTK_CONTAINER (frame), fps_label);
gtk_frame_set_child (GTK_FRAME (frame), fps_label);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
gtk_box_set_spacing (GTK_BOX (box), 6);
gtk_container_add (GTK_CONTAINER (overlay), box);
gtk_overlay_set_child (GTK_OVERLAY (overlay), box);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
gtk_box_set_spacing (GTK_BOX (box), 6);

View File

@@ -153,7 +153,7 @@ do_gestures (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
drawing_area = gtk_drawing_area_new ();
gtk_container_add (GTK_CONTAINER (window), drawing_area);
gtk_window_set_child (GTK_WINDOW (window), drawing_area);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area),
drawing_area_draw,

View File

@@ -401,7 +401,7 @@ create_glarea_window (GtkWidget *do_widget)
gtk_widget_set_margin_top (box, 12);
gtk_widget_set_margin_bottom (box, 12);
gtk_box_set_spacing (GTK_BOX (box), 6);
gtk_container_add (GTK_CONTAINER (window), box);
gtk_window_set_child (GTK_WINDOW (window), box);
gl_area = gtk_gl_area_new ();
gtk_widget_set_hexpand (gl_area, TRUE);

View File

@@ -2,9 +2,8 @@
*
* GtkHeaderBar is a container that is suitable for implementing
* window titlebars. One of its features is that it can position
* a title (and optional subtitle) centered with regard to the
* full width, regardless of variable-width content at the left
* or right.
* a title centered with regard to the full width, regardless of
* variable-width content at the left or right.
*
* It is commonly used with gtk_window_set_titlebar()
*/
@@ -25,36 +24,35 @@ do_headerbar (GtkWidget *do_widget)
{
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Welcome to Facebook - Log in, sign up or learn more");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
header = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Welcome to Facebook - Log in, sign up or learn more");
gtk_header_bar_set_has_subtitle (GTK_HEADER_BAR (header), FALSE);
button = gtk_button_new ();
icon = g_themed_icon_new ("mail-send-receive-symbolic");
image = gtk_image_new_from_gicon (icon);
g_object_unref (icon);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_button_set_child (GTK_BUTTON (button), image);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_add_css_class (box, "linked");
button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("pan-start-symbolic"));
gtk_button_set_child (GTK_BUTTON (button), gtk_image_new_from_icon_name ("pan-start-symbolic"));
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("pan-end-symbolic"));
gtk_button_set_child (GTK_BUTTON (button), gtk_image_new_from_icon_name ("pan-end-symbolic"));
gtk_container_add (GTK_CONTAINER (box), button);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), box);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
gtk_container_add (GTK_CONTAINER (window), gtk_text_view_new ());
gtk_window_set_child (GTK_WINDOW (window), gtk_text_view_new ());
}
if (!gtk_widget_get_visible (window))

View File

@@ -266,8 +266,8 @@ do_hypertext (GtkWidget *do_widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (window), sw);
gtk_container_add (GTK_CONTAINER (sw), view);
gtk_window_set_child (GTK_WINDOW (window), sw);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
show_page (buffer, 1);
}

View File

@@ -66,9 +66,9 @@ populate_icons (void)
hincrement = 0;
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (scrolledwindow), grid);
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), grid);
}
static char *content;
@@ -102,9 +102,9 @@ populate_text (gboolean hilight)
hincrement = 0;
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (scrolledwindow), textview);
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), textview);
}
static void
@@ -126,9 +126,9 @@ populate_image (void)
hincrement = 5;
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (scrolledwindow), image);
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), image);
}
static void
@@ -137,9 +137,8 @@ set_widget_type (int type)
if (tick_cb)
gtk_widget_remove_tick_callback (window, tick_cb);
if (gtk_bin_get_child (GTK_BIN (scrolledwindow)))
gtk_container_remove (GTK_CONTAINER (scrolledwindow),
gtk_bin_get_child (GTK_BIN (scrolledwindow)));
if (gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (scrolledwindow)))
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), NULL);
selected = type;

View File

@@ -263,7 +263,7 @@ do_iconview (GtkWidget *do_widget)
load_pixbufs ();
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
tool_bar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (vbox), tool_bar);
@@ -312,7 +312,7 @@ do_iconview (GtkWidget *do_widget)
/* Connect to the "item-activated" signal */
g_signal_connect (icon_view, "item-activated",
G_CALLBACK (item_activated), store);
gtk_container_add (GTK_CONTAINER (sw), icon_view);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), icon_view);
gtk_widget_grab_focus (icon_view);
}

View File

@@ -146,7 +146,7 @@ do_iconview_edit (GtkWidget *do_widget)
"text", COL_TEXT,
NULL);
gtk_container_add (GTK_CONTAINER (window), icon_view);
gtk_window_set_child (GTK_WINDOW (window), icon_view);
}
if (!gtk_widget_get_visible (window))

View File

@@ -346,7 +346,7 @@ do_images (GtkWidget *do_widget)
gtk_widget_set_margin_end (base_vbox, 16);
gtk_widget_set_margin_top (base_vbox, 16);
gtk_widget_set_margin_bottom (base_vbox, 16);
gtk_container_add (GTK_CONTAINER (window), base_vbox);
gtk_window_set_child (GTK_WINDOW (window), base_vbox);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 16);
gtk_container_add (GTK_CONTAINER (base_vbox), hbox);
@@ -367,7 +367,7 @@ do_images (GtkWidget *do_widget)
image = gtk_image_new_from_icon_name ("gtk3-demo");
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
gtk_container_add (GTK_CONTAINER (frame), image);
gtk_frame_set_child (GTK_FRAME (frame), image);
/* Animation */
@@ -384,7 +384,7 @@ do_images (GtkWidget *do_widget)
picture = gtk_picture_new_for_resource ("/images/floppybuddy.gif");
gtk_container_add (GTK_CONTAINER (frame), picture);
gtk_frame_set_child (GTK_FRAME (frame), picture);
/* Symbolic icon */
@@ -402,7 +402,7 @@ do_images (GtkWidget *do_widget)
image = gtk_image_new_from_gicon (gicon);
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
gtk_container_add (GTK_CONTAINER (frame), image);
gtk_frame_set_child (GTK_FRAME (frame), image);
/* Progressive */
@@ -423,7 +423,7 @@ do_images (GtkWidget *do_widget)
* will create the pixbuf and fill it in.
*/
picture = gtk_picture_new ();
gtk_container_add (GTK_CONTAINER (frame), picture);
gtk_frame_set_child (GTK_FRAME (frame), picture);
start_progressive_loading (picture);
@@ -443,7 +443,7 @@ do_images (GtkWidget *do_widget)
video = gtk_video_new_for_resource ("/images/gtk-logo.webm");
gtk_media_stream_set_loop (gtk_video_get_media_stream (GTK_VIDEO (video)), TRUE);
gtk_container_add (GTK_CONTAINER (frame), video);
gtk_frame_set_child (GTK_FRAME (frame), video);
/* Widget paintables */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);

View File

@@ -66,7 +66,7 @@ do_infobar (GtkWidget *do_widget)
gtk_widget_set_margin_end (vbox, 8);
gtk_widget_set_margin_top (vbox, 8);
gtk_widget_set_margin_bottom (vbox, 8);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
bar = gtk_info_bar_new ();
gtk_container_add (GTK_CONTAINER (vbox), bar);
@@ -143,7 +143,7 @@ do_infobar (GtkWidget *do_widget)
gtk_widget_set_margin_end (actions, 8);
gtk_widget_set_margin_top (actions, 8);
gtk_widget_set_margin_bottom (actions, 8);
gtk_container_add (GTK_CONTAINER (frame), actions);
gtk_frame_set_child (GTK_FRAME (frame), actions);
}
if (!gtk_widget_get_visible (window))

View File

@@ -81,7 +81,7 @@ do_links (GtkWidget *do_widget)
gtk_widget_set_margin_end (label, 20);
gtk_widget_set_margin_top (label, 20);
gtk_widget_set_margin_bottom (label, 20);
gtk_container_add (GTK_CONTAINER (window), label);
gtk_window_set_child (GTK_WINDOW (window), label);
gtk_widget_show (label);
}

View File

@@ -266,7 +266,7 @@ do_list_store (GtkWidget *do_widget)
gtk_widget_set_margin_end (vbox, 8);
gtk_widget_set_margin_top (vbox, 8);
gtk_widget_set_margin_bottom (vbox, 8);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
label = gtk_label_new ("This is the bug list (note: not based on real data, it would be nice to have a nice ODBC interface to bugzilla or so, though).");
gtk_container_add (GTK_CONTAINER (vbox), label);
@@ -289,7 +289,7 @@ do_list_store (GtkWidget *do_widget)
g_object_unref (model);
gtk_container_add (GTK_CONTAINER (sw), treeview);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), treeview);
/* add columns to the tree view */
add_columns (GTK_TREE_VIEW (treeview));

View File

@@ -360,7 +360,7 @@ do_listbox (GtkWidget *do_widget)
&window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
label = gtk_label_new ("Messages from GTK and friends");
gtk_container_add (GTK_CONTAINER (vbox), label);
scrolled = gtk_scrolled_window_new (NULL, NULL);
@@ -368,7 +368,7 @@ do_listbox (GtkWidget *do_widget)
gtk_widget_set_vexpand (scrolled, TRUE);
gtk_container_add (GTK_CONTAINER (vbox), scrolled);
listbox = gtk_list_box_new ();
gtk_container_add (GTK_CONTAINER (scrolled), listbox);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), listbox);
gtk_list_box_set_sort_func (GTK_LIST_BOX (listbox), (GtkListBoxSortFunc)gtk_message_row_sort, listbox, NULL);
gtk_list_box_set_activate_on_single_click (GTK_LIST_BOX (listbox), FALSE);

View File

@@ -17,7 +17,7 @@ static gchar *current_file = NULL;
static GtkWidget *notebook;
static GtkWidget *treeview;
static GtkWidget *headerbar;
static GtkWidget *toplevel;
enum {
NAME_COLUMN,
@@ -571,7 +571,7 @@ display_image (const char *resource)
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (image, GTK_ALIGN_CENTER);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (sw), image);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), image);
return sw;
}
@@ -614,7 +614,7 @@ display_text (const char *resource)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (sw), textview);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), textview);
return sw;
}
@@ -915,7 +915,7 @@ selection_cb (GtkTreeSelection *selection,
if (filename)
load_file (name, filename);
gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar), title);
gtk_window_set_title (GTK_WINDOW (toplevel), title);
g_free (name);
g_free (title);
@@ -1030,9 +1030,9 @@ activate (GApplication *app)
info_view = (GtkWidget *)gtk_builder_get_object (builder, "info-textview");
source_view = (GtkWidget *)gtk_builder_get_object (builder, "source-textview");
headerbar = (GtkWidget *)gtk_builder_get_object (builder, "headerbar");
treeview = (GtkWidget *)gtk_builder_get_object (builder, "treeview");
model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
toplevel = GTK_WIDGET (window);
load_file (gtk_demos[0].name, gtk_demos[0].filename);

View File

@@ -31,7 +31,6 @@
</style>
<property name="default-width">800</property>
<property name="default-height">600</property>
<property name="title">GTK Demo</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="headerbar">
<property name="show-title-buttons">1</property>

View File

@@ -63,7 +63,7 @@ do_markup (GtkWidget *do_widget)
stack = gtk_stack_new ();
gtk_widget_show (stack);
gtk_container_add (GTK_CONTAINER (window), stack);
gtk_window_set_child (GTK_WINDOW (window), stack);
show_source = gtk_check_button_new_with_label ("Source");
gtk_widget_set_valign (show_source, GTK_ALIGN_CENTER);
@@ -86,7 +86,7 @@ do_markup (GtkWidget *do_widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (sw), view);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
gtk_stack_add_named (GTK_STACK (stack), sw, "formatted");
@@ -99,7 +99,7 @@ do_markup (GtkWidget *do_widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (sw), view2);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view2);
gtk_stack_add_named (GTK_STACK (stack), sw, "source");

View File

@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window1">
<property name="title" translatable="yes">Model Button</property>
<property name="resizable">0</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="show-title-buttons">1</property>
<property name="title" translatable="yes">Model Button</property>
</object>
</child>
<child>

View File

@@ -37,7 +37,7 @@ do_overlay (GtkWidget *do_widget)
overlay = gtk_overlay_new ();
grid = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (overlay), grid);
gtk_overlay_set_child (GTK_OVERLAY (overlay), grid);
entry = gtk_entry_new ();
@@ -78,7 +78,7 @@ do_overlay (GtkWidget *do_widget)
gtk_widget_set_margin_bottom (entry, 8);
gtk_container_add (GTK_CONTAINER (vbox), entry);
gtk_container_add (GTK_CONTAINER (window), overlay);
gtk_window_set_child (GTK_WINDOW (window), overlay);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@@ -57,9 +57,9 @@ do_overlay2 (GtkWidget *do_widget)
gtk_text_iter_forward_word_end (&end);
gtk_text_buffer_apply_tag (buffer, tag, &start, &end);
gtk_container_add (GTK_CONTAINER (window), overlay);
gtk_container_add (GTK_CONTAINER (overlay), sw);
gtk_container_add (GTK_CONTAINER (sw), text);
gtk_window_set_child (GTK_WINDOW (window), overlay);
gtk_overlay_set_child (GTK_OVERLAY (overlay), sw);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), text);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@@ -389,10 +389,9 @@ do_paint (GtkWidget *toplevel)
window = gtk_window_new ();
draw_area = drawing_area_new ();
gtk_container_add (GTK_CONTAINER (window), draw_area);
gtk_window_set_child (GTK_WINDOW (window), draw_area);
headerbar = gtk_header_bar_new ();
gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar), "Paint");
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (headerbar), TRUE);
colorbutton = gtk_color_button_new ();
@@ -405,6 +404,7 @@ do_paint (GtkWidget *toplevel)
gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), colorbutton);
gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
gtk_window_set_title (GTK_WINDOW (window), "Paint");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@@ -164,7 +164,7 @@ do_paintable (GtkWidget *do_widget)
nuclear = gtk_nuclear_icon_new (0.0);
image = gtk_image_new_from_paintable (nuclear);
gtk_container_add (GTK_CONTAINER (window), image);
gtk_window_set_child (GTK_WINDOW (window), image);
g_object_unref (nuclear);
}

View File

@@ -196,7 +196,7 @@ do_paintable_animated (GtkWidget *do_widget)
nuclear = gtk_nuclear_animation_new ();
image = gtk_image_new_from_paintable (nuclear);
gtk_container_add (GTK_CONTAINER (window), image);
gtk_window_set_child (GTK_WINDOW (window), image);
g_object_unref (nuclear);
}

View File

@@ -298,7 +298,7 @@ do_paintable_mediastream (GtkWidget *do_widget)
gtk_media_stream_set_loop (GTK_MEDIA_STREAM (nuclear), TRUE);
video = gtk_video_new_for_media_stream (nuclear);
gtk_container_add (GTK_CONTAINER (window), video);
gtk_window_set_child (GTK_WINDOW (window), video);
g_object_unref (nuclear);
}

View File

@@ -103,7 +103,7 @@ create_pane_options (GtkPaned *paned,
gtk_widget_set_margin_bottom (frame, 4);
table = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_frame_set_child (GTK_FRAME (frame), table);
label = gtk_label_new (label1);
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
@@ -159,7 +159,7 @@ do_panes (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Paned Widgets");
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_widget_set_margin_start (vpaned, 5);
@@ -176,7 +176,7 @@ do_panes (GtkWidget *do_widget)
gtk_paned_add1 (GTK_PANED (hpaned), frame);
button = gtk_button_new_with_mnemonic ("_Hi there");
gtk_container_add (GTK_CONTAINER(frame), button);
gtk_frame_set_child (GTK_FRAME (frame), button);
frame = gtk_frame_new (NULL);
gtk_widget_set_size_request (frame, 80, 60);

View File

@@ -40,9 +40,9 @@ do_password_entry (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
header = gtk_header_bar_new ();
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Choose a Password");
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
gtk_window_set_title (GTK_WINDOW (window), "Choose a Password");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
gtk_window_set_deletable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",
@@ -53,7 +53,7 @@ do_password_entry (GtkWidget *do_widget)
gtk_widget_set_margin_end (box, 18);
gtk_widget_set_margin_top (box, 18);
gtk_widget_set_margin_bottom (box, 18);
gtk_container_add (GTK_CONTAINER (window), box);
gtk_window_set_child (GTK_WINDOW (window), box);
entry = gtk_password_entry_new ();
gtk_password_entry_set_show_peek_icon (GTK_PASSWORD_ENTRY (entry), TRUE);

View File

@@ -276,13 +276,12 @@ do_peg_solitaire (GtkWidget *do_widget)
g_signal_connect (restart, "clicked", G_CALLBACK (restart), NULL);
header = gtk_header_bar_new ();
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Peg Solitaire");
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), restart);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Sliding Puzzle");
gtk_window_set_title (GTK_WINDOW (window), "Peg Solitaire");
gtk_window_set_titlebar (GTK_WINDOW (window), header);
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
g_signal_connect (window, "destroy",
@@ -295,7 +294,7 @@ do_peg_solitaire (GtkWidget *do_widget)
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
gtk_grid_set_row_homogeneous (GTK_GRID (grid), TRUE);
gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);
gtk_container_add (GTK_CONTAINER (window), grid);
gtk_window_set_child (GTK_WINDOW (window), grid);
for (x = 0; x < 7; x++)
{

View File

@@ -29,7 +29,7 @@ do_pickers (GtkWidget *do_widget)
gtk_widget_set_margin_bottom (table, 20);
gtk_grid_set_row_spacing (GTK_GRID (table), 3);
gtk_grid_set_column_spacing (GTK_GRID (table), 10);
gtk_container_add (GTK_CONTAINER (window), table);
gtk_window_set_child (GTK_WINDOW (window), table);
label = gtk_label_new ("Color:");
gtk_widget_set_halign (label, GTK_ALIGN_START);

View File

@@ -212,7 +212,7 @@ do_pixbufs (GtkWidget *do_widget)
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), back_height);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), draw_func, NULL, NULL);
gtk_container_add (GTK_CONTAINER (window), da);
gtk_window_set_child (GTK_WINDOW (window), da);
gtk_widget_add_tick_callback (da, on_tick, NULL, NULL);
}

View File

@@ -185,7 +185,7 @@ do_rotated_text (GtkWidget *do_widget)
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous (GTK_BOX (box), TRUE);
gtk_container_add (GTK_CONTAINER (window), box);
gtk_window_set_child (GTK_WINDOW (window), box);
/* Add a drawing area */
drawing_area = gtk_drawing_area_new ();

View File

@@ -269,7 +269,7 @@ do_search_entry (GtkWidget *do_widget)
gtk_widget_set_margin_end (vbox, 5);
gtk_widget_set_margin_top (vbox, 5);
gtk_widget_set_margin_bottom (vbox, 5);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), "Search entry demo");

View File

@@ -78,7 +78,7 @@ do_search_entry2 (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
entry = gtk_search_entry_new ();
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
@@ -87,7 +87,7 @@ do_search_entry2 (GtkWidget *do_widget)
searchbar = gtk_search_bar_new ();
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (searchbar), GTK_EDITABLE (entry));
gtk_search_bar_set_show_close_button (GTK_SEARCH_BAR (searchbar), FALSE);
gtk_container_add (GTK_CONTAINER (searchbar), container);
gtk_search_bar_set_child (GTK_SEARCH_BAR (searchbar), container);
gtk_container_add (GTK_CONTAINER (vbox), searchbar);
/* Hook the search bar to key presses */

View File

@@ -65,7 +65,7 @@ do_shortcut_triggers (GtkWidget *do_widget)
gtk_widget_set_margin_bottom (list, 6);
gtk_widget_set_margin_start (list, 6);
gtk_widget_set_margin_end (list, 6);
gtk_container_add (GTK_CONTAINER (window), list);
gtk_window_set_child (GTK_WINDOW (window), list);
for (i = 0; i < G_N_ELEMENTS (shortcuts); i++)
{

View File

@@ -74,7 +74,7 @@ do_sidebar (GtkWidget *do_widget)
g_object_set (gtk_stack_get_page (GTK_STACK (stack), widget), "title", c, NULL);
}
gtk_container_add (GTK_CONTAINER (window), box);
gtk_window_set_child (GTK_WINDOW (window), box);
}
if (!gtk_widget_get_visible (window))

View File

@@ -112,7 +112,7 @@ do_sizegroup (GtkWidget *do_widget)
gtk_widget_set_margin_end (vbox, 5);
gtk_widget_set_margin_top (vbox, 5);
gtk_widget_set_margin_bottom (vbox, 5);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
g_object_set_data_full (G_OBJECT (window), "size-group", size_group, g_object_unref);
@@ -128,7 +128,7 @@ do_sizegroup (GtkWidget *do_widget)
gtk_widget_set_margin_bottom (table, 5);
gtk_grid_set_row_spacing (GTK_GRID (table), 5);
gtk_grid_set_column_spacing (GTK_GRID (table), 10);
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_frame_set_child (GTK_FRAME (frame), table);
add_row (GTK_GRID (table), 0, size_group, "_Foreground", color_options);
add_row (GTK_GRID (table), 1, size_group, "_Background", color_options);
@@ -144,7 +144,7 @@ do_sizegroup (GtkWidget *do_widget)
gtk_widget_set_margin_bottom (table, 5);
gtk_grid_set_row_spacing (GTK_GRID (table), 5);
gtk_grid_set_column_spacing (GTK_GRID (table), 10);
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_frame_set_child (GTK_FRAME (frame), table);
add_row (GTK_GRID (table), 0, size_group, "_Dashing", dash_options);
add_row (GTK_GRID (table), 1, size_group, "_Line ends", end_options);

View File

@@ -267,15 +267,10 @@ start_puzzle (GdkPaintable *paintable)
guint x, y;
float aspect_ratio;
/* Remove the old grid (if there is one) */
grid = gtk_bin_get_child (GTK_BIN (frame));
if (grid)
gtk_container_remove (GTK_CONTAINER (frame), grid);
/* Create a new grid */
grid = gtk_grid_new ();
gtk_widget_set_can_focus (grid, TRUE);
gtk_container_add (GTK_CONTAINER (frame), grid);
gtk_aspect_frame_set_child (GTK_ASPECT_FRAME (frame), grid);
aspect_ratio = gdk_paintable_get_intrinsic_aspect_ratio (paintable);
if (aspect_ratio == 0.0)
aspect_ratio = 1.0;
@@ -345,7 +340,7 @@ reshuffle (void)
{
GtkWidget *grid;
grid = gtk_bin_get_child (GTK_BIN (frame));
grid = gtk_aspect_frame_get_child (GTK_ASPECT_FRAME (frame));
if (solved)
start_puzzle (puzzle);
else
@@ -372,13 +367,14 @@ reconfigure (void)
child = selected->data;
g_list_free (selected);
}
image = gtk_bin_get_child (GTK_BIN (child));
image = gtk_flow_box_child_get_child (GTK_FLOW_BOX_CHILD (child));
puzzle = gtk_image_get_paintable (GTK_IMAGE (image));
start_puzzle (puzzle);
start_puzzle (puzzle);
popover = gtk_widget_get_ancestor (size_spin, GTK_TYPE_POPOVER);
gtk_popover_popdown (GTK_POPOVER (popover));
grid = gtk_bin_get_child (GTK_BIN (frame));
grid = gtk_aspect_frame_get_child (GTK_ASPECT_FRAME (frame));
gtk_widget_grab_focus (grid);
}
@@ -429,7 +425,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
gtk_media_stream_play (media);
add_choice (choices, GDK_PAINTABLE (media));
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (sw), choices);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), choices);
gtk_grid_attach (GTK_GRID (tweaks), sw, 0, 0, 2, 1);
label = gtk_label_new ("Size");
@@ -445,7 +441,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
g_signal_connect (apply, "clicked", G_CALLBACK (reconfigure), NULL);
popover = gtk_popover_new ();
gtk_container_add (GTK_CONTAINER (popover), tweaks);
gtk_popover_set_child (GTK_POPOVER (popover), tweaks);
tweak = gtk_menu_button_new ();
gtk_menu_button_set_popover (GTK_MENU_BUTTON (tweak), popover);
@@ -468,7 +464,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
frame = gtk_aspect_frame_new (0.5, 0.5, (float) gdk_paintable_get_intrinsic_aspect_ratio (puzzle), FALSE);
gtk_container_add (GTK_CONTAINER (window), frame);
gtk_window_set_child (GTK_WINDOW (window), frame);
start_puzzle (puzzle);
}

View File

@@ -46,8 +46,8 @@ do_tabs (GtkWidget *do_widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (window), sw);
gtk_container_add (GTK_CONTAINER (sw), view);
gtk_window_set_child (GTK_WINDOW (window), sw);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
}
if (!gtk_widget_get_visible (window))

View File

@@ -67,9 +67,9 @@ do_tagged_entry (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
header = gtk_header_bar_new ();
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "A tagged entry");
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
gtk_window_set_title (GTK_WINDOW (window), "A tagged entry");
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_window_set_deletable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",
@@ -80,7 +80,7 @@ do_tagged_entry (GtkWidget *do_widget)
gtk_widget_set_margin_end (box, 18);
gtk_widget_set_margin_top (box, 18);
gtk_widget_set_margin_bottom (box, 18);
gtk_container_add (GTK_CONTAINER (window), box);
gtk_window_set_child (GTK_WINDOW (window), box);
entry = demo_tagged_entry_new ();
gtk_container_add (GTK_CONTAINER (box), entry);

View File

@@ -69,7 +69,7 @@ do_textmask (GtkWidget *do_widget)
da = gtk_drawing_area_new ();
gtk_container_add (GTK_CONTAINER (window), da);
gtk_window_set_child (GTK_WINDOW (window), da);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), draw_text, NULL, NULL);
}

View File

@@ -159,7 +159,7 @@ create_text_view (GtkWidget *hbox,
swindow = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (hbox), swindow);
textview = gtk_text_view_new ();
gtk_container_add (GTK_CONTAINER (swindow), textview);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), textview);
timeout = setup_scroll (GTK_TEXT_VIEW (textview), to_end);
@@ -188,7 +188,7 @@ do_textscroll (GtkWidget *do_widget)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
gtk_container_add (GTK_CONTAINER (window), hbox);
gtk_window_set_child (GTK_WINDOW (window), hbox);
create_text_view (hbox, TRUE);
create_text_view (hbox, FALSE);

View File

@@ -53,8 +53,8 @@ do_textundo (GtkWidget *do_widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (window), sw);
gtk_container_add (GTK_CONTAINER (sw), view);
gtk_window_set_child (GTK_WINDOW (window), sw);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
}
if (!gtk_widget_get_visible (window))

View File

@@ -486,7 +486,7 @@ do_textview (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Multiple Views");
vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_container_add (GTK_CONTAINER (window), vpaned);
gtk_window_set_child (GTK_WINDOW (window), vpaned);
/* For convenience, we just use the autocreated buffer from
* the first text view; you could also create the buffer
@@ -503,7 +503,7 @@ do_textview (GtkWidget *do_widget)
GTK_POLICY_AUTOMATIC);
gtk_paned_add1 (GTK_PANED (vpaned), sw);
gtk_container_add (GTK_CONTAINER (sw), view1);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view1);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
@@ -511,7 +511,7 @@ do_textview (GtkWidget *do_widget)
GTK_POLICY_AUTOMATIC);
gtk_paned_add2 (GTK_PANED (vpaned), sw);
gtk_container_add (GTK_CONTAINER (sw), view2);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view2);
create_tags (buffer);
insert_text (GTK_TEXT_VIEW (view1));
@@ -547,7 +547,7 @@ recursive_attach_view (int depth,
/* Frame is to add a black border around each child view */
frame = gtk_frame_new (NULL);
gtk_container_add (GTK_CONTAINER (frame), child_view);
gtk_frame_set_child (GTK_FRAME (frame), child_view);
gtk_text_view_add_child_at_anchor (view, frame, anchor);
@@ -594,8 +594,8 @@ easter_egg_callback (GtkWidget *button,
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (window), sw);
gtk_container_add (GTK_CONTAINER (sw), view);
gtk_window_set_child (GTK_WINDOW (window), sw);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
window_ptr = &window;
g_object_add_weak_pointer (G_OBJECT (window), window_ptr);

View File

@@ -97,7 +97,6 @@ change_theme (GtkWidget *widget,
gpointer data)
{
GtkBuilder *builder = data;
GtkWidget *header;
GtkWidget *label;
Theme next = themes[theme++ % G_N_ELEMENTS (themes)];
char *name;
@@ -107,9 +106,8 @@ change_theme (GtkWidget *widget,
"gtk-application-prefer-dark-theme", next.dark,
NULL);
header = GTK_WIDGET (gtk_builder_get_object (builder, "header"));
name = g_strconcat (next.name, next.dark ? " (dark)" : NULL, NULL);
gtk_header_bar_set_title (GTK_HEADER_BAR (header), name);
gtk_window_set_title (GTK_WINDOW (widget), name);
g_free (name);
label = GTK_WIDGET (gtk_builder_get_object (builder, "fps"));

View File

@@ -31,7 +31,7 @@ do_theming_style_classes (GtkWidget *do_widget)
builder = gtk_builder_new_from_resource ("/theming_style_classes/theming.ui");
grid = (GtkWidget *)gtk_builder_get_object (builder, "grid");
gtk_container_add (GTK_CONTAINER (window), grid);
gtk_window_set_child (GTK_WINDOW (window), grid);
g_object_unref (builder);
}

View File

@@ -29,10 +29,10 @@ do_transparent (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Transparency");
overlay = blur_overlay_new ();
gtk_container_add (GTK_CONTAINER (window), overlay);
gtk_window_set_child (GTK_WINDOW (window), overlay);
button = gtk_button_new_with_label ("Don't click this button!");
label = gtk_bin_get_child (GTK_BIN (button));
label = gtk_button_get_child (GTK_BUTTON (button));
gtk_widget_set_margin_start (label, 50);
gtk_widget_set_margin_end (label, 50);
gtk_widget_set_margin_top (label, 50);
@@ -45,7 +45,7 @@ do_transparent (GtkWidget *do_widget)
blur_overlay_add_overlay (BLUR_OVERLAY (overlay), button, 5.0);
button = gtk_button_new_with_label ("Maybe this one?");
label = gtk_bin_get_child (GTK_BIN (button));
label = gtk_button_get_child (GTK_BUTTON (button));
gtk_widget_set_margin_start (label, 50);
gtk_widget_set_margin_end (label, 50);
gtk_widget_set_margin_top (label, 50);
@@ -58,7 +58,7 @@ do_transparent (GtkWidget *do_widget)
blur_overlay_add_overlay (BLUR_OVERLAY (overlay), button, 5.0);
picture = gtk_picture_new_for_resource ("/transparent/portland-rose.jpg");
gtk_container_add (GTK_CONTAINER (overlay), picture);
blur_overlay_set_child (BLUR_OVERLAY (overlay), picture);
}
if (!gtk_widget_get_visible (window))

View File

@@ -402,7 +402,7 @@ do_tree_store (GtkWidget *do_widget)
gtk_widget_set_margin_end (vbox, 8);
gtk_widget_set_margin_top (vbox, 8);
gtk_widget_set_margin_bottom (vbox, 8);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_label_new ("Jonathan's Holiday Card Planning Sheet"));
@@ -426,7 +426,7 @@ do_tree_store (GtkWidget *do_widget)
add_columns (GTK_TREE_VIEW (treeview));
gtk_container_add (GTK_CONTAINER (sw), treeview);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), treeview);
/* expand all rows after the treeview widget has been realized */
g_signal_connect (treeview, "realize",

View File

@@ -71,11 +71,10 @@ do_video_player (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
video = gtk_video_new ();
gtk_container_add (GTK_CONTAINER (window), video);
gtk_window_set_child (GTK_WINDOW (window), video);
title = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (title), TRUE);
gtk_header_bar_set_title (GTK_HEADER_BAR (title), "Video Player");
gtk_window_set_titlebar (GTK_WINDOW (window), title);
open_button = gtk_button_new_with_mnemonic ("_Open");

View File

@@ -228,7 +228,7 @@ selected_context_changed (GtkListBox *list, IconBrowserWindow *win)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (win->search), FALSE);
label = gtk_bin_get_child (GTK_BIN (row));
label = gtk_list_box_row_get_child (GTK_LIST_BOX_ROW (row));
win->current_context = g_object_get_data (G_OBJECT (label), "context");
gtk_tree_model_filter_refilter (win->filter_model);
}

View File

@@ -25,7 +25,6 @@
<property name="default-height">768</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="header">
<property name="title" translatable="yes">Icon Browser</property>
<property name="show-title-buttons">1</property>
<child type="title">
<object class="GtkBox">

View File

@@ -273,13 +273,13 @@ text_changed (GtkTextBuffer *buffer,
}
static gboolean
text_view_query_tooltip_cb (GtkWidget *widget,
int x,
int y,
gboolean keyboard_tip,
GtkTooltip *tooltip,
NodeEditorWindow *self)
node_editor_query_tooltip (GtkWidget *widget,
int x,
int y,
gboolean keyboard_tip,
GtkTooltip *tooltip)
{
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
GtkTextIter iter;
guint i;
GString *text;
@@ -295,6 +295,7 @@ text_view_query_tooltip_cb (GtkWidget *widget,
{
gint bx, by, trailing;
gtk_widget_translate_coordinates (widget, self->text_view, x, y, &x, &y);
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (self->text_view), GTK_TEXT_WINDOW_TEXT,
x, y, &bx, &by);
gtk_text_view_get_iter_at_position (GTK_TEXT_VIEW (self->text_view), &iter, &trailing, bx, by);
@@ -757,6 +758,7 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
widget_class->realize = node_editor_window_realize;
widget_class->unrealize = node_editor_window_unrealize;
widget_class->query_tooltip = node_editor_query_tooltip;
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, text_view);
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, picture);
@@ -767,7 +769,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_name_entry);
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_save_button);
gtk_widget_class_bind_template_callback (widget_class, text_view_query_tooltip_cb);
gtk_widget_class_bind_template_callback (widget_class, open_cb);
gtk_widget_class_bind_template_callback (widget_class, save_cb);
gtk_widget_class_bind_template_callback (widget_class, export_image_cb);
@@ -796,7 +797,7 @@ node_editor_window_create_renderer_widget (gpointer item,
gtk_container_add (GTK_CONTAINER (box), picture);
row = gtk_list_box_row_new ();
gtk_container_add (GTK_CONTAINER (row), box);
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
return row;

View File

@@ -84,9 +84,9 @@
<property name="default-width">1024</property>
<property name="default-height">768</property>
<property name="focus-widget">text_view</property>
<property name="has-tooltip">1</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="header">
<property name="title" translatable="yes">GTK Node Editor</property>
<property name="show-title-buttons">1</property>
<child type="start">
<object class="GtkButton">
@@ -120,11 +120,6 @@
<property name="popover">testcase_popover</property>
</object>
</child>
<child type="title">
<object class="GtkLabel">
<property name="label" translatable="yes">GTK Node Editor</property>
</object>
</child>
</object>
</child>
<child>
@@ -144,8 +139,6 @@
<property name="left-margin">6</property>
<property name="right-margin">6</property>
<property name="bottom-margin">6</property>
<property name="has-tooltip">1</property>
<signal name="query-tooltip" handler="text_view_query_tooltip_cb"/>
<style>
<class name="editor" />
</style>

Binary file not shown.

View File

@@ -1799,7 +1799,7 @@ activate (GApplication *app)
static GActionEntry win_entries[] = {
{ "dark", NULL, NULL, "false", change_dark_state },
{ "theme", NULL, "s", "'current'", change_theme_state },
{ "transition", NULL, NULL, "false", change_transition_state },
{ "transition", NULL, NULL, "true", change_transition_state },
{ "search", activate_search, NULL, NULL, NULL },
{ "delete", activate_delete, NULL, NULL, NULL },
{ "busy", get_busy, NULL, NULL, NULL },
@@ -1816,21 +1816,27 @@ activate (GApplication *app)
{ "app.about", { "F1", NULL } },
{ "app.quit", { "<Control>q", NULL } },
{ "app.open-in", { "<Control>n", NULL } },
{ "app.cut", { "<Control>x", NULL } },
{ "app.copy", { "<Control>c", NULL } },
{ "app.paste", { "<Control>v", NULL } },
{ "win.dark", { "<Control>d", NULL } },
{ "win.search", { "<Control>s", NULL } },
{ "win.delete", { "Delete", NULL } },
{ "win.background", { "<Control>b", NULL } },
{ "win.open", { "<Control>o", NULL } },
{ "win.record", { "<Control>r", NULL } },
{ "win.lock", { "<Control>l", NULL } },
};
struct {
const gchar *action_and_target;
const gchar *accelerators[2];
} late_accels[] = {
{ "app.cut", { "<Control>x", NULL } },
{ "app.copy", { "<Control>c", NULL } },
{ "app.paste", { "<Control>v", NULL } },
{ "win.delete", { "Delete", NULL } },
};
gint i;
GPermission *permission;
GAction *action;
GError *error = NULL;
GtkEventController *controller;
g_type_ensure (my_text_view_get_type ());
@@ -1870,6 +1876,24 @@ activate (GApplication *app)
win_entries, G_N_ELEMENTS (win_entries),
window);
controller = gtk_shortcut_controller_new ();
gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_BUBBLE);
for (i = 0; i < G_N_ELEMENTS (late_accels); i++)
{
guint key;
GdkModifierType mods;
GtkShortcutTrigger *trigger;
GtkShortcutAction *ac;
gtk_accelerator_parse (late_accels[i].accelerators[0], &key, &mods);
trigger = gtk_keyval_trigger_new (key, mods);
ac = gtk_named_action_new (late_accels[i].action_and_target);
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (trigger, ac));
}
gtk_widget_add_controller (GTK_WIDGET (window), controller);
for (i = 0; i < G_N_ELEMENTS (accels); i++)
gtk_application_set_accels_for_action (GTK_APPLICATION (app), accels[i].action_and_target, accels[i].accelerators);

View File

@@ -3,24 +3,6 @@
outline-width: 0;
}
.border-inset {
border-style: inset;
}
.border-outset {
border-style: outset;
}
.border-groove {
border-style: groove;
}
.border-ridge {
border-style: ridge;
}
/* These effects use 2 lines, so show them */
.border-groove,
.border-ridge {
border-width: 2px;
.toolbar {
-gtk-icon-style: symbolic;
}

View File

@@ -461,10 +461,12 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkStack" id="toplevel_stack">
<property name="transition-duration">250</property>
<property name="transition-type">crossfade</property>
<child>
<object class="GtkStackPage">
<property name="name">page1</property>
<property name="title" translatable="yes">Page 1</property>
<property name="title" translatable="yes">Page _1</property>
<property name="use-underline">1</property>
<property name="child">
<object class="GtkBox" id="page1">
<property name="orientation">vertical</property>
@@ -1458,7 +1460,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkStackPage">
<property name="name">page2</property>
<property name="title" translatable="yes">Page 2</property>
<property name="title" translatable="yes">Page _2</property>
<property name="use-underline">1</property>
<property name="child">
<object class="GtkOverlay" id="page2">
<child type="overlay">
@@ -1776,6 +1779,10 @@ microphone-sensitivity-medium-symbolic</property>
<property name="hexpand">1</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
</object>
</child>
</object>
@@ -1793,7 +1800,6 @@ microphone-sensitivity-medium-symbolic</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="margin-start">6</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
@@ -1913,6 +1919,9 @@ microphone-sensitivity-medium-symbolic</property>
</child>
<child>
<object class="GtkBox" id="toolbar">
<style>
<class name="toolbar"/>
</style>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">New</property>
@@ -2174,7 +2183,8 @@ microphone-sensitivity-medium-symbolic</property>
<child>
<object class="GtkStackPage">
<property name="name">page3</property>
<property name="title" translatable="yes">Page 3</property>
<property name="title" translatable="yes">Page _3</property>
<property name="use-underline">1</property>
<property name="child">
<object class="GtkBox">
<property name="spacing">10</property>

View File

@@ -206,11 +206,17 @@
During the Paint phase GTK receives a single #GdkSurface::render signal on
the toplevel surface. The signal handler will create a snapshot object
(which is a helper for creating a scene graph) and call the
#GtkWidget::snapshot() vfunc, which will propagate down the widget hierarchy.
#GtkWidget::snapshot() vfunc, which will propagate down the widget hierarchy.
This lets each widget snapshot its content at the right place and time,
correctly handling things like partial transparencies and overlapping widgets.
</para>
<para>
During the snapshotting of each widget, GTK automatically handles the CSS
rendering according to the CSS box model. It snapshots first the background,
then the border, then the widget content itself, and finally the outline.
</para>
<para>
To avoid excessive work when generating scene graphs, GTK caches render nodes.
Each widget keeps a reference to its render node (which in turn, will refer to

View File

@@ -551,7 +551,7 @@ example_app_window_open (ExampleAppWindow *win,
view = gtk_text_view_new ();
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
gtk_container_add (GTK_CONTAINER (scrolled), view);
gtk_scrolled_window (GTK_SCROLLED_WINDOW (scrolled), view);
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))

View File

@@ -304,7 +304,6 @@
<title>Abstract Base Classes</title>
<xi:include href="xml/gtkwidget.xml" />
<xi:include href="xml/gtkcontainer.xml" />
<xi:include href="xml/gtkbin.xml" />
<xi:include href="xml/gtkrange.xml" />
<xi:include href="xml/gtkimcontext.xml" />
<xi:include href="xml/gtknativedialog.xml" />

View File

@@ -198,6 +198,8 @@ gtk_aspect_frame_set_ratio
gtk_aspect_frame_get_ratio
gtk_aspect_frame_set_obey_child
gtk_aspect_frame_get_obey_child
gtk_aspect_frame_set_child
gtk_aspect_frame_get_child
<SUBSECTION Standard>
GTK_ASPECT_FRAME
GTK_IS_ASPECT_FRAME
@@ -209,24 +211,6 @@ GTK_ASPECT_FRAME_GET_CLASS
gtk_aspect_frame_get_type
</SECTION>
<SECTION>
<FILE>gtkbin</FILE>
<TITLE>GtkBin</TITLE>
GtkBin
GtkBinClass
gtk_bin_get_child
<SUBSECTION Standard>
GTK_BIN
GTK_IS_BIN
GTK_TYPE_BIN
GTK_BIN_CLASS
GTK_IS_BIN_CLASS
GTK_BIN_GET_CLASS
<SUBSECTION Private>
GtkBinPrivate
gtk_bin_get_type
</SECTION>
<SECTION>
<FILE>gtkbox</FILE>
<TITLE>GtkBox</TITLE>
@@ -537,6 +521,8 @@ gtk_button_get_use_underline
gtk_button_set_use_underline
gtk_button_set_icon_name
gtk_button_get_icon_name
gtk_button_set_child
gtk_button_get_child
<SUBSECTION Standard>
GTK_BUTTON
@@ -659,6 +645,8 @@ gtk_combo_box_set_entry_text_column
gtk_combo_box_get_entry_text_column
gtk_combo_box_set_popup_fixed_width
gtk_combo_box_get_popup_fixed_width
gtk_combo_box_set_child
gtk_combo_box_get_child
<SUBSECTION Standard>
GTK_TYPE_COMBO_BOX
GTK_COMBO_BOX
@@ -1382,6 +1370,8 @@ gtk_font_chooser_dialog_get_type
GtkFrame
GtkFrameClass
gtk_frame_new
gtk_frame_set_child
gtk_frame_get_child
gtk_frame_set_label
gtk_frame_get_label
gtk_frame_set_label_widget
@@ -2200,6 +2190,8 @@ gtk_scrollbar_get_type
<TITLE>GtkScrolledWindow</TITLE>
GtkScrolledWindow
gtk_scrolled_window_new
gtk_scrolled_window_get_child
gtk_scrolled_window_set_child
gtk_scrolled_window_get_hadjustment
gtk_scrolled_window_set_hadjustment
gtk_scrolled_window_get_vadjustment
@@ -2251,6 +2243,8 @@ GtkScrolledWindowPrivate
<TITLE>GtkSearchBar</TITLE>
GtkSearchBar
gtk_search_bar_new
gtk_search_bar_set_child
gtk_search_bar_get_child
gtk_search_bar_connect_entry
gtk_search_bar_get_search_mode
gtk_search_bar_set_search_mode
@@ -3854,6 +3848,8 @@ GtkViewport
gtk_viewport_new
gtk_viewport_set_scroll_to_focus
gtk_viewport_get_scroll_to_focus
gtk_viewport_set_child
gtk_viewport_get_child
<SUBSECTION Standard>
GTK_VIEWPORT
GTK_IS_VIEWPORT
@@ -4193,6 +4189,8 @@ gtk_requisition_get_type
GtkWindow
GtkWindowClass
gtk_window_new
gtk_window_get_child
gtk_window_set_child
gtk_window_set_title
gtk_window_set_resizable
gtk_window_get_resizable
@@ -4472,7 +4470,6 @@ gtk_style_context_save
gtk_style_context_add_class
gtk_style_context_remove_class
gtk_style_context_has_class
gtk_style_context_list_classes
gtk_style_context_set_display
gtk_style_context_set_state
gtk_style_context_set_scale
@@ -5468,7 +5465,10 @@ GtkLockButtonPrivate
GtkOverlay
gtk_overlay_new
gtk_overlay_set_child
gtk_overlay_get_child
gtk_overlay_add_overlay
gtk_overlay_remove_overlay
gtk_overlay_get_measure_overlay
gtk_overlay_set_measure_overlay
gtk_overlay_get_clip_overlay
@@ -5579,14 +5579,8 @@ gtk_action_bar_get_type
<TITLE>GtkHeaderBar</TITLE>
GtkHeaderBar
gtk_header_bar_new
gtk_header_bar_set_title
gtk_header_bar_get_title
gtk_header_bar_set_subtitle
gtk_header_bar_get_subtitle
gtk_header_bar_set_has_subtitle
gtk_header_bar_get_has_subtitle
gtk_header_bar_set_custom_title
gtk_header_bar_get_custom_title
gtk_header_bar_set_title_widget
gtk_header_bar_get_title_widget
gtk_header_bar_pack_start
gtk_header_bar_pack_end
gtk_header_bar_set_show_title_buttons
@@ -5626,8 +5620,6 @@ gtk_stack_get_visible_child
gtk_stack_set_visible_child_name
gtk_stack_get_visible_child_name
gtk_stack_set_visible_child_full
gtk_stack_set_homogeneous
gtk_stack_get_homogeneous
gtk_stack_set_hhomogeneous
gtk_stack_get_hhomogeneous
gtk_stack_set_vhomogeneous
@@ -5677,6 +5669,8 @@ gtk_stack_switcher_get_type
<TITLE>GtkRevealer</TITLE>
GtkRevealer
gtk_revealer_new
gtk_revealer_get_child
gtk_revealer_set_child
gtk_revealer_get_reveal_child
gtk_revealer_set_reveal_child
gtk_revealer_get_child_revealed
@@ -5746,6 +5740,8 @@ gtk_flow_box_bind_model
<SUBSECTION GtkFlowBoxChild>
GtkFlowBoxChild
gtk_flow_box_child_new
gtk_flow_box_child_set_child
gtk_flow_box_child_get_child
gtk_flow_box_child_get_index
gtk_flow_box_child_is_selected
gtk_flow_box_child_changed
@@ -5776,6 +5772,8 @@ GtkPopover
gtk_popover_new
gtk_popover_popup
gtk_popover_popdown
gtk_popover_set_child
gtk_popover_get_child
gtk_popover_set_pointing_to
gtk_popover_get_pointing_to
gtk_popover_set_position
@@ -6225,8 +6223,6 @@ gtk_gesture_long_press_get_type
<TITLE>GtkGestureClick</TITLE>
GtkGestureClick
gtk_gesture_click_new
gtk_gesture_click_set_area
gtk_gesture_click_get_area
<SUBSECTION Standard>
GTK_TYPE_GESTURE_CLICK

View File

@@ -16,7 +16,6 @@ gtk_application_window_get_type
gtk_aspect_frame_get_type
gtk_assistant_get_type
gtk_assistant_page_get_type
gtk_bin_get_type
gtk_bin_layout_get_type
gtk_box_get_type
gtk_box_layout_get_type

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -61,16 +61,9 @@
</para>
<para>
GDK translates these raw windowing system events into #GdkEvents.
Typical input events are:
<simplelist>
<member>button clicks</member>
<member>pointer motion</member>
<member>key presses</member>
<member>focus changes</member>
<member>touch events</member>
</simplelist>
These are all represented as #GdkEvents, but you can differentiate
between different events by looking at their type, using
Typical input events are button clicks, pointer motion, key presses
or touch events. These are all represented as #GdkEvents, but you can
differentiate between different events by looking at their type, using
gdk_event_get_event_type().
</para>
<para>
@@ -103,34 +96,7 @@
location change from one widget to another.
</para></listitem>
<listitem><para>
Then the event is pushed onto a stack so you can query the currently
handled event with gtk_get_current_event().
</para></listitem>
<listitem><para>
The event is sent to a widget. If a grab is active all events for widgets
that are not in the contained in the grab widget are sent to the latter
with a few exceptions:
<itemizedlist>
<listitem><para>
Deletion and destruction events are still sent to the event widget for
obvious reasons.
</para></listitem>
<listitem><para>
Events which directly relate to the visual representation of the event
widget.
</para></listitem>
<listitem><para>
Leave events are delivered to the event widget if there was an enter
event delivered to it before without the paired leave event.
</para></listitem>
<listitem><para>
Drag events are not redirected because it is unclear what the semantics
of that would be.
</para></listitem>
</itemizedlist>
</para></listitem>
<listitem><para>
After finishing the delivery the event is popped from the event stack.
The event is sent to widgets.
</para></listitem>
</orderedlist>
@@ -139,6 +105,14 @@
(see #GtkPropagationPhase) towards a target widget.
</para>
<informalfigure>
<mediaobject>
<imageobject>
<imagedata fileref="capture-bubble.png" format="PNG"/>
</imageobject>
</mediaobject>
</informalfigure>
<para>
For key events, the top-level window gets a first shot at activating
mnemonics and accelerators. If that does not consume the events,
@@ -224,6 +198,14 @@
<para>
GTK has traditionally supported different kinds of shortcuts:
<variablelist>
<varlistentry>
<term>Accelerators</term>
<listitem><para>
Accelerators are any other shortcuts that can be activated regardless
of where the focus is, and typically trigger global actions, such as
Ctrl-Q to quit an application.
</para></listitem>
</varlistentry>
<varlistentry>
<term>Mnmemonics</term>
<listitem><para>
@@ -242,16 +224,12 @@
triggered when the widget has focus.
</para></listitem>
</varlistentry>
<varlistentry>
<term>Accelerators</term>
<listitem><para>
Accelerators are any other shortcuts that can be activated regardless
of where the focus is, and typically trigger global actions, such as
Ctrl-Q to quit an application.
</para></listitem>
</varlistentry>
</variablelist>
</para>
<para>
GTK traditionally handles accelerators and mnemonics in a global scope,
during the capture phase, and key bindings locally, during the target phase.
</para>
<para>
Under the hood, all shortcuts are represented as instances of #GtkShortcut,
and they are managed by #GtkShortcutController.

View File

@@ -214,6 +214,7 @@ images = [
'images/box-packing.png',
'images/builder-shortcuts.png',
'images/button.png',
'images/capture-bubble.png',
'images/check-button.png',
'images/checks.png',
'images/clocks-shortcuts.png',

View File

@@ -307,13 +307,13 @@ create_combo_box_entry (void)
model = (GtkTreeModel *)gtk_list_store_new (1, G_TYPE_STRING);
widget = g_object_new (GTK_TYPE_COMBO_BOX,
"has-entry", TRUE,
"model", model,
"entry-text-column", 0,
NULL);
"has-entry", TRUE,
"model", model,
"entry-text-column", 0,
NULL);
g_object_unref (model);
child = gtk_bin_get_child (GTK_BIN (widget));
child = gtk_combo_box_get_child (GTK_COMBO_BOX (widget));
gtk_editable_set_text (GTK_EDITABLE (child), "Combo Box Entry");
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
@@ -876,7 +876,7 @@ create_scrolledwindow (void)
GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
label = gtk_label_new ("Scrolled Window");
gtk_container_add (GTK_CONTAINER (scrolledwin), label);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwin), label);
return new_widget_info ("scrolledwindow", scrolledwin, MEDIUM);
}
@@ -1122,16 +1122,15 @@ create_headerbar (void)
GtkWidget *button;
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Header Bar");
view = gtk_text_view_new ();
gtk_widget_show (view);
gtk_widget_set_size_request (window, 220, 150);
gtk_container_add (GTK_CONTAINER (window), view);
gtk_window_set_child (GTK_WINDOW (window), view);
bar = gtk_header_bar_new ();
gtk_header_bar_set_title (GTK_HEADER_BAR (bar), "Header Bar");
gtk_header_bar_set_subtitle (GTK_HEADER_BAR (bar), "(subtitle)");
gtk_window_set_titlebar (GTK_WINDOW (window), bar);
button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("bookmark-new-symbolic"));
gtk_button_set_child (GTK_BUTTON (button), gtk_image_new_from_icon_name ("bookmark-new-symbolic"));
gtk_header_bar_pack_end (GTK_HEADER_BAR (bar), button);
return new_widget_info ("headerbar", window, ASIS);
@@ -1233,7 +1232,7 @@ create_sidebar (void)
gtk_container_add (GTK_CONTAINER (hbox), sidebar);
gtk_container_add (GTK_CONTAINER (hbox), gtk_separator_new (GTK_ORIENTATION_VERTICAL));
gtk_container_add (GTK_CONTAINER (hbox), stack);
gtk_container_add (GTK_CONTAINER (frame), hbox);
gtk_frame_set_child (GTK_FRAME (frame), hbox);
return new_widget_info ("sidebar", frame, ASIS);
}

View File

@@ -113,7 +113,7 @@ activate (GApplication *app,
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), G_MENU_MODEL (button_menu));
gtk_widget_set_halign (GTK_WIDGET (button), GTK_ALIGN_CENTER);
gtk_widget_set_valign (GTK_WIDGET (button), GTK_ALIGN_START);
gtk_container_add (GTK_CONTAINER (win), button);
gtk_window_set_child (GTK_WINDOW (window), button);
gtk_widget_show (win);
g_object_unref (button_menu);

View File

@@ -37,7 +37,7 @@ search_text_changed (GtkEntry *entry,
return;
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
view = gtk_bin_get_child (GTK_BIN (tab));
view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
/* Very simple-minded search implementation */
@@ -77,7 +77,7 @@ update_words (ExampleAppWindow *win)
if (tab == NULL)
return;
view = gtk_bin_get_child (GTK_BIN (tab));
view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
strings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
@@ -130,7 +130,7 @@ update_lines (ExampleAppWindow *win)
if (tab == NULL)
return;
view = gtk_bin_get_child (GTK_BIN (tab));
view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
count = gtk_text_buffer_get_line_count (buffer);
@@ -266,7 +266,7 @@ example_app_window_open (ExampleAppWindow *win,
view = gtk_text_view_new ();
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
gtk_container_add (GTK_CONTAINER (scrolled), view);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));

View File

@@ -49,7 +49,7 @@ example_app_window_open (ExampleAppWindow *win,
view = gtk_text_view_new ();
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
gtk_container_add (GTK_CONTAINER (scrolled), view);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))

View File

@@ -49,7 +49,7 @@ example_app_window_open (ExampleAppWindow *win,
view = gtk_text_view_new ();
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
gtk_container_add (GTK_CONTAINER (scrolled), view);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))

View File

@@ -72,7 +72,7 @@ example_app_window_open (ExampleAppWindow *win,
view = gtk_text_view_new ();
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
gtk_container_add (GTK_CONTAINER (scrolled), view);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));

View File

@@ -72,7 +72,7 @@ example_app_window_open (ExampleAppWindow *win,
view = gtk_text_view_new ();
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
gtk_container_add (GTK_CONTAINER (scrolled), view);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));

Some files were not shown because too many files have changed in this diff Show More