[gnome-builder] terminal: add preference for scrolling behavior
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] terminal: add preference for scrolling behavior
- Date: Fri, 15 Jan 2021 20:16:52 +0000 (UTC)
commit f075be40adf2b0473e2a42866d84862954124180
Author: Christian Hergert <chergert redhat com>
Date: Fri Jan 15 12:16:43 2021 -0800
terminal: add preference for scrolling behavior
Allow toggling of scroll-on-output and scroll-on-keystroke in
VteTerminals.
.../org.gnome.builder.terminal.gschema.xml | 6 ++++
src/libide/terminal/ide-terminal.c | 2 ++
src/plugins/buildui/gbp-buildui-log-pane.c | 3 --
.../terminal/gbp-terminal-preferences-addin.c | 32 ++++++++++++++++++++--
4 files changed, 38 insertions(+), 5 deletions(-)
---
diff --git a/data/gsettings/org.gnome.builder.terminal.gschema.xml
b/data/gsettings/org.gnome.builder.terminal.gschema.xml
index 690ffe722..bd8980bac 100644
--- a/data/gsettings/org.gnome.builder.terminal.gschema.xml
+++ b/data/gsettings/org.gnome.builder.terminal.gschema.xml
@@ -13,5 +13,11 @@
<range min="0" max="999999999"/>
<default>10000</default>
</key>
+ <key name="scroll-on-output" type="b">
+ <default>false</default>
+ </key>
+ <key name="scroll-on-keystroke" type="b">
+ <default>true</default>
+ </key>
</schema>
</schemalist>
diff --git a/src/libide/terminal/ide-terminal.c b/src/libide/terminal/ide-terminal.c
index 0e400eeee..572a61a25 100644
--- a/src/libide/terminal/ide-terminal.c
+++ b/src/libide/terminal/ide-terminal.c
@@ -574,6 +574,8 @@ ide_terminal_init (IdeTerminal *self)
priv->settings = g_settings_new ("org.gnome.builder.terminal");
g_settings_bind (priv->settings, "allow-bold", self, "allow-bold", G_SETTINGS_BIND_GET);
+ g_settings_bind (priv->settings, "scroll-on-output", self, "scroll-on-output", G_SETTINGS_BIND_GET);
+ g_settings_bind (priv->settings, "scroll-on-keystroke", self, "scroll-on-keystroke", G_SETTINGS_BIND_GET);
g_signal_connect_object (priv->settings,
"changed::limit-scrollback",
G_CALLBACK (update_scrollback_cb),
diff --git a/src/plugins/buildui/gbp-buildui-log-pane.c b/src/plugins/buildui/gbp-buildui-log-pane.c
index f8a283cd9..17460b44f 100644
--- a/src/plugins/buildui/gbp-buildui-log-pane.c
+++ b/src/plugins/buildui/gbp-buildui-log-pane.c
@@ -367,9 +367,6 @@ gbp_buildui_log_pane_init (GbpBuilduiLogPane *self)
gtk_range_set_adjustment (GTK_RANGE (self->scrollbar),
gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (self->terminal)));
- vte_terminal_set_scroll_on_output (VTE_TERMINAL (self->terminal), FALSE);
- vte_terminal_set_scroll_on_keystroke (VTE_TERMINAL (self->terminal), TRUE);
-
dzl_dock_widget_set_title (DZL_DOCK_WIDGET (self), _("Build Output"));
gbp_buildui_log_pane_reset_view (self);
diff --git a/src/plugins/terminal/gbp-terminal-preferences-addin.c
b/src/plugins/terminal/gbp-terminal-preferences-addin.c
index 9dc863cae..6186463e0 100644
--- a/src/plugins/terminal/gbp-terminal-preferences-addin.c
+++ b/src/plugins/terminal/gbp-terminal-preferences-addin.c
@@ -31,6 +31,8 @@ struct _GbpTerminalPreferencesAddin
GObject parent_instance;
guint limit_id;
guint lines_id;
+ guint scroll_on_output_id;
+ guint scroll_on_keystroke_id;
};
static void
@@ -45,6 +47,30 @@ gbp_terminal_preferences_addin_load (IdePreferencesAddin *addin,
dzl_preferences_add_page (preferences, "terminal", _("Terminal"), 100);
dzl_preferences_add_list_group (preferences, "terminal", "scrollback", _("Scrollback"),
GTK_SELECTION_NONE, 10);
+ self->scroll_on_output_id = dzl_preferences_add_switch (preferences,
+ "terminal",
+ "scrollback",
+ "org.gnome.builder.terminal",
+ "scroll-on-output",
+ NULL,
+ NULL,
+ _("Scroll on output"),
+ _("When enabled the terminal will scroll to the
bottom when new output is displayed"),
+ /* translators: the following are keywords the
user can search for in no particular order */
+ _("scroll on output"),
+ 0);
+ self->scroll_on_keystroke_id = dzl_preferences_add_switch (preferences,
+ "terminal",
+ "scrollback",
+ "org.gnome.builder.terminal",
+ "scroll-on-keystroke",
+ NULL,
+ NULL,
+ _("Scroll on keystroke"),
+ _("When enabled the terminal will scroll to the
bottom when typing"),
+ /* translators: the following are keywords the
user can search for in no particular order */
+ _("scroll on keystroke"),
+ 10);
self->limit_id = dzl_preferences_add_switch (preferences,
"terminal",
"scrollback",
@@ -56,7 +82,7 @@ gbp_terminal_preferences_addin_load (IdePreferencesAddin *addin,
_("When enabled terminal scrollback will be limited to the
number of lines specified below"),
/* translators: the following are keywords the user can
search for in no particular order */
_("scrollback limit"),
- 10);
+ 20);
self->lines_id = dzl_preferences_add_spin_button (preferences,
"terminal",
"scrollback",
@@ -67,7 +93,7 @@ gbp_terminal_preferences_addin_load (IdePreferencesAddin *addin,
_("The number of lines to keep available for scrolling"),
/* translators: the following are keywords the user can
search for in no particular order */
_("scrollback lines"),
- 20);
+ 30);
}
static void
@@ -81,6 +107,8 @@ gbp_terminal_preferences_addin_unload (IdePreferencesAddin *addin,
dzl_preferences_remove_id (preferences, self->limit_id);
dzl_preferences_remove_id (preferences, self->lines_id);
+ dzl_preferences_remove_id (preferences, self->scroll_on_keystroke_id);
+ dzl_preferences_remove_id (preferences, self->scroll_on_output_id);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]