[gnumeric] Add an interface for conditional background formatting.



commit 151d870a91478dd4caa62001c43b1362124b01dd
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Wed Jul 6 00:42:31 2011 -0600

    Add an interface for conditional background formatting.
    
    2011-07-06  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* component/Gnumeric-embed.xml.in: add menu item
    	* src/GNOME_Gnumeric-gtk.xml.in: ditto
    	* src/HILDON_Gnumeric-gtk.xml.in: ditto
    	* src/sheet-control-gui.c
    	* src/style-conditions.c (gnm_style_conditions_dup): new
    	(gnm_style_cond_is_valid): not all conditions need an expression
    	(gnm_style_conditions_eval): not all conditions need an expression
    	* src/style-conditions.h (gnm_style_conditions_dup): new
    	* src/wbc-gtk-actions.c (cb_format_cells_cond): new
    
    2011-07-06  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* cell-format-cond-def.ui: new
    	* cell-format-cond.ui: new
    	* dialog-cell-format-cond.c: new
    	* Makefile.am: add new files
    	* cell-format.ui: remove conditions tab
    	* dialog-cell-format.c: remove handling of deleted conditions tab moving
    	it to dialog-cell-format-cond.c
    	(dialog_cell_format_select_style): new
    	(dialog_cell_format_init): new
    	(dialog_cell_format): use dialog_cell_format_init
    	* dialogs.h (dialog_cell_format_select_style): new
    	(dialog_cell_format_cond): new
    	(dialog_cell_format_style_added): new
    	* help.h (GNUMERIC_HELP_LINK_CELL_FORMAT_COND): new

 ChangeLog                             |   12 +
 NEWS                                  |    1 +
 component/Gnumeric-embed.xml.in       |    1 +
 po-functions/POTFILES.in              |    3 +
 po/POTFILES.in                        |    3 +
 src/GNOME_Gnumeric-gtk.xml.in         |    1 +
 src/HILDON_Gnumeric-gtk.xml.in        |    1 +
 src/dialogs/ChangeLog                 |   17 +
 src/dialogs/Makefile.am               |    3 +
 src/dialogs/cell-format-cond-def.ui   |  381 ++++++++++++++
 src/dialogs/cell-format-cond.ui       |  225 ++++++++
 src/dialogs/cell-format.ui            |  721 ++++++++++++++++----------
 src/dialogs/dialog-cell-format-cond.c |  928 +++++++++++++++++++++++++++++++++
 src/dialogs/dialog-cell-format.c      |  386 +++-----------
 src/dialogs/dialog-doc-metadata.c     |    2 +-
 src/dialogs/dialogs.h                 |    5 +
 src/dialogs/help.h                    |    3 +
 src/sheet-control-gui.c               |    6 +
 src/style-conditions.c                |  231 +++++----
 src/style-conditions.h                |    1 +
 src/wbc-gtk-actions.c                 |    8 +-
 21 files changed, 2247 insertions(+), 692 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f235d60..5f7c83b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-07-06  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* component/Gnumeric-embed.xml.in: add menu item
+	* src/GNOME_Gnumeric-gtk.xml.in: ditto
+	* src/HILDON_Gnumeric-gtk.xml.in: ditto
+	* src/sheet-control-gui.c
+	* src/style-conditions.c (gnm_style_conditions_dup): new
+	(gnm_style_cond_is_valid): not all conditions need an expression
+	(gnm_style_conditions_eval): not all conditions need an expression
+	* src/style-conditions.h (gnm_style_conditions_dup): new
+	* src/wbc-gtk-actions.c (cb_format_cells_cond): new
+
 2011-06-22  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* print.c (load_repeat_range): move from here to
