[latexila] Use TeplTab API where DocumentTab is not needed



commit ae95801424b95c59c1f707ed77ec8998994cc2ed
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Jun 24 06:01:38 2017 +0200

    Use TeplTab API where DocumentTab is not needed

 src/main_window.vala      |   24 +++++++++++++-----------
 src/main_window_edit.vala |    8 ++++----
 src/search.vala           |    4 ++--
 3 files changed, 19 insertions(+), 17 deletions(-)
---
diff --git a/src/main_window.vala b/src/main_window.vala
index 0261d4f..7745ff6 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -665,7 +665,7 @@ public class MainWindow : ApplicationWindow
                     if (response_id == ResponseType.YES)
                         tab.document.readonly = false;
                     infobar.destroy ();
-                    tab.document_view.grab_focus ();
+                    tab.view.grab_focus ();
                 });
 
                 return tab;
@@ -700,41 +700,43 @@ public class MainWindow : ApplicationWindow
 
         tab.close_document.connect (() => { close_tab (tab); });
 
+        Document doc = tab.document;
+
         /* sensitivity of undo and redo */
-        tab.document.notify["can-undo"].connect (() =>
+        doc.notify["can-undo"].connect (() =>
         {
             if (tab == active_tab)
                 _main_window_edit.update_sensitivity ();
         });
 
-        tab.document.notify["can-redo"].connect (() =>
+        doc.notify["can-redo"].connect (() =>
         {
             if (tab == active_tab)
                 _main_window_edit.update_sensitivity ();
         });
 
         /* sensitivity of cut/copy/delete */
-        tab.document.notify["has-selection"].connect (() =>
+        doc.notify["has-selection"].connect (() =>
         {
             if (tab == active_tab)
                 _main_window_edit.update_sensitivity ();
         });
 
-        tab.document.notify["location"].connect (() =>
+        doc.notify["location"].connect (() =>
         {
             sync_name (tab);
             _main_window_build_tools.update_sensitivity ();
         });
 
-        tab.document.notify["project-id"].connect (() =>
+        doc.notify["project-id"].connect (() =>
         {
             _main_window_build_tools.update_sensitivity ();
         });
 
 
-        tab.document.modified_changed.connect (() => sync_name (tab));
-        tab.document.notify["readonly"].connect (() => sync_name (tab));
-        tab.document.tepl_cursor_moved.connect (update_cursor_position_statusbar);
+        doc.modified_changed.connect (() => sync_name (tab));
+        doc.notify["readonly"].connect (() => sync_name (tab));
+        doc.tepl_cursor_moved.connect (update_cursor_position_statusbar);
 
         tab.show ();
 
@@ -756,7 +758,7 @@ public class MainWindow : ApplicationWindow
         /* If document not saved
          * Ask the user if he wants to save the file, or close without saving, or cancel
          */
-        if (! force_close && tab.document.get_modified ())
+        if (! force_close && tab.get_buffer ().get_modified ())
         {
             Dialog dialog = new MessageDialog (this,
                 DialogFlags.DESTROY_WITH_PARENT,
@@ -1008,7 +1010,7 @@ public class MainWindow : ApplicationWindow
         // Ensure that the file is fully loaded before selecting the lines.
         Utils.flush_queue ();
 
-        tab.document_view.select_lines (start_line, end_line);
+        tab.view.select_lines (start_line, end_line);
     }
 
     /*************************************************************************/
diff --git a/src/main_window_edit.vala b/src/main_window_edit.vala
index d6e5b47..96186ed 100644
--- a/src/main_window_edit.vala
+++ b/src/main_window_edit.vala
@@ -237,9 +237,9 @@ public class MainWindowEdit
 
         TextIter start;
         TextIter end;
-        tab.document.get_selection_bounds (out start, out end);
+        tab.get_buffer ().get_selection_bounds (out start, out end);
 
-        tab.document_view.indent_lines (start, end);
+        tab.view.indent_lines (start, end);
     }
 
     public void on_unindent ()
@@ -249,9 +249,9 @@ public class MainWindowEdit
 
         TextIter start;
         TextIter end;
-        tab.document.get_selection_bounds (out start, out end);
+        tab.get_buffer ().get_selection_bounds (out start, out end);
 
-        tab.document_view.unindent_lines (start, end);
+        tab.view.unindent_lines (start, end);
     }
 
     public void on_comment ()
diff --git a/src/search.vala b/src/search.vala
index 5798b25..bd50801 100644
--- a/src/search.vala
+++ b/src/search.vala
@@ -236,7 +236,7 @@ public class SearchAndReplace : GLib.Object
             if (_search_context.backward2 (iter, out match_start, out match_end, null))
             {
                 doc.select_range (match_start, match_end);
-                doc.tab.document_view.scroll_to_cursor ();
+                doc.tab.view.scroll_to_cursor ();
             }
         });
 
@@ -506,7 +506,7 @@ public class SearchAndReplace : GLib.Object
         if (_search_context.forward2 (iter, out match_start, out match_end, null))
         {
             doc.select_range (match_start, match_end);
-            doc.tab.document_view.scroll_to_cursor ();
+            doc.tab.view.scroll_to_cursor ();
         }
     }
 


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