[dconf-editor] Add popover with scheduled changes.



commit 49839b4a7d8cf8f1a2e2cfd3dc2443486f46857f
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Wed Jan 31 04:56:42 2018 +0100

    Add popover with scheduled changes.
    
    Mainly an adaptation of Davi’s patch to current code.
    https://bugzilla.gnome.org/show_bug.cgi?id=790524#c15

 editor/browser-view.vala           |    8 --
 editor/dconf-editor.css            |   15 ++++
 editor/dconf-editor.gresource.xml  |    1 +
 editor/dconf-window.vala           |   31 +++++++-
 editor/delayed-setting-view.ui     |  137 ++++++++++++++++++++++++++++++++++++
 editor/delayed-setting-view.vala   |   92 ++++++++++++++++++++++++
 editor/help-overlay.ui             |   69 +++++++++++++------
 editor/key-list-box-row.vala       |    4 +-
 editor/meson.build                 |    2 +
 editor/modifications-handler.vala  |   10 +++
 editor/modifications-revealer.ui   |   48 +++++++++++++
 editor/modifications-revealer.vala |  129 +++++++++++++++++++++++++++++++++-
 po/POTFILES.in                     |    2 +
 po/POTFILES.skip                   |    1 +
 14 files changed, 514 insertions(+), 35 deletions(-)
---
diff --git a/editor/browser-view.vala b/editor/browser-view.vala
index 7eeb01a..be8ab0a 100644
--- a/editor/browser-view.vala
+++ b/editor/browser-view.vala
@@ -88,18 +88,10 @@ class BrowserView : Grid
 
     private const GLib.ActionEntry [] action_entries =
     {
-        { "dismiss-change", dismiss_change, "s" },
         { "refresh-folder", refresh_folder },
         { "set-to-default", set_to_default, "(ss)" }
     };
 
-    private void dismiss_change (SimpleAction action, Variant? path_variant)
-        requires (path_variant != null)
-    {
-        modifications_handler.dismiss_change (((!) path_variant).get_string ());
-        invalidate_popovers ();
-    }
-
     private void refresh_folder (/* SimpleAction action, Variant? path_variant */)
         requires (key_model != null)
     {
diff --git a/editor/dconf-editor.css b/editor/dconf-editor.css
index ddfee13..8114363 100644
--- a/editor/dconf-editor.css
+++ b/editor/dconf-editor.css
@@ -38,6 +38,21 @@
 }
 
 /*\
+* * pending change list popover
+\*/
+
+.delayed-settings-popover { padding:6px; }
+
+.delayed-list .list-row-header { padding:5px; padding-top:10px; }
+
+.delayed-list          > row              { padding:10px; }
+.delayed-list          > row .key-name    { padding-bottom:5px; }
+.delayed-list:dir(ltr) > row .diff-bullet { padding-left:20px; padding-right:6px; }
+.delayed-list:dir(rtl) > row .diff-bullet { padding-right:20px; padding-left:6px; }
+.delayed-list:dir(ltr) > row .value-label { padding-right:6px; }
+.delayed-list:dir(rtl) > row .value-label { padding-left:6px; }
+
+/*\
 * * lists rows height and icon
 \*/
 
diff --git a/editor/dconf-editor.gresource.xml b/editor/dconf-editor.gresource.xml
index ff333ed..231c671 100644
--- a/editor/dconf-editor.gresource.xml
+++ b/editor/dconf-editor.gresource.xml
@@ -7,6 +7,7 @@
     <file preprocess="xml-stripblanks">browser-view.ui</file>
     <file>dconf-editor.css</file>
     <file preprocess="xml-stripblanks">dconf-editor.ui</file>
+    <file preprocess="xml-stripblanks">delayed-setting-view.ui</file>
     <file preprocess="xml-stripblanks">folder-list-box-row.ui</file>
     <file preprocess="xml-stripblanks">key-list-box-row.ui</file>
     <file preprocess="xml-stripblanks">modifications-revealer.ui</file>
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 918ee83..247f4cf 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -377,7 +377,8 @@ class DConfWindow : ApplicationWindow
         { "apply-delayed-settings", apply_delayed_settings },
         { "dismiss-delayed-settings", dismiss_delayed_settings },
 
-        { "erase", erase_dconf_key, "s" },  // here because needs a reload_view as we enter delay_mode
+        { "dismiss-change", dismiss_change, "s" },  // here because needs to be accessed from 
DelayedSettingView rows
+        { "erase", erase_dconf_key, "s" },          // here because needs a reload_view as we enter 
delay_mode
 
         { "copy-path", copy_path }
     };
