~ubuntu-branches/ubuntu/vivid/glib2.0/vivid-proposed

« back to all changes in this revision

Viewing changes to docs/reference/gio/html/GSettingsBackend.html

  • Committer: Package Import Robot
  • Author(s): Andreas Henriksson
  • Date: 2014-03-24 20:58:34 UTC
  • mfrom: (1.66.13)
  • Revision ID: package-import@ubuntu.com-20140324205834-8hsgok8k36ftocqa
Tags: 2.40.0-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
156
156
</div>
157
157
<div class="refsect1">
158
158
<a name="GSettingsBackend.object-hierarchy"></a><h2>Object Hierarchy</h2>
159
 
<pre class="screen">    <a href="../gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a>
 
159
<pre class="screen">    <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
160
160
    <span class="lineart">╰──</span> GSettingsBackend
161
161
</pre>
162
162
</div>
178
178
<p>The semantics of the interface are very precisely defined and
179
179
implementations must carefully adhere to the expectations of
180
180
callers that are documented on each of the interface methods.</p>
181
 
<p>Some of the GSettingsBackend functions accept or return a <a href="../glib/glib-Balanced-Binary-Trees.html#GTree"><span class="type">GTree</span></a>.
182
 
These trees always have strings as keys and <a href="../glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> as values.
 
181
<p>Some of the GSettingsBackend functions accept or return a <a href="http://library.gnome.org/devel/glib/unstable/glib-Balanced-Binary-Trees.html#GTree"><span class="type">GTree</span></a>.
 
182
These trees always have strings as keys and <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> as values.
183
183
<code class="function">g_settings_backend_create_tree()</code> is a convenience function to create
184
184
suitable trees.</p>
185
185
<p>The GSettingsBackend API is exported to allow third-party
210
210
<a name="g-settings-backend-changed"></a><h3>g_settings_backend_changed ()</h3>
211
211
<pre class="programlisting"><span class="returnvalue">void</span>
212
212
g_settings_backend_changed (<em class="parameter"><code><a class="link" href="GSettingsBackend.html" title="GSettingsBackend"><span class="type">GSettingsBackend</span></a> *backend</code></em>,
213
 
                            <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *key</code></em>,
214
 
                            <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> origin_tag</code></em>);</pre>
 
213
                            <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *key</code></em>,
 
214
                            <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> origin_tag</code></em>);</pre>
215
215
<p>Signals that a single key has possibly changed.  Backend
216
216
implementations should call this if a key has possibly changed its
217
217
value.</p>
266
266
<a name="g-settings-backend-path-changed"></a><h3>g_settings_backend_path_changed ()</h3>
267
267
<pre class="programlisting"><span class="returnvalue">void</span>
268
268
g_settings_backend_path_changed (<em class="parameter"><code><a class="link" href="GSettingsBackend.html" title="GSettingsBackend"><span class="type">GSettingsBackend</span></a> *backend</code></em>,
269
 
                                 <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *path</code></em>,
270
 
                                 <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> origin_tag</code></em>);</pre>
 
269
                                 <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *path</code></em>,
 
270
                                 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> origin_tag</code></em>);</pre>
271
271
<p>Signals that all keys below a given path may have possibly changed.
272
272
Backend implementations should call this if an entire path of keys
273
273
have possibly changed their values.</p>
322
322
<a name="g-settings-backend-keys-changed"></a><h3>g_settings_backend_keys_changed ()</h3>
323
323
<pre class="programlisting"><span class="returnvalue">void</span>
324
324
g_settings_backend_keys_changed (<em class="parameter"><code><a class="link" href="GSettingsBackend.html" title="GSettingsBackend"><span class="type">GSettingsBackend</span></a> *backend</code></em>,
325
 
                                 <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *path</code></em>,
326
 
                                 <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> const * const *items</code></em>,
327
 
                                 <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> origin_tag</code></em>);</pre>
 
325
                                 <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *path</code></em>,
 
326
                                 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> const * const *items</code></em>,
 
327
                                 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> origin_tag</code></em>);</pre>
328
328
<p>Signals that a list of keys have possibly changed.  Backend
329
329
implementations should call this if keys have possibly changed their
330
330
values.</p>
369
369
</tr>
370
370
<tr>
371
371
<td class="parameter_name"><p>items</p></td>
372
 
<td class="parameter_description"><p> the <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated list of changed keys. </p></td>
 
