Commit Graph

16530 Commits

Author SHA1 Message Date
Piotr Drąg
f3c029978c Updated POTFILES.in 2016-05-23 18:19:51 +02:00
Tom Tromey
b7145a1d72 Rename gdb macros with _gdb suffix to avoid ns clashes
glib installs a gdb helper file named `glib.py`.
Then the "hook" file updates `sys.path` and does `import glib`.

This will fail if glib has already been imported into gdb, say
using `from gi.repository import GLib`.  This is due to a namespace clash.

One fix would be to rename the gdb helper files to not clash with
other Python modules.  This should be done for all such helper files.

https://bugzilla.gnome.org/show_bug.cgi?id=760186
2016-05-23 10:52:10 -04:00
Muhammet Kara
0ffb21d355 Updated Turkish translation
(cherry picked from commit 67ce4d8c7b)
2016-05-20 19:32:39 +00: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
931483aa25 build: Bump version to 2.49.1
So that early adopters of new API have a version number to target.

https://bugzilla.gnome.org/show_bug.cgi?id=765900
2016-05-20 10:34:15 +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
Philip Withnall
098f19bced docs: Replace references to GVFS hal modules with udisks2
Since hal is dead and buried, and has been superseded by the udisks2
modules in GVFS.
2016-05-19 10:06:36 +01:00
Rico Tzschichholz
19689af091 docs: Add index for 2.50 api 2016-05-18 13:30:32 +02:00
Philip Withnall
8f2d181858 build: Fix a misnamed variable in glib-tap.mk
This was causing anything listed in $(installed_test_extra_scripts) to
not be installed.

https://bugzilla.gnome.org/show_bug.cgi?id=766570
2016-05-17 18:09:58 +01:00
Руслан Ижбулатов
6a1e8e8fa7 g_date_time_format_locale: ensure locale encoding is used
Fallback code for g_date_time_format_locale() fetches translated
strings (such as day and month names) from .mo catalogues via
gettext. These strings always come in UTF-8 encoding, because
that is the encoding that glib sets when it initializes gettext
for itself.
However, the non-fallback code uses nl_langinfo() and expects
its results to be in locale-dependent encoding.

This mismatch can result in UTF-8 strings being converted to UTF-8,
producing gibberish.

Fix this by converting UTF-8 strings to locale-dependent encoding
before using them. Also fix the code that was already doing the locale->UTF-8
conversion to not convert the strings when they are already UTF-8-encoded.

https://bugzilla.gnome.org/show_bug.cgi?id=766092
2016-05-16 05:19:10 +00:00
Tiago Santos
6055954a09 Updated Portuguese translation 2016-05-15 19:45:51 +00: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
Руслан Ижбулатов
e88796cad0 testsuite: don't forget -DPCRE_STATIC when PCRE is static
https://bugzilla.gnome.org/show_bug.cgi?id=766407
2016-05-14 04:59:39 +00:00
Руслан Ижбулатов
36c47f2a55 testsuite: include pthread.h in thread testfile
https://bugzilla.gnome.org/show_bug.cgi?id=766407
2016-05-14 04:59:39 +00:00
Krzesimir Nowak
89d8dc979b docs: Clarify clearing the builder after ending the build process
There is no need to call g_variant_builder_clear() after the
g_variant_builder_end(). This is mentioned in docs of the former
function, but not in the docs of the latter one. Add them there too.
2016-05-11 10:18:05 -04:00
Iain Lane
bcbd8d73ce Fix the upper bound in g_unichar_iswide_bsearch
asan noticed an array out of bound access in this function, which was
because we were accessing G_N_ELEMENTS + 1.

https://bugzilla.gnome.org/show_bug.cgi?id=766211
2016-05-10 22:43:23 -04:00
Matthias Clasen
9a865020ca Add a few more test cases for g_unichar_iswide 2016-05-10 22:43:15 -04:00
Garrett Regier
c494ae06b7 gsequence: Improve is_end()
Instead of finding the GSequence, just walk up
the tree and determine if the iter is the end node.

https://bugzilla.gnome.org/show_bug.cgi?id=749583
Signed-off-by: Garrett Regier <garrettregier@gmail.com>
2016-05-09 15:55:53 +03:00
Cédric Valmary
1249e10b8e Updated Occitan translation 2016-05-08 19:38:56 +00:00
Aleksander Morgado
a340a5ef44 docs: improve g_main_context_push_thread_default() documentation
Explicitly suggest to use g_main_context_pop_thread_default() when there's no
user control on the life cycle of the thread being used.

https://bugzilla.gnome.org/show_bug.cgi?id=765173
2016-05-08 14:11:10 +02:00
Matthias Clasen
a17bbbc8a3 doc: Update a few links to the Unicode Standard 2016-05-07 12:38:09 -04: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
2ca496a2e7 glib/gmacros.h: Fix build on C++ mode in Visual Studio
Later Visual Studio versions does not allow one to define known keywords,
even if they are actually not known to the compiler.  Avoid this issue by
checking more conditions before we define inline as __inline:

