[dconf-editor] Use properties GVariant for Key path and name.



commit 67c3d6e6410a76fc49bc8b4da45a88f5d7c2fffe
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri May 13 12:46:25 2016 +0200

    Use properties GVariant for Key path and name.

 editor/dconf-model.vala |   24 ++++++++++++++++++++----
 editor/dconf-view.vala  |   18 ++++++++++--------
 2 files changed, 30 insertions(+), 12 deletions(-)
---
diff --git a/editor/dconf-model.vala b/editor/dconf-model.vala
index 0fa2fa7..24530f1 100644
--- a/editor/dconf-model.vala
+++ b/editor/dconf-model.vala
@@ -357,15 +357,23 @@ public class DConfKey : Key
         {
             string min, max;
             get_min_and_max_string (out min, out max, type_string);
-            properties = new Variant.parsed ("(false, [{'type-name', %s},
+            properties = new Variant.parsed ("(false, [{'key-name', %s},
+                                                       {'parent-path', %s},
+                                                       {'type-name', %s},
                                                        {'minimum', %s},
                                                        {'maximum', %s}])",
+                                             name,
+                                             ((!) parent).full_name,
                                              key_to_description (type_string),
                                              min,
                                              max);
         }
         else
-            properties = new Variant.parsed ("(false, [{'type-name', %s}])",
+            properties = new Variant.parsed ("(false, [{'key-name', %s},
+                                                       {'parent-path', %s},
+                                                       {'type-name', %s}])",
+                                             name,
+                                             ((!) parent).full_name,
                                              key_to_description (type_string));
     }
 }
@@ -426,13 +434,17 @@ public class GSettingsKey : Key
             else
                 get_min_and_max_string (out min, out max, type_string);
 
-            properties = new Variant.parsed ("(true, [{'type-name', %s},
+            properties = new Variant.parsed ("(true, [{'key-name', %s},
+                                                      {'parent-path', %s},
+                                                      {'type-name', %s},
                                                       {'schema-id', %s},
                                                       {'summary', %s},
                                                       {'description', %s},
                                                       {'default-value', %s},
                                                       {'minimum', %s},
                                                       {'maximum', %s}])",
+                                             name,
+                                             ((!) parent).full_name,
                                              key_to_description (type_string),
                                              schema_id,
                                              summary,
@@ -442,11 +454,15 @@ public class GSettingsKey : Key
                                              max);
         }
         else
-            properties = new Variant.parsed ("(true, [{'type-name', %s},
+            properties = new Variant.parsed ("(true, [{'key-name', %s},
+                                                      {'parent-path', %s},
+                                                      {'type-name', %s},
                                                       {'schema-id', %s},
                                                       {'summary', %s},
                                                       {'description', %s},
                                                       {'default-value', %s}])",
+                                             name,
+                                             ((!) parent).full_name,
                                              key_to_description (type_string),
                                              schema_id,
                                              summary,
diff --git a/editor/dconf-view.vala b/editor/dconf-view.vala
index 1ae8b85..e0229ff 100644
--- a/editor/dconf-view.vala
+++ b/editor/dconf-view.vala
@@ -125,6 +125,16 @@ private abstract class KeyEditorDialog : Dialog
 
         // TODO use VariantDict
         string tmp_string;
+
+        if (dict.lookup ("key-name",      "s", out tmp_string)) this.title = tmp_string;
+        else (assert_not_reached ());
+        if (dict.lookup ("parent-path",   "s", out tmp_string))
+        {
+            if (this.use_header_bar == 1)        // TODO else..?
+                ((HeaderBar) this.get_header_bar ()).subtitle = tmp_string;   // TODO get_header_bar() is 
[transfer none]
+        }
+        else (assert_not_reached ());
+
         if (dict.lookup ("schema-id",     "s", out tmp_string))      schema_row.set_text (tmp_string);
         else schema_row.destroy ();
         if (dict.lookup ("summary",       "s", out tmp_string))     summary_row.set_text (tmp_string);
@@ -223,10 +233,6 @@ private class KeyEditorNoSchema : KeyEditorDialog       // TODO add type informa
     {
         key = _key;
 
-        this.title = key.name;
-        if (this.use_header_bar == 1)        // TODO else..?
-            ((HeaderBar) this.get_header_bar ()).subtitle = ((!) key.parent).full_name;   // TODO 
get_header_bar() is [transfer none]
-
         value_row.set_widget (create_child ((Key) _key), add_warning ((Key) _key));
 
         bool has_schema;
@@ -255,10 +261,6 @@ private class KeyEditor : KeyEditorDialog
     {
         key = _key;
 
-        this.title = key.name;
-        if (this.use_header_bar == 1)        // TODO else..?
-            ((HeaderBar) this.get_header_bar ()).subtitle = ((!) key.parent).full_name;   // TODO 
get_header_bar() is [transfer none]
-
         // infos
 
         bool has_schema;


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