Commit Graph

14115 Commits

Author SHA1 Message Date
Giovanni Campagna
32d2539295 GDBusProxy: add flag to control autostarting at construction time
Sometimes the application doesn't want to autostart a service
when it creates a proxy, but wants the service autostarted when
it makes the first method call. Allow that behavior with a new
flag.

https://bugzilla.gnome.org/show_bug.cgi?id=708828
2013-10-04 02:38:17 +02:00
Ryan Lortie
c8e1dbb106 gdesktopappinfo: Large-scale whitespace fixup
Fix up a lot of whitespace issues in this file since we're about to do
some pretty serious rewriting here anyway...

Add some fold markers while we're at it.
2013-10-03 10:40:25 -04:00
Ryan Lortie
b0601e7558 gdesktopappinfo: rework search path
Change the search path to be a global array of 'DesktopFileDir' structures and
change the 'get' function to an 'ensure' function.

This is just a straight-up refactor.  Future patches will expand the
DesktopFileDir structure.
2013-10-03 10:40:25 -04:00
Ryan Lortie
5e59ab8e8c gdesktopappinfo: remove global_defaults_cache
...and some related functions.

This variable is also used for nothing at all.
2013-10-03 10:40:25 -04:00
Ryan Lortie
b95ef4aad4 gdesktopappinfo: remove should_ping_mime_monitor
This variable is used for nothing...
2013-10-03 10:40:25 -04:00
Ryan Lortie
33762a4173 glocalfile: add private worker monitor APIs
Add a convenient and race-free method of watching local files from the
GLib worker thread.

Without this, the race-free way to create a monitor that dispatches
events to the worker thread looked something like this:

 - dispatch an idle to the worker thread
 - from the idle, create the monitor and connect signals
 - from the original thread, wait (on a cond?) until the worker thread
   has finished setting up the monitor
 - read the file that you were monitoring

which is just ridiculously complicated...

To use the new API:

  monitor = g_local_file_monitor_new_in_worker ("/path/to/some/file",
                                                G_FILE_MONITOR_NONE,
                                                &error);
  g_assert_no_error (error);

  g_signal_connect (monitor, "changed", G_CALLBACK (callback), NULL);

  g_local_file_monitor_start (monitor);

'callback' will run from the GLib worker thread.

This is the reason that the start() call was introduced in the previous
commit.  The backends that don't use the start() call will have a very
thin race between creating the monitor and connecting the signal, but
hopefully they will be fixed soon.

These new APIs will be used (at least) from gdesktopappinfo to watch for
changes in the desktop file directories.

https://bugzilla.gnome.org/show_bug.cgi?id=704887
2013-10-03 10:37:47 -04:00
Ryan Lortie
5409d7827e GFileMonitor: support specifying a context
Add a new "context" construct-only property to allow explicitly
specifying the context in which events should be dispatched.

https://bugzilla.gnome.org/show_bug.cgi?id=704887
2013-10-03 10:37:35 -04:00
Ryan Lortie
700677de51 inotify: stop using constructor()
and start using the new start() vcall on the local monitor classes.

I only port inotify because I am uncomfortable making changes to the
other monitor backends without having a way of testing them.

https://bugzilla.gnome.org/show_bug.cgi?id=704887
2013-10-03 10:37:30 -04:00
Ryan Lortie
b050dc3c0a local monitors: make more idiomatic use of GObject
Stop abusing constructor() to do startup work, adding _start() calls
instead.

The backends themselves still use constructor() although a patch will be
following to also fix inotify.

The reason for using a separate start() call instead of constructed()
will become apparent in future commits.

https://bugzilla.gnome.org/show_bug.cgi?id=704887
2013-10-03 10:37:19 -04:00
Ryan Lortie
1ddfd9d98e directory monitor: use the right 'mount_notify'
During initialisation of a directory monitor with the
G_FILE_MONITOR_WATCH_MOUNTS flag set, GLocalDirectory monitor will add a
UNIX mount watch in case the file notification backend doesn't support
reporting these events for itself.

