[dconf-editor] Add example of flags.



commit c19cba2f8c226f6a80e4b373517020f0b8bbe956
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sat Oct 17 02:11:23 2015 +0200

    Add example of flags.

 editor/ca.desrt.dconf-editor.gschema.xml |   12 ++++++++++++
 editor/dconf-view.vala                   |    2 ++
 2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/editor/ca.desrt.dconf-editor.gschema.xml b/editor/ca.desrt.dconf-editor.gschema.xml
index f4a53eb..b933743 100644
--- a/editor/ca.desrt.dconf-editor.gschema.xml
+++ b/editor/ca.desrt.dconf-editor.gschema.xml
@@ -50,6 +50,13 @@
     <value value="3" nick="Yellow"/>
     <value value="1" nick="Green"/>
   </enum>
+  <flags id="ca.desrt.dconf-editor.DemoFlags">
+    <value value="16" nick="Red"/>      <!-- TODO report bug: 0 validates... -->
+    <value value="4" nick="White"/>
+    <value value="2" nick="Blue"/>
+    <value value="8" nick="Yellow"/>
+    <value value="1" nick="Green"/>
+  </flags>
   <schema id="ca.desrt.dconf-editor.Demo" path="/ca/desrt/dconf-editor/demo/">
     <key name="boolean" type="b">
       <default>true</default>
@@ -119,6 +126,11 @@ If you are not interacting with D-Bus, then there is no reason to make use of th
       <summary>A short integer, type "n"</summary>
       <description>A 16bit signed integer. See also the "integer-16-unsigned" key.</description>
     </key>
+    <key name="flags" flags="ca.desrt.dconf-editor.DemoFlags">
+      <default>["Blue", "White", "Red"]</default>
+      <summary>Flags: choose-colors-you-love</summary>
+      <description>Flags could be set by the "enum" attribute.</description>
+    </key>
     <key name="integer-16-unsigned" type="q">
       <default>65535</default>
       <summary>An unsigned short integer, type "q"</summary>
diff --git a/editor/dconf-view.vala b/editor/dconf-view.vala
index e7466e2..866ee00 100644
--- a/editor/dconf-view.vala
+++ b/editor/dconf-view.vala
@@ -117,6 +117,8 @@ private abstract class KeyEditorDialog : Dialog
                 return _("String array");
             case "<enum>":
                 return _("Enumeration");
+            case "<flags>":
+                return _("Flags");
             case "d":
                 string min, max;
                 get_min_and_max (out min, out max);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]