Commit Graph

18590 Commits

Author SHA1 Message Date
Philip Chimento
9e46b2ef11 gtester: Explicitly convert arguments of g_assert_cmpfloat()
Using g_assert_cmpfloat() with a float or double causes warnings on the
newest Clang version, because the macro internally promotes all values to
a long double, which Clang warns about. Casting explicitly removes the
warning.

Closes: #1377
2018-06-21 00:20:55 -07:00
Philip Chimento
e004d5f397 build: Look for copied Objective-C files in builddir
Without this, the build fails in the OS_COCOA case due to not finding
gnextstepsettingsbackend.c in $(srcdir).
2018-06-20 23:03:21 -07:00
Xavier Claessens
b9aed426d1 Merge branch '258-variable-names' into 'master'
gobject: Add prefixes to variables in G_VALUE_COLLECT*() macros

Closes #258

See merge request GNOME/glib!126
2018-06-20 16:07:59 +00:00
Philip Withnall
877f20d0d8 gobject: Add prefixes to variables in G_VALUE_COLLECT*() macros
This makes them a bit more unique (and, crucially, in the g_* namespace)
to avoid shadowing collisions with calling code.

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

https://gitlab.gnome.org/GNOME/glib/issues/258
2018-06-20 16:00:48 +01:00
Philip Withnall
0b9cdf07f7 Merge branch 'lrn/attachconsole' into 'master'
W32: add std stream redirection envvar options

Closes #1304

See merge request GNOME/glib!104
2018-06-20 11:21:43 +00:00
Philip Withnall
a3a6c516c4 gunixmounts: Stop considering cifs/nfs as system file systems
They’re network file systems, but not system file systems (in the sense
that procfs is a system file system). This fixes them disappearing from
the sidebar in the UI.

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

https://gitlab.gnome.org/GNOME/glib/issues/1424
2018-06-20 12:16:34 +01:00
Руслан Ижбулатов
460cc723ad W32: add std stream redirection envvar options
This commit adds two W32-only environmental variable checks:
* G_WIN32_ALLOC_CONSOLE, if set to 1, will force glib to create
  a new console if the process has no console by itself.
  This option is for GUI apps that are launched from GUI
  processes, in which case there's no console anywhere near them.
* G_WIN32_ATTACH_CONSOLE, if set to a comma-separated list of
  standard stream names (stdint, stdout, stderr), will reopen
  a given std stream and tie it to the console (using existing console
  or parent console).
  This works either with the other option (to create a console),
  or if the app is launched from a console process (often the
  case for developers).
  The redirection is done with freopen(), dup() and dup2().
  If everything goes well, C file descriptors 0, 1 or 2 will
  be bound to stdin, stdout and stderr respectively (only for
  streams listed in the envrionmental variable), and so will
  be stdio streams by the same names.

With these it's possible to see the output of g_log*() functions
when running GTK4 applications, which are linked as GUI applications,
and thus do not get a console by default.

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

Fixes issue #1304
2018-06-20 10:53:30 +00:00
Philip Withnall
d4cb3dfcaf Merge branch '1423-gmountoperation-tests' into 'master'
Add unit tests for GMountOperation

Closes #1423

See merge request GNOME/glib!124
2018-06-20 09:44:56 +00:00
Allison Lortie
83a2e85ec8 glib-compile-schemas: Handle per-desktop overrides
Add a new syntax to override files: if the group name has a ':' in it,
it indicates that we want to override the default values of keys for
only one desktop. For example:

[org.gnome.desktop.interface:Unity]
font-name='Ubuntu 12'

Will override the settings, only if "Unity" is found in
XDG_CURRENT_DESKTOP. Multiple per-desktop overrides can be specified
for a given key: the one which comes first in XDG_CURRENT_DESKTOP will
be used.

https://bugzilla.gnome.org/show_bug.cgi?id=746592
2018-06-19 19:18:58 +03:00
Allison Lortie
6ca449672d gsettingsschema: Allow per-desktop overrides
Recognise a new 'd' option in schema keys which gives a dictionary of
per-desktop default values. This dictionary is searched for the items
found in XDG_CURRENT_DESKTOP, in the order. If nothing matches (or if
the option is missing) then the default value is used as before.

This feature was requested by Alberts Muktupāvels and this patch is
based on an approach devised by them.

