platform/upstream/glib.git
9 years agogwin32: Add g_win32_check_windows_version() API
Chun-wei Fan [Mon, 26 Jan 2015 03:11:48 +0000 (11:11 +0800)]
gwin32: Add g_win32_check_windows_version() API

This adds a public API where one can use to see whether the running version
of Windows where the code is run is at least the specified version, service
pack level, and the type (non-server, server, any) of the running Windows
OS.

This API is done as:
-GetVersion()/GetVersionEx() changed in the way they work since Windows 8.1
 [1][2], so a newer mechanism to check the version of the running Windows
 operating system is needed.  MSDN also states that GetVersion() might be
 further changed or removed after Windows 8.1.  This provides a wrapper for
 VerfyVersionInfo() as well in GLib for most cases, which was recommended
 in place of g_win32_get_windows_version() for more detailed Windows
 version checking.
-Provides an OS-level functionality check, for those that we don't need to
 venture into GetProcAddress(), and also to determine system API behavior
 changes due to differences in OS versions.

Also added a note for the g_win32_get_windows_version() API that since the
behavior of GetVersion() which it uses, is changed since Windows 8.1, users
of the API should be aware.

[1]:
http://msdn.microsoft.com/zh-tw/library/windows/desktop/ms724451%28v=vs.85%29.aspx
[2]:
http://msdn.microsoft.com/zh-tw/library/windows/desktop/ms724451%28v=vs.85%29.aspx

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

9 years agoGSimpleAction: add g_simple_action_set_state_hint
Cosimo Cecchi [Mon, 26 Jan 2015 11:18:06 +0000 (11:18 +0000)]
GSimpleAction: add g_simple_action_set_state_hint

Currently the only way to set a state hint on an action is through a
subclass; add a g_simple_action_set_state_hint() method so that this
becomes easier for clients that already use GSimpleAction.

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

9 years agogthread: add thread name support on Mac OS
Ilya Konstantinov [Sat, 20 Dec 2014 16:19:00 +0000 (11:19 -0500)]
gthread: add thread name support on Mac OS

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

9 years agogobject: Fix a typo in a documentation comment
Philip Withnall [Sun, 25 Jan 2015 17:09:35 +0000 (17:09 +0000)]
gobject: Fix a typo in a documentation comment

9 years agogthread: Fix a typo in a documentation comment
Philip Withnall [Sun, 25 Jan 2015 17:09:24 +0000 (17:09 +0000)]
gthread: Fix a typo in a documentation comment

9 years agogstrfuncs: Document that g_ascii_dtostr() writes a nul terminator
Philip Withnall [Sun, 25 Jan 2015 16:22:43 +0000 (16:22 +0000)]
gstrfuncs: Document that g_ascii_dtostr() writes a nul terminator

And g_ascii_formatd().

Reviewed-by: Ryan Lortie <desrt@desrt.ca>
9 years agogio/Makefile.am: Fix MSVC Project Generation
Chun-wei Fan [Wed, 21 Jan 2015 06:28:47 +0000 (14:28 +0800)]
gio/Makefile.am: Fix MSVC Project Generation

We need to filter out gnetworkmonitornm.c in the MSVC Projects, as that is
UNIX-only code.

9 years agobump version
Ryan Lortie [Tue, 20 Jan 2015 06:38:13 +0000 (01:38 -0500)]
bump version

9 years agoGLib 2.43.3 2.43.3
Ryan Lortie [Tue, 20 Jan 2015 05:05:11 +0000 (00:05 -0500)]
GLib 2.43.3

9 years agogtestutils: Add an example of using test fixtures
Philip Withnall [Fri, 16 Jan 2015 09:14:08 +0000 (09:14 +0000)]
gtestutils: Add an example of using test fixtures

Add a simple example of a test suite with two unit tests both using the
same fixture.

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

9 years agoUpdated Basque language
Inaki Larranaga Murgoitio [Sat, 17 Jan 2015 16:14:46 +0000 (17:14 +0100)]
Updated Basque language

9 years agogsocket: always try before waiting for condition
Ignacio Casal Quinteiro [Mon, 22 Dec 2014 15:38:50 +0000 (16:38 +0100)]
gsocket: always try before waiting for condition

When implementing blocking operations on top of
nonblocking sockets we should always first try to
perform the operation and then if needed handle
EAGAIN and wait with g_socket_wait_condition.
This is an optimization since we avoid calling
wait condition when it is not needed, but most
importantly this fixes hangs on win32 where some
events (in particular FD_WRITE) are only emitted
after the operation fails with EWOULDBLOCK.

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

9 years agogsocket: add a testcase that shows a hang on win32
Paolo Borelli [Sat, 10 Jan 2015 14:23:07 +0000 (15:23 +0100)]
gsocket: add a testcase that shows a hang on win32

