Commit Graph

14217 Commits

Author SHA1 Message Date
Ryan Lortie
066df98849 g_settings_schema_list: some fixes
Prevent a crash in the case that gvdb_table_list() returns NULL (ie:
because a schema has no keys).

Stop a memory leak caused by pointlessly stealing keys from a hashtable
(after we quarked them already).

Stop allocating an extra entry at the end of an array for a terminator
(that we never wrote anyway) when all functions using this API refer to
the out-parameter length array.

https://bugzilla.gnome.org/show_bug.cgi?id=711016
2013-10-28 09:44:05 -07:00
Matthias Clasen
5616e03f7a Fix handling of icons in GNotification
The fdo backend was sending a uri where a file path
was expected.
2013-10-28 12:32:04 -04:00
Stef Walter
65af7c47ff Add a request_certificate virtual method to GTlsInteraction
This allows GTlsConnection implementations to request a certificate
from the user.

Fix ups by Dan Winship <danw@gnome.org>

https://bugzilla.gnome.org/show_bug.cgi?id=637257
2013-10-28 09:36:26 +01:00
Matthew Barnes
1fba61981a GKeyFileSettingsBackend: ignore file deletions
Ignore the keyfile being deleted (ie: by the user) instead of reporting
it to the application as all values being reverted back to their
originals.

https://bugzilla.gnome.org/show_bug.cgi?id=637956
2013-10-27 17:27:44 -07:00
Christian Persch
ef57996f44 Add test for extended schemas
The test checks that the keys of the base schema are all present in
the extended schema.

https://bugzilla.gnome.org/show_bug.cgi?id=645453
2013-10-27 17:23:17 -07:00
Ryan Lortie
cbf8cf8598 GSettings: properly support 'extends'
Support the 'extends' attribute that has been supported by the compiler
for a long time by doing three things:

 - when creating a schema that extends another schema, lookup that other
   schema

 - when looking up keys and we can't find them in the schema, check
   (recursively) in the 'extends' schema

 - when listing all keys in a schema, also visit the extends schemas,
   but take care to avoid duplicates caused by overrides

Extend the testsuite to verify that it works.

https://bugzilla.gnome.org/show_bug.cgi?id=645453
2013-10-27 17:18:10 -07:00
Ross Lagerwall
3041d0a8db gio: Fix typo in documentation
https://bugzilla.gnome.org/show_bug.cgi?id=710859
2013-10-27 17:15:38 -07:00
Ryan Lortie
6f386341bd Add g_settings_schema_source_list_schemas()
g_settings_list_schemas() and g_settings_list_relocatable_schemas() are
now deprecated.

This will allow listing off schemas on non-default sources and is a
better fit with the new direction the API is going.

https://bugzilla.gnome.org/show_bug.cgi?id=680838
2013-10-27 17:12:57 -07:00
Colin Walters
13067362d2 gsubprocess: Add documentation about default input directions 2013-10-27 16:02:36 -04:00
Colin Walters
6bb9d17e40 gsubprocess: Fall back to plain F_DUPFD+fcntl for OS X <= Snow Lion
Since it apparently doesn't have F_DUPFD_CLOEXEC.

https://bugzilla.gnome.org/show_bug.cgi?id=710962
2013-10-27 16:02:36 -04:00
Ryan Lortie
00b35c78f8 Add a testcase for summary/description
https://bugzilla.gnome.org/show_bug.cgi?id=668232
2013-10-27 10:42:55 -07:00
Ryan Lortie
96a053e025 Add g_settings_schema_key_get_summary/description
Add an API to read the summary and description from the .xml schema
files.

This will be used by dconf-editor and gnome-tweak-tool.

This API is a bit heavy -- it parses the XML and builds a table.  It
also loads gettext domains for translation.  It only does these things
if it is used, however, so it will not impact normal applications.

We store the summary/description in a pair of hash tables on the schema
source (which we have a backref to as of a few commits ago).  We can't
use a global table because people might want to request summary and
description from non-default sources.  We don't want to use per-schema
tables because we'd have to reparse the directory every time (since we
cannot guess which file a schema may have been in).

https://bugzilla.gnome.org/show_bug.cgi?id=668232
2013-10-27 10:42:55 -07:00
Ryan Lortie
84fa07aeb1 Make GSettingsSchemaKey public
Take this private API and make it public along with a boxed type and
ref/unref functions.