diff --git a/NEWS b/NEWS
index c239b5f..d93cede 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Andreas:
 	* Fix xlsx schema violations.
 	* Fix keyword handling in properties dialog. [#653378]
 	* Allow document properties to be edited and added.
+	* Add an interface for conditional background formatting.
 
 Morten:
 	* Fix --with-gnome compilation:  [#652802]
diff --git a/component/Gnumeric-embed.xml.in b/component/Gnumeric-embed.xml.in
index fb2d918..3e1925c 100644
--- a/component/Gnumeric-embed.xml.in
+++ b/component/Gnumeric-embed.xml.in
@@ -142,6 +142,7 @@
     <menu name="Format" action="MenuFormat">
       <menu name="FormatCellsMenu" action="MenuFormatCells">
       <menuitem action="FormatCells"/>
+      <menuitem action="FormatCellsCond"/>
       <menuitem action="FormatMergeCells"/>
       <menuitem action="FormatUnmergeCells"/>
       <menuitem action="FormatCellsFitHeight"/>
diff --git a/po-functions/POTFILES.in b/po-functions/POTFILES.in
index 0442973..7e564fb 100644
--- a/po-functions/POTFILES.in
+++ b/po-functions/POTFILES.in
@@ -89,6 +89,7 @@ src/dialogs/dialog-autoformat.c
 src/dialogs/dialog-autosave.c
 src/dialogs/dialog-cell-comment.c
 src/dialogs/dialog-cell-format.c
+src/dialogs/dialog-cell-format-cond.c
 src/dialogs/dialog-cell-sort.c
 src/dialogs/dialog-col-width.c
 src/dialogs/dialog-consolidate.c
@@ -146,6 +147,8 @@ src/dialogs/dialog-zoom.c
 [type: gettext/glade]src/dialogs/autosave.ui
 [type: gettext/glade]src/dialogs/cell-comment.ui
 [type: gettext/glade]src/dialogs/cell-format.ui
+[type: gettext/glade]src/dialogs/cell-format-cond.ui
+[type: gettext/glade]src/dialogs/cell-format-cond-def.ui
 [type: gettext/glade]src/dialogs/cell-sort.ui
 [type: gettext/glade]src/dialogs/chi-squared.ui
 [type: gettext/glade]src/dialogs/col-width.ui
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a5b8fc2..79bad13 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -152,6 +152,7 @@ src/dialogs/dialog-autoformat.c
 src/dialogs/dialog-autosave.c
 src/dialogs/dialog-cell-comment.c
 src/dialogs/dialog-cell-format.c
+src/dialogs/dialog-cell-format-cond.c
 src/dialogs/dialog-cell-sort.c
 src/dialogs/dialog-col-width.c
 src/dialogs/dialog-consolidate.c
@@ -209,6 +210,8 @@ src/dialogs/dialog-zoom.c
 [type: gettext/glade]src/dialogs/autosave.ui
 [type: gettext/glade]src/dialogs/cell-comment.ui
 [type: gettext/glade]src/dialogs/cell-format.ui
+[type: gettext/glade]src/dialogs/cell-format-cond.ui
+[type: gettext/glade]src/dialogs/cell-format-cond-def.ui
 [type: gettext/glade]src/dialogs/cell-sort.ui
 [type: gettext/glade]src/dialogs/chi-squared.ui
 [type: gettext/glade]src/dialogs/col-width.ui
diff --git a/src/GNOME_Gnumeric-gtk.xml.in b/src/GNOME_Gnumeric-gtk.xml.in
index 89c3ab3..b9b3880 100644
--- a/src/GNOME_Gnumeric-gtk.xml.in
+++ b/src/GNOME_Gnumeric-gtk.xml.in
@@ -143,6 +143,7 @@
     <menu name="Format" action="MenuFormat">
       <menu name="FormatCellsMenu" action="MenuFormatCells">
       <menuitem action="FormatCells"/>
+      <menuitem action="FormatCellsCond"/>
       <menuitem action="FormatMergeCells"/>
       <menuitem action="FormatUnmergeCells"/>
       <menuitem action="FormatCellsFitHeight"/>
diff --git a/src/HILDON_Gnumeric-gtk.xml.in b/src/HILDON_Gnumeric-gtk.xml.in
index 01b623e..7dda95d 100644
--- a/src/HILDON_Gnumeric-gtk.xml.in
+++ b/src/HILDON_Gnumeric-gtk.xml.in
@@ -152,6 +152,7 @@
     <menu name="Format" action="MenuFormat">
       <menu name="FormatCellsMenu" action="MenuFormatCells">
       <menuitem action="FormatCells"/>
+      <menuitem action="FormatCellsCond"/>
       <menuitem action="FormatMergeCells"/>
       <menuitem action="FormatUnmergeCells"/>
       <menuitem action="FormatCellsFitHeight"/>
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 460b47b..250e70c 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,20 @@
+2011-07-06  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* cell-format-cond-def.ui: new
+	* cell-format-cond.ui: new
+	* dialog-cell-format-cond.c: new
+	* Makefile.am: add new files
+	* cell-format.ui: remove conditions tab
+	* dialog-cell-format.c: remove handling of deleted conditions tab moving
+	it to dialog-cell-format-cond.c
+	(dialog_cell_format_select_style): new
+	(dialog_cell_format_init): new
+	(dialog_cell_format): use dialog_cell_format_init
+	* dialogs.h (dialog_cell_format_select_style): new
+	(dialog_cell_format_cond): new
+	(dialog_cell_format_style_added): new
+	* help.h (GNUMERIC_HELP_LINK_CELL_FORMAT_COND): new
+
 2011-07-01  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* dialog-doc-metadata.c (dialog_doc_metadata_get_value_type_from_name):
diff --git a/src/dialogs/Makefile.am b/src/dialogs/Makefile.am
index c225105..5ce4b85 100644
--- a/src/dialogs/Makefile.am
+++ b/src/dialogs/Makefile.am
@@ -38,6 +38,7 @@ base_files =					\
 	dialog-autosave.c			\
 	dialog-cell-comment.c			\
 	dialog-cell-format.c			\
+	dialog-cell-format-cond.c		\
 	dialog-cell-sort.c			\
 	dialog-col-width.c			\
 	dialog-col-row.c			\
@@ -103,6 +104,8 @@ ui_DATA = 				\
 	autosave.ui			\
 	cell-comment.ui			\
 	cell-format.ui			\
+	cell-format-cond.ui		\
+	cell-format-cond-def.ui		\
 	cell-sort.ui			\
 	chi-squared.ui			\
 	col-width.ui			\
diff --git a/src/dialogs/cell-format-cond-def.ui b/src/dialogs/cell-format-cond-def.ui
new file mode 100644
index 0000000..f50048a
--- /dev/null
+++ b/src/dialogs/cell-format-cond-def.ui
@@ -0,0 +1,381 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 2.12 -->
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkListStore" id="liststore1">
+    <columns>
+      <!-- column-name gchararray1 -->
+      <column type="gchararray"/>
+      <!-- column-name type -->
+      <column type="gint"/>
+    </columns>
+  </object>
+  <object class="GtkDialog" id="style-condition-def">
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Style Condition</property>
+    <property name="modal">True</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="spacing">8</property>
+        <child>
+          <object class="GtkTable" id="condition-table">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="border_width">5</property>
+            <property name="n_rows">4</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">5</property>
+            <property name="row_spacing">5</property>
+            <child>
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Condition:</property>
+              </object>
+              <packing>
+                <property name="y_options">GTK_SHRINK | GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkComboBox" id="condition-combo">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="model">liststore1</property>
+              </object>
+              <packing>
+                <property name="right_attach">2</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="y_options">GTK_SHRINK | GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkTable" id="table1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="border_width">5</property>
+            <property name="n_rows">5</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">5</property>
+            <property name="row_spacing">5</property>
+            <child>
+              <object class="GtkLabel" id="label3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Applicable Style Components:</property>
+              </object>
+              <packing>
+                <property name="right_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="check-number">
+                <property name="label" translatable="yes">Number Format</property>
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="check-align">
+                <property name="label" translatable="yes">Alignment</property>
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="check-font">
+                <property name="label" translatable="yes">Font</property>
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="checkbutton4">
+                <property name="label" translatable="yes">Background</property>
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <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>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="check-protection">
+                <property name="label" translatable="yes">Protection</property>
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <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>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="check-validation">
+                <property name="label" translatable="yes">Validation</property>
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <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>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="check-border">
+                <property name="label" translatable="yes">Border</property>
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="top_attach">4</property>
+                <property name="bottom_attach">5</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="padding">5</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkVBox" id="vbox1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="border_width">5</property>
+            <property name="spacing">5</property>
+            <child>
+              <object class="GtkHBox" id="hbox1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <object class="GtkLabel" id="label2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Style Overlay:</property>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="style-label">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">label</property>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHButtonBox" id="hbuttonbox1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="spacing">5</property>
+                <property name="layout_style">end</property>
+                <child>
+                  <object class="GtkButton" id="edit-button">
+                    <property name="label">gtk-edit</property>
+                    <property name="sensitive">False</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_stock">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="new-button">
+                    <property name="label">gtk-new</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_stock">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="help-button">
+                <property name="label">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="cancel-button">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="ok-button">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">3</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">help-button</action-widget>
+      <action-widget response="0">cancel-button</action-widget>
+      <action-widget response="0">ok-button</action-widget>
+    </action-widgets>
+  </object>
+</interface>
diff --git a/src/dialogs/cell-format-cond.ui b/src/dialogs/cell-format-cond.ui
new file mode 100644
index 0000000..523efd1
--- /dev/null
+++ b/src/dialogs/cell-format-cond.ui
@@ -0,0 +1,225 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 2.12 -->
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkDialog" id="CellFormat">
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Conditional Cell Formatting</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="vbox1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="spacing">6</property>
+        <child>
+          <object class="GtkLabel" id="header-label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">0</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="hbuttonbox1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="helpbutton">
+                <property name="label">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="closebutton">
+                <property name="label">gtk-close</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkTable" id="condition-table">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="border_width">12</property>
+            <property name="n_rows">3</property>
+            <child>
+              <object class="GtkLabel" id="conditions_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="xpad">5</property>
+                <property name="ypad">5</property>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="y_options">GTK_SHRINK | GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkScrolledWindow" id="scrolledwindow1">
+                <property name="height_request">250</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hscrollbar_policy">automatic</property>
+                <property name="vscrollbar_policy">automatic</property>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="GtkTreeView" id="conditions_treeview">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="border_width">5</property>
+                    <property name="headers_visible">False</property>
+                    <property name="enable_search">False</property>
+                    <property name="level_indentation">5</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkHBox" id="hbox1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <object class="GtkHButtonBox" id="hbuttonbox2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="layout_style">start</property>
+                    <child>
+                      <object class="GtkButton" id="conditions_add">
+                        <property name="label">gtk-add</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_stock">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="conditions_remove">
+                        <property name="label">gtk-remove</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_stock">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="conditions_clear">
+                        <property name="label">gtk-clear</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_stock">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="conditions_expand">
+                        <property name="label" translatable="yes">E_xpand</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="conditions_edit">
+                        <property name="label">gtk-edit</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_stock">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">4</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="y_options">GTK_SHRINK | GTK_FILL</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">helpbutton</action-widget>
+      <action-widget response="0">closebutton</action-widget>
+    </action-widgets>
+  </object>
+</interface>
diff --git a/src/dialogs/cell-format.ui b/src/dialogs/cell-format.ui
index 00fbc9b..75009fe 100644
--- a/src/dialogs/cell-format.ui
+++ b/src/dialogs/cell-format.ui
@@ -2,83 +2,94 @@
 <interface>
   <!-- interface-requires gtk+ 2.12 -->
   <!-- interface-naming-policy toplevel-contextual -->
-  <object class="GtkAdjustment" id="adjustment1">
-    <property name="upper">20</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkListStore" id="model1">
-    <columns>
-      <!-- column-name gchararray -->
-      <column type="gchararray"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0" translatable="yes">Any Value     (no validation)</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Whole numbers</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Numbers</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">In a list</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Date</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Time</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Text length</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Custom</col>
-      </row>
-    </data>
-  </object>
-  <object class="GtkListStore" id="model2">
-    <columns>
-      <!-- column-name gchararray -->
-      <column type="gchararray"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0" translatable="yes">min &lt;= val &lt;= max         (between)</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">val &lt;= min || max &lt;= val (not between)</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">val == bound                  (equal to)</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">val &lt;&gt; bound                  (not equal to)</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">val  &gt;  bound                  (greater than)</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">val  &lt;  bound                  (less than)</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">val &gt;= bound                  (greater than or equal)</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">val &lt;= bound                  (less than or equal)</col>
-      </row>
-    </data>
-  </object>
   <object class="GtkDialog" id="CellFormat">
+    <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes">Format Cells</property>
     <property name="type_hint">dialog</property>
     <child internal-child="vbox">
       <object class="GtkVBox" id="vbox1">
         <property name="visible">True</property>
+        <property name="can_focus">False</property>
         <property name="spacing">6</property>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="hbuttonbox1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="helpbutton">
+                <property name="label">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="applybutton">
+                <property name="label">gtk-apply</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="cancelbutton">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="okbutton">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
         <child>
           <object class="GtkNotebook" id="notebook">
             <property name="visible">True</property>
@@ -88,19 +99,23 @@
             <child>
               <object class="GtkHBox" id="alignment_box">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="border_width">12</property>
                 <property name="spacing">24</property>
                 <child>
                   <object class="GtkVBox" id="vbox12">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="spacing">12</property>
                     <child>
                       <object class="GtkVBox" id="vbox54">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="spacing">12</property>
                         <child>
                           <object class="GtkLabel" id="label67">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="xalign">0</property>
                             <property name="label" translatable="yes">&lt;b&gt;Horizontal alignment&lt;/b&gt;</property>
                             <property name="use_markup">True</property>
@@ -114,9 +129,11 @@
                         <child>
                           <object class="GtkHBox" id="hbox41">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <child>
                               <object class="GtkLabel" id="label66">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="label" translatable="yes">    </property>
                               </object>
                               <packing>
@@ -128,6 +145,7 @@
                             <child>
                               <object class="GtkTable" id="table3">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="n_rows">4</property>
                                 <property name="n_columns">3</property>
                                 <property name="column_spacing">12</property>
@@ -139,6 +157,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                   </object>
@@ -156,6 +175,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                     <property name="group">halign_justify</property>
@@ -172,6 +192,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                     <property name="group">halign_justify</property>
@@ -190,6 +211,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                     <property name="group">halign_justify</property>
@@ -206,6 +228,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                     <property name="group">halign_justify</property>
@@ -220,6 +243,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                     <property name="group">halign_justify</property>
@@ -233,6 +257,7 @@
                                 <child>
                                   <object class="GtkLabel" id="halign_indent_label">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="xalign">0</property>
                                     <property name="label" translatable="yes">_Indent:</property>
                                     <property name="use_underline">True</property>
@@ -249,6 +274,10 @@
                                   <object class="GtkSpinButton" id="halign_indent">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
+                                    <property name="primary_icon_activatable">False</property>
+                                    <property name="secondary_icon_activatable">False</property>
+                                    <property name="primary_icon_sensitive">True</property>
+                                    <property name="secondary_icon_sensitive">True</property>
                                     <property name="adjustment">adjustment1</property>
                                     <property name="climb_rate">1</property>
                                     <property name="numeric">True</property>
@@ -268,6 +297,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                     <property name="group">halign_justify</property>
@@ -286,6 +316,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                     <property name="group">halign_justify</property>
@@ -304,27 +335,34 @@
                                 </child>
                               </object>
                               <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
+                        <property name="fill">True</property>
                         <property name="position">0</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkVBox" id="vbox55">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="spacing">12</property>
                         <child>
                           <object class="GtkLabel" id="label69">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="xalign">0</property>
                             <property name="label" translatable="yes">&lt;b&gt;Vertical alignment&lt;/b&gt;</property>
                             <property name="use_markup">True</property>
@@ -338,9 +376,11 @@
                         <child>
                           <object class="GtkHBox" id="hbox42">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <child>
                               <object class="GtkLabel" id="label68">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="label" translatable="yes">    </property>
                               </object>
                               <packing>
@@ -352,6 +392,7 @@
                             <child>
                               <object class="GtkTable" id="table6">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="n_rows">3</property>
                                 <property name="n_columns">2</property>
                                 <property name="column_spacing">12</property>
@@ -363,6 +404,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                   </object>
@@ -377,6 +419,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                     <property name="group">valign_top</property>
@@ -394,6 +437,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                     <property name="group">valign_top</property>
@@ -413,6 +457,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                     <property name="group">valign_top</property>
@@ -430,6 +475,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                     <property name="group">valign_top</property>
@@ -449,28 +495,33 @@
                               </object>
                               <packing>
                                 <property name="expand">False</property>
+                                <property name="fill">True</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>
                           </object>
                           <packing>
                             <property name="expand">False</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
+                        <property name="fill">True</property>
                         <property name="position">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkVBox" id="vbox56">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="spacing">12</property>
                         <child>
                           <object class="GtkLabel" id="label70">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="xalign">0</property>
                             <property name="label" translatable="yes">&lt;b&gt;Control&lt;/b&gt;</property>
                             <property name="use_markup">True</property>
@@ -484,9 +535,11 @@
                         <child>
                           <object class="GtkHBox" id="hbox43">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <child>
                               <object class="GtkLabel" id="label71">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="label" translatable="yes">    </property>
                               </object>
                               <packing>
@@ -498,6 +551,7 @@
                             <child>
                               <object class="GtkVBox" id="vbox38">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="spacing">6</property>
                                 <child>
                                   <object class="GtkCheckButton" id="align_wrap">
@@ -505,6 +559,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                   </object>
@@ -521,6 +576,7 @@
                                     <property name="sensitive">False</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                   </object>
@@ -533,18 +589,21 @@
                               </object>
                               <packing>
                                 <property name="expand">False</property>
+                                <property name="fill">True</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>
                           </object>
                           <packing>
                             <property name="expand">False</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
+                        <property name="fill">True</property>
                         <property name="position">2</property>
                       </packing>
                     </child>
@@ -563,6 +622,7 @@
             <child type="tab">
               <object class="GtkLabel" id="alignment_tab_label">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="label" translatable="yes">Alignment</property>
                 <property name="justify">center</property>
               </object>
@@ -573,15 +633,18 @@
             <child>
               <object class="GtkVBox" id="font_box">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="border_width">12</property>
                 <property name="spacing">18</property>
                 <child>
                   <object class="GtkVBox" id="vbox58">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="spacing">12</property>
                     <child>
                       <object class="GtkLabel" id="label75">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="xalign">0</property>
                         <property name="label" translatable="yes">&lt;b&gt;Style&lt;/b&gt;</property>
                         <property name="use_markup">True</property>
@@ -595,9 +658,11 @@
                     <child>
                       <object class="GtkHBox" id="hbox45">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <child>
                           <object class="GtkLabel" id="label74">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="label" translatable="yes">    </property>
                           </object>
                           <packing>
@@ -609,6 +674,7 @@
                         <child>
                           <object class="GtkTable" id="table7">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="n_rows">2</property>
                             <property name="n_columns">2</property>
                             <property name="column_spacing">24</property>
@@ -616,10 +682,12 @@
                             <child>
                               <object class="GtkHBox" id="font_color_hbox">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="spacing">12</property>
                                 <child>
                                   <object class="GtkLabel" id="font_color_label">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="xalign">0</property>
                                     <property name="label" translatable="yes">C_olor:</property>
                                     <property name="use_underline">True</property>
@@ -638,6 +706,7 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="use_underline">True</property>
                                 <property name="draw_indicator">True</property>
                               </object>
@@ -651,6 +720,7 @@
                             <child>
                               <object class="GtkHBox" id="hbox48">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="spacing">24</property>
                                 <child>
                                   <object class="GtkCheckButton" id="superscript_button">
@@ -658,6 +728,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                   </object>
@@ -673,6 +744,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                   </object>
@@ -694,10 +766,12 @@
                             <child>
                               <object class="GtkHBox" id="underline-box">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="spacing">12</property>
                                 <child>
                                   <object class="GtkLabel" id="underline_label">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="xalign">0</property>
                                     <property name="label" translatable="yes">_Underline:</property>
                                     <property name="use_underline">True</property>
@@ -722,18 +796,21 @@
                           </object>
                           <packing>
                             <property name="expand">False</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
+                        <property name="fill">True</property>
                         <property name="position">1</property>
                       </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
+                    <property name="fill">True</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
@@ -745,6 +822,7 @@
             <child type="tab">
               <object class="GtkLabel" id="font_tab_label">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="label" translatable="yes">Font</property>
                 <property name="justify">center</property>
               </object>
@@ -756,27 +834,33 @@
             <child>
               <object class="GtkHBox" id="border_box">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="border_width">12</property>
                 <property name="spacing">24</property>
                 <child>
                   <object class="GtkAlignment" id="alignment53">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="xscale">0</property>
                     <child>
                       <object class="GtkVBox" id="vbox4">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="spacing">6</property>
                         <child>
                           <object class="GtkHBox" id="hbox32">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="spacing">6</property>
                             <child>
                               <object class="GtkVBox" id="vbox34">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="spacing">4</property>
                                 <child>
                                   <object class="GtkAlignment" id="alignment44">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="xalign">1</property>
                                     <property name="yalign">1</property>
                                     <property name="xscale">0</property>
@@ -788,6 +872,7 @@
                                         <property name="receives_default">False</property>
                                         <property name="tooltip_text" translatable="yes">Reverse Diagonal</property>
                                         <property name="border_width">6</property>
+                                        <property name="use_action_appearance">False</property>
                                         <child>
                                           <placeholder/>
                                         </child>
@@ -803,6 +888,7 @@
                                 <child>
                                   <object class="GtkAlignment" id="alignment14">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="xalign">1</property>
                                     <property name="yalign">0.30000001192092896</property>
                                     <property name="xscale">0</property>
@@ -814,6 +900,7 @@
                                         <property name="receives_default">False</property>
                                         <property name="tooltip_text" translatable="yes">Left</property>
                                         <property name="border_width">6</property>
+                                        <property name="use_action_appearance">False</property>
                                         <child>
                                           <placeholder/>
                                         </child>
@@ -821,22 +908,27 @@
                                     </child>
                                   </object>
                                   <packing>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
+                                <property name="fill">True</property>
                                 <property name="position">0</property>
                               </packing>
                             </child>
                             <child>
                               <object class="GtkVBox" id="vbox36">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="spacing">4</property>
                                 <child>
                                   <object class="GtkAlignment" id="alignment43">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="yalign">1</property>
                                     <property name="xscale">0</property>
                                     <property name="yscale">0</property>
@@ -847,6 +939,7 @@
                                         <property name="receives_default">False</property>
                                         <property name="tooltip_text" translatable="yes">Top</property>
                                         <property name="border_width">6</property>
+                                        <property name="use_action_appearance">False</property>
                                         <child>
                                           <placeholder/>
                                         </child>
@@ -862,9 +955,11 @@
                                 <child>
                                   <object class="GtkAlignment" id="alignment48">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <child>
                                       <object class="GtkFrame" id="border_sample_container">
                                         <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
                                         <property name="label_xalign">0</property>
                                         <child>
                                           <placeholder/>
@@ -873,12 +968,15 @@
                                     </child>
                                   </object>
                                   <packing>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
                                 <child>
                                   <object class="GtkAlignment" id="alignment16">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="yalign">0</property>
                                     <property name="xscale">0</property>
                                     <property name="yscale">0</property>
@@ -889,6 +987,7 @@
                                         <property name="receives_default">False</property>
                                         <property name="tooltip_text" translatable="yes">Bottom</property>
                                         <property name="border_width">6</property>
+                                        <property name="use_action_appearance">False</property>
                                         <child>
                                           <placeholder/>
                                         </child>
@@ -911,10 +1010,12 @@
                             <child>
                               <object class="GtkVBox" id="vbox35">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="spacing">4</property>
                                 <child>
                                   <object class="GtkAlignment" id="alignment11">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="xalign">0</property>
                                     <property name="yalign">1</property>
                                     <property name="xscale">0</property>
@@ -926,6 +1027,7 @@
                                         <property name="receives_default">False</property>
                                         <property name="tooltip_text" translatable="yes">Diagonal</property>
                                         <property name="border_width">6</property>
+                                        <property name="use_action_appearance">False</property>
                                         <child>
                                           <placeholder/>
                                         </child>
@@ -941,6 +1043,7 @@
                                 <child>
                                   <object class="GtkAlignment" id="alignment42">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="xalign">0</property>
                                     <property name="yalign">0.30000001192092896</property>
                                     <property name="xscale">0</property>
@@ -952,6 +1055,7 @@
                                         <property name="receives_default">False</property>
                                         <property name="tooltip_text" translatable="yes">Right</property>
                                         <property name="border_width">6</property>
+                                        <property name="use_action_appearance">False</property>
                                         <child>
                                           <placeholder/>
                                         </child>
@@ -959,12 +1063,15 @@
                                     </child>
                                   </object>
                                   <packing>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
+                                <property name="fill">True</property>
                                 <property name="position">2</property>
                               </packing>
                             </child>
@@ -978,11 +1085,13 @@
                         <child>
                           <object class="GtkHBox" id="hbox30">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="spacing">6</property>
                             <property name="homogeneous">True</property>
                             <child>
                               <object class="GtkAlignment" id="alignment41">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="xscale">0</property>
                                 <property name="yscale">0</property>
                                 <child>
@@ -992,6 +1101,7 @@
                                     <property name="receives_default">False</property>
                                     <property name="tooltip_text" translatable="yes" context="border" comments="Cell border">None</property>
                                     <property name="border_width">6</property>
+                                    <property name="use_action_appearance">False</property>
                                     <child>
                                       <placeholder/>
                                     </child>
@@ -999,12 +1109,15 @@
                                 </child>
                               </object>
                               <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
                                 <property name="position">0</property>
                               </packing>
                             </child>
                             <child>
                               <object class="GtkAlignment" id="alignment40">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="xscale">0</property>
                                 <property name="yscale">0</property>
                                 <child>
@@ -1014,6 +1127,7 @@
                                     <property name="receives_default">False</property>
                                     <property name="tooltip_text" translatable="yes">Outline</property>
                                     <property name="border_width">6</property>
+                                    <property name="use_action_appearance">False</property>
                                     <child>
                                       <placeholder/>
                                     </child>
@@ -1021,12 +1135,15 @@
                                 </child>
                               </object>
                               <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>
                             <child>
                               <object class="GtkAlignment" id="alignment13">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="xscale">0</property>
                                 <property name="yscale">0</property>
                                 <child>
@@ -1036,6 +1153,7 @@
                                     <property name="receives_default">False</property>
                                     <property name="tooltip_text" translatable="yes">Inside Vertical</property>
                                     <property name="border_width">6</property>
+                                    <property name="use_action_appearance">False</property>
                                     <child>
                                       <placeholder/>
                                     </child>
@@ -1043,12 +1161,15 @@
                                 </child>
                               </object>
                               <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
                                 <property name="position">2</property>
                               </packing>
                             </child>
                             <child>
                               <object class="GtkAlignment" id="alignment38">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="xscale">0</property>
                                 <property name="yscale">0</property>
                                 <child>
@@ -1058,6 +1179,7 @@
                                     <property name="receives_default">False</property>
                                     <property name="tooltip_text" translatable="yes">Inside</property>
                                     <property name="border_width">6</property>
+                                    <property name="use_action_appearance">False</property>
                                     <child>
                                       <placeholder/>
                                     </child>
@@ -1065,12 +1187,15 @@
                                 </child>
                               </object>
                               <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
                                 <property name="position">3</property>
                               </packing>
                             </child>
                             <child>
                               <object class="GtkAlignment" id="alignment39">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="xscale">0</property>
                                 <property name="yscale">0</property>
                                 <child>
@@ -1080,6 +1205,7 @@
                                     <property name="receives_default">False</property>
                                     <property name="tooltip_text" translatable="yes">Inside Horizontal</property>
                                     <property name="border_width">6</property>
+                                    <property name="use_action_appearance">False</property>
                                     <child>
                                       <placeholder/>
                                     </child>
@@ -1103,16 +1229,20 @@
                     </child>
                   </object>
                   <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
                   <object class="GtkVBox" id="vbox59">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="spacing">12</property>
                     <child>
                       <object class="GtkLabel" id="label76">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="xalign">0</property>
                         <property name="label" translatable="yes">&lt;b&gt;Line&lt;/b&gt;</property>
                         <property name="use_markup">True</property>
@@ -1126,9 +1256,11 @@
                     <child>
                       <object class="GtkHBox" id="hbox51">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <child>
                           <object class="GtkLabel" id="label77">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="label" translatable="yes">    </property>
                           </object>
                           <packing>
@@ -1140,14 +1272,17 @@
                         <child>
                           <object class="GtkVBox" id="vbox60">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="spacing">12</property>
                             <child>
                               <object class="GtkVBox" id="vbox61">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="spacing">6</property>
                                 <child>
                                   <object class="GtkLabel" id="label9">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="xalign">0</property>
                                     <property name="label" translatable="yes">Style:</property>
                                     <property name="use_underline">True</property>
@@ -1161,14 +1296,17 @@
                                 <child>
                                   <object class="GtkFrame" id="frame8">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="label_xalign">0</property>
                                     <property name="shadow_type">out</property>
                                     <child>
                                       <object class="GtkHBox" id="hbox14">
                                         <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
                                         <child>
                                           <object class="GtkTable" id="table1">
                                             <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
                                             <property name="border_width">6</property>
                                             <property name="n_rows">7</property>
                                             <property name="n_columns">2</property>
@@ -1180,6 +1318,7 @@
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">True</property>
                                                 <property name="receives_default">False</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1198,6 +1337,7 @@
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">True</property>
                                                 <property name="receives_default">False</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1216,6 +1356,7 @@
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">True</property>
                                                 <property name="receives_default">False</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1234,6 +1375,7 @@
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">True</property>
                                                 <property name="receives_default">False</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1252,6 +1394,7 @@
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">True</property>
                                                 <property name="receives_default">False</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1270,6 +1413,7 @@
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">True</property>
                                                 <property name="receives_default">False</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1288,6 +1432,7 @@
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">True</property>
                                                 <property name="receives_default">False</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1304,6 +1449,7 @@
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">True</property>
                                                 <property name="receives_default">False</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1320,6 +1466,7 @@
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">True</property>
                                                 <property name="receives_default">False</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1336,6 +1483,7 @@
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">True</property>
                                                 <property name="receives_default">False</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1352,6 +1500,7 @@
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">True</property>
                                                 <property name="receives_default">False</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1368,6 +1517,7 @@
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">True</property>
                                                 <property name="receives_default">False</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1384,6 +1534,7 @@
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">True</property>
                                                 <property name="receives_default">False</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1401,6 +1552,7 @@
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">True</property>
                                                 <property name="receives_default">False</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <property name="use_underline">True</property>
                                               </object>
                                               <packing>
@@ -1411,6 +1563,7 @@
                                           </object>
                                           <packing>
                                             <property name="expand">False</property>
+                                            <property name="fill">True</property>
                                             <property name="position">0</property>
                                           </packing>
                                         </child>
@@ -1418,22 +1571,27 @@
                                     </child>
                                   </object>
                                   <packing>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
+                                <property name="fill">True</property>
                                 <property name="position">0</property>
                               </packing>
                             </child>
                             <child>
                               <object class="GtkHBox" id="border_color_hbox">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="spacing">12</property>
                                 <child>
                                   <object class="GtkLabel" id="border_color_label">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="label" translatable="yes">C_olor:</property>
                                     <property name="use_underline">True</property>
                                     <property name="justify">center</property>
@@ -1447,23 +1605,28 @@
                               </object>
                               <packing>
                                 <property name="expand">False</property>
+                                <property name="fill">True</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
+                        <property name="fill">True</property>
                         <property name="position">1</property>
                       </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
+                    <property name="fill">True</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
@@ -1475,6 +1638,7 @@
             <child type="tab">
               <object class="GtkLabel" id="border_tab_label">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="label" translatable="yes">Border</property>
                 <property name="justify">center</property>
               </object>
@@ -1486,19 +1650,23 @@
             <child>
               <object class="GtkHBox" id="background_box">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="border_width">12</property>
                 <property name="spacing">24</property>
                 <child>
                   <object class="GtkVBox" id="vbox25">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="spacing">18</property>
                     <child>
                       <object class="GtkVBox" id="vbox65">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="spacing">12</property>
                         <child>
                           <object class="GtkLabel" id="label82">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="xalign">0</property>
                             <property name="label" translatable="yes">&lt;b&gt;Background&lt;/b&gt;</property>
                             <property name="use_markup">True</property>
@@ -1512,9 +1680,11 @@
                         <child>
                           <object class="GtkHBox" id="hbox55">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <child>
                               <object class="GtkLabel" id="label81">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="label" translatable="yes">    </property>
                               </object>
                               <packing>
@@ -1526,10 +1696,12 @@
                             <child>
                               <object class="GtkHBox" id="back_color_hbox">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="spacing">12</property>
                                 <child>
                                   <object class="GtkLabel" id="back_color_label">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="label" translatable="yes">C_olor:</property>
                                     <property name="use_underline">True</property>
                                     <property name="justify">center</property>
@@ -1542,27 +1714,34 @@
                                 </child>
                               </object>
                               <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
+                        <property name="fill">True</property>
                         <property name="position">0</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkVBox" id="vbox66">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="spacing">12</property>
                         <child>
                           <object class="GtkLabel" id="label83">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="xalign">0</property>
                             <property name="label" translatable="yes">&lt;b&gt;Pattern&lt;/b&gt;</property>
                             <property name="use_markup">True</property>
@@ -1576,9 +1755,11 @@
                         <child>
                           <object class="GtkHBox" id="hbox56">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <child>
                               <object class="GtkLabel" id="label84">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="label" translatable="yes">    </property>
                               </object>
                               <packing>
@@ -1590,14 +1771,17 @@
                             <child>
                               <object class="GtkVBox" id="vbox67">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="spacing">6</property>
                                 <child>
                                   <object class="GtkHBox" id="pattern_color_hbox">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="spacing">12</property>
                                     <child>
                                       <object class="GtkLabel" id="pattern_color_label">
                                         <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
                                         <property name="label" translatable="yes">C_olor:</property>
                                         <property name="use_underline">True</property>
                                         <property name="justify">center</property>
@@ -1610,16 +1794,20 @@
                                     </child>
                                   </object>
                                   <packing>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
                                     <property name="position">0</property>
                                   </packing>
                                 </child>
                                 <child>
                                   <object class="GtkVBox" id="vbox62">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="spacing">6</property>
                                     <child>
                                       <object class="GtkLabel" id="label58">
                                         <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
                                         <property name="xalign">0</property>
                                         <property name="label" translatable="yes">Style:</property>
                                       </object>
@@ -1632,11 +1820,13 @@
                                     <child>
                                       <object class="GtkFrame" id="frame16">
                                         <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
                                         <property name="label_xalign">0</property>
                                         <property name="shadow_type">out</property>
                                         <child>
                                           <object class="GtkTable" id="table2">
                                             <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
                                             <property name="n_rows">4</property>
                                             <property name="n_columns">6</property>
                                             <property name="column_spacing">6</property>
@@ -1648,6 +1838,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">75% Grey</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1666,6 +1857,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">50% Grey</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1684,6 +1876,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">25% Grey</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1702,6 +1895,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">12.5% Grey</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1720,6 +1914,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">6.25% Grey</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1738,6 +1933,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">Horizontal Stripe</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1756,6 +1952,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">Thin Horizontal Stripe</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1774,6 +1971,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">Vertical Stripe</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1794,6 +1992,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">Thin Vertical Stripe</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1814,6 +2013,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">Reverse Diagonal Stripe</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1834,6 +2034,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">Thin Reverse Diagonal Stripe</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1854,6 +2055,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">Diagonal Stripe</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1874,6 +2076,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">Thin Diagonal Stripe</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1894,6 +2097,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">Diagonal Crosshatch</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1914,6 +2118,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">Thick Diagonal Crosshatch</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1934,6 +2139,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">Thin Horizontal Crosshatch</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1954,6 +2160,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">Thin Diagonal Crosshatch</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1974,6 +2181,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">Solid</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -1990,6 +2198,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">Bricks</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -2010,6 +2219,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">Large Circles</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -2030,6 +2240,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">Thatch</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -2050,6 +2261,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">Semi Circles</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -2070,6 +2282,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">Small Circles</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -2090,6 +2303,7 @@
                                                 <property name="receives_default">False</property>
                                                 <property name="tooltip_text" translatable="yes">Foreground Solid</property>
                                                 <property name="border_width">3</property>
+                                                <property name="use_action_appearance">False</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
@@ -2106,43 +2320,54 @@
                                       </object>
                                       <packing>
                                         <property name="expand">False</property>
+                                        <property name="fill">True</property>
                                         <property name="position">1</property>
                                       </packing>
                                     </child>
                                   </object>
                                   <packing>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
                               </object>
                               <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
+                        <property name="fill">True</property>
                         <property name="position">1</property>
                       </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
+                    <property name="fill">True</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
                   <object class="GtkVBox" id="vbox68">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="spacing">12</property>
                     <child>
                       <object class="GtkLabel" id="label85">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="xalign">0</property>
                         <property name="label" translatable="yes">&lt;b&gt;Sample&lt;/b&gt;</property>
                         <property name="use_markup">True</property>
@@ -2156,9 +2381,11 @@
                     <child>
                       <object class="GtkHBox" id="hbox57">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <child>
                           <object class="GtkLabel" id="label86">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="label" translatable="yes">    </property>
                           </object>
                           <packing>
@@ -2170,6 +2397,7 @@
                         <child>
                           <object class="GtkFrame" id="back_sample_frame">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="label_xalign">0</property>
                             <property name="label_yalign">0</property>
                             <property name="shadow_type">in</property>
@@ -2178,18 +2406,22 @@
                             </child>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
+                        <property name="fill">True</property>
                         <property name="position">1</property>
                       </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
+                    <property name="fill">True</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
@@ -2202,6 +2434,7 @@
             <child type="tab">
               <object class="GtkLabel" id="background_tab_label">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="label" translatable="yes">Background</property>
                 <property name="justify">center</property>
               </object>
@@ -2213,6 +2446,7 @@
             <child>
               <object class="GtkVBox" id="protection_box">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="border_width">12</property>
                 <property name="spacing">6</property>
                 <child>
@@ -2221,6 +2455,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
+                    <property name="use_action_appearance">False</property>
                     <property name="use_underline">True</property>
                     <property name="draw_indicator">True</property>
                   </object>
@@ -2236,6 +2471,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
+                    <property name="use_action_appearance">False</property>
                     <property name="use_underline">True</property>
                     <property name="draw_indicator">True</property>
                   </object>
@@ -2248,6 +2484,7 @@
                 <child>
                   <object class="GtkLabel" id="label28">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="xalign">0</property>
                     <property name="yalign">0</property>
                     <property name="ypad">10</property>
@@ -2266,6 +2503,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
+                    <property name="use_action_appearance">False</property>
                     <property name="use_underline">True</property>
                     <property name="draw_indicator">True</property>
                   </object>
@@ -2283,6 +2521,7 @@
             <child type="tab">
               <object class="GtkLabel" id="protection_tab_label">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="label" translatable="yes">Protection</property>
                 <property name="justify">center</property>
               </object>
@@ -2294,15 +2533,18 @@
             <child>
               <object class="GtkVBox" id="validation_box">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="border_width">12</property>
                 <property name="spacing">12</property>
                 <child>
                   <object class="GtkVBox" id="vbox63">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="spacing">12</property>
                     <child>
                       <object class="GtkLabel" id="label64">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="xalign">0</property>
                         <property name="label" translatable="yes">&lt;span weight="bold"&gt;Criteria&lt;/span&gt;</property>
                         <property name="use_markup">True</property>
@@ -2316,9 +2558,11 @@
                     <child>
                       <object class="GtkHBox" id="hbox52">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <child>
                           <object class="GtkLabel" id="label78">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="label" translatable="yes">    </property>
                           </object>
                           <packing>
@@ -2330,6 +2574,7 @@
                         <child>
                           <object class="GtkTable" id="validation_criteria_table">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="n_rows">5</property>
                             <property name="n_columns">2</property>
                             <property name="column_spacing">12</property>
@@ -2337,6 +2582,7 @@
                             <child>
                               <object class="GtkLabel" id="label60">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="xalign">0</property>
                                 <property name="label" translatable="yes">Allo_w:</property>
                                 <property name="use_underline">True</property>
@@ -2351,6 +2597,7 @@
                             <child>
                               <object class="GtkLabel" id="validation_operator_label">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="xalign">0</property>
                                 <property name="label" translatable="yes">Con_dition:</property>
                                 <property name="use_underline">True</property>
@@ -2367,6 +2614,7 @@
                             <child>
                               <object class="GtkHBox" id="hbox40">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="spacing">12</property>
                                 <property name="homogeneous">True</property>
                                 <child>
@@ -2375,10 +2623,13 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                   </object>
                                   <packing>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
                                     <property name="position">0</property>
                                   </packing>
                                 </child>
@@ -2388,10 +2639,13 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                   </object>
                                   <packing>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
@@ -2407,6 +2661,7 @@
                             <child>
                               <object class="GtkLabel" id="validation_expr0_name">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="xalign">0</property>
                                 <property name="justify">center</property>
                               </object>
@@ -2420,6 +2675,7 @@
                             <child>
                               <object class="GtkLabel" id="validation_expr1_name">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="xalign">0</property>
                                 <property name="justify">center</property>
                               </object>
@@ -2433,6 +2689,7 @@
                             <child>
                               <object class="GtkComboBox" id="validation_constraint_type">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="model">model1</property>
                                 <child>
                                   <object class="GtkCellRendererText" id="renderer1"/>
@@ -2475,27 +2732,34 @@
                             </child>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
                       </object>
                       <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
                         <property name="position">1</property>
                       </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
+                    <property name="fill">True</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
                   <object class="GtkVBox" id="vbox64">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="spacing">12</property>
                     <child>
                       <object class="GtkLabel" id="label80">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="xalign">0</property>
                         <property name="label" translatable="yes">&lt;b&gt;Error alerts&lt;/b&gt;</property>
                         <property name="use_markup">True</property>
@@ -2509,9 +2773,11 @@
                     <child>
                       <object class="GtkHBox" id="hbox53">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <child>
                           <object class="GtkLabel" id="label79">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="label" translatable="yes">    </property>
                           </object>
                           <packing>
@@ -2523,6 +2789,7 @@
                         <child>
                           <object class="GtkTable" id="table4">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="n_rows">3</property>
                             <property name="n_columns">2</property>
                             <property name="column_spacing">12</property>
@@ -2530,6 +2797,7 @@
                             <child>
                               <object class="GtkHBox" id="hbox38">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="spacing">4</property>
                                 <child>
                                   <object class="GtkScrolledWindow" id="scrolledwindow14">
@@ -2547,15 +2815,19 @@
                                     </child>
                                   </object>
                                   <packing>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
                                     <property name="position">0</property>
                                   </packing>
                                 </child>
                                 <child>
                                   <object class="GtkImage" id="validation_error_image">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
+                                    <property name="fill">True</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
@@ -2571,6 +2843,7 @@
                             <child>
                               <object class="GtkLabel" id="validation_error_action_label">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="xalign">0</property>
                                 <property name="label" translatable="yes">Ac_tion:</property>
                                 <property name="use_underline">True</property>
@@ -2585,6 +2858,7 @@
                             <child>
                               <object class="GtkLabel" id="validation_error_title_label">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="xalign">0</property>
                                 <property name="label" translatable="yes">Titl_e:</property>
                                 <property name="use_underline">True</property>
@@ -2601,6 +2875,7 @@
                             <child>
                               <object class="GtkLabel" id="validation_error_msg_label">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="xalign">0</property>
                                 <property name="yalign">0</property>
                                 <property name="label" translatable="yes">_Message:</property>
@@ -2619,6 +2894,10 @@
                               <object class="GtkEntry" id="validation_error_title">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
+                                <property name="primary_icon_activatable">False</property>
+                                <property name="secondary_icon_activatable">False</property>
+                                <property name="primary_icon_sensitive">True</property>
+                                <property name="secondary_icon_sensitive">True</property>
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
@@ -2632,6 +2911,7 @@
                             <child>
                               <object class="GtkComboBox" id="validation_error_action">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
@@ -2642,17 +2922,22 @@
                             </child>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
                       </object>
                       <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
                         <property name="position">1</property>
                       </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
+                    <property name="fill">True</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
@@ -2664,6 +2949,7 @@
             <child type="tab">
               <object class="GtkLabel" id="validation_tab_label">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="label" translatable="yes">Validation</property>
                 <property name="justify">center</property>
               </object>
@@ -2675,6 +2961,7 @@
             <child>
               <object class="GtkVBox" id="input_msg_box">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="border_width">12</property>
                 <property name="spacing">6</property>
                 <child>
@@ -2683,6 +2970,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
+                    <property name="use_action_appearance">False</property>
                     <property name="use_underline">True</property>
                     <property name="draw_indicator">True</property>
                   </object>
@@ -2695,6 +2983,7 @@
                 <child>
                   <object class="GtkTable" id="table5">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="n_rows">2</property>
                     <property name="n_columns">2</property>
                     <property name="column_spacing">12</property>
@@ -2702,6 +2991,7 @@
                     <child>
                       <object class="GtkLabel" id="input_msg_title_label">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="xalign">0</property>
                         <property name="label" translatable="yes">Titl_e:</property>
                         <property name="use_underline">True</property>
@@ -2717,6 +3007,10 @@
                       <object class="GtkEntry" id="input_msg_title">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
+                        <property name="primary_icon_activatable">False</property>
+                        <property name="secondary_icon_activatable">False</property>
+                        <property name="primary_icon_sensitive">True</property>
+                        <property name="secondary_icon_sensitive">True</property>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
@@ -2751,6 +3045,7 @@
                     <child>
                       <object class="GtkLabel" id="input_msg_msg_label">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="xalign">0</property>
                         <property name="yalign">0</property>
                         <property name="label" translatable="yes">_Message:</property>
@@ -2766,6 +3061,8 @@
                     </child>
                   </object>
                   <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
@@ -2776,6 +3073,7 @@
             </child>
             <child type="tab">
               <object class="GtkLabel" id="input_msg_tab_label">
+                <property name="can_focus">False</property>
                 <property name="label" translatable="yes">Input Message</property>
                 <property name="justify">center</property>
               </object>
@@ -2784,225 +3082,13 @@
                 <property name="tab_fill">False</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkTable" id="table8">
-                <property name="visible">True</property>
-                <property name="border_width">12</property>
-                <property name="n_rows">3</property>
-                <child>
-                  <object class="GtkLabel" id="conditions_label">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="xpad">5</property>
-                    <property name="ypad">5</property>
-                  </object>
-                  <packing>
-                    <property name="top_attach">2</property>
-                    <property name="bottom_attach">3</property>
-                    <property name="y_options">GTK_SHRINK | GTK_FILL</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkScrolledWindow" id="scrolledwindow1">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="hscrollbar_policy">automatic</property>
-                    <property name="vscrollbar_policy">automatic</property>
-                    <property name="shadow_type">in</property>
-                    <child>
-                      <object class="GtkTreeView" id="conditions_treeview">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="border_width">5</property>
-                        <property name="headers_visible">False</property>
-                        <property name="headers_clickable">False</property>
-                        <property name="enable_search">False</property>
-                        <property name="level_indentation">5</property>
-                      </object>
-                    </child>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkHBox" id="hbox1">
-                    <property name="visible">True</property>
-                    <child>
-                      <object class="GtkHButtonBox" id="hbuttonbox2">
-                        <property name="visible">True</property>
-                        <property name="layout_style">start</property>
-                        <child>
-                          <object class="GtkButton" id="conditions_add">
-                            <property name="label">gtk-add</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="use_stock">True</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkButton" id="conditions_remove">
-                            <property name="label">gtk-remove</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="use_stock">True</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkButton" id="conditions_clear">
-                            <property name="label">gtk-clear</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="use_stock">True</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">2</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkButton" id="conditions_expand">
-                            <property name="label" translatable="yes">E_xpand</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="use_underline">True</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">3</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkButton" id="conditions_edit">
-                            <property name="label">gtk-edit</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="use_stock">True</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">4</property>
-                          </packing>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
-                    <property name="y_options">GTK_SHRINK | GTK_FILL</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="position">7</property>
-              </packing>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="condition_tab_label">
-                <property name="visible">True</property>
-                <property name="label" translatable="yes">Conditions</property>
-              </object>
-              <packing>
-                <property name="position">7</property>
-                <property name="tab_fill">False</property>
-              </packing>
-            </child>
           </object>
           <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
             <property name="position">1</property>
           </packing>
         </child>
-        <child internal-child="action_area">
-          <object class="GtkHButtonBox" id="hbuttonbox1">
-            <property name="visible">True</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="helpbutton">
-                <property name="label">gtk-help</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="applybutton">
-                <property name="label">gtk-apply</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="cancelbutton">
-                <property name="label">gtk-cancel</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="okbutton">
-                <property name="label">gtk-ok</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">3</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
       </object>
     </child>
     <action-widgets>
@@ -3012,4 +3098,73 @@
       <action-widget response="0">okbutton</action-widget>
     </action-widgets>
   </object>
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="upper">20</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkListStore" id="model1">
+    <columns>
+      <!-- column-name gchararray -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">Any Value     (no validation)</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Whole numbers</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Numbers</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">In a list</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Date</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Time</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Text length</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Custom</col>
+      </row>
+    </data>
+  </object>
+  <object class="GtkListStore" id="model2">
+    <columns>
+      <!-- column-name gchararray -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">min &lt;= val &lt;= max         (between)</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">val &lt;= min || max &lt;= val (not between)</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">val == bound                  (equal to)</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">val &lt;&gt; bound                  (not equal to)</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">val  &gt;  bound                  (greater than)</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">val  &lt;  bound                  (less than)</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">val &gt;= bound                  (greater than or equal)</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">val &lt;= bound                  (less than or equal)</col>
+      </row>
+    </data>
+  </object>
 </interface>
diff --git a/src/dialogs/dialog-cell-format-cond.c b/src/dialogs/dialog-cell-format-cond.c
new file mode 100644
index 0000000..1caac0c
--- /dev/null
+++ b/src/dialogs/dialog-cell-format-cond.c
@@ -0,0 +1,928 @@
+/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/**
+ * dialog-cell-format-cond.c:  Implements a dialog to format cells.
+ *
+ * (c) Copyright 2010-2011 Andreas J. Guelzow <aguelzow pyrshep ca>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+  **/
+
+#include <gnumeric-config.h>
+#include <glib/gi18n-lib.h>
+#include <gnumeric.h>
+#include "dialogs.h"
+#include "help.h"
+#include <dead-kittens.h>
+
+#include <sheet.h>
+#include <sheet-view.h>
+#include <sheet-merge.h>
+#include <sheet-style.h>
+#include <gui-util.h>
+#include <selection.h>
+#include <ranges.h>
+#include <cell.h>
+#include <expr.h>
+#include <value.h>
+#include <position.h>
+#include <mstyle.h>
+#include <application.h>
+#include <validation.h>
+#include <workbook.h>
+#include <wbc-gtk.h>
+#include <commands.h>
+#include <mathfunc.h>
+#include <style-conditions.h>
+
+#include <gtk/gtk.h>
+
+#include <string.h>
+
+#define CELL_FORMAT_KEY "cell-format-cond-dialog"
+#define CELL_FORMAT_DEF_KEY "cell-format-cond-def-dialog"
+
+typedef struct _CFormatState {
+	GtkBuilder	*gui;
+	WBCGtk	        *wbcg;
+	GtkDialog	*dialog;
+	GtkWidget	*close_button;
+
+	Sheet		*sheet;
+	SheetView	*sv;
+	unsigned int	 conflicts;
+	gboolean         homogeneous;
+	GnmStyle	*style;
+
+	GtkButton       *add;
+	GtkButton       *remove;
+	GtkButton       *clear;
+	GtkButton       *expand;
+	GtkButton       *edit;
+	GtkLabel        *label;
+	GtkTreeView     *treeview;
+	GtkTreeStore    *model;
+	GtkTreeSelection *selection;
+
+	struct {
+		GOUndo *undo;
+		GOUndo *redo;
+		int size;
+		GnmStyle *new_style;
+		GnmStyle *old_style;
+	} action;
+} CFormatState;
+
+typedef struct _CFormatChooseState {
+	CFormatState    *cf_state;
+	GtkBuilder	*gui;
+	GtkDialog	*dialog;
+	GtkWidget	*cancel_button;
+	GtkWidget	*ok_button;
+	GtkWidget	*new_button;
+	GtkWidget	*combo;
+	GtkListStore    *typestore;
+	GnmStyle        *style;
+	GtkWidget       *style_label;
+} CFormatChooseState;
+
+enum {
+	CONDITIONS_RANGE,
+	CONDITIONS_COND,
+	CONDITIONS_NUM_COLUMNS
+};
+
+
+
+/*****************************************************************************/
+static void c_fmt_dialog_load (CFormatState *state);
+static void c_fmt_dialog_apply_add_choice (CFormatState *state, GnmStyleCond *cond);
+static void c_fmt_dialog_update_buttons (CFormatState *state);
+
+/*****************************************************************************/
+
+/* Handler for destroy */
+static void
+cb_c_fmt_dialog_chooser_destroy (CFormatChooseState *state)
+{
+	if (state->style)
+		gnm_style_unref (state->style);
+	g_object_unref (G_OBJECT (state->gui));
+	g_free (state);
+}
+
+static void
+cb_dialog_chooser_destroy (GtkDialog *dialog)
+{
+	g_object_set_data (G_OBJECT (dialog), "state", NULL);
+}
+
+static void
+c_fmt_dialog_set_sensitive (CFormatChooseState *state)
+{
+	gtk_widget_set_sensitive (state->ok_button, state->style != NULL);
+}
+
+void     
+dialog_cell_format_style_added (gpointer closure, GnmStyle *style)
+{
+	CFormatChooseState *state = closure;
+	
+	if (state->style)
+		gnm_style_unref (state->style);
+	state->style = style;
+	gtk_label_set_text (GTK_LABEL (state->style_label), 
+			    style ? _("(defined)") : _("undefined"));
+	c_fmt_dialog_set_sensitive (state);
+}
+
+static void
+cb_c_fmt_dialog_chooser_new_button (G_GNUC_UNUSED GtkWidget *btn, CFormatChooseState *state)
+{
+	dialog_cell_format_select_style (state->cf_state->wbcg, 1 << FD_BACKGROUND, 
+					 GTK_WINDOW (state->dialog), state);
+}
+
+static void
+cb_c_fmt_dialog_chooser_buttons (GtkWidget *btn, CFormatChooseState *state)
+{
+	if (btn == state->ok_button) {
+		GnmStyleCond *cond = g_new0(GnmStyleCond, 1);
+		GtkTreeIter iter;
+
+		cond->overlay = gnm_style_new ();
+		if (state->style) {
+			gnm_style_merge_element (cond->overlay, state->style, 
+						 MSTYLE_COLOR_BACK);
+			gnm_style_merge_element (cond->overlay, state->style, 
+						 MSTYLE_COLOR_PATTERN);
+			gnm_style_merge_element (cond->overlay, state->style, 
+						 MSTYLE_PATTERN);
+		}
+		if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (state->combo), &iter))
+			gtk_tree_model_get (GTK_TREE_MODEL (state->typestore),
+					    &iter,
+					    1, &cond->op,
+					    -1);
+		else
+			cond->op = GNM_STYLE_COND_CONTAINS_ERR;
+
+		c_fmt_dialog_apply_add_choice (state->cf_state, cond);
+		g_free (cond);
+	}
+	gtk_widget_destroy (GTK_WIDGET (state->dialog));
+}
+
+static void	
+c_fmt_dialog_chooser_load_combo (CFormatChooseState *state)
+{
+	static struct {
+		char const *label;
+		gint type;
+	} cond_types[] = {
+		{ N_("Cell contains an error value."), GNM_STYLE_COND_CONTAINS_ERR},
+		{ N_("Cell does not contain an error value."), GNM_STYLE_COND_NOT_CONTAINS_ERR},
+		{ N_("Cell contains whitespace."), GNM_STYLE_COND_CONTAINS_BLANKS},
+		{ N_("Cell does not contain whitespace."), GNM_STYLE_COND_NOT_CONTAINS_BLANKS}
+	};
+	guint i;
+	GtkCellRenderer  *cell;
+	GtkTreeIter iter;
+
+	for (i = 0; i < G_N_ELEMENTS (cond_types); i++)
+		gtk_list_store_insert_with_values (state->typestore,
+						   NULL, G_MAXINT,
+                                                   0, _(cond_types[i].label),
+						   1, cond_types[i].type,
+						   -1);
+	cell = gtk_cell_renderer_text_new();
+	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(state->combo), cell, TRUE);
+	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(state->combo), cell, "text", 0, NULL);
+	if (gtk_tree_model_get_iter_first
+	    (GTK_TREE_MODEL (state->typestore), &iter))
+		gtk_combo_box_set_active_iter (GTK_COMBO_BOX (state->combo), &iter);
+
+}
+
+static void	
+c_fmt_dialog_chooser (CFormatState *cf_state)
+{
+	GtkBuilder     *gui;
+	CFormatChooseState  *state;
+	GtkWidget *dialog;
+
+	g_return_if_fail (cf_state != NULL);
+
+	gui = gnm_gtk_builder_new ("cell-format-cond-def.ui", NULL, 
+				   GO_CMD_CONTEXT (cf_state->wbcg));
+        if (gui == NULL)
+                return;
+
+	/* Initialize */
+	state = g_new (CFormatChooseState, 1);
+	state->gui	= gui;
+	state->cf_state = cf_state;
+	state->style = NULL;
+
+	dialog = go_gtk_builder_get_widget (state->gui, "style-condition-def");
+	g_return_if_fail (dialog != NULL);
+
+	gtk_window_set_title (GTK_WINDOW (dialog), _("Style Condition"));
+
+	/* Initialize */
+	state->dialog	   = GTK_DIALOG (dialog);
+
+	state->cancel_button = go_gtk_builder_get_widget (state->gui, "cancel-button");
+	state->ok_button = go_gtk_builder_get_widget (state->gui, "ok-button");
+	state->new_button = go_gtk_builder_get_widget (state->gui, "new-button");
+	state->combo = go_gtk_builder_get_widget (state->gui, "condition-combo");
+	state->typestore = GTK_LIST_STORE (gtk_combo_box_get_model 
+					   (GTK_COMBO_BOX (state->combo)));
+	c_fmt_dialog_chooser_load_combo (state);
+	
+	state->style_label = go_gtk_builder_get_widget (state->gui, "style-label");
+	gtk_label_set_text (GTK_LABEL (state->style_label), _("(undefined)"));
+
+	gnumeric_init_help_button (
+		go_gtk_builder_get_widget (state->gui, "help-button"),
+		GNUMERIC_HELP_LINK_CELL_FORMAT_COND);
+	c_fmt_dialog_set_sensitive (state);
+
+	gnumeric_restore_window_geometry (GTK_WINDOW (state->dialog),
+					  CELL_FORMAT_DEF_KEY);
+
+	g_signal_connect (G_OBJECT (state->cancel_button),
+		"clicked",
+		G_CALLBACK (cb_c_fmt_dialog_chooser_buttons), state);
+	g_signal_connect (G_OBJECT (state->ok_button),
+		"clicked",
+		G_CALLBACK (cb_c_fmt_dialog_chooser_buttons), state);
+	g_signal_connect (G_OBJECT (state->new_button),
+		"clicked",
+		G_CALLBACK (cb_c_fmt_dialog_chooser_new_button), state);
+	g_object_set_data_full (G_OBJECT (state->dialog),
+		"state", state, (GDestroyNotify)cb_c_fmt_dialog_chooser_destroy);
+	g_signal_connect (G_OBJECT (dialog), "destroy",
+			  G_CALLBACK (cb_dialog_chooser_destroy), NULL);
+	go_gtk_window_set_transient (GTK_WINDOW (state->cf_state->dialog), 
+				     GTK_WINDOW (state->dialog));
+	gtk_window_set_modal (GTK_WINDOW (state->dialog), TRUE);
+	gtk_widget_show (GTK_WIDGET (state->dialog));
+}
+
+
+
+/*****************************************************************************/
+/*****************************************************************************/
+static gboolean
+c_fmt_dialog_condition_setter (SheetView *sv, GnmRange const *range, CFormatState *state)
+{
+	GnmSheetRange *sr = g_new (GnmSheetRange, 1);
+	sr->range = *range;
+	sr->sheet = sv->sheet;
+	state->action.redo = go_undo_combine 
+		(state->action.redo,
+		 sheet_apply_style_undo (sr, state->action.new_style));
+	sr = g_new (GnmSheetRange, 1);
+	sr->range = *range;
+	sr->sheet = sv->sheet;
+	state->action.undo = go_undo_combine 
+		(sheet_apply_style_undo (sr, state->action.old_style),
+		 state->action.undo);
+	state->action.size++;
+	return TRUE;
+}
+
+static gboolean
+c_fmt_dialog_condition_setter_tiled (SheetView *sv, GnmRange const *range, CFormatState *state)
+{
+	GnmStyleList *l, *list = sheet_style_collect_conditions (state->sheet, range);
+	for (l = list; l != NULL; l = l->next) {
+		GnmStyleConditions *old_cond;
+		GnmStyleRegion const *sr = l->data;
+		GnmRange r  = *((GnmRange *) l->data);
+
+		r.start.row += range->start.row;
+		r.end.row += range->start.row;
+		r.start.col += range->start.col;
+		r.end.col += range->start.col;
+		state->action.old_style = gnm_style_new ();
+		old_cond = gnm_style_get_conditions (sr->style);
+		gnm_style_set_conditions (state->action.old_style, 
+					  g_object_ref (G_OBJECT (old_cond)));
+		c_fmt_dialog_condition_setter (state->sv, &r, state);
+		gnm_style_unref (state->action.old_style);
+		state->action.old_style = NULL;
+	}
+	style_list_free (list);
+	return TRUE;
+}
+
+static void
+c_fmt_dialog_set_conditions (CFormatState *state, char const *cmd_label)
+{
+	GnmStyleConditions *old_cond;
+
+	state->action.undo = NULL;
+	state->action.redo = NULL;
+	state->action.size = 0;
+
+	if (state->homogeneous) {
+		state->action.old_style = gnm_style_new ();
+		old_cond = gnm_style_get_conditions (state->style);
+		gnm_style_set_conditions (state->action.old_style, 
+					  old_cond ? g_object_ref (G_OBJECT (old_cond)) : NULL);
+		
+		sv_selection_foreach (state->sv, 
+				      (GnmSelectionFunc)c_fmt_dialog_condition_setter, 
+				      state);
+	} else {
+		sv_selection_foreach (state->sv, 
+				      (GnmSelectionFunc)c_fmt_dialog_condition_setter_tiled, 
+				      state);
+	}
+	cmd_generic_with_size (WORKBOOK_CONTROL (state->wbcg), cmd_label,
+			       state->action.size, state->action.undo, state->action.redo);
+
+	state->action.undo = NULL;
+	state->action.redo = NULL;
+	if (state->action.old_style) {
+		gnm_style_unref (state->action.old_style);
+		state->action.old_style = NULL;
+	}
+}
+
+static void
+c_fmt_dialog_apply_add_choice (CFormatState *state, GnmStyleCond *cond)
+{
+	if (cond != NULL) {
+		GnmStyleConditions *sc;
+		sc = gnm_style_conditions_dup (gnm_style_get_conditions (state->style));
+		if (sc == NULL)
+			sc = gnm_style_conditions_new ();
+		gnm_style_conditions_insert (sc, cond, -1);
+		state->action.new_style = gnm_style_new ();
+		gnm_style_set_conditions (state->action.new_style, sc);
+	
+		c_fmt_dialog_set_conditions (state, _("Set conditional formatting"));
+
+		gnm_style_unref (state->action.new_style);
+		state->action.new_style = NULL;
+
+		c_fmt_dialog_load (state);
+	}	
+}
+
+static void
+cb_c_fmt_dialog_add_clicked (G_GNUC_UNUSED GtkButton *button, CFormatState *state)
+{
+
+	c_fmt_dialog_chooser (state);
+}
+
+static void
+cb_c_fmt_dialog_remove_clicked (G_GNUC_UNUSED GtkButton *button, CFormatState *state)
+{
+	c_fmt_dialog_load (state);
+}
+
+static void
+cb_c_fmt_dialog_clear_clicked (G_GNUC_UNUSED GtkButton *button, CFormatState *state)
+{
+	state->action.new_style = gnm_style_new ();
+	gnm_style_set_conditions (state->action.new_style, NULL);
+	
+	c_fmt_dialog_set_conditions (state, _("Clear conditional formatting"));
+
+	gnm_style_unref (state->action.new_style);
+	state->action.new_style = NULL;
+
+	c_fmt_dialog_load (state);
+}
+
+static void
+cb_c_fmt_dialog_expand_clicked (G_GNUC_UNUSED GtkButton *button, CFormatState *state)
+{
+	c_fmt_dialog_load (state);
+}
+
+static void
+cb_c_fmt_dialog_edit_clicked (G_GNUC_UNUSED GtkButton *button, CFormatState *state)
+{
+	c_fmt_dialog_load (state);
+}
+
+
+static void
+c_fmt_dialog_conditions_page_load_cond_single_f (CFormatState *state,
+					       GnmExprTop const *texpr, GtkTreeIter *iter1)
+{
+	char *formula;
+	GnmParsePos pp;
+	GtkTreeIter iter2;
+
+	gtk_tree_store_append (state->model, &iter2, iter1);
+
+	parse_pos_init (&pp, wb_control_get_workbook (WORKBOOK_CONTROL (state->wbcg)),
+			state->sheet, 0, 0);
+
+	formula = gnm_expr_top_as_string (texpr, &pp, gnm_conventions_default);
+	gtk_tree_store_set (state->model, &iter2, CONDITIONS_RANGE, NULL,
+			    CONDITIONS_COND, formula, -1);
+	g_free (formula);
+}
+
+
+static void
+c_fmt_dialog_conditions_page_load_cond_double_f (CFormatState *state,
+					       GnmStyleCond const *cond, GtkTreeIter *iter1)
+{
+	c_fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], iter1);
+	c_fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[1], iter1);
+}
+
+static void
+c_fmt_dialog_conditions_page_load_cond (CFormatState *state, GnmStyleCond const *cond,
+				      GtkTreeIter *iter)
+{
+	GtkTreeIter iter1;
+
+	gtk_tree_store_append (state->model, &iter1, iter);
+
+	switch (cond->op) {
+	case GNM_STYLE_COND_BETWEEN:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("If the cell content is between these "
+				      "two values, a special style is used."), -1);
+		c_fmt_dialog_conditions_page_load_cond_double_f (state, cond, &iter1);
+		break;
+	case GNM_STYLE_COND_NOT_BETWEEN:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("If the cell content is not between these"
+				      " two values, a special style is used."), -1);
+		c_fmt_dialog_conditions_page_load_cond_double_f (state, cond, &iter1);
+		break;
+	case GNM_STYLE_COND_EQUAL:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("If the cell content is equal to this value"
+				      ", a special style is used."), -1);
+		c_fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
+		break;
+	case GNM_STYLE_COND_NOT_EQUAL:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("If the cell content is not equal to this value"
+				      ", a special style is used."), -1);
+		c_fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
+		break;
+	case GNM_STYLE_COND_GT:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("If the cell content is > this value, a "
+				      "special style is used."), -1);
+		c_fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
+		break;
+	case GNM_STYLE_COND_LT:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("If the cell content is < this value, a "
+				      "special style is used."), -1);
+		c_fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
+		break;
+	case GNM_STYLE_COND_GTE:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("If the cell content is \xe2\x89\xa7 this "
+				      "value, a special style is used."), -1);
+
+		c_fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
+		break;
+	case GNM_STYLE_COND_LTE:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("If the cell content is \xe2\x89\xa6 this "
+				      "value, a special style is used."), -1);
+		c_fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
+		break;
+
+	case GNM_STYLE_COND_CUSTOM:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("If this formula evaluates to TRUE, a special style is used."), -1);
+		c_fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
+		break;
+	case GNM_STYLE_COND_CONTAINS_STR:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("If the cell content contains this string"
+				      ", a special style is used."), -1);
+		c_fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
+		break;
+	case GNM_STYLE_COND_NOT_CONTAINS_STR:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("If the cell content does not contain this string"
+				      ", a special style is used."), -1);
+		c_fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
+		break;
+	case GNM_STYLE_COND_BEGINS_WITH_STR:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("If the cell content begins with this string"
+				      ", a special style is used."), -1);
+		c_fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
+		break;
+	case GNM_STYLE_COND_NOT_BEGINS_WITH_STR:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("If the cell content does not begin with this string,"
+				      " a special style is used."), -1);
+		c_fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
+		break;
+	case GNM_STYLE_COND_ENDS_WITH_STR:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("If the cell content ends with this string"
+				      ", a special style is used."), -1);
+		c_fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
+		break;
+	case GNM_STYLE_COND_NOT_ENDS_WITH_STR:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("If the cell content does not end  "
+				      "with this string, a special style is used."), -1);
+		c_fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
+		break;
+	case GNM_STYLE_COND_CONTAINS_ERR:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("If the cell contains an error "
+				      "value, a special style is used."), -1);
+		break;
+	case GNM_STYLE_COND_NOT_CONTAINS_ERR:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("If the cell does not contain an error value"
+				      ", a special style is used."), -1);
+		break;
+	case GNM_STYLE_COND_CONTAINS_BLANKS:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("If the cell content "
+				      "contains blanks, a special style is used."), -1);
+		break;
+	case GNM_STYLE_COND_NOT_CONTAINS_BLANKS:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("If the cell content does not contain blanks"
+				      ", a special style is used."), -1);
+		break;
+	default:
+		gtk_tree_store_set (state->model, &iter1, CONDITIONS_RANGE, NULL,
+				    CONDITIONS_COND,
+				    _("This is an unknown condition type."), -1);
+		return;
+	}
+}
+
+static void
+c_fmt_dialog_conditions_page_load_conditions (GnmStyle *style, char const *range, CFormatState *state)
+{
+	GnmStyleConditions const *sc;
+	GArray const *conds;
+	guint i;
+	GtkTreeIter iter1, *iter;
+
+	if (range == NULL)
+		iter = NULL;
+	else {
+		iter = &iter1;
+		gtk_tree_store_append (state->model, iter, NULL);
+		gtk_tree_store_set (state->model, iter, CONDITIONS_RANGE, range,
+				    CONDITIONS_COND, NULL, -1);
+	}
+
+
+	if (gnm_style_is_element_set (style, MSTYLE_CONDITIONS) &&
+	    NULL != (sc = gnm_style_get_conditions (style)) &&
+	    NULL != (conds = gnm_style_conditions_details (sc)))
+		for (i = 0 ; i < conds->len ; i++)
+			c_fmt_dialog_conditions_page_load_cond
+				(state, &g_array_index (conds,
+							GnmStyleCond,
+							i), iter);
+
+}
+
+static gboolean
+c_fmt_dialog_condition_collector (SheetView *sv, GnmRange const *range, gpointer user_data)
+{
+	CFormatState *state = user_data;
+	GnmStyleList *l, *list = sheet_style_collect_conditions (state->sheet, range);
+
+	for (l = list; l != NULL; l = l->next) {
+		GnmStyleRegion const *sr = l->data;
+		GnmRange r  = *((GnmRange *) l->data);
+		r.start.row += range->start.row;
+		r.end.row += range->start.row;
+		r.start.col += range->start.col;
+		r.end.col += range->start.col;
+		c_fmt_dialog_conditions_page_load_conditions
+			(sr->style, range_as_string (&r), state);
+	}
+
+	style_list_free (list);
+	return TRUE;
+
+}
+
+static gboolean
+c_fmt_dialog_selection_type (SheetView *sv,
+			   GnmRange const *range,
+			   gpointer user_data)
+{
+	GnmBorder *borders[GNM_STYLE_BORDER_EDGE_MAX] = {NULL};
+	CFormatState *state = user_data;
+	GSList *merged = gnm_sheet_merge_get_overlap (sv->sheet, range);
+	GnmRange r = *range;
+	gboolean allow_multi =
+		merged == NULL ||
+		merged->next != NULL ||
+		!range_equal ((GnmRange *)merged->data, range);
+	g_slist_free (merged);
+
+	/* allow_multi == FALSE && !is_singleton (range) means that we are in
+	 * an merge cell, use only the top left */
+	if (!allow_multi) {
+		if (r.start.col != r.end.col)
+	   			r.end.col = r.start.col;
+		if (range->start.row != range->end.row)
+				r.end.row = r.start.row;
+	}
+
+	state->conflicts = sheet_style_find_conflicts (state->sheet, &r,
+		&(state->style), borders);
+
+	return TRUE;
+}
+
+static void
+c_fmt_dialog_load (CFormatState *state)
+{
+	gtk_tree_store_clear (state->model);
+	if (state->style)
+		gnm_style_unref (state->style);
+	state->style = NULL;
+
+	(void) sv_selection_foreach (state->sv,
+		c_fmt_dialog_selection_type, state);
+
+	state->homogeneous = !(state->conflicts & (1 << MSTYLE_CONDITIONS));
+
+	if (state->homogeneous) {
+		gtk_label_set_markup (state->label,
+				      _("The selection is homogeneous with "
+					 "respect to conditions."));
+		if (state->style != NULL)
+			c_fmt_dialog_conditions_page_load_conditions
+				(state->style, NULL, state);
+		gtk_tree_view_expand_all (state->treeview);
+	} else {
+		gtk_label_set_markup (state->label,
+				      _("The selection is <b>not</b> "
+					 "homogeneous "
+					 "with respect to conditions!"));
+		(void) sv_selection_foreach (state->sv,
+					     c_fmt_dialog_condition_collector, state);
+	}
+	c_fmt_dialog_update_buttons(state);
+}
+
+static void
+c_fmt_dialog_update_buttons (CFormatState *state)
+{
+	GtkTreeIter iter;
+	gboolean not_empty, selected;
+
+	not_empty = gtk_tree_model_get_iter_first 
+		(GTK_TREE_MODEL (state->model), &iter);
+	selected = gtk_tree_selection_get_selected 
+		(state->selection, NULL, NULL);
+	
+	gtk_widget_set_sensitive (GTK_WIDGET (state->clear), not_empty);
+
+	gtk_widget_set_sensitive (GTK_WIDGET (state->add), state->homogeneous);
+	gtk_widget_set_sensitive (GTK_WIDGET (state->remove),
+				  state->homogeneous && selected);
+	gtk_widget_set_sensitive (GTK_WIDGET (state->expand),
+				  (!state->homogeneous) && selected);
+	gtk_widget_set_sensitive (GTK_WIDGET (state->edit),
+				  state->homogeneous && selected);
+}
+
+static void
+cb_selection_changed (GtkTreeSelection *treeselection, CFormatState *state)
+{
+	c_fmt_dialog_update_buttons (state);
+}
+
+static gboolean
+cb_can_select (G_GNUC_UNUSED GtkTreeSelection *selection,
+	       G_GNUC_UNUSED GtkTreeModel *model,
+	       GtkTreePath *path,
+	       gboolean path_currently_selected,
+	       G_GNUC_UNUSED CFormatState *state)
+{
+	if (path_currently_selected)
+		return TRUE;
+
+	return (gtk_tree_path_get_depth (path) == 1);
+}
+
+static gboolean
+cb_c_format_dialog_range (SheetView *sv, GnmRange const *range, GString *str)
+{
+	g_string_append (str, range_as_string (range));
+	g_string_append (str, ", ");
+	return TRUE;
+}
+
+static void
+c_fmt_dialog_init_conditions_page (CFormatState *state)
+{
+	GtkTreeViewColumn * column;
+	GtkCellRenderer *renderer;
+	GtkLabel *hl;
+	GString *str;
+
+	g_return_if_fail (state != NULL);
+
+	state->add = GTK_BUTTON (go_gtk_builder_get_widget (state->gui,
+								     "conditions_add"));
+	gtk_widget_set_sensitive (GTK_WIDGET (state->add), FALSE);
+	state->remove = GTK_BUTTON (go_gtk_builder_get_widget (state->gui,
+								     "conditions_remove"));
+	gtk_widget_set_sensitive (GTK_WIDGET (state->remove), FALSE);
+	state->clear = GTK_BUTTON (go_gtk_builder_get_widget (state->gui,
+								     "conditions_clear"));
+	gtk_widget_set_sensitive (GTK_WIDGET (state->clear), FALSE);
+	state->expand = GTK_BUTTON (go_gtk_builder_get_widget (state->gui,
+								     "conditions_expand"));
+	gtk_widget_set_sensitive (GTK_WIDGET (state->expand), FALSE);
+	state->edit = GTK_BUTTON (go_gtk_builder_get_widget (state->gui,
+								     "conditions_edit"));
+	gtk_widget_set_sensitive (GTK_WIDGET (state->edit), FALSE);
+
+	state->model = gtk_tree_store_new (CONDITIONS_NUM_COLUMNS,
+						      G_TYPE_STRING,
+						      G_TYPE_STRING);
+	state->treeview = GTK_TREE_VIEW (go_gtk_builder_get_widget 
+					 (state->gui, "conditions_treeview"));
+	gtk_tree_view_set_fixed_height_mode (state->treeview, FALSE);
+	gtk_tree_view_set_model (state->treeview, GTK_TREE_MODEL (state->model));
+	g_object_unref (state->model);
+	state->selection = gtk_tree_view_get_selection (state->treeview);
+	gtk_tree_selection_set_mode (state->selection, GTK_SELECTION_SINGLE);
+	gtk_tree_selection_set_select_function (state->selection,
+						(GtkTreeSelectionFunc) cb_can_select,
+						state, NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	column = gtk_tree_view_column_new_with_attributes
+		("Range", renderer, "text", CONDITIONS_RANGE, NULL);
+	gtk_tree_view_insert_column (state->treeview, column, -1);
+	renderer = gtk_cell_renderer_text_new ();
+	column = gtk_tree_view_column_new_with_attributes
+		("Conditions", renderer, "text", CONDITIONS_COND, NULL);
+	gtk_tree_view_insert_column (state->treeview, column, -1);
+	gtk_tree_view_set_expander_column (state->treeview, column);
+
+	state->label = GTK_LABEL (go_gtk_builder_get_widget (state->gui,
+								   "conditions_label"));
+	hl = GTK_LABEL (go_gtk_builder_get_widget (state->gui, "header-label"));
+	gtk_label_set_ellipsize (hl, PANGO_ELLIPSIZE_END);
+	str = g_string_new (_("Editing conditional formatting: "));
+	sv_selection_foreach (state->sv, 
+			      (GnmSelectionFunc)cb_c_format_dialog_range, 
+			      str);
+	g_string_truncate (str, str->len -2);
+	gtk_label_set_text(hl, str->str);
+	g_string_free (str, TRUE);
+
+	c_fmt_dialog_load (state);
+
+	g_signal_connect (G_OBJECT (state->selection), "changed",
+			  G_CALLBACK (cb_selection_changed), state);
+	g_signal_connect (G_OBJECT (state->add), "clicked",
+			  G_CALLBACK (cb_c_fmt_dialog_add_clicked), state);
+	g_signal_connect (G_OBJECT (state->remove), "clicked",
+			  G_CALLBACK (cb_c_fmt_dialog_remove_clicked), state);
+	g_signal_connect (G_OBJECT (state->clear), "clicked",
+			  G_CALLBACK (cb_c_fmt_dialog_clear_clicked), state);
+	g_signal_connect (G_OBJECT (state->expand), "clicked",
+			  G_CALLBACK (cb_c_fmt_dialog_expand_clicked), state);
+	g_signal_connect (G_OBJECT (state->edit), "clicked",
+			  G_CALLBACK (cb_c_fmt_dialog_edit_clicked), state);
+	
+	gtk_widget_hide (GTK_WIDGET (state->remove)); 
+	gtk_widget_hide (GTK_WIDGET (state->expand)); 
+	gtk_widget_hide (GTK_WIDGET (state->edit)); 
+}
+
+/*****************************************************************************/
+
+/* button handlers */
+static void
+cb_c_fmt_dialog_dialog_buttons (G_GNUC_UNUSED GtkWidget *btn, CFormatState *state)
+{
+		gtk_widget_destroy (GTK_WIDGET (state->dialog));
+}
+
+/* Handler for destroy */
+static void
+cb_c_fmt_dialog_dialog_destroy (CFormatState *state)
+{
+	if (state->style)
+		gnm_style_unref (state->style);
+	g_object_unref (G_OBJECT (state->gui));
+	g_free (state);
+}
+
+static void
+cb_dialog_destroy (GtkDialog *dialog)
+{
+	g_object_set_data (G_OBJECT (dialog), "state", NULL);
+}
+
+
+void
+dialog_cell_format_cond (WBCGtk *wbcg)
+{
+	GtkBuilder     *gui;
+	CFormatState  *state;
+	GtkWidget *dialog;
+
+	g_return_if_fail (wbcg != NULL);
+
+	gui = gnm_gtk_builder_new ("cell-format-cond.ui", NULL, GO_CMD_CONTEXT (wbcg));
+        if (gui == NULL)
+                return;
+
+	/* Initialize */
+	state = g_new (CFormatState, 1);
+	state->wbcg	= wbcg;
+	state->gui	= gui;
+	state->sv	= wb_control_cur_sheet_view (WORKBOOK_CONTROL (wbcg));
+	state->sheet	= sv_sheet (state->sv);
+	state->style		= NULL;
+
+	dialog = go_gtk_builder_get_widget (state->gui, "CellFormat");
+	g_return_if_fail (dialog != NULL);
+
+	gtk_window_set_title (GTK_WINDOW (dialog), _("Conditional Cell Formatting"));
+
+	/* Initialize */
+	state->dialog	   = GTK_DIALOG (dialog);
+
+	c_fmt_dialog_init_conditions_page (state);
+
+	gnumeric_init_help_button (
+		go_gtk_builder_get_widget (state->gui, "helpbutton"),
+		GNUMERIC_HELP_LINK_CELL_FORMAT_COND);
+
+	state->close_button = go_gtk_builder_get_widget (state->gui, "closebutton");
+	g_signal_connect (G_OBJECT (state->close_button),
+		"clicked",
+		G_CALLBACK (cb_c_fmt_dialog_dialog_buttons), state);
+
+	gnm_dialog_setup_destroy_handlers (GTK_DIALOG (dialog), state->wbcg,
+					   GNM_DIALOG_DESTROY_CURRENT_SHEET_REMOVED);
+
+	/* a candidate for merging into attach guru */
+	wbc_gtk_attach_guru (state->wbcg, GTK_WIDGET (state->dialog));
+	g_object_set_data_full (G_OBJECT (state->dialog),
+		"state", state, (GDestroyNotify)cb_c_fmt_dialog_dialog_destroy);
+	g_signal_connect (G_OBJECT (dialog), "destroy",
+			  G_CALLBACK (cb_dialog_destroy), NULL);
+
+	gnumeric_restore_window_geometry (GTK_WINDOW (state->dialog),
+					  CELL_FORMAT_KEY);
+
+	go_gtk_nonmodal_dialog (wbcg_toplevel (state->wbcg),
+				   GTK_WINDOW (state->dialog));
+
+	gtk_widget_show (GTK_WIDGET (state->dialog));
+}
diff --git a/src/dialogs/dialog-cell-format.c b/src/dialogs/dialog-cell-format.c
index f4f3306..7b92df4 100644
--- a/src/dialogs/dialog-cell-format.c
+++ b/src/dialogs/dialog-cell-format.c
@@ -211,14 +211,10 @@ typedef struct _FormatState {
 		GtkTextView     *msg;
 	} input_msg;
 	struct {
-		GtkButton       *add;
-		GtkButton       *remove;
-		GtkButton       *clear;
-		GtkButton       *expand;
-		GtkButton       *edit;
-		GtkLabel        *label;
-		GtkTreeStore    *model;
-	} conditions;
+		gboolean is_selector;
+		GtkWindow *w; 
+		gpointer closure;
+	} style_selector;
 
 	void (*dialog_changed) (gpointer user_data);
 	gpointer	dialog_changed_user_data;
