Commit Graph

22770 Commits

Author SHA1 Message Date
Philip Withnall
2ca4d865b2 completion: Declare variables as local in gio completion script
Most variables were, but a few were not declared as local, and hence
leaked into the calling environment every time someone tab-completed the
`gio` command.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2275
2021-01-05 16:14:16 +00:00
Emmanuele Bassi
c537c93c6a Merge branch 'error-docs' into 'master'
Minor improvements to GError documentation

See merge request GNOME/glib!1838
2021-01-04 17:00:19 +00:00
Yuri Chornoivan
0d49f4dd0d Update Ukrainian translation 2021-01-04 16:53:47 +00:00
Philip Withnall
ea6fe7194a gerror: Clarify reference to g_key_file_has_key() in documentation
It’s not actually deprecated, but it is hard to use. It was briefly
deprecated, but then the deprecation was reversed before a stable
release.

See https://bugzilla.gnome.org/show_bug.cgi?id=650345.

Reported on StackOverflow as
https://stackoverflow.com/q/65505393/2931197.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-01-04 16:44:12 +00:00
Philip Withnall
bf0430f10e gerror: Improve documentation formatting slightly
No functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-01-04 16:43:37 +00:00
Philip Withnall
1ae734dd6d Merge branch 'wip/jtojnar/gsrc-dstr-example' into 'master'
Modernize g_source_is_destroyed example

Closes #2279

See merge request GNOME/glib!1835
2021-01-04 16:11:14 +00:00
Sebastian Dröge
be39b8fab4 Merge branch 'isnan-msvc' into 'master'
gdatetime.c: Fix MSVC builds for lack of NAN items

See merge request GNOME/glib!1837
2021-01-04 15:59:17 +00:00
Daniel Șerbănescu
826f890586 Update Romanian translation 2021-01-04 15:50:07 +00:00
Jan Tojnar
720dfa8cd3 Modernize g_source_is_destroyed example
gtk_threads_{leave,enter} API is deprecated and a narrower critical section,
guarding just idle_id manipulation, is better anyway.

Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/2279
2021-01-04 15:42:03 +00:00
Chun-wei Fan
a2454d731a gdatetime.c: Fix MSVC builds for lack of NAN items
Use a fallback for isnan() on Visual Studio 2012 or earlier, and define
NAN if it does not exist.
2021-01-04 15:38:27 +00:00
Sebastian Dröge
87e8eb67c3 Merge branch '1283-trash-wording' into 'master'
glocalfile: Improve wording for error messages about trash directories

Closes #1283

See merge request GNOME/glib!1825
2021-01-04 15:07:31 +00:00
Aurimas Černius
b1b8611611 Updated Lithuanian translation 2021-01-04 16:48:06 +02:00
Philip Withnall
7f2af262bf glocalfile: Improve wording for error messages about trash directories
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #1283
2021-01-04 14:43:54 +00:00
Philip Withnall
9716a26ab6 Merge branch '1281-to-pixdata-docs' into 'master'
gresource: Document the `to-pixdata` option as being deprecated

Closes #1281

See merge request GNOME/glib!1826
2021-01-04 12:58:42 +00:00
Philip Withnall
0c85348efc Merge branch 'appinfo-shellany-uwplaunch' into 'master'
GWin32AppInfo: support getting info about UWP apps and launching them

Closes #1991

See merge request GNOME/glib!1772
2021-01-04 12:55:58 +00:00
Philip Withnall
62b4df8a49 Merge branch 'fix/socket-credentials-error-handling-on-apple-oses' into 'master'
gsocket: Fix credentials error-handling on Apple OSes

See merge request GNOME/glib!1830
2021-01-04 12:45:27 +00:00
Ole André Vadla Ravnås
9ac3a27f03 gsocket: Fix credentials error-handling on Apple OSes
- When querying a TCP socket, getsockopt() may succeed but the resulting
  `optlen` will be zero. This means we'd previously be reading
  uninitialized stack memory in such cases.
- After a file-descriptor has gone through FD-passing, getsockopt() may
  fail with EINVAL. At least this is the case with TCP sockets.
- While at it also use SOL_LOCAL instead of hard-coding its value.
2021-01-04 12:29:47 +00:00
Sebastian Dröge
9a7ca661a3 Merge branch 'wip/baedert/gparam' into 'master'
More small GKeyFile performance improvements

