[dconf-editor] Init ShortPathbar with a complete_path.



commit aad3f9b9e5b82d4444d5cbe0f9943389f15bbb8c
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sun Jan 6 09:31:18 2019 +0100

    Init ShortPathbar with a complete_path.
    
    A ShortPathbar is created (for now, only) at window resize,
    so it should know the "complete path", the path of the last
    visited key (as an example). LargePathbar is, for now, only
    (and always) created at startup; needs fix on small screen.

 editor/adaptative-pathbar.vala | 15 +++++++++++----
 editor/large-pathbar.vala      |  5 +++++
 editor/short-pathbar.vala      |  7 +++++++
 3 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/editor/adaptative-pathbar.vala b/editor/adaptative-pathbar.vala
index bc24b6d..f9a3b2c 100644
--- a/editor/adaptative-pathbar.vala
+++ b/editor/adaptative-pathbar.vala
@@ -36,9 +36,9 @@ private class AdaptativePathbar : Stack, Pathbar, AdaptativeWidget
     private LargePathbar large_pathbar;
     private ShortPathbar short_pathbar;
 
-    private void create_large_pathbar ()
+    private void create_large_pathbar ()        // FIXME large pathbar is created at startup, even on thin 
window
     {
-        large_pathbar = new LargePathbar ();
+        large_pathbar = new LargePathbar ();    // TODO _get_complete_path (/* allow empty */ true));
         large_pathbar.valign = Align.FILL;
         large_pathbar.vexpand = true;
         large_pathbar.show ();
@@ -48,7 +48,7 @@ private class AdaptativePathbar : Stack, Pathbar, AdaptativeWidget
 
     private void create_short_pathbar ()
     {
-        short_pathbar = new ShortPathbar ();
+        short_pathbar = new ShortPathbar (_get_complete_path (/* allow empty */ true));
         short_pathbar.valign = Align.CENTER;
         short_pathbar.show ();
         add (short_pathbar);
@@ -156,12 +156,19 @@ private class AdaptativePathbar : Stack, Pathbar, AdaptativeWidget
     \*/
 
     internal string get_complete_path ()
+    {
+        return _get_complete_path (false);
+    }
+    private string _get_complete_path (bool private_call)
     {
         if (large_pathbar_created)
             return large_pathbar.get_complete_path ();
         else if (short_pathbar_created)
             return short_pathbar.get_complete_path ();
-        assert_not_reached ();
+        else if (private_call)
+            return "";
+        else
+            assert_not_reached ();
     }
 
     internal void get_fallback_path_and_complete_path (out string fallback_path, out string complete_path)
diff --git a/editor/large-pathbar.vala b/editor/large-pathbar.vala
index 311d883..60b692b 100644
--- a/editor/large-pathbar.vala
+++ b/editor/large-pathbar.vala
@@ -45,6 +45,11 @@ private class LargePathbar : Box, Pathbar
         add_slash_label ();
     }
 
+ // internal LargePathbar (string complete_path_or_empty)   // TODO
+ // {
+ //     complete_path = complete_path_or_empty;
+ // }
+
     /*\
     * * keyboard
     \*/
diff --git a/editor/short-pathbar.vala b/editor/short-pathbar.vala
index a11e57f..dd84a4d 100644
--- a/editor/short-pathbar.vala
+++ b/editor/short-pathbar.vala
@@ -40,6 +40,13 @@ private class ShortPathbar : Grid, Pathbar
     [GtkChild] private MenuButton   menu_button;
     [GtkChild] private Label        view_label;
 
+    internal ShortPathbar (string complete_path_or_empty)
+    {
+        complete_path = complete_path_or_empty;
+        non_ghost_path = complete_path_or_empty;
+        update_menu ();
+    }
+
     /*\
     * * keyboard
     \*/


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