[gnome-terminal] Bug 599443 - Add checkbox for unlimited scrollback



commit d7b599f9c61844167416adca2e0ce0743db66986
Author: Behdad Esfahbod <behdad behdad org>
Date:   Tue Dec 15 00:29:44 2009 -0500

    Bug 599443 - Add checkbox for unlimited scrollback
    
    Add an "Unlimited" chekbox for scrollback lines.

 src/gnome-terminal.schemas.in |   25 ++++++-
 src/profile-editor.c          |   16 +++--
 src/profile-preferences.glade |  144 +++++++++++++++++++++++------------------
 src/terminal-profile.c        |    4 +
 src/terminal-profile.h        |    1 +
 src/terminal-screen.c         |   11 ++-
 6 files changed, 126 insertions(+), 75 deletions(-)
---
diff --git a/src/gnome-terminal.schemas.in b/src/gnome-terminal.schemas.in
index 74d344f..3f03fe7 100644
--- a/src/gnome-terminal.schemas.in
+++ b/src/gnome-terminal.schemas.in
@@ -192,6 +192,7 @@
            Default color of bold text in the terminal, as a color
            specification (can be HTML-style hex digits, or
            a color name such as "red").
+	   This is ignored if bold_color_same_as_fg is true.
          </long>
       </locale>
     </schema>
@@ -318,11 +319,27 @@
       <locale name="C">
          <short>Number of lines to keep in scrollback</short>
          <long>
-           Number of scrollback lines to keep around. You can 
-           scroll back in the terminal by this number of lines; 
+           Number of scrollback lines to keep around. You can
+           scroll back in the terminal by this number of lines;
            lines that don't fit in the scrollback are discarded.
-           Be careful with this setting; it's the primary factor 
-           in determining how much memory the terminal will use.      
+	   If scrollback_unlimited is true, this value is ignored.
+         </long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/gnome-terminal/profiles/Default/scrollback_unlimited</key>
+      <applyto>/apps/gnome-terminal/profiles/Default/scrollback_unlimited</applyto>
+      <owner>gnome-terminal</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+         <short>Whether an unlimited number of lines should be kept in scrollback</short>
+         <long>
+	   If true, scrollback lines will never be discarded.  The scrollback
+	   history is stored on disk temporarily, so this may cause the system
+	   to run out of disk space if there is a lot of output to the
+	   terminal.
          </long>
       </locale>
     </schema>
diff --git a/src/profile-editor.c b/src/profile-editor.c
index f4a36ac..823c8a9 100644
--- a/src/profile-editor.c
+++ b/src/profile-editor.c
@@ -110,7 +110,7 @@ profile_notify_sensitivity_cb (TerminalProfile *profile,
                                GtkWidget *editor)
 {
   TerminalBackgroundType bg_type;
-  gboolean use_custom_locked, palette_locked, bg_type_locked, scrollback_lines_locked;
+  gboolean use_custom_locked, palette_locked, bg_type_locked;
   const char *prop_name;
 
   if (pspec)
@@ -227,12 +227,16 @@ profile_notify_sensitivity_cb (TerminalProfile *profile,
     SET_SENSITIVE ("scrollbar-position-combobox",
                    !terminal_profile_property_locked (profile, TERMINAL_PROFILE_SCROLLBAR_POSITION));
 
-  if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLLBACK_LINES))
+  if (!prop_name ||
+      prop_name == I_(TERMINAL_PROFILE_SCROLLBACK_LINES) ||
+      prop_name == I_(TERMINAL_PROFILE_SCROLLBACK_UNLIMITED))
     {
-      scrollback_lines_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_SCROLLBACK_LINES);
+      gboolean scrollback_lines_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_SCROLLBACK_LINES);
+      gboolean scrollback_unlimited = terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_SCROLLBACK_UNLIMITED);
 
       SET_SENSITIVE ("scrollback-label", !scrollback_lines_locked);
-      SET_SENSITIVE ("scrollback-box", !scrollback_lines_locked);
+      SET_SENSITIVE ("scrollback-box", !scrollback_lines_locked && !scrollback_unlimited);
+      SET_SENSITIVE ("scrollback-unlimited-checkbutton", !scrollback_lines_locked);
     }
   
   if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE))
