Commit Graph

3332 Commits

Author SHA1 Message Date
Ryan Lortie
89d48d7800 Add g_application_command_line_get_stdin()
This returns a GInputStream corresponding to the stdin on the
commandline that caused this invocation.

The local case works on both UNIX (GUnixInputStream on stdin) and
Windows (GWin32InputStream on GetStdHandle(STD_INPUT_HANDLE)).  The
remote case works only on UNIX (by fd passing over D-Bus).

https://bugzilla.gnome.org/show_bug.cgi?id=668210
2012-12-27 11:00:49 -05:00
Matthias Clasen
0178402c6d Revert "tests: port from g_test_trap_subprocess() to g_test_trap_fork()"
This reverts commit ea06ec8063.
2012-12-19 15:20:37 -05:00
Simon McVittie
2fe36a2238 Check that credentials pass through D-Bus on supported platforms
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=687920
2012-12-19 15:14:35 -05:00
Simon McVittie
32bfd46c7b GCredentials: add a regression test
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=687920
2012-12-19 15:14:27 -05:00
Simon McVittie
8f65536504 GCredentials: add getter/setter for the Unix process ID
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=687920
2012-12-19 15:08:09 -05:00
Dan Winship
ea06ec8063 tests: port from g_test_trap_subprocess() to g_test_trap_fork()
(or, in a few cases, to g_test_expect_message())

https://bugzilla.gnome.org/show_bug.cgi?id=679683
2012-12-19 14:35:10 -05:00
Dan Winship
69ad5010e3 inotify: fix compile 2012-12-19 09:10:12 -05:00
Dan Winship
3a7244bd0c Add "Since 2.36" to G_FILE_MONITOR_WATCH_HARD_LINKS doc 2012-12-19 08:22:23 -05:00
Ryan Lortie
707bc4a40f gio + inotify support for hard links
Add a new GFileMonitorFlag: G_FILE_MONITOR_WATCH_HARD_LINKS.  When set,
changes made to the file via another hard link will be detected.

Implement the new flag for the inotify backend.

https://bugzilla.gnome.org/show_bug.cgi?id=532815
2012-12-19 08:19:18 -05:00
Rico Tzschichholz
d04faab327 gio: Fix build with -Werror=format-security 2012-12-18 21:32:01 +01:00
PHO
f0f6c8d231 gsocket: Work around broken CMSG_FIRSTHDR()
As RFC 2292 points out, some platforms (e.g. Darwin 9.8.0) provide
CMSG_FIRSTHDR(msg) which just returns msg.msg_control without first
checking if msg.msg_controllen is non-zero. We need a workaround for
such platforms not to let g_socket_receive_message() segfault.

https://bugzilla.gnome.org/show_bug.cgi?id=690388
2012-12-18 13:31:02 -05:00
Colin Walters
780871d273 GOutputStream: Fix a compiler warning 2012-12-18 13:21:24 -05:00
Dan Winship
07bb8097e5 gtask: don't deadlock when tasks block on other tasks
If tasks block waiting for other tasks to complete then the system can
end up starved for threads. Avoid this by bumping up max-threads in
that case.

This also reverts 7b1f8c58 and reverts max-threads for GTask's
GThreadPool back to 10.

https://bugzilla.gnome.org/show_bug.cgi?id=687223
2012-12-18 13:19:08 -05:00
Dan Winship
ed5accf16c gio: port file/vfs-related classes from GSimpleAsyncResult to GTask
https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-12-18 09:07:24 -05:00
Dan Winship
669505e354 gio: port basic I/O classes from GSimpleAsyncResult to GTask
https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-12-18 09:07:19 -05:00
Matthias Clasen
c23122b5e9 Fix distcheck 2012-12-17 19:15:29 -05:00
Dan Winship
df334d6e00 gsocket: improve sockopt handling for IPv4-wrapped-IPv6 sockets
On IPv6 sockets, set both the IPv4 and IPv6 versions of IP socket
options, in case the socket is (or might become) IPv4-wrapped. (But
ignore errors when setting the IPv4 version.)

Similarly, when joining or leaving a multicast group, pick the sockopt
to use based on the address family of the multicast address rather
than the address family of the socket.

https://bugzilla.gnome.org/show_bug.cgi?id=687092
2012-12-17 09:01:05 -05:00
Chun-wei Fan
4b859e4e7a Add a preconfigured gio/gnetworking.h for Windows
Since Windows builds by Visual C++ do not make use of autotools during
its build process, we need to dist a pre-configured
gio/gnetworking.h(.win32) for such builds.

The vs9/vs10 (and therefore vs11) property sheets are updated as well

