Commit Graph

5717 Commits

Author SHA1 Message Date
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
Colin Walters
cb8bfa758f gdbus-codegen: Call abspath() earlier
The previous change from https://bugzilla.gnome.org/show_bug.cgi?id=786785
didn't actually work (for me at least) in the `/bin/gdbus-codegen` case
as the relative `/bin/../share` path works, but then `os.path.abspath()`
breaks it (as it's not doing `realpath()`, and let's not go there).

Fix this by doing the `abspath` first.

Downstream: https://bugzilla.redhat.com/show_bug.cgi?id=1507661

https://bugzilla.gnome.org/show_bug.cgi?id=789723
2017-11-06 11:57:52 +00:00
Rico Tzschichholz
df66b25301 GSeekable: Fix g_seekable_truncate invoker reference
https://bugzilla.gnome.org/show_bug.cgi?id=573251
2017-11-04 20:05:37 +01:00
Daniel Macks
d88d90c3c8 Exec=true (seach via PATH) instead of hardcoding /bin/true
...otherwise this .desktop is omitted on platforms that have it
elsewhere.

https://bugzilla.gnome.org/show_bug.cgi?id=731705
2017-11-03 20:16:52 +00:00
Uwe Helm
5448ef5326 gio: Add FS magic number for FUSE
https://bugzilla.gnome.org/show_bug.cgi?id=740826
2017-11-03 19:50:19 +00:00
Tomas Kotal
ea2901abf8 gio: GPollFileMonitor is not cleaning up correctly
https://bugzilla.gnome.org/show_bug.cgi?id=789820
2017-11-03 14:07:57 +00:00
Jiří Techet
9bcd7800a1 gio: Eliminate warnings in cstring conversion on OS X
create_cstr_from_cfstring_with_fallback() is allowed to be called when str == NULL
but create_cstr_from_cfstring() isn't which leads to warnings in the console.
Fix this by adding NULL checks into create_cstr_from_cfstring_with_fallback().

https://bugzilla.gnome.org/show_bug.cgi?id=788936
2017-11-03 12:04:33 +00:00
Jiří Techet
6acaca8831 gio: Show icons based on file's mime type on OS X
The patch basically just grabs the implementation of g_content_type_get_icon_internal()
from gcontenttype.c - the only difference is that it first converts UTI to MIME using
g_content_type_get_mime_type() and at the end frees this temporary MIME type.

https://bugzilla.gnome.org/show_bug.cgi?id=788936
2017-11-03 12:04:33 +00:00
Colin Walters
96ebcee8c4 Build with old libmount too
Downstream: https://bugzilla.redhat.com/show_bug.cgi?id=1508056

This is an easy change, and lets us build with RHEL7's libmount.

See also cee57a0268
2017-11-01 14:22:18 -04:00
Will Thompson
41112ef00d GSeekable: improve g_seekable_[can_]truncate docs
I was not born next to a PDP-11, either, but I think this is marginally more informative!

https://bugzilla.gnome.org/show_bug.cgi?id=573251
2017-11-01 15:29:22 +00:00
Tom Schoonjans
663a5cc95f gio/gasynchelper.c: fix cast from pointer to smaller int type on win64
https://bugzilla.gnome.org/show_bug.cgi?id=777310
2017-11-01 12:54:14 +00:00
Руслан Ижбулатов
53bd6a359f W32: Add a stat() implementation for private use
This commit adds new W32-only functions to gstdio.c,
and a new header file, gstdioprivate.h.
These functions are:
g_win32_stat_utf8()
g_win32_lstat_utf8()
g_win32_fstat()
and they fill a private structure, GWin32PrivateStat,
which has all the fields that normal stat has, as well as some
extras.