Unfortunately, it was performing the check incorrectly, resulting in a
monitor always being added.

Fix that, and add the #define for G_LOCAL_DIRECTORY_MONITOR_GET_CLASS()
that was also missing (since the fix depends on it).

https://bugzilla.gnome.org/show_bug.cgi?id=704882
2013-10-03 10:35:22 -04:00
Colin Walters
dd4c3695b4 goutputstream: Add clear warning about short writes to _write_bytes() and async version
Matthew Barnes noted this on IRC a few days ago.  I just had this file
open for other reasons and decided to tweak the docs to make this trap
more clear.

https://bugzilla.gnome.org/show_bug.cgi?id=709301
2013-10-02 11:23:01 -04:00
Ryan Lortie
27898916d4 g_settings_list_children: only list viable schemas
Don't return children with invalid schemas from
g_settings_list_children() (ie: missing schemas or mismatched paths).
This prevents gsettings list-recursively from crashing when broken
schemas are installed on the system.

https://bugzilla.gnome.org/show_bug.cgi?id=705688
2013-10-02 12:37:09 -04:00
Christian Persch
d1e4f3dd1a unicode: Update to unicode 6.3.0
No new blocks were added in 6.3, and only 5 new characters to be used
with the updated BiDi algorithm. And some character properties were changed.

See http://www.unicode.org/versions/Unicode6.3.0/ for more information.

https://bugzilla.gnome.org/show_bug.cgi?id=709227
2013-10-02 18:22:16 +02:00
Simon Feltman
2f57139b28 Fix crashes in various GParamSpec creation functions
Add NULL check and return after calls to g_param_spec_internal in GParamSpec
creation functions. This avoids glib crashing due to things like badly named
properties.

https://bugzilla.gnome.org/show_bug.cgi?id=707887
2013-10-01 18:31:17 -07:00
Michael Forney
75bb906e5e Add missing string.h include
Required for memset()
2013-10-01 09:00:10 -04:00
Ryan Lortie
713614608d Fix a careless mistake in the last commit
Thanks Colin :)
2013-09-30 13:06:30 -04:00
Ryan Lortie
5ad7893b51 gmain: Remove dispatching source stack
This stack exists only to answer the question of "what is the currently
dispatching source" and is handled in a way that makes it very clear
that we don't need to be using a linked list at all...

Just store the GSource directly.

Independently discovered (and same solution) by Phillip Susi.

https://bugzilla.gnome.org/show_bug.cgi?id=709113
2013-09-30 12:41:06 -04:00
Mike Ruprecht
4e9e7d0cba GOutputStream: Use async read/write of streams in splice_async()
There are some corner cases where using the sync version of read/write
in a thread could cause thread-safety issues. In these cases it's
possible to override the output stream's splice_async() function,
but for input streams one would need to do some acrobatics to
stay thread-safe. Alternatively, some implementations may not even
override their sync read/write functions.

This patch refactors the default splice_async() implementation to
call the sync read and write functions in a thread only when both
async versions are thread-based. When one or both are non-threaded,
it calls the virtual write_async() and read_async() functions of the
involved streams within the same thread.

https://bugzilla.gnome.org/show_bug.cgi?id=691581
2013-09-29 17:48:41 -04:00
Mike Ruprecht
87e5617a65 GOutputStream: Split _close_async for internal use
Refactor g_output_stream_close_async() into itself and an internal
variant for potential use inside other operations (splice_async).
The internal version must be called between
g_output_stream_set_pending() and g_output_stream_clear_pending().

https://bugzilla.gnome.org/show_bug.cgi?id=691581
2013-09-29 17:48:41 -04:00
Mike Ruprecht
416ca8ad57 GOutputStream: Rename _g_output_stream_close_internal() for consistency
https://bugzilla.gnome.org/show_bug.cgi?id=691581
2013-09-29 17:48:41 -04:00
Mike Ruprecht
e967a76728 tests: Add testcases for g_output_stream_splice_async()
Previously, no testcases tested the close flags of
g_output_stream_splice_async. This patch adds tests for that and
also tests various combinations of threaded and non-threaded
GInputStream async reads and GOutputStream async writes.

