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



commit 6b838455866a14aa19a3d67ad67d9eb81fb61a1f
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         |   91 +++++++--------------------------------------------
 src/vtegtk.cc      |   70 ++++++++++++++++++++++++++++++++++++++++
 src/vteinternal.hh |    2 +
 3 files changed, 85 insertions(+), 78 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 2ab9ca0..0bcd6dd 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -10851,91 +10851,26 @@ VteTerminalPrivate::widget_scroll(GdkEventScroll *event)
        }
 }
 
-/**
- * vte_terminal_set_audible_bell:
- * @terminal: a #VteTerminal
- * @is_audible: %TRUE if the terminal should beep
- *
- * Controls whether or not the terminal will beep when the child outputs the
- * "bl" sequence.
- */
-void
-vte_terminal_set_audible_bell(VteTerminal *terminal, gboolean is_audible)
+bool
+VteTerminalPrivate::set_audible_bell(bool setting)
 {
-        VteTerminalPrivate *pvt;
-
-       g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
-        pvt = terminal->pvt;
-
-        is_audible = is_audible != FALSE;
-        if (is_audible == pvt->audible_bell)
-                return;
-
-       pvt->audible_bell = is_audible;
-
-        g_object_notify (G_OBJECT (terminal), "audible-bell");
-}
+        if (setting == m_audible_bell)
+                return false;
 
-/**
- * vte_terminal_get_audible_bell:
- * @terminal: a #VteTerminal
- *
- * Checks whether or not the terminal will beep when the child outputs the
- * "bl" sequence.
- *
- * Returns: %TRUE if audible bell is enabled, %FALSE if not
- */
-gboolean
-vte_terminal_get_audible_bell(VteTerminal *terminal)
-{
-       g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
-       return terminal->pvt->audible_bell;
+       m_audible_bell = setting;
+        return true;
 }
 
-/**
- * vte_terminal_set_allow_bold:
- * @terminal: a #VteTerminal
- * @allow_bold: %TRUE if the terminal should attempt to draw bold text
- *
- * Controls whether or not the terminal will attempt to draw bold text,
- * either by using a bold font variant or by repainting text with a different
- * offset.
- *
- */
-void
-vte_terminal_set_allow_bold(VteTerminal *terminal, gboolean allow_bold)
+bool
+VteTerminalPrivate::set_allow_bold(bool setting)
 {
-        VteTerminalPrivate *pvt;
-
-       g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
-        pvt = terminal->pvt;
-
-        allow_bold = allow_bold != FALSE;
-        if (allow_bold == pvt->allow_bold)
-                return;
-
-       pvt->allow_bold = allow_bold;
-        g_object_notify (G_OBJECT (terminal), "allow-bold");
+        if (setting == m_allow_bold)
+                return false;
 
-       _vte_invalidate_all (terminal);
-}
+       m_allow_bold = setting;
+       invalidate_all();
 
-/**
- * vte_terminal_get_allow_bold:
- * @terminal: a #VteTerminal
- *
- * Checks whether or not the terminal will attempt to draw bold text by
- * repainting text with a one-pixel offset.
- *
- * Returns: %TRUE if bolding is enabled, %FALSE if not
- */
-gboolean
-vte_terminal_get_allow_bold(VteTerminal *terminal)
-{
-       g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
-       return terminal->pvt->allow_bold;
+        return true;
 }
 
 bool
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index 6fb198d..e38c523 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -1717,6 +1717,76 @@ vte_terminal_search_get_wrap_around (VteTerminal *terminal)
 }
 
 /**
+ * vte_terminal_get_allow_bold:
+ * @terminal: a #VteTerminal
+ *
+ * Checks whether or not the terminal will attempt to draw bold text by
+ * repainting text with a one-pixel offset.
+ *
+ * Returns: %TRUE if bolding is enabled, %FALSE if not
+ */
+gboolean
+vte_terminal_get_allow_bold(VteTerminal *terminal)
+{
+       g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
+       return terminal->pvt->allow_bold;
+}
+
+/**
+ * vte_terminal_set_allow_bold:
+ * @terminal: a #VteTerminal
+ * @allow_bold: %TRUE if the terminal should attempt to draw bold text
+ *
+ * Controls whether or not the terminal will attempt to draw bold text,
+ * either by using a bold font variant or by repainting text with a different
+ * offset.
+ *
+ */
+void
+vte_terminal_set_allow_bold(VteTerminal *terminal,
+                            gboolean allow_bold)
+{
+        g_return_if_fail(VTE_IS_TERMINAL(terminal));
+
+        if (terminal->pvt->set_allow_bold(allow_bold != FALSE))
+                g_object_notify_by_pspec(G_OBJECT(terminal), pspecs[PROP_ALLOW_BOLD]);
+}
+
+/**
+ * vte_terminal_get_audible_bell:
+ * @terminal: a #VteTerminal
+ *
+ * Checks whether or not the terminal will beep when the child outputs the
+ * "bl" sequence.
+ *
+ * Returns: %TRUE if audible bell is enabled, %FALSE if not
+ */
+gboolean
+vte_terminal_get_audible_bell(VteTerminal *terminal)
+{
+       g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
+       return terminal->pvt->audible_bell;
+}
+
+/**
+ * vte_terminal_set_audible_bell:
+ * @terminal: a #VteTerminal
+ * @is_audible: %TRUE if the terminal should beep
+ *
+ * Controls whether or not the terminal will beep when the child outputs the
+ * "bl" sequence.
+ */
+void
+vte_terminal_set_audible_bell(VteTerminal *terminal,
+                              gboolean is_audible)
+{
+        g_return_if_fail(VTE_IS_TERMINAL(terminal));
+
+        if (terminal->pvt->set_audible_bell(is_audible != FALSE))
+                g_object_notify_by_pspec(G_OBJECT(terminal), pspecs[PROP_AUDIBLE_BELL]);
+}
+
+/**
  * vte_terminal_set_backspace_binding:
  * @terminal: a #VteTerminal
  * @binding: a #VteEraseBinding for the backspace key
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 5207f42..b24484a 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -608,6 +608,8 @@ public:
         long get_char_height() { ensure_font(); return char_height; }
         long get_char_width()  { ensure_font(); return char_width;  }
 
+        bool set_audible_bell(bool setting);
+        bool set_allow_bold(bool setting);
         bool set_backspace_binding(VteEraseBinding binding);
         bool set_cursor_blink_mode(VteCursorBlinkMode mode);
         bool set_cursor_shape(VteCursorShape shape);


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