These functions are then used throughout glib and gio to get better
data about the system. Specifically:
* Full, 64-bit size, guaranteed (g_stat() is forced to use 32-bit st_size)
* Full, 64-bit file identifier (st_ino is 0 when normal stat() is used, and still is)
* W32 File attributes (which stat() doesn't report); in particular, this allows
  symlinks to be correctly identified
* Full, 64-bit time, guaranteed (g_stat() uses 32-bit st_*time on 32-bit Windows)
* Allocated file size (as a W32 replacement for the missing st_blocks)

st_mode remains unchanged (thus, no S_ISLNK), so when these are given back to
glib users (via g_stat(), for example, which is now implemented by calling g_win32_stat_utf8),
this field does not contain anything unexpected.

g_lstat() now calls g_win32_lstat_utf8(), which works on symlinks the way it's supposed to.

Also adds the g_win32_readlink_utf8() function, which behaves like readlink()
(including its inability to return 0-terminated strings and inability to say how large
the output buffer should be; these limitations are purely for compatibility with
existing glib code).

Thus, symlink support should now be much better, although far from being complete.

A new W32-only test in gio/tests/file.c highlights the following features:
* allocated size
* 64-bit time
* unique file IDs

https://bugzilla.gnome.org/show_bug.cgi?id=788180
2017-11-01 12:46:38 +00:00
Christoph Reiter
fed574a0c8 introspection: Add more filename type annotations for strings which can contain filenames
This continues the changes done in https://bugzilla.gnome.org/show_bug.cgi?id=767245

This makes it possible to pass Python path types as process arguments and env vars
in PyGObject and and makes it clear that the values are not strictly utf-8 and need
to be validated/converted first.

https://bugzilla.gnome.org/show_bug.cgi?id=788863
2017-10-26 18:51:51 +02:00
Debarshi Ray
7339a09376 docs: Mention the idiomatic way of invoking a GAsyncReadyCallback
The GAsyncResult documentation didn't specify the context in which the
GAsyncReadyCallback is expected to be invoked. Since asynchronous
operations can be implemented in various ways involving GSources,
threads and coroutines, it is useful to mention what the standard
expections are.

Unfortunately, since this was left undefined for so long, we can only
phrase it as a suggestion, and not as a hard requirement.

https://bugzilla.gnome.org/show_bug.cgi?id=783825
2017-10-26 14:08:42 +02:00
Debarshi Ray
09d936c528 docs: Explain how GAsyncReadyCallbacks are, and should be, invoked
https://bugzilla.gnome.org/show_bug.cgi?id=783825
2017-10-26 14:08:42 +02:00
Debarshi Ray
61ea1e7ca4 docs: Don't be vague about where GTask dispatches the result
https://bugzilla.gnome.org/show_bug.cgi?id=783825
2017-10-26 13:48:39 +02:00
Debarshi Ray
3c5b59ddca docs: Clarify the thread-default GMainContext where the result is sent
https://bugzilla.gnome.org/show_bug.cgi?id=783825
2017-10-26 13:48:39 +02:00
Philip Withnall
3eacec1587 Use hash tables as sets in various places
Where we were already treating GHashTables as sets, modify them to use
the set-specific APIs g_hash_table_add() and g_hash_table_contains(), to
make that usage more obvious and less prone to being broken.

Heavily based on patches by Garrett Regier <garrettregier@gmail.com>.

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

https://bugzilla.gnome.org/show_bug.cgi?id=749371
2017-10-26 12:27:17 +01:00
Stef Walter
0f82ff12ea gdbus-proxy: Fix erroneous timeout during following tests
Modified by Philip Withnall to amend a second instance in the same
file.

https://bugzilla.gnome.org/show_bug.cgi?id=711809
2017-10-26 12:01:05 +01:00
Philip Withnall
767296db9c gio: Add autoptr declarations for GUnixMountEntry and GUnixMountPoint
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=788927
2017-10-26 00:19:23 +01:00
Philip Withnall
1e4221a3f7 gio: Add API for identifying system FS types and device paths
This is needed by gnome-control-center and gnome-settings-daemon; it
makes existing checks from gunixmounts.c public.

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

https://bugzilla.gnome.org/show_bug.cgi?id=788927
2017-10-26 00:19:23 +01:00
Michael Catanzaro
4b07869462 socket: actually remove fd from poll when socket is closed
In my previous patch, I failed to call g_source_remove_unix_fd() in
order to actually stop polling the fd of the closed socket.

The test did not catch this, because the test only checks that the right
source callback is dispatched properly. I don't know how to test this.

https://bugzilla.gnome.org/show_bug.cgi?id=723655
2017-10-25 09:36:07 -05:00
Michael Catanzaro
c5202bc5e9 Add socket postmortem test
Checks that after a GSocket is closed, a source created off it
with g_socket_create_source() will dispatch exactly once with
G_IO_NVAL.

Based on a patch by Mikhail Zabaluev

https://bugzilla.gnome.org/show_bug.cgi?id=723655
2017-10-24 09:02:02 -05:00
Michael Catanzaro
f99045fd03 socket: Don't poll the socket fd after close
This prevents polling on file descriptors that are no longer in use
or have been reused for something else.

Based on a patch by Mikhail Zabaluev

https://bugzilla.gnome.org/show_bug.cgi?id=723655
2017-10-24 09:02:02 -05:00
Emmanuele Bassi
5c13bf9bcf build: Use subdir-objects with Autotools
We're eventually going to drop Autotools, but in the meantime we should
probably use idiomatic options and reduce warnings.

GLib is pretty much already safe for subdir-objects to be enabled,
except in the GIO tests, where the build references files that are
generated in a different level. For that, we can use the same solution
employed by GTK+, and link the appropriate file in the right
sub-directory.

https://bugzilla.gnome.org/show_bug.cgi?id=788989
2017-10-24 13:30:41 +01:00
Xiang Fan
3d4fb44653 gsettings: make g_settings_bind() documentation clearer
https://bugzilla.gnome.org/show_bug.cgi?id=789245
2017-10-23 12:20:02 +01:00
Friedrich Beckmann
37c0610b4d MacOS: gosxappinfo.c Fix some memory leaks. Fix failure condition.
Ensure that the debug call won't crash if create_cstr_from_cfstring
returns NULL, fix the leak of that CFArrayRef, and make explicit the
failure condition of LSFindApplicationForInfo.

https://bugzilla.gnome.org/show_bug.cgi?id=788936
2017-10-17 14:10:31 +01:00
Friedrich Beckmann
2bd423c54c MacOS: create_cstr_from_cfstring uses safe conversion - use CFStringGetCString
During testing with gdk-pixbuf I noticed failures during content type
to mime conversion. The root reason was the unsafe conversion used
in create_cstr_from_cfstring. The problem was addressed in commit
c60226e0a1 but that was reverted. I noticed the commit only
when I had fixed the problem. In addition I added a test to check
the content type to mime conversion on MacOS. This problem is
discussed in Bug #788936.

See: https://bugzilla.gnome.org/show_bug.cgi?id=788936
2017-10-17 14:10:31 +01:00
Julien Isorce
ea725a6414 gio: add g_socket_join_multicast_group_ssm (IGMPv3 SSM)
It adds support for source-specific multicast IGMPv3.

Allow receiving data only from a specified source when joining
a multicast group.

g_socket_join_multicast_group_ssm can be called multiple times
to allow receiving data from more than one source.

Support IPv4 and IPv6.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=740791
2017-10-16 11:14:57 +01:00
Friedrich Beckmann
e55efa35e3 OSX: Use xdgmime system to guess content type from data
Closes: Bug #788401

The problem is described here:

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

This patch introduces the use of the xdgmime system to guess
the content type from data. So you can guess for example the
type public.svg-image from the file content of a svg file.
This patch only applies to MacOS. A test for the regression
is also included.
2017-10-14 09:11:01 +01:00
Philip Withnall
13c6d9fedf Revert "[MacOS] Fallback to CFStringGetCSTring if CFStringGetCStringPtr fails."
This reverts commit c60226e0a1.

Pushed without review. This should be reviewed on bug #788936 first.
Several issues with the patch:
 • Takes the string length unnecessarily early.
 • Calls CFRelease(str) before g_strdup(cstr) which could lead to
   use-after-free.
 • Code style issues.
 • Don’t want to encourage pushing patches without review.
2017-10-14 09:04:43 +01:00
John Ralls
c60226e0a1 [MacOS] Fallback to CFStringGetCSTring if CFStringGetCStringPtr fails. 2017-10-13 14:04:02 -07:00
Philip Withnall
0d69462f14 gunixmounts: Update list of virtual file systems to ignore
Synchronise it with the list in gnome-settings-daemon, which has seen
more recent updates than this one.

https://git.gnome.org/browse/gnome-settings-daemon/tree/plugins/housekeeping/gsd-disk-space-helper.c

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

https://bugzilla.gnome.org/show_bug.cgi?id=788880
2017-10-13 11:01:30 +01:00
Rico Tzschichholz
65e443da65 gio: Mark callback_data of GFileReadMoreCallback as closure
In conjunction with 77fbc10da6

https://bugzilla.gnome.org/show_bug.cgi?id=629347
2017-10-12 09:20:17 +01:00
Beniamino Galvani
aeecd81dd1 gio: fix race condition in GDBusObjectManagerClient
priv->map_object_path_to_object_proxy must be protected to avoid
concurrent access by multiple threads. Move the hash table insertion
into the critical section.

https://bugzilla.gnome.org/show_bug.cgi?id=788368
2017-10-11 16:36:20 +01:00
Rico Tzschichholz
1fb56be6ab gio: Mark g_task_get_source_object as nullable
In conjunction with ca4fe5942a

Reviewed-by: Philip Withnall <withnall@endlessm.com>
2017-10-11 17:14:11 +02:00
Philip Withnall
3d8296940a tests: Fix case of a string comparison
Fixup to commit 12e32e96a3.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-10-11 14:05:21 +01:00
Simon McVittie
331f73c26d gio/tests/gdbus-proxy: sleep longer when testing that we time out
On slow ARM machines doing parallel builds, there's no guarantee that
we'll get scheduled in a window between (100ms|250ms) and 500ms.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=769674
2017-10-11 13:32:48 +01:00
Simon McVittie
7d5c738dba gio/tests/file: increase an arbitrary timeout
On slow ARM machines doing parallel builds, there's no guarantee that
we'll get through this in 5 seconds.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=769674
2017-10-11 13:32:41 +01:00
Florian Müllner
77fbc10da6 introspection: Add more annotations for GFile
Add annotations fixing warnings in GFile.

https://bugzilla.gnome.org/show_bug.cgi?id=629347
2017-10-11 13:26:15 +01:00
Christian Dywan
0ef7174e74 Document that pre-unmount may not be emitted
Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=636210
2017-10-11 13:18:49 +01:00
Daniel Macks
b8ccbd9a3c Fix variable-scoping to avoid declaring on platforms where not used
"len" is only used by some platforms' implementations (as controlled
by various autoconf/#ifdef tokens) and only in a small codeblock in
those cases, but was declared based on a looser #ifdef heuristic and
in a larger scope. The result is an unused-variable warning when built
on some platforms. Move declaration to the local codeblocks that use
the variable, which also restricts it to the narrower set of platforms
where those codeblocks are used.

https://bugzilla.gnome.org/show_bug.cgi?id=689323
2017-10-11 13:12:36 +01:00
Philip Withnall
e34884e364 gsettingsschema: Add a missing (nullable) annotation
Spotted as part of https://bugzilla.gnome.org/show_bug.cgi?id=725014.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-10-11 13:09:53 +01:00
Philip Withnall
5876cdff25 gsettingsschema: Fix some incorrect whitespace
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-10-11 13:09:40 +01:00
Philip Withnall
ee1d38ce64 docs: Fix an incorrect function name in GSettings documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-10-11 13:09:15 +01:00
Evan Nemerson
ca4fe5942a gio: mark the GAsyncResult source_object as nullable
https://bugzilla.gnome.org/show_bug.cgi?id=740223
2017-10-11 13:00:43 +01:00
Руслан Ижбулатов
4a77eb16ce Replace all instances of ssize_t with gssize
ssize_t is supported widely, but not universally, so use gssize instead.
Currently only one piece of code actually *needs* this change to be compilable
with MSVC, the rest are mostly in *nix parts of the code, but these are changed
too, for symmetry.

https://bugzilla.gnome.org/show_bug.cgi?id=788180
2017-10-11 12:56:11 +01:00
Руслан Ижбулатов
6abdc06da6 W32: Bump target NT version to 0x601 (7 or newer)
Also remove now-unnecessary if_nametoindex() implementation
(the HAVE_IF_NAMETOINDEX configure check didn't work correctly, it turned out),
which prevents glib from building. if_nametoindex() is available in lphlpapi since
Vista[1], so we don't need a compatibility function for it anymore, as Windows 7
is the new minimally-required version.

[1] https://msdn.microsoft.com/en-us/library/windows/desktop/bb408409(v=vs.85).aspx

https://bugzilla.gnome.org/show_bug.cgi?id=788180
2017-10-11 12:29:55 +01:00
Nirbheek Chauhan
b444ae0de2 meson: Improve gdbus-codegen custom target dependencies
Ensure that the custom targets that use gdbus-codegen get rebuilt when
any of the gdbus-codegen files are changed.

https://bugzilla.gnome.org/show_bug.cgi?id=752239
2017-10-11 16:55:39 +05:30
Philip Withnall
faf9440908 gdbus-tool: Add tab completion support to gdbus emit
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=788594
2017-10-11 12:18:14 +01:00
Philip Withnall
51e91e35c1 gdbus-tool: Fix some invalid indentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=788594
2017-10-11 12:18:14 +01:00
Philip Withnall
b3acf58779 gdbus-tool: Fix tab-completion for non-message-bus connections
• `gdbus monitor` can’t work at all for non-message-bus connections,
   since it can’t subscribe to signals.
 • Other tab completions for names depend on the connection being a
   message bus connection, but we still need to print `--dest` (etc.)
   when tab completing them, even if we can’t print a list of
   available names.

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

https://bugzilla.gnome.org/show_bug.cgi?id=788594
2017-10-11 12:18:14 +01:00
Philip Withnall
181b58c46d build: Fix build with srcdir ≠ builddir
Broken by commit a71f51dece. My fault for
not reviewing thoroughly enough.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-10-11 10:52:44 +01:00
Cor-Paul Bezemer
a71f51dece build: Add gdbus-codegen files as dependencies in generated code rule
So gdbus-daemon-generated.[ch] get regenerated appropriately if any of
them change.

https://bugzilla.gnome.org/show_bug.cgi?id=752239
2017-10-11 10:33:45 +01:00
Maks Naumov
12e32e96a3 Don't skip invalid enum values in schemas
Signed-off-by: Maks Naumov <maksqwe1@ukr.net>

https://bugzilla.gnome.org/show_bug.cgi?id=742997
2017-10-11 10:22:23 +01:00
Jan Alexander Steffens (heftig)
30b25a6fd9 meson: Fix permissions of installed scripts
configure_file preserves the attributes, so the templates need to be
executable for the (installed) outputs to be executable.

https://bugzilla.gnome.org/show_bug.cgi?id=787671
2017-10-11 09:49:26 +01:00
Nirbheek Chauhan
b9f2ea4235 gdbus-codegen: Don't assume bindir and datadir share prefix
This assumption breaks when, for instance:

* Called as /bin/gdbus-codegen
* Installed on Windows in a directory that is not `bin/`

For such cases, we cannot make any assumptions about the directory
structure, and must hard-code the datadir.

https://bugzilla.gnome.org/show_bug.cgi?id=786785
2017-10-11 09:48:38 +01:00
grindhold
5b64522fcb socket: fix typo in get_remote_address docs
fixed the following typo:
"remove address" → "remote address"

https://bugzilla.gnome.org/show_bug.cgi?id=788766
2017-10-10 11:31:49 +01:00
Chun-wei Fan
2c6c03290f gio: Fix gio-tool-open.c on Windows/Cocoa
Commit 7384e37 broke builds on these platforms as *NIX-only APIs are
being used unconditionally.  Fix the build by building these portions
when not on Windows or Cocoa.

https://bugzilla.gnome.org/show_bug.cgi?id=780296
2017-10-09 09:10:48 +08:00
Philip Withnall
0a10f7375f glocalfileinfo: Use g_strcmp0() for some comparisons which might be NULL
The return value from g_get_user_special_dir() might be NULL. Safest to
use g_strcmp0() uniformly everywhere.

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

https://bugzilla.gnome.org/show_bug.cgi?id=661442
2017-10-06 11:17:40 +01:00
Ondrej Holy
1508db2f66 gio: Add hack to close up dbus-daemon race
If gio open exits before the program it starts fully activates, then
the dbus-daemon may avoid doing the activating method call.

This commit works around the problem by pinging the activated application,
and waiting for a reply.

Same workaround is used in gtk-launch and was used in gvfs-open before
it was replaced by gio open.

https://bugzilla.gnome.org/show_bug.cgi?id=780296
2017-10-05 16:19:31 +02:00
Jiro Matsuzawa
acea147cbc gsettings: Suppress error messages of completion
https://bugzilla.gnome.org/show_bug.cgi?id=695681
2017-10-05 14:41:24 +01:00
Philip Withnall
55905db86a gfile: Fix typo in documentation for g_file_set_attribute()
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-10-05 13:46:41 +01:00
Philip Withnall
b0cbd21b25 glib-compile-resources: Fix leak of a GHashTable
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=788138
2017-10-02 15:30:23 +01:00
Ondrej Holy
f6fa90fb0d gunixmounts: Fix mount points generation
Commit 53ed180 improved mtab processing, however, also introduced bug
in code obtaining mount points. mtab was used by mistake also for
g_unix_mount_points_get implementation, which is obviously wrong and
fstab has to be used instead...

https://bugzilla.gnome.org/show_bug.cgi?id=781867
2017-10-02 12:19:51 +02:00
Philip Withnall
330e6911b5 goutputstream: Add missing (optional) annotations to bytes_written args
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-09-27 10:31:34 +01:00
Nelson Benítez León
c1a31c3aaa gio/gunixmounts.c: Don't use mtime to monitor mounts on /proc/
Fix get_mounts_timestamp() to not use a stat'ed mtime for /proc/ files.
Instead, use mount_poller_time if /proc/ watch is running, or otherwise
return a new generated timestamp to always assume mounts-changed, which
is safer than previous behaviour of always assuming mounts-not-changed
(as mtime never changes for /proc/ files when queried from the same
process).

We say it's safer because allows caches depending on:

g_unix_mounts_get(&time_read)
g_unix_mounts_changed_since()

to drop possibly outdated/duplicated values, as that was the case for the
GIO mounts cache used in gio/glocalfile.c which provides mount info for
g_file_query_filesystem_info() call, as described in below referenced bug.

This fix complements related commit bd9e266e11

https://bugzilla.gnome.org/show_bug.cgi?id=787731
2017-09-22 20:28:44 +05:00
Nelson Benítez León
32a9b88b20 gio/tests: Add testcase for bug 787731
Add testcase for function g_file_query_filesystem_info()
reporting outdated info for "filesystem::readonly" attribute
when said attribute was different in a previous mounted
partition in the same device (as GIO maintains a mounts cache
per 'st_dev' stat() member).

To trigger a mount operation, testcase uses program 'bindfs'
instead of 'mount --bind' as bindfs does not require root
privileges. And 'fusermount -u' command is used to unmount said
bindfs mount.

As a reference in Fedora, 'bindfs' is installed from 'bindfs'
package and 'fusermount' from 'fuse' package (this one is installed
by default as being part of 'System Tools' group).

The test creates a directory with a file in it, then mounts it
readonly over another directory (the mountpoint), it then checks
that g_file_query_filesystem_info() for the file in it indeed reports
"filesystem::readonly" as TRUE. Then unmounts and mounts again this
time rw (not readonly), it then checks again if g_file_query_filesystem_info()
is reporting "filesystem::readonly" as TRUE, if that's the case, it
confirms the bug by opening said file in write mode.

Testcase is only added for Unix builds.

https://bugzilla.gnome.org/show_bug.cgi?id=787731
2017-09-22 20:28:44 +05:00
Philip Withnall
09796b3ccc Partially revert "gio: Add missing (array length) annotations"
This reverts commit 8028494335.

Adding (array length=…) to a gchar* parameter causes the GIR file to
contain an array of strings, rather than an array of characters. While
we fix GIR, revert those changes.

Some of the other changes in the file (which have an explicit
(element-type) already) are fine.

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

https://bugzilla.gnome.org/show_bug.cgi?id=765063
2017-09-21 12:05:06 +01:00
Alisa Maas
8028494335 gio: Add missing (array length) annotations
https://bugzilla.gnome.org/show_bug.cgi?id=765063
2017-09-21 11:08:12 +01:00
Robert Ancell
db2ae64636 Fix comment/docs grammar: incase -> in case 2017-09-15 13:50:41 +12:00
Chun-wei Fan
a7a6449f4d meson: Install items according to their relevance
The m4 and bash completion items are usable and relevant
depending on the host system's configuration.  So, we check for the
presence of the programs that these items depend on, and only install
them when those programs are found.

For the Valgrind suppression files, we don't install them on Windows as
Valgrind is currently not supported on Windows.

Als fix the path where the GDB helpers are installed, as the path is
incorrectly constructed.

This will fix the "install" stage when building on Visual Studio at
least as there are some post-install steps that are related to them,
which will make use of these programs.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-09-14 16:02:03 +08:00
Philip Withnall
5e55a4e243 gtlsbackend: Default to indicating no support for DTLS in GTlsBackend
I’m unsure what the original reasoning for returning TRUE by default
from supports_dtls was, but it is not backwards-compatible. If a
pre-existing GTlsBackend implementation never implements the
supports_dtls vfunc, the supports_dtls() method will magically return
TRUE rather than FALSE.

Since any backend which does implement DTLS should be implementing the
supports_dtls vfunc (and no DTLS-supporting backends have actually been
merged yet; see bug #697908), it seems safer to make this slight API
break in the name of backwards compatibility than to leave it as
returning TRUE incorrectly.

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

https://bugzilla.gnome.org/show_bug.cgi?id=787485
2017-09-13 17:38:42 +01:00
Sam Thursfield
bb26bc29e3 Make GListModelInterface::get_item usable from GObject Introspection bindings
Language bindings have so far been unable to implement the GListModel
interface because the ::get_item virtual function returns a
non-bindable type (gpointer). The `gpointer` type gets translated into
`void` by G-I meaning that get_item() implementations can't return any
items.

We can set the return type of the get_item() vfunc explicitly to
GObject, which fixes the issue.

This patch also removes the existing (type GObject) annotation on
g_list_model_get_item(), which is necessary because if its return type
matches that of the get_item() vfunc, G-I connects the two and
propagates the 'skip' annotation from one to the other resulting in the
get_item() vfunc being hidden. There's no API break here because the
'skip' annotation makes g_list_model_get_item() invisible to G-I users
anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=787271
2017-09-12 12:32:20 +01:00
Philip Chimento
7b9503a4f8 docs: Clarify relationship of quit() to hold count
Calling g_application_quit() ignores the hold count; this patch adds a
warning to the documentation about other code having a hold on the
application and expecting it to exist.

https://bugzilla.gnome.org/show_bug.cgi?id=737278
2017-09-11 22:26:04 +01:00
Daniel Macks
b8f9c08a09 Avoid setting unused variables (-Wself-assign)
Setting a variable and then assigning it to itself avoids
-Wunused-but-set-variable but this specific trick is now caught by
-Wself-assign. Instead, actually use the value or don't bother
assigning it at all:

gdbusauthmechanismsha1.c: #ifdef a var decl to match its actual use use
gdbusauthmechanismsha1.c: call g_ascii_strtoll() in void context

https://bugzilla.gnome.org/show_bug.cgi?id=745723
2017-09-11 22:18:42 +01:00
Daniel Macks
190f64a0fb Avoid setting unused variables (-Wself-assign)
Setting a variable and then assigning it to itself avoids
-Wunused-but-set-variable but this specific trick is now caught by
-Wself-assign. Instead, actually use the value or don't bother
assigning it at all:

gdbusauth.c: call g_data_input_stream_read_byte() in void context
gdbusauthmechanismsha1.c: value is actually used
gdbusmessage.c: use consistent preprocessor-token protection
gthreadedresolver.c: skip over bytes in data blob
httpd.c: do something useful with the value

https://bugzilla.gnome.org/show_bug.cgi?id=745723
2017-09-11 22:14:18 +01:00
Emmanuele Bassi
5d9ccf162e gio: Annotate GDBusObjectManagerClient signal appropriately
https://bugzilla.gnome.org/show_bug.cgi?id=756009
2017-09-11 21:31:13 +01:00
Philip Withnall
1275b94fe7 gsettings: Fix copy-paste error in property documentation
This should fix the introspection binding for that property too.

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

https://bugzilla.gnome.org/show_bug.cgi?id=656502
2017-09-11 21:28:40 +01:00
Mikhail Zabaluev
e5db8ec787 Skip g_subprocess_launcher_set_child_setup() in introspection
It's not likely that the runtime of a bound language using the
introspection supports running in a process forked by a foreign
library, so that a closure programmed in that language would work
safely.

Any programming environment supporting that would probably have
its own advanced facilities for process spawning, or be able
to access the GLib spawning APIs via raw C bindings (still
represented in the introspection, (skip) only adds a flag)
and do any low-level preparatory dances as necessary for the
forked runtime.

Note that there are other APIs making use of GSpawnChildSetupFunc,
but they are usable with the closure nullified, and we cannot annotate
the closure parameters away because that would break the annotated API
for bindings; accordingly to bug #738176 comment #3, the current bindings'
users are expected to pass null.
2017-09-11 21:07:09 +01:00
Mikhail Zabaluev
48cf1d32c6 Fix up closure annotations for GSpawnChildSetupFunc
https://bugzilla.gnome.org/show_bug.cgi?id=738176
2017-09-11 21:07:08 +01:00
Alberto Ruiz
df8350b316 GSubprocessLauncher: add (transfer none) annotation
https://bugzilla.gnome.org/show_bug.cgi?id=753521
2017-09-11 20:23:13 +01:00
Philip Withnall
52dd98475c gtlsbackend: Add missing preconditions for DTLS virtual methods
Make it a bit more obvious when the DTLS methods aren’t implemented by a
particular TLS backend; return an invalid type rather than crashing.

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

https://bugzilla.gnome.org/show_bug.cgi?id=752240
2017-09-11 19:15:15 +01:00
Cosimo Cecchi
88a39670e7 GSettingsBackend: use a GWeakRef during dispatch
Instead of a full reference, which causes problems for clients that
expect a GSettings instance to stop firing signals once they drop the
last reference.

https://bugzilla.gnome.org/show_bug.cgi?id=780861
2017-09-08 09:29:18 -07:00
Chris Lamb
e5eaca5492 gio-querymodules: Make the output reproducible
Whilst working on the Reproducible Builds effort [0], we noticed that
queryimmodules generates non-reproducible output as it iterates over the
filesystem without sorting.

Patch attached.

 [0] https://reproducible-builds.org/

Signed-off-by: Chris Lamb <lamby@debian.org>

https://bugzilla.gnome.org/show_bug.cgi?id=786983
2017-09-08 15:20:27 +01:00
Daniel Boles
b1b00517cf GApplication: Fix required # of elements in docs
The reality, as shown by our tests, is that only 2 elements are needed.
2017-09-06 21:44:25 +01:00
Cj Malone
926db3174a gdesktopappinfo.c: Drop disregarded xterm check
https://bugzilla.gnome.org/show_bug.cgi?id=786580
2017-08-23 23:55:43 +01:00
Philip Withnall
73eee8d64e tests: Fix some leaks and double-frees in the GSubprocess tests
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=786456
2017-08-23 11:37:32 +01:00
Will Thompson
65a95a5a2d gio: failing cases for subprocess cancellable bug
https://bugzilla.gnome.org/show_bug.cgi?id=786456
2017-08-23 11:37:32 +01:00
Philip Withnall
8f86d312d8 gio: Fix double-callback on cancellation with GSubprocess
See bug #786456 for a detailed analysis of the situation which can cause
this (in summary, if a g_subprocess_wait_async() call is cancelled on a
GSubprocess which is already known to be dead).

The problem was that the GCancellable callback handler was
unconditionally returning a result for the GTask for
g_subprocess_wait_async(), even if that GTask had already returned a
result and the callback was being invoked after the GTask had been
removed from the pending_waits list.

Fix that by checking whether the GTask is still in the pending_waits
list before returning a result for it.

Thanks to Will Thompson for some very useful unit tests which reproduce
this (which will be pushed in the following commit).

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

https://bugzilla.gnome.org/show_bug.cgi?id=786456
2017-08-23 11:37:32 +01:00
Philip Withnall
a60359aee2 tests: Add temporary working directory for monitor test
Similarly to the previous commit, move the temporary directory for the
monitor test from $(cwd) to the system temporary directory.

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

https://bugzilla.gnome.org/show_bug.cgi?id=785260
2017-08-23 11:26:57 +01:00
Philip Withnall
0f5b523fac tests: Add temporary working directory for appmonitor test
Rather than creating a temporary directory in the current directory
(typically the builddir), then never deleting it; create one in the
system /tmp directory, and clean it up properly afterwards.

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

https://bugzilla.gnome.org/show_bug.cgi?id=785260
2017-08-23 11:26:57 +01:00
Philip Withnall
3ce00b29ec tests: Fix leak in appmonitor test
Spotted by Daniel Macks.

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

https://bugzilla.gnome.org/show_bug.cgi?id=785260
2017-08-23 11:26:57 +01:00
Ondrej Holy
087525b62b gio-tool: Use print_file_error correctly
Use print_file_error where an error relates to that file and vice versa.

https://bugzilla.gnome.org/show_bug.cgi?id=786463
2017-08-18 14:46:23 +02:00
Ondrej Holy
78fa67e70c gio-tool-save: Use g_output_stream_write_all instead of while
Simplify the read-write copy code and use g_output_stream_write_all
instead of while and g_output_stream_write.

https://bugzilla.gnome.org/show_bug.cgi?id=786462
2017-08-18 14:46:23 +02:00
Ondrej Holy
1cce5dda18 gfile: Use g_output_stream_write_all instead of while
Simplify the read-write copy code and use g_output_stream_write_all
instead of while and g_output_stream_write.

https://bugzilla.gnome.org/show_bug.cgi?id=786462
2017-08-18 14:46:23 +02:00
Ondrej Holy
c7f2a7e431 gio-tool-save: Prevent overwriting error
The following warning is shown, when both g_output_stream_write and
g_output_stream_close fail:
"GError set over the top of a previous GError or uninitialized memory."

Let's clear the error after use.

https://bugzilla.gnome.org/show_bug.cgi?id=786463
2017-08-18 14:46:23 +02:00
Ondrej Holy
37cddec0ee gio-tool: Unify buffer sizes
Recently, buffer size for copying has been increased in order to improve
performance:
https://bugzilla.gnome.org/show_bug.cgi?id=773823

Let's do the same for gio-tool-save and gio-tool-cat.

https://bugzilla.gnome.org/show_bug.cgi?id=786460
2017-08-18 14:46:23 +02:00
Chun-wei Fan
54aee1f627 Meson: Set _WIN32_WINNT to 0x0601 (Windows 7)
We want to set _WIN32_WINNT so that functions will be properly found in
the headers, to target the NT6.1+ (Windows 7+) APIs.

Also improve the checks for if_nametoindex() and if_indextoname() on
Windows as they are supported in Windows Vista+, but they have
to be checked by linking against iphlpapi.lib (or -liphlpapi).  On other
platforms, they are still checked as they were before.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-08-17 23:40:35 +08:00
Chun-wei Fan
32d6a76b98 build: Use Meson's find_library() for MSVC builds as needed
Some of the dependencies' build systems for Visual Studio do not provide a
pkg-config file upon build, so we use find_library() for them when the
corresponding pkg-config files are not found during Visual Studio builds,
so that one will not need to make up pkg-config files for them, which
could be error-prone.  These .lib names match the names that are built
with the officially supported build system that is used by their
respective Visual Studio support.

For ZLib, this will make gio-2.0.pc reflect on the zlib .lib based on
what is found, or whether we use the fallback/bundled ZLib, when we
don't have a pkg-config file for ZLib on MSVC.  We still need to depend
on Meson to be updated to put the correct link argument for linking ZLib
in the pkg-config case.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-08-17 17:17:59 +08:00
Simon McVittie
7c97e3d784 gdbus: Check signature of NameAcquired, NameLost
Calling g_variant_get (parameters, "(&s)") when parameters has a
signature other than (s) is considered to be a programming error.
In practice the message bus (dbus-daemon or a reimplementation) should
always send the expected type, but be defensive.

(Modified by Philip Withnall to improve type check.)

Signed-off-by: Simon McVittie <smcv@collabora.com>
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=784392
2017-08-07 17:31:31 +01:00
Simon McVittie
c53b44edb2 GBusNameOwnerFlags: Add DO_NOT_QUEUE flag
PulseAudio and LibreOffice are among the services that use this flag.
Refusing to queue for a name lets you do this transaction,
but atomically, avoiding the transient state where you briefly join
the queue and then are given the name when its primary owner drops it:

    result = RequestName(name)

    if result == IN_QUEUE:
        ReleaseName(name)
        result = EXISTS

    return result

(Modified by Philip Withnall to add documentation.)

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

https://bugzilla.gnome.org/show_bug.cgi?id=784392
2017-08-07 17:16:07 +01:00
Simon McVittie
92f1ba200d GBusNameOwnerFlags: Note equivalence with D-Bus Specification
The implementation passes flags through directly to the RequestName()
call, so if any new values break that equivalence, the implementation
will have to be changed.

Signed-off-by: Simon McVittie <smcv@collabora.com>

https://bugzilla.gnome.org/show_bug.cgi?id=784392
2017-08-07 17:10:07 +01:00
Philip Withnall
05abc6cfce gio: Fix crash in open URI portal when no callback is provided
If no callback is provided, token is never set, but it’s then passed to
g_variant_new_string(), which requires a non-NULL input.

Fix that by moving all the option handling inside the (callback != NULL)
case.

Spotted by Coverity (CID #1378714).

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

https://bugzilla.gnome.org/show_bug.cgi?id=785817
2017-08-07 17:08:07 +01:00
Philip Withnall
1782219fb8 docs: Fix typo in GDBusInterfaceSkeleton documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-04 13:30:10 +01:00
Philip Withnall
ad9d5a11f2 tests: Fix gschema-compile test for translatable string changes
Little did I know when making commit
c257757cf6 that a lot of the output of
glib-compile-schemas is string matched in some of the unit tests. Fix
them to match the updated strings.

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

https://bugzilla.gnome.org/show_bug.cgi?id=695573
2017-08-03 16:32:42 +01:00
Philip Withnall
25c01e1c55 glib-compile-schemas: Use double quotes rather than single quotes
It’s what GLib is standardising on. See bug #772221.

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

https://bugzilla.gnome.org/show_bug.cgi?id=695573
2017-08-03 16:31:37 +01:00
Daniel Macks
f7a14fece4 Use "-module" when compiling loadable modules
Some platforms use different extensions for compile-time linkable
libraries vs runtime-loadable modules. Need to use special libtool
flag in the latter case for consistency with what gmodule expects.

https://bugzilla.gnome.org/show_bug.cgi?id=731703
2017-08-03 12:28:10 +01:00
Philip Withnall
c257757cf6 glib-compile-schemas: Improve some translatable strings
• Fix capitalisation to be consistent
 • Use Unicode quotation marks where appropriate
 • Move trailing \n characters out of the translable strings and append
   them unconditionally

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

https://bugzilla.gnome.org/show_bug.cgi?id=695573
2017-08-03 11:41:13 +01:00
Daniel Boles
94816e10d2 glib-compile-schemas: Fix typo in newly translatable string 2017-08-03 11:30:20 +01:00
Jiro Matsuzawa
a7aa8acc48 glib-compile-schemas: Mark missing strings for translation
https://bugzilla.gnome.org/show_bug.cgi?id=695573
2017-08-03 11:19:08 +01:00
Philip Withnall
f2b6c11629 gstrfuncs: Expand documentation for errno functions
Mention that it really is a good idea to save errno before doing
literally anything else after calling a function which could set it.

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

https://bugzilla.gnome.org/show_bug.cgi?id=785577
2017-08-03 10:21:13 +01:00
Philip Withnall
5cddde1fb2 Consistently save errno immediately after the operation setting it
Prevent the situation where errno is set by function A, then function B
is called (which is typically _(), but could be anything else) and it
overwrites errno, then errno is checked by the caller.

errno is a horrific API, and we need to be careful to save its value as
soon as a function call (which might set it) returns. i.e. Follow the
pattern:
  int errsv, ret;
  ret = some_call_which_might_set_errno ();
  errsv = errno;

  if (ret < 0)
    puts (strerror (errsv));

This patch implements that pattern throughout GLib. There might be a few
places in the test code which still use errno directly. They should be
ported as necessary. It doesn’t modify all the call sites like this:
  if (some_call_which_might_set_errno () && errno == ESOMETHING)
since the refactoring involved is probably more harmful than beneficial
there. It does, however, refactor other call sites regardless of whether
they were originally buggy.

https://bugzilla.gnome.org/show_bug.cgi?id=785577
2017-08-03 10:21:13 +01:00
Ondrej Holy
41a4a70b43 gunixmounts: Add missing const qualifier for mtab path
get_mtab_read_file and get_mtab_monitor_file returns const path,
but const qualifier is missing. Let's add it.

https://bugzilla.gnome.org/show_bug.cgi?id=779607
2017-08-03 10:22:43 +02:00
Ondrej Holy
2db36d0d5c gunixmounts: Prevent "mounts-changed" race if /etc/mtab is used
The /etc/mtab file is still used by some distributions (e.g. Slackware),
so it has to be monitored instead of /proc/self/mountinfo in order to
avoid races between g_unix_mounts_get and "mounts-changed" signal. The
util-linux is built with --enable-libmount-support-mtab in that case and
mnt_has_regular_mtab is used for checks. Let's use mnt_has_regular_mtab
also to determine which file to monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=779607
2017-08-03 10:22:43 +02:00
Debarshi Ray
b51a0e7c63 GApplication: Use a WARNING if dbus_unregister is called by destructor
Unlike g_application_register, there is no public API to unregister the
GApplication from D-Bus. Therefore, if the GApplication is set up
manually without using g_application_run, then neither can the
GApplicationImpl be destroyed nor can dbus_unregister be called before
destruction.

This is fine as long as no sub-class has implemented dbus_unregister.
If they have, their method method will be called after destruction, and
they should be prepared to deal with the consequences.

As long as there is no public API for unregistering, let's demote the
assertion to a WARNING. Bravehearts who don't use g_application_run
can continue to implement dbus_unregister, but they would have been
adequately notified.

This reverts commit c1ae1170fa.

https://bugzilla.gnome.org/show_bug.cgi?id=725950
2017-07-24 19:52:48 +02:00
Debarshi Ray
df06dc6550 GApplication: Don't call dbus_unregister multiple times
https://bugzilla.gnome.org/show_bug.cgi?id=725950
2017-07-24 19:52:48 +02:00
Debarshi Ray
c1ae1170fa GApplication: Assert that dbus_unregister was called before destruction
Invoking the dbus_unregister virtual method during destruction is
problematic. It would happen after a sub-class has dropped its
references to its instance objects, and it is surprising to be asked to
unexport exported D-Bus objects after that.

This problem was masked as a side-effect of commit 21b1c390a3.
Let's ensure that it doesn't regress by asserting that dbus_unregister
has happened before destruction.

Based on a patch by Giovanni Campagna.

https://bugzilla.gnome.org/show_bug.cgi?id=725950
2017-07-20 15:31:41 +02:00
Adrian Perez de Castro
f8a88a768d Map G_NOTIFICATION_PRIORITY_HIGH to NOTIFY_URGENCY_NORMAL
When using the Freedesktop backend for GNotification, it seems like a
better idea to map G_NOTIFICATION_PRIORITY_HIGH to NOTIFY_URGENCY_NORMAL
(instead of NOTIFY_URGENCY_CRITICAL) provided that the difference
between GNotification's NORMAL and HIGH priorities is minor.

Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>

https://bugzilla.gnome.org/show_bug.cgi?id=784815
2017-07-18 17:31:29 -04:00
Matthias Clasen
9424facde2 2.53.4 2017-07-17 16:20:52 -04:00
Emmanuele Bassi
683809d5f7 Use env for gdbus-codegen's script
This allows us to build with Python 3 without using an absolute path.
2017-07-14 22:05:01 +01:00
Thibault Saunier
be8820128f meson: fix remaining wrong #include's for gdbus_codegen files
This is a follow up on 266bc1e510
to fix building tests and examples when using GLib as a meson
subproject.
2017-07-13 22:22:16 -04:00
Matthias Clasen
653be67d7d Add gopenuriportal.c to the meson build
This was added recently.
2017-07-13 19:34:21 -04:00
Alessandro Decina
4db695bfb7 meson: replace meson.current_source_dir() with files()
As the meson reference doc says, files() is preferred over building
paths with current_source_dir().
2017-07-13 19:03:39 -04:00
Alessandro Decina
266bc1e510 meson: fix wrong #include's for gdbus_codegen files
When building glib as a subproject, #include's for xdp-dbus.h from xdp-dbus.c
and for gdbus-daemon-generated.h from gdbus-daemon-generated.c were generated as
being prefixed with the subproject prefix, eg
 #include "subproject/glib/gio/gdbus-daemon-generated.h".
That failed since the root of the build directory is obviously not part of the
include path when building a subproject.

Passing --output-directory @OUTDIR@ to gdbus-codegen and removing @OUTDIR@ from
--generate-c-code fixes the issue.
2017-07-13 19:03:39 -04:00
Thibault Saunier
eb2196e89d meson: Fix building as a subproject
meson.source_root() returns the toplevel source directory
of the toplevel project, thus the paths were wrong when using
it. Simply using files() gets us the right path

https://bugzilla.gnome.org/show_bug.cgi?id=784133
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
10ae386727 meson: gio tests need to link against gobject as well
With meson from git dependencies of dependencies are no
longer added automatically and recursively to the linker
lines. Meaning dependencies that are used have to be
passed directly and explicitly or we'll get linker errors.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
42705b57f7 meson add missing gio/tests subdirectory/file 2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
03eac5fac5 meson: rebase on top of master ~2.53.1
From 2.51.2
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
6af4f1752a meson: gio/tests: remove some leftover rubbish 2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
613e00826e meson: gio/tests: add more gio tests
Need to fix up some of the tests a little, because the
test binary will not necessarily be run from the current
build sub-directory, and the build directory structure
might not always be a mirror of the source directory
structure, so pass location of glib-mkenums and
glib-compile-scheme and such directly.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
1acd6de763 meson: Use glib-mkenums directly instead of via build_mkenum.py
This is no longer needed because we use templates and custom targets
can capture output just fine on all platforms.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
dd8ff54736 meson: Use Python port of glib-mkenums
This reduces the build-time dependencies of glib to only Python 3,
Meson, and git. Git is also optional if you provide a tarball in
which the subproject directories already exist.

The Python port was done by Jussi Pakkanen on bugzilla:
https://bugzilla.gnome.org/show_bug.cgi?id=779332

This version contains some fixes from that and also changes all
instances of `@` to `\u0040` because Meson does not yet provide a
configure_file() mode that ignores unknown @MACRO@ values.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
ee94ad776e meson: Use proxy-libintl if gettext is not found
This is a stub-only library that can be used while building against
MSVC and contains no i18n machinery at all.

The dependencies added indirectly use the libintl.h header, and when
built as a subproject, the header won't be in a path known the
pre-processor.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
192cd652d4 tests: gio/tests: add gdbus tests 2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
4e0ef7655d meson: gio/tests: add more gresource tests 2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
2f29ee1735 meson: add -fvisibility=hidden explicitly to selected targets
Don't use it project-wide for building everything. Otherwise
symbols for shared modules won't be exposed, e.g. in the
resourceplugin used by the gio resource unit test.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
34e4e25d53 meson: gio/tests: add more missing tests 2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
f438c04fac gio: tests: rename generated giotypefunc.c to giotypefuncs.inc
This is needed for the Meson port, a file name .c that's included
and shouldn't be compiled into an object is difficult to manage
otherwise.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
33fb1bbb61 meson: gio, gobject: use files() for headers list
Since these variables are referenced from other directories
such as the tests/ subdir as well.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
d29f022b0b meson: add support for dtrace/systemtap
Still at least one FIXME. And untested so far. It builds.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
9fdcb2bf37 meson: Add a comment about the gdbus-peer gio test
So that it's not forgotten later.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
3c62619930 tests: autoptr test can be run on gcc, clang, intel
The only place where it won't work, is MSVC and maybe Sun Studio, but
we'd need someone to test Sun Studio first.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
122f4c051d meson: Add tls-interaction test, and fix giomodule test
giomodule test needed symbol visibility pragmas added. This is needed on
Windows anyway, so it's better to do it this way rather than disabling
-fvisibility=hidden for the test modules.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
e2da3cb599 meson: Port to latest master (2.51.0)
Also remove headers from some gio sources. Headers do not need to be
added to the list of sources.

+ various smaller self-explanatory fixes.
2017-07-13 19:03:39 -04:00
Patrick Griffis
d10be6102f meson: Minor modernizations 2017-07-13 19:03:39 -04:00
Patrick Griffis
a690e2a375 meson: More build fixes
- Fix installing various data files
- Build translations
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
fe2a9887a8 meson: Improve MSVC and MinGW support and fix dependencies everywhere
Disable gio tests on Windows, fix .gitignore to not ignore
config.h.meson, and add more things to it.

Rename the library file naming and versioning to match what Autotools
outputs, e.g., libglib-2.0.so.0.5000.2 on Linux, libglib-2.0-0.dll  and
glib-2.0-0.dll on Windows with MSVC.

Several more tiny fixes, more executables built and installed, install
pkg-config and m4 files, fix building of gobject tests.

Changes to gdbus-codegen to support out-of-tree builds without
environment variables set (which you can't in Meson). We now add the
build directory to the Python module search path.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
213957970e meson: Fix glib, add gobject, gio, gthread, gmodule, etc
Several small fixes to the build files.

Lots of tests have also been added, and glib tests pass now.
2017-07-13 19:03:39 -04:00
Daniel Boles
5eededccda gsettingsschema: Fix a compiler warning
g_build_filename() returns a gchar*, but it was stored in a const gchar*
and then g_free()d, which is wrong and led to a warning about the const
qualifier being cast away.
2017-07-12 19:23:40 +01:00
Philip Withnall
a131134918 build: Drop nmake/MSC build system for GLib
It hasn’t been seriously maintained for the best part of 10 years and is
very outdated. The recommended way to build GLib on Windows is now
Visual Studio:

https://wiki.gnome.org/Projects/GTK%2B/Win32/MSVCCompilationOfGTKStack#GLib

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

https://bugzilla.gnome.org/show_bug.cgi?id=722047
2017-07-10 11:22:40 +01:00
Matthias Clasen
28cc6aeb19 gsettings: Try harder to describe keys
If a key has no description, show the summary,
rather than "(null)". Since thats not helpful at all.
2017-07-07 19:11:51 -04:00
Matthias Clasen
85e4a25912 Avoid a race with the openuri portal
Same as the previous commit; use the new predictable request
object path to connect to the Response signal early.
2017-07-07 11:54:54 -04:00
Bastien Nocera
a95e2a4c64 docs: Fix cut'n'paste error in g_resources_get_info() doc
https://bugzilla.gnome.org/show_bug.cgi?id=784581
2017-07-05 23:50:04 +02:00
Philip Withnall
5a8b02cae6 gdbusutils: Add an example to g_dbus_gvariant_to_gvalue() docs
Clarify that GVariants of type v are not magically unboxed.

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

https://bugzilla.gnome.org/show_bug.cgi?id=784433
2017-07-04 10:45:50 +01:00
Matthias Clasen
f39024038f Disambiguate source names
This makes debugging more pleasant.
2017-06-28 19:50:57 -04:00
Emanuele Aina
79e4d4c6be gio: Mention the ALL_METADATA flag in g_file_copy()
The g_file_copy() documentation didn't mention if
G_FILE_COPY_ALL_METADATA was applicable or not, and users were led to
call g_file_copy_attributes() to specify it after the g_file_copy()
call, unless they checked the source (been there, done that).

https://bugzilla.gnome.org/show_bug.cgi?id=784037
2017-06-21 15:54:11 +02:00
Philip Withnall
18f8b77c04 gio: Use g_strerror() instead of strerror()
This marginally improves thread safety, and marginally improves
consistency.

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

https://bugzilla.gnome.org/show_bug.cgi?id=733821
2017-06-21 11:20:29 +01:00
Colin Walters
017f78d77f gtype: Add private DEFINE_TYPE with prelude to workaround gtype deadlocks
And use it in GSocket, as it had a real-world case reported.

https://bugzilla.gnome.org/show_bug.cgi?id=674885
2017-06-14 14:45:45 -04:00
Ting-Wei Lan
45d4b59e3f glocalfileoutputstream: Fix symlink writing on FreeBSD and NetBSD
FreeBSD, DragonflyBSD and NetBSD support O_NOFOLLOW, but they use error
numbers that are different from what POSIX standard specifies. They are
not going to change the behavior, and existing programs on these systems
already take advantage of this difference. To support them, we have to
add a check in GIO to use different error numbers on these systems.

https://bugzilla.gnome.org/show_bug.cgi?id=775593
2017-06-10 20:55:12 +08:00
Simon McVittie
34045e66a6 GGtkNotificationBackend: Use correct path for GetNameOwner call
For historical reasons, the reference dbus-daemon responds to most
method calls on all object paths. However, the canonical path
of the object implementing the o.fd.DBus interface is
/org/freedesktop/DBus, and in some environments (notably AppArmor
with the <abstractions/dbus-session-strict> abstraction) only this
path is allowed.

https://bugs.freedesktop.org/show_bug.cgi?id=101256 officially
deprecates all other object paths, and when adding new APIs we will
only make them available on the canonical object path.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Emmanuele Bassi <ebassi@gnome.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=783593
2017-06-09 16:45:09 +01:00
Ondrej Holy
6863080c32 gio-tool: Fix alignment of monitor messages
Name of GMount/GVolume/GDrive is aligned in many cases in output messages,
except few cases. Let's unify the alignment.

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-06-06 11:11:58 +02:00
Philip Withnall
085b3470f0 gdbusintrospection: Remove incorrect (out) annotations
The caller passes in a GString instance which is then modified by the
function, rather than the function building its own GString and passing
it out to the caller.

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

https://bugzilla.gnome.org/show_bug.cgi?id=783392
2017-06-05 16:07:52 +01:00
Philip Withnall
f98d998267 gdatainputstream: Annotate (out) length arguments as (optional)
All of them are.

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

https://bugzilla.gnome.org/show_bug.cgi?id=783350
2017-06-05 16:04:18 +01:00
Sébastien Wilmet
eea0681574 LGPLv2+ -> LGPLv2.1+: update remaining files
For the files in gio/ (but not in gio/ sub-directories), only the *.[ch]
files were handled in commit 3bf4a720c3.

For the modified files in glib/tests/markups/, I've tested that
`make check` still succeeds.

After this commit,
$ git grep -in "GNU Library"
and
$ git grep -in "Library General"
return only results in COPYING files and in glib/libcharset/. The latter
was not updated because it's a copy.

$ git grep -in "version 2" | grep -iv "version 2\.1"
now doesn't return any LGPL license header.
- glib-gettextize.in: GPL
- glib/gen-unicode-tables.pl: GPL
- glib/gnulib/: a copy
- glib/libcharset/: a copy
- m4macros/attributes.m4: GPL
- po/po2tbl.sed.in: GPL
- tap-driver.sh: GPL
- tests/*.pl: GPL

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-06-03 10:30:17 +02:00
Matthias Clasen
34b21312f1 appinfo: Fix the build on windows
The previous commit forgot to protect some unix-only
calls by an ifdef.

Pointed out by John Emmas.
2017-06-02 22:04:46 -04:00
Patrick Griffis
7c5cd293d0 Fix g_file_copy_async() annotation
https://bugzilla.gnome.org/show_bug.cgi?id=776333
2017-06-02 13:44:16 -04:00
John Lindgren
d1d60fc846 NtNotifyChangeMultipleKeys is a __stdcall function.
https://bugzilla.gnome.org/show_bug.cgi?id=781301
2017-06-01 11:00:28 +00:00
Philip Withnall
4dd1b17c24 gdbus: Fix race in name watching on connection teardown
If g_dbus_unwatch_name() is called from one thread at the same time as
the GDBusConnection is emitting ::disconnected in another thread, there
will be a race and the handler for ::disconnected may end up using
memory after it’s freed.

Fix this by serialising through the map_id_to_client, so that
on_connection_disconnected() atomically gets a strong reference to the
Client, or NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=777307
2017-06-01 11:39:40 +01:00
Matthias Clasen
97068f363e OpenFile support: Handle open failing
This can happen, report it as an error when it does.
2017-05-31 12:10:58 -04:00
Philip Withnall
e1e73dafa6 gsubprocess: Copy parent process’ environ when clearing subprocess’
Previously, this was done at the time of spawning the subprocess, which
meant the g_subprocess_launcher_*_environ() functions could not be used
to modify the parent process’ environment.

Change the code to copy the parent process’ environment when
g_subprocess_launcher_set_environ(NULL) is called. Document the change
and add a unit test.

https://bugzilla.gnome.org/show_bug.cgi?id=778422
2017-05-31 12:07:31 +01:00
Philip Withnall
c7d325733c docs: Mention GtkApplication in the GResource documentation
Since GtkApplication auto-loads some well-known resource paths. Add a
cross-reference to its documentation. (The cross-reference won’t be
linked if the GTK+ documentation isn’t available at build time, but this
is probably good enough. It is likely to be available.)

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

https://bugzilla.gnome.org/show_bug.cgi?id=782336
2017-05-31 11:09:51 +01:00
Philip Withnall
678899e87a docs: Mention the alias GResource attribute in the documentation
It was the only part of the XML format which was not documented.

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

https://bugzilla.gnome.org/show_bug.cgi?id=782336
2017-05-31 11:08:05 +01:00
Philip Withnall
29b4e9b05f docs: Improve formatting and fix typos in GResource documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-05-31 10:55:45 +01:00
Matthias Clasen
4c8ab22b95 Use OpenFile for local files
The OpenURI portal has a separate method to handle local
files now. Use it.

At the same time, split out the openuri helpers into separate
files, and generate code for the OpenURI portal.

https://bugzilla.gnome.org/show_bug.cgi?id=783193
2017-05-30 14:23:10 -04:00
Florian Müllner
99d34f65d3 gdbus-codegen: Apply --output-directory to generated docs as well
In addition to code, gdbus-codegen can also generate docbook
documentation for DBus interfaces. There's no good reason why
the newly added --output-directory option shouldn't apply to
those generated files as well.

https://bugzilla.gnome.org/show_bug.cgi?id=783201
2017-05-30 00:08:38 +02:00
Matthias Clasen
d3b4f7c9f6 Make dbus activation sandbox-aware
When we call org.freedesktop.Application.Open to activate
an application and pass file uris, the application may not
be able to see the files due to a flatpak sandbox.

Flatpak puts the flatpak app-id in the  X-Flatpak key in
desktop files that it exports, so we can easily recognize
applications that may be affected by this.

In this case, call the document portal to export the files
and pass the resulting uri's instead of the original ones.

https://bugzilla.gnome.org/show_bug.cgi?id=783130
2017-05-29 17:57:39 -04:00
Matthias Clasen
60a1cc9fac Add a wrapper for the AddFull document portal api
This is a wrapper which takes a list of uris and rewrites
them by calling AddFull with the file:// uris.

https://bugzilla.gnome.org/show_bug.cgi?id=783130
2017-05-29 17:57:39 -04:00
Matthias Clasen
a76fc7fa76 Update flatpak document portal interface
This api has been changed upstream, recently.

A new AddFull method has been added in this commit:
6ce8521b64

https://bugzilla.gnome.org/show_bug.cgi?id=783130
2017-05-29 17:57:39 -04:00
Sébastien Wilmet
3bf4a720c3 gio/: LGPLv2+ -> LGPLv2.1+
Sub-directories inside gio/ already processed in a previous commit:
- fam/
- gdbus-2.0/ (which contains only codegen/)
- gvdb/
- inotify/
- tests/
- win32/
- xdgmime/

Other sub-directories inside gio/:
- completion/: no license headers
- kqueue/: not LGPL, BSD-style license

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Sébastien Wilmet
90afd3b775 gio/xdgmime/: LGPLv2+ -> LGPLv2.1+
https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Sébastien Wilmet
408381b8ae gio/win32/: LGPLv2+ -> LGPLv2.1+
https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Sébastien Wilmet
d9a44b66af gio/tests/: LGPLv2+ -> LGPLv2.1+
A lot of tests in gio/tests/ don't have a license header.

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Sébastien Wilmet
6000f25e4f gio/inotify/: LGPLv2+ -> LGPLv2.1+
https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Sébastien Wilmet
ae4bac0ada gio/gvdb/: LGPLv2+ -> LGPLv2.1+
https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Sébastien Wilmet
0fedc90fac gio/gdbus-2.0/codegen/: LGPLv2+ -> LGPLv2.1+
https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Sébastien Wilmet
57cd1b4239 gio/fam/: LGPLv2+ -> LGPLv2.1+
There is only one *.c file in gio/fam/.

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Philip Withnall
fae61260c6 gtlspassword: Fix a typo in a translatable string
Singular/Plural mismatch.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-05-29 11:24:09 +01:00
Juan R. Garcia Blanco
d865ffa4d5 gtlspassword: Comment for translators added
With tweaks by Philip Withnall <philip@tecnocode.co.uk>.

https://bugzilla.gnome.org/show_bug.cgi?id=658446
2017-05-29 11:22:28 +01:00
Chun-wei Fan
7f41633efd gio/gdbusprivate.c: Include missed headers
This ensures the needed GTYPE_*'s can be found during the build
2017-05-27 00:23:54 +08:00
Matthias Clasen
b5e8e4eea9 GApplication: Remove some unused members
All the menu handling is in GtkApplication, these fields
are entirely unused, and can go away.

https://bugzilla.gnome.org/show_bug.cgi?id=783061
2017-05-25 14:50:34 -04:00
Colin Walters
a0ed9bc8d6 gdbus: Init more types to work around gtype thread issue
See https://bugzilla.gnome.org/show_bug.cgi?id=674885#c85

In this pass I also went through and added more types from GDBusConnection.
2017-05-22 09:20:45 -04:00
Ryan Hendrickson
151d3b01e6 gsettings: check $XDG_DATA_HOME for schemas
Add $XDG_DATA_HOME/glib-2.0/schemas as a schema source, after (higher
priority than) $XDG_DATA_DIRS/glib-2.0/schemas but before
$GSETTINGS_SCHEMA_DIR. This is per the XDG Base Directory Specification,
which states that user specific versions of data in $XDG_DATA_DIRS can
be created in $XDG_DATA_HOME.

https://bugzilla.gnome.org/show_bug.cgi?id=741335
2017-05-22 09:18:25 +01:00
Philip Withnall
3de1fac392 docs: Fix a trivial typo in GMount documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-05-17 13:40:06 +01:00
Philip Withnall
7f8ae236a7 docs: Fix a trivial typo in GMount documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-05-17 13:37:02 +01:00
Mohammed Sadiq
274f336f6a docs: Trivial typo fixes
The presence of space was resulting in wrongly rendered documentation
in devhelp (and probably in other documentations).

https://bugzilla.gnome.org/show_bug.cgi?id=782068
2017-05-16 11:22:54 +01:00
Alexandru Pandelea
eb7b796bd2 xdgmime: fix special case for mime_type_subclass
Currently, all mime types are considered subclasses of
application/octet-stream, but according to the freedesktop
standard, everything but the inode/* types is a subclass of
application/octet-stream.

Update the special case for application/octet-stream so that all
types but inode/* will match with it and add unit test for it.

https://bugzilla.gnome.org/show_bug.cgi?id=782311
2017-05-16 11:16:41 +01:00
Lars Uebernickel
0751ccd315 gdbus: fix use-after-free
g_dbus_connection_call_internal() accesses the user data it passes to
g_dbus_connection_send_message_with_reply() after the call. That data
might be freed already in the case that the callback is called
immediately.

Fix this by removing the 'serial' field from the user data altogether
and fetch the serial from the message in the callback.

https://bugzilla.gnome.org/show_bug.cgi?id=748263
2017-05-12 14:43:22 -04:00
Krzesimir Nowak
b89fed057c docs: Fix typos
Something I spotted by accident with git log.
2017-05-10 12:44:59 +02:00
Ondrej Holy
83c1b881fb gunixmounts: Prevent unwanted automount requests
mnt_table_is_fs_mounted causes unwanted automount requests due to
canonicalization of source and target. It might be replaced by
mnt_table_find_source as per the documentation in order to prevent
the automounts, but it is redundant. All mtab entries should be already
mounted and thus mnt_table_is_fs_mounted result is always true (it
basically checks that the fs from mtab is in mtab). Let's remove
the check at all.

https://bugzilla.gnome.org/show_bug.cgi?id=781867
2017-05-09 14:28:48 +02:00
Ondrej Holy
53ed1804e2 gunixmounts: Speed up mtab processing with libmount
libmnt_context is useless. It contains cache which is useful for searching,
but it isn't used in our case. Let's use mnt_context_parse_mtab instead
directly and the mtab processing will be faster.

https://bugzilla.gnome.org/show_bug.cgi?id=781867
2017-05-09 14:28:48 +02:00
Rico Tzschichholz
17395d79eb Revert "ginputstream: Add missing (out) annotations to read() functions"
This reverts commit 8446ee8c20.
2017-05-04 16:27:39 +02:00
Matthias Clasen
6ddfd516e6 Small documentation additions
The GNetworkMonitor docs were talking about one implementation,
omitting the others. While fixing that, add a bit about implementations
to the GProxyResolver docs too.
2017-05-02 07:23:32 -04:00
Matthias Clasen
f340354861 portal support: Raise the priority for network monitor
When we are inside a sandbox, we want to use the portal
implementation, since it is the only one that has a chance
of working.

This is safe to do, since the portal implementation will
just fail initialization when loaded outside a sandbox.
2017-05-02 06:48:35 -04:00
Philip Withnall
f5993c0e5d gportalsupport: Fix compilation failure from previous commit
Igor says: Thith code did not path the compilation check.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-05-01 19:34:51 +01:00
Matthias Clasen
82e31de04d portal support: Read /.flatpak-info
The flatpak-info file was moved to a different location a while
ago, we should read it from there instead of relying on the
compat symlink. One advantage is that this is a fixed, short
path, we don't have to construct one dynamically.

https://bugzilla.gnome.org/show_bug.cgi?id=781826
2017-05-01 14:15:44 -04:00
Philip Withnall
84134c64ed docs: Remove some extraneous words from g_settings_sync() documentation
Looks like the author started typing one thing, then changed their mind
about how to phrase the sentence, and typed something else.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2017-04-30 22:04:17 +01:00
Timm Bäder
3e2187975d gappinfo: Clear previously set error before calling portal
Otherwise, we might end up returning TRUE from
g_app_info_launch_default_for_uri but with a set error parameter. This
will lead to confusing results depending on how the caller checks for
errors. Checking error != NULL indicats the call failed but checking the
return value indicates that it succeeded.
2017-04-29 15:15:49 +02:00
Patrick Griffis
cbcf10411c tests: Fix g_content_type_is_mime_type() test on OSX
It should be passed a mime type not a content type.

https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-04-29 03:47:54 -04:00
declan
aefffa3fbc gdbusmessage: Don’t use major()/minor() if they’re unavailable
https://bugzilla.gnome.org/show_bug.cgi?id=777030
2017-04-28 15:26:28 +01:00
Philip Withnall
b63469d726 docs: Fix (nullable) (optional) annotations
There are a few places where commit 18a33f72 replaced valid (nullable)
(optional) annotations with just (optional). That has a different
meaning.

(nullable) (optional) can only be applied to gpointer* parameters, and
means that both the gpointer* and returned gpointer can be NULL. i.e.
The caller can pass in NULL to ignore the return value; and the returned
value can be NULL.

(optional) can be applied to anything* parameters, and means that the
anything* can be NULL. i.e. The caller can pass in NULL to ignore the
return value. The return value cannot be NULL.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-04-28 12:32:12 +01:00
Philip Withnall
88ad0dab21 gdbusconnection: Add some comments about object ownership
Some annotations I made while trying to debug bug #781847. They
introduce no behavioural changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-04-28 12:06:25 +01:00
Daniel Macks
ea586b47a3 Implement g_content_type_is_mime_type() (clone of win32's)
Add missing function, copying from gcontenttype-win32.c per Patrick
Griffis (Comment #55 of bug report)

https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-04-28 06:30:11 -04:00
Daniel Macks
ecc27a0cba Add test-case for g_content_type_is_mime_type()
Verify presence of new interface.

https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-04-28 06:30:11 -04:00
Rafal Luzynski
643c722f1e gosxappinfo: fix typo in g_osx_app_info_launch_internal
Correct error domain is G_IO_ERROR.

https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-04-28 06:30:11 -04:00
Patrick Griffis
0c4dd4a802 gosxappinfo: Special case x-scheme-handler
This is the only way they are exposed on Unix so we need to handle it

https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-04-28 06:30:11 -04:00
Patrick Griffis
fac83e09d6 gosxappinfo: Fix get_default_for_type() on 10.10+
https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-04-28 06:30:11 -04:00
Patrick Griffis
d4bfee1e7a build: Don't build dbus-appinfo on OSX
https://bugzilla.gnome.org/show_bug.cgi?id=780309
2017-04-27 21:52:04 -04:00
Patrick Griffis
f3321da462 gosxappinfo: Fix typo in ifdef
https://bugzilla.gnome.org/show_bug.cgi?id=780300
2017-04-27 09:35:29 -04:00
Philip Withnall
c192595268 ginputstream: Add missing (transfer full) annotation to read_bytes() 2017-04-13 10:25:25 +01:00
Philip Withnall
8446ee8c20 ginputstream: Add missing (out) annotations to read() functions
https://bugzilla.gnome.org/show_bug.cgi?id=781234
2017-04-13 10:24:11 +01:00
Philip Withnall
8c4a6fdbf5 gio: Fix some typos of ‘asynchronous’ in documentation comments 2017-04-13 10:23:50 +01:00
Víctor Manuel Jáquez Leal
3d7534eae5 gio-tool: Fix errors format string
Compiling with clang 3.8.1-18 (debian, x86_64) I ran across this
error:

gio-tool.c:40:31: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
  message = g_strdup_vprintf (format, args);
                              ^~~~~~
gio-tool.c:55:31: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
  message = g_strdup_vprintf (format, args);
                              ^~~~~~
2 errors generated.

To fix the first one, related with the function print_error(), this
patch adds to the function prototype a compiler's attribute.

For the second one, since the usage of that function is to print
one string and the format is already provided, the patch simplifies
the function by no receiving variadic arguments.

https://bugzilla.gnome.org/show_bug.cgi?id=781125
2017-04-10 15:43:12 +02:00
Piotr Drąg
77d00030e5 gio-tool: Fix closing Unicode quotation mark
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=772221
2017-04-10 15:40:42 +02:00
Emmanuele Bassi
f952fdf3fc Drop trailing semi-colon from G_DEFINE_ macro
It's unnecessary, and only adds visual noise; we have been fairly
inconsistent in the past, but the semi-colon-less version clearly
dominates in the code base.

https://bugzilla.gnome.org/show_bug.cgi?id=669355
2017-04-10 10:38:31 +01:00
Ondrej Holy
fb7d2184a6 gio-tool: Do not leak GOptionContext
GOptionContext is freed only in case of success. Free the context
also in case of failure.

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00
Ondrej Holy
292f10d053 gio-tool: Add g_drive_is_removable() support
The g_drive_is_removable() support was added recently in gio/gvfs
(see Bug 765900 and Bug 765457). It was also added in gvfs-mount,
but we forgot to add it also in gio-tool-mount.

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00
Ondrej Holy
094613425e gio-tool: Return error if there are not any volumes to mount
Print error and return error code if device doesn't contain any
volumes to mount.

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00
Ondrej Holy
bcb1bfda52 gio-tool: Do not print settable arguments unless they are any
"Settable arguments:" is printed even if they are not any arguments
to print. Do not print it similarly as it is done for "Writable
namespaces:".

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00
Ondrej Holy
bde2bde411 gio-tool: Various memory leak fixes
https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00
Ondrej Holy
0beeeb2ec9 gio-tool: Various fixes related to error messages
This patch contains the following changes:
- Print all errors with "gio: " prefix
- Print file uri in error for each tool allowing multiple locations
- Mark all error messages translatable
- Do not leak strings used in error messages
- Always start error messages with capital letter
- Unify some error messages across various tools
- Fix addional/missing new line characters

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00
Ole André Vadla Ravnås
005dfeacba gdbus: fix false positive g_warning() in remove_filter()
The GDBus thread might be holding a ref while requesting to remove the
filter.

https://bugzilla.gnome.org/show_bug.cgi?id=779409
2017-04-08 01:13:06 -04:00
Adrian Perez de Castro
85882094df Better documentation for g_app_info_equal()
Explicitly state that the function may not compare the contents of the
passed GAppInfo instances.

This fixes bug #777961.
2017-04-08 01:12:16 -04:00
Alexandros Frantzis
feae4e9f31 gdbus: Fix memory leak in gdbusmethodinvocation.c
https://bugzilla.gnome.org/show_bug.cgi?id=780924
2017-04-05 13:12:14 +01:00
Debarshi Ray
4efb8b4f7b docs: Clarify the use of the GError in g_tls_database_verify_chain*
Being able to determine that a certificate chain is invalid is not
considered an error, but success. This might not be obvious at first
due to the way the method is named and described currently. Since we
cannot change the name, let's improve the description and clarify this
aspect of its behaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=780310
2017-04-03 18:57:48 +02:00
Philip Withnall
ca0632ca5c gio: Handle NULL cached properties in NetworkManager monitor
g_dbus_proxy_get_cached_property() and
g_dbus_proxy_get_cached_property_names() can both return NULL if the
property cache is empty. Avoid a crash if this situation arises (which
it looks like it could, from reading the code) by gracefully bailing out
on NULL return values.

Coverity issues: #1257044, #1257045

https://bugzilla.gnome.org/show_bug.cgi?id=741229
2017-04-03 12:04:23 +01:00
Philip Withnall
1f396fd7d6 gsocket: Fix potential multiplication overflow calculating timeout
socket->priv->timeout is only a guint, and the multiplication is
performed before it’s widened to gint64 to be stored in start_time
(thanks, C). This means any timeout of 50 days or more would overflow.
Fixing this bug makes me feel a real sense of self-worth.

Coverity ID: 1159478

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-04-03 11:56:43 +01:00
Philip Withnall
0e0b5dff7c gdbus-tool: Improve --help output for gdbus wait
Include a parameter placeholder for the bus name, which is required.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-04-03 11:53:28 +01:00
Philip Withnall
fe2813b842 gdbus-tool: Drop a few lines of dead code
request_completion is checked several blocks higher in the function.
Spotted by Coverity.

Coverity ID: 1373215

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-04-03 11:43:18 +01:00
Philip Withnall
2f2c2b6362 gobject: Fix Since/Deprecated versions for GParameter replacement API
This slipped through the review cracks.

https://bugzilla.gnome.org/show_bug.cgi?id=709865
2017-03-31 11:09:53 +01:00
Philip Withnall
c11908ab7d gio: Fix deprecation warnings for g_object_newv() API 2017-03-31 11:00:23 +01:00
Fabian Orccon
3151da15d7 gio: Deprecate GParameter-related functions
https://bugzilla.gnome.org/show_bug.cgi?id=709865
2017-03-31 11:00:23 +01:00
Christoph Reiter
c20ab772b1 gosxappinfo: fix typo in url_escape_hostname
This duplicated everything after the hostname.

https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-03-30 10:09:19 -04:00
Patrick Griffis
392bd59eb8 gosxappinfo: Fix launching default applications
https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-03-30 10:09:19 -04:00
Philip Withnall
deab643651 ginitable: Relax idempotency requirements on init() and init_async()
The previously documented requirements for implementing init() and
init_async() as completely idempotent were really quite hard to achieve,
and brought a lot of pain for very little gain. Many implementations of
GInitable and GAsyncInitable did not actually follow the requirements,
or did not correctly handle concurrent init_async() calls.

Relax those requirements so that classes can decide whether their init()
or init_async() implementations need to be idempotent.

https://bugzilla.gnome.org/show_bug.cgi?id=766660
2017-03-30 10:24:09 +01:00
Christoph Reiter
625936343d Make GUnixMountEntry and GUnixMountPoint boxed types
And unskip some functions using them.

https://bugzilla.gnome.org/show_bug.cgi?id=668962
2017-03-28 18:03:08 +02:00
Philip Withnall
7890573f6e gdbus-tool: Add a command to wait for a well-known name on the bus
This is effectively the mc-wait-for-name tool from
telepathy-mission-control; moving it in to gdbus-tool will make it more
widely useful without making people depend on telepathy-mission-control
for no other reason. The code here is reimplemented from scratch to use
GDBus.

It blocks until the specified well-known name is owned by some process
on the bus (which can be the session, system, or any other bus). By
passing --activate, the same (or a different) name can be auto-started
on the bus first.

A timeout can be specified to ensure the process doesn’t block forever.

https://bugzilla.gnome.org/show_bug.cgi?id=745971
2017-03-28 11:23:27 +01:00
Colin Walters
ff7f32f643 gdbusprivate: Include a few headers to fix win32 build
Followup to previous commit.

See: https://bugzilla.gnome.org/show_bug.cgi?id=674885
2017-03-27 14:46:06 -04:00
Colin Walters
5b4b827e99 gdbus: Initialize types earlier to break proxy <-> connection deadlock
This will help us break generic GType deadlocks between people using
GDBus in different threads (which is supported), not just by GType
usage in the GDBus thread.

This should fix the common cases we're seeing in the wild, although I
have some lingering concerns that if someone e.g. referenced
e.g. `G_TYPE_DBUS_AUTH_MECHANISM_SHA1` etc. we'd need to add those
too.

https://bugzilla.gnome.org/show_bug.cgi?id=674885
2017-03-27 09:42:47 -04:00
INSUN PYO
07465176da gdbus: Initialize types at async entrypoints
This isn't a comprehensive fix, but should cover a lot of cases
for GDBus.

https://bugzilla.gnome.org/show_bug.cgi?id=674885
2017-03-27 09:42:47 -04:00
Patrick Griffis
206c54c80b gosxcontenttype: Fix various tests
https://bugzilla.gnome.org/show_bug.cgi?id=780384
2017-03-26 04:56:20 -04:00
Patrick Griffis
03c88daa73 build: Skip gdesktopappinfo tests on OSX
https://bugzilla.gnome.org/show_bug.cgi?id=780384
2017-03-26 04:51:15 -04:00
Florian Müllner
05f0d8199b appinfo: Only use portal as fallback
We currently assume that the OpenURI portal should be used
unconditionally when running inside a flatpak sandbox. While
the portal is what we usually want, there are exceptions:
Yelp is now included in the GNOME runtime to allow displaying
help without exporting the user documentation, and the sandboxed
app itself may register a scheme handler.
To account for those cases transparently, always try the normal
code path first and only fall back to calling the portal when
that fails.

https://bugzilla.gnome.org/show_bug.cgi?id=780471
2017-03-25 22:43:58 +01:00
Marc-André Lureau
73c5e927d5 gio-querymodules: fix memory leak
Spotted thanks to ASAN.

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

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2017-03-24 12:50:30 +04:00
Philip Withnall
4091b2d19e gio: Drop redundant g_source_is_destroyed() calls
These calls cause race warnings from tsan, but are not a thread safety
problem, because we can only ever observe single bit changes: all
modifications to the GSource.flags field are done with a lock held; all
reads are of independent fields, so no intermediate state can ever be
observed. This assumes that a non-atomic read will consistently give us
an old value or a new value.

In any case, these g_source_is_destroyed() calls can happen from any
thread, and the state could be changed from another thread immediately
after the call returns; so the checks are pointless. In addition,
calling g_source_set_ready_time() or g_source_destroy() on a destroyed
source is not a problem.

https://bugzilla.gnome.org/show_bug.cgi?id=778049
2017-03-23 15:00:19 +00:00
Mario Sanchez Prada
92cb02392c appinfo: Don't hardcode strings for the OpenURI portal's D-Bus method
We added several #define in the previous commit, so use those instead.
2017-03-23 14:46:02 +00:00
Mario Sanchez Prada
b374cc2e23 appinfo: Launch the OpenURI portal using a synchronous D-Bus call
Calling the D-Bus method for the OpenURI portal "protects" the logic from
not ever having the remote method running in case the xdg-desktop-portal
process is not yet running and the caller quits quickly after the call.

This should not be a problem as the method returns immediately (regardless
of the user making a selection), but making it synchronous would prevent
situations where the OpenURI method would never be called because of D-Bus
dropping the message after the caller dies, without explicitly waiting for
a reply.

https://bugzilla.gnome.org/show_bug.cgi?id=780441
2017-03-23 11:28:22 +00:00
Mario Sanchez Prada
26e0b3dde4 appinfo: Don't leak the session bus in launch_default_with_portal_async
The session bus object needs to be unreferenced before early returning.
2017-03-23 11:03:34 +00:00
Colin Walters
dd914da1c8 gio/fam: Remove leftover debug print
This leftover debug print was introduced by d682df186e
and is obviously bad for applications that are expecting something
else on stdout, etc.

See: https://bugzilla.redhat.com/show_bug.cgi?id=1396386

https://bugzilla.gnome.org/show_bug.cgi?id=780144
2017-03-16 10:36:17 -04:00
Philip Withnall
2411b76c5e docs: Fix some DocBook usage in a few gtk-doc comments
<emphasis> and <ulink> tags. Replace them with Markdown.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-03-16 13:50:19 +00:00
Piotr Drąg
e9fe8868a7 Use single non-Unicode quotation marks in a new translatable message
Actually, Unicode changes to this file got reverted in
2d56c49b10. Also, there is
"No such interface '%s'" string already, so we avoid
breaking the string freeze.
2017-03-14 14:51:49 +01:00
Piotr Drąg
bb93f3a4aa Use consistent quotation marks in a new translatable message
Double quotation marks are used everywhere else in glib, as per
<https://developer.gnome.org/hig/stable/typography.html>.
2017-03-14 14:45:48 +01:00
Philip Withnall
e1f362ba49 gsubprocess: Add missing G_GNUC_NULL_TERMINATED attribute
g_subprocess_launcher_spawn() is NULL-terminated, and must have a
non-NULL argv0 specified, so G_GNUC_NULL_TERMINATED is appropriate here.

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

https://bugzilla.gnome.org/show_bug.cgi?id=780032
2017-03-14 12:57:32 +00:00
Philip Withnall
ff327ba2d7 gdbusmessage: Add missing G_GNUC_PRINTF attribute
This highlighted a bug in GDBusConnection, where an interface name was
not included in a message referring to it.

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

https://bugzilla.gnome.org/show_bug.cgi?id=780032
2017-03-14 12:57:32 +00:00
Chun-wei Fan
e013164c5c Visual Studio builds: Fix gio project generation
We need to include gcontenttype-win32.c in our Visual Studio projects...
2017-03-14 14:48:23 +08:00
Matthias Clasen
37f5feb1d2 Fix distcheck
Typo in the win32 source list...
2017-03-13 12:30:56 -04:00
TingPing
90dfea2b61 Implement GAppInfo on OSX
This is an implementation of most of GAppInfo using the OS X
NSBundle APIs.

Missing at this point are things that don't have equivalents
in OS X, such as hidden desktop files, last-used, manual type
associations, and g_app_info_get_all().

https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-03-13 10:33:23 -04:00
TingPing
3953d85a92 Implement GContentType on OSX
This is an implementation of most of GContentType using the OS X
UTType APIs.

Missing at this point is an implementation of
g_content_types_get_registered() and g_content_type_guess_for_tree().

https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-03-13 10:32:02 -04:00
Steven McDonald
e305fe971e gio: Always purge kqueue subs from missing list
Previously, _kh_cancel_sub assumed that it only needed to call
_km_remove if sub did not exist in subs_hash_table. This is erroneous
because the complementary operation, _km_add_missing, can be called
from process_kqueue_notifications, in which context sub can *only* have
come from subs_hash_table.

Since _km_remove is implemented using g_slist_remove, which is
documented to be a noop if the list does not contain the element to be
removed, it is safe to call _km_remove unconditionally here.

https://bugzilla.gnome.org/show_bug.cgi?id=778515
2017-03-09 17:38:55 +00:00
TingPing
fe1a749ca6 Create g_content_type_is_mime_type()
Convenience wrapper around g_content_type_is_a().

https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-03-08 23:02:10 -05:00
Matthias Clasen
a28429a3c6 Fix a typo 2017-03-08 22:36:05 -05:00
Matthias Clasen
04ad811e50 Add a forgotten g_type_ensure call
One of the types in this function was not wrapped in a
g_type_ensure_call, an obvious oversight.
2017-03-08 22:27:06 -05:00
John Ralls
d1a03bc728 Enable building gcocoanotification only if OS X min version >= 10.9
This changes the configure checks to check for what is actually
required to build this code.

https://bugzilla.gnome.org/show_bug.cgi?id=747146
2017-03-08 22:26:00 -05:00
Matthias Clasen
b56a95026c Add some more cases to the app-id unit tests
These came up on irc today.
2017-03-05 13:11:52 -05:00
Philip Withnall
d892cf6feb tests: Fix some memory leaks in the GSettings unit tests
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=779265
2017-02-28 16:11:06 +00:00
Philip Withnall
43fbb8652d tests: Fix a double-unref in the GSettings unit tests
g_settings_schema_source_get_default() is (transfer none), not (transfer
full).

Spotted by Marvin Schmidt.

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

https://bugzilla.gnome.org/show_bug.cgi?id=779265
2017-02-28 16:11:05 +00:00
Philip Withnall
6bfb4ce191 gsettings: Fix a leak in GSettingsAction
Every GSettingsAction was leaking its schema key (a few tens of bytes).

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

https://bugzilla.gnome.org/show_bug.cgi?id=779265
2017-02-28 16:11:05 +00:00
Philip Withnall
08b6794ec2 gsettings: Fix memory leak on error handling path for g_settings_set()
On the warning/critical error handling paths for g_settings_set(), the
GVariant value was not ref-sunk, and the schema key was leaked. This
won’t affect code in production (unless it’s seriously buggy), but
eliminates some leaks from the error testing paths in the GSettings
tests.

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

https://bugzilla.gnome.org/show_bug.cgi?id=779265
2017-02-28 16:11:05 +00:00
Philip Withnall
d6d29a2e9f glib-compile-schemas: Fix various memory leaks
Spotted while running `make check` under Valgrind. While it’s not
necessary to fix memory leaks in glib-compile-schemas (since it’s a
utility which runs briefly then exits), fixing them makes more
legitimate leaks in the Valgrind output more obvious, and means we can
be sure there aren’t leaks in the underlying GLib/GIO code which
glib-compile-schemas is calling.

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

https://bugzilla.gnome.org/show_bug.cgi?id=779265
2017-02-28 16:11:05 +00:00
Jan Tojnar
1a845115a2 gio: Check for NUll when getting extensions
When unregistered extension point (i.e. NULL pointer) is passed
to `g_io_extension_point_get_extensions`, it causes a segfault.

This commit adds an assertion, to prevent this.

https://bugzilla.gnome.org/show_bug.cgi?id=779183
2017-02-27 14:43:44 +00:00
Patrick Griffis
ee09bb704f gdbus-codegen: Add --output-directory flag
This is useful with Meson where files are generated in subdirs

https://bugzilla.gnome.org/show_bug.cgi?id=778801
2017-02-27 06:37:44 -05:00
Ole André Vadla Ravnås
8693d60a28 gdbusauth: plug memory leak
Happens when the waiting-for-auth state is re-entered:

SERVER_STATE_WAITING_FOR_AUTH
  |
  v
G_DBUS_AUTH_MECHANISM_STATE_REJECTED
  |
  v
SERVER_STATE_WAITING_FOR_AUTH

Causing the previous `mech` pointer to get overwritten.

https://bugzilla.gnome.org/show_bug.cgi?id=778991
2017-02-21 10:31:03 +00:00
Timm Bäder
1920b550db fdo notification: Avoid a double free
We're first getting the notification by its notify_id, but activating
the action afterwards could redraw it, leading to a dangling pointer.
Fix this by simply searching the list of active notifications again
after activating the action.
2017-02-18 10:19:18 +01:00
Patrick Griffis
79c08255be gdbus-codegen: Fix -Wconversion warning
https://bugzilla.gnome.org/show_bug.cgi?id=778581
2017-02-14 14:06:38 -05:00
Matthew Leeds
442d64ba94 gsubprocesslauncher: Clarify the behavior of set_environ()
GNOME Builder's code was assuming that setting the launcher's
environ to NULL makes the subprocess have an empty environment, but in
fact the parent process's variables are still inherited because execv is
used instead of execve when envp is NULL. This commit clarifies the
documentation to make the behavior clear.

https://bugzilla.gnome.org/show_bug.cgi?id=778422
2017-02-13 09:44:10 -06:00
Ondrej Holy
006a7d082b fileinfo: Add G_FILE_ATTRIBUTE_RECENT_MODIFIED attribute
Add filesystem attribute to propagate time, when the metadata for the file
in "recent:///" was last changed. This attribute is needed for sorting
recent backend files in client applications.

https://bugzilla.gnome.org/show_bug.cgi?id=777507
2017-02-13 08:12:48 -05:00
Ondrej Holy
453957973b fileinfo: Use monospaced font for uris
Some uris are in quotes, some in backticks, let's unify it.

https://bugzilla.gnome.org/show_bug.cgi?id=777507
2017-02-13 10:26:52 +01:00
Philip Withnall
257aff6f60 docs: Fix a typo in a documentation string 2017-02-08 15:06:34 +00:00
Philip Withnall
78fba90f65 docs: Add links to D-Bus specification for D-Bus address format
In an attempt to clarify the format a little.
2017-02-08 15:06:23 +00:00
Philip Withnall
c131865f57 gdbus: Fix atomic accesses to global name watch ID
https://bugzilla.gnome.org/show_bug.cgi?id=777307
2017-02-05 14:59:44 +01:00
Fabrice Bellet
b1f14143e5 gdbus: make gdbusconnection ids thread-safe
To prevent a race where these global static counters can be
incremented by two threads concurrently.

https://bugzilla.gnome.org/show_bug.cgi?id=778096
2017-02-05 14:25:05 +01:00
Fabrice Bellet
c457ec053d gdbus: make sure to stay locked when sending message
This patch fixes a case where schedule_writing_unlocked() was called
without holding the write lock. The bug was introduced in commit
512e9b3b.

https://bugzilla.gnome.org/show_bug.cgi?id=778002
2017-02-05 14:20:06 +01:00
Piotr Drąg
79ce76021a Fix a translator comment
They need to be exactly one line above a string to show up in .po files.
2017-01-26 04:52:17 +01:00
Philip Withnall
95afbe1666 gfileinfo: Clarify units in documentation for file attributes
Clarify that the G_FILE_ATTRIBUTE_TIME_* attributes are all in seconds
(apart from the *_USEC ones, which are documented separately).
2017-01-24 12:52:24 +00:00
Philip Withnall
740007c11e gfileinfo: Fix an incorrect unit in the documentation
G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC is in microseconds, not
milliseconds.
2017-01-24 12:51:35 +00:00
Philip Withnall
a6e2213343 gdbus: Add example to docs for g_dbus_method_invocation_return_value()
Try to clarify that the variant passed to return_value() must be a
tuple.

https://bugzilla.gnome.org/show_bug.cgi?id=777592
2017-01-24 09:50:01 +00:00
Will Thompson
40cf271a77
goutputstream: docs: fix typos
"ouput" -> "output" (missing 't')
"asyncronous" -> "asynchronous" (missing 'h')

https://bugzilla.gnome.org/show_bug.cgi?id=777481
2017-01-19 08:33:58 +00:00
Bastien Nocera
3b5b5696ed gio: Bump copy buffer size to 256k by default
This is small enough that it shouldn't cause problems on most machines
we support, but big enough to increase throughput on a lot of devices
and network protocols.

Note that the actual value is 256k minus malloc overhead, so that it
fits nicely in a 256k block (as suggested by Alexander Larsson).

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

https://bugzilla.gnome.org/show_bug.cgi?id=773823
2017-01-11 18:25:21 +01:00
Bastien Nocera
0106a6cd9e gio: Use heap-allocated buffer
As if we were to increase the buffer size, it would be a bit too big to
fit on the stack.

https://bugzilla.gnome.org/show_bug.cgi?id=773823
2017-01-11 18:19:14 +01:00
Chun-wei Fan
6dfc6fee7b Visual Studio builds: Move project files to win32/
It was suggested that the project files be moved here as we don't actually
need to go two directory layers from $(srcroot), and would help us to
standardize on things in the future across the board.
2017-01-09 14:00:46 +08:00
Sébastien Wilmet
6231b1abc9 License headers: replace current FSF address by a link to gnu.org
Even if the address is correct, it's far more convenient to have a link
to a website.

https://bugzilla.gnome.org/show_bug.cgi?id=776586
2017-01-04 19:12:57 +01:00
Sébastien Wilmet
f60590534d License headers: "the Gnome Library" -> "this library"
Harmonize a little the license headers. In most of the license headers
in GLib, it is "this library".

It is also what is explained at:
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html#SEC4
"How to Apply These Terms to Your New Libraries"

https://bugzilla.gnome.org/show_bug.cgi?id=776586
2017-01-04 19:12:56 +01:00
Christian Hergert
83d6c38e0c subprocess: avoid infinite loop in verify_disposition()
When performing the verify and building the error string there were two
possibilities of an infinite loop. The first is the missing twos-complement
to unset the bit in the filtered flags. The second is the lack of handling
G_SUBPROCESS_FLAGS_NONE which can return a valid GFlagsValue (and cannot
unset the bit since the value is zero).

This walks all known values in the GSubprocessFlags type class and check
if they are set. This has the benefit that we don't call needless functions
which walk the same table as well as avoiding mutating values to build
the error string.

https://bugzilla.gnome.org/show_bug.cgi?id=775913
2017-01-03 15:49:05 -08:00
Bastien Nocera
2e26893bf8 resolver: Fix compilation
Problem introduced in commit 442b7ce.
2017-01-03 16:26:38 +01:00
Bastien Nocera
442b7ce899 resolver: Return error looking up invalid hostnames
Make g_resolver_lookup_by_name() and g_resolver_lookup_by_name_async()
error out when invalid hostnames are passed.

https://bugzilla.gnome.org/show_bug.cgi?id=772989
2017-01-03 14:35:52 +01:00
Bastien Nocera
5c566e435e httpproxy: Fix invalid request on invalid hostnames
When an invalid hostname is passed for connection, the
g_hostname_to_ascii() might fail when creating the request in
create_request(). Make sure that error is caught and reported rather
than passing "(null)" as the hostname of the site we want to connect to.

https://bugzilla.gnome.org/show_bug.cgi?id=772989
2017-01-03 14:35:52 +01:00
Ingo Brückl
731e7fea17 tests: Don't run tests requiring DBUS unconditionally
The tests defaultvalue, gdbus-peer and gdbus-unix-addresses will fail
without DBUS, so only run them in case we HAVE_DBUS_DAEMON.

Signed-off-by: Ingo Brückl <ib@wupperonline.de>

https://bugzilla.gnome.org/show_bug.cgi?id=767609
2016-12-27 20:13:46 +01:00
donadigo
ab70359bbf Fixed notify id in FDO notification backend
https://bugzilla.gnome.org/show_bug.cgi?id=775765
2016-12-07 12:39:25 -08:00
Ignacio Casal Quinteiro
4b98a79997 gioerror: make WSAESHUTDOWN an alias of G_IO_ERROR_CONNECTION_CLOSED
This fixes one of the assertions of the socket unit tests where
G_IO_ERROR_FAILED was returned instead of G_IO_ERROR_CONNECTION_CLOSED.
2016-12-07 08:47:00 +01:00
Sebastian Dröge
799f8dcd46 GSocket: Fix race conditions on Win32 if multiple threads are waiting on conditions for the same socket
WSAWaitForMultipleEvents() only returns for one of the waiting threads, and
that one might not even be the one waiting for the condition that changed. As
such, only let a single thread wait on the event and use a GCond for all other
threads.

With this it is possible to e.g. have an UDP socket that is written to from
one thread and read from in another thread on Win32 too. On POSIX systems this
was working before already.

https://bugzilla.gnome.org/show_bug.cgi?id=762283
2016-12-05 18:17:17 +02:00
Simon McVittie
663e12feca gdbus-serialization test: don't left-shift a negative number
-2LL<<34 is undefined, because left-shifting a negative number is
undefined (it was implementation-defined behaviour in C99, but
is formally undefined in C11). The undefined behaviour sanitizer
picks this up.

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=775510
Reviewed-by: Colin Walters
2016-12-02 19:10:41 +00:00
Simon McVittie
e5ed410c8c Avoid calling Standard C string/array functions with NULL arguments
glibc string.h declares memcpy() with attribute(nonnull(1,2)), causing
calls with NULL arguments to be treated as undefined behaviour.
This is consistent with ISO C99 and C11, which state that passing 0
to string functions as an array length does not remove the requirement
that the pointer to the array is a valid pointer.
gcc -fsanitize=undefined catches this while running OSTree's test suite.

Similarly, running the GLib test suite reports similar issues for
qsort(), memmove(), memcmp().

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=775510
Reviewed-by: Colin Walters
2016-12-02 19:10:39 +00:00
Ignacio Casal Quinteiro
463a863605 gdbusauth: fix crash when server data send returns NULL
_g_dbus_auth_mechanism_server_data_send may fail in which case
we would endup getting a NULL data. In this case we should not
try to encode the data and simply let the state machine to continue.
The auth mechanism will change internally to REJECTED so we just
need to continue the iteration.

https://bugzilla.gnome.org/show_bug.cgi?id=775309
2016-11-29 13:12:47 +01:00
Ignacio Casal Quinteiro
93179f10b8 dbusaddress: do not leak error on win32 code 2016-11-29 09:21:04 +01:00
Christian Hergert
18a33f72db introspection: use (nullable) or (optional) instead of (allow-none)
If we have an input parameter (or return value) we need to use (nullable).
However, if it is an (inout) or (out) parameter, (optional) is sufficient.

It looks like (nullable) could be used for everything according to the
Annotation documentation, but (optional) is more specific.
2016-11-22 14:14:37 -08:00
Christophe Fergeau
a4012abbdf gdbus: Fix leak in g_dbus_message_print()
This leak only happens when using G_DBUS_DEBUG=message or similar, but
it's nicer to be valgrind-clean even in these cases.

https://bugzilla.gnome.org/show_bug.cgi?id=736810
2016-11-22 15:01:31 -05:00
Lukasz Skalski
59a996db9b GDBusMessage: Fix segfault if DEBUG_SERIALIZER is enabled
https://bugzilla.gnome.org/show_bug.cgi?id=729730
2016-11-22 14:59:49 -05:00
Pavel Grunt
c99fe67817 gtask: Add guards for public functions
https://bugzilla.gnome.org/show_bug.cgi?id=769745
2016-11-22 13:23:25 -05:00
Ondrej Holy
b626a4677a gunixmounts: Fix crash if path doesn't exist
g_unix_mount_for segfaults for nonexistent paths. Return NULL if path
doesn't exist.

https://bugzilla.gnome.org/show_bug.cgi?id=772160
2016-11-22 13:21:36 -05:00
Debarshi Ray
00bf553a60 GDBusMethodInvocation: Clarify how the ownership is handled
https://bugzilla.gnome.org/show_bug.cgi?id=767952
2016-11-22 17:06:48 +01:00
Benjamin Otte
578b42a2f2 glib-compile-resources: Add suggested braces
... around empty body in an 'else' statement
2016-11-20 23:50:56 +01:00
Patrick Griffis
3a8ac6e221 glib-compile-resources: Escape file names in dependency file
https://bugzilla.gnome.org/show_bug.cgi?id=774368
2016-11-20 13:33:21 -05:00
Patrick Griffis
7a8cbc60a5 glib-compile-resources: Add --generate-phony-targets flag
This includes phony targets for each dependency in the the generated
dependency file which allows building with `ninja` which doesn't like
the phony targets[1] but also allows silencing `make` errors similar to
gcc's -MP option.

[1] - https://github.com/ninja-build/ninja/issues/1184

https://bugzilla.gnome.org/show_bug.cgi?id=774368
2016-11-20 13:33:21 -05:00
Petr Kulhavy
437474318f GSocket: do not process control messages if not requested by the user
If g_socket_receive_message_with_timeout() is called with messages ==
NULL set the msg_control buffer to empty to not request the control
messages from recvmsg() at all.

This completely disables the control message processing and reduces
overhead, which might be critical at high packet rate.

https://bugzilla.gnome.org/show_bug.cgi?id=774520
2016-11-20 11:09:45 -05:00
Philip Withnall
1f36189aa5 gapplication: Fix a typo in a documentation comment
It’s ‘D-Bus’, not ‘DBus’, ‘DBUS’, ‘D Bus’, ‘Dee Buss’ or ‘the bus’.
2016-11-08 21:13:45 +00:00
Patrick Griffis
d1763d899c Revert "glib-compile-resources: Output depfile in same directory as target"
This reverts commit 9006940de6.
2016-11-05 22:15:53 -04:00
Patrick Griffis
9006940de6 glib-compile-resources: Output depfile in same directory as target
https://bugzilla.gnome.org/show_bug.cgi?id=773437
2016-11-02 17:44:23 -04:00
Matthias Clasen
2d56c49b10 Partially revert 10c490cdfe
This commit broke some tests, and I don't have the time
to fix up all the expected output, so I'll revert the changes
to the affected files for now.

This needs to be redone with the necessary test fixes.
2016-10-24 10:21:59 -04:00
Timm Bäder
f14389bec9 gapplication: Properly free the option_strings
option_strings gets set in g_application_add_main_option, so it can
contain elements independent from packed_options.

https://bugzilla.gnome.org/show_bug.cgi?id=773303
2016-10-24 06:10:57 -04:00
Patrick Griffis
243c1b7e84 glib-compile-resources: Fix creating depfile with other targets
Follow up to 87d76a5a9c from bug 745754

https://bugzilla.gnome.org/show_bug.cgi?id=773344
2016-10-24 01:41:57 -04:00
Sebastian Dröge
2a970e33a4 gresolver: Make get_default() thread-safe
https://bugzilla.gnome.org/show_bug.cgi?id=773262
2016-10-20 17:49:44 +03:00
Damien Lespiau
c494c3028c gfile: G_FILE_MONITOR_WATCH_MOVES was actually introduced in 2.46
I'm guessing the developments were done in 2.44 but the patches landed
after the 2.45.0 bump without an update to the Since tags.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=769630
2016-10-12 19:18:05 -04:00
Piotr Drąg
10c490cdfe Use Unicode in translatable strings
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=772221
2016-10-12 21:30:42 +02:00
Ondrej Holy
da509fd67d gunixmounts: Add g_unix_mount_for() support
GLib has g_unix_mount_at (mount_path) already, let's add g_unix_mount_for
(file_path) for whatever path. GLib already contains some private code
for such task. Let's make this code public. This functionality is needed
by GVfs (see Bug 771431) in order to avoid copy-and-pasting.

https://bugzilla.gnome.org/show_bug.cgi?id=772160
2016-10-12 15:13:00 -04:00
Sam Thursfield
6338cde7ca glib-compile-schemas: Add a --version option
https://bugzilla.gnome.org/show_bug.cgi?id=772269
2016-10-06 21:08:25 +01:00
Sam Thursfield
bce8b6db8d glib-compile-resources: Add a --version option
There have been some improvements to the tool recently, but it's hard to
know if those are available on a given system unless the tool provides a
--version commandline option.

https://bugzilla.gnome.org/show_bug.cgi?id=772269
2016-10-06 21:08:25 +01:00
Florian Müllner
e048d31210 completion: Complete gsettings describe
Commit 8fd72838 added a 'describe' command to the gsettings tool,
but didn't implement completions for it.

https://bugzilla.gnome.org/show_bug.cgi?id=772297
2016-10-05 14:26:42 -04:00
Philip Withnall
10bac98185 gresolver: Mark GResolver as an abstract class
It only works through its virtual methods, so while it could be
instantiated before (and this is technically an API break), any instance
of it would previously have crashed as soon as any of its methods were
called anyway.

If anybody has any problems with this ABI break, please make them known
during the 2.51 unstable development cycle and it can be reverted.

https://bugzilla.gnome.org/show_bug.cgi?id=772255
2016-10-04 16:02:34 +01:00
Ondrej Holy
bd9e266e11 gunixmounts: Fix /proc/self/mountinfo monitoring
/proc/self/mountinfo is used to monitor changes of mounts with libmount.
However, GFileMonitor is used currently to monitor this file, which
doesn't work and consequently "changed" signal is never emitted. Special
monitoring needs to be used instead, same as it is used for /proc/mounts.

https://bugzilla.gnome.org/show_bug.cgi?id=662946
2016-09-29 10:21:34 +02:00
Matthias Clasen
34751ad17a Add a test for dictionaries in settings
This should clarify the questions in
https://bugzilla.gnome.org/show_bug.cgi?id=771968
2016-09-26 06:27:12 -04:00
Rico Tzschichholz
7bf31065cc gsubprocess: Fix annotation for set_environ() 2016-09-12 20:41:40 +02:00
Jeremy Whiting
8fd72838ce Added describe command to gsettings command-line tool.
describe command shows description of given gsettings key.
Added documentation of describe command to gsettings man page.
2016-08-25 12:40:27 -06:00
Philip Withnall
097f70828f gdbus-codegen: Strip @since parameters before comparison
People might put more extraneous whitespace in a @since line in a
documentation comment, which should not affect the ordering of
methods/signals/etc. in the generated output.

https://bugzilla.gnome.org/show_bug.cgi?id=770372
2016-08-25 10:27:22 +01:00
Matthias Clasen
87d76a5a9c glib-compile-resources: generate .d-file style dependency
Add --dependency-file=foo.d option to generate a gcc -M -MF style
dependency file for other build tools. The current output of
--generate-dependencies is only useful for use directly in Makefile
rules, but can't be used in other build systems like that.

The generated dependency file looks like this:
$ glib-compile-resources --sourcedir= test.gresource.xml --dependency-file=-
test.gresource.xml: test1.txt test2.txt test2.txt

test1.txt:

test2.txt:

test2.txt:

Unlike --generate-dependencies, the --dependency-file option can be
used together with other --generate options to create dependencies
as side-effect of generating sources.

Based on a patch by Tim-Philipp Müller in
https://bugzilla.gnome.org/show_bug.cgi?id=745754

The changes in this patch, compared to his are to always return
the hash table with file information from parse_resource_file, so
we can use it for dependency output, regardless if generate_dependencies
was TRUE or not.
2016-08-20 16:49:24 -04:00
Emmanuele Bassi
9afff5f05d Revert "glib-compile-resources: generate .d-file style dependency output for build tools"
This reverts commit e8c8395f0e.

Tim said that the patch isn't ready, yet, and the commit is breaking the
build in Continuous.
2016-08-20 17:16:31 +01:00
Tim-Philipp Müller
e8c8395f0e glib-compile-resources: generate .d-file style dependency output for build tools
Add --dependency-file=foo.d option to generate a gcc -M -MF style
dependency file for other build tools. The current output of
--generate-dependencies is only useful for use directly in Makefile
rules, but can't be used in other build systems like that.

The generated dependency file looks like this:
$ glib-compile-resources --sourcedir= test.gresource.xml --dependency-file=-
test.gresource.xml: test1.txt test2.txt test2.txt

test1.txt:

test2.txt:

test2.txt:

Unlike --generate-dependencies, the --dependency-file option can be
used together with other --generate options to create dependencies
as side-effect of generating sources.

Based on a patch by Tim-Philipp Müller.

https://bugzilla.gnome.org/show_bug.cgi?id=745754
2016-08-20 10:52:46 -04:00
Piotr Drąg
3f0ff576a7 Fix typos in translatable strings 2016-08-17 20:34:38 +02:00
Philip Withnall
15b315b472 gdbus-codegen: Allow '@since: UNRELEASED' in documentation comments
Previously, this would not work, as it would result in comparing the
order of a string and an integer. Make it work, and make 'UNRELEASED'
compare higher than other versions so it's always treated as the latest
version.

'UNRELEASED' is commonly used by maintainers to highlight new API while
it's being prototyped, until they know which version it will actually
be released in. At the time of release, they replace all 'UNRELEASED'
strings in git with the new version number.

An example of this usage is here:
d380ac6a2a (9208ee267cb05db1afd3a5c323d71e51db489447_7619_7656)

https://bugzilla.gnome.org/show_bug.cgi?id=769995
2016-08-16 22:36:53 +02:00
Simon McVittie
037719c27c gdbus-example-unix-fd-client: avoid strftime %c specifier
gcc 6 warns (fatally, by default) that %c only uses a 2-digit year
in some locales. The precise format does not seem to be important
for this sample code, so use ISO 8601 instead of suppressing the
warning with a pragma.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Colin Walters
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=768453
2016-08-15 14:04:43 +01:00
Philip Withnall
5cdf0efaab tests: Fix a typo on a dereferencing assignment
Otherwise the assignment is pointless. Spotted by cppcheck.
2016-08-13 10:24:23 +02:00
Philip Withnall
a42b6eab66 gresource-tool: Clarify precedence of operations
As suggested by cppcheck, which knows more than me.
2016-08-13 10:24:04 +02:00
Philip Withnall
a5044a8e78 build: Fix SystemTap build to disable semaphores as before
At some point, upstream SystemTap changed from using a
STAP_HAS_SEMAPHORES preprocessor variable for this, to using
_SDT_HAS_SEMAPHORES instead. We need to update our build system to
disable that as well.

The original discussion about use of semaphores is here:

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

This was breaking the build with -flto enabled, either because -flto
doesn’t work with semaphores.

https://bugzilla.gnome.org/show_bug.cgi?id=768198
2016-08-13 09:32:12 +02:00
Philip Withnall
0e3f968a2e gio: Fix use of Docbook in documentation comment
This is literally so last year.
2016-08-12 15:58:39 +02:00
Philip Withnall
04bbf9df37 gdatagrambased: Clarify that connection-oriented ≠ stream-based
GDatagramBased allows connection-oriented and connection-less sockets,
but does not allow stream-based sockets (because it’s datagram-based).
So it supports SCTP and UDP, but not TCP.

Clarify that in the documentation, and people sometimes confuse
connection-oriented with stream-based, due to the prevalence of TCP.
2016-08-03 18:46:29 +01:00
Mario Sanchez Prada
ed75b1623d gunixmounts: Ensure that libmount's context gets freed on early returns
Otherwise, it will be leaked in case the relevant table (mtab, fstab)
could not be retrieved for some reason.

https://bugzilla.gnome.org/show_bug.cgi?id=769238
2016-07-28 08:24:57 -06:00
Mario Sanchez Prada
b28c76b0d8 gunixmounts: Do not leak libmount tables in _g_get_unix_mounts()
Use mnt_context_get_mtab instead of using mnt_context_get_table(), since
that's the recommended way of accessing mtab/mountinfo information, and
also because that way the (struct libmnt_table *) will get automatically
deallocated when calling mnt_free_context()

https://bugzilla.gnome.org/show_bug.cgi?id=769238
2016-07-28 08:24:57 -06:00
Chun-wei Fan
48317b199b gio/gappinfo.c: Include gtask.h
This avoids warning/error C4013 (aka implicit declaration of ...) as we
need APIs from gtask.h.
2016-07-27 16:06:21 +08:00
Matthias Clasen
c1e8f705dd Add async variant of g_app_info_launch_default_for_uri
This is useful in the portalized case, when the portal may
present an app chooser dialog to the user.

https://bugzilla.gnome.org/show_bug.cgi?id=768752
2016-07-26 16:05:29 -04:00
Mario Sanchez Prada
f885c4dd0d Monitor /proc/self/mountinfo when using libmount
https://bugzilla.gnome.org/show_bug.cgi?id=522053
2016-07-26 08:09:27 -06:00
Mario Sanchez Prada
97f799b53a Refactor common code into create_unix_mount_point ()
https://bugzilla.gnome.org/show_bug.cgi?id=522053
2016-07-26 08:09:27 -06:00
Mario Sanchez Prada
44f4309e3b Implemented _g_get_unix_mount_points() based on libmount
https://bugzilla.gnome.org/show_bug.cgi?id=522053
2016-07-26 08:09:27 -06:00
Mario Sanchez Prada
2051ee7678 Refactor common code into create_unix_mount_entry ()
https://bugzilla.gnome.org/show_bug.cgi?id=522053
2016-07-26 08:09:27 -06:00
Mario Sanchez Prada
030594777a Implemented _g_get_unix_mounts() based on libmount
https://bugzilla.gnome.org/show_bug.cgi?id=522053
2016-07-26 08:09:27 -06:00
Mario Sanchez Prada
8d5cf2df10 Use libmount to find the path of the fstab file
https://bugzilla.gnome.org/show_bug.cgi?id=522053
2016-07-26 08:09:27 -06:00
Mario Sanchez Prada
4f9cddaeb8 Added autotools support for libmount
Check whether libmount is available at configuration time and provide
an option to explicitly enable or disable it, similar to libelf.

https://bugzilla.gnome.org/show_bug.cgi?id=522053
2016-07-26 08:09:27 -06:00
Emilio Pozuelo Monfort
38317cf746 Use a uint64 to unpack a 64 bit value
https://bugzilla.gnome.org/show_bug.cgi?id=769089
2016-07-22 19:20:30 +02:00
Matthias Clasen
d5efa64539 Deal with lack of O_CLOEXEC
Some platforms don't have it. We fall back to fcntl() in other
places, so do it here as well.

https://bugzilla.gnome.org/show_bug.cgi?id=769042
2016-07-21 11:54:14 -04:00
Matthias Clasen
db0bf5bbf1 proxy resolver portal: Fix the async api 2016-07-20 20:42:09 -04:00
Dan Winship
6de5595570 Fix gio/tests/socket-listener
g_socket_listener_add_address() is synchronous; all of the events will
have been emitted before it returns and it doesn't queue any sources.
The test was unintentionally depending on the fact that
g_main_context_iterate(NULL, TRUE) would return anyway (at least the
first time it was called), but that's no longer true after e4ee307.

https://bugzilla.gnome.org/show_bug.cgi?id=768968
2016-07-19 17:22:07 -04:00
Emmanuele Bassi
7e40228cae Update the ignore file for GIO 2016-07-19 14:18:49 +01:00
Chun-wei Fan
97972471ca gio/glocalfile.c: Windows: Define ECANCELED if not already defined
Older Visual Studio may not have it defined, so define it like what is
defined for Visual Studio 2010 and later.
2016-07-18 14:41:17 +08:00
Chun-wei Fan
c6aee1bf15 Visual Studio builds: Build the gio tool
https://bugzilla.gnome.org/show_bug.cgi?id=768357
2016-07-18 10:39:20 +08:00
Christian Persch
8345a42cd0 Recognise common C++ extension for automatic target selection
glib-compile-resources --generate is supposed to automatically detect
whether to generate source code or header from the target's file extension.
However, this only worked for C; extend this to include the canonical
C++ filename extensions. Also make the check case insensitive.

https://bugzilla.gnome.org/show_bug.cgi?id=747134
2016-07-16 23:30:46 -04:00
Lars Uebernickel
0e5e3d0d65 gsettings: clarify changed signal documentation
Make it clear that this signal is only guaranteed to be emitted when a
key has been read before.

https://bugzilla.gnome.org/show_bug.cgi?id=750257
2016-07-16 23:26:56 -04:00
Ismo Puustinen
9864c8abf5 gio: properly free memory, preventing leak and illegal access.
https://bugzilla.gnome.org/show_bug.cgi?id=753231
2016-07-16 23:24:39 -04:00
Matthias Clasen
3c861237fb Convince gcc to compile this code
It shouldn't be that hard.
2016-07-16 23:24:39 -04:00
Matthias Clasen
21ceeed3b9 Improve error reporting
Include the filename for the file in question in many of the
error messages in glocalfile.c. This is useful information when
diagnosing such errors, so make it easily available.

http://bugzilla.gnome.org/show_bug.cgi?id=754012
2016-07-16 23:09:09 -04:00
Chun-wei Fan
b08a8dc949 gio tool: Fix build on Windows/non-GCC
The recently-added GIO tools is intended to be built on all platforms, so
adjust the code a bit to enable this:

-Use gssize instead of ssize_t, as ssize_t is not supported by all
 compilers.
-Include io.h on Windows, and define STDIN_FILENO and STDOUT_FILENO if
 necessary on Windows.

https://bugzilla.gnome.org/show_bug.cgi?id=768357
2016-07-16 23:03:48 -04:00
Ryan Lortie
ca03753853 g_settings_reset(): add precondition checks
Ensure that @key is non-%NULL on g_settings_reset().

It turns out that using g_settings_reset() with %NULL key (although
invalid as per the API documentation and not possible via bindings)
accidentally produces the same effect as the _reset_all() API that we
are about to add.

Add the standard precondition checks to prevent that from happening.

https://bugzilla.gnome.org/show_bug.cgi?id=744678
2016-07-16 22:26:43 -04:00
Milan Crha
4215c0ce91 Fix memory leaks in GNetworkMonitorNetlink
As claimed by valgrind in a downstream bug report:
https://bugzilla.redhat.com/show_bug.cgi?id=1317369

https://bugzilla.gnome.org/show_bug.cgi?id=766933
2016-07-16 21:15:30 -04:00
Olivier Crête
e3e3ed0d7d socketservice: Document that it starts pre-activated.
https://bugzilla.gnome.org/show_bug.cgi?id=728207
2016-07-16 21:12:06 -04:00
Aurélien Zanelli
b121a7916d gio/tests/gsettings: fix GSettings reference leaks in some tests
GSettings objects were not unreffed in test_flags, test_enums and
test_ranges tests and when we skip internationalization tests, ie
test_l10n(_context).

https://bugzilla.gnome.org/show_bug.cgi?id=768560
2016-07-16 20:57:20 -04:00
Jonatan Pålsson
1e3f2ba415 docs: Remove superflous XML comments in doc string for GDBusProxyTypeFunc
https://bugzilla.gnome.org/show_bug.cgi?id=766899
2016-07-16 20:49:52 -04:00
Stephan Bergmann
e7478ec967 Swallow -- argument when necessary
https://bugzilla.gnome.org/show_bug.cgi?id=768806
2016-07-16 20:34:51 -04:00
Simon McVittie
0f2e4fd01c Do not attempt to autolaunch a session dbus-daemon with no DISPLAY
The two known use-cases for autolaunching are:

* X-forwarding: "ssh -Y myhost myapp" resulting in a
  session bus on myhost but an X server on the original host

* Legacy desktop environments on OSs without D-Bus integration:
  e.g. running a single GNOME or KDE app under fvwm or something,
  without a session dbus-daemon being started by either systemd,
  gnome-session, or OS integration scripts analogous to Debian's
  /etc/X11/Xsession.d/75dbus_dbus-launch

In either case, an X11 DISPLAY is also needed.

"dbus-launch --autolaunch" doesn't do anything useful when unable
to connect to an X11 display; this has been the case since the feature
was added in 2006, and is useful to avoid "split brain" situations in
which two processes that ought to be part of the same session end up
on separate session buses. Since dbus commit 407c111 in 2011,
libdbus hasn't even attempted to run "dbus-launch --autolaunch"
unless getenv("DISPLAY") returns non-null in the parent: this avoids
doing a relatively complicated fork-and-exec that is clearly not
going to lead to success. This commit gives GDBus the same policy.

This change was originally made to work around a race condition in
subprocess spawning (Debian bug #737380, GNOME bug #711090) but
it seems valid in its own right.

In my opinion as D-Bus maintainer, "dbus-launch --autolaunch" should
be considered to be an X11 feature, and any future D-Bus enhancements
(e.g. kdbus) or successors for X11 (e.g. Wayland, Mir) should obtain
a session bus address by other means - either a session manager
such as "systemd --user", gnome-session or Upstart, or a wrapper
for the user session like dbus-run-session(1).

Related to dbus bug <https://bugs.freedesktop.org/show_bug.cgi?id=19997>.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=723506
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=737380
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-07-16 20:33:34 -04:00
Ting-Wei Lan
cef799377e gio-querymodules: Call setlocale in main function
It is required to correctly show translated messages on some locales.

https://bugzilla.gnome.org/show_bug.cgi?id=760423
2016-07-14 11:25:42 +08:00
Matthias Clasen
63654183a8 documents portal: Make sure O_PATH is defined
FreeBSD doesn't have it.

https://bugzilla.gnome.org/show_bug.cgi?id=768780
2016-07-13 12:38:22 -04:00
Chun-wei Fan
b5258d9d76 gio: Build the portal code only on *NIX
xdg-desktop-portal support is only usable on *NIX platforms, so don't build
them on non-*NIX platforms.  Also clean up gio/Makefile.am a bit to split out
the listings for the platform-specific sources from the platform-neutral
sources, and assemble them for the final list of sources required for libgio.

https://bugzilla.gnome.org/show_bug.cgi?id=768498
2016-07-13 10:43:05 +08:00
Chun-wei Fan
bb5707d6cb gio/Makefile.am: Rearrange things a bit
Move the gio tool build items up, so that the MSVC items do not get split
by it.
2016-07-13 10:41:16 +08:00
Cosimo Cecchi
bc7c030480 documentportal: print warnings when document portal fails to initialize
Instead of siletly failing or calling a method on a NULL instance.
2016-07-12 15:12:35 -07:00
Philip Withnall
e694d1b673 gio: Fix a memory leak in gportalsupport.c
Coverity CID: 1357527
2016-07-12 23:08:27 +01:00
Dan Winship
e0bb25c214 Remove an erroneous check in the non-sendmmsg() version of g_socket_send_messages()
The docs specify that *all* errors are ignored if we managed to send
any data successfully, not just timeout/wouldblock.

https://bugzilla.gnome.org/show_bug.cgi?id=768549
2016-07-12 09:14:09 -04:00
Cosimo Cecchi
62bd8f54bb appinfo: support opening files through document portal
In addition to URIs, we now also support opening files internal to the
sandboxed application through the document portal.
2016-07-11 18:20:48 -07:00
Cosimo Cecchi
f4e2047f20 build: don't forget to clean generated portal files 2016-07-11 18:20:48 -07:00
Dan Winship
79b7efada3 Fix gio/tests/inet-address on OS X
OS X apparently stringifies the IPv6 address "::80" as "::0.0.0.128",
which is bizarre, but that address *is* in a "reserved for future use"
range, so it's not unambiguously wrong I guess. Anyway, fix the text
to use an address everyone can agree on.

https://bugzilla.gnome.org/show_bug.cgi?id=768551
2016-07-11 17:42:41 -04:00
Philip Withnall
a9172c6d03 gio-tool: Fix memory leaks on error paths in mount command
Various GErrors were being leaked.

Coverity CID: 1357351 (amongst others)
2016-07-11 21:56:04 +01:00
Philip Withnall
996bb34986 gio-tool: Remove a stray semicolon
This meant the help text would always be outputted, rendering
the same mode useless and the code below it dead.

Coverity CID: 1357352
2016-07-11 21:47:49 +01:00
Chun-wei Fan
d896ad269e gio/gappinfo.c: Don't include unistd.h
Functions from unistd.h seems not to be used in commit 5b77a19, and
unistd.h is not universally available, so don't include it.
2016-07-11 15:18:09 +08:00
Matthias Clasen
bd3fb2a15f Add a portal backend for GNotification
This talks to the org.freedesktop.portal.Notification portal
instead of directly to gnome-shell.

https://bugzilla.gnome.org/show_bug.cgi?id=768498
2016-07-07 23:48:34 -04:00
Matthias Clasen
e362a01446 Add a portalized proxy resolver implementation
The backend for this lives in xdg-desktop-portal,
and is in turn using GProxyResolver.

https://bugzilla.gnome.org/show_bug.cgi?id=768498
2016-07-07 23:48:34 -04:00
Matthias Clasen
cea5626c49 Add a portalized network monitor implementation
The backend for this lives in xdg-desktop-portal,
and is in turn using GNetworkMonitor.

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.

https://bugzilla.gnome.org/show_bug.cgi?id=768498
2016-07-07 23:48:34 -04:00
Matthias Clasen
5b77a19fe1 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 only launch
the defaults.

Note that even though the API is called launch_default...,
the portal may still offer the user to choose the application
to launch.

https://bugzilla.gnome.org/show_bug.cgi?id=768498
2016-07-07 23:47:36 -04:00
Matthias Clasen
78ef32110a Add portal helpers
These are private helper functions that will be used in
the following commits to get information about whether
we are running in a flatpak sandbox, etc.

We allow the use of GTK_USE_PORTAL=1 in the environment
to force the use of portals. This can be useful for
testing and debugging portal interaction.

https://bugzilla.gnome.org/show_bug.cgi?id=768498
2016-07-07 23:44:43 -04:00
Kalev Lember
4586434346 GFileMonitor: Fix doc typos 2016-07-06 14:37:12 +02: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
Krzesimir Nowak
f5e875b2f8 gio: Add a missing autocleanup for GFileAttributeInfoList 2016-06-03 12:36:39 +02:00
Matthias Clasen
15a85f2095 GCredentialsType: Remove XML markup from docs
We now use markdown.
2016-06-02 13:26:07 -04:00
Krzesimir Nowak
504f189e59 gfileenumerator: Fix typo in docs
This probably used to be a part of libgsystem.
2016-06-02 11:29:55 +02:00
Ondrej Holy
17e5281ca9 Fix ABI compatibility
Commit 7b3f6da broke ABI compatibility, because of newly added vfunc.
Move the vfunc to the end to ensure ABI compatibility.

https://bugzilla.gnome.org/show_bug.cgi?id=765924
2016-05-20 12:35:06 +02:00
Ondrej Holy
7b3f6da307 gio: Add g_drive_is_removable() support
Nautilus wants to show entries in the sidebar only for removable devices.
It uses currently sort of conditions to determine which devices should be
shown. Those condition fails in some cases unfortunatelly. Lets provide
g_drive_is_removable() which uses udisks Removable property to determine
which devices should be shown. It should return true for all drives with
removable media, or flash media, or drives on usb and firewire buses.

https://bugzilla.gnome.org/show_bug.cgi?id=765900
2016-05-20 10:31:22 +02:00
Руслан Ижбулатов
2aa7338875 testsuite: override check-TESTS target in gio tests subdir
This prevents testsuite from trying to build any TESTS in that
subdirectory, which will fail, because there are no TESTS defined
in that Makefile.am.

This happens when user runs make check TESTS=...

https://bugzilla.gnome.org/show_bug.cgi?id=766407
2016-05-14 04:59:40 +00:00
Matthias Clasen
98f86beed6 gdbus-codegen: Only generate autocleanup when instructed to
This adds a new --c-generate-autocleanup option to gdbus-codegen
which can be used to instruct gdbus-codegen about what autocleanup
definitions to emit.

Doing this unconditionally was found to interfere with existing
code out in the wild.

The new option takes an argument that can be
none, objects or all; to indicate whether to generate no
autocleanup functions, only do it for object types, or do it
for interface types as well. The default is 'objects', which
matches the unconditional behavior of gdbus-codegen on the 2.48
branch.

https://bugzilla.gnome.org/show_bug.cgi?id=763379
2016-05-05 06:13:16 -04:00
Chun-wei Fan
217b620a7b gresource.c: Use g_file_test()
Use the g_file_test() API instead of the g_stat() + S_ISDIR combo to fix
builds on compilers that do not support S_ISDIR.

https://bugzilla.gnome.org/show_bug.cgi?id=765991
2016-05-04 23:50:18 +08:00
Christian Hergert
c16a0b53fe socket: set fd field to -1 after closing socket
This ensures that g_socket_get_fd() will return -1 after the socket has
been closed.

https://bugzilla.gnome.org/show_bug.cgi?id=765959
2016-05-04 16:47:54 +03:00
Debarshi Ray
0cd3d5741b gio/tests/task: Ensure that g_task_had_error doesn't forget the error
https://bugzilla.gnome.org/show_bug.cgi?id=764163
2016-05-04 09:34:05 +02:00
Debarshi Ray
a17e1e6d19 gtask: Don't forget about the error after g_task_propagate_*
The use of past tense in g_task_had_error makes one assume that it
won't forget about any errors that might have occurred. Except, in
reality, it would.

Let's use a boolean flag to remember the error once it's been
propagated, as opposed to keeping the error around. This ensures that
the g_task_propagate_* methods continue to give invalid results when
called more than once, as mentioned in the documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=764163
2016-05-04 09:33:49 +02:00
Simon McVittie
1c6cd5f0a3 codegen: make g_autoptr for the GInterface conditional
Some GNOME projects unconditionally work around the generated code's
lack of g_autoptr support by defining the autoptr cleanup function
themselves, which is not forward-compatible; as a result, commit
cbbcaa4 broke them. Do not define the cleanup function unless the
including app "opts in" to newer APIs via GLIB_VERSION_MAX_ALLOWED.

Projects requiring compatibility with GLib < 2.49 can get a
forward-compatible g_autoptr for a generated GInterface type found in
a library, for example ExampleAnimal in the GIO tests, by declaring
and using a typedef with a distinct name outside the library's
namespace:

    typedef AutoExampleAnimal ExampleAnimal;
    G_DEFINE_AUTOPTR_CLEANUP_FUNC (AutoExampleAnimal, g_object_unref)

    ...

    g_autoptr (AutoExampleAnimal) animal = NULL;

    /* returns ExampleAnimal * */
    animal = example_animal_proxy_new_sync (...);
    /* takes ExampleAnimal * first argument */
    example_animal_call_poke_sync (animal, ...);

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=763379
Reviewed-by: Colin Walters <walters@verbum.org>
Reviewed-by: Emmanuele Bassi <ebassi@gnome.org>
2016-05-03 15:48:55 +01:00
Simon McVittie
cbbcaa4dd7 codegen: Add g_autoptr support for the shared GInterface
The rest of the generated classes gained g_autoptr support in fd6ca66,
but this one is still missing. Because whatever_proxy_new_finish() and
whatever_proxy_new_sync() are declared as returning a Whatever *
instead of a WhateverProxy *, and the generated method-call stubs
act on a Whatever *, it's reasonably common to want to declare a
g_autoptr (Whatever).

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugzilla.gnome.org/review?bug=763379
Reviewed-by: Colin Walters <walters@verbum.org>
2016-05-02 19:59:09 +01:00
Christian Hergert
d95030a2fd task: avoid context lock when setting source name
If you set the source name after attaching to the context, you have to
lock the context to free/assign the new source name.

https://bugzilla.gnome.org/show_bug.cgi?id=765861
2016-04-30 15:18:31 -07:00
Allison Ryan Lortie
05060b6194 gdbus-tool: avoid irrelevant note about arg types
gdbus-tool prints a hint about the expected arguments to a function call
in case of errors.  Unfortunately, it prints this message on all errors.
I've seen this confuse users several times -- they go on tweaking the
arguments trying to get the correct type, even though they had it
correct in the first place.

Let's limit the hint to the case where it was actually invalid arguments
that triggered the problem.  Also, adjust the code that prints the
message so that it will also report on the case that no arguments were
expected.

We could possibly get closer to what we want by comparing the list of
expected arguments with the parameter list, as it was parsed from the
user, but that would involve composing the expected type.  Let's keep
this simple for now.

https://bugzilla.gnome.org/show_bug.cgi?id=765710
2016-04-29 10:36:53 +02:00
Marc-Antoine Perennou
5cea1c861d gsettings: add get/set_{,u}int64
https://bugzilla.gnome.org/show_bug.cgi?id=755898

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2016-04-28 17:28:44 +02:00
Allison Ryan Lortie
55ab3af098 GResources: add support for resource overlays
When debugging a program or testing a change to an installed version, it
is often useful to be able to replace resources in the program or a
library, without recompiling.

To support this, for debugging and hacking purposes, it's now possible
to define a G_RESOURCE_OVERLAYS environment variable as a
colon-separated list of substitutions to perform when looking up
GResources.

A substitution has the form

  "/org/gtk/libgtk=/home/desrt/gtk-overlay"

The part before the '=' is the resource subpath for which the overlay
applies.  The part after is a filesystem path which contains files and
subdirectories as you would like to be loaded as resources with the
equivalent names.

In the example above, if an application tried to load a resource with
the resource path '/org/gtk/libgtk/ui/gtkdialog.ui' then GResource would
check the filesystem path '/home/desrt/gtk-overlay/ui/gtkdialog.ui'.  If
a file was found there, it would be used instead.

Substitutions must start with a slash, and must not have a trailing
slash before the '='.  It is possible to overlay the location of a
single resource with an individual file.

https://bugzilla.gnome.org/show_bug.cgi?id=765668
2016-04-28 14:36:13 +02:00
Allison Ryan Lortie
3c7c0af1c9 GResources: use g_hash_table_get_keys_as_array()
Replace the hand-written equivalent of this with the call to the
GHashTable built-in version to save a few lines of code.

The GResource code was written a couple of years before this function
existed.

Similarly, replace a set-mode usage of g_hash_table_insert() with a call
to g_hash_table_add().

https://bugzilla.gnome.org/show_bug.cgi?id=765668
2016-04-28 14:36:13 +02:00
Philip Chimento
f8f344923e tests: Fix appmonitor test
Commit f45ec47 fixed a race condition in this test, but one change was
omitted; maybe lost in a rebase.

https://bugzilla.gnome.org/show_bug.cgi?id=749606
2016-04-27 12:12:31 +08:00
Allison Ryan Lortie
75589956a4 GContextSpecificGroup: add testcase
Add a test case for unreffing an object from a GContextSpecificGroup
immediately after firing a signal, before allowing the mainloop to run.

https://bugzilla.gnome.org/show_bug.cgi?id=762994
2016-04-26 15:20:16 +02:00
Allison Ryan Lortie
62f320e6bb GContextSpecificGroup: detach sources
GContextSpecificGroup has been somewhat broken for a rather long time:
when we remove the last reference on an object held in the group, we try
to clean up the source, but fail to actually remove it from the
mainloop.

We will soon stop emitting signals on the source (due to it having been
removed from the hash table) but any "in flight" signals will still be
delivered on the source, which continues to exist.  This is a problem if
the event is being delivered just as the object is being destroyed.

This also means that we leave the source attached to the mainloop
forever (and next time will create a new one)...

This is demonstrated with the GtkAppChooser dialog which writes an
update to the mimeapps.list file just as it is closing, triggering the
app info monitor to fire just as it is being destroyed.

Karl Tomlinson correctly analysed the problem and proposed this fix.

https://bugzilla.gnome.org/show_bug.cgi?id=762994
2016-04-26 15:20:16 +02:00
Allison Ryan Lortie
3301b852a2 GDesktopAppInfo: support bus activation with '-'
GApplication has accepted any valid bus name as an application ID since
before the time of D-Bus activation.  This includes bus names with '-'.
Several applications have even attempted support bus activation with
these names, going as far as installing D-Bus service files, without
realising that they are silently falling back to fork()/exec() on
account of the name containing a dash.

The reason for the problem is that D-Bus object paths cannot contain
dashes.  We solved this problem privately in an unspecified way inside
of GApplication but substituting '_' in this case, but never made this
part of the Desktop Entry Specification.

The fact that these apps with '-' in the desktop file names aren't
actually using D-Bus activation is beside the point: their intent here
was clear.  Let's avoid forcing them to rename their desktop files again
by simply accepting '-' in desktop file names and munging the path in
the way that GApplication did so historically.

The new path escaping code here has been copied more or less verbatim
from GApplication's own code for the same purpose, with only the removal
of one irrelevant part.

An update to the desktop entry specification will follow.

https://bugzilla.gnome.org/show_bug.cgi?id=764754
2016-04-25 09:19:23 +02:00
Antoine Jacoutot
52f116e874 gioenums.h: Remove trailing comma.
This is helpful to people using the g++ --pedantic option.
2016-04-17 10:04:13 +02:00
Matthias Clasen
24b0781264 Improve GApplication docs
D-Bus activation is a thing now; bring the local_command_line
docs in sync with reality.
2016-04-13 12:01:49 -04:00
Debarshi Ray
fcaa3fb189 docs: Add Since for handle_local_options
https://bugzilla.gnome.org/show_bug.cgi?id=764685
2016-04-11 22:37:35 -04:00
Sébastien Wilmet
d16abd3df3 docs: fix function name
g_action_parse_detailed_action_name() doesn't exist, it's
g_action_parse_detailed_name() instead.
2016-04-09 13:01:53 +02:00
Cosimo Cecchi
f45ec47be1 tests: always remove app.desktop
https://bugzilla.gnome.org/show_bug.cgi?id=749606
2016-04-03 12:23:21 -07:00
Philip Withnall
d09c219696 glocalfile: Assert against a potential NULL pointer dereference
This was confusing some static analysis. Through canonicalize_filename()
at construction time, we guaranteed that ->filename is canonical and
absolute, so g_path_skip_root() should never fail.

https://bugzilla.gnome.org/show_bug.cgi?id=731988
2016-04-02 12:27:05 +01:00
Iain Lane
a668ee8fe9 giotypefuncs.c: Sort _get_type functions in the 'C' locale
This ensures that the generated file is always the same (not dependent
on the build machine's environment), making the build reproducible.

Thanks to Jérémy Bobbio <lunar@debian.org> for the Debian bug report and
patch.

https://bugzilla.gnome.org/show_bug.cgi?id=763617
2016-03-21 13:44:38 +00:00
Philip Withnall
c7763d0712 glib-compile-resources: Fix minor memory leak on error path
Spotted by Coverity (CID: #1353385).
2016-03-21 12:44:15 +00:00
Philip Withnall
db972a73ce gio: Fix a GError memory leak in GNetworkService
Spotted by Coverity (CID: #1325405).
2016-03-15 18:08:29 +00:00
Philip Withnall
27660b178e gio: Fix a GError memory leak in GDesktopAppInfo
Spotted by Coverity (CID: #1352961).
2016-03-15 18:03:00 +00:00
Philip Withnall
0a580fc79e gio: Fix minor typo in GActionGroup documentation 2016-03-14 12:57:20 +00:00
Philip Withnall
fd6ca66c16 codegen: Add support for g_autoptr to gdbus-codegen–generated objects
This means that any code generated by gdbus-codegen will now require
GLib 2.44 or newer.

https://bugzilla.gnome.org/show_bug.cgi?id=763379
2016-03-10 09:39:44 +00:00
Руслан Ижбулатов
74b1dd87b5 W32: eliminate busy cursor when a rundll32-hosted child runs
Even though GetStartupInfo() in g_win32_run_session_bus() would
tell us that STARTF_FORCEONFEEDBACK flag is not set, it still
affects the rundll32 process for some reason.

This means that Windows WM changes mouse cursor to IDC_APPSTARTING for
a few seconds when rundll32 runs g_win32_run_session_bus(). Since
g_win32_run_session_bus() never satisfies the conditions set by
STARTF_FORCEONFEEDBACK, the busy cursor only goes away after a
timeout.

Fix this by explicitly running GetMessage(). To ensure that GetMessage()
doesn't block, post a quit message immediately before calling it.

https://bugzilla.gnome.org/show_bug.cgi?id=760694
2016-03-03 07:26:04 +00:00
Jan Alexander Steffens (heftig)
5a894c3232 gsettings: Don't crash when no schemas are installed
Still doesn't behave well ("gsettings help" causes an error),
but at least there's no segfault anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=724847
2016-03-02 19:04:28 -05:00
Allison Ryan Lortie
b54acf513d GDBusConnection: use uint for bitshifts
"1 << 31" is not well-defined, do use "1u << 31" instead.

https://bugzilla.gnome.org/show_bug.cgi?id=762748
2016-03-01 10:34:07 -05:00
Ignacio Casal Quinteiro
96fb3b9c03 gwin32fsmonitorutils: avoid useless cast 2016-03-01 08:55:29 +01:00
Ignacio Casal Quinteiro
6e454a99ef gwin32fsmonitorutils: avoid a possible invalid memory access 2016-03-01 08:55:26 +01:00
Ignacio Casal Quinteiro
dedf65a5fd gwin32fsmonitorutils: no need to g_assert when using g_new 2016-03-01 08:40:48 +01:00
Ignacio Casal Quinteiro
922cd8424a gwin32fsmonitorutils: no need to check for NULL when using g_free 2016-03-01 08:37:51 +01:00
Ignacio Casal Quinteiro
007e3c5939 gwin32fsmonitorutils: coding style fixes 2016-03-01 08:37:14 +01:00
Sebastian Geiger
7f60cbb701 gio: fix documentation of GAction 2016-02-29 15:47:32 +01:00
Ignacio Casal Quinteiro
45ccd3f951 gwin32filemonitor: some cleanups
Make the code a bit more consistent and get it into preparation to
merge the fs monitor stuff that uses the private struct directly.
2016-02-28 15:05:18 +01:00
Ignacio Casal Quinteiro
bc5b7332b7 Improve error on win32input/output streams 2016-02-25 17:23:50 +01:00
Ignacio Casal Quinteiro
73192b84f8 gwin32outputstream: cleanups to make the code more consistent 2016-02-25 10:00:32 +01:00
Ignacio Casal Quinteiro
d5cb451c51 gwin32inputstream: some cleanups to make the code more consistent 2016-02-25 09:56:25 +01:00
Ignacio Casal Quinteiro
53a24814f6 gsettingschema: fix uninitialized value warning
This error could actually happen in case the assertions are off.
2016-02-24 17:20:57 +01:00
Ignacio Casal Quinteiro
f3334b47ec Revert "registrybackend: use G_DECLARE_FINAL_TYPE"
This reverts commit b0776ddd18.
mingw does not seem to like this patch so better go on the safe
way.
2016-02-24 09:33:22 +01:00
Ignacio Casal Quinteiro
13057bb73e registrybackend: fix warning about unused variable 2016-02-24 09:18:42 +01:00
Tobias Nygren
0d0db60959 gio/gtestdbus.c: don't use non-standard %m printf modifier
https://bugzilla.gnome.org/show_bug.cgi?id=756706
2016-02-19 11:29:32 +00:00
Lars Uebernickel
b32f8ba19b gapplication: add a way to override the app-id
Some applications support running in a mode where they present
themselves as a different application to the user (for example web
browsers or terminals).

To facilitate this, add an option --gapplication-app-id which allows
users to override an application's id from desktop files or similar.

Applications need to opt-in to this by setting the
G_APPLICATION_CAN_OVERRIDE_APP_ID flag.

https://bugzilla.gnome.org/show_bug.cgi?id=743933
2016-02-18 08:18:58 -05:00
Matthias Clasen
caf03300e5 Remove leftover markup 2016-02-17 20:10:43 -05:00
Cole Robinson
a3a97dca3a gsettings: schema_list should use the passed schema's source
currently schema_list will iterate over the default SchemaSource
list, and not the one associated with the passed in Schema. This
means schema_list can give incorrect results for a Schema fetched
from a non-default SchemaSource, like via new_from_directory.

https://bugzilla.gnome.org/show_bug.cgi?id=757506
2016-02-16 10:57:58 -05:00
Ignacio Casal Quinteiro
19fd89f8db registrybackend: avoid adding a new child when we return the root 2016-02-05 12:05:02 +01:00
Ignacio Casal Quinteiro
63b0f1087d registrybackend: another cleanup creating a registry cache item 2016-02-05 11:39:30 +01:00
Ignacio Casal Quinteiro
c73e9fc36a registrybackend: use registry_cache_add_item instead of creating manually 2016-02-05 11:14:24 +01:00
Ignacio Casal Quinteiro
bd3dd1cd48 registrybackend: get whether a key is writable or not 2016-02-05 10:44:45 +01:00
Руслан Ижбулатов
604ca89176 registrybackend: do convert values to UTF-16
Perform conversion before writing a value out of the cache into the registry,
and convert back when reading a value into the cache out of the registry.
The registry holds UTF-8 strings.
2016-02-05 09:40:30 +01:00
Руслан Ижбулатов
c4d943186e registrybackend: fix memory leak 2016-02-05 09:39:21 +01:00
Ignacio Casal Quinteiro
b8fc289e8f registrybackend: remove useless include 2016-02-04 12:44:11 +01:00
Ignacio Casal Quinteiro
74442a0b8c registrybackend: do not leak self if there are no items 2016-02-04 11:16:45 +01:00
Ignacio Casal Quinteiro
dc97bb9b9b registrybackend: handle readability of the keys
If a key is removed or it cannot be read anymore we should
notify the backend about it so it fallbacks to the default
value.
2016-02-04 11:02:46 +01:00
Ignacio Casal Quinteiro
05dd91a0b6 registrybackend: use unicode calls intead of the ansi ones
https://bugzilla.gnome.org/show_bug.cgi?id=761504
2016-02-04 08:59:59 +01:00
Ignacio Casal Quinteiro
7161d70955 registrybackend: remove useless get_permission override
The base class does the same
2016-02-04 07:55:25 +01:00
Ignacio Casal Quinteiro
259a61ed2d registrybackend: pass the event to the cache update
This way the registry cache has more control to specify what has
changed.
2016-02-03 19:19:50 +01:00
Rico Tzschichholz
e3189527dc gio/gobject: Various introspection fixes 2016-02-03 18:13:49 +01:00
Ignacio Casal Quinteiro
c7ea434e2c registrybackend: properly propagate the partial key name 2016-02-03 13:10:09 +01:00
Ignacio Casal Quinteiro
f1a5e394b0 registrybackend: rename touched flag to readable
This is a flag used to understand if a key exists on the registry
and if it is readable. It makes more sense to rename it as readable
since anyway a key that does not exists anymore is a key that is
not readable.
2016-02-02 14:48:22 +01:00
Ignacio Casal Quinteiro
5cc997f7c4 registrybackend: close the key only if successfully opened 2016-02-02 11:08:50 +01:00
Ignacio Casal Quinteiro
bf3f827ca1 registrybackend: use ptr_array_new_with_free_func 2016-02-02 11:08:42 +01:00
Ignacio Casal Quinteiro
9098a7f927 registrybackend: minor style cleanup 2016-02-02 11:04:56 +01:00
Rico Tzschichholz
d268d9f86a socket: Fix annotation of g_socket_receive_message
https://bugzilla.gnome.org/show_bug.cgi?id=761337
2016-02-02 10:15:04 +01:00
Rico Tzschichholz
ec173eb654 application: Fix annoation of g_application_add_option_group
https://bugzilla.gnome.org/show_bug.cgi?id=761337
2016-02-02 10:11:08 +01:00
Ignacio Casal Quinteiro
169cfb250f registrybackend: avoid signed/unsigned comparison warnings 2016-02-01 14:25:05 +01:00
Ignacio Casal Quinteiro
b0776ddd18 registrybackend: use G_DECLARE_FINAL_TYPE 2016-02-01 14:24:46 +01:00
Sébastien Wilmet
95dd373024 docs: better documentation for g_file_info_copy_into()
The documentation of g_file_info_copy_into() was misleading. The
attributes are not just copied, @dest_info is also cleared at the
beginning. So any previously set attributes in @dest_info are lost.

There was a bug in gedit about this function, where some metadata were
not saved. So it might make sense to change the implementation to not
clear @dest_info, and copy one by one the attributes from @src_info to
@dest_info.

https://bugzilla.gnome.org/show_bug.cgi?id=747927
2016-01-28 20:31:53 +01:00
Sébastien Wilmet
a4ed89bf75 docs: improve doc of g_file_info_list_attributes()
The name_space can be NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=747927
2016-01-28 18:49:28 +01:00
Matthias Clasen
42699e37be gio: Include filename in error message
I'm tired of seeing 'No such file or directory' in the logs without
a hint as to what is actually wrong. Including the filename here
may help me tracking down a bug in the continuous infrastructure.
2016-01-27 21:05:31 -05:00
Chun-wei Fan
d20e88fd11 gwinhttpfile.c: Fix build on Visual Studio
Visual Studio, at least the older versions, cannot use L on macros which
are defined as a constant string, plus the L must be applied to all string
literals here.  This does not look nice, but this is life...
2016-01-26 23:23:42 +08:00
Ignacio Casal Quinteiro
56b0454ba5 registrybackend: fix warning 2016-01-26 15:41:08 +01:00
Ignacio Casal Quinteiro
b57eac68e5 registrybackend: fix double-free error 2016-01-26 15:22:48 +01:00
Ignacio Casal Quinteiro
df1ffe7e27 registrybackend: remove :( from messages 2016-01-26 14:35:31 +01:00
Ignacio Casal Quinteiro
0200e4036c registrybackend: simplify g_message_win32_error 2016-01-26 13:26:41 +01:00
Ignacio Casal Quinteiro
bc85dee6b3 registrybackend: do not accept 0 as a windows error
We might end up removing from the error stack the wrong error
and this might be missleading
2016-01-26 13:19:56 +01:00
Ignacio Casal Quinteiro
bad7e4a114 registrybackend: do not leak the watch data in case of failure 2016-01-26 13:15:51 +01:00
Ignacio Casal Quinteiro
31aab1bd42 registrybackend: do not leak key and event if it cannot add the watch 2016-01-26 12:53:56 +01:00
Ignacio Casal Quinteiro
a92d97ff1f registrybackend: more style fixes
This is the never ending story
2016-01-26 12:21:48 +01:00
Ignacio Casal Quinteiro
1b5b0eff9a registrybackend: fix possible crash if cache_node is NULL 2016-01-26 12:02:18 +01:00
Ignacio Casal Quinteiro
67f6ede3e5 registrybackend: remove space before ++ 2016-01-26 11:46:51 +01:00
Ignacio Casal Quinteiro
8f7aa273de registrybackend: fix possible mem leak
If the parameters do not validate we would leak the memory.
2016-01-26 11:42:33 +01:00
Ignacio Casal Quinteiro
305a9b12c9 winhttpfile: use glib format string macro
Like this we avoid some downstream patching for msys2
2016-01-26 10:13:02 +01:00
Ignacio Casal Quinteiro
a89629db1d registrybackend: use the glib format string macro 2016-01-26 10:10:39 +01:00
Ignacio Casal Quinteiro
a159bc939d registrybackend: more cleanups 2016-01-26 09:00:35 +01:00
Ignacio Casal Quinteiro
7256f2289a registrybackend: more cleanups 2016-01-25 16:12:59 +01:00
Ignacio Casal Quinteiro
a5e819c4c3 registrybackend: style fixes 2016-01-25 16:02:03 +01:00
Philip Withnall
8c263008bb build: Calculate ABS_GLIB_RUNTIME_LIBDIR at build time
Rather than calculating it at configure time. This means it can expand
$libdir properly, and use the Make $(realpath) function rather than
invoking the non-portable `readlink -f`.

This fixes problems where `readlink` would be called on an invalid path
(due to a variable not being expanded) and would evaluate to "", which
would then cause things to be installed in the wrong place.

https://bugzilla.gnome.org/show_bug.cgi?id=744772
2016-01-24 14:44:44 +00:00
Philip Withnall
3c0cddfe80 gdbusobjectmanagerserver: Clarify recommended ObjectManager paths
Otherwise people might try to export the object manager at ‘/’, which
doesn’t work. And I have no intention of making it work.

https://bugzilla.gnome.org/show_bug.cgi?id=760852
2016-01-19 17:10:40 +00:00
Philip Withnall
1725580f26 gdbusobjectmanagerserver: Convert a DocBook link to Markdown 2016-01-19 17:01:14 +00:00
Philip Withnall
c3d6934f18 gio: Add DTLS interfaces
Add a new GDtlsConnection interface, plus derived GDtlsClientConnection
and GDtlsServerConnection interfaces, for implementing Datagram TLS
support in glib-networking.

A GDtlsConnection is a GDatagramBased, so may be used as a normal
datagram socket, wrapping all datagrams from a base GDatagramBased in
DTLS segments.

Test cases are included in the implementation in glib-networking.

https://bugzilla.gnome.org/show_bug.cgi?id=752240
2016-01-18 14:25:06 +00:00
Allison Ryan Lortie
86c5d8978d GDBusMethodInvocation: document behaviour change
We changed the behaviour of this API to adapt to a change in the D-Bus
specification.  Document the new behaviour, along with the time of the
change.

https://bugzilla.gnome.org/show_bug.cgi?id=755421
2016-01-13 10:51:44 -05:00
Lars Uebernickel
dbea81b02d gdbus: don't send unexpected replies
gdbus sets NO_REPLY_EXPECTED when no callback is given to
g_dbus_connection_call(). It makes sense that it also handles the server
side correctly by discarding replies to clients that don't want one.

https://bugzilla.gnome.org/show_bug.cgi?id=755421
2016-01-13 10:44:49 -05:00
Philip Withnall
3add5e2837 gio: Document thread safety of the streams API
Specifically, GIOStream and the TLS connection streams.

Includes wording adapted from suggestions by Dan Winship
<danw@gnome.org>.

https://bugzilla.gnome.org/show_bug.cgi?id=735754
2016-01-11 15:58:42 +00:00
Javier Jardón
4e78a0a9df Revert "Use upstream gettext instead the glib one"
This causes several problems:
- Compilation in FreeBSD with --enable-gtk-doc broke
- Modules that still use the AM_GLIB_GNU_GETTEXT macro
  doesnt compile anymore because /usr/share/glib-2.0/gettext
  is not filled with the correct files, as this was done in
  the glib custom po/Makefile.in.in

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

This reverts commit e5c752371c.
2016-01-10 22:44:24 +00:00
Javier Jardón
e5c752371c Use upstream gettext instead the glib one
https://bugzilla.gnome.org/show_bug.cgi?id=622991
2016-01-09 18:49:22 +00:00
Matt Watson
c1e2a8d727 resource file: add cancel to dummy monitor
gfilemonitor has a cancel vfunc and will call into the in dispose.
If we don't stub it out we get a segfault.
2016-01-08 18:08:20 -08:00
Daiki Ueno
50645b724a gsettings: Install gettext ITS rules
Recent gettext has a feature to allow consumer projects to supply their
own string extraction rules for XML files, in ITS format.

Gettext still ships the rule for *.gschema.xml, but it would be better
maintained in the upstream project.

See the gettext documentation for details:
http://www.gnu.org/software/gettext/manual/html_node/Preparing-ITS-Rules.html

https://bugzilla.gnome.org/show_bug.cgi?id=760199
2016-01-08 12:31:18 +09:00
Christophe Fergeau
ea5ca11761 gio: Document that g_inet_address_new_* return value must be g_object_unref'ed 2016-01-07 15:21:08 +01:00
Steven Chamberlain
42b160b19f gio: drop obsoleted lock causing deadlocks on FreeBSD
I think it is a recursion from the GUnixMountMonitor constructor, to a
GLocalFileMonitor on /etc/fstab, and into GUnixMountMonitor again, now
with a mutex already held, so it deadlocks.
https://bugzilla.gnome.org/page.cgi?id=traceparser/trace.html&trace_id=235354

That mutex in glocalfile.c:g_local_file_find_enclosing_mount() doesn't
seem necessary any more IMHO.  Inside it, only 'mount' is modified, but
that's just a stack variable local to this function.  When
klass->get_mount_for_mount_path is called, it's given one const
parameter and the other is unused, so they're unchanged. 'klass'
doesn't seem it could be modified either inside that function.

It doesn't recurse infinitely, but seems to work correctly and pass the
testsuite after this change.

The FreeBSD project already applied my patch in their ports tree, and
their users seem happy with it.

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=712848#64
and https://bugzilla.gnome.org/show_bug.cgi?id=753378
2015-12-23 09:40:54 -05:00
Chun-wei Fan
bec6a9a300 g_application_run(): Fix on Windows When Using Bindings
As g_win32_get_command_line() calls CommandLineToArgvW() to acquire the
arguments passed into a GApplication program, it actually returns the
whole command line which is used to invoke the program, including the
script interpreter and its flags when a script using GNOME bindings
(e.g. PyGObject and so on) is being invoked.

The issue here is that g_application_run() would most probably have
trouble in the scripts scenario on Windows as it is likely unable to
"recognize" the script interpreter, causing such scripts to fail to run.

Largely based on the patch by Ray Donnelly <mingw.android@gmail.com>.

https://bugzilla.gnome.org/show_bug.cgi?id=734095
2015-12-22 17:33:33 +08:00
Ignacio Casal Quinteiro
5f4b92202b win32: fix warnings avoid discarding const qualifier 2015-12-21 12:22:10 +01:00
Xavier Claessens
aa9a33b0da GApplication: Avoid getting the default context repeatidly
This avoids getting a global lock on every main loop iteration.

https://bugzilla.gnome.org/show_bug.cgi?id=759554
2015-12-16 11:44:43 -05:00
Jasper St. Pierre
a379a0ad59 gapplication: Acquire the main context before running
Otherwise, we'll acquire it on every loop iteration, which can leave us
vulnerable to racing another thread for the acquisition of the main
context.

This can break methods like g_main_context_invoke, which try to acquire
a context to figure out if it can invoke the method synchronously or
need to defer to an idle. In these cases, it isn't guaranteed that the
invocation function will be invoked in the default main context,
e.g. the one that GApplication is holding.

This also matches what GMainLoop is doing.

https://bugzilla.gnome.org/show_bug.cgi?id=752983
2015-12-16 09:15:43 -05:00
Руслан Ижбулатов
ce985f13f4 Enable contenttype test on W32, tweak it to pass (mostly)
* On W32 use a real directory (SYSTEMROOT) instead of '/etc/'
* Disable test_symbolic_icon() as it can't be passed (symbolic icons are not
  really supported)

* PowerPoint/Gettext test still fails, presumably because msvcrt qsort() moves
  the entires (both have the same priority)

https://bugzilla.gnome.org/show_bug.cgi?id=735696
2015-12-16 07:47:54 -05:00
Руслан Ижбулатов
b86e46e8e7 xdgmime: Finer handling for cases where mmap() is not available
Allocate an empty cache object, check cache objects for being empty
before using them.
Otherwise the code will re-read cache every 5 seconds, as NULL cache
does not trigger the code that stores mtime, which makes the cache
file appear modified/unloaded permanently.

https://bugzilla.gnome.org/show_bug.cgi?id=735696
2015-12-16 07:47:54 -05:00
Matthias Clasen
04c56cf6e7 gsettings: Don't translate ""
The empty msgid is traditionally used to store po file metadata,
so calling gettext with an empty msgid is not the right thing
to do.

https://bugzilla.gnome.org/show_bug.cgi?id=756214
2015-12-16 07:47:53 -05:00
Allison Ryan Lortie
30359e7409 file monitors: reorder some code to avoid segfault
We must initialise '->source' before we use fields inside of it.

https://bugzilla.gnome.org/show_bug.cgi?id=758823
2015-12-16 07:47:53 -05:00
c2d0c40bff Fix gettext use
gettext() calls inside library have to use gi18n-lib.h.

https://bugzilla.gnome.org/show_bug.cgi?id=758553
2015-12-16 07:47:53 -05:00
Roman Lebedev
4cda92b587 glib-compile-resources: do not leak c_name
As per #578363, "if one requests e.g. strings via GOptionEntry.arg_data
then those are strduped and needs to be free'ed by the application."

Fixes following leak:

=================================================================
==29426==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 10 byte(s) in 1 object(s) allocated from:
    0 0x7f3ab783d37a in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9437a)
    1 0x7f3ab70f7c82 in g_malloc /home/lebedevri/src/glib/glib/gmem.c:94
    2 0x7f3ab70f7f60 in g_malloc_n /home/lebedevri/src/glib/glib/gmem.c:330
    3 0x7f3ab713258e in g_strndup /home/lebedevri/src/glib/glib/gstrfuncs.c:425
    4 0x7f3ab709c86b in strdup_len /home/lebedevri/src/glib/glib/gconvert.c:864
    5 0x7f3ab709c966 in g_locale_to_utf8 /home/lebedevri/src/glib/glib/gconvert.c:905
    6 0x7f3ab7103c32 in parse_arg /home/lebedevri/src/glib/glib/goption.c:1276
    7 0x7f3ab71066fb in parse_long_option /home/lebedevri/src/glib/glib/goption.c:1670
    8 0x7f3ab7108047 in g_option_context_parse /home/lebedevri/src/glib/glib/goption.c:1997
    9 0x408532 in main /home/lebedevri/src/glib/gio/glib-compile-resources.c:629
    10 0x7f3ab6c72b44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)

https://bugzilla.gnome.org/show_bug.cgi?id=757299
2015-12-16 07:47:53 -05:00
Allison Ryan Lortie
21b1c390a3 GApplication: destroy the impl on shutdown
It's theoretically possible (and see in the wild) for D-Bus messages to
come in to the application after shutdown() has been called and while
we're draining out the lingering events in the main context.

Prevent this from happening by ensuring we unregister our objects on
D-Bus during the shutdown process.

https://bugzilla.gnome.org/show_bug.cgi?id=757372
2015-12-16 07:47:53 -05:00
Ryan Lortie
aa16359986 Stop supporting non-POSIX getpwuid_r, getgrgid_r
Bug 13403 introduced support for the non-POSIX variants of these APIs
found on a system called "DG/UX".  Meanwhile, the complicated checks
here are breaking cross-builds on systems that we actually care about.

Remove the complicated checks and replace them with AC_CHECK_FUNCS.
Remove the resulting dead code from a couple of .c files.

https://bugzilla.gnome.org/show_bug.cgi?id=756475
2015-12-16 07:47:53 -05:00
Paolo Borelli
c97729532f W32: fix uninitialized var in g_app_info_get_all_for_type
Compare with the handler->app, not with the app var which is not
initialized yet

https://bugzilla.gnome.org/show_bug.cgi?id=759408
2015-12-14 14:32:17 +01:00
Emmanuele Bassi
a81568273c docs: Be more precise on the use of set_resource_base_path()
The current wording is a bit vague on when to call
set_resource_base_path() in a GApplication implementation.
2015-12-01 12:57:02 +00:00
Matthias Clasen
9787790448 GApplication: improve docs
Spell out which GVariant format strings to use for which
commandline option types. I just wasted some time debugging
this in an application.
2015-11-25 21:38:20 -05:00
Evangelos Foutras
db641e3292 GDBusProxy: Fix a memory leak during initialization
https://bugzilla.gnome.org/show_bug.cgi?id=758641
2015-11-25 17:33:11 -05:00
Ben Iofel
7ab79b3879 GTask: fix example code in docs
https://bugzilla.gnome.org/show_bug.cgi?id=758181
2015-11-16 12:33:02 -05:00
Philip Withnall
25a7c817d3 glib: Add missing (nullable) and (optional) annotations
Add various (nullable) and (optional) annotations which were missing
from a variety of functions. Also port a couple of existing (allow-none)
annotations in the same files to use (nullable) and (optional) as
appropriate instead.

Secondly, add various (not nullable) annotations as needed by the new
default in gobject-introspection of marking gpointers as (nullable). See
https://bugzilla.gnome.org/show_bug.cgi?id=729660.

This includes adding some stub documentation comments for the
assertion macro error functions, which weren’t previously documented.
The new comments are purely to allow for annotations, and hence are
marked as (skip) to prevent the symbols appearing in the GIR file.

https://bugzilla.gnome.org/show_bug.cgi?id=719966
2015-11-07 10:48:32 +01:00
Sebastien Bacher
90808a0279 g_local_file_trash: remove invalid free call
Commit 8ece2de964 transplanted a block of
code that contained an early-exit-on-error case which freed several
variables.

Because of the move, the normal-path unconditional free of one of these
variables is now above this early exit case, so if this block is hit, it
will now be a double-free.

Remove that.

https://bugzilla.gnome.org/show_bug.cgi?id=757693
2015-11-06 11:55:57 -05:00
Philip Withnall
1ac2a606fc gtlsconnection: Fix a typo in the documentation 2015-11-06 11:27:24 +01:00
Jussi Kukkonen
1c6e6671d1 gio/tests: Don't depend on a data file that's not built
data.gresource is not built when cross-compiling: Don't
add it to test_data in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=757628
2015-11-05 13:50:13 +02:00
Simon McVittie
236e8040b4 Build gdbus-example-objectmanager-server again
It was removed, apparently accidentally, in commit 5b48dc4.
This had the side-effect that it wasn't included in tarball releases,
which means that commit ab7b4be doesn't work when building a package.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=734469
Reviewed-by: Colin Walters <walters@verbum.org>
2015-11-02 20:36:42 +00:00
Lars Uebernickel
ee718d3526 gapplication: reject actions without names
https://bugzilla.gnome.org/show_bug.cgi?id=756134
2015-11-02 13:52:10 +01:00
Daiki Ueno
863bffdac7 doc: fix g_task_attach_source() example
The 3rd argument of the function is not a GCallback, but a GSourceFunc.

https://bugzilla.gnome.org/show_bug.cgi?id=757451
2015-11-02 11:14:04 +09:00
Xavier Claessens
df352203d6 Stop using g_sequence_get_length() to check if it's empty
g_sequence_is_empty() is more efficient for that task.

https://bugzilla.gnome.org/show_bug.cgi?id=756988
2015-10-30 11:35:28 -04:00
Xavier Claessens
2331437df3 Doc: fix some gtk-doc warnings
https://bugzilla.gnome.org/show_bug.cgi?id=755364
2015-10-30 10:30:55 -04:00
Matthias Clasen
a036bd38a5 Try to fix the desktop-app-info test
This was broken in 2bb898c60f.
2015-10-26 13:52:47 -04:00
Rico Tzschichholz
e93aaeb533 gio: Fix version of "Since" annotation 2015-10-25 19:43:54 +01:00
Dan Winship
4dae2d8289 gtask: re-fix tasks-blocking-other-tasks
The new "slowly add more task threads" code doesn't fully deal with
apps that queue lots and lots of tasks which then block on tasks from
their task threads. Fix this by bringing back the "task is blocking
other task" check and making sure that such tasks get bumped to the
front of the queue.

https://bugzilla.gnome.org/show_bug.cgi?id=687223
2015-10-24 10:37:22 -04:00
Dan Winship
263aac125e .gitignore updates 2015-10-23 11:28:03 -04:00
Víctor Manuel Jáquez Leal
3bb8294e00 giomodule: return a copy of module name
This is a regression from commit 6dedc0.

The clients expect to free the received module name, so the function
must return a copy.

https://bugzilla.gnome.org/show_bug.cgi?id=756952
2015-10-22 11:21:47 +02:00
Ignacio Casal Quinteiro
144a87a643 Use bin/gio/modules when building with visual studio 2015-10-22 09:22:01 +02:00
Ignacio Casal Quinteiro
6dedc0364a Factor out a get_gio_module_dir
This also fixes some memory leaks on windows
2015-10-22 08:42:22 +02:00
Ignacio Casal Quinteiro
ad0f340c27 win32: let glib to use the right path separator for the modules 2015-10-20 16:13:08 +02:00
Ryan Lortie
8ece2de964 g_local_file_trash: write info file first
Recent changes to file monitors removed the delay before events were
reported.  Among other things, this caused the trash backend of gvfs to
notice trashed files sooner than before.

On noticing trashed files, the backend tries to read the info file to
discover (among other things) the original location of the file.

Unfortunately, g_local_file_trash() does a strange dance when trashing a
file.  It does a loop of open(O_EXCL) in order to file an empty filename
in the trash to write an info file to, trashes the file, and only then
writes the contents of the info file.  This means that at the time the
file is moved to the trash, the info file is an empty stub.

Change the order so that we write out the actual content of the info
file first.  If the actual trash files then we will unlink the info file
anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=749314
2015-10-14 18:08:02 +01:00
Philip Withnall
128c413261 gsocketconnectable: Add a to_string() virtual method
Add string serialisation functions for GNetworkAddress, GSocketAddress,
GUnixSocketAddress, GInetSocketAddress, GNetworkService and
GSocketConnectable. These are intended for use in debug output, not for
serialisation in network or disc protocols.

They are implemented as a new virtual method on GSocketConnectable:
g_socket_connectable_to_string().

GInetSocketAddress and GUnixSocketAddress now implement
GSocketConnectable directly to implement to_string(). Previously they
implemented it via their abstract parent class, GSocketAddress.

https://bugzilla.gnome.org/show_bug.cgi?id=737116
2015-10-13 15:42:14 +01:00
Philip Withnall
4e631d2e5f gio: Add GDatagramBased interface and rebase GSocket on it
GDatagramBased is an interface abstracting datagram-based communications
in the style of the Berkeley sockets API. It may be contrasted to (for
example) GIOStream, which supports only streaming I/O.

GDatagramBased allows socket-like communications to be done through any
object, not just a concrete GSocket (which wraps socket()).

This adds the GDatagramBased interface, and implements it in GSocket.

https://bugzilla.gnome.org/show_bug.cgi?id=697907
2015-10-13 15:33:48 +01:00
Mike Frysinger
e5e08ebedb gthreadedresolver.c: Fix for Android 5.0+
https://bugzilla.gnome.org/show_bug.cgi?id=756477
2015-10-13 09:04:39 -04:00
Debarshi Ray
cd1eba043c docs: Improve the text on G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START
... and fix a couple of typos in the process.

https://bugzilla.gnome.org/show_bug.cgi?id=756251
2015-10-09 14:16:29 +02:00
John Hiesey
16e0a5a886 goutputstream: Report input stream read failure correctly
When G_OUTPUT_STREAM_CLOSE_TARGET is set,
g_output_stream_real_splice was not returning -1 in any error
cases, since the success flag was being overwritten.

https://bugzilla.gnome.org/show_bug.cgi?id=756255
2015-10-08 20:07:08 +02:00
Philip Withnall
ac05ad55fa gdbusconnection: Add missing (nullable) to get_peer_credentials()
Since Colin mentioned it on gir-devel-list.
2015-10-06 07:59:19 +01:00
Olivier Fourdan
4919c25d49 GDesktopAppInfo: Do not set the DISPLAY in gio
The environment variable DISPLAY makes sense only for X11, it should
not be set in gio.

Beside, if the backend is not X11 but Wayland, forcing the value of
DISPLAY to the Wayland display will confuse the backend selection and
possibly crash the applications.

https://bugzilla.gnome.org/show_bug.cgi?id=754983
2015-10-05 23:21:43 -04:00
Philip Withnall
212b0c28cc gsocket: Fix g_socket_send_messages_with_timeout() on win32
Commit a0cefc2217 introduced an unresolved
symbol, g_socket_send_message_with_timeout(), on win32. Windows
unfortunately isn’t clever enough to fill in the gaps and magic up the
implementation of that function from nowhere, so we had better do it
ourselves.

Factor the blocking behaviour out of g_socket_send_message() into a new
internal g_socket_send_message_with_timeout().

https://bugzilla.gnome.org/show_bug.cgi?id=756054
2015-10-05 16:15:19 +01:00
Chun-wei Fan
e81d4ea988 gio/goscket.c: Fix build on Windows
5d68947 factored out resuable items, but some of these are only for
*NIX builds, which will break the build on Windows.  Fix this by
building these portions only when !G_OS_WIN32.

https://bugzilla.gnome.org/show_bug.cgi?id=756053
2015-10-05 17:15:12 +08:00
Philip Withnall
9b7f5ad611 gunixsocketaddress: Clarify construction behaviour of anonymous addrs
Clarify the handling of G_UNIX_SOCKET_ADDRESS_ANONYMOUS in the
documentation for g_unix_socket_address_new_with_type().
2015-10-04 15:26:37 +01:00
Philip Withnall
fc59c20e97 gsocket: Minor documentation clarifications
As suggested by Dan Winship on bug #697907.
2015-10-04 11:34:36 +01:00
Philip Withnall
237fec7e70 gsocket: Fix connected state if shutting down in two steps
The value of g_socket_is_connected() gets stuck high if the GSocket is
shut down in two steps:
   g_socket_shutdown (socket, TRUE, FALSE, NULL);
   g_socket_shutdown (socket, FALSE, TRUE, NULL);
rather than one:
   g_socket_shutdown (socket, TRUE, TRUE, NULL);

Fix that by tracking the connected status for the read half and the
write half of the connection separately.

https://bugzilla.gnome.org/show_bug.cgi?id=697907
2015-10-04 10:39:13 +01:00
Philip Withnall
456e02f280 gdbusaddress: Fix memory leak when G_DBUS_DEBUG_ADDRESS is enabled
Coverity CID: 1325374
2015-10-03 11:52:27 +01:00
Philip Withnall
0f98b2f4ec gsocks5proxy: Fix error reporting in authentication
set_auth_msg() was returning FALSE to indicate error, but all its
callers were expecting a negative return value to indicate error. This
was causing memory leaks for the GError, and errors to not be reported.

Coverity CID: 1325357
2015-10-03 11:46:18 +01:00
Philip Withnall
c1c001e300 gresource-tool: Fix minor memory leak when listing resources
Coverity CID: 1325353
2015-10-03 11:43:49 +01:00
Philip Withnall
292fd1155a gtlscertificate: Fix error reporting if a GError is not passed in
If the certificate constructor is called as:
   g_tls_certificate_new_from_pem (data, length, NULL);
and PEM parsing fails for the private key, the function would have
continued to try and create a certificate using a NULL key_pem value,
which would have failed or crashed.

Use g_propagate_error() correctly to avoid this.

Coverity CID: 1325403
2015-10-03 10:58:18 +01:00
Philip Withnall
9275be383f glocalfile: Fix memory leak in find_topdir_for()
Coverity CID 1325398.
2015-10-03 10:48:46 +01:00
Olivier Crête
be732677f5 gio: Add G_IO_ERROR_MESSAGE_TOO_LARGE
Corresponding to EMSGSIZE, for when UDP datagrams are rejected due to
being too big.

https://bugzilla.gnome.org/show_bug.cgi?id=752240
2015-10-01 14:31:40 +01:00
Philip Withnall
1086507e75 gsocket: Fix error behaviour of g_socket_send_messages()
If an error in the underlying sendmmsg() syscall occurs after
successfully sending one or more messages, g_socket_send_messages()
should return the number of messages successfully sent, rather than an
error. This mirrors the documented sendmmsg() behaviour.

This is a slight behaviour change for g_socket_send_messages(), but as
it relaxes the error reporting (reporting errors in fewer situations
than before), it should not cause problems.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-10-01 14:10:10 +01:00
Philip Withnall
f62cbfc022 gsocket: Add g_socket_receive_messages()
Add support for receiving multiple messages with a single system call,
using recvmmsg() if available. Otherwise, fall back to looping over
g_socket_receive_message().

This adds new API, g_socket_receive_messages(), and corresponding unit
tests.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-10-01 14:10:10 +01:00
Philip Withnall
a0cefc2217 gsocket: Switch internal functions from blocking booleans to timeouts
In order to support per-operation timeouts on new API like
g_socket_receive_messages(), the internal GSocket API should use
timeouts rather than boolean blocking parameters.

   (timeout == 0) === (blocking == FALSE)
   (timeout == -1) === (blocking == TRUE)
   (timeout > 0) === new behaviour

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-10-01 13:59:08 +01:00
Philip Withnall
7f985b35ce gsocket: Factor out blocking parameter from g_socket_receive_message()
This will make future API additions easier. The factored version is
internal for the time being.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-10-01 13:58:44 +01:00
Philip Withnall
5d68947466 gsocket: Split out functions to convert to and from struct msghdr
As new methods are added to GSocket, we don’t want to duplicate this
code, so factor it out.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-10-01 13:58:27 +01:00
Philip Withnall
8c4c16ddf4 giotypes: Add GInputMessage struct
This complements the GOutputMessage struct. It will shortly be used for
adding a g_socket_receive_messages() function, but needs to be committed
first to allow some internal refactoring of GSocket.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-10-01 13:58:07 +01:00
Philip Withnall
ad7250ab53 giostream: Fix a typo in the documentation for g_io_stream_close() 2015-09-30 12:58:08 +01:00
Ryan Lortie
202a9c3497 GLocalFile: return text/plain for empty files
Previously, GLib returned text/plain for empty files.

This is important because people may want to open empty (eg:
just-created) text files with the text editor.

An unintended side-effect of b6fc1df022
caused GLib to start returning application/octet-stream instead of
text/plain for these files.

This commit is essentially a revert of that commit, with a different
solution: we move the special-case up a bit in the function and
hard-code it to text/plain.

This change does not exactly maintain the old behaviour: previously, a
"fast" lookup would have returned application/octet-stream on an empty
file and now it will return text/plain.  I consider this to be an
improvement (since we're returning better data) and don't expect it to
cause problems.

https://bugzilla.gnome.org/show_bug.cgi?id=755795
2015-09-29 12:29:10 -04:00
Philip Withnall
21809c8c0f giostream: Fix some typos in the GIOStream documentation
This doesn’t change the meaning of the documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=735754
2015-09-28 13:02:19 +01:00
Philip Withnall
363fa18223 gsocket: Fix documentation for g_socket_send_message()
It is no longer the most fully featured version of this function —
g_socket_send_messages() stole that dubious honour with 2.44.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-09-28 12:47:09 +01:00
Philip Withnall
347e4a75ec gsocket: Clarify GSocket:blocking doesn’t apply to ops with a parameter
Operations which take an explicit blocking parameter are completely
unaffected by GSocket:blocking.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-09-28 12:47:09 +01:00
Philip Withnall
8fdc670188 gsocket: Clarify flags documentation for g_socket_receive_message()
The API design here is a bit awkward — the in/out flags argument should
actually have been an in flags argument and an out msg_flags argument.
Clarify that a bit in the documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-09-28 12:47:07 +01:00
Benjamin Gilbert
4745c08220 win32: Fix link error with _wstat32i64() on 64-bit
_wstat32i64() doesn't exist in msvcrt.dll.  This doesn't cause a problem
on 32-bit Windows because mingw-w64 #defines _wstat32i64 to _wstati64,
but on 64-bit Windows we get a link error.

In addition, _wstat32i64() takes a struct _stat32i64 *, but
GLocalFileStat is #defined to struct _stati64, which is not the same
type on 64-bit Windows.

Fix by using _wstati64().

https://bugzilla.gnome.org/show_bug.cgi?id=749161
2015-09-27 16:07:27 -04:00
Matthew Waters
8297ea8bad win32: fix incorrect specifier
error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has
   type ‘gsize {aka long long unsigned int}’ [-Werror=format=]

https://bugzilla.gnome.org/show_bug.cgi?id=755154
2015-09-21 08:37:29 -04:00
Matthias Clasen
2bc094264b Documentation fixups
Various parameter fixups and symbol list additions.
2015-09-21 06:44:58 -04:00
Murray Cumming
846e206146 GListModel docs: It's get_n_items(), not get_length(). 2015-09-16 14:30:29 +02:00
Matthias Clasen
a7b2b5686a Fix make check
I forgot to add the include to make I_() known in gdbusdaemon.c
2015-09-13 13:37:10 -04:00
Matthias Clasen
9acd0ddbf3 gio: Intern all signal names beforehand
This avoids pointless copying of static strings.
2015-09-12 11:13:45 -04:00
Sebastian Dröge
20e8b63477 gioerror: Add more mappings for WinSock error codes
https://bugzilla.gnome.org/show_bug.cgi?id=754560
2015-09-08 17:39:07 +03:00
Chun-wei Fan
041e77249a Cleanup and Enhance the MSVC Project Generation
Make use of the common autotools module that is used to generate the MSVC
project files from their respective templates so that the main build files
beccome cleaner, and enhance them in a way that the headers that should be
installed can be written to the property sheets during 'make dist', so that
the chances of missing headers for MSVC builds can be greatly reduced.

Also use this autotools module to fill in the projects for
glib-compile-schemas and glib-compile-resources.

https://bugzilla.gnome.org/show_bug.cgi?id=735429
2015-09-03 19:10:06 +08:00
Ting-Wei Lan
4a09d0cf7a Fix return value error in g_list_store_sort 2015-09-02 01:19:40 +08:00
Emmanuele Bassi
b04c565f33 gio: Link against gmodule when building tools
Otherwise cross-compilation will fail with linker errors.

https://bugzilla.gnome.org/show_bug.cgi?id=753745
2015-09-01 10:40:24 -04:00
Emmanuele Bassi
5ce70917df Drop binary checks when cross-compiling
We don't need to run binaries we just built in order to successfully
build GLib and friends any more.

Since commit b74e2a7, we don't need to run glib-genmarshal when building
GIO; since commit f9eb9eed, all our tests (including the ones that do
need to run binaries we just built) are only built when running "make
check", instead of unconditionally at every build.

This means that we don't need to check for existing, native binaries
when cross-compiling, and fail the configuration step if they are not
found — which also means that you don't need to natively build GLib for
your toolchain, in order to cross-compile GLib.

We can also use the cross-compilation conditional, and skip those tests
that require a binary we just built in order to build.

https://bugzilla.gnome.org/show_bug.cgi?id=753745
2015-09-01 10:40:24 -04:00
Matthias Clasen
1dec512a66 Revert "GSettings: delay backend subscription"
This reverts commit 8ff5668a45.

This change has had considerable fallout, and there was no
follow-up to address it.

https://bugzilla.gnome.org/show_bug.cgi?id=733791
2015-09-01 10:21:26 -04:00
Matthias Clasen
7fff264777 Revert "GSettings: fix check for delaying backend subscription"
This reverts commit d511d6b37f.
2015-09-01 10:18:23 -04:00
Dan Winship
9f2e3f6b72 gtestutils: add g_assert_cmpmem()
Add a test macro to compare two buffers (which are not already known
to be the same length) for equality.

https://bugzilla.gnome.org/show_bug.cgi?id=754283
2015-08-31 13:59:48 -04:00
Matthias Clasen
34ec21fab5 win32: Fix a g_once_init_enter call
g_once_init_enter must be given a gsize-sized location.
A gboolean doesn't qualify. This broke the build on win64.

http://bugzilla.gnome.org/show_bug.cgi?id=754307
2015-08-31 13:48:22 -04:00
Matthias Clasen
591eabcbbc Remove an unused variable 2015-08-31 13:43:47 -04:00
Matthias Clasen
e5734c37a6 Add g_list_store_sort
GListStore already has a g_list_store_insert_sorted function,
which can be used to keep the list sorted according to a fixed
sort function. But if the sort function changes (as e.g. with
sort columns in a list UI), the entire list needs to be
resorted. In that case, you want g_list_store_sort().

https://bugzilla.gnome.org/show_bug.cgi?id=754152
2015-08-31 10:40:45 -04:00
Michael Catanzaro
516adb99c0 Add certificate chain construction test
Enhance GTestTlsBackend to allow setting the issuer property of
GTlsCertificates, and add a test to ensure certificate chain
construction with g_tls_certificate_new_from_pem() works as expected.

https://bugzilla.gnome.org/show_bug.cgi?id=754264
2015-08-29 08:43:29 -05:00
Michael Catanzaro
587068c969 GTlsCertificate: fix loading of chain with private key
If a private key (or anything, in fact) follows the final certificate in
the file, certificate parsing will be aborted and only the first
certificate in the chain will be returned, with the private key not set.
Be tolerant of this, rather than expecting the final character in the
file to be the newline following the last certificate.

https://bugzilla.gnome.org/show_bug.cgi?id=754264
2015-08-29 08:43:29 -05:00
Dan Winship
1ab3e3ed3e gsocket: add a wrapper around g_set_error() to avoid extra work
If @error is NULL then we don't even need to evaluate the remaining
arguments. And if errno is EWOULDBLOCK, then no one should see the
error message anyway, so don't bother g_strdup_printf'ing up a pretty
one.

https://bugzilla.gnome.org/show_bug.cgi?id=752769
2015-08-29 08:46:25 -04:00
K. Adam Christensen
f8341badb8 gfileenumerator: Don't leak memory if out_info is NULL
In the unusual case where one just wants the filenames, avoid
a leak.

https://bugzilla.gnome.org/show_bug.cgi?id=754211
2015-08-28 08:17:24 -04:00
Dan Winship
7da3922d05 gdbus: fix race condition in connection filter freeing
If you called g_dbus_connection_remove_filter() on a filter while it
was running (or about to be run) in another thread, its GDestroyNotify
would be run immediately, potentially causing the filter thread to
crash.

Fix this by refcounting the filters, and using the existing mechanism
for running a GDestroyNotify in another thread in the case where the
the gdbus thread is the one that frees it.

Also, add a bit of documentation explaining this (and add a related
clarification to g_dbus_connection_signal_subscribe()).

https://bugzilla.gnome.org/show_bug.cgi?id=704568
2015-08-24 16:30:05 -04:00
Philip Withnall
76c1f78cb9 gfile: Clarify g_file_get_parent() documentation
Clarify that a parent in this case has to be an immediate parent, not an
arbitrary ancestor several levels up in the tree.
2015-08-24 10:38:27 +01:00
Philip Withnall
50a65cc38a gfile: Clarify g_file_get_path() documentation
Clarify that the returned path (if non-NULL) is guaranteed to be
absolute and canonical, but might still contain symlinks.
2015-08-24 10:37:51 +01:00
Kalev Lember
02f9e84709 gdbus: Add a missing include
This fixes the build on non-unix platforms, such as win32 where
gunixfdlist.h is not included.
2015-08-22 23:13:33 +02:00
Ryan Lortie
b6fc1df022 GLocalFileInfo: don't content-sniff zero-length files
This will prevent attempting to read from some files that appear normal but are
really device-like, such as those in /proc and /sys.

If we can't stat() the file then don't bother attempting to sniff, either.

https://bugzilla.gnome.org/show_bug.cgi?id=708525
2015-08-21 01:00:49 -04:00
Ting-Wei Lan
8f662e7259 glocalfileinfo: Support file creation time on FreeBSD and NetBSD
FreeBSD and NetBSD have field st_birthtim and st_birthtime in struct stat,
respectively, which can be used to get file creation time on supported file
systems such as UFS2 and tmpfs.

https://bugzilla.gnome.org/show_bug.cgi?id=749492
2015-08-21 00:52:50 -04:00
Christophe Fergeau
60a6ae6f0b Fix GError leak in g_file_query_writable_namespaces()
gvfs commit b358ca "Make sure metadata is always returned by
query_writable_namespaces()" changed the
query_writable_namespaces vfunc to never return NULL, but the error
checking in g_daemon_file_query_writable_namespaces still assumes vfunc
failure implies NULL return value and GError set. This causes a memory
leak as on failure the GError will be set but the vfunc implementation
will have created its own default list so NULL will not be returned, and
the GError will never be cleared.

This commit directly checks if the GError is set to detect failures,
my_error is directly dereferenced in the error block anyway.

This also removes an unneeded call to g_file_attribute_info_new(); as
the vfunc always returns us a non-NULL GFileAttributeInfoList.

https://bugzilla.gnome.org/show_bug.cgi?id=747364
2015-08-21 00:45:00 -04:00
Matthias Clasen
fa17536598 Code cleanup 2015-08-21 00:43:54 -04:00
Matthias Clasen
b67dac56e3 Add a test for cross dir moves
This is a test that is described in

https://bugzilla.gnome.org/show_bug.cgi?id=742849
2015-08-21 00:41:09 -04:00
Matthias Clasen
3498f29b81 Test resource filesystem attributes 2015-08-21 00:08:57 -04:00
Matthias Clasen
d942c64267 resource file: Return some filesystem info
We now return "resource" as the filesystem type, and state
that the filesystem if readonly.
2015-08-21 00:01:12 -04:00
Matthias Clasen
1bfdcc8499 resource file: Add a dummy file monitor
This avoids the fallback to polling in GFile, which is unnecessarily
expensive for a resource which can never change.
2015-08-20 23:48:51 -04:00
Matthias Clasen
b995c08bf3 Remove unused files
We no longer have GLocalDirectoryMonitor implementations.
These files were not included in the build for a while now.
2015-08-20 22:31:41 -04:00
Matthias Clasen
d66e3f57cd Add more directory monitoring tests
These tests clear up a misunderstanding of mine: Monitoring
nonexisting files and directories *does* work with the inotify
implementation, it just has a very long timeout for scanning
for missing locations, so the test needs to take that into
account.
2015-08-20 22:30:19 -04:00
Matthias Clasen
ee31d492d8 poll file monitor: Don't reimplement g_strcmp0
We have that function now, so use it.
2015-08-20 21:10:49 -04:00
Debarshi Ray
fa0f51ddf8 fileinfo: Add a G_FILE_ATTRIBUTE_STANDARD_IS_VOLATILE attribute
This is meant for opaque, non-POSIX-like backends to indicate that the
URI is not persistent. Applications should look at
G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET for the persistent URI.
Examples of such backends could be a portal for letting sandboxed
applications access the file-system, or a database-backed storage like
Google Drive.

In these cases, the user visible file and folder names are different
from the real identifiers, used by the backend. So, a request to
create google-drive://user@gmail.com/foo/New\ File, would actually
lead to google-drive://user@gmail.com/foo/bar on the server even though
the user visible name is still "New File". Since the server-defined URI
is persistent and sanity-checked by the backend, it is recommended that
applications switch to it as soon as possible. Backends will try to
keep a mapping from "fake" to "real" URIs, but those are only on a
best effort basis. They might not be persistent or have the same
guarantees as the "real" URIs.

https://bugzilla.gnome.org/show_bug.cgi?id=741602
2015-08-20 18:40:02 +02:00
Matthias Clasen
4a076032cf More file monitor tests
Test regular writes and attribute changes with a file monitor,
as well as various file changes under a directory monitor.
2015-08-19 20:33:46 -04:00
Dan Winship
8d8a1c205b fix previous 2015-08-19 16:21:46 -04:00
Dan Winship
c686245141 gdbus: don't warn when returning a value on a closed connection
g_dbus_method_invocation_return_value(), etc, don't have GError
parameters (which makes sense since they won't usually return errors,
and there's not much you could do if they did), so in the rare case
when something does go wrong, they print a warning.

However, there is at least one situation where the warning is a bad
idea: if you are using private bus connections, and a client connects,
makes a request, and then disconnects before getting the response.
Given that there's nothing the caller can do to prevent this case from
getting hit (since the client might not disconnect until after the
call to g_dbus_method_invocation_return_value() starts) and given that
the server can never actually know for sure that the client has
received the response (it might disconnect after reading the response,
but before processing it), just kill the warning in this case.

https://bugzilla.gnome.org/show_bug.cgi?id=753839
2015-08-19 16:08:48 -04:00
Dan Winship
656494a784 gpermission: fix async error returns
a8eedd00 broke the error return values from
g_permission_acquire/release_async() on GSimplePermission. Fix that.
2015-08-19 15:45:11 -04:00
Matthias Clasen
8c32f7c448 Add some file monitoring tests
Add a new test which checks that atomically replacing a file that
is being monitored by GFileMonitor produced the expected events.

The test can easily be expanded to cover other file monitoring
scenarios.
2015-08-19 14:57:53 -04:00
Matthias Clasen
ac78d14125 inotify: Fix handling of paired events for atomic replace
After the big file monitoring rewrite, we only put the IN_MOVED_FROM event
in the queue for such pairs. It matches INOTIFY_DIR_MASK and thus we call
ip_dispatch_event on it, but that function was filtering it out because
the filename in the 'from' event is the one of the temp file, not the
one we are monitoring. That name is in the 'to' event, so compare it as
well, and let the event passin that case.

There is another instance of this check in glocalfilemonitor.c, which is
corrected here as well.

https://bugzilla.gnome.org/show_bug.cgi?id=751358
2015-08-19 14:57:53 -04:00
Janusz Lewandowski
5d014a802a Add a g_dbus_connection_register_object_with_closures function
This is a binding-friendly version of g_dbus_connection_register_object.
Based on a patch by Martin Pitt and the code of g_bus_watch_name_with_closures.

https://bugzilla.gnome.org/show_bug.cgi?id=656325
2015-08-18 16:41:12 -04:00
Felix Riemann
34277d6996 gio: g_menu_item_set_icon should not fail if icon is NULL
It allows passing a NULL icon to unset the icon and thus should not
log a critical warning if used like that.

https://bugzilla.gnome.org/show_bug.cgi?id=753285
2015-08-10 19:00:24 +02:00
Dan Winship
a8eedd00a7 gio: fix a leftover GSimpleAsyncResult usage
And remove remaining unnecessary gsimpleasyncresult.h includes
2015-08-07 09:50:16 -04:00
Dan Winship
e02fa68068 gsettings-tool: fix deprecated call 2015-08-07 09:50:13 -04:00
Dan Winship
ff3dee4bf6 gdbus: fix gdbus-exit-on-close for gdbusconnection change 2015-08-07 09:49:57 -04:00
Colin Walters
66bc9660c4 gdbusconnection: Don't g_printerr() when exiting
exit-on-close for a DBus connection is a completely normal thing.  On
a regular GNOME login, gdm retains the X server, but terminates the
session login bus and associated helpers like gnome-settings-dameon,
the a11y tools, etc.

I've seen several downstream reports of confusion as to what these
apparent error messages mean in the system log.  It doesn't help
that they're so obtuse.

We're also printing them to stderr, when this is not an error.

The reason this was introduced is presumably some people were confused
as to why their process exited when the system bus did.  But the
solution for that I believe is documentation, not printing stuff to
everyone's system log in normal operation.

https://bugzilla.gnome.org/show_bug.cgi?id=742386
2015-08-06 08:51:02 -04:00
Matthias Clasen
905e916573 Don't leak an error
The previous commit introduced a possible memory leak in cases
where we get a G_IO_ERROR_CLOSED error. Make sure to always
free an error, if we got one.

https://bugzilla.gnome.org/show_bug.cgi?id=753278
2015-08-05 17:18:48 -04:00
Stef Walter
b3fcb1442e gdbus: Don't use g_assert_no_error() GDBusObjectManagerServer
There are real world cases where emitting signals can fail, such
as if the DBus connection closes. Asserting and aborting the process
in these cases is just plain lazy.

Ignore the errors when the connection is closed, and turn the
others into warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=753278
2015-08-05 13:43:08 +02:00
Philip Withnall
6b652b1a2e gio: Fix application of GNetworkMonitor:network-metered patch
The wrong patch from https://bugzilla.gnome.org/show_bug.cgi?id=750282
was applied, causing test failures due to not implementing the property
on GNetworkMonitorBase (plus some other omissions).

Fix that by reverting commit a80e7db1a8
and re-applying the correct patch over the top.

https://bugzilla.gnome.org/show_bug.cgi?id=750282
2015-07-29 11:58:02 +01:00
Philip Withnall
7f195ac956 gresource: Clarify error docs for g_resource_enumerate_children()
Document that it returns G_RESOURCE_ERROR_NOT_FOUND if the path doesn’t
exist.
2015-07-28 10:14:17 +01:00
Richard Hughes
a80e7db1a8 gio: Add network metered information to GNetworkMonitor
Add a property to GNetworkMonitor indicating if the network
is metered, e.g. subject to limitations set by service providers.

The default value is FALSE

https://bugzilla.gnome.org/show_bug.cgi?id=750282
2015-07-27 06:44:52 -04:00
Matthias Clasen
c885d42751 Add tests for GApplication::handle-local-options 2015-07-26 21:41:08 -04:00
Christophe Fergeau
243d740c04 gapplication: Stop handle-local-options emission on errors
A signal accumulator can return TRUE to continue signal emission, and
FALSE to stop signal emission. handle-local-options callbacks can return
« return a non-negative option if you have handled your options and
want to exit the process ».

Currently, g_application_handle_local_options_accumulator (the
accumulator for the handle-local-options signal) returns TRUE on
non-negative return value (ie continue signal emission), and returns
FALSE on negative return values (ie when the default option processing
should continue).
This return value seems backward as on >= 0 values, subsequent
handle-local-options callbacks could overwrite the 'exit request' from
the handler, while on < 0 values, the handle-local-options processing
could end up early if several callbacks are listening for this signal.
In particular, the default handler for this signal
(g_application_real_handle_local_options) always returns -1 and will
overwrite >= 0 return values from other handlers.

This commit inverts the check so that signal emission stops early when
one of the handle-local-options callbacks indicates it wants processing
to stop and the process to exit.

https://bugzilla.gnome.org/show_bug.cgi?id=751598
2015-07-26 21:41:08 -04:00
Christophe Fergeau
2551685cf6 gapplication: Fix typos in handle-local-options API doc
The @options parameter was missing an 's', and the name of
g_application_command_line_get_options_dict() was not correct.

https://bugzilla.gnome.org/show_bug.cgi?id=751598
2015-07-26 21:41:08 -04:00
Philip Withnall
8520ae3ffa gsocket: Factor out blocking parameter from g_socket_send_messages()
This will make future API additions easier. The factored version is
internal for the time being.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-07-23 11:37:18 +01:00
TingPing
3cc349b04e win32: Replace usage of __wgetmainargs()
It was an internal function that has been removed with VS 2015

Use g_win32_get_command_line() or CommandLineToArgvW() directly.

https://bugzilla.gnome.org/show_bug.cgi?id=741822
2015-07-23 04:22:59 -04:00
Arun Raghavan
be7de8a7fd gdbusconnection: Fix signal subscription documentation
https://bugzilla.gnome.org/show_bug.cgi?id=752656
2015-07-21 15:20:23 -04:00
Dan Winship
de1bd45fe9 gio/tests/task: fix for change to cancellation behavior
Multiple tasks cancelled at the same time now complete in the opposite
order from how they used to. Fix the test to not assume any particular
order.
2015-07-20 17:35:43 -04:00
Paolo Borelli
45e99833e3 Move a unit test to the right file
Move a test for threaded socket service to socket-service.c.
2015-07-20 00:00:42 +02:00
Paolo Borelli
e1d44799c0 socketservice: add an "active" property
We already have start, stop and is_active methods, but turning it
into a real property is useful for a few reasons:
 - it allows us to bind the property to an UI or a setting
 - it allows us to get notified when the state changes
 - it allows us to instantiate objects directly in the stopped state

https://bugzilla.gnome.org/show_bug.cgi?id=752089
2015-07-20 00:00:02 +02:00
Paolo Borelli
a223796d0b networkaddress: use free_full
https://bugzilla.gnome.org/show_bug.cgi?id=752293
2015-07-19 23:53:35 +02:00
Matthias Clasen
0c12177514 notification: Add an assertion to clarify
Coverity doesn't see that g_enum_get_value will never return
NULL here since we always pass it a valid enum value. Help
it along with an assertion.
2015-07-17 16:46:26 -04:00
Xavier Claessens
dafc454e70 GAsyncInitable: Fix leaked object when using _newv_async 2015-07-08 14:38:16 -04:00
Ryan Lortie
7ed76a4eca file monitors: report MOVED only with both sides
Make sure we know the destination file before reporting a MOVED event.
Otherwise, we should just fall back to reporting it as a DELETED.

https://bugzilla.gnome.org/show_bug.cgi?id=751731
2015-07-06 10:22:36 -04:00
Руслан Ижбулатов
e337fe3163 W32: Add back the dummy g_app_info_reset_type_associations() 2015-07-02 11:06:17 +00:00
Руслан Ижбулатов
155a688635 W32: Add a g_app_info_get_all_for_type() implementation
Also add g_app_info_get_fallback_for_type() and
g_app_info_get_recommended_for_type() as proxies for
g_app_info_get_all_for_type(), until gcontenttype support is improved.
2015-07-02 11:03:47 +00:00
Руслан Ижбулатов
b9d919bd8f Don't ref a NULL pointer 2015-07-02 11:03:47 +00:00
Stef Walter
f405f42115 gsocket: Don't g_error() if file-descriptor is not a socket
This code was out of date with current coding practices.

Nowadays it's common to receive file descriptors over environment
variables from other processes like systemd. The unit files that
control these file descriptors are configurable by sysadmins.

It is not (necessarily) a programmer error when g_socket_details_from_fd()
is called with a file descriptor that is not a socket. It can also
be a system and/or configuration error.

https://bugzilla.gnome.org/show_bug.cgi?id=746339
2015-07-02 12:24:11 +02:00
Iain Lane
f2c1cfe8c7 gio/tests/appmonitor: Delete file before checking for changed event
In 4e7d22e268, deleting the file was moved
after the assertion which checks for the changed event that results from
it being deleted. This is the wrong way around and makes the assertion
fail.

Move the deletion back up before we check the condition. delete_app is
no longer an idle callback so it can be made void. The change
notification might come in when the loop isn't running now, so don't try
to quit if it isn't running. In this case we'll wait for the three
second timeout and the test will still pass.

https://bugzilla.gnome.org/show_bug.cgi?id=751737
2015-07-01 12:11:23 +02:00
Dan Winship
b25fa8feed gio/tests/socket.c: fix on OS X
The semantics of calling shutdown() on a dup()ed socket aren't
well-specified, so don't require any specific behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=747676
2015-06-29 14:40:56 -04:00
Dan Winship
b97d666b2f gio/tests/socket.c: clean up a test case a bit 2015-06-29 14:40:56 -04:00
Matthias Clasen
368c3f205f GTask: Remove unused function
We no longer resort the queue, so this function can go.

https://bugzilla.gnome.org/show_bug.cgi?id=751160
2015-06-29 08:20:26 -07:00
Matthias Clasen
e419e1c4e2 GTask: Avoid resorting
When a task is cancelled, we want to move it to the front
of the queue - our sort function does that for us, but there
is no need to resort the entire queue here, we can just
move the one item and be done with it. This uses just-introduced
threadpool api for this purpose.

https://bugzilla.gnome.org/show_bug.cgi?id=751160
2015-06-29 08:20:26 -07:00
Dan Winship
f9af40a133 Fix a FIXME in the WinXP inet_pton() implementation
https://bugzilla.gnome.org/show_bug.cgi?id=749912
2015-06-29 10:47:35 -04:00
Wouter Paesen
a4c3ab58cc Fix g_inet_address_to_string() on XP
[This patch originally also included an equivalent to the fix that was
committed in 3e29dada, but that was not the complete fix for the bug.]

https://bugzilla.gnome.org/show_bug.cgi?id=749911
2015-06-29 10:46:21 -04:00
Kalev Lember
c612fcab0f gapplication: Initialize backend before withdrawing notifications
Make sure to initialize the notification backend in
g_application_withdraw_notification() the same way as is done in
g_application_send_notification().

This makes it possible for an app to withdraw notifications it has sent
in a previous execution of the application.

https://bugzilla.gnome.org/show_bug.cgi?id=750625
2015-06-23 14:22:41 +02:00
Matthias Clasen
4e7d22e268 Fix distcheck
The appmonitor test was sometimes leaving files behind, causing
distcheck some heartburn.
2015-06-23 06:56:26 -04:00
Chun-wei Fan
3e29dadae4 gio/ginetaddress.c: Fix Windows XP inet_pton() Emulation
We need to be more careful when we try to assign values to gpointers, so
that means we have to assign the value to the properly-dereference
gpointer, so that the assigned value will be retained after the function
returns.  This code will be dropped soon, but it is done for XP
compatibility's sake for 2.44.

Should fix the issue reported in bug 730352 comment #24.
2015-06-23 13:52:25 +08:00
Tim-Philipp Müller
fd789f1187 gsocket: avoid unnecessary select in _send_messages() and _receive_message()
For performance reasons we should always try to send or
receive our messages first and only wait for more space
or data to become available if we get an EAGAIN (and
are in blocking mode).

https://bugzilla.gnome.org/show_bug.cgi?id=751122
2015-06-21 10:28:14 +01:00
Paolo Borelli
9e85f60ec6 socketclient: annotate the connection param of "event" as nullable
When emitting the RESOLVING/RESOLVED events the connection param is
set to NULL.
2015-06-18 16:33:31 +02:00
Philip Withnall
4b02bfd6ee gfile: Clarify that g_file_replace_contents() uses atomic renames
It uses g_file_replace() internally, so is inherently safe.

Though it might vomit .goutputstream-XXXXXX files all over the place
occasionally.
2015-06-17 09:25:49 +01:00
Cosimo Cecchi
0d6e200384 gresource: fix a couple of typos in documentation 2015-06-11 15:56:25 -07:00
Matthias Clasen
1102e6f9ca Allow property actions to invert booleans
This can be handy when you want to change the sense of a toggle
in the UI without rewriting the underlying logic. Currently, this
is just exposed as a construct-only property. We may add a
convenience wrapper or a special !property syntax for this later.

https://bugzilla.gnome.org/show_bug.cgi?id=728489
2015-06-10 21:59:28 -04:00