Add a unit test that checks g_socket_new_from_fd by creating
a gsocket, obtaining its fd, duplicating the fd and then creating
a gsocket from the new fd. This shows a hang on win32 since the
gsocket created from the fd never receives the FD_WRITE event
because we wait for the condition without first trying to write
and windows signals the condition only after a EWOULDBLOCK error.

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

9 years agogtestutils: Add links to gtester and gtester-report documentation
Philip Withnall [Fri, 16 Jan 2015 09:22:21 +0000 (09:22 +0000)]
gtestutils: Add links to gtester and gtester-report documentation

Link some existing text to make cross-referencing a little easier.

9 years agogtestutils: Fix a typo in the g_test_add() documentation
Philip Withnall [Fri, 16 Jan 2015 09:18:41 +0000 (09:18 +0000)]
gtestutils: Fix a typo in the g_test_add() documentation

9 years agogtestutils: Clarify that test fixtures are allocated by GLib
Philip Withnall [Fri, 16 Jan 2015 09:10:46 +0000 (09:10 +0000)]
gtestutils: Clarify that test fixtures are allocated by GLib

Make it a little clearer that the user’s fixture setup and teardown
functions don’t have to do the allocation or freeing.

9 years agogtestutils: Fix a typo in the g_test_run() documentation
Philip Withnall [Fri, 16 Jan 2015 09:12:53 +0000 (09:12 +0000)]
gtestutils: Fix a typo in the g_test_run() documentation

9 years agoggettext: Include an example of setlocale() and friends in the i18n docs
Philip Withnall [Thu, 15 Jan 2015 14:20:33 +0000 (14:20 +0000)]
ggettext: Include an example of setlocale() and friends in the i18n docs

Include an example main() function, and include a link to the gettext
manual’s section on integrating gettext with build systems.

That should work as a complete reference for how to add i18n support to
an application.

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

9 years agoAvoid warning when using G_STMT_END macro with MSVC
Paolo Borelli [Tue, 13 Jan 2015 11:44:20 +0000 (12:44 +0100)]
Avoid warning when using G_STMT_END macro with MSVC

Workaround found on
http://cnicholson.net/2009/03/stupid-c-tricks-dowhile0-and-c4127/

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

9 years agoUse G_STMT_START/END in gslice.h
Paolo Borelli [Tue, 13 Jan 2015 12:22:07 +0000 (13:22 +0100)]
Use G_STMT_START/END in gslice.h

9 years agoUse G_STMT_START/END in gtestutils
Paolo Borelli [Tue, 13 Jan 2015 12:19:58 +0000 (13:19 +0100)]
Use G_STMT_START/END in gtestutils

9 years agogsettings: Fix a typo in the GSettings documentation
Philip Withnall [Fri, 19 Dec 2014 21:10:53 +0000 (21:10 +0000)]
gsettings: Fix a typo in the GSettings documentation

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

9 years agoBump version
Matthias Clasen [Tue, 13 Jan 2015 21:54:59 +0000 (16:54 -0500)]
Bump version

So that early adopters of new api have a version to target.

9 years agognetworkmonitornm: Check if network-manager is running
Iain Lane [Mon, 12 Jan 2015 10:03:18 +0000 (10:03 +0000)]
gnetworkmonitornm: Check if network-manager is running

We were asking for properties on NM's dbus interface, but if NM is not
running then there won't be any. Check if the name has an owner before
doing anything to it.

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

9 years agoconfigure.ac: reject 'universal' builds
Ryan Lortie [Wed, 7 Jan 2015 21:15:22 +0000 (16:15 -0500)]
configure.ac: reject 'universal' builds

AC_C_BIGENDIAN can return 'universal' as the result in the case that we
are trying to do a universal build on Mac OS.  This has to be opted into
explicitly by using multiple -arch CFLAGS.

Previously, we detected this result and fell back to doing our own check
based on the endianness of the build machine, hardcoding that.  This
means that universal builds might successfully build, but the binaries
would never actually run correctly on the 'opposite' arch.

This check was added because of a bug in the intial implementation of
this detection in autoconf, which was inappropriately identifying
non-macos compilers as 'universal'.  That was hitting ppc64 systems.
See https://bugzilla.redhat.com/show_bug.cgi?id=449944 for more info.