https://bugzilla.gnome.org/show_bug.cgi?id=691581
2013-09-29 17:48:40 -04:00
Mike Ruprecht
dec3bfeebc GOutputStream: Add g_output_stream_async_write_is_via_threads()
In implementing a better g_output_stream_splice_async() and possibly
other situtations it's helpful to know whether the output stream's
write function internally uses threads. If it and the input stream's
read async functions use threads, then the splice function could
spawn a single thread for better efficiency.

This patch adds a function to determine whether an output stream's
g_output_stream_write_async() function internally uses threads.

https://bugzilla.gnome.org/show_bug.cgi?id=691581
2013-09-29 17:48:40 -04:00
Mike Ruprecht
94a232a4ed GInputStream: Add g_input_stream_async_read_is_via_threads()
In implementing a better g_output_stream_splice_async() and possibly
other situtations it's helpful to know whether the input stream's
read function internally uses threads. If it and the output stream's
write async functions use threads, then the splice function could
spawn a single thread for better efficiency.

This patch adds a function to determine whether an input stream's
g_input_stream_read_async() function internally uses threads.

https://bugzilla.gnome.org/show_bug.cgi?id=691581
2013-09-29 17:48:40 -04:00
John Ralls
ab5aa2aa3a Fix the -Werror=format-nonliteral fixes for older GCCs
They don't allow that pragma inside functions.
2013-09-29 11:33:30 -07:00
John Ralls
09d83640a8 More -Werror=format-nonliteral fixes
This fixes the build with CLang.

https://bugzilla.gnome.org/show_bug.cgi?id=702516
2013-09-29 11:03:16 -04:00
Colin Walters
38d1658b87 gfileutils: Make -Werror=format-nonliteral happy
I tried to please it by using G_GNUC_FORMAT, but that didn't work, so
let's just fall back to pushing an ignore.

https://bugzilla.gnome.org/show_bug.cgi?id=702516
2013-09-29 11:02:30 -04:00
Dan Winship
b5ce635a42 gmessages: fix clang annotations to work with older versions
https://bugzilla.gnome.org/show_bug.cgi?id=708793
2013-09-28 12:31:52 -04:00
Dan Winship
4a953af8a5 gio: make gnetworking.h nodist
https://bugzilla.gnome.org/show_bug.cgi?id=708972
2013-09-28 12:18:14 -04:00
Dan Winship
c9ac45a023 .gitignore: add "signals" 2013-09-28 10:39:01 -04:00
Patrick Welche
e3fa9c9ab6 Only use SA_RESTART if it exists
Fixes build on QNX (and possibly HPUX given Bug 168352)
Patch essentially from pkgsrc devel/glib2/patches/patch-ai

https://bugzilla.gnome.org/show_bug.cgi?id=583321
2013-09-27 17:14:43 +01:00
Bastien Nocera
2d8e5ef81e gdesktopappinfo: Call g_file_get_path() on demand
Rather than always calling out to g_file_get_path() (which
might block, whatever the documentation might say), postpone
the call until we actually need it.

https://bugzilla.gnome.org/show_bug.cgi?id=708753
2013-09-27 09:52:57 +02:00
Robert Ancell
458c1c0f16 gio: Fix documentation for GSocketControlMessage that refers to a 'file description' instead of a 'file descriptor' 2013-09-27 14:52:51 +12:00
Jan Schmidt
0167c3340d gio: Fix -Werror format string errors from mismatched ints. 2013-09-27 10:52:50 +10:00
William Orr
7eb1e5fc5b glocalfile: Only use O_DIRECTORY if available
Solaris 10 for example doesn't have it.

