Commit Graph

28381 Commits

Author SHA1 Message Date
Philip Withnall
fb998ff52d gtkbuilder: Eliminate array reallocations in get_parameters()
`gtk_builder_get_parameters()` is a hot path, being called twice for
each object in each UI file in an application. The majority of objects
have ≤ 8 properties, which are each filtered into either `parameters` or
`filtered_parameters`.

Unfortunately, both of those arrays are created as empty `GArray`s, and
adding 8 elements to an empty `GArray` hits the worst possible case of
reallocating and `memcpy()`ing the array 3 times. As the array size is
doubled with each reallocation, the cost is not particularly well
amortised when the array size is small.

From the `ObjectInfo`, we actually know how many properties there are in
total, so just allocate the arrays at the right size to begin with.

This saves 7% of the instruction cycles needed to start up
gnome-software to the point where it’s showing its main window,
according to callgrind. gnome-software is making around 5500 calls to
`gtk_builder_get_parameters()`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-06-10 19:59:03 +01:00
Thomas Holder
1573ff6803 gtk_file_chooser_set_current_name: fix type of name argument
The description says UTF-8 string, but the annotation said filename.
2020-06-05 12:43:49 +02:00
Emmanuele Bassi
d60746ae6c Merge branch 'issue-2820' into 'gtk-3-24'
docs: Update the link to the GtkBuilder schema

See merge request GNOME/gtk!2042
2020-06-05 09:46:56 +00:00
Emmanuele Bassi
e9c4c80102 docs: Update the link to the GtkBuilder schema
The link to the file is still using the old cgit format, which redirects
to master, where the RNC file is gone.

Fixes: #2820
2020-06-05 10:16:19 +01:00
Kjell Ahlstedt
52d944ec44 flowbox: Don't use a removed child after it has been unparented
In gtk_flow_box_remove(), call g_sequence_remove() before the child is unparented.

See MR !2029
2020-06-04 08:24:08 -04:00
Matthias Clasen
92f11144f3 Merge branch 'gtk-3-24' into 'gtk-3-24'
Fix GPtrArray sorting function

See merge request GNOME/gtk!1984
2020-06-01 14:46:14 +00:00
Alexander Mikhaylenko
60f69462fc Adwaita: Revert black decoration background
Before I tried this change, I thought it might break apps that do
transparent window background. So I checked a few that did this:
gnome-terminal, tilix, kgx. It worked, so it must work everywhere, right?

However, it just so happens that vte is drawn using CAIRO_OPERATOR_SOURCE
operator rather than CAIRO_OPERATOR_OVER like everything else. This means
that if vte widget is transparent, anything below it, like a black
decoration background, won't be shown.

So really it is still broken, so reverting it.
2020-05-30 15:22:40 +05:00
Tristan Partin
6a507c0b63
Fix GPtrArray sorting function
GPtrArray's GCompareFunc passes a double pointer that needs to be
dereferenced in order to use the data you are actually wanting to
compare.

See: https://developer.gnome.org/glib/stable/glib-Pointer-Arrays.html#g-ptr-array-sort
2020-05-29 15:24:09 -05:00
Jakub Steiner
1f8c019d1e Merge branch 'theme-linked-button-fixes-gtk3' into 'gtk-3-24'
Adwaita: Fix and simplify the linked buttons styling (GTK3)

See merge request GNOME/gtk!1948
2020-05-22 09:30:16 +00:00
Ondrej Holy
cb9b7278d6 trash-monitor: Rate limit updates
Trash monitor queries info from gvfsd-trash after each file monitor
change which can be problematic when too many changes happen in
a short time. Let's rate limit the number of queries...

Fixes: #1010
2020-05-21 21:16:20 -04:00
nana-4
34d85329a9 Adwaita: Fix and simplify the linked buttons styling
- Remove various unnecessary overrides for linked buttons.
- Add missing outline styles to the %linked_vertical ones.
- Consistently use :not(.vertical) instead of :dir(ltr|rtl) for linked
  combo buttons.
