[gnome-latex/wip/misc] Remove SidePanel class, use Tepl functions instead



commit ad4540349dfbd579d64ffa412e2ba617aecb0e12
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon Apr 20 20:24:06 2020 +0200

    Remove SidePanel class, use Tepl functions instead

 po/POTFILES.in       |  1 -
 po/POTFILES.skip     |  1 -
 src/Makefile.am      |  1 -
 src/main_window.vala | 36 +++++++++++++++++------------
 src/side_panel.vala  | 65 ----------------------------------------------------
 5 files changed, 21 insertions(+), 83 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ca0267d..0d808a9 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -57,7 +57,6 @@ src/preferences_dialog.vala
 src/project_dialogs.vala
 src/projects.vala
 src/search.vala
-src/side_panel.vala
 src/stock_icons.vala
 src/structure_model.vala
 src/structure.vala
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 816d9ed..5aa8093 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -32,7 +32,6 @@ src/preferences_dialog.c
 src/project_dialogs.c
 src/projects.c
 src/search.c
-src/side_panel.c
 src/stock_icons.c
 src/structure.c
 src/structure_model.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 6510f0d..1b2fa10 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -53,7 +53,6 @@ vala_files =                          \
        project_dialogs.vala            \
        projects.vala                   \
        search.vala                     \
-       side_panel.vala                 \
        stock_icons.vala                \
        structure_model.vala            \
        structure.vala                  \
diff --git a/src/main_window.vala b/src/main_window.vala
index e46526e..4f214eb 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -210,7 +210,7 @@ public class MainWindow : ApplicationWindow
 
         /* Side panel */
 
-        SidePanel side_panel = get_side_panel ();
+        Widget side_panel = get_side_panel ();
         _main_hpaned.pack1 (side_panel, false, false);
 
         /* Vertical paned.
@@ -429,33 +429,39 @@ public class MainWindow : ApplicationWindow
         return edit_toolbar;
     }
 
-    private SidePanel get_side_panel ()
+    private Widget get_side_panel ()
     {
-        SidePanel side_panel = new SidePanel ();
-        side_panel.show ();
-
-        // 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);
+        Gtk.Stack stack = new Gtk.Stack ();
 
         // Symbols
         SymbolsView symbols = new SymbolsView (this);
-        side_panel.add_component (symbols, "symbols", _("Symbols"), "symbol_greek");
+        Tepl.stack_add_component (stack, symbols, "symbols", _("Symbols"),
+            "symbol_greek");
 
         // File browser
         FileBrowser file_browser = new FileBrowser (this);
-        side_panel.add_component (file_browser, "file-browser", _("File Browser"),
+        Tepl.stack_add_component (stack, file_browser, "file-browser", _("File Browser"),
             "document-open");
 
         // Structure
         Structure structure = new Structure (this);
         _main_window_structure.set_structure (structure);
-        side_panel.add_component (structure, "structure", _("Structure"), Stock.INDEX); // FIXME don't use 
Stock
+        Tepl.stack_add_component (stack, structure, "structure", _("Structure"),
+            Stock.INDEX); // FIXME don't use GtkStock
+
+        // Side panel
+        Widget side_panel = Tepl.side_panel_new (stack);
 
-        side_panel.restore_state ();
+        // Restore/save state
+        GLib.Settings settings = new GLib.Settings ("org.gnome.gnome-latex.preferences.ui");
+        Tepl.stack_bind_setting (stack, settings, "side-panel-component");
+
+        // 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);
 
         return side_panel;
     }


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