Compare commits

..

183 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
3b4b1c6878

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
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
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
217 changed files with 12627 additions and 7045 deletions

View File

@@ -192,7 +192,6 @@ macos:
only:
- branches@GNOME/gtk
stage: build
allow_failure: true
tags:
- macos
needs: []
@@ -210,6 +209,7 @@ macos:
-Dintrospection=disabled
-Dcpp_std=c++11
-Dpixman:tests=disabled
-Dlibjpeg-turbo:simd=disabled
_build
- ninja -C _build
artifacts:

24
NEWS
View File

@@ -1,9 +1,11 @@
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.
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
@@ -15,7 +17,21 @@ GTK 5 release, which is still far away.
* gtk_render_ and gtk_snapshot_render_ APIs
have been deprecated
* GtkAppChooser widgets hae 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

View File

@@ -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

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

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

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>

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 {

View File

@@ -11,7 +11,6 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
G_DECLARE_FINAL_TYPE (CanvasItem, canvas_item, CANVAS, ITEM, GtkWidget)
@@ -26,6 +25,9 @@ struct _CanvasItem {
double delta;
GtkWidget *editor;
GtkStyleProvider *provider;
char *css_class;
};
struct _CanvasItemClass {
@@ -36,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);
@@ -71,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
@@ -724,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 ();
@@ -735,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));

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

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)

View File

@@ -23,6 +23,76 @@
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))
typedef struct {
@@ -95,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);
}
@@ -184,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
@@ -196,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
@@ -205,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);
@@ -472,8 +546,6 @@ update_display (void)
GString *s;
char *text;
gboolean has_feature;
GtkTreeIter iter;
GtkTreeModel *model;
PangoFontDescription *desc;
GList *l;
PangoAttrList *attrs;
@@ -518,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);
@@ -576,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;
@@ -610,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);
@@ -623,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));
@@ -698,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);
@@ -710,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);
@@ -740,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);
@@ -807,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];
@@ -839,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");
@@ -856,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 *
@@ -905,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)
{
@@ -955,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);
@@ -966,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);
@@ -989,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);
@@ -1048,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)
@@ -1074,8 +1125,6 @@ update_features (void)
}
}
}
g_free (feat);
}
}
@@ -1322,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;
@@ -1341,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;
@@ -1366,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)
{
@@ -1411,7 +1460,6 @@ instance_changed (GtkComboBox *combo)
}
out:
g_free (text);
g_clear_object (&pango_font);
g_free (ai);
g_free (coords);
@@ -1521,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);
@@ -1528,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;
}
@@ -1694,6 +1745,7 @@ do_font_features (GtkWidget *do_widget)
GtkBuilder *builder;
GtkBuilderScope *scope;
GtkEventController *controller;
GtkExpression *expression;
builder = gtk_builder_new ();
@@ -1727,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"));
@@ -1745,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);
@@ -1824,3 +1880,5 @@ do_font_features (GtkWidget *do_widget)
return window;
}
/* vim:set foldmethod=marker expandtab: */

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>

View File

@@ -10,8 +10,6 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *window = NULL;
static GtkWidget *font_button = NULL;
static GtkWidget *entry = NULL;
@@ -45,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;
@@ -56,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);
@@ -285,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;
@@ -420,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);

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>

View File

@@ -20,8 +20,6 @@
#include "gtkshadertoy.h"
#include "gskshaderpaintable.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *demo_window = NULL;
static void
@@ -146,7 +144,6 @@ make_shader_stack (const char *name,
GtkTextBuffer *buffer;
GBytes *bytes;
GtkEventController *controller;
GtkCssProvider *provider;
GdkPaintable *paintable;
stack = gtk_shader_stack_new ();
@@ -237,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");
@@ -276,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));
@@ -335,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;
}

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 */

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 *

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;
}

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);

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);
}

View File

@@ -10,8 +10,6 @@
#include "script-names.h"
#include "unicode-names.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
#define UCD_TYPE_ITEM (ucd_item_get_type ())
G_DECLARE_FINAL_TYPE (UcdItem, ucd_item, UCD, ITEM, GObject)
@@ -339,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)
{
@@ -361,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);
@@ -371,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))

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 *

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);

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;

View File

@@ -8,7 +8,6 @@
#include "config.h"
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* Create an object for the pegs that get moved around in the game.
*
@@ -361,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)
{
@@ -377,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);
@@ -395,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)
@@ -441,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

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,55 +66,41 @@ 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);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
picker = gtk_app_chooser_button_new ("x-scheme-handler/mailto");
gtk_app_chooser_button_set_show_dialog_item (GTK_APP_CHOOSER_BUTTON (picker), TRUE);

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)

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);
}

View File

@@ -16,26 +16,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* 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,
@@ -43,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);
@@ -52,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

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);

View File

@@ -11,7 +11,6 @@
#include <stdlib.h> /* for exit() */
#include "paintable.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void easter_egg_callback (GtkWidget *button, gpointer data);
@@ -431,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)
{

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

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)

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

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
@@ -1093,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);
}
}
@@ -1462,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));

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

View File

@@ -72,3 +72,28 @@ 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.

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[] = {

View File

@@ -352,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;
@@ -361,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;
@@ -390,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;
@@ -401,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;
@@ -426,6 +427,7 @@ edit_accels (GSimpleAction *action,
char **actions;
GtkWidget *dialog;
int i;
GtkStringList *strings;
dialog = gtk_dialog_new_with_buttons ("Accelerators",
NULL,
@@ -437,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,
@@ -448,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);
@@ -460,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);
}

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;

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"
@@ -216,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;
@@ -494,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;

View File

@@ -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

View File

@@ -69,9 +69,13 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* [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;
@@ -312,7 +316,7 @@ gtk_app_chooser_sort_func (GtkTreeModel *model,
retval = 1;
goto out;
}
/* the recommended one always wins */
if (a_recommended && !b_recommended)
{
@@ -444,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;

View File

@@ -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"

View File

@@ -42,6 +42,9 @@
* 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"
@@ -502,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)
{
@@ -892,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)
@@ -2086,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);

View File

@@ -139,7 +139,7 @@ get_array (GtkCellAreaBoxContext *context,
return array;
}
static gboolean
static gboolean
group_expands (GtkCellAreaBoxContext *context,
int group_idx)
{
@@ -161,7 +161,7 @@ count_expand_groups (GtkCellAreaBoxContext *context)
if (priv->expand[i])
expand++;
}
return expand;
}
@@ -182,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);
@@ -267,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;
}
@@ -326,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);
}
@@ -336,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);
}
@@ -686,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;
}
@@ -846,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);

View File

@@ -23,6 +23,9 @@
* The `GtkCellEditable` interface must be implemented for widgets to be usable
* to edit the contents of a `GtkTreeView` cell. It provides a way to specify how
* temporary widgets should be configured for editing, get the new value, etc.
*
* Deprecated: 4.10: List views use widgets for displaying their
* contents. See [iface@Gtk.Editable] for editable text widgets
*/
#include "config.h"

View File

