? help/C/gnome-terminal-C.omf.out
? src/gnome-terminal.glade2p
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/profterm/ChangeLog,v
retrieving revision 1.196
diff -u -r1.196 ChangeLog
--- ChangeLog	12 Jun 2002 03:46:07 -0000	1.196
+++ ChangeLog	18 Jun 2002 22:04:01 -0000
@@ -1,3 +1,22 @@
+2002-06-18  Mathias Hasselmann <mathias.hasselmann@gmx.de>
+
+        * src/gnome-terminal.glade2: added button for custom-palette-popup,
+          consistent use of GtkFrame
+        * src/profile-editor.c: ported to new TerminalSettingMask; 
+          added custom-palette-popup
+        * src/terminal-profile.c: cleaned up property handling: ported
+          to new TerminalSettingMask, created macros for common management
+          tasks; added Pastell palette
+        * src/terminal-profile.h: cleaned up property handling:
+          lock flags are a struct of bitfields now instead within
+          one huge bitmask
+        * src/terminal-screen.c: ported to new TerminalSettingMask
+        * src/terminal-window.c: ported to new TerminalSettingMask
+        * src/terminal.c: ported to new TerminalSettingMask
+          introduced terminal_util_get_dialog
+        * src/terminal.h:
+          introduced terminal_util_get_dialog
+
 2002-06-11  Havoc Pennington  <hp@pobox.com>
 
 	* configure.in: 2.0.0
Index: src/gnome-terminal.glade2
===================================================================
RCS file: /cvs/gnome/profterm/src/gnome-terminal.glade2,v
retrieving revision 1.26
diff -u -r1.26 gnome-terminal.glade2
--- src/gnome-terminal.glade2	14 May 2002 04:14:12 -0000	1.26
+++ src/gnome-terminal.glade2	18 Jun 2002 22:04:02 -0000
@@ -52,348 +52,435 @@
 	      <property name="border_width">4</property>
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
-	      <property name="spacing">0</property>
+	      <property name="spacing">4</property>
 
 	      <child>
-		<widget class="GtkTable" id="table18">
+		<widget class="GtkFrame" id="frame15">
 		  <property name="visible">True</property>
-		  <property name="n_rows">1</property>
-		  <property name="n_columns">3</property>
-		  <property name="homogeneous">False</property>
-		  <property name="row_spacing">4</property>
-		  <property name="column_spacing">4</property>
+		  <property name="label_xalign">0</property>
+		  <property name="label_yalign">0.5</property>
+		  <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
 
 		  <child>
-		    <widget class="GtkEntry" id="profile-name-entry">
+		    <widget class="GtkTable" id="table34">
+		      <property name="border_width">4</property>
 		      <property name="visible">True</property>
-		      <property name="can_focus">True</property>
-		      <property name="editable">True</property>
-		      <property name="visibility">True</property>
-		      <property name="max_length">0</property>
-		      <property name="text" translatable="yes"></property>
-		      <property name="has_frame">True</property>
-		      <property name="invisible_char" translatable="yes">*</property>
-		      <property name="activates_default">False</property>
-		      <accessibility>
-			<atkrelation target="profile-name-label" type="labelled-by"/>
-		      </accessibility>
+		      <property name="n_rows">2</property>
+		      <property name="n_columns">2</property>
+		      <property name="homogeneous">False</property>
+		      <property name="row_spacing">4</property>
+		      <property name="column_spacing">4</property>
+
+		      <child>
+			<widget class="GtkLabel" id="profile-name-label">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">_Profile name:</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">1</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">4</property>
+			  <property name="ypad">0</property>
+			  <property name="mnemonic_widget">profile-name-entry</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"></property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkAlignment" id="alignment28">
+			  <property name="visible">True</property>
+			  <property name="xalign">0</property>
+			  <property name="yalign">0</property>
+			  <property name="xscale">0</property>
+			  <property name="yscale">0</property>
+
+			  <child>
+			    <widget class="GnomeIconEntry" id="profile-icon-entry">
+			      <property name="visible">True</property>
+			      <property name="max_saved">10</property>
+			    </widget>
+			  </child>
+			</widget>
+			<packing>
+			  <property name="left_attach">1</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="profile-icon-label">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">Profile _icon:</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">1</property>
+			  <property name="yalign">0</property>
+			  <property name="xpad">4</property>
+			  <property name="ypad">4</property>
+			  <property name="mnemonic_widget">profile-icon-entry</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="GtkEntry" id="profile-name-entry">
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="editable">True</property>
+			  <property name="visibility">True</property>
+			  <property name="max_length">0</property>
+			  <property name="text" translatable="yes"></property>
+			  <property name="has_frame">True</property>
+			  <property name="invisible_char" translatable="yes">*</property>
+			  <property name="activates_default">False</property>
+			</widget>
+			<packing>
+			  <property name="left_attach">1</property>
+			  <property name="right_attach">2</property>
+			  <property name="top_attach">0</property>
+			  <property name="bottom_attach">1</property>
+			  <property name="y_options"></property>
+			</packing>
+		      </child>
 		    </widget>
-		    <packing>
-		      <property name="left_attach">1</property>
-		      <property name="right_attach">3</property>
-		      <property name="top_attach">0</property>
-		      <property name="bottom_attach">1</property>
-		    </packing>
 		  </child>
 
 		  <child>
-		    <widget class="GtkLabel" id="profile-name-label">
+		    <widget class="GtkLabel" id="label73">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">_Profile name:</property>
-		      <property name="use_underline">True</property>
+		      <property name="label" translatable="yes">Description</property>
+		      <property name="use_underline">False</property>
 		      <property name="use_markup">False</property>
-		      <property name="justify">GTK_JUSTIFY_CENTER</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
 		      <property name="wrap">False</property>
 		      <property name="selectable">False</property>
-		      <property name="xalign">1</property>
+		      <property name="xalign">0.5</property>
 		      <property name="yalign">0.5</property>
-		      <property name="xpad">4</property>
+		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
-		      <property name="mnemonic_widget">profile-name-entry</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>
+		      <property name="type">label_item</property>
 		    </packing>
 		  </child>
 		</widget>
 		<packing>
-		  <property name="padding">10</property>
-		  <property name="expand">False</property>
-		  <property name="fill">False</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkCheckButton" id="system-font-checkbutton">
-		  <property name="visible">True</property>
-		  <property name="can_focus">True</property>
-		  <property name="label" translatable="yes">_Use the same font as other applications</property>
-		  <property name="use_underline">True</property>
-		  <property name="relief">GTK_RELIEF_NORMAL</property>
-		  <property name="active">False</property>
-		  <property name="inconsistent">False</property>
-		  <property name="draw_indicator">True</property>
-		</widget>
-		<packing>
-		  <property name="padding">5</property>
-		  <property name="expand">False</property>
-		  <property name="fill">False</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkHBox" id="font-hbox">
-		  <property name="visible">True</property>
-		  <property name="homogeneous">False</property>
-		  <property name="spacing">0</property>
-
-		  <child>
-		    <placeholder/>
-		  </child>
-		</widget>
-		<packing>
-		  <property name="padding">1</property>
+		  <property name="padding">0</property>
 		  <property name="expand">False</property>
 		  <property name="fill">True</property>
 		</packing>
 	      </child>
 
 	      <child>
-		<widget class="GtkHBox" id="hbox3">
+		<widget class="GtkFrame" id="frame13">
 		  <property name="visible">True</property>
-		  <property name="homogeneous">False</property>
-		  <property name="spacing">4</property>
+		  <property name="label_xalign">0</property>
+		  <property name="label_yalign">0.5</property>
+		  <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
 
 		  <child>
-		    <widget class="GtkLabel" id="profile-icon-label">
+		    <widget class="GtkVBox" id="vbox5">
+		      <property name="border_width">4</property>
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">Profile _icon:</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">1</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xpad">4</property>
-		      <property name="ypad">0</property>
-		      <property name="mnemonic_widget">profile-icon-entry</property>
-		    </widget>
-		    <packing>
-		      <property name="padding">0</property>
-		      <property name="expand">False</property>
-		      <property name="fill">False</property>
-		    </packing>
-		  </child>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">4</property>
 
-		  <child>
-		    <widget class="GtkAlignment" id="alignment28">
-		      <property name="visible">True</property>
-		      <property name="xalign">0</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xscale">0</property>
-		      <property name="yscale">1</property>
+		      <child>
+			<widget class="GtkCheckButton" id="system-font-checkbutton">
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="label" translatable="yes">_Use the same font as other applications</property>
+			  <property name="use_underline">True</property>
+			  <property name="relief">GTK_RELIEF_NORMAL</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">True</property>
+			</packing>
+		      </child>
 
 		      <child>
-			<widget class="GnomeIconEntry" id="profile-icon-entry">
+			<widget class="GtkVBox" id="font-vbox">
 			  <property name="visible">True</property>
-			  <property name="max_saved">10</property>
+			  <property name="homogeneous">False</property>
+			  <property name="spacing">0</property>
+
+			  <child>
+			    <placeholder/>
+			  </child>
 			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">True</property>
+			  <property name="fill">True</property>
+			</packing>
 		      </child>
 		    </widget>
-		    <packing>
-		      <property name="padding">0</property>
-		      <property name="expand">True</property>
-		      <property name="fill">True</property>
-		    </packing>
 		  </child>
-		</widget>
-		<packing>
-		  <property name="padding">2</property>
-		  <property name="expand">False</property>
-		  <property name="fill">False</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkTable" id="table19">
-		  <property name="border_width">4</property>
-		  <property name="visible">True</property>
-		  <property name="n_rows">3</property>
-		  <property name="n_columns">2</property>
-		  <property name="homogeneous">False</property>
-		  <property name="row_spacing">4</property>
-		  <property name="column_spacing">4</property>
 
 		  <child>
-		    <widget class="GtkLabel" id="word-chars-entry-label">
+		    <widget class="GtkLabel" id="label70">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">Select-by-_word characters:</property>
-		      <property name="use_underline">True</property>
+		      <property name="label" translatable="yes">Font	</property>
+		      <property name="use_underline">False</property>
 		      <property name="use_markup">False</property>
-		      <property name="justify">GTK_JUSTIFY_CENTER</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
 		      <property name="wrap">False</property>
 		      <property name="selectable">False</property>
-		      <property name="xalign">0</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="mnemonic_widget">word-chars-entry</property>
 		    </widget>
 		    <packing>
-		      <property name="left_attach">0</property>
-		      <property name="right_attach">1</property>
-		      <property name="top_attach">2</property>
-		      <property name="bottom_attach">3</property>
-		      <property name="x_options">fill</property>
-		      <property name="y_options"></property>
+		      <property name="type">label_item</property>
 		    </packing>
 		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">True</property>
+		  <property name="fill">True</property>
+		</packing>
+	      </child>
 
-		  <child>
-		    <widget class="GtkEntry" id="word-chars-entry">
-		      <property name="visible">True</property>
-		      <property name="can_focus">True</property>
-		      <property name="editable">True</property>
-		      <property name="visibility">True</property>
-		      <property name="max_length">0</property>
-		      <property name="text" translatable="yes"></property>
-		      <property name="has_frame">True</property>
-		      <property name="invisible_char" translatable="yes">*</property>
-		      <property name="activates_default">False</property>
-		      <accessibility>
-			<atkrelation target="word-chars-entry-label" type="labelled-by"/>
-		      </accessibility>
-		    </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>
-		    </packing>
-		  </child>
+	      <child>
+		<widget class="GtkFrame" id="frame12">
+		  <property name="visible">True</property>
+		  <property name="label_xalign">0</property>
+		  <property name="label_yalign">0.5</property>
+		  <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
 
 		  <child>
-		    <widget class="GtkAlignment" id="alignment9">
+		    <widget class="GtkTable" id="table19">
+		      <property name="border_width">4</property>
 		      <property name="visible">True</property>
-		      <property name="xalign">1.49012e-08</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xscale">0</property>
-		      <property name="yscale">1</property>
+		      <property name="n_rows">3</property>
+		      <property name="n_columns">2</property>
+		      <property name="homogeneous">False</property>
+		      <property name="row_spacing">4</property>
+		      <property name="column_spacing">4</property>
 
 		      <child>
-			<widget class="GtkCheckButton" id="allow-bold-checkbutton">
+			<widget class="GtkLabel" id="word-chars-entry-label">
 			  <property name="visible">True</property>
-			  <property name="can_focus">True</property>
-			  <property name="label" translatable="yes">_Allow bold text</property>
+			  <property name="label" translatable="yes">Select-by-_word characters:</property>
 			  <property name="use_underline">True</property>
-			  <property name="relief">GTK_RELIEF_NORMAL</property>
-			  <property name="active">False</property>
-			  <property name="inconsistent">False</property>
-			  <property name="draw_indicator">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">word-chars-entry</property>
 			</widget>
-		      </child>
-		    </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="y_options"></property>
-		    </packing>
-		  </child>
-
-		  <child>
-		    <widget class="GtkAlignment" id="alignment10">
-		      <property name="visible">True</property>
-		      <property name="xalign">1.49012e-08</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xscale">0</property>
-		      <property name="yscale">1</property>
+			<packing>
+			  <property name="left_attach">0</property>
+			  <property name="right_attach">1</property>
+			  <property name="top_attach">2</property>
+			  <property name="bottom_attach">3</property>
+			  <property name="x_options">fill</property>
+			  <property name="y_options"></property>
+			</packing>
+		      </child>
 
 		      <child>
-			<widget class="GtkCheckButton" id="show-menubar-checkbutton">
+			<widget class="GtkEntry" id="word-chars-entry">
 			  <property name="visible">True</property>
 			  <property name="can_focus">True</property>
-			  <property name="label" translatable="yes">Show _menubar by default in new terminals</property>
-			  <property name="use_underline">True</property>
-			  <property name="relief">GTK_RELIEF_NORMAL</property>
-			  <property name="active">False</property>
-			  <property name="inconsistent">False</property>
-			  <property name="draw_indicator">True</property>
+			  <property name="editable">True</property>
+			  <property name="visibility">True</property>
+			  <property name="max_length">0</property>
+			  <property name="text" translatable="yes"></property>
+			  <property name="has_frame">True</property>
+			  <property name="invisible_char" translatable="yes">*</property>
+			  <property name="activates_default">False</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>
+			</packing>
 		      </child>
-		    </widget>
-		    <packing>
-		      <property name="left_attach">1</property>
-		      <property name="right_attach">2</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="GtkAlignment" id="alignment11">
-		      <property name="visible">True</property>
-		      <property name="xalign">1.49012e-08</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xscale">0</property>
-		      <property name="yscale">1</property>
+		      <child>
+			<widget class="GtkAlignment" id="alignment9">
+			  <property name="visible">True</property>
+			  <property name="xalign">1.49012e-08</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xscale">0</property>
+			  <property name="yscale">1</property>
+
+			  <child>
+			    <widget class="GtkCheckButton" id="allow-bold-checkbutton">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">_Allow bold text</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			    </widget>
+			  </child>
+			</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="y_options"></property>
+			</packing>
+		      </child>
 
 		      <child>
-			<widget class="GtkCheckButton" id="blink-cursor-checkbutton">
+			<widget class="GtkAlignment" id="alignment10">
 			  <property name="visible">True</property>
-			  <property name="can_focus">True</property>
-			  <property name="label" translatable="yes">_Blink cursor</property>
-			  <property name="use_underline">True</property>
-			  <property name="relief">GTK_RELIEF_NORMAL</property>
-			  <property name="active">False</property>
-			  <property name="inconsistent">False</property>
-			  <property name="draw_indicator">True</property>
+			  <property name="xalign">1.49012e-08</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xscale">0</property>
+			  <property name="yscale">1</property>
+
+			  <child>
+			    <widget class="GtkCheckButton" id="show-menubar-checkbutton">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">Show _menubar by default in new terminals</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			    </widget>
+			  </child>
 			</widget>
+			<packing>
+			  <property name="left_attach">1</property>
+			  <property name="right_attach">2</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>
-		    </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>
-		    </packing>
-		  </child>
 
-		  <child>
-		    <widget class="GtkAlignment" id="alignment12">
-		      <property name="visible">True</property>
-		      <property name="xalign">1.49012e-08</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xscale">0</property>
-		      <property name="yscale">1</property>
+		      <child>
+			<widget class="GtkAlignment" id="alignment11">
+			  <property name="visible">True</property>
+			  <property name="xalign">1.49012e-08</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xscale">0</property>
+			  <property name="yscale">1</property>
+
+			  <child>
+			    <widget class="GtkCheckButton" id="blink-cursor-checkbutton">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">_Blink cursor</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			    </widget>
+			  </child>
+			</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>
+			</packing>
+		      </child>
 
 		      <child>
-			<widget class="GtkCheckButton" id="silent-bell-checkbutton">
+			<widget class="GtkAlignment" id="alignment12">
 			  <property name="visible">True</property>
-			  <property name="can_focus">True</property>
-			  <property name="label" translatable="yes">Silence terminal _bell</property>
-			  <property name="use_underline">True</property>
-			  <property name="relief">GTK_RELIEF_NORMAL</property>
-			  <property name="active">False</property>
-			  <property name="inconsistent">False</property>
-			  <property name="draw_indicator">True</property>
+			  <property name="xalign">1.49012e-08</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xscale">0</property>
+			  <property name="yscale">1</property>
+
+			  <child>
+			    <widget class="GtkCheckButton" id="silent-bell-checkbutton">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">Silence terminal _bell</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			    </widget>
+			  </child>
 			</widget>
+			<packing>
+			  <property name="left_attach">1</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>
 		    </widget>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label68">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Miscellaneous</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>
+		    </widget>
 		    <packing>
-		      <property name="left_attach">1</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>
+		      <property name="type">label_item</property>
 		    </packing>
 		  </child>
 		</widget>
 		<packing>
-		  <property name="padding">10</property>
-		  <property name="expand">False</property>
+		  <property name="padding">0</property>
+		  <property name="expand">True</property>
 		  <property name="fill">True</property>
 		</packing>
 	      </child>
@@ -957,8 +1044,8 @@
 		    <widget class="GtkTable" id="table24">
 		      <property name="border_width">5</property>
 		      <property name="visible">True</property>
-		      <property name="n_rows">4</property>
-		      <property name="n_columns">2</property>
+		      <property name="n_rows">3</property>
+		      <property name="n_columns">4</property>
 		      <property name="homogeneous">False</property>
 		      <property name="row_spacing">3</property>
 		      <property name="column_spacing">0</property>
@@ -1014,31 +1101,6 @@
 		      </child>
 
 		      <child>
-			<widget class="GtkLabel" id="label41">
-			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">_Background color:</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">1</property>
-			  <property name="yalign">0.5</property>
-			  <property name="xpad">8</property>
-			  <property name="ypad">0</property>
-			  <property name="mnemonic_widget">background-colorpicker</property>
-			</widget>
-			<packing>
-			  <property name="left_attach">0</property>
-			  <property name="right_attach">1</property>
-			  <property name="top_attach">3</property>
-			  <property name="bottom_attach">4</property>
-			  <property name="x_options">fill</property>
-			  <property name="y_options"></property>
-			</packing>
-		      </child>
-
-		      <child>
 			<widget class="GtkOptionMenu" id="color-scheme-optionmenu">
 			  <property name="visible">True</property>
 			  <property name="can_focus">True</property>
@@ -1055,87 +1117,90 @@
 			</widget>
 			<packing>
 			  <property name="left_attach">1</property>
-			  <property name="right_attach">2</property>
+			  <property name="right_attach">4</property>
 			  <property name="top_attach">1</property>
 			  <property name="bottom_attach">2</property>
-			  <property name="x_options">fill</property>
 			  <property name="y_options"></property>
 			</packing>
 		      </child>
 
 		      <child>
-			<widget class="GtkAlignment" id="alignment25">
+			<widget class="GtkCheckButton" id="use-theme-colors-checkbutton">
 			  <property name="visible">True</property>
-			  <property name="xalign">1.49012e-08</property>
-			  <property name="yalign">0.5</property>
-			  <property name="xscale">0</property>
-			  <property name="yscale">1</property>
-
-			  <child>
-			    <widget class="GnomeColorPicker" id="foreground-colorpicker">
-			      <property name="visible">True</property>
-			      <property name="can_focus">True</property>
-			      <property name="dither">True</property>
-			      <property name="use_alpha">False</property>
-			      <property name="title" translatable="yes">Choose terminal text color</property>
-			    </widget>
-			  </child>
+			  <property name="can_focus">True</property>
+			  <property name="label" translatable="yes">Use colors from s_ystem theme</property>
+			  <property name="use_underline">True</property>
+			  <property name="relief">GTK_RELIEF_NORMAL</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="left_attach">0</property>
+			  <property name="right_attach">4</property>
+			  <property name="top_attach">0</property>
+			  <property name="bottom_attach">1</property>
 			  <property name="x_options">fill</property>
 			  <property name="y_options"></property>
 			</packing>
 		      </child>
 
 		      <child>
-			<widget class="GtkAlignment" id="alignment26">
+			<widget class="GnomeColorPicker" id="background-colorpicker">
 			  <property name="visible">True</property>
-			  <property name="xalign">1.49012e-08</property>
-			  <property name="yalign">0.5</property>
-			  <property name="xscale">0</property>
-			  <property name="yscale">1</property>
+			  <property name="can_focus">True</property>
+			  <property name="dither">True</property>
+			  <property name="use_alpha">False</property>
+			  <property name="title" translatable="yes">Choose terminal background color</property>
+			</widget>
+			<packing>
+			  <property name="left_attach">3</property>
+			  <property name="right_attach">4</property>
+			  <property name="top_attach">2</property>
+			  <property name="bottom_attach">3</property>
+			  <property name="x_options">fill</property>
+			  <property name="y_options"></property>
+			</packing>
+		      </child>
 
-			  <child>
-			    <widget class="GnomeColorPicker" id="background-colorpicker">
-			      <property name="visible">True</property>
-			      <property name="can_focus">True</property>
-			      <property name="dither">True</property>
-			      <property name="use_alpha">False</property>
-			      <property name="title" translatable="yes">Choose terminal background color</property>
-			    </widget>
-			  </child>
+		      <child>
+			<widget class="GnomeColorPicker" id="foreground-colorpicker">
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="dither">True</property>
+			  <property name="use_alpha">False</property>
+			  <property name="title" translatable="yes">Choose terminal text color</property>
 			</widget>
 			<packing>
 			  <property name="left_attach">1</property>
 			  <property name="right_attach">2</property>
-			  <property name="top_attach">3</property>
-			  <property name="bottom_attach">4</property>
+			  <property name="top_attach">2</property>
+			  <property name="bottom_attach">3</property>
 			  <property name="x_options">fill</property>
 			  <property name="y_options"></property>
 			</packing>
 		      </child>
 
 		      <child>
-			<widget class="GtkCheckButton" id="use-theme-colors-checkbutton">
+			<widget class="GtkLabel" id="label41">
 			  <property name="visible">True</property>
-			  <property name="can_focus">True</property>
-			  <property name="label" translatable="yes">Use colors from s_ystem theme</property>
+			  <property name="label" translatable="yes">_Background color:</property>
 			  <property name="use_underline">True</property>
-			  <property name="relief">GTK_RELIEF_NORMAL</property>
-			  <property name="active">False</property>
-			  <property name="inconsistent">False</property>
-			  <property name="draw_indicator">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">1</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">8</property>
+			  <property name="ypad">0</property>
+			  <property name="mnemonic_widget">background-colorpicker</property>
 			</widget>
 			<packing>