Commit b0e687ef42e21b1eb7af18c4eaebcd41b0bd5632 in autoconf ("Limit
AC_C_BIGENDIAN univeral checks to Mac OS X") solved this issue in 2008,
so let's remove our workaround.  For good measure, if we detect
"universal" in the result, error out.

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

9 years agoUpdated Brazilian Portuguese translation
Rafael Ferreira [Fri, 9 Jan 2015 01:49:13 +0000 (01:49 +0000)]
Updated Brazilian Portuguese translation

9 years agoWin32: Update Pre-configured Config Headers
Chun-wei Fan [Wed, 7 Jan 2015 01:59:47 +0000 (09:59 +0800)]
Win32: Update Pre-configured Config Headers

Update config.h.win32.in and glibconfig.h.win32.in so that they will be
in-line with the ones that are produced with configure.ac, for use on
Windows builds.

Thanks to Philip Withnall for pointing out the changes needed to update
glibconfig.h.win32.in in bug 727829.

9 years agognetworkmonitornm: Prevent crash
Timm Bäder [Mon, 5 Jan 2015 10:51:46 +0000 (11:51 +0100)]
gnetworkmonitornm: Prevent crash

g_dbus_proxy_get_cached_property_names can return NULL if there are no
cached properties, so don't try to access them in that case.

9 years agoFix GContentType usage
TingPing [Sat, 16 Aug 2014 08:47:46 +0000 (04:47 -0400)]
Fix GContentType usage

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

9 years agoFix a typo
Matthias Clasen [Wed, 24 Dec 2014 00:49:27 +0000 (19:49 -0500)]
Fix a typo

9 years agoFix document typo
Erick Pérez Castellanos [Sun, 21 Dec 2014 16:08:39 +0000 (11:08 -0500)]
Fix document typo

This one was making syntax highlighting fail.

9 years agoSilence the build some more
Matthias Clasen [Sun, 21 Dec 2014 02:32:53 +0000 (21:32 -0500)]
Silence the build some more

9 years agogobject: don't use G_STRLOC in G_OBJECT_WARN_INVALID_PSPEC() macro
Thomas Haller [Wed, 17 Dec 2014 09:00:35 +0000 (10:00 +0100)]
gobject: don't use G_STRLOC in G_OBJECT_WARN_INVALID_PSPEC() macro

Using G_STRLOC ends up embedding unique strings of the form
__FILE__:__LINE__ in the compiled binary. We can avoid these
by passing __FILE__ and __LINE__ separately when constructing
the warning text.
This probably reduces the size of the binary as __FILE__ is
likely already contained as string otherwise.

Note that for GCC 2.x this changes behavior because G_STRLOC
also contained __PRETTY_FUNCTION__.

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

9 years agogobject: Add g_set_object() convenience function to set GObject pointers
Philip Withnall [Tue, 16 Dec 2014 11:29:03 +0000 (11:29 +0000)]
gobject: Add g_set_object() convenience function to set GObject pointers

Along the same lines as g_clear_object(), g_set_object() is a
convenience function to update a GObject pointer, handling reference
counting transparently and correctly.

Specifically, it handles the case where a pointer is set to its current
value. If handled naïvely, that could result in the object instance
being finalised. In the following code, that happens when
(my_obj == new_value) and the object has a single reference:
    g_clear_object (&my_obj);
    my_obj = g_object_ref (new_value);

It also simplifies boilerplate code such as set_property()
implementations, which are otherwise long and boring.

Test cases included.

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

9 years agogfile: Explain nonobvious use of my_error
Philip Chimento [Tue, 2 Dec 2014 17:34:30 +0000 (12:34 -0500)]
gfile: Explain nonobvious use of my_error

In g_file_make_directory_with_parents(), the my_error variable is used
for several different purposes throughout the whole function, not all of
which are obvious. This explains the situation with some comments.

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

9 years agogfile: Use g_error_matches
Philip Chimento [Wed, 4 Dec 2013 02:51:51 +0000 (18:51 -0800)]
gfile: Use g_error_matches

Make proper use of g_error_matches() instead of comparing only error codes.

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

9 years agogfile: make_directory_with_parents race condition
Philip Chimento [Thu, 28 Nov 2013 01:43:18 +0000 (17:43 -0800)]
gfile: make_directory_with_parents race condition

A race condition could cause g_file_make_directory_with_parents() to
fail with G_IO_ERROR_EXISTS despite the requested directory not
existing.

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

9 years agoUpdated Spanish translation
Daniel Mustieles [Wed, 17 Dec 2014 11:31:29 +0000 (12:31 +0100)]
Updated Spanish translation

9 years agodocs: Remove a mention of g_clear_object() being atomic
Philip Withnall [Tue, 16 Dec 2014 11:23:12 +0000 (11:23 +0000)]
docs: Remove a mention of g_clear_object() being atomic

It is no longer atomic.

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

9 years ago2.43.2 2.43.2
Matthias Clasen [Mon, 15 Dec 2014 16:56:12 +0000 (11:56 -0500)]
2.43.2

9 years agogobject: Add missing symbols to the docs
Matthias Clasen [Mon, 15 Dec 2014 18:17:02 +0000 (13:17 -0500)]
gobject: Add missing symbols to the docs

9 years agogio: Add missing symbols to docs
Matthias Clasen [Mon, 15 Dec 2014 18:14:01 +0000 (13:14 -0500)]
gio: Add missing symbols to docs

9 years agoUpdates
Matthias Clasen [Mon, 15 Dec 2014 16:52:42 +0000 (11:52 -0500)]
Updates

9 years agogio/tests/socket: fix one of the new tests
Dan Winship [Sun, 14 Dec 2014 13:04:27 +0000 (08:04 -0500)]
gio/tests/socket: fix one of the new tests

One of the recently-added tests was using g_test_cmpstr() on a buffer
containing a string that wasn't necessarily 0-terminated.

9 years agoDoc: glib: Fix all undocumented/unused/undeclared symbols
Xavier Claessens [Sat, 29 Nov 2014 13:39:24 +0000 (08:39 -0500)]
Doc: glib: Fix all undocumented/unused/undeclared symbols

There is one issue left in gscanner.h due to a bug #741305 in gtk-doc.

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

9 years agoUpdated Kannada translation
Shankar Prasad [Fri, 12 Dec 2014 11:55:07 +0000 (11:55 +0000)]
Updated Kannada translation

9 years agoUpdated Hebrew translation
Yosef Or Boczko [Fri, 12 Dec 2014 10:36:27 +0000 (12:36 +0200)]
Updated Hebrew translation

9 years agoghash: minor docs tweak
Ryan Lortie [Thu, 11 Dec 2014 23:49:16 +0000 (18:49 -0500)]
ghash: minor docs tweak

We should not advise people to cast the result of
g_hash_table_get_keys_as_array() to a type that looks suitable for use
with g_strfreev().  Advise to use (const gchar **) instead.

9 years agogio/tests/socket: add unit test for g_socket_send_messages()
Tim-Philipp Müller [Fri, 13 Jun 2014 19:19:09 +0000 (20:19 +0100)]
gio/tests/socket: add unit test for g_socket_send_messages()

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

9 years agogsocket: add g_socket_send_messages()
Tim-Philipp Müller [Thu, 12 Jun 2014 17:16:45 +0000 (18:16 +0100)]
gsocket: add g_socket_send_messages()

Allows sending of multiple messages (packets, datagrams)
in one go using sendmmsg(), thus drastically reducing the
number of syscalls when sending out a lot of data, or when
sending out the same data to multiple recipients.

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

9 years agogio/tests/socket: add datagram version of test_ip_sync
Tim-Philipp Müller [Fri, 13 Jun 2014 18:45:25 +0000 (19:45 +0100)]
gio/tests/socket: add datagram version of test_ip_sync

9 years agogio/tests/socket: add test for g_socket_send_message()
Tim-Philipp Müller [Fri, 13 Jun 2014 09:48:52 +0000 (10:48 +0100)]
gio/tests/socket: add test for g_socket_send_message()

9 years agoUpdated gujarati translations
Sweta Kothari [Thu, 11 Dec 2014 04:00:01 +0000 (09:30 +0530)]
Updated gujarati translations

9 years agoUpdated Turkish translation
Muhammet Kara [Wed, 10 Dec 2014 22:04:49 +0000 (22:04 +0000)]
Updated Turkish translation

9 years agogio: fix the Since/AVAILABLE version on network connectivity stuff
Dan Winship [Wed, 10 Dec 2014 17:39:21 +0000 (18:39 +0100)]
gio: fix the Since/AVAILABLE version on network connectivity stuff

9 years agokeyfile: Add "in group" to GError message consistently
Colin Walters [Sun, 7 Dec 2014 21:00:55 +0000 (16:00 -0500)]
keyfile: Add "in group" to GError message consistently

This originated with https://github.com/GNOME/ostree/pull/23
It's nicer for the user if we also mention which group the expected
key would be in.

And in fact, every other error *except* _get_value() already had it.

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

9 years agoUpdated Hungarian translation
Balázs Úr [Sun, 7 Dec 2014 09:26:40 +0000 (09:26 +0000)]
Updated Hungarian translation

9 years agogio/tests: Prevent hangs and aborts in socket-listener
Ross Lagerwall [Sun, 30 Nov 2014 22:17:51 +0000 (22:17 +0000)]
gio/tests: Prevent hangs and aborts in socket-listener

Fix two problems:
1) If g_socket_service_stop is called before the accept call is requeued,
then the reference count won't decrease and this code will hang forever:
  while (G_OBJECT (service)->ref_count == ref_count)
    g_main_context_iteration (NULL, TRUE);

