Commit Graph

5103 Commits

Author SHA1 Message Date
Jens Georg
f5804275af gdbus-codegen: Clarify license of generated code
https://bugzilla.gnome.org/show_bug.cgi?id=780893
2017-12-13 14:09:05 +00:00
Friedrich Beckmann
6d0210240a MacOS: gosxcontenttype.c consider generic icon names also
This patch considers generic icon names also when icon names
are searched based on content type. Without this fix only
non-generic icon names are found. This results in no icons
for pdf and jpeg files in the file selection dialog.
This is discussed in

https://bugzilla.gnome.org/show_bug.cgi?id=788936
2017-12-11 11:40:14 +00:00
Mario Sanchez Prada
637a298960 gio/tests/appinfo: New test for launch with "appId-less" applications
New test to make sure we exercise the code paths in gdesktopappinfo.c
that get triggered when g_desktop_app_info_launch_uris_with_spawn()
is used (i.e. unknown app ID, no session bus), both for when either
a single URI or multiple ones are expected by the application.

https://bugzilla.gnome.org/show_bug.cgi?id=791337
2017-12-08 13:47:23 +00:00
Mario Sanchez Prada
d501bd0dbe gdesktopappinfo: Gracefully handle NULL URIs when passed to expand_macro()
If an application calls g_app_info_launch_uris() with a GList that includes
NULL values in some of its data members, and GIO ends up internally calling
g_desktop_app_info_launch_uris_with_spawn() for whatever reason (e.g. no
D-Bus session available), expand_macro() will crash due to the invalid data.

As this is considered a programmer error, use g_return_val_if_fail() in those
situations to prevent the crash from happening, but printing a warning anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=791337
2017-12-08 13:47:23 +00:00
Mario Sanchez Prada
fbed9c8b85 gdesktopappinfo: Pass a copy of the URIs list to expand_application_parameters()
This list will be modified in-place when calling expand_macro(), so pass a copy
of it instead the original pointer, that is supposed to be an input parameter
only for g_desktop_app_info_launch_uris_with_spawn().

https://bugzilla.gnome.org/show_bug.cgi?id=791337
2017-12-08 13:47:23 +00:00
Friedrich Beckmann
018b997dd2 MacOS: fix content type check vs. mime check to show folder icons
In MacOS the file selection dialog does not show folder icons.
With this fix the folder icons are shown. The bug is described
in:

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

This bug fix is only partial, because this fix is only the
last resort when no mime information is available.
2017-12-08 11:10:27 +00:00
Philip Withnall
62dece198b gio: Fix querying of thumbnail attributes other than thumbnail::path
The thumbnail attributes would previously only be set if thumbnail::path
was included in the query — so querying for just thumbnail::is-valid
would return no results.

This fixes the behaviour of
    gio info -a thumbnail::is-valid ./some-file.png
vs
    gio info -a thumbnail ./some-file.png

The first command would previously list nothing. The second would
previously list a thumbnail::path and thumbnail::is-valid.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=791325
2017-12-07 13:03:18 +00:00
Arnaud Bonatti
2ebc78ae71 gio: Remove stray ‘<’ from gschema.dtd
The mathematical operator was making the DTD unusable.
Also, min and max can be equal with current parser.

https://bugzilla.gnome.org/show_bug.cgi?id=791267
2017-12-06 10:33:52 +00:00
Arnaud Bonatti
0d59878bce Fix gschema.dtd regarding flags
https://bugzilla.gnome.org/show_bug.cgi?id=791235
2017-12-05 12:31:49 +00:00
Christian Hergert
f44472e715 gobject: fix typecasts via g_object_ref
Now that g_object_ref() propagates the parameter type to the
return value, we need to cast to ensure the result is warning
free.