https://bugzilla.gnome.org/show_bug.cgi?id=690163
2012-12-15 00:22:37 +08:00
Tomas Bzatek
cc3171f680 docs: Fix return value of g_file_set_attributes_from_info()
GIO API usually returns FALSE and sets GError when something went wrong
and it was also the case of this method, just being badly documented.
2012-12-14 16:54:09 +01:00
Jasper St. Pierre
3c87ab97ff gfileenumerator: Add a g_file_enumerator_get_child method
This is a new convenience method designed to simplify some use
cases of GFileEnumerator, by making it easy to get the next file
from a file enumerator.

https://bugzilla.gnome.org/show_bug.cgi?id=690083
2012-12-13 21:38:18 -05:00
Dan Winship
211ed1775d gsocket: add getsockopt/setsockopt wrappers
Add g_socket_get_option() and g_socket_set_option(), wrapping
getsockopt/setsockopt for the case of integer-valued options. Update
code to use these instead of the underlying calls.

https://bugzilla.gnome.org/show_bug.cgi?id=623187
2012-12-12 15:20:22 +01:00
Dan Winship
b377e69685 Add gnetworking.h
Install a public "gnetworking.h" header that can be used to include
the relevant OS-dependent networking headers. This does not really
abstract away unix-vs-windows however; error codes, in particular,
are incompatible.

gnetworkingprivate.h now contains just a few internal URI-related
functions

Also add a g_networking_init() function to gnetworking.h, which can be
used to explicitly initialize OS-level networking, rather than having
that happen as a side-effect of registering GInetAddress.

https://bugzilla.gnome.org/show_bug.cgi?id=623187
2012-12-12 15:20:22 +01:00
Dan Winship
9e90575502 gio: move resolver utils from gresolver.c to gthreadedresolver.c
Since there is only one resolver implementation now, we can move the
resolver utility functions from gresolver.c into gthreadedresolver.c,
and remove the prototypes from gnetworkingprivate.h.

https://bugzilla.gnome.org/show_bug.cgi?id=623187
2012-12-12 15:20:22 +01:00
Dan Winship
afdb2abb13 gio: Don't leak the temp file when g_file_replace() fails or is cancelled
If the temp file still exists at the end of the close operation,
unlink it.

https://bugzilla.gnome.org/show_bug.cgi?id=629301
2012-12-10 17:04:05 +01:00
David Zeuthen
d77948eadf fileinfo: mark lost+found/ root directory as hidden
This was reported in bug 689800.

https://bugzilla.gnome.org/show_bug.cgi?id=689800

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-12-06 16:21:58 -05:00
Timothy Arceri
510ba9b4ef Support for .hidden files
https://bugzilla.gnome.org/show_bug.cgi?id=587806
2012-12-06 16:18:19 -05:00
Ryan Lortie
6869454103 add two missing version macros 2012-12-06 13:58:42 -05:00
Ryan Lortie
7c98844760 various: add missing cases of #include "config.h" 2012-12-06 13:30:31 -05:00
Colin Walters
1e74e46a00 gdbusobjectskeleton: Fix compiler warnings
The G_OBJECT_WARN_INVALID_PROPERTY_ID() macro uses a local variable
named "_object"; work around this by using "object" as the variable we
pass in.

https://bugzilla.gnome.org/show_bug.cgi?id=689377
2012-12-05 13:30:15 -05:00
Aleksander Morgado
ac025007cc gsocketlistener: set source object tag before completing the GTask
Otherwise, the finish() method won't find the source object.

https://bugzilla.gnome.org/show_bug.cgi?id=689538
2012-12-03 15:59:06 +01:00
Kalev Lember
80c24d36f2 win32: Fix GDBusDaemon build when glib is built as a static lib
This makes sure not to ifdef _g_io_win32_get_module() out when glib is
built as a static lib, and also fixes it to work when DllMain isn't
available.

The implementation uses GetModuleHandleEx() which is only available on
Windows XP and later, so this commit effectively drops the Windows 2000
support in glib. Earlier commit 731b4699 already took care of defining
_WIN32_WINNT to support the Windows XP API.