-			  <property name="left_attach">0</property>
-			  <property name="right_attach">2</property>
-			  <property name="top_attach">0</property>
-			  <property name="bottom_attach">1</property>
-			  <property name="x_options">fill</property>
+			  <property name="left_attach">2</property>
+			  <property name="right_attach">3</property>
+			  <property name="top_attach">2</property>
+			  <property name="bottom_attach">3</property>
 			  <property name="y_options"></property>
 			</packing>
 		      </child>
@@ -1180,7 +1245,7 @@
 		    <widget class="GtkTable" id="table25">
 		      <property name="border_width">5</property>
 		      <property name="visible">True</property>
-		      <property name="n_rows">3</property>
+		      <property name="n_rows">4</property>
 		      <property name="n_columns">2</property>
 		      <property name="homogeneous">False</property>
 		      <property name="row_spacing">3</property>
@@ -1236,6 +1301,64 @@
 		      </child>
 
 		      <child>
+			<widget class="GtkAlignment" id="alignment17">
+			  <property name="visible">True</property>
+			  <property name="xalign">1.49012e-08</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xscale">0</property>
+			  <property name="yscale">1</property>
+
+			  <child>
+			    <widget class="GtkOptionMenu" id="palette-optionmenu">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="history">-1</property>
+			      <accessibility>
+				<atkrelation target="palette-optionmenu-label" type="labelled-by"/>
+			      </accessibility>
+
+			      <child internal-child="menu">
+				<widget class="GtkMenu" id="convertwidget14">
+				  <property name="visible">True</property>
+				</widget>
+			      </child>
+			    </widget>
+			  </child>
+			</widget>
+			<packing>
+			  <property name="left_attach">1</property>
+			  <property name="right_attach">2</property>
+			  <property name="top_attach">1</property>
+			  <property name="bottom_attach">2</property>
+			  <property name="y_options"></property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkLabel" id="label44">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">Terminal applications have these colors available to them.</property>
+			  <property name="use_underline">False</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>
+			</widget>
+			<packing>
+			  <property name="left_attach">0</property>
+			  <property name="right_attach">2</property>
+			  <property name="top_attach">0</property>
+			  <property name="bottom_attach">1</property>
+			  <property name="x_options">fill</property>
+			  <property name="y_options"></property>
+			</packing>
+		      </child>
+
+		      <child>
 			<widget class="GtkTable" id="table26">
 			  <property name="visible">True</property>
 			  <property name="n_rows">2</property>
@@ -1559,49 +1682,63 @@
 		      </child>
 
 		      <child>
-			<widget class="GtkLabel" id="label44">
+			<widget class="GtkAlignment" id="alignment30">
 			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">Terminal applications have these colors available to them.</property>
-			  <property name="use_underline">False</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>
-			</widget>
-			<packing>
-			  <property name="left_attach">0</property>
-			  <property name="right_attach">2</property>
-			  <property name="top_attach">0</property>
-			  <property name="bottom_attach">1</property>
-			  <property name="x_options">fill</property>
-			  <property name="y_options"></property>
-			</packing>
-		      </child>
-
-		      <child>
-			<widget class="GtkAlignment" id="alignment17">
-			  <property name="visible">True</property>
-			  <property name="xalign">1.49012e-08</property>
-			  <property name="yalign">0.5</property>
 			  <property name="xscale">0</property>
 			  <property name="yscale">1</property>
 
 			  <child>
-			    <widget class="GtkOptionMenu" id="palette-optionmenu">
+			    <widget class="GtkButton" id="initialize-custom-palette-button">
 			      <property name="visible">True</property>
 			      <property name="can_focus">True</property>
-			      <property name="history">-1</property>
-			      <accessibility>
-				<atkrelation target="palette-optionmenu-label" type="labelled-by"/>
-			      </accessibility>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
 
-			      <child internal-child="menu">
-				<widget class="GtkMenu" id="convertwidget14">
+			      <child>
+				<widget class="GtkHBox" id="hbox4">
 				  <property name="visible">True</property>
+				  <property name="homogeneous">False</property>
+				  <property name="spacing">0</property>
+
+				  <child>
+				    <widget class="GtkLabel" id="initialize_custom_palette_label">
+				      <property name="visible">True</property>
+				      <property name="label" translatable="yes">Initialize _custom palette</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.5</property>
+				      <property name="yalign">0.5</property>
+				      <property name="xpad">0</property>
+				      <property name="ypad">0</property>
+				    </widget>
+				    <packing>
+				      <property name="padding">0</property>
+				      <property name="expand">True</property>
+				      <property name="fill">True</property>
+				    </packing>
+				  </child>
+
+				  <child>
+				    <widget class="GtkArrow" id="arrow1">
+				      <property name="visible">True</property>
+				      <property name="arrow_type">GTK_ARROW_RIGHT</property>
+				      <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+				      <property name="xalign">0.25</property>
+				      <property name="yalign">0.5</property>
+				      <property name="xpad">2</property>
+				      <property name="ypad">0</property>
+				    </widget>
+				    <packing>
+				      <property name="padding">0</property>
+				      <property name="expand">False</property>
+				      <property name="fill">True</property>
+				      <property name="pack_type">GTK_PACK_END</property>
+				    </packing>
+				  </child>
 				</widget>
 			      </child>
 			    </widget>
@@ -1610,8 +1747,8 @@
 			<packing>
 			  <property name="left_attach">1</property>
 			  <property name="right_attach">2</property>
-			  <property name="top_attach">1</property>
-			  <property name="bottom_attach">2</property>
+			  <property name="top_attach">3</property>
+			  <property name="bottom_attach">4</property>
 			  <property name="x_options">fill</property>
 			  <property name="y_options"></property>
 			</packing>
@@ -1976,17 +2113,17 @@
 	      <property name="visible">True</property>
 	      <property name="label_xalign">0</property>
 	      <property name="label_yalign">0.5</property>
-	      <property name="shadow_type">GTK_SHADOW_NONE</property>
+	      <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
 
 	      <child>
 		<widget class="GtkTable" id="table27">
 		  <property name="border_width">4</property>
 		  <property name="visible">True</property>
-		  <property name="n_rows">3</property>
-		  <property name="n_columns">9</property>
+		  <property name="n_rows">4</property>
+		  <property name="n_columns">5</property>
 		  <property name="homogeneous">False</property>
-		  <property name="row_spacing">6</property>
-		  <property name="column_spacing">0</property>
+		  <property name="row_spacing">4</property>
+		  <property name="column_spacing">4</property>
 
 		  <child>
 		    <widget class="GtkLabel" id="label46">
@@ -1999,7 +2136,7 @@
 		      <property name="selectable">False</property>
 		      <property name="xalign">1</property>
 		      <property name="yalign">0.5</property>
-		      <property name="xpad">8</property>
+		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
 		      <property name="mnemonic_widget">scrollback-lines-spinbutton</property>
 		    </widget>
@@ -2024,7 +2161,7 @@
 		      <property name="selectable">False</property>
 		      <property name="xalign">1</property>
 		      <property name="yalign">0.5</property>
-		      <property name="xpad">8</property>
+		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
 		      <property name="mnemonic_widget">scrollback-lines-spinbutton</property>
 		    </widget>
@@ -2039,201 +2176,172 @@
 		  </child>
 
 		  <child>
-		    <widget class="GtkAlignment" id="alignment20">
+		    <widget class="GtkSpinButton" id="scrollback-lines-spinbutton">
 		      <property name="visible">True</property>
-		      <property name="xalign">1.49012e-08</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xscale">0</property>
-		      <property name="yscale">1</property>
-
-		      <child>
-			<widget class="GtkOptionMenu" id="scrollbar-position-optionmenu">
-			  <property name="visible">True</property>
-			  <property name="can_focus">True</property>
-			  <property name="history">0</property>
-			  <accessibility>
-			    <atkrelation target="scrollbar-position-optionmenu-label" type="labelled-by"/>
-			  </accessibility>
-
-			  <child internal-child="menu">
-			    <widget class="GtkMenu" id="convertwidget1">
-			      <property name="visible">True</property>
-
-			      <child>
-				<widget class="GtkMenuItem" id="convertwidget2">
-				  <property name="visible">True</property>
-				  <property name="label" translatable="yes">On the left side</property>
-				  <property name="use_underline">True</property>
-				</widget>
-			      </child>
-
-			      <child>
-				<widget class="GtkMenuItem" id="convertwidget3">
-				  <property name="visible">True</property>
-				  <property name="label" translatable="yes">On the right side</property>
-				  <property name="use_underline">True</property>
-				</widget>
-			      </child>
-
-			      <child>
-				<widget class="GtkMenuItem" id="convertwidget4">
-				  <property name="visible">True</property>
-				  <property name="label" translatable="yes">Disabled</property>
-				  <property name="use_underline">True</property>
-				</widget>
-			      </child>
-			    </widget>
-			  </child>
-			</widget>
-		      </child>
+		      <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">1 1 100000 1 5 0</property>
 		    </widget>
 		    <packing>
 		      <property name="left_attach">1</property>
-		      <property name="right_attach">8</property>
-		      <property name="top_attach">0</property>
-		      <property name="bottom_attach">1</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"></property>
 		    </packing>
 		  </child>
 
 		  <child>
-		    <widget class="GtkAlignment" id="alignment14">
+		    <widget class="GtkSpinButton" id="scrollback-kilobytes-spinbutton">
 		      <property name="visible">True</property>
-		      <property name="xalign">1.49012e-08</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xscale">0</property>
-		      <property name="yscale">1</property>
-
-		      <child>
-			<widget class="GtkCheckButton" id="scroll-on-output-checkbutton">
-			  <property name="visible">True</property>
-			  <property name="can_focus">True</property>
-			  <property name="label" translatable="yes">Sc_roll on output</property>
-			  <property name="use_underline">True</property>
-			  <property name="relief">GTK_RELIEF_NORMAL</property>
-			  <property name="active">False</property>
-			  <property name="inconsistent">False</property>
-			  <property name="draw_indicator">True</property>
-			</widget>
-		      </child>
+		      <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">1 1 100000 1 5 0</property>
 		    </widget>
 		    <packing>
-		      <property name="left_attach">4</property>
-		      <property name="right_attach">7</property>
-		      <property name="top_attach">2</property>
-		      <property name="bottom_attach">3</property>
+		      <property name="left_attach">3</property>
+		      <property name="right_attach">4</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>
+		      <property name="y_options"></property>
 		    </packing>
 		  </child>
 
 		  <child>
-		    <widget class="GtkAlignment" id="alignment13">
+		    <widget class="GtkLabel" id="scrollback-kilobytes-spinbutton-label">
 		      <property name="visible">True</property>
-		      <property name="xalign">1.49012e-08</property>
+		      <property name="label" translatable="yes">_kilobytes</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="xscale">0</property>
-		      <property name="yscale">1</property>
-
-		      <child>
-			<widget class="GtkCheckButton" id="scroll-on-keystroke-checkbutton">
-			  <property name="visible">True</property>
-			  <property name="can_focus">True</property>
-			  <property name="label" translatable="yes">S_croll on keystroke</property>
-			  <property name="use_underline">True</property>
-			  <property name="relief">GTK_RELIEF_NORMAL</property>
-			  <property name="active">False</property>
-			  <property name="inconsistent">False</property>
-			  <property name="draw_indicator">True</property>
-			</widget>
-		      </child>
+		      <property name="xpad">3</property>
+		      <property name="ypad">0</property>
+		      <property name="mnemonic_widget">scrollback-kilobytes-spinbutton</property>
 		    </widget>
 		    <packing>
-		      <property name="left_attach">1</property>
-		      <property name="right_attach">4</property>
-		      <property name="top_attach">2</property>
-		      <property name="bottom_attach">3</property>
+		      <property name="left_attach">4</property>
+		      <property name="right_attach">5</property>
+		      <property name="top_attach">1</property>
+		      <property name="bottom_attach">2</property>
 		      <property name="y_options"></property>
 		    </packing>
 		  </child>
 
 		  <child>
-		    <widget class="GtkSpinButton" id="scrollback-lines-spinbutton">
+		    <widget class="GtkCheckButton" id="scroll-on-keystroke-checkbutton">
 		      <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">1 1 100000 1 5 0</property>
-		      <accessibility>
-			<atkrelation target="scrollback-lines-spinbutton-label" type="labelled-by"/>
-		      </accessibility>
+		      <property name="label" translatable="yes">S_croll on keystroke</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</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">4</property>
-		      <property name="top_attach">1</property>
-		      <property name="bottom_attach">2</property>
+		      <property name="right_attach">5</property>
+		      <property name="top_attach">2</property>
+		      <property name="bottom_attach">3</property>
 		      <property name="y_options"></property>
 		    </packing>
 		  </child>
 
 		  <child>
-		    <widget class="GtkLabel" id="scrollback-lines-spinbutton-label">
+		    <widget class="GtkCheckButton" id="scroll-on-output-checkbutton">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">_lines</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">Sc_roll on output</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">3</property>
-		      <property name="ypad">0</property>
-		      <property name="mnemonic_widget">scrollback-kilobytes-spinbutton</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
 		    </widget>
 		    <packing>
-		      <property name="left_attach">4</property>
+		      <property name="left_attach">1</property>
 		      <property name="right_attach">5</property>
-		      <property name="top_attach">1</property>
-		      <property name="bottom_attach">2</property>
-		      <property name="x_options">fill</property>
+		      <property name="top_attach">3</property>
+		      <property name="bottom_attach">4</property>
 		      <property name="y_options"></property>
 		    </packing>
 		  </child>
 
 		  <child>
-		    <widget class="GtkLabel" id="label57">
+		    <widget class="GtkAlignment" id="alignment29">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">kilobytes</property>
-		      <property name="use_underline">False</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="xscale">0</property>
+		      <property name="yscale">0</property>
+
+		      <child>
+			<widget class="GtkOptionMenu" id="scrollbar-position-optionmenu">
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="history">0</property>
+
+			  <child internal-child="menu">
+			    <widget class="GtkMenu" id="convertwidget1">
+			      <property name="visible">True</property>
+
+			      <child>
+				<widget class="GtkMenuItem" id="convertwidget2">
+				  <property name="visible">True</property>
+				  <property name="label" translatable="yes">On the left side</property>
+				  <property name="use_underline">True</property>
+				</widget>
+			      </child>
+
+			      <child>
+				<widget class="GtkMenuItem" id="convertwidget3">
+				  <property name="visible">True</property>
+				  <property name="label" translatable="yes">On the right side</property>
+				  <property name="use_underline">True</property>
+				</widget>
+			      </child>
+
+			      <child>
+				<widget class="GtkMenuItem" id="convertwidget4">
+				  <property name="visible">True</property>
+				  <property name="label" translatable="yes">Disabled</property>
+				  <property name="use_underline">True</property>
+				</widget>
+			      </child>
+			    </widget>
+			  </child>
+			</widget>
+		      </child>
 		    </widget>
 		    <packing>
-		      <property name="left_attach">6</property>
-		      <property name="right_attach">7</property>
-		      <property name="top_attach">1</property>
-		      <property name="bottom_attach">2</property>
-		      <property name="x_options">fill</property>
+		      <property name="left_attach">1</property>
+		      <property name="right_attach">5</property>
+		      <property name="top_attach">0</property>
+		      <property name="bottom_attach">1</property>
 		      <property name="y_options"></property>
 		    </packing>
 		  </child>
 
 		  <child>
-		    <widget class="GtkLabel" id="scrollback-kilobytes-spinbutton-label">
+		    <widget class="GtkLabel" id="scrollback-lines-spinbutton-label">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">_kilobytes</property>
+		      <property name="label" translatable="yes">_lines</property>
 		      <property name="use_underline">True</property>
 		      <property name="use_markup">False</property>
 		      <property name="justify">GTK_JUSTIFY_CENTER</property>
@@ -2246,39 +2354,34 @@
 		      <property name="mnemonic_widget">scrollback-kilobytes-spinbutton</property>
 		    </widget>
 		    <packing>
-		      <property name="left_attach">8</property>
-		      <property name="right_attach">9</property>
+		      <property name="left_attach">2</property>
+		      <property name="right_attach">3</property>
 		      <property name="top_attach">1</property>
 		      <property name="bottom_attach">2</property>
 		      <property name="x_options">fill</property>
 		      <property name="y_options"></property>
 		    </packing>
 		  </child>
+		</widget>
+	      </child>
 
-		  <child>
-		    <widget class="GtkSpinButton" id="scrollback-kilobytes-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">1 1 100000 1 5 0</property>
-		      <accessibility>
-			<atkrelation target="scrollback-kilobytes-spinbutton-label" type="labelled-by"/>
-		      </accessibility>
-		    </widget>
-		    <packing>
-		      <property name="left_attach">5</property>
-		      <property name="right_attach">8</property>
-		      <property name="top_attach">1</property>
-		      <property name="bottom_attach">2</property>
-		      <property name="y_options"></property>
-		    </packing>
-		  </child>
+	      <child>
+		<widget class="GtkLabel" id="label69">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">Scrolling</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>
 		</widget>
+		<packing>
+		  <property name="type">label_item</property>
+		</packing>
 	      </child>
 	    </widget>
 	    <packing>
@@ -2307,345 +2410,760 @@
 	  </child>
 
 	  <child>
-	    <widget class="GtkVBox" id="vbox4">
+	    <widget class="GtkFrame" id="frame14">
 	      <property name="border_width">4</property>
 	      <property name="visible">True</property>
-	      <property name="homogeneous">False</property>
-	      <property name="spacing">10</property>
-
-	      <child>
-		<widget class="GtkLabel" id="label51">
-		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">These options may cause some applications to behave incorrectly.
-They are only here to allow you to work around certain applications
-and operating sytems that expect different terminal behavior.</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</property>
-		  <property name="yalign">7.45058e-09</property>
-		  <property name="xpad">0</property>
-		  <property name="ypad">0</property>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">True</property>
-		  <property name="fill">True</property>
-		</packing>
-	      </child>
+	      <property name="label_xalign">0</property>
+	      <property name="label_yalign">0.5</property>
+	      <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
 
 	      <child>
-		<widget class="GtkTable" id="table30">
+		<widget class="GtkVBox" id="vbox4">
+		  <property name="border_width">4</property>
 		  <property name="visible">True</property>
-		  <property name="n_rows">2</property>
-		  <property name="n_columns">3</property>
 		  <property name="homogeneous">False</property>
-		  <property name="row_spacing">4</property>
-		  <property name="column_spacing">4</property>
-
-		  <child>
-		    <widget class="GtkLabel" id="delete-binding-optionmenu-label">
-		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">_Delete key generates:</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">1</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xpad">8</property>
-		      <property name="ypad">0</property>
-		      <property name="mnemonic_widget">scrollback-kilobytes-spinbutton</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"></property>
-		    </packing>
-		  </child>
+		  <property name="spacing">10</property>
 
 		  <child>
-		    <widget class="GtkLabel" id="backspace-binding-optionmenu-label">
+		    <widget class="GtkLabel" id="label51">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">_Backspace key generates:</property>
-		      <property name="use_underline">True</property>
+		      <property name="label" translatable="yes">These options may cause some applications to behave incorrectly.
+They are only here to allow you to work around certain applications
+and operating sytems that expect different terminal behavior.</property>
+		      <property name="use_underline">False</property>
 		      <property name="use_markup">False</property>
-		      <property name="justify">GTK_JUSTIFY_CENTER</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
 		      <property name="wrap">False</property>
 		      <property name="selectable">False</property>
-		      <property name="xalign">1</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xpad">8</property>
+		      <property name="xalign">0</property>
+		      <property name="yalign">7.45058e-09</property>
+		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
-		      <property name="mnemonic_widget">backspace-binding-optionmenu</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"></property>
+		      <property name="padding">0</property>
+		      <property name="expand">True</property>
+		      <property name="fill">True</property>
 		    </packing>
 		  </child>
 
 		  <child>
-		    <widget class="GtkAlignment" id="alignment21">
+		    <widget class="GtkTable" id="table30">
 		      <property name="visible">True</property>
-		      <property name="xalign">1.49012e-08</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xscale">0</property>
-		      <property name="yscale">1</property>
+		      <property name="n_rows">2</property>
+		      <property name="n_columns">3</property>
+		      <property name="homogeneous">False</property>
+		      <property name="row_spacing">4</property>
+		      <property name="column_spacing">4</property>
 
 		      <child>
-			<widget class="GtkOptionMenu" id="backspace-binding-optionmenu">
+			<widget class="GtkLabel" id="delete-binding-optionmenu-label">
 			  <property name="visible">True</property>
-			  <property name="can_focus">True</property>
-			  <property name="history">0</property>
-			  <accessibility>
-			    <atkrelation target="backspace-binding-optionmenu-label" type="labelled-by"/>
-			  </accessibility>
-
-			  <child internal-child="menu">
-			    <widget class="GtkMenu" id="convertwidget15">
-			      <property name="visible">True</property>
+			  <property name="label" translatable="yes">_Delete key generates:</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">1</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">8</property>
+			  <property name="ypad">0</property>
+			  <property name="mnemonic_widget">scrollback-kilobytes-spinbutton</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"></property>
+			</packing>
+		      </child>
 
-			      <child>
-				<widget class="GtkMenuItem" id="convertwidget16">
-				  <property name="visible">True</property>
-				  <property name="label" translatable="yes">ASCII DEL</property>
-				  <property name="use_underline">True</property>
-				</widget>
-			      </child>
+		      <child>
+			<widget class="GtkLabel" id="backspace-binding-optionmenu-label">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">_Backspace key generates:</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">1</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">8</property>
+			  <property name="ypad">0</property>
+			  <property name="mnemonic_widget">backspace-binding-optionmenu</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"></property>
+			</packing>
+		      </child>
 
-			      <child>
-				<widget class="GtkMenuItem" id="convertwidget17">
+		      <child>
+			<widget class="GtkAlignment" id="alignment21">
+			  <property name="visible">True</property>
+			  <property name="xalign">1.49012e-08</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xscale">0</property>
+			  <property name="yscale">1</property>
+
+			  <child>
+			    <widget class="GtkOptionMenu" id="backspace-binding-optionmenu">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="history">0</property>
+
+			      <child internal-child="menu">
+				<widget class="GtkMenu" id="convertwidget15">
 				  <property name="visible">True</property>
-				  <property name="label" translatable="yes">Escape sequence</property>
-				  <property name="use_underline">True</property>
+
+				  <child>
+				    <widget class="GtkMenuItem" id="convertwidget16">
+				      <property name="visible">True</property>
+				      <property name="label" translatable="yes">ASCII DEL</property>
+				      <property name="use_underline">True</property>
+				    </widget>
+				  </child>
+
+				  <child>
+				    <widget class="GtkMenuItem" id="convertwidget17">
+				      <property name="visible">True</property>
+				      <property name="label" translatable="yes">Escape sequence</property>
+				      <property name="use_underline">True</property>
+				    </widget>
+				  </child>
+
+				  <child>
+				    <widget class="GtkMenuItem" id="convertwidget18">
+				      <property name="visible">True</property>
+				      <property name="label" translatable="yes">Control-H</property>
+				      <property name="use_underline">True</property>
+				    </widget>
+				  </child>
 				</widget>
 			      </child>
+			    </widget>
+			  </child>
+			</widget>
+			<packing>
+			  <property name="left_attach">1</property>
+			  <property name="right_attach">3</property>
+			  <property name="top_attach">0</property>
+			  <property name="bottom_attach">1</property>
+			  <property name="y_options"></property>
+			</packing>
+		      </child>
 
