Commit Graph

14150 Commits

Author SHA1 Message Date
Matthias Clasen
ea52ce07d8 Generate introspected docs for GSimpleProxyResolver 2013-10-17 20:38:15 -04:00
Matthias Clasen
8520c9cdf4 Add some missing argument docs 2013-10-17 20:37:57 -04:00
Matthias Clasen
4cae0703f7 Add index for 2.40 api additions 2013-10-17 20:16:13 -04:00
Colin Walters
ebd098155b tests/gsubprocess: Locate test child binary for installed tests too
Just use the new g_test_build_filename() rather than assuming
it's in cwd.
2013-10-17 22:39:48 +01:00
Piotr Drąg
f7e2190e74 Updated POTFILES.in 2013-10-17 21:56:55 +02:00
Ihar Hrachyshka
00f0795a84 Use g_return_val_if_fail() for developer-only messages
Replaced several usages of GError with g_return_val_if_fail() for
developer-only messages. As additional value, it also removes those
messages from the list to translate, simplifying translator's work a
bit.

https://bugzilla.gnome.org/show_bug.cgi?id=569017
2013-10-17 15:11:51 -04:00
Ryan Lortie
542ad4db03 Fixup GSubprocess documentation bits 2013-10-17 15:01:42 -04:00
Colin Walters
9318d5a429 gsubprocess: Add UTF-8 variants of communicate()
Over many years of writing code interacting with subprocesses, a pattern
that comes up a lot is to run a child and get its output as UTF-8, to
put inside a JSON document or render in a GtkTextBuffer, etc.

It's very important to validate at the boundaries, and not say deep
inside Pango.

We could do this a bit more efficiently if done in a streaming fashion,
but realistically this should be OK for now.
2013-10-17 14:32:44 -04:00
Colin Walters
0e1a3ee345 gsubprocess: Fix up communicate
We weren't closing the streams after we were done reading or writing,
which is kind of essential.  The easy way to fix this is to just use
g_output_stream_splice() to a GMemoryOutputStream rather than
hand-rolling it.  This results in a substantial reduction of code
complexity.

A second serious issue is that we were marking the task as complete when
the process exits, but that's racy - there could still be data to read
from stdout.  Fix this by just refcounting outstanding operations.

This code, not surprisingly, looks a lot like the "multi" test.

Next, because processes output binary data, I'd be forced to annotate
the char*/length pairs as (array) (element-type uint8).  But rather than
doing that, it's *far* simpler to just use GBytes.

We need a version of this that actually validates as UTF-8, that will be
in the next patch.
2013-10-17 14:32:44 -04:00
Colin Walters
5b48dc40cc GSubprocess: New class for spawning child processes
There are a number of nice things this class brings:

0) Has a race-free termination API on all platforms (on UNIX, calls to
   kill() and waitpid() are coordinated as not to cause problems).
1) Operates in terms of G{Input,Output}Stream, not file descriptors
2) Standard GIO-style async API for wait() with cancellation
3) Makes some simple cases easy, like synchronously spawning a
   process with an argument list
4) Makes hard cases possible, like asynchronously running a process
   with stdout/stderr merged, output directly to a file path

Much rewriting and code review from Ryan Lortie <desrt@desrt.ca>

https://bugzilla.gnome.org/show_bug.cgi?id=672102
2013-10-17 14:32:44 -04:00
Ryan Lortie
e30bbca667 gspawn: support creating pipes with O_CLOEXEC
Add a new flag, G_SPAWN_CLOEXEC_PIPES, for creating the stdin/out/err
pipes with O_CLOEXEC (for the usual reasons).
2013-10-17 14:32:41 -04:00
Colin Walters
c515c3ed11 gio: Add private API to create win32 streams from fds
This will be used by GSubprocess.

https://bugzilla.gnome.org/show_bug.cgi?id=672102
2013-10-17 14:27:07 -04:00
Ihar Hrachyshka
aaddd823bc Removed obsolete makefile rules
Removed test, test-report, full-report, perf-report.  They all come from
an old (now obsolete) approach toward glib testing[1]. Now the blessed
ways to test glib are 'make check' and installed tests.

