Commit Graph

3320 Commits

Author SHA1 Message Date
Dan Winship
d21309464c gio: port networking classes from GSimpleAsyncResult to GTask
https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-10-10 10:29:37 -04:00
Dan Winship
130d0fdac0 gio: port GAsyncInitable from GSimpleAsyncResult to GTask
https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-10-10 10:29:36 -04:00
Dan Winship
55e7ca6e1b gio: deprecate gioscheduler, soft deprecate GSimpleAsyncResult
Reimplement gioscheduler in terms of GTask, and deprecate the original
gioscheduler methods. Update docs to point people to GTask rather than
gioscheduler and GSimpleAsyncResult, but don't actually formally
deprecate GSimpleAsyncResult yet.

https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-10-10 10:29:36 -04:00
Dan Winship
b20eec3294 gio: port GThreadedResolver from GSimpleAsyncResult to GTask
https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-10-10 10:29:36 -04:00
Dan Winship
4aeefa70a1 GTask: new GAsyncResult implementation / threaded task manager
GTask is a replacement for GSimpleAsyncResult and GIOScheduler, that
also allows for making cancellable wrappers around non-cancellable
functions (as in GThreadedResolver).

https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-10-10 10:29:36 -04:00
Aleksander Morgado
fd29b2f356 gdbus: minor documentation fix in g_dbus_interface_skeleton_has_connection()
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=685697
2012-10-09 07:22:41 +02:00
Dan Winship
7e6fa556ec GFileMonitor: thread-safety fix for non-default-main-context monitors
When queuing events to another thread, we need a mutex around
priv->pending_file_changes and priv->pending_file_change_source.

https://bugzilla.gnome.org/show_bug.cgi?id=682950
2012-10-06 10:40:53 -04:00
Colin Walters
05461e5709 codegen: Install Python files in $(datadir)/glib-2.0, rather than $(libdir)
These files are actually architecture-indepdendent; using $(libdir)
for them means that /usr/bin/gdbus-codegen varies between
architectures, which is problematic for (mis)uses of multilib.

See https://bugzilla.redhat.com/show_bug.cgi?id=718404

https://bugzilla.gnome.org/show_bug.cgi?id=685012
2012-10-05 17:00:13 -04:00
Colin Walters
ce06987449 codegen: Explicitly close output
This is just cleaner rather than relying on the GC, and maybe
if we're lucky it will actually solve a problem.

https://bugzilla.gnome.org/show_bug.cgi?id=684909
2012-10-05 16:50:48 -04:00
David Zeuthen
a8a416181c gdbus-codegen: Update tests for new inheritance-semantics for Since
Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-10-03 11:23:04 -04:00
David Zeuthen
fa6a684630 gdbus-codegen: make members of an interface inherit the "Since" annotation
This is the expected (and sane) behavior - without this bug-fix you'd
have to add "Since" to every member of a newly added D-Bus interface.

Also show-case this in the codegen example.

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-10-03 11:13:12 -04:00
Matthias Clasen
ec82f61065 Really fix the leak
Pointed out by Josselin Mouette.
2012-09-30 19:24:13 -04:00
Matthias Clasen
7f325939ba Fix memory leaks in glib-compile resources
Based on a patch by Josselin Mouette,
https://bugzilla.gnome.org/show_bug.cgi?id=685069
2012-09-30 14:07:37 -04:00
Matthias Clasen
c44f8f5b9f Document g_test_dbus_get_flags 2012-09-23 20:14:27 -04:00
Matthias Clasen
344066e0c1 Fix gio docs 2012-09-23 02:18:56 -04:00
Chun-wei Fan
3dd65859a7 gio: Fix build on Windows
The newly-introduced functions, g_content_type_get_symbolic_icon() and
g_content_type_get_generic_icon_name() don't seem to be for Windows, at
least for now.  So filter them out from gio.symbols on Windows.

Also, glocalfileinfo.c calls g_content_type_get_symbolic_icon() in
get_icon(), so only build that code when on Unix, for the time being.

https://bugzilla.gnome.org/show_bug.cgi?id=684278
2012-09-19 10:32:05 +08:00
Ryan Lortie
ce3dddb622 GApplication: document differences from libunique
People implementing GApplication often waste a lot of time by trying to
use it as if it were libunique.  Add a note to the docs about the
difference.
2012-09-18 10:14:35 -04:00
Dieter Verfaillie
db22102038 gresource tests: fix VPATH builds emitting errors during dependency generation
Adding the --sourcedir option fixes these:
/path/to/src/gio/tests/test2.gresource.xml: Error on line 5 char 1: Failed to locate 'test1.txt' in current directory.
/path/to/src/gio/tests/test3.gresource.xml: Error on line 5 char 1: Failed to locate 'test1.txt' in current directory.
/path/to/src/gio/tests/test4.gresource.xml: Error on line 5 char 1: Failed to locate 'test1.txt' in current directory.
/path/to/src/gio/tests/test.gresource.xml: Error on line 5 char 1: Failed to locate 'test1.txt' in current directory.
2012-09-17 15:29:59 +02:00
Colin Walters
d6cbb29f59 CVE-2012-3524: Hardening for being run in a setuid environment
Some programs attempt to use libglib (or even libgio) when setuid.
For a long time, GTK+ simply aborted if launched in this
configuration, but we never had a real policy for GLib.

I'm not sure whether we should advertise such support.  However, given
that there are real-world programs that do this currently, we can make
them safer with not too much effort.

Better to fix a problem caused by an interaction between two
components in *both* places if possible.

This patch adds a private function g_check_setuid() which is used to
first ensure we don't run an external dbus-launch binary if
DBUS_SESSION_BUS_ADDRESS isn't set.