@@ -398,6 +399,7 @@ class DConfWindow : ApplicationWindow
     {
         if (bookmarks_button.active)
             bookmarks_button.active = false;
+        revealer.hide_modifications_list ();
 
         string full_name;
         string context;
@@ -465,6 +467,14 @@ class DConfWindow : ApplicationWindow
         invalidate_popovers ();
     }
 
+    private void dismiss_change (SimpleAction action, Variant? path_variant)
+        requires (path_variant != null)
+    {
+        modifications_handler.dismiss_change (((!) path_variant).get_string ());
+        browser_view.invalidate_popovers ();
+        reload_view ();
+    }
+
     private void erase_dconf_key (SimpleAction action, Variant? path_variant)
         requires (path_variant != null)
     {
@@ -726,6 +736,14 @@ class DConfWindow : ApplicationWindow
                         search_bar.search_mode_enabled = false;
                     return true;
 
+                case "i":
+                    if (revealer.reveal_child)
+                    {
+                        revealer.toggle_modifications_list ();
+                        return true;
+                    }
+                    return false;
+
                 case "F1":
                     browser_view.discard_row_popover ();
                     if ((event.state & Gdk.ModifierType.SHIFT_MASK) == 0)
@@ -749,6 +767,11 @@ class DConfWindow : ApplicationWindow
                 case "KP_Decimal":
                     if (info_button.active || bookmarks_button.active)
                         return false;
+                    if (revealer.dismiss_selected_modification ())
+                    {
+                        reload_view ();
+                        return true;
+                    }
                     browser_view.discard_row_popover ();
                     string? selected_row = browser_view.get_selected_row_name ();
                     if (selected_row != null && ((!) selected_row).has_suffix ("/"))
@@ -787,11 +810,13 @@ class DConfWindow : ApplicationWindow
 
         if (name == "Up"
          && bookmarks_button.active == false
-         && info_button.active == false)
+         && info_button.active == false
+         && !revealer.get_modifications_list_state ())
             return browser_view.up_pressed ();
         if (name == "Down"
          && bookmarks_button.active == false
-         && info_button.active == false)
+         && info_button.active == false
+         && !revealer.get_modifications_list_state ())
             return browser_view.down_pressed ();
 
         if ((name == "Return" || name == "KP_Enter")
diff --git a/editor/delayed-setting-view.ui b/editor/delayed-setting-view.ui
new file mode 100644
index 0000000..bc07ebf
--- /dev/null
+++ b/editor/delayed-setting-view.ui
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <template class="DelayedSettingView" parent="GtkGrid">
+    <property name="visible">True</property> <!-- TODO useful? -->
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkLabel" id="key_name_label">
+        <property name="visible">True</property>
+        <property name="halign">start</property>
+        <property name="hexpand">true</property>
+        <style>
+          <class name="key-name"/>
+        </style>
+      </object>
+      <packing>
+        <property name="left-attach">0</property>
+        <property name="top-attach">0</property>
+        <property name="width">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkButton" id="cancel_change_button">
+        <property name="visible">True</property>
+        <property name="halign">end</property>
+        <property name="hexpand">false</property>
+        <property name="valign">center</property>
+        <property name="can-focus">False</property>
+        <style>
+          <class name="flat"/>
+          <class name="circular"/>
+        </style>
+        <child>
+          <object class="GtkImage">
+            <property name="visible">True</property>
+            <property name="icon-name">window-close-symbolic</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="left-attach">3</property>
+        <property name="top-attach">0</property>
+        <property name="height">3</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkImage">
+        <property name="visible">True</property>
+        <property name="halign">start</property>
+        <property name="icon-name">list-remove-symbolic</property>
+        <style>
+          <class name="diff-bullet"/>
+        </style>
+      </object>
+      <packing>
+        <property name="left-attach">0</property>
+        <property name="top-attach">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkGrid">
+        <property name="visible">True</property>
+        <property name="hexpand">True</property>
+        <child>
+          <object class="GtkLabel" id="key_value_label">
+            <property name="visible">True</property>
+            <property name="halign">start</property>
+            <property name="ellipsize">end</property>
+            <style>
+              <class name="value-label"/>
+            </style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel" id="key_value_default">
+            <property name="visible">True</property>
+            <property name="halign">start</property>
+            <property name="hexpand">True</property>
+            <property name="label" translatable="yes">Default value</property>
+            <style>
+              <class name="bold-label"/>
+            </style>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="left-attach">1</property>
+        <property name="top-attach">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkImage">
+        <property name="visible">True</property>
+        <property name="halign">start</property>
+        <property name="icon-name">list-add-symbolic</property>
+        <style>
+          <class name="diff-bullet"/>
+        </style>
+      </object>
+      <packing>
+        <property name="left-attach">0</property>
+        <property name="top-attach">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkGrid">
+        <property name="visible">True</property>
+        <property name="hexpand">True</property>
+        <child>
+          <object class="GtkLabel" id="planned_value_label">
+            <property name="visible">True</property>
+            <property name="halign">start</property>
+            <property name="ellipsize">end</property>
+            <style>
+              <class name="value-label"/>
+            </style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel" id="planned_value_default">
+            <property name="visible">True</property>
+            <property name="halign">start</property>
+            <property name="hexpand">True</property>
+            <property name="label" translatable="yes">Default value</property>
+            <style>
+              <class name="bold-label"/>
+            </style>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="left-attach">1</property>
+        <property name="top-attach">2</property>
+      </packing>
+    </child>
+  </template>
+</interface>
diff --git a/editor/delayed-setting-view.vala b/editor/delayed-setting-view.vala
new file mode 100644
index 0000000..9b57d04
--- /dev/null
+++ b/editor/delayed-setting-view.vala
@@ -0,0 +1,92 @@
+/*
+  This file is part of Dconf Editor
+
+  Dconf Editor is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Dconf Editor is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with Dconf Editor.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+using Gtk;
+
+[GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/delayed-setting-view.ui")]
+private class DelayedSettingView : Grid
+{
+    [GtkChild] private Label key_name_label;
+    [GtkChild] private Label key_value_label;
+    [GtkChild] private Label key_value_default;
+    [GtkChild] private Label planned_value_label;
+    [GtkChild] private Label planned_value_default;
+    [GtkChild] private Button cancel_change_button;
+
+    public string full_name { get; construct; }
+
+    public DelayedSettingView (string _full_name, bool is_default_or_ghost, string cool_key_value, string? 
cool_planned_value, string? cool_default_value)
+    {
+        Object (full_name: _full_name);
+        Variant variant = new Variant.string (full_name);
+        key_name_label.label = SettingsModel.get_name (full_name);
+        cancel_change_button.set_detailed_action_name ("ui.dismiss-change(" + variant.print (false) + ")");
+
+        key_value_label.label = cool_key_value;
+        if (cool_default_value == null)
+            update_dconf_key (is_default_or_ghost, cool_planned_value);
+        else
+            update_gsettings_key (is_default_or_ghost, cool_planned_value, (!) cool_default_value);
+    }
+
+    private void update_gsettings_key (bool is_default, string? cool_planned_value, string 
cool_default_value)
+    {
+        if (is_default)
+        {
+            key_value_default.label = _("Default value");
+            key_value_default.visible = true;
+        }
+        else
+            key_value_default.visible = false;
+
+        if (cool_planned_value == null)
+        {
+            planned_value_label.label = cool_default_value;
+            planned_value_default.label = _("Default value");
+            planned_value_default.visible = true;
+        }
+        else
+        {
+            planned_value_label.label = (!) cool_planned_value;
+            planned_value_default.visible = false;
+        }
+    }
+    private void update_dconf_key (bool is_ghost, string? cool_planned_value)
+    {
+        if (is_ghost)
+        {
+            key_value_label.visible = false;
+            key_value_default.label = _("Key erased");
+            key_value_default.visible = true;
+        }
+        else
+            key_value_default.visible = false;
+
+        if (cool_planned_value == null)
+        {
+            planned_value_label.visible = false;
+            planned_value_default.label = _("Key erased.");
+            planned_value_default.visible = true;
+        }
+        else
+        {
+            planned_value_label.label = (!) cool_planned_value;
+            planned_value_label.visible = true;
+            planned_value_default.visible = false;
+        }
+    }
+}
diff --git a/editor/help-overlay.ui b/editor/help-overlay.ui
index c8d4043..23789f7 100644
--- a/editor/help-overlay.ui
+++ b/editor/help-overlay.ui
@@ -4,7 +4,7 @@
     <child>
       <object class="GtkShortcutsSection">
         <property name="visible">True</property>
-        <property name="max-height">12</property>
+        <property name="max-height">14</property>
         <child>
           <object class="GtkShortcutsGroup">
             <property name="visible">True</property>
@@ -49,6 +49,53 @@
         <child>
           <object class="GtkShortcutsGroup">
             <property name="visible">True</property>
+            <property name="title" translatable="yes" context="shortcut window">Clipboard</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes" context="shortcut window">Copy 
descriptor</property>
+                <property name="accelerator">&lt;Primary&gt;c</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes" context="shortcut window">Copy path</property>
+                <property name="accelerator">&lt;Primary&gt;&lt;Shift&gt;c</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">True</property>
+            <property name="title" translatable="yes" context="shortcut window">Modifications list 
actions</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes" context="shortcut window">Toggle modifications 
list</property>
+                <property name="accelerator">&lt;Primary&gt;i</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes" context="shortcut window">Open selected row 
key</property>
+                <property name="accelerator">Return</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes" context="shortcut window">Dismiss 
modification</property>
+                <property name="accelerator">&lt;Primary&gt;Delete</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">True</property>
             <property name="title" translatable="yes" context="shortcut window">Path bar 
navigation</property>
             <child>
               <object class="GtkShortcutsShortcut">
@@ -110,26 +157,6 @@
         <child>
           <object class="GtkShortcutsGroup">
             <property name="visible">True</property>
-            <property name="title" translatable="yes" context="shortcut window">Clipboard</property>
-            <child>
-              <object class="GtkShortcutsShortcut">
-                <property name="visible">True</property>
-                <property name="title" translatable="yes" context="shortcut window">Copy 
descriptor</property>
-                <property name="accelerator">&lt;Primary&gt;c</property>
-              </object>
-            </child>
-            <child>
-              <object class="GtkShortcutsShortcut">
-                <property name="visible">True</property>
-                <property name="title" translatable="yes" context="shortcut window">Copy path</property>
-                <property name="accelerator">&lt;Primary&gt;&lt;Shift&gt;c</property>
-              </object>
-            </child>
-          </object>
-        </child>
-        <child>
-          <object class="GtkShortcutsGroup">
-            <property name="visible">True</property>
             <property name="title" translatable="yes" context="shortcut window">Generic</property>
             <child>
               <object class="GtkShortcutsShortcut">
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index dce090d..3924378 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -393,7 +393,7 @@ private class KeyListBoxRowEditableNoSchema : KeyListBoxRow
             if (planned_change)
             {
                 popover.new_section ();
-                popover.new_gaction (planned_value == null ? "unerase" : "dismiss", "bro.dismiss-change(" + 
variant_s.print (false) + ")");
+                popover.new_gaction (planned_value == null ? "unerase" : "dismiss", "ui.dismiss-change(" + 
variant_s.print (false) + ")");
             }
 
             if (!planned_change || planned_value != null) // not &&
@@ -563,7 +563,7 @@ private class KeyListBoxRowEditable : KeyListBoxRow
         else if (planned_change)
         {
             popover.new_section ();
-            popover.new_gaction ("dismiss", "bro.dismiss-change(" + variant_s.print (false) + ")");
+            popover.new_gaction ("dismiss", "ui.dismiss-change(" + variant_s.print (false) + ")");
 
             if (planned_value != null)
                 popover.new_gaction ("default1", "bro.set-to-default(" + variant_ss.print (false) + ")");
diff --git a/editor/meson.build b/editor/meson.build
index a2cea62..59f9aaa 100644
--- a/editor/meson.build
+++ b/editor/meson.build
@@ -73,6 +73,7 @@ sources = files(
   'dconf-model.vala',
   'dconf-view.vala',
   'dconf-window.vala',
+  'delayed-setting-view.vala',
   'key-list-box-row.vala',
   'modifications-handler.vala',
   'modifications-revealer.vala',
@@ -94,6 +95,7 @@ resource_data = files(
   'dconf-editor.css',
   'dconf-editor-menu.ui',
   'dconf-editor.ui',
+  'delayed-setting-view.ui',
   'folder-list-box-row.ui',
   'help-overlay.ui',
   'key-list-box-row.ui',
diff --git a/editor/modifications-handler.vala b/editor/modifications-handler.vala
index 6b75ee5..26495a7 100644
--- a/editor/modifications-handler.vala
+++ b/editor/modifications-handler.vala
@@ -229,4 +229,14 @@ class ModificationsHandler : Object
             });
         return planned_changed;
     }
+
+    public ListStore get_delayed_settings ()
+    {
+        ListStore delayed_settings_list = new ListStore (typeof (Key));
+        keys_awaiting_hashtable.@foreach ((key_path, planned_value) => {
+                SettingObject? key = model.get_key (key_path);
+                delayed_settings_list.append ((Key) (!) key);
+            });
+        return delayed_settings_list;
+    }
 }
diff --git a/editor/modifications-revealer.ui b/editor/modifications-revealer.ui
index 70e403d..352b394 100644
--- a/editor/modifications-revealer.ui
+++ b/editor/modifications-revealer.ui
@@ -8,6 +8,23 @@
       <object class="GtkActionBar">
         <property name="visible">True</property>
         <child>
+          <object class="GtkMenuButton" id="delayed_list_button">
+            <property name="visible">True</property>
+            <property name="use-popover">True</property>
+            <property name="popover">delayed_settings_list_popover</property>
+            <property name="focus-on-click">False</property>
+            <style>
+              <class name="circular"/>
+            </style>
+            <child>
+              <object class="GtkImage">
+                <property name="visible">True</property>
+                <property name="icon-name">view-more-symbolic</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
           <object class="GtkLabel" id="label">
             <property name="visible">True</property>
             <property name="margin-start">6</property><!-- GtkActionBar creates a GtkBox which "spacing" 
property is not editable -->
@@ -61,4 +78,35 @@
       </object>
     </child>
   </template>
+
+  <object class="GtkPopover" id="delayed_settings_list_popover">
+    <property name="height-request">300</property>
+    <property name="width-request">550</property>
+    <style>
+      <class name="delayed-settings-popover"/>
+    </style>
+    <child>
+      <object class="GtkScrolledWindow">
+        <property name="visible">True</property>
+        <property name="shadow-type">etched-in</property>
+        <property name="can-focus">False</property>
+        <child>
+          <object class="GtkListBox" id="delayed_settings_listbox">
+            <property name="visible">True</property>
+            <property name="activate-on-single-click">True</property>
+            <property name="selection-mode">browse</property>
+            <style>
+              <class name="delayed-list"/>
+            </style>
+            <child type="placeholder">
+              <object class="RegistryPlaceholder">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Delayed setting changes will be shown 
here</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
 </interface>
diff --git a/editor/modifications-revealer.vala b/editor/modifications-revealer.vala
index 8a2e9d2..aa8b2b8 100644
--- a/editor/modifications-revealer.vala
+++ b/editor/modifications-revealer.vala
@@ -33,9 +33,17 @@ class ModificationsRevealer : Revealer
 
     [GtkChild] private Label label;
     [GtkChild] private ModelButton apply_button;
+    [GtkChild] private MenuButton delayed_list_button;
+    [GtkChild] private Popover delayed_settings_list_popover;
+    [GtkChild] private ListBox delayed_settings_listbox;
 
     private ThemedIcon apply_button_icon = new ThemedIcon.from_names ({"object-select-symbolic"});
 
+    construct
+    {
+        delayed_settings_listbox.set_header_func (delayed_setting_row_update_header);
+    }
+
     /*\
     * * Window management callbacks
     \*/
@@ -108,14 +116,133 @@ class ModificationsRevealer : Revealer
     }
 
     /*\
-    * * Utilities
+    * * Modifications list public functions
+    \*/
+
+    public bool dismiss_selected_modification ()
+    {
+        if (!delayed_list_button.active)
+            return false;
+
+        ListBoxRow? selected_row = delayed_settings_listbox.get_selected_row ();
+        if (selected_row == null)
+            return false;
+
+        modifications_handler.dismiss_change (((DelayedSettingView) (!) ((!) selected_row).get_child 
()).full_name);
+        update ();
+        return true;
+    }
+
+    public void hide_modifications_list ()
+    {
+        delayed_settings_list_popover.popdown ();
+    }
+
+    public void toggle_modifications_list ()
+    {
+        delayed_list_button.active = !delayed_settings_list_popover.visible;
+    }
+
+    public bool get_modifications_list_state ()
+    {
+        return delayed_list_button.active;
+    }
+
+    /*\
+    * * Modifications list population
+    \*/
+
+    private Widget delayed_setting_row_create (Object key)
+    {
+        string full_name = ((Key) key).full_name;
+        bool has_schema = key is GSettingsKey;
+        bool is_default_or_ghost = has_schema ? modifications_handler.model.is_key_default ((GSettingsKey) 
key)
+                                              : modifications_handler.model.is_key_ghost ((DConfKey) key);
+        Variant? planned_value = modifications_handler.get_key_planned_value (full_name);
+        string? cool_planned_value = null;
+        if (planned_value != null)
+            cool_planned_value = Key.cool_text_value_from_variant ((!) planned_value, ((Key) 
key).type_string);
+        string? cool_default_value = null;
+        if (has_schema)
+            cool_default_value = Key.cool_text_value_from_variant (((GSettingsKey) key).default_value, 
((Key) key).type_string);
+        string cool_key_value = Key.cool_text_value_from_variant (modifications_handler.model.get_key_value 
((Key) key),
+                                                                                                             
((Key) key).type_string);
+        DelayedSettingView view = new DelayedSettingView (full_name,
+                                                          is_default_or_ghost,
+                                                          cool_key_value,
+                                                          cool_planned_value,
+                                                          cool_default_value);
+
+        ListBoxRow wrapper = new ListBoxRow ();
+        wrapper.add (view);
+        Variant variant = new Variant ("(ss)", full_name, has_schema ? ((GSettingsKey) key).schema_id : 
".dconf");
+        wrapper.set_detailed_action_name ("ui.open-object(" + variant.print (false) + ")");
+        return wrapper;
+    }
+
+    private void delayed_setting_row_update_header (ListBoxRow row, ListBoxRow? before)
+    {
+        string row_key_name = ((DelayedSettingView) row.get_child ()).full_name;
+        bool add_location_header = false;
+        if (before == null)
+            add_location_header = true;
+        else
+        {
+            string before_key_name = ((DelayedSettingView) ((!) before).get_child ()).full_name;
+
+            if (SettingsModel.get_parent_path (row_key_name) != SettingsModel.get_parent_path 
(before_key_name))
+                add_location_header = true;
+        }
+
+        if (add_location_header)
+        {
+            Grid location_header = new Grid ();
+            location_header.show ();
+            location_header.orientation = Orientation.VERTICAL;
+
+            Label location_header_label = new Label (SettingsModel.get_parent_path (row_key_name));
+            location_header_label.show ();
+            location_header_label.hexpand = true;
+            location_header_label.halign = Align.START;
+
+            StyleContext context = location_header_label.get_style_context ();
+            context.add_class ("dim-label");
+            context.add_class ("bold-label");
+            context.add_class ("list-row-header");
+
+            location_header.add (location_header_label);
+
+            Separator separator_header = new Separator (Orientation.HORIZONTAL);
+            separator_header.show ();
+            location_header.add (separator_header);
+
+            row.set_header (location_header);
+        }
+        else
+        {
+            Separator separator_header = new Separator (Orientation.HORIZONTAL);
+            separator_header.show ();
+            row.set_header (separator_header);
+        }
+    }
+
+    /*\
+    * * Update
     \*/
 
     private void update ()
     {
+        GLib.ListStore modifications_list = modifications_handler.get_delayed_settings ();
+        delayed_settings_listbox.bind_model (modifications_handler.get_delayed_settings (), 
delayed_setting_row_create);
+        if (modifications_list.get_n_items () == 0)
+            delayed_settings_list_popover.popdown ();
+        else
+            delayed_settings_listbox.select_row ((!) delayed_settings_listbox.get_row_at_index (0));
+
         if (modifications_handler.mode == ModificationsMode.NONE)
         {
             set_reveal_child (false);
+            apply_button.sensitive = false;
             label.set_text ("");
             return;
         }
diff --git a/po/POTFILES.in b/po/POTFILES.in
index b43eb60..36a8c77 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -13,6 +13,8 @@ editor/dconf-editor.vala
 editor/dconf-model.vala
 editor/dconf-view.vala
 editor/dconf-window.vala
+editor/delayed-setting-view.ui
+editor/delayed-setting-view.vala
 editor/help-overlay.ui
 editor/key-list-box-row.vala
 editor/modifications-revealer.ui
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 0f8f3ea..227ff38 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -5,6 +5,7 @@ editor/dconf-editor.c
 editor/dconf-model.c
 editor/dconf-view.c
 editor/dconf-window.c
+editor/delayed-setting-view.c
 editor/key-list-box-row.c
 editor/modifications-revealer.c
 editor/pathbar.c


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