[1]: https://mail.gnome.org/archives/gtk-devel-list/2007-November/msg00000.html

https://bugzilla.gnome.org/show_bug.cgi?id=709995
2013-10-17 13:20:14 -04:00
Jasper St. Pierre
a2f6f0d2f6 gtask: Fix invalid name in documentation 2013-10-17 13:04:06 -04:00
Ryan Lortie
9defb6b1b1 New gapplication(1) tool
This is essentially a commandline implementation of the client-side of
the org.freedesktop.Application D-Bus interface.

It includes support for tab-completion based on desktop files and their
contents.

https://bugzilla.gnome.org/show_bug.cgi?id=704218
2013-10-17 10:12:27 -04:00
Ryan Lortie
4e1e36a7f0 Revert "gapplication: don't rely on cmdline being finalized immediately"
This reverts commit c5748328be.
2013-10-17 08:22:11 -04:00
Cosimo Cecchi
c5748328be gapplication: don't rely on cmdline being finalized immediately
The GApplicationCommandLine DBus implementation currently calls
g_dbus_method_invocation_return_value() in its finalize() implementation
only, relying on the object being destroyed after g_object_unref() is
called on it inside g_application_impl_method_call().

While this is usually fine for C applications, when overriding the
command_line vfunc from language bindings, the binding might add extra
references to the object, which might not be released immediately - e.g.
because they're garbage collected, or possibly even leaked. The same
scenario could happen in a C application that decides to keep a
reference to the passed-in GApplicationCommandLine object.

To ensure the CommandLine DBus method always gets a reply after the
invocation of command_line in the primary instance, explicitly send the
message back before dropping our reference to the object.

https://bugzilla.gnome.org/show_bug.cgi?id=708042
2013-10-16 23:06:13 -04:00
Colin Walters
be2656f139 g_file_copy: Fall back to pathname queryinfo to help gvfs backends
It's not difficult to do; not all backends implement it, and for some
it may be difficult to implement query_info_on_read(), so let's just
do both.

https://bugzilla.gnome.org/show_bug.cgi?id=706254
2013-10-16 13:33:14 -04:00
Xavier Claessens
4fea5c0029 Fix wrong function names in g_str_match_string() documentation 2013-10-15 11:02:40 -04:00
Ihar Hrachyshka
b2c15f18b2 Updated reference to README.commits
The major useful information regarding commits is now placed in
README.commits, not README.

https://bugzilla.gnome.org/show_bug.cgi?id=709994
2013-10-15 10:11:12 -04:00
Andika Triwidada
c6d7e1ede7 Updated Indonesian translation 2013-10-15 11:54:59 +07:00
Xavier Claessens
0420295430 Add testcase for search utilities functions
https://bugzilla.gnome.org/show_bug.cgi?id=709753
2013-10-14 16:48:47 -04:00
Ryan Lortie
38dfce5992 Add simple string "search" function
Add a pair of functions to make it easier to do simple string matching.

This will be useful for use with things like GtkSearchBar and will also
be the basis of the searching done by the (soon to appear)
g_desktop_app_info_search()

https://bugzilla.gnome.org/show_bug.cgi?id=709753
2013-10-14 16:48:42 -04:00
Ryan Lortie
4c510801cf Add g_str_is_ascii()
Add a function for checking if a string is pure ASCII.

https://bugzilla.gnome.org/show_bug.cgi?id=709753
2013-10-14 16:48:37 -04:00
Noah Massey
c4c3ee6087 gmain: mark newest id used when source id overflows
When the source id reaches G_MAXUINT (just prior to overflow), we
record the existing source ids to prevent reassigning them.  As we are
about to assign G_MAXUINT to the triggering source, that id should be
added as well.

https://bugzilla.gnome.org/show_bug.cgi?id=710002
2013-10-13 10:25:39 -04:00
Colin Walters
e2d5282636 GMemoryOutputStream: Don't return -1 as a gboolean in precondition
Since it could confuse callers (admittedly who are already violating
a precondition).

