[latexila] Structure fix: a simple list can contain several types



commit 87d0a163a72b4d94e4d1615deecfbe496b6db855
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Sat Jun 25 23:45:12 2011 +0200

    Structure fix: a simple list can contain several types

 src/document.vala        |    4 ----
 src/post_processors.vala |    1 -
 src/structure.vala       |   20 ++++++++------------
 3 files changed, 8 insertions(+), 17 deletions(-)
---
diff --git a/src/document.vala b/src/document.vala
index f2c0bc5..0088d7e 100644
--- a/src/document.vala
+++ b/src/document.vala
@@ -836,7 +836,6 @@ public class Document : Gtk.SourceBuffer
         if (insert.has_tag (found_tag_selected) ||
             insert_previous.has_tag (found_tag_selected))
         {
-            //stdout.printf ("has tag selected\n");
             return;
         }
 
@@ -844,10 +843,7 @@ public class Document : Gtk.SourceBuffer
         invalidate_search_selected_marks ();
 
         if (insert.has_tag (found_tag) || insert_previous.has_tag (found_tag))
-        {
-            //stdout.printf ("has tag\n");
             search_backward ();
-        }
         else
             search_info_updated (false, search_nb_matches, 0);
     }
diff --git a/src/post_processors.vala b/src/post_processors.vala
index c4721fc..cfbf9eb 100644
--- a/src/post_processors.vala
+++ b/src/post_processors.vala
@@ -218,7 +218,6 @@ private class LatexmkPostProcessor : GLib.Object, PostProcessor
 
     public void process (File file, string output, int status)
     {
-        //stdout.printf ("*** OUTPUT ***\n\n%s\n\n*** END OUTPUT ***\n\n", output);
         successful = status == 0;
 
         return_if_fail (reg_rule != null && reg_no_rule != null);
diff --git a/src/structure.vala b/src/structure.vala
index 443eac2..835f056 100644
--- a/src/structure.vala
+++ b/src/structure.vala
@@ -60,8 +60,7 @@ public class Structure : VBox
     private TreeView _list_view;
     private Widget _list_view_sw;
     private ListStore _list_store;
-    // FIXME a simple list can contain several types
-    private StructType _current_list_type;
+    private StructType[] _current_list_types;
     private bool _list_is_hidden = true;
 
     private bool _first_select = true;
@@ -158,9 +157,9 @@ public class Structure : VBox
     {
         return_val_if_fail (types.length > 0, null);
 
-        StructType cur_type = types[0];
+        StructType main_type = types[0];
         ToggleButton button =
-            Utils.get_toolbar_toggle_button (get_icon_from_type (cur_type));
+            Utils.get_toolbar_toggle_button (get_icon_from_type (main_type));
 
         button.tooltip_text = tooltip;
 
@@ -170,7 +169,7 @@ public class Structure : VBox
         {
             if (! button.get_active ())
             {
-                if (! _list_is_hidden && _current_list_type == cur_type)
+                if (! _list_is_hidden && main_type in _current_list_types)
                 {
                     _list_is_hidden = true;
                     _list_view_sw.hide ();
@@ -178,7 +177,7 @@ public class Structure : VBox
                 return;
             }
 
-            _current_list_type = cur_type;
+            _current_list_types = types;
             _list_is_hidden = false;
             _list_view_sw.show_all ();
             populate_simple_list ();
@@ -203,7 +202,7 @@ public class Structure : VBox
         if (_model == null || _list_is_hidden)
             return;
 
-        _model.populate_list (_list_store, _current_list_type);
+        _model.populate_list (_list_store, _current_list_types[0]);
 
         /* select an item if needed */
 
@@ -211,10 +210,7 @@ public class Structure : VBox
         List<TreePath> selected_rows = tree_select.get_selected_rows (null);
 
         if (selected_rows.length () != 1)
-        {
-            //stdout.printf ("length: %u\n", selected_rows.length ());
             return;
-        }
 
         TreePath tree_path = selected_rows.nth_data (0);
         TreeIter tree_iter;
@@ -359,7 +355,7 @@ public class Structure : VBox
         int row_num = list_path.get_indices ()[0];
 
         TreePath? tree_path =
-            _model.get_tree_path_from_list_num (_current_list_type, row_num);
+            _model.get_tree_path_from_list_num (_current_list_types[0], row_num);
 
         return_val_if_fail (tree_path != null, false);
 
@@ -429,7 +425,7 @@ public class Structure : VBox
         StructType type;
         _model.get (tree_iter, StructColumn.TYPE, out type, -1);
 
-        if (type != _current_list_type)
+        if (! (type in _current_list_types))
             return;
 
         int row_num = _model.get_list_num_from_tree_iter (tree_iter);



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