@@ -308,7 +312,6 @@ profile_colors_notify_scheme_combo_cb (TerminalProfile *profile,
 {
   const GdkColor *fg, *bg;
   guint i;
-  gboolean bold_same_as_fg;
 
   fg = terminal_profile_get_property_boxed (profile, TERMINAL_PROFILE_FOREGROUND_COLOR);
   bg = terminal_profile_get_property_boxed (profile, TERMINAL_PROFILE_BACKGROUND_COLOR);
@@ -806,6 +809,8 @@ terminal_profile_edit (TerminalProfile *profile,
   CONNECT ("image-radiobutton", TERMINAL_PROFILE_BACKGROUND_TYPE);
   CONNECT ("login-shell-checkbutton", TERMINAL_PROFILE_LOGIN_SHELL);
   CONNECT ("profile-name-entry", TERMINAL_PROFILE_VISIBLE_NAME);
+  CONNECT ("scrollback-lines-spinbutton", TERMINAL_PROFILE_SCROLLBACK_LINES);
+  CONNECT ("scrollback-unlimited-checkbutton", TERMINAL_PROFILE_SCROLLBACK_UNLIMITED);
   CONNECT ("scroll-background-checkbutton", TERMINAL_PROFILE_SCROLL_BACKGROUND);
   CONNECT ("scrollbar-position-combobox", TERMINAL_PROFILE_SCROLLBAR_POSITION);
   CONNECT ("scroll-on-keystroke-checkbutton", TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE);
@@ -821,7 +826,6 @@ terminal_profile_edit (TerminalProfile *profile,
   CONNECT ("use-theme-colors-checkbutton", TERMINAL_PROFILE_USE_THEME_COLORS);
   CONNECT ("word-chars-entry", TERMINAL_PROFILE_WORD_CHARS);
   CONNECT_WITH_FLAGS ("bell-checkbutton", TERMINAL_PROFILE_SILENT_BELL, FLAG_INVERT_BOOL);
-  CONNECT_WITH_FLAGS ("scrollback-lines-spinbutton", TERMINAL_PROFILE_SCROLLBACK_LINES, 0);
 
 #undef CONNECT
 #undef CONNECT_WITH_FLAGS
diff --git a/src/profile-preferences.glade b/src/profile-preferences.glade
index 2976fc2..dd1f259 100644
--- a/src/profile-preferences.glade
+++ b/src/profile-preferences.glade
@@ -2099,13 +2099,71 @@ Custom</property>
 	    <widget class="GtkTable" id="table27">
 	      <property name="border_width">12</property>
 	      <property name="visible">True</property>
-	      <property name="n_rows">4</property>
+	      <property name="n_rows">5</property>
 	      <property name="n_columns">2</property>
 	      <property name="homogeneous">False</property>
 	      <property name="row_spacing">6</property>
 	      <property name="column_spacing">12</property>
 
 	      <child>
+		<widget class="GtkLabel" id="scrollbar-position-combobox-label">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">_Scrollbar is:</property>
+		  <property name="use_underline">True</property>
+		  <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_CENTER</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		  <property name="mnemonic_widget">scrollbar-position-combobox</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
+		</widget>
+		<packing>
+		  <property name="left_attach">0</property>
+		  <property name="right_attach">1</property>
+		  <property name="top_attach">0</property>
+		  <property name="bottom_attach">1</property>
+		  <property name="x_options">fill</property>
+		  <property name="y_options">fill</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkLabel" id="scrollback-label">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">Scroll_back:</property>
+		  <property name="use_underline">True</property>
+		  <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_CENTER</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		  <property name="mnemonic_widget">scrollback-lines-spinbutton</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
+		</widget>
+		<packing>
+		  <property name="left_attach">0</property>
+		  <property name="right_attach">1</property>
+		  <property name="top_attach">1</property>
+		  <property name="bottom_attach">2</property>
+		  <property name="x_options">fill</property>
+		  <property name="y_options">fill</property>
+		</packing>
+	      </child>
+
+	      <child>
 		<widget class="GtkCheckButton" id="scroll-on-keystroke-checkbutton">
 		  <property name="visible">True</property>
 		  <property name="can_focus">True</property>
@@ -2120,8 +2178,8 @@ Custom</property>
 		<packing>
 		  <property name="left_attach">0</property>
 		  <property name="right_attach">2</property>
-		  <property name="top_attach">3</property>
-		  <property name="bottom_attach">4</property>
+		  <property name="top_attach">4</property>
+		  <property name="bottom_attach">5</property>
 		  <property name="y_options"></property>
 		</packing>
 	      </child>
@@ -2141,6 +2199,27 @@ Custom</property>
 		<packing>
 		  <property name="left_attach">0</property>
 		  <property name="right_attach">2</property>
+		  <property name="top_attach">3</property>
+		  <property name="bottom_attach">4</property>
+		  <property name="y_options"></property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkCheckButton" id="scrollback-unlimited-checkbutton">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="label" translatable="yes">_Unlimited</property>
+		  <property name="use_underline">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		  <property name="active">False</property>
+		  <property name="inconsistent">False</property>
+		  <property name="draw_indicator">True</property>
+		</widget>
+		<packing>
+		  <property name="left_attach">1</property>
+		  <property name="right_attach">2</property>
 		  <property name="top_attach">2</property>
 		  <property name="bottom_attach">3</property>
 		  <property name="y_options"></property>
@@ -2234,65 +2313,6 @@ Disabled</property>
 		  <property name="right_attach">2</property>
 		  <property name="top_attach">1</property>
 		  <property name="bottom_attach">2</property>
-		  <property name="x_options">fill</property>
-		  <property name="y_options">fill</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkLabel" id="scrollbar-position-combobox-label">
-		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">_Scrollbar is:</property>
-		  <property name="use_underline">True</property>
-		  <property name="use_markup">False</property>
-		  <property name="justify">GTK_JUSTIFY_CENTER</property>
-		  <property name="wrap">False</property>
-		  <property name="selectable">False</property>
-		  <property name="xalign">0</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xpad">0</property>
-		  <property name="ypad">0</property>
-		  <property name="mnemonic_widget">scrollbar-position-combobox</property>
-		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-		  <property name="width_chars">-1</property>
-		  <property name="single_line_mode">False</property>
-		  <property name="angle">0</property>
-		</widget>
-		<packing>
-		  <property name="left_attach">0</property>
-		  <property name="right_attach">1</property>
-		  <property name="top_attach">0</property>
-		  <property name="bottom_attach">1</property>
-		  <property name="x_options">fill</property>
-		  <property name="y_options">fill</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkLabel" id="scrollback-label">
-		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">Scroll_back:</property>
-		  <property name="use_underline">True</property>
-		  <property name="use_markup">False</property>
-		  <property name="justify">GTK_JUSTIFY_CENTER</property>
-		  <property name="wrap">False</property>
-		  <property name="selectable">False</property>
-		  <property name="xalign">0</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xpad">0</property>
-		  <property name="ypad">0</property>
-		  <property name="mnemonic_widget">scrollback-lines-spinbutton</property>
-		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-		  <property name="width_chars">-1</property>
-		  <property name="single_line_mode">False</property>
-		  <property name="angle">0</property>
-		</widget>
-		<packing>
-		  <property name="left_attach">0</property>
-		  <property name="right_attach">1</property>
-		  <property name="top_attach">1</property>
-		  <property name="bottom_attach">2</property>
-		  <property name="x_options">fill</property>
 		  <property name="y_options">fill</property>
 		</packing>
 	      </child>
diff --git a/src/terminal-profile.c b/src/terminal-profile.c
index 1b9ca35..565d092 100644
--- a/src/terminal-profile.c
+++ b/src/terminal-profile.c
@@ -69,6 +69,7 @@ enum
   PROP_PALETTE,
   PROP_SCROLL_BACKGROUND,
   PROP_SCROLLBACK_LINES,
+  PROP_SCROLLBACK_UNLIMITED,
   PROP_SCROLLBAR_POSITION,
   PROP_SCROLL_ON_KEYSTROKE,
   PROP_SCROLL_ON_OUTPUT,
@@ -105,6 +106,7 @@ enum
 #define KEY_PALETTE "palette"
 #define KEY_SCROLL_BACKGROUND "scroll_background"
 #define KEY_SCROLLBACK_LINES "scrollback_lines"
+#define KEY_SCROLLBACK_UNLIMITED "scrollback_unlimited"
 #define KEY_SCROLLBAR_POSITION "scrollbar_position"
 #define KEY_SCROLL_ON_KEYSTROKE "scroll_on_keystroke"
 #define KEY_SCROLL_ON_OUTPUT "scroll_on_output"
@@ -141,6 +143,7 @@ enum
 #define DEFAULT_PALETTE               (terminal_palettes[TERMINAL_PALETTE_TANGO])
 #define DEFAULT_SCROLL_BACKGROUND     (TRUE)
 #define DEFAULT_SCROLLBACK_LINES      (512)
+#define DEFAULT_SCROLLBACK_UNLIMITED  (FALSE)
 #define DEFAULT_SCROLLBAR_POSITION    (TERMINAL_SCROLLBAR_RIGHT)
 #define DEFAULT_SCROLL_ON_KEYSTROKE   (TRUE)
 #define DEFAULT_SCROLL_ON_OUTPUT      (FALSE)
@@ -1286,6 +1289,7 @@ terminal_profile_class_init (TerminalProfileClass *klass)
   TERMINAL_PROFILE_PROPERTY_BOOLEAN (DEFAULT_SHOW_MENUBAR, DEFAULT_DEFAULT_SHOW_MENUBAR, KEY_DEFAULT_SHOW_MENUBAR);
   TERMINAL_PROFILE_PROPERTY_BOOLEAN (LOGIN_SHELL, DEFAULT_LOGIN_SHELL, KEY_LOGIN_SHELL);
   TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_BACKGROUND, DEFAULT_SCROLL_BACKGROUND, KEY_SCROLL_BACKGROUND);
+  TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLLBACK_UNLIMITED, DEFAULT_SCROLLBACK_UNLIMITED, KEY_SCROLLBACK_UNLIMITED);
   TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_KEYSTROKE, DEFAULT_SCROLL_ON_KEYSTROKE, KEY_SCROLL_ON_KEYSTROKE);
   TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_OUTPUT, DEFAULT_SCROLL_ON_OUTPUT, KEY_SCROLL_ON_OUTPUT);
   TERMINAL_PROFILE_PROPERTY_BOOLEAN (SILENT_BELL, DEFAULT_SILENT_BELL, KEY_SILENT_BELL);