372
<td class="parameter_description"><p> the <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated list of changed keys. </p></td>
373
373
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1]</span></td>
374
374
</tr>
375
375
<tr>
388
388
<pre class="programlisting"><span class="returnvalue">void</span>
389
389
g_settings_backend_path_writable_changed
390
390
                               (<em class="parameter"><code><a class="link" href="GSettingsBackend.html" title="GSettingsBackend"><span class="type">GSettingsBackend</span></a> *backend</code></em>,
391
 
                                <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *path</code></em>);</pre>
 
391
                                <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *path</code></em>);</pre>
392
392
<p>Signals that the writability of all keys below a given path may have
393
393
changed.</p>
394
394
<p>Since GSettings performs no locking operations for itself, this call
422
422
<a name="g-settings-backend-writable-changed"></a><h3>g_settings_backend_writable_changed ()</h3>
423
423
<pre class="programlisting"><span class="returnvalue">void</span>
424
424
g_settings_backend_writable_changed (<em class="parameter"><code><a class="link" href="GSettingsBackend.html" title="GSettingsBackend"><span class="type">GSettingsBackend</span></a> *backend</code></em>,
425
 
                                     <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *key</code></em>);</pre>
 
425
                                     <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *key</code></em>);</pre>
426
426
<p>Signals that the writability of a single key has possibly changed.</p>
427
427
<p>Since GSettings performs no locking operations for itself, this call
428
428
will always be made in response to external events.</p>
455
455
<a name="g-settings-backend-changed-tree"></a><h3>g_settings_backend_changed_tree ()</h3>
456
456
<pre class="programlisting"><span class="returnvalue">void</span>
457
457
g_settings_backend_changed_tree (<em class="parameter"><code><a class="link" href="GSettingsBackend.html" title="GSettingsBackend"><span class="type">GSettingsBackend</span></a> *backend</code></em>,
458
 
                                 <em class="parameter"><code><a href="../glib/glib-Balanced-Binary-Trees.html#GTree"><span class="type">GTree</span></a> *tree</code></em>,
459
 
                                 <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> origin_tag</code></em>);</pre>
 
458
                                 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Balanced-Binary-Trees.html#GTree"><span class="type">GTree</span></a> *tree</code></em>,
 
459
                                 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> origin_tag</code></em>);</pre>
460
460
<p>This call is a convenience wrapper.  It gets the list of changes from
461
461
<em class="parameter"><code>tree</code></em>
462
462
, computes the longest common prefix and calls
477
477
</tr>
478
478
<tr>
479
479
<td class="parameter_name"><p>tree</p></td>
480
 
<td class="parameter_description"><p>a <a href="../glib/glib-Balanced-Binary-Trees.html#GTree"><span class="type">GTree</span></a> containing the changes</p></td>
 
480
<td class="parameter_description"><p>a <a href="http://library.gnome.org/devel/glib/unstable/glib-Balanced-Binary-Trees.html#GTree"><span class="type">GTree</span></a> containing the changes</p></td>
481
481
<td class="parameter_annotations"> </td>
482
482
</tr>
483
483
<tr>
494
494
<div class="refsect2">
495
495
<a name="g-settings-backend-flatten-tree"></a><h3>g_settings_backend_flatten_tree ()</h3>
496
496
<pre class="programlisting"><span class="returnvalue">void</span>
497
 
