Commit Graph

3426 Commits

Author SHA1 Message Date
Antoine Jacoutot
596f96b08d gio-kqueue: use O_EVTONLY on MacOS
MacOS provides the O_EVTONLY flag to open(2) which allow to open a file
for monitoring without preventing an unmount of the volume that contains
it.

https://bugzilla.gnome.org/show_bug.cgi?id=688518
2012-11-17 16:32:23 +01:00
Aleksander Morgado
8bf295bcd8 gdbus: improve documentation of the GDBusError section
https://bugzilla.gnome.org/show_bug.cgi?id=688370
2012-11-15 22:24:54 +01:00
Dan Winship
aa1418c427 win32: work around broken winsock prototypes
Re-#define a few socket functions to work around winsock's prototypes
having, eg, "int *" rather than "unsigned int *", or "char *" rather
than "void *".

(Also fix two places that mistakenly assumed guint==guint32.)

https://bugzilla.gnome.org/show_bug.cgi?id=688109
2012-11-15 14:19:06 -05:00
Dan Winship
d9e8feae7c win32: make gio/tests/gdbus-proxy.c compile
win32 doesn't have kill(), so this won't even compile on Windows
unless that is ifdeffed out. The test probably still doesn't *work*,
but...

https://bugzilla.gnome.org/show_bug.cgi?id=688109
2012-11-15 14:19:06 -05:00
Dan Winship
468a166711 GLocalFile: canonicalize the initial directory separator
GLocalFile was (in certain situations) translating a path like
"/foo/bar/baz" to "/foo\bar\baz" on win32. Fix it to make sure the
initial directory separator gets canonicalized too.

Fixes gio/tests/g-icon on win32.

https://bugzilla.gnome.org/show_bug.cgi?id=688109
2012-11-15 14:19:06 -05:00
Dan Winship
b8c13a01b6 win32: misc warning fixes
https://bugzilla.gnome.org/show_bug.cgi?id=688109
2012-11-15 14:19:06 -05:00
Dan Winship
f248c86b0a win32: move some code into #ifdef G_OS_UNIX
Fix various bits of code/declarations that are only used by G_OS_UNIX
but were still visible to G_OS_WIN32.

https://bugzilla.gnome.org/show_bug.cgi?id=688109
2012-11-15 14:19:05 -05:00
Dan Winship
731b469908 win32: define _WIN32_WINNT globally
Rather than defining _WIN32_WINNT only in a handful of files, define
it in config.h, like we do with _GNU_SOURCE.

(Also remove a "#define WIN32_LEAN_AND_MEAN" that isn't really all
that useful.)