Future commits will add accessors with new functionality and some that
allow us to deprecate functions on GSettings itself (such as
g_settings_get_range).

https://bugzilla.gnome.org/show_bug.cgi?id=668232
2013-10-27 10:42:50 -07:00
Ryan Lortie
0ef43ba743 GSettingsSchema: store a backref to the source
Record in each GSettingsSchema object the source from which it came.

This will be useful in future commits.

https://bugzilla.gnome.org/show_bug.cgi?id=668232
2013-10-27 09:32:10 -07:00
Ryan Lortie
e462eda3d5 Clean up GSettingsSchema logic
The way we created the global schema list predates
g_settings_schema_source_new_from_directory() and therefore doesn't use
it.

Update it to use that function, removing some code.

https://bugzilla.gnome.org/show_bug.cgi?id=668232
2013-10-27 09:32:10 -07:00
Ryan Lortie
ba3103763d tests: test g_hash_table_get_keys_as_array()
https://bugzilla.gnome.org/show_bug.cgi?id=710964
2013-10-27 09:26:56 -07:00
Ryan Lortie
2880767702 Add g_hash_table_get_keys_as_array()
Returns a %NULL-terminated array of the keys of a hashtable.

In the case that the hash table has strings for keys, this is actually a
gchar**.

https://bugzilla.gnome.org/show_bug.cgi?id=710964
2013-10-27 09:26:53 -07:00
Giovanni Campagna
415c6d2e27 gapplication: don't emit warnings for DBus calls
If a broken (or malicious) remote client calls Open or CommandLine
on a GApplication that does not implement those, return a DBus
error instead of going through and then emitting a warning.

https://bugzilla.gnome.org/show_bug.cgi?id=710885
2013-10-26 14:55:18 +02:00
Giovanni Campagna
3e48e3be40 gapplication: fix memory leak
g_variant_get_child_value() returns a new GVariant, which we must
free.

https://bugzilla.gnome.org/show_bug.cgi?id=710885
2013-10-26 14:55:18 +02:00
Ryan Lortie
0e1924a66c win32: use real random data for seed on win32
We can get cryptographically secure data from rand_s().

https://bugzilla.gnome.org/show_bug.cgi?id=710738
2013-10-25 18:17:35 -04:00
Nilamdyuti Goswami
2bf492e97d Assamese translation updated 2013-10-25 12:44:48 +05:30
Ryan Lortie
8973a8bea7 GLib 2.39.0 2013-10-24 15:31:45 -04:00
Ryan Lortie
e52ff01552 docs: dist manpage gapplication.xml 2013-10-24 15:31:45 -04:00
Philip Withnall
fcd2f7e639 tests: Add tests for the thumbnail verification code in GIO
This code was added for use by the G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID
file attribute, but may end up being used elsewhere (e.g. in GVfs) as well.
As it’s dealing with untrusted external files, and the non-trivial PNG file
format, this commit adds several test cases to cover valid and invalid PNG
files.

The security model for the thumbnail verification code is that the user’s
cache directory is untrusted, and potentially any PNG file which is passed
to the verifier has been manipulated arbitrarily by an attacker.

This is a follow-up to commit fe7069749f.

https://bugzilla.gnome.org/show_bug.cgi?id=709898
2013-10-24 13:55:33 -04:00
Colin Walters
ed6ca39d3b Revert "Use g_return_val_if_fail() for developer-only messages"
This reverts commit 00f0795a84.

https://bugzilla.gnome.org/show_bug.cgi?id=569017
2013-10-24 09:53:55 -04:00
Jiro Matsuzawa
d5e2a57741 gsettings-tool: Add --version into general usage
https://bugzilla.gnome.org/show_bug.cgi?id=707002
2013-10-24 09:53:55 -04:00
Ryan Lortie
6568843624 GSettings: verify path validity on constructors
Don't allow constructing GSettings objects with invalid paths.

https://bugzilla.gnome.org/show_bug.cgi?id=704802
2013-10-24 09:53:55 -04:00
Olivier Brunel
0a7d1084a5 gthemedicon: Fallback to non-symbolic icons
When doing fallback for symbolic icons, we first shorten the name at dashes
while preserving the -symbolic suffix. But after exhausting that, we should also
try stripping the suffix.

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