2) Sometimes the testcase fails (maybe 1 in 200 times for me):
GLib-GIO:ERROR:socket-listener.c:73:connection_cb: assertion failed
(G_OBJECT (service)->ref_count == 2): (3 == 2)
Aborted (core dumped)

The problem is that depending on ordering, cancellation of the async
listener can require further main context iterations before it releases
the reference on the socket service. Furthermore, in some cases, it
requires at least one iteration.

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

9 years agoUpdated POTFILES.in
Piotr Drąg [Fri, 5 Dec 2014 22:04:04 +0000 (23:04 +0100)]
Updated POTFILES.in

9 years agogio: Add GNetworkMonitor impl based on NetworkManager
Bastien Nocera [Wed, 3 Dec 2014 17:36:25 +0000 (18:36 +0100)]
gio: Add GNetworkMonitor impl based on NetworkManager

Which implements the new GNetworkConnectivity property.

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

9 years agogio: add network connectivity state to GNetworkMonitor
Dan Winship [Wed, 16 Apr 2014 14:39:12 +0000 (10:39 -0400)]
gio: add network connectivity state to GNetworkMonitor

Add a property to GNetworkMonitor indicating the level of network
connectivity: none/local, limited, stuck behind a portal, or full.

The default implementation just returns none or full depending on the
value of is-available.

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