- Remove :only-child styling from the messagedialog button. The
  :only-child is equivalent to :first-child:last-child, so we don't need
  the styling there specially.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2752
Closes https://gitlab.gnome.org/GNOME/gtk/-/issues/2549
2020-05-21 00:51:54 +09:00
Matthias Clasen
88fc1640ed Merge branch 'BUG_double_popover_focus_filechooser_GTK3' into 'gtk-3-24'
filechooser: set default widget early for 'Rename' popover

See merge request GNOME/gtk!1592
2020-05-19 23:26:56 +00:00
Carlos Garnacho
df8e6ea32e gtksearchenginetracker3: Pre-fill GFileInfo from query
Provide the minimal info necessary. Improves apparent responsiveness
(since we don't visibly clear and repopulate the list) and saves doing
file stat/reads on every file in the result set.
2020-05-19 22:03:39 +02:00
Carlos Garnacho
ae776046fc gtksearchengine: Add tracker3 search engine
Make this dependency optional at build time, and prefer it over
the old tracker <= 2.x implementation.
2020-05-19 22:03:39 +02:00
Carlos Garnacho
5858f7c5bd gtksearchengine: Add autoptr handler for this type
So subclasses can just use G_DECLARE_*_TYPE.
2020-05-19 22:03:20 +02:00
Carlos Garnacho
99031f885e gtksearchengine: Add "got_results" argument to ::finished
The filechooser tries to figure out whether it got results by poking
the model, but all files might go through the async GFileInfo querying
state.

Make all search engines (and the composite one) just notify about this
fact, so the file chooser can behave appropriately without waiting for
the async operations to finish.
2020-05-19 22:03:20 +02:00
LRN
0e8eedee16 Merge branch '324-print-paper' into 'gtk-3-24'
W32: Ensure paper size/orientation is preserved

See merge request GNOME/gtk!695
2020-05-18 08:55:47 +00:00
Alexander Mikhaylenko
97f540622a eventcontrollerscroll: Fix the history push condition
Once upon a time, there was a function called gdk_event_get_scroll_deltas().
It returned %TRUE when an event had scroll deltas and that was used as the
condition to decide whether to push scroll deltas to the scroll history,
even when the both deltas are 0 for the stop event at the end of scrolling.

When GtkScrolledWindow kinetic scrolling code was adapted for
GtkEventControllerScroll, it was replaced with a (dx != 0 && dy != 0)
check. This prevented the stop event from getting into the history, and
instead allowed non-smooth scrolling to affect the history as they have
synthetic deltas with one of the values being -1 or 1 and the other on 0.

Instead, check the direction as we already have it as a local variable.
2020-05-15 01:37:40 +05:00
Matthias Clasen
4f7c3610d6 Merge branch 'wip/sadiq/entry-select-all' into 'gtk-3-24'
entry: Always show “select-all” button on touch popup

See merge request GNOME/gtk!1857
2020-05-13 15:05:21 +00:00
Simon McVittie
4db3f142d7 aboutdialog: Document the new licenses added in 3.24.20
Originally part of b4c79bad "Assorted documentation fixes" by
Matthias Clasen.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-05-11 18:35:58 +01:00
Simon McVittie
177aeca5a1 aboutdialog: Update precondition checks for new licenses added in 3.24.20
To avoid making this mistake again, add a static assertion that the
enum is in sync with gtk_license_info, and use the length of
gtk_license_info for the precondition check.

Signed-off-by: Simon McVittie <smcv@debian.org>
Resolves: #2734
2020-05-11 18:35:58 +01:00
Mohammed Sadiq
c823a4d673 entry: Always show 'select-all' button on touch popup
On touch, the popup shown shall contain the 'select-all' button
only if a selection is in progress and if the entry is editable.
Let the button be shown always if selectable so that it’s more helpful.
2020-05-07 18:09:40 +05:30
Matthias Clasen
86b0b80dfa filechooser: Translate type column
When the code for this was copied from nautilus,
we forgot to adapt it for running in a library
instead of an application - gettext() doesn't work
in a library.

Fixes: #2690
2020-05-02 20:07:33 -04:00
Florian Müllner
f28c6d34a7 appchooserdialog: Don't show broken subtitles
Commit 07beb6dba2 made GtkAppChooserWidget useful with no content-type,
however when used in a GtkAppChooserDialog, this will lead to a confusing
"Opening (null) files" subtitle.

Fix this by omitting the subtitle altogether in that case.
2020-05-01 18:22:39 +02:00
Matthias Clasen
521a382d79 HighContrast: regenerate css 2020-04-27 08:47:35 -04:00
Peter Bloomfield
3b5e10ef4d file-system-model: Refactor a helper
Push more common code into the helper for
gtk_file_system_model_query_done() and
gtk_file_system_model_one_query_done().
2020-04-27 08:21:45 -04:00
Peter Bloomfield
326077d2ed file-system-model: Avoid use-after free
This is a possible fix for https://gitlab.gnome.org/GNOME/gtk/-/issues/2657

Use a NULL return from g_file_query_info_finish() to detect cancellation
of the query, and avoid derferencing a stale pointer.
2020-04-27 08:18:48 -04:00
Jakub Steiner
be159ab93c Merge branch 'wip/exalm/solid-csd' into 'gtk-3-24'
theme: Fix decoration background

See merge request GNOME/gtk!1742
2020-04-23 14:26:32 +00:00
Alexander Mikhaylenko
d46aa9f49e theme: Fix decoration background
'window' is not the only toplevel css name, there are also 'dialog' etc.

Move it before .solid-csd style so that .solid-csd background takes
precedence.
2020-04-23 19:06:33 +05:00
Jakub Steiner
16b4ae8486 HC: export public colors
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2641 and
https://gitlab.gnome.org/GNOME/gtk/-/issues/2650
2020-04-23 14:24:46 +02:00
Jakub Steiner
30906f3240 Adwaita: lower glyph contrast for checkboxes
- stylistic choice didn't sit well with majority of the design team
2020-04-23 13:57:58 +02:00
Nelson Benítez León
7c343a87d1 GtkPlacesSidebar: avoid location clicks to grab focus
Sibebar location rows should not grab focus on click.

Fixes filechooser issue #1469
2020-04-18 14:38:47 -04:00
Emmanuele Bassi
633f0fa52a Merge branch 'jjardon/3_24_more_licenses' into 'gtk-3-24'
3.24: gtk/gtkaboutdialog: Add some more very common licenses:

See merge request GNOME/gtk!1672
2020-04-17 21:50:45 +00:00
Matthias Clasen
3483a3e134 Merge branch 'BUG_filechooser_async_data_loss_GTK3' into 'gtk-3-24'
GtkFilechooserWidget: prevent oblivious selection of file

See merge request GNOME/gtk!1682
2020-04-17 20:30:07 +00:00
Matthias Clasen
0459569b49 Avoid a critical in the Emoji chooser
If event_widget is NULL, just dismiss the popover.

https://gitlab.gnome.org/GNOME/gtk/-/issues/2199
2020-04-14 15:37:59 -04:00
Nelson Benítez León
e6ff990145 GtkFilechooserWidget: prevent oblivious selection of file
which could happen after confirming the "file overwrite"
dialog and may result in a different file being overwritten
causing data loss.

The oblivious file selection can be done by a mouse
click or keyboard press sent inadvertently just after
confirming the "file overwrite" dialog.

Fixed by adding a flag to ignore any button/key press
events sent to the file list. We set this flag just
after the user accepts the "file overwrite" dialog,
which means the enclosing GtkfilechooserDialog is about
to get closed. And we restablish the flag when the dialog
is shown again (in its map() handler).

Fixes data loss issue #2288
2020-04-13 16:33:10 -04:00
Mathieu H
73737bcc4f Remove the blacklist list in convert-emoji.c since now it is supported 2020-04-13 15:27:40 +00:00
Matthias Clasen
e51cfe2349 Merge branch 'window-set-focus-docstring-fix' into 'gtk-3-24'
window: Fix docstring formatting on 'set-focus' signal

See merge request GNOME/gtk!1677
2020-04-12 22:50:07 +00:00
Collin May
d536fa5aa4 window: Fix docstring formatting on 'set-focus' signal
This comment was added in 93bcca7f02 but missed a
colon so it never actually generated documentation and the nullable annotation
never made it into GObject-introspection language bindings.

This crude regex does not catch any other instances of this mistake. The @
symbol is used to disambiguate signal doc comments from property doc comments,
since property docs usually don't have parameters.

$ pcre2grep -rM '\\* [A-Z][A-Za-z]*:([a-z\-]*):\n +\* @' gtk/
2020-04-12 15:09:54 -07:00
Luca Bacci
0352d88b8a
Fix message dialog not shown when the user tries to create a folder but a file with the same name exists
Fixes issue #2604
2020-04-12 15:05:18 +02:00
Javier Jardón
adc2f4ad9e 3.24: gtk/gtkaboutdialog: Add some more very common licenses:
- BSD 3-Clause "New" or "Revised" license
- Apache License 2.0
- Mozilla Public License 2.0
2020-04-12 13:11:22 +01:00
Simon McVittie
c37bbb2641 Add miscellaneous unpackaged files to dist tarball
Various files are in git but not in dist tarballs. Some of them look
like potentially useful references for downstream distributors.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-04-08 13:43:28 +01:00
Matthias Clasen
5a0891c69d Merge branch 'gtk-3-24' into 'gtk-3-24'
docs: Do not call GTK APIs if gtk_init_check returns FALSE

See merge request GNOME/gtk!1617
2020-04-04 03:18:01 +00:00
Nicola Fontana
392d4de8a9 docs: Do not call GTK APIs if gtk_init_check returns FALSE
See issue #994.
2020-04-03 22:59:59 +02:00
Matthias Clasen
da1686eb47 Fix build issues with HighContrast theme 2020-04-03 12:54:32 -04:00
Matthias Clasen
58cfd44307 Merge branch 'BUG_filechooser_new_folder_focus_GTK3' into 'gtk-3-24'
gtkfilechooserwidget: set 'New folder' button focus-on-click

See merge request GNOME/gtk!1595
2020-04-01 04:28:22 +00:00
Nelson Benítez León
527a99e598 GtkMenuButton: disable focus-on-click
As general rule, all buttons that launch a menu should
not grab focus on click, because otherwise when the menu
is closed the focus goes back to the button instead of
the previously focused widget, which is the one the user
was interacting with.

GtkScaleButton and GtkVolumeButton set focus-on-click
to FALSE for this same reason.

Fixes #2557
2020-03-31 21:00:32 -04:00
Nelson Benítez León
3997cdf2f4 gtkfilechooserwidget: set 'New folder' button focus-on-click
As general rule, all buttons that launch a menu should
not grab focus on click, because otherwise when the menu
is closed the focus goes back to the button instead of
the previously focused widget, which is the one the user
was interacting with.

So this is also the case for the 'New Folder' button on
the filechooser.

Fixes #2557
2020-03-31 20:15:34 -04:00
Nelson Benítez León
6d98edf89f filechooser: set default widget early for 'Rename' popover
because otherwise this second[1] popover will not be
able to save the filechooser default widget (the 'save'
button) because the first popover has not yet restablish
it (as will be done on popover's unmap handler).

[1] second because 'Rename' popover is launched from inside
    the 'file properties' popover.

Fixes #2555
2020-03-31 14:32:03 -04:00
Matthias Clasen
21e0e3f863 Merge branch 'wip/jimmac/HC-redesign-gtk3' into 'gtk-3-24'
HC: derive from Adwaita

See merge request GNOME/gtk!1587
2020-03-30 17:48:22 +00:00