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



commit 6ef6503e6f51b6f173018de1b810cb2566b06f41
Author: Christian Persch <chpe gnome org>
Date:   Wed Nov 18 21:15:44 2015 +0100

    widget: Move some public API to its own file

 src/vte.cc         |   48 +++++++++++++-----------------------------------
 src/vtegtk.cc      |   37 +++++++++++++++++++++++++++++++++++++
 src/vteinternal.hh |    3 +++
 3 files changed, 53 insertions(+), 35 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index b2486ad..2ab9ca0 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -10938,46 +10938,24 @@ vte_terminal_get_allow_bold(VteTerminal *terminal)
        return terminal->pvt->allow_bold;
 }
 
-/**
- * vte_terminal_set_scroll_on_output:
- * @terminal: a #VteTerminal
- * @scroll: whether the terminal should scroll on output
- *
- * Controls whether or not the terminal will forcibly scroll to the bottom of
- * the viewable history when the new data is received from the child.
- */
-void
-vte_terminal_set_scroll_on_output(VteTerminal *terminal, gboolean scroll)
+bool
+VteTerminalPrivate::set_scroll_on_output(bool scroll)
 {
-       g_return_if_fail(VTE_IS_TERMINAL(terminal));
-       terminal->pvt->scroll_on_output = scroll;
+        if (scroll == m_scroll_on_output)
+                return false;
+
+        m_scroll_on_output = scroll;
+        return true;
 }
 
-/**
- * vte_terminal_set_scroll_on_keystroke:
- * @terminal: a #VteTerminal
- * @scroll: whether the terminal should scroll on keystrokes
- *
- * Controls whether or not the terminal will forcibly scroll to the bottom of
- * the viewable history when the user presses a key.  Modifier keys do not
- * trigger this behavior.
- */
-void
-vte_terminal_set_scroll_on_keystroke(VteTerminal *terminal, gboolean scroll)
+bool
+VteTerminalPrivate::set_scroll_on_keystroke(bool scroll)
 {
-        VteTerminalPrivate *pvt;
-
-       g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
-        pvt = terminal->pvt;
-
-        scroll = scroll != FALSE;
-        if (scroll == pvt->scroll_on_keystroke)
-                return;
-
-       pvt->scroll_on_keystroke = scroll;
+        if (scroll == m_scroll_on_keystroke)
+                return false;
 
-        g_object_notify (G_OBJECT (terminal), "scroll-on-keystroke");
+        m_scroll_on_keystroke = scroll;
+        return true;
 }
 
 bool
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index 719ae11..6fb198d 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -2188,6 +2188,43 @@ vte_terminal_set_scrollback_lines(VteTerminal *terminal, glong lines)
 }
 
 /**
+ * vte_terminal_set_scroll_on_keystroke:
+ * @terminal: a #VteTerminal
+ * @scroll: whether the terminal should scroll on keystrokes
+ *
+ * Controls whether or not the terminal will forcibly scroll to the bottom of
+ * the viewable history when the user presses a key.  Modifier keys do not
+ * trigger this behavior.
+ */
+void
+vte_terminal_set_scroll_on_keystroke(VteTerminal *terminal,
+                                     gboolean scroll)
+{
+       g_return_if_fail(VTE_IS_TERMINAL(terminal));
+
+        if (terminal->pvt->set_scroll_on_keystroke(scroll != FALSE))
+                g_object_notify_by_pspec(G_OBJECT(terminal), pspecs[PROP_SCROLL_ON_OUTPUT]);
+}
+
+/**
+ * vte_terminal_set_scroll_on_output:
+ * @terminal: a #VteTerminal
+ * @scroll: whether the terminal should scroll on output
+ *
+ * Controls whether or not the terminal will forcibly scroll to the bottom of
+ * the viewable history when the new data is received from the child.
+ */
+void
+vte_terminal_set_scroll_on_output(VteTerminal *terminal,
+                                  gboolean scroll)
+{
+       g_return_if_fail(VTE_IS_TERMINAL(terminal));
+
+        if (terminal->pvt->set_scroll_on_output(scroll != FALSE))
+                g_object_notify_by_pspec(G_OBJECT(terminal), pspecs[PROP_SCROLL_ON_OUTPUT]);
+}
+
+/**
  * vte_terminal_get_window_title:
  * @terminal: a #VteTerminal
  *
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 0caf513..5207f42 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -617,6 +617,8 @@ public:
         bool set_pty(VtePty *pty);
         bool set_rewrap_on_resize(bool rewrap);
         bool set_scrollback_lines(long lines);
+        bool set_scroll_on_keystroke(bool scroll);
+        bool set_scroll_on_output(bool scroll);
         bool set_word_char_exceptions(char const* exceptions);
 
         bool write_contents_sync (GOutputStream *stream,
@@ -684,6 +686,7 @@ public:
 #define m_alternate_screen alternate_screen
 #define m_meta_sends_escape meta_sends_escape
 #define m_scroll_on_keystroke scroll_on_keystroke
+#define m_scroll_on_output scroll_on_output
 #define m_cursor_mode cursor_mode
 #define m_keypad_mode keypad_mode
 #define m_has_selection has_selection


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