https://bugzilla.gnome.org/show_bug.cgi?id=675516
2012-12-02 18:19:31 +01:00
Evan Nemerson
e261b9c030 gtask: annotate source_object arguments and return values as GObject
https://bugzilla.gnome.org/show_bug.cgi?id=688419
2012-12-01 22:40:08 -08:00
Mike Gorse
fe0b77fea8 Optimize reading strings when deserializing gdbus messages
Now that we're directly accessing the memory holding a message blob,
we can access strings directly while reading them. This speeds up
read_string significantly, since we no longer malloc/memcpy/free.
2012-11-30 15:51:47 -06:00
Matthias Clasen
a5f57bad20 g_file_enumerate_children: Fix reference to wrong error code
This function does in fact return G_IO_ERROR_NOT_DIRETORY, and
not G_FILE_ERROR_NOTDIR.
2012-11-30 09:05:41 -05:00
Alexander Larsson
936254c386 Don't look for icons called "(null)" if no xdg mime icon 2012-11-30 09:39:52 +01:00
Emilio Pozuelo Monfort
edf94ba263 Fix race condition in gapplication/basic test
The three processes this test creates need to be executed
in order, and g_usleep was used to guarantee that.
However, under heavy load, that is not enough. Instead,
wait until the children start by making sure they have
written to stdout before proceeding any further.

https://bugzilla.gnome.org/show_bug.cgi?id=664627
2012-11-30 00:07:58 +01:00
Mike Gorse
3e5214c15c Use a simple struct when reading and writing gdbus messages
GData*Streams incur significant overhead, and we do not need all of the
functionality that they provide, since we only ever read from/write to
memory when handling message blobs, so it is more performant to use a
simple structure.

https://bugzilla.gnome.org/show_bug.cgi?id=652650
2012-11-29 14:15:34 -06:00
Juan Pablo Ugarte
ccd1fb6820 Added G_IO_ERROR_BROKEN_PIPE 2012-11-29 16:29:47 -03:00
Ryan Lortie
52c608dd0d gio: GLIB_AVAILABLE_IN to more APIs
Useful on its own, but also for a future patch for symbol visibility.

https://bugzilla.gnome.org/show_bug.cgi?id=688681
2012-11-29 14:07:27 -05:00
Kalev Lember
ce586ba991 Unconditionally use g_content_type_get_symbolic_icon()
... and g_content_type_get_generic_icon_name(). The new functions are
implemented for Win32 since commit dace477c, so we no longer need to
guard them with G_OS_UNIX.
2012-11-28 23:25:52 +01:00
Sebastian Dröge
c9affa778e Revert "Fix compilation on Android with the bionic C library"
This reverts commit cb0ed84d40.

It wasn't meant to be pushed yet.
2012-11-28 16:55:12 +01:00
Sebastian Dröge
cb0ed84d40 Fix compilation on Android with the bionic C library 2012-11-28 16:32:48 +01:00
Matthias Clasen
65740f62bf Fix suprisingly hard-to-spot typo 2012-11-28 00:58:03 -05:00
Colin Walters
ed5c17e11f GMemoryOutputStream: Add new _resizable() constructor usable from bindings
Really, the memory output stream API is too warped around the model
where it's a fixed size buffer that you've already allocated.  Even in
C, I find myself always wanting to use it to just accumulate data into
an arbitrary-sized buffer it allocates.

Unfortunately, it's also not usable from bindings because it's not
common to bind g_free() and g_realloc(), but if you just pass NULL, you
get the default of a fixed size, which is useless as per above.

I am going to use this from a gjs test case, and the GSubprocess test
cases also will use it.

https://bugzilla.gnome.org/show_bug.cgi?id=688931
2012-11-27 20:45:21 -05:00
Bastien Nocera
7a5dd54f47 fileinfo: Add missing AVAILABLE macro
As forgotten in previous patch.
2012-11-27 17:23:08 +01:00
Bastien Nocera
f635f1fd16 fileinfo: Add _get_deletion_date() helper
For use in gnome-settings-daemon, so that callers don't have
to parse the deletion date by hand.
2012-11-27 16:59:28 +01:00
Ryan Lortie
3baf256a2c gio: New API for GFile from remote commandline arg
Add a pair of new APIs: one to GFile to create a new file from a
commandline arg relative to a given cwd and one to
GApplicationCommandLine to create a GFile from an arg, relative to the
cwd of the invoking commandline.

https://bugzilla.gnome.org/show_bug.cgi?id=689037
2012-11-27 10:10:37 -05:00
Paolo Borelli
ee8080cc0b Add GApplication local_command_line test
Assert that startup and shutdown are not called if we return TRUE from
local_command_line
2012-11-24 19:21:54 +01:00
Ryan Lortie
543bbd8752 GApplication: don't shutdown() on failure to start
If we fail to start (and don't register() or call startup()) then also
don't call shutdown().  This happens in the case of failing to parse
commandline arguments, for example.
2012-11-24 13:20:29 -05:00
Matthias Clasen
4ffa472438 Add a test for the GAppLaunchContext::launched signal 2012-11-21 21:20:25 -05:00