https://bugzilla.gnome.org/show_bug.cgi?id=790697
2017-12-04 11:42:58 +00:00
Philip Withnall
c26aab36db gio: Fix a minor indentation problem
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2017-12-04 10:38:01 +00:00
Michael Catanzaro
18f4583653 gdbusconnection: Fix link in documentation 2017-12-03 19:22:58 -06:00
Philip Withnall
36f7440bb7 goutputstream: Fix pre-condition
Spotted by Izak van Langevelde.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=791036
2017-12-01 10:02:21 +00:00
Philip Withnall
06719a86b2 docs: Drop unnecessary <!-- -->s from gtk-doc comments
Putting a <!-- --> in plural<!-- -->s was an old hack used to fix
linking the symbol with gtk-doc when gtk-doc didn’t know about plural
forms. gtk-doc does now know about plural forms, so the hack can be
removed.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-29 17:50:27 +00:00
Philip Withnall
a2a4a10299 tests: Fix some minor memory leaks in gdbus-test-codegen
It’s not entirely leak-free, but it’s better than before.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=741167
2017-11-28 14:28:50 +00:00
Philip Withnall
37d9b0c699 gdbusutils: Fix a memory leak in g_dbus_gvalue_to_gvariant()
g_variant_get_normal_form() doesn’t necessarily return a floating
GVariant, so we have to take, rather than sink, the ref.

This fixes a lot of leaks with gdbus-codegen-generated code.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=741167
2017-11-28 14:28:50 +00:00
Tim Waugh
d35d9b7911 codegen: fix array out-param annotations
When using gdbus-codegen to produce generated code for a method with
an out parameter with a signature like 'as', make sure to include
an "(array)" annotation for that parameter.

(Reworked by Philip Withnall to improve code formatting.)

https://bugzilla.gnome.org/show_bug.cgi?id=741167
2017-11-28 14:28:49 +00:00
Philip Withnall
2a0db6d868 inotify: Add missing commas
These were accidentally omitted from commit
748bb24985. My fault.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-28 14:25:34 +00:00
Philip Withnall
e644bfa37e gio: Add some casts for printf() formatting statbufs on Solaris
Apparently Solaris defines statbuf fields as long when Linux doesn’t, in
some cases. Cast down to the type expected by the printf() format
placeholder.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=749652
2017-11-28 14:17:09 +00:00
Philip Withnall
b16d7fc1a7 gmountoperation: Add missing (array) annotations
Two of the vfuncs in GMountOperation need some annotations for their
element types and array sizes, otherwise g-ir-scanner comes up with
nonsense output.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=773980
2017-11-28 14:14:19 +00:00
Philip Withnall
181eb900d5 gdesktopappinfo: Downgrade a warning to a debug message
Bug #786580 triggered this warning to show up in the appinfo tests if
run on a machine where no terminal except xterm is installed (for
example, a build machine). Since we didn’t warn before if xterm but no
other terminals were installed, it seems reasonable to downgrade the
warning to a debug message.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=790914
2017-11-28 14:12:40 +00:00
Philip Withnall
748bb24985 inotify: Don’t propagate unrecognised events to GLocalFileMonitor
If we can’t convert the inotify event mask into a GFileMonitorEvent enum
value, don’t propagate it to GLocalFileMonitor, since it hits an
assertion failure in that case.

This should no longer be possible since the previous commit to ignore
IN_Q_OVERFLOW events, but we might as well change this just in case
other bugs crop up in event mask handling.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=776147
2017-11-28 13:55:34 +00:00
Philip Withnall
9853842c53 inotify: Ignore IN_Q_OVERFLOW events
There’s not much we can do about them, and if they go unhandled, they
can propagate through to g_file_monitor_source_handle_event() and cause
assertion failures due to not mapping to a GFileMonitorEvent.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=776147
2017-11-28 13:55:34 +00:00
Philip Withnall
76072a2dde kqueue: Fix invalid emission of G_FILE_MONITOR_EVENT_MOVED event
That event is deprecated, and the kqueue backend can’t provide enough
information to go alongside the event (i.e. the name of the new file).
Use G_FILE_MONITOR_EVENT_DELETED instead.

Quite disappointed in the kqueue documentation for this: I cannot find a
single piece of documentation or example about how NOTE_RENAME is
supposed to communicate the new name of the file.

