[latexila] MainWindowStructure: add the structure later



commit 6fabb4f176b97dbd96fae54764bb49c54323c478
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Thu Aug 2 02:01:08 2012 +0200

    MainWindowStructure: add the structure later

 src/main_window.vala           |    5 +++--
 src/main_window_structure.vala |    9 +++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/main_window.vala b/src/main_window.vala
index 0339e7d..974c52e 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -147,10 +147,11 @@ public class MainWindow : Window
 
         /* components */
         initialize_menubar_and_toolbar ();
-        _main_window_edit = new MainWindowEdit (this, _ui_manager);
         _main_window_file = new MainWindowFile (this, _ui_manager);
+        _main_window_edit = new MainWindowEdit (this, _ui_manager);
         _main_window_build_tools = new MainWindowBuildTools (this, _ui_manager);
         _main_window_documents = new MainWindowDocuments (this, _ui_manager);
+        _main_window_structure = new MainWindowStructure (_ui_manager);
 
         _documents_panel = new DocumentsPanel (this);
         _main_window_documents.set_documents_panel (_documents_panel);
@@ -175,7 +176,7 @@ public class MainWindow : Window
 
         // Structure
         Structure structure = new Structure (this);
-        _main_window_structure = new MainWindowStructure (_ui_manager, structure);
+        _main_window_structure.set_structure (structure);
 
         // Bottom panel
         BuildView build_view = new BuildView (this);
diff --git a/src/main_window_structure.vala b/src/main_window_structure.vala
index ed92e04..9e390ad 100644
--- a/src/main_window_structure.vala
+++ b/src/main_window_structure.vala
@@ -60,16 +60,20 @@ public class MainWindowStructure
     private UIManager _ui_manager;
     private Structure _structure;
 
-    public MainWindowStructure (UIManager ui_manager, Structure structure)
+    public MainWindowStructure (UIManager ui_manager)
     {
         _ui_manager = ui_manager;
-        _structure = structure;
 
         Gtk.ActionGroup action_group = new Gtk.ActionGroup ("StructureActionGroup");
         action_group.set_translation_domain (Config.GETTEXT_PACKAGE);
         action_group.add_actions (_action_entries, this);
 
         ui_manager.insert_action_group (action_group, 0);
+    }
+
+    public void set_structure (Structure structure)
+    {
+        _structure = structure;
 
         structure.show_popup_menu.connect (show_popup_menu);
         structure.hide.connect (set_menu_insensitive);
@@ -79,6 +83,7 @@ public class MainWindowStructure
 
     public void save_state ()
     {
+        return_if_fail (_structure != null);
         _structure.save_state ();
     }
 



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