@@ -1960,297 +1956,6 @@ fmt_dialog_init_input_msg_page (FormatState *state)
 
 /*****************************************************************************/
 
-static void
-fmt_dialog_conditions_page_load_cond_single_f (FormatState *state,
-					       GnmExprTop const *texpr, GtkTreeIter *iter1)
-{
-	char *formula;
-	GnmParsePos pp;
-	GtkTreeIter iter2;
-
-	gtk_tree_store_append (state->conditions.model, &iter2, iter1);
-
-	parse_pos_init (&pp, wb_control_get_workbook (WORKBOOK_CONTROL (state->wbcg)),
-			state->sheet, 0, 0);
-
-	formula = gnm_expr_top_as_string (texpr, &pp, gnm_conventions_default);
-	gtk_tree_store_set (state->conditions.model, &iter2, CONDITIONS_RANGE, NULL,
-			    CONDITIONS_COND, formula, -1);
-	g_free (formula);
-}
-
-
-static void
-fmt_dialog_conditions_page_load_cond_double_f (FormatState *state,
-					       GnmStyleCond const *cond, GtkTreeIter *iter1)
-{
-	fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], iter1);
-	fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[1], iter1);
-}
-
-static void
-fmt_dialog_conditions_page_load_cond (FormatState *state, GnmStyleCond const *cond,
-				      GtkTreeIter *iter)
-{
-	GtkTreeIter iter1;
-
-	gtk_tree_store_append (state->conditions.model, &iter1, iter);
-
-	switch (cond->op) {
-	case GNM_STYLE_COND_BETWEEN:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("If the cell content is between these "
-				      "two values, a special style is used."), -1);
-		fmt_dialog_conditions_page_load_cond_double_f (state, cond, &iter1);
-		break;
-	case GNM_STYLE_COND_NOT_BETWEEN:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("If the cell content is not between these"
-				      " two values, a special style is used."), -1);
-		fmt_dialog_conditions_page_load_cond_double_f (state, cond, &iter1);
-		break;
-	case GNM_STYLE_COND_EQUAL:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("If the cell content is equal to this value"
-				      ", a special style is used."), -1);
-		fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
-		break;
-	case GNM_STYLE_COND_NOT_EQUAL:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("If the cell content is not equal to this value"
-				      ", a special style is used."), -1);
-		fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
-		break;
-	case GNM_STYLE_COND_GT:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("If the cell content is > this value, a "
-				      "special style is used."), -1);
-		fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
-		break;
-	case GNM_STYLE_COND_LT:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("If the cell content is < this value, a "
-				      "special style is used."), -1);
-		fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
-		break;
-	case GNM_STYLE_COND_GTE:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("If the cell content is \xe2\x89\xa7 this "
-				      "value, a special style is used."), -1);
-
-		fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
-		break;
-	case GNM_STYLE_COND_LTE:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("If the cell content is \xe2\x89\xa6 this "
-				      "value, a special style is used."), -1);
-		fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
-		break;
-
-	case GNM_STYLE_COND_CUSTOM:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("If this formula evaluates to TRUE, a special style is used."), -1);
-		fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
-		break;
-	case GNM_STYLE_COND_CONTAINS_STR:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("If the cell content contains this string"
-				      ", a special style is used."), -1);
-		fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
-		break;
-	case GNM_STYLE_COND_NOT_CONTAINS_STR:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("If the cell content does not contain this string"
-				      ", a special style is used."), -1);
-		fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
-		break;
-	case GNM_STYLE_COND_BEGINS_WITH_STR:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("If the cell content begins with this string"
-				      ", a special style is used."), -1);
-		fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
-		break;
-	case GNM_STYLE_COND_NOT_BEGINS_WITH_STR:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("If the cell content does not begin with this string,"
-				      " a special style is used."), -1);
-		fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
-		break;
-	case GNM_STYLE_COND_ENDS_WITH_STR:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("If the cell content ends with this string"
-				      ", a special style is used."), -1);
-		fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
-		break;
-	case GNM_STYLE_COND_NOT_ENDS_WITH_STR:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("If the cell content does not end  "
-				      "with this string, a special style is used."), -1);
-		fmt_dialog_conditions_page_load_cond_single_f (state, cond->texpr[0], &iter1);
-		break;
-	case GNM_STYLE_COND_CONTAINS_ERR:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("If the cell contains an error "
-				      "value, a special style is used."), -1);
-		break;
-	case GNM_STYLE_COND_NOT_CONTAINS_ERR:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("If the cell does not contain an error value"
-				      ", a special style is used."), -1);
-		break;
-	case GNM_STYLE_COND_CONTAINS_BLANKS:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("If the cell content "
-				      "contains blanks, a special style is used."), -1);
-		break;
-	case GNM_STYLE_COND_NOT_CONTAINS_BLANKS:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("If the cell content does not contain blanks"
-				      ", a special style is used."), -1);
-		break;
-	default:
-		gtk_tree_store_set (state->conditions.model, &iter1, CONDITIONS_RANGE, NULL,
-				    CONDITIONS_COND,
-				    _("This is an unknown condition type."), -1);
-		return;
-	}
-}
-
-static void
-fmt_dialog_conditions_page_load_conditions (GnmStyle *style, char const *range, FormatState *state)
-{
-	GnmStyleConditions const *sc;
-	GArray const *conds;
-	guint i;
-	GtkTreeIter iter1, *iter;
-
-	if (range == NULL)
-		iter = NULL;
-	else {
-		iter = &iter1;
-		gtk_tree_store_append (state->conditions.model, iter, NULL);
-		gtk_tree_store_set (state->conditions.model, iter, CONDITIONS_RANGE, range,
-				    CONDITIONS_COND, NULL, -1);
-	}
-
-
-	if (gnm_style_is_element_set (style, MSTYLE_CONDITIONS) &&
-	    NULL != (sc = gnm_style_get_conditions (style)) &&
-	    NULL != (conds = gnm_style_conditions_details (sc)))
-		for (i = 0 ; i < conds->len ; i++)
-			fmt_dialog_conditions_page_load_cond
-				(state, &g_array_index (conds,
-							GnmStyleCond,
-							i), iter);
-
-}
-
-static gboolean
-fmt_dialog_condition_collector (SheetView *sv, GnmRange const *range, gpointer user_data)
-{
-	FormatState *state = user_data;
-	GnmStyleList *l, *list = sheet_style_collect_conditions (state->sheet, range);
-
-	for (l = list; l != NULL; l = l->next) {
-		GnmStyleRegion const *sr = l->data;
-		GnmRange r  = *((GnmRange *) l->data);
-		r.start.row += range->start.row;
-		r.end.row += range->start.row;
-		r.start.col += range->start.col;
-		r.end.col += range->start.col;
-		fmt_dialog_conditions_page_load_conditions
-			(sr->style, range_as_string (&r), state);
-	}
-
-	style_list_free (list);
-	return TRUE;
-
-}
-
-static void
-fmt_dialog_init_conditions_page (FormatState *state)
-{
-	GtkTreeView *treeview;
-	GtkTreeViewColumn * column;
-	GtkCellRenderer *renderer;
-
-	g_return_if_fail (state != NULL);
-
-	state->conditions.add = GTK_BUTTON (go_gtk_builder_get_widget (state->gui,
-								     "conditions_add"));
-	gtk_widget_set_sensitive (GTK_WIDGET (state->conditions.add), FALSE);
-	state->conditions.remove = GTK_BUTTON (go_gtk_builder_get_widget (state->gui,
-								     "conditions_remove"));
-	gtk_widget_set_sensitive (GTK_WIDGET (state->conditions.remove), FALSE);
-	state->conditions.clear = GTK_BUTTON (go_gtk_builder_get_widget (state->gui,
-								     "conditions_clear"));
-	gtk_widget_set_sensitive (GTK_WIDGET (state->conditions.clear), FALSE);
-	state->conditions.expand = GTK_BUTTON (go_gtk_builder_get_widget (state->gui,
-								     "conditions_expand"));
-	gtk_widget_set_sensitive (GTK_WIDGET (state->conditions.expand), FALSE);
-	state->conditions.edit = GTK_BUTTON (go_gtk_builder_get_widget (state->gui,
-								     "conditions_edit"));
-	gtk_widget_set_sensitive (GTK_WIDGET (state->conditions.edit), FALSE);
-
-	state->conditions.model = gtk_tree_store_new (CONDITIONS_NUM_COLUMNS,
-						      G_TYPE_STRING,
-						      G_TYPE_STRING);
-	treeview = GTK_TREE_VIEW (go_gtk_builder_get_widget (state->gui, "conditions_treeview"));
-	gtk_tree_view_set_fixed_height_mode (treeview, FALSE);
-	gtk_tree_view_set_model (treeview, GTK_TREE_MODEL (state->conditions.model));
-	g_object_unref (state->conditions.model);
-
-	renderer = gtk_cell_renderer_text_new ();
-	column = gtk_tree_view_column_new_with_attributes
-		("Range", renderer, "text", CONDITIONS_RANGE, NULL);
-	gtk_tree_view_insert_column (treeview, column, -1);
-	renderer = gtk_cell_renderer_text_new ();
-	column = gtk_tree_view_column_new_with_attributes
-		("Conditions", renderer, "text", CONDITIONS_COND, NULL);
-	gtk_tree_view_insert_column (treeview, column, -1);
-	gtk_tree_view_set_expander_column (treeview, column);
-
-	state->conditions.label = GTK_LABEL (go_gtk_builder_get_widget (state->gui,
-								   "conditions_label"));
-	if (state->conflicts & (1 << MSTYLE_CONDITIONS)) {
-		gtk_label_set_markup (state->conditions.label,
-				      _("The selection is <b>not</b> "
-					 "homogeneous "
-					 "with respect to conditions!"));
-		(void) sv_selection_foreach (state->sv,
-					     fmt_dialog_condition_collector, state);
-	} else {
-		gtk_label_set_markup (state->conditions.label,
-				      _("The selection is homogeneous with "
-					 "respect to conditions."));
-		if (state->style != NULL)
-			fmt_dialog_conditions_page_load_conditions
-				(state->style, NULL, state);
-		gtk_tree_view_expand_all (treeview);
-	}
-}
-
-/*****************************************************************************/
-
 /* button handlers */
 static void
 cb_fmt_dialog_dialog_buttons (GtkWidget *btn, FormatState *state)
