4677 Commits

Author SHA1 Message Date
Matthias Clasen
5066318482 Fix indentation mishap 2016-07-06 19:58:34 -04:00
Matthias Clasen
9d6b3d729f Remove an extraneous casts
Spotted by Cosimo.
2016-07-06 19:51:45 -04:00
Matthias Clasen
ce62ca0c14 Be more truthful about network availability
If flatpak-info exists, but we don't have the shared key, then
the network is not available. Pointed out by Cosimo.
2016-07-06 19:42:12 -04:00
Matthias Clasen
f08b703f84 Use g_build_filename
Instead of manual path construction. Pointed out by Cosimo.
2016-07-06 19:34:45 -04:00
Matthias Clasen
5090920c98 Remove debug spew
Spotted by Cosimo.
2016-07-06 19:31:56 -04:00
Matthias Clasen
f700245891 Avoid an extraneous cast
Cosimo pointed out that this is unnecessary.
2016-07-06 19:30:23 -04:00
Matthias Clasen
9d59e45961 Set an error on failure
'has no owner' seems close enough, that is what we are seeing
here.
2016-07-06 19:29:13 -04:00
Matthias Clasen
22ff54a069 network monitor portal: Fix indentation
Pointed out by Cosimo Cecchi.
2016-07-06 19:24:55 -04:00
Matthias Clasen
01404fbe83 Avoid a use-after-free
Instead of pulling parent_window out of a copy of the environment
and having it go bad when we free the copy, move the definition
of GAppLaunchContextPrivate up and use the envp member without
copying in.

Pointed out by Cosimo Cecchi.
2016-07-06 19:10:33 -04:00
Matthias Clasen
34c104924f Avoid type name clash
GIO should not install types whose names don't start with 'g'.
This was causing the xdg-desktop-portal to crash, since it was
also trying to register Xdp types.
2016-07-04 22:53:30 -04:00
Matthias Clasen
5e1e90ce25 Add a portal backend for GNotification
This will talk to a portal api instead of directly to the shell.
2016-07-03 18:01:45 -04:00
Matthias Clasen
291af24495 portal support: Flush the connection
As Mario pointed out, this is common practice for uses
of the bus singleton inside GIO.
2016-07-03 18:01:45 -04:00
Matthias Clasen
5af31fbdbc portal support: Don't wait for the reply
It does not really make sense for g_app_info_launch_default_for_uri
to block on an interactive dialog. If we want that, we can should
introduce a proper async variant of this API with a cancellable
and a finish().
2016-07-03 18:01:45 -04:00
Matthias Clasen
69f7a26f34 portal support: handle errors
Return an error when we don't have a session bus connection.
Pointed out by Cosimo and Mario.
2016-07-03 18:01:45 -04:00
Matthias Clasen
c88714b9cc portal support: Use g_get_user_runtime_dir()
Pointed out by Cosimo Cecchi and Mario Sanchez Prada.
2016-07-03 18:01:45 -04:00
Matthias Clasen
4f6d25ed44 proxy: Redo the network availability check
Do this more like for the network monitor: We keep using the
portal proxy, but we neuter all results. Eventually, we can
do this on the portal side, but we need some systemd infrastructure
for it.
2016-07-03 18:01:45 -04:00
Matthias Clasen
0912552c67 Avoid a critical
The key might not be present in flatpak-info. Deal with that.
2016-07-03 18:01:45 -04:00
Matthias Clasen
4521e5c40d Add a portalized proxy resolver implementation
The backend for this lives in xdg-desktop-portal, and is in turn
using GProxyResolver.
2016-07-03 18:01:45 -04:00
Matthias Clasen
de5b18dfc3 Move some portal support to its own files
This is better than copying these utility functions around to
multiple places.
2016-07-03 18:01:45 -04:00
Matthias Clasen
e8df162402 network monitor portal: Respect sandbox setup
When network is not available in the sandbox, there is
no point in reporting accurately about the network
status outside the sandbox. Just return 'no connection'
in this case.
2016-07-03 18:01:45 -04:00
Matthias Clasen
956d4858f3 Add a portalized network monitor implementation
The backend for this lives in xdg-desktop-portal, and is in turn
using GNetworkMonitor.
2016-07-03 18:01:45 -04:00
Matthias Clasen
5496d16ed3 Use the new portal name
The portal got renamed to org.freedesktop.portal.OpenURI.
2016-07-03 18:01:45 -04:00
Matthias Clasen
453507ac6d Revert "Add portal support to g_app_info_launch_uris"
This reverts commit c980bd2bc416f6762c49497ddc042cea11a30bf2.
2016-07-03 18:01:45 -04:00
Matthias Clasen
4c24fab1ba Revert "Take the parent window id from the environment"
This reverts commit 4b44094309efe9a86bc0f3e6e687059ee55a90ab.
2016-07-03 18:01:45 -04:00
Matthias Clasen
b78cf7cb23 Add portal support to g_app_info_launch_default_for_uri
We need to patch in the portal support at a high enough
level that GAppInfo is not involved - a sandboxed app may
not be able to see any applications, so it can just launch
the defaults.
2016-07-03 18:01:45 -04:00
Matthias Clasen
5b5b1aab7b Take the parent window id from the environment
GTK+ will set this for when showing URIs in a sandbox.
2016-07-03 18:01:45 -04:00
Matthias Clasen
3ef357aca0 Add portal support to g_app_info_launch_uris
Call out to the org.freedesktop.portal.AppChooser portal.
2016-07-03 18:01:45 -04:00
Matthias Clasen
9edba4e49c Add a new gio commandline tool
This command collects the various commandline utilities that
are currently shipped in gvfs, and unifies them under a single,
command-style binary.