-			      <child>
-				<widget class="GtkMenuItem" id="convertwidget18">
+		      <child>
+			<widget class="GtkAlignment" id="alignment22">
+			  <property name="visible">True</property>
+			  <property name="xalign">1.49012e-08</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xscale">0</property>
+			  <property name="yscale">1</property>
+
+			  <child>
+			    <widget class="GtkOptionMenu" id="delete-binding-optionmenu">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="history">0</property>
+
+			      <child internal-child="menu">
+				<widget class="GtkMenu" id="convertwidget19">
 				  <property name="visible">True</property>
-				  <property name="label" translatable="yes">Control-H</property>
-				  <property name="use_underline">True</property>
+
+				  <child>
+				    <widget class="GtkMenuItem" id="convertwidget20">
+				      <property name="visible">True</property>
+				      <property name="label" translatable="yes">ASCII DEL</property>
+				      <property name="use_underline">True</property>
+				    </widget>
+				  </child>
+
+				  <child>
+				    <widget class="GtkMenuItem" id="convertwidget21">
+				      <property name="visible">True</property>
+				      <property name="label" translatable="yes">Escape sequence</property>
+				      <property name="use_underline">True</property>
+				    </widget>
+				  </child>
+
+				  <child>
+				    <widget class="GtkMenuItem" id="convertwidget22">
+				      <property name="visible">True</property>
+				      <property name="label" translatable="yes">Control-H</property>
+				      <property name="use_underline">True</property>
+				    </widget>
+				  </child>
 				</widget>
 			      </child>
 			    </widget>
 			  </child>
 			</widget>
+			<packing>
+			  <property name="left_attach">1</property>
+			  <property name="right_attach">3</property>
+			  <property name="top_attach">1</property>
+			  <property name="bottom_attach">2</property>
+			  <property name="y_options"></property>
+			</packing>
 		      </child>
 		    </widget>
 		    <packing>
-		      <property name="left_attach">1</property>
-		      <property name="right_attach">3</property>
-		      <property name="top_attach">0</property>
-		      <property name="bottom_attach">1</property>
-		      <property name="y_options"></property>
+		      <property name="padding">0</property>
+		      <property name="expand">True</property>
+		      <property name="fill">True</property>
 		    </packing>
 		  </child>
 
 		  <child>
-		    <widget class="GtkAlignment" id="alignment22">
+		    <widget class="GtkAlignment" id="reset-compat-defaults-button">
 		      <property name="visible">True</property>
-		      <property name="xalign">1.49012e-08</property>
+		      <property name="xalign">1.11759e-08</property>
 		      <property name="yalign">0.5</property>
 		      <property name="xscale">0</property>
-		      <property name="yscale">1</property>
+		      <property name="yscale">0</property>
 
 		      <child>
-			<widget class="GtkOptionMenu" id="delete-binding-optionmenu">
+			<widget class="GtkButton" id="reset-compat-defaults-button">
 			  <property name="visible">True</property>
 			  <property name="can_focus">True</property>
-			  <property name="history">0</property>
-			  <accessibility>
-			    <atkrelation target="delete-binding-optionmenu-label" type="labelled-by"/>
-			  </accessibility>
-
-			  <child internal-child="menu">
-			    <widget class="GtkMenu" id="convertwidget19">
-			      <property name="visible">True</property>
-
-			      <child>
-				<widget class="GtkMenuItem" id="convertwidget20">
-				  <property name="visible">True</property>
-				  <property name="label" translatable="yes">ASCII DEL</property>
-				  <property name="use_underline">True</property>
-				</widget>
-			      </child>
-
-			      <child>
-				<widget class="GtkMenuItem" id="convertwidget21">
-				  <property name="visible">True</property>
-				  <property name="label" translatable="yes">Escape sequence</property>
-				  <property name="use_underline">True</property>
-				</widget>
-			      </child>
-
-			      <child>
-				<widget class="GtkMenuItem" id="convertwidget22">
-				  <property name="visible">True</property>
-				  <property name="label" translatable="yes">Control-H</property>
-				  <property name="use_underline">True</property>
-				</widget>
-			      </child>
-			    </widget>
-			  </child>
+			  <property name="label" translatable="yes">_Reset compatibility options to defaults</property>
+			  <property name="use_underline">True</property>
+			  <property name="relief">GTK_RELIEF_NORMAL</property>
 			</widget>
 		      </child>
 		    </widget>
 		    <packing>
-		      <property name="left_attach">1</property>
-		      <property name="right_attach">3</property>
-		      <property name="top_attach">1</property>
-		      <property name="bottom_attach">2</property>
-		      <property name="y_options"></property>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
 		    </packing>
 		  </child>
 		</widget>
+	      </child>
+
+	      <child>
+		<widget class="GtkLabel" id="label72">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">Compatibility</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>
+		</widget>
 		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">True</property>
-		  <property name="fill">True</property>
+		  <property name="type">label_item</property>
 		</packing>
 	      </child>
+	    </widget>
+	    <packing>
+	      <property name="tab_expand">False</property>
+	      <property name="tab_fill">True</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkLabel" id="label54">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">Compatibility</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.5</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">0</property>
+	      <property name="ypad">0</property>
+	    </widget>
+	    <packing>
+	      <property name="type">tab</property>
+	    </packing>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">True</property>
+	  <property name="fill">True</property>
+	</packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+<widget class="GtkDialog" id="keybindings-dialog">
+  <property name="title" translatable="yes">Keybindings Editor</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="has_separator">False</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="dialog-vbox2">
+      <property name="border_width">2</property>
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">8</property>
+
+      <child internal-child="action_area">
+	<widget class="GtkHButtonBox" id="dialog-action_area2">
+	  <property name="border_width">5</property>
+	  <property name="visible">True</property>
+	  <property name="layout_style">GTK_BUTTONBOX_END</property>
+	  <property name="spacing">10</property>
+
+	  <child>
+	    <widget class="GtkButton" id="close_button1">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="has_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-close</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="response_id">-7</property>
+	    </widget>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">False</property>
+	  <property name="fill">True</property>
+	  <property name="pack_type">GTK_PACK_END</property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkTable" id="table32">
+	  <property name="border_width">8</property>
+	  <property name="visible">True</property>
+	  <property name="n_rows">4</property>
+	  <property name="n_columns">1</property>
+	  <property name="homogeneous">False</property>
+	  <property name="row_spacing">4</property>
+	  <property name="column_spacing">4</property>
+
+	  <child>
+	    <widget class="GtkCheckButton" id="disable-mnemonics-checkbutton">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label" translatable="yes">Disable all menu mnemonics (such as Alt+f to open File menu)</property>
+	      <property name="use_underline">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="active">False</property>
+	      <property name="inconsistent">False</property>
+	      <property name="draw_indicator">True</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"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkScrolledWindow" id="scrolledwindow1">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
+	      <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+	      <property name="shadow_type">GTK_SHADOW_IN</property>
+	      <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
 
 	      <child>
-		<widget class="GtkAlignment" id="reset-compat-defaults-button">
+		<widget class="GtkTreeView" id="accelerators-treeview">
 		  <property name="visible">True</property>
-		  <property name="xalign">1.11759e-08</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xscale">0</property>
-		  <property name="yscale">0</property>
+		  <property name="can_focus">True</property>
+		  <property name="headers_visible">True</property>
+		  <property name="rules_hint">True</property>
+		  <property name="reorderable">False</property>
+		  <property name="enable_search">True</property>
+		</widget>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">0</property>
+	      <property name="right_attach">1</property>
+	      <property name="top_attach">3</property>
+	      <property name="bottom_attach">4</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkLabel" id="label59">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">A_ccelerators:</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</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">0</property>
+	      <property name="ypad">0</property>
+	      <property name="mnemonic_widget">accelerators-treeview</property>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">0</property>
+	      <property name="right_attach">1</property>
+	      <property name="top_attach">2</property>
+	      <property name="bottom_attach">3</property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkCheckButton" id="disable-menu-accel-checkbutton">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label" translatable="yes">Disable menu access key (F10 by default)</property>
+	      <property name="use_underline">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="active">False</property>
+	      <property name="inconsistent">False</property>
+	      <property name="draw_indicator">True</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"></property>
+	    </packing>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">True</property>
+	  <property name="fill">True</property>
+	</packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+<widget class="GtkWindow" id="custom-palette-popup">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">custom-palette-popup</property>
+  <property name="type">GTK_WINDOW_POPUP</property>
+  <property name="window_position">GTK_WIN_POS_MOUSE</property>
+  <property name="modal">False</property>
+  <property name="resizable">False</property>
+  <property name="destroy_with_parent">True</property>
+
+  <child>
+    <widget class="GtkFrame" id="frame16">
+      <property name="visible">True</property>
+      <property name="label_xalign">0</property>
+      <property name="label_yalign">0.5</property>
+      <property name="shadow_type">GTK_SHADOW_OUT</property>
+
+      <child>
+	<widget class="GtkTable" id="table33">
+	  <property name="border_width">4</property>
+	  <property name="visible">True</property>
+	  <property name="n_rows">4</property>
+	  <property name="n_columns">6</property>
+	  <property name="homogeneous">False</property>
+	  <property name="row_spacing">4</property>
+	  <property name="column_spacing">4</property>
+
+	  <child>
+	    <widget class="GtkLabel" id="label62">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">_Saturation:</property>
+	      <property name="use_underline">True</property>
+	      <property name="use_markup">False</property>
+	      <property name="justify">GTK_JUSTIFY_RIGHT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">1</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">4</property>
+	      <property name="ypad">0</property>
+	      <property name="mnemonic_widget">regular-saturation-spinbutton</property>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">0</property>
+	      <property name="right_attach">1</property>
+	      <property name="top_attach">2</property>
+	      <property name="bottom_attach">3</property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkLabel" id="label63">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">&lt;b&gt;Bright Shades&lt;/b&gt;</property>
+	      <property name="use_underline">False</property>
+	      <property name="use_markup">True</property>
+	      <property name="justify">GTK_JUSTIFY_CENTER</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>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">2</property>
+	      <property name="right_attach">4</property>
+	      <property name="top_attach">0</property>
+	      <property name="bottom_attach">1</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkLabel" id="label61">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">&lt;b&gt;Dark Shades&lt;/b&gt;</property>
+	      <property name="use_underline">False</property>
+	      <property name="use_markup">True</property>
+	      <property name="justify">GTK_JUSTIFY_CENTER</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>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">0</property>
+	      <property name="right_attach">2</property>
+	      <property name="top_attach">0</property>
+	      <property name="bottom_attach">1</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkHSeparator" id="hseparator1">
+	      <property name="visible">True</property>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">0</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>
+	    </packing>
+	  </child>
 
-		  <child>
-		    <widget class="GtkButton" id="reset-compat-defaults-button">
-		      <property name="visible">True</property>
-		      <property name="can_focus">True</property>
-		      <property name="label" translatable="yes">_Reset compatibility options to defaults</property>
-		      <property name="use_underline">True</property>
-		      <property name="relief">GTK_RELIEF_NORMAL</property>
-		    </widget>
-		  </child>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">False</property>
-		  <property name="fill">False</property>
-		</packing>
-	      </child>
+	  <child>
+	    <widget class="GtkHSeparator" id="hseparator2">
+	      <property name="visible">True</property>
 	    </widget>
 	    <packing>
-	      <property name="tab_expand">False</property>
-	      <property name="tab_fill">True</property>
+	      <property name="left_attach">2</property>
+	      <property name="right_attach">4</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="label54">
+	    <widget class="GtkLabel" id="label64">
 	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">Compatibility</property>
+	      <property name="label" translatable="yes">S_aturation:</property>
 	      <property name="use_underline">True</property>
 	      <property name="use_markup">False</property>
-	      <property name="justify">GTK_JUSTIFY_CENTER</property>
+	      <property name="justify">GTK_JUSTIFY_RIGHT</property>
 	      <property name="wrap">False</property>
 	      <property name="selectable">False</property>
-	      <property name="xalign">0.5</property>
+	      <property name="xalign">1</property>
 	      <property name="yalign">0.5</property>
-	      <property name="xpad">0</property>
+	      <property name="xpad">4</property>
 	      <property name="ypad">0</property>
+	      <property name="mnemonic_widget">intensive-saturation-spinbutton</property>
 	    </widget>
 	    <packing>
-	      <property name="type">tab</property>
+	      <property name="left_attach">2</property>
+	      <property name="right_attach">3</property>
+	      <property name="top_attach">2</property>
+	      <property name="bottom_attach">3</property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options"></property>
 	    </packing>
 	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">True</property>
-	  <property name="fill">True</property>
-	</packing>
-      </child>
-    </widget>
-  </child>
-</widget>
 
-<widget class="GtkDialog" id="keybindings-dialog">
-  <property name="title" translatable="yes">Keybindings Editor</property>
-  <property name="type">GTK_WINDOW_TOPLEVEL</property>
-  <property name="window_position">GTK_WIN_POS_NONE</property>
-  <property name="modal">False</property>
-  <property name="resizable">True</property>
-  <property name="destroy_with_parent">False</property>
-  <property name="has_separator">False</property>
+	  <child>
+	    <widget class="GtkLabel" id="label65">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">Va_lue:</property>
+	      <property name="use_underline">True</property>
+	      <property name="use_markup">False</property>
+	      <property name="justify">GTK_JUSTIFY_RIGHT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">1</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">4</property>
+	      <property name="ypad">0</property>
+	      <property name="mnemonic_widget">intensive-intensity-spinbutton</property>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">2</property>
+	      <property name="right_attach">3</property>
+	      <property name="top_attach">3</property>
+	      <property name="bottom_attach">4</property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
 
-  <child internal-child="vbox">
-    <widget class="GtkVBox" id="dialog-vbox2">
-      <property name="border_width">2</property>
-      <property name="visible">True</property>
-      <property name="homogeneous">False</property>
-      <property name="spacing">8</property>
+	  <child>
+	    <widget class="GtkLabel" id="label66">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">_Value:</property>
+	      <property name="use_underline">True</property>
+	      <property name="use_markup">False</property>
+	      <property name="justify">GTK_JUSTIFY_RIGHT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">1</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">4</property>
+	      <property name="ypad">0</property>
+	      <property name="mnemonic_widget">regular-intensity-spinbutton</property>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">0</property>
+	      <property name="right_attach">1</property>
+	      <property name="top_attach">3</property>
+	      <property name="bottom_attach">4</property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
 
-      <child internal-child="action_area">
-	<widget class="GtkHButtonBox" id="dialog-action_area2">
-	  <property name="border_width">5</property>
-	  <property name="visible">True</property>
-	  <property name="layout_style">GTK_BUTTONBOX_END</property>
-	  <property name="spacing">10</property>
+	  <child>
+	    <widget class="GtkSpinButton" id="regular-saturation-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">128 0 255 1 16 64</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="x_options">fill</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
 
 	  <child>
-	    <widget class="GtkButton" id="close_button1">
+	    <widget class="GtkSpinButton" id="regular-intensity-spinbutton">
 	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="has_default">True</property>
 	      <property name="can_focus">True</property>
-	      <property name="label">gtk-close</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="response_id">-7</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">128 0 255 1 16 64</property>
 	    </widget>
+	    <packing>
+	      <property name="left_attach">1</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>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">True</property>
-	  <property name="pack_type">GTK_PACK_END</property>
-	</packing>
-      </child>
 
-      <child>
-	<widget class="GtkTable" id="table32">
-	  <property name="border_width">8</property>
-	  <property name="visible">True</property>
-	  <property name="n_rows">4</property>
-	  <property name="n_columns">1</property>
-	  <property name="homogeneous">False</property>
-	  <property name="row_spacing">4</property>
-	  <property name="column_spacing">4</property>
+	  <child>
+	    <widget class="GtkSpinButton" id="intensive-saturation-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">128 0 255 1 16 64</property>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">3</property>
+	      <property name="right_attach">4</property>
+	      <property name="top_attach">2</property>
+	      <property name="bottom_attach">3</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
 
 	  <child>
-	    <widget class="GtkCheckButton" id="disable-mnemonics-checkbutton">
+	    <widget class="GtkSpinButton" id="intensive-intensity-spinbutton">
 	      <property name="visible">True</property>
 	      <property name="can_focus">True</property>
-	      <property name="label" translatable="yes">Disable all menu mnemonics (such as Alt+f to open File menu)</property>
-	      <property name="use_underline">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="active">False</property>
-	      <property name="inconsistent">False</property>
-	      <property name="draw_indicator">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">170 0 255 1 16 64</property>
 	    </widget>
 	    <packing>
-	      <property name="left_attach">0</property>
-	      <property name="right_attach">1</property>
+	      <property name="left_attach">3</property>
+	      <property name="right_attach">4</property>
+	      <property name="top_attach">3</property>
+	      <property name="bottom_attach">4</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkLabel" id="label74">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">&lt;b&gt;Gray Shades&lt;/b&gt;</property>
+	      <property name="use_underline">False</property>
+	      <property name="use_markup">True</property>
+	      <property name="justify">GTK_JUSTIFY_CENTER</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>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">4</property>
+	      <property name="right_attach">6</property>
 	      <property name="top_attach">0</property>
 	      <property name="bottom_attach">1</property>
 	      <property name="x_options">fill</property>
@@ -2654,51 +3172,37 @@
 	  </child>
 
 	  <child>
-	    <widget class="GtkScrolledWindow" id="scrolledwindow1">
+	    <widget class="GtkHSeparator" id="hseparator3">
 	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
-	      <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-	      <property name="shadow_type">GTK_SHADOW_IN</property>
-	      <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
-	      <child>
-		<widget class="GtkTreeView" id="accelerators-treeview">
-		  <property name="visible">True</property>
-		  <property name="can_focus">True</property>
-		  <property name="headers_visible">True</property>
-		  <property name="rules_hint">True</property>
-		  <property name="reorderable">False</property>
-		  <property name="enable_search">True</property>
-		</widget>
-	      </child>
 	    </widget>
 	    <packing>
-	      <property name="left_attach">0</property>
-	      <property name="right_attach">1</property>
-	      <property name="top_attach">3</property>
-	      <property name="bottom_attach">4</property>
+	      <property name="left_attach">4</property>
+	      <property name="right_attach">6</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="label59">
+	    <widget class="GtkLabel" id="label75">
 	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">A_ccelerators:</property>
+	      <property name="label" translatable="yes">_Black Level:</property>
 	      <property name="use_underline">True</property>
 	      <property name="use_markup">False</property>
-	      <property name="justify">GTK_JUSTIFY_LEFT</property>
+	      <property name="justify">GTK_JUSTIFY_RIGHT</property>
 	      <property name="wrap">False</property>
 	      <property name="selectable">False</property>
-	      <property name="xalign">0</property>
+	      <property name="xalign">1</property>
 	      <property name="yalign">0.5</property>
-	      <property name="xpad">0</property>
+	      <property name="xpad">4</property>
 	      <property name="ypad">0</property>
-	      <property name="mnemonic_widget">accelerators-treeview</property>
+	      <property name="mnemonic_widget">black-level-spinbutton</property>
 	    </widget>
 	    <packing>
-	      <property name="left_attach">0</property>
-	      <property name="right_attach">1</property>
+	      <property name="left_attach">4</property>
+	      <property name="right_attach">5</property>
 	      <property name="top_attach">2</property>
 	      <property name="bottom_attach">3</property>
 	      <property name="x_options">fill</property>
@@ -2707,31 +3211,72 @@
 	  </child>
 
 	  <child>
-	    <widget class="GtkCheckButton" id="disable-menu-accel-checkbutton">
+	    <widget class="GtkLabel" id="label76">
 	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label" translatable="yes">Disable menu access key (F10 by default)</property>
+	      <property name="label" translatable="yes">_White Level:</property>
 	      <property name="use_underline">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="active">False</property>
-	      <property name="inconsistent">False</property>
-	      <property name="draw_indicator">True</property>
+	      <property name="use_markup">False</property>
+	      <property name="justify">GTK_JUSTIFY_RIGHT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">1</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">4</property>
+	      <property name="ypad">0</property>
+	      <property name="mnemonic_widget">white-level-spinbutton</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="left_attach">4</property>
+	      <property name="right_attach">5</property>
+	      <property name="top_attach">3</property>
+	      <property name="bottom_attach">4</property>
 	      <property name="x_options">fill</property>
 	      <property name="y_options"></property>
 	    </packing>
 	  </child>
+
+	  <child>
+	    <widget class="GtkSpinButton" id="black-level-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">0 0 255 1 16 64</property>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">5</property>
+	      <property name="right_attach">6</property>
+	      <property name="top_attach">2</property>
+	      <property name="bottom_attach">3</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkSpinButton" id="white-level-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">255 0 255 1 16 64</property>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">5</property>
+	      <property name="right_attach">6</property>
+	      <property name="top_attach">3</property>
+	      <property name="bottom_attach">4</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
 	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">True</property>
-	  <property name="fill">True</property>
-	</packing>
       </child>
     </widget>
   </child>
Index: src/profile-editor.c
===================================================================
RCS file: /cvs/gnome/profterm/src/profile-editor.c,v
retrieving revision 1.33
diff -u -r1.33 profile-editor.c
--- src/profile-editor.c	26 May 2002 15:01:17 -0000	1.33
+++ src/profile-editor.c	18 Jun 2002 22:04:04 -0000
@@ -21,16 +21,17 @@
 
 #include "profile-editor.h"
 #include "terminal-intl.h"
-#include <glade/glade.h>
 #include <libgnome/gnome-help.h>
 #include <libgnomeui/gnome-color-picker.h>
 #include <libgnomeui/gnome-font-picker.h>
 #include <libgnomeui/gnome-file-entry.h>
 #include <libgnomeui/gnome-icon-entry.h>
+#include <gdk/gdkkeysyms.h>
 #include <string.h>
 #include <math.h>
 #include "simple-x-font-selector.h"
 #include "terminal-widget.h"
+#include "terminal.h"
 
 #define BYTES_PER_LINE (terminal_widget_get_estimated_bytes_per_scrollback_line ())
 
@@ -65,7 +66,8 @@
 static TerminalPaletteScheme palette_schemes[] = {
   { N_("Linux console"), terminal_palette_linux },
   { N_("XTerm"), terminal_palette_xterm },
-  { N_("Rxvt"), terminal_palette_rxvt }
+  { N_("Rxvt"), terminal_palette_rxvt },
+  { N_("Pastell"), terminal_palette_pastell }
 };
 
 static GtkWidget* profile_editor_get_widget                  (GtkWidget       *editor,
@@ -136,12 +138,37 @@
 static void       profile_editor_update_font                 (GtkWidget       *widget,
                                                               TerminalProfile *profile);
 
+static void       profile_editor_update_custom_palette       (GtkWidget       *widget,
+                                                              TerminalProfile *profile);
 
-static void profile_forgotten (TerminalProfile     *profile,
-                               GtkWidget           *editor);
-static void profile_changed   (TerminalProfile     *profile,
-                               TerminalSettingMask  mask,
-                               GtkWidget           *editor);
+static void       profile_forgotten                          (TerminalProfile *profile,
+                                                              GtkWidget       *editor);
+static void       profile_changed                            (TerminalProfile *profile,
+                                                              TerminalSettingMask *mask,
+                                                              GtkWidget       *editor);
+
+static void       regular_saturation_changed                 (GtkWidget       *widget,
+                                                              TerminalProfile *profile);
+static void       regular_intensity_changed                  (GtkWidget       *widget,
+                                                              TerminalProfile *profile);
+static void       intensive_saturation_changed               (GtkWidget       *widget,
+                                                              TerminalProfile *profile);
+static void       intensive_intensity_changed                (GtkWidget       *widget,
+                                                              TerminalProfile *profile);
+static void       initialize_custom_palette_clicked          (GtkWidget       *button,
+                                                              TerminalProfile *profile);
+static void       custom_palette_popup_destroyed             (GtkWidget       *popup,
+                                                              TerminalProfile *profile);
+static gboolean   custom_palette_popup_grab_on_window        (GdkWindow       *window,
+                                                              guint32         activate_time);
+static gint       custom_palette_popup_delete_event          (GtkWidget       *widget, 
+                                                              gpointer        data);
+static gint       custom_palette_popup_key_press_event       (GtkWidget       *widget, 
+                                                              GdkEventKey     *event, 
+                                                              gpointer        data);
+static gint       custom_palette_popup_button_press_event    (GtkWidget       *widget, 
+                                                              GdkEventButton  *event, 
+                                                              gpointer        data);
 
 
 static void
@@ -245,102 +272,102 @@
 }
 
 static void