@@ -2317,8 +2022,13 @@ cb_fmt_dialog_dialog_buttons (GtkWidget *btn, FormatState *state)
 		for (i = GNM_STYLE_BORDER_TOP; i < GNM_STYLE_BORDER_EDGE_MAX; i++)
 			borders[i] = border_get_mstyle (state, i);
 
-		cmd_selection_format (WORKBOOK_CONTROL (state->wbcg),
-			state->result, borders, NULL);
+		if (state->style_selector.is_selector)
+			dialog_cell_format_style_added 
+				(state->style_selector.closure,
+				 state->result);
+		else
+			cmd_selection_format (WORKBOOK_CONTROL (state->wbcg),
+					      state->result, borders, NULL);
 		/* state->result got absorbed.  */
 		/* Get a fresh style to accumulate results in */
 		state->result = gnm_style_new ();
@@ -2502,7 +2212,6 @@ fmt_dialog_impl (FormatState *state, FormatDialogPosition_t pageno)
 	fmt_dialog_init_protection_page (state);
 	fmt_dialog_init_validation_page (state);
 	fmt_dialog_init_input_msg_page (state);
-	fmt_dialog_init_conditions_page (state);
 
 	default_border_color = GO_COLOR_FROM_GDK (gtk_widget_get_style (GTK_WIDGET (state->dialog))->black);
 