The tools just use GIO APIs, so it makes sense for them to live here.
2016-07-01 16:01:34 -04:00
Philip Withnall
3613b7a366 gio: Add source tags to various GTasks constructed in GLib
This makes them easier to identify when debugging and profiling.

This patch was somewhat less than interesting to write.

https://bugzilla.gnome.org/show_bug.cgi?id=767765
2016-06-29 15:16:52 +01:00
Philip Withnall
8c6d08ab1b build: Simplify dtrace configuration
Apply the same changes as in commit
7563ab4734 to gio/Makefile.am.

https://bugzilla.gnome.org/show_bug.cgi?id=725902
2016-06-29 15:10:12 +01:00
Philip Withnall
c4695f192c build: Rename SystemTap scripts to include the LT version
In a vague attempt at ensuring the .stp scripts can be closely
associated with the .so files which they hard-code references to, rename
the scripts so they include the LT version — so that they are the .so
file name plus .stp.

This does not fix the fact that our .stp scripts will not work on
multiarch systems, as they are installed in an architecture-independent
directory (/usr/share/systemtap/tapset). At the moment, it is
recommended that any distribution who package the .stp files should
install them in the architecture-specific subdirectories of this (for
example, /usr/share/systemtap/tapset/x86-64).

A better long-term solution for this is under discussion upstream:
https://sourceware.org/bugzilla/show_bug.cgi?id=20264

https://bugzilla.gnome.org/show_bug.cgi?id=662802
2016-06-29 14:43:52 +01:00
Philip Withnall
c9d661b431 build: Ensure gio.stp.in is always distributed
Even if systemtap is not enabled in configure when running distcheck.

https://bugzilla.gnome.org/show_bug.cgi?id=662802
2016-06-29 14:43:51 +01:00
Florian Müllner
61c1e2db99 vfs: Fix copying default schemes list
The list of supported schemes is not known at compile-time, so it is
wrong to iterate the list with G_N_ELEMENTS() and we miss all but the
first scheme. Fix by checking for the %NULL sentinel instead.

https://bugzilla.gnome.org/show_bug.cgi?id=768119
2016-06-28 15:57:49 +02:00
Florian Müllner
a42bdecf5c vfs: Fix return value of get_supported_uri_schemes()
The function is expected to return a %NULL-terminated array, but
commit 375b4ca65c dropped the sentinel when adding support for
additional custom schemes. Add it back.

https://bugzilla.gnome.org/show_bug.cgi?id=768119
2016-06-28 15:57:49 +02:00
Ondrej Holy
e57355b055 fileinfo: Add G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE attribute
Add filesystem attribute to detect remote filesystems in order to
replace hardcoded filesystem types in GtkFileSystem. Set this attribute
also for GLocalFile appropriately.

Bump version to 2.49.3, so that early adopters of new API have a version
number to target.
2016-06-28 10:28:51 +02:00
Ernestas Kulik
f4b5dc30a7 gvfs: fix possible infinite loop in parse_name_internal()
If none of the closures in the hash table return a non-null value, the
loop never ends. Since the end of the hash table has been reached at
that point, g_hash_table_iter_next() starts asserting.

The possible fix is making the return value of g_hash_table_iter_next()
the condition in the loop.

https://bugzilla.gnome.org/show_bug.cgi?id=768029
2016-06-25 08:44:52 -04:00
Cosimo Cecchi
375b4ca65c vfs: add g_vfs_register_uri_scheme()
Add a new API to allow clients to register a custom GFile implementation
handling a particular URI scheme.
This can be useful for tests, but also for cases where a different URI
scheme is desired to be used with another custom GFile backend.

As an additional cleanup, we can use this to register the "resource" URI
scheme too.

Based on a patch by Jasper St. Pierre <jstpierre@mecheye.net>.

https://bugzilla.gnome.org/show_bug.cgi?id=767887
2016-06-25 06:58:19 +08:00
Allison Lortie
9bb2499c9c tests: fix uint64 argument to g_object_set() call
5cea1c861d introduced accessors for 64bit
ints to gsettings, at which point the testcases were expanded.