-profile_changed (TerminalProfile          *profile,
-                 TerminalSettingMask       mask,
-                 GtkWidget                *editor)
+profile_changed (TerminalProfile     *profile,
+                 TerminalSettingMask *mask,
+                 GtkWidget           *editor)
 {
-  if (mask & TERMINAL_SETTING_VISIBLE_NAME)
+  if (mask->visible_name)
     profile_editor_update_visible_name (editor, profile);
 
-  if (mask & TERMINAL_SETTING_ICON)
+  if (mask->icon_file)
     profile_editor_update_icon (editor, profile);
   
-  if (mask & TERMINAL_SETTING_CURSOR_BLINK)
+  if (mask->cursor_blink)
     profile_editor_update_cursor_blink (editor, profile);
 
-  if (mask & TERMINAL_SETTING_DEFAULT_SHOW_MENUBAR)
+  if (mask->default_show_menubar)
     profile_editor_update_default_show_menubar (editor, profile);
 
-  if ((mask & TERMINAL_SETTING_FOREGROUND_COLOR) ||
-      (mask & TERMINAL_SETTING_BACKGROUND_COLOR))
+  if (mask->foreground_color ||
+      mask->background_color)
     {
       profile_editor_update_color_scheme_menu (editor, profile);
       profile_editor_update_color_pickers (editor, profile);
     }
 
-  if (mask & TERMINAL_SETTING_TITLE)
+  if (mask->title)
     profile_editor_update_title (editor, profile);
   
-  if (mask & TERMINAL_SETTING_TITLE_MODE)
+  if (mask->title_mode)
     profile_editor_update_title_mode (editor, profile);
 
-  if (mask & TERMINAL_SETTING_ALLOW_BOLD)
+  if (mask->allow_bold)
     profile_editor_update_allow_bold (editor, profile);
 
-  if (mask & TERMINAL_SETTING_SILENT_BELL)
+  if (mask->silent_bell)
     profile_editor_update_silent_bell (editor, profile);
 
-  if (mask & TERMINAL_SETTING_WORD_CHARS)
+  if (mask->word_chars)
     profile_editor_update_word_chars (editor, profile);
 
-  if (mask & TERMINAL_SETTING_SCROLLBAR_POSITION)
+  if (mask->scrollbar_position)
     profile_editor_update_scrollbar_position (editor, profile);
 
-  if (mask & TERMINAL_SETTING_SCROLLBACK_LINES)
+  if (mask->scrollback_lines)
     profile_editor_update_scrollback_lines (editor, profile);
 
-  if (mask & TERMINAL_SETTING_SCROLL_ON_KEYSTROKE)
+  if (mask->scroll_on_keystroke)
     profile_editor_update_scroll_on_keystroke (editor, profile);
 
-  if (mask & TERMINAL_SETTING_SCROLL_ON_OUTPUT)
+  if (mask->scroll_on_output)
     profile_editor_update_scroll_on_output (editor, profile);
 
-  if (mask & TERMINAL_SETTING_EXIT_ACTION)
+  if (mask->exit_action)
     profile_editor_update_exit_action (editor, profile);
 
-  if (mask & TERMINAL_SETTING_LOGIN_SHELL)
+  if (mask->login_shell)
     profile_editor_update_login_shell (editor, profile);
 
-  if (mask & TERMINAL_SETTING_UPDATE_RECORDS)
+  if (mask->update_records)
     profile_editor_update_update_records (editor, profile);
 
-  if (mask & TERMINAL_SETTING_USE_CUSTOM_COMMAND)
+  if (mask->use_custom_command)
     profile_editor_update_use_custom_command (editor, profile);
 
-  if (mask & TERMINAL_SETTING_CUSTOM_COMMAND)
+  if (mask->custom_command)
     profile_editor_update_custom_command (editor, profile);
 
-  if (mask & TERMINAL_SETTING_PALETTE)
+  if (mask->palette)
     profile_editor_update_palette (editor, profile);
 
-  if (mask & TERMINAL_SETTING_X_FONT)
+  if (mask->x_font)
     profile_editor_update_x_font (editor, profile);
 
-  if (mask & TERMINAL_SETTING_BACKGROUND_TYPE)
+  if (mask->background_type)
     profile_editor_update_background_type (editor, profile);
   
-  if (mask & TERMINAL_SETTING_BACKGROUND_IMAGE)
+  if (mask->background_image_file)
     profile_editor_update_background_image (editor, profile);
 
-  if (mask & TERMINAL_SETTING_SCROLL_BACKGROUND)
+  if (mask->scroll_background)
     profile_editor_update_scroll_background (editor, profile);
 
-  if (mask & TERMINAL_SETTING_BACKGROUND_DARKNESS)
+  if (mask->background_darkness)
     profile_editor_update_background_darkness (editor, profile);
 
-  if (mask & TERMINAL_SETTING_BACKSPACE_BINDING)
+  if (mask->backspace_binding)
     profile_editor_update_backspace_binding (editor, profile);
 
-  if (mask & TERMINAL_SETTING_DELETE_BINDING)
+  if (mask->delete_binding)
     profile_editor_update_delete_binding (editor, profile);
 
-  if (mask & TERMINAL_SETTING_USE_THEME_COLORS)
+  if (mask->use_theme_colors)
     profile_editor_update_use_theme_colors (editor, profile);
     
-  if (mask & TERMINAL_SETTING_USE_SYSTEM_FONT)
+  if (mask->use_system_font)
     profile_editor_update_use_system_font (editor, profile);
 
-  if (mask & TERMINAL_SETTING_FONT)
+  if (mask->font)
     profile_editor_update_font (editor, profile);
   
   profile_editor_update_sensitivity (editor, profile);
@@ -635,8 +662,7 @@
   i = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (colorpicker),
                                           "palette-entry-index"));
 
-  terminal_profile_set_palette_entry (profile, i,
-                                      &color);
+  terminal_profile_set_palette_entry (profile, i, &color);
 }
 
 static void
@@ -907,8 +933,7 @@
   GtkWidget *editor, *fontsel;
   GtkWindow *old_transient_parent;
 
-  editor = g_object_get_data (G_OBJECT (profile),
-                              "editor-window");
+  editor = g_object_get_data (G_OBJECT (profile), "editor-window");
 
   if (editor == NULL)
     {
@@ -918,49 +943,10 @@
       gint i;
       GtkSizeGroup *size_group;
       
-      if (g_file_test ("./"TERM_GLADE_FILE,
-                       G_FILE_TEST_EXISTS))
-        {
-          /* Try current dir, for debugging */
-          xml = glade_xml_new ("./"TERM_GLADE_FILE,
-                               "profile-editor-dialog",
-                               GETTEXT_PACKAGE);
-        }
-      else
-        {
-          xml = glade_xml_new (TERM_GLADE_DIR"/"TERM_GLADE_FILE,
-                               "profile-editor-dialog",
-                               GETTEXT_PACKAGE);
-        }
-
-      if (xml == NULL)
-        {
-          static GtkWidget *no_glade_dialog = NULL;
-          
-          if (no_glade_dialog == NULL)
-            {
-              no_glade_dialog =
-                gtk_message_dialog_new (transient_parent,
-                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                        GTK_MESSAGE_ERROR,
-                                        GTK_BUTTONS_CLOSE,
-                                        _("The file \"%s\" is missing. This indicates that the application is installed incorrectly, so the profile editor can't be displayed."),
-                                        TERM_GLADE_DIR"/"TERM_GLADE_FILE);
-                                        
-              g_signal_connect (G_OBJECT (no_glade_dialog),
-                                "response",
-                                G_CALLBACK (gtk_widget_destroy),
-                                NULL);
-
-              g_object_add_weak_pointer (G_OBJECT (no_glade_dialog),
-                                         (void**)&no_glade_dialog);
-            }
-
-          gtk_window_present (GTK_WINDOW (no_glade_dialog));
-
+      if (NULL == (xml = terminal_util_get_dialog (transient_parent, 
+                                                   "profile-editor-dialog")))
           return;
-        }
-      
+
       old_transient_parent = NULL;
       
       editor = glade_xml_get_widget (xml, "profile-editor-dialog");
@@ -1219,10 +1205,9 @@
                         profile);
 
       
-      i = 0;
-      while (i < TERMINAL_PALETTE_SIZE)
+      for (i = 0; i < TERMINAL_PALETTE_SIZE; ++i)
         {
-          char *s = g_strdup_printf ("palette-colorpicker-%d", i+1);
+          char *s = g_strdup_printf ("palette-colorpicker-%d", i + 1);
           
           w = glade_xml_get_widget (xml, s);
           g_assert (w);
@@ -1236,13 +1221,11 @@
                             profile);
           
           g_free (s);
-
-          ++i;
         }
 
       profile_editor_update_palette (editor, profile);
 
-      w = glade_xml_get_widget (xml, "font-hbox");
+      w = glade_xml_get_widget (xml, "font-vbox");
 
       if (terminal_widget_supports_pango_fonts ())
         {
@@ -1289,6 +1272,11 @@
       g_signal_connect (G_OBJECT (w), "clicked",
 			G_CALLBACK (reset_compat_defaults_clicked),
 			profile);
+                        
+      w = glade_xml_get_widget (xml, "initialize-custom-palette-button");
+      g_signal_connect (G_OBJECT (w), "clicked",
+			G_CALLBACK (initialize_custom_palette_clicked),
+                        profile);
     }
   else
     {
@@ -1330,8 +1318,15 @@
    * thus the last mask is 0, which means everything is sensitive,
    * which is what we want.
    */
-  last_mask = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (editor),
-                                                  "cached-lock-mask"));
+  {
+    TerminalSettingMask *last_mask_ptr = (TerminalSettingMask *) 
+        g_object_get_data (G_OBJECT (editor), "cached-lock-mask");
+
+    if (last_mask_ptr)
+      last_mask = *last_mask_ptr;
+    else
+      TERMINAL_SETTING_MASK_CLEAR (last_mask);
+  }
   
   mask = terminal_profile_get_locked_settings (profile);
 
@@ -1339,22 +1334,21 @@
    * it depends on settings
    */
   w = profile_editor_get_widget (editor, "custom-command-entry");
-  gtk_widget_set_sensitive (w,
-                            !((mask & TERMINAL_SETTING_CUSTOM_COMMAND) ||
-                              !terminal_profile_get_use_custom_command (profile))); 
+  gtk_widget_set_sensitive (w, !mask.custom_command &&
+                               terminal_profile_get_use_custom_command (profile)); 
   if (terminal_profile_get_background_type (profile) == TERMINAL_BACKGROUND_IMAGE)
     {
       w = profile_editor_get_widget (editor, "background-image-fileentry");
-      gtk_widget_set_sensitive (w, !(mask & TERMINAL_SETTING_BACKGROUND_IMAGE));
+      gtk_widget_set_sensitive (w, !mask.background_image_file);
       w = profile_editor_get_widget (editor, "scroll-background-checkbutton");
-      gtk_widget_set_sensitive (w, !(mask & TERMINAL_SETTING_SCROLL_BACKGROUND));
+      gtk_widget_set_sensitive (w, !mask.scroll_background);
       w = profile_editor_get_widget (editor, "darken-background-vbox");
-      gtk_widget_set_sensitive (w, !(mask & TERMINAL_SETTING_BACKGROUND_DARKNESS));
+      gtk_widget_set_sensitive (w, !mask.background_darkness);
     }
   else if (terminal_profile_get_background_type (profile) == TERMINAL_BACKGROUND_TRANSPARENT) 
   {
       w = profile_editor_get_widget (editor, "darken-background-vbox");
-      gtk_widget_set_sensitive (w, !(mask & TERMINAL_SETTING_BACKGROUND_DARKNESS));
+      gtk_widget_set_sensitive (w, !mask.background_darkness);
       w = profile_editor_get_widget (editor, "background-image-fileentry");
       gtk_widget_set_sensitive (w, FALSE);
       w = profile_editor_get_widget (editor, "scroll-background-checkbutton");
@@ -1374,15 +1368,13 @@
   if (!terminal_profile_get_use_system_font (profile))
     {
       if (terminal_widget_supports_pango_fonts ())
-        set_insensitive (editor, "font-hbox",
-                     mask & TERMINAL_SETTING_FONT);
+        set_insensitive (editor, "font-vbox", mask.font);
       else
-        set_insensitive (editor, "font-hbox",
-                     mask & TERMINAL_SETTING_X_FONT);
+        set_insensitive (editor, "font-vbox", mask.x_font);
     }
   else
     {
-      w = profile_editor_get_widget (editor, "font-hbox");
+      w = profile_editor_get_widget (editor, "font-vbox");
       gtk_widget_set_sensitive (w, FALSE);
     }
 
@@ -1396,98 +1388,98 @@
   else
     {      
       set_insensitive (editor, "foreground-colorpicker",
-                       mask & TERMINAL_SETTING_FOREGROUND_COLOR);
+                       mask.foreground_color);
       
       set_insensitive (editor, "background-colorpicker",
-                       mask & TERMINAL_SETTING_BACKGROUND_COLOR);
+                       mask.background_color);
       
       set_insensitive (editor, "color-scheme-optionmenu",
-                       (mask & (TERMINAL_SETTING_BACKGROUND_COLOR |
-                                TERMINAL_SETTING_FOREGROUND_COLOR)));
+                       mask.background_color |
+                       mask.foreground_color);
     }
   
 #if 0 /* uncomment once we've tested the sensitivity code */
-  if (mask == last_mask)
+  if (TERMINAL_SETTING_MASK_EQUAL (mask, last_mask))
     return;
 #endif
 
-  g_object_set_data (G_OBJECT (editor), "cached-lock-mask",
-                     GINT_TO_POINTER (mask));
+  g_object_set_data_full (G_OBJECT (editor), "cached-lock-mask",
+                          g_memdup (&mask, sizeof (mask)), g_free);
   
   set_insensitive (editor, "profile-name-entry",
-                   mask & TERMINAL_SETTING_VISIBLE_NAME);
+                   mask.visible_name);
 
   set_insensitive (editor, "profile-icon-entry",
-                   mask & TERMINAL_SETTING_ICON);
+                   mask.icon_file);
   
   set_insensitive (editor, "blink-cursor-checkbutton",
-                   mask & TERMINAL_SETTING_CURSOR_BLINK);
+                   mask.cursor_blink);
 
   set_insensitive (editor, "show-menubar-checkbutton",
-                   mask & TERMINAL_SETTING_DEFAULT_SHOW_MENUBAR);
+                   mask.default_show_menubar);
 
   set_insensitive (editor, "title-entry",
-                   mask & TERMINAL_SETTING_TITLE);
+                   mask.title);
   
   set_insensitive (editor, "title-mode-optionmenu",
-                   mask & TERMINAL_SETTING_TITLE_MODE);
+                   mask.title_mode);
 
   set_insensitive (editor, "allow-bold-checkbutton",
-                   mask & TERMINAL_SETTING_ALLOW_BOLD);
+                   mask.allow_bold);
 
   set_insensitive (editor, "silent-bell-checkbutton",
-                   mask & TERMINAL_SETTING_SILENT_BELL);
+                   mask.silent_bell);
 
   set_insensitive (editor, "word-chars-entry",
-                   mask & TERMINAL_SETTING_WORD_CHARS);
+                   mask.word_chars);
 
   set_insensitive (editor, "scrollbar-position-optionmenu",
-                   mask & TERMINAL_SETTING_SCROLLBAR_POSITION);
+                   mask.scrollbar_position);
 
   set_insensitive (editor, "scrollback-lines-spinbutton",
-                   mask & TERMINAL_SETTING_SCROLLBACK_LINES);
+                   mask.scrollback_lines);
 
   set_insensitive (editor, "scrollback-kilobytes-spinbutton",
-                   mask & TERMINAL_SETTING_SCROLLBACK_LINES);
+                   mask.scrollback_lines);
   
   set_insensitive (editor, "scroll-on-keystroke-checkbutton",
-                   mask & TERMINAL_SETTING_SCROLL_ON_KEYSTROKE);
+                   mask.scroll_on_keystroke);
 
   set_insensitive (editor, "scroll-on-output-checkbutton",
-                   mask & TERMINAL_SETTING_SCROLL_ON_OUTPUT);
+                   mask.scroll_on_output);
 
   set_insensitive (editor, "exit-action-optionmenu",
-                   mask & TERMINAL_SETTING_EXIT_ACTION);
+                   mask.exit_action);
 
   set_insensitive (editor, "login-shell-checkbutton",
-                   mask & TERMINAL_SETTING_LOGIN_SHELL);
+                   mask.login_shell);
 
   set_insensitive (editor, "update-records-checkbutton",
-                   mask & TERMINAL_SETTING_UPDATE_RECORDS);
+                   mask.update_records);
 
   set_insensitive (editor, "use-custom-command-checkbutton",
-                   mask & TERMINAL_SETTING_USE_CUSTOM_COMMAND);
+                   mask.use_custom_command);
 
   set_insensitive (editor, "palette-optionmenu",
-                   mask & TERMINAL_SETTING_PALETTE);
+                   mask.palette);
 
   set_insensitive (editor, "solid-radiobutton",
-                   mask & TERMINAL_SETTING_BACKGROUND_TYPE);
+                   mask.background_type);
   set_insensitive (editor, "image-radiobutton",
-                   mask & TERMINAL_SETTING_BACKGROUND_TYPE);
+                   mask.background_type);
   set_insensitive (editor, "transparent-radiobutton",
-                   mask & TERMINAL_SETTING_BACKGROUND_TYPE);
+                   mask.background_type);
 
   set_insensitive (editor, "backspace-binding-optionmenu",
-                   mask & TERMINAL_SETTING_BACKSPACE_BINDING);
+                   mask.backspace_binding);
   set_insensitive (editor, "delete-binding-optionmenu",
-                   mask & TERMINAL_SETTING_DELETE_BINDING);
+                   mask.delete_binding);
 
   set_insensitive (editor, "use-theme-colors-checkbutton",
-                   mask & TERMINAL_SETTING_USE_THEME_COLORS);
+                   mask.use_theme_colors);
 
   set_insensitive (editor, "system-font-checkbutton",
-                   mask & TERMINAL_SETTING_USE_SYSTEM_FONT);
+                   mask.use_system_font);
 
   
   {
@@ -1498,13 +1490,16 @@
       {
         char *s = g_strdup_printf ("palette-colorpicker-%d", i+1);
 
-        set_insensitive (editor, s, mask & TERMINAL_SETTING_PALETTE);
+        set_insensitive (editor, s, mask.palette);
 
         g_free (s);
 
         ++i;
       }
   }
+
+  set_insensitive (editor, "initialize-custom-palette-button",
+                   mask.palette);
 }
 
 
@@ -1828,22 +1823,18 @@
 
   terminal_profile_get_palette (profile, palette);
   
-  i = 0;
-  while (i < TERMINAL_PALETTE_SIZE)
+  for (i = 0; i < TERMINAL_PALETTE_SIZE; ++i)
     {
       char *s = g_strdup_printf ("palette-colorpicker-%d", i+1);
       w = profile_editor_get_widget (editor, s);
       g_free (s);
       
       colorpicker_set_if_changed (w, &palette[i]);
-      
-      ++i;
     }
 
   w = profile_editor_get_widget (editor, "palette-optionmenu");
 