diff --git a/src/terminal-profile.h b/src/terminal-profile.h
index ab72827..cd3c374 100644
--- a/src/terminal-profile.h
+++ b/src/terminal-profile.h
@@ -87,6 +87,7 @@ typedef enum
 #define TERMINAL_PROFILE_PALETTE                "palette"
 #define TERMINAL_PROFILE_SCROLL_BACKGROUND      "scroll-background"
 #define TERMINAL_PROFILE_SCROLLBACK_LINES       "scrollback-lines"
+#define TERMINAL_PROFILE_SCROLLBACK_UNLIMITED   "scrollback-unlimited"
 #define TERMINAL_PROFILE_SCROLLBAR_POSITION     "scrollbar-position"
 #define TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE    "scroll-on-keystroke"
 #define TERMINAL_PROFILE_SCROLL_ON_OUTPUT       "scroll-on-output"
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index 66dac2b..3726426 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -983,9 +983,14 @@ terminal_screen_profile_notify_cb (TerminalProfile *profile,
   if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLL_ON_OUTPUT))
     vte_terminal_set_scroll_on_output (vte_terminal,
                                        terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_SCROLL_ON_OUTPUT));
-  if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLLBACK_LINES))
-    vte_terminal_set_scrollback_lines (vte_terminal,
-                                       terminal_profile_get_property_int (profile, TERMINAL_PROFILE_SCROLLBACK_LINES));
+  if (!prop_name ||
+      prop_name == I_(TERMINAL_PROFILE_SCROLLBACK_LINES) ||
+      prop_name == I_(TERMINAL_PROFILE_SCROLLBACK_UNLIMITED))
+    {
+      glong lines = terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_SCROLLBACK_UNLIMITED) ?
+		    -1 : terminal_profile_get_property_int (profile, TERMINAL_PROFILE_SCROLLBACK_LINES);
+      vte_terminal_set_scrollback_lines (vte_terminal, lines);
+    }
 
   if (!prop_name || prop_name == I_(TERMINAL_PROFILE_USE_SKEY))
     {



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