[dconf-editor] Add a mark in the keys list when a key has planned changes.



commit 2881d5fb3f92a7bfd63c82e5b6e88c5785a6cf7a
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Tue Jul 19 15:02:12 2016 +0200

    Add a mark in the keys list when a key has planned changes.

 editor/dconf-editor.css   |   18 ++++++++++++++++++
 editor/dconf-model.vala   |    2 +-
 editor/registry-view.vala |   11 +++++++++++
 3 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/editor/dconf-editor.css b/editor/dconf-editor.css
index b07e50d..6727af6 100644
--- a/editor/dconf-editor.css
+++ b/editor/dconf-editor.css
@@ -85,6 +85,24 @@ window > popover.menu {
                          .dconf-list:dir(ltr) > row  grid > label { padding-right: 0.5em; }
                          .dconf-list:dir(rtl) > row  grid > label { padding-left:  0.5em; }
 
+/* pending change icon */
+
+                         .dconf-list          > row > .key         { transition:background-position 0.3s; }
+                         .dconf-list          > row > .key.delayed {
+                           background-image:-gtk-icontheme("document-open-recent-symbolic");
+                           background-repeat:no-repeat;
+                         }
+
+                         .dconf-list          > row > .key.delayed { background-size:16px; 
transition:background-size 0.3s; }
+             .small-rows .dconf-list          > row > .key.delayed { background-size:12px; }
+
+                         .dconf-list:dir(ltr) > row > .key.delayed { padding-right: 28px; }
+                         .dconf-list:dir(rtl) > row > .key.delayed { padding-left:  28px; }
+                         .dconf-list:dir(ltr) > row > .key         { background-position:calc(100% - 16px) 
calc(1.3rem - 8px); }
+                         .dconf-list:dir(rtl) > row > .key         { background-position:            16px  
calc(1.3rem - 8px); }
+             .small-rows .dconf-list:dir(ltr) > row > .key         { background-position:calc(100% - 16px) 
calc(0.65rem - 5px); }
+             .small-rows .dconf-list:dir(rtl) > row > .key         { background-position:            16px  
calc(0.65rem - 5px); }
+
 /*\
 * * pathbar
 \*/
diff --git a/editor/dconf-model.vala b/editor/dconf-model.vala
index 77906be..f276310 100644
--- a/editor/dconf-model.vala
+++ b/editor/dconf-model.vala
@@ -180,7 +180,7 @@ public abstract class Key : SettingObject
     public string type_string { get; protected set; default = "*"; }
     public Variant properties { owned get; protected set; }
 
-    public bool planned_change = false;
+    public bool planned_change { get; set; default = false; }
     public Variant? planned_value { get; set; default = null; }
 
     public abstract Variant value { owned get; set; }
diff --git a/editor/registry-view.vala b/editor/registry-view.vala
index 09c9088..94418c5 100644
--- a/editor/registry-view.vala
+++ b/editor/registry-view.vala
@@ -216,6 +216,9 @@ class RegistryView : Grid
             ((KeyListBoxRow) row).set_key_value.connect ((variant) => { set_key_value (key, variant); });
             ((KeyListBoxRow) row).change_dismissed.connect (() => { revealer.dismiss_change (key); });
 
+            key.notify ["planned-change"].connect (() => { set_delayed_icon (row, key.planned_change); });
+            set_delayed_icon (row, key.planned_change);
+
             row.on_row_clicked.connect (() => {
                     if (!properties_view.populate_properties_list_box (revealer, key))  // TODO unduplicate
                         return;
@@ -229,6 +232,14 @@ class RegistryView : Grid
         return row;
     }
 
+    private void set_delayed_icon (ClickableListBoxRow row, bool state)
+    {
+        if (state)
+            row.get_style_context ().add_class ("delayed");
+        else
+            row.get_style_context ().remove_class ("delayed");
+    }
+
     private bool on_button_pressed (Widget widget, Gdk.EventButton event)
     {
         ListBoxRow list_box_row = (ListBoxRow) widget.get_parent ();


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