[vte/vte-next: 141/223] Move delete and backspace binding to VteBuffer



commit 0c418c8d316433744e2ded6261155823c20ea88a
Author: Christian Persch <chpe gnome org>
Date:   Thu Jun 9 23:57:00 2011 +0200

    Move delete and backspace binding to VteBuffer

 doc/reference/vte-sections.txt |   10 ++--
 src/vte-private.h              |    2 +-
 src/vte.c                      |  136 +++++++++++++++++++--------------------
 src/vte.h                      |    6 --
 src/vtebuffer.h                |    5 ++
 src/vteenums.h                 |    4 +-
 6 files changed, 79 insertions(+), 84 deletions(-)
---
diff --git a/doc/reference/vte-sections.txt b/doc/reference/vte-sections.txt
index c80708c..1a980c0 100644
--- a/doc/reference/vte-sections.txt
+++ b/doc/reference/vte-sections.txt
@@ -5,7 +5,7 @@ VteTerminal
 VteTerminalCursorBlinkMode
 VteTerminalCursorShape
 VteTerminalEffect
-VteTerminalEraseBinding
+VteEraseBinding
 VteTerminalWriteFlags
 VteSelectionFunc
 vte_terminal_new
@@ -29,8 +29,6 @@ vte_terminal_set_scroll_on_keystroke
 vte_terminal_get_has_selection
 vte_terminal_set_word_chars
 vte_terminal_is_word_char
-vte_terminal_set_backspace_binding
-vte_terminal_set_delete_binding
 vte_terminal_set_mouse_autohide
 vte_terminal_get_mouse_autohide
 vte_terminal_reset
@@ -79,8 +77,8 @@ VTE_TYPE_TERMINAL_CURSOR_SHAPE
 vte_terminal_cursor_shape_get_type
 VTE_TYPE_TERMINAL_EFFECT
 vte_terminal_effect_get_type
-VTE_TYPE_TERMINAL_ERASE_BINDING
-vte_terminal_erase_binding_get_type
+VTE_TYPE_ERASE_BINDING
+vte_erase_binding_get_type
 VTE_TYPE_TERMINAL_WRITE_FLAGS
 vte_terminal_write_flags_get_type
 VTE_TYPE_TERMINAL
@@ -110,6 +108,8 @@ VteTerminalClassPrivate
 <TITLE>VteBuffer</TITLE>
 VteBuffer
 vte_buffer_new
+vte_buffer_set_backspace_binding
+vte_buffer_set_delete_binding
 vte_buffer_set_scrollback_lines
 vte_buffer_feed
 vte_buffer_feed_child