https://bugzilla.gnome.org/show_bug.cgi?id=746592
2018-06-19 19:18:58 +03:00
Allison Lortie
c2e7f31697 gsettings: cleanup default value lookup
There are a couple of different ways (and soon one more) to access the
default value of a key. Clean up the various places that access this to
avoid duplication.

https://bugzilla.gnome.org/show_bug.cgi?id=746592
2018-06-19 19:18:58 +03:00
Philip Withnall
1c673535fe tests: Add basic tests for GMountOperation
There were previously no tests for it. These take gmountoperation.c up
to 85.5% coverage of lines.

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

https://gitlab.gnome.org/GNOME/glib/issues/1423
2018-06-19 15:46:59 +01:00
Emmanuele Bassi
df28cfe0b5 Merge branch '896-variant-type-docs' into 'master'
Documentation and typing improvements for GVariant bytes

Closes #896

See merge request GNOME/glib!117
2018-06-19 14:15:37 +00:00
Xavier Claessens
720fc3fadc Merge branch '807-g-file-dup-docs' into 'master'
Document why g_file_dup() is useful, instead of g_object_ref()

Closes #807

See merge request GNOME/glib!122
2018-06-19 13:47:37 +00:00
Philip Withnall
6284749487 gfile: Document usefulness of g_file_dup()
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/807
2018-06-19 12:36:37 +01:00
Philip Withnall
40a84b3d1c Merge branch 'wip/lantw/freebsd-kqueue-complex' into 'master'
FreeBSD kqueue file monitor fixes: the complex parts

See merge request GNOME/glib!77
2018-06-19 11:19:43 +00:00
Philip Withnall
dd51b05e19 Merge branch 'non-atomicity-of-g_file_set_contents' into 'master'
gfileutils: document non-atomicity of g_file_set_contents()

See merge request GNOME/glib!118
2018-06-19 11:13:50 +00:00
Philip Withnall
f784df722d Merge branch 'wip/hughsie/EOPNOTSUPP' into 'master'
Handle EOPNOTSUPP error from splice()

See merge request GNOME/glib!112
2018-06-19 11:13:37 +00:00
Philip Withnall
e0f4439cad Merge branch 'wip/oholy/gio-bash-completion' into 'master'
Add bash completion for gio tool

See merge request GNOME/glib!115
2018-06-19 11:12:00 +00:00
Philip Withnall
0e49e22ce0 Merge branch 'strlcpy-comment' into 'master'
Meson: Add comment telling why we test strlcpy/strlcat

See merge request GNOME/glib!121
2018-06-18 13:45:47 +00:00
Xavier Claessens
b97453c3e6 Meson: Add comment telling why we test strlcpy/strlcat 2018-06-18 09:28:55 -04:00
Ting-Wei Lan
e714e1e951 kqueue: Use the worker context to schedule rescanning of missing files
This makes it consistent with the file monitor itself, which already
attaches kqueue event sources to the worker context.
2018-06-17 11:26:32 +08:00
Ting-Wei Lan
454a9f8de9 tests: Make testfilemonitor test work with kqueue
check_expected_events is heavily modified in this commit to tolerate
event loss and allow renaming to be reported as creation and deletion.

This fixes test failure on FreeBSD.
2018-06-17 11:26:32 +08:00
Ting-Wei Lan
09c019a4f0 kqueue: Make it possible to pass file monitor tests
Previously, kqueue file monitor only add event sources for directories
regardless of the type of the file being monitored. Doing so may be
possible on inotify, but it is not sufficient on kqueue. Watching a
directory on kqueue doesn't report changes made to files under it, and
we must watch files themselves to get notified. This problem is fixed
by adding a second watch for non-directory file monitors, and the result
is that we are now able to receive 'CHANGED' and 'ATTRIBUTE_CHANGED'
events for non-directory files.