9 years agogio: Correct the "available in" for GNetworkMonitor
Bastien Nocera [Thu, 4 Dec 2014 11:27:23 +0000 (12:27 +0100)]
gio: Correct the "available in" for GNetworkMonitor

They were marked as available in all versions when the main interface
was actually added in glib 2.32.

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

9 years agogio: provide G_IO_ERROR_NOT_CONNECTED translation for ENOTCONN
Ignacio Casal Quinteiro [Tue, 2 Dec 2014 13:25:56 +0000 (14:25 +0100)]
gio: provide G_IO_ERROR_NOT_CONNECTED translation for ENOTCONN

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

9 years agogio: fix build
Ignacio Casal Quinteiro [Tue, 2 Dec 2014 13:29:11 +0000 (14:29 +0100)]
gio: fix build

next time I should definitely try to compile after a rebase conflict...

9 years agogio: add G_IO_ERROR_NOT_CONNECTED
Ignacio Casal Quinteiro [Tue, 2 Dec 2014 12:50:51 +0000 (13:50 +0100)]
gio: add G_IO_ERROR_NOT_CONNECTED

It adds a new error G_IO_ERROR_NOT_CONNECTED
and makes the win32 error ERROR_PIPE_LISTENING
to be translated to it.

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

9 years agodocs: Add index for 2.44 api
Rico Tzschichholz [Mon, 1 Dec 2014 13:16:54 +0000 (14:16 +0100)]
docs: Add index for 2.44 api

9 years agoUpdated Vietnamese translation
Trần Ngọc Quân [Mon, 1 Dec 2014 02:07:13 +0000 (09:07 +0700)]
Updated Vietnamese translation

Signed-off-by: Trần Ngọc Quân <vnwildman@gmail.com>
9 years agogsocket: add G_IO_ERROR_CONNECTION_CLOSED
Dan Winship [Fri, 19 Aug 2011 14:23:12 +0000 (10:23 -0400)]
gsocket: add G_IO_ERROR_CONNECTION_CLOSED

Add G_IO_ERROR_CONNECTION_CLOSED as an alias for
G_IO_ERROR_BROKEN_PIPE, and also return it on ECONNRESET.

It doesn't really make sense to try to distinguish EPIPE and
ECONNRESET at the GLib level, since the exact choice of which error
gets returned in what conditions depends on the OS. Given that, we
ought to map the two errors to the same value, and since we're already
mapping EPIPE to G_IO_ERROR_BROKEN_PIPE, we need to map ECONNRESET to
that too. But the existing name doesn't really make sense for sockets,
so we add a new name.

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

9 years agognetworkaddress: Add g_network_address_new_loopback() constructor
Dan Winship [Sun, 23 Nov 2014 17:53:03 +0000 (12:53 -0500)]
gnetworkaddress: Add g_network_address_new_loopback() constructor

This is a convenience method for creating a GNetworkAddress which is
guaranteed to return IPv4 and IPv6 loopback addresses. The program
cannot guarantee that 'localhost' will resolve to both types of
address, so programs which wish to connect to a local service over
either IPv4 or IPv6 must currently manually create an IPv4 and another
IPv6 socket, and detect which of the two are working. This new API
allows the existing GSocketConnectable machinery to be used to
automate that.

Based on a patch from Philip Withnall.

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

9 years agoGVariant tests: test with larger strings
Ryan Lortie [Fri, 28 Nov 2014 22:55:28 +0000 (17:55 -0500)]
GVariant tests: test with larger strings

Allocate some larger strings in the testcase to make sure we handle them
correctly as well.