https://bugzilla.gnome.org/show_bug.cgi?id=708860
2013-09-26 15:22:51 -04:00
Yuri Myasoedov
e631507c50 Updated Russian translation 2013-09-25 23:11:29 +04:00
Krzesimir Nowak
3c5aad358c Fix typo in GLIB_VERSION_2_40 docs.
https://bugzilla.gnome.org/show_bug.cgi?id=708714
2013-09-25 09:39:20 +02:00
Shantha kumar
93101f1b89 Tamil Translations Updated 2013-09-25 12:28:53 +05:30
James Strandboge
74314de4d8 gio: Fix typo in the /org/freedesktop/DBus path
https://bugzilla.gnome.org/show_bug.cgi?id=708677
2013-09-24 09:25:51 -04:00
Svante Signell
1d4bb3f5d0 gio/gsocket.c: Fix error code checks when SOCK_CLOEXEC is defined but
not supported on GNU/Hurd.

https://bugzilla.gnome.org/show_bug.cgi?id=708266
2013-09-24 08:59:38 -04:00
Chao-Hsiung Liao
04e784e0c2 Updated Traditional Chinese translation(Hong Kong and Taiwan) 2013-09-24 19:01:24 +08:00
Ryan Lortie
d974d2ec8f Bump version to 2.39.0 2013-09-23 17:47:49 -04:00
Ryan Lortie
fbe3ce89a8 Introduce version macros for 2.40 2013-09-23 17:46:58 -04:00
Ryan Lortie
c8de2b11bb GLib 2.38.0 2013-09-23 17:07:33 -04:00
Ryan Lortie
9da87f597c fix up refcount/properties test case
Recent changes to the properties testcase made invalid use of the GArray
free function.  This free function takes a pointer to the item to be
freed, not the item itself.  Since that item was a pointer to a GObject,
g_object_unref() was getting a GObject**, rather than a GObject*.

The use of GArray in this testcase is pretty questionable in the first
place, so just use C arrays instead.
2013-09-23 17:07:33 -04:00
Ryan Lortie
748c86e45f gio docs: add some missing functions 2013-09-23 17:07:33 -04:00
Ryan Lortie
abf505fd0e More gio-du win32 fixes
Don't free the utf8 filename before the async function completes.

also, gitignore
2013-09-23 16:31:40 -04:00
Ryan Lortie
6d08d1191b Revert "gcancellable: allow g_cancellable_disconnect from "cancelled" handler on same thread"
This reverts commits 83605e2d0a and
140fa7ee46.
2013-09-23 16:15:52 -04:00
Alexander Larsson
140fa7ee46 cancellable: Minor fix to docs
The code uses "my_data", not "data" everywhere else.
2013-09-23 09:11:04 +02:00
Ray Strode
83605e2d0a gcancellable: allow g_cancellable_disconnect from "cancelled" handler on same thread
g_cancellable_disconnect will wait until any pending "cancelled"
handlers finish.  This is useful because disconnecting a handler can have the
side-effect of freeing data that the cancelled handler may rely on.
Unfortunately, the code used to enforce this synchronization between
"cancelled" handlers and g_cancellable_disconnect will also cause
deadlock if the cancelled handler itself calls g_cancellable_disconect.

Obviously, if g_cancellable_disconnect is explicitly called by a "cancelled"
handler, then the "cancelled" handler is shouldering the responsibility
of not using any data that may be freed by disconnection.

Also, g_cancellable_disconnect can be called in unexpected places by
lower layers in the code (for instance as a result of g_source_destroy).
In practice, this means it's easy for deadlocks to inadvertently crop
up when using "cancelled" handlers.

For these reasons, it would be good to fix the deadlock.

This commit prevents the deadlock by allowing foregoing synchronization,
if a pending "cancelled" handler is in the same thread as the
g_cancellabale_disconnnect call.

https://bugzilla.gnome.org/show_bug.cgi?id=705395
2013-09-23 09:09:48 +02:00
Duarte Loreto
795a36142d Updated Portuguese translation 2013-09-23 00:16:05 +01:00