See merge request GNOME/glib!1832
2021-01-04 08:46:41 +00:00
Jordi Mas
79db5272e0 Update Catalan translation 2021-01-03 22:42:31 +01:00
Timm Bäder
fe441c8ca5 giomodule: Don't allocate GHashTable for no entries
This seems to happen in 3 out of 4 cases when calling gtk_init(), so
avoid allocating the GHashTable in that case.
2020-12-31 14:58:40 +01:00
Timm Bäder
105e44beb5 gresource: Avoid work for NULL errors
Don't go through gettext if the GError** passed is NULL anyway.
2020-12-31 14:58:40 +01:00
Timm Bäder
89f12e10b6 keyfile: Only allocate group_hash if needed
A keyfile with no groups (e.g. an empty one) does not need a hash table
for the groups.
2020-12-31 14:58:37 +01:00
Timm Bäder
3ee05ef3bd keyfile: Don't allocate parse_buffer if we don't need it
When loading a GKeyFile, the sequence is usually:

keyfile = g_key_file_new();
g_key_file_load_xxx(keyfile, ...)

g_key_file_new() calls g_key_file_init(), which allocates a parse_buffer
for parsing. g_key_file_load_xxx() will then g_key_file_clear() the
keyfile and call g_key_file_init() again.

Just don't allocate a parse_buffer unless we need it for parsing.
2020-12-31 14:58:37 +01:00
Timm Bäder
03ca87586f fileutils: Avoid calling set_file_error with NULL GError**
If no pointer to a GError* has been passed to public API, there's not
need to look at translations via gettext or format an error message that
g_set_error_literal will entirely ignore in the end.
2020-12-31 14:58:37 +01:00
Timm Bäder
423bfa87d5 gparam: Remove pspec_list_remove_overridden_and_redirected()
Instead of collecting more pspecs than we need, just don't add them to
the list(s) in the first place.
2020-12-31 14:58:34 +01:00
Sebastian Dröge
2bd8626885 Merge branch 'wip/baedert/keyfile' into 'master'
keyfile: Delay calling g_get_language_names() until it's needed

See merge request GNOME/glib!1829
2020-12-30 11:51:21 +00:00
Timm Bäder
037f1ce672 keyfile: Delay calling g_get_language_names() until it's needed
The g_get_languages() call is quite costly and often unneeded.
2020-12-30 12:39:14 +01:00
Philipp Kiemle
efcbf1f137 Update German translation 2020-12-27 18:19:03 +00:00
Sebastian Dröge
7ad7f55888 Merge branch 'master' into 'master'
Windows: fix FD_READ condition flag still set on recoverable UDP socket errors.

See merge request GNOME/glib!1827
2020-12-24 09:08:40 +00:00
Marco Mastropaolo
43b13d7a1a Windows: fix FD_READ condition flag still set on recoverable UDP socket errors.
Contrary to what the WSARecvFrom seem to imply, a UDP socket is perfectly recoverable and usable after a WSAECONNRESET error (and, I assume, WSAENETRESET).
However GSocket condition has the FD_READ bit set after a UDP socket fails with WSAECONNRESET, even if no data is available on the socket anymore; this causes select calls to report the socket as readable when, in fact, it's not.

