[vte/wip/sixels: 102/111] widget: Catch exceptions in new API
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/wip/sixels: 102/111] widget: Catch exceptions in new API
- Date: Sat, 8 Aug 2020 18:43:03 +0000 (UTC)
commit 14f8d9a50a0bf29dfff88be5914b937e801243de
Author: Christian Persch <chpe src gnome org>
Date: Sat Aug 8 20:42:49 2020 +0200
widget: Catch exceptions in new API
src/vte/vteterminal.h | 6 ++--
src/vtegtk.cc | 81 ++++++++++++++++++++++++++++++---------------------
2 files changed, 51 insertions(+), 36 deletions(-)
---
diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h
index 1244f7cc..e49c0359 100644
--- a/src/vte/vteterminal.h
+++ b/src/vte/vteterminal.h
@@ -507,11 +507,11 @@ gboolean vte_terminal_write_contents_sync (VteTerminal *terminal,
/* Set or get whether inline image support is enabled */
_VTE_PUBLIC
-void vte_terminal_set_images_enabled (VteTerminal *terminal,
- gboolean enabled) _VTE_GNUC_NONNULL(1);
+void vte_terminal_set_images_enabled(VteTerminal *terminal,
+ gboolean enabled) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1);
_VTE_PUBLIC
-gboolean vte_terminal_get_images_enabled (VteTerminal *terminal) _VTE_GNUC_NONNULL(1);
+gboolean vte_terminal_get_images_enabled(VteTerminal *terminal) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(VteTerminal, g_object_unref)
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index 0f7c6b99..ee8b8f3d 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -5570,6 +5570,54 @@ catch (...)
*color = {0., 0., 0., 1.};
}
+/**
+ * vte_terminal_set_images_enabled:
+ * @terminal: a #VteTerminal
+ * @enabled: %TRUE to enable images, %FALSE otherwise.
+ *
+ * Set whether to enable inline images, e.g. SIXELs.
+ *
+ * Since: 0.62
+ */
+void
+vte_terminal_set_images_enabled(VteTerminal *terminal,
+ gboolean enabled) noexcept
+try
+{
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
+
+ if (IMPL(terminal)->set_images_enabled(enabled))
+ g_object_notify_by_pspec(G_OBJECT(terminal), pspecs[PROP_IMAGES_ENABLED]);
+}
+catch (...)
+{
+ vte::log_exception();
+}
+
+/**
+ * vte_terminal_get_images_enabled:
+ * @terminal: a #VteTerminal
+ *
+ * Get whether to enable inline images, e.g. SIXELs.
+ *
+ * Returns: %TRUE if image support is enabled, %FALSE otherwise.
+ *
+ * Since: 0.62
+ */
+gboolean
+vte_terminal_get_images_enabled(VteTerminal *terminal) noexcept
+try
+{
+ g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
+
+ return IMPL(terminal)->m_images_enabled;
+}
+catch (...)
+{
+ vte::log_exception();
+ return false;
+}
+
namespace vte {
using namespace std::literals;
@@ -5674,36 +5722,3 @@ catch (...)
} // namespace glib
} // namespace vte
-
-/**
- * vte_terminal_set_images_enabled:
- * @terminal: a #VteTerminal
- * @enabled: %TRUE to enable images, %FALSE otherwise.
- *
- * Set whether to enable inline images, e.g. sixels.
- */
-void
-vte_terminal_set_images_enabled(VteTerminal *terminal, gboolean enabled)
-{
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
- if (IMPL(terminal)->set_images_enabled(enabled))
- g_object_notify_by_pspec(G_OBJECT(terminal), pspecs[PROP_IMAGES_ENABLED]);
-}
-
-/**
- * vte_terminal_get_images_enabled:
- * @terminal: a #VteTerminal
- *
- * Get whether to enable inline images, e.g. sixels.
- *
- * Returns: %TRUE if image support is enabled, %FALSE otherwise.
- */
-
-gboolean
-vte_terminal_get_images_enabled(VteTerminal *terminal)
-{
- g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
-
- return IMPL(terminal)->m_images_enabled;
-}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]