[vte/vte-next: 208/223] Don't create a buffer in vte_view_init
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-next: 208/223] Don't create a buffer in vte_view_init
- Date: Wed, 22 Jun 2011 21:06:04 +0000 (UTC)
commit d5704a4c8e2c7b78682ebf289e1b79be4d41ab20
Author: Christian Persch <chpe gnome org>
Date: Sun Jun 19 23:50:00 2011 +0200
Don't create a buffer in vte_view_init
Instead, the buffer needs to be set after creating the view.
src/reflect.c | 4 +++-
src/vte.c | 7 ++-----
src/vteapp.c | 5 ++++-
3 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/reflect.c b/src/reflect.c
index 7a7f175..c92d4de 100644
--- a/src/reflect.c
+++ b/src/reflect.c
@@ -61,11 +61,13 @@ terminal_init_vte(GtkWidget **terminal)
VteBuffer *buffer;
*terminal = vte_view_new();
- buffer = vte_view_get_buffer(VTE_VIEW(*terminal));
+ buffer = vte_buffer_new();
+ vte_view_set_buffer(VTE_VIEW(*terminal), buffer);
g_signal_connect(buffer, "eof",
G_CALLBACK(gtk_main_quit), NULL);
g_signal_connect(buffer, "child-exited",
G_CALLBACK(gtk_main_quit), NULL);
+ g_object_unref(buffer);
}
static void
terminal_shell_vte(GtkWidget *terminal)
diff --git a/src/vte.c b/src/vte.c
index b7da64c..839435c 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -2459,12 +2459,14 @@ vte_view_set_buffer(VteView *terminal,
g_signal_handlers_disconnect_by_func(old_buffer, G_CALLBACK(vte_view_beep), terminal);
g_signal_handlers_disconnect_by_func(old_buffer, G_CALLBACK(vte_view_buffer_contents_changed), terminal);
+ old_buffer->pvt->terminal = NULL;
/* defer unref until after "buffer-changed" signal emission */
}
pvt->buffer = buffer;
if (buffer) {
g_object_ref(buffer);
+ buffer->pvt->terminal = terminal;
g_signal_connect_swapped(buffer, "bell", G_CALLBACK(vte_view_beep), terminal);
g_signal_connect_swapped(buffer, "contents-changed", G_CALLBACK(vte_view_buffer_contents_changed), terminal);
@@ -8049,11 +8051,6 @@ vte_view_init(VteView *terminal)
gtk_style_context_add_class (context, VTE_STYLE_CLASS_TERMINAL);
vte_view_update_style (terminal);
-
- buffer = vte_buffer_new();
- vte_view_set_buffer(terminal, buffer);
- buffer->pvt->terminal = terminal;
- g_object_unref(buffer);
}
/* Tell GTK+ how much space we need. */
diff --git a/src/vteapp.c b/src/vteapp.c
index 4d9809d..f702f82 100644
--- a/src/vteapp.c
+++ b/src/vteapp.c
@@ -945,7 +945,10 @@ main(int argc, char **argv)
/* Create the terminal widget and add it to the scrolling shell. */
widget = vteapp_terminal_new();
terminal = VTE_VIEW (widget);
- buffer = vte_view_get_buffer(terminal);
+ buffer = vte_buffer_new();
+ vte_view_set_buffer(terminal, buffer);
+ g_object_unref(buffer);
+
if (!dbuffer) {
gtk_widget_set_double_buffered(widget, dbuffer);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]