Since having two watches on one file monitor requires many code changes
to work properly, this commit also changes the following things:

 - NOTE_ALL macro is now replaced by note_all inline function. Since the
   kqueue backend is shared by all BSD operating systems, there are a
   few difference between these systems. It is easier to do '#ifdef'
   check in a function than in a macro.

 - Both g_kqueue_file_monitor_callback and g_kqueue_file_monitor_cancel
   now holds a lock before accessing kqueue_sub structs. This fixes a
   crash when these two functions are called from different threads,
   causing g_kqueue_file_monitor_callback to access freed memory.

 - 'mask' variable in g_kqueue_file_monitor_callback is now removed.
   The usage of 'mask' was wrong because of the 'mask > 0' check.
   'CHANGED' event has value 0 so the 'mask > 0' check made it
   impossible to emit 'CHANGED' events.

 - kqueue-missing scans can now be triggered from the kqueue event
   callback instead of always waiting for 4 seconds.

 - Don't remove a file from kqueue on unlink unless its hard link count
   has dropped to zero.

 - Don't use 'else if' in the check of 'fflags'. It is possible for a
   kevent to have multiple flags set.

 - Don't use g_file_monitor_emit_event directly. Always use
   g_file_monitor_source_handle_event to report events.
   Events submitted to g_file_monitor_emit_event are delivered
   immediately, but events sent to g_file_monitor_source_handle_event
   are scheduled by GLocalFileMonitor. If we mix the two, the order of
   events will be wrong and tests will fail.

 - Report 'CHANGES_DONE_HINT' immediately after 'CREATED' if the file
   created is not a regular file. This is copied from ih_event_callback.
2018-06-17 11:26:32 +08:00
Xavier Claessens
75fd0109db Merge branch 'str-equal-docs' into 'master'
docs: Amend the docs for g_str_equal() to reflect current general usage

See merge request GNOME/glib!109
2018-06-15 14:53:19 +00:00
Will Thompson
c1a8e93dc4
gfileutils: document non-atomicity of g_file_set_contents()
This function only calls fsync() if @target exists and is non-empty. If
not, it doesn't provide the "old contents or new contents" guarantee
that one might expect. This has been the case since
d20a188b12, and is justified either as a
performance optimization or by asserting that this function only
guarantees to not destroy existing data (implicitly defining
non-existence or emptiness as not data).

In addition, explicitly spell out that whether it's atomic in the
non-empty case is system-dependent. If the system administrator has
configured some funky filesystem options, they may be out of luck on the
atomicity front.

https://gitlab.gnome.org/GNOME/glib/issues/1302
2018-06-15 14:47:47 +01:00
Xavier Claessens
acb4f54833 Merge branch 'meson-functions' into 'master'
Meson: Add missing checks for functions

See merge request GNOME/glib!114
2018-06-15 13:27:18 +00:00
Xavier Claessens
a633e260c7 Merge branch 'gitlab' into 'master'
docs: Change Bugzilla references to GitLab

See merge request GNOME/glib!116
2018-06-15 13:23:52 +00:00
Philip Withnall
5e46a97ac6 gvariant: Document differences between GVariant bytestrings and arrays
https://gitlab.gnome.org/GNOME/glib/issues/896
2018-06-15 13:17:25 +01:00
Philip Withnall
09419fdeb4 gvariant: Change type of ‘y’ variants from guchar to guint8
This fits better with the convention in the rest of GLib where arbitrary
8-bit values are represented as guint8, avoiding the potential confusing
of a name which references ‘char’s.

This is not an API break, as both guint8 and guchar are unconditionally
typedeffed to unsigned char.

https://gitlab.gnome.org/GNOME/glib/issues/896
2018-06-15 13:10:36 +01:00
Philip Withnall
77dba8537c docs: Rename README.commits to CONTRIBUTING.md
That means GitLab will automatically pick it up and link people to it.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-15 13:05:00 +01:00
Philip Withnall
c200c1d1df docs: Rename README.in to README.md for GitLab
There seems to be little point in substituting the version number into
README (using autotools). Rename it to README.md and distribute that
verbatim (with autotools and Meson) instead.

Autotools still requires that README exists, so leave a stub README file
in place which redirects people to README.md. This can be dropped when
we drop autotools support.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-15 13:04:59 +01:00
Olivier Crête
8e65417c6e docs: Change Bugzilla references to GitLab
Including modifications by Philip Withnall <withnall@endlessm.com>
2018-06-15 13:04:39 +01:00
Philip Withnall
3126f73c80 Merge branch '1368-codegen-interface-info' into 'master'
gdbus-codegen: Add a mode to generate GDBusInterfaceInfo structures

Closes #1368

