Commit Graph

16530 Commits

Author SHA1 Message Date
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
Xavier Claessens
fdd0ed1972 Doc: Clarify when g_variant_get_fixed_array() should be used instead of _get_bytestring()
https://bugzilla.gnome.org/show_bug.cgi?id=746685
2016-07-16 22:13:47 -04:00
Krzesimir Nowak
992ded39bf GVariant: Add a G_VARIANT_DICT_INIT macro
The macro could be used at initialization time to avoid having an
unitialized dict, especially with g_auto variables.

The macro tries to be a bit more type-safe by making sure that the asv
parameter is actually "GVariant *".

https://bugzilla.gnome.org/show_bug.cgi?id=766370
2016-07-16 21:41:16 -04:00
Krzesimir Nowak
e1c640f819 GVariant: Add a G_VARIANT_BUILDER_INIT macro
The macro could be used at initialization time to avoid having an
unitialized builder, especially with g_auto variables.

The macro tries to be a bit more type-safe by making sure that the
variant_type parameter is actually "const GVariantType
*". Unfortunately I have no idea how to make it possible to also pass
a "const gchar *" parameter without warning.

https://bugzilla.gnome.org/show_bug.cgi?id=766370
2016-07-16 21:41:16 -04:00
Matthias Clasen
e0e652e403 Fix a corner-case in g_utf8_find_next_char
In the case that *p is '\0', we should return p + 1, not p.
This change allows to simplify g_utf8_find_next_char a bit.

https://bugzilla.gnome.org/show_bug.cgi?id=547200
2016-07-16 21:34:21 -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
Matthias Clasen
48ea710ee3 Do not use revents as not updated
revents is set in the same function after some lines. This check was
using revents from previous loop. This had the problem of causing two
poll execution for every changes to poll records.

Note that is not possible to move the code after revents is updated
as probably poll_changed is TRUE causing the function to exit.

Adapted from a patch by Frediano Ziglio,

https://bugzilla.gnome.org/show_bug.cgi?id=761102
2016-07-16 21:09:26 -04:00
Frediano Ziglio
e4ee3079c5 Do not wake up main loop if change is from same thread
This reduce the frequency the loop is waked up adding and removing
file descriptors or timeouts.
Considering that to support recursion events are removed from list and
added again this reduce iteration number a lot.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=761102
2016-07-16 21:08:51 -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
Kang Hu
42dad59cc1 gobject: add GOBJECT_IF_DEBUG macro for debugging gobjects and gsignals.
historically, DEBUG_CODE(gtype.c) and IF_DEBUG(gobject.c, gsignal.c)
macros are used to support debugging messages about object bookkeeping
and signal emission.
DEBUG_CODE has never been used in gtype.c. IF_DEBUG, when used, must be
accompanied by an extra #ifdef G_ENABLE_DEBUG. this is cumbersome.

this patch add a new macro GOBJECT_IF_DEBUG based on DEBUG_CODE as
a replacement for both DEBUG_CODE and IF_DEBUG.

https://bugzilla.gnome.org/show_bug.cgi?id=729914
2016-07-16 20:54:44 -04:00
Aurélien Zanelli
ec5397f9b0 keyfile: return 0 when the parsed double value is invalid
As specified in the g_key_file_get_double documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=768504
2016-07-16 20:50:54 -04:00
Aurélien Zanelli
3560faadd1 glib/tests/keyfile: check return value of g_key_file_get_double is 0 for invalid values
As specified in the documentation of g_key_file_get_double function.

https://bugzilla.gnome.org/show_bug.cgi?id=768504
2016-07-16 20:50:54 -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
Matthias Clasen
b4878dec3a Add a test for g_hmac_for_bytes 2016-07-16 20:48:41 -04:00
Giovanni Campagna
183ed8a3f8 Add g_compute_hmac_for_bytes()
As an introspection-friendly GBytes variant of g_compute_hmac_for_data()

https://bugzilla.gnome.org/show_bug.cgi?id=765338
2016-07-16 20:48:41 -04:00
Giovanni Campagna
a9e9bc74c3 Fix annotations of g_compute_hmac_for_data
https://bugzilla.gnome.org/show_bug.cgi?id=765338
2016-07-16 20:40:11 -04:00
Evan Nemerson
ebfbae534b gtestutils: add missing dash in seed argument's --help documentation
https://bugzilla.gnome.org/show_bug.cgi?id=760115
2016-07-16 20:39:18 -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
suhail
69a2c70174 docs: trivial typo fixes
https://bugzilla.gnome.org/show_bug.cgi?id=767949
2016-07-16 20:32:16 -04:00
Tiago Santos
a9b1f8118a Updated Portuguese translation 2016-07-16 18:33:27 +00:00
Chao-Hsiung Liao
dbb3e551f8 Updated Chinese (Taiwan) translation 2016-07-16 02:51:15 +00:00
Yosef Or Boczko
bb310d47de Updated Hebrew translation 2016-07-15 16:31:09 +03:00
Piotr Drąg
128f85730b Add Language headers to po files
Future versions of gettext will fail if this header is missing.
2016-07-14 17:23:02 +02: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
Nirbheek Chauhan
92e3189613 gmacros.h: offsetof is also available on MSVC
All versions since Visual C++ 2005 have this available, so we can just
use it for G_STRUCT_OFFSET.

See: https://msdn.microsoft.com/en-us/library/dz4y9b9a.aspx
2016-07-13 11:44:34 +08: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
Claude Paroz
bec71b5742 Updated French translation 2016-07-08 11:35:31 +00: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
Daniel Mustieles
d2c809d233 Updated Spanish translation 2016-07-05 10:38:05 +00:00
Aurimas Černius
a523faba62 Updated Lithuanian translation 2016-07-03 18:00:19 +03:00
Matthias Clasen
27fad7a6b1 Document the gio tool
Add a man page, and integrate it in the reference docs.
2016-07-01 16:01:34 -04:00
Matthias Clasen
37129297a9 Add new files to POTFILES 2016-07-01 16:01:34 -04:00