https://bugzilla.gnome.org/show_bug.cgi?id=688109
2012-11-15 14:19:05 -05:00
Dan Winship
3ac6cfaeaa win32: prototype _glib_get_dll_directory() and _glib_get_locale_dir()
Rather than using "extern" declarations of these win32 functions
everywhere they're needed, just prototype them in glib-private.h.
(Which also fixes the fact that they weren't prototyped in the files
where they're defined.)

https://bugzilla.gnome.org/show_bug.cgi?id=688109
2012-11-15 14:19:05 -05:00
Wim Taymans
c2acbc0182 gsocket: fix joining/leaving multicast groups
Initialize the structure passed to setsockopt to 0 to avoid random
errors when joining or leaving a multicast group.

https://bugzilla.gnome.org/show_bug.cgi?id=688378
2012-11-15 11:09:00 -05:00
Michael Natterer
6dee874b68 Revert "gio: Add private API to create win32 streams from fds"
This reverts commit 292de8cc52.
2012-11-15 15:33:38 +01:00
Colin Walters
2aa97e2847 gdbus: Fix some compiler warnings
Code appears to have been copy/pasted from a bit which used _object,
but I think it's clearer to always use the "self" parameter anyways.
2012-11-15 08:42:36 -05:00
Antoine Jacoutot
a335fd1de8 GFileMonitor: Add kqueue(3) support to GIO
Written by Dmitry Matveev as part of GSoC 2011:
http://netbsd-soc.sourceforge.net/projects/kqueue4gio/

This brings native file monitoring support on systems supporting kqueue(3)
(all BSDs) and remove the need to rely on the unmaintained gamin software.
The backend adds GKqueueDirectoryMonitor and GKqueueFileMonitor.

Some parts rewritten by myself (to prevent needing a configuration file).
Helpful inputs from Colin Walters and Simon McVittie.

https://bugzilla.gnome.org/show_bug.cgi?id=679793
2012-11-15 08:13:30 +01:00
Colin Walters
292de8cc52 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
2012-11-14 14:12:05 -05:00
Paul Menzel
606aa26acf gio/*: Fix spelling of determining
$ sed -i s,determing,determining,g gio/gdrive.c
$ sed -i s,determing,determining,g gio/gdbusprivate.c

http://www.merriam-webster.com/dictionary/determining

For some reason according to `git log --follow` the whole file was created during some translation update.

    commit c45b813504
    Author: Timo Jyrinki <timo@debian.org>
    Date:   Mon Mar 12 11:02:04 2012 +0200

        Finnish translation update from http://l10n.laxstrom.name/wiki/Gnome_3.4 translation sprint
2012-11-13 13:54:40 +00:00
Dan Winship
9fb3082070 Revert "Return correct value for g_socket_get_available_bytes() on Windows and OSX"
This neither compiles nor does what it's supposed to on Windows.

This reverts commit 1e598600a1.
2012-11-11 14:14:04 -05:00
Sebastian Dröge
2bba1da306 Add caching for the receiver addresses for g_socket_receive_from()
https://bugzilla.gnome.org/show_bug.cgi?id=668842
2012-11-11 17:32:38 +01:00
Matthias Clasen
8caf39b59b Add an option to make glib-compile-resources use G_GNUC_INTERNAL
https://bugzilla.gnome.org/show_bug.cgi?id=687742
2012-11-09 22:14:39 -05:00
Matthias Clasen
138f4c1e2f Remove trailing space from some translated strings
https://bugzilla.gnome.org/show_bug.cgi?id=687700
2012-11-09 22:12:57 -05:00
Sebastian Dröge
1e598600a1 Return correct value for g_socket_get_available_bytes() on Windows and OSX
https://bugzilla.gnome.org/show_bug.cgi?id=686786
2012-11-09 21:57:50 -05:00
John Ralls
b65dac802e Fix poll able streams for Darwin (and probably BSD)
Darwin's poll doesn't change revents if there are no available events, though it returns 0. Initialize the fd.revents to 0 so that the test passes.

That reveals a test failure, though, because with socket streams it takes time for an event to pass through the socket. Provide an 80-usec delay to allow time for the propagation.
2012-11-09 09:23:01 -08:00
John Ralls
5588d47985 Fix compile error about missing prototype
For g_nextstep_settings_backend_get_type()
2012-11-09 09:23:01 -08:00
Dan Winship
f1b34cab8a gthreadedresolver: fix a bug in the GTask porting of lookup_records
We were passing the wrong destroy notify when returning the list of
records, so it would crash if it got called (ie, if you didn't call
g_resolver_lookup_records_finish()).

(Also fix s/targets/records/ throughout the records functions.)
2012-11-09 11:41:01 -05:00
Timothy Arceri
edeffe0c87 Use url encoding for trash fileinfo path as per freedesktop trash specification
https://bugzilla.gnome.org/show_bug.cgi?id=687540
2012-11-09 08:40:43 -05:00
Colin Walters
753494a25e tests/buffered-input-stream: Fix size of parameter passed
buffer-size is guint, but the public API is gsize for some reason.

Tested-By: gustavold@linux.vnet.ibm.com

https://bugzilla.gnome.org/show_bug.cgi?id=687801
2012-11-07 09:51:20 -05:00
Chun-wei Fan
2b17e797a4 gio/gthreadedresolver.c: Fix non-UNIX build
Move the GError *error declaration up, as that variable is also used for
non-Unix builds.
2012-11-05 17:22:38 +08:00
Simon McVittie
85976cf91d Bring back a couple of private-but-extern symbols
These both existed in 2.34.1, but are not exposed in headers, and were
meant to be private. Making them static (in commit 84475e43) was
technically an ABI break, and in particular it causes abicheck.sh to fail.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=687441
Reviewed-by: Colin Walters <walters@verbum.org>
2012-11-02 16:13:57 +00:00
Dan Winship
7b1f8c582a gtask: bump the max thread pool size up to 100 to avoid stalls/deadlocks
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=686810 for now.
https://bugzilla.gnome.org/show_bug.cgi?id=687223 discusses a nicer
fix for later.
2012-11-02 10:19:06 -04:00
Simon McVittie
1afaea333b Use the FreeBSD credentials-passing code on Debian GNU/kFreeBSD
The __FreeBSD__ macro means we have both a FreeBSD kernel and FreeBSD
libc, which isn't the case on GNU/kFreeBSD (GNU libc and userland on
the FreeBSD kernel), so it predefines a different macro. The kernel
is what actually matters for credentials-passing, though.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Tested-by: Steven Chamberlain <steven@pyro.eu.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=649302
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=581750
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=631968
Reviewed-by: Dan Winship <danw@gnome.org>
2012-11-02 13:55:40 +00:00
Colin Walters
94ef8dff0d gdbusactiongroup: Add prototype for g_dbus_action_group_sync()
Even private functions that are actually called across compilation
units should have prototypes.  For g_dbus_action_group_sync(), create
one in gdbusactiongroup-private.h

https://bugzilla.gnome.org/show_bug.cgi?id=687385
2012-11-02 09:03:52 -04:00
Colin Walters
dc4922af21 test-pipe-unix: Add missing include
Fixes the build with -Werror=missing-prototypes.

https://bugzilla.gnome.org/show_bug.cgi?id=687385
2012-11-02 09:03:52 -04:00
Colin Walters
8e59d8602c Use (void) for no parameters, not ()
This ensures we build with -Werror=missing-parameter-type.

https://bugzilla.gnome.org/show_bug.cgi?id=687385
2012-11-01 20:12:02 -04:00
Colin Walters
84475e4320 build: Prototype GType accessors for private classes
Otherwise we fail to build with -Werror=missing-prototypes.

https://bugzilla.gnome.org/show_bug.cgi?id=687385
2012-11-01 20:12:02 -04:00
Colin Walters
6d88a2f822 build: Add missing "static" keyword where it should be used
Otherwise we fail to build with -Werror=missing-prototypes.

https://bugzilla.gnome.org/show_bug.cgi?id=687385
2012-11-01 20:12:01 -04:00
Colin Walters
67466b41af build: Don't use C99 declarations
Since GLib needs to compile with MSVC, we can't use them.  This fixes
compilation when using -Werror=declaration-after-statement.

https://bugzilla.gnome.org/show_bug.cgi?id=687385
2012-11-01 20:12:01 -04:00
Robert Ancell
59a24ab5a3 Use "Returns:" instead of the invalid "@returns" for annotating return values.
https://bugzilla.gnome.org/show_bug.cgi?id=673229
2012-11-01 14:47:25 +13:00
Will Thompson
a773a615b6 GNetworkMonitor: add missing apostrophe to docstring 2012-10-30 17:17:23 +00:00
Ryan Lortie
f20ae7fcfd g_dbus_connection_export_menu_model(): fix a crash
Add some extra protection when 'preparing' a group that doesn't yet
contain any menus.  This can happen if you subscribe to a group that
doesn't yet exist.

It was possible to crash any application using
g_dbus_connection_export_menu_model() by requesting a non-existent
subscription group over the bus.

In practice this only happened in races -- where the proxy sees a group
that exists and queries it, but by the time it does, it's already gone.

https://bugzilla.gnome.org/show_bug.cgi?id=687089
2012-10-29 16:18:10 +01:00
Rico Tzschichholz
8911cee350 gio/tests: Fix build with -Werror=format-security 2012-10-27 12:12:29 +02:00
Rico Tzschichholz
fa523734c7 gio/tests: Fix linker failure
Fixes 8c320d0c34
2012-10-27 12:10:44 +02:00
Stef Walter
d68b4e1d02 gio: No need to specify SOURCES when name matches executable
Removes some of the duplication from Makefile.am

https://bugzilla.gnome.org/show_bug.cgi?id=686921
2012-10-26 21:25:55 +02:00
Stef Walter
8c320d0c34 gio: Remove LDADD repetition from gio/tests Makefile
Using a global LDADD for the basic libraries to link.

https://bugzilla.gnome.org/show_bug.cgi?id=686921
2012-10-26 21:25:55 +02:00
Stef Walter
fb2d3aacb5 gdbus: Allow GDBusObjectManagerClient to work on peer connections
Allow GDBusObjectManagerClient to work on peer to peer DBus
connections. Don't require that a unique bus name is available
for the object manager, if the owned bus name is NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=686920
2012-10-26 21:20:04 +02:00
Matthew Barnes
7db2ac7b88 Fix typo in G_TEST_DBUS. 2012-10-26 13:20:29 -04:00
Cosimo Cecchi
d681b581ff file-info: catch thumbnail files in large directory as well
When building the file attribute table info for local files, use
thumbnail paths in $XDG_CACHE_DIR/thumbnails/large in addition to
$XDG_CACHE_DIR/thumbnails/normal.

Failing to do this would cause an application that creates large
thumbnails by default to never find any value for
G_FILE_ATTRIBUTE_THUMBNAIL_PATH, with no
G_FILE_ATTRIBUTE_THUMBNAILING_FAILED set, which might cause the
application to either think thumbnailing is still in progress, or
blindly requeue thumbnail operations in a loop.

Large thumbnails are generally preferred, so we now default to the path
of a large thumbnail (in case both are present).

https://bugzilla.gnome.org/show_bug.cgi?id=686895
2012-10-26 10:48:09 -04:00
Murray Cumming
05756f8418 Fix this cost -> the cost typos 2012-10-21 13:08:01 +02:00
Antoine Jacoutot
475edeb2ed Allow slightly too big poll duration in /socket/timed_wait test
Sometimes the poll duration in the /socket/timed_wait test is slightly
bigger than the requested 100000, causing failures like:

GLib-GIO:ERROR:socket.c:620:test_timed_wait:
    assertion failed (poll_duration < 110000): (110057 < 110000)

Adjust the test to allow some jitter in the "too high" direction.

https://bugzilla.gnome.org/show_bug.cgi?id=686458
2012-10-19 14:34:18 +02:00
Ryan Lortie
654bfcb7ce GBusNameVanishedCallback: document NULL connection
@connection can be NULL for this callback.  Document this possibility
and describe the circumstances.

https://bugzilla.gnome.org/show_bug.cgi?id=686231
2012-10-16 12:40:21 -04:00
Ryan Lortie
212ffcc574 GMenuExporter: allow NULL bus on _name_vanished
GBusNameVanishedCallback is called with a NULL GDBusConnection in the
case that the connection has vanished.  We were doing an assert to
verify that it was the same as we had exported the menu on and that
assert was failing.

https://bugzilla.gnome.org/show_bug.cgi?id=685995
2012-10-16 12:31:23 -04:00
Ryan Lortie
1dc774a653 Remove g_type_init() calls
Very many testcases, some GLib tools (resource compiler, etc) and
GApplication were calling g_type_init().

Remove those uses, as they are no longer required.

https://bugzilla.gnome.org/show_bug.cgi?id=686161
2012-10-16 09:39:24 -04:00
Marc-Antoine Perennou
f923fb330b gdbus-testserver: port to pygi
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>

https://bugzilla.gnome.org/show_bug.cgi?id=685608
2012-10-15 19:37:04 -04:00
Matthias Clasen
e16f82854a Add return-if-fail checks to g_application_hold/release
This is our common practice for public API.
https://bugzilla.gnome.org/show_bug.cgi?id=685208
2012-10-15 19:34:36 -04:00
Ryan Lortie
1a20d56a89 g_settings_bind: use canonical property name
We were using the user-passed value of the @property argument for
several purposes in g_settings_bind(): error messages, binding
uniqueness (ie: one-binding-per-property-per-object) and most
importantly, connecting to the detailed notify:: signal.

The user may pass a string like "property_name" when the property's
canonical name is "property-name".  g_object_class_find_property() will
find the property under these circumstances, but a connection to
"notify::property_name" will not notice notifies emitted for
"property-name".

We can solve this by using the user's string to perform the lookup and
then using pspec->name for everything after that.

https://bugzilla.gnome.org/show_bug.cgi?id=684882
2012-10-15 19:28:28 -04:00
Matthias Clasen
dace477c92 Add Win32 versions of some new content type APIs
This commit adds minimal versions of
g_content_type_get_symbolic_icon and
g_content_type_get_generic_icon_name.
https://bugzilla.gnome.org/show_bug.cgi?id=683642
2012-10-15 19:22:50 -04:00
Will Thompson
a342be7138 gtestdbus: correct documentation typos
https://bugzilla.gnome.org/show_bug.cgi?id=685787
2012-10-11 16:12:47 +01:00
Dan Winship
e162fab4c0 gio/tests: port from GSimpleAsyncResult to GTask
https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-10-10 10:29:37 -04:00
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