Compare commits

...

407 Commits

Author SHA1 Message Date
Matthias Clasen 2cf360cd65 window: Port to GtkMessageWindow 2022-10-30 16:45:03 -04:00
Matthias Clasen 68fa64d61e alertdialog: Port to GtkMessageWindow 2022-10-30 16:45:03 -04:00
Matthias Clasen 54ca75b529 Add GtkMessageWindow
This is a private reimplementation of GtkMessageDialog.
2022-10-30 16:45:03 -04:00
Matthias Clasen d930998f2a gtk-demo: Partial port of dialog demo
Use GtkAlertDialog for the first dialog.
2022-10-30 16:45:03 -04:00
Matthias Clasen ae3f7d3032 gtk-demo: Some updates to the picker demos 2022-10-30 14:34:07 -04:00
Matthias Clasen 5cb84afaa9 Add a test for POTFILES.in
Add a test that runs make-pot. This will only pass
if you've updated po/POTFILES.in and .skip after
moving source files around.

Unfortunately, it won't catch new source files that
are missing.
2022-10-30 08:52:02 -04:00
Matthias Clasen a36bf22134 alertdialog: Small refactoring
Move the deprecated code out into its own function.
2022-10-30 08:52:02 -04:00
Piotr Drąg 8ef8514036 Update POTFILES.in 2022-10-30 12:34:21 +01:00
Matthias Clasen c1b1e96a9a Merge branch 'deprecate-gtkdialog2' into 'main'
Deprecate GtkDialog

See merge request GNOME/gtk!5182
2022-10-29 20:39:18 +00:00
Matthias Clasen 9948053cd7 Deprecate GtkDialog
GtkDialog is too flexible in terms of UI (headerbars vs action bar,
etc), and has archaic APIs. It is time to retire it.
2022-10-29 15:27:53 -04:00
Matthias Clasen f1af8046d0 Merge branch 'matthiasc/for-main' into 'main'
Docs updates

See merge request GNOME/gtk!5180
2022-10-29 19:22:50 +00:00
Matthias Clasen 8324a93c73 Update docs
Mention new deprecations in the future migration guide.
2022-10-29 14:14:59 -04:00
Matthias Clasen 251dcc2f86 Merge branch 'async-dialog-api2' into 'main'
Add new async APIs to replace chooser dialogs

See merge request GNOME/gtk!5174
2022-10-29 17:52:13 +00:00
Matthias Clasen 2ca168d680 NEWS: Updates 2022-10-29 13:31:41 -04:00
Matthias Clasen f54ab91ff3 Deprecate GtkFileChooser and implementations
These are being replaced by GtkFileDialog.

This commit only moves the headers for GtkFileChooserWidget and
GtkFileChooserDialog to deprecated/, and keeps the implementations
in gtk/, since they will eventually be salvaged into a private
GtkFileChooserWindow.
2022-10-29 13:31:41 -04:00
Matthias Clasen 66b062a976 Deprecate GtkMessageDialog
It is getting replaced by GtkAlertDialog

This commit only moves the header to deprecated/,
and keeps the implementation in gtk/, since it will
eventually be salvaged into a private, dialog-free
widget.
2022-10-29 13:31:41 -04:00
Matthias Clasen 15572b0183 Deprecate GtkFontChooser and implementations
These are being replaced by GtkFontDialog
and GtkFontDialogButton

This commit only moves the headers for GtkFontChooserWidget and
GtkFontChooserDialog to deprecated/, and keeps the implementations
in gtk/, since they will eventually be salvaged into a private
GtkFontChooserWindow.
2022-10-29 13:31:41 -04:00
Matthias Clasen a51a6a3ee2 Deprecate GtkColorChooser and implementations
These are being replaced by GtkColorDialog
and GtkColorDialogButton.

This commit only moves the headers for GtkColorChooserWidget
and GtkColorChooserDialog to deprecated/, and keeps the
implementations in gtk/, since they will eventually be
salvaged into a private GtkColorChooserWindow.
2022-10-29 13:31:41 -04:00
Matthias Clasen 8bee62dd36 examples: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen 4248380538 print-editor: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen e7de4c1f99 node-editor: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen d620197ae1 constraint-editor: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen ad2552ee43 widget-factory: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen 756888a53d gtk-demo: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen 99e1643cdd gtk-demo: Rewrite the pickers demo
This needs some more work. For now, just have
very simple test cases for some of the new async
APIs.
2022-10-29 13:31:41 -04:00
Matthias Clasen 9839aca0bd inspector: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen 9ab732ce2d gtk: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen 6ed2d2b232 Add GtkFileDialog
Add an async API for picking a file, together with
a builder object for it. This is meant to replace direct
use of GtkFileChooserDialog.
2022-10-29 13:31:41 -04:00
Matthias Clasen cccc74786f Add GtkAlertDialog
This is replacing GtkMessageDialog with an
async API for showing informational messages.
2022-10-29 13:31:41 -04:00
Matthias Clasen aeacc8f3c5 Add GtkFontDialogButton
This is like GtkColorDialogButton, but for fonts.
2022-10-29 13:31:41 -04:00
Matthias Clasen 7d0ebe02db Add GtkFontDialog
This is similar to GtkColorDialog, but for fonts.
2022-10-29 13:31:41 -04:00
Matthias Clasen 655675e6a1 Add GtkColorDialogButton
This is a new color button implementation
built around GtkColorDialog.
2022-10-29 13:02:15 -04:00
Matthias Clasen f877f33c19 Add GtkColorDialog
Add an async API for picking a color, together with
a builder object for it. This is meant to replace direct
use of GtkColorChooserDialog.
2022-10-29 10:18:37 -04:00
Matthias Clasen 2fce117d15 Add GtkDialogError
This error domain will be used by async apis
in future commits.
2022-10-29 10:18:37 -04:00
Matthias Clasen bd5dedce12 fontchooser: Add a way to set a GtkFilter
We keep this private, since the chooser apis
are going away. This will be used in GtkFontDialog.
2022-10-29 10:18:37 -04:00
Matthias Clasen bdc91c2339 messagedialog: Cosmetics 2022-10-28 22:23:04 -04:00
Matthias Clasen 8be7515610 Merge branch 'matthiasc/for-main' into 'main'
ci: Try to fix the macos build

See merge request GNOME/gtk!5179
2022-10-29 02:08:19 +00:00
Matthias Clasen 2cef677aef ci: Require macos to build again 2022-10-28 21:39:13 -04:00
Matthias Clasen a2e2673809 ci: Try to fix the macos build
It seems that libjpeg-turbo first finds nasm,
and then doesn't find it. Turn off simd to keep
it from looking for it in the first place.
2022-10-28 21:07:58 -04:00
Matthias Clasen 2c844e961f Merge branch 'matthiasc/for-main' into 'main'
printeroptionwidget: Drop unused include

See merge request GNOME/gtk!5178
2022-10-28 23:41:03 +00:00
Matthias Clasen 5c9d68a550 printeroptionwidget: Drop unused include 2022-10-28 18:24:48 -04:00
Matthias Clasen 0248a7e43f Merge branch 'matthiasc/for-main' into 'main'
gtk4-demo: Avoid a critical from a11y code

See merge request GNOME/gtk!5177
2022-10-28 16:20:18 +00:00
Matthias Clasen b972decf82 gtk4-demo: Avoid a critical from a11y code
Even though we want to be accessible,
we must not divide by zero.
2022-10-28 12:02:23 -04:00
Emmanuele Bassi 66ec091461 Merge branch 'bilelmoussaoui/file-chooser-gi' into 'main'
g-i: Add missing since annotation

See merge request GNOME/gtk!5175
2022-10-27 17:06:22 +00:00
Bilal Elmoussaoui 6ca33c639e g-i: Add missing since annotation 2022-10-27 15:38:14 +00:00
Matthias Clasen a13a681910 Merge branch 'revert-9c919ffa462dd4511da0bfd19d36d2e15c51651b-main' into 'main'
Revert "treepopover: Do not propagate natural width of content"

See merge request GNOME/gtk!5171
2022-10-26 18:22:43 +00:00
Mat f6eb84189f Revert "treepopover: Do not propagate natural width of content"
This reverts commit 9c919ffa46.
2022-10-26 13:58:10 +03:00
Matthias Clasen 114e2b607b Merge branch 'ebassi/glade-docs' into 'main'
docs: Remove mentions of Glade

See merge request GNOME/gtk!5168
2022-10-25 00:39:57 +00:00
Emmanuele Bassi 21bc2c5078 docs: Remove mentions of Glade
Glade does not support GTK4, so we should not link to it when discussing
developing GTK4 applications.
2022-10-24 20:11:50 +01:00
Мирослав Николић a95cfb1c45 Update Serbian translation
(cherry picked from commit b760f57ae1)
2022-10-23 09:21:37 +00:00
Matthias Clasen 799fb41937 Merge branch 'deprecation-cleanups' into 'main'
gtk-demo: Replace combo boxes in font features

See merge request GNOME/gtk!5164
2022-10-22 19:23:45 +00:00
Matthias Clasen e6f4c596fa gtk-demo: Use global style in font_features 2022-10-22 11:38:46 -04:00
Matthias Clasen 3d7fb26588 gtk-demo: Replace combo boxes in font features
This is a slightly more complicated combo box,
so we need an auxiliary object.
2022-10-22 11:35:35 -04:00
Matthias Clasen 93f9b2d519 Merge branch 'deprecation-cleanups' into 'main'
gtk-demo: Remove deprecations from dnd

See merge request GNOME/gtk!5160
2022-10-22 02:32:23 +00:00
Matthias Clasen 6f3613a06f bloatpad: Stop using a combobox
Replace GtkComboBoxText with GtkDropDown+GtkStringList.
2022-10-21 22:03:17 -04:00
Matthias Clasen 3723778f42 fontchooser: Stop using deprecated harfbuzz api
The replacement is very straightforward.
2022-10-21 21:54:38 -04:00
Matthias Clasen 3fc3f8d2ff gtk-demo: Replace combobox in font rendering
Out with the combobox, in with the dropdown.
2022-10-21 21:48:39 -04:00
Matthias Clasen 2868f1b509 placesview: Drop deprecation guards
We got rid of all deprecated api here.
2022-10-21 21:48:39 -04:00
Matthias Clasen f44570e71a filechooserwidget: Drop deprecation guards
We got rid of all deprecated api here.
2022-10-21 21:48:39 -04:00
Matthias Clasen 15d39dddc5 filesystemmodel: Drop outdated comments
Drop a long comment describing an implementation
that no longer exists.
2022-10-21 21:48:39 -04:00
Matthias Clasen 1028449bcc filesystemmodel: Drop unneded deprecation guards
Nothing deprecated is used here anymore.
2022-10-21 21:48:39 -04:00
Matthias Clasen 01cca279f9 searchenginemodel: Drop unneeded deprecation guards
Nothing deprecated is used here anymore.
2022-10-21 21:48:39 -04:00
Matthias Clasen a7cae4bffa gtk-demo: Remove deprecations from characters
Make the characters demo use global style providers.
2022-10-21 21:48:39 -04:00
Matthias Clasen 3e2e29a1dc gtk-demo: Remove deprecations from sizegroup demo
Out with the comboboxes, in with the dropdowns.
2022-10-21 21:48:39 -04:00
Matthias Clasen de069e15c2 gtk-demo: Remove deprecation from textview demo
Use a dropdown instead of a combobox for the widget
embedding. It's better!
2022-10-21 21:48:39 -04:00
Matthias Clasen f8edefd7c0 gtk-demo: Remove deprecations from gltransitions
Make the GL transitions demo use global style providers.
2022-10-21 21:48:39 -04:00
Matthias Clasen 24a15b51fe gtk-demo: Remove deprecations from solitaire
Make the solitaire game use global style providers.
2022-10-21 21:48:39 -04:00
Matthias Clasen 1f7aba345d gtk=demo: Drop unneeded deprecation guards
Nothing deprecated in the pixbuf paintable demo.
2022-10-21 21:48:39 -04:00
Matthias Clasen 230212c59c gtk-demo: Remove deprecations from dnd
Make the dnd demo use global style providers.
2022-10-21 21:48:39 -04:00
Matthias Clasen 86f7c19b91 Merge branch 'wip/corey/file-chooser-popup' into 'main'
filechooserwidget: Fix popup issues

See merge request GNOME/gtk!5161
2022-10-22 00:36:26 +00:00
Corey Berla e5cea4e39d filechooserwidget: Show popup when clicking on empty space
Add gesture to right click or long press in the empty space
in the FileChooserWidget.  Only show the global settings when
clicking on the empty space.
2022-10-21 13:57:21 -07:00
Corey Berla 22aca8952f filechoosercell: Select item when right click or long press 2022-10-21 13:57:15 -07:00
Corey Berla c0e437d163 filechoosercell: Only use long press when in touch mode 2022-10-21 13:57:11 -07:00
Corey Berla ffe97a453f filechoosercell: Claim sequence on click 2022-10-21 13:57:06 -07:00
Matthias Clasen c09ba28b06 Merge branch 'gbsneto/filechooser-column-view' into 'main'
Port filechooser to GtkColumnView

See merge request GNOME/gtk!5108
2022-10-21 19:42:24 +00:00
Matthias Clasen 81de43eba5 Merge branch 'matthiasc/for-main' into 'main'
Bump the GLib requirement

See merge request GNOME/gtk!5158
2022-10-21 16:26:57 +00:00
Matthias Clasen 788be8b945 filesystemmodel: Fix a compiler warning 2022-10-21 12:15:36 -04:00
Matthias Clasen 0370979225 theme: Fix up padding for the file chooser
We need the padding inside the filelistcell, so that
its event controllers cover the whole area.

Introduce a .complex style class for columnviews that
achieves that, and make the filechooser use it.
2022-10-21 08:28:58 -04:00
Matthias Clasen 943014074c Bump the GLib requirement
We now use GSignalGroup, which was introduced
in GLib 2.72.
2022-10-21 07:59:47 -04:00
Matthias Clasen c0e8523a01 filesystemmodel: Fix a compiler warning 2022-10-21 07:44:13 -04:00
Matthias Clasen 8374ebe4c4 Merge branch 'gtkcompostable-c-fix-c4013' into 'main'
gtkcomposetable.c: Fix build on non-X11

See merge request GNOME/gtk!5156
2022-10-21 11:40:52 +00:00
Chun-wei Fan 611d14108d gtkcomposetable.c: Fix build on non-X11
The build breaks with a C4013 warning/error on Visual Studio because we don't
have a prototype defined for _gtk_get_datadir(), so include gtkprivate.h.

The vs2017-x64 CI did not catch this error because it is building GLib as a
fallback subproject, causing the msvc_recommended_pragmas.h header not to be
found, which is used to detect problems like this.
2022-10-21 12:29:19 +08:00
Matthias Clasen 25cf702345 filechooser: Make search results show up
The tracker search engine implementation was not
setting all the custom attributes that we require
now.

The quartz search engine will need similar fixes.
2022-10-20 22:34:41 -04:00
Matthias Clasen 1d9c61cada filechooserwidget: Remember sort columns and order
These settings existed before, we keep using them.
This loses some information about sorting by multiple
columns, but it is sufficient to get the same primary
sort column back.
2022-10-20 22:34:41 -04:00
Corey Berla 71adb26a0d filechooserwidget: Fix time_sort_func 2022-10-20 22:34:41 -04:00
Corey Berla e27fa33690 filechooser: Add show-time property
The "Show Time" setting does not take immediate effect (only after
changing folders) because it's set as a single call to
column_view_get_time_visible() on the FileChooserCell creation.
Instead create a bind a show-time property that gets updated
as the setting is changed.
2022-10-20 22:34:41 -04:00
Corey Berla f7dfead861 filechoosercell: Add a GtkDragSource
Allow dragging one or more items.  If the item dragged is not part of
the current selection, only drag that item.
2022-10-20 22:34:41 -04:00
Corey Berla aac04a0995 filechoosercell: Bind "item" and "selected" to cell 2022-10-20 22:34:41 -04:00
Corey Berla 8af191e52d filechooserwidget: Expose selection model
FileChooserCell may need to change the selection during a DND.
2022-10-20 22:34:41 -04:00
Corey Berla 06382ff836 filechooserwidget: Rename and expose get_selected_files()
GtkFileChooserCell will need this function
2022-10-20 22:34:41 -04:00
Matthias Clasen cd469788c3 filechooserwidget: Make rename popover work
Make the rename popover operate on the file that
the context menu was opened for, and pop up at
the same position.
2022-10-20 22:34:40 -04:00
Matthias Clasen 44b5076cf2 filechooserwidget: Make context menus mostly work
Move the gestures to the individual cells, and
make them trigger the context menu via an action
that takes item position and coordinates.

The semantics are changed slightly: the menu actions
now operate on the clicked item, not on the selection.

Still to do: Fix up keyboard activation.
2022-10-20 22:34:40 -04:00
Matthias Clasen e5be9e1035 filesystemmodel: Drop the model types
We are no longer storing extra values, so no need
to take their types in the api.
2022-10-20 22:34:40 -04:00
Matthias Clasen b831d01f0d filesystemmodel: Drop unused arguments
Drop the unused get_func arguments in constructors.

Update all callers.
2022-10-20 22:34:40 -04:00
Matthias Clasen 278bcf2680 filechooserentry: Simplify model construction
Don't pass a get_value callback when creating the
filesystem model. It isn't called anymore, and things
continue to work.
2022-10-20 22:34:40 -04:00
Matthias Clasen c19d0dc9ea filesystemmodel: Drop more unused api
Drop all apis that operate on tree iters.
We are no longer a tree model.
2022-10-20 22:34:40 -04:00
Matthias Clasen edd5ed169e filesystemmodel: Drop _gtk_file_system_model_get_value
This function is unused, so drop it, and its callback.
2022-10-20 22:34:40 -04:00
Matthias Clasen 8ec9c3fdc6 filechooser: Some work on popup menus
This is a start towards placing menus properly.

We once again center keyboard-triggered menus
on the file list.
2022-10-20 22:34:40 -04:00
Matthias Clasen e95022040f filechooser: Drop deprecated includes
We no longer use cell renderers and tree models
here. Yay.
2022-10-20 22:34:40 -04:00
Matthias Clasen 3a2ce620e2 filesystemmodel: Fix a possible problem
If the async query fails to reproduce a file info,
we still need to thaw the model, otherwise it ends
up frozen forever.

This was deduced by reading the code, I haven't
actually seen it happen.
2022-10-20 22:34:40 -04:00
Matthias Clasen df49bf9eec filechooserwidget: Use a string sorter for names
We can use the new collation property of GtkStringSorter,
and get the benefit of sort key caching. This commit
also fixes an accidental leak of all sorters, and
removes the sorter from the location column - we never
show that column when individual colummns are sortable.
2022-10-20 22:34:40 -04:00
Matthias Clasen 53327f3aea filechooser: Drop unnecessary theme tracking
The widgets we are using handle theme changes
themselves, so there is no need for the filechooser
to do anything.
2022-10-20 22:34:40 -04:00
Matthias Clasen c0c3d75062 filechooser: Bring back sorting
Add a sort model between the filter model and the
file system model, and set it up to sort according
to the circumstances.
2022-10-20 22:34:40 -04:00
Corey Berla d0d0409f9d filechooserwidget: Reimplement DnD Drop Target
This reverts commit 34752a15a71597d00a8d08befc545ac1c178b81b.

Leaving out the drag source portion as that needs a total
reimplementation.  The GtkDropTarget only required minor
modifications.
2022-10-20 22:34:40 -04:00
Matthias Clasen 3a7d094542 filechooserwidget: Reinstate show_and_select_files
Now that we have information about visible and
filtered-out status of items, we can make this
function work again.
2022-10-20 22:34:40 -04:00
Matthias Clasen 280adcbb8c filechooserwidget: Add a filter model
Put a filter model between the selection model and
the filesystem model, and make it filter on the
filechooser::visible attribute. This makes the filer
combo in the filterchooser and the 'show hidden files'
item work. But we need to prod the filter to trigger
a refiltering every now and then.
2022-10-20 22:34:40 -04:00
Matthias Clasen 83431a999c filesystemmodel: Make filtering info available
Provide the filtered-out and visible bits as a file attributes
under the names filechooser::filtered-out and filechooser::visible,
so that we can filter on it.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto eeeee99aa8 filechooserwidget: Connect to the right model
When recreating the browse_files_model model, connect to that
model's item-changed signal, instead of connecting to the selection
model.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 0f503e0ba2 filechooserwidget: Connect to items-changed when changing model
Just like previous commit, we need to call list_items_changed()
even if we change from single selection to multi selection or
vice-versa.
2022-10-20 22:34:40 -04:00
Matthias Clasen 3e4ae62b44 filesystemmodel: Drop an unused include 2022-10-20 22:34:40 -04:00
Matthias Clasen ec4f814bd4 filechooserwidget: Listen to items-changed too
To track changes of the selected items in a selection
model, we need to listen to both ::selection-changed
and ::items-changed.

This fixes the open button not turning sensitive
when initially loading a new folder.
2022-10-20 22:34:40 -04:00
Matthias Clasen 0141ba4e00 filechooser: Prevent recursion when activating items
When a list item is activated, we activate the default widget.
Unfortunately, due to some other bug, sometimes the open button
is not made sensitive, and then default.activate falls back
to activating the focus widget (which is the item we are just
coming from). Boom
2022-10-20 22:34:40 -04:00
Matthias Clasen 52ef16c21b actionmuxer: Add debug spew for action activation
This helps tracking down whe activation goes wrong.
2022-10-20 22:34:40 -04:00
Matthias Clasen 6ca7104015 filesystemmodel: Drop the tree model implementation
This is no longer used.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 07d6166ab8 filechooserwidget: Use GListModel API for post-renaming selection 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto dc651c3dc3 filechooserentry: Use separate GtkTreeStore for completion
Soon GtkFileSystemModel will not be a GtkTreeModel implementation,
so preemptively remove any usage of this interface. Populate the
list store using the GListModel's 'items-changed' signal.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto f520801626 filesystemmodel: Retire GtkFileSystemItem
This has to be the shortest-living object in GTK history!

It helped us greatly during the transition to GtkColumnView, but
now we can remove it in favour of GFileInfo directly. Perhaps I
could have never introduced GtkFileSystemItem in the first place,
but we're 30 commits deep and it's too late to just redo the whole
thing that will get us exactly here anyway.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 4e3fbd0b0f filesystemmodel: Always set standard::file attribute
This will help us greatly when porting GtkFileSystemModel to
GtkDirectoryList.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 8a24fdea38 filesystemmodel: Trivial cleanup
Use g_set_object() which does exactly what the code there does.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto b26222b6ba filechooserutils: Add helper to get GFile from info
This will be used extensively starting from next commit!
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto c8d291ab86 filechooserentry: Trivial cleanups
Use g_clear_object() in a couple of places. No functional changes.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 0a87438432 searchenginemodel: Use GListModel API to filter
We now start a mini-series of commits that will ultimately remove
the GtkTreeModel implementation of GtkFileSystemModel.