-  i = 0;
-  while (i < G_N_ELEMENTS (palette_schemes))
+  for (i = 0; i < G_N_ELEMENTS (palette_schemes); ++i)
     {
       int j;
       gboolean match;
@@ -1864,8 +1855,6 @@
 
       if (match)
         break;
-      
-      ++i;
     }
 
   /* If we didn't find a match, then we want the last option
@@ -2050,15 +2039,387 @@
   GladeXML *xml;
   GtkWidget *w;
   
-  xml = g_object_get_data (G_OBJECT (editor),
-                           "glade-xml");
-
+  xml = g_object_get_data (G_OBJECT (editor), "glade-xml");
   g_return_val_if_fail (xml, NULL);
   
   w = glade_xml_get_widget (xml, widget_name);
-
-  if (w == NULL)
-    g_error ("No such widget %s", widget_name);
+  if (w == NULL) g_error ("No such widget %s", widget_name);
   
   return w;
 }
+
+
+
+
+
+
+
+
+static void
+gdk_color_to_greyscale (GdkColor *color,
+                        unsigned *greyscale)
+{
+  *greyscale = (5 * color->red +
+                9 * color->green +
+                2 * color->blue) >> 4;
+}
+
+static void
+gdk_color_to_hsv (GdkColor *color, 
+                  unsigned *hue, 
+                  unsigned *saturation,
+                  unsigned *value)
+{
+  unsigned min = MIN (MIN (color->red, color->green), color->blue);
+  unsigned max = MAX (MAX (color->red, color->green), color->blue);
+  unsigned delta = max - min;
+
+  if (value)
+    *value = max;
+
+  if (saturation)
+    *saturation = max ? 65535 * delta / max : 0;
+  
+  if (hue)
+    if (max == color->red)
+      *hue = (color->green > color->blue ? 0 : 6) +
+           + (color->green - color->blue) * 60 / delta;
+    else if (max == color->green)
+      *hue = (color->blue > color->red ? 2 : 8) +
+           + (color->blue - color->red) * 60 / delta;
+    else /* if (max == color->blue) */
+      *hue = (color->red > color->green ? 4 : 10) +
+           + (color->red - color->green) * 60 / delta;
+}
+
+
+
+custom_palette_popup_get_parameter (GtkWidget  *editor,
+                                    const char *name,
+                                    int         preset)
+{
+  char *widget_name = g_strconcat (name, "-spinbutton", NULL);
+  GtkWidget *widget = profile_editor_get_widget (editor, widget_name);
+  g_free (widget_name);
+
+  if (widget)
+    return gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
+
+  g_warning ("Invalid custom-palette parameter: %s", name);
+  return preset;
+}
+
+
+static void
+profile_editor_update_custom_palette (GtkWidget       *editor,
+                                      TerminalProfile *profile)
+{
+  int regular_high, regular_low;
+  int intensive_high, intensive_low;
+  int black, dark, bright, white;
+
+  {
+    int sat = custom_palette_popup_get_parameter 
+                (editor, "regular-saturation", 85);
+    int val = custom_palette_popup_get_parameter 
+                (editor, "regular-intensity", 85);
+  
+    regular_high = val * 65535/255;
+    regular_low = (val * (255 - sat) / 255) * 65535/255;
+  }
+
+  {
+    int sat = custom_palette_popup_get_parameter 
+                (editor, "intensive-saturation", 85);
+    int val = custom_palette_popup_get_parameter 
+                (editor, "intensive-intensity", 85);
+  
+    intensive_high = val * 65535/255;
+    intensive_low = (val * (255 - sat) / 255) * 65535/255;
+  }
+  
+  {
+    black = custom_palette_popup_get_parameter 
+                (editor, "black-level", 0) * 65535/255;
+    white = custom_palette_popup_get_parameter 
+                (editor, "white-level", 255) * 65535/255;
+
+    dark = (white - black) * 1 / 3;
+    bright = (white - black) * 2 / 3;
+  }
+  
+  {
+    GdkColor palette[TERMINAL_PALETTE_SIZE] =
+      {
+        { 0, black,             black,              black },
+        { 0, regular_high,      regular_low,        regular_low },
+        { 0, regular_low,       regular_high,       regular_low },
+        { 0, regular_high,      regular_high,       regular_low },
+        { 0, regular_low,       regular_low,        regular_high },
+        { 0, regular_high,      regular_low,        regular_high },
+        { 0, regular_low,       regular_high,       regular_high },
+        { 0, bright,            bright,             bright },
+        { 0, dark,              dark,               dark },
+        { 0, intensive_high,    intensive_low,      intensive_low },
+        { 0, intensive_low,     intensive_high,     intensive_low },
+        { 0, intensive_high,    intensive_high,     intensive_low },
+        { 0, intensive_low,     intensive_low,      intensive_high },
+        { 0, intensive_high,    intensive_low,      intensive_high },
+        { 0, intensive_low,     intensive_high,     intensive_high },
+        { 0, white,             white,              white }
+      };
+
+    terminal_profile_set_palette (profile, palette);
+
+#ifdef DUMP_CUSTOM_PALETTE
+    {
+      int i;
+      
+      for (i = 0; i < TERMINAL_PALETTE_SIZE; ++i)
+        g_print ("  { 0, %04x, %04x, %04x },\n",
+                 palette[i].red, palette[i].green, palette[i].blue);
+    }
+#endif
+  }
+}
+
+static void
+custom_palette_popup_changed (GtkWidget       *widget,
+                              TerminalProfile *profile)
+{
+  int value = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
+  profile_editor_update_custom_palette (gtk_widget_get_toplevel (widget), 
+                                        profile);
+}
+
+static void
+initialize_custom_palette_clicked (GtkWidget       *button,
+                                   TerminalProfile *profile)
+{
+  GtkWidget *popup;
+
+  if (NULL == (popup = g_object_get_data (G_OBJECT (profile),
+                                          "custom-palette-popup")))
+    {
+      GtkWindow *editor = g_object_get_data (G_OBJECT (profile),
+                                             "editor-window");
+      GladeXML *xml = terminal_util_get_dialog(editor, "custom-palette-popup");
+      
+      if (NULL == xml) return;
+      g_return_if_fail(editor != NULL);
+      
+      popup = glade_xml_get_widget (xml, "custom-palette-popup");
+
+      g_object_set_data (G_OBJECT (profile), "custom-palette-popup", popup);
+      g_object_set_data_full (G_OBJECT (popup), "glade-xml", xml,
+                              (GDestroyNotify) g_object_unref);
+
+      g_signal_connect (G_OBJECT (popup), "destroy",
+                        G_CALLBACK (custom_palette_popup_destroyed),
+                        profile);
+
+      /* Temporarily grab pointer and keyboard on a window we know exists; we
+	 + * do this so that the grab (with owner events == TRUE) affects
+	 + * events generated when the window is mapped, such as enter
+	 + * notify events on subwidgets. If the grab fails, bail out.
+	 + */
+      if (!custom_palette_popup_grab_on_window (button->window,
+				                gtk_get_current_event_time ()))
+        return;
+
+      gtk_widget_add_events (popup, GDK_KEY_PRESS_MASK);
+      g_signal_connect (popup, "delete_event",
+			G_CALLBACK (custom_palette_popup_delete_event), 
+                        profile);
+      g_signal_connect (popup, "key_press_event",
+			G_CALLBACK (custom_palette_popup_key_press_event), 
+                        profile);
+      g_signal_connect (popup, "button_press_event",
+			G_CALLBACK (custom_palette_popup_button_press_event), 
+                        profile);
+
+      {
+        GdkColor palette[TERMINAL_PALETTE_SIZE];
+        int regular_saturation, regular_intensity;
+        int intensive_saturation, intensive_intensity;
+        int black, white;
+
+        GtkWidget *w;
+        int i;
+
+        terminal_profile_get_palette (profile, palette);
+
+        gdk_color_to_greyscale (palette + 0, &black);
+        gdk_color_to_greyscale (palette + 15, &white);
+
+        regular_saturation = regular_intensity =
+        intensive_saturation = intensive_intensity = 0;
+
+        for (i = 0; i < 6; ++i)
+          {
+            int sat, val;
+
+            gdk_color_to_hsv (palette + i + 1, NULL, &sat, &val);
+            regular_saturation+= sat;
+            regular_intensity+= val;
+
+            gdk_color_to_hsv (palette + i + 9, NULL, &sat, &val);
+            intensive_saturation+= sat;
+            intensive_intensity+= val;
+          }
+          
+        black/= 65535 / 255;
+        white/= 65535 / 255;
+
+        regular_saturation/= 6 * 257;
+        regular_intensity/= 6 * 257;
+
+        intensive_saturation/= 6 * 257;
+        intensive_intensity/= 6 * 257;
+        
+        w = glade_xml_get_widget (xml, "regular-saturation-spinbutton");
+        gtk_spin_button_set_value (GTK_SPIN_BUTTON (w), regular_saturation);
+        g_signal_connect (G_OBJECT (w), "value-changed",
+                          G_CALLBACK (custom_palette_popup_changed), profile);
+
+        w = glade_xml_get_widget (xml, "regular-intensity-spinbutton");
+        gtk_spin_button_set_value (GTK_SPIN_BUTTON (w), regular_intensity);
+        g_signal_connect (G_OBJECT (w), "value-changed",
+                          G_CALLBACK (custom_palette_popup_changed), profile);
+
+        w = glade_xml_get_widget (xml, "intensive-saturation-spinbutton");
+        gtk_spin_button_set_value (GTK_SPIN_BUTTON (w), intensive_saturation);
+        g_signal_connect (G_OBJECT (w), "value-changed",
+                          G_CALLBACK (custom_palette_popup_changed), profile);
+
+        w = glade_xml_get_widget (xml, "intensive-intensity-spinbutton");
+        gtk_spin_button_set_value (GTK_SPIN_BUTTON (w), intensive_intensity);
+        g_signal_connect (G_OBJECT (w), "value-changed",
+                          G_CALLBACK (custom_palette_popup_changed), profile);
+
+        w = glade_xml_get_widget (xml, "black-level-spinbutton");
+        gtk_spin_button_set_value (GTK_SPIN_BUTTON (w), black);
+        g_signal_connect (G_OBJECT (w), "value-changed",
+                          G_CALLBACK (custom_palette_popup_changed), profile);
+
+        w = glade_xml_get_widget (xml, "white-level-spinbutton");
+        gtk_spin_button_set_value (GTK_SPIN_BUTTON (w), white);
+        g_signal_connect (G_OBJECT (w), "value-changed",
+                          G_CALLBACK (custom_palette_popup_changed), profile);
+      }
+
+      /* Move the popup to the proper location
+       */      
+      {
+        GdkWindow *window;
+        gint x, y;
+      
+        window = gtk_widget_get_parent_window(button);
+        gdk_window_get_origin (window, &x, &y);
+        
+        x+= button->allocation.x + button->allocation.width;
+        y+= button->allocation.y;
+      
+        gtk_window_move (GTK_WINDOW(popup), x, y);
+      }
+      
+      gtk_window_present (GTK_WINDOW(popup));
+        
+      gtk_grab_add (popup);
+	
+      /* Now transfer our grabs to the popup window; this
+       * should always succeed.
+       */
+      custom_palette_popup_grab_on_window (popup->window,
+			                   gtk_get_current_event_time ());
+    }
+  else
+    {
+      gtk_widget_destroy (popup);
+    }
+}
+
+static void
+custom_palette_popup_destroyed (GtkWidget *popup,
+                                TerminalProfile *profile)
+{
+  g_object_set_data (G_OBJECT (profile), "custom-palette-popup", NULL);
+  g_object_set_data (G_OBJECT (popup), "glade-xml", NULL);
+  gtk_grab_remove (popup);
+}
+
+/* This function are yanked from gnome-dateedit.c */
+
+static gboolean
+custom_palette_popup_grab_on_window (GdkWindow *window,
+		                     guint32    activate_time)
+{
+  if (!gdk_pointer_grab (window, TRUE,
+                         GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
+			 GDK_POINTER_MOTION_MASK,
+			 NULL, NULL, activate_time)) 
+    {
+      if (!gdk_keyboard_grab (window, TRUE, activate_time))
+        {
+          return TRUE;
+        }
+      else
+        {
+          gdk_pointer_ungrab (activate_time);
+          return FALSE;
+	}
+    }
+ 
+  return FALSE;
+}
+
+static gint
+custom_palette_popup_delete_event (GtkWidget *widget, gpointer data)
+{
+  gtk_widget_destroy(widget);
+  return TRUE;
+}
+
+static gint
+custom_palette_popup_key_press_event (GtkWidget *widget, 
+                                      GdkEventKey *event, gpointer data)
+{
+  if (event->keyval != GDK_Escape) return FALSE;
+	
+  g_signal_stop_emission_by_name (widget, "key_press_event");
+  gtk_widget_destroy(widget);
+
+  return TRUE;
+}
+
+static gint
+custom_palette_popup_button_press_event (GtkWidget *widget, 
+                                         GdkEventButton *event, gpointer data)
+{
+  GtkWidget *child;
+
+  child = gtk_get_event_widget ((GdkEvent *) event);
+
+  /* We don't ask for button press events on the grab widget, so
+   *  if an event is reported directly to the grab widget, it must
+   *  be on a window outside the application (and thus we remove
+   *  the popup window). Otherwise, we check if the widget is a child
+   *  of the grab widget, and only remove the popup window if it
+   *  is not.
+   */
+
+  if (child != widget) 
+    {
+      while (child) 
+      {
+        if (child == widget) return FALSE;
+        child = child->parent;
+      }
+    }
+
+  gtk_widget_destroy(widget);
+
+  return TRUE;
+}
+
+/* end-of-yank */
Index: src/terminal-profile.c
===================================================================
RCS file: /cvs/gnome/profterm/src/terminal-profile.c,v
retrieving revision 1.21
diff -u -r1.21 terminal-profile.c
--- src/terminal-profile.c	27 May 2002 08:10:11 -0000	1.21
+++ src/terminal-profile.c	18 Jun 2002 22:04:06 -0000
@@ -214,8 +214,10 @@
 static void update_default_profile       (const char  *name,
                                           gboolean     locked);
 
-static void emit_changed (TerminalProfile    *profile,
-                          TerminalSettingMask mask);
+static void emit_changed                (TerminalProfile     *profile,
+                                         TerminalSettingMask *mask);
+static void emit_is_default_changed     (TerminalProfile *profile);
+
 
 
 static gpointer parent_class;
@@ -257,7 +259,7 @@
   g_return_if_fail (profiles != NULL);
   
   profile->priv = g_new0 (TerminalProfilePrivate, 1);
-  profile->priv->locked = 0;
+  TERMINAL_SETTING_MASK_CLEAR (profile->priv->locked);
   profile->priv->cursor_blink = FALSE;
   profile->priv->default_show_menubar = TRUE;
   profile->priv->visible_name = g_strdup ("<not named>");
@@ -309,9 +311,8 @@
                   G_SIGNAL_RUN_LAST,
                   G_STRUCT_OFFSET (TerminalProfileClass, changed),
                   NULL, NULL,
-                  /* should be VOID__ENUM but I'm lazy */
-                  g_cclosure_marshal_VOID__INT,
-                  G_TYPE_NONE, 1, G_TYPE_INT);
+                  g_cclosure_marshal_VOID__POINTER,
+                  G_TYPE_NONE, 1, G_TYPE_POINTER);
 
   signals[FORGOTTEN] =
     g_signal_new ("forgotten",
@@ -1685,8 +1686,8 @@
 }
 
 static gboolean
-set_palette_string (TerminalProfile *profile,
-                    const char      *candidate_str)
+set_palette (TerminalProfile *profile,
+             const char      *candidate_str)
 {  
   if (candidate_str != NULL)
     {
@@ -1856,1226 +1857,443 @@
 void
 terminal_profile_update (TerminalProfile *profile)
 {
-  char *key;
-  gboolean bool_val;
-  char *str_val;
-  int int_val;
-  double float_val;
   TerminalSettingMask mask;
   TerminalSettingMask locked;
   TerminalSettingMask old_locked;
   
-  mask = 0;
-  locked = 0;
+  TERMINAL_SETTING_MASK_CLEAR(mask);
+  TERMINAL_SETTING_MASK_CLEAR(locked);
 
-  /* KEY_CURSOR_BLINK */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_CURSOR_BLINK);
-  bool_val = gconf_client_get_bool (profile->priv->conf,
-                                    key, NULL);
-  /*   g_print ("cursor blink is now %d\n", bool_val); */
-  if (bool_val != profile->priv->cursor_blink)
-    {
-      mask |= TERMINAL_SETTING_CURSOR_BLINK;
-      profile->priv->cursor_blink = bool_val;
-    }  
+#define UPDATE_BOOLEAN(KName, FName)                                        \
+{                                                                           \
+  char *key = gconf_concat_dir_and_key (profile->priv->profile_dir, KName); \
+  gboolean val = gconf_client_get_bool (profile->priv->conf, key, NULL);    \
+                                                                            \
+  if (val != profile->priv->FName)                                          \
+    {                                                                       \
+      mask.FName = TRUE;                                                    \
+      profile->priv->FName = val;                                           \
+    }                                                                       \
+                                                                            \
+  locked.FName =                                                            \
+    !gconf_client_key_is_writable (profile->priv->conf, key, NULL);         \
+                                                                            \
+  g_free (key);                                                             \
+}
+
+#define UPDATE_INTEGER(KName, FName)                                        \
+{                                                                           \
+  char *key = gconf_concat_dir_and_key (profile->priv->profile_dir, KName); \
+  int val = gconf_client_get_int (profile->priv->conf, key, NULL);          \
+                                                                            \
+  mask.FName = set_##FName (profile, val);                                  \
+                                                                            \
+  locked.FName =                                                            \
+    !gconf_client_key_is_writable (profile->priv->conf, key, NULL);         \
+                                                                            \
+  g_free (key);                                                             \
+}
+
+#define UPDATE_FLOAT(KName, FName)                                          \
+{                                                                           \
+  char *key = gconf_concat_dir_and_key (profile->priv->profile_dir, KName); \
+  double val = gconf_client_get_float (profile->priv->conf, key, NULL);     \
+                                                                            \
+  if (val != profile->priv->FName)                                          \
+    {                                                                       \
+      mask.FName = TRUE;                                                    \
+      profile->priv->FName = val;                                           \
+    }                                                                       \
+                                                                            \
+  g_free (key);                                                             \
+}
+
+#define UPDATE_STRING(KName, FName)                                         \
+{                                                                           \
+  char *key = gconf_concat_dir_and_key (profile->priv->profile_dir, KName); \
+  char *val = gconf_client_get_string (profile->priv->conf, key, NULL);     \
+                                                                            \
+  mask.FName = set_##FName (profile, val);                                  \
+                                                                            \
+  locked.FName =                                                            \
+    !gconf_client_key_is_writable (profile->priv->conf, key, NULL);         \
+                                                                            \
+  g_free (val);                                                             \
+  g_free (key);                                                             \
+}
+
+  UPDATE_BOOLEAN (KEY_CURSOR_BLINK,         cursor_blink);
+  UPDATE_BOOLEAN (KEY_DEFAULT_SHOW_MENUBAR, default_show_menubar);
+  UPDATE_STRING  (KEY_VISIBLE_NAME,         visible_name);
+  UPDATE_STRING  (KEY_FOREGROUND_COLOR,     foreground_color);
+  UPDATE_STRING  (KEY_BACKGROUND_COLOR,     background_color);
+  UPDATE_STRING  (KEY_TITLE,                title);
+  UPDATE_STRING  (KEY_TITLE_MODE,           title_mode);
+  UPDATE_BOOLEAN (KEY_ALLOW_BOLD,           allow_bold);
+  UPDATE_BOOLEAN (KEY_SILENT_BELL,          silent_bell);
+  UPDATE_STRING  (KEY_WORD_CHARS,           word_chars);
+  UPDATE_STRING  (KEY_SCROLLBAR_POSITION,   scrollbar_position);
+  UPDATE_INTEGER (KEY_SCROLLBACK_LINES,     scrollback_lines);
+  UPDATE_BOOLEAN (KEY_SCROLL_ON_KEYSTROKE,  scroll_on_keystroke);
+  UPDATE_BOOLEAN (KEY_SCROLL_ON_OUTPUT,     scroll_on_output);
+  UPDATE_STRING  (KEY_EXIT_ACTION,          exit_action);
+  UPDATE_BOOLEAN (KEY_LOGIN_SHELL,          login_shell);
+  UPDATE_BOOLEAN (KEY_UPDATE_RECORDS,       update_records);
+  UPDATE_BOOLEAN (KEY_USE_CUSTOM_COMMAND,   use_custom_command);
+  UPDATE_STRING  (KEY_CUSTOM_COMMAND,       custom_command);
+  UPDATE_STRING  (KEY_ICON,                 icon_file);
+  UPDATE_STRING  (KEY_PALETTE,              palette);
+  UPDATE_STRING  (KEY_X_FONT,               x_font);
+  UPDATE_STRING  (KEY_BACKGROUND_TYPE,      background_type);
+  UPDATE_STRING  (KEY_BACKGROUND_IMAGE,     background_image_file);
+  UPDATE_BOOLEAN (KEY_SCROLL_BACKGROUND,    scroll_background);
+  UPDATE_FLOAT   (KEY_BACKGROUND_DARKNESS,  background_darkness);
+  UPDATE_STRING  (KEY_BACKSPACE_BINDING,    backspace_binding);
+  UPDATE_STRING  (KEY_DELETE_BINDING,       delete_binding);
+  UPDATE_BOOLEAN (KEY_USE_THEME_COLORS,     use_theme_colors);
+  UPDATE_BOOLEAN (KEY_USE_SYSTEM_FONT,      use_system_font);
+  UPDATE_STRING  (KEY_FONT,                 font);
+  
+#undef UPDATE_BOOLEAN
+#undef UPDATE_INTEGER
+#undef UPDATE_FLOAT
+#undef UPDATE_STRING
 
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_CURSOR_BLINK;
+  /* Update state and emit signals */
   
-  g_free (key);
-
-  /* KEY_DEFAULT_SHOW_MENUBAR */
+  old_locked = profile->priv->locked;
+  profile->priv->locked = locked;
   
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_DEFAULT_SHOW_MENUBAR);
-  bool_val = gconf_client_get_bool (profile->priv->conf,
-                                    key, NULL);
+  if (!(terminal_setting_mask_is_empty (&mask) &&
+        TERMINAL_SETTING_MASK_EQUAL (locked, old_locked)))
+    emit_changed (profile, &mask);
+}
 
-  if (bool_val != profile->priv->default_show_menubar)
-    {
-      mask |= TERMINAL_SETTING_DEFAULT_SHOW_MENUBAR;
-      profile->priv->default_show_menubar = bool_val;
-    }
 
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_DEFAULT_SHOW_MENUBAR;
+static const gchar*
+find_key (const gchar* key)
+{
+  const gchar* end;
   
-  g_free (key);
+  end = strrchr (key, '/');
 
-  /* KEY_VISIBLE_NAME */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_VISIBLE_NAME);
-  str_val = gconf_client_get_string (profile->priv->conf,
-                                     key, NULL);
+  ++end;
 
-  if (set_visible_name (profile, str_val))
-    mask |= TERMINAL_SETTING_VISIBLE_NAME;
+  return end;
+}
 
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_VISIBLE_NAME;
+static void
+profile_change_notify (GConfClient *client,
+                       guint        cnxn_id,
+                       GConfEntry  *entry,
+                       gpointer     user_data)
+{
+  TerminalProfile *profile;
+  const char *key;
+  GConfValue *val;
+  TerminalSettingMask mask;  
+  TerminalSettingMask old_locked;
+  
+  profile = TERMINAL_PROFILE (user_data);
 
-  g_free (str_val);
-  g_free (key);
+  TERMINAL_SETTING_MASK_CLEAR(mask);
+  old_locked = profile->priv->locked;
 
-  /* KEY_FOREGROUND_COLOR */
+  val = gconf_entry_get_value (entry);
   
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_FOREGROUND_COLOR);
-  str_val = gconf_client_get_string (profile->priv->conf,
-                                     key, NULL);
-
-  if (set_foreground_color (profile, str_val))
-    mask |= TERMINAL_SETTING_FOREGROUND_COLOR;
+  key = find_key (gconf_entry_get_key (entry));
   
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_FOREGROUND_COLOR;
+  /*   g_print ("Key '%s' changed\n", key); */
 
-  g_free (str_val);
-  g_free (key);
+#define BEGIN_UPDATE if (0) {}
+#define END_UPDATE
 
