[vte/vte-next: 118/223] Add VteBuffer
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-next: 118/223] Add VteBuffer
- Date: Wed, 22 Jun 2011 20:58:31 +0000 (UTC)
commit 1e96ee28c8efc68f75b5468cffa46734a6ec2597
Author: Christian Persch <chpe gnome org>
Date: Tue Jun 7 20:50:37 2011 +0200
Add VteBuffer
doc/reference/vte-docs.xml | 3 +
doc/reference/vte-sections.txt | 22 ++++++
src/Makefile.am | 4 +-
src/vte-private.h | 11 +++
src/vte.c | 148 ++++++++++++++++++++++++++++++++++++++++
src/vte.h | 7 ++
src/vtebuffer.h | 63 +++++++++++++++++
7 files changed, 256 insertions(+), 2 deletions(-)
---
diff --git a/doc/reference/vte-docs.xml b/doc/reference/vte-docs.xml
index f98b968..67276bd 100644
--- a/doc/reference/vte-docs.xml
+++ b/doc/reference/vte-docs.xml
@@ -53,6 +53,9 @@
<part>
<title>API Reference</title>
<chapter>
+ <xi:include href="xml/vte-buffer.xml"/>
+ </chapter>
+ <chapter>
<xi:include href="xml/vte-terminal.xml"/>
</chapter>
<chapter>
diff --git a/doc/reference/vte-sections.txt b/doc/reference/vte-sections.txt
index f087f93..71a4e37 100644
--- a/doc/reference/vte-sections.txt
+++ b/doc/reference/vte-sections.txt
@@ -9,6 +9,7 @@ VteTerminalEraseBinding
VteTerminalWriteFlags
VteSelectionFunc
vte_terminal_new
+vte_terminal_get_buffer
vte_terminal_im_append_menuitems
vte_terminal_feed
vte_terminal_feed_child
@@ -109,6 +110,27 @@ VteTerminalClassPrivate
</SECTION>
<SECTION>
+<FILE>vte-buffer</FILE>
+<TITLE>VteBuffer</TITLE>
+VteBuffer
+vte_buffer_new
+
+<SUBSECTION Standard>
+VTE_TYPE_BUFFER
+vte_buffer_get_type
+VTE_IS_BUFFER
+VTE_BUFFER
+VTE_BUFFER_GET_CLASS
+VTE_IS_BUFFER_CLASS
+VTE_BUFFER_CLASS
+VteBufferClass
+
+<SUBSECTION Private>
+VteBufferPrivate
+VteBufferClassPrivate
+</SECTION>
+
+<SECTION>
<FILE>vte-pty</FILE>
<TITLE>Vte PTY</TITLE>
VtePtyFlags
diff --git a/src/Makefile.am b/src/Makefile.am
index 56b4a90..0dc1173 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,7 +5,7 @@ EXTRA_DIST = iso2022.txt palette.c
# The library
headerdir = $(includedir)/vte-$(VTE_API_VERSION)/vte
-header_HEADERS = vte.h vtepty.h vtetypebuiltins.h vteversion.h
+header_HEADERS = vte.h vtebuffer.h vtepty.h vtetypebuiltins.h vteversion.h
lib_LTLIBRARIES = libvte VTE_LIBRARY_SUFFIX_U@.la
@@ -98,7 +98,7 @@ libvte VTE_LIBRARY_SUFFIX_U@_la_LIBADD = $(VTE_LIBS)
libvte VTE_LIBRARY_SUFFIX_U@_la_LDFLAGS = \
$(VTE_LDFLAGS) \
-version-info $(LT_VERSION_INFO) \
- -export-symbols-regex "^vte_terminal_.*|^vte_pty_.*|^vte_get_.*" \
+ -export-symbols-regex "^vte_buffer_.*|^vte_terminal_.*|^vte_pty_.*|^vte_get_.*" \
@LIBTOOL_EXPORT_OPTIONS@ @LIBTOOL_FLAGS@ \
$(AM_LDFLAGS)
diff --git a/src/vte-private.h b/src/vte-private.h
index a9309c4..9c9ace7 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -147,8 +147,19 @@ typedef struct _VteVisualPosition {
long row, col;
} VteVisualPosition;
+struct _VteBufferPrivate {
+ gpointer dummy;
+};
+
+struct _VteBufferClassPrivate {
+ gpointer dummy;
+};
+
/* Terminal private data. */
struct _VteTerminalPrivate {
+
+ VteBuffer *buffer;
+
/* Metric and sizing data: dimensions of the window */
glong row_count;
glong column_count;
diff --git a/src/vte.c b/src/vte.c
index f5fd246..54e0734 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -136,6 +136,7 @@ static guint signals[LAST_SIGNAL];
enum {
PROP_0,
+ PROP_BUFFER,
PROP_HADJUSTMENT,
PROP_VADJUSTMENT,
PROP_HSCROLL_POLICY,
@@ -2159,6 +2160,22 @@ vte_terminal_new(void)
return g_object_new(VTE_TYPE_TERMINAL, NULL);
}
+/**
+ * vte_terminal_get_buffer:
+ * @terminal: a #VteTerminal
+ *
+ * Returns: (transfer none): the terminal's buffer
+ *
+ * Since: 0.30
+ */
+VteBuffer *
+vte_terminal_get_buffer(VteTerminal *terminal)
+{
+ g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL);
+
+ return terminal->pvt->buffer;
+}
+
/* Set up a palette entry with a more-or-less match for the requested color. */
static void
vte_terminal_set_color_internal(VteTerminal *terminal,
@@ -7530,6 +7547,9 @@ vte_terminal_init(VteTerminal *terminal)
/* Initialize private data. */
pvt = terminal->pvt = G_TYPE_INSTANCE_GET_PRIVATE (terminal, VTE_TYPE_TERMINAL, VteTerminalPrivate);
+ pvt->buffer = vte_buffer_new();
+ terminal->buffer_pvt = pvt->buffer->pvt;
+
gtk_widget_set_can_focus(&terminal->widget, TRUE);
gtk_widget_set_app_paintable (&terminal->widget, TRUE);
@@ -8132,6 +8152,11 @@ vte_terminal_finalize(GObject *object)
0, 0, NULL, NULL,
terminal);
+ if (pvt->buffer != NULL) {
+ g_object_unref(pvt->buffer);
+ pvt->buffer = NULL;
+ }
+
/* Call the inherited finalize() method. */
G_OBJECT_CLASS(vte_terminal_parent_class)->finalize(object);
}
@@ -10535,6 +10560,9 @@ vte_terminal_get_property (GObject *object,
switch (prop_id)
{
+ case PROP_BUFFER:
+ g_value_set_object (value, pvt->buffer);
+ break;
case PROP_HADJUSTMENT:
g_value_set_object (value, pvt->hadjustment);
break;
@@ -10665,6 +10693,7 @@ vte_terminal_set_property (GObject *object,
break;
/* Not writable */
+ case PROP_BUFFER:
case PROP_ICON_TITLE:
case PROP_WINDOW_TITLE:
g_assert_not_reached ();
@@ -11273,6 +11302,20 @@ vte_terminal_class_init(VteTerminalClass *klass)
G_TYPE_NONE, 0);
/**
+ * VteTerminal:buffer:
+ *
+ * The terminal's buffer.
+ *
+ * Since: 0.30
+ */
+ g_object_class_install_property
+ (gobject_class,
+ PROP_AUDIBLE_BELL,
+ g_param_spec_object ("buffer", NULL, NULL,
+ VTE_TYPE_BUFFER,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+ /**
* VteTerminal:audible-bell:
*
* Controls whether or not the terminal will beep when the child outputs the
@@ -13598,3 +13641,108 @@ vte_terminal_search_find_next (VteTerminal *terminal)
{
return vte_terminal_search_find (terminal, FALSE);
}
+
+/* *********
+ * VteBuffer
+ * *********
+ */
+
+/**
+ * SECTION: vte-buffer
+ * @short_description: FIXME
+ *
+ * Long description FIXME.
+ *
+ * Since: 0.30
+ */
+
+#ifdef VTE_DEBUG
+G_DEFINE_TYPE_WITH_CODE(VteBuffer, vte_buffer, G_TYPE_OBJECT,
+ g_type_add_class_private (g_define_type_id, sizeof (VteBufferClassPrivate));
+ _vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_buffer_get_type()\n");
+ )
+#else
+G_DEFINE_TYPE_WITH_CODE(VteBuffer, vte_buffer, VTE_TYPE_TERMINAL,
+ g_type_add_class_private (g_define_type_id, sizeof (VteBufferClassPrivate));
+ )
+#endif
+
+static void
+vte_buffer_init(VteBuffer *buffer)
+{
+ VteBufferPrivate *pvt;
+
+ _vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_buffer_init()\n");
+
+ pvt = buffer->pvt = G_TYPE_INSTANCE_GET_PRIVATE (buffer, VTE_TYPE_BUFFER, VteBufferPrivate);
+}
+
+static void
+vte_buffer_dispose(GObject *object)
+{
+ _vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_buffer_dispose()\n");
+
+ G_OBJECT_CLASS(vte_buffer_parent_class)->dispose(object);
+}
+
+static void
+vte_buffer_finalize(GObject *object)
+{
+ _vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_buffer_finalize()\n");
+
+ G_OBJECT_CLASS(vte_buffer_parent_class)->finalize(object);
+}
+
+static void
+vte_buffer_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ return;
+ }
+}
+
+static void
+vte_buffer_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ return;
+ }
+}
+
+static void
+vte_buffer_class_init(VteBufferClass *klass)
+{
+ GObjectClass *gobject_class = &klass->object_class;
+
+ _vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_buffer_class_init()\n");
+
+ g_type_class_add_private(klass, sizeof (VteBufferPrivate));
+
+ gobject_class->dispose = vte_buffer_dispose;
+ gobject_class->finalize = vte_buffer_finalize;
+ gobject_class->get_property = vte_buffer_get_property;
+ gobject_class->set_property = vte_buffer_set_property;
+}
+
+/**
+ * vte_buffer_new:
+ *
+ * Returns: (transfer full): a new #VteBuffer
+ *
+ * Since: 0.30
+ */
+VteBuffer *
+vte_buffer_new(void)
+{
+ return g_object_new(VTE_TYPE_BUFFER, NULL);
+}
diff --git a/src/vte.h b/src/vte.h
index d225a1a..5e29aaa 100644
--- a/src/vte.h
+++ b/src/vte.h
@@ -27,6 +27,8 @@
#define __VTE_VTE_H_INSIDE__ 1
#include "vtepty.h"
+#include "vtebuffer.h"
+
#include "vtetypebuiltins.h"
#include "vteversion.h"
@@ -53,6 +55,9 @@ struct _VteTerminal {
GtkWidget widget;
/*< private >*/
VteTerminalPrivate *pvt;
+
+ /* temporary hack! FIXMEchpe */
+ VteBufferPrivate *buffer_pvt;
};
/**
@@ -202,6 +207,8 @@ GType vte_terminal_get_type(void);
GtkWidget *vte_terminal_new(void);
+VteBuffer *vte_terminal_get_buffer(VteTerminal *terminal);
+
VtePty *vte_terminal_pty_new_sync (VteTerminal *terminal,
VtePtyFlags flags,
GCancellable *cancellable,
diff --git a/src/vtebuffer.h b/src/vtebuffer.h
new file mode 100644
index 0000000..09903fa
--- /dev/null
+++ b/src/vtebuffer.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright  2011 Christian Persch
+ *
+ * This is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#if !defined (__VTE_VTE_H_INSIDE__) && !defined (VTE_COMPILATION)
+#error "Only <vte/vte.h> can be included directly."
+#endif
+
+#ifndef VTE_BUFFER_H
+#define VTE_BUFFER_H
+
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+/* VteBuffer object */
+
+#define VTE_TYPE_BUFFER (vte_buffer_get_type())
+#define VTE_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VTE_TYPE_BUFFER, VteBuffer))
+#define VTE_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VTE_TYPE_BUFFER, VteBufferClass))
+#define VTE_IS_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VTE_TYPE_BUFFER))
+#define VTE_IS_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VTE_TYPE_BUFFER))
+#define VTE_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VTE_TYPE_BUFFER, VteBufferClass))
+
+typedef struct _VteBuffer VteBuffer;
+typedef struct _VteBufferPrivate VteBufferPrivate;
+typedef struct _VteBufferClass VteBufferClass;
+typedef struct _VteBufferClassPrivate VteBufferClassPrivate;
+
+struct _VteBufferClass {
+ GObjectClass object_class;
+
+ /*< private >*/
+ VteBufferClassPrivate *priv;
+};
+
+struct _VteBuffer {
+ GObject object;
+
+ VteBufferPrivate *pvt;
+};
+
+GType vte_buffer_get_type (void);
+
+VteBuffer *vte_buffer_new (void);
+
+G_END_DECLS
+
+#endif /* VTE_BUFFER_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]