Just spotted while adapting some bits of this code for a ssh library.
2013-10-08 12:19:11 -04:00
Nilamdyuti Goswami
30772e74bf Assamese translation updated 2013-10-07 12:56:28 +05:30
Dan Winship
8e17040c15 Fix overloading of "source" and "target" terminology in GBinding
GBindingTransformFunc called its arguments "source_value" and
"target_value", but in the transform_from function of a bidirectional
binding, "source_value" comes from the target object, and
"target_value" comes from the source object, which quickly gets
confusing if you need to use g_binding_get_source(), etc, in the
function.

Of course developers can call their transform function arguments
whatever they want, but many will copy from the headers/docs to start
out, so use less confusing names here ("from_value" and "to_value").

Also, fix the documentation to describe the bidirectional case
correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=709440
2013-10-06 14:24:43 -04:00
Kalev Lember
be7f40185f xdgmime: Fix an invalid read
This commit factors out a function for comparing string suffixes, and at
the same time makes it safe for mime types that are shorter than the
"/*" suffix.

==25418== Invalid read of size 1
==25418==    at 0x3C6D0F9D22: __gio_xdg_cache_mime_type_subclass (xdgmimecache.c:848)
==25418==    by 0x3C6D09ED8C: g_content_type_is_a (gcontenttype.c:158)
==25418==    by 0x34D8031E95: gtk_recent_filter_filter (gtkrecentfilter.c:733)
==25418==    by 0x34D802F167: _gtk_recent_chooser_get_items (gtkrecentchooserutils.c:387)
==25418==    by 0x34D802D07F: idle_populate_func (gtkrecentchoosermenu.c:1011)
==25418==    by 0x34D7A20477: gdk_threads_dispatch (gdk.c:804)
==25418==    by 0x3C6C0492F5: g_main_context_dispatch (gmain.c:3065)
==25418==    by 0x3C6C049677: g_main_context_iterate.isra.23 (gmain.c:3712)
==25418==    by 0x3C6C04972B: g_main_context_iteration (gmain.c:3773)
==25418==    by 0x34D7FC2AF4: gtk_main_iteration (gtkmain.c:1262)
==25418==    by 0x408EB4: main (in /usr/bin/glade)

https://bugzilla.gnome.org/show_bug.cgi?id=708529
2013-10-04 22:08:36 +02:00
John Ralls
5aead642c2 Restore gl_GLIBC21 to configure; needed for libcharset 2013-10-04 11:47:46 -07:00
Ryan Lortie
e0ffd5c184 appinfo: Don't try DBusActivatable with load_from_keyfile
We can't get the name of the filename, so we can't determine the application
ID.  We'll have to fallback on Exec= for this case.

https://bugzilla.gnome.org/show_bug.cgi?id=709326
2013-10-04 12:19:03 -04:00
Ryan Lortie
5d7a7df867 Add g_key_file_save_to_file()
To write a keyfile to disk.

https://bugzilla.gnome.org/show_bug.cgi?id=309224
2013-10-04 12:18:20 -04:00
Dan Winship
5a269e5a90 gcredentials: add Solaris support
Based on patches from Igor Pashev.

https://bugzilla.gnome.org/show_bug.cgi?id=705029
2013-10-04 09:51:31 -04:00
Dan Winship
66edac7fb9 gcredentials: add Hurd support
It uses the same system as FreeBSD.

https://bugzilla.gnome.org/show_bug.cgi?id=708265
2013-10-04 09:51:31 -04:00
Dan Winship
cedd697bf8 gcredentials: add internal macros to simplify all the #ifdefs
Rather than having lots of obscure platform-based #ifdefs all over
gio, define some macros in gcredentialsprivate.h, and use those to
simplify the rest of the code.

https://bugzilla.gnome.org/show_bug.cgi?id=701482
2013-10-04 09:51:31 -04:00
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