[libvtemm] Add write_contents() methods.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libvtemm] Add write_contents() methods.
- Date: Thu, 14 Jan 2010 08:59:44 +0000 (UTC)
commit bc2a1eb26ce48b4d8a7edd9c92db161da5ab0fd5
Author: Krzesimir Nowak <qdlacz gmail com>
Date: Thu Jan 14 09:35:58 2010 +0100
Add write_contents() methods.
* libvte/src/terminal.ccg:
* libvte/src/terminal.hg: Added write_contents() methods and
TerminalWriteFlags enum and documented them.
* docs/reference/Doxyfile.in: Added an alias for newin command used
in newly added method documentation.
* configure.ac: Bumped dependencies and added new one - new methods
use OutputStream and Cancellable from giomm.
configure.ac | 2 +-
docs/reference/Doxyfile.in | 2 +-
libvte/src/terminal.ccg | 50 ++++++++++++++++++++++++++++++++++++
libvte/src/terminal.hg | 60 +++++++++++++++++++++++++++++++++++++++++++-
4 files changed, 111 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ecd3bb1..f227b66 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,7 @@ AC_SUBST([LIBVTEMM_SO_VERSION], [10:0:1])
LT_INIT([win32-dll disable-static])
AC_PROG_CXX
-AC_SUBST([LIBVTEMM_MODULES], ['glibmm-2.4 >= 2.18.0 pangomm-1.4 >= 2.24.0 gtkmm-2.4 >= 2.19.2 vte >= 0.23.2'])
+AC_SUBST([LIBVTEMM_MODULES], ['glibmm-2.4 >= 2.22.0 pangomm-1.4 >= 2.24.0 gtkmm-2.4 >= 2.19.2 vte >= 0.23.5 giomm-2.4'])
PKG_CHECK_MODULES([LIBVTEMM], [$LIBVTEMM_MODULES])
MM_PKG_CONFIG_SUBST([GTHREAD_CFLAGS], [--cflags-only-other gthread-2.0])
diff --git a/docs/reference/Doxyfile.in b/docs/reference/Doxyfile.in
index 6887002..2354a19 100644
--- a/docs/reference/Doxyfile.in
+++ b/docs/reference/Doxyfile.in
@@ -31,7 +31,7 @@ MULTILINE_CPP_IS_BRIEF = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
-ALIASES =
+ALIASES = "newin{2}=\xrefitem since_\1_\2 \"Since @PACKAGE_NAME@ \1.\2\" \"New API in @PACKAGE_NAME@ \1.\2\""
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
diff --git a/libvte/src/terminal.ccg b/libvte/src/terminal.ccg
index 3f28388..3b6e53e 100644
--- a/libvte/src/terminal.ccg
+++ b/libvte/src/terminal.ccg
@@ -205,6 +205,56 @@ Terminal::get_padding() const
return Padding(border.left + border.right, border.top + border.bottom);
}
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+bool
+Terminal::write_contents(const Glib::RefPtr<Gio::OutputStream>& stream, const Glib::RefPtr<Gio::Cancellable>& cancellable, TerminalWriteFlags flags)
+#else
+bool
+Terminal::write_contents(const Glib::RefPtr<Gio::OutputStream>& stream, const Glib::RefPtr<Gio::Cancellable>& cancellable, TerminalWriteFlags flags, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+ GError* gerror = 0;
+ bool retvalue = vte_terminal_write_contents(gobj(), Glib::unwrap(stream), static_cast<VteTerminalWriteFlags>(flags), Glib::unwrap(cancellable), &gerror);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if (gerror)
+ {
+ ::Glib::Error::throw_exception(gerror);
+ }
+#else
+ if (gerror)
+ {
+ error = ::Glib::Error::throw_exception(gerror);
+ }
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+ return retvalue;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+bool
+Terminal::write_contents(const Glib::RefPtr<Gio::OutputStream>& stream, TerminalWriteFlags flags)
+#else
+bool
+Terminal::write_contents(const Glib::RefPtr<Gio::OutputStream>& stream, TerminalWriteFlags flags, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+ GError* gerror = 0;
+ bool retvalue = vte_terminal_write_contents(gobj(), Glib::unwrap(stream), static_cast<VteTerminalWriteFlags>(flags), 0, &gerror);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if (gerror)
+ {
+ ::Glib::Error::throw_exception(gerror);
+ }
+#else
+ if (gerror)
+ {
+ error = ::Glib::Error::throw_exception(gerror);
+ }
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+ return retvalue;
+}
+
} // namespace Vte
} // namespace Gnome
diff --git a/libvte/src/terminal.hg b/libvte/src/terminal.hg
index c4ec14e..c7e722c 100644
--- a/libvte/src/terminal.hg
+++ b/libvte/src/terminal.hg
@@ -24,6 +24,8 @@ _DEFS(libvtemm,libvte)
_PINCLUDE(gtkmm/private/widget_p.h)
#include <sigc++/slot.h>
+#include <giomm/cancellable.h>
+#include <giomm/outputstream.h>
#include <gdkmm/color.h>
#include <gdkmm/pixbuf.h>
#include <gdkmm/cursor.h>
@@ -106,19 +108,32 @@ _WRAP_ENUM(TerminalCursorShape, VteTerminalCursorShape)
* Draw a horizontal bar below the character.
*/
+/** TerminalWriteFlags - A flag type to determine how terminal contents should
+ * be written to an output stream.
+ */
+_WRAP_ENUM(TerminalWriteFlags, VteTerminalWriteFlags)
+/** @var TerminalWriteFlags TERMINAL_WRITE_DEFAULT
+ * Write contents as UTF-8 text - this is the default.
+ */
+
/** Terminal - a terminal emulator implemented as a gtkmm widget.
*/
class Terminal : public Gtk::Widget
{
_CLASS_GTKOBJECT(Terminal, VteTerminal, VTE_TERMINAL, Gtk::Widget, GtkWidget)
+ // wrapped by hand
_IGNORE(vte_terminal_feed, vte_terminal_feed_child, vte_terminal_feed_child_binary,
vte_terminal_set_colors, vte_terminal_get_text, vte_terminal_get_text_include_trailing_spaces,
vte_terminal_get_text_range, vte_terminal_get_cursor_position, vte_terminal_match_check,
- vte_terminal_get_padding, vte_terminal_fork_command, vte_terminal_forkpty)
+ vte_terminal_get_padding, vte_terminal_fork_command, vte_terminal_forkpty,
+ vte_terminal_write_contents)
+ // deprecated
_IGNORE(vte_terminal_set_cursor_blinks, vte_terminal_set_font_full, vte_terminal_get_using_xft,
vte_terminal_set_font_from_string_full, vte_terminal_match_add, vte_terminal_get_char_ascent,
vte_terminal_get_char_descent)
+ // bogus
+ _IGNORE(vte_terminal_accessible_new)
public:
_CTOR_DEFAULT()
@@ -611,6 +626,49 @@ public:
*/
_WRAP_METHOD(int get_child_exit_status() const, vte_terminal_get_child_exit_status)
+ /** Write contents of the current contents of terminal (including any
+ * scrollback history) to @a stream according to @a flags.
+ *
+ * The operation can be cancelled by triggering the cancellable object from
+ * another thread. If the operation was cancelled, the Gio::Error with
+ * CANCELLED will be thrown.
+ *
+ * This is a synchronous operation and will make the widget (and input
+ * processing) during the write operation, which may take a long time
+ * depending on scrollback history and @a stream availability for writing.
+ *
+ * @param stream A Gio::OutputStream to write to.
+ * @param cancellable Optional Gio::Cancellable object.
+ * @param flags A set of TerminalWriteFlags.
+ * @return @c true on success, @c false if there was an error.
+ *
+ * @newin{0,24}
+ */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ bool write_contents(const Glib::RefPtr<Gio::OutputStream>& stream, const Glib::RefPtr<Gio::Cancellable>& cancellable, TerminalWriteFlags flags = TERMINAL_WRITE_DEFAULT);
+#else
+ bool write_contents(const Glib::RefPtr<Gio::OutputStream>& stream, const Glib::RefPtr<Gio::Cancellable>& cancellable, TerminalWriteFlags flags, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+ /** Write contents of the current contents of terminal (including any
+ * scrollback history) to @a stream according to @a flags.
+ *
+ * This is a synchronous operation and will make the widget (and input
+ * processing) during the write operation, which may take a long time
+ * depending on scrollback history and @a stream availability for writing.
+ *
+ * @param stream A Gio::OutputStream to write to.
+ * @param flags A set of TerminalWriteFlags.
+ * @return @c true on success, @c false if there was an error.
+ *
+ * @newin{0,24}
+ */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ bool write_contents(const Glib::RefPtr<Gio::OutputStream>& stream, TerminalWriteFlags flags = TERMINAL_WRITE_DEFAULT);
+#else
+ bool write_contents(const Glib::RefPtr<Gio::OutputStream>& stream, TerminalWriteFlags flags, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
_WRAP_SIGNAL(void eof(), "eof")
_WRAP_SIGNAL(void child_exited(), "child-exited")
_WRAP_SIGNAL(void emulation_changed(), "emulation-changed")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]