+#define UPDATE_BOOLEAN(KName, FName, Preset)                                \
+else if (strcmp (key, KName) == 0)                                          \
+  {                                                                         \
+    gboolean setting = (Preset);                                            \
+                                                                            \
+    if (val && val->type == GCONF_VALUE_BOOL)                               \
+      setting = gconf_value_get_bool (val);                                 \
+                                                                            \
+    if (setting != profile->priv->FName)                                    \
+      {                                                                     \
+        mask.FName = TRUE;                                                  \
+        profile->priv->FName = setting;                                     \
+      }                                                                     \
+                                                                            \
+    profile->priv->locked.FName = !gconf_entry_get_is_writable (entry);     \
+  }
+
+#define UPDATE_INTEGER(KName, FName, Preset)                                \
+else if (strcmp (key, KName) == 0)                                          \
+  {                                                                         \
+    int setting = (Preset);                                                 \
+                                                                            \
+    if (val && val->type == GCONF_VALUE_INT)                                \
+      setting = gconf_value_get_int (val);                                  \
+                                                                            \
+    mask.FName = set_##FName (profile, setting);                            \
+                                                                            \
+    profile->priv->locked.FName = !gconf_entry_get_is_writable (entry);     \
+  }
+
+#define UPDATE_FLOAT(KName, FName, Preset)                                  \
+else if (strcmp (key, KName) == 0)                                          \
+  {                                                                         \
+    float setting = (Preset);                                               \
+                                                                            \
+    if (val && val->type == GCONF_VALUE_FLOAT)                              \
+      setting = gconf_value_get_float (val);                                \
+                                                                            \
+    if (setting != profile->priv->FName)                                    \
+      {                                                                     \
+        mask.FName = TRUE;                                                  \
+        profile->priv->FName = setting;                                     \
+      }                                                                     \
+                                                                            \
+    profile->priv->locked.FName = !gconf_entry_get_is_writable (entry);     \
+  }
+
+#define UPDATE_STRING(KName, FName, Preset)                                 \
+else if (strcmp (key, KName) == 0)                                          \
+  {                                                                         \
+    const char * setting = (Preset);                                        \
+                                                                            \
+    if (val && val->type == GCONF_VALUE_STRING)                             \
+      setting = gconf_value_get_string (val);                               \
+                                                                            \
+    mask.FName = set_##FName (profile, setting);                            \
+                                                                            \
+    profile->priv->locked.FName = !gconf_entry_get_is_writable (entry);     \
+  }
+
+  BEGIN_UPDATE
+    UPDATE_BOOLEAN (KEY_CURSOR_BLINK,           cursor_blink,           FALSE)
+    UPDATE_BOOLEAN (KEY_DEFAULT_SHOW_MENUBAR,   default_show_menubar,   FALSE)
+    UPDATE_STRING  (KEY_VISIBLE_NAME,           visible_name,           NULL)
+    UPDATE_STRING  (KEY_FOREGROUND_COLOR,       foreground_color,       NULL)
+    UPDATE_STRING  (KEY_BACKGROUND_COLOR,       background_color,       NULL)
+    UPDATE_STRING  (KEY_TITLE,                  title,                  NULL)
+    UPDATE_STRING  (KEY_TITLE_MODE,             title_mode,             NULL)
+    UPDATE_BOOLEAN (KEY_ALLOW_BOLD,             allow_bold,             FALSE)
+    UPDATE_BOOLEAN (KEY_SILENT_BELL,            silent_bell,            FALSE)
+    UPDATE_STRING  (KEY_WORD_CHARS,             word_chars,             NULL)
+    UPDATE_STRING  (KEY_SCROLLBAR_POSITION,     scrollbar_position,     NULL)
+    UPDATE_INTEGER (KEY_SCROLLBACK_LINES,       scrollback_lines,       profile->priv->scrollback_lines)
+    UPDATE_BOOLEAN (KEY_SCROLL_ON_KEYSTROKE, 	scroll_on_keystroke,    FALSE)
+    UPDATE_BOOLEAN (KEY_SCROLL_ON_OUTPUT,       scroll_on_output,       FALSE)
+    UPDATE_STRING  (KEY_EXIT_ACTION,            exit_action,            NULL)
+    UPDATE_BOOLEAN (KEY_LOGIN_SHELL,            login_shell,            FALSE)
+    UPDATE_BOOLEAN (KEY_UPDATE_RECORDS,         update_records,         FALSE)
+    UPDATE_BOOLEAN (KEY_USE_CUSTOM_COMMAND,     use_custom_command,     FALSE)
+    UPDATE_STRING  (KEY_CUSTOM_COMMAND,         custom_command,         NULL)
+    UPDATE_STRING  (KEY_ICON,                   icon_file,              NULL)
+    UPDATE_STRING  (KEY_PALETTE,                palette,                NULL)
+    UPDATE_STRING  (KEY_X_FONT,                 x_font,                 NULL)
+    UPDATE_STRING  (KEY_BACKGROUND_TYPE,        background_type,        NULL)
+    UPDATE_STRING  (KEY_BACKGROUND_IMAGE,       background_image_file,  NULL)
+    UPDATE_BOOLEAN (KEY_SCROLL_BACKGROUND,      scroll_background,      FALSE)
+    UPDATE_FLOAT   (KEY_BACKGROUND_DARKNESS,    scroll_background,      0.5)
+    UPDATE_STRING  (KEY_BACKSPACE_BINDING,      backspace_binding,      NULL)
+    UPDATE_STRING  (KEY_DELETE_BINDING,         delete_binding,         NULL)
+    UPDATE_BOOLEAN (KEY_USE_THEME_COLORS,       use_theme_colors,       TRUE)
+    UPDATE_BOOLEAN (KEY_USE_SYSTEM_FONT,        use_system_font,        TRUE)
+    UPDATE_STRING  (KEY_FONT,                   font,                   NULL)
+  END_UPDATE
+  
+#undef UPDATE_BOOLEAN
+#undef UPDATE_INTEGER
+#undef UPDATE_FLOAT
+#undef UPDATE_STRING
+
+  if (!(terminal_setting_mask_is_empty (&mask) &&
+        TERMINAL_SETTING_MASK_EQUAL (old_locked, profile->priv->locked)))
+    emit_changed (profile, &mask);
+}
 
-  /* KEY_BACKGROUND_COLOR */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_BACKGROUND_COLOR);
-  str_val = gconf_client_get_string (profile->priv->conf,
-                                     key, NULL);
+static void
+set_key_to_default (TerminalProfile *profile,
+                    const char      *relative_key)
+{
+  char *key;
+  char *default_key;
+  GError *err;
+  GConfValue *val;
+
+  default_key = gconf_concat_dir_and_key (CONF_PROFILES_PREFIX"/"FALLBACK_PROFILE_ID,
+                                          relative_key);
+
+  err = NULL;
+  val = gconf_client_get_default_from_schema (profile->priv->conf,
+                                              default_key,
+                                              &err);
+  if (err != NULL)
+    {
+      g_printerr (_("Error getting default value of %s: %s\n"),
+                  default_key, err->message);
+      g_error_free (err);
+    }
 
-  if (set_background_color (profile, str_val))
-    mask |= TERMINAL_SETTING_BACKGROUND_COLOR;
+  if (val == NULL)
+    g_printerr (_("There wasn't a default value for %s\n"),
+                default_key);
   
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_BACKGROUND_COLOR;
+  g_free (default_key);
   
-  g_free (str_val);
-  g_free (key);
+  if (val)
+    {
+      key = gconf_concat_dir_and_key (profile->priv->profile_dir,
+                                      relative_key);
+      
+      err = NULL;      
+      gconf_client_set (profile->priv->conf,
+                        key, val, &err);
+      if (err != NULL)
+        {
+          g_printerr (_("Error setting key %s back to default: %s\n"),
+                      key, err->message);
+          g_error_free (err);
+        }
 
+      gconf_value_free (val);
+      g_free (key);
+    }
+}
 
-  /* KEY_TITLE */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_TITLE);
-  str_val = gconf_client_get_string (profile->priv->conf,
-                                     key, NULL);
+void
+terminal_profile_reset_compat_defaults (TerminalProfile *profile)
+{
+  set_key_to_default (profile, KEY_DELETE_BINDING);
+  set_key_to_default (profile, KEY_BACKSPACE_BINDING);
+}
 
-  if (set_title (profile, str_val))
-    mask |= TERMINAL_SETTING_TITLE;
+static void
+update_default_profile (const char *name,
+                        gboolean    locked)
+{
+  TerminalProfile *profile;
+  gboolean changed;
+  TerminalProfile *old_default;
   
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_TITLE;
+  changed = FALSE;
   
-  g_free (str_val);
-  g_free (key);
+  g_free (default_profile_id);
+  default_profile_id = g_strdup (name);
 
-  /* KEY_TITLE_MODE */
+  old_default = default_profile;
+  profile = terminal_profile_lookup (name);
   
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_TITLE_MODE);
-  str_val = gconf_client_get_string (profile->priv->conf,
-                                     key, NULL);
+  if (profile)
+    {
+      if (profile != default_profile)
+        {
+          default_profile = profile;
+          changed = TRUE;
+        }
+    }
 
-  if (set_title_mode (profile, str_val))
-    mask |= TERMINAL_SETTING_TITLE_MODE;
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_TITLE_MODE;
-  
-  g_free (str_val);
-  g_free (key);
+  if (locked != default_profile_locked)
+    {
+      /* Need to emit changed on all profiles */
+      GList *all_profiles;
+      GList *tmp;
 
+      default_profile_locked = locked;
+      
+      all_profiles = terminal_profile_get_list ();
+      tmp = all_profiles;
+      while (tmp != NULL)
+        {
+          TerminalProfile *p = tmp->data;
+          emit_is_default_changed (p);
+          tmp = tmp->next;
+        }
 
-  /* KEY_ALLOW_BOLD */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_ALLOW_BOLD);
-  bool_val = gconf_client_get_bool (profile->priv->conf,
-                                    key, NULL);
-  if (bool_val != profile->priv->allow_bold)
+      g_list_free (all_profiles);
+    }
+  else if (changed)
     {
-      mask |= TERMINAL_SETTING_ALLOW_BOLD;
-      profile->priv->allow_bold = bool_val;
-    }  
+      if (old_default) emit_is_default_changed (old_default);
+      emit_is_default_changed (profile);
+    }
+}
 
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_ALLOW_BOLD;
+static void
+default_change_notify (GConfClient *client,
+                       guint        cnxn_id,
+                       GConfEntry  *entry,
+                       gpointer     user_data)
+{
+  GConfValue *val;
+  gboolean locked;
+  const char *name;
   
-  g_free (key);
+  val = gconf_entry_get_value (entry);  
 
-  /* KEY_SILENT_BELL */
+  if (val == NULL || val->type != GCONF_VALUE_STRING)
+    return;
   
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_SILENT_BELL);
-  bool_val = gconf_client_get_bool (profile->priv->conf,
-                                    key, NULL);
-  if (bool_val != profile->priv->silent_bell)
-    {
-      mask |= TERMINAL_SETTING_SILENT_BELL;
-      profile->priv->silent_bell = bool_val;
-    }  
-
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_SILENT_BELL;
+  if (gconf_entry_get_is_writable (entry))  
+    locked = FALSE;
+  else
+    locked = TRUE;
   
-  g_free (key);
+  name = gconf_value_get_string (val);
 
-  /* KEY_WORD_CHARS */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_WORD_CHARS);
-  str_val = gconf_client_get_string (profile->priv->conf,
-                                     key, NULL);
+  update_default_profile (name, locked);
+}
 
-  if (set_word_chars (profile, str_val))
-    mask |= TERMINAL_SETTING_WORD_CHARS;
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_WORD_CHARS;
-  
-  g_free (str_val);
-  g_free (key);
+static void
+listify_foreach (gpointer key,
+                 gpointer value,
+                 gpointer data)
+{
+  GList **listp = data;
 
-  /* KEY_SCROLLBAR_POSITION */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_SCROLLBAR_POSITION);
-  str_val = gconf_client_get_string (profile->priv->conf,
-                                     key, NULL);
+  *listp = g_list_prepend (*listp, value);
+}
 
-  if (set_scrollbar_position (profile, str_val))
-    mask |= TERMINAL_SETTING_SCROLLBAR_POSITION;
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_SCROLLBAR_POSITION;
-  
-  g_free (str_val);
-  g_free (key);
+static int
+alphabetic_cmp (gconstpointer a,
+                gconstpointer b)
+{
+  TerminalProfile *ap = (TerminalProfile*) a;
+  TerminalProfile *bp = (TerminalProfile*) b;
 
-  /* KEY_SCROLLBACK_LINES */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_SCROLLBACK_LINES);
-  int_val = gconf_client_get_int (profile->priv->conf,
-                                  key, NULL);
-  if (set_scrollback_lines (profile, int_val))
-    mask |= TERMINAL_SETTING_SCROLLBACK_LINES;
+  return g_utf8_collate (terminal_profile_get_visible_name (ap),
+                         terminal_profile_get_visible_name (bp));
+}
 
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_SCROLL_ON_KEYSTROKE;
-  
-  g_free (key);
+GList*
+terminal_profile_get_list (void)
+{
+  GList *list;
 
-  
-  /* KEY_SCROLL_ON_KEYSTROKE */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_SCROLL_ON_KEYSTROKE);
-  bool_val = gconf_client_get_bool (profile->priv->conf,
-                                    key, NULL);
-  if (bool_val != profile->priv->scroll_on_keystroke)
-    {
-      mask |= TERMINAL_SETTING_SCROLL_ON_KEYSTROKE;
-      profile->priv->scroll_on_keystroke = bool_val;
-    }  
+  list = NULL;
+  g_hash_table_foreach (profiles, listify_foreach, &list);
 
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_SCROLL_ON_KEYSTROKE;
+  list = g_list_sort (list, alphabetic_cmp);
   
-  g_free (key);
+  return list;
+}
 