As a first step, port GtkSearchEngineModel iter through the files
using GListModel API.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto ddf1cd6678 filechooserwidget: Remove treeview
Now that most of the treeview usage is gone, remove the remaining
code that uses it - mostly event handling code, which for now won't
work, but will be fixed by next commits - and drop the tree view
entirely.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 9c6d5e2ca5 filechooserwidget: Use GtkSelectionModel for selection
So far, GtkFileChooserWidget has relied on GtkTreeView's selection
management. This commit moves it away from GtkTreeView, and that's
a massive surgery - sorry :(

The most important aspect of this commit is that 'selection_model'
is now the main model we deal with. Changing between directories,
recent files, and search, all sets the selection_model's model.

Selections are entirely handled by GtkSelectionModel now.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 1f2561b08e filesystemmodel: Add more GtkFileSystemItem getters
They'll help us further remove GtkTreeModel code.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto d5b31a30fd filechooserwidget: Stop centering on selected files 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 39c678988d filechooserwidget: Don't queue redraw / resize on tree view 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 9052c191cb filechooserwidget: Compare focus against column view
This effectively doesn't work, but focus will be reworked at some
point, and this gets us a tiny bit closer to that.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 766f442636 gtkfilechooserwidget: Don't set size request 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 27a3d2d09e filesystemmodel: Don't implement GtkTreeDragSource 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 3a3482e41e filechooserwidget: Remove DnD code
Another case where we'll reimplement it later.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 44c37fa34a filesystemmodel: Drop GtkTreeSortable interface
Stop implementing this interface. We'll be able to reimplement
sorting once we fully transition to GListModel.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 5c41dbfaa5 filechooserwidget: Remove sorting
This will be reimplemented later using list models. For now, let's
remove it so we can untangle all this code properly.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto c9d2ff7a0f filechooserwidget: Stop autosizing treeview 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 174af596c5 filechooserwidget: Use column view scrolled window
One less hook to treeview widgetry.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto de2624faa7 filechooserwidget: Move tooltip text to column view
Use a closure binding to query the tooltip.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto cda784a5f4 filechooserwidget: Move folder navigation to column view
React to column view's 'activate' signal, instead of treeview's
'row-activated'. It doesn't handle file sensitivity yet, but that
will probably be dropped later.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto cc33dbef03 filechooserwidget: Move keynav handling to column view 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto ce36611c4e filechooserwidget: Set rubberbanding on column view
And stop setting it on the tree view.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 038cb31d27 filesystemmodel: Don't expose cache
With this commit we start slowly cleaning up the sattelite code
surrounding GtkFileChooserWidget, so that we eventually drop it
all.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 3b53a6b0a9 filechooserwidget: Remove extra action bar 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 619ff2338e filechooserwidget: Move date and time to column view
Because this is the last treeview column, some pending tasks
are marked as TODO. We're getting close to dropping the tree
view!
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 2bcd6949df filechooserwidget: Move file type to column view 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto abd78ce5f5 filechooserwidget: Move size to column view
This was one of the easier ones. We merely delegate the hard work
to g_format_size(), like we already do for treeview.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 7899fc03c4 filechooserwidget: Move location to column view
Move the entire location column, which only contains the location
renderer, to the column view. The code to generate locations from
the current folder is essentially intact.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 9984f00781 filechooserwidget: Drop name column from treeview
It is now entirely handled by the column view.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto a0d3bdc911 filechooserwidget: Move file icon to column view
This commit moves the icon loading code into a new private
widget called GtkFileThumbnail, which is bound to the GFileInfo
of the model, and asynchronously loads the file icon from that.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto b96317b872 filechooserwidget: Move file name to column view
And remove it from the tree view. Next commits will look a lot like
this, until all columns are moved.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto 6c84958b9f filechooserwidget: Replace 'list' page with column view
Replace the 'list' page of the main stack with another page, this
one containing a GtkColumnView. This, again, is the very minimal
code to achieve a column view - and validate the GListModel code
introduced in the previous commit - but there's a long way until
this column view covers the full range of features of the file
chooser.

The tree view still lives in an unused 'list2' page. From now on,
commits will "cannibalize" the treeview, each commit porting any
particular feature - be it a column, an event controller, etc -
to the column view, and dropping the corresponding feature from
the treeview.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto f2559b1dbb filesystemmodel: Implement GListModel
This is a trivial implementation of the GListModel interface. It
does not do anything fancy, like filtering out hidden files, nor
sorting.

The purpose of this minimal implementation is to bootstrap the
initial work to port GtkFileChooserWidget to GtkColumnView.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto ed2ade4801 filesystemmodel: Use g_clear_* on finalize
Trivial cleanup, no functional changes.
2022-10-20 22:34:40 -04:00
Matthias Clasen 4549172825 Merge branch 'matthiasc/for-main' into 'main'
inspector: Fix accessibility calls

See merge request GNOME/gtk!5154
2022-10-21 02:28:02 +00:00
Matthias Clasen b877804eb6 Merge branch 'completion' into 'main'
entrycompletion: Fix inserted-text handler

See merge request GNOME/gtk!4892
2022-10-21 02:13:42 +00:00
Matthias Clasen 5310abbcf7 filechooserentry: Fix completions
Before we can drop them, lets make them work.

This was broken since 4.0, I assume :(
2022-10-20 21:41:18 -04:00
Matthias Clasen 490d4b0b9e inspector: Fix accessibility calls
The argument list of gtk_accessible_update_property
is -1-terminated, not NULL-terminated.
2022-10-20 21:19:13 -04:00
Matthias Clasen 375432f0b6 Merge branch 'columnview-sorter-api' into 'main'
gtk-demo: Add more sort columns

Closes #5149

See merge request GNOME/gtk!5152
2022-10-20 19:18:26 +00:00
Matthias Clasen c00a23ebbc Merge branch 'fix-wayland-keycode-mapping' into 'main'
wayland: Fix keycode->keyval mapping

Closes #5277

See merge request GNOME/gtk!5147
2022-10-20 19:15:38 +00:00
Matthias Clasen 4cd2e2a11f Merge branch 'ebassi/tree-deprecation-docs' into 'main'
docs: Add deprecation messages to GtkTreeStore

See merge request GNOME/gtk!5115
2022-10-20 18:39:29 +00:00
Matthias Clasen ae7bf4dcf7 Merge branch 'wip/jtojnar/compose-consistent-system' into 'main'
Improve composetable inclusions

See merge request GNOME/gtk!5150
2022-10-20 18:28:47 +00:00
Matthias Clasen 9ed1505073 columnviewtitle: Clean up interactions
Separate the apis we use for updating title,
menu and sort indicator.
2022-10-20 13:57:33 -04:00
Matthias Clasen e040d3663e columnviewsorter: Add public API
This API should be sufficient to serialize
a columnviews sort configuration.

Fixes: #5149
2022-10-20 13:06:45 -04:00
Matthias Clasen 6af69a7b7d Make GtkColumnViewSorter public
API is yet to come.
2022-10-20 13:01:18 -04:00
Matthias Clasen a116e0dd26 columnviewsorter: Cosmetics 2022-10-20 13:01:18 -04:00
Matthias Clasen 3e2b962a36 columnviewcolumn: Add an ID
This string can be used when storing columnview
configuration.
2022-10-20 13:01:18 -04:00
Matthias Clasen abb60ec579 columnviewcolumn: Remove some unused code 2022-10-20 11:44:05 -04:00
Matthias Clasen b738d4a6ac columnviewcolumn: Cosmetics 2022-10-20 11:44:05 -04:00
Matthias Clasen 0149bd49ca gtk-demo: Add more sort columns
Add a second sort column to the Settings demo,
to make it easier to test column view sorting.
2022-10-20 11:44:05 -04:00
Emmanuele Bassi e05157437f Add more messages to the deprecation warnings
Point to replacement types for the old GtkTree* API.
2022-10-20 15:39:07 +01:00
Emmanuele Bassi e045e798a2 Mark GtkStyleContext type as deprecated
Add the Deprecated tag to the type docblock
2022-10-20 15:39:07 +01:00
Emmanuele Bassi 7908a72fa9 Mark GtkEntryCompletion type as deprecated
Add the Deprecated tag to the type docblock.
2022-10-20 15:39:07 +01:00
Emmanuele Bassi 593bf2bc6d Mark GtkTreeView-related types as deprecated
Add the Deprecated annotation to the type docblock.
2022-10-20 15:39:07 +01:00
Jan Tojnar cf701d5db4 imcontextsimple: Document that Compose file support is incomplete
And that `include "%L"` does something different as introduced in
https://gitlab.gnome.org/GNOME/gtk/-/commit/3b4b1c68781aad61fc6b91c9dff75b5790b4d8e4

Note that user can still use `include "/.%L"` as a workaround.
2022-10-20 16:19:13 +02:00
Emmanuele Bassi bf8d4c5418 Mark GtkAppChooser-related types as deprecated
The type docblock needs a Deprecated annotation.
2022-10-20 14:38:31 +01:00
Emmanuele Bassi 912145c81b Mark GtkCellRenderer-related types as deprecated
The docblock for the type needs a Deprecated annotation, and we can use
it to point to the appropriate replacement.
2022-10-20 14:38:31 +01:00
Emmanuele Bassi 913127b553 Point at the replacement for GtkIconView
In the symbol annotations and in the docblocks.
2022-10-20 14:38:31 +01:00
Emmanuele Bassi 62f85e2f49 Point at the replacements for GtkTreeView
In the symbol annotations and in the docblocks.
2022-10-20 14:38:31 +01:00
Emmanuele Bassi 4b1212eb4a Point to replacement for GtkComboBoxText
GtkDropDown and GtkStringList replace GtkComboBoxText with a simpler
API.
2022-10-20 14:38:31 +01:00
Jan Tojnar 94a096ec4c composetable: Support non-FHS paths for Compose tables
On platforms like NixOS, the libX11 installation prefix may differ from /usr/share,
breaking the hardcoded placeholders. Let’s re-use the X11 path definition from imcontextsimple.
2022-10-20 12:59:17 +02:00
Emmanuele Bassi 404ee55ec4 Point to GtkDropDown as the GtkComboBox replacement 2022-10-20 11:10:57 +01:00
Emmanuele Bassi 5fbd52da49 docs: Add deprecation message for GtkListStore
Point to GListStore and list models instead.
2022-10-20 11:02:29 +01:00
Emmanuele Bassi 7bf094c117 docs: Add deprecation messages to GtkTreeStore
Point to GtkTreeListModel, and while we're at it, let's fix some of the
gtk-doc-isms that are still there.
2022-10-20 11:02:29 +01:00
Matthias Clasen 4bb79decf3 Merge branch 'label-selection-fix' into 'main'
label: Tweak selection behavior

Closes #2024

See merge request GNOME/gtk!5148
2022-10-19 21:37:08 +00:00
Matthias Clasen 60fb93e063 label: Tweak selection behavior
Arrange for double-click-followed-by-drag to do
select by words, not select-and-dnd. This matches
the behavior in GtkTextView better and feels
intuitive.

Fixes: #2024
2022-10-19 16:22:55 -04:00
Matthias Clasen 1894a8960e wayland: Fix keycode->keyval mapping
We were looping over the levels, but not using
the current level value to obtain the keymap
entries. Oops.

Fixes: #5277
2022-10-19 15:46:27 -04:00
Matthias Clasen 4ba5c90bc9 Merge branch 'filechooser-amberol' into 'main'
filechooser: Improve "Open in File Manager"

Closes #5260

See merge request GNOME/gtk!5140
2022-10-19 19:41:15 +00:00
Matthias Clasen 1d16bd7d30 Merge branch 'matthiasc/for-main' into 'main'
docs: Remove mention of ~/.gtk-4.0

Closes #3266

See merge request GNOME/gtk!5146
2022-10-19 19:11:57 +00:00
Matthias Clasen 17819ad4f6 filechooser: Improve "Open in File Manager"
Just relying on GAppInfo leads to suboptimal
results. Instead, call either the OpenURI portal
or the org.freedesktop.FileManager1 interface
directly, and only fall back to GAppInfo.

The wrapper code for the OpenURI portal is taken
from gio, with small adjustments.

Fixes: #5260
2022-10-19 15:01:21 -04:00
Matthias Clasen ac1ea6faca docs: Remove mention of ~/.gtk-4.0
We are not looking there anymore, for a long time.

Fixes: #3266
2022-10-19 14:36:48 -04:00
Matthias Clasen 8a3f1a1fa1 Merge branch 'builder-tool-scope' into 'main'
docs: Update gtk4-builder-tool docs

See merge request GNOME/gtk!5145
2022-10-19 18:34:25 +00:00
Matthias Clasen 46c7c0c4e6 docs: Document new buildertool options 2022-10-19 13:36:14 -04:00
Matthias Clasen dd60a9abd6 buildertool: Support enumerating callbacks
The new scope approach makes this easy, and
it can be useful to know what functions are
needed.
2022-10-19 13:36:14 -04:00
Matthias Clasen 50835ffbf6 buildertool: Improve validate implementation
Reimplement deprecation checking via a scope.
This lets us ignore missing callbacks, and helps
for validating templates.
2022-10-19 13:36:14 -04:00
Matthias Clasen 637713fe72 buildertool: Add a builder scope implementation
This will be used in future commits.
2022-10-19 13:36:14 -04:00
Matthias Clasen 7e71c868ab buildertool: Use --deprecations for templates
Use this option for templates too.

We still can't parse most templates, since they are
missing their callbacks.
2022-10-19 13:36:14 -04:00
Matthias Clasen aaf5c43e78 Merge branch 'matthiasc/for-main' into 'main'
docs: Update gtk4-builder-tool docs

See merge request GNOME/gtk!5144
2022-10-19 17:13:23 +00:00
Matthias Clasen 5fb6f0e410 Merge branch 'wip/clipboard-serials' into 'main'
gdk/wayland: Use serial of the latest implicit grab available

Closes #5250

See merge request GNOME/gtk!5143
2022-10-19 13:57:19 +00:00
Matthias Clasen cd031de680 docs: Update gtk4-builder-tool docs
Mention the new --deprecations option of the
validate command.
2022-10-19 08:50:34 -04:00
Carlos Garnacho eeda25ab04 gdk/wayland: Use serial of the latest implicit grab available
When getting the serial for primary/clipboard selections we used a
function that largely relied on a GdkEvent being passed. We have
another available function that looks up the most recent serial
given the ongoing touch/tablet input as well.

This is the second best, compared to actually knowing the
input/device from the event that was received by the UI an triggered
the clipboard operation, and is already in use in other places
(e.g. window dragging). It is valid for these situations too.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5250
2022-10-19 13:54:07 +02:00
Matthias Clasen acaf04a24e Merge branch 'builder-deprecations' into 'main'
buildertool: Fix template handling

Closes #5256

See merge request GNOME/gtk!5141
2022-10-19 11:20:37 +00:00
Matthias Clasen bcabe77799 buildertool: Warn about deprecations
Add a new option --deprecations to the validate
command that will warn about use of deprecated types.

The list of current deprecations is unfortunately
hardcoded in the source, so this list will have to
be kept up-to-date.

Fixes: #5256
2022-10-19 02:51:29 -04:00
Matthias Clasen 64cf31f348 buildertool: Fix template handling
We were not properly parsing the error message
here, leading to badness.
2022-10-19 02:51:29 -04:00
Matthias Clasen e037155a94 Merge branch 'text-overwrite-undo' into 'main'
testsuite: Fix tiff pixbuf tests

Closes #4411

See merge request GNOME/gtk!5138
2022-10-19 05:59:13 +00:00
Matthias Clasen 55cbb8a8d6 Merge branch 'clarify-gapplication-docs' into 'main'
docs: Clarify a point in GtkApplication docs

See merge request GNOME/gtk!5139
2022-10-19 03:54:36 +00:00
Matthias Clasen db599f2ae6 Merge branch 'fix-pixbuf-tiff-tests' into 'main'
testsuite: Fix tiff pixbuf tests

Closes #4615

See merge request GNOME/gtk!5137
2022-10-19 03:53:08 +00:00
Matthias Clasen 741567868e Merge branch 'modelbutton-tooltip' into 'main'
widgetfactory: Add text to iconic model buttons

Closes #5220

See merge request GNOME/gtk!5136
2022-10-19 03:51:21 +00:00
Matthias Clasen 1e5e0480fd text: Make overwrite undo-friendly
In overwrite mode, every typed character gets
handled as a delete+insert, but we should not
record these as two individually undoable
steps.

This matches how we handle overwrite mode in
GtkTextView.

Fixes: #4411
2022-10-18 23:49:16 -04:00
Matthias Clasen 917aa7928d docs: Clarify a point in GtkApplication docs
Clarify that loading of automatic resources uses
the resource base path that was set at construction
time.

Fixes: #4300
2022-10-18 23:47:48 -04:00
Matthias Clasen cd4dbd67a2 testsuite: Skip known-broken tests
The tiff pixbuf tests fail because of known
issues with the pixbuf tiff loader. Skip them.

Fixes: #4615
2022-10-18 23:22:47 -04:00
Matthias Clasen 5a6eab05e9 testsuite: Fix tiff pixbuf tests
This test wasn't actually testing what it claims,
since that functionality is broken in gdk-pixbuf.

Test it anyway.
2022-10-18 23:21:28 -04:00
Matthias Clasen 55ccaf9df9 modelbutton: Set up tooltips
Use the text of iconic model buttons as tooltip.

Fixes: #5220
2022-10-18 22:35:28 -04:00
Matthias Clasen af0e056eec widgetfactory: Add text to iconic model buttons
We want to use this for tooltips in the future.
2022-10-18 22:35:02 -04:00
Matthias Clasen 77d1f0d982 Merge branch 'matthiasc/for-main' into 'main'
fontchooser: Drop a few errant translations

Closes #5146

See merge request GNOME/gtk!5135
2022-10-19 01:53:56 +00:00
Matthias Clasen d4d7d5eafd fontchooser: Drop a few errant translations
No point in translating these properties, they
are not strings.

Fixes: #5146
2022-10-18 16:40:37 -04:00
Matthias Clasen f658027c51 Merge branch 'fix-editable-label-spurious-focus-out' into 'main'
window: Keep a reference to move_focus_widget

Closes #4864

See merge request GNOME/gtk!5134
2022-10-18 19:45:19 +00:00
Matthias Clasen 7be993b728 editablelabel: Defer changes on focus-out
We can get spurious focus-out/-in pairs when
the editable label is in a popover that gets
a Wayland keyboard enter event as a result of
clicking the editable label.

A timeout isn't a great solution, but nothing
better is available right now.

Fixes: #4864
2022-10-18 14:23:22 -04:00
Matthias Clasen e1d78821f6 window: Keep a reference to move_focus_widget
If we don't take a reference, it can happen that
the pointer is no longer valid by the time we
dereference it in after_paint.
2022-10-18 14:23:11 -04:00
Matthias Clasen 94ac1af293 Merge branch 'fix-focus-changes' into 'main'
window: Fix focus updates

Closes #4903

See merge request GNOME/gtk!5127
2022-10-18 11:02:08 +00:00
Matthias Clasen b4db48935d Merge branch 'fix-windows-build-testmountoperation' into 'main'
tests/testmountoperation.c: Fix build on Windows

See merge request GNOME/gtk!5126
2022-10-18 10:53:21 +00:00
Matthias Clasen f5063c1435 window: Don't focus invisible widgets
Only clear a queued move_focus if the widget
we are focusing is actually visible.

This was happening in some cases when popovers
are dismissed by clicking outside, and it was
causing us to miss proper focus updates that
were already queued.
2022-10-18 06:42:17 -04:00
Benjamin Otte 8092a6858e Merge branch 'bilelmoussaoui/gi-deprecated' into 'main'
g-i: Fix deprecated version of GtkTreeView

See merge request GNOME/gtk!5131
2022-10-18 09:53:53 +00:00
Bilal Elmoussaoui 0fbaeaabd0 g-i: Fix deprecated version of GtkTreeView 2022-10-18 11:27:39 +02:00
Luca Bacci 995f00d23f Merge branch 'forward-port-mr-991-to-gtk4-2' into 'main'
Use native Windows API for converting keystrokes to characters

Closes #2944

See merge request GNOME/gtk!4986
2022-10-17 19:20:08 +00:00
Matthias Clasen 100605ef0c window: Fix focus updates
This partially undoes changes from 3dbf5038fa.

That commit did two things:
1) Move the focus update to after-paint time
2) Change from grabbing focus to the visible parent
   to  calling move_focus (TAB)

The second part did have the unintended consequence
of moving focus laterally.

Fixes: #4903
2022-10-17 15:10:41 -04:00
Benjamin Otte 1246cd5e73 Merge branch 'wip/otte/for-main' into 'main'
singleselection: Be more careful about notifies

See merge request GNOME/gtk!5129
2022-10-17 18:34:40 +00:00
Benjamin Otte f30e59fed9 dropdown: Handle ::selected and ::selected-item separately
GtkSingleSelection will only emit either of those signals if they
change. But it is possible that only one of those properties changes,
and in those cases we want to only notify for that property changing in
the dropdown, too.
2022-10-17 20:11:27 +02:00
Benjamin Otte 5e8b294faf singleselection: Be more careful about notifies
We don't want to notify::selected or notify::selected-item if they
didn't change.
This will bring performance benefits on frequently changing lists.

In particular, if lists get filtered or reordered, but the selected item
stays in the list, not doing a notify::selected-item will avoid updates
in connected handlers like GtkDropdown (and its handlers), thereby
avoiding lots of unnecessary updates.
2022-10-17 20:11:27 +02:00
Philip Zander c84c469b78 Use native Windows API for converting keystrokes to characters 2022-10-17 19:36:48 +02:00
Chun-wei Fan 1a5a65acd0 tests/testmountoperation.c: Fix build on Windows
Sadly, we can't just use an interger for a GPid on Windows, so just cast
it.  Sounds silly for non-Windows, but that's life...
2022-10-17 12:36:17 +08:00
Matthias Clasen 6f5d18a9f5 macos: Fix clipboard data size handling
We were using the allocated memory size, not
the amount of data that has been written.

Fixes: #5261
2022-10-16 23:45:28 -04:00
Matthias Clasen 004f22a51c Merge branch 'matthiasc/for-main' into 'main'
Rename gtk_widget_get_style_color

See merge request GNOME/gtk!5125
2022-10-17 03:26:21 +00:00
Matthias Clasen d775caff7f Rename gtk_widget_get_style_color
This name wasn't everybody's favorite, so go with
the generic name gtk_widget_get_color() instead.
2022-10-16 21:41:43 -04:00
Piotr Drąg baf3a3eecd Update POTFILES.in 2022-10-16 14:34:34 +02:00
Benjamin Otte ca2e14788d Merge branch 'antoniof-main-patch-03677' into 'main'
columnview: Don't be focusable

See merge request GNOME/gtk!5022
2022-10-14 22:39:49 +00:00
Matthias Clasen c57d8fc6be Merge branch 'gtk_widget_get_style_color-docs-fix' into 'main'
Fix documentation for `gtk_widget_get_style_color()`

See merge request GNOME/gtk!5119
2022-10-14 10:49:15 +00:00
Sebastian Dröge 294e5bb79f Fix documentation for gtk_widget_get_style_color()
It was pointing at `gtk_widget_get_css_style()` instead.
2022-10-14 12:36:11 +03:00
Matthias Clasen bde19f9b2a Fix blank popovers
This was a typo in 2b00b64e8c, making
us render the background on the wrong snapshot.
2022-10-13 16:38:41 -04:00
Matthias Clasen 1d2071b892 NEWS: Updates 2022-10-12 23:27:36 -04:00
Matthias Clasen b46eb5c20a Merge branch 'matthiasc/for-main' into 'main'
filechooser: Update the settings docs

See merge request GNOME/gtk!5118
2022-10-13 03:09:47 +00:00
Matthias Clasen 3d605615ce filechooser: Update the settings docs
Document the window-position setting as unused.
2022-10-12 22:47:51 -04:00
Matthias Clasen c502d7fca6 Merge branch 'matthiasc/for-main' into 'main'
docs: Add a cross-reference

See merge request GNOME/gtk!5117
2022-10-13 02:43:48 +00:00
Matthias Clasen 9f8abc5d74 docs: Add a cross-reference
Note that GtkTreeView is deprecated and link to the
list view introduction from 'Tree and List Widget Overview'.
2022-10-12 22:26:40 -04:00
Matthias Clasen c8cbb3fbba Merge branch 'matthiasc/for-main' into 'main'
filechooserentry: Add a set_text api

See merge request GNOME/gtk!5116
2022-10-13 02:25:19 +00:00
Matthias Clasen fa3c8ed5f9 filechooser: Stop using entrycompletion api
The file chooser entry now has an api for this.
2022-10-12 21:59:35 -04:00
Matthias Clasen 8ac5f1983e filechooserentry: Add a set_text api
This function prevents the completion popup
from coming up when setting the entry text.
2022-10-12 21:59:19 -04:00
Matthias Clasen eccc02d084 Merge branch 'matthiasc/for-main' into 'main'
Start a migration guide for GTK 5

See merge request GNOME/gtk!5114
2022-10-12 21:02:56 +00:00
Matthias Clasen 0c94db7147 Start a migration guide for GTK 5
No need to panic, GTK 5 is still years away!
But it is good to write this material down while
it is fresh in mind.
2022-10-12 16:39:28 -04:00
Matthias Clasen ed87473bf9 Merge branch 'deprecate-render' into 'main'
wip: Deprecate gtk_render apis

See merge request GNOME/gtk!5100
2022-10-12 20:38:19 +00:00
Matthias Clasen 812a879ec2 inspector: Use gtk_widget_get_style_color
The graph renderer in the statistics page needs
the CSS foreground color to draw the graph. Use
the just introduced api for it.
2022-10-12 15:35:00 -04:00
Matthias Clasen 5627542d7c Add gtk_widget_get_style_color
There is a widespread need to access the CSS foreground
color for custom drawing in snapshot functions, so make
it available after gtk_style_context_get_color was
deprecated with a new widget api.
2022-10-12 15:35:00 -04:00
Matthias Clasen f42fe500c9 cssnode: Avoid style context api
Duplicate the print flags in gtkcssnodeprivate.h,
so we don't rely on gtkstylecontext.h here.
2022-10-12 15:35:00 -04:00
Matthias Clasen ac3177ce95 tests: Ignore deprecations
Some of our tests use deprecated style context api.
Most of them should be ported to use global style
providers eventually. For now, ignore deprecations.
2022-10-12 15:35:00 -04:00
Matthias Clasen ccaaff406f testsuite: Ignore deprecations
Some of our tests use deprecated style context
apis. Ignore the deprecations for now.
2022-10-12 15:35:00 -04:00
Matthias Clasen b1ec43ae33 demos: Ignore deprecations
Most of these demos should be ported to use
global style providers eventually. For now,
just ignore the deprecations.
2022-10-12 15:35:00 -04:00
Matthias Clasen ee8c2a235f stylecontext: Deprecate most apis
The notable exception here are the global provider apis,
which are needed in some form and don't have a replacement
yet. Move them to gtkstyleprovider.[hc], so we can wholly
deprecated gtkstylecontext.[hc].
2022-10-12 15:35:00 -04:00
Matthias Clasen 299fbfd722 tests: Ignore deprecations for render api 2022-10-12 15:35:00 -04:00
Matthias Clasen 5f54ecdf2c aboutdialog: Stop using gtk_style_context_save 2022-10-12 15:35:00 -04:00
Matthias Clasen e09138ce45 textview: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen a71893f88b text: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen 01324ffaff label: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen c354465ed8 scrolledwindow: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen 50ab2386ec printunixdialog: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen bf9f362597 popover: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen d03ee57cc5 flowbox: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen 6f24bd9ff4 demos: Ignore deprecations for render apis
Eventually, this demo should probably be removed.
2022-10-12 15:35:00 -04:00
Matthias Clasen 616e0a0d32 textview: Stop using gtk_snapshot_render api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen ee76105119 text: Stop using gtk_snapshot_render api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen 381f863a18 label: Stop using gtk_snapshot_render api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen 57c63d9ce7 Use the new caret rendering api
Implement the deprecated gtk_snapshot_render api
for carets with the new one.
2022-10-12 15:35:00 -04:00
Matthias Clasen 0522dade9f Add gtk_css_style_snapshot_caret 2022-10-12 15:35:00 -04:00
Matthias Clasen 484cff2182 glarea: Stop using gtk_snapshot_render api
The gtk_snapshot_render api is deprecated, stop using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen dd3c371c08 inscription: Stop using gtk_snapshot_render api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen 3145bce6a1 render: Use the new layout render api 2022-10-12 15:35:00 -04:00
Matthias Clasen 73f991a7fd Add gtk_css_style_snapshot_layout
This function renders a PangoLayout at a given
position, using text shadows and color from css.
2022-10-12 15:35:00 -04:00
Matthias Clasen 0205caa371 scrolledwindow: Port to the gtk_css_style_snapshot api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen c2c46a7036 printunixdialog: Port to the gtk_css_style_snapshot api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen 2b00b64e8c popover: Port to the gtk_css_style_snapshot api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen 4e2522a080 iconview: Port to the gtk_css_style_snapshot api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen 473065dfeb flowbox: Port to the gtk_css_style_snapshot api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen 60dafebd91 Deprecate gtk_snapshot_render apis
Move the implementations from gtksnapshot.c to
gtk/deprecated/gtkrender.c and deprecated these
functions. We want to get rid of them.

These functions are still used in some of our widgetry,
so use G_GNUC_BEGIN/END_IGNORE_DEPRECATIONS around
them.
2022-10-12 15:35:00 -04:00
Matthias Clasen 35370752d5 Deprecate gtk_render apis
These take a GtkStyleContext as argument, and we
want to get rid of GtkStyleContext eventually.
The proper drawing api these days is gtk_snapshot.
2022-10-12 15:35:00 -04:00
Matthias Clasen 808d00906c printunixdialog: Stop using gtk_render_ apis
These are getting deprecated.
2022-10-12 15:35:00 -04:00
Matthias Clasen da5d5bd71f popover: Stop using gtk_render_background
The gtk_render_ apis are getting deprecated.
2022-10-12 15:34:59 -04:00
Matthias Clasen 0c99e69423 flowbox: Stop using gtk_render_background
The gtk_render_ apis are getting deprecated.
2022-10-12 15:34:59 -04:00
Matthias Clasen 410813eb6b Merge branch 'deprecate-all-the-cells' into 'main'
Deprecate treeviews and cell renderers

See merge request GNOME/gtk!5098
2022-10-12 19:28:04 +00:00
Luca Bacci 6cc44eb0fe Merge branch 'for-master' into 'main'
For master

See merge request GNOME/gtk!5095
2022-10-12 13:56:51 +00:00
Matthias Clasen 11ee930b9d Merge branch 'inspector_a11y' into 'main'
GtkInspector: make the inspector at least a little bit more accessible

See merge request GNOME/gtk!5109
2022-10-12 11:06:35 +00:00
Matthias Clasen 69e4c9b01e tests: Ignore deprecations
Eventually, most of these tests should be dropped.
2022-10-11 17:18:21 -04:00
Matthias Clasen c32fed9238 testsuite: Ignore deprecations
For now, just ignore deprecations. Eventually,
we will have to go through, drop demos that are
for wholly deprecated widgets, and update others.
2022-10-11 17:18:21 -04:00
Matthias Clasen 4941ef659f tools: Ignore deprecations
For now, just ignore deprecations. Eventually,
we will have to go through and drop code that is
dealing with widgets that are going away.
2022-10-11 17:18:21 -04:00
Matthias Clasen 6efb18330f demos and examples: Ignore deprecations
For now, just ignore deprecations. Eventually,
we will have to go through, drop demos that are
for wholly deprecated widgets, and update others.
2022-10-11 17:18:21 -04:00
Matthias Clasen 5e256590db Deprecate treeviews and cell renderers
This includes

GtkCellArea
GtkCellAreaBox
GtkCellAreaContext
GtkCellEditable
GtkCellRenderer
GtkCellRendererAccel
GtkCellRendererCombo
GtkCellRendererPixbuf
GtkCellRendererProgress
GtkCellRendererSpin
GtkCellRendererSpinner
GtkCellRendererText
GtkCellRendererToggle
GtkCellView
GtkComboBox
GtkComboBoxText
GtkIconView
GtkListStore
GtkTreeModel
GtkTreeModelFilter
GtkTreeModelSort
GtkTreeStore
GtkTreeView
GtkTreeViewColumn
GtkTreeSelection
2022-10-11 17:18:21 -04:00
Matthias Clasen 79303d7cd3 inspector: Drop an unused file 2022-10-11 17:18:21 -04:00
Matthias Clasen 681a818af2 flowbox: Stop using gtk_render_background
The gtk_render_ apis are getting deprecated.
2022-10-11 17:18:21 -04:00
Matthias Clasen 933b1eb4df Merge branch 'filename-sorter' into 'main'
stringsorter: Add a collate-mode property

See merge request GNOME/gtk!5111
2022-10-11 20:59:08 +00:00
Matthias Clasen c419b57754 stringsorter: Fix up a doc typo
gi-docgen links can be tricky to get right.
2022-10-11 15:32:05 -04:00
Matthias Clasen 05323869d7 stringsorter: Add more detail to the docs
Mention when a collation value of NONE might
be useful.
2022-10-11 14:09:21 -04:00
Matthias Clasen 2520148ebb Apply 2 suggestion(s) to 2 file(s) 2022-10-11 17:53:26 +00:00
Matthias Clasen a06a4ad59a ci: Allow macos builds to fail
The runner seems busted, so allow builds to fail
for now.
2022-10-11 13:43:36 -04:00
Matthias Clasen 141aac1a60 stringsorter: Add a collation property
The new property lets us choose between
Unicode collation, filename collation, and
plain strcmp.

This will be used in the filechooser.
2022-10-11 13:42:00 -04:00
Lukáš Tyrychtr 8a1578ede8 GtkInspector: make the inspector at least a little bit more accessible
Namely, it adds accessible name to the property value editors and to a few labels in the a11y panel.
2022-10-11 13:34:53 +02:00
Matthias Clasen 8ba7840528 Merge branch 'wip/corey/file-clipboard' into 'main'
gdkcontentserializer: Use newlines for file separators

Closes #5240

See merge request GNOME/gtk!5107
2022-10-10 21:13:28 +00:00
Corey Berla 3168a3e086 gdkcontentserializer: Use newlines for file separators
Use newlines rather than spaces to separate file paths (or uri's)
when serializing text/plain files.  There isn't a matching
deserializer, so we can do this in isolation.  Newlines
seem to make more sense when pasting into a text editor etc.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5240
2022-10-10 13:27:07 -07:00
Matthias Clasen 3cf9149129 Merge branch 'matthiasc/for-main' into 'main'
Matthiasc/for main

See merge request GNOME/gtk!5106
2022-10-10 03:29:41 +00:00
Matthias Clasen 7c8a098852 emojicompletion: Drop an unused include 2022-10-09 23:08:55 -04:00
Matthias Clasen ecbdb3104a emojichooser: Drop an unused include 2022-10-09 23:03:43 -04:00
Matthias Clasen c8a332b3af searchentry: Drop an unused include 2022-10-09 23:03:36 -04:00
Matthias Clasen b5f7d57124 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Modernize accordion demo

See merge request GNOME/gtk!5105
2022-10-09 14:26:58 +00:00
Benjamin Otte 0db5c7f421 testgtk: Use global css provider 2022-10-09 10:13:44 -04:00
Benjamin Otte ed83272f35 tests: Use per-screen CSS providers 2022-10-09 10:13:10 -04:00
Benjamin Otte 20b49e7c34 gtk-demo: Modernize accordion demo 2022-10-09 10:09:59 -04:00
Matthias Clasen 6a6ef0f437 Merge branch 'matthiasc/for-main' into 'main'
inspector: Fix some criticals

See merge request GNOME/gtk!5104
2022-10-09 13:53:54 +00:00
Benjamin Otte 32ef462f1d fontbutton: Use attributes for custom font
Don't try to use CSS.
2022-10-09 09:10:39 -04:00
Matthias Clasen b895360f49 inspector: Fix some criticals
This is fallout from the recent porting to GtkColumnView.
2022-10-09 09:10:39 -04:00
Matthias Clasen c2c094e8a1 Merge branch 'matthiasc/for-main' into 'main'
widget: Changing the scale does no longer require a redraw

See merge request GNOME/gtk!5103
2022-10-09 13:10:24 +00:00
Benjamin Otte d4d0192405 widget: Changing the scale does no longer require a redraw
It doesn't require one generally anyway, because only the root can
change scale and when that happens the root will queue a redraw.

But even if the root doesn't queue a redraw, render nodes (the only
thing discarded by queue_draw()) are scale-independant.
2022-10-09 08:50:32 -04:00
Matthias Clasen 15ea36e7fd Merge branch 'matthiasc/for-main' into 'main'
glarea: Drop an unused include

See merge request GNOME/gtk!5102
2022-10-09 12:49:42 +00:00
Matthias Clasen 692279586a Merge branch 'main' into 'main'
GtkPaned: Fix symbol names in code example

See merge request GNOME/gtk!5101
2022-10-09 12:22:08 +00:00
Matthias Clasen 9eec475dcc glarea: Drop an unused include
We are not using gtk_render apis here.
2022-10-09 08:10:12 -04:00
Tilo Villwock 661130d429 GtkPaned: Fix symbol names in code example 2022-10-08 13:49:10 +02:00
Matthias Clasen 68b73ebf91 Merge branch 'matthiasc/for-main' into 'main'
paperdialog: Drop an unused function

See merge request GNOME/gtk!5099
2022-10-08 03:01:24 +00:00
Matthias Clasen 08c0020ac3 placesview: Stop using GtkEntryCompletion
We want to get rid of tree models and cell renderers,
and that includes GtkEntryCompletion. The functionality
here is really not that essential.
2022-10-07 22:22:36 -04:00
Matthias Clasen ac87c72797 paperdialog: Drop an unused function
This gets rid of a GtkListStore use.
2022-10-07 22:03:15 -04:00
Matthias Clasen 5be8710774 Merge branch 'inspector-trees' into 'main'
inspector: Stop using GtkTreeView for css nodes

See merge request GNOME/gtk!5097
2022-10-07 21:55:10 +00:00
Matthias Clasen 5fa027ab8a cssnode: Drop the node-added/-removed signals
These are no longer used, and the children-observer
listmodel is a better approach for monitoring the
children.
2022-10-07 17:21:04 -04:00
Matthias Clasen dbe04adb1a inspector: Drop the css node tree model
This is not used anymore.
2022-10-07 17:17:41 -04:00
Matthias Clasen 6815f3af6d inspector: Stop using GtkTreeView for css nodes
Replace the css node tree with a GtkColumnView, using
the new gtk_css_node_observe_children api.
2022-10-07 15:54:02 -04:00
Matthias Clasen f8357512d0 Add gtk_css_node_observe_children 2022-10-07 15:54:01 -04:00
Luca Bacci 8bfc19e7f7 GtkFileChooserNativeWin32: Add some option flags
Avoid changing the current directory.
Also avoid creating a sample file to test if the target file
can be created.

References:

* "Why does the common file dialog change the current directory?"
 -> https://devblogs.microsoft.com/oldnewthing/20101112-00/?p=12293

* "Why does the common file save dialog create a temporary file and then delete it?"
 -> https://devblogs.microsoft.com/oldnewthing/20140429-00/?p=1123
2022-10-07 19:06:09 +02:00
Luca Bacci d6f7449636 GdkWin32: Return TRUE when processing WM_XBUTTONDOWN/UP messages
As documented on MSDN:

> Unlike the WM_LBUTTONUP, WM_MBUTTONUP, and WM_RBUTTONUP messages, an
> application should return TRUE from this message if it processes it.
2022-10-07 19:05:29 +02:00
Luca Bacci f4286e8f1a GdkWin32: Use gdk_pixbuf_read_pixels () where applicable
This is an optimization in case of reading unmodifiable GdkPixbufs.
Also replace uses of GLib integral types with <stdlib.h> integral
types.
2022-10-07 19:05:29 +02:00
Matthias Clasen 14e6fd1f12 Merge branch 'wroy-main-patch-03767' into 'main'
Add subproject/libjpeg-turbo.wrap

Closes #5237

See merge request GNOME/gtk!5094
2022-10-07 16:00:36 +00:00
William Roy 2e57621fc5 Add subproject/libjpeg-turbo.wrap 2022-10-07 14:48:49 +00:00
Matthias Clasen 4a8ae3a20c Merge branch 'inspector-trees' into 'main'
inspector: Stop using GtkTreeView for statistics

See merge request GNOME/gtk!5093
2022-10-07 05:57:02 +00:00
Matthias Clasen 61393fdcce inspector: Stop using GtkTreeView for statistics
GtkTreeView is heading towards deprecation; use
a GtkColumnView instead.
2022-10-07 01:40:51 -04:00
Matthias Clasen 6ed6cebcf4 inspector: Fixup
We were overlooking a transfer full here.
2022-10-07 00:12:47 -04:00
Jürgen Benvenuti 2f764f6c18 Update German translation
(cherry picked from commit 52dd917c6a)
2022-10-06 20:48:36 +00:00
Matthias Clasen a646e50019 Merge branch 'main' into 'main'
Treat XKB_MOD_NAME_LOGO as super key

Closes #4913

See merge request GNOME/gtk!5088
2022-10-06 10:41:56 +00:00
Po Lu e967dfed2d Treat XKB_MOD_NAME_LOGO as super key 2022-10-06 11:19:31 +04:00
Matthias Clasen 2dc33a9de1 Merge branch 'matthiasc/for-main' into 'main'
gdk: Cosmetics