9 years agogmain: fix poll record comparison
Ryan Lortie [Fri, 28 Nov 2014 17:43:03 +0000 (12:43 -0500)]
gmain: fix poll record comparison

We intend to keep the list of poll records sorted by (integer) file
descriptor, but due to a typo we are actually keeping it sorted by
pointer address of the GPollFD.

Fix that.

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

9 years agogsignal: add a clarification to the docs
Ryan Lortie [Fri, 28 Nov 2014 21:20:40 +0000 (16:20 -0500)]
gsignal: add a clarification to the docs

As evidenced by a mistake that I made recently, this documentation could
use a little bit of clarification.

9 years agoGSettings: fix check for delaying backend subscription
Lars Uebernickel [Fri, 28 Nov 2014 12:06:04 +0000 (13:06 +0100)]
GSettings: fix check for delaying backend subscription

g_settings_has_signal_handlers() checks whether any of the signals has
pending handlers. However, g_signal_has_handler_pending() matches on
exact detail, even when passing 0. Subscribing to one of GSettings'
signals with a detail will fail this check and never connect to the
backend.

Fix this by calling has_handler_pending() with the key as detail as
well.

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

9 years agoUse the new g_strv_contains
Matthias Clasen [Thu, 27 Nov 2014 14:12:42 +0000 (09:12 -0500)]
Use the new g_strv_contains

No need to keep our own copy of this in the testsuite.

9 years agogstrfuncs: Add g_strv_contains()
Xavier Claessens [Mon, 15 Apr 2013 12:54:31 +0000 (14:54 +0200)]
gstrfuncs: Add g_strv_contains()

Includes unit tests.

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

9 years ago2.43.1 2.43.1 upstream/2.43.1
Matthias Clasen [Mon, 24 Nov 2014 18:07:22 +0000 (13:07 -0500)]
2.43.1

9 years agogio/tests: add a socket-listener test
Dan Winship [Sun, 23 Nov 2014 17:33:01 +0000 (12:33 -0500)]
gio/tests: add a socket-listener test

Add a GSocketListener test program. Currently the only test is a
regression test for bug 712570 (based on a standalone bug reproducer
provided by Ross Lagerwall).

9 years agogio: Prevent hang when finalizing GThreadedSocketService
Ross Lagerwall [Tue, 28 Oct 2014 21:16:50 +0000 (21:16 +0000)]
gio: Prevent hang when finalizing GThreadedSocketService

If all users of a GThreadedSocketService release their references to the
service while a connection thread is running, the thread function will
release the last reference to the service which causes the finalize to
deadlock waiting for all threads to finish (because it's called from the
thread function).

To fix this, don't wait for all threads to finish in the service's
finalize method.  Since the threads hold a reference to the service,
finalize should only be called when all threads are finished running (or
have unrefed the service and are about to finish).

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

9 years agogparam: Make the documentation clearer for CONSTRUCT_ONLY properties
Jasper St. Pierre [Tue, 28 Oct 2014 20:45:34 +0000 (13:45 -0700)]
gparam: Make the documentation clearer for CONSTRUCT_ONLY properties

It's not that the properly will only be set on construction, it's that
it *can* only be set upon construction.

9 years agogio: Implement g_win32_app_info_launch_uris for windows.
Michael Henning [Wed, 5 Nov 2014 06:20:25 +0000 (01:20 -0500)]
gio: Implement g_win32_app_info_launch_uris for windows.

9 years agogio: Implement g_app_info_get_default_for_uri_scheme for windows.
Michael Henning [Wed, 5 Nov 2014 06:18:25 +0000 (01:18 -0500)]
gio: Implement g_app_info_get_default_for_uri_scheme for windows.

9 years agoGTlsClientConnection: loosen the semantics of "use-ssl3"
Dan Winship [Sat, 22 Nov 2014 15:54:41 +0000 (10:54 -0500)]
GTlsClientConnection: loosen the semantics of "use-ssl3"

If SSL 3.0 has been disabled (at the host, application, or library
level), then the "use-ssl3" property becomes a "fail-immediately"
property.

Despite the name, the point of the property wasn't really specifically
to use SSL 3.0; it was to allow fallback when talking to broken
servers that do SSL/TLS negotiation incorrectly and break when they
see unexpectedly-high version numbers. So if we can't fall back to SSL
3.0, then the "use-ssl3" property should fall back to TLS 1.0 instead
(since there are hosts that will reject a TLS 1.2 handshake, but
accept a TLS 1.0 one).

glib-networking is being updated to implement that behavior, so update
the documentation here.

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

9 years agoGSettings Registry Backend: Init cache_lock Earlier
Chun-wei Fan [Thu, 20 Nov 2014 10:34:21 +0000 (18:34 +0800)]
GSettings Registry Backend: Init cache_lock Earlier