Second, we also ensure the local VFS is used in this case.  The
gdaemonvfs extension point will end up talking to the session bus
which is typically undesirable in a setuid context.

Implementing g_check_setuid() is interesting - whether or not we're
running in a privilege-escalated path is operating system specific.
Note that GTK+'s code to check euid versus uid worked historically on
Unix, more modern systems have filesystem capabilities and SELinux
domain transitions, neither of which are captured by the uid
comparison.

On Linux/glibc, the way this works is that the kernel sets an
AT_SECURE flag in the ELF auxiliary vector, and glibc looks for it on
startup.  If found, then glibc sets a public-but-undocumented
__libc_enable_secure variable which we can use.  Unfortunately, while
it *previously* worked to check this variable, a combination of newer
binutils and RPM break it:
http://www.openwall.com/lists/owl-dev/2012/08/14/1

So for now on Linux/glibc, we fall back to the historical Unix version
until we get glibc fixed.

On some BSD variants, there is a issetugid() function.  On other Unix
variants, we fall back to what GTK+ has been doing.

Reported-By: Sebastian Krahmer <krahmer@suse.de>
Signed-off-by: Colin Walters <walters@verbum.org>
2012-09-13 18:34:29 -04:00
William Jon McCann
cc3238a9c9 Add api to get the generic icon name for a mime type
https://bugzilla.gnome.org/show_bug.cgi?id=683744
2012-09-13 12:50:02 -04:00
Matthias Clasen
6a50dc511b Drop GVFS_INOTIFY_DIAG debug feature
Just not a good idea to have this in production code.
2012-09-11 20:24:30 -04:00
Thomas Bechtold
c9a3cd6d8b Fix gdbus connection annotations
g_dbus_connection_call_with_unix_fd_list_sync () and
g_dbus_connection_call_sync () should allow None for the
bus_name parameter.

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

Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-09-11 13:16:32 +01:00
LRN
59ad2acfc5 gwin32mount.c: Fix syntax error
Signed-off-by: Colin Walters <walters@verbum.org>

https://bugzilla.gnome.org/show_bug.cgi?id=683641
2012-09-09 10:49:45 -04:00
Dan Winship
d68609f9fd Revert "xdgmime: plug a small leak"
This reverts commit 4e7031f073.

The string actually does get freed somewhere else, at least in some
cases. Can be looked at again later if this reintroduces a leak.

https://bugzilla.gnome.org/show_bug.cgi?id=683270
2012-09-03 10:07:31 -04:00
Dan Winship
beb0f9c150 gio/tests: fix leaks
https://bugzilla.gnome.org/show_bug.cgi?id=682560
2012-09-03 08:41:23 -04:00
Dan Winship
17bb9d542c gio/tests/cancellable: fix to still work when running slowly
The test was assuming that all cancelled ops would finish within a
certain amount of time, but this often failed under valgrind. Instead,
just run the loop until all of the ops have actually finished.

https://bugzilla.gnome.org/show_bug.cgi?id=682560
2012-09-03 08:40:14 -04:00
Dan Winship
568f737708 gio/tests: port some stuff to g_test_expect_message()
https://bugzilla.gnome.org/show_bug.cgi?id=682560
2012-09-03 08:40:14 -04:00
Dan Winship
039ecf2bc6 g_file_copy: plug a leak
The fallback copy code was leaking the GFileInfo if it didn't have
G_FILE_ATTRIBUTE_STANDARD_TYPE.

https://bugzilla.gnome.org/show_bug.cgi?id=682560
2012-09-03 08:40:14 -04:00
Dan Winship
fa58cef826 GDesktopAppInfo: fix leaks
g_desktop_app_info_ensure_saved() was leaking the file contents.

_g_desktop_app_info_launch_uris_internal() was leaking the session bus
on error.

