[latexila] Refresh structure when saving



commit 8064fbe23e165f637f699f83d5eadf612d139ca3
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Jan 30 21:30:54 2014 +0100

    Refresh structure when saving
    
    https://bugzilla.gnome.org/show_bug.cgi?id=723312

 src/main_window.vala           |    8 ++++++++
 src/main_window_structure.vala |    6 ++++++
 src/structure.vala             |    7 ++++++-
 3 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/src/main_window.vala b/src/main_window.vala
index 58dbb5e..12c5878 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -847,6 +847,10 @@ public class MainWindow : Window
         if (! force_save_as && doc.location != null)
         {
             doc.save ();
+
+            if (doc == active_document)
+                _main_window_structure.refresh ();
+
             return true;
         }
 
@@ -914,6 +918,10 @@ public class MainWindow : Window
         {
             // force saving
             doc.save (false, true);
+
+            if (doc == active_document)
+                _main_window_structure.refresh ();
+
             return true;
         }
         return false;
diff --git a/src/main_window_structure.vala b/src/main_window_structure.vala
index 9e390ad..99db50b 100644
--- a/src/main_window_structure.vala
+++ b/src/main_window_structure.vala
@@ -87,6 +87,12 @@ public class MainWindowStructure
         _structure.save_state ();
     }
 
+    public void refresh ()
+    {
+        return_if_fail (_structure != null)
+        _structure.refresh ();
+    }
+
     private void show_popup_menu (Gdk.EventButton? event)
     {
         Gtk.Menu popup_menu = _ui_manager.get_widget ("/StructurePopup") as Gtk.Menu;
diff --git a/src/structure.vala b/src/structure.vala
index cd96438..743640b 100644
--- a/src/structure.vala
+++ b/src/structure.vala
@@ -134,6 +134,11 @@ public class Structure : Grid
         hide.connect (disconnect_parsing);
     }
 
+    public void refresh ()
+    {
+        show_document (_main_window.active_document, true);
+    }
+
     private void init_toolbar ()
     {
         Toolbar toolbar = new Toolbar ();
@@ -160,7 +165,7 @@ public class Structure : Grid
 
         refresh_button.clicked.connect (() =>
         {
-            show_document (_main_window.active_document, true);
+            refresh ();
         });
 
         return refresh_button;


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