In commit 8ff5668, we are subscribing the GSettings backend later, but this
meant that we need to initialize cache_lock earlier, as we might try to
use that lock before a change notification is issued to subscribe the
backend, which would then cause an access violation if we are trying to
read GSettings values, as that lock is used to access the Windows Registry.

Initialize cache_lock once we initialize the GSettings Registry backend,
and delete it upon finalize, so that g_settings_read_from_backend() can
proceed normally, even if the GSettings backend is not yet subscribed.

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

9 years agogsettingsschema: Print the string that failed to parse
Christian Persch [Tue, 23 Sep 2014 08:46:53 +0000 (10:46 +0200)]
gsettingsschema: Print the string that failed to parse

When parsing a translated value fails, print the actual string that
failed to parse instead of the 'domain\004string' untranslated string.

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

9 years agoGSettings: delay backend subscription
Ryan Lortie [Sat, 26 Jul 2014 15:16:37 +0000 (17:16 +0200)]
GSettings: delay backend subscription

GSettings objects begin watching for changes as soon as they are created
in order that they can emit the "changed" signal.

In the case of dconf, if we want to be able to emit the changed signal,
we need to go on the bus and add some match rules.  This requires
creating the dconf helper thread and also requires initialising GDBus
(which creates another thread).

Some users of GSettings are never interested in the "changed" signal.
One of these users is the glib-networking code that gets run every time
a new network connection is created.

Some users are reporting that they are annoyed that simply establishing
a network connection would spawn two extra threads and create a D-Bus
connection.

In order to avoid doing unnecessary work for these simple uses, delay
the subscription until we know that we will actually need to do it.

We do this in a simple way, using a simple argument: in order for the
user to care that a value changed then they must have:

 1) watched for a change signal; and then
 2) actually read a value

If the user didn't actually read a value then they cannot possibly be
interested in if the value changed or not (since they never knew the old
value to begin with and therefore would be unable to observe that it
ever changed, since they have nothing to compare the new value with).

This really is a behaviour change, however, and it does impact at least
one user: the 'monitor' functionality of the GSettings commandline tool,
which is interested in reporting changes without ever having known the
original values.  We add a workaround to the commandline tool in order
to ensure that it continues to function properly.

It's also possible to argue that it is completely valid to have read a
value and _then_ established a change signal connection under the
(correct) assumption that it would not have been possible to miss a
change signal by virtue of not having returned to the mainloop.
Although this argument is true, this pattern is extremely non-idiomatic,
and the problem is easily avoided by doing things in the usual order.

We never really talked about change notification in the overview
documentation for GSettings, so it seems like now is a good time to add
some discussion, including the new rules for when one can expect change
signals to be emitted.

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

9 years agoglib: Improve documentation for g_strfreev()
Alberto Ruiz [Tue, 18 Nov 2014 14:43:41 +0000 (14:43 +0000)]
glib: Improve documentation for g_strfreev()

Fixes #740309.

9 years agoUpdated Norwegian bokmål translation.
Kjartan Maraas [Sat, 15 Nov 2014 17:31:40 +0000 (18:31 +0100)]
Updated Norwegian bokmål translation.

9 years agogapplication: enable --help when app has options
Lars Uebernickel [Sat, 15 Nov 2014 09:30:41 +0000 (10:30 +0100)]
gapplication: enable --help when app has options

This should already work according to the documentation, but doesn't
because main_options is consumed before the check in
g_application_parse_command_line().

Fix by moving the check for main_options up.

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

9 years agodocs: Add missing opening parenthesis
David King [Thu, 13 Nov 2014 17:49:31 +0000 (17:49 +0000)]
docs: Add missing opening parenthesis

https://mail.gnome.org/archives/gnome-web-list/2014-November/msg00003.html

9 years agodocs: Update GParamFlags docs.
Volker Sobek [Fri, 23 May 2014 20:45:30 +0000 (22:45 +0200)]
docs: Update GParamFlags docs.

Remove reference to G_PARAM_READWRITE from GParamFlags' description,
since commit 6c395244a5db added G_PARAM_READWRITE to GParamFlags.

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

9 years agoSimplify code that uses g_queue_insert_before() and insert_after()
Sébastien Wilmet [Wed, 5 Nov 2014 13:00:45 +0000 (14:00 +0100)]
Simplify code that uses g_queue_insert_before() and insert_after()

g_queue_insert_before() and g_queue_insert_after() now accept a NULL
sibling.

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

9 years agoGQueue: accept a NULL sibling for insert_before() and insert_after()
Sébastien Wilmet [Wed, 5 Nov 2014 13:03:30 +0000 (14:03 +0100)]
GQueue: accept a NULL sibling for insert_before() and insert_after()