https://bugzilla.gnome.org/show_bug.cgi?id=682560
2012-09-03 08:36:10 -04:00
Dan Winship
4e7031f073 xdgmime: plug a small leak
https://bugzilla.gnome.org/show_bug.cgi?id=682560
2012-09-03 08:36:10 -04:00
Paolo Borelli
2d85894bc5 Fix gtk-doc for g_app_info_get_supported_types 2012-09-02 12:25:50 +02:00
Aleksander Morgado
724c8a1846 gdbus-codegen: avoid error when wrong interface is provided to --annotate
If the interface given cannot be matched, `iface_obj' was left uninitialized and
the iface_obj == None check would end up crashing:

Traceback (most recent call last):
  File "/usr/bin/gdbus-codegen", line 41, in <module>
    sys.exit(codegen_main.codegen_main())
  File "/usr/lib64/gdbus-2.0/codegen/codegen_main.py", line 175, in codegen_main
    apply_annotations(all_ifaces, opts.annotate)
  File "/usr/lib64/gdbus-2.0/codegen/codegen_main.py", line 146, in apply_annotations
    apply_annotation(iface_list, iface, None, None, None, None, key, value)
  File "/usr/lib64/gdbus-2.0/codegen/codegen_main.py", line 64, in apply_annotation
    if iface_obj == None:
UnboundLocalError: local variable 'iface_obj' referenced before assignment

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=683088
2012-09-01 11:53:19 -04:00
Martin Pitt
55f7061097 Bump max time in test_method_calls_on_proxy() test
On slower platforms, the overhead of the 240 D-BUS Sleep calls is larger than
the current maximum of 6 seconds. A run on a Panda board sometimes fails with

  ERROR:/build/buildd/glib2.0-2.33.8/./gio/tests/gdbus-threading.c:409:test_method_calls_on_proxy:
  assertion failed (elapsed_msec < 6000): (7365 < 6000)

Bump maximum time to 8 seconds to be more resilient to this.

https://bugzilla.gnome.org/show_bug.cgi?id=682222
2012-08-31 18:03:26 +02:00
William Jon McCann
40b4fae42e Add ability to get symbolic icon for content type
https://bugzilla.gnome.org/show_bug.cgi?id=682101
2012-08-30 11:04:43 -04:00
William Jon McCann
a15a071f35 Add symbolic icon support to gfileinfo
https://bugzilla.gnome.org/show_bug.cgi?id=682101
2012-08-30 11:04:43 -04:00
William Jon McCann
a2dca48bf7 Add symbolic icon support to drive, volume, and mount
We need symbolic icon support for display in Nautilus.

https://bugzilla.gnome.org/show_bug.cgi?id=682101
2012-08-30 11:04:43 -04:00
Rui Matos
88d181ef18 gdbus-tool: Check return value of strrchr()
Fixes a crash when invoking gdbus like:

$ gdbus emit --session -o / -s Foo

https://bugzilla.gnome.org/show_bug.cgi?id=682965
2012-08-30 11:51:49 +02:00
Cosimo Cecchi
9bca5bb49f appinfo: fix annotations for g_app_info_launch and g_app_info_launch_uris
The files/uris parameters for these functions can be NULL, so we need an
allow-none annotation here.
2012-08-29 14:46:11 -04:00
Colin Walters
6e64ba58b9 Switch all open() calls to use g_open()
Because it now handles EINTR.  And we should do so.  While most people
use Linux, which tries very hard to avoid propagating EINTR back up
into userspace, it can still happen.

https://bugzilla.gnome.org/show_bug.cgi?id=682833
2012-08-28 13:56:59 -04:00
Colin Walters
2542b6f604 xdgmime: Handle EINTR in open()
https://bugzilla.gnome.org/show_bug.cgi?id=682833
2012-08-28 13:56:58 -04:00
Cosimo Cecchi
62570a52b1 gio: don't quote quark names for G_DEFINE_QUARK 2012-08-28 13:16:25 -04:00
Matthias Clasen
60d2cb665e Use G_DEFINE_QUARK for quarks in GIO 2012-08-28 00:08:08 -04:00
Daiki Ueno
030ebfb93b gsettings-tool: make list-recursively really recurse
https://bugzilla.gnome.org/show_bug.cgi?id=682586
2012-08-28 00:08:06 -04:00
Matthias Clasen
a552989410 GFile: Cosmetic doc changes 2012-08-28 00:08:05 -04:00
Matthias Clasen
0149f44f4a Fix the GDBusProxy async test
Patch by Mike Gorse, bug
https://bugzilla.gnome.org/show_bug.cgi?id=674805
2012-08-28 00:08:05 -04:00
Matthias Clasen
7e07ea8189 Make async permission tests work 2012-08-28 00:08:05 -04:00
Mike Gorse
375943ea21 Fix the gdbus-proxy async test
The async test had several problems:
- It created a proxy and did not launch a main loop, meaning that its
  callback would usually not get called, or, if it did get called, the
test harness would have taken down the connection already, causing an
assertion failure when the proxy had an error.
- It was dependent on the proxy test to set up the server and would fail
  because some properties were modified by that test.

https://bugzilla.gnome.org/show_bug.cgi?id=674805
2012-08-28 00:08:04 -04:00
Dan Winship
b901aaf673 Update .gitignores 2012-08-26 14:40:22 -04:00
Stef Walter
7518f7a674 Revert "gtlscertificate: Add certificate-bytes and private-key-bytes props"
* In order to add contstruct properties to an abstract base
   calls, and retain ABI stability, the base class must add a
   default implementation of those properties.
 * We cannot add a default implementation of certificate-bytes
   or private-key-bytes since certificate and private-key properties
   are writable on construct-only.

This reverts commit 541c985869.

https://bugzilla.gnome.org/show_bug.cgi?id=682081
2012-08-21 13:30:02 +02:00
Stef Walter
a8c784df58 gdbus: Fix double free and use after free of object path
* This occurs when the 'g-object-path' property is read
   on a GDBusObjectSkeleton

https://bugzilla.gnome.org/show_bug.cgi?id=682075
2012-08-21 13:21:26 +02:00
Cosimo Cecchi
0d8a81b722 mount-op: use gint64 instead of guint64 for time_left and bytes_left
Since those can be -1, they need to be signed.

https://bugzilla.gnome.org/show_bug.cgi?id=682284
2012-08-21 10:55:28 +02:00
Ryan Lortie
59394b3e1e Revert the GMarkup attribute collect changes
We need to have some more discussion on this topic.

This reverts commits 86329ba44f and
8d40389d15.

https://bugzilla.gnome.org/show_bug.cgi?id=665634
2012-08-20 18:34:13 -04:00
Lars Uebernickel
07fadc7932 GMenuModel: add test for the new GMenuItem API 2012-08-20 16:26:25 -04:00
Ryan Lortie
6798fcdd0f GMenuItem: add constructor to copy from model
Add g_menu_item_new_from_model() for constructing a GMenuItem that is a
copy of a menu item that's in a GMenuModel.
2012-08-20 16:26:25 -04:00
Ryan Lortie
99478dd893 GMenuItem: add getter APIs
GMenuItem has been write-only up to this point.  Add some APIs for
reading back values as well.
2012-08-20 16:26:25 -04:00
Ryan Lortie
ad79b0f8ef GMenuModel: remove a type safety bug
There was a /* XXX */ in the code here to do proper typechecking of the
GVariant in the menu model when using g_menu_model_get_item_attribute().
We have g_variant_check_format_string() now, so use it.
2012-08-20 16:26:25 -04:00
Marc-André Lureau
d9f6314f57 win32: add pipe-io-cancel-test
Test that win32 streams can be cancelled.
It can even be tested with wine on Linux!

https://bugzilla.gnome.org/show_bug.cgi?id=679288
2012-08-20 17:10:31 +02:00
Marc-André Lureau
b9b2cf6a66 win32: add pipe-io-concurrent
Implement test case suggested by Ryan Lortie on bug:
https://bugzilla.gnome.org/show_bug.cgi?id=679288

"There is a potential race here that's really unlikely to happen, but
here we go: We are trying to read from the same socket in two threads.
Some data comes. That causes the poll() in both threads (above) to
finish running. Then the cancellable is checked above. We now find
ourselves here. Only one thread will read the data. The other will
block on this function. Then the user may cancel the cancellable while
we are blocked here, but we will stay blocked...."
2012-08-20 17:10:31 +02:00
Marc-André Lureau
1c1ba8b512 win32: add pipe-io-overlap-test 2012-08-20 17:10:31 +02:00
Marc-André Lureau
b9d7b80897 win32: make gio stream cancellable
v2:
 - fix cancellation of concurrent readers
 - replace g_assert() usage with g_warn_if_fail()
v3:
 - fix indentation
 - fix loop code to not leak (silly me)

https://bugzilla.gnome.org/show_bug.cgi?id=679288
2012-08-20 17:10:31 +02:00
Marc-André Lureau
4b5d762d5d win32: handle ERROR_MORE_DATA
If a named pipe is being read in message mode and the next message is
longer than the nNumberOfBytesToRead parameter specifies, ReadFile
returns FALSE and GetLastError returns ERROR_MORE_DATA.

Since the API doesn't allow to return both a GError and the number of
bytes read so far, it makes more sense to return nread, and let the
client call GetLastError() himself to check if ERROR_MORE_DATA.

The current alternative loses the nread information.

https://bugzilla.gnome.org/show_bug.cgi?id=679288
2012-08-20 17:10:31 +02:00
Marc-André Lureau
23d80a04da win32: use overlapped events for streams
Any file handle created with FLAG_OVERLAPPED must have
ReadFile()/WriteFile() called with an OVERLAPPED structure.
Failing to do so will give unspecified results, invalid read/write or
corruption.

Without FLAG_OVERLAPPED, it is not possible to read and write
concurrently, even with two seperate threads, created by 2 input and
output gio streams. Also, only with FLAG_OVERLAPPED may an IO
operation be asynchronous and thus be cancellable.

We may want to call ReOpenFile() to make sure the FLAG is set, but
this API is only available since Vista+.

According to MSDN doc, adding the OVERLAPPED argument for IO operation
on handles without FLAG_OVERLAPPED is allowed, and indeed the existing
test still passes.

v2:
- update GetLastError() after _g_win32_overlap_wait_result ()
- split the unrelated ERROR_MORE_DATA handling

https://bugzilla.gnome.org/show_bug.cgi?id=679288
2012-08-20 17:10:31 +02:00
Matthias Clasen
cbf346ce53 Remove some more 'the the' 2012-08-19 02:27:04 -04:00
Matthias Clasen
efd822bb07 Improve test coverage for GSocketConnection 2012-08-19 02:26:42 -04:00
Matthias Clasen
cc5d7ccdba Improve test coverage for unix socket addresses 2012-08-19 02:26:05 -04:00
Matthias Clasen
63eaeb223b Improve test coverage for resources 2012-08-19 02:25:37 -04:00
Matthias Clasen
beea8c5c84 Improve test coverage for filter streams 2012-08-19 02:25:21 -04:00
Matthias Clasen
b22f4a2dd2 Improve test coverage for unix streams 2012-08-19 02:25:02 -04:00
Matthias Clasen
3afec2b872 Improve test coverage for pollable streams 2012-08-19 02:24:44 -04:00
Matthias Clasen
eeb4951c47 Improve GSettings test coverage 2012-08-19 02:24:04 -04:00
Matthias Clasen
f89e9deaec Improve GAppInfo test coverage 2012-08-19 02:23:32 -04:00
Matthias Clasen
35bf77445b Add some GInetAddress tests 2012-08-19 02:22:59 -04:00
Matthias Clasen
867ad1cebc Add some GPermission tests 2012-08-19 02:22:33 -04:00
Matthias Clasen
2687d921e1 Cosmetic change
gtk-doc doesn't need <!-- --> anymore to recognize plural
forms of links.
2012-08-19 02:21:02 -04:00
Matthias Clasen
4dbcd27eee Make GPermission more forgiving
It is not great if calling g_permission_acquire on a simple
permission object just segfaults. This commit arranges for
this to return a G_IO_ERROR_NOT_SUPPORTED error.
2012-08-19 02:19:27 -04:00
Matthias Clasen
4a8740d0d2 It is 'registered', not 'registred' 2012-08-18 23:17:47 -04:00
Matthias Clasen
e27367f341 Exterminate 'the the' 2012-08-18 23:15:58 -04:00
Chun-wei Fan
2954f70d39 Fix build on Visual C++
-glib/gmarkup.c: Use G_VA_COPY() instead of va_copy() as va_copy() may not
 be universally available.
-gio/gtestdbus.c: Include io.h on Windows for close()
2012-08-17 19:22:43 +08:00
Matthias Clasen
b13a79aeb4 Adapt schema tests to changed error messages 2012-08-17 01:15:08 -04:00
Matthias Clasen
86329ba44f gdbus: Use g_markup_collect_known_attributes() in GDBus introspection
In order to be able to cope with the introspection XML
from the Telepathy specification, which uses attributes
like tp:type and tp:name-for-bindings, we need to ignore
unknown attributes when parsing.
Closes: https://bugzilla.gnome.org/show_bug.cgi?id=665634
2012-08-16 23:41:19 -04:00
Matthias Clasen
21aff13d22 Fix 'make report'
Turns out this doesn't work unless every Makefile.am includes
Makefile.decl.
2012-08-16 23:23:16 -04:00
Matthias Clasen
6bee6dbce5 Miscellaneous string fixes
Typo and punctuation fixes, and some rewording, based
on a patch by Philip Withnall, bug
https://bugzilla.gnome.org/review?bug=628193
2012-08-16 23:02:41 -04:00
Matthias Clasen
e4dc223e9d Make capitalisation of "UNIX" consistent in translatable strings
Based on a patch by Philip Withnall, bug
https://bugzilla.gnome.org/review?bug=628193
2012-08-16 22:47:43 -04:00
Matthias Clasen
191f09b044 Change "dash" to "hyphen" in translatable strings
GSchemas use hyphens, not dashes.
Patch by Philip Withnall, bug
https://bugzilla.gnome.org/review?bug=628193
2012-08-16 22:23:20 -04:00
Matthias Clasen
4e55bebb7a Fix leak in GWinHttpVfs
Patch by Ole André Vadla Ravnås, bug
https://bugzilla.gnome.org/show_bug.cgi?id=627423
2012-08-16 22:17:46 -04:00
Matthias Clasen
6ef1e56479 Fix leak in GFileAttributeInfoList
Patch by Ole André Vadla Ravnås, bug
https://bugzilla.gnome.org/show_bug.cgi?id=627423
2012-08-16 22:15:54 -04:00
Owen W. Taylor
d7e1d51fc9 Add tests for g_file_make_directory_with_parents()
Add tests to catch recent regressions with g_file_make_directory_with_parents()

https://bugzilla.gnome.org/show_bug.cgi?id=680823
2012-08-16 18:08:08 -04:00
Owen W. Taylor
f899358156 g_file_make_directory_with_parents: clean up logic
Simplify logic by only looking at whether we have a GError and
not also using return codes.

https://bugzilla.gnome.org/show_bug.cgi?id=680823
2012-08-16 18:08:06 -04:00
Owen W. Taylor
5291190f46 g_file_make_directory_with_parents(): fix a corner case
If g_file_get_parent() unexpectedly failed, we could return
FALSE but with no error.

https://bugzilla.gnome.org/show_bug.cgi?id=680823
2012-08-16 18:08:05 -04:00
Owen W. Taylor
732470a359 g_file_make_directory_with_parents: refix error propagation
The patch from b0bce4ad triggered segfaults - see:

 http://redmine.yorba.org/issues/5656

We were clearing the error before dereferencing it in the next
go-around of the while loop - this wasn't necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=680823
2012-08-16 18:08:03 -04:00
Javier Jardón
f8a5fc2e2e Revert "Use upstream gettext instead the glib one"
Commited by mistake
This reverts commit e930e3b3aa.
2012-08-15 02:46:16 +09:00
Javier Jardón
e930e3b3aa Use upstream gettext instead the glib one 2012-08-15 01:41:11 +09:00
Stef Walter
541c985869 gtlscertificate: Add certificate-bytes and private-key-bytes props
* These properties contain the same data as certificate and
   private-key, but as GBytes

https://bugzilla.gnome.org/show_bug.cgi?id=681319
2012-08-06 22:23:20 +02:00
Matthias Clasen
b55a2a2005 Don't use GIO in GTestDBus setup
Using GIO here may cause the gvfs module to be loaded, which
in turn gets onto the session bus to talk to gvfsd - not ideal
if you are trying to control the session bus life cycle. Instead,
just use old-fashioned glib file utils.
2012-08-06 12:08:21 -04:00
Matthias Clasen
cc80ae321f Solaris build fix for GIO
Solaris/OpenSolaris/OpenIndiana define FIONREAD in sys/filio.h.
This commit adds a configure check for this header, and includes
it conditionally in gio/gsocket.c.

Patch by Fabian Groffen, bug 675524.
2012-08-06 11:55:59 -04:00
Dan Winship
bd883f8dc7 gio/tests/g-icon.c: fix some path checks on win32
Some of the tests needed to be modified to use G_DIR_SEPARATOR_S
rather than hardcoded "/"s.

https://bugzilla.gnome.org/show_bug.cgi?id=669331
2012-08-06 11:31:52 -04:00
Dan Winship
291853bea3 gicon: make g_icon_new_for_string() recognize win32 paths
(but for compatibility, make it still recognize unix paths on win32
too)

https://bugzilla.gnome.org/show_bug.cgi?id=669331
2012-08-06 11:27:39 -04:00
Dan Winship
26f1e0938e gio/tests/file: skip the file monitor tests if using GPollFileMonitor
test_create_delete() assumes that if it creates a file and then
immediately deletes it, that the file monitor will notice this and
record it as a create followed by a delete. But that won't work with
GPollFileMonitor, which will just think nothing changed. So skip the
test in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=669331
2012-08-06 11:27:38 -04:00
Dan Winship
2793b39ea3 gio/tests/g-file.c: fix some path checks on win32
Some of the tests needed to be modified to use G_DIR_SEPARATOR_S
rather than hardcoded "/"s.

https://bugzilla.gnome.org/show_bug.cgi?id=669331
2012-08-06 11:27:37 -04:00
Dan Winship
5c91af7e41 glocalfile: fix g_file_get_parse_name() on win32
When getting the parse name for a file: URI on win32, we were not
translating "\" to "/", resulting in incorrect output.

https://bugzilla.gnome.org/show_bug.cgi?id=669331
2012-08-06 11:27:36 -04:00
Matthias Clasen
b2ddbd8f55 Plug a minor memory leak in GDBusObjectProxy
As pointed out by Patrick Ohly in bug 680505,
GDBusObjectProxy was forgetting to free its object_path.
2012-08-06 11:03:42 -04:00
Brian Koning
10474aca34 Remove extra newline chars in local g_application_command_line_print/err
The extra newline chars in the local implementation of g_application_command_line_print and g_application_command_line_printerr() cause an unwanted newline after printed strings. This patch removes the newline chars to make the functions consistent with their documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=680459
2012-08-06 10:17:30 -04:00
Pavel Vasin
151b198b93 GDBusActionGroup: hold ref until async init done
to avoid use-after-free if GDBusActionGroup was finalized

https://bugzilla.gnome.org/show_bug.cgi?id=679509
2012-08-06 10:08:13 -04:00
Pavel Vasin
b2d848e3cb gio/tests/actions: test for bug679509 2012-08-06 10:08:11 -04:00
Stef Walter
49b35f0930 gtlscertificate: Don't confuse certificate and public key in docs
* A certificate sorta acts as a public key, but more specifically
   it contains a public key (in its subjectPublicKeyInfo) field.
 * Documentation was confusing and could have read like the
   certificate and certificate-pem properties were returning the
   public key part of the certificate.

https://bugzilla.gnome.org/show_bug.cgi?id=681158
2012-08-06 10:44:52 +02:00
Matthias Clasen
e2470ec6db docs: Don't put links in section titles 2012-08-03 23:36:45 -04:00
Stef Walter
6ddf40f301 gtlscertificate: Add g_tls_certificate_is_same() function
* Certificate equality in PKIX in general is equality between
   the DER encoding of the certificates.

https://bugzilla.gnome.org/show_bug.cgi?id=681116
2012-08-03 18:58:30 +02:00
Stef Walter
b913b0c29e gtlsdatabase: Don't complain if no callbacks for async functions
https://bugzilla.gnome.org/show_bug.cgi?id=681118
2012-08-03 17:39:10 +02:00
David Zeuthen
800ca21e55 GDBusError: Fix up G_STATIC_ASSERT guidance
This was reported in bug 680994.

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

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-08-01 11:57:22 -04:00
Dan Winship
b3f9637337 gthreadpool: set default max_unused_threads and max_idle_time values
GThreadPool defaulted to 0 for max_unused_threads (meaning thread-pool
threads would exit immediately if there was not already another task
waiting for them), and 0 for max_idle_time (meaning unused threads
would linger forever, though this is only relevant if you changed
max_unused_threads).

However, GIOScheduler changed the global defaults to 2 and 15*1000,
respectively, arguing that these were more useful defaults. And they
are, so let's use them.

https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-07-31 14:37:56 -04:00
Owen W. Taylor
b0bce4ad41 g_file_make_directory_with_parents: Fix error propagation
When creating a directory fails for some reason other than
the parent not existing, don't clear the error before we try
to propagate it.

To reproduce, run 'ostadmin init' on /ostree or otherwise try to
run the function on a directory with a parent directory where the
current user is not allowed to write.

https://bugzilla.gnome.org/show_bug.cgi?id=680823
2012-07-30 18:29:26 +02:00
Colin Walters
d7829ced53 GFile: Note semantics of g_file_delete()
Particularly for someone programming on Unix, this helps them
understand that we will unlink symbolic links, and not follow them.
2012-07-30 05:11:08 -04:00
Colin Walters
14a1c20177 GFile: Add g_file_delete_async()
This looks like it was stubbed out but not implemented; the vtable
entry dates to commit 3781343738 which
is just alex's initial merge of gio into glib.

I was working on some code that wants an asynchronous rm -rf
equivalent, and so yeah, this is desirable.

https://bugzilla.gnome.org/show_bug.cgi?id=680760
2012-07-30 05:01:06 -04:00
Chun-wei Fan
1ae7c7d982 gio/Makefile.am: Filter out gcontenttype.c for MSVC builds
gcontenttype.c was split into gcontenttype.c and gcontenttype-win32.c
in commit 32192ee9 ("Split gcontenttype.c"), so we don't want to include
gcontenttype.c in the Visual C++ build as it is no longer a source file
meant for Windows.

Thanks to Thomas H.P. Anderson for pointing this out.
2012-07-19 23:15:59 +08:00
Dan Winship
2855b827da gio/tests/converter-stream: add a new test, rename an old one
Add a test that the decompressor input streams handle truncated data
correctly. (They do; I wrote the test thinking there was a bug there,
but there isn't.)

Also, rename the "corruption" tests to "roundtrip", since "corruption"
makes it sound like we're testing how the converters deal with
corrupted data, as opposed to merely testing that they don't corrupt
data themselves. And fix the bug reference.
2012-07-17 16:21:03 -04:00
Dan Winship
09c18537f4 g_cancellable_source_new: don't use a file descriptor
Rather than implementing GCancellableSource by polling on its fd,
implement it by just waking its GMainContext up from the "cancelled"
signal handler, thereby helping to reduce file descriptor usage.
Suggested by Ryan Lortie.

https://bugzilla.gnome.org/show_bug.cgi?id=680121
2012-07-17 15:32:48 -04:00
Stef Walter
a0b71839ee GIOScheduler: Fix access after free in "cancelled" handler
* GCancellable can be "cancelled" more than once if
   g_cancellable_reset() is called.
 * Don't assume that because the "cancelled" signal fired
   it won't fire again.

https://bugzilla.gnome.org/show_bug.cgi?id=680111
2012-07-17 13:47:26 -04:00
Dan Winship
d90ad18055 GAsyncInitable: partially revert the init_finish changes
g_async_initable_real_init_finish() was previously handling all
GSimpleAsyncResults, even if they weren't created by
g_async_initable_real_init_async(), and libnm-glib accidentally relied
on that behavior. So remove the g_simple_async_result_is_valid()
check.
2012-07-17 09:15:44 -04:00
Cosimo Cecchi
99f26ab08f mount-operation: add a Since tag to the show-unmount-progress signal 2012-07-11 20:26:16 -04:00
Cosimo Cecchi
44375ad7c5 mount-operation: add show-unmount-progress signal
The actual implementation will be in gvfs.

https://bugzilla.gnome.org/show_bug.cgi?id=676111
2012-07-11 19:57:42 -04:00
Rui Matos
eda1735029 GDBusNodeInfo: remove a spurious for loop
https://bugzilla.gnome.org/show_bug.cgi?id=679671
2012-07-11 03:27:29 +02:00
Rui Matos
6f23c33831 GDBusNodeInfo: the XML string must contain exactly one node element
Make the documentation clear about this.

https://bugzilla.gnome.org/show_bug.cgi?id=679671
2012-07-11 03:27:29 +02:00
Colin Walters
f7abd3ce13 Add g_spawn_check_exit_status()
Many (if not "almost all") programs that spawn other programs via
g_spawn_sync() or the like simply want to check whether or not the
child exited successfully, but doing so requires use of
platform-specific functionality and there's actually a fair amount of
boilerplate involved.

This new API will help drain a *lot* of mostly duplicated code in
GNOME, from gnome-session to gdm.  And we can see that some bits even
inside GLib were doing it wrong; for example checking the exit status
on Unix, but ignoring it on Windows.

https://bugzilla.gnome.org/show_bug.cgi?id=679691
2012-07-10 18:03:56 -04:00
Dan Winship
82d914d808 gio: add g_async_result_is_tagged()
Rather than doing a two step first-check-the-GAsyncResult-subtype-then-
check-the-tag, add a GAsyncResult-level method so that you can do them
both at once, simplifying the code for "short-circuit" async return
values where the vmethod never gets called.

https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-07-10 10:49:20 -04:00
Dan Winship
f8532a13e2 gio: Add g_async_result_legacy_propagate_error()
Finish deprecating the "handle GSimpleAsyncResult errors in the
wrapper function" idiom (and protect against future GSimpleAsyncResult
deprecation warnings) by adding a "legacy" GAsyncResult method
to do it in those classes/methods where it had been traditionally
done.

(This applies only to wrapper methods; in cases where an _async
vmethod explicitly uses GSimpleAsyncResult, its corresponding _finish
vmethod still uses g_simple_async_result_propagate_error.)

https://bugzilla.gnome.org/show_bug.cgi?id=667375
https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-07-10 10:49:14 -04:00
Dan Winship
538b2f106d gio: handle GSimpleAsyncResult errors in _finish vmethods
Originally, the standard idiom with GSimpleAsyncResult was to handle
all errors in the _finish wrapper function, so that vmethods only had
to deal with successful results. But this means that chaining up to a
parent _finish vmethod won't work correctly. Fix this by also checking
for errors in all the relevant vmethods. (We have to redundantly check
in both the vmethod and the wrapper to preserve compatibility.)

https://bugzilla.gnome.org/show_bug.cgi?id=667375
https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-07-10 10:47:55 -04:00
Dan Winship
a98d26c9bb GFile: remove some unnecessary code
The "mainloop_barrier" in copy_async_thread() is unnecessary, since
the g_simple_async_result_complete_in_idle() will be queued after all
of the g_io_scheduler_job_send_to_mainloop_async()s, and sources with
the same priority will run in the order in which they were queued.

https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-07-10 10:47:49 -04:00
Torsten Schönfeld
a511a706de gio: Add type macros for GFileAttributeInfoList and GFileAttributeMatcher
https://bugzilla.gnome.org/show_bug.cgi?id=616892
2012-07-08 00:47:01 +02:00
David Zeuthen
c09bf3e6b9 gdbus-codegen: improve casting a tiny wee bit
The in commit b79fbc5c3f for fixing
-Wstrict-aliasing warnings was a little too brutal, make it a bit
better.

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-07-07 17:10:46 -04:00
David Zeuthen
b79fbc5c3f gdbus-codegen: neuter warnings when using -Wstrict-aliasing
Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-07-06 13:49:28 -04:00
David Zeuthen
d728eae85f gdbus-codegen: don't shadow variable
This avoids a warning when building with -Wshadow

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-07-06 13:49:28 -04:00
Ryan Lortie
ed492a5de2 GSettings: be more careful about keys names with /
Prevent attempts to access keys ending with slashes that exist in the
schema file as references to child schemas.

Also: don't emit change signals for these same keys.
2012-07-06 13:44:17 -04:00
David Zeuthen
d72116d8b7 gdbus-codegen: Don't generate invalid GObject property names
For a D-Bus property with name "Type" (fairly common), we used to
generate a GObject property with name "type-" and C accessors
get_type_() (to avoid clashing with the GType getter), set_type_()
(for symmetri).

However, the rules for GObject property names are fairly rigid and
specifically prohibit names ending in a dash.

Therefore change things so the chosen GObject property name is "type"
but preserve the naming rules for the C getter and setter (for the
same reasons: avoiding name clashing and symmetri).

This change does break the API of generated code (but only on the
GObject property level, the C symbols are not changed) but strictly
speaking the behavior was undefined since "type-" was an invalid
GObject property name.

Also add a test case for this.

Bug 679473.

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

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-07-06 09:26:41 -04:00
Matthias Clasen
04af05fd1f Drop unneeded includes 2012-07-03 21:14:41 -04:00
Matthias Clasen
32192ee9e4 Split gcontenttype.c
Instead of a giant #if G_OS_WIN32 #else #endif around the entire
file, just split it into gcontenttype.c and gcontenttype-win32.c.
2012-07-03 21:13:32 -04:00
Marc-André Lureau
af3b1674cd win32: fix build after bug 674452 2012-07-03 21:01:31 -04:00
Simon Feltman
03611f7c06 Updated codegen to work with python3.
Most changes were just replacing usage of "has_key" with "in".
Also updated the sorting function which was simplified and
changed to a "key" function instead of "cmp" (which is no longer
supported in python3. Verified everything builds with
python 2.7 and 3.

https://bugzilla.gnome.org/show_bug.cgi?id=678066
2012-07-01 11:14:54 -04:00
Johan Dahlin
08cfcdc81a Use the same Python as we found in configure
Don't assume /usr/bin/python is python 2.x, on newer Ubuntu versions
it's actually python 3.x.
2012-06-29 11:59:33 -03:00
Martin Pitt
d023b81a7a Fix /contenttype/guess test
After fixing bug 674452 this test case now reliably fails, as "ABC abc" is text
and definitively not PowerPoint. It previously worked as g_content_type_guess()
was reading beyond the boundary of the data due to specifying -1 as data
length.

Update that test case to expect a PO template instead, and add two more with a
definitive PO template syntax and some binary data. We do not currently have a
MIME magic for PowerPoint, so we cannot actually detect it with certainty, but
at least make sure that the returned MIME type is correct.

https://bugzilla.gnome.org/show_bug.cgi?id=678941
2012-06-28 15:57:22 +02:00
Alexander Larsson
c35106fcc4 Fix the mimetype default fix
We need to ignore the defaults.list item only when there
was a mimetype handler found in a previous mimetype, not
if one was found for the same mimetype as the one that
is listed in defaults.list (same for the new-style defaults).
2012-06-28 15:38:06 +02:00
Alexander Larsson
f14c0112d0 Fix default app lookup wrt parent types and defaults.list
There was an issue when looking up the default handler
for a type where a supertype was listed in defaults.list.
We would pick the default for the parent type even if
there was a handler for the more specific type.

In the case of the new-style defaults marking (
"Default Applications" in mimeapps.list) we were already
checking for a more specific handler befor using a default,
but we also need to do a similar check for the defaults.list
case.

https://bugzilla.gnome.org/show_bug.cgi?id=678944
2012-06-28 15:05:03 +02:00
Stef Walter
1ae3080640 GTlsInteraction: Fix incorrect locking of mutex
* Fix incorrect locking of mutex in g_tls_interaction_invoke_ask_password()

https://bugzilla.gnome.org/show_bug.cgi?id=678758
2012-06-28 14:43:12 +02:00
Martin Pitt
139c1ce988 gio/tests/contenttype: Call g_content_type_guess() with valid data len
g_content_type_guess() requires specifying a valid data length. Fixes a
segfault when running the test.

Also add an explicit check for this and return XDG_MIME_TYPE_UNKNOWN when
data_size is specified as -1, to avoid crashing.

https://bugzilla.gnome.org/show_bug.cgi?id=674452
2012-06-27 16:00:27 +02:00
Martin Pitt
72af44cb12 Allow slightly too small poll duration in /socket/timed_wait test
Sometimes the poll duration in the /socket/timed_wait test is slightly lower
than the requested 100000, causing failures like

ERROR:/build/buildd/glib2.0-2.33.2/./gio/tests/socket.c:619:test_timed_wait:
  assertion failed (poll_duration > = 100000): (99240 >= 100000)
FAIL

Adjust the test to also allow some jitter in the "too small" direction, similar
to the already existing span for "slightly too large".

https://bugzilla.gnome.org/show_bug.cgi?id=678881
2012-06-26 18:34:08 +02:00
Colin Walters
d6aa3b3bdd GTestDBus: Don't call into gvfs
https://bugzilla.gnome.org/show_bug.cgi?id=678808
2012-06-26 12:26:05 -04:00
Colin Walters
130c249eac Fix previous commit 2012-06-25 19:37:05 -04:00
Colin Walters
b837cdde69 gio/tests/actions: Plug a memory leak 2012-06-25 18:14:10 -04:00
Colin Walters
b65194e8df GIOScheduler: Disconnect from cancellable after job completes
This was causing crashes when a cancellable was canceled after the job
had completed.

https://bugzilla.gnome.org/show_bug.cgi?id=678576
2012-06-25 17:07:16 -04:00
Ryan Lortie
115ca3d897 Revert "GIOScheduler: Avoid constant iteration over pending job list"
This reverts commit 2839297686.

Conflicts:

	gio/gioscheduler.c

https://bugzilla.gnome.org/show_bug.cgi?id=678576
2012-06-25 16:19:03 -04:00
Lars Uebernickel
1354ef2540 GDbusActionGroup: always set strict when _query_action fails 2012-06-25 18:29:01 +02:00