Commit Graph

15562 Commits

Author SHA1 Message Date
Ryan Lortie
3b4cb28e17 gtype: add type declaration macros for headers
Add G_DECLARE_DERIVABLE_TYPE() and G_DECLARE_FINAL_TYPE() to allow
skipping almost all of the typical GObject boilerplate code.

These macros make some assumptions about GObject best practice that mean
that they may not be usable with older classes that have to preserve
API/ABI compatibility with a time before these practices existed.

https://bugzilla.gnome.org/show_bug.cgi?id=389585
2015-01-27 11:07:52 +00:00
Chun-wei Fan
e07cc89dee glib-sections.txt: Add g_win32_check_windows_version()
https://bugzilla.gnome.org/show_bug.cgi?id=741895
2015-01-27 12:17:25 +08:00
Chun-wei Fan
bcbf80c355 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
2015-01-27 12:17:14 +08:00
Cosimo Cecchi
be2d9b4f58 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
2015-01-26 12:06:24 +00:00
Ilya Konstantinov
2a0c18041b gthread: add thread name support on Mac OS
https://bugzilla.gnome.org/show_bug.cgi?id=741807
2015-01-26 09:06:13 +00:00
Philip Withnall
1cf7f5a240 gobject: Fix a typo in a documentation comment 2015-01-25 17:09:35 +00:00
Philip Withnall
4462cd30bc gthread: Fix a typo in a documentation comment 2015-01-25 17:09:24 +00:00
Philip Withnall
92041f4b3b gstrfuncs: Document that g_ascii_dtostr() writes a nul terminator
And g_ascii_formatd().

Reviewed-by: Ryan Lortie <desrt@desrt.ca>
2015-01-25 16:22:43 +00:00
Chun-wei Fan
ef09373e03 gio/Makefile.am: Fix MSVC Project Generation
We need to filter out gnetworkmonitornm.c in the MSVC Projects, as that is
UNIX-only code.
2015-01-21 14:28:47 +08:00
Ryan Lortie
29307b4e41 bump version 2015-01-20 01:38:13 -05:00
Ryan Lortie
95ea50d73c GLib 2.43.3 2015-01-20 00:05:28 -05:00
Philip Withnall
11a846b6bf 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
2015-01-18 23:04:05 +00:00
Inaki Larranaga Murgoitio
ee245b57ff Updated Basque language 2015-01-17 17:14:46 +01:00
Ignacio Casal Quinteiro
cf03e82478 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
2015-01-17 15:04:25 +01:00
Paolo Borelli
4f4714285d 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
2015-01-17 15:04:25 +01:00
Philip Withnall
2c5076cd58 gtestutils: Add links to gtester and gtester-report documentation
Link some existing text to make cross-referencing a little easier.
2015-01-16 09:22:21 +00:00
Philip Withnall
056f50ce94 gtestutils: Fix a typo in the g_test_add() documentation 2015-01-16 09:18:41 +00:00
Philip Withnall
7dd7c04148 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.
2015-01-16 09:15:07 +00:00
Philip Withnall
123bd7aecf gtestutils: Fix a typo in the g_test_run() documentation 2015-01-16 09:15:07 +00:00
Philip Withnall
9114923db2 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
2015-01-15 14:22:25 +00:00
Paolo Borelli
7a8ef00aae 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
2015-01-14 16:21:00 +01:00
Paolo Borelli
432476355b Use G_STMT_START/END in gslice.h 2015-01-14 16:21:00 +01:00
Paolo Borelli
be0c9e507a Use G_STMT_START/END in gtestutils 2015-01-14 16:21:00 +01:00
Philip Withnall
70e2630f5a gsettings: Fix a typo in the GSettings documentation
https://bugzilla.gnome.org/show_bug.cgi?id=741788
2015-01-14 10:53:04 +00:00
Matthias Clasen
b1e5b0e733 Bump version
So that early adopters of new api have a version to target.
2015-01-13 16:54:59 -05:00
Iain Lane
f7be461601 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
2015-01-13 12:11:06 +01:00
Ryan Lortie
84a1efeabd 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
2015-01-10 18:00:02 -05:00
Rafael Ferreira
12b5eff6dc Updated Brazilian Portuguese translation 2015-01-09 01:49:13 +00:00
Chun-wei Fan
1632d5716e 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.
2015-01-07 09:59:47 +08:00
Timm Bäder
327d35ed41 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.
2015-01-05 11:51:46 +01:00
TingPing
aa4e2d4dc3 Fix GContentType usage
https://bugzilla.gnome.org/show_bug.cgi?id=734946
2015-01-04 22:09:37 -05:00
Matthias Clasen
48293bb47d Fix a typo 2014-12-23 19:49:41 -05:00
Erick Pérez Castellanos
8344bf1179 Fix document typo
This one was making syntax highlighting fail.
2014-12-22 11:02:08 -05:00
Matthias Clasen
30abc73c1a Silence the build some more 2014-12-20 21:32:53 -05:00
Thomas Haller
c447bc7f93 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
2014-12-18 15:02:16 +01:00
Philip Withnall
d951db4236 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
2014-12-18 11:32:56 +00:00
Philip Chimento
4f3ab40c04 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
2014-12-18 02:02:53 -05:00
Philip Chimento
44372f4dd0 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
2014-12-18 02:02:53 -05:00
Philip Chimento
5a7db3015a 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
2014-12-18 02:02:53 -05:00
Daniel Mustieles
388e0d576f Updated Spanish translation 2014-12-17 12:31:29 +01:00
Philip Withnall
e98a5828d3 docs: Remove a mention of g_clear_object() being atomic
It is no longer atomic.

https://bugzilla.gnome.org/show_bug.cgi?id=741589
2014-12-16 17:11:11 +00:00
Matthias Clasen
924f269763 2.43.2 2014-12-15 13:17:15 -05:00
Matthias Clasen
0f21ee4c89 gobject: Add missing symbols to the docs 2014-12-15 13:17:15 -05:00
Matthias Clasen
169eae47e5 gio: Add missing symbols to docs 2014-12-15 13:17:15 -05:00
Matthias Clasen
b32ea8d924 Updates 2014-12-15 11:52:42 -05:00
Dan Winship
b6d1c66c50 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.
2014-12-14 08:04:27 -05:00
Xavier Claessens
1a2a689dea 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
2014-12-12 11:01:37 -05:00
Shankar Prasad
b6aa0c4890 Updated Kannada translation 2014-12-12 11:55:07 +00:00
Yosef Or Boczko
45e4ea75da Updated Hebrew translation 2014-12-12 12:36:27 +02:00
Ryan Lortie
de65723877 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.
2014-12-11 18:50:07 -05:00