See merge request GNOME/gtk!5087
2022-10-06 03:48:36 +00:00
Matthias Clasen 7c5e1c6195 gtk: Rename some private headers
Improve the consistency of our private header
naming, by add 'private' to a bunch of them.
2022-10-05 23:01:28 -04:00
Matthias Clasen 8607312fef gdk: Cosmetics
Add a define for each renderer.
2022-10-05 23:01:28 -04:00
Matthias Clasen abac891bd2 Merge branch 'inspector-trees' into 'main'
inspector: Stop using a treeview for css properties

See merge request GNOME/gtk!5086
2022-10-06 02:52:12 +00:00
Matthias Clasen 2e25a13fc0 Merge branch 'matthiasc/for-main' into 'main'
mountoperation: Add a mnemonic to a button

See merge request GNOME/gtk!5085
2022-10-06 02:15:16 +00:00
Matthias Clasen 7a2c4e8a38 inspector: Stop using a treeview for css properties
Treeviews are heading towards deprecation.
2022-10-05 22:12:57 -04:00
Matthias Clasen 90e0ace325 inspector: Cosmetics 2022-10-05 21:20:04 -04:00
Matthias Clasen 9a2a5d9c8b mountoperation: Add a mnemonic to a button
This is a good practice, even if this is a rarely
used dialog.
2022-10-05 20:14:09 -04:00
Matthias Clasen d4dd0dcd79 Merge branch 'accessible_range_interface' into 'main'
Introduce GtkAccessibleRange

See merge request GNOME/gtk!5066
2022-10-05 11:33:56 +00:00
Matthias Clasen d454586927 Review fixes 2022-10-05 11:13:21 +00:00
Matthias Clasen 1917b6a0a3 Merge branch 'matthiasc/for-main' into 'main'
inspector: Use more compact list styles

See merge request GNOME/gtk!5083
2022-10-05 10:14:04 +00:00
Matthias Clasen a924b820c2 inspector: Use more compact list styles
Use the same style classes throughout for
data lists that benefit from smaller fonts.
2022-10-04 23:25:12 -04:00
Matthias Clasen 9e82d2b843 Merge branch 'inspector-menus' into 'main'
Drop unused includes

See merge request GNOME/gtk!5082
2022-10-05 03:11:41 +00:00
Matthias Clasen ab7a04d89f inspector: Stop using a treeview for menus
Replace this with a GtkColumnView.
2022-10-04 22:49:05 -04:00
Matthias Clasen a377f95aac Drop unused includes
This gets rid of treeview includes in a number of places.
2022-10-04 22:49:05 -04:00
Matthias Clasen 4356e0c3ce Merge branch 'mountoperation-trees' into 'main'
mountoperation: Survive on Wayland

See merge request GNOME/gtk!5081
2022-10-05 02:48:39 +00:00
Matthias Clasen 5d5de9f759 mountoperation: Don't use a treeview
Port the process list from GtkTreeView
to GtkListView, and fix a number of broken
things along the way.
2022-10-04 21:26:07 -04:00
Matthias Clasen e1f69ea278 testmountoperation: Test process dialog
Without this, it is hard to trigger the
dialog. Event with this, we have to force
GtkMountOperation to use its own dialog.
2022-10-04 21:26:07 -04:00
Matthias Clasen 6a76fe41c6 mountoperation: Survive on Wayland
The code was assuming it is dealing with an
X11 display, and trigger assertions. Fix that
to make it work at least as well as it does
on Windows.
2022-10-04 21:26:07 -04:00
Matthias Clasen aae82d7992 Merge branch 'inspector-trees' into 'main'
inspector: Don't use treeviews in the recorder

See merge request GNOME/gtk!5080
2022-10-04 20:54:10 +00:00
Matthias Clasen ca576e877f inspector: Don't use treeviews in the recorder
Replace the event and render node details views with
columnviews.
2022-10-04 16:26:28 -04:00
Alexander Shopov bc23038848 Update Bulgarian translation
(cherry picked from commit 2ca2a15637)
2022-10-04 18:07:24 +00:00
Matthias Clasen 43e8730acd Merge branch 'inspector-fixes' into 'main'
inspector: Fix some lifecycle issues

See merge request GNOME/gtk!5079
2022-10-04 15:34:53 +00:00
Piotr Drąg c43def5fce Update POTFILES.in 2022-10-04 15:20:57 +02:00
Matthias Clasen e68b365fa1 inspector: Fix some lifecycle issues
The template use in the inspector was not properly
disposing all widgets. gtk_widget_dispose_template
will only unparent widgets that have been named
as template children, so we need to make the toplevel
elements in the ui file named children, or manually
dispose them. This commit does the former.
2022-10-04 07:10:35 -04:00
Matthias Clasen 3867f9b8ea Merge branch 'deprecate-entry-completion' into 'main'
Deprecate GtkEntryCompletion

See merge request GNOME/gtk!5078
2022-10-04 03:35:26 +00:00
Matthias Clasen 0b20c57867 Merge branch 'deprecate-app-choosers' into 'main'
Deprecate app choosers

See merge request GNOME/gtk!5077
2022-10-04 03:28:09 +00:00
Matthias Clasen 7e9ca5b41d Deprecate GtkEntryCompletion
We want to drop cell renderers and tree models
in GTK 5. The functionality of GtkEntryCompletion
may be replaced by a new widget in GTK 5.
2022-10-03 23:23:56 -04:00
Matthias Clasen a527a4d82e Deprecate the app chooser widgets
These are a family of pretty specialized widgets, and
are very rarely used. Instead of porting them away
from GtkTreeView and GtkComboBox, deprecate them.
2022-10-03 23:02:09 -04:00
Matthias Clasen adfc29968a Revert "gtk: Use gnome.mkenums_simple"
This reverts commit 11829fe7d0.

The mkenums_simple function can't properly handle headers
in subdirectories currently, so go back to the template
version.
2022-10-03 22:20:07 -04:00
Benjamin Otte e17e94d2da Merge branch 'oh-no-my-docs' into 'main'
Remove outdated docs

See merge request GNOME/gtk!5076
2022-10-03 22:21:48 +00:00
Benjamin Otte 9af3bb8dc1 Remove outdated docs
There are a lot of automatic conversions in the blame log.
2022-10-03 21:12:42 +00:00
Matthias Clasen 998dd11cbd Merge branch 'wip/jimmac/combobox-lists' into 'main'
stylesheet: sync combox with other popovers

Closes #5221

See merge request GNOME/gtk!5074
2022-10-03 21:02:25 +00:00
António Fernandes 9cb8d21cb5 columnview: Forward all focus to child
For the same reasoning as the preceding commit.

Also don't make GtkColumnView focusable. Its internal list view
is already focusable, which is enough to take care of the empty
view case.
2022-10-03 20:48:10 +01:00
António Fernandes 4fc4298920 listbase: Grab focus on items instead of container
The container view itself being focusable makes keyboard navigation
slower by adding a useless focus step.

It also means if an item gets removed, the focus jumps back to the view,
instead of jumping to the next item, as seen in nautilus bug report:
https://gitlab.gnome.org/GNOME/nautilus/-/issues/2489

Instead of making the GtkListBase container itself focusable, override
the .grab_focus() vfunc. This way, calling gtk_widget_grab_focus() on
the view container keeps working sucessfully, but focuses the focus
item directly instead.

This is particularly useful to have because applicaiton authors do
not have direct acess to this class's children, so they can't call
gtk_widget_grab_focus() on them directly.
2022-10-03 20:26:24 +01:00
Corey Berla 230188fb30 entrycompletion: Use GSignalGroup on the entry's buffer
We connect to the inserted-text signal for the entry's buffer.
During the lifetime of the entry, the buffer changes.  This is
literally the example used for GSignalGroup in the docs.
2022-10-03 10:40:27 -07:00
Jakub Steiner a96c75ff02 stylesheet: sync combox with other popovers
- use the same lists style as everything else (menus, sidebars ...)

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5221
2022-10-03 15:43:07 +02:00
Carlos Garnacho 1b4ed00509 Merge branch 'evince_crash_popover_motion2' into 'main'
fix crash in gtk_synthesize_crossing_events()

Closes #5190

See merge request GNOME/gtk!5052
2022-10-03 12:19:35 +00:00
Fabio Tomat a54284b629 Update Friulian translation
(cherry picked from commit 6387863256)
2022-10-03 08:35:56 +00:00
Goran Vidović ee9e9bb3e1 Update Croatian translation 2022-10-02 14:05:29 +00:00
Aleksandr Melman cae9689281 Update Russian translation 2022-10-01 15:40:59 +00:00
Emin Tufan Çetin 1f6e2cf291 Update Turkish translation 2022-10-01 14:57:10 +00:00
Zurab Kargareteli 69a76054e8 Update Georgian translation 2022-10-01 10:17:09 +00:00
Emmanuele Bassi 31fea11255 a11y: Drop GtkAccessibleRange.get_minimum_increment()
MinimumIncrement is an AT-SPI-ism that has no counterpart in the ARIA
specification, so it should not live inside public API. Additionally,
it's not really a useful method because it collapses two values on the
adjustment API.

The only method in the GtkAccessibleRange interface should be the
set_current_value(), which allows ATs to control the current position in
a ranged widget.

The AT-SPI implementation can now use all the accessible properties,
including the VALUE_TEXT one, mapped to the Text property on the
AtSpi.Value interface.
2022-09-30 18:36:02 +01:00
Emmanuele Bassi 5dd7e24806 Clean up GtkAccessibleRange
Coding style and documentation fixes.
2022-09-30 16:58:00 +01:00
Goran Vidović 848dc78112 Update Croatian translation 2022-09-30 12:05:09 +00:00
Matthias Clasen e9d7cd3a48 Merge branch 'wip/handle-zero-bounds' into 'main'
Fix shrinking windows when suspending

See merge request GNOME/gtk!5069
2022-09-30 11:26:29 +00:00
Jonas Ådahl b3a3a6ceb1 toplevel-size: Report zero bounds as infinite
Empty/zero bounds are sent by the Wayland compositor if there are no
valid bounds to report, e.g. if there are no connected monitors. Report
this to GTK, which uses this to clamp calculated sizes, as INT_MAX, so
that clamping isn't done until there are actual valid bounds to clamp
to.

This fixes clients sometimes shrinking to their minimum size during
hotplugs or after having suspended the session.
2022-09-30 09:31:40 +02:00
Jonas Ådahl 148c133674 surface/wayland: Handle no current monitor when calculating bounds
We shouldn't assume there is always a monitor to derive bounds from.
If there is no monitor, pass empty bounds, as this matches what
xdg_toplevel.configure_bounds do in this case.
2022-09-30 09:31:40 +02:00
Asier Sarasua Garmendia d2c9cbba4f Update Basque translation 2022-09-29 16:55:20 +00:00
Balázs Úr 8b33900e1d Update Hungarian translation 2022-09-29 16:43:31 +00:00
Nart Tlisha 0c3572312a Update Abkhazian translation 2022-09-29 15:19:37 +00:00
Lukáš Tyrychtr 7e683ed89b Use proper version specifier 2022-09-29 09:55:10 +02:00
Lukáš Tyrychtr 7fb892460a Document that this will be available only in GTK 4.10 2022-09-29 09:36:09 +02:00
Lukáš Tyrychtr d517804acd Actually use the AccessibleRange interface 2022-09-29 09:36:09 +02:00
Lukáš Tyrychtr ce761122b2 Implement also for GtkPaned 2022-09-29 09:36:09 +02:00
Lukáš Tyrychtr 76a5354ad7 Implement GtkAccessibleRange for GtkScaleButton 2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr 006b473c0c Improve documentation 2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr 5e1af6d7d5 Implement GtkAccessibleRange for GtkProgressBar 2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr ec0cd4a994 Implement GtkAccessibleRange for GtkLevelBar 2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr 86864d7bc0 Account for GtkAccessibleRange implementations which do not have a
minimum step and it makes no sense for them to set the current value
2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr 485ffcde38 Implement GtkAccessibleRange for GtkSpinButton 2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr 0304eaec94 Implement GtkAccessibleRange for GtkRange 2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr a7814a0963 Introduce GtkAccessibleRange
This introduces GtkAccessibleRange, an interface which allows the accessibility backend to work with a control which can adjust a value.
2022-09-29 09:36:08 +02:00
Zurab Kargareteli 160a83023a Update Georgian translation 2022-09-28 18:33:41 +00:00
Matthias Clasen 911abe2d2c Fix expected test output
The major.minor version number shows up in the expected
output of this test, so it needs to be adjusted at the
beginning of every cycle.
2022-09-28 13:32:40 -04:00
Matthias Clasen 0c02573c47 Add 4.10 version macros 2022-09-28 13:30:01 -04:00
Matthias Clasen 4257e1ce4f Post-release version bump
This is an experiment to see if I can keep up with
doing post-release version bumps, so git snapshots
will always have a different version from released
tarballs.

This commit also marks the beginning of the 4.10
development cycle, as 4.8 has been branched.
2022-09-28 13:19:49 -04:00
Nelson Benítez León 94a4c2cb40 fix crash in gtk_synthesize_crossing_events()
Update ancestor between GTK_CROSSING_OUT and
GTK_CROSSING_IN as it may have changed.