Signed-off-by: Olivier Brunel <jjk@jjacky.com>

https://bugzilla.gnome.org/show_bug.cgi?id=710254
2013-10-24 08:09:48 -04:00
Colin Walters
1e1e2d1ff7 grand: Document this is not for cryptographic purposes
While this is obvious to seasoned experts upon inspection, it is
really worth documenting explicitly.

https://bugzilla.gnome.org/show_bug.cgi?id=710736
2013-10-23 16:41:09 -04:00
Philip Withnall
856d901569 gdbus: Ensure message matching always succeeds against path_namespace='/'
This copies the fix from upstream D-Bus bug
https://bugs.freedesktop.org/show_bug.cgi?id=70799 to the GDBusDaemon
implementation, ensuring that matching against path_namespace='/' succeeds
for all keys (i.e. it’s a no-op).

https://bugzilla.gnome.org/show_bug.cgi?id=710726
2013-10-23 20:55:00 +01:00
Ryan Lortie
a4bcd3e65a gtester: only remove source if not already dead
Don't attempt to g_source_remove() a source for which we already returned FALSE
from the handler.

https://bugzilla.gnome.org/show_bug.cgi?id=710724
2013-10-23 15:28:06 -04:00
Ryan Lortie
f7beb90193 tests: expect critical on failure to remove source
We've added a g_critical() on failure to remove sources, so make sure we
expect to see that (instead of failing the test due to the unexpected
message).

https://bugzilla.gnome.org/show_bug.cgi?id=710724
2013-10-23 12:00:44 -04:00
Ryan Lortie
b9de6f0489 gmain: test g_source_remove() with invalid ID
Make sure we get the proper critical displayed.

https://bugzilla.gnome.org/show_bug.cgi?id=710724
2013-10-23 12:00:44 -04:00
Bastien Nocera
a919be3d39 gmain: Warn when g_source_remove() fails
Trying to remove a non-existent source should really be
a programming error, as the programmer could be trying to
use the wrong function to remove a callback, as seen when
GtkScrolledWindow tried to remove ID from another function
using g_source_remove().

See https://bugzilla.gnome.org/show_bug.cgi?id=710666#c12

https://bugzilla.gnome.org/show_bug.cgi?id=710724
2013-10-23 12:00:43 -04:00
Ryan Lortie
fe7069749f file-info: Add a G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID attribute
This indicates whether the thumbnail (given by G_FILE_ATTRIBUTE_THUMBNAIL_PATH)
is valid — i.e. to represent the file in its current state. If
G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID is FALSE (for a normal _or_ failed
thumbnail) it means the file has changed since the thumbnail was generated, and
the thumbnail is out of date.

Part of checking thumbnail validity (by the spec) involves parsing
headers out of the thumbnail .png so we include some (small) code to do
that in a separate file.  We will likely want to copy this code to gvfs
to do the same for GVfsFile.

Heavily based on a patch from Philip Withnall <philip.withnall@collabora.co.uk>
who suggested the feature and designed the API.

https://bugzilla.gnome.org/show_bug.cgi?id=709898
2013-10-23 11:56:28 -04:00
Ryan Lortie
38dc8d4cd3 GMemoryOutputStream: docs and whitespace fixes
Document the difference between resizable and fixed-sized streams,
particularly with regards to sizing and seeking.

https://bugzilla.gnome.org/show_bug.cgi?id=684842
2013-10-23 11:32:13 -04:00
Ryan Lortie
1d1c17d9ee GMemoryOutputStream: improve seek tests
Improve test coverage for testing seeking on fixed vs. resizable
GMemoryOutputStream.

https://bugzilla.gnome.org/show_bug.cgi?id=684842
2013-10-23 11:32:13 -04:00
Ryan Lortie
fdc5cd8d9f Change semantics of seek on memory output stream
It is our intention that memory output streams should operate in two
distinct modes, depending on if a realloc function was provided or not.

In the case that we have a realloc function (resizable mode), we want
the stream to behave as if it were a file that started out empty.  In
the case that we don't have a realloc function (fixed-sized mode), we
want the stream to behave as a block device would.

To this end, we introduce two changes in functionality:

 - seeking to SEEK_END on a resizable stream will now seek to the end of
   the valid data region, not to the end of the allocated memory (which
   is really just an implementation detail)

 - seeks past the end of the allocated memory size are now permitted,
   but only on resizable streams.  The next write will grow the buffer
   (inserting zeros between).

