[latexila] Document: use GtefSelectionType



commit 1d33f4fdede6f5e5278f6cfbf0731e160a1f82c7
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Oct 22 12:08:51 2016 +0200

    Document: use GtefSelectionType

 src/document.vala   |   20 --------------------
 src/latex_menu.vala |    2 +-
 src/search.vala     |    2 +-
 3 files changed, 2 insertions(+), 22 deletions(-)
---
diff --git a/src/document.vala b/src/document.vala
index 905de9f..beb8122 100644
--- a/src/document.vala
+++ b/src/document.vala
@@ -19,13 +19,6 @@
 
 using Gtk;
 
-public enum SelectionType
-{
-    NO_SELECTION,
-    ONE_LINE,
-    MULTIPLE_LINES
-}
-
 public class Document : Gtef.Buffer
 {
     public File location { get; set; }
@@ -455,19 +448,6 @@ public class Document : Gtef.Buffer
         tab.view.scroll_to_cursor ();
     }
 
-    public SelectionType get_selection_type ()
-    {
-        if (! has_selection)
-            return SelectionType.NO_SELECTION;
-
-        TextIter start, end;
-        get_selection_bounds (out start, out end);
-        if (start.get_line () == end.get_line ())
-            return SelectionType.ONE_LINE;
-
-        return SelectionType.MULTIPLE_LINES;
-    }
-
     // If line is bigger than the number of lines of the document, the cursor is moved
     // to the last line and false is returned.
     public bool goto_line (int line)
diff --git a/src/latex_menu.vala b/src/latex_menu.vala
index df6c550..172f5c2 100644
--- a/src/latex_menu.vala
+++ b/src/latex_menu.vala
@@ -549,7 +549,7 @@ public class LatexMenu : Gtk.ActionGroup
         return_if_fail (main_window.active_tab != null);
 
         if (main_window.active_document.get_selection_type ()
-            == SelectionType.MULTIPLE_LINES)
+            == Gtef.SelectionType.MULTIPLE_LINES)
             text_buffer_insert (@"\\begin{$style}\n", @"\n\\end{$style}");
         else
             text_buffer_insert (@"{\\$style ", "}", @"\\$style ");
diff --git a/src/search.vala b/src/search.vala
index af1e2a6..022fef8 100644
--- a/src/search.vala
+++ b/src/search.vala
@@ -378,7 +378,7 @@ public class SearchAndReplace : GLib.Object
         // if text is selected in the active document, and if this text contains no \n,
         // search this text
         Document doc = _main_window.active_document;
-        if (doc.get_selection_type () == SelectionType.ONE_LINE)
+        if (doc.get_selection_type () == Gtef.SelectionType.ON_SAME_LINE)
         {
             TextIter start, end;
             doc.get_selection_bounds (out start, out end);


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