[vte] widget: Move some methods to VteTerminalPrivate



commit 0c4386edf91051dbb43ee375b5bc6c5a9cbf00d3
Author: Christian Persch <chpe gnome org>
Date:   Sat Jan 30 18:19:26 2016 +0100

    widget: Move some methods to VteTerminalPrivate

 src/vte-private.h |    3 ---
 src/vte.cc        |   44 --------------------------------------------
 src/vteaccess.cc  |   25 ++++++++++++-------------
 3 files changed, 12 insertions(+), 60 deletions(-)
---
diff --git a/src/vte-private.h b/src/vte-private.h
index 478b02d..d94fcef 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -54,9 +54,6 @@
 G_BEGIN_DECLS
 
 VteTerminalPrivate *_vte_terminal_get_impl(VteTerminal *terminal);
-char* _vte_terminal_get_selection(VteTerminal *terminal);
-void _vte_terminal_get_start_selection(VteTerminal *terminal, long *x, long *y);
-void _vte_terminal_get_end_selection(VteTerminal *terminal, long *x, long *y);
 void _vte_terminal_select_text(VteTerminal *terminal, long start_x, long start_y, long end_x, long end_y, 
int start_offset, int end_offset);
 
 VteRowData *_vte_terminal_ensure_row(VteTerminal *terminal);
diff --git a/src/vte.cc b/src/vte.cc
index bd9ec5c..0e10aab 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -10397,50 +10397,6 @@ VteTerminalPrivate::subscribe_accessible_events()
        m_accessible_emit = true;
 }
 
-char *
-_vte_terminal_get_selection(VteTerminal *terminal)
-{
-       g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL);
-
-       return g_strdup (terminal->pvt->selection_text[VTE_SELECTION_PRIMARY]);
-}
-
-void
-_vte_terminal_get_start_selection(VteTerminal *terminal, long *col, long *row)
-{
-       VteVisualPosition ss;
-
-       g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
-       ss = terminal->pvt->selection_start;
-
-       if (col) {
-               *col = ss.col;
-       }
-
-       if (row) {
-               *row = ss.row;
-       }
-}
-
-void
-_vte_terminal_get_end_selection(VteTerminal *terminal, long *col, long *row)
-{
-       VteVisualPosition se;
-
-       g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
-       se = terminal->pvt->selection_end;
-
-       if (col) {
-               *col = se.col;
-       }
-
-       if (row) {
-               *row = se.row;
-       }
-}
-
 void
 _vte_terminal_select_text(VteTerminal *terminal,
                          long start_col, long start_row,
diff --git a/src/vteaccess.cc b/src/vteaccess.cc
index edc691e..70a823c 100644
--- a/src/vteaccess.cc
+++ b/src/vteaccess.cc
@@ -1408,8 +1408,9 @@ vte_terminal_accessible_get_selection(AtkText *text, gint selection_number,
         VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(text);
        VteTerminalAccessiblePrivate *priv = (VteTerminalAccessiblePrivate 
*)_vte_terminal_accessible_get_instance_private(accessible);
        GtkWidget *widget;
-       VteTerminal *terminal;
-       long start_x, start_y, end_x, end_y;
+
+       if (selection_number != 0)
+               return NULL;
 
        vte_terminal_accessible_update_private_data_if_needed(accessible,
                                                              NULL, NULL);
@@ -1419,20 +1420,18 @@ vte_terminal_accessible_get_selection(AtkText *text, gint selection_number,
                return NULL;
        }
 
-       terminal = VTE_TERMINAL (widget);
-       if (!vte_terminal_get_has_selection (terminal)) {
-               return NULL;
-       }
-       if (selection_number != 0) {
+        auto impl = IMPL_FROM_WIDGET(widget);
+
+       if (!impl->m_has_selection)
                return NULL;
-       }
 
-       _vte_terminal_get_start_selection (terminal, &start_x, &start_y);
+        auto start_sel = impl->selection_start;
+        auto end_sel = impl->selection_end;
+
+       *start_offset = offset_from_xy (priv, start_sel.col, start_sel.row);
+       *end_offset = offset_from_xy (priv, end_sel.col, end_sel.row);
 
-       *start_offset = offset_from_xy (priv, start_x, start_y);
-       _vte_terminal_get_end_selection (terminal, &end_x, &end_y);
-       *end_offset = offset_from_xy (priv, end_x, end_y);
-       return _vte_terminal_get_selection (terminal);
+       return g_strdup(impl->m_selection_text[VTE_SELECTION_PRIMARY]);
 }
 
 static gboolean


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