Commit Graph

97 Commits

Author SHA1 Message Date
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
27898916d4 g_settings_list_children: only list viable schemas
Don't return children with invalid schemas from
g_settings_list_children() (ie: missing schemas or mismatched paths).
This prevents gsettings list-recursively from crashing when broken
schemas are installed on the system.

https://bugzilla.gnome.org/show_bug.cgi?id=705688
2013-10-02 12:37:09 -04:00
Matthias Clasen
a3182e3b9a Improve various section headings in the docs
We don't use # or other forms of links in the section headings.
We also capitalize them and don't put a final period.

This commit corrects several headings to follow these rules.
2013-06-29 22:51:31 -04:00
Dan Winship
4b94c0831e Use 'dumb quotes' rather than `really dumb quotes'
Back in the far-off twentieth century, it was normal on unix
workstations for U+0060 GRAVE ACCENT to be drawn as "‛" and for U+0027
APOSTROPHE to be drawn as "’". This led to the convention of using
them as poor-man's ‛smart quotes’ in ASCII-only text.

However, "'" is now universally drawn as a vertical line, and "`" at a
45-degree angle, making them an `odd couple' when used together.

Unfortunately, there are lots of very old strings in glib, and also
lots of new strings in which people have kept up the old tradition,
perhaps entirely unaware that it used to not look stupid.

Fix this by just using 'dumb quotes' everywhere.

https://bugzilla.gnome.org/show_bug.cgi?id=700746
2013-05-21 11:23:22 -03:00
Matthias Clasen
e2470ec6db docs: Don't put links in section titles 2012-08-03 23:36:45 -04:00
Ryan Lortie
ed492a5de2 GSettings: be more careful about keys names with /
Prevent attempts to access keys ending with slashes that exist in the
schema file as references to child schemas.

Also: don't emit change signals for these same keys.
2012-07-06 13:44:17 -04:00
Ryan Lortie
c95e908529 GSettingsSchema: ignore empty schema caches
glib-compile-schemas used to generate these.  They're harmless and they
mean that no schemas are installed in a particular directory, so just
ignore them.

https://bugzilla.gnome.org/show_bug.cgi?id=656301
2012-01-18 22:16:23 -05: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
Rico Tzschichholz
8d9f600aea Remove redefinition of typedef 'GSettingsSchemaSource' 2011-11-17 19:46:54 +01: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
a7ce1953fa Trivial typo fix 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
269c999463 add boxed types for GSettingSchema{,Source} 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
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
10907cafc3 add internal g_settings_schema_get_name() 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
Ryan Lortie
09429e2c82 gio static fixups 2011-10-16 21:41:15 -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
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
Ryan Lortie
c841c2ce3f GSettings: don't abort on missing schemas
Give a g_critical instead.
2011-07-20 14:06:36 +02:00
Matthias Clasen
b2919e558b Add schema name in error message
Why not be helpful if it doesn't cost anything...
2011-02-14 19:20:44 -05:00
Matthias Clasen
4a8d9b68e3 Fail in a clean way if schema name is missing
https://bugzilla.gnome.org/show_bug.cgi?id=640192
2011-01-27 20:29:22 -05:00
Xan Lopez
78103b2f1f gsettingsschema: plug leak 2010-11-29 15:29:56 +01:00
Ryan Lortie
9211d2b00c GSettings endian: missed a spot
Missed an instance of get_value -> get_raw_value search/replace.
2010-10-03 23:15:27 -04:00
Ryan Lortie
c84441fbb3 GSettings big endian tweaks
GSettings relies on parts of the schema infromation remaining
unbyteswapped (the strinfo database, for example) while requiring other
parts to be in native order (the default value, constraints, etc.).

Lift the byteswapping into a place where we can do it selectively.
2010-10-03 23:04:00 -04:00
Ryan Lortie
5af11ae4bc Add 'Since:' tags for schema listing APIs 2010-10-02 22:46:53 -04:00
Ryan Lortie
d2c0699440 Clean up g_settings_list_schemas()
In its previous form, g_settings_list_schemas() was not useful as a tool
to prevent aborts due to using g_settings_new() with an invalid schema
name.  This is because g_settings_list_scheams() also listed relocatable
schemas, and calling g_settings_new() for those would abort just the
same as if you called it for a non-existent schema.

Modify g_settings_list_schemas() so that it only returns schemas for
which it is safe to call g_settings_new().  Add another call for sake of
completeness: g_settings_list_relocatable_schemas().
2010-10-02 22:42:02 -04:00
Johan Dahlin
30132c44c1 Add a lot of missing annotations 2010-09-24 18:24:41 -03:00
Ryan Lortie
5344c22810 gio/ docs fixup 2010-07-12 18:30:14 -04:00
Ryan Lortie
de0464cf89 Tweak GSettings key/schema listing APIs 2010-06-24 12:25:48 -04:00
Ryan Lortie
6218d8047a Add g_settings_schema_exists
Solves half of #622554.
2010-06-24 02:17:28 -04:00
Ryan Lortie
597290d5c8 GSettings: major refactor. Add enums, range. 2010-06-16 18:17:53 -04:00
Ryan Lortie
3a062d2e33 GSettings: store (default, options) in gvdb
gvdb just dropped the ability to have a separate "options" field.  We
now store the options into a GVariant along with the default value.

For now, we use a small shim in GSettingsSchema in order not to touch
too much code.  A more complete rewrite will follow.

This represents a change to the schema file format with another likely
to follow.  glib-compile-schemas needs to be re-run after installing
this change.
2010-06-10 13:49:57 -04:00
Ryan Lortie
43a72ce1be GSettingsSchema: add call to get list of keys 2010-04-16 23:21:08 -04:00
Ryan Lortie
2bc8157735 merge GSettingsSchema 2010-04-15 22:30:11 -04:00