g_settings_backend_flatten_tree (<em class="parameter"><code><a href="../glib/glib-Balanced-Binary-Trees.html#GTree"><span class="type">GTree</span></a> *tree</code></em>,
498
 
                                 <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> **path</code></em>,
499
 
                                 <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> ***keys</code></em>,
500
 
                                 <em class="parameter"><code><a href="../glib/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> ***values</code></em>);</pre>
 
497
g_settings_backend_flatten_tree (<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Balanced-Binary-Trees.html#GTree"><span class="type">GTree</span></a> *tree</code></em>,
 
498
                                 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> **path</code></em>,
 
499
                                 <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> ***keys</code></em>,
 
500
                                 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> ***values</code></em>);</pre>
501
501
<p>Calculate the longest common prefix of all keys in a tree and write
502
502
out an array of the key names relative to that prefix and,
503
503
optionally, the value to store at each of those keys.</p>
505
505
, <em class="parameter"><code>keys</code></em>
506
506
 and <em class="parameter"><code>values</code></em>
507
507
 using
508
 
<a href="../glib/glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a>.  You should not attempt to free or unref the contents of
 
508
<a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a>.  You should not attempt to free or unref the contents of
509
509
<em class="parameter"><code>keys</code></em>
510
510
 or <em class="parameter"><code>values</code></em>
511
511
.</p>
520
520
<tbody>
521
521
<tr>
522
522
<td class="parameter_name"><p>tree</p></td>
523
 
<td class="parameter_description"><p>a <a href="../glib/glib-Balanced-Binary-Trees.html#GTree"><span class="type">GTree</span></a> containing the changes</p></td>
 
523
<td class="parameter_description"><p>a <a href="http://library.gnome.org/devel/glib/unstable/glib-Balanced-Binary-Trees.html#GTree"><span class="type">GTree</span></a> containing the changes</p></td>
524
524
<td class="parameter_annotations"> </td>
525
525
</tr>
526
526
<tr>
536
536
</tr>
537
537
<tr>
538
538
<td class="parameter_name"><p>values</p></td>
539
 
<td class="parameter_description"><p>         the location to save the values, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
 
539
<td class="parameter_description"><p>         the location to save the values, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
540
540
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Free data container after the code is done."><span class="acronym">transfer container</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1]</span></td>
541
541
</tr>
542
542
</tbody>
548
548
<div class="refsect2">
549
549
<a name="g-keyfile-settings-backend-new"></a><h3>g_keyfile_settings_backend_new ()</h3>
550
550
<pre class="programlisting"><a class="link" href="GSettingsBackend.html" title="GSettingsBackend"><span class="returnvalue">GSettingsBackend</span></a> *
551
 
g_keyfile_settings_backend_new (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *filename</code></em>,
552
 
                                <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *root_path</code></em>,
553
 
                                <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *root_group</code></em>);</pre>
 
551
g_keyfile_settings_backend_new (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *filename</code></em>,
 
552
                                <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *root_path</code></em>,
 
553
                                <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *root_group</code></em>);</pre>
554
554
<p>Creates a keyfile-backed <a class="link" href="GSettingsBackend.html" title="GSettingsBackend"><span class="type">GSettingsBackend</span></a>.</p>
555
555
<p>The filename of the keyfile to use is given by <em class="parameter"><code>filename</code></em>
556
556
.</p>
560
560
not contain two consecutive slashes).  <em class="parameter"><code>root_path</code></em>
561
561
 may be "/".</p>
562
562
<p>If <em class="parameter"><code>root_group</code></em>
563
 
 is non-<a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> then it specifies the name of the keyfile
 
563
 is non-<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> then it specifies the name of the keyfile
564
564
group used for keys that are written directly below <em class="parameter"><code>root_path</code></em>
565
565
.  For
566
566
example, if <em class="parameter"><code>root_path</code></em>
567
567
 is "/apps/example/" and <em class="parameter"><code>root_group</code></em>
568
568
 is
569
569
"toplevel", then settings the key "/apps/example/enabled" to a value
570
 
of <a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> will cause the following to appear in the keyfile:</p>
 
570
of <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> will cause the following to appear in the keyfile:</p>
571
571
<div class="informalexample">
572
572
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
573
573
    <tbody>
583
583
 
584
584
<p></p>
585
585
<p>If <em class="parameter"><code>root_group</code></em>
586
 
 is <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> then it is not permitted to store keys
 
586
 is <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> then it is not permitted to store keys
587
587
directly below the <em class="parameter"><code>root_path</code></em>
588
588
.</p>
589
589
<p>For keys not stored directly below <em class="parameter"><code>root_path</code></em>
607
607
 
608
608
<p></p>
609
609
<p>The backend will refuse writes (and return writability as being
610
 
<a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>) for keys outside of <em class="parameter"><code>root_path</code></em>
 
610
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>) for keys outside of <em class="parameter"><code>root_path</code></em>
611
611
 and, in the event that
612
612
<em class="parameter"><code>root_group</code></em>
613
 
 is <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, also for keys directly under <em class="parameter"><code>root_path</code></em>
 
613
 is <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, also for keys directly under <em class="parameter"><code>root_path</code></em>
614
614
.
615
615
Writes will also be refused if the backend detects that it has the
616
616
inability to rewrite the keyfile (ie: the containing directory is not
642
642
<td class="parameter_name"><p>root_group</p></td>
643
643
<td class="parameter_description"><p> the group name corresponding to
644
644
<em class="parameter"><code>root_path</code></em>
645
 
, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
 
645
, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
646
646
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
647
647
</tr>
648
648
</tbody>