Unfortunately, the expanded tests contained a bug: integer constants
passed to g_object_set() for a 64-bit property need an up-cast.  Add
that now.

Problem found by Iain Lane.
2016-06-23 11:49:39 -04:00
Philip Withnall
8e21b9e966 build: Add gio_probes.d to sources list so it ends up in the tarball
The probes.d file should be distributed even if GLib is build with
dtrace disabled. This is what’s done in the glib and gobject
directories.
2016-06-22 12:41:34 +01:00
Philip Withnall
fadd00c708 glocalfileoutputstream: Drop unnecessary (void) return value casts
g_close() does not have G_GNUC_WARN_UNUSED_RESULT, so these casts are
unnecessary.
2016-06-16 14:45:21 -04:00
Philip Withnall
16d674411f glocalfileoutputstream: Fix an FD leak in an error path
If a backup file is created, opened successfully, then fstat() on it
fails (perhaps due to another process deleting it in the mean time?),
the FD will be leaked.

Coverity issue: #1159485

https://bugzilla.gnome.org/show_bug.cgi?id=730187
2016-06-16 14:39:05 -04:00
Philip Withnall
195a0cb6bb gio: Add SystemTap and DTrace probes for GTask
This adds a basic tapset for GIO, covering various interesting parts of
GTask.

https://bugzilla.gnome.org/show_bug.cgi?id=759813
2016-06-15 16:15:12 -04:00
Philip Withnall
b26b083aa2 gio: Support using GDBusObjectManagerServer at path ‘/’
Previously this would cause an assertion failure when checking the paths
of exported objects, as it would try to check that their paths started
with ‘//’ due to mishandling the root object case.

Includes a unit test.

https://bugzilla.gnome.org/show_bug.cgi?id=761810
2016-06-15 13:27:19 -04:00
Philip Withnall
ac1166626c gio: Add missing (type filename) annotations
These differentiate between strings in the GLib filename encoding, and
strings in UTF-8.

https://bugzilla.gnome.org/show_bug.cgi?id=700756
2016-06-15 11:04:18 -04:00
Philip Withnall
f8ff1049d3 gio: Add missing (nullable) annotation
Add it to g_application_command_line_get_cwd(). Also add a clarifying
internal comment about the cwd private member.

https://bugzilla.gnome.org/show_bug.cgi?id=700756
2016-06-15 11:03:55 -04:00
Hans Petter Jansson
ae048625fe GDbusProxy: Plug memory leak.
proxy->priv->name_owner gets overwritten in async_init_data_set_name_owner() on the
assumption that it will always be NULL when we get there. However,
on_name_owner_changed() can run first, and it does set name_owner.

==20126== 42 bytes in 6 blocks are definitely lost in loss record 15,174 of 48,256
==20126==    at 0x4C280F3: malloc (vg_replace_malloc.c:299)
==20126==    by 0x7541D00: g_malloc (gmem.c:104)
==20126==    by 0x7558FEE: g_strdup (gstrfuncs.c:364)
==20126==    by 0x6DF8E4F: on_name_owner_changed (gdbusproxy.c:1399)
==20126==    by 0x6DE94C4: emit_signal_instance_in_idle_cb (gdbusconnection.c:3743)
==20126==    by 0x753C315: g_main_dispatch (gmain.c:3066)
==20126==    by 0x753C315: g_main_context_dispatch (gmain.c:3642)
==20126==    by 0x753C667: g_main_context_iterate.isra.24 (gmain.c:3713)
==20126==    by 0x753CA69: g_main_loop_run (gmain.c:3907)
==20126==    by 0x5E38000: meta_run (main.c:556)
==20126==    by 0x401EC0: main (main.c:441)

https://bugzilla.gnome.org/show_bug.cgi?id=755439
2016-06-15 16:39:00 +02:00
Christoph Reiter
9ec74d20a7 Partly revert "gio: Add filename type annotations"
Revert all annotation changes for environment variables and command line
arguments.

See commit f8189ddf98.
2016-06-07 19:50:03 +02:00
Christoph Reiter
f8189ddf98 gio: Add filename type annotations
https://bugzilla.gnome.org/show_bug.cgi?id=767245
2016-06-04 20:38:42 +02:00
Emmanuele Bassi
7d8e98ee09 Fix paths for non-srcdir builds
This fixes a build failure in Continuous that resulted in the error:

../../../gio/tests/test.gresource.xml: Failed to locate
'test-generated.txt' in any source directory.
Makefile:4676: recipe for target 'test.gresource' failed
make[6]: *** [test.gresource] Error 1
2016-06-04 13:49:46 +01:00
Georges Basile Stavracas Neto
5411a187a3 glib-compile-resources: correct resource compiler dependency for generated files
Don't require that files can be resolved when generating dependencies.

Original patch by Garret Regier.

https://bugzilla.gnome.org/show_bug.cgi?id=673101
2016-06-04 08:24:22 -04:00