[vte] widget: Move some public API to its own file
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] widget: Move some public API to its own file
- Date: Wed, 18 Nov 2015 20:19:46 +0000 (UTC)
commit 620e9dfd4b478c163f08007fd4134d20e3af10ba
Author: Christian Persch <chpe gnome org>
Date: Wed Nov 18 21:15:42 2015 +0100
widget: Move some public API to its own file
src/vte.cc | 70 ++++++++++++++++-----------------------------------
src/vtegtk.cc | 50 +++++++++++++++++++++++++++++++++++++
src/vteinternal.hh | 6 ++++
3 files changed, 78 insertions(+), 48 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 6d43c58..c17b418 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -13066,10 +13066,10 @@ vte_terminal_get_input_enabled (VteTerminal *terminal)
return terminal->pvt->input_enabled;
}
-static gboolean
-process_word_char_exceptions(const char *str,
- gunichar **arrayp,
- gsize *lenp)
+bool
+VteTerminalPrivate::process_word_char_exceptions(char const *str,
+ gunichar **arrayp,
+ gsize *lenp)
{
const char *p;
gunichar *array, c;
@@ -13114,7 +13114,7 @@ process_word_char_exceptions(const char *str,
continue;
g_free(array);
- return FALSE;
+ return false;
}
#if 0
@@ -13129,13 +13129,12 @@ process_word_char_exceptions(const char *str,
*lenp = len;
*arrayp = array;
- return TRUE;
+ return true;
}
-/**
- * vte_terminal_set_word_char_exceptions:
- * @terminal: a #VteTerminal
- * @exceptions: a string of ASCII punctuation characters, or %NULL
+/*
+ * VteTerminalPrivate::set_word_char_exceptions:
+ * @exceptions: a string of ASCII punctuation characters, or %nullptr
*
* With this function you can provide a set of characters which will
* be considered parts of a word when doing word-wise selection, in
@@ -13146,53 +13145,28 @@ process_word_char_exceptions(const char *str,
* must occur only once, and if @exceptions contains the character
* U+002D HYPHEN-MINUS, it must be at the start of the string.
*
- * Use %NULL to reset the set of exception characters to the default.
+ * Use %nullptr to reset the set of exception characters to the default.
*
- * Since: 0.40
+ * Returns: %true if the word char exceptions changed
*/
-void
-vte_terminal_set_word_char_exceptions(VteTerminal *terminal,
- const char *exceptions)
+bool
+VteTerminalPrivate::set_word_char_exceptions(char const* exceptions)
{
gunichar *array;
gsize len;
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
- if (g_strcmp0(exceptions, terminal->pvt->word_char_exceptions_string) == 0)
- return;
+ if (g_strcmp0(exceptions, m_word_char_exceptions_string) == 0)
+ return false;
if (!process_word_char_exceptions(exceptions, &array, &len))
- return;
-
- g_free(terminal->pvt->word_char_exceptions_string);
- terminal->pvt->word_char_exceptions_string = g_strdup(exceptions);
-
- g_free(terminal->pvt->word_char_exceptions);
- terminal->pvt->word_char_exceptions = array;
- terminal->pvt->word_char_exceptions_len = len;
+ return false;
- g_object_notify(G_OBJECT(terminal), "word-char-exceptions");
-}
+ g_free(m_word_char_exceptions_string);
+ m_word_char_exceptions_string = g_strdup(exceptions);
-/**
- * vte_terminal_get_word_char_exceptions:
- * @terminal: a #VteTerminal
- *
- * Returns the set of characters which will be considered parts of a word
- * when doing word-wise selection, in addition to the default which only
- * considers alphanumeric characters part of a word.
- *
- * If %NULL, a built-in set is used.
- *
- * Returns: (transfer none): a string, or %NULL
- *
- * Since: 0.40
- */
-const char *
-vte_terminal_get_word_char_exceptions(VteTerminal *terminal)
-{
- g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL);
+ g_free(m_word_char_exceptions);
+ m_word_char_exceptions = array;
+ m_word_char_exceptions_len = len;
- return terminal->pvt->word_char_exceptions_string;
+ return true;
}
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index 0453aeb..9efa53c 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -1587,3 +1587,53 @@ vte_terminal_set_geometry_hints_for_window(VteTerminal *terminal,
GDK_HINT_MIN_SIZE |
GDK_HINT_BASE_SIZE));
}
+
+/**
+ * vte_terminal_get_word_char_exceptions:
+ * @terminal: a #VteTerminal
+ *
+ * Returns the set of characters which will be considered parts of a word
+ * when doing word-wise selection, in addition to the default which only
+ * considers alphanumeric characters part of a word.
+ *
+ * If %NULL, a built-in set is used.
+ *
+ * Returns: (transfer none): a string, or %NULL
+ *
+ * Since: 0.40
+ */
+const char *
+vte_terminal_get_word_char_exceptions(VteTerminal *terminal)
+{
+ g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL);
+
+ return terminal->pvt->word_char_exceptions_string;
+}
+
+/**
+ * vte_terminal_set_word_char_exceptions:
+ * @terminal: a #VteTerminal
+ * @exceptions: a string of ASCII punctuation characters, or %NULL
+ *
+ * With this function you can provide a set of characters which will
+ * be considered parts of a word when doing word-wise selection, in
+ * addition to the default which only considers alphanumeric characters
+ * part of a word.
+ *
+ * The characters in @exceptions must be non-alphanumeric, each character
+ * must occur only once, and if @exceptions contains the character
+ * U+002D HYPHEN-MINUS, it must be at the start of the string.
+ *
+ * Use %NULL to reset the set of exception characters to the default.
+ *
+ * Since: 0.40
+ */
+void
+vte_terminal_set_word_char_exceptions(VteTerminal *terminal,
+ const char *exceptions)
+{
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
+
+ if (terminal->pvt->set_word_char_exceptions(exceptions))
+ g_object_notify_by_pspec(G_OBJECT(terminal), pspecs[PROP_WORD_CHAR_EXCEPTIONS]);
+}
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index d3ddcbe..75d4c50 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -572,6 +572,11 @@ public:
void feed_focus_event(bool in);
void maybe_feed_focus_event(bool in);
+
+ bool process_word_char_exceptions(char const *str,
+ gunichar **arrayp,
+ gsize *lenp);
+ bool set_word_char_exceptions(char const* exceptions);
};
#define m_invalidated_all invalidated_all
@@ -715,6 +720,7 @@ public:
#define m_current_file_uri current_file_uri
#define m_word_char_exceptions_string word_char_exceptions_string
#define m_word_char_exceptions word_char_exceptions
+#define m_word_char_exceptions_len word_char_exceptions_len
#define m_icon_title icon_title
#define m_selection_start selection_start
#define m_selection_end selection_end
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]