-  /* KEY_SCROLL_ON_OUTPUT */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_SCROLL_ON_OUTPUT);
-  bool_val = gconf_client_get_bool (profile->priv->conf,
-                                    key, NULL);
-  if (bool_val != profile->priv->scroll_on_output)
-    {
-      mask |= TERMINAL_SETTING_SCROLL_ON_OUTPUT;
-      profile->priv->scroll_on_output = bool_val;
-    }  
+int
+terminal_profile_get_count (void)
+{
+  return g_hash_table_size (profiles);
+}
 
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_SCROLL_ON_OUTPUT;
-  
-  g_free (key);
+TerminalProfile*
+terminal_profile_lookup (const char *name)
+{
+  g_return_val_if_fail (name != NULL, NULL);
 
-  /* KEY_EXIT_ACTION */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_EXIT_ACTION);
-  str_val = gconf_client_get_string (profile->priv->conf,
-                                     key, NULL);
-
-  if (set_exit_action (profile, str_val))
-    mask |= TERMINAL_SETTING_EXIT_ACTION;
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_EXIT_ACTION;
-  
-  g_free (str_val);
-  g_free (key);
-  
-  /* KEY_LOGIN_SHELL */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_LOGIN_SHELL);
-  bool_val = gconf_client_get_bool (profile->priv->conf,
-                                    key, NULL);
-  if (bool_val != profile->priv->login_shell)
-    {
-      mask |= TERMINAL_SETTING_LOGIN_SHELL;
-      profile->priv->login_shell = bool_val;
-    }  
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_LOGIN_SHELL;
-  
-  g_free (key);
-
-  /* KEY_UPDATE_RECORDS */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_UPDATE_RECORDS);
-  bool_val = gconf_client_get_bool (profile->priv->conf,
-                                    key, NULL);
-  if (bool_val != profile->priv->update_records)
-    {
-      mask |= TERMINAL_SETTING_UPDATE_RECORDS;
-      profile->priv->update_records = bool_val;
-    }  
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_UPDATE_RECORDS;
-  
-  g_free (key);
-
-  /* KEY_USE_CUSTOM_COMMAND */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_USE_CUSTOM_COMMAND);
-  bool_val = gconf_client_get_bool (profile->priv->conf,
-                                    key, NULL);
-  if (bool_val != profile->priv->use_custom_command)
-    {
-      mask |= TERMINAL_SETTING_USE_CUSTOM_COMMAND;
-      profile->priv->use_custom_command = bool_val;
-    }  
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_USE_CUSTOM_COMMAND;
-  
-  g_free (key);
-
-  /* KEY_CUSTOM_COMMAND */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_CUSTOM_COMMAND);
-  str_val = gconf_client_get_string (profile->priv->conf,
-                                     key, NULL);
-
-  if (set_custom_command (profile, str_val))
-    mask |= TERMINAL_SETTING_CUSTOM_COMMAND;
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_CUSTOM_COMMAND;
-  
-  g_free (str_val);
-  g_free (key);
-
-  /* KEY_ICON */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_ICON);
-  str_val = gconf_client_get_string (profile->priv->conf,
-                                     key, NULL);
-
-  if (set_icon_file (profile, str_val))
-    mask |= TERMINAL_SETTING_ICON;
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_ICON;
-  
-  g_free (str_val);
-  g_free (key);
-
-  /* KEY_PALETTE */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_PALETTE);
-  str_val = gconf_client_get_string (profile->priv->conf,
-                                     key, NULL);
-
-  if (set_palette_string (profile, str_val))
-    mask |= TERMINAL_SETTING_PALETTE;
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_PALETTE;
-  
-  g_free (str_val);
-  g_free (key);
-
-  /* KEY_X_FONT */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_X_FONT);
-  str_val = gconf_client_get_string (profile->priv->conf,
-                                     key, NULL);
-
-  if (set_x_font (profile, str_val))
-    mask |= TERMINAL_SETTING_X_FONT;
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_X_FONT;
-  
-  g_free (str_val);
-  g_free (key);
-
-  /* KEY_BACKGROUND_TYPE */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_BACKGROUND_TYPE);
-  str_val = gconf_client_get_string (profile->priv->conf,
-                                     key, NULL);
-
-  if (set_background_type (profile, str_val))
-    mask |= TERMINAL_SETTING_BACKGROUND_TYPE;
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_BACKGROUND_TYPE;
-  
-  g_free (str_val);
-  g_free (key);
-
-  /* KEY_BACKGROUND_IMAGE */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_BACKGROUND_IMAGE);
-  str_val = gconf_client_get_string (profile->priv->conf,
-                                     key, NULL);
-
-  if (set_background_image_file (profile, str_val))
-    mask |= TERMINAL_SETTING_BACKGROUND_IMAGE;
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_BACKGROUND_IMAGE;
-
-  g_free (str_val);
-  g_free (key);
-
-  /* KEY_SCROLL_BACKGROUND */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_SCROLL_BACKGROUND);
-  bool_val = gconf_client_get_bool (profile->priv->conf,
-                                    key, NULL);
-  if (bool_val != profile->priv->scroll_background)
-    {
-      mask |= TERMINAL_SETTING_SCROLL_BACKGROUND;
-      profile->priv->scroll_background = bool_val;
-    }  
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_SCROLL_BACKGROUND;
-  
-  g_free (key);
-
-  /* KEY_BACKGROUND_DARKNESS */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_BACKGROUND_DARKNESS);
-  float_val = gconf_client_get_float (profile->priv->conf,
-                                      key, NULL);
-  if (float_val != profile->priv->background_darkness)
-    {
-      mask |= TERMINAL_SETTING_BACKGROUND_DARKNESS;
-      profile->priv->background_darkness = float_val;
-    }
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_BACKGROUND_DARKNESS;
-  
-  g_free (key);
-  
-  /* KEY_BACKSPACE_BINDING */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_BACKSPACE_BINDING);
-  str_val = gconf_client_get_string (profile->priv->conf,
-                                     key, NULL);
-
-  if (set_backspace_binding (profile, str_val))
-    mask |= TERMINAL_SETTING_BACKSPACE_BINDING;
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_BACKSPACE_BINDING;
-  
-  g_free (str_val);
-  g_free (key);
-
-  /* KEY_DELETE_BINDING */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_DELETE_BINDING);
-  str_val = gconf_client_get_string (profile->priv->conf,
-                                     key, NULL);
-
-  if (set_delete_binding (profile, str_val))
-    mask |= TERMINAL_SETTING_DELETE_BINDING;
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_DELETE_BINDING;
-  
-  g_free (str_val);
-  g_free (key);
-
-  /* KEY_USE_THEME_COLORS */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_USE_THEME_COLORS);
-  bool_val = gconf_client_get_bool (profile->priv->conf,
-                                    key, NULL);
-  if (bool_val != profile->priv->use_theme_colors)
-    {
-      mask |= TERMINAL_SETTING_USE_THEME_COLORS;
-      profile->priv->use_theme_colors = bool_val;
-    }  
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_USE_THEME_COLORS;
-  
-  g_free (key);
-  
-  /* KEY_USE_SYSTEM_FONT */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_USE_SYSTEM_FONT);
-  bool_val = gconf_client_get_bool (profile->priv->conf,
-                                    key, NULL);
-  if (bool_val != profile->priv->use_system_font)
-    {
-      mask |= TERMINAL_SETTING_USE_SYSTEM_FONT;
-      profile->priv->use_system_font = bool_val;
-    }  
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_USE_SYSTEM_FONT;
-  
-  g_free (key);
-
-  /* KEY_FONT */
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_FONT);
-  str_val = gconf_client_get_string (profile->priv->conf,
-                                     key, NULL);
-
-  if (set_font (profile, str_val))
-    mask |= TERMINAL_SETTING_FONT;
-  
-  if (!gconf_client_key_is_writable (profile->priv->conf, key, NULL))
-    locked |= TERMINAL_SETTING_FONT;
-  
-  g_free (str_val);
-  g_free (key);
-  
-  /* Update state and emit signals */
-  
-  old_locked = profile->priv->locked;
-  profile->priv->locked = locked;
-  
-  if (mask != 0 || locked != old_locked)
-    emit_changed (profile, mask);
-}
-
-
-static const gchar*
-find_key (const gchar* key)
-{
-  const gchar* end;
-  
-  end = strrchr (key, '/');
-
-  ++end;
-
-  return end;
-}
-
-static void
-profile_change_notify (GConfClient *client,
-                       guint        cnxn_id,
-                       GConfEntry  *entry,
-                       gpointer     user_data)
-{
-  TerminalProfile *profile;
-  const char *key;
-  GConfValue *val;
-  TerminalSettingMask mask;  
-  TerminalSettingMask old_locked;
-  
-  profile = TERMINAL_PROFILE (user_data);
-
-  mask = 0;
-  old_locked = profile->priv->locked;
-
-  val = gconf_entry_get_value (entry);
-  
-  key = find_key (gconf_entry_get_key (entry));
-  
-  /*   g_print ("Key '%s' changed\n", key); */
-
-#define UPDATE_LOCKED(flag)                     \
-      if (gconf_entry_get_is_writable (entry))  \
-        profile->priv->locked &= ~(flag);        \
-      else                                      \
-        profile->priv->locked |= (flag);
-  
-  if (strcmp (key, KEY_CURSOR_BLINK) == 0)
-    {
-      gboolean bool_val;
-
-      bool_val = FALSE;
-
-      if (val && val->type == GCONF_VALUE_BOOL)
-        bool_val = gconf_value_get_bool (val);
-
-      if (bool_val != profile->priv->cursor_blink)
-        {
-          mask |= TERMINAL_SETTING_CURSOR_BLINK;
-          profile->priv->cursor_blink = bool_val;
-        }
-
-      UPDATE_LOCKED (TERMINAL_SETTING_CURSOR_BLINK);
-    }
-  else if (strcmp (key, KEY_DEFAULT_SHOW_MENUBAR) == 0)
-    {
-      gboolean bool_val;
-
-      bool_val = FALSE;
-
-      if (val && val->type == GCONF_VALUE_BOOL)
-        bool_val = gconf_value_get_bool (val);
-
-      if (bool_val != profile->priv->default_show_menubar)
-        {
-          mask |= TERMINAL_SETTING_DEFAULT_SHOW_MENUBAR;
-          profile->priv->default_show_menubar = bool_val;
-        }
-
-      UPDATE_LOCKED (TERMINAL_SETTING_DEFAULT_SHOW_MENUBAR);
-    }
-  else if (strcmp (key, KEY_VISIBLE_NAME) == 0)
-    {
-      const char *str_val;
-
-      str_val = NULL;
-      if (val && val->type == GCONF_VALUE_STRING)
-        str_val = gconf_value_get_string (val);
-      
-      if (set_visible_name (profile, str_val))
-        mask |= TERMINAL_SETTING_VISIBLE_NAME;
-
-      UPDATE_LOCKED (TERMINAL_SETTING_VISIBLE_NAME);
-    }
-  else if (strcmp (key, KEY_FOREGROUND_COLOR) == 0)
-    {
-      const char *str_val;
-
-      str_val = NULL;
-      if (val && val->type == GCONF_VALUE_STRING)
-        str_val = gconf_value_get_string (val);
-      
-      if (set_foreground_color (profile, str_val))
-        mask |= TERMINAL_SETTING_FOREGROUND_COLOR;
-
-      UPDATE_LOCKED (TERMINAL_SETTING_FOREGROUND_COLOR);
-    }
-  else if (strcmp (key, KEY_BACKGROUND_COLOR) == 0)
-    {
-      const char *str_val;
-
-      str_val = NULL;
-      if (val && val->type == GCONF_VALUE_STRING)
-        str_val = gconf_value_get_string (val);
-      
-      if (set_background_color (profile, str_val))
-        mask |= TERMINAL_SETTING_BACKGROUND_COLOR;
-
-      UPDATE_LOCKED (TERMINAL_SETTING_BACKGROUND_COLOR);
-    }
-  else if (strcmp (key, KEY_TITLE) == 0)
-    {
-      const char *str_val;
-
-      str_val = NULL;
-      if (val && val->type == GCONF_VALUE_STRING)
-        str_val = gconf_value_get_string (val);
-      
-      if (set_title (profile, str_val))
-        mask |= TERMINAL_SETTING_TITLE;
-
-      UPDATE_LOCKED (TERMINAL_SETTING_TITLE);
-    }
-  else if (strcmp (key, KEY_TITLE_MODE) == 0)
-    {
-      const char *str_val;
-
-      str_val = NULL;
-      if (val && val->type == GCONF_VALUE_STRING)
-        str_val = gconf_value_get_string (val);
-      
-      if (set_title_mode (profile, str_val))
-        mask |= TERMINAL_SETTING_TITLE_MODE;
-
-      UPDATE_LOCKED (TERMINAL_SETTING_TITLE_MODE);
-    }
-  else if (strcmp (key, KEY_ALLOW_BOLD) == 0)
-    {
-      gboolean bool_val;
-
-      bool_val = FALSE;
-
-      if (val && val->type == GCONF_VALUE_BOOL)
-        bool_val = gconf_value_get_bool (val);
-
-      if (bool_val != profile->priv->allow_bold)
-        {
-          mask |= TERMINAL_SETTING_ALLOW_BOLD;
-          profile->priv->allow_bold = bool_val;
-        }
-
-      UPDATE_LOCKED (TERMINAL_SETTING_ALLOW_BOLD);
-    }
-  else if (strcmp (key, KEY_SILENT_BELL) == 0)
-    {
-      gboolean bool_val;
-
-      bool_val = FALSE;
-
-      if (val && val->type == GCONF_VALUE_BOOL)
-        bool_val = gconf_value_get_bool (val);
-
-      if (bool_val != profile->priv->silent_bell)
-        {
-          mask |= TERMINAL_SETTING_SILENT_BELL;
-          profile->priv->silent_bell = bool_val;
-        }
-
-      UPDATE_LOCKED (TERMINAL_SETTING_SILENT_BELL);
-    }
-  else if (strcmp (key, KEY_WORD_CHARS) == 0)
-    {
-      const char *str_val;
-
-      str_val = NULL;
-      if (val && val->type == GCONF_VALUE_STRING)
-        str_val = gconf_value_get_string (val);
-      
-      if (set_word_chars (profile, str_val))
-        mask |= TERMINAL_SETTING_WORD_CHARS;
-
-      UPDATE_LOCKED (TERMINAL_SETTING_WORD_CHARS);
-    }
-  else if (strcmp (key, KEY_SCROLLBAR_POSITION) == 0)
-    {
-      const char *str_val;
-
-      str_val = NULL;
-      if (val && val->type == GCONF_VALUE_STRING)
-        str_val = gconf_value_get_string (val);
-      
-      if (set_scrollbar_position (profile, str_val))
-        mask |= TERMINAL_SETTING_SCROLLBAR_POSITION;
-
-      UPDATE_LOCKED (TERMINAL_SETTING_SCROLLBAR_POSITION);
-    }
-  else if (strcmp (key, KEY_SCROLLBACK_LINES) == 0)
-    {
-      int int_val;
-
-      int_val = profile->priv->scrollback_lines;
-      if (val && val->type == GCONF_VALUE_INT)
-        int_val = gconf_value_get_int (val);
-      
-      if (set_scrollback_lines (profile, int_val))
-        mask |= TERMINAL_SETTING_SCROLLBACK_LINES;
-
-      UPDATE_LOCKED (TERMINAL_SETTING_SCROLLBACK_LINES);
-    }
-  else if (strcmp (key, KEY_SCROLL_ON_KEYSTROKE) == 0)
-    {
-      gboolean bool_val;
-
-      bool_val = FALSE;
-
-      if (val && val->type == GCONF_VALUE_BOOL)
-        bool_val = gconf_value_get_bool (val);
-
-      if (bool_val != profile->priv->scroll_on_keystroke)
-        {
-          mask |= TERMINAL_SETTING_SCROLL_ON_KEYSTROKE;
-          profile->priv->scroll_on_keystroke = bool_val;
-        }
-
-      UPDATE_LOCKED (TERMINAL_SETTING_SCROLL_ON_KEYSTROKE);
-    }
-  else if (strcmp (key, KEY_SCROLL_ON_OUTPUT) == 0)
-    {
-      gboolean bool_val;
-
-      bool_val = FALSE;
-
-      if (val && val->type == GCONF_VALUE_BOOL)
-        bool_val = gconf_value_get_bool (val);
-
-      if (bool_val != profile->priv->scroll_on_output)
-        {
-          mask |= TERMINAL_SETTING_SCROLL_ON_OUTPUT;
-          profile->priv->scroll_on_output = bool_val;
-        }
-
-      UPDATE_LOCKED (TERMINAL_SETTING_SCROLL_ON_OUTPUT);
-    }  
-  else if (strcmp (key, KEY_EXIT_ACTION) == 0)
-    {
-      const char *str_val;
-
-      str_val = NULL;
-      if (val && val->type == GCONF_VALUE_STRING)
-        str_val = gconf_value_get_string (val);
-      
-      if (set_exit_action (profile, str_val))
-        mask |= TERMINAL_SETTING_EXIT_ACTION;
-
-      UPDATE_LOCKED (TERMINAL_SETTING_EXIT_ACTION);
-    }
-  else if (strcmp (key, KEY_LOGIN_SHELL) == 0)
-    {
-      gboolean bool_val;
-
-      bool_val = FALSE;
-
-      if (val && val->type == GCONF_VALUE_BOOL)
-        bool_val = gconf_value_get_bool (val);
-
-      if (bool_val != profile->priv->login_shell)
-        {
-          mask |= TERMINAL_SETTING_LOGIN_SHELL;
-          profile->priv->login_shell = bool_val;
-        }
-
-      UPDATE_LOCKED (TERMINAL_SETTING_LOGIN_SHELL);
-    }
-  else if (strcmp (key, KEY_UPDATE_RECORDS) == 0)
-    {
-      gboolean bool_val;
-
-      bool_val = FALSE;
-
-      if (val && val->type == GCONF_VALUE_BOOL)
-        bool_val = gconf_value_get_bool (val);
-
-      if (bool_val != profile->priv->update_records)
-        {
-          mask |= TERMINAL_SETTING_UPDATE_RECORDS;
-          profile->priv->update_records = bool_val;
-        }
-
-      UPDATE_LOCKED (TERMINAL_SETTING_UPDATE_RECORDS);
-    }
-  else if (strcmp (key, KEY_USE_CUSTOM_COMMAND) == 0)
-    {
-      gboolean bool_val;
-
-      bool_val = FALSE;
-
-      if (val && val->type == GCONF_VALUE_BOOL)
-        bool_val = gconf_value_get_bool (val);
-
-      if (bool_val != profile->priv->use_custom_command)
-        {
-          mask |= TERMINAL_SETTING_USE_CUSTOM_COMMAND;
-          profile->priv->use_custom_command = bool_val;
-        }
-
-      UPDATE_LOCKED (TERMINAL_SETTING_USE_CUSTOM_COMMAND);
-    }
-  else if (strcmp (key, KEY_CUSTOM_COMMAND) == 0)
-    {
-      const char *str_val;
-
-      str_val = NULL;
-      if (val && val->type == GCONF_VALUE_STRING)
-        str_val = gconf_value_get_string (val);
-      
-      if (set_custom_command (profile, str_val))
-        mask |= TERMINAL_SETTING_CUSTOM_COMMAND;
-
-      UPDATE_LOCKED (TERMINAL_SETTING_CUSTOM_COMMAND);
-    }
-  else if (strcmp (key, KEY_ICON) == 0)
-    {
-      const char *str_val;
-
-      str_val = NULL;
-      if (val && val->type == GCONF_VALUE_STRING)
-        str_val = gconf_value_get_string (val);
-      
-      if (set_icon_file (profile, str_val))
-        mask |= TERMINAL_SETTING_ICON;
-
-      UPDATE_LOCKED (TERMINAL_SETTING_ICON);
-    }
-  else if (strcmp (key, KEY_PALETTE) == 0)
-    {
-      const char *str_val;
-
-      str_val = NULL;
-      if (val && val->type == GCONF_VALUE_STRING)
-        str_val = gconf_value_get_string (val);
-      
-      if (set_palette_string (profile, str_val))
-        mask |= TERMINAL_SETTING_PALETTE;
-
-      UPDATE_LOCKED (TERMINAL_SETTING_PALETTE);
-    }
-  else if (strcmp (key, KEY_X_FONT) == 0)
-    {
-      const char *str_val;
-
-      str_val = NULL;
-      if (val && val->type == GCONF_VALUE_STRING)
-        str_val = gconf_value_get_string (val);
-      
-      if (set_x_font (profile, str_val))
-        mask |= TERMINAL_SETTING_X_FONT;
-
-      UPDATE_LOCKED (TERMINAL_SETTING_X_FONT);
-    }
-  else if (strcmp (key, KEY_BACKGROUND_TYPE) == 0)
-    {
-      const char *str_val;
-
-      str_val = NULL;
-      if (val && val->type == GCONF_VALUE_STRING)
-        str_val = gconf_value_get_string (val);
-      
-      if (set_background_type (profile, str_val))
-        mask |= TERMINAL_SETTING_BACKGROUND_TYPE;
-
-      UPDATE_LOCKED (TERMINAL_SETTING_BACKGROUND_TYPE);
-    }
-  else if (strcmp (key, KEY_BACKGROUND_IMAGE) == 0)
-    {
-      const char *str_val;
-
-      str_val = NULL;
-      if (val && val->type == GCONF_VALUE_STRING)
-        str_val = gconf_value_get_string (val);
-      
-      if (set_background_image_file (profile, str_val))
-        mask |= TERMINAL_SETTING_BACKGROUND_IMAGE;
-
-      UPDATE_LOCKED (TERMINAL_SETTING_BACKGROUND_IMAGE);
-    }
-  else if (strcmp (key, KEY_SCROLL_BACKGROUND) == 0)
-    {
-      gboolean bool_val;
-
-      bool_val = FALSE;
-
-      if (val && val->type == GCONF_VALUE_BOOL)
-        bool_val = gconf_value_get_bool (val);
-
-      if (bool_val != profile->priv->scroll_background)
-        {
-          mask |= TERMINAL_SETTING_SCROLL_BACKGROUND;
-          profile->priv->scroll_background = bool_val;
-        }
-
-      UPDATE_LOCKED (TERMINAL_SETTING_SCROLL_BACKGROUND);
-    }
-  else if (strcmp (key, KEY_BACKGROUND_DARKNESS) == 0)
-    {
-      double float_val;
-
-      float_val = 0.5;
-
-      if (val && val->type == GCONF_VALUE_FLOAT)
-        float_val = gconf_value_get_float (val);
-
-      if (float_val != profile->priv->background_darkness)
-        {
-          mask |= TERMINAL_SETTING_BACKGROUND_DARKNESS;
-          profile->priv->background_darkness = float_val;
-        }
-
-      UPDATE_LOCKED (TERMINAL_SETTING_BACKGROUND_DARKNESS);
-    }
-  else if (strcmp (key, KEY_BACKSPACE_BINDING) == 0)
-    {
-      const char *str_val;
-
-      str_val = NULL;
-      if (val && val->type == GCONF_VALUE_STRING)
-        str_val = gconf_value_get_string (val);
-      
-      if (set_backspace_binding (profile, str_val))
-        mask |= TERMINAL_SETTING_BACKSPACE_BINDING;
-
-      UPDATE_LOCKED (TERMINAL_SETTING_BACKSPACE_BINDING);
-    }
-  else if (strcmp (key, KEY_DELETE_BINDING) == 0)
-    {
-      const char *str_val;
-
-      str_val = NULL;
-      if (val && val->type == GCONF_VALUE_STRING)
-        str_val = gconf_value_get_string (val);
-      
-      if (set_delete_binding (profile, str_val))
-        mask |= TERMINAL_SETTING_DELETE_BINDING;
-
-      UPDATE_LOCKED (TERMINAL_SETTING_DELETE_BINDING);
-    }
-  else if (strcmp (key, KEY_USE_THEME_COLORS) == 0)
-    {
-      gboolean bool_val;
-
-      bool_val = TRUE;
-
-      if (val && val->type == GCONF_VALUE_BOOL)
-        bool_val = gconf_value_get_bool (val);
-
-      if (bool_val != profile->priv->use_theme_colors)
-        {
-          mask |= TERMINAL_SETTING_USE_THEME_COLORS;
-          profile->priv->use_theme_colors = bool_val;
-        }
-
-      UPDATE_LOCKED (TERMINAL_SETTING_USE_THEME_COLORS);
-    }
-  else if (strcmp (key, KEY_USE_SYSTEM_FONT) == 0)
-    {
-      gboolean bool_val;
-
-      bool_val = TRUE;
-
-      if (val && val->type == GCONF_VALUE_BOOL)
-        bool_val = gconf_value_get_bool (val);
-
-      if (bool_val != profile->priv->use_system_font)
-        {
-          mask |= TERMINAL_SETTING_USE_SYSTEM_FONT;
-          profile->priv->use_system_font = bool_val;
-        }
-
-      UPDATE_LOCKED (TERMINAL_SETTING_USE_SYSTEM_FONT);
-    }
-  else if (strcmp (key, KEY_FONT) == 0)
-    {
-      const char *str_val;
-
-      str_val = NULL;
-      if (val && val->type == GCONF_VALUE_STRING)
-        str_val = gconf_value_get_string (val);
-      
-      if (set_font (profile, str_val))
-        mask |= TERMINAL_SETTING_FONT;
-
-      UPDATE_LOCKED (TERMINAL_SETTING_FONT);
-    }
-  
-  if (mask != 0 || old_locked != profile->priv->locked)
-    emit_changed (profile, mask);
-}
-
-static void
-set_key_to_default (TerminalProfile *profile,
-                    const char      *relative_key)
-{
-  char *key;
-  char *default_key;
-  GError *err;
-  GConfValue *val;
-
-  default_key = gconf_concat_dir_and_key (CONF_PROFILES_PREFIX"/"FALLBACK_PROFILE_ID,
-                                          relative_key);
-
-  err = NULL;
-  val = gconf_client_get_default_from_schema (profile->priv->conf,
-                                              default_key,
-                                              &err);
-  if (err != NULL)
-    {
-      g_printerr (_("Error getting default value of %s: %s\n"),
-                  default_key, err->message);
-      g_error_free (err);
-    }
-
-  if (val == NULL)
-    g_printerr (_("There wasn't a default value for %s\n"),
-                default_key);
-  
-  g_free (default_key);
-  
-  if (val)
-    {
-      key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                      relative_key);
-      
-      err = NULL;      
-      gconf_client_set (profile->priv->conf,
-                        key, val, &err);
-      if (err != NULL)
-        {
-          g_printerr (_("Error setting key %s back to default: %s\n"),
-                      key, err->message);
-          g_error_free (err);
-        }
-
-      gconf_value_free (val);
-      g_free (key);
-    }
-}
-
-void
-terminal_profile_reset_compat_defaults (TerminalProfile *profile)
-{
-  set_key_to_default (profile, KEY_DELETE_BINDING);
-  set_key_to_default (profile, KEY_BACKSPACE_BINDING);
-}
-
-static void
-update_default_profile (const char *name,
-                        gboolean    locked)
-{
-  TerminalProfile *profile;
-  gboolean changed;
-  TerminalProfile *old_default;
-  
-  changed = FALSE;
-  
-  g_free (default_profile_id);
-  default_profile_id = g_strdup (name);
-
-  old_default = default_profile;
-  profile = terminal_profile_lookup (name);
-  
-  if (profile)
-    {
-      if (profile != default_profile)
-        {
-          default_profile = profile;
-          changed = TRUE;
-        }
-    }
-
-  if (locked != default_profile_locked)
-    {
-      /* Need to emit changed on all profiles */
-      GList *all_profiles;
-      GList *tmp;
-
-      default_profile_locked = locked;
-      
-      all_profiles = terminal_profile_get_list ();
-      tmp = all_profiles;
-      while (tmp != NULL)
-        {
-          TerminalProfile *p = tmp->data;
-          
-          emit_changed (p, TERMINAL_SETTING_IS_DEFAULT);
-          tmp = tmp->next;
-        }
-
-      g_list_free (all_profiles);
-    }
-  else if (changed)
-    {
-      if (old_default)
-        emit_changed (old_default, TERMINAL_SETTING_IS_DEFAULT);
-      emit_changed (profile, TERMINAL_SETTING_IS_DEFAULT);
-    }
-}
-
-static void
-default_change_notify (GConfClient *client,
-                       guint        cnxn_id,
-                       GConfEntry  *entry,
-                       gpointer     user_data)
-{
-  GConfValue *val;
-  gboolean locked;
-  const char *name;
-  
-  val = gconf_entry_get_value (entry);  
-
-  if (val == NULL || val->type != GCONF_VALUE_STRING)
-    return;
-  
-  if (gconf_entry_get_is_writable (entry))  
-    locked = FALSE;
-  else
-    locked = TRUE;
-  
-  name = gconf_value_get_string (val);
-
-  update_default_profile (name, locked);
-}
-
-static void
-listify_foreach (gpointer key,
-                 gpointer value,
-                 gpointer data)
-{
-  GList **listp = data;
-
-  *listp = g_list_prepend (*listp, value);
-}
-
-static int
-alphabetic_cmp (gconstpointer a,
-                gconstpointer b)
-{
-  TerminalProfile *ap = (TerminalProfile*) a;
-  TerminalProfile *bp = (TerminalProfile*) b;
-
-  return g_utf8_collate (terminal_profile_get_visible_name (ap),
-                         terminal_profile_get_visible_name (bp));
-}
-
-GList*
-terminal_profile_get_list (void)
-{
-  GList *list;
-
-  list = NULL;
-  g_hash_table_foreach (profiles, listify_foreach, &list);
-
-  list = g_list_sort (list, alphabetic_cmp);
-  
-  return list;
-}
-
-int
-terminal_profile_get_count (void)
-{
-  return g_hash_table_size (profiles);
-}
-
-TerminalProfile*
-terminal_profile_lookup (const char *name)
-{
-  g_return_val_if_fail (name != NULL, NULL);
-
-  if (profiles)
-    return g_hash_table_lookup (profiles, name);
-  else
-    return NULL;
-}
+  if (profiles)
+    return g_hash_table_lookup (profiles, name);
+  else
+    return NULL;
+}
 
 typedef struct
 {
@@ -3200,14 +2418,23 @@
 }
 
 static void
-emit_changed (TerminalProfile    *profile,
-              TerminalSettingMask mask)
+emit_changed (TerminalProfile     *profile,
+              TerminalSettingMask *mask)
 {
   profile->priv->in_notification_count += 1;
   g_signal_emit (G_OBJECT (profile), signals[CHANGED], 0, mask);  
   profile->priv->in_notification_count -= 1;
 }
 
+static void
+emit_is_default_changed (TerminalProfile *profile)
+{
+  TerminalSettingMask mask;
+  TERMINAL_SETTING_MASK_CLEAR (mask);
+  mask.is_default = TRUE;
+  emit_changed (profile, &mask);
+}
+
 /* Function I'm cut-and-pasting everywhere, this is from msm */
 void
 dialog_add_details (GtkDialog  *dialog,
@@ -3269,379 +2496,180 @@
 {
   char *profile_name = NULL;
   char *profile_dir = NULL;
-  int i;
-  char *s;
-  const char *cs;
+
   char *key = NULL;
+  char *str = NULL;
   GError *err = NULL;
+
   GList *profiles = NULL;
   GSList *name_list = NULL;
-  GList *tmp;  
 
   /* This is for extra bonus paranoia against CORBA reentrancy */
   g_object_ref (G_OBJECT (base_profile));
   g_object_ref (G_OBJECT (transient_parent));
 
-#define BAIL_OUT_CHECK() do {                           \
-    if (!GTK_WIDGET_VISIBLE (transient_parent) ||       \
-        base_profile->priv->forgotten ||                \
-        err != NULL)                                    \
-       goto cleanup;                                    \
-  } while (0) 
-  
   /* Pick a unique name for storing in gconf (based on visible name) */
   profile_name = gconf_escape_key (visible_name, -1);
 
-  s = g_strdup (profile_name);
-  i = 0;
-  while (terminal_profile_lookup (s))
-    {
-      g_free (s);
-      
-      s = g_strdup_printf ("%s-%d", profile_name, i);
+  {
+    int i;
+  
+    str = g_strdup (profile_name);
 
-      ++i;
+    for (i = 0; terminal_profile_lookup (str); ++i)
+    {
+      g_free (str);
+      str = g_strdup_printf ("%s-%d", profile_name, i);
     }
+  }
 
   g_free (profile_name);
-  profile_name = s;
+  profile_name = str;
 
   profile_dir = gconf_concat_dir_and_key (CONF_PROFILES_PREFIX, 
                                           profile_name);
-  
-  /* Store a copy of base profile values at under that directory */
-
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_VISIBLE_NAME);
-
-  gconf_client_set_string (base_profile->priv->conf,
-                           key,
-                           visible_name,
-                           &err);
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_CURSOR_BLINK);
-
-  gconf_client_set_bool (base_profile->priv->conf,
-                         key,
-                         base_profile->priv->cursor_blink,
-                         &err);
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_DEFAULT_SHOW_MENUBAR);
-
-  gconf_client_set_bool (base_profile->priv->conf,
-                         key,
-                         base_profile->priv->default_show_menubar,
-                         &err);
-
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_FOREGROUND_COLOR);
-  s = color_to_string (&base_profile->priv->foreground);
-  gconf_client_set_string (base_profile->priv->conf,
-                           key, s,                           
-                           &err);
-  g_free (s);
-
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_BACKGROUND_COLOR);
-  s = color_to_string (&base_profile->priv->background);
-  gconf_client_set_string (base_profile->priv->conf,
-                           key, s,                           
-                           &err);
-  g_free (s);
-
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_TITLE);
-  /* default title is profile name, not copied from base */
-  gconf_client_set_string (base_profile->priv->conf,
-                           key, visible_name,
-                           &err);
-  BAIL_OUT_CHECK ();
-  
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_TITLE_MODE);
-  cs = gconf_enum_to_string (title_modes, base_profile->priv->title_mode);
-  gconf_client_set_string (base_profile->priv->conf,
-                           key, cs,
-                           &err);
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_ALLOW_BOLD);
-
-  gconf_client_set_bool (base_profile->priv->conf,
-                         key,
-                         base_profile->priv->allow_bold,
-                         &err);
-
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_SILENT_BELL);
-
-  gconf_client_set_bool (base_profile->priv->conf,
-                         key,
-                         base_profile->priv->silent_bell,
-                         &err);
-
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_WORD_CHARS);
-  /* default title is profile name, not copied from base */
-  gconf_client_set_string (base_profile->priv->conf,
-                           key, base_profile->priv->word_chars,
-                           &err);
-  BAIL_OUT_CHECK ();
-  
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_SCROLLBAR_POSITION);
-  cs = gconf_enum_to_string (scrollbar_positions,
-                             base_profile->priv->scrollbar_position);
-  gconf_client_set_string (base_profile->priv->conf,
-                           key, cs,
-                           &err);
-  BAIL_OUT_CHECK ();
-  
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_SCROLLBACK_LINES);
-  gconf_client_set_int (base_profile->priv->conf,
-                        key, base_profile->priv->scrollback_lines,
-                        &err);
-  BAIL_OUT_CHECK ();
-
-  
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_SCROLL_ON_KEYSTROKE);
-
-  gconf_client_set_bool (base_profile->priv->conf,
-                         key,
-                         base_profile->priv->scroll_on_keystroke,
-                         &err);
-
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_SCROLL_ON_OUTPUT);
-
-  gconf_client_set_bool (base_profile->priv->conf,
-                         key,
-                         base_profile->priv->scroll_on_output,
-                         &err);
-
-  BAIL_OUT_CHECK ();
-
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_EXIT_ACTION);
-
-  cs = gconf_enum_to_string (scrollbar_positions,
-                             base_profile->priv->exit_action);
-  
-  gconf_client_set_string (base_profile->priv->conf,
-                           key, cs,
-                           &err);
-
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_LOGIN_SHELL);
-
-  gconf_client_set_bool (base_profile->priv->conf,
-                         key,
-                         base_profile->priv->login_shell,
-                         &err);
-
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_UPDATE_RECORDS);
-
-  gconf_client_set_bool (base_profile->priv->conf,
-                         key,
-                         base_profile->priv->update_records,
-                         &err);
-
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_USE_CUSTOM_COMMAND);
-
-  gconf_client_set_bool (base_profile->priv->conf,
-                         key,
-                         base_profile->priv->use_custom_command,
-                         &err);
-
-  BAIL_OUT_CHECK ();
-
-  
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_CUSTOM_COMMAND);
-  gconf_client_set_string (base_profile->priv->conf,
-                           key, base_profile->priv->custom_command,
-                           &err);
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_ICON);
-  gconf_client_set_string (base_profile->priv->conf,
-                           key, base_profile->priv->icon_file,
-                           &err);
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_PALETTE);
-  s = terminal_palette_to_string (base_profile->priv->palette);
-  gconf_client_set_string (base_profile->priv->conf,
-                           key, s,
-                           &err);
-  g_free (s);
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_X_FONT);
-  gconf_client_set_string (base_profile->priv->conf,
-                           key, base_profile->priv->x_font,
-                           &err);
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_BACKGROUND_TYPE);
-  cs = gconf_enum_to_string (background_types, base_profile->priv->background_type);
-  gconf_client_set_string (base_profile->priv->conf,
-                           key, cs,
-                           &err);
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_BACKGROUND_IMAGE);
-  gconf_client_set_string (base_profile->priv->conf,
-                           key, base_profile->priv->background_image_file,
-                           &err);
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_SCROLL_BACKGROUND);
-  gconf_client_set_bool (base_profile->priv->conf,
-                         key, base_profile->priv->scroll_background,
-                         &err);
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_BACKGROUND_DARKNESS);
-  gconf_client_set_float (base_profile->priv->conf,
-                          key, base_profile->priv->background_darkness,
-                          &err);
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_BACKSPACE_BINDING);
-  cs = gconf_enum_to_string (erase_bindings, base_profile->priv->backspace_binding);
-  gconf_client_set_string (base_profile->priv->conf,
-                           key, cs,
-                           &err);
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_DELETE_BINDING);
-  cs = gconf_enum_to_string (erase_bindings, base_profile->priv->delete_binding);
-  gconf_client_set_string (base_profile->priv->conf,
-                           key, cs,
-                           &err);
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_USE_THEME_COLORS);
-  gconf_client_set_bool (base_profile->priv->conf,
-                         key, base_profile->priv->use_theme_colors,
-                         &err);
-  BAIL_OUT_CHECK ();
 
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_USE_SYSTEM_FONT);
-  gconf_client_set_bool (base_profile->priv->conf,
-                         key, base_profile->priv->use_system_font,
-                         &err);
-  BAIL_OUT_CHECK ();
+/* Store a copy of base profile values at under that directory */
 
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_FONT);
-  s = pango_font_description_to_string (base_profile->priv->font);
-  gconf_client_set_string (base_profile->priv->conf,
-                           key, s,
-                           &err);
-  g_free (s);
-  
-  BAIL_OUT_CHECK ();
+#define BAIL_OUT_CHECK() do {                           \
+    if (!GTK_WIDGET_VISIBLE (transient_parent) ||       \
+        base_profile->priv->forgotten ||                \
+        err != NULL)                                    \
+       goto cleanup;                                    \
+  } while (0) 
   
