[vte/vte-next: 119/223] Hackaround



commit 562c333f2c5ecdda93fb230493b46681d8a9c28e
Author: Christian Persch <chpe gnome org>
Date:   Wed Jun 8 12:56:25 2011 +0200

    Hackaround
    
    Temporarily redirect VteTerminal->pvt to the VteBufferPrivate of its
    buffer. This will help in refactoring, and then be removed again.

 src/vte-private.h |   17 +++++++++++------
 src/vte.c         |   21 +++++++++++++--------
 src/vte.h         |    6 ++++--
 3 files changed, 28 insertions(+), 16 deletions(-)
---
diff --git a/src/vte-private.h b/src/vte-private.h
index 9c9ace7..c63e944 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -147,18 +147,16 @@ typedef struct _VteVisualPosition {
 	long row, col;
 } VteVisualPosition;
 
-struct _VteBufferPrivate {
-        gpointer dummy;
-};
-
 struct _VteBufferClassPrivate {
         gpointer dummy;
 };
 
 /* Terminal private data. */
-struct _VteTerminalPrivate {
+struct _VteBufferPrivate {
+//  struct _VteTerminalPrivate {
 
-        VteBuffer *buffer;
+        /* The VteTerminal that's displaying this buffer */
+        VteTerminal *terminal;
 
         /* Metric and sizing data: dimensions of the window */
         glong row_count;
@@ -413,6 +411,13 @@ struct _VteTerminalPrivate {
         guint vscroll_policy : 1;
 };
 
+#define VteTerminalPrivate VteBufferPrivate
+
+struct _VteTerminalRealPrivate {
+        VteBuffer *buffer;
+        VteBufferPrivate *buffer_pvt;
+};
+
 struct _VteTerminalClassPrivate {
         GtkStyleProvider *style_provider;
 };
diff --git a/src/vte.c b/src/vte.c
index 54e0734..5555ee3 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -2173,7 +2173,7 @@ vte_terminal_get_buffer(VteTerminal *terminal)
 {
         g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL);
 
-        return terminal->pvt->buffer;
+        return terminal->term_pvt->buffer;
 }
 
 /* Set up a palette entry with a more-or-less match for the requested color. */
@@ -7540,15 +7540,19 @@ static void
 vte_terminal_init(VteTerminal *terminal)
 {
 	VteTerminalPrivate *pvt;
+        VteTerminalRealPrivate *term_pvt;
         GtkStyleContext *context;
 
 	_vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_init()\n");
 
 	/* Initialize private data. */
-	pvt = terminal->pvt = G_TYPE_INSTANCE_GET_PRIVATE (terminal, VTE_TYPE_TERMINAL, VteTerminalPrivate);
+	term_pvt = terminal->term_pvt = G_TYPE_INSTANCE_GET_PRIVATE (terminal, VTE_TYPE_TERMINAL, VteTerminalRealPrivate);
 
-        pvt->buffer = vte_buffer_new();
-        terminal->buffer_pvt = pvt->buffer->pvt;
+        term_pvt->buffer = vte_buffer_new();
+        term_pvt->buffer_pvt = term_pvt->buffer->pvt;
+
+        pvt = terminal->pvt = term_pvt->buffer_pvt;
+        pvt->terminal = terminal;
 
 	gtk_widget_set_can_focus(&terminal->widget, TRUE);
 
@@ -7988,6 +7992,7 @@ vte_terminal_finalize(GObject *object)
 {
     	GtkWidget *widget = GTK_WIDGET (object);
     	VteTerminal *terminal = VTE_TERMINAL (object);
+        VteTerminalRealPrivate *term_pvt = terminal->term_pvt;
         VteTerminalPrivate *pvt = terminal->pvt;
 	GtkClipboard *clipboard;
         GtkSettings *settings;
@@ -8152,9 +8157,9 @@ vte_terminal_finalize(GObject *object)
                                               0, 0, NULL, NULL,
                                               terminal);
 
-        if (pvt->buffer != NULL) {
-                g_object_unref(pvt->buffer);
-                pvt->buffer = NULL;
+        if (term_pvt->buffer != NULL) {
+                g_object_unref(term_pvt->buffer);
+                term_pvt->buffer = NULL;
         }
 
 	/* Call the inherited finalize() method. */
@@ -10561,7 +10566,7 @@ vte_terminal_get_property (GObject *object,
 	switch (prop_id)
 	{
                 case PROP_BUFFER:
-                        g_value_set_object (value, pvt->buffer);
+                        g_value_set_object (value, vte_terminal_get_buffer(terminal));
                         break;
                 case PROP_HADJUSTMENT:
                         g_value_set_object (value, pvt->hadjustment);
diff --git a/src/vte.h b/src/vte.h
index 5e29aaa..0a857b1 100644
--- a/src/vte.h
+++ b/src/vte.h
@@ -48,16 +48,18 @@ typedef struct _VteTerminalPrivate      VteTerminalPrivate;
 typedef struct _VteTerminalClass        VteTerminalClass;
 typedef struct _VteTerminalClassPrivate VteTerminalClassPrivate;
 
+typedef struct _VteTerminalRealPrivate VteTerminalRealPrivate;
+
 /**
  * VteTerminal:
  */
 struct _VteTerminal {
 	GtkWidget widget;
         /*< private >*/
-	VteTerminalPrivate *pvt;
+	VteTerminalRealPrivate *term_pvt;
 
         /* temporary hack! FIXMEchpe */
-        VteBufferPrivate *buffer_pvt;
+        VteBufferPrivate *pvt;
 };
 
 /**



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