The change resets FD_READ flag on a socket upon the above error conditions; there's no 'if' to filter between datagram and stream sockets as the change should be harmless in the case of stream sockets which are, however, very unlikely to be usable after a WSAECONNRESET.
2020-12-24 09:08:40 +00:00
Руслан Ижбулатов
c816d074c3 GWin32AppInfo: fix a leak 2020-12-23 01:47:01 +00:00
Руслан Ижбулатов
d33c3747dc GWin32AppInfo: invert verb comparison function
The list is sorted in ascending order, which means that to put
verbs alphabetically we need to sort ealier verbs with -1. Same for
the "open" verb and the preferred verb (if any).
2020-12-23 01:46:33 +00:00
Руслан Ижбулатов
48d96b21f9 GWin32AppInfo: enforce chosen handler on UWP apps, use URI verbs
* UWP apps that have low registry footprint might end up with chosen_handler == NULL.
Ensure that this doesn't happen.
* UWP apps don't need verbs for URIs, but we do need verbs to have a link to an app
(since handlers don't contain app fields). Work around this by adding an "open" verb
to each UWP URI handler.
* Duplicate the code that inserts extension handler verbs into the app to also insert
URI handler verbs. This allows URI-only apps to be used correctly later on (otherwise
GLib errors out, saying that the app has no verbs).
2020-12-23 01:46:11 +00:00
Руслан Ижбулатов
a2f823113c GWin32AppInfo: read UWP handler metadata (indirect strings)
Have to use of SHLoadIndirectString() from shell32.dll for this, no
way around that.
2020-12-23 01:46:10 +00:00
Руслан Ижбулатов
a2c287bf9f GWin32AppInfo: be less picky about names
Use pretty name as the result of _name(), if available. This is
more in line with what .desktop files return. Canonical name
may be completely unintelligible.
2020-12-23 01:45:20 +00:00
Руслан Ижбулатов
e7a738711b GWin32AppInfo: be more permissive about verbs in capable apps
MSDN doesn't say much on this subject, but i've seen apps in the wild
that have the "shell" subkey with verbs *either* in the root app key *or*
in the "Capabilities" subkey of the root key. Accommodate either case by trying both
(root key gets a priority, since this is how MS Address Book is registered -
assume that MS knows how to do this the right way).
2020-12-23 01:44:47 +00:00
Руслан Ижбулатов
10def41dc5 GWin32AppInfo: simplify appinfo wait condition 2020-12-23 01:44:34 +00:00
Руслан Ижбулатов
4c3a61e221 GWin32AppInfo: use g_new() instead of g_malloc() 2020-12-23 01:43:39 +00:00
Руслан Ижбулатов
f28b75e9ff GWin32AppInfo: Support launching UWP applications 2020-12-23 01:43:38 +00:00
Руслан Ижбулатов
0ea2f34723 GWin32AppInfo: more checks for UWP apps
UWP apps have no exectuables or commandlines. Check for that.
2020-12-23 01:43:38 +00:00
Руслан Ижбулатов
720b51032c GWin32AppInfo: Support getting information about UWP apps 2020-12-23 01:43:38 +00:00
Руслан Ижбулатов
e9b09911f6 gio: Add g_win32_package_parser_enum_packages()
This function enumerates all user-accessible UWP packages
and calls the user-provided callback for each package.

This can be used to make GLib aware of the UWP applications
installed in the system.

The function works by using IPackageManager/IPackage UWP interfaces
and XmlLite COM library to parse package manifests.

The function requires COM, and initializes it to a single-thread
appartment model. To ensure this doesn't break anything, either
only use it in a separate thread (COM is initialized on a per-thread
basis), or make sure that the main thread also uses the same COM
model (it's OK to initialize COM multiple times, as long as the same
model is used and as long as init/uninit calls are paired correctly).
2020-12-23 01:43:38 +00:00
Philip Withnall
37ec6f1da7 docs: Ignore new win32 private headers
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-23 01:43:37 +00:00
Руслан Ижбулатов
2773c06bd4 gio: Add private headers with missing UWP/COM types
MinGW-w64 lacks the appropriate headers, so we have to add them
here. Note that these only have the C versions (normally these
things come in both C and C++ flavours), since that's what we use.

Also note that some of the functions that we don't use (but must
describe to maintain binary compatibility) were altered to use
IUnknown (basically, an untyped pointer) instead of the appropriate
object types, as adding these types would require other types,
which would pull even more types, forcing us to drag half of the
UWP headers in here. By replacing unused types with IUnknown we
can trim a lot of branches from the dependency graph.
2020-12-23 01:35:51 +00:00
Руслан Ижбулатов
895fc2eff2 gio: add GWin32FileSyncStream
This is a COM object that implements IStream by using a HANDLE
and WinAPI file functions to access the file (only a file; pipes
are not supported). Only supports synchronous access (this is
a feature - the APIs that read from this stream internally will
never return the COM equivalent of EWOULDBLOCK, which greatly
simplifies their use).
2020-12-23 01:35:39 +00:00
Руслан Ижбулатов
fdfa9236a2 GWin32AppInfo: Store UWP AppUserModelId for a handler
Could be used later on to launch UWP apps.

UWP apps need verbs, but we don't have any code to get UWP app
info yet.
2020-12-23 01:33:28 +00:00
Philip Withnall
b63e9889a8 gresource: Document the to-pixdata option as being deprecated
Just embed a PNG instead. gdk-pixbuf deprecated its pixdata support in
version 2.32, in 2015.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #1281
2020-12-22 18:42:05 +00:00
Philip Withnall
8cec87ff46 glocalfile: Clarify an error message slightly
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-22 18:22:37 +00:00
Jordi Mas i Hernandez
d48e22e464 Update Catalan translation 2020-12-22 12:54:44 +00:00
Sebastian Dröge
8f590df123 Merge branch 'ossfuzz-28718-date-normalization' into 'master'
gdate: Limit length of dates which can be parsed as valid

See merge request GNOME/glib!1821
2020-12-21 17:48:45 +00:00