[gnome-terminal] Bug 607875. Add a "use custom default terminal size" profile setting
- From: Behdad Esfahbod <behdad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal] Bug 607875. Add a "use custom default terminal size" profile setting
- Date: Tue, 16 Mar 2010 20:09:01 +0000 (UTC)
commit 0f0fafbe950e5c57b3345524602a226b597a319f
Author: Behdad Esfahbod <behdad behdad org>
Date: Mon Mar 15 18:09:39 2010 -0400
Bug 607875. Add a "use custom default terminal size" profile setting
Such that by default, we use the termcap size.
src/gnome-terminal.schemas.in | 16 +++
src/profile-editor.c | 17 ++-
src/profile-preferences.glade | 225 +++++++++++++++++++++++-----------------
src/terminal-profile.c | 4 +
src/terminal-profile.h | 1 +
src/terminal-screen.c | 8 +-
6 files changed, 166 insertions(+), 105 deletions(-)
---
diff --git a/src/gnome-terminal.schemas.in b/src/gnome-terminal.schemas.in
index be11301..2f3ba61 100644
--- a/src/gnome-terminal.schemas.in
+++ b/src/gnome-terminal.schemas.in
@@ -296,6 +296,20 @@
</schema>
<schema>
+ <key>/schemas/apps/gnome-terminal/profiles/Default/use_custom_default_size</key>
+ <applyto>/apps/gnome-terminal/profiles/Default/use_custom_default_size</applyto>
+ <owner>gnome-terminal</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Whether to use custom terminal size for new windows</short>
+ <long>
+ If true, newly created terminal windows will have custom
+ size specified by default_size_columns and default_size_rows.
+ </long>
+ </locale>
+ </schema>
+ <schema>
<key>/schemas/apps/gnome-terminal/profiles/Default/default_size_columns</key>
<applyto>/apps/gnome-terminal/profiles/Default/default_size_columns</applyto>
<owner>gnome-terminal</owner>
@@ -305,6 +319,7 @@
<short>Default number of columns</short>
<long>
Number of columns in newly created terminal windows.
+ Has no effect if use_custom_default_size is not enabled.
</long>
</locale>
</schema>
@@ -319,6 +334,7 @@
<short>Default number of rows</short>
<long>
Number of rows in newly created terminal windows.
+ Has no effect if use_custom_default_size is not enabled.
</long>
</locale>
</schema>
diff --git a/src/profile-editor.c b/src/profile-editor.c
index 7244036..19f092f 100644
--- a/src/profile-editor.c
+++ b/src/profile-editor.c
@@ -110,7 +110,6 @@ profile_notify_sensitivity_cb (TerminalProfile *profile,
GtkWidget *editor)
{
TerminalBackgroundType bg_type;
- gboolean use_custom_locked, palette_locked, bg_type_locked;
const char *prop_name;
if (pspec)
@@ -120,12 +119,12 @@ profile_notify_sensitivity_cb (TerminalProfile *profile,
#define SET_SENSITIVE(name, setting) widget_and_labels_set_sensitive (profile_editor_get_widget (editor, name), setting)
- use_custom_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_USE_CUSTOM_COMMAND);
if (!prop_name ||
prop_name == I_(TERMINAL_PROFILE_USE_CUSTOM_COMMAND) ||
prop_name == I_(TERMINAL_PROFILE_CUSTOM_COMMAND))
{
- SET_SENSITIVE ("use-custom-command-checkbutton", !use_custom_locked);
+ gboolean use_custom_command_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_USE_CUSTOM_COMMAND);
+ SET_SENSITIVE ("use-custom-command-checkbutton", !use_custom_command_locked);
SET_SENSITIVE ("custom-command-box",
terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_CUSTOM_COMMAND) &&
!terminal_profile_property_locked (profile, TERMINAL_PROFILE_CUSTOM_COMMAND));
@@ -133,7 +132,7 @@ profile_notify_sensitivity_cb (TerminalProfile *profile,
if (!prop_name || prop_name == I_(TERMINAL_PROFILE_BACKGROUND_TYPE))
{
- bg_type_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_BACKGROUND_TYPE);
+ gboolean bg_type_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_BACKGROUND_TYPE);
SET_SENSITIVE ("solid-radiobutton", !bg_type_locked);
SET_SENSITIVE ("image-radiobutton", !bg_type_locked);
SET_SENSITIVE ("transparent-radiobutton", !bg_type_locked);
@@ -237,13 +236,18 @@ profile_notify_sensitivity_cb (TerminalProfile *profile,
!terminal_profile_property_locked (profile, TERMINAL_PROFILE_WORD_CHARS));
if (!prop_name ||
+ prop_name == I_(TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE) ||
prop_name == I_(TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS) ||
prop_name == I_(TERMINAL_PROFILE_DEFAULT_SIZE_ROWS))
{
+ gboolean use_custom_default_size_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE);
+ gboolean use_custom_default_size = terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE);
gboolean columns_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS);
gboolean rows_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_DEFAULT_SIZE_ROWS);
- SET_SENSITIVE ("default-size-label", !columns_locked || !rows_locked);
+ SET_SENSITIVE ("use-custom-default-size-checkbutton", !use_custom_default_size_locked);
+ SET_SENSITIVE ("default-size-hbox", use_custom_default_size);
+ SET_SENSITIVE ("default-size-label", (!columns_locked || !rows_locked));
SET_SENSITIVE ("default-size-columns-label", !columns_locked);
SET_SENSITIVE ("default-size-columns-spinbutton", !columns_locked);
SET_SENSITIVE ("default-size-rows-label", !rows_locked);
@@ -289,7 +293,7 @@ profile_notify_sensitivity_cb (TerminalProfile *profile,
if (!prop_name || prop_name == I_(TERMINAL_PROFILE_PALETTE))
{
- palette_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_PALETTE);
+ gboolean palette_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_PALETTE);
SET_SENSITIVE ("palette-combobox", !palette_locked);
SET_SENSITIVE ("palette-table", !palette_locked);
}
@@ -844,6 +848,7 @@ terminal_profile_edit (TerminalProfile *profile,
CONNECT ("transparent-radiobutton", TERMINAL_PROFILE_BACKGROUND_TYPE);
CONNECT ("update-records-checkbutton", TERMINAL_PROFILE_UPDATE_RECORDS);
CONNECT ("use-custom-command-checkbutton", TERMINAL_PROFILE_USE_CUSTOM_COMMAND);
+ CONNECT ("use-custom-default-size-checkbutton", TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE);
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);
diff --git a/src/profile-preferences.glade b/src/profile-preferences.glade
index 61af195..cae040a 100644
--- a/src/profile-preferences.glade
+++ b/src/profile-preferences.glade
@@ -403,66 +403,47 @@ Underline</property>
</child>
<child>
- <widget class="GtkHBox" id="hbox141">
+ <widget class="GtkCheckButton" id="use-custom-default-size-checkbutton">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Use custom default terminal si_ze</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="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkLabel" id="default-size-label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Default si_ze:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</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="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment10110">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">0</property>
<child>
- <widget class="GtkHBox" id="hbox143">
+ <widget class="GtkHBox" id="default-size-hbox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkSpinButton" id="default-size-columns-spinbutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="climb_rate">1</property>
- <property name="digits">0</property>
- <property name="numeric">False</property>
- <property name="update_policy">GTK_UPDATE_ALWAYS</property>
- <property name="snap_to_ticks">False</property>
- <property name="wrap">False</property>
- <property name="adjustment">80 1 1024 1 10 0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
+ <property name="spacing">12</property>
<child>
- <widget class="GtkLabel" id="default-size-columns-label">
+ <widget class="GtkLabel" id="default-size-label">
<property name="visible">True</property>
- <property name="label" translatable="yes">columns</property>
- <property name="use_underline">False</property>
+ <property name="label" translatable="yes">Default si_ze:</property>
+ <property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
@@ -482,69 +463,121 @@ Underline</property>
<property name="fill">False</property>
</packing>
</child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox142">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
<child>
- <widget class="GtkSpinButton" id="default-size-rows-spinbutton">
+ <widget class="GtkHBox" id="hbox143">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="climb_rate">1</property>
- <property name="digits">0</property>
- <property name="numeric">False</property>
- <property name="update_policy">GTK_UPDATE_ALWAYS</property>
- <property name="snap_to_ticks">False</property>
- <property name="wrap">False</property>
- <property name="adjustment">24 1 1024 1 10 0</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkSpinButton" id="default-size-columns-spinbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">80 1 1024 1 10 0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="default-size-columns-label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">columns</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</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="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="default-size-rows-label">
+ <widget class="GtkHBox" id="hbox142">
<property name="visible">True</property>
- <property name="label" translatable="yes">rows</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</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>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkSpinButton" id="default-size-rows-spinbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">24 1 1024 1 10 0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="default-size-rows-label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">rows</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</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="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="fill">True</property>
</packing>
</child>
</widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
</child>
</widget>
<packing>
@@ -556,7 +589,7 @@ Underline</property>
</widget>
<packing>
<property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
+ <property name="tab_fill">False</property>
</packing>
</child>
diff --git a/src/terminal-profile.c b/src/terminal-profile.c
index f050e87..326c18d 100644
--- a/src/terminal-profile.c
+++ b/src/terminal-profile.c
@@ -80,6 +80,7 @@ enum
PROP_TITLE_MODE,
PROP_UPDATE_RECORDS,
PROP_USE_CUSTOM_COMMAND,
+ PROP_USE_CUSTOM_DEFAULT_SIZE,
PROP_USE_SKEY,
PROP_USE_SYSTEM_FONT,
PROP_USE_THEME_COLORS,
@@ -119,6 +120,7 @@ enum
#define KEY_TITLE "title"
#define KEY_UPDATE_RECORDS "update_records"
#define KEY_USE_CUSTOM_COMMAND "use_custom_command"
+#define KEY_USE_CUSTOM_DEFAULT_SIZE "use_custom_default_size"
#define KEY_USE_SKEY "use_skey"
#define KEY_USE_SYSTEM_FONT "use_system_font"
#define KEY_USE_THEME_COLORS "use_theme_colors"
@@ -158,6 +160,7 @@ enum
#define DEFAULT_TITLE (N_("Terminal"))
#define DEFAULT_UPDATE_RECORDS (TRUE)
#define DEFAULT_USE_CUSTOM_COMMAND (FALSE)
+#define DEFAULT_USE_CUSTOM_DEFAULT_SIZE (FALSE)
#define DEFAULT_USE_SKEY (TRUE)
#define DEFAULT_USE_SYSTEM_FONT (TRUE)
#define DEFAULT_USE_THEME_COLORS (TRUE)
@@ -1301,6 +1304,7 @@ terminal_profile_class_init (TerminalProfileClass *klass)
TERMINAL_PROFILE_PROPERTY_BOOLEAN (SILENT_BELL, DEFAULT_SILENT_BELL, KEY_SILENT_BELL);
TERMINAL_PROFILE_PROPERTY_BOOLEAN (UPDATE_RECORDS, DEFAULT_UPDATE_RECORDS, KEY_UPDATE_RECORDS);
TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_COMMAND, DEFAULT_USE_CUSTOM_COMMAND, KEY_USE_CUSTOM_COMMAND);
+ TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_DEFAULT_SIZE, DEFAULT_USE_CUSTOM_DEFAULT_SIZE, KEY_USE_CUSTOM_DEFAULT_SIZE);
TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SKEY, DEFAULT_USE_SKEY, KEY_USE_SKEY);
TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SYSTEM_FONT, DEFAULT_USE_SYSTEM_FONT, KEY_USE_SYSTEM_FONT);
TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_THEME_COLORS, DEFAULT_USE_THEME_COLORS, KEY_USE_THEME_COLORS);
diff --git a/src/terminal-profile.h b/src/terminal-profile.h
index f627935..ad52a53 100644
--- a/src/terminal-profile.h
+++ b/src/terminal-profile.h
@@ -98,6 +98,7 @@ typedef enum
#define TERMINAL_PROFILE_TITLE "title"
#define TERMINAL_PROFILE_UPDATE_RECORDS "update-records"
#define TERMINAL_PROFILE_USE_CUSTOM_COMMAND "use-custom-command"
+#define TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE "use-custom-default-size"
#define TERMINAL_PROFILE_USE_SKEY "use-skey"
#define TERMINAL_PROFILE_USE_SYSTEM_FONT "use-system-font"
#define TERMINAL_PROFILE_USE_THEME_COLORS "use-theme-colors"
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index 060aa29..0a8126e 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -738,9 +738,11 @@ terminal_screen_new (TerminalProfile *profile,
terminal_screen_set_profile (screen, profile);
- vte_terminal_set_size (VTE_TERMINAL (screen),
- terminal_profile_get_property_int (profile, TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS),
- terminal_profile_get_property_int (profile, TERMINAL_PROFILE_DEFAULT_SIZE_ROWS));
+ if (terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE)) {
+ vte_terminal_set_size (VTE_TERMINAL (screen),
+ terminal_profile_get_property_int (profile, TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS),
+ terminal_profile_get_property_int (profile, TERMINAL_PROFILE_DEFAULT_SIZE_ROWS));
+ }
if (title)
terminal_screen_set_override_title (screen, title);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]