It simplifies a little bit some code that inserts data relative to a
GList location, that might be NULL for the tail of the queue. A NULL
sibling is probably less useful for insert_after(), so it's more for
consistency with insert_before().

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

9 years agognetworking.h.win32: Move "#undef interface"
Chun-wei Fan [Mon, 3 Nov 2014 02:09:14 +0000 (10:09 +0800)]
gnetworking.h.win32: Move "#undef interface"

This is a follow-up commit due to the fix in gnetworking.h.in in commit
7103484 (gnetworking.h.in: move "#undef interface").

9 years agognetworking.h.in: move "#undef interface"
Dan Winship [Sun, 2 Nov 2014 14:36:14 +0000 (09:36 -0500)]
gnetworking.h.in: move "#undef interface"

The win32 headers do:

  #define interface struct

which is just evil and breaks other code that assumes it can use
"interface" as a variable name. gnetworking.h was supposed to be doing
"#undef interface" after including the win headers, but it did it too
soon, resulting in it getting redefined by a later include. Fix this.

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

9 years agoGTlsCertificate: fix loading of bad certificate chains
Dan Winship [Tue, 28 Oct 2014 19:08:43 +0000 (15:08 -0400)]
GTlsCertificate: fix loading of bad certificate chains

g_tls_certificate_new_from_file() was only loading the complete chain
if it was fully valid, but we only meant to be validating that it
formed an actual chain (since the caller may be planning to ignore
other errors).

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

9 years agodoc: Clarify documentation regarding g_file_replace and etags
Ross Lagerwall [Mon, 8 Sep 2014 20:09:08 +0000 (21:09 +0100)]
doc: Clarify documentation regarding g_file_replace and etags

Clarify that with g_file_replace, a non-NULL etag is only checked if the
file already exists.

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

9 years agogio: Prevent hang writing to a large GMemoryBuffer
Ross Lagerwall [Wed, 29 Oct 2014 22:12:39 +0000 (22:12 +0000)]
gio: Prevent hang writing to a large GMemoryBuffer

Fix a hang due to overflow by using unsigned numbers and explicitly
checking if the number overflows to zero.  This also fixes the previous
logic which assigned an int which may be negative to an unsigned number
resulting in sign extension and strange results.

Use gsize rather than int to allow for large buffers on 64 bit machines.

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

9 years agogio: Prevent hang writing to a large GMemoryOutputStream
Ross Lagerwall [Wed, 29 Oct 2014 22:05:32 +0000 (22:05 +0000)]
gio: Prevent hang writing to a large GMemoryOutputStream

Fix a hang due to overflow by using unsigned numbers and explicitly
checking if the number overflows to zero.  This also fixes the previous
logic which assigned an int which may be negative to an unsigned number
resulting in sign extension and strange results.

Use gsize rather than int to allow for large streams on 64 bit machines.

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

9 years agogmain: don't pass the same fd to g_poll() multiple times
Dan Winship [Tue, 13 Mar 2012 15:43:38 +0000 (11:43 -0400)]
gmain: don't pass the same fd to g_poll() multiple times

If a given fd is being polled by multiple sources, we used to pass it
multiple times to g_poll(), which is technically illegal (and not
supported by the select()-based fallback implementation of poll() in
gpoll.c), and also made it more likely that we'd exceed the maximum
number of pollfds.

Fix it to merge together "duplicate" GPollFDs. The easiest way to do
this involves re-sorting context->poll_records into fd order rather
than priority order. This means we now have to walk the entire pollrec
list for every g_main_context_query() and g_main_context_poll(),
rather than only walking the list up to the current max_priority.
However, this will only have a noticeable effect if you have tons of
GPollFDs, and we're already too slow in that case anyway because of
other O(n) operations that happen too often. So this shouldn't change
much (and the new poll API will eventually let us be cleverer).

Remove some win32-specific code which did the same thing (but was
O(n^2)).

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

9 years agoGDBusInterfaceVTable: clarify memory handling for the method() virtual function
Owen W. Taylor [Thu, 9 Oct 2014 18:40:45 +0000 (14:40 -0400)]
GDBusInterfaceVTable: clarify memory handling for the method() virtual function

There are two consistent interpretations that could be taken for memory
handling of the 'invocation' parameter passed to the method_call() virtual
function of GDBusInterfaceVTable

 - A reference is passed (transfer full) to the method_call() virtual function,
   and that reference is then passed (transfer full) to the return_value/error
   functions on GDBusMethodInvocation.
 - An internal reference is retained from the point where method_call() is called
   until the return_value/error function is called.

Since the return_value/error functions were already marked (transfer full),
we use the first interpretation, annotate the invocation parameter of
method call as (transfer full) and describe this in the documentation, along
with the idea that you are always supposed to call one of the return_value/error
functions.

See bug 738122 for the leak this caused in GJS.

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