If it turns out that this is possible, the code can be amended again in
future. At least now it doesn’t abort.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=776147
2017-11-28 13:55:34 +00:00
Carlos Garcia Campos
7dcc09e586 gproxyresolverportal: do not connect to session bus when not under flatpak
While gio module extension is loaded a new GProxyResolverPortal is
created to query whether it's supported. We always return FALSE when not
aunder flatpak, so we don't need to connect to the session bus in that
case. Add a helper ensure_resolver_proxy() that returns TRUE when the
proxy is created and use it in is_supported() instead of creating the
proxy unconditionally in the instance initialization.

https://bugzilla.gnome.org/show_bug.cgi?id=790894
2017-11-27 12:36:03 +01:00
Nirbheek Chauhan
7a9d92702e meson: Create gio-unix and gio-win32 internal deps
These are useful when using glib as a subproject and you want to use
gio-unix-2.0 or gio-win32-2.0.
2017-11-24 12:40:43 +05:30
Nirbheek Chauhan
bd22bb9898 meson: Use files() for gio sources and headers
This allows them to be fetched with subproject().get_variable(). Needed
for generating Gio-2.0.gir in the gobject-introspection meson port.
2017-11-23 23:03:57 +05:30
Daniel Macks
deeacce18a Do not load systemwide giomodules during self-test
$libdir/gio/modules/*.so on the live build machine are supplied by
third parties, so we should not look there while testing ourselves.

https://bugzilla.gnome.org/show_bug.cgi?id=780309
2017-11-20 10:23:23 +00:00
Daniel Macks
0b10c41a04 Git should ignore generated config.py file
gio/gdbus-2.0/codegen/config.py is generated by ./configure from
gio/gdbus-2.0/codegen/config.py.in

https://bugzilla.gnome.org/show_bug.cgi?id=790588
2017-11-20 10:17:01 +00:00
Philip Withnall
9ab0073321 glocalfileinfo: Fix a leak on an error handling path
Spotted by Clang static analysis, thanks to Leslie Zhai.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=777075
2017-11-17 14:39:55 +00:00
Philip Withnall
63c07f9b63 codegen: Change (allow-none) annotations to (nullable)
(nullable) has been around for a while now.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-17 11:42:48 +00:00
Daiki Ueno
c71098ddab tests/gmenumodel: Add test cases using peer-to-peer D-Bus connection
https://bugzilla.gnome.org/show_bug.cgi?id=720380
2017-11-17 11:28:43 +00:00
Daiki Ueno
f29065c315 GMenuExporter: Allow NULL bus name for peer-to-peer connection
https://bugzilla.gnome.org/show_bug.cgi?id=720380
2017-11-17 11:28:43 +00:00
Daiki Ueno
d37af2bd04 GDBusActionGroup: Allow NULL bus name for peer-to-peer connection
https://bugzilla.gnome.org/show_bug.cgi?id=720380
2017-11-17 11:28:43 +00:00
Daiki Ueno
e8a09b3f85 GDBusMenuModel: Allow NULL bus name for peer-to-peer connection
https://bugzilla.gnome.org/show_bug.cgi?id=720380
2017-11-17 11:28:43 +00:00
Philip Withnall
d4f07f21fb glocalfile: Fix leak of FS type on some platforms
fstype is a const char*, and is passed to
g_file_info_set_attribute_string(), which takes a copy of it. There’s no
need to g_strdup() the FS type from various statfs/statvfs buffers
beforehand, given that the buffers are valid for the duration of this
function.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=679347
2017-11-15 13:08:11 +00:00
Christian Hergert
ed78f30c5e file: add tests for g_file_load_bytes()
This adds a test for both g_file_load_bytes() and the
asynchronous form g_file_load_bytes_async().

https://bugzilla.gnome.org/show_bug.cgi?id=790272
2017-11-15 04:10:23 -08:00
Christian Hergert
2227918dfd file: add g_file_load_bytes()
This adds g_file_load_bytes() to make it more convenient to
load the contents of a GFile as GBytes.

It includes a special casing for gresources to increase the
chances that the GBytes directly references the embedded data
instead of copying to the heap.

https://bugzilla.gnome.org/show_bug.cgi?id=790272
2017-11-15 03:52:41 -08:00
Christian Hergert
5464461e4c gresource: avoid allocations in enumerate_children()
In the vast majority of cases, we can avoid temporary
allocations for paths in g_resources_enumerate_children().

In the case we need to add a suffix "/", we can usually just
build the path on the stack. In other cases, we can completely
avoid the strdup, which appears to only have been added for
readability. If the path is really long, we fallback to doing
what we did before, and use g_strconcat().

In the case of Builder, this saved 5.3mb of temporary
allocations in the process of showing the first application
window.

https://bugzilla.gnome.org/show_bug.cgi?id=790275
2017-11-15 03:24:29 -08:00
Christian Hergert
38ffcd298c gresourcefile: simplify path canonicalization
Previously, the path canonicalization for resources had liberal use of
strlen() and memmove() while walking through the path. This patch avoids
any secondary strlen() and removes all use of memmove().

A single allocation is created up front as we should only ever need one
additional byte more than then length of the incoming path string.

To keep the implementation readable, the mechanics are kept in external
functions. memrchr() was not used due to its lack of portability.

This is faster in every test case I've tested. Paths that contain
relative ../ have the most speedup.

https://bugzilla.gnome.org/show_bug.cgi?id=790310
2017-11-14 15:13:44 -08:00
Sebastian Dröge
7b60708204 GResource – Create an internal copy of the GBytes if it is not pointer aligned
https://bugzilla.gnome.org/show_bug.cgi?id=790030
2017-11-14 10:39:45 +02:00
Sebastian Dröge
3c9c01e3ce GResource – Add note to documentation that the memory must be at least pointer aligned
https://bugzilla.gnome.org/show_bug.cgi?id=790030
2017-11-14 10:19:58 +02:00
Stefan Sauer
c68f66c19e docs: fix 'emphasis' tag
There is no 'em' tag in docbook. Use 'emphasis'. This would also require
to enable --xml-mode in MKDB_OPTIONS, but that requires more cleanups.
2017-11-12 21:04:30 +01:00
Stefan Sauer
2812219adb docs: add missing '*' chars at start of doc-comments 2017-11-12 16:36:16 +01:00
Philip Withnall
1897e66dce build: Drop data-to-c.pl in favour of data-to-c.py
The Python version was added for the Meson build, but we might as well
use it from autotools too, since it does exactly the same thing as the
Perl version (modulo not including a trailing linebreak, but that
doesn’t matter).

Works fine with Python 2.7 or Python 3.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=790147
2017-11-10 11:47:57 +00:00
Christian Kellner
b9b7a1d039 gio-tool: fix inverted logic in monitor tool
The tool should refuse to work if none of the locations to watch
are set, not if *any* of them are unset.

https://bugzilla.gnome.org/show_bug.cgi?id=790093
2017-11-09 10:47:14 +01:00
Cosimo Cecchi
44d6052584 gfile: add g_file_new_build_filename()
This is a convenience C API that combines g_build_filename() with
g_file_new_for_path().

https://bugzilla.gnome.org/show_bug.cgi?id=788488
2017-11-07 08:25:28 -08:00
Philip Withnall
8e8f4e6486 docs: Fix various minor syntax errors in gtk-doc comments
This will fix a few broken links in the documentation, and shut up a
load of gtk-doc warnings (but certainly not all of them).

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=790015
2017-11-07 14:51:12 +00:00
Philip Withnall
249d74fcf6 docs: Make argument names in GAppInfo consistent
This fixes a mismatch between some of the gtk-doc comments and reality.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=790015
2017-11-07 14:50:23 +00:00
Ondrej Holy
796599a705 gio-tool: Do not alter uris before use
Uris may be altered by the following code, which breaks xdg-open:
file = g_file_new_for_commandline_arg (arg[i])
uri = g_file_get_uri (file);

Examples of possible uri changes:
mailto:email -> mailto:///email
magnet:?xt=urn:hash -> magnet:///?xt=urn:hash
ssh://user@host -> sftp://user@host

This patch causes that uris aren't preprocessed for locations with
scheme, however absolute and relative paths are still preprocessed.

https://bugzilla.gnome.org/show_bug.cgi?id=779182
2017-11-07 13:46:56 +01:00