Commit Graph

17207 Commits

Author SHA1 Message Date
Philip Withnall
8c4a6fdbf5 gio: Fix some typos of ‘asynchronous’ in documentation comments 2017-04-13 10:23:50 +01:00
Paolo Bonzini
9ba95e25b7 gmain: only signal GWakeup right before or during a blocking poll
Since commit e4ee307 ("Do not wake up main loop if change is from same
thread", bug 761102), GMainContext uses context->owner to decide if the
event loop is being run in the current thread.  However, what really
matters is the phase in the prepare/query/poll/check/dispatch sequence.
Wakeups are only needed between the end of prepare and the end of poll,
and then only if prepare found that no sources were ready.

There is no need to take threads into account, because prepare, check
and all callers of conditional_wakeup all look at the new need_wakeup
flag inside LOCK_CONTEXT/UNLOCK_CONTEXT.

With this change, g_main_context_is_owner and g_main_context_wait are
the only functions for which acquire/release matters, just like before
commit e4ee307.

Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
2017-04-11 13:27:31 -04:00
Paolo Bonzini
0c0469b56d gmain: Signal wakeups if context has never been acquired as well
Should address backwards compatibility with how qemu is using
`GMainContext`.

See https://bugzilla.gnome.org/show_bug.cgi?id=761102#c14

Input-into-keyboard-by: Colin Walters <walters@verbum.org>
2017-04-11 11:49:32 -04:00
Víctor Manuel Jáquez Leal
3d7534eae5 gio-tool: Fix errors format string
Compiling with clang 3.8.1-18 (debian, x86_64) I ran across this
error:

gio-tool.c:40:31: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
  message = g_strdup_vprintf (format, args);
                              ^~~~~~
gio-tool.c:55:31: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
  message = g_strdup_vprintf (format, args);
                              ^~~~~~
2 errors generated.

To fix the first one, related with the function print_error(), this
patch adds to the function prototype a compiler's attribute.

For the second one, since the usage of that function is to print
one string and the format is already provided, the patch simplifies
the function by no receiving variadic arguments.

https://bugzilla.gnome.org/show_bug.cgi?id=781125
2017-04-10 15:43:12 +02:00
Piotr Drąg
77d00030e5 gio-tool: Fix closing Unicode quotation mark
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=772221
2017-04-10 15:40:42 +02:00
Emmanuele Bassi
f952fdf3fc Drop trailing semi-colon from G_DEFINE_ macro
It's unnecessary, and only adds visual noise; we have been fairly
inconsistent in the past, but the semi-colon-less version clearly
dominates in the code base.

https://bugzilla.gnome.org/show_bug.cgi?id=669355
2017-04-10 10:38:31 +01:00
Ondrej Holy
fb7d2184a6 gio-tool: Do not leak GOptionContext
GOptionContext is freed only in case of success. Free the context
also in case of failure.

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00
Ondrej Holy
292f10d053 gio-tool: Add g_drive_is_removable() support
The g_drive_is_removable() support was added recently in gio/gvfs
(see Bug 765900 and Bug 765457). It was also added in gvfs-mount,
but we forgot to add it also in gio-tool-mount.

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00
Ondrej Holy
094613425e gio-tool: Return error if there are not any volumes to mount
Print error and return error code if device doesn't contain any
volumes to mount.

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00
Ondrej Holy
bcb1bfda52 gio-tool: Do not print settable arguments unless they are any
"Settable arguments:" is printed even if they are not any arguments
to print. Do not print it similarly as it is done for "Writable
namespaces:".

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00
Ondrej Holy
bde2bde411 gio-tool: Various memory leak fixes
https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00
Ondrej Holy
0beeeb2ec9 gio-tool: Various fixes related to error messages
This patch contains the following changes:
- Print all errors with "gio: " prefix
- Print file uri in error for each tool allowing multiple locations
- Mark all error messages translatable
- Do not leak strings used in error messages
- Always start error messages with capital letter
- Unify some error messages across various tools
- Fix addional/missing new line characters

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00
Tim-Philipp Müller
a83ccc535f gobject: remove duplicate GType sanity check
This is going to be checked again by g_object_new_with_properties()
and g_object_new_valist() anyway, so might just as well leave it
to those functions to do the check and only do it once. It doesn't
matter which function emits the critical warning in the end either,
as one has to look at a stack trace to find out what code triggered
it in any case.

https://bugzilla.gnome.org/show_bug.cgi?id=780908
2017-04-08 01:20:29 -04:00
Philip Withnall
a5b58da6bf gfileutils: Add precondition checks to g_file_test()
Otherwise g_file_test(NULL, …) causes a call to access(NULL, …) on
Linux, which is disallowed and valgrind complains about it.

https://bugzilla.gnome.org/show_bug.cgi?id=755046
2017-04-08 01:16:04 -04:00
Ole André Vadla Ravnås
005dfeacba gdbus: fix false positive g_warning() in remove_filter()
The GDBus thread might be holding a ref while requesting to remove the
filter.

https://bugzilla.gnome.org/show_bug.cgi?id=779409
2017-04-08 01:13:06 -04:00
Adrian Perez de Castro
85882094df Better documentation for g_app_info_equal()
Explicitly state that the function may not compare the contents of the
passed GAppInfo instances.

This fixes bug #777961.
2017-04-08 01:12:16 -04:00
Jan Alexander Steffens (heftig)
47a02c8561 g_unix_signal_source_new: Add SIGWINCH
Assume this won't go into 2.52 anymore, so say it was added in 2.54.

https://bugzilla.gnome.org/show_bug.cgi?id=769534
2017-04-08 01:02:31 -04:00
Christoph Reiter
3525048dc4 gmodule: Remove old win32 codepage ABI compat code
Makes new code link against the normal symbol names again.
Variants with utf8 suffix are there for existing binaries/ABI compat.

https://bugzilla.gnome.org/show_bug.cgi?id=780634
2017-04-06 19:25:29 +02:00
Christoph Reiter
5067d25a74 gwin32: Remove old win32 codepage ABI compat code
Makes new code link against the normal symbol names again.
Variants with utf8 suffix are there for existing binaries/ABI compat.

https://bugzilla.gnome.org/show_bug.cgi?id=780634
2017-04-06 19:25:09 +02:00
Christoph Reiter
23dffdd949 gspawn: Remove old win32 codepage ABI compat code
Makes new code link against the normal symbol names again.
Variants with utf8 suffix are there for existing binaries/ABI compat.

https://bugzilla.gnome.org/show_bug.cgi?id=780634
2017-04-06 19:24:00 +02:00
Christoph Reiter
fad5f5bd17 giochannel: Remove old win32 codepage ABI compat code
Makes new code link against the normal symbol names again.
Variants with utf8 suffix are there for existing binaries/ABI compat.

https://bugzilla.gnome.org/show_bug.cgi?id=780634
2017-04-06 19:22:43 +02:00
Christoph Reiter
d1528402ab gfileutils: Remove old win32 codepage ABI compat code
Makes new code link against the normal symbol names again.
Variants with utf8 suffix are there for existing binaries/ABI compat.

https://bugzilla.gnome.org/show_bug.cgi?id=780634
2017-04-06 19:21:20 +02:00
Christoph Reiter
b67d071321 genviron: Remove old win32 codepage ABI compat code
Makes new code link against the normal symbol names again.
Variants with utf8 suffix are there for existing binaries/ABI compat.

https://bugzilla.gnome.org/show_bug.cgi?id=780634
2017-04-06 19:19:20 +02:00
Christoph Reiter
d43b3d889a gdir: Remove old win32 codepage ABI compat code
Makes new code link against the normal symbol names again.
Variants with utf8 suffix are there for existing binaries/ABI compat.

https://bugzilla.gnome.org/show_bug.cgi?id=780634
2017-04-06 19:17:56 +02:00
Christoph Reiter
713788413d gconvert: Remove old win32 codepage ABI compat code
Makes new code link against the normal symbol names again.
Variants with utf8 suffix are there for existing binaries/ABI compat.

https://bugzilla.gnome.org/show_bug.cgi?id=780634
2017-04-06 19:17:03 +02:00
Alexandros Frantzis
feae4e9f31 gdbus: Fix memory leak in gdbusmethodinvocation.c
https://bugzilla.gnome.org/show_bug.cgi?id=780924
2017-04-05 13:12:14 +01:00
Chun-wei Fan
20fde20ab4 Visual Studio 201x builds: Fix GIO x64 Debug builds
The custom build rules did not have rules for x64 Debug builds during
the refactoring.  Fix this by removing all Platform and Configuration
conditions for it, since this is done on are configs in the same manner.

Noted by Ignacio Casal Quinteiro.
2017-04-05 00:15:26 +08:00
Philip Withnall
1b64ddb933 gvariant: Minor documentation tweak for g_variant_get_fixed_array()
Add a missing clausal comma, and add some backtick formatting.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-04-04 15:10:01 +01:00
Stas Solovey
028a597d64 Update Russian translation
(cherry picked from commit 8c9d02acb7)
2017-04-03 19:10:42 +00:00
Colin Walters
2087024049 main: Create a helper function for "owner wakeup" optimization
The original patch really should have introduced a helper - among
other things it deserves a code comment.  We're likely to make
further changes too, so it's obviously better to only do it in one
place.

See: https://bugzilla.gnome.org/show_bug.cgi?id=761102
2017-04-03 13:28:13 -04:00
Debarshi Ray
4efb8b4f7b docs: Clarify the use of the GError in g_tls_database_verify_chain*
Being able to determine that a certificate chain is invalid is not
considered an error, but success. This might not be obvious at first
due to the way the method is named and described currently. Since we
cannot change the name, let's improve the description and clarify this
aspect of its behaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=780310
2017-04-03 18:57:48 +02:00
Cosimo Cecchi
69e448bc28 datetime: add fallback logic for AM/PM specifier
When the locale does not provide any string for AM/PM, fallback to the
default.

https://bugzilla.gnome.org/show_bug.cgi?id=761889
2017-04-03 08:31:37 -07:00
Cosimo Cecchi
6e192588e0 datetime: don't conflate heap/non-heap allocations in same variable
Use an extra variable instead of casting out the const specifier.

https://bugzilla.gnome.org/show_bug.cgi?id=761889
2017-04-03 08:31:28 -07:00
Cosimo Cecchi
62edcf03d3 datetime: factor out fallback AM/PM function
We will reuse this.

https://bugzilla.gnome.org/show_bug.cgi?id=761889
2017-04-03 08:13:19 -07:00
Cosimo Cecchi
9163306de2 datetime: factor out a common function
The 'p' and 'P' cases are exactly the same, except for one line. Factor
out a common function for both.

https://bugzilla.gnome.org/show_bug.cgi?id=761889
2017-04-03 08:13:16 -07:00
Philip Withnall
ca0632ca5c gio: Handle NULL cached properties in NetworkManager monitor
g_dbus_proxy_get_cached_property() and
g_dbus_proxy_get_cached_property_names() can both return NULL if the
property cache is empty. Avoid a crash if this situation arises (which
it looks like it could, from reading the code) by gracefully bailing out
on NULL return values.

Coverity issues: #1257044, #1257045

https://bugzilla.gnome.org/show_bug.cgi?id=741229
2017-04-03 12:04:23 +01:00
Philip Withnall
1f396fd7d6 gsocket: Fix potential multiplication overflow calculating timeout
socket->priv->timeout is only a guint, and the multiplication is
performed before it’s widened to gint64 to be stored in start_time
(thanks, C). This means any timeout of 50 days or more would overflow.
Fixing this bug makes me feel a real sense of self-worth.

Coverity ID: 1159478

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-04-03 11:56:43 +01:00
Philip Withnall
0e0b5dff7c gdbus-tool: Improve --help output for gdbus wait
Include a parameter placeholder for the bus name, which is required.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-04-03 11:53:28 +01:00
Philip Withnall
fe2813b842 gdbus-tool: Drop a few lines of dead code
request_completion is checked several blocks higher in the function.
Spotted by Coverity.

Coverity ID: 1373215

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-04-03 11:43:18 +01:00
Philip Withnall
3a926db37b build: Include gettext libraries for static compilation on Mac OS X
When compiling statically against the system-provided gettext on Mac OS
X, GLib needs to be linked against CoreFramework, which provides some
functions used by gettext.

Fix this by including the necessary macro magic from upstream gettext.

https://bugzilla.gnome.org/show_bug.cgi?id=725894
2017-04-03 10:32:55 +01:00
Philip Withnall
4c91b7f935 docs: Add GParameter replacement API to gobject-sections.txt
This slipped through the review cracks.

https://bugzilla.gnome.org/show_bug.cgi?id=709865
2017-03-31 11:10:26 +01:00
Philip Withnall
2f2c2b6362 gobject: Fix Since/Deprecated versions for GParameter replacement API
This slipped through the review cracks.

https://bugzilla.gnome.org/show_bug.cgi?id=709865
2017-03-31 11:09:53 +01:00
Philip Withnall
c11908ab7d gio: Fix deprecation warnings for g_object_newv() API 2017-03-31 11:00:23 +01:00
Fabian Orccon
e2c3b7f634 gobject: Deprecate g_object_newv
g_object_newv uses a GParameter as argument. Since GParameter
is deprecated due to this type is not introspectible,
g_object_newv is deprecated now.

https://bugzilla.gnome.org/show_bug.cgi?id=709865
2017-03-31 11:00:23 +01:00
Fabian Orccon
3151da15d7 gio: Deprecate GParameter-related functions
https://bugzilla.gnome.org/show_bug.cgi?id=709865
2017-03-31 11:00:23 +01:00
Fabian Orccon
2646c21735 gobject: Deprecate GParameter
GParameter is a rarely used type and not introspectible.

https://bugzilla.gnome.org/show_bug.cgi?id=709865
2017-03-31 11:00:23 +01:00
Fabian Orccon
942edbc700 tests: Add test for gobject properties for g_object_newv/setv/getv
https://bugzilla.gnome.org/show_bug.cgi?id=709865
2017-03-31 11:00:23 +01:00
Fabian Orccon
c6d373bfe7 gobject: Add g_object_setv and g_object_getv functions
https://bugzilla.gnome.org/show_bug.cgi?id=709865
2017-03-31 10:38:30 +01:00
Fabian Orccon
26b211ef89 gobject: Add g_object_new_with_properties
g_object_new_with_properties is an alternative to g_object_newv.
The last one, takes an array of GParameter. However, GParameter
is a rarely used type and this type is not introspectible, so
it will not work properly in bindings.

https://bugzilla.gnome.org/show_bug.cgi?id=709865
2017-03-31 10:38:30 +01:00
Fabian Orccon
19e81dedc9 gobject: Add helper functions to handle warnings in g_object_new/set/get
g_object_new_is_valid_property
g_object_get_is_valid_property
g_object_set_is_valid_property

https://bugzilla.gnome.org/show_bug.cgi?id=709865
2017-03-31 10:38:30 +01:00