-We are not building under C++ mode.
-We are on Visual Studio 2013 or earlier.

Where both of these conditions need to hold true.

https://bugzilla.gnome.org/show_bug.cgi?id=765990
2016-05-05 00:44:48 +08: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
Руслан Ижбулатов
210a9796f7 W32: Do not ignore short waits in g_poll
Do the actual wait dance even if wait timeout is < 10ms. Otherwise
we might busyloop.

https://bugzilla.gnome.org/show_bug.cgi?id=764415
2016-04-28 14:22:51 +00: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
Kjell Ahlstedt
05e5da9a83 gvalue: Fix description of g_value_type_transformable()
Types are transformable if they are compatible *or* a transformation function
is registered.

https://bugzilla.gnome.org/show_bug.cgi?id=742898
2016-04-28 12:05:50 +02:00
Víctor Manuel Jáquez Leal
96c962de22 glib tests: add pthread flag to 'thread' test
Commit 99bdfd1b introduced a direct call to pthreads_setname_np in the
'thread' test case.  Because we are directly calling pthreads functions
from this file now, we need to make sure we link it with the system
thread library flags (as we already do for another file).

https://bugzilla.gnome.org/show_bug.cgi?id=765712
2016-04-28 11:21:52 +02:00
Emmanuele Bassi
41df41550f utils: Compile g_abort() only on Windows
Otherwise it will break the build on non-Windows because of the macro in
the header, and the unconditional use of Windows-only API.

https://bugzilla.gnome.org/show_bug.cgi?id=665446
2016-04-27 14:55:45 +01:00
Emmanuele Bassi
2f05d1454e Bump master to 2.49 2016-04-27 14:35:09 +01:00
Руслан Ижбулатов
e47904a26f Use g_abort() instead of abort() where possible
https://bugzilla.gnome.org/show_bug.cgi?id=665446
2016-04-27 13:17:28 +00:00
Руслан Ижбулатов
5974428d25 Add g_abort()
The new g_abort() macro just expands to abort() on systems where abort()
behaves in a sane way. On other systems (read: Windows) it does its best
to emulate a sane abort() behaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=665446
2016-04-27 13:17:27 +00:00
Руслан Ижбулатов
e4aaae4ed6 glib: Add 2.50 availibity macros
https://bugzilla.gnome.org/show_bug.cgi?id=665446
2016-04-27 13:17:27 +00:00
Sebastian Dröge
4e3cd88c2b gparamspecs: GTypes are stored in v_pointer, not v_long
v_long is 32 bits on Win64, v_pointer is 64 bits. On most other platforms the
size of long and pointer is the same, so it's usually not a problem.

https://bugzilla.gnome.org/show_bug.cgi?id=758738
2016-04-27 10:28:09 +03: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
Руслан Ижбулатов
999711abc8 gthread: Better fallback for W32 g_get_num_processors()
https://bugzilla.gnome.org/show_bug.cgi?id=748530
2016-04-26 13:52:45 +00: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
Руслан Ижбулатов
e118856430 Add g_system_thread_set_name() implementation for W32 threads
This works by using semi-documented[1] exception to tell the debugger
that a thread needs to have its name changed.

If this exception is not caught and handled by something, it will crash
the process, so we need to set up our own handler in case there's no
debugger attached or the debugger can't handle this type of exception.

Since SEH is not supported by gcc on i686 (at the moment), we need to use VEH
instead. For completeness the MSVC-oriented code still uses SEH, although
there is no reason why it shouldn't work with the VEH variant used by MinGW.

VEH handler has to be set up somewhere (g_thread_win32_init () works nicely)
and removed once it's not needed (g_thread_win32_process_detach () is added
expressly for that purpose). Note that g_thread_win32_process_detach() is
only called when glib is unloaded by FreeLibrary(), not when glib-using
process is terminating.

This exception is known to work with WinDbg, and adding support for it into
GDB proved to be feasible (GDB patch will be sent upstream, eventually).

[1] https://msdn.microsoft.com/en-us/library/xcb2z8hs%28v=vs.71%29.aspx

https://bugzilla.gnome.org/show_bug.cgi?id=747478
2016-04-26 10:40:07 +00:00
Matthias Clasen
99bdfd1bcb Stop using ptrctl for thread names
We now prefer pthread_setname_np when available, and don't
need the linux specific API anymore. Also change the test
for this functionality to use pthread_getname_np.
2016-04-26 06:35:06 -04:00
Alan Coopersmith
28f0160031 gthread: add thread name support on Solaris
https://bugzilla.gnome.org/show_bug.cgi?id=747478
2016-04-26 06:18:34 -04:00