@@ -2655,8 +2364,6 @@ fmt_dialog_impl (FormatState *state, FormatDialogPosition_t pageno)
 	 *   then move around and apply it to different cells.
 	 */
 
-	/* a candidate for merging into attach guru */
-	wbc_gtk_attach_guru (state->wbcg, GTK_WIDGET (state->dialog));
 	g_object_set_data_full (G_OBJECT (state->dialog),
 		"state", state, (GDestroyNotify)cb_fmt_dialog_dialog_destroy);
 	g_signal_connect (G_OBJECT (dialog), "destroy",
@@ -2664,10 +2371,6 @@ fmt_dialog_impl (FormatState *state, FormatDialogPosition_t pageno)
 
 	gnumeric_restore_window_geometry (GTK_WINDOW (state->dialog),
 					  CELL_FORMAT_KEY);
-
-	go_gtk_nonmodal_dialog (wbcg_toplevel (state->wbcg),
-				   GTK_WINDOW (state->dialog));
-	gtk_widget_show (GTK_WIDGET (state->dialog));
 }
 
 static GnmValue *
@@ -2738,18 +2441,16 @@ fmt_dialog_selection_type (SheetView *sv,
 	return TRUE;
 }
 
-void
-dialog_cell_format (WBCGtk *wbcg, FormatDialogPosition_t pageno)
+static FormatState *
+dialog_cell_format_init (WBCGtk *wbcg)
 {
 	GtkBuilder     *gui;
 	GnmCell	     *edit_cell;
 	FormatState  *state;
 
-	g_return_if_fail (wbcg != NULL);
-
 	gui = gnm_gtk_builder_new ("cell-format.ui", NULL, GO_CMD_CONTEXT (wbcg));
         if (gui == NULL)
-                return;
+                return NULL;
 
 	/* Initialize */
 	state = g_new (FormatState, 1);
@@ -2773,7 +2474,31 @@ dialog_cell_format (WBCGtk *wbcg, FormatDialogPosition_t pageno)
 		fmt_dialog_selection_type, state);
 	state->selection_mask	= 1 << state->selection_mask;
 