diff --git a/src/vte-private.h b/src/vte-private.h
index 6d1791f..aeee782 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -271,7 +271,7 @@ struct _VteBufferPrivate {
 	VteVisualPosition selection_start, selection_end;
 
 	/* Miscellaneous options. */
-	VteTerminalEraseBinding backspace_binding, delete_binding;
+	VteEraseBinding backspace_binding, delete_binding;
 	gboolean meta_sends_escape;
 	gboolean audible_bell;
 	gboolean visible_bell;
diff --git a/src/vte.c b/src/vte.c
index 13694a2..9624d5c 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -142,8 +142,6 @@ enum {
         PROP_HSCROLL_POLICY,
         PROP_VSCROLL_POLICY,
         PROP_AUDIBLE_BELL,
-        PROP_BACKSPACE_BINDING,
-        PROP_DELETE_BINDING,
         PROP_EMULATION,
         PROP_ENCODING,
         PROP_ICON_TITLE,
@@ -159,6 +157,8 @@ enum {
 
 enum {
         BUFFER_PROP_0,
+        BUFFER_PROP_BACKSPACE_BINDING,
+        BUFFER_PROP_DELETE_BINDING,
         BUFFER_PROP_SCROLLBACK_LINES
 };
 
@@ -7715,8 +7715,8 @@ vte_terminal_init(VteTerminal *terminal)
 	vte_terminal_set_word_chars(terminal, NULL);
 
 	/* Miscellaneous options. */
-	vte_terminal_set_backspace_binding(terminal, VTE_ERASE_AUTO);
-	vte_terminal_set_delete_binding(terminal, VTE_ERASE_AUTO);
+	vte_buffer_set_backspace_binding(buffer, VTE_ERASE_AUTO);
+	vte_buffer_set_delete_binding(buffer, VTE_ERASE_AUTO);
 	pvt->meta_sends_escape = TRUE;
 	pvt->audible_bell = TRUE;
 	pvt->bell_margin = 10;
@@ -10662,12 +10662,6 @@ vte_terminal_get_property (GObject *object,
                 case PROP_AUDIBLE_BELL:
                         g_value_set_boolean (value, vte_terminal_get_audible_bell (terminal));
                         break;
-                case PROP_BACKSPACE_BINDING:
-                        g_value_set_enum (value, pvt->backspace_binding);
-                        break;
-                case PROP_DELETE_BINDING:
-                        g_value_set_enum (value, pvt->delete_binding);
-                        break;
                 case PROP_EMULATION:
                         g_value_set_string (value, vte_terminal_get_emulation (terminal));
                         break;
@@ -10736,12 +10730,6 @@ vte_terminal_set_property (GObject *object,
                 case PROP_AUDIBLE_BELL:
                         vte_terminal_set_audible_bell (terminal, g_value_get_boolean (value));
                         break;
-                case PROP_BACKSPACE_BINDING:
-                        vte_terminal_set_backspace_binding (terminal, g_value_get_enum (value));
-                        break;
-                case PROP_DELETE_BINDING:
-                        vte_terminal_set_delete_binding (terminal, g_value_get_enum (value));
-                        break;
                 case PROP_EMULATION:
                         vte_terminal_set_emulation (terminal, g_value_get_string (value));
                         break;
@@ -11389,38 +11377,6 @@ vte_terminal_class_init(VteTerminalClass *klass)
                                        G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
         /**
-         * VteTerminal:backspace-binding:
-         *
-         * *Controls what string or control sequence the terminal sends to its child
-         * when the user presses the backspace key.
-         * 
-         * Since: 0.20
-         */
-        g_object_class_install_property
-                (gobject_class,
-                 PROP_BACKSPACE_BINDING,
-                 g_param_spec_enum ("backspace-binding", NULL, NULL,
-                                    VTE_TYPE_TERMINAL_ERASE_BINDING,
-                                    VTE_ERASE_AUTO,
-                                    G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-        /**
-         * VteTerminal:delete-binding:
-         *
-         * Controls what string or control sequence the terminal sends to its child
-         * when the user presses the delete key.
-         * 
-         * Since: 0.20
-         */
-        g_object_class_install_property
-                (gobject_class,
-                 PROP_DELETE_BINDING,
-                 g_param_spec_enum ("delete-binding", NULL, NULL,
-                                    VTE_TYPE_TERMINAL_ERASE_BINDING,
-                                    VTE_ERASE_AUTO,
-                                    G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-     
-        /**
          * VteTerminal:emulation:
          *
          * Sets what type of terminal the widget attempts to emulate by scanning for
@@ -12267,23 +12223,23 @@ vte_terminal_set_word_chars(VteTerminal *terminal, const char *spec)
 }
 
 /**
- * vte_terminal_set_backspace_binding:
- * @terminal: a #VteTerminal
- * @binding: a #VteTerminalEraseBinding for the backspace key
+ * vte_buffer_set_backspace_binding:
+ * @buffer: a #VteBuffer
+ * @binding: a #VteEraseBinding for the backspace key
  *
- * Modifies the terminal's backspace key binding, which controls what
- * string or control sequence the terminal sends to its child when the user
+ * Modifies the buffer's backspace key binding, which controls what
+ * string or control sequence the buffer sends to its child when the user
  * presses the backspace key.
  */
 void
-vte_terminal_set_backspace_binding(VteTerminal *terminal,
-				   VteTerminalEraseBinding binding)
+vte_buffer_set_backspace_binding(VteBuffer *buffer,
+				 VteEraseBinding binding)
 {
-        VteTerminalPrivate *pvt;
+        VteBufferPrivate *pvt;
 
-	g_return_if_fail(VTE_IS_TERMINAL(terminal));
+	g_return_if_fail(VTE_IS_BUFFER(buffer));
 
-        pvt = terminal->pvt;
+        pvt = buffer->pvt;
 
         if (binding == pvt->backspace_binding)
                 return;
@@ -12291,34 +12247,34 @@ vte_terminal_set_backspace_binding(VteTerminal *terminal,
 	/* FIXME: should we set the pty mode to match? */
 	pvt->backspace_binding = binding;
 
-        g_object_notify(G_OBJECT(terminal), "backspace-binding");
+        g_object_notify(G_OBJECT(buffer), "backspace-binding");
 }
 
 /**
- * vte_terminal_set_delete_binding:
- * @terminal: a #VteTerminal
- * @binding: a #VteTerminalEraseBinding for the delete key
+ * vte_buffer_set_delete_binding:
+ * @buffer: a #VteBuffer
+ * @binding: a #VteEraseBinding for the delete key
  *
- * Modifies the terminal's delete key binding, which controls what
- * string or control sequence the terminal sends to its child when the user
+ * Modifies the buffer's delete key binding, which controls what
+ * string or control sequence the buffer sends to its child when the user
  * presses the delete key.
  */
 void
-vte_terminal_set_delete_binding(VteTerminal *terminal,
-				VteTerminalEraseBinding binding)
+vte_buffer_set_delete_binding(VteBuffer *buffer,
+                              VteEraseBinding binding)
 {
-        VteTerminalPrivate *pvt;
+        VteBufferPrivate *pvt;
 
-	g_return_if_fail(VTE_IS_TERMINAL(terminal));
+	g_return_if_fail(VTE_IS_BUFFER(buffer));
 
-        pvt = terminal->pvt;
+        pvt = buffer->pvt;
 
         if (binding == pvt->delete_binding)
                 return;
 
 	pvt->delete_binding = binding;
 
-        g_object_notify(G_OBJECT(terminal), "delete-binding");
+        g_object_notify(G_OBJECT(buffer), "delete-binding");
 }
 
 /**
@@ -13742,6 +13698,12 @@ vte_buffer_get_property (GObject *object,
         VteBuffer *buffer = VTE_BUFFER(object);
 
         switch (prop_id) {
+        case BUFFER_PROP_BACKSPACE_BINDING:
+                g_value_set_enum(value, buffer->pvt->backspace_binding);
+                break;
+        case BUFFER_PROP_DELETE_BINDING:
+                g_value_set_enum(value, buffer->pvt->delete_binding);
+                break;
         case BUFFER_PROP_SCROLLBACK_LINES:
                 g_value_set_uint (value, buffer->pvt->scrollback_lines);
                 break;
@@ -13760,6 +13722,12 @@ vte_buffer_set_property (GObject *object,
         VteBuffer *buffer = VTE_BUFFER(object);
 
         switch (prop_id) {
+        case BUFFER_PROP_BACKSPACE_BINDING:
+                vte_buffer_set_backspace_binding(buffer, g_value_get_enum (value));
+                break;
+        case BUFFER_PROP_DELETE_BINDING:
+                vte_buffer_set_delete_binding(buffer, g_value_get_enum (value));
+                break;
         case BUFFER_PROP_SCROLLBACK_LINES:
                 vte_buffer_set_scrollback_lines (buffer, g_value_get_uint (value));
                 break;
@@ -13809,6 +13777,34 @@ vte_buffer_class_init(VteBufferClass *klass)
         /* Properties */
 
         /**
+         * VteBuffer:backspace-binding:
+         *
+         * Controls what string or control sequence the terminal sends to its child
+         * when the user presses the backspace key.
+         */
+        g_object_class_install_property
+                (gobject_class,
+                 BUFFER_PROP_BACKSPACE_BINDING,
+                 g_param_spec_enum ("backspace-binding", NULL, NULL,
+                                    VTE_TYPE_ERASE_BINDING,
+                                    VTE_ERASE_AUTO,
+                                    G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+        /**
+         * VteBuffer:delete-binding:
+         *
+         * Controls what string or control sequence the terminal sends to its child
+         * when the user presses the delete key.
+         */
+        g_object_class_install_property
+                (gobject_class,
+                 BUFFER_PROP_DELETE_BINDING,
+                 g_param_spec_enum ("delete-binding", NULL, NULL,
+                                    VTE_TYPE_ERASE_BINDING,
+                                    VTE_ERASE_AUTO,
+                                    G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+        /**
          * VteBuffer:scrollback-lines:
          *
          * The length of the scrollback buffer used by the terminal.  The size of
diff --git a/src/vte.h b/src/vte.h
index b249f14..a1b8601 100644
--- a/src/vte.h
+++ b/src/vte.h
@@ -209,12 +209,6 @@ gboolean vte_terminal_get_has_selection(VteTerminal *terminal);
 void vte_terminal_set_word_chars(VteTerminal *terminal, const char *spec);
 gboolean vte_terminal_is_word_char(VteTerminal *terminal, gunichar c);
 
-/* Set what happens when the user strikes backspace or delete. */
-void vte_terminal_set_backspace_binding(VteTerminal *terminal,
-					VteTerminalEraseBinding binding);
-void vte_terminal_set_delete_binding(VteTerminal *terminal,
-				     VteTerminalEraseBinding binding);
-
 /* Manipulate the autohide setting. */
 void vte_terminal_set_mouse_autohide(VteTerminal *terminal, gboolean setting);
 gboolean vte_terminal_get_mouse_autohide(VteTerminal *terminal);
diff --git a/src/vtebuffer.h b/src/vtebuffer.h
index 6c2be6f..a97191e 100644
--- a/src/vtebuffer.h
+++ b/src/vtebuffer.h
@@ -62,6 +62,11 @@ GType vte_buffer_get_type (void);
 
 VteBuffer *vte_buffer_new (void);
 
+void vte_buffer_set_backspace_binding   (VteBuffer *buffer,
+                                         VteEraseBinding binding);
+void vte_buffer_set_delete_binding      (VteBuffer *buffer,
+                                         VteEraseBinding binding);
+
 void vte_buffer_set_scrollback_lines    (VteBuffer *buffer,
                                          glong lines);
 
diff --git a/src/vteenums.h b/src/vteenums.h
index afa00bc..fc31b3c 100644
--- a/src/vteenums.h
+++ b/src/vteenums.h
@@ -26,7 +26,7 @@
 G_BEGIN_DECLS
 
 /**
- * VteTerminalEraseBinding:
+ * VteEraseBinding:
  * @VTE_ERASE_AUTO: For backspace, attempt to determine the right value from the terminal's IO settings.  For delete, use the control sequence.
  * @VTE_ERASE_ASCII_BACKSPACE: Send an ASCII backspace character (0x08).
  * @VTE_ERASE_ASCII_DELETE: Send an ASCII delete character (0x7F).
@@ -43,7 +43,7 @@ typedef enum {
 	VTE_ERASE_ASCII_DELETE,
 	VTE_ERASE_DELETE_SEQUENCE,
 	VTE_ERASE_TTY
-} VteTerminalEraseBinding;
+} VteEraseBinding;
 
 /**
  * VteTerminalCursorBlinkMode:



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