See merge request GNOME/glib!13
2018-06-15 10:35:46 +00:00
Ondrej Holy
e0e0f259c3 gio: Add bash completion for gio tool
GVfs utils used to have bash completion, which was pretty useful. However,
it hasn't been ported to gio tool unfortunately. GLib provides completion
for various utils already, so it would be nice to provide completion also
for gio tool. I've updated old bash completion code and merged with some
my old unmerged fixes.

The gvfs completion used "gvfs-ls --show-completions" helper. This mentioned
option hasn't been obviously ported to "gio list" and the proposed completion
doesn't add this option in "gio list" to not pollute the codes, but maybe it
is a bit slower as consequence.

The proposed bash completion suggests subcommands, uris and paths including
the remote mounts. It contains some workarounds, especially because of proper
handling of paths with colons and other special chars (like spaces)...
2018-06-15 12:34:10 +02:00
Christoph Reiter
45f9b5a336 Merge branch 'strlcpy' into 'master'
Meson: Add check for strlcpy/strlcat

See merge request GNOME/glib!111
2018-06-15 05:22:54 +00:00
Christoph Reiter
ee5a37f657 Merge branch 'threads-none' into 'master'
Remove unused THREADS_NONE

See merge request GNOME/glib!110
2018-06-15 04:55:17 +00:00
Christoph Reiter
efb5d50010 Merge branch 'struct-member' into 'master'
Meson: Add missing checks for struct members

See merge request GNOME/glib!113
2018-06-15 04:51:06 +00:00
Xavier Claessens
8ba364186f Meson: Add missing checks for functions 2018-06-14 14:51:08 -04:00
Xavier Claessens
5ee54589e2 Meson: Add missing checks for struct members 2018-06-14 14:32:49 -04:00
Richard Hughes
7a7fe06939 gio: PPC64 returns EOPNOTSUPP from splice() if not supported 2018-06-14 19:18:25 +01:00
Xavier Claessens
76a7f7dca3 Remove unused THREADS_NONE
Thread implementation is mandatory and configure will abort. So there is
no point in having a THREADS_NONE conditional/define.
2018-06-14 14:07:40 -04:00
Xavier Claessens
5ebcfdf447 Meson: Add check for strlcpy/strlcat
I don't know why it runs the code in autotools instead of only checking
if it links, but let's copy the same logic for now.
2018-06-14 14:00:43 -04:00
Philip Withnall
0e3b137210 codegen: Fix a minor Python linting warning
This introduces no functional changes.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795304
2018-06-14 18:57:53 +01:00
Philip Withnall
3a1536ba34 codegen: Suppress the old --xml-files option in the --help output
Since it’s deprecated in favour of positional arguments, including it in
the help output is confusing.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795304
2018-06-14 18:57:53 +01:00
Philip Withnall
8916874ee6 codegen: Add --interface-info-[body|header] modes
These generate basic .c and .h files containing the GDBusInterfaceInfo
for a D-Bus introspection XML file, but no other code (no skeletons,
proxies, GObjects, etc.).

This is useful for projects who want to describe their D-Bus interfaces
using introspection XML, but who wish to implement the interfaces
manually (for various reasons, typically because the skeletons generated
by gdbus-codegen are too simplistic and limiting). Previously, these
projects would have had to write the GDBusInterfaceInfo manually, which
is painstaking and error-prone.

The new --interface-info-[body|header] options are very similar to
--[body|header], but mutually exclusive with them.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795304
2018-06-14 18:57:53 +01:00
Philip Withnall
99b64d4014 codegen: Support Since and name changing annotations on annotations
Recursive annotations do seem to be supported, so we should support them
properly in the type system representation. This currently introduces no
behavioural changes, but will be used in upcoming commits.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795304
2018-06-14 18:57:53 +01:00
Philip Withnall
c36c55dbd6 Merge branch 'fdonotif-fix-backend-dispose-race' into 'master'
gfdonotificationbackend: hold a strong ref on backend

See merge request GNOME/glib!106
2018-06-14 17:49:29 +00:00
Philip Withnall
7830b65c5f Merge branch 'triple_dash' into 'master'
goption: Reject group options specified with three dashes

Closes #1418

See merge request GNOME/glib!108
2018-06-14 17:43:53 +00:00
Philip Withnall
6dc543c6d3 Merge branch 'issue-699' into 'master'
Deprecate g_type_class_add_private()

Closes #699

See merge request GNOME/glib!7
2018-06-14 17:27:30 +00:00