Commit Graph

2340 Commits

Author SHA1 Message Date
Matthias Clasen
66a1dfc84f Avoid some compiler warnings 2011-09-09 23:44:41 -04:00
Matthias Clasen
e5653c0050 Keep up with the standards
More choices, always better.
2011-09-09 20:37:09 -04:00
Colin Walters
9bf59d4a14 Add glib__private__() API to share between glib,gio; port GWakeup to it
Historically we've added random symbols to the public API with warnings
that they're private; examples are:

glib_gettext(), glib_pgettext()
g_thread_functions_for_glib_use, g_thread_use_default_impl, etc.

And we almost added "GWakeup" to public API just to share between glib and
gio.

This new glib__private__() API exports a hidden vtable, and adds a macro
GLIB_PRIVATE_CALL() that makes it generally convenient to use.

This adds an extremely tiny cost for the double indirection; but it has
the benefit that we don't need to either:

1) compile the code into both glib and gio (like GWakeup), with the
   inefficiency that implies.
2) Export a "do not use this" symbol; the serious problem with this is
   that someone CAN use it pretty easily.  Particularly if we document
   it.  It's far, far harder to peek into a structure without a public
   header file.

https://bugzilla.gnome.org/show_bug.cgi?id=657992
2011-09-09 14:17:08 -04:00
Ryan Lortie
e48573c402 Deprecated (undocumented) g_thread_gettime
g_thread_gettime() is an undocumented public function pointer that
points to a function that returns the monotonic time in nanoseconds.
g_get_monotonic_time() does the same in microseconds, so it can be used
instead.

GLib had one internal user in GFileMonitor that only cared about
millisecond accuracy; it has been ported to g_get_monotonic_time().
2011-09-09 12:47:39 -04:00
Dan Winship
5a30712dc7 Remove !g_thread_supported() codepaths in gio
In particular, remove the libasyncns import, which was only used by
GUnixResolver, which is only used when threads are not available.
Likewise remove GWin32Resolver, and the hacky broken non-threaded
parts of GIOScheduler.

https://bugzilla.gnome.org/show_bug.cgi?id=616754
2011-09-09 12:47:39 -04:00
Ryan Lortie
aa586f6354 Revert "GIOSchedulerJob: Improve struct packing"
This reverts commit a2094d5e56.

https://bugzilla.gnome.org/show_bug.cgi?id=616754
2011-09-09 12:41:56 -04:00
Dan Winship
5bc7729d16 Make threads mandatory
G_THREADS_ENABLED still exists, but is always defined. It is still
possible to use libglib without threads, but gobject (and everything
above it) is now guaranteed to be using threads (as, in fact, it was
before, since it was accidentally impossible to compile with
--disable-threads).

https://bugzilla.gnome.org/show_bug.cgi?id=616754
2011-09-09 12:41:55 -04:00
Damien Lespiau
c8ef5b7d6c simpleaction: Fix documentation of :enabled
An over-zealous sed, most likely, transformed g_action_.*() into
g_simple_action.*().

https://bugzilla.gnome.org/show_bug.cgi?id=658558
2011-09-08 17:07:56 +01:00
Federico Mena Quintero
571185f0f6 bgo#640212 - Replace "error stating file" with friendlier messages
Non-technical users won't know that "stating" refers to stat(2), so we
just use "error when getting information" now.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2011-09-08 09:11:56 -05:00
Ryan Lortie
27fbaf3712 GSettingsBackend: emit changes to correct thread
When g_settings_apply() is called on a delayed settings backend and
there is a D-Bus error when communicating with dconf-service, recent
versions of the dconf GSettingsBackend call a function in GLib that
improperly delivered the signal directly instead of using
g_main_context_invoke().

This patch fixes this function to route in the same way as the others so
that the signal is dispatched in the proper GMainContext.
2011-09-06 14:07:16 -04:00
Ryan Lortie
8a7d33024a gio docs: lots more fixes 2011-09-06 00:31:49 -04:00
Dan Winship
749fa587bc fix a few warnings on non-Linux
mostly #ifdeffing functions that are only called by #ifdeffed code
2011-09-04 17:50:41 -04:00
Patrick Welche
afa82ae805 Avoid getmntinfo
- getmntinfo can take struct statfs or statvfs depending on the
  OS. Use getvfsstat and if not found getfsstat instead. Idea from
  Dan Winship.
- g_local_file_query_filesystem_info(): use statvfs.f_fstypename
  if available

https://bugzilla.gnome.org/show_bug.cgi?id=617949
2011-09-04 17:50:41 -04:00
Dan Winship
15f1ba4721 gio/tests/tls-interaction: fix two sporadic errors
The threaded tests are using the default main context in the worker
thread, but were not g_main_context_acquire()ing it first, which meant
that g_tls_interaction_invoke_ask_password() in the main thread would
sometimes succeed in acquiring it itself and thus performing the
operation in the wrong thread. Fix that.