@@ -24,7 +24,7 @@
* want to provide a `GtkTreeViewColumn` like API for packing cells,
* setting attributes and data funcs.
*
* One of the notable features provided by implementations of
* One of the notable features provided by implementations of
* `GtkCellLayout` are attributes. Attributes let you set the properties
* in flexible ways. They can just be set to constant values like regular
* properties. But they can also be mapped to a column of the underlying
@@ -34,7 +34,7 @@
* gtk_cell_layout_set_cell_data_func() that is called to determine the
* value of the attribute for each cell that is rendered.
*
* # GtkCellLayouts as GtkBuildable
* ## GtkCellLayouts as GtkBuildable
*
* Implementations of GtkCellLayout which also implement the GtkBuildable
* interface (`GtkCellView`, `GtkIconView`, `GtkComboBox`,
@@ -78,7 +78,7 @@
* </object>
* ```
*
* # Subclassing GtkCellLayout implementations
* ## Subclassing GtkCellLayout implementations
*
* When subclassing a widget that implements `GtkCellLayout` like
* `GtkIconView` or `GtkComboBox`, there are some considerations related
@@ -126,6 +126,9 @@
* to support alternative cell areas, you can do so by moving the
* problematic calls out of `init()` and into a `constructor()`
* for your class.
*
* Deprecated: 4.10: List views use widgets to display their contents.
* See [class@Gtk.LayoutManager] for layout manager delegate objects
*/
#include "config.h"
@@ -281,8 +284,8 @@ gtk_cell_layout_default_set_cell_data_func (GtkCellLayout *cell_layout,
area = iface->get_area (cell_layout);
if (area)
_gtk_cell_area_set_cell_data_func_with_proxy (area, cell,
(GFunc)func, func_data, destroy,
_gtk_cell_area_set_cell_data_func_with_proxy (area, cell,
(GFunc)func, func_data, destroy,
cell_layout);
else
warn_no_cell_area ("GtkCellLayoutIface->set_cell_data_func()");
@@ -446,7 +449,7 @@ gtk_cell_layout_set_attributesv (GtkCellLayout *cell_layout,
* @cell: a `GtkCellRenderer`
* @...: a %NULL-terminated list of attributes
*
* Sets the attributes in the parameter list as the attributes
* Sets the attributes in the parameter list as the attributes
* of @cell_layout.
*
* See [method@Gtk.CellLayout.add_attribute] for more details.
@@ -531,7 +534,7 @@ gtk_cell_layout_set_cell_data_func (GtkCellLayout *cell_layout,
g_return_if_fail (GTK_IS_CELL_LAYOUT (cell_layout));
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
GTK_CELL_LAYOUT_GET_IFACE
GTK_CELL_LAYOUT_GET_IFACE
(cell_layout)->set_cell_data_func (cell_layout, cell, func, func_data, destroy);
}
@@ -619,7 +622,7 @@ gtk_cell_layout_get_area (GtkCellLayout *cell_layout)
g_return_val_if_fail (GTK_IS_CELL_LAYOUT (cell_layout), NULL);
iface = GTK_CELL_LAYOUT_GET_IFACE (cell_layout);
iface = GTK_CELL_LAYOUT_GET_IFACE (cell_layout);
if (iface->get_area)
return iface->get_area (cell_layout);

View File

@@ -68,6 +68,9 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* corresponding “set” property, e.g. “cell-background-set” corresponds
* to “cell-background”. These “set” properties reflect whether a property
* has been set or not. You should not set them independently.
*
* Deprecated: 4.10: List views use widgets for displaying their
* contents
*/
@@ -213,7 +216,7 @@ gtk_cell_renderer_class_init (GtkCellRendererClass *class)
*
* This signal gets emitted when the user cancels the process of editing a
* cell. For example, an editable cell renderer could be written to cancel
* editing when the user presses Escape.
* editing when the user presses Escape.
*
* See also: gtk_cell_renderer_stop_editing().
*/
@@ -251,12 +254,12 @@ gtk_cell_renderer_class_init (GtkCellRendererClass *class)
* const char *path,
* gpointer data)
* {
* if (GTK_IS_ENTRY (editable))
* if (GTK_IS_ENTRY (editable))
* {
* GtkEntry *entry = GTK_ENTRY (editable);
*
*
* // ... create a GtkEntryCompletion
*
*
* gtk_entry_set_completion (entry, completion);
* }
* }
@@ -628,7 +631,7 @@ set_cell_bg_color (GtkCellRenderer *cell,
* @cell: a `GtkCellRenderer`
* @snapshot: a `GtkSnapshot` to draw to
* @widget: the widget owning @window
* @background_area: entire cell area (including tree expanders and maybe
* @background_area: entire cell area (including tree expanders and maybe
* padding on the sides)
* @cell_area: area normally rendered by a cell renderer
* @flags: flags that affect rendering
@@ -802,7 +805,7 @@ gtk_cell_renderer_start_editing (GtkCellRenderer *cell,
gtk_widget_add_css_class (GTK_WIDGET (editable), "cell");
g_signal_emit (cell,
g_signal_emit (cell,
cell_renderer_signals[EDITING_STARTED], 0,
editable, path);
@@ -1196,7 +1199,7 @@ gtk_cell_renderer_real_get_preferred_size (GtkCellRenderer *cell,
}
}
static GtkSizeRequestMode
static GtkSizeRequestMode
gtk_cell_renderer_real_get_request_mode (GtkCellRenderer *cell)
{
/* By default cell renderers are height-for-width. */
@@ -1209,7 +1212,7 @@ gtk_cell_renderer_real_get_preferred_width (GtkCellRenderer *cell,
int *minimum_size,
int *natural_size)
{
gtk_cell_renderer_real_get_preferred_size (cell, widget, GTK_ORIENTATION_HORIZONTAL,
gtk_cell_renderer_real_get_preferred_size (cell, widget, GTK_ORIENTATION_HORIZONTAL,
minimum_size, natural_size);
}
@@ -1219,7 +1222,7 @@ gtk_cell_renderer_real_get_preferred_height (GtkCellRenderer *cell,
int *minimum_size,
int *natural_size)
{
gtk_cell_renderer_real_get_preferred_size (cell, widget, GTK_ORIENTATION_VERTICAL,
gtk_cell_renderer_real_get_preferred_size (cell, widget, GTK_ORIENTATION_VERTICAL,
minimum_size, natural_size);
}
@@ -1268,35 +1271,35 @@ gtk_cell_renderer_real_get_aligned_area (GtkCellRenderer *cell,
/* Trim up the aligned size */
if (gtk_cell_renderer_get_request_mode (cell) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
{
gtk_cell_renderer_get_preferred_width (cell, widget,
gtk_cell_renderer_get_preferred_width (cell, widget,
NULL, &natural_size);
aligned_area->width = MIN (aligned_area->width, natural_size);
gtk_cell_renderer_get_preferred_height_for_width (cell, widget,
aligned_area->width,
gtk_cell_renderer_get_preferred_height_for_width (cell, widget,
aligned_area->width,
NULL, &opposite_size);
aligned_area->height = MIN (opposite_size, aligned_area->height);
}
else
{
gtk_cell_renderer_get_preferred_height (cell, widget,
gtk_cell_renderer_get_preferred_height (cell, widget,
NULL, &natural_size);
aligned_area->height = MIN (aligned_area->width, natural_size);
gtk_cell_renderer_get_preferred_width_for_height (cell, widget,
aligned_area->height,
gtk_cell_renderer_get_preferred_width_for_height (cell, widget,
aligned_area->height,
NULL, &opposite_size);
aligned_area->width = MIN (opposite_size, aligned_area->width);
}
/* offset the cell position */
_gtk_cell_renderer_calc_offset (cell, cell_area,
_gtk_cell_renderer_calc_offset (cell, cell_area,
gtk_widget_get_direction (widget),
aligned_area->width,
aligned_area->width,
aligned_area->height,
&x_offset, &y_offset);
@@ -1319,7 +1322,7 @@ _gtk_cell_renderer_calc_offset (GtkCellRenderer *cell,
int height,
int *x_offset,
int *y_offset)
{
{
GtkCellRendererPrivate *priv;
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
@@ -1331,7 +1334,7 @@ _gtk_cell_renderer_calc_offset (GtkCellRenderer *cell,
if (x_offset)
{
*x_offset = (((direction == GTK_TEXT_DIR_RTL) ?
(1.0 - priv->xalign) : priv->xalign) *
(1.0 - priv->xalign) : priv->xalign) *
(cell_area->width - width));
*x_offset = MAX (*x_offset, 0);
}
@@ -1403,8 +1406,8 @@ gtk_cell_renderer_get_preferred_width (GtkCellRenderer *cell,
#if DEBUG_CELL_SIZE_REQUEST
g_message ("%s returning minimum width: %d and natural width: %d",
G_OBJECT_TYPE_NAME (cell),
minimum_size ? *minimum_size : 20000,
G_OBJECT_TYPE_NAME (cell),
minimum_size ? *minimum_size : 20000,
natural_size ? *natural_size : 20000);
#endif
}
@@ -1451,8 +1454,8 @@ gtk_cell_renderer_get_preferred_height (GtkCellRenderer *cell,
#if DEBUG_CELL_SIZE_REQUEST
g_message ("%s returning minimum height: %d and natural height: %d",
G_OBJECT_TYPE_NAME (cell),
minimum_size ? *minimum_size : 20000,
G_OBJECT_TYPE_NAME (cell),
minimum_size ? *minimum_size : 20000,
natural_size ? *natural_size : 20000);
#endif
}
@@ -1466,7 +1469,7 @@ gtk_cell_renderer_get_preferred_height (GtkCellRenderer *cell,
* @minimum_width: (out) (optional): location for storing the minimum size
* @natural_width: (out) (optional): location for storing the preferred size
*
* Retrieves a cell rendererss minimum and natural width if it were rendered to
* Retrieves a cell rendererss minimum and natural width if it were rendered to
* @widget with the specified @height.
*
* Deprecated: 4.10
@@ -1503,7 +1506,7 @@ gtk_cell_renderer_get_preferred_width_for_height (GtkCellRenderer *cell,
#if DEBUG_CELL_SIZE_REQUEST
g_message ("%s width for height: %d is minimum %d and natural: %d",
G_OBJECT_TYPE_NAME (cell), height,
minimum_width ? *minimum_width : 20000,
minimum_width ? *minimum_width : 20000,
natural_width ? *natural_width : 20000);
#endif
}
@@ -1516,7 +1519,7 @@ gtk_cell_renderer_get_preferred_width_for_height (GtkCellRenderer *cell,
* @minimum_height: (out) (optional): location for storing the minimum size
* @natural_height: (out) (optional): location for storing the preferred size
*
* Retrieves a cell rendererss minimum and natural height if it were rendered to
* Retrieves a cell rendererss minimum and natural height if it were rendered to
* @widget with the specified @width.
*
* Deprecated: 4.10
@@ -1553,7 +1556,7 @@ gtk_cell_renderer_get_preferred_height_for_width (GtkCellRenderer *cell,
#if DEBUG_CELL_SIZE_REQUEST
g_message ("%s height for width: %d is minimum %d and natural: %d",
G_OBJECT_TYPE_NAME (cell), width,
minimum_height ? *minimum_height : 20000,
minimum_height ? *minimum_height : 20000,
natural_height ? *natural_height : 20000);
#endif
}

View File

@@ -41,6 +41,10 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* `GtkCellRendererAccel` displays a keyboard accelerator (i.e. a key
* combination like `Control + a`). If the cell renderer is editable,
* the accelerator can be changed by simply typing the new combination.
*
* Deprecated: 4.10: Applications editing keyboard accelerators should
* provide their own implementation according to platform design
* guidelines
*/
@@ -52,7 +56,7 @@ static void gtk_cell_renderer_accel_set_property (GObject *object,
guint param_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_cell_renderer_accel_get_preferred_width
static void gtk_cell_renderer_accel_get_preferred_width
(GtkCellRenderer *cell,
GtkWidget *widget,
int *minimum_size,
@@ -177,7 +181,7 @@ gtk_cell_renderer_accel_class_init (GtkCellRendererAccelClass *cell_accel_class)
G_MAXINT,
0,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/**
* GtkCellRendererAccel:accel-mods:
*
@@ -196,7 +200,7 @@ gtk_cell_renderer_accel_class_init (GtkCellRendererAccelClass *cell_accel_class)
* The hardware keycode of the accelerator. Note that the hardware keycode is
* only relevant if the key does not have a keyval. Normally, the keyboard
* configuration should assign keyvals to all keys.
*/
*/
g_object_class_install_property (object_class,
PROP_KEYCODE,
g_param_spec_uint ("keycode", NULL, NULL,
@@ -219,7 +223,7 @@ gtk_cell_renderer_accel_class_init (GtkCellRendererAccelClass *cell_accel_class)
GTK_TYPE_CELL_RENDERER_ACCEL_MODE,
GTK_CELL_RENDERER_ACCEL_MODE_GTK,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/**
* GtkCellRendererAccel::accel-edited:
* @accel: the object reveiving the signal
@@ -264,7 +268,7 @@ gtk_cell_renderer_accel_class_init (GtkCellRendererAccelClass *cell_accel_class)
* gtk_cell_renderer_accel_new:
*
* Creates a new `GtkCellRendererAccel`.
*
*
* Returns: the new cell renderer
*
* Deprecated: 4.10
@@ -288,7 +292,7 @@ convert_keysym_state_to_string (GtkCellRendererAccel *accel,
* a disabled accelerator key combination.
*/
return g_strdup (C_("Accelerator", "Disabled"));
else
else
{
if (priv->accel_mode == GTK_CELL_RENDERER_ACCEL_MODE_GTK)
{
@@ -301,7 +305,7 @@ convert_keysym_state_to_string (GtkCellRendererAccel *accel,
return gtk_accelerator_get_label (keysym, mask);
}
else
else
{
char *name;
@@ -402,7 +406,7 @@ gtk_cell_renderer_accel_set_property (GObject *object,
g_object_notify (object, "accel-mode");
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
}
@@ -537,7 +541,7 @@ key_controller_key_pressed (GtkEventControllerKey *key,
event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (key));
if (!gdk_key_event_get_match (event, &accel_key, &accel_mods))
return FALSE;
if (accel_mods == 0)
{
switch (keyval)
@@ -579,8 +583,8 @@ static void
gtk_cell_editable_widget_unrealize (GtkWidget *widget)
{
gtk_grab_remove (widget);
GTK_WIDGET_CLASS (gtk_cell_editable_widget_parent_class)->unrealize (widget);
GTK_WIDGET_CLASS (gtk_cell_editable_widget_parent_class)->unrealize (widget);
}
static void

View File

@@ -43,6 +43,9 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* box and sets it to display the column specified by its
* `GtkCellRendererCombo`:text-column property. Further properties of the combo box
* can be set in a handler for the `GtkCellRenderer::editing-started` signal.
*
* Deprecated: 4.10: List views use widgets to display their contents. You
* should use [class@Gtk.DropDown] instead
*/
typedef struct _GtkCellRendererComboPrivate GtkCellRendererComboPrivate;
@@ -125,7 +128,7 @@ gtk_cell_renderer_combo_class_init (GtkCellRendererComboClass *klass)
/**
* GtkCellRendererCombo:model:
*
* Holds a tree model containing the possible values for the combo box.
* Holds a tree model containing the possible values for the combo box.
* Use the text_column property to specify the column holding the values.
*/
g_object_class_install_property (object_class,
@@ -137,14 +140,14 @@ gtk_cell_renderer_combo_class_init (GtkCellRendererComboClass *klass)
/**
* GtkCellRendererCombo:text-column:
*
* Specifies the model column which holds the possible values for the
* combo box.
* Specifies the model column which holds the possible values for the
* combo box.
*
* Note that this refers to the model specified in the model property,
* not the model backing the tree view to which
* Note that this refers to the model specified in the model property,
* not the model backing the tree view to which
* this cell renderer is attached.
*
* `GtkCellRendererCombo` automatically adds a text cell renderer for
*
* `GtkCellRendererCombo` automatically adds a text cell renderer for
* this column to its combo box.
*/
g_object_class_install_property (object_class,
@@ -155,11 +158,11 @@ gtk_cell_renderer_combo_class_init (GtkCellRendererComboClass *klass)
-1,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/**
/**
* GtkCellRendererCombo:has-entry:
*
* If %TRUE, the cell renderer will include an entry and allow to enter
* values other than the ones in the popup list.
* If %TRUE, the cell renderer will include an entry and allow to enter
* values other than the ones in the popup list.
*/
g_object_class_install_property (object_class,
PROP_HAS_ENTRY,
@@ -232,7 +235,7 @@ gtk_cell_renderer_combo_init (GtkCellRendererCombo *self)
GtkCellRenderer *
gtk_cell_renderer_combo_new (void)
{
return g_object_new (GTK_TYPE_CELL_RENDERER_COMBO, NULL);
return g_object_new (GTK_TYPE_CELL_RENDERER_COMBO, NULL);
}
static void
@@ -240,13 +243,13 @@ gtk_cell_renderer_combo_finalize (GObject *object)
{
GtkCellRendererCombo *cell = GTK_CELL_RENDERER_COMBO (object);
GtkCellRendererComboPrivate *priv = gtk_cell_renderer_combo_get_instance_private (cell);
if (priv->model)
{
g_object_unref (priv->model);
priv->model = NULL;
}
G_OBJECT_CLASS (gtk_cell_renderer_combo_parent_class)->finalize (object);
}
@@ -263,7 +266,7 @@ gtk_cell_renderer_combo_get_property (GObject *object,
{
case PROP_MODEL:
g_value_set_object (value, priv->model);
break;
break;
case PROP_TEXT_COLUMN:
g_value_set_int (value, priv->text_column);
break;
@@ -369,7 +372,7 @@ gtk_cell_renderer_combo_editing_done (GtkCellEditable *combo,
entry = GTK_ENTRY (gtk_combo_box_get_child (GTK_COMBO_BOX (combo)));
new_text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (entry)));
}
else
else
{
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
@@ -395,17 +398,17 @@ gtk_cell_renderer_combo_focus_change (GtkWidget *widget,
gtk_cell_renderer_combo_editing_done (GTK_CELL_EDITABLE (widget), data);
}
typedef struct
typedef struct
{
GtkCellRendererCombo *cell;
gboolean found;
GtkTreeIter iter;
} SearchData;
static gboolean
find_text (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
static gboolean
find_text (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gpointer data)
{
SearchData *search_data = (SearchData *)data;
@@ -424,7 +427,7 @@ find_text (GtkTreeModel *model,
g_free (cell_text);
g_free (text);
return search_data->found;
}
@@ -474,7 +477,7 @@ gtk_cell_renderer_combo_start_editing (GtkCellRenderer *cell,
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), priv->model);
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo),
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo),
cell, "text", priv->text_column,
NULL);

View File

@@ -48,6 +48,9 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* renders that pixbuf, if the `GtkCellRenderer:is-expanded` property is %FALSE
* and the `GtkCellRendererPixbuf:pixbuf-expander-closed` property is set to a
* pixbuf, it renders that one.
*
* Deprecated: 4.10: List views use widgets to display their contents. You
* should use [class@Gtk.Image] for icons, and [class@Gtk.Picture] for images
*/
@@ -321,13 +324,13 @@ take_image_definition (GtkCellRendererPixbuf *cellpixbuf,
{
GtkCellRendererPixbufPrivate *priv = gtk_cell_renderer_pixbuf_get_instance_private (cellpixbuf);
GtkImageType old_storage_type, new_storage_type;
if (def == NULL)
def = gtk_image_definition_new_empty ();
old_storage_type = gtk_image_definition_get_storage_type (priv->image_def);
new_storage_type = gtk_image_definition_get_storage_type (def);
if (new_storage_type != old_storage_type)
notify_storage_type (cellpixbuf, old_storage_type);
@@ -401,7 +404,7 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object,
/**
* gtk_cell_renderer_pixbuf_new:
*
*
* Creates a new `GtkCellRendererPixbuf`. Adjust rendering
* parameters using object properties. Object properties can be set
* globally (with g_object_set()). Also, with `GtkTreeViewColumn`, you
@@ -409,7 +412,7 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object,
* can bind the “pixbuf” property on the cell renderer to a pixbuf value
* in the model, thus rendering a different image in each row of the
* `GtkTreeView`.
*
*
* Returns: the new cell renderer
*
* Deprecated: 4.10
@@ -469,7 +472,7 @@ gtk_cell_renderer_pixbuf_get_size (GtkCellRendererPixbuf *self,
pixbuf_height = gdk_paintable_get_intrinsic_height (paintable);
}
else
pixbuf_width = pixbuf_height = gtk_icon_helper_get_size (icon_helper);
pixbuf_width = pixbuf_height = gtk_icon_helper_get_size (icon_helper);
g_object_unref (icon_helper);
gtk_style_context_restore (context);
@@ -488,7 +491,7 @@ gtk_cell_renderer_pixbuf_get_size (GtkCellRendererPixbuf *self,
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
calc_width = (int) xpad * 2 + pixbuf_width;
calc_height = (int) ypad * 2 + pixbuf_height;
if (cell_area && pixbuf_width > 0 && pixbuf_height > 0)
{
float xalign, yalign;
@@ -516,7 +519,7 @@ gtk_cell_renderer_pixbuf_get_size (GtkCellRendererPixbuf *self,
if (width)
*width = calc_width;
if (height)
*height = calc_height;
}
@@ -540,7 +543,7 @@ gtk_cell_renderer_pixbuf_snapshot (GtkCellRenderer *cell,
gtk_cell_renderer_pixbuf_get_size (cellpixbuf, widget,
cell_area,
&pix_rect.x,
&pix_rect.x,
&pix_rect.y,
&pix_rect.width,
&pix_rect.height);

View File

@@ -42,6 +42,9 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
*
* `GtkCellRendererProgress` renders a numeric value as a progress par in a cell.
* Additionally, it can display a text on top of the progress bar.
*
* Deprecated: 4.10: List views use widgets to display their contents.
* You should use [class@Gtk.ProgressBar] instead
*/

View File

@@ -47,7 +47,8 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* of `GtkCellRendererSpin:digits` to display. Other `GtkSpinButton` properties
* can be set in a handler for the `GtkCellRenderer::editing-started` signal.
*
* The `GtkCellRendererSpin` cell renderer was added in GTK 2.10.
* Deprecated: 4.10: List views use widgets to display their contents.
* You should use [class@Gtk.SpinButton] instead
*/
typedef struct _GtkCellRendererSpinClass GtkCellRendererSpinClass;
@@ -122,7 +123,7 @@ gtk_cell_renderer_spin_class_init (GtkCellRendererSpinClass *klass)
/**
* GtkCellRendererSpin:adjustment:
*
* The adjustment that holds the value of the spinbutton.
* The adjustment that holds the value of the spinbutton.
* This must be non-%NULL for the cell renderer to be editable.
*/
g_object_class_install_property (object_class,
@@ -141,7 +142,7 @@ gtk_cell_renderer_spin_class_init (GtkCellRendererSpinClass *klass)
PROP_CLIMB_RATE,
g_param_spec_double ("climb-rate", NULL, NULL,
0.0, G_MAXDOUBLE, 0.0,
GTK_PARAM_READWRITE));
GTK_PARAM_READWRITE));
/**
* GtkCellRendererSpin:digits:
*
@@ -151,7 +152,7 @@ gtk_cell_renderer_spin_class_init (GtkCellRendererSpinClass *klass)
PROP_DIGITS,
g_param_spec_uint ("digits", NULL, NULL,
0, 20, 0,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
}
static void
@@ -366,7 +367,7 @@ gtk_cell_renderer_spin_start_editing (GtkCellRenderer *cell,
/**
* gtk_cell_renderer_spin_new:
*
* Creates a new `GtkCellRendererSpin`.
* Creates a new `GtkCellRendererSpin`.
*
* Returns: a new `GtkCellRendererSpin`
*

View File

@@ -54,6 +54,9 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* at regular intervals. The usual way to set the cell renderer properties
* for each cell is to bind them to columns in your tree model using e.g.
* gtk_tree_view_column_add_attribute().
*
* Deprecated: 4.10: List views use widgets to display their contents.
* You should use [class@Gtk.Spinner] instead
*/

View File

@@ -45,6 +45,9 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
*
* If the `GtkCellRenderer:mode` is %GTK_CELL_RENDERER_MODE_EDITABLE,
* the `GtkCellRendererText` allows to edit its text using an entry.
*
* Deprecated: 4.10: List views use widgets to display their contents.
* You should use [class@Gtk.Inscription] or [class@Gtk.Label] instead
*/
@@ -238,7 +241,7 @@ gtk_cell_renderer_text_class_init (GtkCellRendererTextClass *class)
GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (class);
object_class->finalize = gtk_cell_renderer_text_finalize;
object_class->get_property = gtk_cell_renderer_text_get_property;
object_class->set_property = gtk_cell_renderer_text_set_property;
@@ -623,7 +626,7 @@ gtk_cell_renderer_text_get_property (GObject *object,
case PROP_FONT:
g_value_take_string (value, pango_font_description_to_string (priv->font));
break;
case PROP_FONT_DESC:
g_value_set_boxed (value, priv->font);
break;
@@ -659,7 +662,7 @@ gtk_cell_renderer_text_get_property (GObject *object,
case PROP_SCALE:
g_value_set_double (value, priv->font_scale);
break;
case PROP_EDITABLE:
g_value_set_boolean (value, priv->editable);
break;
@@ -674,7 +677,7 @@ gtk_cell_renderer_text_get_property (GObject *object,
case PROP_RISE:
g_value_set_int (value, priv->rise);
break;
break;
case PROP_LANGUAGE:
g_value_set_static_string (value, pango_language_to_string (priv->language));
@@ -683,7 +686,7 @@ gtk_cell_renderer_text_get_property (GObject *object,
case PROP_ELLIPSIZE:
g_value_set_enum (value, priv->ellipsize);
break;
case PROP_WRAP_MODE:
g_value_set_enum (value, priv->wrap_mode);
break;
@@ -691,7 +694,7 @@ gtk_cell_renderer_text_get_property (GObject *object,
case PROP_WRAP_WIDTH:
g_value_set_int (value, priv->wrap_width);
break;
case PROP_ALIGN:
g_value_set_enum (value, priv->align);
break;
@@ -713,14 +716,14 @@ gtk_cell_renderer_text_get_property (GObject *object,
{
PangoFontMask mask = get_property_font_set_mask (param_id);
g_value_set_boolean (value, (pango_font_description_get_set_fields (priv->font) & mask) != 0);
break;
}
case PROP_SCALE_SET:
g_value_set_boolean (value, priv->scale_set);
break;
case PROP_EDITABLE_SET:
g_value_set_boolean (value, priv->editable_set);
break;
@@ -748,14 +751,14 @@ gtk_cell_renderer_text_get_property (GObject *object,
case PROP_ALIGN_SET:
g_value_set_boolean (value, priv->align_set);
break;
case PROP_WIDTH_CHARS:
g_value_set_int (value, priv->width_chars);
break;
break;
case PROP_MAX_WIDTH_CHARS:
g_value_set_int (value, priv->max_width_chars);
break;
break;
case PROP_PLACEHOLDER_TEXT:
g_value_set_string (value, priv->placeholder_text);
@@ -828,7 +831,7 @@ set_font_desc_fields (PangoFontDescription *desc,
PangoFontMask to_set)
{
PangoFontMask changed_mask = 0;
if (to_set & PANGO_FONT_MASK_FAMILY)
{
const char *family = pango_font_description_get_family (desc);
@@ -856,7 +859,7 @@ set_font_desc_fields (PangoFontDescription *desc,
size = 10 * PANGO_SCALE;
changed_mask |= PANGO_FONT_MASK_SIZE;
}
pango_font_description_set_size (desc, size);
}
@@ -1290,7 +1293,7 @@ gtk_cell_renderer_text_set_property (GObject *object,
/**
* gtk_cell_renderer_text_new:
*
*
* Creates a new `GtkCellRendererText`. Adjust how text is drawn using
* object properties. Object properties can be
* set globally (with g_object_set()). Also, with `GtkTreeViewColumn`,
@@ -1298,7 +1301,7 @@ gtk_cell_renderer_text_set_property (GObject *object,
* you can bind the “text” property on the cell renderer to a string
* value in the model, thus rendering a different string in each row
* of the `GtkTreeView`.
*
*
* Returns: the new cell renderer
*
* Deprecated: 4.10
@@ -1324,7 +1327,7 @@ add_attr (PangoAttrList *attr_list,
{
attr->start_index = 0;
attr->end_index = G_MAXINT;
pango_attr_list_insert (attr_list, attr);
}
@@ -1356,11 +1359,11 @@ get_layout (GtkCellRendererText *celltext,
if (!placeholder_layout && cell_area)
{
/* Add options that affect appearance but not size */
/* note that background doesn't go here, since it affects
* background_area not the PangoLayout area
*/
if (priv->foreground_set
&& (flags & GTK_CELL_RENDERER_SELECTED) == 0)
{
@@ -1497,7 +1500,7 @@ get_layout (GtkCellRendererText *celltext,
pango_layout_set_alignment (layout, align);
}
return layout;
}
@@ -1554,7 +1557,7 @@ get_size (GtkCellRenderer *cell,
gtk_cell_renderer_set_fixed_size (cell,
cell_width, 2 * ypad +
priv->fixed_height_rows * PANGO_PIXELS (row_height));
if (height)
{
*height = cell_height;
@@ -1731,7 +1734,7 @@ gtk_cell_renderer_text_start_editing (GtkCellRenderer *cell,
if (priv->text)
gtk_editable_set_text (GTK_EDITABLE (priv->entry), priv->text);
g_object_set_data_full (G_OBJECT (priv->entry), I_(GTK_CELL_RENDERER_TEXT_PATH), g_strdup (path), g_free);
gtk_editable_select_region (GTK_EDITABLE (priv->entry), 0, -1);
priv->in_entry_menu = FALSE;
@@ -1754,7 +1757,7 @@ gtk_cell_renderer_text_start_editing (GtkCellRenderer *cell,
* gtk_cell_renderer_text_set_fixed_height_from_font:
* @renderer: A `GtkCellRendererText`
* @number_of_rows: Number of rows of text each cell renderer is allocated, or -1
*
*
* Sets the height of a renderer to explicitly be determined by the “font” and
* “y_pad” property set on it. Further changes in these properties do not
* affect the height, so they must be accompanied by a subsequent call to this
@@ -1859,7 +1862,7 @@ gtk_cell_renderer_text_get_preferred_width (GtkCellRenderer *cell,
if (priv->max_width_chars > 0)
{
int max_width = xpad * 2 + PANGO_PIXELS (char_width) * priv->max_width_chars;
min_width = MIN (min_width, max_width);
nat_width = MIN (nat_width, max_width);
}
@@ -1931,7 +1934,7 @@ gtk_cell_renderer_text_get_aligned_area (GtkCellRenderer *cell,
int y_offset = 0;
layout = get_layout (celltext, widget, cell_area, flags);
get_size (cell, widget, cell_area, layout, &x_offset, &y_offset,
get_size (cell, widget, cell_area, layout, &x_offset, &y_offset,
&aligned_area->width, &aligned_area->height);
aligned_area->x = cell_area->x + x_offset;

View File

@@ -42,6 +42,9 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* button is drawn as a radio or a checkbutton, depending on the
* `GtkCellRendererToggle:radio` property.
* When activated, it emits the `GtkCellRendererToggle::toggled` signal.
*
* Deprecated: 4.10: List views use widgets to display their contents.
* You should use [class@Gtk.ToggleButton] instead
*/
@@ -190,7 +193,7 @@ gtk_cell_renderer_toggle_class_init (GtkCellRendererToggleClass *class)
cell_class->get_preferred_height = gtk_cell_renderer_toggle_get_preferred_height;
cell_class->snapshot = gtk_cell_renderer_toggle_snapshot;
cell_class->activate = gtk_cell_renderer_toggle_activate;
g_object_class_install_property (object_class,
PROP_ACTIVE,
g_param_spec_boolean ("active", NULL, NULL,
@@ -202,7 +205,7 @@ gtk_cell_renderer_toggle_class_init (GtkCellRendererToggleClass *class)
g_param_spec_boolean ("inconsistent", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
g_object_class_install_property (object_class,
PROP_ACTIVATABLE,
g_param_spec_boolean ("activatable", NULL, NULL,
@@ -215,14 +218,14 @@ gtk_cell_renderer_toggle_class_init (GtkCellRendererToggleClass *class)
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/**
* GtkCellRendererToggle::toggled:
* @cell_renderer: the object which received the signal
* @path: string representation of `GtkTreePath` describing the
* @path: string representation of `GtkTreePath` describing the
* event location
*
* The ::toggled signal is emitted when the cell is toggled.
* The ::toggled signal is emitted when the cell is toggled.
*
* It is the responsibility of the application to update the model
* with the correct value to store at @path. Often this is simply the
@@ -467,7 +470,7 @@ gtk_cell_renderer_toggle_snapshot (GtkCellRenderer *cell,
if (priv->inconsistent)
state |= GTK_STATE_FLAG_INCONSISTENT;
if (priv->active)
state |= GTK_STATE_FLAG_CHECKED;
@@ -528,7 +531,7 @@ gtk_cell_renderer_toggle_activate (GtkCellRenderer *cell,
* gtk_cell_renderer_toggle_set_radio:
* @toggle: a `GtkCellRendererToggle`
* @radio: %TRUE to make the toggle look like a radio button
*
*
* If @radio is %TRUE, the cell renderer renders a radio toggle
* (i.e. a toggle in a group of mutually-exclusive toggles).
* If %FALSE, it renders a check toggle (a standalone boolean option).
@@ -554,8 +557,8 @@ gtk_cell_renderer_toggle_set_radio (GtkCellRendererToggle *toggle,
* gtk_cell_renderer_toggle_get_radio:
* @toggle: a `GtkCellRendererToggle`
*
* Returns whether were rendering radio toggles rather than checkboxes.
*
* Returns whether were rendering radio toggles rather than checkboxes.
*
* Returns: %TRUE if were rendering radio toggles rather than checkboxes
*
* Deprecated: 4.10

View File

@@ -40,7 +40,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* A widget displaying a single row of a GtkTreeModel
*
* A `GtkCellView` displays a single row of a `GtkTreeModel` using a `GtkCellArea`
* and `GtkCellAreaContext`. A `GtkCellAreaContext` can be provided to the
* and `GtkCellAreaContext`. A `GtkCellAreaContext` can be provided to the
* `GtkCellView` at construction time in order to keep the cellview in context
* of a group of cell views, this ensures that the renderers displayed will
* be properly aligned with each other (like the aligned cells in the menus
@@ -53,9 +53,12 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* individual heights (left-to-right menus should be allocated vertically since
* they all share the same height but may have variable widths).
*
* # CSS nodes
* ## CSS nodes
*
* GtkCellView has a single CSS node with name cellview.
*
* Deprecated: 4.10: List views use widgets to display their contents.
* You can use [class@Gtk.Box] instead
*/
static void gtk_cell_view_constructed (GObject *object);
@@ -206,7 +209,7 @@ gtk_cell_view_class_init (GtkCellViewClass *klass)
*
* The `GtkCellArea` rendering cells
*
* If no area is specified when creating the cell view with gtk_cell_view_new_with_context()
* If no area is specified when creating the cell view with gtk_cell_view_new_with_context()
* a horizontally oriented `GtkCellArea`Box will be used.
*
* since 3.0
@@ -524,19 +527,19 @@ gtk_cell_view_request_model (GtkCellView *cellview,
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
if (for_size < 0)
gtk_cell_area_get_preferred_width (priv->area, priv->context,
gtk_cell_area_get_preferred_width (priv->area, priv->context,
GTK_WIDGET (cellview), &min, &nat);
else
gtk_cell_area_get_preferred_width_for_height (priv->area, priv->context,
gtk_cell_area_get_preferred_width_for_height (priv->area, priv->context,
GTK_WIDGET (cellview), for_size, &min, &nat);
}
else
{
if (for_size < 0)
gtk_cell_area_get_preferred_height (priv->area, priv->context,
gtk_cell_area_get_preferred_height (priv->area, priv->context,
GTK_WIDGET (cellview), &min, &nat);
else
gtk_cell_area_get_preferred_height_for_width (priv->area, priv->context,
gtk_cell_area_get_preferred_height_for_width (priv->area, priv->context,
GTK_WIDGET (cellview), for_size, &min, &nat);
}
@@ -550,7 +553,7 @@ gtk_cell_view_request_model (GtkCellView *cellview,
}
}
static GtkSizeRequestMode
static GtkSizeRequestMode
gtk_cell_view_get_request_mode (GtkWidget *widget)
{
GtkCellView *cellview = GTK_CELL_VIEW (widget);
@@ -698,13 +701,13 @@ gtk_cell_view_set_cell_data (GtkCellView *cell_view)
gtk_tree_model_get_iter (priv->model, &iter, path);
gtk_tree_path_free (path);
gtk_cell_area_apply_attributes (priv->area,
priv->model,
gtk_cell_area_apply_attributes (priv->area,
priv->model,
&iter, FALSE, FALSE);
if (priv->draw_sensitive)
{
GList *l, *cells =
GList *l, *cells =
gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (priv->area));
for (l = cells; l; l = l->next)
@@ -846,7 +849,7 @@ gtk_cell_view_new_with_context (GtkCellArea *area,
g_return_val_if_fail (GTK_IS_CELL_AREA (area), NULL);
g_return_val_if_fail (context == NULL || GTK_IS_CELL_AREA_CONTEXT (context), NULL);
return (GtkWidget *)g_object_new (GTK_TYPE_CELL_VIEW,
return (GtkWidget *)g_object_new (GTK_TYPE_CELL_VIEW,
"cell-area", area,
"cell-area-context", context,
NULL);
@@ -955,7 +958,7 @@ gtk_cell_view_new_with_texture (GdkTexture *texture)
* @renderer: one of the renderers of @cell_view
* @property: the name of the property of @renderer to set
* @value: the new value to set the property to
*
*
* Sets a property of a cell renderer of @cell_view, and
* makes sure the display of @cell_view is updated.
*
@@ -1012,7 +1015,7 @@ gtk_cell_view_set_model (GtkCellView *cell_view,
{
g_object_ref (priv->model);
priv->row_changed_id =
priv->row_changed_id =
g_signal_connect (priv->model, "row-changed",
G_CALLBACK (row_changed_cb), cell_view);
}
@@ -1079,8 +1082,8 @@ gtk_cell_view_set_displayed_row (GtkCellView *cell_view,
* gtk_cell_view_get_displayed_row:
* @cell_view: a `GtkCellView`
*
* Returns a `GtkTreePath` referring to the currently
* displayed row. If no row is currently displayed,
* Returns a `GtkTreePath` referring to the currently
* displayed row. If no row is currently displayed,
* %NULL is returned.
*
* Returns: (nullable) (transfer full): the currently displayed row

View File

@@ -46,6 +46,8 @@
#include "gtkwidgetprivate.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/**
* GtkColorButton:
*
@@ -67,6 +69,8 @@
* `GtkColorButton` has a single CSS node with name colorbutton which
* contains a button node. To differentiate it from a plain `GtkButton`,
* it gets the .color style class.
*
* Deprecated: 4.10: Use [class@Gtk.ColorDialogButton] instead
*/
typedef struct _GtkColorButtonClass GtkColorButtonClass;
@@ -353,6 +357,8 @@ gtk_color_button_finalize (GObject *object)
* color when the user finishes.
*
* Returns: a new color button
*
* Deprecated: 4.10: Use [class@Gtk.ColorDialogButton] instead
*/
GtkWidget *
gtk_color_button_new (void)
@@ -561,6 +567,8 @@ set_use_alpha (GtkColorButton *button,
* @title: String containing new window title
*
* Sets the title for the color chooser dialog.
*
* Deprecated: 4.10: Use [class@Gtk.ColorDialogButton] instead
*/
void
gtk_color_button_set_title (GtkColorButton *button,
@@ -587,6 +595,8 @@ gtk_color_button_set_title (GtkColorButton *button,
* Gets the title of the color chooser dialog.
*
* Returns: An internal string, do not free the return value
*
* Deprecated: 4.10: Use [class@Gtk.ColorDialogButton] instead
*/
const char *
gtk_color_button_get_title (GtkColorButton *button)
@@ -602,6 +612,8 @@ gtk_color_button_get_title (GtkColorButton *button)
* @modal: %TRUE to make the dialog modal
*
* Sets whether the dialog should be modal.
*
* Deprecated: 4.10: Use [class@Gtk.ColorDialogButton] instead
*/
void
gtk_color_button_set_modal (GtkColorButton *button,
@@ -627,6 +639,8 @@ gtk_color_button_set_modal (GtkColorButton *button,
* Gets whether the dialog is modal.
*
* Returns: %TRUE if the dialog is modal
*
* Deprecated: 4.10: Use [class@Gtk.ColorDialogButton] instead
*/
gboolean
gtk_color_button_get_modal (GtkColorButton *button)

View File

@@ -48,19 +48,19 @@ typedef struct _GtkColorButton GtkColorButton;
GDK_AVAILABLE_IN_ALL
GType gtk_color_button_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget * gtk_color_button_new (void);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget * gtk_color_button_new_with_rgba (const GdkRGBA *rgba);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_color_button_set_title (GtkColorButton *button,
const char *title);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
const char *gtk_color_button_get_title (GtkColorButton *button);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_color_button_get_modal (GtkColorButton *button);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_color_button_set_modal (GtkColorButton *button,
gboolean modal);

View File

@@ -36,6 +36,9 @@
* In GTK, the main widgets that implement this interface are
* [class@Gtk.ColorChooserWidget], [class@Gtk.ColorChooserDialog] and
* [class@Gtk.ColorButton].
*
* Deprecated: 4.10: Use [class@Gtk.ColorDialog] and [class@Gtk.ColorDialogButton]
* instead of widgets implementing `GtkColorChooser`
*/
enum
@@ -116,6 +119,8 @@ _gtk_color_chooser_color_activated (GtkColorChooser *chooser,
* @color: (out): a `GdkRGBA` to fill in with the current color
*
* Gets the currently-selected color.
*
* Deprecated: 4.10: Use [class@Gtk.ColorDialog] instead
*/
void
gtk_color_chooser_get_rgba (GtkColorChooser *chooser,
@@ -132,6 +137,8 @@ gtk_color_chooser_get_rgba (GtkColorChooser *chooser,
* @color: the new color
*
* Sets the color.
*
* Deprecated: 4.10: Use [class@Gtk.ColorDialog] instead
*/
void
gtk_color_chooser_set_rgba (GtkColorChooser *chooser,
@@ -151,6 +158,8 @@ gtk_color_chooser_set_rgba (GtkColorChooser *chooser,
*
* Returns: %TRUE if the color chooser uses the alpha channel,
* %FALSE if not
*
* Deprecated: 4.10: Use [class@Gtk.ColorDialog] instead
*/
gboolean
gtk_color_chooser_get_use_alpha (GtkColorChooser *chooser)
@@ -170,6 +179,8 @@ gtk_color_chooser_get_use_alpha (GtkColorChooser *chooser)
* @use_alpha: %TRUE if color chooser should use alpha channel, %FALSE if not
*
* Sets whether or not the color chooser should use the alpha channel.
*
* Deprecated: 4.10: Use [class@Gtk.ColorDialog] instead
*/
void
gtk_color_chooser_set_use_alpha (GtkColorChooser *chooser,
@@ -207,6 +218,8 @@ gtk_color_chooser_set_use_alpha (GtkColorChooser *chooser,
* of removing the default color palette from the color chooser.
*
* If @colors is %NULL, removes all previously added palettes.
*
* Deprecated: 4.10: Use [class@Gtk.ColorDialog] instead
*/
void
gtk_color_chooser_add_palette (GtkColorChooser *chooser,

View File

@@ -63,20 +63,20 @@ struct _GtkColorChooserInterface
GDK_AVAILABLE_IN_ALL
GType gtk_color_chooser_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_color_chooser_get_rgba (GtkColorChooser *chooser,
GdkRGBA *color);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_color_chooser_set_rgba (GtkColorChooser *chooser,
const GdkRGBA *color);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_color_chooser_get_use_alpha (GtkColorChooser *chooser);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_color_chooser_set_use_alpha (GtkColorChooser *chooser,
gboolean use_alpha);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_color_chooser_add_palette (GtkColorChooser *chooser,
GtkOrientation orientation,
int colors_per_line,

View File

@@ -22,7 +22,7 @@
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkdialog.h>
#include <gtk/deprecated/gtkdialog.h>
G_BEGIN_DECLS
@@ -35,7 +35,7 @@ typedef struct _GtkColorChooserDialog GtkColorChooserDialog;
GDK_AVAILABLE_IN_ALL
GType gtk_color_chooser_dialog_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget * gtk_color_chooser_dialog_new (const char *title,
GtkWindow *parent);

View File

@@ -35,7 +35,7 @@ typedef struct _GtkColorChooserWidget GtkColorChooserWidget;
GDK_AVAILABLE_IN_ALL
GType gtk_color_chooser_widget_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget * gtk_color_chooser_widget_new (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkColorChooserWidget, g_object_unref)

View File

@@ -104,9 +104,11 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* a button, both with the .combo class added. The button also contains another
* node with name arrow.
*
* # Accessibility
* ## Accessibility
*
* `GtkComboBox` uses the %GTK_ACCESSIBLE_ROLE_COMBO_BOX role.
*
* Deprecated: 4.10: Use [class@Gtk.DropDown] instead
*/
typedef struct
@@ -1373,7 +1375,7 @@ gtk_combo_box_menu_popup (GtkComboBox *combo_box)
*
* Before calling this, @combo_box must be mapped, or nothing will happen.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_popup (GtkComboBox *combo_box)
@@ -1396,7 +1398,7 @@ gtk_combo_box_popup (GtkComboBox *combo_box)
* in GTK 4. However, it is retained in case similar functionality is added
* back later.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_popup_for_device (GtkComboBox *combo_box,
@@ -1447,7 +1449,7 @@ gtk_combo_box_real_popdown (GtkComboBox *combo_box)
* This function is mostly intended for use by accessibility technologies;
* applications should have little use for it.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_popdown (GtkComboBox *combo_box)
@@ -1851,7 +1853,7 @@ gtk_combo_box_cell_layout_get_area (GtkCellLayout *cell_layout)
*
* Returns: A new `GtkComboBox`
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
GtkWidget *
gtk_combo_box_new (void)
@@ -1866,11 +1868,11 @@ gtk_combo_box_new (void)
*
* In order to use a combo box with entry, you need to tell it
* which column of the model contains the text for the entry
* by calling [method@Gtk.ComboBox.set_entry_text_column].
* by calling [method@Gtk.ComboBox.set_entry_text_column].
*
* Returns: A new `GtkComboBox`
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
GtkWidget *
gtk_combo_box_new_with_entry (void)
@@ -1886,7 +1888,7 @@ gtk_combo_box_new_with_entry (void)
*
* Returns: A new `GtkComboBox`
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
GtkWidget *
gtk_combo_box_new_with_model (GtkTreeModel *model)
@@ -1910,7 +1912,7 @@ gtk_combo_box_new_with_model (GtkTreeModel *model)
*
* Returns: A new `GtkComboBox`
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
GtkWidget *
gtk_combo_box_new_with_model_and_entry (GtkTreeModel *model)
@@ -1935,7 +1937,7 @@ gtk_combo_box_new_with_model_and_entry (GtkTreeModel *model)
* Returns: An integer which is the index of the currently active item,
* or -1 if theres no active item
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
int
gtk_combo_box_get_active (GtkComboBox *combo_box)
@@ -1967,7 +1969,7 @@ gtk_combo_box_get_active (GtkComboBox *combo_box)
*
* Sets the active item of @combo_box to be the item at @index.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_set_active (GtkComboBox *combo_box,
@@ -2066,7 +2068,7 @@ gtk_combo_box_set_active_internal (GtkComboBox *combo_box,
*
* Returns: %TRUE if @iter was set, %FALSE otherwise
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
gboolean
gtk_combo_box_get_active_iter (GtkComboBox *combo_box,
@@ -2097,7 +2099,7 @@ gtk_combo_box_get_active_iter (GtkComboBox *combo_box,
*
* If @iter is %NULL, the active item is unset.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_set_active_iter (GtkComboBox *combo_box,
@@ -2128,7 +2130,7 @@ gtk_combo_box_set_active_iter (GtkComboBox *combo_box,
* call [method@Gtk.CellLayout.clear] yourself if you need to set up different
* cell renderers for the new model.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_set_model (GtkComboBox *combo_box,
@@ -2191,7 +2193,7 @@ out:
* Returns: (nullable) (transfer none): A `GtkTreeModel` which was passed
* during construction.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
GtkTreeModel *
gtk_combo_box_get_model (GtkComboBox *combo_box)
@@ -2550,7 +2552,7 @@ gtk_combo_box_start_editing (GtkCellEditable *cell_editable,
* If @fixed is %TRUE, the popup's width is set to match the
* allocated width of the combo box.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_set_popup_fixed_width (GtkComboBox *combo_box,
@@ -2576,7 +2578,7 @@ gtk_combo_box_set_popup_fixed_width (GtkComboBox *combo_box,
*
* Returns: %TRUE if the popup uses a fixed width
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
gboolean
gtk_combo_box_get_popup_fixed_width (GtkComboBox *combo_box)
@@ -2596,7 +2598,7 @@ gtk_combo_box_get_popup_fixed_width (GtkComboBox *combo_box)
*
* Returns: (nullable): the current row separator function.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
GtkTreeViewRowSeparatorFunc
gtk_combo_box_get_row_separator_func (GtkComboBox *combo_box)
@@ -2621,7 +2623,7 @@ gtk_combo_box_get_row_separator_func (GtkComboBox *combo_box)
* If the row separator function is %NULL, no separators are drawn.
* This is the default value.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_set_row_separator_func (GtkComboBox *combo_box,
@@ -2655,7 +2657,7 @@ gtk_combo_box_set_row_separator_func (GtkComboBox *combo_box,
* Sets whether the dropdown button of the combo box should update
* its sensitivity depending on the model contents.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_set_button_sensitivity (GtkComboBox *combo_box,
@@ -2687,7 +2689,7 @@ gtk_combo_box_set_button_sensitivity (GtkComboBox *combo_box,
* if it is only sensitive as long as the model has one item to
* be selected.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
GtkSensitivityType
gtk_combo_box_get_button_sensitivity (GtkComboBox *combo_box)
@@ -2707,7 +2709,7 @@ gtk_combo_box_get_button_sensitivity (GtkComboBox *combo_box)
*
* Returns: whether there is an entry in @combo_box.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
gboolean
gtk_combo_box_get_has_entry (GtkComboBox *combo_box)
@@ -2725,9 +2727,9 @@ gtk_combo_box_get_has_entry (GtkComboBox *combo_box)
* the internal entry
*
* Sets the model column which @combo_box should use to get strings
* from to be @text_column.
* from to be @text_column.
*
* For this column no separate
* For this column no separate
* [class@Gtk.CellRenderer] is needed.
*
* The column @text_column in the model of @combo_box must be of
@@ -2736,7 +2738,7 @@ gtk_combo_box_get_has_entry (GtkComboBox *combo_box)
* This is only relevant if @combo_box has been created with
* [property@Gtk.ComboBox:has-entry] as %TRUE.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_set_entry_text_column (GtkComboBox *combo_box,
@@ -2771,7 +2773,7 @@ gtk_combo_box_set_entry_text_column (GtkComboBox *combo_box,
*
* Returns: A column in the data source model of @combo_box.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
int
gtk_combo_box_get_entry_text_column (GtkComboBox *combo_box)
@@ -2849,7 +2851,7 @@ gtk_combo_box_buildable_get_internal_child (GtkBuildable *buildable,
* The column @id_column in the model of @combo_box must be of type
* %G_TYPE_STRING.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_set_id_column (GtkComboBox *combo_box,
@@ -2880,7 +2882,7 @@ gtk_combo_box_set_id_column (GtkComboBox *combo_box,
*
* Returns: A column in the data source model of @combo_box.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
int
gtk_combo_box_get_id_column (GtkComboBox *combo_box)
@@ -2912,7 +2914,7 @@ gtk_combo_box_get_id_column (GtkComboBox *combo_box)
*
* Returns: (nullable): the ID of the active row
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
const char *
gtk_combo_box_get_active_id (GtkComboBox *combo_box)
@@ -2967,7 +2969,7 @@ gtk_combo_box_get_active_id (GtkComboBox *combo_box)
* @active_id was given to unset the active row, the function
* always returns %TRUE.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
gboolean
gtk_combo_box_set_active_id (GtkComboBox *combo_box,
@@ -3032,7 +3034,7 @@ gtk_combo_box_get_popup (GtkComboBox *combo_box)
*
* Sets the child widget of @combo_box.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_set_child (GtkComboBox *combo_box,
@@ -3060,7 +3062,7 @@ gtk_combo_box_set_child (GtkComboBox *combo_box,
*
* Returns: (nullable) (transfer none): the child widget of @combo_box
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
GtkWidget *
gtk_combo_box_get_child (GtkComboBox *combo_box)

View File

@@ -71,87 +71,87 @@ struct _GtkComboBoxClass
/* construction */
GDK_AVAILABLE_IN_ALL
GType gtk_combo_box_get_type (void) G_GNUC_CONST;
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
GtkWidget *gtk_combo_box_new (void);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
GtkWidget *gtk_combo_box_new_with_entry (void);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
GtkWidget *gtk_combo_box_new_with_model (GtkTreeModel *model);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
GtkWidget *gtk_combo_box_new_with_model_and_entry (GtkTreeModel *model);
/* get/set active item */
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
int gtk_combo_box_get_active (GtkComboBox *combo_box);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
void gtk_combo_box_set_active (GtkComboBox *combo_box,
int index_);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
gboolean gtk_combo_box_get_active_iter (GtkComboBox *combo_box,
GtkTreeIter *iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
void gtk_combo_box_set_active_iter (GtkComboBox *combo_box,
GtkTreeIter *iter);
/* getters and setters */
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
void gtk_combo_box_set_model (GtkComboBox *combo_box,
GtkTreeModel *model);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
GtkTreeModel *gtk_combo_box_get_model (GtkComboBox *combo_box);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
GtkTreeViewRowSeparatorFunc gtk_combo_box_get_row_separator_func (GtkComboBox *combo_box);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
void gtk_combo_box_set_row_separator_func (GtkComboBox *combo_box,
GtkTreeViewRowSeparatorFunc func,
gpointer data,
GDestroyNotify destroy);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
void gtk_combo_box_set_button_sensitivity (GtkComboBox *combo_box,
GtkSensitivityType sensitivity);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
GtkSensitivityType gtk_combo_box_get_button_sensitivity (GtkComboBox *combo_box);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
gboolean gtk_combo_box_get_has_entry (GtkComboBox *combo_box);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
void gtk_combo_box_set_entry_text_column (GtkComboBox *combo_box,
int text_column);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
int gtk_combo_box_get_entry_text_column (GtkComboBox *combo_box);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
void gtk_combo_box_set_popup_fixed_width (GtkComboBox *combo_box,
gboolean fixed);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
gboolean gtk_combo_box_get_popup_fixed_width (GtkComboBox *combo_box);
/* programmatic control */
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
void gtk_combo_box_popup (GtkComboBox *combo_box);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
void gtk_combo_box_popup_for_device (GtkComboBox *combo_box,
GdkDevice *device);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
void gtk_combo_box_popdown (GtkComboBox *combo_box);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
int gtk_combo_box_get_id_column (GtkComboBox *combo_box);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
void gtk_combo_box_set_id_column (GtkComboBox *combo_box,
int id_column);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
const char * gtk_combo_box_get_active_id (GtkComboBox *combo_box);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
gboolean gtk_combo_box_set_active_id (GtkComboBox *combo_box,
const char *active_id);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
void gtk_combo_box_set_child (GtkComboBox *combo_box,
GtkWidget *child);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown)
GtkWidget * gtk_combo_box_get_child (GtkComboBox *combo_box);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkComboBox, g_object_unref)

View File

@@ -56,7 +56,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* You should not call [method@Gtk.ComboBox.set_model] or attempt to pack more
* cells into this combo box via its [iface@Gtk.CellLayout] interface.
*
* # GtkComboBoxText as GtkBuildable
* ## GtkComboBoxText as GtkBuildable
*
* The `GtkComboBoxText` implementation of the `GtkBuildable` interface supports
* adding items directly using the <items> element and specifying <item>
@@ -75,7 +75,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* </object>
* ```
*
* # CSS nodes
* ## CSS nodes
*
* ```
* combobox
@@ -88,6 +88,9 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* `GtkComboBoxText` has a single CSS node with name combobox. It adds
* the style class .combo to the main CSS nodes of its entry and button
* children, and the .linked class to the node of its internal box.
*
* Deprecated: 4.10: Use [class@Gtk.DropDown] with a [class@Gtk.StringList]
* instead
*/
typedef struct _GtkComboBoxTextClass GtkComboBoxTextClass;
@@ -353,7 +356,7 @@ gtk_combo_box_text_buildable_custom_finished (GtkBuildable *buildable,
*
* Returns: A new `GtkComboBoxText`
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
GtkWidget *
gtk_combo_box_text_new (void)
@@ -369,7 +372,7 @@ gtk_combo_box_text_new (void)
*
* Returns: a new `GtkComboBoxText`
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
GtkWidget *
gtk_combo_box_text_new_with_entry (void)
@@ -389,7 +392,7 @@ gtk_combo_box_text_new_with_entry (void)
* This is the same as calling [method@Gtk.ComboBoxText.insert_text]
* with a position of -1.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_text_append_text (GtkComboBoxText *combo_box,
@@ -408,7 +411,7 @@ gtk_combo_box_text_append_text (GtkComboBoxText *combo_box,
* This is the same as calling [method@Gtk.ComboBoxText.insert_text]
* with a position of 0.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_text_prepend_text (GtkComboBoxText *combo_box,
@@ -430,7 +433,7 @@ gtk_combo_box_text_prepend_text (GtkComboBoxText *combo_box,
* This is the same as calling [method@Gtk.ComboBoxText.insert]
* with a %NULL ID string.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_text_insert_text (GtkComboBoxText *combo_box,
@@ -453,7 +456,7 @@ gtk_combo_box_text_insert_text (GtkComboBoxText *combo_box,
* This is the same as calling [method@Gtk.ComboBoxText.insert]
* with a position of -1.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_text_append (GtkComboBoxText *combo_box,
@@ -476,7 +479,7 @@ gtk_combo_box_text_append (GtkComboBoxText *combo_box,
* This is the same as calling [method@Gtk.ComboBoxText.insert]
* with a position of 0.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_text_prepend (GtkComboBoxText *combo_box,
@@ -501,7 +504,7 @@ gtk_combo_box_text_prepend (GtkComboBoxText *combo_box,
*
* If @position is negative then @text is appended.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_text_insert (GtkComboBoxText *combo_box,
@@ -554,7 +557,7 @@ gtk_combo_box_text_insert (GtkComboBoxText *combo_box,
*
* Removes the string at @position from @combo_box.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_text_remove (GtkComboBoxText *combo_box,
@@ -581,7 +584,7 @@ gtk_combo_box_text_remove (GtkComboBoxText *combo_box,
*
* Removes all the text entries from the combo box.
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
void
gtk_combo_box_text_remove_all (GtkComboBoxText *combo_box)
@@ -609,7 +612,7 @@ gtk_combo_box_text_remove_all (GtkComboBoxText *combo_box)
* string containing the currently active text.
* Must be freed with g_free().
*
* Deprecated: 4.10: Use GtkDropDown
* Deprecated: 4.10: Use [class@Gtk.DropDown]
*/
char *
gtk_combo_box_text_get_active_text (GtkComboBoxText *combo_box)

View File

@@ -35,38 +35,38 @@ typedef struct _GtkComboBoxText GtkComboBoxText;
GDK_AVAILABLE_IN_ALL
GType gtk_combo_box_text_get_type (void) G_GNUC_CONST;
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown and GtkStringList)
GtkWidget* gtk_combo_box_text_new (void);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown and GtkStringList)
GtkWidget* gtk_combo_box_text_new_with_entry (void);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown and GtkStringList)
void gtk_combo_box_text_append_text (GtkComboBoxText *combo_box,
const char *text);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown and GtkStringList)
void gtk_combo_box_text_insert_text (GtkComboBoxText *combo_box,
int position,
const char *text);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown and GtkStringList)
void gtk_combo_box_text_prepend_text (GtkComboBoxText *combo_box,
const char *text);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown and GtkStringList)
void gtk_combo_box_text_remove (GtkComboBoxText *combo_box,
int position);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown and GtkStringList)
void gtk_combo_box_text_remove_all (GtkComboBoxText *combo_box);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown and GtkStringList)
char *gtk_combo_box_text_get_active_text (GtkComboBoxText *combo_box);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown and GtkStringList)
void gtk_combo_box_text_insert (GtkComboBoxText *combo_box,
int position,
const char *id,
const char *text);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown and GtkStringList)
void gtk_combo_box_text_append (GtkComboBoxText *combo_box,
const char *id,
const char *text);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropDown and GtkStringList)
void gtk_combo_box_text_prepend (GtkComboBoxText *combo_box,
const char *id,
const char *text);

View File

@@ -43,6 +43,8 @@
#include "gtktypebuiltins.h"
#include "gtksizegroup.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/**
* GtkDialog:
*

View File

@@ -127,51 +127,51 @@ struct _GtkDialogClass
GDK_AVAILABLE_IN_ALL
GType gtk_dialog_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget* gtk_dialog_new (void);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget* gtk_dialog_new_with_buttons (const char *title,
GtkWindow *parent,
GtkDialogFlags flags,
const char *first_button_text,
...) G_GNUC_NULL_TERMINATED;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_dialog_add_action_widget (GtkDialog *dialog,
GtkWidget *child,
int response_id);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget* gtk_dialog_add_button (GtkDialog *dialog,
const char *button_text,
int response_id);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_dialog_add_buttons (GtkDialog *dialog,
const char *first_button_text,
...) G_GNUC_NULL_TERMINATED;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_dialog_set_response_sensitive (GtkDialog *dialog,
int response_id,
gboolean setting);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_dialog_set_default_response (GtkDialog *dialog,
int response_id);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget* gtk_dialog_get_widget_for_response (GtkDialog *dialog,
int response_id);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
int gtk_dialog_get_response_for_widget (GtkDialog *dialog,
GtkWidget *widget);
/* Emit response signal */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_dialog_response (GtkDialog *dialog,
int response_id);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget * gtk_dialog_get_content_area (GtkDialog *dialog);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget * gtk_dialog_get_header_bar (GtkDialog *dialog);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkDialog, g_object_unref)

View File

@@ -56,6 +56,8 @@
* [method@Gtk.TreeModelFilter.get_model]. Dont forget to use
* [method@Gtk.TreeModelFilter.convert_iter_to_child_iter] to obtain a
* matching iter.
*
* Deprecated: 4.10
*/
#include "config.h"
@@ -434,6 +436,7 @@ gtk_entry_completion_init (GtkEntryCompletion *completion)
completion->inline_selection = FALSE;
completion->filter_model = NULL;
completion->insert_text_signal_group = NULL;
}
static gboolean
@@ -1382,13 +1385,12 @@ gtk_entry_completion_insert_completion_text (GtkEntryCompletion *completion,
{
int len;
GtkText *text = gtk_entry_get_text_widget (GTK_ENTRY (completion->entry));
GtkEntryBuffer *buffer = gtk_text_get_buffer (text);
if (completion->changed_id > 0)
g_signal_handler_block (text, completion->changed_id);
if (completion->insert_text_id > 0)
g_signal_handler_block (buffer, completion->insert_text_id);
if (completion->insert_text_signal_group != NULL)
g_signal_group_block (completion->insert_text_signal_group);
gtk_editable_set_text (GTK_EDITABLE (completion->entry), new_text);
@@ -1398,8 +1400,8 @@ gtk_entry_completion_insert_completion_text (GtkEntryCompletion *completion,
if (completion->changed_id > 0)
g_signal_handler_unblock (text, completion->changed_id);
if (completion->insert_text_id > 0)
g_signal_handler_unblock (buffer, completion->insert_text_id);
if (completion->insert_text_signal_group != NULL)
g_signal_group_unblock (completion->insert_text_signal_group);
}
static gboolean
@@ -1438,11 +1440,9 @@ gtk_entry_completion_insert_prefix (GtkEntryCompletion *completion)
gboolean done;
char *prefix;
GtkText *text = gtk_entry_get_text_widget (GTK_ENTRY (completion->entry));
GtkEntryBuffer *buffer = gtk_text_get_buffer (text);
if (completion->insert_text_id > 0)
g_signal_handler_block (buffer, completion->insert_text_id);
if (completion->insert_text_signal_group != NULL)
g_signal_group_block (completion->insert_text_signal_group);
prefix = gtk_entry_completion_compute_prefix (completion,
gtk_editable_get_text (GTK_EDITABLE (completion->entry)));
@@ -1454,8 +1454,8 @@ gtk_entry_completion_insert_prefix (GtkEntryCompletion *completion)
g_free (prefix);
}
if (completion->insert_text_id > 0)
g_signal_handler_unblock (buffer, completion->insert_text_id);
if (completion->insert_text_signal_group != NULL)
g_signal_group_unblock (completion->insert_text_signal_group);
}
/**
@@ -2028,7 +2028,7 @@ static gboolean
check_completion_callback (GtkEntryCompletion *completion)
{
completion->check_completion_idle = NULL;
gtk_entry_completion_complete (completion);
gtk_entry_completion_insert_prefix (completion);
@@ -2096,7 +2096,6 @@ connect_completion_signals (GtkEntryCompletion *completion)
{
GtkEventController *controller;
GtkText *text = gtk_entry_get_text_widget (GTK_ENTRY (completion->entry));
GtkEntryBuffer *buffer = gtk_text_get_buffer (text);
controller = completion->entry_key_controller = gtk_event_controller_key_new ();
gtk_event_controller_set_static_name (controller, "gtk-entry-completion");
@@ -2111,8 +2110,10 @@ connect_completion_signals (GtkEntryCompletion *completion)
completion->changed_id =
g_signal_connect (text, "changed", G_CALLBACK (gtk_entry_completion_changed), completion);
completion->insert_text_id =
g_signal_connect (buffer, "inserted-text", G_CALLBACK (completion_inserted_text_callback), completion);
completion->insert_text_signal_group = g_signal_group_new (GTK_TYPE_ENTRY_BUFFER);
g_signal_group_connect (completion->insert_text_signal_group, "inserted-text", G_CALLBACK (completion_inserted_text_callback), completion);
g_object_bind_property (text, "buffer", completion->insert_text_signal_group, "target", G_BINDING_SYNC_CREATE);
g_signal_connect (text, "notify", G_CALLBACK (clear_completion_callback), completion);
g_signal_connect_swapped (text, "activate", G_CALLBACK (accept_completion_callback), completion);
}
@@ -2121,7 +2122,6 @@ static void
disconnect_completion_signals (GtkEntryCompletion *completion)
{
GtkText *text = gtk_entry_get_text_widget (GTK_ENTRY (completion->entry));
GtkEntryBuffer *buffer = gtk_text_get_buffer (text);
gtk_widget_remove_controller (GTK_WIDGET (text), completion->entry_key_controller);
gtk_widget_remove_controller (GTK_WIDGET (text), completion->entry_focus_controller);
@@ -2132,12 +2132,9 @@ disconnect_completion_signals (GtkEntryCompletion *completion)
g_signal_handler_disconnect (text, completion->changed_id);
completion->changed_id = 0;
}
if (completion->insert_text_id > 0 &&
g_signal_handler_is_connected (buffer, completion->insert_text_id))
{
g_signal_handler_disconnect (buffer, completion->insert_text_id);
completion->insert_text_id = 0;
}
g_clear_object (&completion->insert_text_signal_group);
g_signal_handlers_disconnect_by_func (text, G_CALLBACK (clear_completion_callback), completion);
g_signal_handlers_disconnect_by_func (text, G_CALLBACK (accept_completion_callback), completion);
}

View File

@@ -24,6 +24,8 @@
#include "gtkmarshalers.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/**
* GtkFileChooser:
*
@@ -67,6 +69,8 @@
* options. If a choice has no option, it will be rendered as a
* check button with the given label; if a choice has options, it will
* be rendered as a combo box.
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
@@ -173,6 +177,8 @@ gtk_file_chooser_error_quark (void)
* For example, an option to create a new folder might be shown
* if the action is %GTK_FILE_CHOOSER_ACTION_SAVE but not if the
* action is %GTK_FILE_CHOOSER_ACTION_OPEN.
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
**/
void
gtk_file_chooser_set_action (GtkFileChooser *chooser,
@@ -190,6 +196,8 @@ gtk_file_chooser_set_action (GtkFileChooser *chooser,
* Gets the type of operation that the file chooser is performing.
*
* Returns: the action that the file selector is performing
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
GtkFileChooserAction
gtk_file_chooser_get_action (GtkFileChooser *chooser)
@@ -213,6 +221,8 @@ gtk_file_chooser_get_action (GtkFileChooser *chooser)
* This is only relevant if the action is set to be
* %GTK_FILE_CHOOSER_ACTION_OPEN or
* %GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER.
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
void
gtk_file_chooser_set_select_multiple (GtkFileChooser *chooser,
@@ -231,6 +241,8 @@ gtk_file_chooser_set_select_multiple (GtkFileChooser *chooser,
* chooser.
*
* Returns: %TRUE if multiple files can be selected.
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
gboolean
gtk_file_chooser_get_select_multiple (GtkFileChooser *chooser)
@@ -253,6 +265,8 @@ gtk_file_chooser_get_select_multiple (GtkFileChooser *chooser)
*
* This is only relevant if the action is not set to be
* %GTK_FILE_CHOOSER_ACTION_OPEN.
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
void
gtk_file_chooser_set_create_folders (GtkFileChooser *chooser,
@@ -270,6 +284,8 @@ gtk_file_chooser_set_create_folders (GtkFileChooser *chooser,
* Gets whether file chooser will offer to create new folders.
*
* Returns: %TRUE if the Create Folder button should be displayed.
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
gboolean
gtk_file_chooser_get_create_folders (GtkFileChooser *chooser)
@@ -301,6 +317,8 @@ gtk_file_chooser_get_create_folders (GtkFileChooser *chooser)
*
* Please see the documentation for those functions for an example
* of using [method@Gtk.FileChooser.set_current_name] as well.
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
**/
void
gtk_file_chooser_set_current_name (GtkFileChooser *chooser,
@@ -326,6 +344,8 @@ gtk_file_chooser_set_current_name (GtkFileChooser *chooser,
* whatever the contents of the entry are. Note also that this string is
* in UTF-8 encoding, which is not necessarily the systems encoding for
* filenames.
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
char *
gtk_file_chooser_get_current_name (GtkFileChooser *chooser)
@@ -362,6 +382,8 @@ gtk_file_chooser_unselect_all (GtkFileChooser *chooser)
*
* Returns: %TRUE if the folder could be changed successfully, %FALSE
* otherwise.
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
gboolean
gtk_file_chooser_set_current_folder (GtkFileChooser *chooser,
@@ -382,6 +404,8 @@ gtk_file_chooser_set_current_folder (GtkFileChooser *chooser,
* Gets the current folder of @chooser as `GFile`.
*
* Returns: (transfer full) (nullable): the `GFile` for the current folder.
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
GFile *
gtk_file_chooser_get_current_folder (GtkFileChooser *chooser)
@@ -423,6 +447,8 @@ gtk_file_chooser_unselect_file (GtkFileChooser *chooser,
* Returns: (transfer full): a list model containing a `GFile` for each
* selected file and subfolder in the current folder. Free the returned
* list with g_object_unref().
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
GListModel *
gtk_file_chooser_get_files (GtkFileChooser *chooser)
@@ -482,6 +508,8 @@ gtk_file_chooser_get_files (GtkFileChooser *chooser)
* ```
*
* Returns: Not useful
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
gboolean
gtk_file_chooser_set_file (GtkFileChooser *chooser,
@@ -511,6 +539,8 @@ gtk_file_chooser_set_file (GtkFileChooser *chooser,
*
* Returns: (transfer full) (nullable): a selected `GFile`. You own the
* returned file; use g_object_unref() to release it.
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
GFile *
gtk_file_chooser_get_file (GtkFileChooser *chooser)
@@ -539,6 +569,8 @@ gtk_file_chooser_get_file (GtkFileChooser *chooser)
*
* Returns: %TRUE if the folder could be added successfully,
* %FALSE otherwise.
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
gboolean
gtk_file_chooser_add_shortcut_folder (GtkFileChooser *chooser,
@@ -561,6 +593,8 @@ gtk_file_chooser_add_shortcut_folder (GtkFileChooser *chooser,
*
* Returns: %TRUE if the folder could be removed successfully,
* %FALSE otherwise.
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
gboolean
gtk_file_chooser_remove_shortcut_folder (GtkFileChooser *chooser,
@@ -601,6 +635,8 @@ gtk_file_chooser_add_filter (GtkFileChooser *chooser,
* @filter: a `GtkFileFilter`
*
* Removes @filter from the list of filters that the user can select between.
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
void
gtk_file_chooser_remove_filter (GtkFileChooser *chooser,
@@ -648,6 +684,8 @@ gtk_file_chooser_get_filters (GtkFileChooser *chooser)
* Setting the current filter when the list of filters is
* empty is useful if you want to restrict the displayed
* set of files without letting the user change it.
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
void
gtk_file_chooser_set_filter (GtkFileChooser *chooser,
@@ -666,6 +704,8 @@ gtk_file_chooser_set_filter (GtkFileChooser *chooser,
* Gets the current filter.
*
* Returns: (nullable) (transfer none): the current filter
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
GtkFileFilter *
gtk_file_chooser_get_filter (GtkFileChooser *chooser)
@@ -695,6 +735,8 @@ gtk_file_chooser_get_filter (GtkFileChooser *chooser)
* @chooser may or may not affect the returned model.
*
* Returns: (transfer full): A list model of `GFile`s
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
GListModel *
gtk_file_chooser_get_shortcut_folders (GtkFileChooser *chooser)
@@ -720,6 +762,8 @@ gtk_file_chooser_get_shortcut_folders (GtkFileChooser *chooser)
* and you can obtain the user-selected value in the
* [signal@Gtk.Dialog::response] signal handler using
* [method@Gtk.FileChooser.get_choice].
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
void
gtk_file_chooser_add_choice (GtkFileChooser *chooser,
@@ -740,6 +784,8 @@ gtk_file_chooser_add_choice (GtkFileChooser *chooser,
* @id: the ID of the choice to remove
*
* Removes a 'choice' that has been added with gtk_file_chooser_add_choice().
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
void
gtk_file_chooser_remove_choice (GtkFileChooser *chooser,
@@ -761,6 +807,8 @@ gtk_file_chooser_remove_choice (GtkFileChooser *chooser,
* gtk_file_chooser_add_choice().
*
* For a boolean choice, the possible options are "true" and "false".
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
void
gtk_file_chooser_set_choice (GtkFileChooser *chooser,
@@ -781,6 +829,8 @@ gtk_file_chooser_set_choice (GtkFileChooser *chooser,
* Gets the currently selected option in the 'choice' with the given ID.
*
* Returns: (nullable): the ID of the currently selected option
*
* Deprecated: 4.10: Use [class@Gtk.FileDialog] instead
*/
const char *
gtk_file_chooser_get_choice (GtkFileChooser *chooser,

View File

@@ -85,101 +85,101 @@ typedef enum {
GTK_FILE_CHOOSER_ERROR_INCOMPLETE_HOSTNAME
} GtkFileChooserError;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GQuark gtk_file_chooser_error_quark (void);
/* Configuration */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_file_chooser_set_action (GtkFileChooser *chooser,
GtkFileChooserAction action);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkFileChooserAction gtk_file_chooser_get_action (GtkFileChooser *chooser);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_file_chooser_set_select_multiple (GtkFileChooser *chooser,
gboolean select_multiple);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_file_chooser_get_select_multiple (GtkFileChooser *chooser);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_file_chooser_set_create_folders (GtkFileChooser *chooser,
gboolean create_folders);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_file_chooser_get_create_folders (GtkFileChooser *chooser);
/* Suggested name for the Save-type actions */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_file_chooser_set_current_name (GtkFileChooser *chooser,
const char *name);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
char * gtk_file_chooser_get_current_name (GtkFileChooser *chooser);
/* GFile manipulation */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GFile * gtk_file_chooser_get_file (GtkFileChooser *chooser);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_file_chooser_set_file (GtkFileChooser *chooser,
GFile *file,
GError **error);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GListModel * gtk_file_chooser_get_files (GtkFileChooser *chooser);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_file_chooser_set_current_folder (GtkFileChooser *chooser,
GFile *file,
GError **error);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GFile * gtk_file_chooser_get_current_folder (GtkFileChooser *chooser);
/* List of user selectable filters */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_file_chooser_add_filter (GtkFileChooser *chooser,
GtkFileFilter *filter);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_file_chooser_remove_filter (GtkFileChooser *chooser,
GtkFileFilter *filter);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GListModel * gtk_file_chooser_get_filters (GtkFileChooser *chooser);
/* Current filter */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_file_chooser_set_filter (GtkFileChooser *chooser,
GtkFileFilter *filter);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkFileFilter * gtk_file_chooser_get_filter (GtkFileChooser *chooser);
/* Per-application shortcut folders */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_file_chooser_add_shortcut_folder (GtkFileChooser *chooser,
GFile *folder,
GError **error);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_file_chooser_remove_shortcut_folder
(GtkFileChooser *chooser,
GFile *folder,
GError **error);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GListModel * gtk_file_chooser_get_shortcut_folders (GtkFileChooser *chooser);
/* Custom widgets */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_file_chooser_add_choice (GtkFileChooser *chooser,
const char *id,
const char *label,
const char **options,
const char **option_labels);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_file_chooser_remove_choice (GtkFileChooser *chooser,
const char *id);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_file_chooser_set_choice (GtkFileChooser *chooser,
const char *id,
const char *option);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
const char * gtk_file_chooser_get_choice (GtkFileChooser *chooser,
const char *id);

View File

@@ -23,8 +23,8 @@
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkdialog.h>
#include <gtk/gtkfilechooser.h>
#include <gtk/deprecated/gtkdialog.h>
#include <gtk/deprecated/gtkfilechooser.h>
G_BEGIN_DECLS
@@ -36,7 +36,7 @@ typedef struct _GtkFileChooserDialog GtkFileChooserDialog;
GDK_AVAILABLE_IN_ALL
GType gtk_file_chooser_dialog_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget *gtk_file_chooser_dialog_new (const char *title,
GtkWindow *parent,
GtkFileChooserAction action,

View File

@@ -23,7 +23,7 @@
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkfilechooser.h>
#include <gtk/deprecated/gtkfilechooser.h>
#include <gtk/gtknativedialog.h>
G_BEGIN_DECLS
@@ -33,21 +33,21 @@ G_BEGIN_DECLS
GDK_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (GtkFileChooserNative, gtk_file_chooser_native, GTK, FILE_CHOOSER_NATIVE, GtkNativeDialog)
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkFileChooserNative *gtk_file_chooser_native_new (const char *title,
GtkWindow *parent,
GtkFileChooserAction action,
const char *accept_label,
const char *cancel_label);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
const char *gtk_file_chooser_native_get_accept_label (GtkFileChooserNative *self);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_file_chooser_native_set_accept_label (GtkFileChooserNative *self,
const char *accept_label);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
const char *gtk_file_chooser_native_get_cancel_label (GtkFileChooserNative *self);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_file_chooser_native_set_cancel_label (GtkFileChooserNative *self,
const char *cancel_label);

View File

@@ -23,7 +23,7 @@
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkfilechooser.h>
#include <gtk/deprecated/gtkfilechooser.h>
#include <gtk/gtkbox.h>
G_BEGIN_DECLS
@@ -36,7 +36,7 @@ typedef struct _GtkFileChooserWidget GtkFileChooserWidget;
GDK_AVAILABLE_IN_ALL
GType gtk_file_chooser_widget_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget *gtk_file_chooser_widget_new (GtkFileChooserAction action);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkFileChooserWidget, g_object_unref)

View File

@@ -45,6 +45,8 @@
#include <stdio.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/**
* GtkFontButton:
*
@@ -65,6 +67,8 @@
*
* `GtkFontButton` has a single CSS node with name fontbutton which
* contains a button node with the .font style class.
*
* Deprecated: 4.10: Use [class@Gtk.FontDialogButton] instead
*/
typedef struct _GtkFontButtonClass GtkFontButtonClass;
@@ -744,6 +748,8 @@ gtk_font_button_get_property (GObject *object,
* Creates a new font picker widget.
*
* Returns: a new font picker widget.
*
* Deprecated: 4.10: Use [class@Gtk.FontDialogButton] instead
*/
GtkWidget *
gtk_font_button_new (void)
@@ -758,6 +764,8 @@ gtk_font_button_new (void)
* Creates a new font picker widget showing the given font.
*
* Returns: a new font picker widget.
*
* Deprecated: 4.10: Use [class@Gtk.FontDialogButton] instead
*/
GtkWidget *
gtk_font_button_new_with_font (const char *fontname)
@@ -771,6 +779,8 @@ gtk_font_button_new_with_font (const char *fontname)
* @title: a string containing the font chooser dialog title
*
* Sets the title for the font chooser dialog.
*
* Deprecated: 4.10: Use [class@Gtk.FontDialogButton] instead
*/
void
gtk_font_button_set_title (GtkFontButton *font_button,
@@ -797,6 +807,8 @@ gtk_font_button_set_title (GtkFontButton *font_button,
*
* Returns: an internal copy of the title string
* which must not be freed.
*
* Deprecated: 4.10: Use [class@Gtk.FontDialogButton] instead
*/
const char *
gtk_font_button_get_title (GtkFontButton *font_button)
@@ -812,6 +824,8 @@ gtk_font_button_get_title (GtkFontButton *font_button)
* @modal: %TRUE to make the dialog modal
*
* Sets whether the dialog should be modal.
*
* Deprecated: 4.10: Use [class@Gtk.FontDialogButton] instead
*/
void
gtk_font_button_set_modal (GtkFontButton *font_button,
@@ -837,6 +851,8 @@ gtk_font_button_set_modal (GtkFontButton *font_button,
* Gets whether the dialog is modal.
*
* Returns: %TRUE if the dialog is modal
*
* Deprecated: 4.10: Use [class@Gtk.FontDialogButton] instead
*/
gboolean
gtk_font_button_get_modal (GtkFontButton *font_button)
@@ -853,6 +869,8 @@ gtk_font_button_get_modal (GtkFontButton *font_button)
* Returns whether the selected font is used in the label.
*
* Returns: whether the selected font is used in the label.
*
* Deprecated: 4.10: Use [class@Gtk.FontDialogButton] instead
*/
gboolean
gtk_font_button_get_use_font (GtkFontButton *font_button)
@@ -869,6 +887,8 @@ gtk_font_button_get_use_font (GtkFontButton *font_button)
*
* If @use_font is %TRUE, the font name will be written
* using the selected font.
*
* Deprecated: 4.10: Use [class@Gtk.FontDialogButton] instead
*/
void
gtk_font_button_set_use_font (GtkFontButton *font_button,
@@ -896,6 +916,8 @@ gtk_font_button_set_use_font (GtkFontButton *font_button,
* Returns whether the selected size is used in the label.
*
* Returns: whether the selected size is used in the label.
*
* Deprecated: 4.10: Use [class@Gtk.FontDialogButton] instead
*/
gboolean
gtk_font_button_get_use_size (GtkFontButton *font_button)
@@ -913,6 +935,8 @@ gtk_font_button_get_use_size (GtkFontButton *font_button)
*
* If @use_size is %TRUE, the font name will be written using
* the selected size.
*
* Deprecated: 4.10: Use [class@Gtk.FontDialogButton] instead
*/
void
gtk_font_button_set_use_size (GtkFontButton *font_button,

View File

@@ -43,29 +43,29 @@ typedef struct _GtkFontButton GtkFontButton;
GDK_AVAILABLE_IN_ALL
GType gtk_font_button_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget *gtk_font_button_new (void);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget *gtk_font_button_new_with_font (const char *fontname);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
const char * gtk_font_button_get_title (GtkFontButton *font_button);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_font_button_set_title (GtkFontButton *font_button,
const char *title);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_font_button_get_modal (GtkFontButton *font_button);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_font_button_set_modal (GtkFontButton *font_button,
gboolean modal);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_font_button_get_use_font (GtkFontButton *font_button);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_font_button_set_use_font (GtkFontButton *font_button,
gboolean use_font);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_font_button_get_use_size (GtkFontButton *font_button);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_font_button_set_use_size (GtkFontButton *font_button,
gboolean use_size);

View File

@@ -25,6 +25,8 @@
#include "gtktypebuiltins.h"
#include "gtkprivate.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/**
* GtkFontChooser:
*
@@ -34,6 +36,9 @@
* In GTK, the main objects that implement this interface are
* [class@Gtk.FontChooserWidget], [class@Gtk.FontChooserDialog] and
* [class@Gtk.FontButton].
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
enum
@@ -167,6 +172,9 @@ gtk_font_chooser_default_init (GtkFontChooserInterface *iface)
*
* Returns: (nullable) (transfer none): A `PangoFontFamily` representing the
* selected font family
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
PangoFontFamily *
gtk_font_chooser_get_font_family (GtkFontChooser *fontchooser)
@@ -187,6 +195,9 @@ gtk_font_chooser_get_font_family (GtkFontChooser *fontchooser)
*
* Returns: (nullable) (transfer none): A `PangoFontFace` representing the
* selected font group details
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
PangoFontFace *
gtk_font_chooser_get_font_face (GtkFontChooser *fontchooser)
@@ -204,6 +215,9 @@ gtk_font_chooser_get_font_face (GtkFontChooser *fontchooser)
*
* Returns: A n integer representing the selected font size,
* or -1 if no font size is selected.
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
int
gtk_font_chooser_get_font_size (GtkFontChooser *fontchooser)
@@ -230,6 +244,9 @@ gtk_font_chooser_get_font_size (GtkFontChooser *fontchooser)
*
* Returns: (nullable) (transfer full): A string with the name
* of the current font
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
char *
gtk_font_chooser_get_font (GtkFontChooser *fontchooser)
@@ -250,6 +267,9 @@ gtk_font_chooser_get_font (GtkFontChooser *fontchooser)
* @fontname: a font name like Helvetica 12 or Times Bold 18
*
* Sets the currently-selected font.
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
void
gtk_font_chooser_set_font (GtkFontChooser *fontchooser,
@@ -278,6 +298,9 @@ gtk_font_chooser_set_font (GtkFontChooser *fontchooser,
*
* Returns: (nullable) (transfer full): A `PangoFontDescription` for the
* current font
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
PangoFontDescription *
gtk_font_chooser_get_font_desc (GtkFontChooser *fontchooser)
@@ -297,6 +320,9 @@ gtk_font_chooser_get_font_desc (GtkFontChooser *fontchooser)
* @font_desc: a `PangoFontDescription`
*
* Sets the currently-selected font from @font_desc.
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
void
gtk_font_chooser_set_font_desc (GtkFontChooser *fontchooser,
@@ -315,6 +341,9 @@ gtk_font_chooser_set_font_desc (GtkFontChooser *fontchooser,
* Gets the text displayed in the preview area.
*
* Returns: (transfer full): the text displayed in the preview area
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
char *
gtk_font_chooser_get_preview_text (GtkFontChooser *fontchooser)
@@ -336,6 +365,9 @@ gtk_font_chooser_get_preview_text (GtkFontChooser *fontchooser)
* Sets the text displayed in the preview area.
*
* The @text is used to show how the selected font looks.
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
void
gtk_font_chooser_set_preview_text (GtkFontChooser *fontchooser,
@@ -354,6 +386,9 @@ gtk_font_chooser_set_preview_text (GtkFontChooser *fontchooser,
* Returns whether the preview entry is shown or not.
*
* Returns: %TRUE if the preview entry is shown or %FALSE if it is hidden.
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
gboolean
gtk_font_chooser_get_show_preview_entry (GtkFontChooser *fontchooser)
@@ -373,6 +408,9 @@ gtk_font_chooser_get_show_preview_entry (GtkFontChooser *fontchooser)
* @show_preview_entry: whether to show the editable preview entry or not
*
* Shows or hides the editable preview entry.
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
void
gtk_font_chooser_set_show_preview_entry (GtkFontChooser *fontchooser,
@@ -393,6 +431,9 @@ gtk_font_chooser_set_show_preview_entry (GtkFontChooser *fontchooser,
*
* Adds a filter function that decides which fonts to display
* in the font chooser.
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
void
gtk_font_chooser_set_filter_func (GtkFontChooser *fontchooser,
@@ -447,6 +488,9 @@ _gtk_font_chooser_font_activated (GtkFontChooser *chooser,
* context = gtk_widget_get_pango_context (label);
* pango_context_set_font_map (context, fontmap);
* ```
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
void
gtk_font_chooser_set_font_map (GtkFontChooser *fontchooser,
@@ -467,6 +511,9 @@ gtk_font_chooser_set_font_map (GtkFontChooser *fontchooser,
* or %NULL if it does not have one.
*
* Returns: (nullable) (transfer full): a `PangoFontMap`
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
PangoFontMap *
gtk_font_chooser_get_font_map (GtkFontChooser *fontchooser)
@@ -487,6 +534,9 @@ gtk_font_chooser_get_font_map (GtkFontChooser *fontchooser)
* @level: the desired level of granularity
*
* Sets the desired level of granularity for selecting fonts.
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
void
gtk_font_chooser_set_level (GtkFontChooser *fontchooser,
@@ -504,6 +554,9 @@ gtk_font_chooser_set_level (GtkFontChooser *fontchooser,
* Returns the current level of granularity for selecting fonts.
*
* Returns: the current granularity level
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
GtkFontChooserLevel
gtk_font_chooser_get_level (GtkFontChooser *fontchooser)
@@ -528,6 +581,9 @@ gtk_font_chooser_get_level (GtkFontChooser *fontchooser)
* It can be passed to [func@Pango.AttrFontFeatures.new].
*
* Returns: the currently selected font features
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
char *
gtk_font_chooser_get_font_features (GtkFontChooser *fontchooser)
@@ -548,6 +604,9 @@ gtk_font_chooser_get_font_features (GtkFontChooser *fontchooser)
* Gets the language that is used for font features.
*
* Returns: the currently selected language
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
char *
gtk_font_chooser_get_language (GtkFontChooser *fontchooser)
@@ -567,6 +626,9 @@ gtk_font_chooser_get_language (GtkFontChooser *fontchooser)
* @language: a language
*
* Sets the language to use for font features.
*
* Deprecated: 4.10: Use [class@Gtk.FontDialog] and [class@GtkFontDialogButton]
* instead
*/
void
gtk_font_chooser_set_language (GtkFontChooser *fontchooser,

View File

@@ -107,57 +107,57 @@ struct _GtkFontChooserIface
GDK_AVAILABLE_IN_ALL
GType gtk_font_chooser_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
PangoFontFamily *gtk_font_chooser_get_font_family (GtkFontChooser *fontchooser);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
PangoFontFace *gtk_font_chooser_get_font_face (GtkFontChooser *fontchooser);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
int gtk_font_chooser_get_font_size (GtkFontChooser *fontchooser);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
PangoFontDescription *
gtk_font_chooser_get_font_desc (GtkFontChooser *fontchooser);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_font_chooser_set_font_desc (GtkFontChooser *fontchooser,
const PangoFontDescription *font_desc);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
char * gtk_font_chooser_get_font (GtkFontChooser *fontchooser);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_font_chooser_set_font (GtkFontChooser *fontchooser,
const char *fontname);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
char * gtk_font_chooser_get_preview_text (GtkFontChooser *fontchooser);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_font_chooser_set_preview_text (GtkFontChooser *fontchooser,
const char *text);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
gboolean gtk_font_chooser_get_show_preview_entry (GtkFontChooser *fontchooser);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_font_chooser_set_show_preview_entry (GtkFontChooser *fontchooser,
gboolean show_preview_entry);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_font_chooser_set_filter_func (GtkFontChooser *fontchooser,
GtkFontFilterFunc filter,
gpointer user_data,
GDestroyNotify destroy);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_font_chooser_set_font_map (GtkFontChooser *fontchooser,
PangoFontMap *fontmap);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
PangoFontMap * gtk_font_chooser_get_font_map (GtkFontChooser *fontchooser);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_font_chooser_set_level (GtkFontChooser *fontchooser,
GtkFontChooserLevel level);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkFontChooserLevel
gtk_font_chooser_get_level (GtkFontChooser *fontchooser);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
char * gtk_font_chooser_get_font_features (GtkFontChooser *fontchooser);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
char * gtk_font_chooser_get_language (GtkFontChooser *fontchooser);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_font_chooser_set_language (GtkFontChooser *fontchooser,
const char *language);

View File

@@ -22,7 +22,7 @@
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkdialog.h>
#include <gtk/deprecated/gtkdialog.h>
G_BEGIN_DECLS
@@ -34,7 +34,7 @@ typedef struct _GtkFontChooserDialog GtkFontChooserDialog;
GDK_AVAILABLE_IN_ALL
GType gtk_font_chooser_dialog_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget* gtk_font_chooser_dialog_new (const char *title,
GtkWindow *parent);

View File

@@ -35,7 +35,7 @@ typedef struct _GtkFontChooserWidget GtkFontChooserWidget;
GDK_AVAILABLE_IN_ALL
GType gtk_font_chooser_widget_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget* gtk_font_chooser_widget_new (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkFontChooserWidget, g_object_unref)

File diff suppressed because it is too large Load Diff

View File

@@ -74,138 +74,138 @@ typedef enum
GDK_AVAILABLE_IN_ALL
GType gtk_icon_view_get_type (void) G_GNUC_CONST;
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
GtkWidget * gtk_icon_view_new (void);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
GtkWidget * gtk_icon_view_new_with_area (GtkCellArea *area);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
GtkWidget * gtk_icon_view_new_with_model (GtkTreeModel *model);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_model (GtkIconView *icon_view,
GtkTreeModel *model);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
GtkTreeModel * gtk_icon_view_get_model (GtkIconView *icon_view);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_text_column (GtkIconView *icon_view,
int column);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
int gtk_icon_view_get_text_column (GtkIconView *icon_view);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_markup_column (GtkIconView *icon_view,
int column);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
int gtk_icon_view_get_markup_column (GtkIconView *icon_view);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_pixbuf_column (GtkIconView *icon_view,
int column);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
int gtk_icon_view_get_pixbuf_column (GtkIconView *icon_view);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_item_orientation (GtkIconView *icon_view,
GtkOrientation orientation);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
GtkOrientation gtk_icon_view_get_item_orientation (GtkIconView *icon_view);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_columns (GtkIconView *icon_view,
int columns);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
int gtk_icon_view_get_columns (GtkIconView *icon_view);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_item_width (GtkIconView *icon_view,
int item_width);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
int gtk_icon_view_get_item_width (GtkIconView *icon_view);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_spacing (GtkIconView *icon_view,
int spacing);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
int gtk_icon_view_get_spacing (GtkIconView *icon_view);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_row_spacing (GtkIconView *icon_view,
int row_spacing);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
int gtk_icon_view_get_row_spacing (GtkIconView *icon_view);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_column_spacing (GtkIconView *icon_view,
int column_spacing);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
int gtk_icon_view_get_column_spacing (GtkIconView *icon_view);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_margin (GtkIconView *icon_view,
int margin);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
int gtk_icon_view_get_margin (GtkIconView *icon_view);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_item_padding (GtkIconView *icon_view,
int item_padding);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
int gtk_icon_view_get_item_padding (GtkIconView *icon_view);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
GtkTreePath * gtk_icon_view_get_path_at_pos (GtkIconView *icon_view,
int x,
int y);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
gboolean gtk_icon_view_get_item_at_pos (GtkIconView *icon_view,
int x,
int y,
GtkTreePath **path,
GtkCellRenderer **cell);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
gboolean gtk_icon_view_get_visible_range (GtkIconView *icon_view,
GtkTreePath **start_path,
GtkTreePath **end_path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_activate_on_single_click (GtkIconView *icon_view,
gboolean single);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
gboolean gtk_icon_view_get_activate_on_single_click (GtkIconView *icon_view);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_selected_foreach (GtkIconView *icon_view,
GtkIconViewForeachFunc func,
gpointer data);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_selection_mode (GtkIconView *icon_view,
GtkSelectionMode mode);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
GtkSelectionMode gtk_icon_view_get_selection_mode (GtkIconView *icon_view);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_select_path (GtkIconView *icon_view,
GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_unselect_path (GtkIconView *icon_view,
GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
gboolean gtk_icon_view_path_is_selected (GtkIconView *icon_view,
GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
int gtk_icon_view_get_item_row (GtkIconView *icon_view,
GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
int gtk_icon_view_get_item_column (GtkIconView *icon_view,
GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
GList *gtk_icon_view_get_selected_items (GtkIconView *icon_view);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_select_all (GtkIconView *icon_view);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_unselect_all (GtkIconView *icon_view);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_item_activated (GtkIconView *icon_view,
GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_cursor (GtkIconView *icon_view,
GtkTreePath *path,
GtkCellRenderer *cell,
gboolean start_editing);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
gboolean gtk_icon_view_get_cursor (GtkIconView *icon_view,
GtkTreePath **path,
GtkCellRenderer **cell);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_scroll_to_path (GtkIconView *icon_view,
GtkTreePath *path,
gboolean use_align,
@@ -213,62 +213,62 @@ void gtk_icon_view_scroll_to_path (GtkIconView *icon_
float col_align);
/* Drag-and-Drop support */
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_enable_model_drag_source (GtkIconView *icon_view,
GdkModifierType start_button_mask,
GdkContentFormats *formats,
GdkDragAction actions);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_enable_model_drag_dest (GtkIconView *icon_view,
GdkContentFormats *formats,
GdkDragAction actions);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_unset_model_drag_source (GtkIconView *icon_view);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_unset_model_drag_dest (GtkIconView *icon_view);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_reorderable (GtkIconView *icon_view,
gboolean reorderable);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
gboolean gtk_icon_view_get_reorderable (GtkIconView *icon_view);
/* These are useful to implement your own custom stuff. */
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_drag_dest_item (GtkIconView *icon_view,
GtkTreePath *path,
GtkIconViewDropPosition pos);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_get_drag_dest_item (GtkIconView *icon_view,
GtkTreePath **path,
GtkIconViewDropPosition *pos);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
gboolean gtk_icon_view_get_dest_item_at_pos (GtkIconView *icon_view,
int drag_x,
int drag_y,
GtkTreePath **path,
GtkIconViewDropPosition *pos);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
GdkPaintable *gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
gboolean gtk_icon_view_get_cell_rect (GtkIconView *icon_view,
GtkTreePath *path,
GtkCellRenderer *cell,
GdkRectangle *rect);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_tooltip_item (GtkIconView *icon_view,
GtkTooltip *tooltip,
GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_tooltip_cell (GtkIconView *icon_view,
GtkTooltip *tooltip,
GtkTreePath *path,
GtkCellRenderer *cell);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
gboolean gtk_icon_view_get_tooltip_context (GtkIconView *icon_view,
int x,
int y,
@@ -276,10 +276,10 @@ gboolean gtk_icon_view_get_tooltip_context (GtkIconView
GtkTreeModel **model,
GtkTreePath **path,
GtkTreeIter *iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
void gtk_icon_view_set_tooltip_column (GtkIconView *icon_view,
int column);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkGridView)
int gtk_icon_view_get_tooltip_column (GtkIconView *icon_view);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkIconView, g_object_unref)

View File

@@ -104,7 +104,11 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* }
* ```
*
* # Performance Considerations
* `GtkListStore` is deprecated since GTK 4.10, and should not be used in newly
* written code. You should use [class@Gio.ListStore] instead, and the various
* list models provided by GTK.
*
* ## Performance Considerations
*
* Internally, the `GtkListStore` was originally implemented with a linked list
* with a tail pointer. As a result, it was fast at data insertion and deletion,
@@ -114,7 +118,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* often and your code is expected to run on older versions of GTK, it is worth
* keeping the iter around.
*
* # Atomic Operations
* ## Atomic Operations
*
* It is important to note that only the methods
* gtk_list_store_insert_with_values() and gtk_list_store_insert_with_valuesv()
@@ -131,7 +135,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* `GtkTreeModel`FilterVisibleFunc to be visited with an empty row first; the
* function must be prepared for that.
*
* # GtkListStore as GtkBuildable
* ## GtkListStore as GtkBuildable
*
* The GtkListStore implementation of the [iface@Gtk.Buildable] interface allows
* to specify the model columns with a `<columns>` element that may contain
@@ -171,6 +175,8 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* </data>
* </object>
* ```
*
* Deprecated: 4.10: Use [class@Gio.ListStore] instead
*/
@@ -390,7 +396,7 @@ static gboolean
iter_is_valid (GtkTreeIter *iter,
GtkListStore *list_store)
{
return iter != NULL &&
return iter != NULL &&
iter->user_data != NULL &&
list_store->priv->stamp == iter->stamp &&
!g_sequence_iter_is_end (iter->user_data) &&
@@ -402,17 +408,27 @@ iter_is_valid (GtkTreeIter *iter,
* @n_columns: number of columns in the list store
* @...: all `GType` types for the columns, from first to last
*
* Creates a new list store as with @n_columns columns each of the types passed
* in. Note that only types derived from standard GObject fundamental types
* Creates a new list store.
*
* The list store will have @n_columns columns, with each column using
* the given type passed to this function.
*
*
* Note that only types derived from standard GObject fundamental types
* are supported.
*
* As an example, `gtk_list_store_new (3, G_TYPE_INT, G_TYPE_STRING,
* GDK_TYPE_TEXTURE);` will create a new `GtkListStore` with three columns, of type
* int, string and `GdkTexture`, respectively.
* As an example:
*
* ```c
* gtk_list_store_new (3, G_TYPE_INT, G_TYPE_STRING, GDK_TYPE_TEXTURE);
* ```
*
* will create a new `GtkListStore` with three columns, of type `int`,
* `gchararray` and `GdkTexture`, respectively.
*
* Returns: a new `GtkListStore`
*
* Deprecated: 4.10: Use list models
* Deprecated: 4.10: Use [class@Gio.ListStore] instead
*/
GtkListStore *
gtk_list_store_new (int n_columns,
@@ -455,11 +471,13 @@ gtk_list_store_new (int n_columns,
* @n_columns: number of columns in the list store
* @types: (array length=n_columns): an array of `GType` types for the columns, from first to last
*
* Non-vararg creation function. Used primarily by language bindings.
* Creates a new `GtkListStore`.
*
* This function is meant to be used by language bindings.
*
* Returns: (transfer full): a new `GtkListStore`
*
* Deprecated: 4.10: Use list models
* Deprecated: 4.10: Use [class@Gio.ListStore] instead
**/
GtkListStore *
gtk_list_store_newv (int n_columns,
@@ -494,10 +512,14 @@ gtk_list_store_newv (int n_columns,
* @n_columns: Number of columns for the list store
* @types: (array length=n_columns): An array length n of `GType`s
*
* This function is meant primarily for `GObject`s that inherit from `GtkListStore`,
* and should only be used when constructing a new `GtkListStore`. It will not
* function after a row has been added, or a method on the `GtkTreeModel`
* interface is called.
* Sets the types of the columns of a list store.
*
* This function is meant primarily for objects that inherit
* from `GtkListStore`, and should only be used when constructing
* a new instance.
*
* This function cannot be called after a row has been added, or
* a method on the `GtkTreeModel` interface is called.
*
* Deprecated: 4.10: Use list models
**/
@@ -661,10 +683,10 @@ gtk_list_store_get_path (GtkTreeModel *tree_model,
if (g_sequence_iter_is_end (iter->user_data))
return NULL;
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, g_sequence_iter_get_position (iter->user_data));
return path;
}
@@ -681,7 +703,7 @@ gtk_list_store_get_value (GtkTreeModel *tree_model,
g_return_if_fail (column < priv->n_columns);
g_return_if_fail (iter_is_valid (iter, list_store));
list = g_sequence_get (iter->user_data);
while (tmp_column-- > 0 && list)
@@ -998,8 +1020,8 @@ gtk_list_store_set_vector_internal (GtkListStore *list_store,
for (i = 0; i < n_values; i++)
{
*emit_signal = gtk_list_store_real_set_value (list_store,
iter,
*emit_signal = gtk_list_store_real_set_value (list_store,
iter,
columns[i],
&values[i],
FALSE) || *emit_signal;
@@ -1057,7 +1079,7 @@ gtk_list_store_set_valist_internal (GtkListStore *list_store,
column,
&value,
FALSE) || *emit_signal;
if (func == _gtk_tree_data_list_compare_func &&
column == priv->sort_column_id)
*maybe_need_sort = TRUE;
@@ -1078,7 +1100,7 @@ gtk_list_store_set_valist_internal (GtkListStore *list_store,
*
* A variant of gtk_list_store_set_valist() which
* takes the columns and values as two arrays, instead of
* varargs. This function is mainly intended for
* varargs. This function is mainly intended for
* language-bindings and in case the number of columns to
* change is not known until run-time.
*
@@ -1143,8 +1165,8 @@ gtk_list_store_set_valist (GtkListStore *list_store,
priv = list_store->priv;
gtk_list_store_set_valist_internal (list_store, iter,
&emit_signal,
gtk_list_store_set_valist_internal (list_store, iter,
&emit_signal,
&maybe_need_sort,
var_args);
@@ -1196,8 +1218,8 @@ gtk_list_store_set (GtkListStore *list_store,
* @list_store: A `GtkListStore`
* @iter: A valid `GtkTreeIter`
*
* Removes the given row from the list store. After being removed,
* @iter is set to be the next valid row, or invalidated if it pointed
* Removes the given row from the list store. After being removed,
* @iter is set to be the next valid row, or invalidated if it pointed
* to the last row in @list_store.
*
* Returns: %TRUE if @iter is valid, %FALSE if not.
@@ -1221,12 +1243,12 @@ gtk_list_store_remove (GtkListStore *list_store,
ptr = iter->user_data;
next = g_sequence_iter_next (ptr);
_gtk_tree_data_list_free (g_sequence_get (ptr), priv->column_headers);
g_sequence_remove (iter->user_data);
priv->length--;
gtk_tree_model_row_deleted (GTK_TREE_MODEL (list_store), path);
gtk_tree_path_free (path);
@@ -1290,7 +1312,7 @@ gtk_list_store_insert (GtkListStore *list_store,
g_assert (iter_is_valid (iter, list_store));
priv->length++;
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, position);
gtk_tree_model_row_inserted (GTK_TREE_MODEL (list_store), path, iter);
@@ -1303,9 +1325,9 @@ gtk_list_store_insert (GtkListStore *list_store,
* @iter: (out): An unset `GtkTreeIter` to set to the new row
* @sibling: (nullable): A valid `GtkTreeIter`
*
* Inserts a new row before @sibling. If @sibling is %NULL, then the row will
* be appended to the end of the list. @iter will be changed to point to this
* new row. The row will be empty after this function is called. To fill in
* Inserts a new row before @sibling. If @sibling is %NULL, then the row will
* be appended to the end of the list. @iter will be changed to point to this
* new row. The row will be empty after this function is called. To fill in
* values, you need to call gtk_list_store_set() or gtk_list_store_set_value().
*
* Deprecated: 4.10: Use list models
@@ -1317,7 +1339,7 @@ gtk_list_store_insert_before (GtkListStore *list_store,
{
GtkListStorePrivate *priv;
GSequenceIter *after;
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
g_return_if_fail (iter != NULL);
@@ -1429,7 +1451,7 @@ gtk_list_store_increment_stamp (GtkListStore *list_store)
* gtk_list_store_clear:
* @list_store: a `GtkListStore`.
*
* Removes all rows from the list store.
* Removes all rows from the list store.
*
* Deprecated: 4.10: Use list models
**/
@@ -1506,7 +1528,7 @@ static gboolean real_gtk_list_store_row_draggable (GtkTreeDragSource *drag_sourc
{
return TRUE;
}
static gboolean
gtk_list_store_drag_data_delete (GtkTreeDragSource *drag_source,
GtkTreePath *path)
@@ -1677,7 +1699,7 @@ gtk_list_store_row_drop_possible (GtkTreeDragDest *drag_dest,
out:
if (src_path)
gtk_tree_path_free (src_path);
return retval;
}
@@ -1699,7 +1721,7 @@ gtk_list_store_reorder_func (GSequenceIter *a,
return 1;
return 0;
}
/**
* gtk_list_store_reorder:
* @store: A `GtkListStore`.
@@ -1723,7 +1745,7 @@ gtk_list_store_reorder (GtkListStore *store,
GHashTable *new_positions;
GSequenceIter *ptr;
int *order;
g_return_if_fail (GTK_IS_LIST_STORE (store));
g_return_if_fail (!GTK_LIST_STORE_IS_SORTED (store));
g_return_if_fail (new_order != NULL);
@@ -1733,7 +1755,7 @@ gtk_list_store_reorder (GtkListStore *store,
order = g_new (int, g_sequence_get_length (priv->seq));
for (i = 0; i < g_sequence_get_length (priv->seq); i++)
order[new_order[i]] = i;
new_positions = g_hash_table_new (g_direct_hash, g_direct_equal);
ptr = g_sequence_get_begin_iter (priv->seq);
@@ -1745,11 +1767,11 @@ gtk_list_store_reorder (GtkListStore *store,
ptr = g_sequence_iter_next (ptr);
}
g_free (order);
g_sequence_sort_iter (priv->seq, gtk_list_store_reorder_func, new_positions);
g_hash_table_destroy (new_positions);
/* emit signal */
path = gtk_tree_path_new ();
gtk_tree_model_rows_reordered (GTK_TREE_MODEL (store),
@@ -1828,12 +1850,12 @@ gtk_list_store_swap (GtkListStore *store,
return;
old_positions = save_positions (priv->seq);
g_sequence_swap (a->user_data, b->user_data);
order = generate_order (priv->seq, old_positions);
path = gtk_tree_path_new ();
gtk_tree_model_rows_reordered (GTK_TREE_MODEL (store),
path, NULL, order);
@@ -1882,7 +1904,7 @@ gtk_list_store_move_before (GtkListStore *store,
GtkTreeIter *position)
{
int pos;
g_return_if_fail (GTK_IS_LIST_STORE (store));
g_return_if_fail (!GTK_LIST_STORE_IS_SORTED (store));
g_return_if_fail (iter_is_valid (iter, store));
@@ -1893,7 +1915,7 @@ gtk_list_store_move_before (GtkListStore *store,
pos = g_sequence_iter_get_position (position->user_data);
else
pos = -1;
gtk_list_store_move_to (store, iter, pos);
}
@@ -1915,7 +1937,7 @@ gtk_list_store_move_after (GtkListStore *store,
GtkTreeIter *position)
{
int pos;
g_return_if_fail (GTK_IS_LIST_STORE (store));
g_return_if_fail (!GTK_LIST_STORE_IS_SORTED (store));
g_return_if_fail (iter_is_valid (iter, store));
@@ -1926,10 +1948,10 @@ gtk_list_store_move_after (GtkListStore *store,
pos = g_sequence_iter_get_position (position->user_data) + 1;
else
pos = 0;
gtk_list_store_move_to (store, iter, pos);
}
/* Sorting */
static int
gtk_list_store_compare_func (GSequenceIter *a,
@@ -2029,7 +2051,7 @@ iter_is_sorted (GtkListStore *list_store,
if (gtk_list_store_compare_func (iter->user_data, cmp, list_store) > 0)
return FALSE;
}
return TRUE;
}
@@ -2102,7 +2124,7 @@ gtk_list_store_set_sort_column_id (GtkTreeSortable *sortable,
{
GtkTreeDataSortHeader *header = NULL;
header = _gtk_tree_data_list_get_header (priv->sort_list,
header = _gtk_tree_data_list_get_header (priv->sort_list,
sort_column_id);
/* We want to make sure that we have a function */
@@ -2134,8 +2156,8 @@ gtk_list_store_set_sort_func (GtkTreeSortable *sortable,
GtkListStore *list_store = GTK_LIST_STORE (sortable);
GtkListStorePrivate *priv = list_store->priv;
priv->sort_list = _gtk_tree_data_list_set_header (priv->sort_list,
sort_column_id,
priv->sort_list = _gtk_tree_data_list_set_header (priv->sort_list,
sort_column_id,
func, data, destroy);
if (priv->sort_column_id == sort_column_id)
@@ -2262,7 +2284,7 @@ gtk_list_store_insert_with_values (GtkListStore *list_store,
priv->length++;
va_start (var_args, position);
gtk_list_store_set_valist_internal (list_store, iter,
gtk_list_store_set_valist_internal (list_store, iter,
&changed, &maybe_need_sort,
var_args);
va_end (var_args);
@@ -2286,9 +2308,9 @@ gtk_list_store_insert_with_values (GtkListStore *list_store,
* @iter: (out) (optional): An unset `GtkTreeIter` to set to the new row
* @position: position to insert the new row, or -1 for last
* @columns: (array length=n_values): an array of column numbers
* @values: (array length=n_values): an array of GValues
* @values: (array length=n_values): an array of GValues
* @n_values: the length of the @columns and @values arrays
*
*
* A variant of gtk_list_store_insert_with_values() which
* takes the columns and values as two arrays, instead of
* varargs.
@@ -2301,7 +2323,7 @@ void
gtk_list_store_insert_with_valuesv (GtkListStore *list_store,
GtkTreeIter *iter,
int position,
int *columns,
int *columns,
GValue *values,
int n_values)
{
@@ -2314,8 +2336,8 @@ gtk_list_store_insert_with_valuesv (GtkListStore *list_store,
gboolean changed = FALSE;
gboolean maybe_need_sort = FALSE;
/* FIXME refactor to reduce overlap with
* gtk_list_store_insert_with_values()
/* FIXME refactor to reduce overlap with
* gtk_list_store_insert_with_values()
*/
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
@@ -2340,7 +2362,7 @@ gtk_list_store_insert_with_valuesv (GtkListStore *list_store,
g_assert (iter_is_valid (iter, list_store));
priv->length++;
priv->length++;
gtk_list_store_set_vector_internal (list_store, iter,
&changed, &maybe_need_sort,

View File

@@ -60,88 +60,88 @@ struct _GtkListStoreClass
GDK_AVAILABLE_IN_ALL
GType gtk_list_store_get_type (void) G_GNUC_CONST;
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
GtkListStore *gtk_list_store_new (int n_columns,
...);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
GtkListStore *gtk_list_store_newv (int n_columns,
GType *types);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
void gtk_list_store_set_column_types (GtkListStore *list_store,
int n_columns,
GType *types);
/* NOTE: use gtk_tree_model_get to get values from a GtkListStore */
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
void gtk_list_store_set_value (GtkListStore *list_store,
GtkTreeIter *iter,
int column,
GValue *value);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
void gtk_list_store_set (GtkListStore *list_store,
GtkTreeIter *iter,
...);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
void gtk_list_store_set_valuesv (GtkListStore *list_store,
GtkTreeIter *iter,
int *columns,
GValue *values,
int n_values);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
void gtk_list_store_set_valist (GtkListStore *list_store,
GtkTreeIter *iter,
va_list var_args);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
gboolean gtk_list_store_remove (GtkListStore *list_store,
GtkTreeIter *iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
void gtk_list_store_insert (GtkListStore *list_store,
GtkTreeIter *iter,
int position);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
void gtk_list_store_insert_before (GtkListStore *list_store,
GtkTreeIter *iter,
GtkTreeIter *sibling);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
void gtk_list_store_insert_after (GtkListStore *list_store,
GtkTreeIter *iter,
GtkTreeIter *sibling);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
void gtk_list_store_insert_with_values (GtkListStore *list_store,
GtkTreeIter *iter,
int position,
...);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
void gtk_list_store_insert_with_valuesv (GtkListStore *list_store,
GtkTreeIter *iter,
int position,
int *columns,
GValue *values,
int n_values);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
void gtk_list_store_prepend (GtkListStore *list_store,
GtkTreeIter *iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
void gtk_list_store_append (GtkListStore *list_store,
GtkTreeIter *iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
void gtk_list_store_clear (GtkListStore *list_store);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
gboolean gtk_list_store_iter_is_valid (GtkListStore *list_store,
GtkTreeIter *iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
void gtk_list_store_reorder (GtkListStore *store,
int *new_order);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
void gtk_list_store_swap (GtkListStore *store,
GtkTreeIter *a,
GtkTreeIter *b);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
void gtk_list_store_move_after (GtkListStore *store,
GtkTreeIter *iter,
GtkTreeIter *position);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListStore)
void gtk_list_store_move_before (GtkListStore *store,
GtkTreeIter *iter,
GtkTreeIter *position);

View File

@@ -29,7 +29,7 @@
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkdialog.h>
#include <gtk/deprecated/gtkdialog.h>
#include <gtk/gtkenums.h>
G_BEGIN_DECLS
@@ -78,7 +78,7 @@ typedef enum
GDK_AVAILABLE_IN_ALL
GType gtk_message_dialog_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget* gtk_message_dialog_new (GtkWindow *parent,
GtkDialogFlags flags,
GtkMessageType type,
@@ -86,7 +86,7 @@ GtkWidget* gtk_message_dialog_new (GtkWindow *parent,
const char *message_format,
...) G_GNUC_PRINTF (5, 6);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget* gtk_message_dialog_new_with_markup (GtkWindow *parent,
GtkDialogFlags flags,
GtkMessageType type,
@@ -94,21 +94,21 @@ GtkWidget* gtk_message_dialog_new_with_markup (GtkWindow *parent,
const char *message_format,
...) G_GNUC_PRINTF (5, 6);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_message_dialog_set_markup (GtkMessageDialog *message_dialog,
const char *str);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_message_dialog_format_secondary_text (GtkMessageDialog *message_dialog,
const char *message_format,
...) G_GNUC_PRINTF (2, 3);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_message_dialog_format_secondary_markup (GtkMessageDialog *message_dialog,
const char *message_format,
...) G_GNUC_PRINTF (2, 3);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget *gtk_message_dialog_get_message_area (GtkMessageDialog *message_dialog);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkMessageDialog, g_object_unref)

View File

@@ -48,7 +48,7 @@
* and RTL/LTR information set. The style context will also be updated
* automatically if any of these settings change on the widget.
*
* # Style Classes
* ## Style Classes
*
* Widgets can add style classes to their context, which can be used to associate
* different styles by class. The documentation for individual widgets lists
@@ -71,6 +71,10 @@
* `XDG_CONFIG_HOME/gtk-4.0/gtk.css` will
* still take precedence over your changes, as it uses the
* %GTK_STYLE_PROVIDER_PRIORITY_USER priority.
*
* Deprecated: 4.10: The relevant API has been moved to [class@Gtk.Widget]
* where applicable; otherwise, there is no replacement for querying the
* style machinery. Stylable UI elements should use widgets.
*/
#define CURSOR_ASPECT_RATIO (0.04)

View File

@@ -49,12 +49,18 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* GtkTreeDragDest:
*
* Interface for Drag-and-Drop destinations in `GtkTreeView`.
*
* Deprecated: 4.10: List views use widgets to display their contents.
* You can use [class@Gtk.DropTarget] to implement a drop destination
*/
/**
* GtkTreeDragSource:
*
* Interface for Drag-and-Drop destinations in `GtkTreeView`.
*
* Deprecated: 4.10: List views use widgets to display their contents.
* You can use [class@Gtk.DragSource] to implement a drag source
*/
GType
@@ -77,11 +83,11 @@ gtk_tree_drag_source_get_type (void)
NULL
};
our_type = g_type_register_static (G_TYPE_INTERFACE,
our_type = g_type_register_static (G_TYPE_INTERFACE,
I_("GtkTreeDragSource"),
&our_info, 0);
}
return our_type;
}
@@ -108,7 +114,7 @@ gtk_tree_drag_dest_get_type (void)
our_type = g_type_register_static (G_TYPE_INTERFACE, I_("GtkTreeDragDest"), &our_info, 0);
}
return our_type;
}
@@ -116,7 +122,7 @@ gtk_tree_drag_dest_get_type (void)
* gtk_tree_drag_source_row_draggable:
* @drag_source: a `GtkTreeDragSource`
* @path: row on which user is initiating a drag
*
*
* Asks the `GtkTreeDragSource` whether a particular row can be used as
* the source of a DND operation. If the source doesnt implement
* this interface, the row is assumed draggable.
@@ -147,13 +153,13 @@ gtk_tree_drag_source_row_draggable (GtkTreeDragSource *drag_source,
* gtk_tree_drag_source_drag_data_delete:
* @drag_source: a `GtkTreeDragSource`
* @path: row that was being dragged
*
*
* Asks the `GtkTreeDragSource` to delete the row at @path, because
* it was moved somewhere else via drag-and-drop. Returns %FALSE
* if the deletion fails because @path no longer exists, or for
* some model-specific reason. Should robustly handle a @path no
* longer found in the model!
*
*
* Returns: %TRUE if the row was successfully deleted
*
* Deprecated: 4.10: Use list models instead
@@ -174,11 +180,11 @@ gtk_tree_drag_source_drag_data_delete (GtkTreeDragSource *drag_source,
* gtk_tree_drag_source_drag_data_get:
* @drag_source: a `GtkTreeDragSource`
* @path: row that was dragged
*
*
* Asks the `GtkTreeDragSource` to return a `GdkContentProvider` representing
* the row at @path. Should robustly handle a @path no
* longer found in the model!
*
*
* Returns: (nullable) (transfer full): a `GdkContentProvider` for the
* given @path
*
@@ -201,14 +207,14 @@ gtk_tree_drag_source_drag_data_get (GtkTreeDragSource *drag_source,
* @drag_dest: a `GtkTreeDragDest`
* @dest: row to drop in front of
* @value: data to drop
*
*
* Asks the `GtkTreeDragDest` to insert a row before the path @dest,
* deriving the contents of the row from @value. If @dest is
* outside the tree so that inserting before it is impossible, %FALSE
* will be returned. Also, %FALSE may be returned if the new row is
* not created for some model-specific reason. Should robustly handle
* a @dest no longer found in the model!
*
*
* Returns: whether a new row was created before position @dest
*
* Deprecated: 4.10: Use list models instead
@@ -233,13 +239,13 @@ gtk_tree_drag_dest_drag_data_received (GtkTreeDragDest *drag_dest,
* @drag_dest: a `GtkTreeDragDest`
* @dest_path: destination row
* @value: the data being dropped
*
*
* Determines whether a drop is possible before the given @dest_path,
* at the same depth as @dest_path. i.e., can we drop the data in
* @value at that location. @dest_path does not have to
* exist; the return value will almost certainly be %FALSE if the
* parent of @dest_path doesnt exist, though.
*
*
* Returns: %TRUE if a drop is possible before @dest_path
*
* Deprecated: 4.10: Use list models instead
@@ -281,9 +287,9 @@ G_DEFINE_BOXED_TYPE (GtkTreeRowData, gtk_tree_row_data,
* gtk_tree_create_row_drag_content:
* @tree_model: a `GtkTreeModel`
* @path: a row in @tree_model
*
*
* Creates a content provider for dragging @path from @tree_model.
*
*
* Returns: (transfer full): a new `GdkContentProvider`
*
* Deprecated: 4.10: Use list models instead
@@ -297,7 +303,7 @@ gtk_tree_create_row_drag_content (GtkTreeModel *tree_model,
char *path_str;
int len;
int struct_size;
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
g_return_val_if_fail (path != NULL, FALSE);
@@ -309,18 +315,18 @@ gtk_tree_create_row_drag_content (GtkTreeModel *tree_model,
struct_size = sizeof (GtkTreeRowData) + len + 1 -
(sizeof (GtkTreeRowData) - G_STRUCT_OFFSET (GtkTreeRowData, path));
trd = g_malloc (struct_size);
trd = g_malloc (struct_size);
strcpy (trd->path, path_str);
g_free (path_str);
trd->model = tree_model;
content = gdk_content_provider_new_typed (GTK_TYPE_TREE_ROW_DATA, trd);
g_free (trd);
return content;
}
@@ -329,12 +335,12 @@ gtk_tree_create_row_drag_content (GtkTreeModel *tree_model,
* @value: a `GValue`
* @tree_model: (nullable) (optional) (transfer none) (out): a `GtkTreeModel`
* @path: (nullable) (optional) (out): row in @tree_model
*
*
* Obtains a @tree_model and @path from value of target type
* %GTK_TYPE_TREE_ROW_DATA.
*
* The returned path must be freed with gtk_tree_path_free().
*
*
* Returns: %TRUE if @selection_data had target type %GTK_TYPE_TREE_ROW_DATA
* is otherwise valid
*
@@ -346,8 +352,8 @@ gtk_tree_get_row_drag_data (const GValue *value,
GtkTreePath **path)
{
GtkTreeRowData *trd;
g_return_val_if_fail (value != NULL, FALSE);
g_return_val_if_fail (value != NULL, FALSE);
if (tree_model)
*tree_model = NULL;
@@ -367,6 +373,6 @@ gtk_tree_get_row_drag_data (const GValue *value,
if (path)
*path = gtk_tree_path_new_from_string (trd->path);
return TRUE;
}

View File

@@ -74,23 +74,23 @@ struct _GtkTreeDragSourceIface
GtkTreePath *path);
};
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDragSource)
GType gtk_tree_drag_source_get_type (void) G_GNUC_CONST;
/* Returns whether the given row can be dragged */
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDragSource)
gboolean gtk_tree_drag_source_row_draggable (GtkTreeDragSource *drag_source,
GtkTreePath *path);
/* Deletes the given row, or returns FALSE if it can't */
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDragSource)
gboolean gtk_tree_drag_source_drag_data_delete (GtkTreeDragSource *drag_source,
GtkTreePath *path);
/* Fills in selection_data with type selection_data->target based on
* the row denoted by path, returns TRUE if it does anything
*/
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDragSource)
GdkContentProvider *
gtk_tree_drag_source_drag_data_get (GtkTreeDragSource *drag_source,
GtkTreePath *path);
@@ -129,20 +129,20 @@ struct _GtkTreeDragDestIface
const GValue *value);
};
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropTarget)
GType gtk_tree_drag_dest_get_type (void) G_GNUC_CONST;
/* Inserts a row before dest which contains data in selection_data,
* or returns FALSE if it can't
*/
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropTarget)
gboolean gtk_tree_drag_dest_drag_data_received (GtkTreeDragDest *drag_dest,
GtkTreePath *dest,
const GValue *value);
/* Returns TRUE if we can drop before path; path may not exist. */
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDropTarget)
gboolean gtk_tree_drag_dest_row_drop_possible (GtkTreeDragDest *drag_dest,
GtkTreePath *dest_path,
const GValue *value);
@@ -151,11 +151,11 @@ gboolean gtk_tree_drag_dest_row_drop_possible (GtkTreeDragDest *drag_dest,
/* The selection data would normally have target type GTK_TREE_MODEL_ROW in this
* case. If the target is wrong these functions return FALSE.
*/
GDK_DEPRECATED_IN_4_10
GdkContentProvider *
GDK_DEPRECATED_IN_4_10_FOR(GtkDragSource and GtkDropTarget)
GdkContentProvider *
gtk_tree_create_row_drag_content (GtkTreeModel *tree_model,
GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkDragSource and GtkDropTarget)
gboolean gtk_tree_get_row_drag_data (const GValue *value,
GtkTreeModel **tree_model,
GtkTreePath **path);

View File

@@ -228,6 +228,8 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* required for levels in which nodes are referenced. For the root level
* however, signals must be emitted at all times (however the root level
* is always referenced when any view is attached).
*
* Deprecated: 4.10: Use [iface@Gio.ListModel] instead
*/
#define INITIALIZE_TREE_ITER(Iter) \
@@ -362,7 +364,7 @@ gtk_tree_model_base_init (gpointer g_class)
tree_model_signals[ROW_CHANGED] =
g_signal_new (I_("row-changed"),
GTK_TYPE_TREE_MODEL,
G_SIGNAL_RUN_LAST,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkTreeModelIface, row_changed),
NULL, NULL,
_gtk_marshal_VOID__BOXED_BOXED,

View File

@@ -192,57 +192,57 @@ struct _GtkTreeModelIface
/* GtkTreePath operations */
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
GtkTreePath *gtk_tree_path_new (void);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
GtkTreePath *gtk_tree_path_new_from_string (const char *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
GtkTreePath *gtk_tree_path_new_from_indices (int first_index,
...);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
GtkTreePath *gtk_tree_path_new_from_indicesv (int *indices,
gsize length);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
char *gtk_tree_path_to_string (GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
GtkTreePath *gtk_tree_path_new_first (void);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_path_append_index (GtkTreePath *path,
int index_);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_path_prepend_index (GtkTreePath *path,
int index_);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
int gtk_tree_path_get_depth (GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
int *gtk_tree_path_get_indices (GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
int *gtk_tree_path_get_indices_with_depth (GtkTreePath *path,
int *depth);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_path_free (GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
GtkTreePath *gtk_tree_path_copy (const GtkTreePath *path);
GDK_AVAILABLE_IN_ALL
GType gtk_tree_path_get_type (void) G_GNUC_CONST;
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
int gtk_tree_path_compare (const GtkTreePath *a,
const GtkTreePath *b);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_path_next (GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
gboolean gtk_tree_path_prev (GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
gboolean gtk_tree_path_up (GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_path_down (GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
gboolean gtk_tree_path_is_ancestor (GtkTreePath *path,
GtkTreePath *descendant);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
gboolean gtk_tree_path_is_descendant (GtkTreePath *path,
GtkTreePath *ancestor);
@@ -256,147 +256,147 @@ gboolean gtk_tree_path_is_descendant (GtkTreePath *path,
GDK_AVAILABLE_IN_ALL
GType gtk_tree_row_reference_get_type (void) G_GNUC_CONST;
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
GtkTreeRowReference *gtk_tree_row_reference_new (GtkTreeModel *model,
GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
GtkTreeRowReference *gtk_tree_row_reference_new_proxy (GObject *proxy,
GtkTreeModel *model,
GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
GtkTreePath *gtk_tree_row_reference_get_path (GtkTreeRowReference *reference);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
GtkTreeModel *gtk_tree_row_reference_get_model (GtkTreeRowReference *reference);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
gboolean gtk_tree_row_reference_valid (GtkTreeRowReference *reference);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
GtkTreeRowReference *gtk_tree_row_reference_copy (GtkTreeRowReference *reference);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_row_reference_free (GtkTreeRowReference *reference);
/* These two functions are only needed if you created the row reference with a
* proxy object */
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_row_reference_inserted (GObject *proxy,
GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_row_reference_deleted (GObject *proxy,
GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_row_reference_reordered (GObject *proxy,
GtkTreePath *path,
GtkTreeIter *iter,
int *new_order);
/* GtkTreeIter operations */
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
GtkTreeIter * gtk_tree_iter_copy (GtkTreeIter *iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_iter_free (GtkTreeIter *iter);
GDK_AVAILABLE_IN_ALL
GType gtk_tree_iter_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GType gtk_tree_model_get_type (void) G_GNUC_CONST;
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
GtkTreeModelFlags gtk_tree_model_get_flags (GtkTreeModel *tree_model);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
int gtk_tree_model_get_n_columns (GtkTreeModel *tree_model);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
GType gtk_tree_model_get_column_type (GtkTreeModel *tree_model,
int index_);
/* Iterator movement */
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
gboolean gtk_tree_model_get_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
gboolean gtk_tree_model_get_iter_from_string (GtkTreeModel *tree_model,
GtkTreeIter *iter,
const char *path_string);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
char * gtk_tree_model_get_string_from_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
gboolean gtk_tree_model_get_iter_first (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
GtkTreePath * gtk_tree_model_get_path (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_model_get_value (GtkTreeModel *tree_model,
GtkTreeIter *iter,
int column,
GValue *value);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
gboolean gtk_tree_model_iter_previous (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
gboolean gtk_tree_model_iter_next (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
gboolean gtk_tree_model_iter_children (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
gboolean gtk_tree_model_iter_has_child (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
int gtk_tree_model_iter_n_children (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
gboolean gtk_tree_model_iter_nth_child (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent,
int n);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
gboolean gtk_tree_model_iter_parent (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *child);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_model_ref_node (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_model_unref_node (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_model_get (GtkTreeModel *tree_model,
GtkTreeIter *iter,
...);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_model_get_valist (GtkTreeModel *tree_model,
GtkTreeIter *iter,
va_list var_args);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_model_foreach (GtkTreeModel *model,
GtkTreeModelForeachFunc func,
gpointer user_data);
/* Signals */
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_model_row_changed (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_model_row_inserted (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_model_row_has_child_toggled (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_model_row_deleted (GtkTreeModel *tree_model,
GtkTreePath *path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_model_rows_reordered (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter,
int *new_order);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GListModel)
void gtk_tree_model_rows_reordered_with_length (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter,

View File

@@ -31,13 +31,13 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
*
* A `GtkTreeModelFilter` is a tree model which wraps another tree model,
* and can do the following things:
*
*
* - Filter specific rows, based on data from a “visible column”, a column
* storing booleans indicating whether the row should be filtered or not,
* or based on the return value of a “visible function”, which gets a
* model, iter and user_data and returns a boolean indicating whether the
* row should be filtered or not.
*
*
* - Modify the “appearance” of the model, using a modify function.
* This is extremely powerful and allows for just changing some
* values and also for creating a completely different model based
@@ -94,6 +94,8 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* because it does not implement reference counting, or for models that
* do implement reference counting, obtain references on these child levels
* yourself.
*
* Deprecated: 4.10: Use [class@Gtk.FilterListModel] instead.
*/
/* Notes on this implementation of GtkTreeModelFilter
@@ -588,7 +590,7 @@ gtk_tree_model_filter_finalize (GObject *object)
gtk_tree_model_filter_free_level (filter, filter->priv->root, TRUE, TRUE, FALSE);
g_free (filter->priv->modify_types);
if (filter->priv->modify_destroy)
filter->priv->modify_destroy (filter->priv->modify_data);
@@ -3801,7 +3803,7 @@ gtk_tree_model_filter_get_model (GtkTreeModelFilter *filter)
* %FALSE otherwise.
*
* If the condition calculated by the function changes over time (e.g.
* because it depends on some global parameters), you must call
* because it depends on some global parameters), you must call
* gtk_tree_model_filter_refilter() to keep the visibility information
* of the model up-to-date.
*
@@ -3864,8 +3866,8 @@ gtk_tree_model_filter_set_visible_func (GtkTreeModelFilter *filter,
* types for this model (which will be exposed to the parent model/view).
* The @func, @data and @destroy parameters are for specifying the modify
* function. The modify function will get called for each
* data access, the goal of the modify function is to return the data which
* should be displayed at the location specified using the parameters of the
* data access, the goal of the modify function is to return the data which
* should be displayed at the location specified using the parameters of the
* modify function.
*
* Note that gtk_tree_model_filter_set_modify_func()

View File

@@ -105,48 +105,48 @@ struct _GtkTreeModelFilterClass
/* base */
GDK_AVAILABLE_IN_ALL
GType gtk_tree_model_filter_get_type (void) G_GNUC_CONST;
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkFilterListModel)
GtkTreeModel *gtk_tree_model_filter_new (GtkTreeModel *child_model,
GtkTreePath *root);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkFilterListModel)
void gtk_tree_model_filter_set_visible_func (GtkTreeModelFilter *filter,
GtkTreeModelFilterVisibleFunc func,
gpointer data,
GDestroyNotify destroy);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkFilterListModel)
void gtk_tree_model_filter_set_modify_func (GtkTreeModelFilter *filter,
int n_columns,
GType *types,
GtkTreeModelFilterModifyFunc func,
gpointer data,
GDestroyNotify destroy);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkFilterListModel)
void gtk_tree_model_filter_set_visible_column (GtkTreeModelFilter *filter,
int column);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkFilterListModel)
GtkTreeModel *gtk_tree_model_filter_get_model (GtkTreeModelFilter *filter);
/* conversion */
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkFilterListModel)
gboolean gtk_tree_model_filter_convert_child_iter_to_iter (GtkTreeModelFilter *filter,
GtkTreeIter *filter_iter,
GtkTreeIter *child_iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkFilterListModel)
void gtk_tree_model_filter_convert_iter_to_child_iter (GtkTreeModelFilter *filter,
GtkTreeIter *child_iter,
GtkTreeIter *filter_iter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkFilterListModel)
GtkTreePath *gtk_tree_model_filter_convert_child_path_to_path (GtkTreeModelFilter *filter,
GtkTreePath *child_path);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkFilterListModel)
GtkTreePath *gtk_tree_model_filter_convert_path_to_child_path (GtkTreeModelFilter *filter,
GtkTreePath *filter_path);
/* extras */
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkFilterListModel)
void gtk_tree_model_filter_refilter (GtkTreeModelFilter *filter);
GDK_DEPRECATED_IN_4_10
GDK_DEPRECATED_IN_4_10_FOR(GtkFilterListModel)
void gtk_tree_model_filter_clear_cache (GtkTreeModelFilter *filter);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreeModelFilter, g_object_unref)

View File

@@ -127,6 +127,8 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* g_free (modified_data);
* }
* ]|
*
* Deprecated: 4.10: Use [class@Gtk.SortListModel] instead
*/
@@ -659,13 +661,13 @@ fill_sort_data (SortData *data,
if (priv->sort_column_id != GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID)
{
GtkTreeDataSortHeader *header;
header = _gtk_tree_data_list_get_header (priv->sort_list,
priv->sort_column_id);
g_return_if_fail (header != NULL);
g_return_if_fail (header->func != NULL);
data->sort_func = header->func;
data->sort_data = header->data;
}
@@ -1421,7 +1423,7 @@ gtk_tree_model_sort_iter_children (GtkTreeModel *tree_model,
iter->stamp = 0;
g_return_val_if_fail (priv->child_model != NULL, FALSE);
if (parent)
if (parent)
g_return_val_if_fail (VALID_ITER (parent, tree_model_sort), FALSE);
if (parent == NULL)
@@ -1482,7 +1484,7 @@ gtk_tree_model_sort_iter_n_children (GtkTreeModel *tree_model,
GtkTreeIter child_iter;
g_return_val_if_fail (priv->child_model != NULL, 0);
if (iter)
if (iter)
g_return_val_if_fail (VALID_ITER (iter, tree_model_sort), 0);
if (iter == NULL)
@@ -1504,7 +1506,7 @@ gtk_tree_model_sort_iter_nth_child (GtkTreeModel *tree_model,
/* We have this for the iter == parent case */
GtkTreeIter children;
if (parent)
if (parent)
g_return_val_if_fail (VALID_ITER (parent, tree_model_sort), FALSE);
/* Use this instead of has_child to force us to build the level, if needed */
@@ -1532,7 +1534,7 @@ static gboolean
gtk_tree_model_sort_iter_parent (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *child)
{
{
GtkTreeModelSort *tree_model_sort = (GtkTreeModelSort *) tree_model;
GtkTreeModelSortPrivate *priv = tree_model_sort->priv;
SortLevel *level;
@@ -1670,7 +1672,7 @@ gtk_tree_model_sort_get_sort_column_id (GtkTreeSortable *sortable,
if (priv->sort_column_id == GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID ||
priv->sort_column_id == GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID)
return FALSE;
return TRUE;
}
@@ -2111,9 +2113,9 @@ gtk_tree_model_sort_elt_get_path (SortLevel *level,
* @tree_model_sort: The `GtkTreeModelSort`.
* @child_model: (nullable): A `GtkTreeModel`
*
* Sets the model of @tree_model_sort to be @model. If @model is %NULL,
* then the old model is unset. The sort function is unset as a result
* of this call. The model will be in an unsorted state until a sort
* Sets the model of @tree_model_sort to be @model. If @model is %NULL,
* then the old model is unset. The sort function is unset as a result
* of this call. The model will be in an unsorted state until a sort
* function is set.
*
* Deprecated: 4.10
@@ -2274,12 +2276,12 @@ gtk_real_tree_model_sort_convert_child_path_to_path (GtkTreeModelSort *tree_mode
* gtk_tree_model_sort_convert_child_path_to_path:
* @tree_model_sort: A `GtkTreeModelSort`
* @child_path: A `GtkTreePath` to convert
*
*
* Converts @child_path to a path relative to @tree_model_sort. That is,
* @child_path points to a path in the child model. The returned path will
* point to the same row in the sorted model. If @child_path isnt a valid
* point to the same row in the sorted model. If @child_path isnt a valid
* path on the child model, then %NULL is returned.
*
*
* Returns: (nullable) (transfer full): A newly allocated `GtkTreePath`
*
* Deprecated: 4.10
@@ -2300,7 +2302,7 @@ gtk_tree_model_sort_convert_child_path_to_path (GtkTreeModelSort *tree_model_sor
* @tree_model_sort: A `GtkTreeModelSort`
* @sort_iter: (out): An uninitialized `GtkTreeIter`
* @child_iter: A valid `GtkTreeIter` pointing to a row on the child model
*
*
* Sets @sort_iter to point to the row in @tree_model_sort that corresponds to
* the row pointed at by @child_iter. If @sort_iter was not set, %FALSE
* is returned. Note: a boolean is only returned since 2.14.
@@ -2350,13 +2352,13 @@ gtk_tree_model_sort_convert_child_iter_to_iter (GtkTreeModelSort *tree_model_sor
* gtk_tree_model_sort_convert_path_to_child_path:
* @tree_model_sort: A `GtkTreeModelSort`
* @sorted_path: A `GtkTreePath` to convert
*
* Converts @sorted_path to a path on the child model of @tree_model_sort.
* That is, @sorted_path points to a location in @tree_model_sort. The
* returned path will point to the same location in the model not being
* sorted. If @sorted_path does not point to a location in the child model,
*
* Converts @sorted_path to a path on the child model of @tree_model_sort.
* That is, @sorted_path points to a location in @tree_model_sort. The
* returned path will point to the same location in the model not being
* sorted. If @sorted_path does not point to a location in the child model,
* %NULL is returned.
*
*
* Returns: (nullable) (transfer full): A newly allocated `GtkTreePath`
*
* Deprecated: 4.10
@@ -2414,7 +2416,7 @@ gtk_tree_model_sort_convert_path_to_child_path (GtkTreeModelSort *tree_model_sor
gtk_tree_path_append_index (retval, elt->offset);
level = elt->children;
}
return retval;
}
@@ -2423,7 +2425,7 @@ gtk_tree_model_sort_convert_path_to_child_path (GtkTreeModelSort *tree_model_sor
* @tree_model_sort: A `GtkTreeModelSort`
* @child_iter: (out): An uninitialized `GtkTreeIter`
* @sorted_iter: A valid `GtkTreeIter` pointing to a row on @tree_model_sort.
*
*
* Sets @child_iter to point to the row pointed to by @sorted_iter.
*
* Deprecated: 4.10
@@ -2689,7 +2691,7 @@ gtk_tree_model_sort_clear_cache_helper (GtkTreeModelSort *tree_model_sort,
/**
* gtk_tree_model_sort_reset_default_sort_func:
* @tree_model_sort: A `GtkTreeModelSort`
*
*
* This resets the default sort function to be in the “unsorted” state. That
* is, it is in the same order as the child model. It will re-sort the model
* to be in the same order as the child model only if the `GtkTreeModelSort`
@@ -2724,7 +2726,7 @@ gtk_tree_model_sort_reset_default_sort_func (GtkTreeModelSort *tree_model_sort)
/**
* gtk_tree_model_sort_clear_cache:
* @tree_model_sort: A `GtkTreeModelSort`
*
*
* This function should almost never be called. It clears the @tree_model_sort
* of any cached iterators that havent been reffed with
* gtk_tree_model_ref_node(). This might be useful if the child model being

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