Fixes #5190
2022-09-24 21:25:05 -04:00
509 changed files with 28613 additions and 16010 deletions
+1
View File
@@ -209,6 +209,7 @@ macos:
-Dintrospection=disabled
-Dcpp_std=c++11
-Dpixman:tests=disabled
-Dlibjpeg-turbo:simd=disabled
_build
- ninja -C _build
artifacts:
+63
View File
@@ -1,3 +1,66 @@
Overview of Changes in 4.9.1, dd-mm-yyyy
========================================
Note that deprecations are an early outlook at changes
that will appear in an eventual GTK 5 release, which is
still far away. We are introducing deprecations in 4.10
as a way to give users time to adapt, and to provide
feedback on our plans.
* GtkTreeView, GtkIconView, GtkComboBox and
auxiliary classes have been deprecated
* GtkEntryCompletion has been deprecated
* GtkStyleContext has been deprecated
* gtk_render_ and gtk_snapshot_render_ APIs
have been deprecated
* GtkAppChooser widgets have been deprecated
* GtkMessageDialog has been deprecated and
replaced by a new async dialog API
* GtkDialog has been deprecated
* GtkColorChooser, GtkFontChooser, GtkFileChooser
interfaces and their implementations have been
deprecated. A new family of async dialog APIs
has been introduced to replace them
* GtkColorDialog, GtkFontDialog, GtkFileDialog
and GtkAlertDialog are new dialog classes with
a consistent and well-bindable API
* GtkMountOperation:
- Fix the dialog to look reasonable
- Make it work under non-X11
* GtkStringSorter:
- Support different collation methods
* Accessibility:
- Introduce GtkAccessibleRange and implement it
* Debugging:
- Unify formatting for debug output
- Make make debug options available in
non-debug builds
* Translation updates:
Abkhazian
Basque
Bulgarian
Croatian
Friulian
Georgian
German
Hungarian
Russian
Turkish
Overview of Changes in 4.8.1, 16-09-2022
========================================
@@ -202,43 +202,36 @@ constraint_editor_window_load (ConstraintEditorWindow *self,
}
static void
open_response_cb (GtkNativeDialog *dialog,
int response,
ConstraintEditorWindow *self)
open_response_cb (GObject *source,
GAsyncResult *result,
void *user_data)
{
gtk_native_dialog_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
ConstraintEditorWindow *self = user_data;
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_open_finish (dialog, result, NULL);
if (file)
{
GFile *file;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
constraint_editor_window_load (self, file);
g_object_unref (file);
}
gtk_native_dialog_destroy (dialog);
}
static void
open_cb (GtkWidget *button,
ConstraintEditorWindow *self)
{
GtkFileChooserNative *dialog;
GtkFileDialog *dialog;
GFile *cwd;
dialog = gtk_file_chooser_native_new ("Open file",
GTK_WINDOW (self),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Load",
"_Cancel");
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
GFile *cwd = g_file_new_for_path (".");
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), cwd, NULL);
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Open file");
cwd = g_file_new_for_path (".");
gtk_file_dialog_set_current_folder (dialog, cwd);
g_object_unref (cwd);
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), self);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
gtk_file_dialog_open (dialog, GTK_WINDOW (self), NULL, NULL, open_response_cb, self);
g_object_unref (dialog);
}
static void
@@ -294,22 +287,23 @@ serialize_model (GListModel *list)
static void
save_response_cb (GtkNativeDialog *dialog,
int response,
ConstraintEditorWindow *self)
save_response_cb (GObject *source,
GAsyncResult *result,
void *user_data)
{
gtk_native_dialog_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
ConstraintEditorWindow *self = user_data;
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_save_finish (dialog, result, NULL);
if (file)
{
GListModel *model;
GFile *file;
char *text;
GError *error = NULL;
model = constraint_view_get_model (CONSTRAINT_VIEW (self->view));
text = serialize_model (model);
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
g_file_replace_contents (file, text, strlen (text),
NULL, FALSE,
G_FILE_CREATE_NONE,
@@ -318,46 +312,39 @@ save_response_cb (GtkNativeDialog *dialog,
&error);
if (error != NULL)
{
GtkWidget *message_dialog;
GtkAlertDialog *alert;
message_dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))),
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"Saving failed");
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog),
"%s", error->message);
g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (message_dialog);
alert = gtk_alert_dialog_new ("Saving failed");
gtk_alert_dialog_set_detail (alert, error->message);
gtk_alert_dialog_show (alert,
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))));
g_object_unref (alert);
g_error_free (error);
}
g_free (text);
g_object_unref (file);
}
gtk_native_dialog_destroy (dialog);
}
static void
save_cb (GtkWidget *button,
ConstraintEditorWindow *self)
{
GtkFileChooserNative *dialog;
GtkFileDialog *dialog;
GFile *cwd;
dialog = gtk_file_chooser_native_new ("Save constraints",
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
GTK_FILE_CHOOSER_ACTION_SAVE,
"_Save",
"_Cancel");
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
GFile *cwd = g_file_new_for_path (".");
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), cwd, NULL);
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Save constraints");
cwd = g_file_new_for_path (".");
gtk_file_dialog_set_current_folder (dialog, cwd);
g_object_unref (cwd);
g_signal_connect (dialog, "response", G_CALLBACK (save_response_cb), self);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
gtk_file_dialog_save (dialog,
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
NULL, NULL,
NULL,
save_response_cb, self);
g_object_unref (dialog);
}
static void
@@ -21,6 +21,8 @@
#include "constraint-editor.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
struct _ConstraintEditor
{
GtkWidget parent_instance;
+2
View File
@@ -21,6 +21,8 @@
#include "guide-editor.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
struct _GuideEditor
{
GtkWidget parent_instance;
+23 -49
View File
@@ -33,22 +33,12 @@ static void create_window (GApplication *app, const char *contents);
static void
show_action_dialog (GSimpleAction *action)
{
const char *name;
GtkWidget *dialog;
GtkAlertDialog *dialog;
name = g_action_get_name (G_ACTION (action));
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
"You activated action: \"%s\"",
name);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
dialog = gtk_alert_dialog_new ("You activated action: \"%s\n",
g_action_get_name (G_ACTION (action)));
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
}
static void
@@ -90,20 +80,19 @@ activate_new (GSimpleAction *action,
}
static void
open_response_cb (GtkNativeDialog *dialog,
int response_id,
gpointer user_data)
open_response_cb (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
GtkFileChooserNative *native = user_data;
GApplication *app = g_object_get_data (G_OBJECT (native), "app");
GtkWidget *message_dialog;
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GApplication *app = G_APPLICATION (user_data);
GFile *file;
char *contents;
GError *error = NULL;
if (response_id == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_save_finish (dialog, result, &error);
if (file)
{
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (native));
char *contents;
if (g_file_load_contents (file, NULL, &contents, NULL, NULL, &error))
{
@@ -112,21 +101,16 @@ open_response_cb (GtkNativeDialog *dialog,
}
else
{
message_dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Error loading file: \"%s\"",
error->message);
g_signal_connect (message_dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (message_dialog);
GtkAlertDialog *alert;
alert = gtk_alert_dialog_new ("Error loading file: \"%s\"", error->message);
gtk_alert_dialog_show (alert, NULL);
g_object_unref (alert);
g_error_free (error);
}
}
gtk_native_dialog_destroy (GTK_NATIVE_DIALOG (native));
g_object_unref (native);
g_object_unref (app);
}
@@ -136,21 +120,11 @@ activate_open (GSimpleAction *action,
gpointer user_data)
{
GApplication *app = user_data;
GtkFileChooserNative *native;
GtkFileDialog *dialog;
native = gtk_file_chooser_native_new ("Open File",
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Open",
"_Cancel");
g_object_set_data_full (G_OBJECT (native), "app", g_object_ref (app), g_object_unref);
g_signal_connect (native,
"response",
G_CALLBACK (open_response_cb),
native);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (native));
dialog = gtk_file_dialog_new ();
gtk_file_dialog_open (dialog, NULL, NULL, NULL, open_response_cb, g_object_ref (app));
g_object_unref (dialog);
}
static void
+18 -19
View File
@@ -50,10 +50,10 @@ copy_button_clicked (GtkStack *source_stack,
}
else if (strcmp (visible_child_name, "Color") == 0)
{
GdkRGBA color;
const GdkRGBA *color;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (visible_child), &color);
gdk_clipboard_set (clipboard, GDK_TYPE_RGBA, &color);
color = gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (visible_child));
gdk_clipboard_set (clipboard, GDK_TYPE_RGBA, color);
}
else if (strcmp (visible_child_name, "File") == 0)
{
@@ -215,37 +215,36 @@ file_button_set_file (GtkButton *button,
}
static void
file_chooser_response (GtkNativeDialog *dialog,
int response,
GtkButton *button)
file_chooser_response (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
gtk_native_dialog_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GtkButton *button = GTK_BUTTON (user_data);
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_open_finish (dialog, result, NULL);
if (file)
{
GFile *file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
file_button_set_file (button, file);
g_object_unref (file);
update_copy_button_sensitivity (gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_STACK));
}
gtk_native_dialog_destroy (dialog);
}
static void
open_file_cb (GtkWidget *button)
{
GtkFileChooserNative *chooser;
GtkFileDialog *dialog;
chooser = gtk_file_chooser_native_new ("Choose a file",
GTK_WINDOW (gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW)),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Open",
"_Cancel");
dialog = gtk_file_dialog_new ();
g_signal_connect (chooser, "response", G_CALLBACK (file_chooser_response), button);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (chooser));
gtk_file_dialog_open (dialog,
GTK_WINDOW (gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW)),
NULL,
NULL,
file_chooser_response, button);
}
static void
+5 -1
View File
@@ -64,7 +64,11 @@
<object class="GtkStackPage">
<property name="name">Color</property>
<property name="child">
<object class="GtkColorButton" id="source_color">
<object class="GtkColorDialogButton" id="source_color">
<property name="dialog">
<object class="GtkColorDialog">
</object>
</property>
<property name="valign">center</property>
<property name="rgba">purple</property>
</object>
+2
View File
@@ -11,6 +11,8 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
enum
{
ICON_NAME_COL,
+19 -14
View File
@@ -1,20 +1,16 @@
/* Theming/CSS Accordion
*
* A simple accordion demo written using CSS transitions and multiple backgrounds
*
*/
#include <gtk/gtk.h>
static void
apply_css (GtkWidget *widget, GtkStyleProvider *provider)
destroy_provider (GtkWidget *window,
GtkStyleProvider *provider)
{
GtkWidget *child;
gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
apply_css (child, provider);
gtk_style_context_remove_provider_for_display (gtk_widget_get_display (window), provider);
}
GtkWidget *
@@ -24,8 +20,8 @@ do_css_accordion (GtkWidget *do_widget)
if (!window)
{
GtkWidget *container, *child;
GtkStyleProvider *provider;
GtkWidget *container, *styled_box, *child;
GtkCssProvider *provider;
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "CSS Accordion");
@@ -33,10 +29,13 @@ do_css_accordion (GtkWidget *do_widget)
gtk_window_set_default_size (GTK_WINDOW (window), 600, 300);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
styled_box = gtk_frame_new (NULL);
gtk_window_set_child (GTK_WINDOW (window), styled_box);
gtk_widget_add_css_class (styled_box, "accordion");
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_window_set_child (GTK_WINDOW (window), container);
gtk_frame_set_child (GTK_FRAME (styled_box), container);
child = gtk_button_new_with_label ("This");
gtk_box_append (GTK_BOX (container), child);
@@ -56,10 +55,16 @@ do_css_accordion (GtkWidget *do_widget)
child = gtk_button_new_with_label (":-)");
gtk_box_append (GTK_BOX (container), child);
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (provider), "/css_accordion/css_accordion.css");
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/css_accordion/css_accordion.css");
apply_css (window, provider);
gtk_style_context_add_provider_for_display (gtk_widget_get_display (window),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_signal_connect (window, "destroy",
G_CALLBACK (destroy_provider), provider);
g_object_unref (provider);
}
if (!gtk_widget_get_visible (window))
+10 -10
View File
@@ -1,13 +1,13 @@
@import url("resource://css_accordion/reset.css");
.accordion, .accordion * {
all: unset;
* {
transition-property: color, background-color, border-color, background-image, padding, border-width;
transition-duration: 1s;
font: 20px Cantarell;
}
window {
.accordion {
background: linear-gradient(153deg, #151515, #151515 5px, transparent 5px) 0 0,
linear-gradient(333deg, #151515, #151515 5px, transparent 5px) 10px 5px,
linear-gradient(153deg, #222, #222 5px, transparent 5px) 0 5px,
@@ -18,7 +18,7 @@ window {
background-size: 20px 20px;
}
button {
.accordion button {
color: black;
background-color: #bbb;
border-style: solid;
@@ -28,25 +28,25 @@ button {
padding: 12px 4px;
}
button:first-child {
.accordion button:first-child {
border-radius: 5px 0 0 5px;
}
button:last-child {
.accordion button:last-child {
border-radius: 0 5px 5px 0;
border-width: 2px;
}
button:hover {
.accordion button:hover {
padding: 12px 48px;
background-color: #4870bc;
}
button *:hover {
.accordion button *:hover {
color: white;
}
button:hover:active,
button:active {
.accordion button:hover:active,
.accordion button:active {
background-color: #993401;
}
+2
View File
@@ -6,6 +6,8 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
show_parsing_error (GtkCssProvider *provider,
GtkCssSection *section,
+2
View File
@@ -6,6 +6,8 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
show_parsing_error (GtkCssProvider *provider,
GtkCssSection *section,
+2
View File
@@ -7,6 +7,8 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
show_parsing_error (GtkCssProvider *provider,
GtkCssSection *section,
+2
View File
@@ -5,6 +5,8 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
show_parsing_error (GtkCssProvider *provider,
GtkCssSection *section,
-1
View File
@@ -24,7 +24,6 @@
</gresource>
<gresource prefix="/css_accordion">
<file>css_accordion.css</file>
<file>reset.css</file>
</gresource>
<gresource prefix="/css_basics">
<file>css_basics.css</file>
+18 -12
View File
@@ -8,6 +8,8 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *window = NULL;
static GtkWidget *entry1 = NULL;
static GtkWidget *entry2 = NULL;
@@ -16,19 +18,23 @@ static void
message_dialog_clicked (GtkButton *button,
gpointer user_data)
{
GtkWidget *dialog;
static int i = 1;
GtkAlertDialog *dialog;
GtkWindow *parent;
static int count = 1;
char *detail;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK_CANCEL,
"Test message");
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
ngettext ("Has been shown once", "Has been shown %d times", i), i);
g_signal_connect (dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
i++;
parent = GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_WINDOW));
dialog = gtk_alert_dialog_new ("Test message");
detail = g_strdup_printf (ngettext ("Has been shown once", "Has been shown %d times", count), count);
gtk_alert_dialog_set_detail (dialog, detail);
g_free (detail);
gtk_alert_dialog_set_buttons (dialog, (const char *[]) {"_Cancel", "_OK", NULL });
gtk_alert_dialog_set_cancel_button (dialog, 0);
gtk_alert_dialog_set_default_button (dialog, 1);
gtk_alert_dialog_show (dialog, parent);
count++;
}
typedef struct {
+44 -27
View File
@@ -11,6 +11,7 @@
#include <gtk/gtk.h>
G_DECLARE_FINAL_TYPE (CanvasItem, canvas_item, CANVAS, ITEM, GtkWidget)
struct _CanvasItem {
@@ -24,6 +25,9 @@ struct _CanvasItem {
double delta;
GtkWidget *editor;
GtkStyleProvider *provider;
char *css_class;
};
struct _CanvasItemClass {
@@ -34,32 +38,41 @@ G_DEFINE_TYPE (CanvasItem, canvas_item, GTK_TYPE_WIDGET)
static int n_items = 0;
static void
unstyle_item (CanvasItem *item)
{
if (item->provider)
{
gtk_style_context_remove_provider_for_display (gtk_widget_get_display (item->label), item->provider);
g_clear_object (&item->provider);
}
if (item->css_class)
{
gtk_widget_remove_css_class (item->label, item->css_class);
g_clear_pointer (&item->css_class, g_free);
}
}
static void
set_color (CanvasItem *item,
GdkRGBA *color)
{
char *css;
char *str;
GtkStyleContext *context;
GtkCssProvider *provider;
const char *old_class;
const char *name;
unstyle_item (item);
str = gdk_rgba_to_string (color);
css = g_strdup_printf ("* { background: %s; }", str);
context = gtk_widget_get_style_context (item->label);
provider = g_object_get_data (G_OBJECT (context), "style-provider");
if (provider)
gtk_style_context_remove_provider (context, GTK_STYLE_PROVIDER (provider));
old_class = (const char *)g_object_get_data (G_OBJECT (item->label), "css-class");
if (old_class)
gtk_widget_remove_css_class (item->label, old_class);
name = gtk_widget_get_name (item->label);
css = g_strdup_printf ("#%s { background: %s; }", name, str);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css, -1);
gtk_style_context_add_provider (gtk_widget_get_style_context (item->label), GTK_STYLE_PROVIDER (provider), 800);
g_object_set_data_full (G_OBJECT (context), "style-provider", provider, g_object_unref);
gtk_style_context_add_provider_for_display (gtk_widget_get_display (item->label), GTK_STYLE_PROVIDER (provider), 700);
item->provider = GTK_STYLE_PROVIDER (provider);
g_free (str);
g_free (css);
@@ -69,21 +82,10 @@ static void
set_css (CanvasItem *item,
const char *class)
{
GtkStyleContext *context;
GtkCssProvider *provider;
const char *old_class;
unstyle_item (item);
context = gtk_widget_get_style_context (item->label);
provider = g_object_get_data (G_OBJECT (context), "style-provider");
if (provider)
gtk_style_context_remove_provider (context, GTK_STYLE_PROVIDER (provider));
old_class = (const char *)g_object_get_data (G_OBJECT (item->label), "css-class");
if (old_class)
gtk_widget_remove_css_class (item->label, old_class);
g_object_set_data_full (G_OBJECT (item->label), "css-class", g_strdup (class), g_free);
gtk_widget_add_css_class (item->label, class);
item->css_class = g_strdup (class);
}
static gboolean
@@ -722,8 +724,11 @@ do_dnd (GtkWidget *do_widget)
int i;
int x, y;
GtkCssProvider *provider;
GString *css;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
button = gtk_color_button_new ();
G_GNUC_END_IGNORE_DEPRECATIONS
g_object_unref (g_object_ref_sink (button));
provider = gtk_css_provider_new ();
@@ -733,6 +738,18 @@ do_dnd (GtkWidget *do_widget)
800);
g_object_unref (provider);
css = g_string_new ("");
for (i = 0; colors[i]; i++)
g_string_append_printf (css, ".canvasitem.%s { background: %s; }\n", colors[i], colors[i]);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css->str, css->len);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
800);
g_object_unref (provider);
g_string_free (css, TRUE);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
+2
View File
@@ -14,6 +14,8 @@
#include <string.h>
#include <stdlib.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
typedef struct
{
int number;
+2
View File
@@ -8,6 +8,8 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* Creates a tree model containing the completions */
static GtkTreeModel *
create_completion_model (void)
+2
View File
@@ -10,6 +10,8 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *window = NULL;
static void
+2
View File
@@ -9,6 +9,8 @@
#include <gtk/gtk.h>
#include <stdlib.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
enum {
WIDTH_COLUMN,
HEIGHT_COLUMN,
+2
View File
@@ -68,11 +68,13 @@ create_blurred_button (void)
return w;
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *
create_font_button (void)
{
return gtk_font_button_new ();
}
G_GNUC_END_IGNORE_DEPRECATIONS
static GtkWidget *
create_level_bar (void)
+166 -107
View File
@@ -21,6 +21,77 @@
#include "script-names.h"
#include "language-names.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* {{{ ScriptLang object */
G_DECLARE_FINAL_TYPE (ScriptLang, script_lang, SCRIPT, LANG, GObject)
struct _ScriptLang
{
GObject parent;
char *langname;
unsigned int script_index;
unsigned int lang_index;
hb_tag_t lang_tag;
};
struct _ScriptLangClass
{
GObjectClass parent_class;
};
G_DEFINE_TYPE (ScriptLang, script_lang, G_TYPE_OBJECT)
static void
script_lang_init (ScriptLang *self)
{
}
static void
script_lang_finalize (GObject *object)
{
ScriptLang *self = SCRIPT_LANG (object);
g_free (self->langname);
G_OBJECT_CLASS (script_lang_parent_class)->finalize (object);
}
static void
script_lang_class_init (ScriptLangClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = script_lang_finalize;
}
static ScriptLang *
script_lang_new (const char *langname,
unsigned int script_index,
unsigned int lang_index,
hb_tag_t lang_tag)
{
ScriptLang *self;
self = g_object_new (script_lang_get_type (), NULL);
self->langname = g_strdup (langname);
self->script_index = script_index;
self->lang_index = lang_index;
self->lang_tag = lang_tag;
return self;
}
static char *
script_lang_get_langname (ScriptLang *self)
{
return g_strdup (self->langname);
}
/* }}} */
#define MAKE_TAG(a,b,c,d) (unsigned int)(((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
@@ -94,6 +165,10 @@ demo_free (gpointer data)
g_clear_pointer (&demo->axes, g_hash_table_unref);
g_clear_pointer (&demo->text, g_free);
gtk_style_context_remove_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (demo->provider));
g_object_unref (demo->provider);
g_free (demo);
}
@@ -183,10 +258,10 @@ swap_colors (void)
GdkRGBA fg;
GdkRGBA bg;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->foreground), &fg);
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->background), &bg);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->foreground), &bg);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->background), &fg);
fg = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground));
bg = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background));
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground), &bg);
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background), &fg);
}
static void
@@ -195,8 +270,8 @@ font_features_reset_basic (void)
gtk_adjustment_set_value (demo->size_adjustment, 20);
gtk_adjustment_set_value (demo->letterspacing_adjustment, 0);
gtk_adjustment_set_value (demo->line_height_adjustment, 1);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->foreground), &(GdkRGBA){0.,0.,0.,1.});
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->background), &(GdkRGBA){1.,1.,1.,1.});
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground), &(GdkRGBA){0.,0.,0.,1.});
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background), &(GdkRGBA){1.,1.,1.,1.});
}
static void
@@ -204,7 +279,7 @@ update_basic (void)
{
PangoFontDescription *desc;
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (demo->font));
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (demo->font));
gtk_adjustment_set_value (demo->size_adjustment,
pango_font_description_get_size (desc) / (double) PANGO_SCALE);
@@ -471,8 +546,6 @@ update_display (void)
GString *s;
char *text;
gboolean has_feature;
GtkTreeIter iter;
GtkTreeModel *model;
PangoFontDescription *desc;
GList *l;
PangoAttrList *attrs;
@@ -517,7 +590,7 @@ update_display (void)
end = PANGO_ATTR_INDEX_TO_TEXT_END;
}
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (demo->font));
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (demo->font));
value = gtk_adjustment_get_value (demo->size_adjustment);
pango_font_description_set_size (desc, value * PANGO_SCALE);
@@ -575,14 +648,13 @@ update_display (void)
features = g_string_free (s, FALSE);
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (demo->script_lang), &iter))
if (gtk_drop_down_get_selected (GTK_DROP_DOWN (demo->script_lang)) != 0)
{
hb_tag_t lang_tag;
ScriptLang *selected;
model = gtk_combo_box_get_model (GTK_COMBO_BOX (demo->script_lang));
gtk_tree_model_get (model, &iter, 3, &lang_tag, -1);
selected = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (demo->script_lang));
lang = pango_language_from_string (hb_language_to_string (hb_ot_tag_to_language (lang_tag)));
lang = pango_language_from_string (hb_language_to_string (hb_ot_tag_to_language (selected->lang_tag)));
}
else
lang = NULL;
@@ -609,7 +681,7 @@ update_display (void)
GdkRGBA rgba;
char *fg, *bg, *css;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->foreground), &rgba);
rgba = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground));
attr = pango_attr_foreground_new (65535 * rgba.red,
65535 * rgba.green,
65535 * rgba.blue);
@@ -622,7 +694,7 @@ update_display (void)
pango_attr_list_insert (attrs, attr);
fg = gdk_rgba_to_string (&rgba);
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->background), &rgba);
rgba = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background));
bg = gdk_rgba_to_string (&rgba);
css = g_strdup_printf (".font_features_background { caret-color: %s; background-color: %s; }", fg, bg);
gtk_css_provider_load_from_data (demo->provider, css, strlen (css));
@@ -697,7 +769,6 @@ update_display (void)
gtk_label_set_attributes (GTK_LABEL (demo->the_label), attrs);
g_free (font_desc);
pango_font_description_free (desc);
g_free (features);
pango_attr_list_unref (attrs);
g_free (text);
@@ -709,7 +780,7 @@ get_pango_font (void)
PangoFontDescription *desc;
PangoContext *context;
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (demo->font));
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (demo->font));
context = gtk_widget_get_pango_context (demo->font);
return pango_context_load_font (context, desc);
@@ -739,50 +810,40 @@ tag_pair_equal (gconstpointer a, gconstpointer b)
return pair_a->script_tag == pair_b->script_tag && pair_a->lang_tag == pair_b->lang_tag;
}
static int
script_sort_func (GtkTreeModel *model,
GtkTreeIter *a,
GtkTreeIter *b,
gpointer user_data)
static GtkOrdering
script_sort (const void *item1,
const void *item2,
void *data)
{
char *sa, *sb;
int ret;
ScriptLang *a = (ScriptLang *)item1;
ScriptLang *b = (ScriptLang *)item2;
gtk_tree_model_get (model, a, 0, &sa, -1);
gtk_tree_model_get (model, b, 0, &sb, -1);
ret = strcmp (sa, sb);
g_free (sa);
g_free (sb);
return ret;
return strcmp (a->langname, b->langname);
}
static void
update_script_combo (void)
{
GtkListStore *store;
GListStore *store;
GtkSortListModel *sortmodel;
hb_font_t *hb_font;
int i, j, k;
PangoFont *pango_font;
GHashTable *tags;
GHashTableIter iter;
TagPair *pair;
char *lang;
PangoLanguage *language;
const char *lang;
hb_tag_t active;
GtkTreeIter active_iter;
gboolean have_active = FALSE;
lang = gtk_font_chooser_get_language (GTK_FONT_CHOOSER (demo->font));
language = gtk_font_dialog_button_get_language (GTK_FONT_DIALOG_BUTTON (demo->font));
lang = pango_language_to_string (language);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
active = hb_ot_tag_from_language (hb_language_from_string (lang, -1));
G_GNUC_END_IGNORE_DEPRECATIONS
g_free (lang);
store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
store = g_list_store_new (script_lang_get_type ());
pango_font = get_pango_font ();
hb_font = pango_font_get_hb_font (pango_font);
@@ -806,19 +867,19 @@ update_script_combo (void)
hb_face = hb_font_get_face (hb_font);
for (i= 0; i < 2; i++)
for (guint i = 0; i < 2; i++)
{
hb_tag_t scripts[80];
unsigned int script_count = G_N_ELEMENTS (scripts);
hb_ot_layout_table_get_script_tags (hb_face, tables[i], 0, &script_count, scripts);
for (j = 0; j < script_count; j++)
for (guint j = 0; j < script_count; j++)
{
hb_tag_t languages[80];
unsigned int language_count = G_N_ELEMENTS (languages);
hb_ot_layout_script_get_language_tags (hb_face, tables[i], j, 0, &language_count, languages);
for (k = 0; k < language_count; k++)
for (guint k = 0; k < language_count; k++)
{
pair = g_new (TagPair, 1);
pair->script_tag = scripts[j];
@@ -838,7 +899,6 @@ update_script_combo (void)
{
const char *langname;
char langbuf[5];
GtkTreeIter tree_iter;
if (pair->lang_tag == 0 && pair->script_tag == 0)
langname = NC_("Language", "None");
@@ -855,31 +915,31 @@ update_script_combo (void)
}
}
gtk_list_store_insert_with_values (store, &tree_iter, -1,
0, langname,
1, pair->script_index,
2, pair->lang_index,
3, pair->lang_tag,
-1);
if (pair->lang_tag == active)
{
have_active = TRUE;
active_iter = tree_iter;
}
g_list_store_append (store, script_lang_new (langname,
pair->script_index,
pair->lang_index,
pair->lang_tag));
}
g_hash_table_destroy (tags);
gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (store),
script_sort_func, NULL, NULL);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
GTK_SORT_ASCENDING);
gtk_combo_box_set_model (GTK_COMBO_BOX (demo->script_lang), GTK_TREE_MODEL (store));
if (have_active)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (demo->script_lang), &active_iter);
else
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (demo->script_lang), 0);
sortmodel = gtk_sort_list_model_new (G_LIST_MODEL (store),
GTK_SORTER (gtk_custom_sorter_new (script_sort, NULL, NULL)));
gtk_drop_down_set_model (GTK_DROP_DOWN (demo->script_lang), G_LIST_MODEL (sortmodel));
for (guint i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (sortmodel)); i++)
{
ScriptLang *item = g_list_model_get_item (G_LIST_MODEL (sortmodel), i);
g_object_unref (item);
if (item->lang_tag == active)
{
gtk_drop_down_set_selected (GTK_DROP_DOWN (demo->script_lang), i);
break;
}
}
g_object_unref (sortmodel);
}
static char *
@@ -904,27 +964,19 @@ static void
update_features (void)
{
int i, j;
GtkTreeModel *model;
GtkTreeIter iter;
guint script_index, lang_index;
hb_tag_t lang_tag;
PangoFont *pango_font;
hb_font_t *hb_font;
GList *l;
ScriptLang *selected;
/* set feature presence checks from the font features */
if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (demo->script_lang), &iter))
if (gtk_drop_down_get_selected (GTK_DROP_DOWN (demo->script_lang)) == 0)
return;
model = gtk_combo_box_get_model (GTK_COMBO_BOX (demo->script_lang));
gtk_tree_model_get (model, &iter,
1, &script_index,
2, &lang_index,
3, &lang_tag,
-1);
selected = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (demo->script_lang));
if (lang_tag == 0) /* None is selected */
if (selected->lang_tag == 0) /* None is selected */
{
for (l = demo->feature_items; l; l = l->next)
{
@@ -954,7 +1006,7 @@ update_features (void)
{
hb_tag_t tables[2] = { HB_OT_TAG_GSUB, HB_OT_TAG_GPOS };
hb_face_t *hb_face;
char *feat;
const char *feat;
hb_face = hb_font_get_face (hb_font);
@@ -965,8 +1017,8 @@ update_features (void)
hb_ot_layout_language_get_feature_tags (hb_face,
tables[i],
script_index,
lang_index,
selected->script_index,
selected->lang_index,
0,
&count,
features);
@@ -988,8 +1040,8 @@ update_features (void)
hb_ot_layout_language_find_feature (hb_face,
tables[i],
script_index,
lang_index,
selected->script_index,
selected->lang_index,
features[j],
&feature_index);
@@ -1047,7 +1099,7 @@ update_features (void)
}
}
feat = gtk_font_chooser_get_font_features (GTK_FONT_CHOOSER (demo->font));
feat = gtk_font_dialog_button_get_font_features (GTK_FONT_DIALOG_BUTTON (demo->font));
if (feat)
{
for (l = demo->feature_items; l; l = l->next)
@@ -1073,8 +1125,6 @@ update_features (void)
}
}
}
g_free (feat);
}
}
@@ -1321,10 +1371,9 @@ free_instance (gpointer data)
}
static void
add_instance (hb_face_t *face,
unsigned int index,
GtkWidget *combo,
int pos)
add_instance (hb_face_t *face,
unsigned int index,
GtkStringList *strings)
{
Instance *instance;
hb_ot_name_id_t name_id;
@@ -1340,20 +1389,20 @@ add_instance (hb_face_t *face,
instance->index = index;
g_hash_table_add (demo->instances, instance);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), instance->name);
gtk_string_list_append (GTK_STRING_LIST (strings), instance->name);
}
static void
unset_instance (GtkAdjustment *adjustment)
{
if (demo->instance_combo)
gtk_combo_box_set_active (GTK_COMBO_BOX (demo->instance_combo), 0);
gtk_drop_down_set_selected (GTK_DROP_DOWN (demo->instance_combo), 0);
}
static void
instance_changed (GtkComboBox *combo)
instance_changed (GtkDropDown *combo)
{
char *text;
const char *text;
Instance *instance;
Instance ikey;
int i;
@@ -1365,11 +1414,12 @@ instance_changed (GtkComboBox *combo)
hb_font_t *hb_font;
hb_face_t *hb_face;
text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combo));
text = gtk_string_list_get_string (GTK_STRING_LIST (gtk_drop_down_get_model (combo)),
gtk_drop_down_get_selected (combo));
if (text[0] == '\0')
goto out;
ikey.name = text;
ikey.name = (char *) text;
instance = g_hash_table_lookup (demo->instances, &ikey);
if (!instance)
{
@@ -1410,7 +1460,6 @@ instance_changed (GtkComboBox *combo)
}
out:
g_free (text);
g_clear_object (&pango_font);
g_free (ai);
g_free (coords);
@@ -1520,6 +1569,7 @@ update_font_variations (void)
{
GtkWidget *label;
GtkWidget *combo;
GtkStringList *strings;
label = gtk_label_new ("Instance");
gtk_label_set_xalign (GTK_LABEL (label), 0);
@@ -1527,26 +1577,28 @@ update_font_variations (void)
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_grid_attach (GTK_GRID (demo->variations_grid), label, 0, -1, 1, 1);
combo = gtk_combo_box_text_new ();
strings = gtk_string_list_new (NULL);
combo = gtk_drop_down_new (G_LIST_MODEL (strings), NULL);
gtk_widget_set_halign (combo, GTK_ALIGN_START);
gtk_widget_set_valign (combo, GTK_ALIGN_BASELINE);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "");
gtk_string_list_append (strings, "");
for (i = 0; i < hb_ot_var_get_named_instance_count (hb_face); i++)
add_instance (hb_face, i, combo, i);
add_instance (hb_face, i, strings);
for (i = 0; i < hb_ot_var_get_named_instance_count (hb_face); i++)
{
if (matches_instance (hb_face, i, n_axes, design_coords))
{
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i + 1);
gtk_drop_down_set_selected (GTK_DROP_DOWN (combo), i + 1);
break;
}
}
gtk_grid_attach (GTK_GRID (demo->variations_grid), combo, 1, -1, 3, 1);
g_signal_connect (combo, "changed", G_CALLBACK (instance_changed), NULL);
g_signal_connect (combo, "notify::selecte", G_CALLBACK (instance_changed), NULL);
demo->instance_combo = combo;
}
@@ -1693,6 +1745,7 @@ do_font_features (GtkWidget *do_widget)
GtkBuilder *builder;
GtkBuilderScope *scope;
GtkEventController *controller;
GtkExpression *expression;
builder = gtk_builder_new ();
@@ -1726,6 +1779,10 @@ do_font_features (GtkWidget *do_widget)
demo->description = GTK_WIDGET (gtk_builder_get_object (builder, "description"));
demo->font = GTK_WIDGET (gtk_builder_get_object (builder, "font"));
demo->script_lang = GTK_WIDGET (gtk_builder_get_object (builder, "script_lang"));
g_assert (GTK_IS_DROP_DOWN (demo->script_lang));
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, G_CALLBACK (script_lang_get_langname), NULL, NULL);
gtk_drop_down_set_expression (GTK_DROP_DOWN (demo->script_lang), expression);
gtk_expression_unref (expression);
demo->feature_list = GTK_WIDGET (gtk_builder_get_object (builder, "feature_list"));
demo->stack = GTK_WIDGET (gtk_builder_get_object (builder, "stack"));
demo->entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
@@ -1744,8 +1801,8 @@ do_font_features (GtkWidget *do_widget)
demo->swin = GTK_WIDGET (gtk_builder_get_object (builder, "swin"));
demo->provider = gtk_css_provider_new ();
gtk_style_context_add_provider (gtk_widget_get_style_context (demo->swin),
GTK_STYLE_PROVIDER (demo->provider), 800);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (demo->provider), 800);
basic_value_changed (demo->size_adjustment, demo->size_entry);
basic_value_changed (demo->letterspacing_adjustment, demo->letterspacing_entry);
@@ -1823,3 +1880,5 @@ do_font_features (GtkWidget *do_widget)
return window;
}
/* vim:set foldmethod=marker expandtab: */
+19 -14
View File
@@ -58,11 +58,14 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkFontButton" id="font">
<object class="GtkFontDialogButton" id="font">
<property name="dialog">
<object class="GtkFontDialog">
</object>
</property>
<property name="receives-default">1</property>
<property name="font">Sans 12</property>
<property name="level">family|style</property>
<signal name="font-set" handler="font_features_font_changed" swapped="no"/>
<property name="level">face</property>
<signal name="notify::font-desc" handler="font_features_font_changed" swapped="no"/>
</object>
</child>
<child>
@@ -192,7 +195,11 @@
</object>
</child>
<child>
<object class="GtkColorButton" id="foreground">
<object class="GtkColorDialogButton" id="foreground">
<property name="dialog">
<object class="GtkColorDialog">
</object>
</property>
<property name="valign">baseline</property>
<property name="rgba">black</property>
<signal name="notify::rgba" handler="color_set_cb"/>
@@ -214,7 +221,11 @@
</object>
</child>
<child>
<object class="GtkColorButton" id="background">
<object class="GtkColorDialogButton" id="background">
<property name="dialog">
<object class="GtkColorDialog">
</object>
</property>
<property name="valign">baseline</property>
<property name="rgba">white</property>
<signal name="notify::rgba" handler="color_set_cb"/>
@@ -259,16 +270,10 @@
<object class="GtkBox" id="feature_list">
<property name="orientation">vertical</property>
<child>
<object class="GtkComboBox" id="script_lang">
<object class="GtkDropDown" id="script_lang">
<property name="tooltip-text" translatable="yes">Language System</property>
<property name="margin-top">10</property>
<signal name="changed" handler="font_features_script_changed" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
<signal name="notify::selected" handler="font_features_script_changed" swapped="no"/>
</object>
</child>
</object>
+18 -16
View File
@@ -43,7 +43,6 @@ update_image (void)
cairo_t *cr;
GdkPixbuf *pixbuf;
GdkPixbuf *pixbuf2;
const char *hint;
cairo_font_options_t *fopt;
cairo_hint_style_t hintstyle;
cairo_hint_metrics_t hintmetrics;
@@ -54,22 +53,27 @@ update_image (void)
context = gtk_widget_create_pango_context (image);
text = gtk_editable_get_text (GTK_EDITABLE (entry));
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (font_button));
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (font_button));
fopt = cairo_font_options_copy (pango_cairo_context_get_font_options (context));
hint = gtk_combo_box_get_active_id (GTK_COMBO_BOX (hinting));
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
if (hint)
switch (gtk_drop_down_get_selected (GTK_DROP_DOWN (hinting)))
{
if (strcmp (hint, "none") == 0)
hintstyle = CAIRO_HINT_STYLE_NONE;
else if (strcmp (hint, "slight") == 0)
hintstyle = CAIRO_HINT_STYLE_SLIGHT;
else if (strcmp (hint, "medium") == 0)
hintstyle = CAIRO_HINT_STYLE_MEDIUM;
else if (strcmp (hint, "full") == 0)
hintstyle = CAIRO_HINT_STYLE_FULL;
case 0:
hintstyle = CAIRO_HINT_STYLE_NONE;
break;
case 1:
hintstyle = CAIRO_HINT_STYLE_SLIGHT;
break;
case 2:
hintstyle = CAIRO_HINT_STYLE_MEDIUM;
break;
case 3:
hintstyle = CAIRO_HINT_STYLE_FULL;
break;
default:
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
break;
}
cairo_font_options_set_hint_style (fopt, hintstyle);
@@ -283,8 +287,6 @@ retry:
gtk_picture_set_pixbuf (GTK_PICTURE (image), pixbuf2);
g_object_unref (pixbuf2);
pango_font_description_free (desc);
}
static gboolean fading = FALSE;
@@ -418,7 +420,7 @@ do_fontrendering (GtkWidget *do_widget)
g_signal_connect (down_button, "clicked", G_CALLBACK (scale_down), NULL);
g_signal_connect (entry, "notify::text", G_CALLBACK (update_image), NULL);
g_signal_connect (font_button, "notify::font-desc", G_CALLBACK (update_image), NULL);
g_signal_connect (hinting, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (hinting, "notify::selected", G_CALLBACK (update_image), NULL);
g_signal_connect (anti_alias, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (hint_metrics, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (text_radio, "notify::active", G_CALLBACK (update_image), NULL);
+16 -9
View File
@@ -74,7 +74,11 @@
</object>
</child>
<child>
<object class="GtkFontButton" id="font_button">
<object class="GtkFontDialogButton" id="font_button">
<property name="dialog">
<object class="GtkFontDialog">
</object>
</property>
<layout>
<property name="column">2</property>
<property name="row">1</property>
@@ -116,15 +120,18 @@
</object>
</child>
<child>
<object class="GtkComboBoxText" id="hinting">
<property name="active">0</property>
<object class="GtkDropDown" id="hinting">
<property name="valign">center</property>
<items>
<item translatable="yes" id="none">None</item>
<item translatable="yes" id="slight">Slight</item>
<item translatable="yes" id="medium">Medium</item>
<item translatable="yes" id="full">Full</item>
</items>
<property name="model">
<object class="GtkStringList">
<items>
<item translatable="yes">None</item>
<item translatable="yes">Slight</item>
<item translatable="yes">Medium</item>
<item translatable="yes">Full</item>
</items>
</object>
</property>
</object>
</child>
<layout>
+18 -7
View File
@@ -144,7 +144,6 @@ make_shader_stack (const char *name,
GtkTextBuffer *buffer;
GBytes *bytes;
GtkEventController *controller;
GtkCssProvider *provider;
GdkPaintable *paintable;
stack = gtk_shader_stack_new ();
@@ -235,12 +234,6 @@ make_shader_stack (const char *name,
g_signal_connect (buffer, "changed", G_CALLBACK (text_changed), button);
g_object_set_data (G_OBJECT (button), "the-stack", stack);
g_signal_connect (button, "clicked", G_CALLBACK (apply_text), buffer);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, "button.small { padding: 0; }", -1);
gtk_style_context_add_provider (gtk_widget_get_style_context (button),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref (provider);
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
gtk_widget_add_css_class (button, "small");
@@ -274,11 +267,21 @@ make_shader_stack (const char *name,
return vbox;
}
static void
remove_provider (gpointer data)
{
GtkStyleProvider *provider = GTK_STYLE_PROVIDER (data);
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
g_object_unref (provider);
}
static GtkWidget *
create_gltransition_window (GtkWidget *do_widget)
{
GtkWidget *window, *headerbar, *scale, *outer_grid, *grid, *background;
GdkPaintable *paintable;
GtkCssProvider *provider;
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
@@ -333,6 +336,14 @@ create_gltransition_window (GtkWidget *do_widget)
make_shader_stack ("Kaleidoscope", "/gltransition/kaleidoscope.glsl", 3, scale),
1, 1, 1, 1);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, "button.small { padding: 0; }", -1);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_set_data_full (G_OBJECT (window), "provider", provider, remove_provider);
return window;
}
+2
View File
@@ -9,6 +9,8 @@
#include <gtk/gtk.h>
#include <string.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *window = NULL;
#define FOLDER_NAME "/iconview/gnome-fs-directory.png"
+2
View File
@@ -8,6 +8,8 @@
#include <gtk/gtk.h>
#include <string.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
enum
{
COL_TEXT,
+26 -64
View File
@@ -83,24 +83,17 @@ progressive_timeout (gpointer data)
if (bytes_read < 0)
{
GtkWidget *dialog;
GtkAlertDialog *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failure reading image file 'alphatest.png': %s",
error->message);
dialog = gtk_alert_dialog_new ("Failure reading image file 'alphatest.png': %s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
g_object_unref (image_stream);
image_stream = NULL;
gtk_widget_show (dialog);
load_timeout = 0;
return FALSE; /* uninstall the timeout */
@@ -110,25 +103,17 @@ progressive_timeout (gpointer data)
buf, bytes_read,
&error))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failed to load image: %s",
error->message);
GtkAlertDialog *dialog;
dialog = gtk_alert_dialog_new ("Failed to load image: %s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
g_object_unref (image_stream);
image_stream = NULL;
gtk_widget_show (dialog);
load_timeout = 0;
return FALSE; /* uninstall the timeout */
@@ -143,22 +128,14 @@ progressive_timeout (gpointer data)
error = NULL;
if (!g_input_stream_close (image_stream, NULL, &error))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failed to load image: %s",
error->message);
GtkAlertDialog *dialog;
dialog = gtk_alert_dialog_new ("Failed to load image: %s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
g_object_unref (image_stream);
image_stream = NULL;
g_object_unref (pixbuf_loader);
@@ -177,25 +154,16 @@ progressive_timeout (gpointer data)
* it was incomplete.
*/
error = NULL;
if (!gdk_pixbuf_loader_close (pixbuf_loader,
&error))
if (!gdk_pixbuf_loader_close (pixbuf_loader, &error))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failed to load image: %s",
error->message);
GtkAlertDialog *dialog;
dialog = gtk_alert_dialog_new ("Failed to load image: %s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
g_object_unref (pixbuf_loader);
pixbuf_loader = NULL;
@@ -216,20 +184,14 @@ progressive_timeout (gpointer data)
if (image_stream == NULL)
{
GtkWidget *dialog;
GtkAlertDialog *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"%s", error->message);
dialog = gtk_alert_dialog_new ("%s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
load_timeout = 0;
return FALSE; /* uninstall the timeout */
+8 -15
View File
@@ -12,8 +12,8 @@ on_bar_response (GtkInfoBar *info_bar,
int response_id,
gpointer user_data)
{
GtkWidget *dialog;
GtkWidget *window;
GtkAlertDialog *dialog;
char *detail;
if (response_id == GTK_RESPONSE_CLOSE)
{
@@ -21,19 +21,12 @@ on_bar_response (GtkInfoBar *info_bar,
return;
}
window = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (info_bar)));
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"You clicked a button on an info bar");
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"Your response has id %d", response_id);
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_window_destroy), dialog);
gtk_widget_show (dialog);
dialog = gtk_alert_dialog_new ("You clicked a button on an info bar");
detail = g_strdup_printf ("Your response has been %d", response_id);
gtk_alert_dialog_set_detail (dialog, detail);
g_free (detail);
gtk_alert_dialog_show (dialog, GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (info_bar))));
g_object_unref (dialog);
}
GtkWidget *
+10 -26
View File
@@ -7,38 +7,22 @@
#include <gtk/gtk.h>
static void
response_cb (GtkWidget *dialog,
int response_id,
gpointer data)
{
gtk_window_destroy (GTK_WINDOW (dialog));
}
static gboolean
activate_link (GtkWidget *label,
activate_link (GtkWidget *label,
const char *uri,
gpointer data)
gpointer data)
{
if (g_strcmp0 (uri, "keynav") == 0)
{
GtkWidget *dialog;
GtkWidget *parent;
GtkAlertDialog *dialog;
parent = GTK_WIDGET (gtk_widget_get_root (label));
dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (parent),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"Keyboard navigation");
gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog),
"The term <i>keynav</i> is a shorthand for "
"keyboard navigation and refers to the process of using "
"a program (exclusively) via keyboard input.");
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_window_present (GTK_WINDOW (dialog));
g_signal_connect (dialog, "response", G_CALLBACK (response_cb), NULL);
dialog = gtk_alert_dialog_new ("Keyboard navigation");
gtk_alert_dialog_set_detail (dialog,
"The term keynav is a shorthand for "
"keyboard navigation and refers to the process of using "
"a program (exclusively) via keyboard input.");
gtk_alert_dialog_show (dialog, GTK_WINDOW (gtk_widget_get_root (label)));
g_object_unref (dialog);
return TRUE;
}
+2
View File
@@ -7,6 +7,8 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *window = NULL;
static GtkTreeModel *model = NULL;
static guint timeout = 0;
+5 -8
View File
@@ -117,19 +117,16 @@ activate_cb (GtkListView *list,
G_APP_LAUNCH_CONTEXT (context),
&error))
{
GtkWidget *dialog;
GtkAlertDialog *dialog;
/* And because error handling is important, even a simple demo has it:
* We display an error dialog that something went wrong.
*/
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (list))),
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Could not launch %s", g_app_info_get_display_name (app_info));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", error->message);
dialog = gtk_alert_dialog_new ("Could not launch %s", g_app_info_get_display_name (app_info));
gtk_alert_dialog_set_detail (dialog, error->message);
gtk_alert_dialog_show (dialog, GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (list))));
g_object_unref (dialog);
g_clear_error (&error);
gtk_widget_show (dialog);
}
g_object_unref (context);
+4
View File
@@ -422,6 +422,10 @@ do_listview_settings (GtkWidget *do_widget)
gtk_column_view_column_set_sorter (name_column, sorter);
g_object_unref (sorter);
sorter = GTK_SORTER (gtk_string_sorter_new (gtk_property_expression_new (SETTINGS_TYPE_KEY, NULL, "type")));
gtk_column_view_column_set_sorter (type_column, sorter);
g_object_unref (sorter);
g_object_unref (builder);
}
+12 -2
View File
@@ -10,7 +10,6 @@
#include "script-names.h"
#include "unicode-names.h"
#define UCD_TYPE_ITEM (ucd_item_get_type ())
G_DECLARE_FINAL_TYPE (UcdItem, ucd_item, UCD, ITEM, GObject)
@@ -338,6 +337,15 @@ create_ucd_view (GtkWidget *label)
static GtkWidget *window;
static void
remove_provider (gpointer data)
{
GtkStyleProvider *provider = GTK_STYLE_PROVIDER (data);
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
g_object_unref (provider);
}
GtkWidget *
do_listview_ucd (GtkWidget *do_widget)
{
@@ -360,7 +368,7 @@ do_listview_ucd (GtkWidget *do_widget)
gtk_widget_add_css_class (label, "enormous");
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, "label.enormous { font-size: 80px; }", -1);
gtk_style_context_add_provider (gtk_widget_get_style_context (label), GTK_STYLE_PROVIDER (provider), 800);
gtk_style_context_add_provider_for_display (gdk_display_get_default (), GTK_STYLE_PROVIDER (provider), 800);
gtk_widget_set_hexpand (label, TRUE);
gtk_box_append (GTK_BOX (box), label);
@@ -370,6 +378,8 @@ do_listview_ucd (GtkWidget *do_widget)
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), listview);
gtk_box_prepend (GTK_BOX (box), sw);
gtk_window_set_child (GTK_WINDOW (window), box);
g_object_set_data_full (G_OBJECT (window), "provider", provider, remove_provider);
}
if (!gtk_widget_get_visible (window))
+17 -21
View File
@@ -42,7 +42,7 @@ update_title_cb (GtkFilterListModel *model)
title = g_strdup_printf ("%u lines", g_list_model_get_n_items (G_LIST_MODEL (model)));
gtk_widget_set_visible (progress, pending != 0);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), (total - pending) / (double) total);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), total > 0 ? (total - pending) / (double) total : 0.);
gtk_window_set_title (GTK_WINDOW (window), title);
g_free (title);
}
@@ -141,39 +141,35 @@ load_file (GtkStringList *list,
}
static void
open_response_cb (GtkNativeDialog *dialog,
int response,
GtkStringList *stringlist)
open_response_cb (GObject *source,
GAsyncResult *result,
void *user_data)
{
gtk_native_dialog_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GtkStringList *stringlist = GTK_STRING_LIST (user_data);
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_open_finish (dialog, result, NULL);
if (file)
{
GFile *file;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
load_file (stringlist, file);
g_object_unref (file);
}
gtk_native_dialog_destroy (dialog);
}
static void
file_open_cb (GtkWidget *button,
GtkStringList *stringlist)
{
GtkFileChooserNative *dialog;
GtkFileDialog *dialog;
dialog = gtk_file_chooser_native_new ("Open file",
GTK_WINDOW (gtk_widget_get_root (button)),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Load",
"_Cancel");
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), stringlist);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
dialog = gtk_file_dialog_new ();
gtk_file_dialog_open (dialog,
GTK_WINDOW (gtk_widget_get_root (button)),
NULL,
NULL,
open_response_cb, stringlist);
g_object_unref (dialog);
}
GtkWidget *
+20 -17
View File
@@ -7,6 +7,8 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
enum {
COLOR_SET,
N_SIGNALS
@@ -51,8 +53,8 @@ static const char *pad_colors[] = {
static GType drawing_area_get_type (void);
G_DEFINE_TYPE (DrawingArea, drawing_area, GTK_TYPE_WIDGET)
static void drawing_area_set_color (DrawingArea *area,
GdkRGBA *color);
static void drawing_area_set_color (DrawingArea *area,
const GdkRGBA *color);
static void
drawing_area_ensure_surface (DrawingArea *area,
@@ -350,8 +352,8 @@ drawing_area_new (void)
}
static void
drawing_area_set_color (DrawingArea *area,
GdkRGBA *color)
drawing_area_set_color (DrawingArea *area,
const GdkRGBA *color)
{
if (gdk_rgba_equal (&area->draw_color, color))
return;
@@ -361,21 +363,22 @@ drawing_area_set_color (DrawingArea *area,
}
static void
color_button_color_set (GtkColorButton *button,
DrawingArea *draw_area)
color_button_color_set (GtkColorDialogButton *button,
GParamSpec *pspec,
DrawingArea *draw_area)
{
GdkRGBA color;
const GdkRGBA *color;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (button), &color);
drawing_area_set_color (draw_area, &color);
color = gtk_color_dialog_button_get_rgba (button);
drawing_area_set_color (draw_area, color);
}
static void
drawing_area_color_set (DrawingArea *area,
GdkRGBA *color,
GtkColorButton *button)
drawing_area_color_set (DrawingArea *area,
GdkRGBA *color,
GtkColorDialogButton *button)
{
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (button), color);
gtk_color_dialog_button_set_rgba (button, color);
}
GtkWidget *
@@ -394,13 +397,13 @@ do_paint (GtkWidget *toplevel)
headerbar = gtk_header_bar_new ();
colorbutton = gtk_color_button_new ();
g_signal_connect (colorbutton, "color-set",
colorbutton = gtk_color_dialog_button_new (gtk_color_dialog_new ());
g_signal_connect (colorbutton, "notify::rgba",
G_CALLBACK (color_button_color_set), draw_area);
g_signal_connect (draw_area, "color-set",
G_CALLBACK (drawing_area_color_set), colorbutton);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (colorbutton),
&(GdkRGBA) { 0, 0, 0, 1 });
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (colorbutton),
&(GdkRGBA) { 0, 0, 0, 1 });
gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), colorbutton);
gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
+23 -19
View File
@@ -13,25 +13,24 @@
static void
open_response_cb (GtkNativeDialog *dialog,
int response,
GtkPicture *picture)
open_response_cb (GObject *source,
GAsyncResult *result,
void *data)
{
gtk_native_dialog_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GtkPicture *picture = data;
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_open_finish (dialog, result, NULL);
if (file)
{
GFile *file;
GdkPaintable *paintable;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
paintable = svg_paintable_new (file);
gtk_picture_set_paintable (GTK_PICTURE (picture), paintable);
g_object_unref (paintable);
g_object_unref (file);
}
gtk_native_dialog_destroy (dialog);
}
static void
@@ -39,20 +38,25 @@ show_file_open (GtkWidget *button,
GtkPicture *picture)
{
GtkFileFilter *filter;
GtkFileChooserNative *dialog;
GtkFileDialog *dialog;
GListStore *filters;
dialog = gtk_file_chooser_native_new ("Open node file",
GTK_WINDOW (gtk_widget_get_root (button)),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Load",
"_Cancel");
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Open node file");
filter = gtk_file_filter_new ();
gtk_file_filter_add_mime_type (filter, "image/svg+xml");
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), picture);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
filters = g_list_store_new (GTK_TYPE_FILE_FILTER);
g_list_store_append (filters, filter);
g_object_unref (filter);
gtk_file_dialog_set_filters (dialog, G_LIST_MODEL (filters));
g_object_unref (filters);
gtk_file_dialog_open (dialog,
GTK_WINDOW (gtk_widget_get_root (button)),
NULL,
NULL,
open_response_cb, picture);
}
static GtkWidget *window;
+14 -4
View File
@@ -8,6 +8,7 @@
#include "config.h"
#include <gtk/gtk.h>
/* Create an object for the pegs that get moved around in the game.
*
* We implement the GdkPaintable interface for them, so we can use GtkPicture
@@ -359,6 +360,15 @@ drop_drop (GtkDropTarget *target,
return TRUE;
}
static void
remove_provider (gpointer data)
{
GtkStyleProvider *provider = GTK_STYLE_PROVIDER (data);
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
g_object_unref (provider);
}
static void
create_board (GtkWidget *window)
{
@@ -375,6 +385,9 @@ create_board (GtkWidget *window)
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css, -1);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
800);
grid = gtk_grid_new ();
gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
@@ -393,9 +406,6 @@ create_board (GtkWidget *window)
continue;
image = gtk_image_new ();
gtk_style_context_add_provider (gtk_widget_get_style_context (image),
GTK_STYLE_PROVIDER (provider),
800);
gtk_widget_add_css_class (image, "solitaire-field");
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
if (x != 3 || y != 3)
@@ -439,7 +449,7 @@ create_board (GtkWidget *window)
}
}
g_object_unref (provider);
g_object_set_data_full (G_OBJECT (window), "provider", provider, remove_provider);
}
static void
+48 -67
View File
@@ -1,34 +1,44 @@
/* Pickers
* #Keywords: GtkColorChooser, GtkFontChooser, GtkApplicationChooser
* #Keywords: GtkColorDialog, GtkFontDialog, GtkFileDialog, GtkColorDialogButton, GtkFontDialogButton, chooser, button
*
* These widgets are mainly intended for use in preference dialogs.
* They allow to select colors, fonts and applications.
*
* This demo shows both the default appearance for these dialogs,
* as well as some of the customizations that are possible.
* These widgets and async APIs are mainly intended for use in preference dialogs.
* They allow to select colors, fonts, files and applications.
*/
#include <gtk/gtk.h>
static gboolean
filter_font_cb (const PangoFontFamily *family,
const PangoFontFace *face,
gpointer data)
static void
file_opened (GObject *source,
GAsyncResult *result,
void *data)
{
const char *alias_families[] = {
"Cursive",
"Fantasy",
"Monospace",
"Sans",
"Serif",
"System-ui",
NULL
};
const char *family_name;
GFile *file;
family_name = pango_font_family_get_name (PANGO_FONT_FAMILY (family));
file = gtk_file_dialog_open_finish (GTK_FILE_DIALOG (source), result, NULL);
return g_strv_contains (alias_families, family_name);
if (file)
{
char *name = g_file_get_basename (file);
gtk_button_set_label (GTK_BUTTON (data), name);
g_object_set_data_full (G_OBJECT (data), "file", file, g_object_unref);
g_free (name);
}
}
static void
open_file (GtkButton *picker)
{
GtkWindow *parent = GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (picker)));
GtkFileDialog *dialog;
GFile *file;
dialog = gtk_file_dialog_new ();
file = (GFile *) g_object_get_data (G_OBJECT (picker), "file");
gtk_file_dialog_open (dialog, parent, file, NULL, file_opened, picker);
g_object_unref (dialog);
}
#define COLOR(r,g,b) { r/255., g/255., b/255., 1.0 }
@@ -38,27 +48,6 @@ do_pickers (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
GtkWidget *table, *label, *picker;
GdkRGBA solarized[] = {
COLOR (0xff, 0xff, 0xff),
COLOR (0x07, 0x36, 0x42),
COLOR (0xdc, 0x32, 0x2f),
COLOR (0x85, 0x99, 0x00),
COLOR (0xb5, 0x89, 0x00),
COLOR (0x26, 0x8b, 0xd2),
COLOR (0xd3, 0x36, 0x82),
COLOR (0x2a, 0xa1, 0x98),
COLOR (0xee, 0xe8, 0xd5),
COLOR (0x00, 0x00, 0x00),
COLOR (0x00, 0x2b, 0x36),
COLOR (0xcb, 0x4b, 0x16),
COLOR (0x58, 0x6e, 0x75),
COLOR (0x65, 0x7b, 0x83),
COLOR (0x83, 0x94, 0x96),
COLOR (0x6c, 0x71, 0xc4),
COLOR (0x93, 0xa1, 0xa1),
COLOR (0xfd, 0xf6, 0xe3),
};
if (!window)
{
@@ -77,54 +66,46 @@ do_pickers (GtkWidget *do_widget)
gtk_grid_set_column_spacing (GTK_GRID (table), 10);
gtk_window_set_child (GTK_WINDOW (window), table);
label = gtk_label_new ("Standard");
gtk_widget_add_css_class (label, "title-4");
gtk_grid_attach (GTK_GRID (table), label, 1, -1, 1, 1);
label = gtk_label_new ("Custom");
gtk_widget_add_css_class (label, "title-4");
gtk_grid_attach (GTK_GRID (table), label, 2, -1, 1, 1);
label = gtk_label_new ("Color:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
picker = gtk_color_button_new ();
picker = gtk_color_dialog_button_new (gtk_color_dialog_new ());
gtk_grid_attach (GTK_GRID (table), picker, 1, 0, 1, 1);
picker = gtk_color_button_new ();
gtk_color_button_set_title (GTK_COLOR_BUTTON (picker), "Solarized colors");
gtk_color_chooser_add_palette (GTK_COLOR_CHOOSER (picker),
GTK_ORIENTATION_HORIZONTAL,
9,
18,
solarized);
gtk_grid_attach (GTK_GRID (table), picker, 2, 0, 1, 1);
label = gtk_label_new ("Font:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (GTK_GRID (table), label, 0, 1, 1, 1);
picker = gtk_font_button_new ();
picker = gtk_font_dialog_button_new (gtk_font_dialog_new ());
gtk_grid_attach (GTK_GRID (table), picker, 1, 1, 1, 1);
picker = gtk_font_button_new ();
gtk_font_chooser_set_level (GTK_FONT_CHOOSER (picker),
GTK_FONT_CHOOSER_LEVEL_FAMILY |
GTK_FONT_CHOOSER_LEVEL_SIZE);
gtk_font_chooser_set_filter_func (GTK_FONT_CHOOSER (picker), filter_font_cb, NULL, NULL);
label = gtk_label_new ("File:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (GTK_GRID (table), label, 0, 2, 1, 1);
gtk_grid_attach (GTK_GRID (table), picker, 2, 1, 1, 1);
picker = gtk_button_new_with_label ("None");
g_signal_connect (picker, "clicked", G_CALLBACK (open_file), NULL);
gtk_grid_attach (GTK_GRID (table), picker, 1, 2, 1, 1);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
label = gtk_label_new ("Mail:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (label, TRUE);
picker = gtk_app_chooser_button_new ("x-scheme-handler/mailto");
gtk_app_chooser_button_set_show_dialog_item (GTK_APP_CHOOSER_BUTTON (picker), TRUE);
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_grid_attach (GTK_GRID (table), label, 0, 3, 1, 1);
gtk_grid_attach (GTK_GRID (table), picker, 1, 3, 1, 1);
}
-2
View File
@@ -16,7 +16,6 @@ enum {
NUM_PROPERTIES
};
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
static void
pixbuf_paintable_snapshot (GdkPaintable *paintable,
GdkSnapshot *snapshot,
@@ -37,7 +36,6 @@ pixbuf_paintable_snapshot (GdkPaintable *paintable,
g_object_unref (texture);
}
G_GNUC_END_IGNORE_DEPRECATIONS;
static int
pixbuf_paintable_get_intrinsic_width (GdkPaintable *paintable)
+4 -11
View File
@@ -177,19 +177,12 @@ do_printing (GtkWidget *do_widget)
if (error)
{
GtkWidget *dialog;
GtkAlertDialog *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (do_widget),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"%s", error->message);
dialog = gtk_alert_dialog_new ("%s", error->message);
gtk_alert_dialog_show (dialog, GTK_WINDOW (do_widget));
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
}
+7 -25
View File
@@ -16,24 +16,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
/* Convenience function to create a combo box holding a number of strings
*/
GtkWidget *
create_combo_box (const char **strings)
{
GtkWidget *combo_box;
const char **str;
combo_box = gtk_combo_box_text_new ();
for (str = strings; *str; str++)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), *str);
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
return combo_box;
}
static void
add_row (GtkGrid *table,
int row,
@@ -41,7 +23,7 @@ add_row (GtkGrid *table,
const char *label_text,
const char **options)
{
GtkWidget *combo_box;
GtkWidget *dropdown;
GtkWidget *label;
label = gtk_label_new_with_mnemonic (label_text);
@@ -50,12 +32,12 @@ add_row (GtkGrid *table,
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (table, label, 0, row, 1, 1);
combo_box = create_combo_box (options);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo_box);
gtk_widget_set_halign (combo_box, GTK_ALIGN_END);
gtk_widget_set_valign (combo_box, GTK_ALIGN_BASELINE);
gtk_size_group_add_widget (size_group, combo_box);
gtk_grid_attach (table, combo_box, 1, row, 1, 1);
dropdown = gtk_drop_down_new_from_strings (options);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), dropdown);
gtk_widget_set_halign (dropdown, GTK_ALIGN_END);
gtk_widget_set_valign (dropdown, GTK_ALIGN_BASELINE);
gtk_size_group_add_widget (size_group, dropdown);
gtk_grid_attach (table, dropdown, 1, row, 1, 1);
}
static void
+2
View File
@@ -35,6 +35,7 @@ do_spinner (GtkWidget *do_widget)
if (!window)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
window = gtk_dialog_new_with_buttons ("Spinner",
GTK_WINDOW (do_widget),
0,
@@ -48,6 +49,7 @@ do_spinner (GtkWidget *do_widget)
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
G_GNUC_END_IGNORE_DEPRECATIONS
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
gtk_widget_set_margin_start (vbox, 5);
+5 -4
View File
@@ -11,6 +11,7 @@
#include <stdlib.h> /* for exit() */
#include "paintable.h"
static void easter_egg_callback (GtkWidget *button, gpointer data);
static void
@@ -429,11 +430,11 @@ attach_widgets (GtkTextView *text_view)
}
else if (i == 1)
{
widget = gtk_combo_box_text_new ();
const char *options[] = {
"Option 1", "Option 2", "Option 3", NULL
};
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Option 1");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Option 2");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Option 3");
widget = gtk_drop_down_new_from_strings (options);
}
else if (i == 2)
{
+2
View File
@@ -10,6 +10,8 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* TreeItem structure */
typedef struct _TreeItem TreeItem;
struct _TreeItem
+27 -24
View File
@@ -10,60 +10,63 @@
static GtkWidget *window = NULL;
static void
open_dialog_response_cb (GtkNativeDialog *dialog,
int response,
GtkWidget *video)
open_dialog_response_cb (GObject *source,
GAsyncResult *result,
void *user_data)
{
gtk_native_dialog_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GtkWidget *video = user_data;
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_open_finish (dialog, result, NULL);
if (file)
{
GFile *file;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
gtk_video_set_file (GTK_VIDEO (video), file);
g_object_unref (file);
}
gtk_native_dialog_destroy (dialog);
}
static void
open_clicked_cb (GtkWidget *button,
GtkWidget *video)
{
GtkFileChooserNative *dialog;
GtkFileDialog *dialog;
GtkFileFilter *filter;
GListStore *filters;
dialog = gtk_file_chooser_native_new ("Select a video",
GTK_WINDOW (gtk_widget_get_root (button)),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Open",
"_Cancel");
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Select a video");
filters = g_list_store_new (GTK_TYPE_FILE_FILTER);
filter = gtk_file_filter_new ();
gtk_file_filter_add_pattern (filter, "*");
gtk_file_filter_set_name (filter, "All Files");
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
g_list_store_append (filters, filter);
g_object_unref (filter);
filter = gtk_file_filter_new ();
gtk_file_filter_add_mime_type (filter, "image/*");
gtk_file_filter_set_name (filter, "Images");
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
g_list_store_append (filters, filter);
g_object_unref (filter);
filter = gtk_file_filter_new ();
gtk_file_filter_add_mime_type (filter, "video/*");
gtk_file_filter_set_name (filter, "Video");
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
g_list_store_append (filters, filter);
gtk_file_dialog_set_current_filter (dialog, filter);
g_object_unref (filter);
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
g_signal_connect (dialog, "response", G_CALLBACK (open_dialog_response_cb), video);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
gtk_file_dialog_set_filters (dialog, G_LIST_MODEL (filters));
g_object_unref (filters);
gtk_file_dialog_open (dialog,
GTK_WINDOW (gtk_widget_get_root (button)),
NULL,
NULL,
open_dialog_response_cb, video);
}
static void
+67 -90
View File
@@ -548,45 +548,36 @@ node_editor_window_load (NodeEditorWindow *self,
}
static void
open_response_cb (GtkWidget *dialog,
int response,
NodeEditorWindow *self)
open_response_cb (GObject *source,
GAsyncResult *result,
void *user_data)
{
gtk_widget_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
NodeEditorWindow *self = user_data;
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_open_finish (dialog, result, NULL);
if (file)
{
GFile *file;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
node_editor_window_load (self, file);
g_object_unref (file);
}
gtk_window_destroy (GTK_WINDOW (dialog));
}
static void
show_open_filechooser (NodeEditorWindow *self)
{
GtkWidget *dialog;
GtkFileDialog *dialog;
GFile *cwd;
dialog = gtk_file_chooser_dialog_new ("Open node file",
GTK_WINDOW (self),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Cancel", GTK_RESPONSE_CANCEL,
"_Load", GTK_RESPONSE_ACCEPT,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
GFile *cwd = g_file_new_for_path (".");
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), cwd, NULL);
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Open node file");
cwd = g_file_new_for_path (".");
gtk_file_dialog_set_current_folder (dialog, cwd);
g_object_unref (cwd);
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), self);
gtk_widget_show (dialog);
gtk_file_dialog_open (dialog, GTK_WINDOW (self),
NULL, NULL, open_response_cb, self);
g_object_unref (dialog);
}
static void
@@ -597,21 +588,22 @@ open_cb (GtkWidget *button,
}
static void
save_response_cb (GtkWidget *dialog,
int response,
NodeEditorWindow *self)
save_response_cb (GObject *source,
GAsyncResult *result,
void *user_data)
{
gtk_widget_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
NodeEditorWindow *self = user_data;
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_save_finish (dialog, result, NULL);
if (file)
{
GFile *file;
char *text;
GError *error = NULL;
text = get_current_text (self->text_buffer);
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
g_file_replace_contents (file, text, strlen (text),
NULL, FALSE,
G_FILE_CREATE_NONE,
@@ -620,49 +612,40 @@ save_response_cb (GtkWidget *dialog,
&error);
if (error != NULL)
{
GtkWidget *message_dialog;
GtkAlertDialog *alert;
message_dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))),
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"Saving failed");
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog),
"%s", error->message);
g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (message_dialog);
alert = gtk_alert_dialog_new ("Saving failed");
gtk_alert_dialog_set_detail (alert, error->message);
gtk_alert_dialog_show (alert,
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))));
g_object_unref (alert);
g_error_free (error);
}
g_free (text);
g_object_unref (file);
}
gtk_window_destroy (GTK_WINDOW (dialog));
}
static void
save_cb (GtkWidget *button,
NodeEditorWindow *self)
{
GtkWidget *dialog;
GtkFileDialog *dialog;
GFile *cwd;
dialog = gtk_file_chooser_dialog_new ("Save node",
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
GTK_FILE_CHOOSER_ACTION_SAVE,
"_Cancel", GTK_RESPONSE_CANCEL,
"_Save", GTK_RESPONSE_ACCEPT,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
GFile *cwd = g_file_new_for_path (".");
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), cwd, NULL);
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Save node");
cwd = g_file_new_for_path (".");
gtk_file_dialog_set_current_folder (dialog, cwd);
g_object_unref (cwd);
g_signal_connect (dialog, "response", G_CALLBACK (save_response_cb), self);
gtk_widget_show (dialog);
gtk_file_dialog_save (dialog,
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
NULL,
"demo.node",
NULL,
save_response_cb, self);
g_object_unref (dialog);
}
static GdkTexture *
@@ -724,34 +707,29 @@ create_cairo_texture (NodeEditorWindow *self)
}
static void
export_image_response_cb (GtkWidget *dialog,
int response,
GdkTexture *texture)
export_image_response_cb (GObject *source,
GAsyncResult *result,
void *user_data)
{
gtk_widget_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GdkTexture *texture = user_data;
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_save_finish (dialog, result, NULL);
if (file)
{
GFile *file;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
if (!gdk_texture_save_to_png (texture, g_file_peek_path (file)))
{
GtkWidget *message_dialog;
GtkAlertDialog *alert;
message_dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_window_get_transient_for (GTK_WINDOW (dialog))),
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"Exporting to image failed");
g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (message_dialog);
alert = gtk_alert_dialog_new ("Exporting to image failed");
gtk_alert_dialog_show (alert, GTK_WINDOW (gtk_window_get_transient_for (GTK_WINDOW (dialog))));
g_object_unref (alert);
}
g_object_unref (file);
}
gtk_window_destroy (GTK_WINDOW (dialog));
g_object_unref (texture);
}
@@ -760,25 +738,24 @@ export_image_cb (GtkWidget *button,
NodeEditorWindow *self)
{
GdkTexture *texture;
GtkWidget *dialog;
GtkFileDialog *dialog;
texture = create_texture (self);
if (texture == NULL)
return;
dialog = gtk_file_chooser_dialog_new ("",
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
GTK_FILE_CHOOSER_ACTION_SAVE,
"_Cancel", GTK_RESPONSE_CANCEL,
"_Save", GTK_RESPONSE_ACCEPT,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
g_signal_connect (dialog, "response", G_CALLBACK (export_image_response_cb), texture);
gtk_widget_show (dialog);
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "");
gtk_file_dialog_save (dialog,
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
NULL,
"example.png",
NULL,
export_image_response_cb, texture);
g_object_unref (dialog);
}
static void
clip_image_cb (GtkWidget *button,
NodeEditorWindow *self)
+78 -101
View File
@@ -96,12 +96,10 @@ set_text (const char *text,
static void
load_file (GFile *open_filename)
{
GtkWidget *error_dialog;
char *contents;
GError *error;
gsize len;
error_dialog = NULL;
error = NULL;
g_file_load_contents (open_filename, NULL, &contents, &len, NULL, &error);
if (error == NULL)
@@ -117,36 +115,28 @@ load_file (GFile *open_filename)
{
GFileInfo *info = g_file_query_info (open_filename, "standard::display-name", 0, NULL, &error);
const char *display_name = g_file_info_get_display_name (info);
error_dialog = gtk_message_dialog_new (GTK_WINDOW (main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Error loading file %s:\n%s",
display_name,
"Not valid utf8");
g_object_unref (info);
}
GtkAlertDialog *alert;
alert = gtk_alert_dialog_new ("Error loading file %s", display_name);
gtk_alert_dialog_set_detail (alert, "Not valid utf8");
gtk_alert_dialog_show (alert, GTK_WINDOW (main_window));
g_object_unref (alert);
g_object_unref (info);
}
}
else
{
GFileInfo *info = g_file_query_info (open_filename, "standard::display-name", 0, NULL, &error);
const char *display_name = g_file_info_get_display_name (info);
error_dialog = gtk_message_dialog_new (GTK_WINDOW (main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Error loading file %s:\n%s",
display_name,
error->message);
GtkAlertDialog *alert;
alert = gtk_alert_dialog_new ("Error loading file %s", display_name);
gtk_alert_dialog_set_detail (alert, error->message);
gtk_alert_dialog_show (alert, GTK_WINDOW (main_window));
g_object_unref (alert);
g_object_unref (info);
g_error_free (error);
}
if (error_dialog)
{
g_signal_connect (error_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (error_dialog);
}
}
@@ -154,7 +144,6 @@ static void
save_file (GFile *save_filename)
{
char *text = get_text ();
GtkWidget *error_dialog;
GError *error;
error = NULL;
@@ -180,18 +169,12 @@ save_file (GFile *save_filename)
{
GFileInfo *info = g_file_query_info (save_filename, "standard::display-name", 0, NULL, NULL);
const char *display_name = g_file_info_get_display_name (info);
GtkAlertDialog *alert;
error_dialog = gtk_message_dialog_new (GTK_WINDOW (main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Error saving to file %s:\n%s",
display_name,
error->message);
g_signal_connect (error_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (error_dialog);
alert = gtk_alert_dialog_new ("Error saving to file %s", display_name);
gtk_alert_dialog_set_detail (alert, error->message);
gtk_alert_dialog_show (alert, GTK_WINDOW (main_window));
g_object_unref (alert);
g_error_free (error);
g_object_unref (info);
}
@@ -340,21 +323,24 @@ create_custom_widget (GtkPrintOperation *operation,
PrintData *data)
{
GtkWidget *vbox, *hbox, *font, *label;
GtkFontDialog *dialog;
PangoFontDescription *desc;
gtk_print_operation_set_custom_tab_label (operation, "Other");
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
gtk_box_append (GTK_BOX (vbox), hbox);
gtk_widget_show (hbox);
label = gtk_label_new ("Font:");
gtk_box_append (GTK_BOX (hbox), label);
gtk_widget_show (label);
font = gtk_font_button_new_with_font (data->font);
dialog = gtk_font_dialog_new ();
font = gtk_font_dialog_button_new (dialog);
desc = pango_font_description_from_string (data->font);
gtk_font_dialog_button_set_font_desc (GTK_FONT_DIALOG_BUTTON (font), desc);
pango_font_description_free (desc);
gtk_box_append (GTK_BOX (hbox), font);
gtk_widget_show (font);
data->font_button = font;
return vbox;
@@ -365,11 +351,12 @@ custom_widget_apply (GtkPrintOperation *operation,
GtkWidget *widget,
PrintData *data)
{
const char *selected_font;
selected_font = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (data->font_button));
PangoFontDescription *desc;
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (data->font_button));
g_free (data->font);
data->font = g_strdup (selected_font);
data->font = pango_font_description_to_string (desc);
}
static void
@@ -377,23 +364,18 @@ print_done (GtkPrintOperation *op,
GtkPrintOperationResult res,
PrintData *print_data)
{
GError *error = NULL;
if (res == GTK_PRINT_OPERATION_RESULT_ERROR)
{
GtkWidget *error_dialog;
GtkAlertDialog *alert;
GError *error = NULL;
gtk_print_operation_get_error (op, &error);
error_dialog = gtk_message_dialog_new (GTK_WINDOW (main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Error printing file:\n%s",
error ? error->message : "no details");
g_signal_connect (error_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (error_dialog);
alert = gtk_alert_dialog_new ("Error printing file");
if (error)
gtk_alert_dialog_set_detail (alert, error->message);
gtk_alert_dialog_show (alert, GTK_WINDOW (main_window));
g_object_unref (alert);
}
else if (res == GTK_PRINT_OPERATION_RESULT_APPLY)
{
@@ -499,17 +481,19 @@ activate_preview (GSimpleAction *action,
}
static void
on_save_response (GtkWidget *dialog,
int response)
on_save_response (GObject *source,
GAsyncResult *result,
void *user_data)
{
if (response == GTK_RESPONSE_OK)
{
GFile *save_filename = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
save_file (save_filename);
g_object_unref (save_filename);
}
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GFile *file;
gtk_window_destroy (GTK_WINDOW (dialog));
file = gtk_file_dialog_save_finish (dialog, result, NULL);
if (file)
{
save_file (file);
g_object_unref (file);
}
}
static void
@@ -517,21 +501,17 @@ activate_save_as (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GtkWidget *dialog;
GtkFileDialog *dialog;
dialog = gtk_file_chooser_dialog_new ("Select file",
GTK_WINDOW (main_window),
GTK_FILE_CHOOSER_ACTION_SAVE,
"_Cancel", GTK_RESPONSE_CANCEL,
"_Save", GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_widget_show (dialog);
g_signal_connect (dialog, "response",
G_CALLBACK (on_save_response),
NULL);
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Select file");
gtk_file_dialog_save (dialog,
GTK_WINDOW (main_window),
NULL,
NULL,
NULL,
on_save_response, NULL);
g_object_unref (dialog);
}
static void
@@ -546,17 +526,19 @@ activate_save (GSimpleAction *action,
}
static void
on_open_response (GtkWidget *dialog,
int response)
on_open_response (GObject *source,
GAsyncResult *result,
void *user_data)
{
if (response == GTK_RESPONSE_OK)
{
GFile *open_filename = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
load_file (open_filename);
g_object_unref (open_filename);
}
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GFile *file;
gtk_window_destroy (GTK_WINDOW (dialog));
file = gtk_file_dialog_open_finish (dialog, result, NULL);
if (file)
{
load_file (file);
g_object_unref (file);
}
}
static void
@@ -564,21 +546,16 @@ activate_open (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GtkWidget *dialog;
GtkFileDialog *dialog;
dialog = gtk_file_chooser_dialog_new ("Select file",
GTK_WINDOW (main_window),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Cancel", GTK_RESPONSE_CANCEL,
"_Open", GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_widget_show (dialog);
g_signal_connect (dialog, "response",
G_CALLBACK (on_open_response),
NULL);
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Select file");
gtk_file_dialog_open (dialog,
GTK_WINDOW (main_window),
NULL,
NULL,
on_open_response, NULL);
g_object_unref (dialog);
}
static void
+32 -13
View File
@@ -214,10 +214,19 @@ activate_background (GSimpleAction *action,
}
static void
file_chooser_response (GtkNativeDialog *self,
int response)
file_chooser_response (GObject *source,
GAsyncResult *result,
void *user_data)
{
gtk_native_dialog_destroy (self);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GFile *file;
file = gtk_file_dialog_open_finish (dialog, result, NULL);
if (file)
{
g_print ("File selected: %s", g_file_peek_path (file));
g_object_unref (file);
}
}
static void
@@ -225,17 +234,11 @@ activate_open_file (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GtkFileChooserNative *chooser;
GtkFileDialog *dialog;
chooser = gtk_file_chooser_native_new ("Open file",
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
"Open",
"Cancel");
g_signal_connect (chooser, "response", G_CALLBACK (file_chooser_response), NULL);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (chooser));
dialog = gtk_file_dialog_new ();
gtk_file_dialog_open (dialog, NULL, NULL, NULL, file_chooser_response, NULL);
g_object_unref (dialog);
}
static void
@@ -664,6 +667,7 @@ on_record_button_toggled (GtkToggleButton *button,
gtk_widget_add_css_class (GTK_WIDGET (button), "destructive-action");
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
on_page_combo_changed (GtkComboBox *combo,
gpointer user_data)
@@ -705,6 +709,7 @@ on_page_combo_changed (GtkComboBox *combo,
default:;
}
}
G_GNUC_END_IGNORE_DEPRECATIONS
static void
on_range_from_changed (GtkSpinButton *from)
@@ -843,6 +848,7 @@ page_changed_cb (GtkWidget *stack, GParamSpec *pspec, gpointer data)
}
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
populate_model (GtkTreeStore *store)
{
@@ -960,6 +966,7 @@ row_separator_func (GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
return is_sep;
}
G_GNUC_END_IGNORE_DEPRECATIONS
static void
update_title_header (GtkListBoxRow *row,
@@ -1089,7 +1096,9 @@ set_color (GtkListBox *box, GtkListBoxRow *row, GtkColorChooser *chooser)
if (gdk_rgba_parse (&rgba, color))
{
g_signal_handlers_block_by_func (chooser, rgba_changed, box);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_color_chooser_set_rgba (chooser, &rgba);
G_GNUC_END_IGNORE_DEPRECATIONS
g_signal_handlers_unblock_by_func (chooser, rgba_changed, box);
}
}
@@ -1458,7 +1467,9 @@ close_selection_dialog (GtkWidget *dialog, int response, GtkWidget *tv)
if (response == GTK_RESPONSE_CANCEL)
return;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
box = gtk_widget_get_first_child (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
G_GNUC_END_IGNORE_DEPRECATIONS
g_assert (GTK_IS_FLOW_BOX (box));
children = gtk_flow_box_get_selected_children (GTK_FLOW_BOX (box));
@@ -1578,6 +1589,7 @@ osd_frame_pressed (GtkGestureClick *gesture,
return GDK_EVENT_STOP;
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static gboolean
page_combo_separator_func (GtkTreeModel *model,
GtkTreeIter *iter,
@@ -1592,6 +1604,7 @@ page_combo_separator_func (GtkTreeModel *model,
return res;
}
G_GNUC_END_IGNORE_DEPRECATIONS
static void
toggle_format (GSimpleAction *action,
@@ -1844,6 +1857,7 @@ update_buttons (GtkWidget *iv, GtkIconSize size)
gtk_widget_set_sensitive (button, size != GTK_ICON_SIZE_INHERIT);
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
increase_icon_size (GtkWidget *iv)
{
@@ -1894,6 +1908,7 @@ reset_icon_size (GtkWidget *iv)
gtk_widget_queue_resize (iv);
}
G_GNUC_END_IGNORE_DEPRECATIONS
static char *
scale_format_value_blank (GtkScale *scale, double value, gpointer user_data)
@@ -2270,10 +2285,12 @@ activate (GApplication *app)
g_object_set_data (G_OBJECT (window), "selection_flowbox", widget2);
g_signal_connect_swapped (widget, "clicked", G_CALLBACK (populate_flowbox), widget2);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
widget = (GtkWidget *)gtk_builder_get_object (builder, "charletree");
populate_model ((GtkTreeStore *)gtk_tree_view_get_model (GTK_TREE_VIEW (widget)));
gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (widget), row_separator_func, NULL, NULL);
gtk_tree_view_expand_all (GTK_TREE_VIEW (widget));
G_GNUC_END_IGNORE_DEPRECATIONS
widget = GTK_WIDGET (gtk_builder_get_object (builder, "munsell"));
widget2 = GTK_WIDGET (gtk_builder_get_object (builder, "cchooser"));
@@ -2281,6 +2298,7 @@ activate (GApplication *app)
populate_colors (widget, widget2);
g_signal_connect (widget2, "notify::rgba", G_CALLBACK (rgba_changed), widget);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
widget = (GtkWidget *)gtk_builder_get_object (builder, "page_combo");
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (widget), page_combo_separator_func, NULL, NULL);
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "range_from_spin");
@@ -2291,6 +2309,7 @@ activate (GApplication *app)
g_object_set_data (G_OBJECT (widget), "range_to_spin", widget3);
g_object_set_data (G_OBJECT (widget2), "range_to_spin", widget3);
g_object_set_data (G_OBJECT (widget), "print_button", widget4);
G_GNUC_END_IGNORE_DEPRECATIONS
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "tooltextview");
+5
View File
@@ -3345,10 +3345,12 @@ bad things might happen.</property>
<attribute name="display-hint">circular-buttons</attribute>
<item>
<attribute name="verb-icon">printer-symbolic</attribute>
<attribute name="label" translatable="yes">Print all the things!</attribute>
<attribute name="action">win.print</attribute>
</item>
<item>
<attribute name="verb-icon">emblem-shared-symbolic</attribute>
<attribute name="label" translatable="yes">Share all the things!</attribute>
<attribute name="action">app.share</attribute>
</item>
</section>
@@ -3363,14 +3365,17 @@ bad things might happen.</property>
<attribute name="label" translatable="yes">Edit</attribute>
<item>
<attribute name="verb-icon">edit-cut-symbolic</attribute>
<attribute name="label" translatable="yes">Cut</attribute>
<attribute name="action">app.cut</attribute>
</item>
<item>
<attribute name="verb-icon">edit-copy-symbolic</attribute>
<attribute name="label" translatable="yes">Copy</attribute>
<attribute name="action">app.copy</attribute>
</item>
<item>
<attribute name="verb-icon">edit-paste-symbolic</attribute>
<attribute name="label" translatable="yes">Paste</attribute>
<attribute name="action">app.paste</attribute>
</item>
</section>
+15 -7
View File
@@ -8,8 +8,7 @@ are organized in a hierarchy. The window widget is the main container.
The user interface is then built by adding buttons, drop-down menus, input
fields, and other widgets to the window. If you are creating complex user
interfaces it is recommended to use GtkBuilder and its GTK-specific markup
description language, instead of assembling the interface manually. You can
also use a visual user interface editor, like [Glade](https://glade.gnome.org/).
description language, instead of assembling the interface manually.
GTK is event-driven. The toolkit listens for events such as a click
on a button, and passes the event to your application.
@@ -712,11 +711,20 @@ A common location to install UI descriptions and similar data is
`/usr/share/appname`.
It is also possible to embed the UI description in the source code as a
string and use [`method@Gtk.Builder.add_from_string`] to load it. But keeping the
UI description in a separate file has several advantages: It is then possible
to make minor adjustments to the UI without recompiling your program, and,
more importantly, graphical UI editors such as [Glade](http://glade.gnome.org)
can load the file and allow you to create and modify your UI by point-and-click.
string and use [`method@Gtk.Builder.add_from_string`] to load it. But keeping
the UI description in a separate file has several advantages:
- it is possible to make minor adjustments to the UI without recompiling your
program
- it is easier to isolate the UI code from the business logic of your
application
- it is easier to restructure your UI into separate classes using composite
widget templates
Using [GResource](https://docs.gtk.org/gio/struct.Resource.html) it is possible
to combine the best of both worlds: you can keep the UI definition files
separate inside your source code repository, and then ship them embedded into
your application.
## Building applications
+11 -3
View File
@@ -12,8 +12,8 @@ SYNOPSIS
--------
| **gtk4-builder-tool** <COMMAND> [OPTIONS...] <FILE>
|
| **gtk4-builder-tool** validate <FILE>
| **gtk4-builder-tool** enumerate <FILE>
| **gtk4-builder-tool** validate [OPTIONS...] <FILE>
| **gtk4-builder-tool** enumerate [OPTIONS...] <FILE>
| **gtk4-builder-tool** simplify [OPTIONS...] <FILE>
| **gtk4-builder-tool** preview [OPTIONS...] <FILE>
| **gtk4-builder-tool** screenshot [OPTIONS...] <FILE>
@@ -33,12 +33,20 @@ Validation
The ``validate`` command validates the given UI definition file and reports
errors to ``stderr``.
``--deprecations``
Warn about uses of deprecated types in the UI definition file.
Enumeration
^^^^^^^^^^^
The ``enumerate`` command lists all the named objects that are present in the UI
The ``enumerate`` command prints all the named objects that are present in the UI
definition file.
``--callbacks``
Print the names of callbacks as well.
Preview
^^^^^^^
+99
View File
@@ -0,0 +1,99 @@
Title: Preparing for GTK 5
Slug: gtk-migrating-4-to-5
GTK 5 will be a major new version of GTK that breaks both API and
ABI compared to GTK 4.x. GTK 5 does not exist yet, so we cannot
be entirely sure what will be involved in a migration from GTK 4
to GTK 5. But we can already give some preliminary hints about
the likely changes, and how to prepare for them in code that is
using GTK 4.
### Do not use deprecated symbols
As always, functions and types that are known to go away in the
next major version of GTK are being marked as deprecated in GTK 4.
Removing the use of deprecated APIs is the most important step
to prepare your code for the next major version of GTK. Often,
deprecation notes will include hints about replacement APIs to
help you with this.
Sometimes, it is helpful to have some background information about
the motivation and goals of larger API changes.
## Cell renderers are going away
Cell renderers were introduced in GTK 2 to support rendering of
"big data" UIs, in particular treeviews. Over the years, more
"data-like" widgets have started to use them, and cell renderers
have grown into a shadowy, alternative rendering infrastructure
that duplicates much of what widgets do, while duplicating the
code and adding their own dose of bugs.
In GTK 4, replacement widgets for GtkTreeView, GtkIconView and
GtkComboBox have appeared: GtkListView, GtkColumnView, GtkGridView
and GtkDropDown. For GTK 5, we will take the next step and remove
all cell renderer-based widgets.
## Themed rendering APIs are going away
The old GTK 2 era rendering APIs for theme components like
gtk_render_frame() or gtk_render_check() have not been used by
GTK itself even in later GTK 3, but they have been kepy around
for the benefit of "external drawing" users - applications that
want their controls to look like GTK without using widgets.
Supporting this is increasingly getting in the way of making
the GTK CSS machinery fast and correct. One notable problem is
that temporary style changes (using gtk_style_context_save())
is breaking animations. Therefore, these APIs will be going away
in GTK 5, together with their more modern GtkSnapshot variants
like gtk_snapshot_render_background() or gtk_snapshot_render_focus().
The best way to render parts of your widget using CSS styling
is to use subwidgets. For example, to show a piece of text with
fonts, effects and shadows according to the current CSS style,
use a GtkLabel.
If you have a need for custom drawing that fits into the current
(dark or light) theme, e.g. for rendering a graph, you can still
get the current style foreground color, using
[method@Gtk.Widget.get_style_color].
## Local stylesheets are going away
The cascading part of GTK's CSS implementation is complicated by
the existence of local stylesheets (i.e. those added with
gtk_style_context_add_provider()). And local stylesheets are
unintuitive in that they do not apply to the whole subtree of
widgets, but just to the one widget where the stylesheet was
added.
GTK 5 will no longer provide this functionality. The recommendations
is to use a global stylesheet (i.e. gtk_style_context_add_provider_for_display())
and rely on style classes to make your CSS apply only where desired.
## Chooser interfaces are going away
The GtkColorChooser, GtkFontChooser, GtkFileChooser and GtkAppChooser
interfaces and their implementations as dialogs, buttons and widgets
are phased out. The are being replaced by a new family of async APIs
that will be more convenient to use from language bindings, in particular
for languages that have concepts like promises. The new APIs are
[class@Gtk.ColorDialog], [class@Gtk.FontDialog] and [class@Gtk.FileDialog],
There are also equivalents for some of the 'button' widgets:
[class@Gtk.ColorDialogButton], [class@Gtk.FontDialogButton].
## GtkMessageDialog is going away
Like the Chooser interfaces, GtkMessageDialog has been replaced by
a new async API that will be more convenient, in particular for
language binding. The new API is [class@Gtk.AlertDialog].
## GtkDialog is going away
After gtk_dialog_run() was removed, the usefulness of GtkDialog
is much reduced, and it has awkward, archaice APIs. Therefore,
it is dropped. The recommended replacement is to just create
your own window and add buttons as required, either in the header
or elsewhere.
+1 -2
View File
@@ -92,8 +92,7 @@ Specifies a list of directories to search when GTK is looking for
dynamically loaded objects such as input method modules and print
backends. If the path to the dynamically loaded object is given as
an absolute path name, then GTK loads it directly. Otherwise, GTK
goes in turn through the directories in `GTK_PATH`, followed by
the directory `.gtk-4.0` in the user's home directory, followed
goes in turn through the directories in `GTK_PATH`, followed
by the system default directory, which is `libdir/gtk-4.0/modules`.
(If `GTK_EXE_PREFIX` is defined, `libdir` is `$GTK_EXE_PREFIX/lib`.
Otherwise it is the libdir specified when GTK was configured, usually
@@ -1,6 +1,13 @@
Title: Tree and List Widget Overview
Slug: gtk-treeview
This document describes the `GtkTreeView` widget and auxiliary
classes, like tree models and cell renderers. All of these have
been deprecated and will be removed in GTK 5. Their replacements
are described in the [List Widget Overview](section-list-widget.html).
## Introduction
To create a tree or list in GTK, use the `GtkTreeModel` interface in
conjunction with the `GtkTreeView` widget. This widget is designed around
a _Model/View/Controller_ design and consists of four major parts:
+4 -12
View File
@@ -6,19 +6,11 @@ action_activated (GSimpleAction *action,
gpointer user_data)
{
GtkWindow *parent = user_data;
GtkWidget *dialog;
GtkAlertDialog *dialog;
dialog = gtk_message_dialog_new (parent,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
"Activated action `%s`",
g_action_get_name (G_ACTION (action)));
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_window_destroy), dialog);
gtk_widget_show (dialog);
dialog = gtk_alert_dialog_new ("Activated action `%s`", g_action_get_name (G_ACTION (action)));
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
}
static GActionEntry doc_entries[] = {
+13 -8
View File
@@ -1,6 +1,8 @@
#include <stdlib.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
typedef struct
{
GtkApplication parent_instance;
@@ -350,7 +352,8 @@ quit_activated (GSimpleAction *action,
}
static void
combo_changed (GtkComboBox *combo,
combo_changed (GtkDropDown *combo,
GParamSpec *pspec,
gpointer user_data)
{
GtkDialog *dialog = user_data;
@@ -359,7 +362,7 @@ combo_changed (GtkComboBox *combo,
char **accels;
char *str;
action = gtk_combo_box_get_active_id (combo);
action = gtk_string_object_get_string (GTK_STRING_OBJECT (gtk_drop_down_get_selected_item (combo)));
if (!action)
return;
@@ -388,7 +391,7 @@ response (GtkDialog *dialog,
gpointer user_data)
{
GtkEntry *entry = g_object_get_data (user_data, "entry");
GtkComboBox *combo = g_object_get_data (user_data, "combo");
GtkDropDown *combo = g_object_get_data (user_data, "combo");
const char *action;
const char *str;
char **accels;
@@ -399,7 +402,7 @@ response (GtkDialog *dialog,
return;
}
action = gtk_combo_box_get_active_id (combo);
action = gtk_string_object_get_string (GTK_STRING_OBJECT (gtk_drop_down_get_selected_item (combo)));
if (!action)
return;
@@ -424,6 +427,7 @@ edit_accels (GSimpleAction *action,
char **actions;
GtkWidget *dialog;
int i;
GtkStringList *strings;
dialog = gtk_dialog_new_with_buttons ("Accelerators",
NULL,
@@ -435,7 +439,8 @@ edit_accels (GSimpleAction *action,
gtk_window_set_application (GTK_WINDOW (dialog), app);
actions = gtk_application_list_action_descriptions (app);
combo = gtk_combo_box_text_new ();
strings = gtk_string_list_new (NULL);
combo = gtk_drop_down_new (G_LIST_MODEL (strings), NULL);
g_object_set (gtk_dialog_get_content_area (GTK_DIALOG (dialog)),
"margin-top", 10,
"margin-bottom", 10,
@@ -446,8 +451,8 @@ edit_accels (GSimpleAction *action,
gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), combo);
for (i = 0; actions[i]; i++)
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), actions[i], actions[i]);
g_signal_connect (combo, "changed", G_CALLBACK (combo_changed), dialog);
gtk_string_list_append (strings, actions[i]);
g_signal_connect (combo, "notify::selected", G_CALLBACK (combo_changed), dialog);
entry = gtk_entry_new ();
gtk_widget_set_hexpand (entry, TRUE);
@@ -458,7 +463,7 @@ edit_accels (GSimpleAction *action,
g_object_set_data (G_OBJECT (dialog), "combo", combo);
g_object_set_data (G_OBJECT (dialog), "entry", entry);
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
gtk_drop_down_set_selected (GTK_DROP_DOWN (combo), 0);
gtk_widget_show (dialog);
}
+2 -1
View File
@@ -262,7 +262,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
message->key.state,
FALSE,
&translated,
&translated);
&translated,
NULL);
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
+2
View File
@@ -16,6 +16,8 @@ G_BEGIN_DECLS
#mesondefine GDK_WINDOWING_WAYLAND
#mesondefine GDK_WINDOWING_WIN32
#mesondefine GDK_RENDERING_CAIRO
#mesondefine GDK_RENDERING_GL
#mesondefine GDK_RENDERING_VULKAN
G_END_DECLS
+1 -1
View File
@@ -879,7 +879,7 @@ file_text_serializer (GdkContentSerializer *serializer)
g_string_append (str, path);
g_free (path);
if (l->next)
g_string_append (str, " ");
g_string_append (str, "\n");
}
path = g_string_free (str, FALSE);
}
+38 -2
View File
@@ -1517,6 +1517,16 @@ gdk_button_event_get_button (GdkEvent *event)
* An event related to a key-based device.
*/
static void
gdk_key_event_finalize (GdkEvent *event)
{
GdkKeyEvent *self = (GdkKeyEvent *) event;
g_free (self->compose_sequence);
GDK_EVENT_SUPER (event)->finalize (event);
}
static GdkModifierType
gdk_key_event_get_state (GdkEvent *event)
{
@@ -1528,7 +1538,7 @@ gdk_key_event_get_state (GdkEvent *event)
static const GdkEventTypeInfo gdk_key_event_info = {
sizeof (GdkKeyEvent),
NULL,
NULL,
gdk_key_event_finalize,
gdk_key_event_get_state,
NULL,
NULL,
@@ -1552,6 +1562,10 @@ GDK_DEFINE_EVENT_TYPE (GdkKeyEvent, gdk_key_event,
* @is_modifier: whether the event is a modifiers only event
* @translated: the translated key data for the given @state
* @no_lock: the translated key data without the given @state
* @compose_sequence: (transfer none) (nullable):
* The compose sequence string, either partial or only the
* final composed string, if that can be determined at event
* creation time. Used by selected IM modules.
*
* Creates a new `GdkKeyEvent`.
*
@@ -1566,7 +1580,8 @@ gdk_key_event_new (GdkEventType type,
GdkModifierType state,
gboolean is_modifier,
GdkTranslatedKey *translated,
GdkTranslatedKey *no_lock)
GdkTranslatedKey *no_lock,
char *compose_sequence)
{
g_return_val_if_fail (type == GDK_KEY_PRESS ||
type == GDK_KEY_RELEASE, NULL);
@@ -1579,6 +1594,7 @@ gdk_key_event_new (GdkEventType type,
self->key_is_modifier = is_modifier;
self->translated[0] = *translated;
self->translated[1] = *no_lock;
self->compose_sequence = g_strdup (compose_sequence);
return event;
}
@@ -1609,6 +1625,26 @@ gdk_key_event_get_translated_key (GdkEvent *event,
return &(self->translated[0]);
}
/*< private >
* gdk_key_event_get_compose_sequence:
* @event: (type GdkKeyEvent): a key event
*
* Extracts the compose sequence string from a key event.
*
* Returns: (transfer none): the compose sequence string
*/
char *
gdk_key_event_get_compose_sequence (GdkEvent *event)
{
GdkKeyEvent *self = (GdkKeyEvent *) event;
g_return_val_if_fail (GDK_IS_EVENT (event), 0);
g_return_val_if_fail (GDK_IS_EVENT_TYPE (event, GDK_KEY_PRESS) ||
GDK_IS_EVENT_TYPE (event, GDK_KEY_RELEASE), FALSE);
return self->compose_sequence;
}
/**
* gdk_key_event_get_keyval:
* @event: (type GdkKeyEvent): a key event
+8 -2
View File
@@ -259,6 +259,9 @@ typedef struct {
* @keycode: the raw code of the key that was pressed or released.
* @translated: the result of translating @keycode. First with the full
* @state, then while ignoring Caps Lock.
* @compose_sequence: optional string for use by selected IM modules.
* Contains either partial compose sequences or the final composed
* string of the keystroke sequence.
*
* Describes a key press or key release event.
*/
@@ -270,6 +273,7 @@ struct _GdkKeyEvent
guint32 keycode;
gboolean key_is_modifier;
GdkTranslatedKey translated[2];
char *compose_sequence;
};
/*
@@ -470,7 +474,8 @@ GdkEvent * gdk_key_event_new (GdkEventType type,
GdkModifierType modifiers,
gboolean is_modifier,
GdkTranslatedKey *translated,
GdkTranslatedKey *no_lock);
GdkTranslatedKey *no_lock,
char *compose_sequence);
GdkEvent * gdk_focus_event_new (GdkSurface *surface,
GdkDevice *device,
@@ -597,6 +602,8 @@ GdkEvent * gdk_grab_broken_event_new (GdkSurface *surface,
GdkTranslatedKey * gdk_key_event_get_translated_key (GdkEvent *event,
gboolean no_lock);
char * gdk_key_event_get_compose_sequence (GdkEvent *event);
typedef enum
{
/* Following flag is set for events on the event queue during
@@ -626,7 +633,6 @@ void _gdk_event_queue_flush (GdkDisplay *display);
double * gdk_event_dup_axes (GdkEvent *event);
G_END_DECLS
#endif /* __GDK_EVENTS_PRIVATE_H__ */
+12 -2
View File
@@ -32,6 +32,9 @@ G_DEFINE_POINTER_TYPE (GdkToplevelSize, gdk_toplevel_size)
#define UNCONFIGURED_WIDTH 400
#define UNCONFIGURED_HEIGHT 300
#define DEFAULT_BOUNDS_WIDTH INT_MAX
#define DEFAULT_BOUNDS_HEIGHT INT_MAX
void
gdk_toplevel_size_init (GdkToplevelSize *size,
int bounds_width,
@@ -68,8 +71,15 @@ gdk_toplevel_size_get_bounds (GdkToplevelSize *size,
g_return_if_fail (bounds_width);
g_return_if_fail (bounds_height);
*bounds_width = size->bounds_width;
*bounds_height = size->bounds_height;
if (size->bounds_width > 0)
*bounds_width = size->bounds_width;
else
*bounds_width = DEFAULT_BOUNDS_WIDTH;
if (size->bounds_height > 0)
*bounds_height = size->bounds_height;
else
*bounds_height = DEFAULT_BOUNDS_HEIGHT;
}
/**
+24
View File
@@ -118,6 +118,16 @@
*/
#define GDK_VERSION_4_8 (G_ENCODE_VERSION (4, 8))
/**
* GDK_VERSION_4_10:
*
* A macro that evaluates to the 4.10 version of GDK, in a format
* that can be used by the C pre-processor.
*
* Since: 4.10
*/
#define GDK_VERSION_4_10 (G_ENCODE_VERSION (4, 10))
/* evaluates to the current stable version; for development cycles,
* this means the next stable target, with a hard backstop to the
@@ -273,4 +283,18 @@
# define GDK_DEPRECATED_IN_4_8_FOR(f) _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_10
# define GDK_AVAILABLE_IN_4_10 GDK_UNAVAILABLE(4, 10)
#else
# define GDK_AVAILABLE_IN_4_10 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_10
# define GDK_DEPRECATED_IN_4_10 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_10_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_10 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_10_FOR(f) _GDK_EXTERN
#endif
#endif /* __GDK_VERSION_MACROS_H__ */
+1 -1
View File
@@ -440,7 +440,7 @@ on_data_ready_cb (GObject *object,
g_output_stream_close (G_OUTPUT_STREAM (wr->stream), NULL, NULL);
size = g_memory_output_stream_get_size (wr->stream);
size = g_memory_output_stream_get_data_size (wr->stream);
bytes = g_memory_output_stream_steal_data (wr->stream);
data = [[NSData alloc] initWithBytesNoCopy:bytes
length:size
+2 -1
View File
@@ -431,7 +431,8 @@ fill_key_event (GdkMacosDisplay *display,
state,
is_modifier,
&translated,
&no_lock);
&no_lock,
NULL);
}
static GdkEvent *
+2 -1
View File
@@ -944,7 +944,8 @@ _gdk_macos_surface_synthesize_null_key (GdkMacosSurface *self)
0,
FALSE,
&translated,
&no_lock);
&no_lock,
NULL);
_gdk_event_queue_append (display, event);
}
+2
View File
@@ -161,6 +161,8 @@ gdkconfig_cdata.set('GDK_WINDOWING_WAYLAND', wayland_enabled)
gdkconfig_cdata.set('GDK_WINDOWING_WIN32', win32_enabled)
gdkconfig_cdata.set('GDK_WINDOWING_BROADWAY', broadway_enabled)
gdkconfig_cdata.set('GDK_WINDOWING_MACOS', macos_enabled)
gdkconfig_cdata.set('GDK_RENDERING_CAIRO', true)
gdkconfig_cdata.set('GDK_RENDERING_GL', true)
gdkconfig_cdata.set('GDK_RENDERING_VULKAN', have_vulkan)
gdkconfig = configure_file(
+3 -2
View File
@@ -2205,7 +2205,8 @@ deliver_key_event (GdkWaylandSeat *seat,
device_get_modifiers (seat->logical_pointer),
_gdk_wayland_keymap_key_is_modifier (keymap, key),
&translated,
&no_lock);
&no_lock,
NULL);
_gdk_wayland_display_deliver_event (seat->display, event);
@@ -5322,7 +5323,7 @@ gdk_wayland_device_set_selection (GdkDevice *gdk_device,
g_return_if_fail (GDK_IS_WAYLAND_DEVICE (gdk_device));
seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (gdk_device));
serial = _gdk_wayland_seat_get_implicit_grab_serial (GDK_SEAT (seat), NULL);
serial = _gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL);
wl_data_device_set_selection (seat->data_device, source, serial);
}
+4 -2
View File
@@ -203,7 +203,7 @@ gdk_wayland_keymap_get_entries_for_keycode (GdkKeymap *keymap,
{
const xkb_keysym_t *syms;
int num_syms;
num_syms = xkb_keymap_key_get_syms_by_level (xkb_keymap, hardware_keycode, layout, 0, &syms);
num_syms = xkb_keymap_key_get_syms_by_level (xkb_keymap, hardware_keycode, layout, level, &syms);
if (keys)
{
(*keys)[i].keycode = hardware_keycode;
@@ -254,7 +254,7 @@ get_xkb_modifiers (struct xkb_keymap *xkb_keymap,
if (state & GDK_ALT_MASK)
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_ALT);
if (state & GDK_SUPER_MASK)
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Super");
mods |= (1 << xkb_keymap_mod_get_index (xkb_keymap, "Super") | 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_LOGO));
if (state & GDK_HYPER_MASK)
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Hyper");
if (state & GDK_META_MASK)
@@ -277,6 +277,8 @@ get_gdk_modifiers (struct xkb_keymap *xkb_keymap,
state |= GDK_CONTROL_MASK;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_ALT)))
state |= GDK_ALT_MASK;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_LOGO)))
state |= GDK_SUPER_MASK;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Super")))
state |= GDK_SUPER_MASK;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Hyper")))
+2 -1
View File
@@ -292,7 +292,8 @@ gdk_wayland_primary_claim (GdkClipboard *clipboard,
}
seat = gdk_display_get_default_seat (GDK_DISPLAY (wdisplay));
serial = _gdk_wayland_seat_get_implicit_grab_serial (seat, NULL);
serial = _gdk_wayland_seat_get_last_implicit_grab_serial (GDK_WAYLAND_SEAT (seat),
NULL);
zwp_primary_selection_device_v1_set_selection (cb->primary_data_device,
cb->source,
serial);
+12 -4
View File
@@ -1419,10 +1419,18 @@ configure_toplevel_geometry (GdkSurface *surface)
GdkRectangle monitor_geometry;
monitor = g_list_model_get_item (gdk_display_get_monitors (display), 0);
gdk_monitor_get_geometry (monitor, &monitor_geometry);
bounds_width = monitor_geometry.width;
bounds_height = monitor_geometry.height;
g_object_unref (monitor);
if (monitor)
{
gdk_monitor_get_geometry (monitor, &monitor_geometry);
bounds_width = monitor_geometry.width;
bounds_height = monitor_geometry.height;
g_object_unref (monitor);
}
else
{
bounds_width = 0;
bounds_height = 0;
}
}
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
+33 -36
View File
@@ -17,34 +17,29 @@
*/
#include "config.h"
#define GDK_PIXBUF_ENABLE_BACKEND /* Ugly? */
#include "gdkdisplay.h"
#include "gdkcursor.h"
#include "gdkwin32.h"
#include "gdktextureprivate.h"
#include <glib/gi18n-lib.h>
#include "gdkdisplay-win32.h"
#ifdef __MINGW32__
#include <w32api.h>
#endif
#include "xcursors.h"
typedef struct _DefaultCursor {
#include <stdint.h>
static struct {
char *name;
char *id;
} DefaultCursor;
static DefaultCursor default_cursors[] = {
} default_cursors[] = {
/* -- Win32 cursor names: -- */
{ "appstarting", IDC_APPSTARTING },
{ "arrow", IDC_ARROW },
{ "cross", IDC_CROSS },
{ "hand", IDC_HAND },
{ "help", IDC_HELP },
{ "ibeam", IDC_IBEAM },
/* an X cursor name, for compatibility with GTK: */
/* -- X11 cursor names: -- */
{ "left_ptr_watch", IDC_APPSTARTING },
{ "sizeall", IDC_SIZEALL },
{ "sizenesw", IDC_SIZENESW },
@@ -53,7 +48,7 @@ static DefaultCursor default_cursors[] = {
{ "sizewe", IDC_SIZEWE },
{ "uparrow", IDC_UPARROW },
{ "wait", IDC_WAIT },
/* css cursor names: */
/* -- CSS cursor names: -- */
{ "default", IDC_ARROW },
{ "pointer", IDC_HAND },
{ "progress", IDC_APPSTARTING },
@@ -93,18 +88,17 @@ struct _GdkWin32HCursor
/* Do not do any modifications to the handle
* (i.e. do not call DestroyCursor() on it).
* It's a "read-only" copy, the original is stored
* in the display instance.
*/
* It's a "read-only" copy, the original is
* stored in the display instance */
HANDLE readonly_handle;
/* This is a way to access the real handle stored
* in the display.
* TODO: make it a weak reference
*/
/* This is a way to access the real handle
* stored in the display.
* TODO: make it a weak reference */
GdkWin32Display *display;
/* A copy of the "destoyable" attribute of the handle */
/* A copy of the "destoyable" attribute of
* the handle */
gboolean readonly_destroyable;
};
@@ -382,7 +376,8 @@ hcursor_from_x_cursor (int i,
int j, x, y, ofs;
HCURSOR rv;
int w, h;
guchar *and_plane, *xor_plane;
uint8_t *and_plane;
uint8_t *xor_plane;
w = GetSystemMetrics (SM_CXCURSOR);
h = GetSystemMetrics (SM_CYCURSOR);
@@ -406,7 +401,7 @@ hcursor_from_x_cursor (int i,
for (x = 0; x < cursors[i].width && x < w ; x++, j++)
{
int pofs = ofs + x / 8;
guchar data = (cursors[i].data[j/4] & (0xc0 >> (2 * (j%4)))) >> (2 * (3 - (j%4)));
uint8_t data = (cursors[i].data[j/4] & (0xc0 >> (2 * (j%4)))) >> (2 * (3 - (j%4)));
int bit = 7 - (j % cursors[i].width) % 8;
if (data)
@@ -852,7 +847,7 @@ static GdkWin32HCursor *
create_blank_win32hcursor (GdkWin32Display *display)
{
int w, h;
guchar *and_plane, *xor_plane;
uint8_t *and_plane, *xor_plane;
HCURSOR rv;
w = GetSystemMetrics (SM_CXCURSOR);
@@ -1009,7 +1004,7 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
RGBQUAD colors[2];
} bmi;
HDC hdc;
guchar *pixels, *bits;
uint8_t *pixels, *bits;
int rowstride, x, y, w, h;
if (!GDI_CALL (GetIconInfo, (hicon, &ii)))
@@ -1117,7 +1112,7 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
for (y = 0; y < h; y++)
{
const guchar *andp, *xorp;
const uint8_t *andp, *xorp;
if (bmi.bi.biHeight < 0)
{
andp = bits + bpl*y;
@@ -1178,8 +1173,8 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
*/
static HBITMAP
create_alpha_bitmap (int size,
guchar **outdata)
create_alpha_bitmap (int size,
uint8_t **outdata)
{
BITMAPV5HEADER bi;
HDC hdc;
@@ -1216,9 +1211,9 @@ create_alpha_bitmap (int size,
}
static HBITMAP
create_color_bitmap (int size,
guchar **outdata,
int bits)
create_color_bitmap (int size,
uint8_t **outdata,
int bits)
{
struct {
BITMAPV4HEADER bmiHeader;
@@ -1265,8 +1260,9 @@ pixbuf_to_hbitmaps_alpha_winxp (GdkPixbuf *pixbuf,
* http://www.dotnet247.com/247reference/msgs/13/66301.aspx
*/
HBITMAP hColorBitmap, hMaskBitmap;
guchar *indata, *inrow;
guchar *colordata, *colorrow, *maskdata, *maskbyte;
const uint8_t *indata;
const uint8_t *inrow;
uint8_t *colordata, *colorrow, *maskdata, *maskbyte;
int width, height, size, i, i_offset, j, j_offset, rowstride;
guint maskstride, mask_bit;
@@ -1289,7 +1285,7 @@ pixbuf_to_hbitmaps_alpha_winxp (GdkPixbuf *pixbuf,
/* MSDN says mask rows are aligned to "LONG" boundaries */
maskstride = (((size + 31) & ~31) >> 3);
indata = gdk_pixbuf_get_pixels (pixbuf);
indata = gdk_pixbuf_read_pixels (pixbuf);
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
if (width > height)
@@ -1343,8 +1339,9 @@ pixbuf_to_hbitmaps_normal (GdkPixbuf *pixbuf,
* http://www.dotnet247.com/247reference/msgs/13/66301.aspx
*/
HBITMAP hColorBitmap, hMaskBitmap;
guchar *indata, *inrow;
guchar *colordata, *colorrow, *maskdata, *maskbyte;
const uint8_t *indata;
const uint8_t *inrow;
uint8_t *colordata, *colorrow, *maskdata, *maskbyte;
int width, height, size, i, i_offset, j, j_offset, rowstride, nc, bmstride;
gboolean has_alpha;
guint maskstride, mask_bit;
@@ -1373,7 +1370,7 @@ pixbuf_to_hbitmaps_normal (GdkPixbuf *pixbuf,
/* MSDN says mask rows are aligned to "LONG" boundaries */
maskstride = (((size + 31) & ~31) >> 3);
indata = gdk_pixbuf_get_pixels (pixbuf);
indata = gdk_pixbuf_read_pixels (pixbuf);
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
nc = gdk_pixbuf_get_n_channels (pixbuf);
has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
+62 -85
View File
@@ -1857,7 +1857,8 @@ gdk_event_translate (MSG *msg,
0,
FALSE,
&translated,
&translated);
&translated,
NULL);
_gdk_win32_append_event (event);
}
break;
@@ -1906,8 +1907,12 @@ gdk_event_translate (MSG *msg,
GdkTranslatedKey translated;
GdkTranslatedKey no_lock;
BYTE key_state[256];
wchar_t wbuf[100];
int ccount = 0;
GArray *translation;
MSG msg2;
int level = 0;
int effective_group = 0;
GdkModifierType consumed = 0;
char *composed = NULL;
/* Ignore key messages intended for the IME */
if (msg->wParam == VK_PROCESSKEY || in_ime_composition)
@@ -1929,34 +1934,41 @@ gdk_event_translate (MSG *msg,
API_CALL (GetKeyboardState, (key_state));
ccount = 0;
if (msg->wParam == VK_PACKET)
{
ccount = ToUnicode (VK_PACKET, HIWORD (msg->lParam), key_state, wbuf, 1, 0);
if (ccount == 1)
{
if (wbuf[0] >= 0xD800 && wbuf[0] < 0xDC00)
{
if (msg->message == WM_KEYDOWN)
impl->leading_surrogate_keydown = wbuf[0];
else
impl->leading_surrogate_keyup = wbuf[0];
/* don't emit an event */
return_val = TRUE;
break;
}
else
{
/* wait until an event is created */;
}
}
}
keyval = GDK_KEY_VoidSymbol;
keycode = msg->wParam;
/* Get the WinAPI translation of the WM_KEY messages to characters.
The WM_CHAR messages are generated by a previous call to TranslateMessage() and always
follow directly after the corresponding WM_KEY* messages.
There could be 0 or more WM_CHAR messages following (for example dead keys don't generate
WM_CHAR messages - they generate WM_DEAD_CHAR instead, but we are not interested in those
messages). */
translation = g_array_sized_new (FALSE, FALSE, sizeof (gunichar2), 2);
while (PeekMessageW (&msg2, msg->hwnd, 0, 0, 0) && (msg2.message == WM_CHAR || msg2.message == WM_SYSCHAR))
{
/* The character is encoded in WPARAM as UTF-16. */
gunichar2 c = msg2.wParam;
/* Append character to translation string. */
g_array_append_val (translation, c);
/* Remove message from queue */
GetMessageW (&msg2, msg->hwnd, 0, 0);
}
if (translation->len > 0)
composed = g_utf16_to_utf8 ((gunichar2*)translation->data,
translation->len, NULL, NULL, NULL);
g_array_unref (translation);
translation = NULL;
/* Ignore control sequences like Backspace */
if (composed && g_unichar_iscntrl (g_utf8_get_char (composed)))
g_clear_pointer (&composed, g_free);
if (HIWORD (msg->lParam) & KF_EXTENDED)
{
switch (msg->wParam)
@@ -1985,61 +1997,20 @@ gdk_event_translate (MSG *msg,
state = build_key_event_state (key_state);
group = get_active_group ();
if (msg->wParam == VK_PACKET && ccount == 1)
{
if (wbuf[0] >= 0xD800 && wbuf[0] < 0xDC00)
{
g_assert_not_reached ();
}
else if (wbuf[0] >= 0xDC00 && wbuf[0] < 0xE000)
{
wchar_t leading;
gdk_keymap_translate_keyboard_state ((GdkKeymap*) win32_keymap, keycode, state, group,
&keyval, &effective_group, &level, &consumed);
translated.keyval = keyval;
translated.consumed = consumed;
translated.layout = effective_group;
translated.level = level;
if (msg->message == WM_KEYDOWN)
leading = impl->leading_surrogate_keydown;
else
leading = impl->leading_surrogate_keyup;
keyval = gdk_unicode_to_keyval ((leading - 0xD800) * 0x400 + wbuf[0] - 0xDC00 + 0x10000);
}
else
{
keyval = gdk_unicode_to_keyval (wbuf[0]);
}
translated.keyval = keyval;
translated.consumed = 0;
translated.layout = 0;
translated.level = 0;
no_lock = translated;
}
else
{
int level = 0;
int effective_group = 0;
GdkModifierType consumed = 0;
gdk_keymap_translate_keyboard_state ((GdkKeymap*) win32_keymap, keycode, state, group,
&keyval, &effective_group, &level, &consumed);
translated.keyval = keyval;
translated.consumed = consumed;
translated.layout = effective_group;
translated.level = level;
gdk_keymap_translate_keyboard_state ((GdkKeymap*) win32_keymap, keycode,
state & ~GDK_LOCK_MASK, group, &keyval,
&effective_group, &level, &consumed);
no_lock.keyval = keyval;
no_lock.consumed = consumed;
no_lock.layout = effective_group;
no_lock.level = level;
}
if (msg->message == WM_KEYDOWN)
impl->leading_surrogate_keydown = 0;
else
impl->leading_surrogate_keyup = 0;
gdk_keymap_translate_keyboard_state ((GdkKeymap*) win32_keymap, keycode,
state & ~GDK_LOCK_MASK, group, &keyval,
&effective_group, &level, &consumed);
no_lock.keyval = keyval;
no_lock.consumed = consumed;
no_lock.layout = effective_group;
no_lock.level = level;
/* Only one release key event is fired when both shift keys are pressed together
and then released. In order to send the missing event, press events for shift
@@ -2087,10 +2058,12 @@ gdk_event_translate (MSG *msg,
state,
is_modifier,
&translated,
&no_lock);
&no_lock,
composed);
_gdk_win32_append_event (event);
g_free (composed);
return_val = TRUE;
}
break;
@@ -2169,7 +2142,8 @@ gdk_event_translate (MSG *msg,
build_key_event_state (key_state),
FALSE,
&translated,
&translated);
&translated,
NULL);
_gdk_win32_append_event (event);
@@ -2182,7 +2156,8 @@ gdk_event_translate (MSG *msg,
build_key_event_state (key_state),
FALSE,
&translated,
&translated);
&translated,
NULL);
_gdk_win32_append_event (event);
}
@@ -2229,6 +2204,7 @@ gdk_event_translate (MSG *msg,
generate_button_event (GDK_BUTTON_PRESS, button,
window, msg);
*ret_valp = (msg->message == WM_XBUTTONDOWN ? TRUE : 0);
return_val = TRUE;
break;
@@ -2312,6 +2288,7 @@ gdk_event_translate (MSG *msg,
mouse_window_ignored_leave = NULL;
}
*ret_valp = (msg->message == WM_XBUTTONUP ? TRUE : 0);
return_val = TRUE;
break;
}
-8
View File
@@ -235,14 +235,6 @@ struct _GdkWin32Surface
/* The cursor that GDK set for this window via GdkDevice */
GdkWin32HCursor *cursor;
/* When VK_PACKET sends us a leading surrogate, it's stashed here.
* Later, when another VK_PACKET sends a tailing surrogate, we make up
* a full unicode character from them, or discard the leading surrogate,
* if the next key is not a tailing surrogate.
*/
wchar_t leading_surrogate_keydown;
wchar_t leading_surrogate_keyup;
/* Window size hints */
int hint_flags;
GdkGeometry hints;
+2 -1
View File
@@ -1595,7 +1595,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
state,
gdk_x11_keymap_key_is_modifier (keymap, xev->detail),
&translated,
&no_lock);
&no_lock,
NULL);
if (ev->evtype == XI_KeyPress)
set_user_time (event);
+7 -11
View File
@@ -1,14 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<node name="/node">
<interface name="org.a11y.atspi.Value">
<property name="MinimumValue" type="d" access="read"/>
<property name="MaximumValue" type="d" access="read"/>
<property name="MinimumIncrement" type="d" access="read"/>
<property name="CurrentValue" type="d" access="readwrite"/>
</interface>
<interface name="org.a11y.atspi.Value">
<property name="MinimumValue" type="d" access="read"/>
<property name="MaximumValue" type="d" access="read"/>
<property name="MinimumIncrement" type="d" access="read"/>
<property name="CurrentValue" type="d" access="readwrite"/>
<property name="Text" type="s" access="read"/>
</interface>
</node>
+1 -1
View File
@@ -18,7 +18,7 @@
#include "config.h"
#include "gtkatspipangoprivate.h"
#include "gtkpango.h"
#include "gtkpangoprivate.h"
void
gtk_pango_get_font_attributes (PangoFontDescription *font,
+5 -1
View File
@@ -31,7 +31,7 @@
#include "gtklistbase.h"
#include "gtklistbox.h"
#include "gtkflowbox.h"
#include "gtkcombobox.h"
#include "deprecated/gtkcombobox.h"
#include "gtkstackswitcher.h"
#include "gtknotebook.h"
#include "gtklistview.h"
@@ -618,6 +618,8 @@ static const GDBusInterfaceVTable flowbox_vtable = {
/* }}} */
/* {{{ GtkComboBox */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
combobox_handle_method (GDBusConnection *connection,
const gchar *sender,
@@ -713,6 +715,8 @@ static const GDBusInterfaceVTable combobox_vtable = {
NULL
};
G_GNUC_END_IGNORE_DEPRECATIONS
/* }}} */
/* {{{ GtkStackSwitcher */
+1 -1
View File
@@ -35,7 +35,7 @@
#include "gtkentryprivate.h"
#include "gtkinscriptionprivate.h"
#include "gtklabelprivate.h"
#include "gtkpango.h"
#include "gtkpangoprivate.h"
#include "gtkpasswordentryprivate.h"
#include "gtksearchentryprivate.h"
#include "gtkspinbuttonprivate.h"
+1 -1
View File
@@ -21,7 +21,7 @@
#include "gtkatspipangoprivate.h"
#include "gtktextbufferprivate.h"
#include "gtktextviewprivate.h"
#include "gtkpango.h"
#include "gtkpangoprivate.h"
void
gtk_text_view_add_default_attributes (GtkTextView *view,
+39 -36
View File
@@ -24,14 +24,9 @@
#include "a11y/atspi/atspi-value.h"
#include "gtkaccessiblerangeprivate.h"
#include "gtkatcontextprivate.h"
#include "gtkdebug.h"
#include "gtklevelbar.h"
#include "gtkpaned.h"
#include "gtkprogressbar.h"
#include "gtkrange.h"
#include "gtkscalebutton.h"
#include "gtkspinbutton.h"
#include <gio/gio.h>
@@ -45,31 +40,58 @@ handle_value_get_property (GDBusConnection *connection,
gpointer user_data)
{
GtkATContext *ctx = GTK_AT_CONTEXT (user_data);
/* Numeric attributes */
struct {
const char *name;
GtkAccessibleProperty property;
} properties[] = {
} num_properties[] = {
{ "MinimumValue", GTK_ACCESSIBLE_PROPERTY_VALUE_MIN },
{ "MaximumValue", GTK_ACCESSIBLE_PROPERTY_VALUE_MAX },
{ "CurrentValue", GTK_ACCESSIBLE_PROPERTY_VALUE_NOW },
};
int i;
for (i = 0; i < G_N_ELEMENTS (properties); i++)
/* String attributes */
struct {
const char *name;
GtkAccessibleProperty property;
} str_properties[] = {
{ "Text", GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT },
};
for (int i = 0; i < G_N_ELEMENTS (num_properties); i++)
{
if (g_strcmp0 (property_name, properties[i].name) == 0)
if (g_strcmp0 (property_name, num_properties[i].name) == 0)
{
if (gtk_at_context_has_accessible_property (ctx, properties[i].property))
if (gtk_at_context_has_accessible_property (ctx, num_properties[i].property))
{
GtkAccessibleValue *value;
GtkAccessibleValue *value =
gtk_at_context_get_accessible_property (ctx, num_properties[i].property);
value = gtk_at_context_get_accessible_property (ctx, properties[i].property);
return g_variant_new_double (gtk_number_accessible_value_get (value));
}
}
}
/* fall back for a) MinimumIncrement b) widgets that should have the
for (int i = 0; i < G_N_ELEMENTS (str_properties); i++)
{
if (g_strcmp0 (property_name, str_properties[i].name) == 0)
{
if (gtk_at_context_has_accessible_property (ctx, str_properties[i].property))
{
GtkAccessibleValue *value =
gtk_at_context_get_accessible_property (ctx, str_properties[i].property);
return g_variant_new_string (gtk_string_accessible_value_get (value));
}
}
}
/* Special-case MinimumIncrement as it does not have an ARIA counterpart */
if (g_strcmp0 (property_name, "MinimumIncrement") == 0)
return g_variant_new_double (0.0);
/* fall back for widgets that should have the
* properties but don't
*/
return g_variant_new_double (0.0);
@@ -86,23 +108,10 @@ handle_value_set_property (GDBusConnection *connection,
gpointer user_data)
{
GtkATContext *self = user_data;
GtkWidget *widget = GTK_WIDGET (gtk_at_context_get_accessible (self));
GtkAccessibleRange *range = GTK_ACCESSIBLE_RANGE (gtk_at_context_get_accessible (self));
if (g_strcmp0 (property_name, "CurrentValue") == 0)
{
/* we only allow setting values if that is part of the user-exposed
* functionality of the widget.
*/
if (GTK_IS_RANGE (widget))
gtk_range_set_value (GTK_RANGE (widget), g_variant_get_double (value));
else if (GTK_IS_PANED (widget))
gtk_paned_set_position (GTK_PANED (widget), (int)(g_variant_get_double (value) + 0.5));
else if (GTK_IS_SPIN_BUTTON (widget))
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), g_variant_get_double (value));
else if (GTK_IS_SCALE_BUTTON (widget))
gtk_scale_button_set_value (GTK_SCALE_BUTTON (widget), g_variant_get_double (value));
return TRUE;
}
return gtk_accessible_range_set_current_value (range, g_variant_get_double (value));
return FALSE;
}
@@ -116,14 +125,8 @@ static const GDBusInterfaceVTable value_vtable = {
const GDBusInterfaceVTable *
gtk_atspi_get_value_vtable (GtkAccessible *accessible)
{
if (GTK_IS_LEVEL_BAR (accessible) ||
GTK_IS_PANED (accessible) ||
GTK_IS_PROGRESS_BAR (accessible) ||
GTK_IS_RANGE (accessible) ||
GTK_IS_SCALE_BUTTON (accessible) ||
GTK_IS_SPIN_BUTTON (accessible))
if (GTK_IS_ACCESSIBLE_RANGE (accessible))
return &value_vtable;
return NULL;
}
@@ -41,6 +41,10 @@
*
* To obtain the application that has been selected in a `GtkAppChooser`,
* use [method@Gtk.AppChooser.get_app_info].
*
* Deprecated: 4.10: The application selection widgets should be
* implemented according to the design of each platform and/or
* application requiring them.
*/
#include "config.h"
@@ -52,6 +56,8 @@
#include <glib.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
G_DEFINE_INTERFACE (GtkAppChooser, gtk_app_chooser, GTK_TYPE_WIDGET);
static void
@@ -82,6 +88,8 @@ gtk_app_chooser_default_init (GtkAppChooserIface *iface)
* shows applications.
*
* Returns: the content type of @self. Free with g_free()
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
char *
gtk_app_chooser_get_content_type (GtkAppChooser *self)
@@ -105,6 +113,8 @@ gtk_app_chooser_get_content_type (GtkAppChooser *self)
*
* Returns: (nullable) (transfer full): a `GAppInfo` for the
* currently selected application
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
GAppInfo *
gtk_app_chooser_get_app_info (GtkAppChooser *self)
@@ -117,6 +127,8 @@ gtk_app_chooser_get_app_info (GtkAppChooser *self)
* @self: a `GtkAppChooser`
*
* Reloads the list of applications.
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
void
gtk_app_chooser_refresh (GtkAppChooser *self)
@@ -41,11 +41,11 @@ typedef struct _GtkAppChooser GtkAppChooser;
GDK_AVAILABLE_IN_ALL
GType gtk_app_chooser_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GAppInfo * gtk_app_chooser_get_app_info (GtkAppChooser *self);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
char * gtk_app_chooser_get_content_type (GtkAppChooser *self);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_app_chooser_refresh (GtkAppChooser *self);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAppChooser, g_object_unref)
@@ -45,9 +45,13 @@
* To track changes in the selected application, use the
* [signal@Gtk.AppChooserButton::changed] signal.
*
* # CSS nodes
* ## CSS nodes
*
* `GtkAppChooserButton` has a single CSS node with the name appchooserbutton.
*
* Deprecated: 4.10: The application selection widgets should be
* implemented according to the design of each platform and/or
* application requiring them.
*/
#include "config.h"
@@ -67,6 +71,8 @@
#include "gtkliststore.h"
#include "gtkprivate.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
enum {
PROP_SHOW_DIALOG_ITEM = 1,
PROP_SHOW_DEFAULT_ITEM,
@@ -883,6 +889,8 @@ real_insert_separator (GtkAppChooserButton *self,
* that can handle content of the given type.
*
* Returns: a newly created `GtkAppChooserButton`
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
GtkWidget *
gtk_app_chooser_button_new (const char *content_type)
@@ -900,6 +908,8 @@ gtk_app_chooser_button_new (const char *content_type)
*
* Appends a separator to the list of applications that is shown
* in the popup.
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
void
gtk_app_chooser_button_append_separator (GtkAppChooserButton *self)
@@ -928,6 +938,8 @@ gtk_app_chooser_button_append_separator (GtkAppChooserButton *self)
* callback for the activation of a particular custom item in the list.
*
* See also [method@Gtk.AppChooserButton.append_separator].
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
void
gtk_app_chooser_button_append_custom_item (GtkAppChooserButton *self,
@@ -955,6 +967,8 @@ gtk_app_chooser_button_append_custom_item (GtkAppChooserButton *self,
*
* Use [method@Gtk.AppChooser.refresh] to bring the selection
* to its initial state.
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
void
gtk_app_chooser_button_set_active_custom_item (GtkAppChooserButton *self,
@@ -983,6 +997,8 @@ gtk_app_chooser_button_set_active_custom_item (GtkAppChooserButton *self,
* for a `GtkAppChooserDialog`.
*
* Returns: the value of [property@Gtk.AppChooserButton:show-dialog-item]
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
gboolean
gtk_app_chooser_button_get_show_dialog_item (GtkAppChooserButton *self)
@@ -999,6 +1015,8 @@ gtk_app_chooser_button_get_show_dialog_item (GtkAppChooserButton *self)
*
* Sets whether the dropdown menu of this button should show an
* entry to trigger a `GtkAppChooserDialog`.
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
void
gtk_app_chooser_button_set_show_dialog_item (GtkAppChooserButton *self,
@@ -1022,6 +1040,8 @@ gtk_app_chooser_button_set_show_dialog_item (GtkAppChooserButton *self,
* application at the top.
*
* Returns: the value of [property@Gtk.AppChooserButton:show-default-item]
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
gboolean
gtk_app_chooser_button_get_show_default_item (GtkAppChooserButton *self)
@@ -1038,6 +1058,8 @@ gtk_app_chooser_button_get_show_default_item (GtkAppChooserButton *self)
*
* Sets whether the dropdown menu of this button should show the
* default application for the given content type at top.
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
void
gtk_app_chooser_button_set_show_default_item (GtkAppChooserButton *self,
@@ -1063,6 +1085,8 @@ gtk_app_chooser_button_set_show_default_item (GtkAppChooserButton *self,
* Sets the text to display at the top of the dialog.
*
* If the heading is not set, the dialog displays a default text.
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
void
gtk_app_chooser_button_set_heading (GtkAppChooserButton *self,
@@ -1084,6 +1108,8 @@ gtk_app_chooser_button_set_heading (GtkAppChooserButton *self,
*
* Returns: (nullable): the text to display at the top of the dialog,
* or %NULL, in which case a default text is displayed
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
const char *
gtk_app_chooser_button_get_heading (GtkAppChooserButton *self)
@@ -1099,6 +1125,8 @@ gtk_app_chooser_button_get_heading (GtkAppChooserButton *self)
* @modal: %TRUE to make the dialog modal
*
* Sets whether the dialog should be modal.
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
void
gtk_app_chooser_button_set_modal (GtkAppChooserButton *self,
@@ -1121,6 +1149,8 @@ gtk_app_chooser_button_set_modal (GtkAppChooserButton *self,
* Gets whether the dialog is modal.
*
* Returns: %TRUE if the dialog is modal
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
gboolean
gtk_app_chooser_button_get_modal (GtkAppChooserButton *self)
@@ -40,40 +40,40 @@ typedef struct _GtkAppChooserButton GtkAppChooserButton;
GDK_AVAILABLE_IN_ALL
GType gtk_app_chooser_button_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget * gtk_app_chooser_button_new (const char *content_type);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_app_chooser_button_append_separator (GtkAppChooserButton *self);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_app_chooser_button_append_custom_item (GtkAppChooserButton *self,
const char *name,
const char *label,
GIcon *icon);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_app_chooser_button_set_active_custom_item (GtkAppChooserButton *self,
const char *name);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_app_chooser_button_set_show_dialog_item (GtkAppChooserButton *self,
gboolean setting);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_app_chooser_button_get_show_dialog_item (GtkAppChooserButton *self);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_app_chooser_button_set_heading (GtkAppChooserButton *self,
const char *heading);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
const char *
gtk_app_chooser_button_get_heading (GtkAppChooserButton *self);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_app_chooser_button_set_show_default_item (GtkAppChooserButton *self,
gboolean setting);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_app_chooser_button_get_show_default_item (GtkAppChooserButton *self);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_app_chooser_button_get_modal (GtkAppChooserButton *self);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_app_chooser_button_set_modal (GtkAppChooserButton *self,
gboolean modal);
@@ -37,6 +37,10 @@
*
* To set the heading that is shown above the `GtkAppChooserWidget`,
* use [method@Gtk.AppChooserDialog.set_heading].
*
* Deprecated: 4.10: The application selection widgets should be
* implemented according to the design of each platform and/or
* application requiring them.
*/
#include "config.h"
@@ -61,6 +65,8 @@
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
typedef struct _GtkAppChooserDialogClass GtkAppChooserDialogClass;
struct _GtkAppChooserDialog {
@@ -214,13 +220,13 @@ set_dialog_properties (GtkAppChooserDialog *self)
else if (self->content_type)
{
/* Translators: %s is a file type description */
subtitle = g_strdup_printf (_("Opening “%s” files."),
subtitle = g_strdup_printf (_("Opening “%s” files."),
unknown ? self->content_type : description);
string = g_strdup_printf (_("No applications found for “%s” files"),
unknown ? self->content_type : description);
}
g_object_get (self, "use-header-bar", &use_header, NULL);
g_object_get (self, "use-header-bar", &use_header, NULL);
if (use_header)
{
GtkWidget *box, *label;
@@ -492,7 +498,7 @@ static void
gtk_app_chooser_dialog_dispose (GObject *object)
{
GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (object);
g_clear_object (&self->gfile);
self->dismissed = TRUE;
@@ -670,6 +676,8 @@ set_parent_and_flags (GtkWidget *dialog,
* The dialog will show applications that can open the file.
*
* Returns: a newly created `GtkAppChooserDialog`
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
GtkWidget *
gtk_app_chooser_dialog_new (GtkWindow *parent,
@@ -700,6 +708,8 @@ gtk_app_chooser_dialog_new (GtkWindow *parent,
* The dialog will show applications that can open the content type.
*
* Returns: a newly created `GtkAppChooserDialog`
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
GtkWidget *
gtk_app_chooser_dialog_new_for_content_type (GtkWindow *parent,
@@ -726,6 +736,8 @@ gtk_app_chooser_dialog_new_for_content_type (GtkWindow *parent,
* Returns the `GtkAppChooserWidget` of this dialog.
*
* Returns: (transfer none): the `GtkAppChooserWidget` of @self
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
GtkWidget *
gtk_app_chooser_dialog_get_widget (GtkAppChooserDialog *self)
@@ -743,6 +755,8 @@ gtk_app_chooser_dialog_get_widget (GtkAppChooserDialog *self)
* Sets the text to display at the top of the dialog.
*
* If the heading is not set, the dialog displays a default text.
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
void
gtk_app_chooser_dialog_set_heading (GtkAppChooserDialog *self,
@@ -777,6 +791,8 @@ gtk_app_chooser_dialog_set_heading (GtkAppChooserDialog *self,
*
* Returns: (nullable): the text to display at the top of the dialog,
* or %NULL, in which case a default text is displayed
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
const char *
gtk_app_chooser_dialog_get_heading (GtkAppChooserDialog *self)
@@ -29,7 +29,7 @@
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkdialog.h>
#include <gtk/deprecated/gtkdialog.h>
#include <gio/gio.h>
G_BEGIN_DECLS
@@ -43,21 +43,21 @@ typedef struct _GtkAppChooserDialog GtkAppChooserDialog;
GDK_AVAILABLE_IN_ALL
GType gtk_app_chooser_dialog_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget * gtk_app_chooser_dialog_new (GtkWindow *parent,
GtkDialogFlags flags,
GFile *file);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget * gtk_app_chooser_dialog_new_for_content_type (GtkWindow *parent,
GtkDialogFlags flags,
const char *content_type);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget * gtk_app_chooser_dialog_get_widget (GtkAppChooserDialog *self);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_app_chooser_dialog_set_heading (GtkAppChooserDialog *self,
const char *heading);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
const char * gtk_app_chooser_dialog_get_heading (GtkAppChooserDialog *self);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAppChooserDialog, g_object_unref)
@@ -44,6 +44,8 @@
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/**
* GtkAppChooserWidget:
*
@@ -67,9 +69,13 @@
* [signal@Gtk.AppChooserWidget::application-selected] and
* [signal@Gtk.AppChooserWidget::application-activated] signals.
*
* # CSS nodes
* ## CSS nodes
*
* `GtkAppChooserWidget` has a single CSS node with name appchooser.
*
* Deprecated: 4.10: The application selection widgets should be
* implemented according to the design of each platform and/or
* application requiring them.
*/
typedef struct _GtkAppChooserWidgetClass GtkAppChooserWidgetClass;
@@ -310,7 +316,7 @@ gtk_app_chooser_sort_func (GtkTreeModel *model,
retval = 1;
goto out;
}
/* the recommended one always wins */
if (a_recommended && !b_recommended)
{
@@ -442,7 +448,7 @@ gtk_app_chooser_widget_add_section (GtkAppChooserWidget *self,
retval = FALSE;
heading_added = FALSE;
bold_string = g_strdup_printf ("<b>%s</b>", heading_title);
for (l = applications; l != NULL; l = l->next)
{
app = l->data;
@@ -1112,6 +1118,8 @@ gtk_app_chooser_widget_iface_init (GtkAppChooserIface *iface)
* that can handle content of the given type.
*
* Returns: a newly created `GtkAppChooserWidget`
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
GtkWidget *
gtk_app_chooser_widget_new (const char *content_type)
@@ -1128,6 +1136,8 @@ gtk_app_chooser_widget_new (const char *content_type)
*
* Sets whether the app chooser should show the default handler
* for the content type in a separate section.
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
void
gtk_app_chooser_widget_set_show_default (GtkAppChooserWidget *self,
@@ -1153,6 +1163,8 @@ gtk_app_chooser_widget_set_show_default (GtkAppChooserWidget *self,
* for the content type in a separate section.
*
* Returns: the value of [property@Gtk.AppChooserWidget:show-default]
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
gboolean
gtk_app_chooser_widget_get_show_default (GtkAppChooserWidget *self)
@@ -1169,6 +1181,8 @@ gtk_app_chooser_widget_get_show_default (GtkAppChooserWidget *self)
*
* Sets whether the app chooser should show recommended applications
* for the content type in a separate section.
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
void
gtk_app_chooser_widget_set_show_recommended (GtkAppChooserWidget *self,
@@ -1194,6 +1208,8 @@ gtk_app_chooser_widget_set_show_recommended (GtkAppChooserWidget *self,
* for the content type in a separate section.
*
* Returns: the value of [property@Gtk.AppChooserWidget:show-recommended]
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
gboolean
gtk_app_chooser_widget_get_show_recommended (GtkAppChooserWidget *self)
@@ -1210,6 +1226,8 @@ gtk_app_chooser_widget_get_show_recommended (GtkAppChooserWidget *self)
*
* Sets whether the app chooser should show related applications
* for the content type in a separate section.
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
void
gtk_app_chooser_widget_set_show_fallback (GtkAppChooserWidget *self,
@@ -1235,6 +1253,8 @@ gtk_app_chooser_widget_set_show_fallback (GtkAppChooserWidget *self,
* for the content type in a separate section.
*
* Returns: the value of [property@Gtk.AppChooserWidget:show-fallback]
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
gboolean
gtk_app_chooser_widget_get_show_fallback (GtkAppChooserWidget *self)
@@ -1251,6 +1271,8 @@ gtk_app_chooser_widget_get_show_fallback (GtkAppChooserWidget *self)
*
* Sets whether the app chooser should show applications
* which are unrelated to the content type.
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
void
gtk_app_chooser_widget_set_show_other (GtkAppChooserWidget *self,
@@ -1276,6 +1298,8 @@ gtk_app_chooser_widget_set_show_other (GtkAppChooserWidget *self,
* which are unrelated to the content type.
*
* Returns: the value of [property@Gtk.AppChooserWidget:show-other]
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
gboolean
gtk_app_chooser_widget_get_show_other (GtkAppChooserWidget *self)
@@ -1292,6 +1316,8 @@ gtk_app_chooser_widget_get_show_other (GtkAppChooserWidget *self)
*
* Sets whether the app chooser should show all applications
* in a flat list.
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
void
gtk_app_chooser_widget_set_show_all (GtkAppChooserWidget *self,
@@ -1317,6 +1343,8 @@ gtk_app_chooser_widget_set_show_all (GtkAppChooserWidget *self,
* in a flat list.
*
* Returns: the value of [property@Gtk.AppChooserWidget:show-all]
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
gboolean
gtk_app_chooser_widget_get_show_all (GtkAppChooserWidget *self)
@@ -1333,6 +1361,8 @@ gtk_app_chooser_widget_get_show_all (GtkAppChooserWidget *self)
*
* Sets the text that is shown if there are not applications
* that can handle the content type.
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
void
gtk_app_chooser_widget_set_default_text (GtkAppChooserWidget *self,
@@ -1359,6 +1389,8 @@ gtk_app_chooser_widget_set_default_text (GtkAppChooserWidget *self,
* that can handle the content type.
*
* Returns: (nullable): the value of [property@Gtk.AppChooserWidget:default-text]
*
* Deprecated: 4.10: This widget will be removed in GTK 5
*/
const char *
gtk_app_chooser_widget_get_default_text (GtkAppChooserWidget *self)
@@ -43,43 +43,43 @@ typedef struct _GtkAppChooserWidget GtkAppChooserWidget;
GDK_AVAILABLE_IN_ALL
GType gtk_app_chooser_widget_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget * gtk_app_chooser_widget_new (const char *content_type);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_app_chooser_widget_set_show_default (GtkAppChooserWidget *self,
gboolean setting);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_app_chooser_widget_get_show_default (GtkAppChooserWidget *self);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_app_chooser_widget_set_show_recommended (GtkAppChooserWidget *self,
gboolean setting);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_app_chooser_widget_get_show_recommended (GtkAppChooserWidget *self);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_app_chooser_widget_set_show_fallback (GtkAppChooserWidget *self,
gboolean setting);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_app_chooser_widget_get_show_fallback (GtkAppChooserWidget *self);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_app_chooser_widget_set_show_other (GtkAppChooserWidget *self,
gboolean setting);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_app_chooser_widget_get_show_other (GtkAppChooserWidget *self);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_app_chooser_widget_set_show_all (GtkAppChooserWidget *self,
gboolean setting);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_app_chooser_widget_get_show_all (GtkAppChooserWidget *self);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_app_chooser_widget_set_default_text (GtkAppChooserWidget *self,
const char *text);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
const char * gtk_app_chooser_widget_get_default_text (GtkAppChooserWidget *self);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAppChooserWidget, g_object_unref)
@@ -35,7 +35,7 @@
* Usually users dont have to interact with the `GtkCellArea` directly
* unless they are implementing a cell-layouting widget themselves.
*
* # Requesting area sizes
* ## Requesting area sizes
*
* As outlined in
* [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management),
@@ -186,7 +186,7 @@
* values while more and more height is required for the row heights
* that are calculated in the background.
*
* # Rendering Areas
* ## Rendering Areas
*
* Once area sizes have been acquired at least for the rows in the
* visible area of the layouting widget they can be rendered at
@@ -227,7 +227,7 @@
* would make sense to calculate the allocation for each row at
* the time the widget is allocated using [func@Gtk.distribute_natural_allocation].
*
* # Handling Events and Driving Keyboard Focus
* ## Handling Events and Driving Keyboard Focus
*
* Passing events to the area is as simple as handling events on any
* normal widget and then passing them to the [method@Gtk.CellArea.event]
@@ -316,7 +316,7 @@
* Note that the layouting widget is responsible for matching the
* `GtkDirectionType` values to the way it lays out its cells.
*
* # Cell Properties
* ## Cell Properties
*
* The `GtkCellArea` introduces cell properties for `GtkCellRenderer`s.
* This provides some general interfaces for defining the relationship
@@ -335,6 +335,9 @@
* [method@Gtk.CellArea.cell_set] or [method@Gtk.CellArea.cell_set_valist]. To obtain
* the value of a cell property, use [method@Gtk.CellArea.cell_get_property]
* [method@Gtk.CellArea.cell_get] or [method@Gtk.CellArea.cell_get_valist].
*
* Deprecated: 4.10: List views use widgets for displaying their
* contents
*/
#include "config.h"
@@ -343,17 +346,18 @@
#include <string.h>
#include <stdlib.h>
#include "gtkcelllayout.h"
#include "deprecated/gtkcelllayout.h"
#include "gtkcellarea.h"
#include "gtkcellareacontext.h"
#include "deprecated/gtkcellareacontext.h"
#include "gtkmarshalers.h"
#include "gtkprivate.h"
#include "gtksnapshot.h"
#include "deprecated/gtkrender.h"
#include "gtkstylecontext.h"
#include "gtknative.h"
#include <gobject/gvaluecollector.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* GObjectClass */
static void gtk_cell_area_dispose (GObject *object);
@@ -1587,6 +1591,8 @@ gtk_cell_area_buildable_custom_tag_end (GtkBuildable *buildable,
* @renderer: the `GtkCellRenderer` to add to @area
*
* Adds @renderer to @area with the default child cell properties.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_add (GtkCellArea *area,
@@ -1604,6 +1610,8 @@ gtk_cell_area_add (GtkCellArea *area,
* @renderer: the `GtkCellRenderer` to remove from @area
*
* Removes @renderer from @area.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_remove (GtkCellArea *area,
@@ -1658,6 +1666,8 @@ get_has_renderer (GtkCellRenderer *renderer,
* Checks if @area contains @renderer.
*
* Returns: %TRUE if @renderer is in the @area.
*
* Deprecated: 4.10
*/
gboolean
gtk_cell_area_has_renderer (GtkCellArea *area,
@@ -1680,6 +1690,8 @@ gtk_cell_area_has_renderer (GtkCellArea *area,
* @callback_data: user provided data pointer
*
* Calls @callback for every `GtkCellRenderer` in @area.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_foreach (GtkCellArea *area,
@@ -1737,6 +1749,8 @@ gtk_cell_area_foreach_alloc (GtkCellArea *area,
* Delegates event handling to a `GtkCellArea`.
*
* Returns: %TRUE if the event was handled by @area.
*
* Deprecated: 4.10
*/
int
gtk_cell_area_event (GtkCellArea *area,
@@ -1777,6 +1791,8 @@ gtk_cell_area_event (GtkCellArea *area,
*
* Snapshots @areas cells according to @areas layout onto at
* the given coordinates.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_snapshot (GtkCellArea *area,
@@ -1830,6 +1846,8 @@ get_cell_allocation (GtkCellRenderer *renderer,
*
* Derives the allocation of @renderer inside @area if @area
* were to be renderered in @cell_area.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_get_cell_allocation (GtkCellArea *area,
@@ -1886,6 +1904,8 @@ get_cell_by_position (GtkCellRenderer *renderer,
* returns the full cell allocation for it inside @cell_area.
*
* Returns: (transfer none): the `GtkCellRenderer` at @x and @y.
*
* Deprecated: 4.10
*/
GtkCellRenderer *
gtk_cell_area_get_cell_at_position (GtkCellArea *area,
@@ -1929,6 +1949,8 @@ gtk_cell_area_get_cell_at_position (GtkCellArea *area,
* which was used to request the size of those rows of data).
*
* Returns: (transfer full): a newly created `GtkCellArea`Context which can be used with @area.
*
* Deprecated: 4.10
*/
GtkCellAreaContext *
gtk_cell_area_create_context (GtkCellArea *area)
@@ -1956,6 +1978,8 @@ gtk_cell_area_create_context (GtkCellArea *area)
* to be displayed.
*
* Returns: (transfer full): a newly created `GtkCellArea`Context copy of @context.
*
* Deprecated: 4.10
*/
GtkCellAreaContext *
gtk_cell_area_copy_context (GtkCellArea *area,
@@ -2000,6 +2024,8 @@ gtk_cell_area_get_request_mode (GtkCellArea *area)
* to check the @minimum_width and @natural_width of this call but rather to
* consult gtk_cell_area_context_get_preferred_width() after a series of
* requests.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_get_preferred_width (GtkCellArea *area,
@@ -2038,6 +2064,8 @@ gtk_cell_area_get_preferred_width (GtkCellArea *area,
* requested with gtk_cell_area_get_preferred_width() again and then
* the full width of the requested rows checked again with
* gtk_cell_area_context_get_preferred_width().
*
* Deprecated: 4.10
*/
void
gtk_cell_area_get_preferred_height_for_width (GtkCellArea *area,
@@ -2072,6 +2100,8 @@ gtk_cell_area_get_preferred_height_for_width (GtkCellArea *area,
* to check the @minimum_height and @natural_height of this call but rather to
* consult gtk_cell_area_context_get_preferred_height() after a series of
* requests.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_get_preferred_height (GtkCellArea *area,
@@ -2110,6 +2140,8 @@ gtk_cell_area_get_preferred_height (GtkCellArea *area,
* requested with gtk_cell_area_get_preferred_height() again and then
* the full height of the requested rows checked again with
* gtk_cell_area_context_get_preferred_height().
*
* Deprecated: 4.10
*/
void
gtk_cell_area_get_preferred_width_for_height (GtkCellArea *area,
@@ -2141,6 +2173,8 @@ gtk_cell_area_get_preferred_width_for_height (GtkCellArea *area,
*
* Connects an @attribute to apply values from @column for the
* `GtkTreeModel` in use.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_attribute_connect (GtkCellArea *area,
@@ -2207,6 +2241,8 @@ gtk_cell_area_attribute_connect (GtkCellArea *area,
* Disconnects @attribute for the @renderer in @area so that
* attribute will no longer be updated with values from the
* model.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_attribute_disconnect (GtkCellArea *area,
@@ -2250,6 +2286,8 @@ gtk_cell_area_attribute_disconnect (GtkCellArea *area,
* or -1 if the attribute is not mapped.
*
* Returns: the model column, or -1
*
* Deprecated: 4.10
*/
int
gtk_cell_area_attribute_get_column (GtkCellArea *area,
@@ -2288,6 +2326,8 @@ gtk_cell_area_attribute_get_column (GtkCellArea *area,
*
* Applies any connected attributes to the renderers in
* @area by pulling the values from @tree_model.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_apply_attributes (GtkCellArea *area,
@@ -2339,6 +2379,8 @@ gtk_cell_area_get_current_path_string (GtkCellArea *area)
* @pspec: the `GParamSpec` for the property
*
* Installs a cell property on a cell area class.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_class_install_cell_property (GtkCellAreaClass *aclass,
@@ -2375,6 +2417,8 @@ gtk_cell_area_class_install_cell_property (GtkCellAreaClass *aclass,
* Finds a cell property of a cell area class by name.
*
* Returns: (transfer none): the `GParamSpec` of the child property
*
* Deprecated: 4.10
*/
GParamSpec*
gtk_cell_area_class_find_cell_property (GtkCellAreaClass *aclass,
@@ -2399,6 +2443,8 @@ gtk_cell_area_class_find_cell_property (GtkCellAreaClass *aclass,
* Returns: (array length=n_properties) (transfer container): a newly
* allocated %NULL-terminated array of `GParamSpec`*. The array
* must be freed with g_free().
*
* Deprecated: 4.10
*/
GParamSpec**
gtk_cell_area_class_list_cell_properties (GtkCellAreaClass *aclass,
@@ -2428,6 +2474,8 @@ gtk_cell_area_class_list_cell_properties (GtkCellAreaClass *aclass,
*
* Adds @renderer to @area, setting cell properties at the same time.
* See gtk_cell_area_add() and gtk_cell_area_cell_set() for more details.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_add_with_properties (GtkCellArea *area,
@@ -2466,6 +2514,8 @@ gtk_cell_area_add_with_properties (GtkCellArea *area,
* with @first_prop_name
*
* Sets one or more cell properties for @cell in @area.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_cell_set (GtkCellArea *area,
@@ -2492,6 +2542,8 @@ gtk_cell_area_cell_set (GtkCellArea *area,
* optionally by more name/return location pairs, followed by %NULL
*
* Gets the values of one or more cell properties for @renderer in @area.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_cell_get (GtkCellArea *area,
@@ -2563,6 +2615,8 @@ area_set_cell_property (GtkCellArea *area,
* with @first_prop_name
*
* Sets one or more cell properties for @renderer in @area.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_cell_set_valist (GtkCellArea *area,
@@ -2623,6 +2677,8 @@ gtk_cell_area_cell_set_valist (GtkCellArea *area,
* optionally by more name/return location pairs, followed by %NULL
*
* Gets the values of one or more cell properties for @renderer in @area.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_cell_get_valist (GtkCellArea *area,
@@ -2680,6 +2736,8 @@ gtk_cell_area_cell_get_valist (GtkCellArea *area,
* @value: the value to set the cell property to
*
* Sets a cell property for @renderer in @area.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_cell_set_property (GtkCellArea *area,
@@ -2716,6 +2774,8 @@ gtk_cell_area_cell_set_property (GtkCellArea *area,
* @value: a location to return the value
*
* Gets the value of a cell property for @renderer in @area.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_cell_get_property (GtkCellArea *area,
@@ -2785,6 +2845,8 @@ gtk_cell_area_cell_get_property (GtkCellArea *area,
* after applying new attributes to @area.
*
* Returns: whether @area can do anything when activated.
*
* Deprecated: 4.10
*/
gboolean
gtk_cell_area_is_activatable (GtkCellArea *area)
@@ -2808,6 +2870,8 @@ gtk_cell_area_is_activatable (GtkCellArea *area)
* to how it lays out cells.
*
* Returns: %TRUE if focus remains inside @area as a result of this call.
*
* Deprecated: 4.10
*/
gboolean
gtk_cell_area_focus (GtkCellArea *area,
@@ -2833,6 +2897,8 @@ gtk_cell_area_focus (GtkCellArea *area,
* can also activate a widget if it currently has the focus.
*
* Returns: Whether @area was successfully activated.
*
* Deprecated: 4.10
*/
gboolean
gtk_cell_area_activate (GtkCellArea *area,
@@ -2859,6 +2925,8 @@ gtk_cell_area_activate (GtkCellArea *area,
* `GtkCellAreaClass.focus()` or `GtkCellAreaClass.event()`,
* however it can also be used to implement functions such
* as gtk_tree_view_set_cursor_on_cell().
*
* Deprecated: 4.10
*/
void
gtk_cell_area_set_focus_cell (GtkCellArea *area,
@@ -2897,6 +2965,8 @@ gtk_cell_area_set_focus_cell (GtkCellArea *area,
* Retrieves the currently focused cell for @area
*
* Returns: (transfer none) (nullable): the currently focused cell in @area.
*
* Deprecated: 4.10
*/
GtkCellRenderer *
gtk_cell_area_get_focus_cell (GtkCellArea *area)
@@ -2925,6 +2995,8 @@ gtk_cell_area_get_focus_cell (GtkCellArea *area)
*
* Events handled by focus siblings can also activate the given
* focusable @renderer.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_add_focus_sibling (GtkCellArea *area,
@@ -2968,6 +3040,8 @@ gtk_cell_area_add_focus_sibling (GtkCellArea *area,
*
* Removes @sibling from @renderers focus sibling list
* (see gtk_cell_area_add_focus_sibling()).
*
* Deprecated: 4.10
*/
void
gtk_cell_area_remove_focus_sibling (GtkCellArea *area,
@@ -3003,6 +3077,8 @@ gtk_cell_area_remove_focus_sibling (GtkCellArea *area,
* (see gtk_cell_area_add_focus_sibling()).
*
* Returns: %TRUE if @sibling is a focus sibling of @renderer
*
* Deprecated: 4.10
*/
gboolean
gtk_cell_area_is_focus_sibling (GtkCellArea *area,
@@ -3038,6 +3114,8 @@ gtk_cell_area_is_focus_sibling (GtkCellArea *area,
*
* Returns: (element-type GtkCellRenderer) (transfer none): A `GList` of `GtkCellRenderer`s.
* The returned list is internal and should not be freed.
*
* Deprecated: 4.10
*/
const GList *
gtk_cell_area_get_focus_siblings (GtkCellArea *area,
@@ -3066,6 +3144,8 @@ gtk_cell_area_get_focus_siblings (GtkCellArea *area,
*
* Returns: (nullable) (transfer none): the `GtkCellRenderer`
* for which @renderer is a sibling
*
* Deprecated: 4.10
*/
GtkCellRenderer *
gtk_cell_area_get_focus_from_sibling (GtkCellArea *area,
@@ -3205,6 +3285,8 @@ gtk_cell_area_set_edit_widget (GtkCellArea *area,
* being edited.
*
* Returns: (transfer none) (nullable): The currently edited `GtkCellRenderer`
*
* Deprecated: 4.10
*/
GtkCellRenderer *
gtk_cell_area_get_edited_cell (GtkCellArea *area)
@@ -3224,6 +3306,8 @@ gtk_cell_area_get_edited_cell (GtkCellArea *area)
* to edit the currently edited cell.
*
* Returns: (transfer none) (nullable): The currently active `GtkCellEditable` widget
*
* Deprecated: 4.10
*/
GtkCellEditable *
gtk_cell_area_get_edit_widget (GtkCellArea *area)
@@ -3251,6 +3335,8 @@ gtk_cell_area_get_edit_widget (GtkCellArea *area)
* implementation.
*
* Returns: whether cell activation was successful
*
* Deprecated: 4.10
*/
gboolean
gtk_cell_area_activate_cell (GtkCellArea *area,
@@ -3344,6 +3430,8 @@ gtk_cell_area_activate_cell (GtkCellArea *area,
* edit widget.
*
* See gtk_cell_area_get_edited_cell() and gtk_cell_area_get_edit_widget().
*
* Deprecated: 4.10
*/
void
gtk_cell_area_stop_editing (GtkCellArea *area,
@@ -3396,6 +3484,8 @@ gtk_cell_area_stop_editing (GtkCellArea *area,
* This is a convenience function for `GtkCellArea` implementations
* to get the inner area where a given `GtkCellRenderer` will be
* rendered. It removes any padding previously added by gtk_cell_area_request_renderer().
*
* Deprecated: 4.10
*/
void
gtk_cell_area_inner_cell_area (GtkCellArea *area,
@@ -3448,6 +3538,8 @@ gtk_cell_area_inner_cell_area (GtkCellArea *area,
* function to request size and then use gtk_cell_area_inner_cell_area()
* at render and event time since this function will add padding
* around the cell for focus painting.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_request_renderer (GtkCellArea *area,
@@ -26,9 +26,9 @@
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkcellrenderer.h>
#include <gtk/gtkwidget.h>
#include <gtk/gtktreemodel.h>
#include <gtk/deprecated/gtkcellrenderer.h>
#include <gtk/deprecated/gtktreemodel.h>
G_BEGIN_DECLS
@@ -269,20 +269,20 @@ GDK_AVAILABLE_IN_ALL
GType gtk_cell_area_get_type (void) G_GNUC_CONST;
/* Basic methods */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_add (GtkCellArea *area,
GtkCellRenderer *renderer);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_remove (GtkCellArea *area,
GtkCellRenderer *renderer);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_cell_area_has_renderer (GtkCellArea *area,
GtkCellRenderer *renderer);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_foreach (GtkCellArea *area,
GtkCellCallback callback,
gpointer callback_data);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_foreach_alloc (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
@@ -290,14 +290,14 @@ void gtk_cell_area_foreach_alloc (GtkCellArea
const GdkRectangle *background_area,
GtkCellAllocCallback callback,
gpointer callback_data);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
int gtk_cell_area_event (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
GdkEvent *event,
const GdkRectangle *cell_area,
GtkCellRendererState flags);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_snapshot (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
@@ -307,14 +307,14 @@ void gtk_cell_area_snapshot (GtkCellArea
GtkCellRendererState flags,
gboolean paint_focus);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_get_cell_allocation (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
GtkCellRenderer *renderer,
const GdkRectangle *cell_area,
GdkRectangle *allocation);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkCellRenderer *gtk_cell_area_get_cell_at_position (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
@@ -324,179 +324,179 @@ GtkCellRenderer *gtk_cell_area_get_cell_at_position (GtkCellArea
GdkRectangle *alloc_area);
/* Geometry */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkCellAreaContext *gtk_cell_area_create_context (GtkCellArea *area);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkCellAreaContext *gtk_cell_area_copy_context (GtkCellArea *area,
GtkCellAreaContext *context);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkSizeRequestMode gtk_cell_area_get_request_mode (GtkCellArea *area);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_get_preferred_width (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
int *minimum_width,
int *natural_width);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_get_preferred_height_for_width (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
int width,
int *minimum_height,
int *natural_height);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_get_preferred_height (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
int *minimum_height,
int *natural_height);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_get_preferred_width_for_height (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
int height,
int *minimum_width,
int *natural_width);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
const char * gtk_cell_area_get_current_path_string (GtkCellArea *area);
/* Attributes */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_apply_attributes (GtkCellArea *area,
GtkTreeModel *tree_model,
GtkTreeIter *iter,
gboolean is_expander,
gboolean is_expanded);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_attribute_connect (GtkCellArea *area,
GtkCellRenderer *renderer,
const char *attribute,
int column);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_attribute_disconnect (GtkCellArea *area,
GtkCellRenderer *renderer,
const char *attribute);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
int gtk_cell_area_attribute_get_column (GtkCellArea *area,
GtkCellRenderer *renderer,
const char *attribute);
/* Cell Properties */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_class_install_cell_property (GtkCellAreaClass *aclass,
guint property_id,
GParamSpec *pspec);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GParamSpec* gtk_cell_area_class_find_cell_property (GtkCellAreaClass *aclass,
const char *property_name);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GParamSpec** gtk_cell_area_class_list_cell_properties (GtkCellAreaClass *aclass,
guint *n_properties);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_add_with_properties (GtkCellArea *area,
GtkCellRenderer *renderer,
const char *first_prop_name,
...) G_GNUC_NULL_TERMINATED;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_cell_set (GtkCellArea *area,
GtkCellRenderer *renderer,
const char *first_prop_name,
...) G_GNUC_NULL_TERMINATED;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_cell_get (GtkCellArea *area,
GtkCellRenderer *renderer,
const char *first_prop_name,
...) G_GNUC_NULL_TERMINATED;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_cell_set_valist (GtkCellArea *area,
GtkCellRenderer *renderer,
const char *first_property_name,
va_list var_args);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_cell_get_valist (GtkCellArea *area,
GtkCellRenderer *renderer,
const char *first_property_name,
va_list var_args);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_cell_set_property (GtkCellArea *area,
GtkCellRenderer *renderer,
const char *property_name,
const GValue *value);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_cell_get_property (GtkCellArea *area,
GtkCellRenderer *renderer,
const char *property_name,
GValue *value);
/* Focus */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_cell_area_is_activatable (GtkCellArea *area);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_cell_area_activate (GtkCellArea *area,
GtkCellAreaContext *context,
GtkWidget *widget,
const GdkRectangle *cell_area,
GtkCellRendererState flags,
gboolean edit_only);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_cell_area_focus (GtkCellArea *area,
GtkDirectionType direction);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_set_focus_cell (GtkCellArea *area,
GtkCellRenderer *renderer);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkCellRenderer *gtk_cell_area_get_focus_cell (GtkCellArea *area);
/* Focus siblings */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_add_focus_sibling (GtkCellArea *area,
GtkCellRenderer *renderer,
GtkCellRenderer *sibling);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_remove_focus_sibling (GtkCellArea *area,
GtkCellRenderer *renderer,
GtkCellRenderer *sibling);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_cell_area_is_focus_sibling (GtkCellArea *area,
GtkCellRenderer *renderer,
GtkCellRenderer *sibling);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
const GList * gtk_cell_area_get_focus_siblings (GtkCellArea *area,
GtkCellRenderer *renderer);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkCellRenderer *gtk_cell_area_get_focus_from_sibling (GtkCellArea *area,
GtkCellRenderer *renderer);
/* Cell Activation/Editing */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkCellRenderer *gtk_cell_area_get_edited_cell (GtkCellArea *area);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkCellEditable *gtk_cell_area_get_edit_widget (GtkCellArea *area);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_cell_area_activate_cell (GtkCellArea *area,
GtkWidget *widget,
GtkCellRenderer *renderer,
GdkEvent *event,
const GdkRectangle *cell_area,
GtkCellRendererState flags);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_stop_editing (GtkCellArea *area,
gboolean canceled);
/* Functions for area implementations */
/* Distinguish the inner cell area from the whole requested area including margins */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_inner_cell_area (GtkCellArea *area,
GtkWidget *widget,
const GdkRectangle *cell_area,
GdkRectangle *inner_area);
/* Request the size of a cell while respecting the cell margins (requests are margin inclusive) */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_request_renderer (GtkCellArea *area,
GtkCellRenderer *renderer,
GtkOrientation orientation,
@@ -42,16 +42,20 @@
* configured by configuring the `GtkCellAreaBox` align child cell property
* with gtk_cell_area_cell_set_property() or by specifying the "align"
* argument to gtk_cell_area_box_pack_start() and gtk_cell_area_box_pack_end().
*
* Deprecated: 4.10: List views use widgets for displaying their
* contents
*/
#include "config.h"
#include "gtkorientable.h"
#include "gtkcelllayout.h"
#include "deprecated/gtkcelllayout.h"
#include "gtkcellareabox.h"
#include "gtkcellareaboxcontextprivate.h"
#include "gtktypebuiltins.h"
#include "gtkprivate.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* GObjectClass */
static void gtk_cell_area_box_finalize (GObject *object);
@@ -501,7 +505,7 @@ cell_groups_rebuild (GtkCellAreaBox *box)
CellInfo *info = l->data;
/* A new group starts with any aligned cell, or
* at the beginning and end of a fixed size cell.
* at the beginning and end of a fixed size cell.
* the first group is implied */
if ((info->align || info->fixed || last_cell_fixed) && l != cells)
{
@@ -891,7 +895,7 @@ get_allocated_cells (GtkCellAreaBox *box,
if (visible_cells == 0)
continue;
/* If were not aligned, place the cell after the last cell
/* If were not aligned, place the cell after the last cell
* and eat up the extra space
*/
if (group->align)
@@ -2085,7 +2089,7 @@ _gtk_cell_area_box_group_visible (GtkCellAreaBox *box,
{
GtkCellAreaBoxPrivate *priv = gtk_cell_area_box_get_instance_private (box);
CellGroup *group;
g_assert (group_idx >= 0 && group_idx < priv->groups->len);
group = &g_array_index (priv->groups, CellGroup, group_idx);
@@ -2103,6 +2107,8 @@ _gtk_cell_area_box_group_visible (GtkCellAreaBox *box,
* Creates a new `GtkCellAreaBox`.
*
* Returns: a newly created `GtkCellAreaBox`
*
* Deprecated: 4.10
*/
GtkCellArea *
gtk_cell_area_box_new (void)
@@ -2123,6 +2129,8 @@ gtk_cell_area_box_new (void)
*
* The @renderer is packed after any other `GtkCellRenderer` packed
* with reference to the start of @box.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_box_pack_start (GtkCellAreaBox *box,
@@ -2164,6 +2172,8 @@ gtk_cell_area_box_pack_start (GtkCellAreaBox *box,
*
* The @renderer is packed after (away from end of) any other
* `GtkCellRenderer` packed with reference to the end of @box.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_box_pack_end (GtkCellAreaBox *box,
@@ -2199,6 +2209,8 @@ gtk_cell_area_box_pack_end (GtkCellAreaBox *box,
* Gets the spacing added between cell renderers.
*
* Returns: the space added between cell renderers in @box.
*
* Deprecated: 4.10
*/
int
gtk_cell_area_box_get_spacing (GtkCellAreaBox *box)
@@ -2216,6 +2228,8 @@ gtk_cell_area_box_get_spacing (GtkCellAreaBox *box)
* @spacing: the space to add between `GtkCellRenderer`s
*
* Sets the spacing to add between cell renderers in @box.
*
* Deprecated: 4.10
*/
void
gtk_cell_area_box_set_spacing (GtkCellAreaBox *box,
@@ -26,7 +26,7 @@
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkcellarea.h>
#include <gtk/deprecated/gtkcellarea.h>
G_BEGIN_DECLS
@@ -39,23 +39,23 @@ typedef struct _GtkCellAreaBox GtkCellAreaBox;
GDK_AVAILABLE_IN_ALL
GType gtk_cell_area_box_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkCellArea *gtk_cell_area_box_new (void);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_box_pack_start (GtkCellAreaBox *box,
GtkCellRenderer *renderer,
gboolean expand,
gboolean align,
gboolean fixed);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_box_pack_end (GtkCellAreaBox *box,
GtkCellRenderer *renderer,
gboolean expand,
gboolean align,
gboolean fixed);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
int gtk_cell_area_box_get_spacing (GtkCellAreaBox *box);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_cell_area_box_set_spacing (GtkCellAreaBox *box,
int spacing);
@@ -26,6 +26,8 @@
#include "gtkprivate.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* GObjectClass */
static void _gtk_cell_area_box_context_finalize (GObject *object);
@@ -137,7 +139,7 @@ get_array (GtkCellAreaBoxContext *context,
return array;
}
static gboolean
static gboolean
group_expands (GtkCellAreaBoxContext *context,
int group_idx)
{
@@ -159,7 +161,7 @@ count_expand_groups (GtkCellAreaBoxContext *context)
if (priv->expand[i])
expand++;
}
return expand;
}
@@ -180,7 +182,7 @@ _gtk_cell_area_box_context_init (GtkCellAreaBoxContext *box_context)
NULL, (GDestroyNotify)free_cache_array);
}
static void
static void
_gtk_cell_area_box_context_class_init (GtkCellAreaBoxContextClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
@@ -265,11 +267,11 @@ _gtk_cell_area_box_context_sum (GtkCellAreaBoxContext *context,
box_orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (area));
array = get_array (context, orientation, for_size);
/* Get the last visible aligned group
/* Get the last visible aligned group
* (we need to get space at least up till this group) */
for (i = array->len - 1; i >= 0; i--)
{
if (priv->align[i] &&
if (priv->align[i] &&
_gtk_cell_area_box_group_visible (area, i))
break;
}
@@ -324,7 +326,7 @@ _gtk_cell_area_box_context_get_preferred_height_for_width (GtkCellAreaContext *c
int *minimum_height,
int *natural_height)
{
_gtk_cell_area_box_context_sum (GTK_CELL_AREA_BOX_CONTEXT (context), GTK_ORIENTATION_VERTICAL,
_gtk_cell_area_box_context_sum (GTK_CELL_AREA_BOX_CONTEXT (context), GTK_ORIENTATION_VERTICAL,
width, minimum_height, natural_height);
}
@@ -334,7 +336,7 @@ _gtk_cell_area_box_context_get_preferred_width_for_height (GtkCellAreaContext *c
int *minimum_width,
int *natural_width)
{
_gtk_cell_area_box_context_sum (GTK_CELL_AREA_BOX_CONTEXT (context), GTK_ORIENTATION_HORIZONTAL,
_gtk_cell_area_box_context_sum (GTK_CELL_AREA_BOX_CONTEXT (context), GTK_ORIENTATION_HORIZONTAL,
height, minimum_width, natural_width);
}
@@ -684,11 +686,11 @@ _gtk_cell_area_box_context_get_requests (GtkCellAreaBoxContext *box_context,
int last_aligned_group_idx = 0;
int i, j;
/* Get the last visible aligned group
/* Get the last visible aligned group
* (we need to get space at least up till this group) */
for (i = priv->base_widths->len - 1; i >= 0; i--)
{
if (priv->align[i] &&
if (priv->align[i] &&
_gtk_cell_area_box_group_visible (area, i))
break;
}
@@ -844,11 +846,11 @@ _gtk_cell_area_box_context_get_orientation_allocs (GtkCellAreaBoxContext *contex
gtk_cell_area_context_get_allocation (ctx, &width, &height);
if (orientation == GTK_ORIENTATION_HORIZONTAL && width > 0)
allocs = allocate_for_orientation (context, area, orientation,
allocs = allocate_for_orientation (context, area, orientation,
spacing, width, height,
&alloc_count);
else if (orientation == GTK_ORIENTATION_VERTICAL && height > 0)
allocs = allocate_for_orientation (context, area, orientation,
allocs = allocate_for_orientation (context, area, orientation,
spacing, height, width,
&alloc_count);
@@ -26,9 +26,9 @@
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkcellareacontext.h>
#include <gtk/gtkcellareabox.h>
#include <gtk/gtkcellrenderer.h>
#include <gtk/deprecated/gtkcellareacontext.h>
#include <gtk/deprecated/gtkcellareabox.h>
#include <gtk/deprecated/gtkcellrenderer.h>
#include <gtk/gtksizerequest.h>
G_BEGIN_DECLS

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