Also, we can't unref the loop from the worker thread, because the main
thread isn't holding a reference on it, and so it might end up being
destroyed while that thread is still inside g_main_loop_quit().
2011-09-04 10:33:37 -04:00
Dan Winship
655c9f5753 gsocket: fix win32 build
https://bugzilla.gnome.org/show_bug.cgi?id=658157
2011-09-04 08:42:31 -04:00
Dan Winship
4a371c2ce5 g_network_address_parse: deprecate symbolic port names
(which shouldn't ever have been part of the API. Grr.)

Solaris /etc/services doesn't even have "http", which was causing
tests/network-address to fail...
2011-09-03 19:58:40 -04:00
Dan Winship
af2a905e54 gsocket: fix g_socket_details_from_fd() on Solaris
On Solaris, getsockname() on an unconnected socket gives an addrlen of
0 and doesn't set the sockaddr. So use the SO_DOMAIN sockopt to find
the socket family in that case. (SO_DOMAIN doesn't exist everywhere,
so we can't use it unconditionally. Also, we have to only use it if
getsockname() fails, since SO_DOMAIN returns a bogus value for
accept()ed sockets on both Linux and Solaris...)
2011-09-03 19:58:40 -04:00
Dan Winship
0d63793129 configure: check if -lsocket is needed (for Solaris)
Also, link libgio to -lresolv explicitly, rather than depending on
getting it implicitly via the libasyncns build (which should
eventually be going away).

https://bugzilla.gnome.org/show_bug.cgi?id=645336
2011-09-03 19:58:40 -04:00
Will Thompson
a020fbf8f6 gdbus-codegen: post-process all interfaces when parsing >1 file
This also fixes a crash when you run gdbus-codegen with no arguments.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-01 14:28:57 -04:00
Stef Walter
49bb7cff4b gio: Add GTlsInteraction interaction method invocation guarantees
* Add 'invoke' style method, which can be used to call an interaction
   from any thread. The interaction will be run in the appropriate
   #GMainContext
 * Sync methods can be called whether main loop is running or not.
 * Derived classes can choose to implement only sync or async
   interaction method, and the invoke method will fill in the blanks.
 * Documentation for the above.
 * Tests for the above.

https://bugzilla.gnome.org/show_bug.cgi?id=657567
2011-08-30 18:30:02 +02:00
Tomas Bzatek
116b2932ab glocalfile: Fix the grammar 2011-08-30 18:00:49 +02:00
Bastien Nocera
229234111c gio: Error out when we cannot modify a GAppInfo
g_desktop_app_info_set_as_default_for_type() and
g_desktop_app_info_set_as_last_used_for_type () require the
application's ID, but depending on how the GAppInfo was created,
we might not be have one, and would thus silently fail to set
the default application, or last used application.

https://bugzilla.gnome.org/show_bug.cgi?id=657445
2011-08-30 15:55:02 +01:00
Dan Winship
302a5072c9 gio/tests/gdbus-peer: make this work on non-Linux unixes
The test was using a socket in a temporary directory, but not actually
creating that temporary directory. This worked fine on Linux since it
actually ended up using an abstract socket instead, but failed on
unixes without abstract sockets.

https://bugzilla.gnome.org/show_bug.cgi?id=657517
2011-08-30 09:52:46 -04:00
Matthias Clasen
08208e3ce2 Fix a doc comment 2011-08-30 00:09:51 -04:00
Dan Winship
fb74f6e303 GSocketAddress: create IPv4 addresses for IPv6 mapped-IPv4 addresses
IPv6-mapped-IPv4 addresses are annoying. Just translate them to real
IPv4 addresses.

based on a patch from Jonny Lamb
https://bugzilla.gnome.org/show_bug.cgi?id=646082
2011-08-29 23:42:39 -04:00
David Zeuthen
027b63ab96 GDBusObjectManagerServer: Add locking
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-08-29 16:46:45 -04:00
David Zeuthen
4e7ef619eb GDBusObjectManagerClient: Add locking
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-08-29 16:20:50 -04:00
David Zeuthen
fcefc71d59 GDBusObjectProxy: Add locking
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-08-29 15:29:40 -04:00
David Zeuthen
fb94a0299b GDBusObjectSkeleton: Add locking
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-08-29 15:20:02 -04:00
David Zeuthen
faec5d6b5c GDBusInterfaceSkeleton: Add locking
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-08-29 15:20:02 -04:00
Matthias Clasen
1b28408b8b Spelling fixes
Spelling fixes in comments and docs, provided by
Kjartan Maraas in bug 657336.
2011-08-29 14:49:32 -04:00
Kalev Lember
41e4db8076 gio/tests/gtlsconsoleinteraction: Work around missing getpass() on win32
Loosely based on a patch by Sam Thursfield <ssssam@gmail.com>.
https://bugzilla.gnome.org/show_bug.cgi?id=656341
2011-08-28 16:45:53 +03:00
Matthias Clasen
be555ed2d0 Fix symbol lists 2011-08-27 23:30:43 -04:00
Matthias Clasen
6e80885c8d Spell out file descriptors in a message
Translators don't necessarily know what 'fds' are.
Pointed out in bug 657454.
2011-08-27 13:18:45 -04:00
Matthias Clasen
1a2265889b GDBusMessage: Use ngettext() where appropriate
Pointed out in bug 657452.
2011-08-27 13:17:07 -04:00
Dan Winship
06b23e2b54 gsocketaddress: don't return ABSTRACT if the OS doesn't support it
FreeBSD apparently has non-0-length (but nameless) ANONYMOUS sockets.
Fix the heuristics here.
2011-08-27 12:28:03 -04:00
Dan Winship
aa10574dc3 gunixcredentialsmessage: fix this on FreeBSD
pointed out by Henry Hu
https://bugzilla.gnome.org/show_bug.cgi?id=628904
2011-08-27 12:28:03 -04:00
Dan Winship
cef679d004 GSocket: fix GIOCondition on timed-out socket operation
The docs for g_socket_set_timeout() claimed that if an async operation
timed out, the GIOCondition passed to the source callback would be
G_IO_IN or G_IO_OUT (thus prompting the caller to call
g_socket_receive/send and get a G_IO_ERROR_TIMED_OUT), but in fact it
ended up being 0, and gio/tests/socket.c was erroneously testing for
that instead of the correct value. Fix this.
2011-08-27 12:28:03 -04:00
Og B. Maciel
c04496d98d Fixed typo: s/ether/enter. 2011-08-26 11:07:32 -04:00
Stef Walter
d789e78dff giomodule: When loading GIO_EXTRA_MODULES skip duplicates
* Load modules from paths listed in GIO_EXTRA_MODULES environment
   variable first.
 * Ignore duplicate modules based on module basename.
 * Add the concept of GIOModuleScope which allows other callers to
   skip duplicate loaded modules, or block specific modules based on
   basename.
 * Document behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=656914
2011-08-26 15:27:19 +02:00
Stef Walter
41432cb375 Make GTlsInteraction virtual methods cancellable
* Add cancellable argument to g_tls_interaction_ask_password
   and g_tls_interaction_ask_password_async.
 * This is API breakage, but this API has not yet been released
   in a stable release (and very unlikely used yet).
 * Since we're breaking unreleased API, expand amount of padding
   on GTlsInteractionClass because we're going to need it.

https://bugzilla.gnome.org/show_bug.cgi?id=656443
2011-08-26 07:34:31 +02:00
Dieter Verfaillie
a2614efd14 Make gdbus-codegen 'relocatable' at runtime on Windows.
https://bugzilla.gnome.org/show_bug.cgi?id=650763
2011-08-25 17:23:00 -04:00
Dieter Verfaillie
acb5b852c1 gdbus-codegen: Revert to using /usr/bin/env for Python
After a lot of discussion, we decided /usr/bin/env is the most
flexible for now.

https://bugzilla.gnome.org/show_bug.cgi?id=650763
2011-08-25 17:19:27 -04:00
Dieter Verfaillie
cd0cd95078 Introduce the UNINSTALLED_GLIB_SRCDIR environment variable
This makes it possible to avoid setting PYTHONPATH in
Makefile.am files.

https://bugzilla.gnome.org/show_bug.cgi?id=650763
2011-08-25 16:55:49 -04:00
Dieter Verfaillie
5391aae009 Introduce the UNINSTALLED_GLIB_BUILDDIR environment variable
This makes it possible to also use relative imports for
gdbus-codegen's config module.

https://bugzilla.gnome.org/show_bug.cgi?id=650763
2011-08-25 16:55:49 -04:00
Dieter Verfaillie
5dc3c2efc8 Use relative imports for the gdbus/codegen package
But not yet for the config module (but is taken care
of in a followup patch).

https://bugzilla.gnome.org/show_bug.cgi?id=650763
2011-08-25 16:55:47 -04:00
Dieter Verfaillie
0eaec4e59a Avoid using - (hyphen) in gdbus-codegen directory name
It's an invalid character in Python module names and prevents us from
being able to import it.

https://bugzilla.gnome.org/show_bug.cgi?id=650763
2011-08-25 16:55:46 -04:00
Ionut Biru
33831bda24 Use detected PYTHON shebang in gdbus-codegen
Change the hardcoded /usr/bin/python shebag from gdbus-codegen.in into
@PYTHON@. Is used in Makefile.am to use detected python binary.

$(AM_V_GEN) sed -e 's,@libdir\@,$(libdir),' -e 's,@PYTHON\@,$(PYTHON),'
$< > $@.tmp && mv $@.tmp $@

Signed-off-by: Ionut Biru <ibiru@archlinux.org>

https://bugzilla.gnome.org/show_bug.cgi?id=657274
2011-08-25 13:35:35 -04:00
Matthias Clasen
471593ebf0 GCancellable: Small annotation additions
https://bugzilla.gnome.org/show_bug.cgi?id=657243
2011-08-24 21:25:31 -04:00
Philip Withnall
ff0cf7b681 Bug 657206 — GInputStream leaked in g_file_icon_load_async()
Add a missing unref to g_file_icon_load_async().

Closes: bgo#657206
2011-08-24 07:54:29 +01:00