+	return state;
+}
+
+void
+dialog_cell_format (WBCGtk *wbcg, FormatDialogPosition_t pageno)
+{
+	FormatState  *state;
+
+	g_return_if_fail (wbcg != NULL);
+
+	state = dialog_cell_format_init (wbcg);
+
+        if (state == NULL)
+                return;
+
+	state->style_selector.is_selector = FALSE;
+	state->style_selector.w = NULL;
+	state->style_selector.closure = NULL;
+
 	fmt_dialog_impl (state, pageno);
+
+	wbc_gtk_attach_guru (state->wbcg, GTK_WIDGET (state->dialog));
+	go_gtk_nonmodal_dialog (wbcg_toplevel (state->wbcg),
+				   GTK_WINDOW (state->dialog));
+	gtk_widget_show (GTK_WIDGET (state->dialog));
 }
 
 /*
@@ -2786,3 +2511,38 @@ dialog_cell_format (WBCGtk *wbcg, FormatDialogPosition_t pageno)
  *	- Some undo capabilities in the dialog.
  *	- How to distinguish between auto & custom colors on extraction from styles.
  */
+
+void
+dialog_cell_format_select_style (WBCGtk *wbcg, gint pages, 
+				 GtkWindow *w, gpointer closure)
+{
+	FormatState  *state;
+	gint i;
+
+	g_return_if_fail (wbcg != NULL);
+
+	state = dialog_cell_format_init (wbcg);
+
+        if (state == NULL)
+                return;
+
+	state->style_selector.is_selector = TRUE;
+	state->style_selector.w = w;
+	state->style_selector.closure = closure;
+
+	fmt_dialog_impl (state, FD_BACKGROUND);
+
+	for (i = 0; i <= FD_LAST; i++) {
+		GtkWidget *widget = gtk_notebook_get_nth_page 
+			(state->notebook, i);
+		if (widget != NULL && !((1<<i) & pages))
+			gtk_widget_hide (widget);
+	}
+
+	gtk_widget_hide (state->apply_button);
+
+	go_gtk_window_set_transient (GTK_WINDOW (w), 
+				     GTK_WINDOW (state->dialog));
+	gtk_window_set_modal (GTK_WINDOW (state->dialog), TRUE);
+	gtk_widget_show (GTK_WIDGET (state->dialog));
+}
diff --git a/src/dialogs/dialog-doc-metadata.c b/src/dialogs/dialog-doc-metadata.c
index 3df7b9e..2c19b30 100644
--- a/src/dialogs/dialog-doc-metadata.c
+++ b/src/dialogs/dialog-doc-metadata.c
@@ -1220,7 +1220,7 @@ static void
 dialog_doc_metadata_update_keyword_list (DialogDocMetaData *state, GsfDocProp *prop)
 {
 	guint i;
-	GtkTreeSelection *sel;;
+	GtkTreeSelection *sel;
 
 	gtk_list_store_clear (state->key_store);
 
diff --git a/src/dialogs/dialogs.h b/src/dialogs/dialogs.h
index 2963c02..3beab05 100644
--- a/src/dialogs/dialogs.h
+++ b/src/dialogs/dialogs.h
@@ -23,6 +23,11 @@ void	 dialog_plugin_manager	(WBCGtk *wbcg);
 void	 dialog_goto_cell	(WBCGtk *wbcg);
 void	 dialog_cell_format	(WBCGtk *wbcg,
 				 FormatDialogPosition_t pageno);
+void	 dialog_cell_format_select_style (WBCGtk *wbcg,
+					  gint pages, GtkWindow *w,
+					  gpointer closure);
+void	 dialog_cell_format_cond (WBCGtk *wbcg);
+void     dialog_cell_format_style_added (gpointer closure, GnmStyle *style);
 void	 dialog_paste_special	(WBCGtk *wbcg);
 void	 dialog_insert_cells	(WBCGtk *wbcg);
 void	 dialog_delete_cells	(WBCGtk *wbcg);
diff --git a/src/dialogs/help.h b/src/dialogs/help.h
index 4c99644..cf03698 100644
--- a/src/dialogs/help.h
+++ b/src/dialogs/help.h
@@ -44,6 +44,9 @@
 /* dialog-cell-format.c       */
 #define GNUMERIC_HELP_LINK_CELL_FORMAT "sect-data-format"
 
+/* dialog-cell-format-cond.c       */
+#define GNUMERIC_HELP_LINK_CELL_FORMAT_COND "sect-data-format"
+
 /* dialog-cell-sort.c  */
 #define GNUMERIC_HELP_LINK_CELL_SORT "sect-data-modify"
 
diff --git a/src/sheet-control-gui.c b/src/sheet-control-gui.c
index 6ece4ad..e9ad28d 100644
--- a/src/sheet-control-gui.c
+++ b/src/sheet-control-gui.c
@@ -1796,6 +1796,7 @@ enum {
 	CONTEXT_DELETE,
 	CONTEXT_CLEAR_CONTENT,
 	CONTEXT_FORMAT_CELL,
+	CONTEXT_FORMAT_CELL_COND,
 	CONTEXT_CELL_AUTOFIT_WIDTH,
 	CONTEXT_CELL_AUTOFIT_HEIGHT,
 	CONTEXT_CELL_MERGE,
@@ -1856,6 +1857,9 @@ context_menu_handler (GnumericPopupMenuElement const *element,
 	case CONTEXT_FORMAT_CELL :
 		dialog_cell_format (wbcg, FD_CURRENT);
 		break;
+	case CONTEXT_FORMAT_CELL_COND :
+		dialog_cell_format_cond (wbcg);
+		break;
 	case CONTEXT_CELL_AUTOFIT_HEIGHT :
 		workbook_cmd_autofit_selection
 			(wbc, wb_control_cur_sheet (wbc), FALSE);
@@ -2105,6 +2109,8 @@ scg_context_menu (SheetControlGUI *scg, GdkEventButton *event,
 
 		{ N_("_Format All Cells..."), GTK_STOCK_PROPERTIES,
 		    0, 0, CONTEXT_FORMAT_CELL },
+		{ N_("C_onditional Formating..."), GTK_STOCK_PROPERTIES,
+		    0, 0, CONTEXT_FORMAT_CELL_COND },
 		{ N_("Cell"), NULL, 0, 0, -1},/* start sub menu */
 		{ N_("_Merge"), "Gnumeric_MergeCells",   0,
 		  CONTEXT_DISABLE_FOR_ONLYMERGES, CONTEXT_CELL_MERGE },
diff --git a/src/style-conditions.c b/src/style-conditions.c
index 010c3d9..123ab60 100644
--- a/src/style-conditions.c
+++ b/src/style-conditions.c
@@ -55,7 +55,11 @@ gnm_style_cond_is_valid (GnmStyleCond const *cond)
 	g_return_val_if_fail (cond != NULL, FALSE);
 
 	if (cond->overlay == NULL) return FALSE;
-	if (cond->texpr[0] == NULL) return FALSE;
+	if ((cond->texpr[0] != NULL) ^ 
+	    (cond->op != GNM_STYLE_COND_CONTAINS_ERR &&
+	     cond->op != GNM_STYLE_COND_NOT_CONTAINS_ERR &&
+	     cond->op != GNM_STYLE_COND_CONTAINS_BLANKS &&
+	     cond->op != GNM_STYLE_COND_NOT_CONTAINS_BLANKS)) return FALSE;
 	if ((cond->texpr[1] != NULL) ^
 	    (cond->op == GNM_STYLE_COND_BETWEEN ||
 	     cond->op == GNM_STYLE_COND_NOT_BETWEEN))
@@ -118,6 +122,36 @@ gnm_style_conditions_new (void)
 	return g_object_new (gnm_style_conditions_get_type (), NULL);
 }
 
+GnmStyleConditions *
+gnm_style_conditions_dup  (GnmStyleConditions const *cond)
+{
+	GnmStyleConditions  *dup;
+	GArray const *ga;
+	if (cond == NULL)
+		return NULL;
+
+	dup =  gnm_style_conditions_new ();
+	ga = gnm_style_conditions_details (cond);
+	if (ga != NULL) {
+		guint i;
+		GArray *ga_dup = g_array_sized_new (FALSE, FALSE, sizeof (GnmStyleCond),
+						    ga->len);
+		for (i = 0; i < ga->len; i++) {
+			GnmStyleCond gsc = g_array_index(ga, GnmStyleCond, i);
+
+			gnm_style_ref (gsc.overlay);
+			if (gsc.texpr[0])
+				gnm_expr_top_ref (gsc.texpr[0]);
+			if (gsc.texpr[1])
+				gnm_expr_top_ref (gsc.texpr[1]);
+			g_array_append_val (ga_dup, gsc);
+		}
+		dup->conditions = ga_dup;
+	}
+	return dup;
+}
+
+
 /**
  * gnm_style_conditions_details :
  * @sc : #GnmStyleConditions
@@ -198,7 +232,7 @@ gnm_style_conditions_eval (GnmStyleConditions const *sc, GnmEvalPos const *ep)
 {
 	unsigned i;
 	gboolean use_this = FALSE;
-	GnmValue *val;
+	GnmValue *val = NULL;
 	GArray const *conds;
 	GnmStyleCond const *cond;
 	GnmParsePos pp;
@@ -214,105 +248,116 @@ gnm_style_conditions_eval (GnmStyleConditions const *sc, GnmEvalPos const *ep)
 	for (i = 0 ; i < conds->len ; i++) {
 		cond = &g_array_index (conds, GnmStyleCond, i);
 
-		val = gnm_expr_top_eval (cond->texpr[0], ep, GNM_EXPR_EVAL_SCALAR_NON_EMPTY);
-		if (cond->op == GNM_STYLE_COND_CUSTOM) {
-			use_this = value_get_as_bool (val, NULL);
-#if 0
-			char *str = gnm_expr_as_string (cond->expr[0],
-							&pp, NULL);
-			g_print ("'%s' = %s\n", str, use_this ? "true" : "false");
-			g_free (str);
-#endif
-		} else if (cond->op < GNM_STYLE_COND_CONTAINS_STR) {
-			GnmValDiff diff = value_compare (cv, val, TRUE);
-
-			switch (cond->op) {
-			default:
-			case GNM_STYLE_COND_EQUAL:	use_this = (diff == IS_EQUAL); break;
-			case GNM_STYLE_COND_NOT_EQUAL:	use_this = (diff != IS_EQUAL); break;
-			case GNM_STYLE_COND_NOT_BETWEEN:
-				if (diff == IS_LESS) {
-					use_this = TRUE;
+		if (cond->op == GNM_STYLE_COND_CONTAINS_ERR)
+			use_this = (cv != NULL) && VALUE_IS_ERROR (cv);
+		else if (cond->op == GNM_STYLE_COND_NOT_CONTAINS_ERR)
+			use_this = (cv == NULL) || !VALUE_IS_ERROR (cv);
+		else if (cond->op == GNM_STYLE_COND_CONTAINS_BLANKS ||
+			 cond->op == GNM_STYLE_COND_NOT_CONTAINS_BLANKS) {
+			if (cv && VALUE_IS_STRING (cv)) {
+				char const *cvstring = value_peek_string (cv);
+				switch (cond->op) {
+				case GNM_STYLE_COND_CONTAINS_BLANKS :
+					use_this = NULL != strpbrk (cvstring, BLANKS_STRING_FOR_MATCHING);
 					break;
-				}
-				value_release (val);
-				val = gnm_expr_top_eval (cond->texpr[1], ep, GNM_EXPR_EVAL_SCALAR_NON_EMPTY);
-				diff = value_compare (cv, val, TRUE);
-				/* fall through */
-
-			case GNM_STYLE_COND_GT:		use_this = (diff == IS_GREATER); break;
-			case GNM_STYLE_COND_LT:		use_this = (diff == IS_LESS); break;
-			case GNM_STYLE_COND_GTE:	use_this = (diff != IS_LESS); break;
-			case GNM_STYLE_COND_BETWEEN:
-				if (diff == IS_LESS)
+				case GNM_STYLE_COND_NOT_CONTAINS_BLANKS :
+					use_this = NULL == strpbrk (cvstring, BLANKS_STRING_FOR_MATCHING);
+					break;
+				default:
 					break;
-				value_release (val);
-				val = gnm_expr_top_eval (cond->texpr[1], ep, GNM_EXPR_EVAL_SCALAR_NON_EMPTY);
-				diff = value_compare (cv, val, TRUE);
-				/* fall through */
-			case GNM_STYLE_COND_LTE:	use_this = (diff != IS_GREATER); break;
+				}
 			}
-		} else if (cond->op != GNM_STYLE_COND_CONTAINS_ERR)
-			use_this = (cv != NULL) && VALUE_IS_ERROR (cv);
-		else if (cond->op != GNM_STYLE_COND_NOT_CONTAINS_ERR)
-			use_this = (cv == NULL) || !VALUE_IS_ERROR (cv);
-		else if (VALUE_IS_STRING (cv)) {
-			char const *valstring;
-			char *ptr;
-			char *ptr2;
-			char const *cvstring = value_peek_string (cv);
-			int slen = strlen (cvstring);
-
-			valstring = value_peek_string (val);
-			switch (cond->op) {
-			default : g_warning ("Unknown condition operator %d", cond->op);
-				break;
-			case GNM_STYLE_COND_CONTAINS_STR :
-				use_this = (NULL != strstr (cvstring, valstring));
-				break;
-			case GNM_STYLE_COND_NOT_CONTAINS_STR :
-				use_this = (NULL == strstr (cvstring, valstring));
-				break;
-			case GNM_STYLE_COND_BEGINS_WITH_STR :
-				use_this = (0 == strncmp (cvstring, valstring, slen));
-				break;
-			case GNM_STYLE_COND_NOT_BEGINS_WITH_STR :
-				use_this = (0 != strncmp (cvstring, valstring, slen));
-				break;
-			case GNM_STYLE_COND_ENDS_WITH_STR :
-				/* gedanken experiment: valuestr="foofoo"; cvstring="foo"
-				 * This loop solves the problem.
-				 * First, make sure ptr2 is NULL in case it never gets assigned*/
-				ptr2 = NULL;
-				while ((ptr = strstr (cvstring,valstring))) {
-					/*ptr2 will point to the beginning of the last match*/
-					ptr2 = ptr;
+		} else {
+			val = gnm_expr_top_eval (cond->texpr[0], ep, GNM_EXPR_EVAL_SCALAR_NON_EMPTY);
+			if (cond->op == GNM_STYLE_COND_CUSTOM) {
+				use_this = value_get_as_bool (val, NULL);
+#if 0
+				char *str = gnm_expr_as_string (cond->expr[0],
+								&pp, NULL);
+				g_print ("'%s' = %s\n", str, use_this ? "true" : "false");
+				g_free (str);
+#endif
+			} else if (cond->op < GNM_STYLE_COND_CONTAINS_STR) {
+				GnmValDiff diff = value_compare (cv, val, TRUE);
+
+				switch (cond->op) {
+				default:
+				case GNM_STYLE_COND_EQUAL:	use_this = (diff == IS_EQUAL); break;
+				case GNM_STYLE_COND_NOT_EQUAL:	use_this = (diff != IS_EQUAL); break;
+				case GNM_STYLE_COND_NOT_BETWEEN:
+					if (diff == IS_LESS) {
+						use_this = TRUE;
+						break;
+					}
+					value_release (val);
+					val = gnm_expr_top_eval (cond->texpr[1], ep, GNM_EXPR_EVAL_SCALAR_NON_EMPTY);
+					diff = value_compare (cv, val, TRUE);
+					/* fall through */
+
+				case GNM_STYLE_COND_GT:		use_this = (diff == IS_GREATER); break;
+				case GNM_STYLE_COND_LT:		use_this = (diff == IS_LESS); break;
+				case GNM_STYLE_COND_GTE:	use_this = (diff != IS_LESS); break;
+				case GNM_STYLE_COND_BETWEEN:
+					if (diff == IS_LESS)
+						break;
+					value_release (val);
+					val = gnm_expr_top_eval (cond->texpr[1], ep, GNM_EXPR_EVAL_SCALAR_NON_EMPTY);
+					diff = value_compare (cv, val, TRUE);
+					/* fall through */
+				case GNM_STYLE_COND_LTE:	use_this = (diff != IS_GREATER); break;
 				}
-				/*If it matches; is it the *end* match?*/
-				use_this = (ptr != NULL) && (0 == strcmp (ptr2, valstring));
-				break;
-			case GNM_STYLE_COND_NOT_ENDS_WITH_STR :
-				/*gedanken experiment: valuestr="foofoo"; cvstring="foo"
-				 * This loop solves the problem.
-				 *First, make sure ptr2 is NULL in case it never gets assigned*/
-				ptr2 = NULL;
-				while ((ptr = strstr (cvstring,valstring))) {
-					/*ptr2 will point to the beginning of the last match*/
-					ptr2 = ptr;
+			} else if (cv && VALUE_IS_STRING (cv)) {
+				char const *valstring;
+				char *ptr;
+				char *ptr2;
+				char const *cvstring = value_peek_string (cv);
+				int slen = strlen (cvstring);
+
+				valstring = value_peek_string (val);
+				switch (cond->op) {
+				default : g_warning ("Unknown condition operator %d", cond->op);
+					break;
+				case GNM_STYLE_COND_CONTAINS_STR :
+					use_this = (NULL != strstr (cvstring, valstring));
+					break;
+				case GNM_STYLE_COND_NOT_CONTAINS_STR :
+					use_this = (NULL == strstr (cvstring, valstring));
+					break;
+				case GNM_STYLE_COND_BEGINS_WITH_STR :
+					use_this = (0 == strncmp (cvstring, valstring, slen));
+					break;
+				case GNM_STYLE_COND_NOT_BEGINS_WITH_STR :
+					use_this = (0 != strncmp (cvstring, valstring, slen));
+					break;
+				case GNM_STYLE_COND_ENDS_WITH_STR :
+					/* gedanken experiment: valuestr="foofoo"; cvstring="foo"
+					 * This loop solves the problem.
+					 * First, make sure ptr2 is NULL in case it never gets assigned*/
+					ptr2 = NULL;
+					while ((ptr = strstr (cvstring,valstring))) {
+						/*ptr2 will point to the beginning of the last match*/
+						ptr2 = ptr;
+					}
+					/*If it matches; is it the *end* match?*/
+					use_this = (ptr != NULL) && (0 == strcmp (ptr2, valstring));
+					break;
+				case GNM_STYLE_COND_NOT_ENDS_WITH_STR :
+					/*gedanken experiment: valuestr="foofoo"; cvstring="foo"
+					 * This loop solves the problem.
+					 *First, make sure ptr2 is NULL in case it never gets assigned*/
+					ptr2 = NULL;
+					while ((ptr = strstr (cvstring,valstring))) {
+						/*ptr2 will point to the beginning of the last match*/
+						ptr2 = ptr;
+					}
+					/*If it matches; is it the *end* match?*/
+					use_this = (ptr == NULL) || (0 != strcmp (ptr2, valstring));
+					break;
 				}
-				/*If it matches; is it the *end* match?*/
-				use_this = (ptr == NULL) || (0 != strcmp (ptr2, valstring));
-				break;
-			case GNM_STYLE_COND_CONTAINS_BLANKS :
-				use_this = NULL != strpbrk (cvstring, BLANKS_STRING_FOR_MATCHING);
-				break;
-			case GNM_STYLE_COND_NOT_CONTAINS_BLANKS :
-				use_this = NULL == strpbrk (cvstring, BLANKS_STRING_FOR_MATCHING);
-				break;
 			}
+			value_release (val);
 		}
 
-		value_release (val);
 		if (use_this)
 			return i;
 	}
diff --git a/src/style-conditions.h b/src/style-conditions.h
index 0a12cea..5a9fc54 100644
--- a/src/style-conditions.h
+++ b/src/style-conditions.h
@@ -43,6 +43,7 @@ typedef struct {
 } GnmStyleCond;
 
 GnmStyleConditions *gnm_style_conditions_new  (void);
+GnmStyleConditions *gnm_style_conditions_dup  (GnmStyleConditions const *cond);
 GArray const *gnm_style_conditions_details (GnmStyleConditions const *sc);
 void	      gnm_style_conditions_insert  (GnmStyleConditions *sc,
 					    GnmStyleCond const *cond,
diff --git a/src/wbc-gtk-actions.c b/src/wbc-gtk-actions.c
index e56ad14..94c3ce9 100644
--- a/src/wbc-gtk-actions.c
+++ b/src/wbc-gtk-actions.c
@@ -924,6 +924,7 @@ static GNM_ACTION_DEF (cb_sheet_name)
 static GNM_ACTION_DEF (cb_sheet_order)		{ dialog_sheet_order (wbcg); }
 static GNM_ACTION_DEF (cb_sheet_resize)		{ dialog_sheet_resize (wbcg); }
 static GNM_ACTION_DEF (cb_format_cells)		{ dialog_cell_format (wbcg, FD_CURRENT); }
+static GNM_ACTION_DEF (cb_format_cells_cond)    { dialog_cell_format_cond (wbcg); }
 static GNM_ACTION_DEF (cb_autoformat)		{ dialog_autoformat (wbcg); }
 static GNM_ACTION_DEF (cb_workbook_attr)	{ dialog_workbook_attr (wbcg); }
 static GNM_ACTION_DEF (cb_tools_plugins)	{ dialog_plugin_manager (wbcg); }
@@ -2297,8 +2298,11 @@ static GtkActionEntry const actions[] = {
 
 /* Format -> Cells */
 	{ "FormatCells", NULL, N_("_Format..."),
-		"<control>1", N_("Modify the formatting of the selected cells"),
-		G_CALLBACK (cb_format_cells) },
+	  "<control>1", N_("Modify the formatting of the selected cells"),
+	  G_CALLBACK (cb_format_cells) },
+	{ "FormatCellsCond", NULL, N_("_Conditional Formating..."), NULL, 
+	  N_("Modify the conditional formatting of the selected cells"),
+	  G_CALLBACK (cb_format_cells_cond) },
 	{ "FormatCellsFitHeight", "Gnumeric_RowSize", N_("Auto Fit _Height"), NULL,
 	  N_("Ensure rows are just tall enough to display content of selection"),
 	  G_CALLBACK (cb_format_cells_auto_fit_height) },



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