+#define STORE_VALUE(Type, Key, Value)                                       \
+{                                                                           \
+  g_free (key);                                                             \
+  key = gconf_concat_dir_and_key (profile_dir, Key);                        \
+  gconf_client_set_##Type (base_profile->priv->conf, key, Value, &err);     \
+  BAIL_OUT_CHECK ();                                                        \
+}
+
+#define STORE_BOOLEAN(Key, Value) \
+STORE_VALUE (bool, Key, Value)
+
+#define STORE_INTEGER(Key, Value) \
+STORE_VALUE (int, Key, Value)
+
+#define STORE_FLOAT(Key, Value) \
+STORE_VALUE (float, Key, Value)
+
+#define STORE_STRING(Key, Value) \
+STORE_VALUE (string, Key, Value)
+
+#define STORE_CHOICE(Key, Enumeration, Value) \
+STORE_STRING (Key, gconf_enum_to_string (Enumeration, Value))
+
+#define STORE_COLOR(Key, Value) \
+g_free (str); \
+str = color_to_string (&Value); \
+STORE_STRING (Key, str); \
+
+#define STORE_PALETTE(Key, Value) \
+g_free (str); \
+str = terminal_palette_to_string (Value); \
+STORE_STRING (Key, str); \
+
+#define STORE_FONT(Key, Value) \
+g_free (str); \
+str = pango_font_description_to_string (Value); \
+STORE_STRING (Key, str); \
+
+  STORE_STRING  (KEY_VISIBLE_NAME, 
+                 visible_name);
+  STORE_BOOLEAN (KEY_CURSOR_BLINK, 
+                 base_profile->priv->cursor_blink);
+  STORE_BOOLEAN (KEY_DEFAULT_SHOW_MENUBAR,
+                 base_profile->priv->default_show_menubar);
+  STORE_COLOR   (KEY_FOREGROUND_COLOR,
+                 base_profile->priv->foreground);
+  STORE_COLOR   (KEY_BACKGROUND_COLOR,
+                 base_profile->priv->background);
+  STORE_STRING  (KEY_TITLE,
+                 visible_name);
+  STORE_CHOICE  (KEY_TITLE_MODE, title_modes,
+                 base_profile->priv->title_mode);
+  STORE_BOOLEAN (KEY_ALLOW_BOLD,
+                 base_profile->priv->allow_bold);
+  STORE_BOOLEAN (KEY_SILENT_BELL,
+                 base_profile->priv->silent_bell);
+  STORE_STRING  (KEY_WORD_CHARS,
+                 base_profile->priv->word_chars);
+  STORE_CHOICE  (KEY_SCROLLBAR_POSITION, scrollbar_positions,
+                 base_profile->priv->scrollbar_position);
+  STORE_INTEGER (KEY_SCROLLBACK_LINES,
+                 base_profile->priv->scrollback_lines);
+  STORE_BOOLEAN (KEY_SCROLL_ON_KEYSTROKE,
+                 base_profile->priv->scroll_on_keystroke);
+  STORE_BOOLEAN (KEY_SCROLL_ON_OUTPUT,
+                 base_profile->priv->scroll_on_output);
+  STORE_CHOICE  (KEY_EXIT_ACTION, scrollbar_positions,
+                 base_profile->priv->exit_action);
+  STORE_BOOLEAN (KEY_LOGIN_SHELL,
+                 base_profile->priv->login_shell);
+  STORE_BOOLEAN (KEY_UPDATE_RECORDS,
+                 base_profile->priv->update_records);
+  STORE_BOOLEAN (KEY_USE_CUSTOM_COMMAND,
+                 base_profile->priv->use_custom_command);
+  STORE_STRING  (KEY_CUSTOM_COMMAND,
+                 base_profile->priv->custom_command);
+  STORE_STRING  (KEY_ICON,
+                 base_profile->priv->icon_file);
+  STORE_PALETTE (KEY_PALETTE,
+                 base_profile->priv->palette);
+  STORE_STRING  (KEY_X_FONT,
+                 base_profile->priv->x_font);
+  STORE_CHOICE  (KEY_BACKGROUND_TYPE, background_types,
+                 base_profile->priv->background_type);
+  STORE_STRING  (KEY_BACKGROUND_IMAGE,
+                 base_profile->priv->background_image_file);
+  STORE_BOOLEAN (KEY_SCROLL_BACKGROUND,
+                 base_profile->priv->scroll_background);
+  STORE_FLOAT   (KEY_BACKGROUND_DARKNESS,
+                 base_profile->priv->background_darkness);
+  STORE_CHOICE  (KEY_BACKSPACE_BINDING, erase_bindings,
+                 base_profile->priv->backspace_binding);
+  STORE_CHOICE  (KEY_DELETE_BINDING, erase_bindings,
+                 base_profile->priv->delete_binding);
+  STORE_BOOLEAN (KEY_USE_THEME_COLORS,
+                 base_profile->priv->use_theme_colors);
+  STORE_BOOLEAN (KEY_USE_SYSTEM_FONT,
+                 base_profile->priv->use_system_font);
+  STORE_FONT    (KEY_FONT,
+                 base_profile->priv->font);
   
   /* Add new profile to the profile list; the method for doing this has
    * a race condition where we and someone else set at the same time,
    * but I am just going to punt on this issue.
    */
-  profiles = terminal_profile_get_list ();
-  tmp = profiles;
-  while (tmp != NULL)
-    {
-      name_list = g_slist_prepend (name_list,
-                                   g_strdup (terminal_profile_get_name (tmp->data)));
-      
-      tmp = tmp->next;
-    }
+  {
+    GList *cp;
+    
+    profiles = terminal_profile_get_list ();
+    name_list = NULL;
+
+    for (cp = profiles; cp != NULL; cp = cp->next)
+      {
+        char *name = g_strdup (terminal_profile_get_name (cp->data));
+        name_list = g_slist_prepend (name_list, name);
+      }      
+
+    name_list = g_slist_prepend (name_list, g_strdup (profile_name));
+  }
 
-  name_list = g_slist_prepend (name_list, g_strdup (profile_name));
-  
   gconf_client_set_list (base_profile->priv->conf,
                          CONF_GLOBAL_PREFIX"/profile_list",
                          GCONF_VALUE_STRING,
-                         name_list,
-                         &err);
+                         name_list, &err);
 
   BAIL_OUT_CHECK ();
-  
- cleanup:
+
+cleanup:
   g_free (profile_name);
   g_free (profile_dir);
   g_free (key);
+  g_free (str);
 
   g_list_free (profiles);
 
@@ -3833,6 +2861,19 @@
   return TRUE;
 }
 
+gboolean 
+terminal_setting_mask_is_empty(TerminalSettingMask *mask)
+{
+  unsigned *pMask = (unsigned *) mask;
+  unsigned *pEnd = pMask + (sizeof (TerminalSettingMask) / 
+                            sizeof (unsigned));
+
+  while (pMask < pEnd)
+    if (*pMask++) return FALSE;
+
+  return TRUE;
+}
+
 const GdkColor
 terminal_palette_linux[TERMINAL_PALETTE_SIZE] =
 {
@@ -3878,6 +2919,7 @@
 const GdkColor
 terminal_palette_rxvt[TERMINAL_PALETTE_SIZE] =
 {
+
   { 0, 0x0000, 0x0000, 0x0000 },
   { 0, 0xcdcd, 0x0000, 0x0000 },
   { 0, 0x0000, 0xcdcd, 0x0000 },
@@ -3894,5 +2936,26 @@
   { 0, 0xffff, 0x0000, 0xffff },
   { 0, 0x0000, 0xffff, 0xffff },
   { 0, 0xffff, 0xffff, 0xffff }
+};
+
+const GdkColor
+terminal_palette_pastell[TERMINAL_PALETTE_SIZE] =
+{
+  { 0, 0x0000, 0x0000, 0x0000 },
+  { 0, 0x8080, 0x5555, 0x5555 },
+  { 0, 0x5555, 0x8080, 0x5555 },
+  { 0, 0x8080, 0x8080, 0x5555 },
+  { 0, 0x5555, 0x5555, 0x8080 },
+  { 0, 0x8080, 0x5555, 0x8080 },
+  { 0, 0x5555, 0x8080, 0x8080 },
+  { 0, 0xaaaa, 0xaaaa, 0xaaaa },
+  { 0, 0x5555, 0x5555, 0x5555 },
+  { 0, 0xaaaa, 0x7171, 0x7171 },
+  { 0, 0x7171, 0xaaaa, 0x7171 },
+  { 0, 0xaaaa, 0xaaaa, 0x7171 },
+  { 0, 0x7171, 0x7171, 0xaaaa },
+  { 0, 0xaaaa, 0x7171, 0xaaaa },
+  { 0, 0x7171, 0xaaaa, 0xaaaa },
+  { 0, 0xffff, 0xffff, 0xffff },
 };
 
Index: src/terminal-profile.h
===================================================================
RCS file: /cvs/gnome/profterm/src/terminal-profile.h,v
retrieving revision 1.18
diff -u -r1.18 terminal-profile.h
--- src/terminal-profile.h	14 May 2002 04:14:13 -0000	1.18
+++ src/terminal-profile.h	18 Jun 2002 22:04:07 -0000
@@ -31,43 +31,40 @@
 #define CONF_KEYS_PREFIX CONF_PREFIX"/keybindings"
 #define FALLBACK_PROFILE_ID "Default"
 
-typedef enum
+typedef struct _TerminalSettingMask
 {
-  TERMINAL_SETTING_VISIBLE_NAME         = 1 << 0,
-  TERMINAL_SETTING_CURSOR_BLINK         = 1 << 1,
-  TERMINAL_SETTING_DEFAULT_SHOW_MENUBAR = 1 << 2,
-  TERMINAL_SETTING_FOREGROUND_COLOR     = 1 << 3,
-  TERMINAL_SETTING_BACKGROUND_COLOR     = 1 << 4,
-  TERMINAL_SETTING_TITLE                = 1 << 5,
-  TERMINAL_SETTING_TITLE_MODE           = 1 << 6,
-  TERMINAL_SETTING_ALLOW_BOLD           = 1 << 7,
-  TERMINAL_SETTING_SILENT_BELL          = 1 << 8,
-  TERMINAL_SETTING_WORD_CHARS           = 1 << 9,
-  TERMINAL_SETTING_SCROLLBAR_POSITION   = 1 << 10,
-  TERMINAL_SETTING_SCROLLBACK_LINES     = 1 << 11,
-  TERMINAL_SETTING_SCROLL_ON_KEYSTROKE  = 1 << 12,
-  TERMINAL_SETTING_SCROLL_ON_OUTPUT     = 1 << 13,
-  TERMINAL_SETTING_EXIT_ACTION          = 1 << 14,
-  TERMINAL_SETTING_LOGIN_SHELL          = 1 << 15,
-  TERMINAL_SETTING_UPDATE_RECORDS       = 1 << 16,
-  TERMINAL_SETTING_USE_CUSTOM_COMMAND   = 1 << 17,
-  TERMINAL_SETTING_CUSTOM_COMMAND       = 1 << 18,
-  TERMINAL_SETTING_ICON                 = 1 << 19,
-  TERMINAL_SETTING_IS_DEFAULT           = 1 << 20,
-  TERMINAL_SETTING_PALETTE              = 1 << 21,
-  TERMINAL_SETTING_X_FONT               = 1 << 22,
-  TERMINAL_SETTING_BACKGROUND_TYPE      = 1 << 23,
-  TERMINAL_SETTING_BACKGROUND_IMAGE     = 1 << 24,
-  TERMINAL_SETTING_SCROLL_BACKGROUND    = 1 << 25,
-  TERMINAL_SETTING_BACKGROUND_DARKNESS  = 1 << 26,
-  TERMINAL_SETTING_BACKSPACE_BINDING    = 1 << 27,
-  TERMINAL_SETTING_DELETE_BINDING       = 1 << 28,
-  TERMINAL_SETTING_USE_THEME_COLORS     = 1 << 29,
-  TERMINAL_SETTING_USE_SYSTEM_FONT      = 1 << 30,
-  TERMINAL_SETTING_FONT                 = 1 << 31
-
-  /* Out of bits! To add a setting you have to write a bunch of code ;-) */
-  
+  unsigned visible_name:1,
+           cursor_blink:1,
+           default_show_menubar:1,
+           foreground_color:1,
+           background_color:1,
+           title:1,
+           title_mode:1,
+           allow_bold:1,
+           silent_bell:1,
+           word_chars:1,
+           scrollbar_position:1,
+           scrollback_lines:1,
+           scroll_on_keystroke:1,
+           scroll_on_output:1,
+           exit_action:1,
+           login_shell:1,
+           update_records:1,
+           use_custom_command:1,
+           custom_command:1,
+           icon_file:1,
+           is_default:1,
+           palette:1,
+           x_font:1,
+           background_type:1,
+           background_image_file:1,
+           scroll_background:1,
+           background_darkness:1,
+           backspace_binding:1,
+           delete_binding:1,
+           use_theme_colors:1,
+           use_system_font:1,
+           font:1;
 } TerminalSettingMask;
 
 typedef enum
@@ -119,6 +116,9 @@
 #define TERMINAL_IS_PROFILE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_TYPE_PROFILE))
 #define TERMINAL_PROFILE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_TYPE_PROFILE, TerminalProfileClass))
 
+#define TERMINAL_SETTING_MASK_CLEAR(mask)  (memset (&mask, 0, sizeof (mask)))
+#define TERMINAL_SETTING_MASK_EQUAL(a, b)  (sizeof (a) == sizeof (b) && 0 == memcmp (&a, &b, sizeof (a)))
+
 typedef struct _TerminalProfile        TerminalProfile;
 typedef struct _TerminalProfileClass   TerminalProfileClass;
 typedef struct _TerminalProfilePrivate TerminalProfilePrivate;
@@ -135,7 +135,7 @@
   GObjectClass parent_class;
 
   void (* changed)   (TerminalProfile           *profile,
-                      TerminalSettingMask        mask);
+                      TerminalSettingMask       *mask);
   void (* forgotten) (TerminalProfile           *profile);
 };
 
@@ -287,9 +287,12 @@
                                    GList      *list,
                                    GtkWindow  *transient_parent);
 
+gboolean terminal_setting_mask_is_empty(TerminalSettingMask *mask);
+
 extern const GdkColor terminal_palette_linux[TERMINAL_PALETTE_SIZE];
 extern const GdkColor terminal_palette_xterm[TERMINAL_PALETTE_SIZE];
 extern const GdkColor terminal_palette_rxvt[TERMINAL_PALETTE_SIZE];
+extern const GdkColor terminal_palette_pastell[TERMINAL_PALETTE_SIZE];
 
 char*    terminal_palette_to_string   (const GdkColor *palette);
 gboolean terminal_palette_from_string (const char     *str,
Index: src/terminal-screen.c
===================================================================
RCS file: /cvs/gnome/profterm/src/terminal-screen.c,v
retrieving revision 1.53
diff -u -r1.53 terminal-screen.c
--- src/terminal-screen.c	27 May 2002 08:10:11 -0000	1.53
+++ src/terminal-screen.c	18 Jun 2002 22:04:08 -0000
@@ -454,7 +454,7 @@
 
 static void
 profile_changed_callback (TerminalProfile          *profile,
-                          TerminalSettingMask       mask,
+                          TerminalSettingMask      *mask,
                           TerminalScreen           *screen)
 {
   reread_profile (screen);
@@ -805,7 +805,7 @@
   else
     {
       const char *only_name;
-      const char *shell;
+      char *shell;
 
       shell = gnome_util_user_shell ();
 
Index: src/terminal-window.c
===================================================================
RCS file: /cvs/gnome/profterm/src/terminal-window.c,v
retrieving revision 1.54
diff -u -r1.54 terminal-window.c
--- src/terminal-window.c	27 May 2002 08:10:11 -0000	1.54
+++ src/terminal-window.c	18 Jun 2002 22:04:10 -0000
@@ -2103,11 +2103,11 @@
 
 
 static void
-default_profile_changed (TerminalProfile    *profile,
-                         TerminalSettingMask mask,
-                         void               *data)
+default_profile_changed (TerminalProfile     *profile,
+                         TerminalSettingMask *mask,
+                         void                *data)
 {  
-  if (mask & TERMINAL_SETTING_IS_DEFAULT)
+  if (mask->is_default)
     {
       TerminalWindow *window;
 
Index: src/terminal.c
===================================================================
RCS file: /cvs/gnome/profterm/src/terminal.c,v
retrieving revision 1.38
diff -u -r1.38 terminal.c
--- src/terminal.c	3 Jun 2002 22:30:45 -0000	1.38
+++ src/terminal.c	18 Jun 2002 22:04:21 -0000
@@ -2084,7 +2084,7 @@
                          TerminalSettingMask mask,
                          void               *profile_optionmenu)
 {
-  if (mask & TERMINAL_SETTING_IS_DEFAULT)
+  if (mask.is_default)
     {
       if (terminal_profile_get_is_default (profile))
         profile_optionmenu_set_selected (GTK_WIDGET (profile_optionmenu),
@@ -2806,7 +2806,6 @@
 		    CORBA_Environment *ev,
 		    gpointer           user_data)
 {
-  int i;
   int argc;
   int nextopt;
   poptContext ctx;
@@ -2931,3 +2930,50 @@
   return FALSE;
 }
 
+GladeXML* terminal_util_get_dialog (GtkWindow *transient_parent, 
+                                    const gchar *dialog_name)
+{
+  GladeXML *xml;
+      
+  if (g_file_test ("./"TERM_GLADE_FILE, G_FILE_TEST_EXISTS))
+    {
+      /* Try current dir, for debugging */
+      xml = glade_xml_new ("./"TERM_GLADE_FILE,
+                           dialog_name, GETTEXT_PACKAGE);
+    }
+  else
+    {
+      xml = glade_xml_new (TERM_GLADE_DIR"/"TERM_GLADE_FILE,
+                           dialog_name, GETTEXT_PACKAGE);
+    }
+
+  if (xml == NULL)
+    {
+      static GtkWidget *no_glade_dialog = NULL;
+
+      if (no_glade_dialog == NULL)
+        {
+          no_glade_dialog =
+            gtk_message_dialog_new (transient_parent,
+                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_ERROR,
+                                    GTK_BUTTONS_CLOSE,
+                                    _("The file \"%s\" is missing. This indicates that the application is installed incorrectly, so the profile editor can't be displayed."),
+                                    TERM_GLADE_DIR"/"TERM_GLADE_FILE);
+
+          g_signal_connect (G_OBJECT (no_glade_dialog),
+                            "response",
+                            G_CALLBACK (gtk_widget_destroy),
+                            NULL);
+
+          g_object_add_weak_pointer (G_OBJECT (no_glade_dialog),
+                                     (void**)&no_glade_dialog);
+        }
+
+      gtk_window_present (GTK_WINDOW (no_glade_dialog));
+
+      return NULL;
+    }
+
+  return xml;
+}
Index: src/terminal.h
===================================================================
RCS file: /cvs/gnome/profterm/src/terminal.h,v
retrieving revision 1.9
diff -u -r1.9 terminal.h
--- src/terminal.h	20 Apr 2002 17:47:25 -0000	1.9
+++ src/terminal.h	18 Jun 2002 22:04:21 -0000
@@ -24,6 +24,7 @@
 
 #include <gtk/gtk.h>
 #include <gconf/gconf-client.h>
+#include <glade/glade.h>
 #include "terminal-screen.h"
 
 typedef struct _TerminalApp TerminalApp;
@@ -60,6 +61,7 @@
                                              const char *name,
                                              const char *desc);
 
-
+GladeXML* terminal_util_get_dialog (GtkWindow *transient_parent, 
+                                    const gchar *dialog_name);
 
 #endif /* TERMINAL_H */
