[vte] widget: Move some public API to its own file



commit 693eead2c394e6bc6f3e26f52f3b3122aa705e67
Author: Christian Persch <chpe gnome org>
Date:   Wed Nov 18 21:15:45 2015 +0100

    widget: Move some public API to its own file

 src/vte.cc         |   39 ++++++++++++---------------------------
 src/vtegtk.cc      |   30 ++++++++++++++++++++++++++++++
 src/vteinternal.hh |    2 ++
 3 files changed, 44 insertions(+), 27 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index ef0307e..381a13b 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -1233,21 +1233,14 @@ VteTerminalPrivate::set_cursor_from_regex_match(struct vte_match_regex *regex)
                 g_object_unref(gdk_cursor);
 }
 
-/**
- * vte_terminal_match_remove_all:
- * @terminal: a #VteTerminal
- *
- * Clears the list of regular expressions the terminal uses to highlight text
- * when the user moves the mouse cursor.
- */
 void
-vte_terminal_match_remove_all(VteTerminal *terminal)
+VteTerminalPrivate::match_remove_all()
 {
        struct vte_match_regex *regex;
        guint i;
-       g_return_if_fail(VTE_IS_TERMINAL(terminal));
-       for (i = 0; i < terminal->pvt->match_regexes->len; i++) {
-               regex = &g_array_index(terminal->pvt->match_regexes,
+
+       for (i = 0; i < m_match_regexes->len; i++) {
+               regex = &g_array_index(m_match_regexes,
                                       struct vte_match_regex,
                                       i);
                /* Unless this is a hole, clean it up. */
@@ -1255,27 +1248,19 @@ vte_terminal_match_remove_all(VteTerminal *terminal)
                         regex_match_clear (regex);
                }
        }
-       g_array_set_size(terminal->pvt->match_regexes, 0);
-       terminal->pvt->match_hilite_clear();
+       g_array_set_size(m_match_regexes, 0);
+
+       match_hilite_clear();
 }
 
-/**
- * vte_terminal_match_remove:
- * @terminal: a #VteTerminal
- * @tag: the tag of the regex to remove
- *
- * Removes the regular expression which is associated with the given @tag from
- * the list of expressions which the terminal will highlight when the user
- * moves the mouse cursor over matching text.
- */
 void
-vte_terminal_match_remove(VteTerminal *terminal, int tag)
+VteTerminalPrivate::match_remove(int tag)
 {
        struct vte_match_regex *regex;
-       g_return_if_fail(VTE_IS_TERMINAL(terminal));
-       if (terminal->pvt->match_regexes->len > (guint)tag) {
+
+       if (m_match_regexes->len > (guint)tag) {
                /* The tag is an index, so find the corresponding struct. */
-               regex = &g_array_index(terminal->pvt->match_regexes,
+               regex = &g_array_index(m_match_regexes,
                                       struct vte_match_regex,
                                       tag);
                /* If it's already been removed, return. */
@@ -1285,7 +1270,7 @@ vte_terminal_match_remove(VteTerminal *terminal, int tag)
                /* Remove this item and leave a hole in its place. */
                 regex_match_clear (regex);
        }
-       terminal->pvt->match_hilite_clear();
+       match_hilite_clear();
 }
 
 static GdkCursor *
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index 4b674a4..82f7762 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -1578,6 +1578,36 @@ vte_terminal_paste_primary(VteTerminal *terminal)
 }
 
 /**
+ * vte_terminal_match_remove:
+ * @terminal: a #VteTerminal
+ * @tag: the tag of the regex to remove
+ *
+ * Removes the regular expression which is associated with the given @tag from
+ * the list of expressions which the terminal will highlight when the user
+ * moves the mouse cursor over matching text.
+ */
+void
+vte_terminal_match_remove(VteTerminal *terminal, int tag)
+{
+       g_return_if_fail(VTE_IS_TERMINAL(terminal));
+        terminal->pvt->match_remove(tag);
+}
+
+/**
+ * vte_terminal_match_remove_all:
+ * @terminal: a #VteTerminal
+ *
+ * Clears the list of regular expressions the terminal uses to highlight text
+ * when the user moves the mouse cursor.
+ */
+void
+vte_terminal_match_remove_all(VteTerminal *terminal)
+{
+       g_return_if_fail(VTE_IS_TERMINAL(terminal));
+        terminal->pvt->match_remove_all();
+}
+
+/**
  * vte_terminal_search_find_previous:
  * @terminal: a #VteTerminal
  *
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index b0ffeba..97d7c29 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -512,6 +512,8 @@ public:
                           long y);
 
         int regex_match_add(struct vte_match_regex *new_regex_match);
+        void match_remove(int tag);
+        void match_remove_all();
         bool match_rowcol_to_offset(vte::grid::column_t column,
                                     vte::grid::row_t row,
                                     gsize *offset_ptr,


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