[dconf-editor] Create AboutList on the fly.



commit f65dd875165a9fa7690e55d54ffbe2a26935a9d1
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Nov 29 06:01:23 2018 +0100

    Create AboutList on the fly.

 editor/about-list.vala   |  6 ++++++
 editor/browser-view.ui   |  8 --------
 editor/browser-view.vala | 23 ++++++++++++++++++++---
 3 files changed, 26 insertions(+), 11 deletions(-)
---
diff --git a/editor/about-list.vala b/editor/about-list.vala
index 656de77..1f66d70 100644
--- a/editor/about-list.vala
+++ b/editor/about-list.vala
@@ -33,10 +33,16 @@ private class AboutList : OverlayedList
         show_apropos (ref main_list_store);
     }
 
+    internal AboutList (bool needs_shadows, bool big_placeholder)
+    {
+        Object (needs_shadows: needs_shadows, big_placeholder: big_placeholder, edit_mode_action_prefix: 
"about");
+    }
+
     internal void reset ()
     {
         edit_mode_action.set_state (false);
         show_apropos (ref main_list_store);
+        scroll_top ();
     }
 
     /*\
diff --git a/editor/browser-view.ui b/editor/browser-view.ui
index dd2c4c9..9818d33 100644
--- a/editor/browser-view.ui
+++ b/editor/browser-view.ui
@@ -39,13 +39,5 @@
         <signal name="selection-changed" handler="on_modifications_selection_changed"/>
       </object>
     </child>
-    <child>
-      <object class="AboutList" id="about_list">
-        <property name="visible">True</property>
-        <property name="needs-shadows">False</property>
-        <property name="big-placeholder">True</property>
-        <property name="edit-mode-action-prefix">about</property>
-      </object>
-    </child>
   </template>
 </interface>
diff --git a/editor/browser-view.vala b/editor/browser-view.vala
index faa7e54..43911f0 100644
--- a/editor/browser-view.vala
+++ b/editor/browser-view.vala
@@ -61,12 +61,15 @@ private class BrowserView : Stack, AdaptativeWidget
 
     internal bool small_keys_list_rows { set { current_child.small_keys_list_rows = value; }}
 
+    private AdaptativeWidget.WindowSize window_size = AdaptativeWidget.WindowSize.START_SIZE;
     private void set_window_size (AdaptativeWidget.WindowSize new_size)
     {
+        window_size = new_size;
         current_child.set_window_size (new_size);
         bookmarks_list.set_window_size (new_size);
         modifications_list.set_window_size (new_size);
-        about_list.set_window_size (new_size);
+        if (about_list_created)
+            about_list.set_window_size (new_size);
     }
 
     private ModificationsHandler _modifications_handler;
@@ -206,7 +209,17 @@ private class BrowserView : Stack, AdaptativeWidget
 
     internal bool in_window_about                   { internal get; private set; default = false; }
 
-    [GtkChild] private AboutList about_list;
+    private bool about_list_created = false;
+    private AboutList about_list;
+
+    private void create_about_list ()
+    {
+        about_list = new AboutList (false, true);
+        about_list.set_window_size (window_size);
+        about_list.show ();
+        add (about_list);
+        about_list_created = true;
+    }
 
     internal void show_in_window_about ()
     {
@@ -215,7 +228,11 @@ private class BrowserView : Stack, AdaptativeWidget
         else if (in_window_modifications)
             hide_in_window_modifications ();
 
-        about_list.reset ();
+        if (about_list_created)
+            about_list.reset ();
+        else
+            create_about_list ();
+
         set_visible_child (about_list);
         in_window_about = true;
     }


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