Some tweaks to testcases were required in order not to break the build,
which indicates that this is an API break, but it seems unlikely that
anyone will be effected by these changes 'in the real world'.

Updates to documentation and further testcases are in following commits.

Based on a patch from Maciej Piechotka <uzytkownik2@gmail.com>.

https://bugzilla.gnome.org/show_bug.cgi?id=684842
2013-10-23 11:31:27 -04:00
Ryan Lortie
38ef509cf3 GSeekable: document seek-past-end semantics
Introduce the concept of "fixed" vs. "resizable" streams and document
how g_seekable_seek() works for each case.

We don't include g_seekable_is_fixed_size() at this point because we
don't know if anyone would require it.  This may appear in the future if
someone asks for it, however.

https://bugzilla.gnome.org/show_bug.cgi?id=684842
2013-10-23 11:19:27 -04:00
Philip Withnall
3b28df1e00 gdbus: Work around a D-Bus bug with path_namespace='/' match rules
D-Bus versions < 1.6.18 (i.e. all current versions) have a bug with the
path_namespace='/' match rule key. It should conceptually match everything,
but actually matches nothing. This results in no property change (or other)
signals being forwarded to the D-Bus client.

The work-around implemented in GDBusObjectManagerClient is to remove the
path_namespace match key if its value is ‘/’.

For the upstream D-Bus bug, see:
https://bugs.freedesktop.org/show_bug.cgi?id=70799

https://bugzilla.gnome.org/show_bug.cgi?id=710726
2013-10-23 15:36:23 +01:00
Bastien Nocera
5a3fd63246 g_file_error_from_errno: Remove unneeded breaks
Just wasting space

https://bugzilla.gnome.org/show_bug.cgi?id=710625
2013-10-23 00:22:21 -04:00
Ryan Lortie
1b592524ff GKeyfile: don't leak on failed get_(u)int64
In the case that g_key_file_get_(u)int64 fails to parse the integer,
make sure we free the string before returning.

Reported by Andrew Stone <astonecc@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=710313
2013-10-22 16:24:41 -04:00
Dan Winship
efecfe0fac gobject: simplify object-in-construction handling
Rather than keeping a global list of objects that are being
constructed, use qdata on the object itself like we do with several
other properties now.

https://bugzilla.gnome.org/show_bug.cgi?id=661576
2013-10-22 11:01:15 -04:00
Dan Winship
0d62eb467f gobject: forbid finalization-during-construction
If a constructor() implementation created an object but then unreffed
it rather than returning it, that object would get left on the
construction_objects list, which would cause problems later when that
memory location got reused by another object.

"Fix" this by making it fail intentionally, and add a test for it (and
for the normal, working singleton case).

https://bugzilla.gnome.org/show_bug.cgi?id=661576
2013-10-22 11:01:15 -04:00
Matthias Clasen
a7bd6c47db Clarify the g_application_withdraw_notification docs
Mention that notifications are dismissed when activated.
2013-10-21 18:46:48 -04:00
Ryan Lortie
1f0e69f734 Don't build gapplication(1) on win32
It's pretty closely tied to desktop files...
2013-10-21 15:24:55 -04:00
Ryan Lortie
358588ed2a GSubprocess win32 fixups
Note: we go out of our way not to pass a child setup function on win32
(even if it does nothing) because we get a g_warning() from gspawn if we
do so.
2013-10-21 15:24:55 -04:00
Colin Walters
b21c86b6a0 GNotification: Don't install private headers, avoid duplicated prototype
These both break gobject-introspection's build, and moreover are
things we don't want to do anyways.
2013-10-21 15:05:45 -04:00
Ryan Lortie
8dfb070329 Don't g_test_assert_expected_messages for g_error
Don't allow the user to assert for expected g_error().  They need to use
subprocess for this.

https://bugzilla.gnome.org/show_bug.cgi?id=709615
2013-10-21 14:33:06 -04:00
Ryan Lortie
6957004007 GNotification: finish documentation
Add the missing documentation and add the section to the GIO reference
docs.  Fix up a few small documentation issues.

https://bugzilla.gnome.org/show_bug.cgi?id=688492
2013-10-21 14:30:30 -04:00