Commit Graph

2885 Commits

Author SHA1 Message Date
Matthias Clasen
66e089f086 Add GMenuModel D-Bus exporter 2011-12-08 18:05:12 -05:00
Matthias Clasen
6b40d4eb6b Add GMenu markup
These functions serialize and deserialize a GMenuModel
to and from XML.
2011-12-08 18:05:12 -05:00
Matthias Clasen
13f5977735 Add GMenu 2011-12-08 18:05:12 -05:00
Matthias Clasen
12a39a05d3 Add GMenuModel 2011-12-08 18:05:12 -05:00
Matthias Clasen
df4cd241e5 GApplication: use GDBusActionGroup
instead of the internal version of the same
2011-12-08 18:05:12 -05:00
Ryan Lortie
c249e10d11 Add GDBusActionGroup
GDBusActionGroup can be used as a client-side wrapper
for the an action group that has been exported on D-Bus.
2011-12-08 18:05:12 -05:00
Ryan Lortie
bc5fe41dec GApplication: port action client to new D-Bus API
for compatibility with GActionGroup exporter
2011-12-08 18:05:12 -05:00
Ryan Lortie
20d1de3a1b GApplication: use GActionGroup exporter
instead of home-grown internal implementation of the same
2011-12-08 18:05:12 -05:00
Ryan Lortie
940ec94f0a Add GActionGroup D-Bus exporter 2011-12-08 18:05:12 -05:00
Ryan Lortie
8d1cc7f463 Revert "Use an XML blob for gapplication interface info"
This reverts commit 8013401f6e.
2011-12-08 18:05:12 -05:00
Ryan Lortie
45818762d3 Revert "Forgot one interface..."
This reverts commit 30580bdca7.
2011-12-08 18:05:12 -05:00
Matthias Clasen
3d686e3d8f Clarify docs around main loop vfuncs
Mention that the vfuncs are no longer used, and tweak the
wording around what g_application_run() does.

https://bugzilla.gnome.org/show_bug.cgi?id=665391
2011-12-07 14:38:37 -05:00
David Zeuthen
70dacf83d2 Bug 665733 – GDBusConnection holds lock while calling destroynotify
Fix this problem by always running the destroynotify from an idle.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-12-07 10:30:42 -05:00
David Zeuthen
990af4b372 GDBus: Note in docs that g_dbus_node_info_new_for_xml() is using GMarkup
This was discussed in bug 665634.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-12-06 13:41:53 -05:00
David Zeuthen
74e131551d GDBus: fix link to D-Bus spec
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-12-06 13:41:53 -05:00
Benjamin Otte
482f226270 outputstream: Clarify docs of flush()
After questioning the semantics of flush on IRC, it seemed necessary to
clarify what flushing is supposed to do. The Linux man page for fflush()
seemed to cover it perfectly, so I just copied it.

I did not add the "via the underlying write mechanism" part as that in
my opinion is not something subclasses should need to guarantee.
2011-12-05 22:40:18 +01:00
Cosimo Alfarano
fd1e9938b3 Send CHANGES_DONE_HINT on file moves if no IN_CLOSE_WRITE is emitted
This patch makes GFileMonitor to emit EVENT_CHANGES_DONE_HINT when
EVENT_CREATED is emitted but the file is not opened for writing.

On file moves across different mounted volumes, inotify will always emit
IN_CREATE and IN_CLOSE_WRITE (plus other events).
This translates into GIO's _EVENT_CREATED and _EVENT_CHANGES_DONE_HINT.

On file moves across the same mounted volumes, inotify will emit
IN_MOVED_FROM/IN_MOVED_TO which will be translated into
_EVENT_DELETED/_EVENT_CREATED GIO's side. No _EVENT_CHANGES_DONE_HINT is
emited afterwards.
Under such circumstances a file indexer does not know when actually the
file is ready to be indexed, either waiting too much or triggering the
indexing twice. On small devices it's not advisable.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=640077
Bug-NB: NB#219982
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Tomas Bzatek <tbzatek@redhat.com>
2011-12-05 18:27:34 +00:00
Simon McVittie
83d0c8a739 GDBusConnection: propagate error correctly if flags are inappropriate
Previously, this would fail the assertion
"connection->initialization_error != NULL" after the label "out".

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=665067
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
2011-12-05 18:15:19 +00:00
Tristan Van Berkom
a00530ecb0 GDBusInterfaceSkeleton: make it possible to export on multiple connections
This is useful in peer-to-peer connections.

With minor changes by David Zeuthen <davidz@redhat.com>.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-12-02 11:20:21 -05:00
Dan Winship
e798349587 GMemoryInputStream/GMemoryOutputStream: fix bug in previous commit
A g_input_stream_read_async() implementation can't call
g_input_stream_read() on itself directly because it will fail because
the pending flag is already set. So fix that by invoking the vmethod
directly rather than calling the wrapper. Likewise with
GMemoryOutputStream.

Add a test to gio/tests/memory-input-stream.c to catch read_async
failures in the future.
2011-12-01 13:10:25 +01:00
Dan Winship
a5876e5fc1 GMemoryInputStream/GMemoryOutputStream: make these properly subclassable
The async methods were directly invoking their own implementations of
the sync methods, making it impossible for a subclass to reimplement
them.

https://bugzilla.gnome.org/show_bug.cgi?id=664635
2011-11-30 10:34:19 +01:00
Matthias Clasen
3aa0fc43a6 Clarify local_command_line docs
https://bugzilla.gnome.org/show_bug.cgi?id=641720
2011-11-29 22:10:37 -05:00
Dan Winship
1f33446e1f gnetworkmonitornetlink.c: Make the error messages less geeky
This makes several different errors have identical messages, but
they're pretty much "can't happen" situations anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=664406
2011-11-29 21:45:37 +01:00
Dan Winship
69043de3e0 gzlibdecompressor.c: fix a comment 2011-11-29 21:43:00 +01:00
Michael Vogt
0627759331 Add missing annotation to g_file_set_attribute()
g_file_set_attribute() also permits a NULL value for value_p, and requires it
to be NULL to unset it. Also fix the wrong variable name in the documentation.

Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
2011-11-29 12:01:25 +01:00
Matthias Clasen
30580bdca7 Forgot one interface... 2011-11-28 19:57:44 -05:00
Matthias Clasen
8013401f6e Use an XML blob for gapplication interface info
This is both more readable and more efficient. Double win !
2011-11-28 19:33:24 -05:00
Ryan Lortie
01ce06ac27 gio.symbols: add g_application_[gs]et_default() 2011-11-26 20:28:50 -05:00
Matthias Clasen
c7dc66602a Cosmetics
Reword the title of GSimpleAction in the docs.
2011-11-26 20:12:34 -05:00
Ryan Lortie
a81cdf297c GApplication: add default application 2011-11-26 20:11:40 -05:00
Ryan Lortie
95c3796d6a GApplication: unregister action interface export
We missed a few cases of unexporting the action group interface (in
error cases, and on GApplication teardown).
2011-11-26 20:07:24 -05:00
Matthias Clasen
2cbc6d9ae6 GApplication: Implement query_action 2011-11-26 19:43:46 -05:00
Matthias Clasen
c3a2c280c3 GSimpleActionGroup: Implement query_action 2011-11-26 19:27:30 -05:00
Ryan Lortie
f468e9c309 Add g_action_group_query_action()
This new API allows requesting multiple pieces of information about a
particular action in one go and also simplifies the burden for
GActionGroup implementations -- they need not implement all the separate
APIs now.
2011-11-26 19:25:32 -05:00
Simon McVittie
0104c62f3f GInitable, GAsyncInitable: not initializing gives undefined behaviour
This is the ISO C sense of undefined behaviour, in which
works-by-coincidence, critical warning, abort, demons-fly-out-of-your-nose
are all valid implementations.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662208
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
2011-11-23 12:30:06 +00:00
Simon McVittie
968ef5f5ff GDBusWorker: continue_writing: initialize flush_async_data if closing
This was a regression in commit f41178c6c: flush_async_data wasn't
necessarily NULL in the "don't flush" case.

Also move initialization of these variables up so that it's
unconditional, since that's easier to verify than checking
that each branch gets it right.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=664617
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-11-23 11:20:15 +00:00
Ryan Lortie
345688c9e9 GApplication: don't fail if can't get session bus
If we can't get on the session bus, just behave like a normal non-unique
application.

This turns out to be remarkably easy to implement and lets us avoid
adding a 'dummy' backend.

Add a test for this case as well.

Idea from Zachary Dovel.

https://bugzilla.gnome.org/show_bug.cgi?id=651997
2011-11-22 17:35:56 -05:00
Simon McVittie
c4a11858cf GDBusConnection: don't pass boolean > 1 to _g_dbus_worker_new
This happens to work at the moment (because GDBusWorker.frozen is a
gboolean and not just a 1-bit bitfield), but isn't right: the gboolean
ends up with values 0 or G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING
(which is more than 1).

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=664558
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
2011-11-22 16:08:14 +00:00
Dan Winship
95faa44f2d GSocketInputStream/GSocketOutputStream: fix win32 build
based on a patch from Chun-wei Fan

https://bugzilla.gnome.org/show_bug.cgi?id=664455
2011-11-22 08:56:54 -05:00
Rico Tzschichholz
38a00cec67 gio/tests: Fix for -Werror=format-security 2011-11-21 23:06:15 +01:00
Ryan Lortie
59623973fa dist gio/tests/key8.pem 2011-11-21 14:23:17 -05:00
Simon McVittie
4bb411948c Add test case for #662395
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662395
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-11-21 18:16:51 +00:00
Simon McVittie
96deb40caa GDBus tests: factor out TestIOStream, test_pipe and test_bidi_pipe
These might even make useful public API if they grew a Windows
implementation, but for now they can be Unix-only test API.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662395
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-11-21 18:15:26 +00:00
Simon McVittie
bae9928246 _g_dbus_worker_flush_sync: always flush if we need to
We didn't previously flush in a couple of cases where we should have
done:

* a write is running when flush is called: we should flush after it
  finishes

* writes have been made since the last flush, but none are pending or
  running right now: we should flush the underlying transport straight
  away

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662395
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-11-21 18:12:30 +00:00
Simon McVittie
f41178c6c7 GDBusWorker: move flush async op into continue_writing()
This makes it easier to schedule a flush, by putting it on the same code
path as writing and closing.

Also change message_written to expect the lock to be held, since all
that's left in that function either wants to hold the lock or doesn't
care, and it's silly to release the lock immediately before calling
message_written, which just takes it again.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662395
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-11-21 18:10:11 +00:00
Simon McVittie
301332168b schedule_write_in_worker_thread: require caller to lock; rename accordingly
When we use this function to schedule a flush, it'll be called
with the lock held. Releasing and immediately re-taking the lock would
be pointless.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662395
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-11-21 17:42:58 +00:00
Simon McVittie
56eb16ff50 GDBusWorker: rename some functions
maybe_write_next_message now also closes, and I'm about to make it
consider whether to flush as well, so its name is increasingly
inappropriate. Similarly, write_message_in_idle_cb is a wrapper around
it which could do any of those things.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662395
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-11-21 17:40:51 +00:00
Simon McVittie
18482ab17e GDBusWorker: distinguish between 3 sorts of output that might be pending
If the user calls flush_sync() with no messages in the queue, but an
async write call pending, then we ought to flush after that async write
returns (although we don't currently do that). If it was an async close
or flush that was pending, there's no need to flush (again) afterwards.
So, we need to distinguish.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662395
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-11-21 17:21:35 +00:00
Ryan Lortie
a795e563df Drop last uses of @returns: 2011-11-21 12:02:02 -05:00
Matthias Clasen
f62ee0a0ca GSocketClient: Drop @returns syntax from doc comments 2011-11-21 11:03:31 -05:00
Matthias Clasen
b9f0cb0f07 GSimplePermission: Drop @returns syntax in doc comments 2011-11-21 11:02:30 -05:00
Matthias Clasen
2011ecd6ac GPermission: Drop @returns syntax from doc comments 2011-11-21 11:01:16 -05:00
Chun-wei Fan
3aeddaa2d4 gio/Makefile.am
Filter out yet another *nix only source file from the Visual C++ project
file completion rules.
2011-11-21 11:53:02 +08:00
Matthias Clasen
0878f5ba43 GFile: Add some introspection annotations
progress_callback in g_file_copy and g_file_copy_async may be NULL.
Annotations should reflect that. Pointed out by Carlo Teubner.

https://bugzilla.gnome.org/show_bug.cgi?id=664415
2011-11-20 15:12:05 -05:00
Matthias Clasen
d920cb6bdb GApplication: unregister bus name
https://bugzilla.gnome.org/show_bug.cgi?id=647987
2011-11-19 16:24:08 -05:00
Matthias Clasen
6c7387f6d1 Trivial doc typo fix 2011-11-19 16:23:33 -05:00
Dan Winship
1dc8d1f932 GTlsCertificate: support unencrypted PKCS#8 private keys
PKCS#8 is the "right" way to encode private keys. Although the APIs do
not currently support encrypted keys, we should at least support
unencrypted PKCS#8 keys.

https://bugzilla.gnome.org/show_bug.cgi?id=664321
2011-11-18 20:26:58 -05:00
Nicolas Dufresne
cb74c36678 [gio] Terminate connect call when application proxy is used
The connect_async() calls would never terminated when an application side
proxy was being used. Note we also skip over TLS handshake in this case,
as the application may have to do some proxy handshake before.
2011-11-18 12:32:42 -05:00
Giovanni Campagna
71d3dad3ff GPollable*Stream: expose source methods to introspection
GSource has been introspectable for a while, so can stop skipping
methods of GPollableInputStream/OutputStream that return it.

https://bugzilla.gnome.org/show_bug.cgi?id=664302
2011-11-18 15:20:41 +01:00
Ryan Lortie
f9cc078671 We need <locale.h> in gsettingsschema.c now
for LC_TIME (since we moved a bunch of code over from gsettings.c).
2011-11-18 09:41:52 +00:00
Nicolas Dufresne
4ae42ceb3c Clear proxy address upon retry
The proxy address was not cleared between each attempt. That would lead
to leak or worse, trying to do the proxy handshake on the final
destination address. To make all this safer, I have regroup all the cleanup
where the iterations starts.

https://bugzilla.gnome.org/show_bug.cgi?id=664141
2011-11-17 23:13:35 -05:00
Alexandre Rostovtsev
dc89b51c2d _g_dbus_get_machine_id(): check /etc/machine-id too
machine-id can be in /etc or in /var/lib/dbus.

[amended with slightly revised error handling -smcv]

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=663928
2011-11-17 23:09:50 -05:00
Rico Tzschichholz
8d9f600aea Remove redefinition of typedef 'GSettingsSchemaSource' 2011-11-17 19:46:54 +01:00
Ryan Lortie
7f28529190 g_settings_new_full(): more docs 2011-11-17 17:33:19 +00:00
Ryan Lortie
ee31c7f4ed add plugin example for GSettingsSchemaSource 2011-11-17 14:03:39 +00:00
Ryan Lortie
a4421529b8 Add gtk-doc for gsettingsschema{,source} 2011-11-17 14:03:39 +00:00
Matthias Clasen
011a71cf71 'make dist' fixes 2011-11-17 14:03:39 +00:00
Matthias Clasen
97cf2d78c5 settings-source test: Check returned error as well 2011-11-17 14:03:39 +00:00
Matthias Clasen
a7ce1953fa Trivial typo fix 2011-11-17 14:03:39 +00:00
Jasper St. Pierre
f47264ef5c gsettings: add annotations for _new_full()
The path and backend arguments to g_settings_new_full are optional.
2011-11-17 14:03:39 +00:00
Jasper St. Pierre
6339b5fe2d schema source: avoid introspection confusion
Any method that has its prefix'd argument as its first parameter will be
interpreted by introspection as a method. We don't want this, so we need
to swap the first two parameters.
2011-11-17 14:03:39 +00:00
Jasper St. Pierre
bef773408c gsettingsschema: Use the trusted parameter 2011-11-17 14:03:39 +00:00
Ryan Lortie
148f731748 Add test case and fix some bugs
Add the first test case for the schema source functionality and fix a
couple of bugs that got uncovered by that.
2011-11-17 14:03:39 +00:00
Ryan Lortie
fee2c87ba1 Add g_settings_schema_source_new_from_directory()
It is now possible for plugin loading systems to do the right thing.
2011-11-17 14:03:39 +00:00
Ryan Lortie
446eda8c2b Clarify docs/params for 'schema' vs 'schema id'
Clean up our parameter naming and documentation to draw a clearer line
between a schema and its identifier.
2011-11-17 14:03:39 +00:00
Ryan Lortie
1e70072065 Add g_settings_new_full() taking GSettingsSchema 2011-11-17 14:03:39 +00:00
Ryan Lortie
1c8ae819ed GSettings: add 'settings-schema' property
Ideally we'd have called this 'schema', but it is already used.
2011-11-17 14:03:39 +00:00
Ryan Lortie
269c999463 add boxed types for GSettingSchema{,Source} 2011-11-17 14:03:39 +00:00
Ryan Lortie
c25a36c920 Drop the 'schema_name' field of GSettings
This is strictly redundant now that we can get the ID from the schema
itself.  Its only other purpose was to get the schema name from the
set_property() call to the constructed() call and we can avoid that by
doing the schema lookup at the time of the property being set.
2011-11-17 14:03:39 +00:00
Ryan Lortie
48b99017de speak of 'schema id' rather than 'schema name'
Schemas are identified by id='' in the xml file, so we should use the
same language on the C and GObject property APIs.
2011-11-17 14:03:39 +00:00
Ryan Lortie
736a286dce GSettings: deprecate 'schema' property
This should have been called 'schema-name'.
2011-11-17 14:03:39 +00:00
Ryan Lortie
3bcf1137f4 drop the now-trivial g_settings_schema_new
Combine it into g_settings_constructed()
2011-11-17 14:03:39 +00:00
Ryan Lortie
d5fb032f72 new public header: gsettingsschema.h
Expose some GSettingsSchemaSource and GSettingsSchema APIs.

These are mostly useless so far...
2011-11-17 14:03:39 +00:00
Ryan Lortie
2633f2903e Add non-aborting g_settings_schema_source_lookup()
And rewrite g_settings_schema_new() in terms of it
2011-11-17 14:03:39 +00:00
Ryan Lortie
bf5626ddc2 GSettingSchemaSource: add refcounting 2011-11-17 14:03:39 +00:00
Ryan Lortie
e01a43b621 GSettingsSchema: use our own linked lists
Switch from GSList for the list of schema sources to using our own
linked list type called GSettingsSchemaSource.
2011-11-17 14:03:39 +00:00
Ryan Lortie
5ec84e8056 GSettingsSchema: alter our 'reverse' technology
Instead of building a reversed linked list by prepending in order and
then reversing it at the end, prepend in reverse by iterating backwards
through the directories (to get a list in-order when we're done).
2011-11-17 14:03:38 +00:00
Ryan Lortie
104f7353a7 move GSettingsSchemaKey to gsettingsschema.c
These functions no longer have anything to do with GSettings itself, so
they should not be in that file anymore.

GSettings still wants direct access to the GSettingsSchemaKey structure,
so put that one in gsettingsschema-internal.h.
2011-11-17 14:03:38 +00:00
Ryan Lortie
53b5918545 GSettingsSchemaKey: store the GSettingsSchema* 2011-11-17 14:03:38 +00:00
Ryan Lortie
54964e22d4 g_settings_schema_key_init: take GSettingsSchema*
instead of of GSettings *
2011-11-17 14:03:38 +00:00
Ryan Lortie
10907cafc3 add internal g_settings_schema_get_name() 2011-11-17 14:03:38 +00:00
Ryan Lortie
e6b4074e41 rename GSettingsKeyInfo to GSettingsSchemaKey 2011-11-17 14:03:38 +00:00
Ryan Lortie
426b146e5f GSettingsKeyInfo: rename field 'key' to 'name' 2011-11-17 14:03:38 +00:00
Ryan Lortie
ca2004fe73 remove GSettings* from GSettingsKeyInfo
This way GSettingsKeyInfo depends strictly on the information in the
schema.  Pass the GSettings* around separately where we need it.
2011-11-17 14:03:38 +00:00
Ryan Lortie
d6c3c2f3c2 store some extra info in GSettingsKeyInfo 2011-11-17 14:03:38 +00:00
Ryan Lortie
f60e0e7242 GSettingsKeyInfo: drop unused variable 2011-11-17 14:03:38 +00:00
Ryan Lortie
11ef4d7981 rename gsettingsschema.h to -internal.h 2011-11-17 14:03:38 +00:00
Ryan Lortie
577faeae5b unGObjectify GSettingsSchema 2011-11-17 14:03:38 +00:00
Benjamin Otte
3c66ada435 localfileenumerator: Improve non-stat'ing code
We now avoid the per-enumerated-file stat for type and names. We could
improve this further by moving things to the no_stat function, but this
is what the file chooser needs for autocomplete, so I am happy.
2011-11-16 17:22:17 +01:00
Benjamin Otte
93aea49bd7 localfileinfo: Split out attributes that don't need a stat
This will be used in the next commit.
2011-11-16 17:22:10 +01:00
Benjamin Otte
8863071b9d localfileenumerator: Take the type from the readdir() call
That way, we can avoid stat() calls for all enumerated files in various
cases. In particular in the autocompletion code in the GTK filechooser.
2011-11-16 17:22:03 +01:00
Benjamin Otte
6fe9791f24 gio: Add tests for g_file_attribute_matcher_subtract() 2011-11-16 17:21:21 +01:00
Benjamin Otte
1985d54bb2 fileinfo: Add g_file_attribute_matcher_subtract()
Added as public API so I can write tests, the use case is local.
2011-11-16 17:19:02 +01:00
Benjamin Otte
60c42f6648 tests: Add tests for fileattributematchers 2011-11-16 17:18:58 +01:00
Benjamin Otte
b400127b3e fileinfo: Add g_file_attribute_matcher_to_string()
This is to be mainly used for debugging and tests.
2011-11-16 17:18:13 +01:00
Benjamin Otte
86d29e4e73 fileinfo: Store namespace::* as 0th attribute
This way, we can get_attribute() namespaces. This will be important in
the next commit.
2011-11-16 17:11:52 +01:00
Benjamin Otte
128e0cb787 fileinfo: Change the way attribute matchers are created
We now sort the matchers and remove unnecessary duplicates (like
removing standard:type when we already match standard:*), so that we can
do more complex operations on them easily in later commits.
2011-11-16 17:11:52 +01:00
Benjamin Otte
1850d23f52 fileinfo: Remove optimization for GFileAttributeMatcher
It makes code more complicated, in particular the code I'm about to add.
2011-11-16 17:11:52 +01:00
Dan Winship
bad6c0ad15 GSocketClient: improve error messages on connection failure
Include the hostname (or proxy hostname if it was the connection to
the proxy server that failed) in the GError message when
g_socket_client_connect* fail.

https://bugzilla.gnome.org/show_bug.cgi?id=661266
2011-11-14 19:46:02 -05:00
Dan Winship
74dad004d1 GUnixInput/OutputStream: fix blocking methods to always block
Previously, if you created a GUnixInputStream or GUnixOutputStream
from a non-blocking file descriptor, it might sometimes return
G_IO_ERROR_WOULD_BLOCK from g_input_stream_read/g_output_stream_write,
which is wrong. Fix that. (Use the GPollableInput/OutputStream methods
if you want non-blocking I/O.)

Also, add a test for this to gio/tests/unix-streams.

Also, fix the GError messages to say "Error reading from file
descriptor", etc instead of "Error reading from unix" (which was
presumably from a bad search and replace job).

https://bugzilla.gnome.org/show_bug.cgi?id=626866
2011-11-14 18:31:21 -05:00
Dan Winship
fe5ba0f291 add GNetworkMonitor, for... monitoring the network
Add GNetworkMonitor and its associated extension point, provide a base
implementation that always claims the network is available, and a
netlink-based implementation built on top of that that actually tracks
the network state.

https://bugzilla.gnome.org/show_bug.cgi?id=620932
2011-11-14 13:42:30 -05:00
Dan Winship
eb9755dc9c GInetAddressMask: new type for internet address range matching
Eg, for matching a GInetAddress to a range like "10.0.0.0/8" or
"fe80::/10"

https://bugzilla.gnome.org/show_bug.cgi?id=620932
2011-11-14 13:42:29 -05:00
Dan Winship
fac9e8d29f gunixinput/outputstream: fix docs
Don't try to link to the docs of undocumented private classes
2011-11-13 16:39:45 -05:00
Dan Winship
9b4cc6edf4 GUnixInputStream, GUnixOutputStream: support ordinary files better
If the fd is not a pipe or socket, fall back to using threads to do
async I/O rather than poll, since poll doesn't work the way you want
for ordinary files.

https://bugzilla.gnome.org/show_bug.cgi?id=606913
2011-11-13 16:28:51 -05:00
Simon McVittie
0f01bef4b4 GDBusWorker: tolerate read errors while closing
My previous fix for GNOME#662100 was incomplete: it seems that with some
timings, the stream can be closed with an async read in-flight. This
can make the read fail immediately with G_IO_ERROR_CLOSED instead of
becoming cancelled.

This happens reliably on an embedded device, and rarely on my laptop;
repeating the test 100 times in quick succession reliably reproduces
the bug on my laptop.

It seems as though what we really want is to ignore read errors, once
we've established that we want to close the connection anyway - this
means that after asking to close, you're immune to exit-on-close,
which seems like a good rule.

An additional subtlety is that continuing to read after we know we
want to close is still required, otherwise we'll never emit ::closed.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
Bug-NB: NB#287088
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
2011-11-11 16:05:21 +00:00
Simon McVittie
214d249f40 GDBusWorker: debug on read errors if transport debugging is enabled
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
Bug-NB: NB#287088
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
2011-11-11 16:05:19 +00:00
Simon McVittie
fc21c6ced0 gdbus-exit-on-close test: don't leak a variant
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
Bug-NB: NB#287088
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
2011-11-11 16:05:16 +00:00
Simon McVittie
f0c383917b gdbus-exit-on-close test: optionally be more verbose for debugging
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
Bug-NB: NB#287088
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
2011-11-11 16:05:04 +00:00
Dan Winship
759c0e935d gio: more implementations of GFileDescriptorBased
Implement GFileDescriptorBased in GSocket{Input,Output}Stream and
GUnix{Input,Output}Stream.

https://bugzilla.gnome.org/show_bug.cgi?id=616852
2011-11-09 08:27:53 -05:00
Dan Winship
f09e71aff0 gio/tests/proxy: don't use deprecated functions 2011-11-07 13:50:00 -05:00
Benjamin Otte
7d1c7af1a6 docs: Improve g_variant_loop() docs
Typo fix and changing "is not recommended" to the nice version of "don't
do this", aka "causes undefined behavior".
2011-11-07 15:29:51 +01:00
Matthias Clasen
fc0b8d4f28 Add a test for CDATA in gschema.xml files 2011-11-07 00:14:28 -05:00
Matthias Clasen
7ec69ecd32 Accept CDATA in gschema.xml files 2011-11-07 00:13:56 -05:00
Matthias Clasen
5896808e8c GIO: Don't use G_DISABLE_DEPRECATED for functions 2011-11-03 00:16:41 -04:00
Aleksander Morgado
9782598b81 gdbus: avoid warning when finalizing a GDBusObjectManagerClient
If the GDBusObjectManagerClient doesn't get a name owner during its lifetime,
`on_control_proxy_g_signal' will never be connected to any signal, so we
shouldn't dump any warning in that case.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=662858
2011-10-27 18:34:27 +02:00
David Zeuthen
1fc897352e g_bus_own_name: fix race when unowning a name immediately after owning it
... and also add a test to verify that the fix works.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-10-27 10:35:18 -04:00
Simon McVittie
a124562d1b GDBusConnection: document that this object is (meant to be) thread-safe
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661992
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
2011-10-24 10:40:29 +01:00
Simon McVittie
a031bacaac GDBusConnection: make the closed flag atomic (but still lock to write)
Strictly speaking, neither of the two uses that aren't under the lock
*needs* to be atomic, but it seems better to be obviously correct (and
we save another 4 bytes of struct).

One of these uses is in g_dbus_connection_is_closed(), any use of which
is inherently a race condition anyway.

The other is g_dbus_connection_flush_sync, which as far as I can tell
just needs a best-effort check, to not waste effort on a connection that
has been closed for a while (but I could be wrong).

I removed the check for the closed flag altogether in
g_dbus_connection_send_message_with_reply_unlocked, because it turns out
to be redundant with one in g_dbus_connection_send_message_unlocked,
which is called immediately after.

g_dbus_connection_close_sync held the lock to check the closed flag,
which is no longer needed.

As far as I can tell, the only reason why the lock is still desirable
when setting the closed flag is so that remove_match_rule can't fail
by racing with close notification from the worker thread - but
on_worker_closed needs to hold the lock anyway, to deal with other
data structures, so there's no point in trying to eliminate the
requirement to hold the lock.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661992
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
2011-10-24 10:40:26 +01:00
Simon McVittie
9857cf8c46 GDBusConnection: document which properties are protected by @lock
Also, a few that don't need to be.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661992
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
2011-10-24 10:40:23 +01:00
Simon McVittie
8df114f597 GDBusConnection: access the exit-on-close flag atomically
This isn't strictly necessary, because in every location where it's
checked, if the reading thread misses an update from another thread,
it's indistinguishable from the reading thread having been scheduled
before the writing thread, which is an unavoidable race condition that
callers need to cope with anyway. On the other hand, merging exit_on_close
into atomic_flags gives the least astonishing semantics to library users
and saves 4 bytes of struct, and if you're accessing exit-on-close often
enough for it to be a performance concern, you're probably doing it wrong.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661992
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
2011-10-24 10:40:20 +01:00
Simon McVittie
3a0b60647d Annotate GDBusConnection private functions with thread/lock status
The thread shared between all GDBusWorker instances was variously called
the "worker thread" or "message handler thread", which I mostly changed to
"the GDBusWorker thread" to avoid ambiguity.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661992
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
2011-10-24 10:40:06 +01:00
Ryan Lortie
9c07e7dc90 GDBusMessage: fix leak of GError
As part of the deserialisation process of a zero-length array in the
DBus wire format, parse_value_from_blob() recursively calls itself with
the expectation of failing (as can be seen by the assert immediately
following).

It passes &local_error to this always-failing call and then fails to
free it (indeed, to use it at all).  The result is that the GError is
leaked.

Fix it by passing in NULL instead, so that the GError is never created
in the first place.

https://bugzilla.gnome.org/show_bug.cgi?id=662411
2011-10-21 15:18:20 -04:00
Simon McVittie
848df03e16 GDBusConnection: check for initializedness in most public API
The only exceptions are those of the trivial getters/setters that don't
already need the initialization check for its secondary role as a memory
barrier (this is consistent with GSocket, where trivial getters/setters
don't check):

* g_dbus_connection_set_exit_on_close
* g_dbus_connection_get_exit_on_close
* g_dbus_connection_is_closed

g_dbus_connection_set_exit_on_close needs to be safe for
use before initialization anyway, so it can be set at construct-time.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661689
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
2011-10-21 16:02:33 +01:00
Simon McVittie
3958a9fc1e GDBusConnection: document use while uninitialized as undefined behaviour
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661689
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662208
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
2011-10-21 16:02:31 +01:00
Simon McVittie
a7ea949294 GDBusConnection: check for initialization where needed for thread-safety
Also document which fields require such a check in order to have correct
threading semantics.

This usage doesn't matches the GInitable documentation, which suggests
use of a GError - but using an uninitialized GDBusConnection is
programming error, and not usefully recoverable. (The GInitable
documentation may have been a mistake - GNOME#662208.) Also, not all of
the places where we need it can raise a GError.

The check serves a dual purpose: it turns a non-deterministic crash into
a deterministic critical warning, and is also a memory barrier for
thread-safety. All of these functions dereference or return fields that
are meant to be protected by FLAG_INITIALIZED, so they could crash or
return an undefined value to their caller without this, if called from a
thread that isn't the one that called initable_init() (although I can't
think of any way to do that without encountering a memory barrier,
undefined behaviour, or a race condition that leads to undefined
behaviour if the non-initializing thread wins the race).

One exception is that initable_init() itself makes a synchronous call.
We deal with that by passing new internal flags up the call stack, to
reassure g_dbus_connection_send_message_unlocked() that it can go ahead.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661689
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661992
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
2011-10-21 16:02:27 +01:00
Simon McVittie
245d68be6f GDBusConnection: replace is_initialized with an atomic flag
The comment implied that even failed initialization would set
is_initialized = TRUE, but this wasn't the case - failed initialization
would only set initialization_error, and it was necessary to check both.

It turns out the documented semantics are nicer than the implemented
semantics, since this lets us use atomic operations, which are also
memory barriers, to avoid needing separate memory barriers or locks
for initialization_error (and other members that are read-only after
construction).

I expect to need more than one atomically-accessed flag to fix thread
safety, so instead of a minimal implementation I've turned is_initialized
into a flags word.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661689
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661992
Reviewed-by: David Zeuthen <davidz@redhat.com>
2011-10-21 16:02:22 +01:00
Cosimo Cecchi
3569af4af1 desktop-app-info: annotate g_desktop_app_info_get_keywords()
https://bugzilla.gnome.org/show_bug.cgi?id=662096
2011-10-19 17:27:21 -04:00
Simon McVittie
612d238467 gdbus-non-socket test: avoid use of a GMainContext across a fork
See https://bugzilla.gnome.org/show_bug.cgi?id=658999 for why this would
be bad.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
2011-10-19 10:50:02 +01:00
Simon McVittie
be89f052c2 gdbus-exit-on-close test: cover more possibilities
We didn't previously test anything except the implicit default of TRUE.
Now we test implicit TRUE, explicit TRUE, explicit FALSE, and
disconnecting at the local end (which regressed while fixing Bug #651268).

Also avoid some questionable use of a main context, which fell foul of
Bug #658999 and caused this test to be disabled in master.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
Bug-NB: NB#287088
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
2011-10-19 10:50:02 +01:00
Simon McVittie
5e0492da50 GDBusWorker: if a read was cancelled it means we closed the connection
This was a regression caused by my previous work on GDBusWorker thread-safety
(Bug #651268). The symptom is that if you disconnect a GDBusConnection
locally, the default implementation of GDBusConnection::closed
terminates your process, even though it shouldn't do that for
locally-closed connections; this is because GDBusWorker didn't think a
cancelled read was a local close.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
Bug-NB: NB#287088
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
2011-10-19 10:49:56 +01:00
Simon McVittie
6c33e1cd9d Revert "Disable two GDBus tests"
This reverts commit 05ef173466.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
2011-10-19 10:37:27 +01:00
David Zeuthen
915e2238c4 gio: Introduce get_sort_key() methods on GDrive, GVolume and GMount
This is needed to implement efficient and predictable proxy volume
monitors, see

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

for details.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-10-18 14:29:18 -04:00
Javier Jardón
8d3250016d gio: Use G_VALUE_INIT 2011-10-18 17:12:33 +01:00
Sjoerd Simons
f07201c314 GDBusConnection: Fix race in /gdbus/connection/life-cycle
GDBusConnection sets the closed flag in the worker thread, then adds an
idle callback (which refs the Connection) to signal this in the main
thread. The tests session_bus_down doesn't spin the mainloop, so the
"closed" signal will always fire if iterating the mainloop later (and
drops the ref when doing so). But _is_closed can return TRUE even before
signalling this, in which case the "closed" signal isn't fired and the
ref isn't dropped, causing the test to fail.

Instead simply always wait for the closed signal, which is a good thing
to check anyway and ensures the ref is closed.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661896
Reviewed-by: Matthias Clasen <mclasen@redhat.com>
2011-10-18 13:18:09 +01:00
Alexander Larsson
52389bd010 Fix up testcase broken due to g_thread_new API change 2011-10-17 23:00:29 +02:00
Chun-wei Fan
32214583c3 Fix gio.symbols
g_simple_action_get_parameter_type is now static, so this symbol needs to
be removed from here...
2011-10-17 23:54:17 +08:00
Ryan Lortie
b0ab7aba6b push G_THREADS_MANDATORY over the cliff
This was used as an optimisation for the macro hackery that used to live
in gthread.h.  If a particular library or program knew that it could
rely on thread support being enabled, it would allow for static
evaluation of conditionals in some of those macros.

Since the macros are dead and thread support is now always-on, we can
get rid of this bit of legacy.
2011-10-16 21:59:55 -04:00
Ryan Lortie
b076020719 gobject/gio: some last missed statics/inclues 2011-10-16 21:53:03 -04:00
Ryan Lortie
09429e2c82 gio static fixups 2011-10-16 21:41:15 -04:00
Ryan Lortie
38e8ecd62a more 'static' adding in testcases
No dead code found this time...
2011-10-16 21:41:15 -04:00
Ryan Lortie
b264fccd23 contexts test: don't use deprecated GCond wait API 2011-10-16 21:41:15 -04:00
Ryan Lortie
c5aa8390b2 gitignore 2011-10-16 19:11:00 -04:00
Matthias Clasen
8ff94df632 Add a tests of some GVfs functions
https://bugzilla.gnome.org/show_bug.cgi?id=656621
2011-10-16 16:09:33 -04:00
Matthias Clasen
448be24cf3 Add app lauch environment test 2011-10-16 00:08:42 -04:00
Simon McVittie
a7143a0e9f GDBusConnection: warn that direct access to the stream is a bad idea
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661679
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-10-15 18:03:19 -04:00
Torsten Schönfeld
70eff50f21 Add two annotations to gio
https://bugzilla.gnome.org/show_bug.cgi?id=656679
2011-10-15 18:02:32 -04:00
Kean Johnston
33a86fce6a GIOModule: Use G_SEARCHPATH_SEPARATOR_S instead of ":"
https://bugzilla.gnome.org/show_bug.cgi?id=661257
2011-10-15 17:58:39 -04:00
Dan Winship
de834bed30 GAppLaunchContext: add environment-manipulating functions
Add functions for manipulating the environment under which a
GAppLaunchContext will launch its children, to avoid thread-related
bugs with using setenv() directly.

FIXME: win32 side isn't implemented yet

https://bugzilla.gnome.org/show_bug.cgi?id=659326
2011-10-15 17:30:55 -04:00
Florian Müllner
1ed88f0615 desktop-app-info: Add support for X-GNOME-Keywords
With search gaining traction as being the preferred way to locate
applications, the existing .desktop file fields meant for browsing
often produce insufficient results.
gnome-control-center introduced a custom X-GNOME-Keywords field for
that purpose, which we plan to support in gnome-shell as well.

https://bugzilla.gnome.org/show_bug.cgi?id=661763
2011-10-14 23:30:21 +02:00
Ryan Lortie
430c5635f2 g_thread_new: never fail
Remove the GError argument from g_thread_new() and abort on failure.
Introduce g_thread_try() for those who want to handle failure.
2011-10-13 01:00:57 -04:00
Ryan Lortie
015f4b4513 thread: nuke the concept of 'joinable'
And remove the 'joinable' argument from g_thread_new() and
g_thread_new_full().

Change the wording in the docs.  Clarify expectations for
(deprecated) g_thread_create().
2011-10-13 00:43:33 -04:00
Dan Winship
95cab96515 giomodule: make the default_modules mutex recursive
It is possible for _g_io_module_get_default() to be called recursively
(eg, if a module of one type is loaded that tries to look up gsettings
from its init() method and ends up causing the gsettings module to be
loaded). So use a recursive mutex.
2011-10-12 13:57:44 -04:00
Chun-wei Fan
08d6e1147d Use GLIB_DEPRECATED instead of G_GNUC_DEPRECATED in our headers
This will let others opt out of seeing GLib deprecation warnings
by defining GLIB_DISABLE_DEPRECATION_WARNINGS.

https://bugzilla.gnome.org/show_bug.cgi?id=661438
2011-10-11 13:42:59 -04:00
Matthias Clasen
93e49aea1b Don't use deprecated GThread API in gio tests 2011-10-10 09:49:50 -04:00
Matthias Clasen
ff2dafb209 Add G_GNUC_DEPRECATED to deprecated functions in gio 2011-10-08 23:49:04 -04:00
Antoine Jacoutot
c739a5df14 gio: enable test_peer regression test for OpenBSD
https://bugzilla.gnome.org/show_bug.cgi?id=661255
2011-10-08 17:11:39 +02:00
David Zeuthen
3c4d3dec09 GDBusConnection: Make pending calls error when the connection is lost
If the connection to the bus is lost while a method call is ongoing,
the method call does not get cancelled. Instead it just sits around
until it times out.

This is visible here on XO laptops when stopping the display manager
during shutdown. imsettings starts sending a sync message to give up
its bus name (via g_bus_unown_name()), then systemd terminates the
session bus at approximately the same time. imsettings then hangs for
about 20 seconds before timing out the message.

 http://lists.freedesktop.org/archives/dbus/2011-September/014717.html

imsettings behaviour could be improved as described in that thread,
but I think this is a glib bug. I've also come up with the attached
patch which fixes it.

Credits for the bug-fix goes to Daniel Drake <dsd@laptop.org>. The test
case was written by David Zeuthen <zeuthen@gmail.com>.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-10-07 14:23:03 -04:00
Dan Winship
59f1f54655 Add g_main_context_ref_thread_default()
Add g_main_context_ref_thread_default(), which always returns a
reffed GMainContext, rather than sometimes returning a (non-reffed)
GMainContext, and sometimes returning NULL. This simplifies the
bookkeeping in any code that needs to keep a reference to the
thread-default context for a while.

https://bugzilla.gnome.org/show_bug.cgi?id=660994
2011-10-07 10:14:34 -04:00
David Zeuthen
f34908ef15 GDBus: Regenerate code when the codegen or options passed to it changes
https://bugzilla.gnome.org/show_bug.cgi?id=660498

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-10-05 12:42:06 -04:00
Dan Winship
7ca83c6c9f Fix up some doc comments that referred to threads not being enabled
(and a few other unrelated comment fixes)
2011-10-05 11:54:36 -04:00
David Zeuthen
af55ff5a2b GDBus: disable two more GDBus tests using fork()
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-10-05 10:56:11 -04:00
David Zeuthen
2b963266b6 GDBusProxy: Correctly handle unknown members when having an expected interface
Since it is valid for a D-Bus interface / service to add new methods,
signals or properties we must NEVER warn about unknown properties or
drop unknown signals or disallow unknown method invocations when we
have an expected interface.

So this means that the expected_interface machinery is only useful for
checking that the service didn't break ABI.

Also update the docs so it is clear exactly what it means to have an
expected interface.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-10-05 10:45:22 -04:00
Dan Winship
2f48b4b7fb gthreadedresolver: remove a bit of cruft
Remove a test that only made sense when GThreadedResolver was the base
class for the two non-threaded resolver classes that no longer exist.
2011-10-05 08:36:03 -04:00
Ryan Lortie
26a6b3c6ff gdbusprivate: fix a missed g_mutex_free()
This should have been changed to g_mutex_clear()
2011-10-04 20:08:14 -04:00
Ryan Lortie
6f343ca548 Remove g_mutex_new()/g_cond_new() in testcases
These were the last users of the dynamic allocation API.

Keep the uses in glib/tests/mutex.c since this is actually meant to test
the API (which has to continue working, even if it is deprecated).

https://bugzilla.gnome.org/show_bug.cgi?id=660739
2011-10-04 19:35:27 -04:00
Dan Winship
1481b7bca3 Add _g_io_module_get_default(), use to simplify other *_get_default()s
Add _g_io_module_get_default(), which implements the
figure-out-the-best-available-module-that-is-actually-usable logic,
and use that to simplify g_proxy_resolver_get_default(),
g_settings_backend_get_default(), g_tls_backend_get_default(), and
g_vfs_get_default().

https://bugzilla.gnome.org/show_bug.cgi?id=620932
2011-10-04 13:20:34 -04:00
Dan Winship
38d21f6d8a gsettingsbackend: remove useless check
GMemorySettingsBackend is always present, so there's no need to check
for "no backends available"

https://bugzilla.gnome.org/show_bug.cgi?id=620932
2011-10-04 13:20:28 -04:00
Dan Winship
afa604f881 gio/tests/socket-client: fix a crash (and some indentation) 2011-10-04 13:19:21 -04:00
Chun-wei Fan
53fb4e9867 Bug 660851: Update GIO for changes in GThread API
gsocket.c: Use intern string instead of GStaticPrivate/
           g_static_private_set, as Dan suggested.
2011-10-05 00:57:34 +08:00
Bastien Nocera
82fae72ae9 [gio] Improve doc for g_file_make_directory_with_parents()
g_file_make_directory_with_parents() will fail for already
existing directories, unlike g_mkdir_with_parents(), so mention
this clearly in the docs.

https://bugzilla.gnome.org/show_bug.cgi?id=660791
2011-10-04 17:10:39 +01:00
Ryan Lortie
449a1e8bfd Fix an invalid non-looping use of GCond
The GIOScheduler was using a GCond in a way that didn't deal with the
possibility of spurious wakeups.  Add an explicit predicate and a loop.

Problem caught by Matthias Clasen.

https://bugzilla.gnome.org/show_bug.cgi?id=660739
2011-10-04 11:57:35 -04:00
Ryan Lortie
c474cd71ba GIO: switch a couple more GMutex users to _init()
Move a couple more GIO users off of _new()/_free() to _init()/_clear().

https://bugzilla.gnome.org/show_bug.cgi?id=660739
2011-10-04 11:57:34 -04:00
Ryan Lortie
7d4dea748d GDBus codegen: generate code with embedded GMutex
Modify GDBus code generator to emit code that uses GMutex embedded into
the structure of the skeleton instead of a pointer.

https://bugzilla.gnome.org/show_bug.cgi?id=660739
2011-10-04 11:13:47 -04:00
Ryan Lortie
8bcdabf25a GThreadedResolver: port to embedded GMutex/GCond
This is the only case that was non trivial to port, due to some of the
logic being based on checking the GCond* for being non-%NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=660739
2011-10-04 11:13:46 -04:00
Ryan Lortie
19cd57d4f3 GCancellable: use GCond and GMutex directly
Use a statically-allocated GCond and directly use GMutex instead of
making use of the undocumented G_LOCK_NAME() macro.

https://bugzilla.gnome.org/show_bug.cgi?id=660739
2011-10-04 11:13:46 -04:00
Ryan Lortie
5f48e2cde5 GDBus: switch to struct-embedded GMutex and GCond
Now that we have those, we should use them.

https://bugzilla.gnome.org/show_bug.cgi?id=660739
2011-10-04 11:13:46 -04:00
David Zeuthen
3f982cb9ab GUnixMountPoint: expose options
Make the options from an /etc/fstab entry available as public API -
this can be used to support options such as

 comment=gvfs.name=Foo\040Bar

to e.g. set the name of an fstab mount in the UI to "Foo Bar".

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-10-03 14:06:47 -04:00
Ryan Lortie
3106391694 Revert "GSettings: don't abort on missing schemas"
This reverts commit c841c2ce3f.

This approach has been an unmitigated disaster.  We're getting all sorts
of crashes due to functions that are returning NULL because they can't
find the schema for the default value.  The people who get these crashes
are then confused about the root cause of the problem and waste a lot of
time trying to figure it out.

Until we find a better solution, we should go back to what we had
before.

https://bugzilla.gnome.org/show_bug.cgi?id=655366
2011-10-03 10:19:38 -04:00
Ryan Lortie
2a677d1370 locks: drop _INIT macros
All locks are now zero-initialised, so we can drop the G_*_INIT macros
for them.

Adjust various users around GLib accordingly and change the docs.

https://bugzilla.gnome.org/show_bug.cgi?id=659866
2011-10-02 22:33:10 -04:00
Matthias Clasen
0d1a92ca3d Add new thread creation API
Deprecate both g_thread_create functions and add
g_thread_new() and g_thread_new_full(). The new functions
expect a name for the thread.

Change GThreadPool, GMainContext and GDBus to create named threads.

https://bugzilla.gnome.org/show_bug.cgi?id=660635
2011-10-02 22:11:58 -04:00
Matthias Clasen
34ce4dd032 Replace static privates by privates
GStaticPrivate is heading for deprecation soon, and GPrivate
can replace these uses now.
2011-10-02 22:11:33 -04:00
Ryan Lortie
65b7a20c67 GSettings schemas: allow for zero items in schema
GVDB deals with empty lists by returning NULL for the list instead of a
zero-length (non-NULL) strv.  We can work around that in GSettingsSchema
by checking for the NULL case and treating it like a zero-length list.

https://bugzilla.gnome.org/show_bug.cgi?id=660147
2011-10-01 09:34:44 -04:00
Simon McVittie
7aad93c5b4 sleepy-stream test: use a real GError domain
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Matthias Clasen <mclasen@redhat.com>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=660371
2011-09-30 13:17:27 +01:00
Simon McVittie
e60e4999b9 g_dbus_error_encode_gerror: don't segfault on bad domains
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Matthias Clasen <mclasen@redhat.com>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=660371
2011-09-30 13:17:27 +01:00
Matthias Clasen
5156d1b2d4 Prevent data loss in gdesktopappinfo.c
Don't loose the content of mimeapps.list when it doesn't contain
a [Added Associations] group. Pointed out by Alexander Larsson.

https://bugzilla.gnome.org/show_bug.cgi?id=660130
2011-09-29 23:42:58 -04:00
David Zeuthen
934e0a7470 GUnixFileMonitor: Clean up /proc/mounts monitoring
Most suggestions from Colin Walters <walters@verbum.org>.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-29 15:49:09 -04:00
David Zeuthen
55065461bf GUnixFileMonitor: Use /proc/mounts for monitoring mount changes
On recent Linux distros /etc/mtab is just a symlink to /proc/mounts
and GFileMonitor does not work there because of how the kernel conveys
that the file changes.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-29 15:16:51 -04:00
Javier Jardón
6d05f684eb gfile: Be clear about freeing GFile objects 2011-09-29 20:04:28 +01:00
Dan Winship
0f4b278a4b update .gitignores 2011-09-28 12:20:09 -04:00
Ryan Lortie
104ea17125 GDesktopAppInfo: simplify how defaults work
Previously, we took the default application for a particular mimetype
from the system and copied it into the user's configuration as the
default there.

Instead of doing that we leave the user's default unset, and at time of
use, if the user has no explicitly-set default value, we use the system
default.

This avoids complicated situations where inappropriate applications were
being set as the default in the user's configuration.

https://bugzilla.gnome.org/show_bug.cgi?id=658188
2011-09-26 16:54:24 -04:00
Edward Sheldrake
5b2c809dda Add another mimeapps test
This tests the interaction between mimeinfo.cache, defaults.list and
mimeapps.list to ensure g_app_info_set_as_last_used_for_type doesn't
incorrectly change the default.

https://bugzilla.gnome.org/show_bug.cgi?id=658188
2011-09-26 16:54:23 -04:00
Dan Winship
eba49a4f7f g_simple_async_result_complete_in_idle: add a minor doc clarification 2011-09-26 12:43:08 -04:00
Dan Winship
bec571dc79 giostream: "closed" property should not be marked writable
https://bugzilla.gnome.org/show_bug.cgi?id=659920
2011-09-23 08:53:47 -04:00
Colin Walters
f42fe6cdc0 gvalue: Add explicitly signed g_value_get_schar() and g_value_set_schar()
The documentation for G_TYPE_CHAR says:

"The type designated by G_TYPE_CHAR is unconditionally an 8-bit signed
 integer."

However the return value for g_value_get_char() was just "char" which
in C has an unspecified signedness; on e.g. x86 it's signed (which
matches the GType), but on e.g. PowerPC or ARM, it's not.

We can't break the old API, so we need to suck it up and add new API.
Port most internal users, but keep some tests of the old API too.

https://bugzilla.gnome.org/show_bug.cgi?id=659870
2011-09-22 20:05:38 -04:00
Ryan Lortie
b6140c2f89 Port internal GStaticRecMutex users to GRecMutex 2011-09-21 16:09:04 -04:00
Ryan Lortie
806de91cd5 GSettings: port from GStaticMutex to GMutex 2011-09-21 16:06:53 -04:00
Ryan Lortie
cf26a6fc32 G_LOCK: port from GStaticMutex to GMutex
GCancellable made use of the undocumented G_LOCK_NAME macro in an
invalid way.  Fix that up while we're at it.
2011-09-21 15:55:36 -04:00
David Zeuthen
aabdb7e190 GDBusObject{Proxy,Skeleton}: Prefix properties with g- to avoid collisions
Otherwise we might collide with an interface called Connection.

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

This is for the same reason that GDBusProxy has its properties
prefixed with g-.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-21 12:35:40 -04:00
Ryan Lortie
1f5262d2c9 gunixmounts: exempt entries with "none" mountpoint
We ignore entries with mountpoint of "swap" and "ignore".  Add "none" to
that list, since Debian uses it.

Probably we should move to using our already-existing internal list of
things to ignore, but this patch is more minimally intrusive for now.

https://bugzilla.gnome.org/show_bug.cgi?id=654563
2011-09-21 10:20:08 -04:00
Xavier Claessens
6b39085016 gdbus-codegen: prepend arg_ to method/signal arg names
This is to avoid shadow declaration warning in the case an arg name
is "time" for example.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-21 07:45:50 -04:00
Xavier Claessens
70515ffe92 gdbus-codegen: Fix build errors in generated code
https://bugzilla.gnome.org/show_bug.cgi?id=659646
2011-09-21 10:22:24 +02:00
Dan Winship
855e13cc0a GThreadedResolver: don't overwrite errors
If a dns op was cancelled and then the abandoned op failed, it would
try to overwrite the original error. Fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=658769
2011-09-20 17:00:58 -04:00
Antoine Jacoutot
0db338bdb0 gunixmounts: Fix compilation on BSD
Commit afa82ae805 introduced a compilation
regression on BSD systems that use the sysctl(3) interface; we need to
declare the buffer len in _g_get_unix_mount_points()
BZ #659528
2011-09-20 16:58:00 +02:00
David Zeuthen
88f2b32eb0 GDBusObjectManagerServer: Add test for export_uniquely() method
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-19 17:31:21 -04:00
Matthew Barnes
b1c08ca419 GDBusObjectManagerServer: Use correct object path in export_uniquely() method
In registration_data_export_interface(), the object_path is obtained using:

object_path = g_dbus_object_get_object_path (G_DBUS_OBJECT (data->object));

But when exporting an object uniquely, the object_path is not assigned
to the GDBusObject until after all the interfaces are exported.
Therefore, registration_data_export_interface() is trying to export
the interface on the non-unique object path, which can lead to
run-time errors if an object already exists on that path.

Instead, registration_data_export_interface() should be passed the
object_path explicitly, as is done in
g_dbus_object_manager_server_export_unlocked().

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-19 16:45:05 -04:00
Philip Withnall
fe27bf0037 Don't close stream twice when splicing
Ensure that the output/target stream in a g_output_stream_splice_async()
operation is marked as closed if G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET is
passed to g_output_stream_splice_async(). This removes the possibility of
local FDs being closed twice because the stream's not marked as closed.

This is implemented by calling g_output_stream_close() from within
g_output_stream_splice_async() instead of calling the stream's close_fn()
directly.

Closes: bgo#659324
2011-09-19 10:13:52 +02:00
Dan Winship
eb45a590fa gsocks5proxy, gsocks4aproxy: simplify some error messages
There's no need to include the exact max length in the error messages,
and it makes it look like the strings need to use ngettext() if you do.

https://bugzilla.gnome.org/show_bug.cgi?id=658206
2011-09-18 10:49:58 -04:00
Ryan Lortie
b83e0a39fb glib-compile-schemas: remove --uninstall option
This option does nothing as has been documented as "will be removed
soon" for the vast majority of its life.
2011-09-17 19:11:10 -04:00
David Zeuthen
48494dd552 gdbus-codegen: Support Ugly_Case for given C namespace
https://bugzilla.gnome.org/show_bug.cgi?id=658976

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-16 16:01:13 -04:00
David Zeuthen
c6c2c10946 gdbus-codegen: Single letter namespaces get dropped from symbol names
https://bugzilla.gnome.org/show_bug.cgi?id=659082

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-16 15:20:00 -04:00
Simon McVittie
e34e8a25a0 _g_dbus_worker_new: hold a ref until we have done the initial read
Otherwise, we could use-after-free the GDBusWorker, if its last-unref
is immediately after _g_dbus_worker_new returns (before the worker thread
does its initial read).

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651268
Bug-NB: NB#271520
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-16 12:00:22 -04:00
Simon McVittie
698eeb3ef6 GDBusWorker: as a precaution, access 'stopped' boolean atomically
This member is written in _g_dbus_worker_stop from arbitrary threads, and
read by the worker thread, so it should be accessed atomically.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651268
Bug-NB: NB#271520
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-16 12:00:22 -04:00
Simon McVittie
20497f7af9 Regression test for closing a stream, slowly, while a message is queued
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651268
Bug-NB: NB#271520
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-16 12:00:22 -04:00
Simon McVittie
c180ea13ae GDBusWorker: annotate more functions with lock/pending state
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651268
Bug-NB: NB#271520
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-16 12:00:22 -04:00
Simon McVittie
8097e2de85 GDBusConnection: delegate to the worker to close the stream
We can't safely close the output part of the I/O stream until any
pending write or flush has been completed. In the worst case, this could
lead to an assertion failure in the worker (when the close wins the
race) or not closing the stream at all (when the write wins the race).

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651268
Bug-NB: NB#271520
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-16 12:00:22 -04:00
Simon McVittie
a8f75f21b4 GDBusWorker: combine num_writes_pending with flush_pending
num_writes_pending was a counter, but it only took values 0 or 1, so make
it a boolean: it would never make sense to be trying to write out two
messages at the same time (they'd get interleaved).

Similarly, we can never be writing and flushing at the same time (that'd
mean we were flushing halfway through a message, which would be pointless)
so combine it with flush_pending too, calling the result output_pending.

Also assert that it takes the expected value whenever we change it,
and document the locking discipline used for it, including a subtle
case in write_message_in_idle_cb where it's not obvious at first glance
why we don't need the lock.

(Having the combined boolean at the top of the block of write-related
struct members improves struct packing on 64-bit platforms, by packing
read_num_ancillary_messages and output_pending into one word.)

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651268
Bug-NB: NB#271520
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-16 12:00:22 -04:00
Ryan Lortie
05ef173466 Disable two GDBus tests
These tests try to use GMainContext across fork() which now fails a lot
more violently than it used to.

See https://bugzilla.gnome.org/show_bug.cgi?id=658999 for information.
2011-09-16 11:18:26 -04:00
Murray Cumming
0bb01a150f Revert "Add g_memory_input_stream_new_from_data_full/add_data_full() apis"
I'm not sure that this API is right now that I try to use it.

This reverts commit 42738469d1.
2011-09-16 16:09:56 +02:00
Tristan Van Berkom
42738469d1 Add g_memory_input_stream_new_from_data_full/add_data_full() apis
Add an extra state pointer and an extra GDestroyNotify function
to the 'Chunk' definition... allowing bindings to attach some extra
state to memory chunks (to get memory management correctly from
language bindings).
Bug #589887
2011-09-16 15:37:06 +02:00
Ryan Lortie
43007aa2d2 GApplication: don't create a mainloop
Just iterate the main context directly.  Also: avoid calling the virtual
functions for mainloops.

https://bugzilla.gnome.org/show_bug.cgi?id=658805
2011-09-14 14:09:12 -04:00
Ryan Lortie
39294664a6 GApplication test: fix testcase to avoid fork()
The GApplication test case tried to fork() while using GMainLoop,
causing problems.  Avoid doing that by splitting the child process into
a separate program and spawning it in the usual way.

https://bugzilla.gnome.org/show_bug.cgi?id=658999
2011-09-14 14:09:12 -04:00
Ryan Lortie
01f9479438 GApplication: add chain-up checks
Make sure ::startup and ::shutdown are being chained up.
2011-09-14 14:00:08 -04:00
Brian Koning
15b1c1bf4f GApplication: introduce ::shutdown
Introduce ::shutdown as a dual to ::startup.

https://bugzilla.gnome.org/show_bug.cgi?id=643934
2011-09-14 13:45:44 -04:00
Tomas Bzatek
659b287a92 gdbus-codegen: Fix segfault when remote property is invalidated
The 'key' variable is no longer valid outside the cycle, owned and
probably already freed by GVariant. This causes apps to segfault
when proxy is constructed and a property on remote d-bus service
changes (actually is invalidated). Looks like a typo anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=659070
2011-09-14 19:02:01 +02:00
Richard Hughes
8152e3f54e Fix the description for g_app_info_get_icon()
It can return NULL when there is no default icon.
2011-09-13 16:38:40 +01:00
Ryan Lortie
1b03391984 Merge remote-tracking branch 'gvdb/master' 2011-09-12 08:12:57 -04:00
Matthias Clasen
2d44a45b6b GDesktopAppInfo: Improve docs 2011-09-12 01:56:45 -04:00
Matthias Clasen
05342d0a93 Fix formatting in a doc comment 2011-09-12 01:49:01 -04:00
Matthias Clasen
73c427fab9 Expand mimeapps test
This adds a test involving both defaults.list and mimeapps.list.
2011-09-12 01:46:48 -04:00
Matthias Clasen
2ba5a79a70 Also check api results
In addition to looking at mimeapps.list, check that the default
and recommended apps returned by g_app_info api are as expected.
2011-09-11 23:39:29 -04:00
Matthias Clasen
75c989b9ab Revert "Fix default setting generation in g_desktop_app_info_set_as_last_used"
This reverts commit a13f5ca4da.
2011-09-11 23:28:45 -04:00
Matthias Clasen
938e57dd4b Adapt tests to string changes 2011-09-11 23:28:44 -04:00
Matthias Clasen
ec3653be00 glib-compile-schemas: Pedantic string fixes
Replace 'can not' by 'cannot' in several places. String change!

https://bugzilla.gnome.org/show_bug.cgi?id=658207
2011-09-10 10:36:56 -04:00
Josselin Mouette
a13f5ca4da Fix default setting generation in g_desktop_app_info_set_as_last_used
* Do not ignore the system default
 * Do not exclude the last used being set from the default list

This fixes the default applications dialog in control-center.

https://bugzilla.gnome.org/show_bug.cgi?id=658188
2011-09-10 08:26:12 +02:00
Matthias Clasen
011c0b488f Add some tests for mimeapps.list handling
These tests directly look at mimeapps.list to verify that
we make the expected changes to the database.
2011-09-09 23:44:41 -04:00
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
Eduardo Lima Mitev
30d9636df2 GIO: Add more missing GI annotations
- g_io_extension_point_register()
 - g_io_extension_point_lookup()
 - g_io_extension_point_implement()

https://bugzilla.gnome.org/show_bug.cgi?id=625383
2011-08-23 19:56:36 -04:00
David Zeuthen
e604b2d0af gdbus-codegen: update comment in code to reflect reality
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-08-23 12:57:14 -04:00
David Zeuthen
05448a6bef gdbus-codegen: Rework C property getters
Rework property getters to use a vfunc so we can take the fast path
and avoid allocating memory for both the skeleton and the proxy
cases. This requires some special case because of how GVariant expects
you to free memory in some cases, see #657100. Add test cases for
this.

Document the _get_ functions as not being thread-safe and also
generate _dup_ C getters (which are thread-safe).

Mark all the generated _get_, _dup_ and _set_ as (skip) as non-C
languages should just use GObject properties and not the (socalled)
"C binding".

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-08-23 12:54:27 -04:00
Colin Walters
5b68b49b20 GTimeZoneMonitor: Revert addition of this class
The main rationale for adding it was to avoid having gnome-shell
mmap'ing /etc/localtime once a second.  However, we can just as easily
run inotify there, and given no one else was clamoring for a way to
detect when the time zone changes, I don't see a need for public API
here - at least not yet.

In the bigger picture, I just don't believe that the vast majority of
applications are going to go out of their way to instantiate and keep
around a random GTimeZoneMonitor class.  And if they do, it's has the
side effect that for other bits of code in the process, local GDateTime
instances may start varying again!

So, if code can't rely on local GDateTime instances being in a
consistent state anyways, let's just do that always.  The
documentation now says that this is the case.  Applications have
always been able to work in a consistent local time zone by
instantiating a zone and then using it for GDateTime constructors.

We fix the "gnome-shell stats /etc/localtime once a second" issue by
using timerfd (in glib) and inotify (in gnome-shell).

https://bugzilla.gnome.org/show_bug.cgi?id=655129
2011-08-22 11:12:37 -04:00
Stef Walter
26548e05bb Merge branch 'concurrent-cancellable' 2011-08-19 11:21:11 +02:00
Stef Walter
54579bf88f gio: GCancellable can be used concurrently
* Update documentation to note that GCancellable can be used
   concurrently by multiple operations.
 * Add documentation to g_cancellable_reset that behavior is
   undefined if called from within cancelled handler.
 * Add test for multiple concurrent operations using the same
   cancellable.

https://bugzilla.gnome.org/show_bug.cgi?id=656387
2011-08-19 11:13:37 +02:00
Brian Cameron
b5f1ea4bb1 void functions should not return. Fixes bug #656675. 2011-08-17 03:01:14 -05:00
Ryan Lortie
0a4663343f distcheck fixes 2011-08-15 21:01:23 -04:00
Simon McVittie
67cf3ea368 Add a stress-test for GDBusProxy in threads with no default main context
Destroying a GDBusProxy in a thread used to race with NameOwnerChanged
being delivered to the main context's thread (GNOME #651133).

Also, g_dbus_proxy_call_sync in a thread would race with NameOwnerChanged
being delivered to the main context's thread and rewriting the name_owner
(GNOME #656039).

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=656039
Bug-NB: NB#259760
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-08-15 12:50:04 -04:00
Simon McVittie
85214d1e7f GDBusProxy: hold properties_lock while using any mutable property
This changes the meaning of "properties_lock" from "lock for D-Bus
properties" to "lock for GObject properties".

The most common problem, and the only one I've reproduced in a regression
test, is name_owner, which can be updated by the thread that owns
the GDBusProxy's main context (i.e. the thread-default main context of
the thread that constructed it) at the same time that a blocking call
is made. When a GDBusProxy is constructed in a thread-pool thread for
short-term use, the main context will typically be the global default
main context (which is actively running in the main thread!), making
this extremely problematic.

The interface info is perhaps a theoretical concern - one thread could
conceivably set it at the same time that another thread uses it, but only
in relatively pathological situations. The current API for this does have
the problem that it returns a borrowed ref, but interface info is
hopefully permanent anyway.

The default timeout is probably only a theoretical concern - it's just an
int, so writes are indivisible, and there's no worry about whether
something has been freed - but to be safe, let's hold the lock for that
too.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=656039
Bug-NB: NB#259760

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-08-15 12:50:03 -04:00
Simon McVittie
5909cb1031 GDBusProxy: factor out async_init_data_set_name_owner
This removes the need for async_init_get_name_owner_cb to cope with being
called without a real GAsyncResult, and will simplify the addition of
correct thread-locking.

In async_init_data_set_name_owner, use the name_owner parameter instead
of the corresponding member of GDBusProxyPrivate, partly to reduce
pointer-chasing but mainly to avoid needing to hold the lock.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-08-15 12:50:01 -04:00
Simon McVittie
03ae974f7c g_dbus_proxy_get_property: use accessors for all mutable state
These ought to have thread-locking, and having it in the accessor seems
better than duplicating it here.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-08-15 12:50:00 -04:00
Simon McVittie
20387d262f GDBusProxy: if a well-known name is not owned, don't GetAll from the dbus-daemon
If you run:

    ( cd gio/tests && G_DBUS_DEBUG=all ./gdbus-proxy-well-known-name )

you can see that in the case where the name com.example.TestService isn't
owned yet, the GDBusProxy calls GetAll() with no destination, resulting
in an error reply from the peer (the dbus-daemon itself). That's clearly
not right!

However, if priv->name is NULL, that indicates the special case where we
really do want to talk directly to a peer, instead of via the bus daemon
(most likely to be used on peer-to-peer connections); in that special
case, do call GetAll().

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-08-15 12:49:58 -04:00
Ryan Lortie
2b0171a808 g_settings_bind: add some g_return checks
https://bugzilla.gnome.org/show_bug.cgi?id=636405
2011-08-15 10:43:32 -04:00
David Zeuthen
20a4f2578f GDBusObjectManagerClient: Emit signals on proxy before emitting on manager
This is needed because the proxy may need to update its internal state
which a signal handler connected to the manager may rely on.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-08-15 05:43:24 -04:00
Sjoerd Simons
a9ca74efb1 Don't finish gtls connection if the handshake failed
https://bugzilla.gnome.org/show_bug.cgi?id=656283
2011-08-13 16:15:11 -04:00
Matthias Clasen
ae496a52a9 GDBusProxy: on_properties_changed initialize some variables
This avoids calling g_variant_unref and g_free on uninitialized memory
if PropertiesChanged is received in the creating thread's thread-default
main context's thread, at the same time as releasing the last ref in
another thread. This would result in "goto out" before the variables
freed after that label had been initialized to NULL.

Based on a patch by Simon McVittie, bug 656282
2011-08-13 16:09:41 -04:00
David Zeuthen
428f49b9c8 In addition to /media and $HOME, also show mounts in $XDG_USER_DIR
Prepare for the future where udisks will use $XDG_USER_DIR/Volumes
instead of /media when mounting filesystems on behalf of the user.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-08-12 11:10:22 -04:00
Martin Pitt
c3fd789bb7 [gi] Add missing (out) annotation to g_dbus_{node,interface}_info_generate_xml() 2011-08-11 14:09:23 +02:00
Martin Pitt
782f839383 [gi] Add missing Gio transfer annotations 2011-08-11 11:38:20 +02:00
Martin Pitt
0e54825120 [gi] Fix parameter name typos in Gio docstrings
Found by GIR compiler when building gobject-introspection:

gir/gio-2.0.c:33525: Warning: Gio: g_tls_password_set_description: unknown
parameter 'flags' in documentation comment, should be one of 'password',
'description'
gir/gio-2.0.c:14568: Warning: Gio: g_action_group_action_state_changed: unknown
parameter 'state' in documentation comment, should be one of 'action_group',
'action_name', 'value'
2011-08-11 11:38:19 +02:00
Martin Pitt
b2c6b801bc [gi] Add missing transfer annotation to g_dbus_node_info_lookup_interface() 2011-08-10 22:51:32 +02:00
Martin Pitt
c783bfd4e7 [gi] Add missing (allow-none) annotations to g_dbus_connection_register_object() 2011-08-09 14:52:53 +02:00
Dan Winship
cfa90b8fc1 gio/tests/.gitignore: fix 2011-08-05 19:43:47 -04:00
Murray Cumming
d728c00a04 gio enums: Remove trailing commas 2011-08-04 21:47:07 +02:00
Stef Walter
29aae440fb Fix up ABI symbols after GTlsDatabase merge.
https://bugzilla.gnome.org/show_bug.cgi?id=636572
2011-08-04 09:43:45 +02:00
Stef Walter
0f99cfa882 GTlsDatabase and related objects
The database is an abstract object implemented by the various TLS
backends, which is used by GTlsConnection to lookup certificates
and keys, as well as verify certificate chains.

Also add GTlsInteraction, which can be used to prompt the user
for a password or PIN (used with the database).

https://bugzilla.gnome.org/show_bug.cgi?id=636572
2011-08-04 08:54:55 +02:00
kotarou
a187199efd build: Pass ZLIB_CFLAGS for gio build
Otherwise we will fail if zlib is in an alternative prefix.

Commit message written by Colin Walters <walters@verbum.org>

https://bugzilla.gnome.org/show_bug.cgi?id=655769
2011-08-03 08:47:01 -04:00
Owen W. Taylor
ee63179b71 g_cancellable_get_fd: silently return -1 for NULL cancellable
This keeps compatibility with previous behavior.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-08-01 16:24:34 -04:00
David Zeuthen
659ba3d0b3 GDBusConnection: Only apply exit-on-closed semantics if properly initialized
Otherwise there is no point in gracefully handling the error...

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-08-01 11:58:05 -04:00
Nicolas Dufresne
dbb78fe57d Added TLS PEM parser unit test 2011-07-27 16:23:33 -04:00
Nicolas Dufresne
fdfb42b9f2 Rework PEM parsing to not be order dependent
Some valid PEM file would not work because the private key was put
before the certificate.
2011-07-27 16:23:33 -04:00
Tomas Bzatek
fb45baaf8c Docs: Correct the namespace for g_file_query_filesystem_info() 2011-07-26 17:32:53 +02:00
David Zeuthen
b7f3638e5c More gdbus-codegen fixed to build on non-Unix
https://bugzilla.gnome.org/show_bug.cgi?id=655148#c6

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-07-26 10:05:57 -04:00
Ryan Lortie
633fd86815 glocalfile: don't bother with fstype on win32
Fixes the broken build on Windows.
2011-07-26 11:20:12 +02:00
Ryan Lortie
12f516b44c Merge branch 'gwakeup' 2011-07-26 10:50:25 +02:00
Ryan Lortie
c81eb121a1 GWakeup: make it private API
Colin requests that we keep this one private for now.

Include it at each point of use (libglib, libgio, tests).
2011-07-25 18:51:03 +02:00
David Zeuthen
32b1349a23 More fixes for non-Unix builds
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-07-25 10:31:17 -04:00
David Zeuthen
f8b98841ad Fix the build on non-Unix
https://bugzilla.gnome.org/show_bug.cgi?id=655148

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-07-25 09:56:01 -04:00
Ryan Lortie
0a971e46bf GCancellable: port to GWakeup 2011-07-25 15:30:35 +02:00
Murray Cumming
3769c1e173 Docs: Fix tiny typo. 2011-07-25 09:24:43 +02:00
Dan Winship
eac8d47e37 gio/tests/socket: add some basic IPv4 and IPv6 tests 2011-07-24 14:55:05 -04:00
Dan Winship
aefda965f6 GSocket: fix connected state after async connect
socket->priv->connected was only being set if g_socket_connect()
succeeded right away; in the case where it returns G_IO_ERROR_PENDING,
it never got set. Fix that by having g_socket_check_connect_result()
set it on success.
2011-07-24 14:54:45 -04:00
Matthias Clasen
4cb33b158b Explicitly unset the session bus address for the peer tests
Otherwise, we may run into trouble as opening a peer-to-peer
connection uses a socket client, which uses a proxy resolver
which may end up using gsettings, whose dconf backend may end
up using the session bus to talk to dconfd...
2011-07-23 21:59:49 -04:00
Matthias Clasen
d344e69dc2 Properly bring up a session bus for application tests
As pointed out in bug 644601, session_bus_up() requires
us to set up environment variables for things to work.
2011-07-23 21:16:28 -04:00
Matthias Clasen
1f9e84896b Fix a typo 2011-07-23 21:07:48 -04:00
Vincent Untz
ae7c48b955 GDesktopAppInfo: Add g_desktop_app_info_get_show_in()
Necessary for rebasing gnome-menus on top of GDesktopAppInfo.

https://bugzilla.gnome.org/show_bug.cgi?id=655044
2011-07-23 10:05:12 +02:00
David Zeuthen
c404dbed11 gdbus-codegen: Add support for new org.gtk.GDBus.C.UnixFD annotation
Also add convenience _with_unix_fd_list variants to GDBusConnection,
GDBusProxy and GDBusMethodInvocation types to easily support this.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-07-21 16:06:18 -04:00
David Zeuthen
03f673abc2 GDBus: Don't convert GVariant type 'h' to gint
The code-generator already uses GVariant* so generated code didn't
really work at all. We want that instead of gint to avoid confusion
because a 'h' instance is an _index_ into a GUnixFDList, not a file
descriptor.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-07-21 09:43:59 -04:00
David Zeuthen
419bfe325c gdbus-codegen: Use G_TYPE_STRV/gchar** for GVariant type 'ao'
This is possible now that we have better support for object path
arrays, see

 http://git.gnome.org/browse/glib/commit/?id=19878998bc386db78614f1c92ff8524a81479c7b

Note that this breaks the ABI of generated code but since
gdbus-codegen(1) has never yet been in a stable GLib release, this is
fine.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-07-21 09:32:38 -04:00
Benjamin Otte
a5e94cbd36 glocalfile: Fix compilation without USE_STATFS and USE_STATVFS 2011-07-21 02:58:15 +02:00
Giovanni Campagna
4e015d36a0 gdbusintrospection: fix introspection annotations
g_dbus_interface_info_lookup_* were incorrectly considered
(transfer full) by introspected bindings, and this caused memory
corruptions.

https://bugzilla.gnome.org/show_bug.cgi?id=622921
2011-07-20 13:50:20 -04:00
Ryan Lortie
c841c2ce3f GSettings: don't abort on missing schemas
Give a g_critical instead.
2011-07-20 14:06:36 +02:00
Ryan Lortie
06941419e3 Add some blacklisted mount directories
Another long-carried Debian patch.  No reason that we should not have
these few extra items in the (already long) upstream list.
2011-07-20 10:52:07 +02:00
Holger Berndt
d1e5161ab0 Document how to unset attributes
Unsetting won't work on all attributes. Currently, only
metadata attributes are supported.

https://bugzilla.gnome.org/show_bug.cgi?id=620423
2011-07-19 22:52:56 +02:00