[gnome-latex/wip/misc] MainWindow: use TeplPanel to create the side panel



commit 9e8ba62fd99bdf29e476966b0f619f7cdc2b20a8
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Apr 21 15:36:07 2020 +0200

    MainWindow: use TeplPanel to create the side panel

 src/main_window.vala | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)
---
diff --git a/src/main_window.vala b/src/main_window.vala
index 4f214eb..0f31289 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -210,7 +210,7 @@ public class MainWindow : ApplicationWindow
 
         /* Side panel */
 
-        Widget side_panel = get_side_panel ();
+        Tepl.Panel side_panel = get_side_panel ();
         _main_hpaned.pack1 (side_panel, false, false);
 
         /* Vertical paned.
@@ -429,37 +429,32 @@ public class MainWindow : ApplicationWindow
         return edit_toolbar;
     }
 
-    private Widget get_side_panel ()
+    private Tepl.Panel get_side_panel ()
     {
-        Gtk.Stack stack = new Gtk.Stack ();
+        Tepl.Panel side_panel = new Tepl.Panel.for_left_side_panel ();
 
         // Symbols
         SymbolsView symbols = new SymbolsView (this);
-        Tepl.stack_add_component (stack, symbols, "symbols", _("Symbols"),
-            "symbol_greek");
+        side_panel.add_component (symbols, "symbols", _("Symbols"), "symbol_greek");
 
         // File browser
         FileBrowser file_browser = new FileBrowser (this);
-        Tepl.stack_add_component (stack, file_browser, "file-browser", _("File Browser"),
+        side_panel.add_component (file_browser, "file-browser", _("File Browser"),
             "document-open");
 
         // Structure
         Structure structure = new Structure (this);
         _main_window_structure.set_structure (structure);
-        Tepl.stack_add_component (stack, structure, "structure", _("Structure"),
-            Stock.INDEX); // FIXME don't use GtkStock
+        side_panel.add_component (structure, "structure", _("Structure"), Stock.INDEX); // FIXME don't use 
GtkStock
 
-        // Side panel
-        Widget side_panel = Tepl.side_panel_new (stack);
-
-        // Restore/save state
+        // Restore state
         GLib.Settings settings = new GLib.Settings ("org.gnome.gnome-latex.preferences.ui");
-        Tepl.stack_bind_setting (stack, settings, "side-panel-component");
+        side_panel.set_active_component_setting (settings, "side-panel-component");
+        side_panel.restore_settings ();
 
         // Bind the toggle action to show/hide the side panel
         ToggleAction action = _action_group.get_action ("ViewSidePanel") as ToggleAction;
         action.active = true;
-
         side_panel.bind_property ("visible", action, "active",
             BindingFlags.BIDIRECTIONAL);
 


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