[dconf-editor] Make ModificationsList an OverlayedList.



commit 24486bfe5e0f32bdb870b69d5f6a1bf144c0469a
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Wed Nov 14 12:20:56 2018 +0100

    Make ModificationsList an OverlayedList.

 editor/dconf-editor.css           | 12 +++---
 editor/dconf-editor.gresource.xml |  1 -
 editor/meson.build                |  1 -
 editor/modifications-list.ui      | 79 ---------------------------------------
 editor/modifications-list.vala    | 56 +++++++++------------------
 5 files changed, 23 insertions(+), 126 deletions(-)
---
diff --git a/editor/dconf-editor.css b/editor/dconf-editor.css
index 1787c6d..7cc33f9 100644
--- a/editor/dconf-editor.css
+++ b/editor/dconf-editor.css
@@ -102,12 +102,12 @@
 
 .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; }
+.delayed-list          > scrolledwindow > viewport > list > row              { padding:10px; }
+.delayed-list          > scrolledwindow > viewport > list > row .key-name    { padding-bottom:5px; }
+.delayed-list:dir(ltr) > scrolledwindow > viewport > list > row .diff-bullet { padding-left:20px; 
padding-right:6px; }
+.delayed-list:dir(rtl) > scrolledwindow > viewport > list > row .diff-bullet { padding-right:20px; 
padding-left:6px; }
+.delayed-list:dir(ltr) > scrolledwindow > viewport > list > row .value-label { padding-right:6px; }
+.delayed-list:dir(rtl) > scrolledwindow > viewport > list > 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 0dc5ad0..7473eec 100644
--- a/editor/dconf-editor.gresource.xml
+++ b/editor/dconf-editor.gresource.xml
@@ -18,7 +18,6 @@
     <file>large-pathbar.css</file>
     <file preprocess="xml-stripblanks">large-pathbar.ui</file>
     <file preprocess="xml-stripblanks">large-pathbar-item.ui</file>
-    <file preprocess="xml-stripblanks">modifications-list.ui</file>
     <file preprocess="xml-stripblanks">modifications-revealer.ui</file>
     <file preprocess="xml-stripblanks">overlayed-list.ui</file>
     <file preprocess="xml-stripblanks">pathentry.ui</file>
diff --git a/editor/meson.build b/editor/meson.build
index e1b3b19..40c43bc 100644
--- a/editor/meson.build
+++ b/editor/meson.build
@@ -119,7 +119,6 @@ resource_data = files(
   'large-pathbar-item.ui',
   'large-pathbar.css',
   'large-pathbar.ui',
-  'modifications-list.ui',
   'modifications-revealer.ui',
   'overlayed-list.ui',
   'pathentry.ui',
diff --git a/editor/modifications-list.vala b/editor/modifications-list.vala
index 5e074e5..05c4e6d 100644
--- a/editor/modifications-list.vala
+++ b/editor/modifications-list.vala
@@ -17,42 +17,20 @@
 
 using Gtk;
 
-[GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/modifications-list.ui")]
-private class ModificationsList : Overlay
+private class ModificationsList : OverlayedList
 {
-    [GtkChild] private ScrolledWindow   scrolled;
-    [GtkChild] private ListBox          delayed_settings_listbox;
-/*    [GtkChild] private Box              edit_mode_box;
-
-    [GtkChild] private ModelButton enter_edit_mode_button;
-    [GtkChild] private ModelButton leave_edit_mode_button;
-    public string edit_mode_action_prefix
+    construct
     {
-        construct
-        {
-            // TODO sanitize "value"
-            enter_edit_mode_button.set_detailed_action_name (value + ".set-edit-mode(true)");
-            leave_edit_mode_button.set_detailed_action_name (value + ".set-edit-mode(false)");
-        }
-    } */
+        get_style_context ().add_class ("delayed-list");
 
-    public bool needs_shadows
-    {
-        construct
-        {
-            if (value)
-                scrolled.shadow_type = ShadowType.ETCHED_IN;
-            else
-                scrolled.shadow_type = ShadowType.NONE;
-        }
-    }
+        placeholder_icon = "document-open-recent-symbolic";
+        placeholder_text = _("Delayed mode is on\nbut\nno pending changes");
+        add_placeholder ();
 
-    [GtkChild] private RegistryPlaceholder placeholder;
-    public bool big_placeholder { internal construct { placeholder.big = value; }}
+        first_mode_name = _("Rule all");
+        second_mode_name = _("Select");
 
-    construct
-    {
-        delayed_settings_listbox.set_header_func (delayed_setting_row_update_header);
+        main_list_box.set_header_func (delayed_setting_row_update_header);
     }
 
     private static void delayed_setting_row_update_header (ListBoxRow row, ListBoxRow? before)
@@ -107,7 +85,7 @@ private class ModificationsList : Overlay
 
     internal bool dismiss_selected_modification (ModificationsHandler modifications_handler)
     {
-        ListBoxRow? selected_row = delayed_settings_listbox.get_selected_row ();
+        ListBoxRow? selected_row = main_list_box.get_selected_row ();
         if (selected_row == null)
             return false;
 
@@ -117,14 +95,14 @@ private class ModificationsList : Overlay
 
     internal void bind_model (GLib.ListStore modifications, ListBoxCreateWidgetFunc 
delayed_setting_row_create)
     {
-        delayed_settings_listbox.bind_model (modifications, delayed_setting_row_create);
-        select_first_row (delayed_settings_listbox);
+        main_list_box.bind_model (modifications, delayed_setting_row_create);
+        select_first_row (main_list_box);
     }
-    private static inline void select_first_row (ListBox delayed_settings_listbox)
+    private static inline void select_first_row (ListBox main_list_box)
     {
-        ListBoxRow? first_row = delayed_settings_listbox.get_row_at_index (0);
+        ListBoxRow? first_row = main_list_box.get_row_at_index (0);
         if (first_row != null)
-            delayed_settings_listbox.select_row ((!) first_row);
+            main_list_box.select_row ((!) first_row);
     }
 
     /*\
@@ -133,7 +111,7 @@ private class ModificationsList : Overlay
 
     internal void gkey_value_push (string full_name, uint16 context_id, Variant key_value, bool 
is_key_default)
     {
-        delayed_settings_listbox.foreach ((widget) => {
+        main_list_box.foreach ((widget) => {
                 DelayedSettingView row = (DelayedSettingView) ((Bin) widget).get_child ();
                 if (row.full_name == full_name && row.context_id == context_id)
                     row.update_gsettings_key_current_value (key_value, is_key_default);
@@ -142,7 +120,7 @@ private class ModificationsList : Overlay
 
     internal void dkey_value_push (string full_name, Variant? key_value_or_null)
     {
-        delayed_settings_listbox.foreach ((widget) => {
+        main_list_box.foreach ((widget) => {
                 DelayedSettingView row = (DelayedSettingView) ((Bin) widget).get_child ();
                 if (row.full_name == full_name)
                     row.update_dconf_key_current_value (key_value_or_null);


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