[gnumeric] Combine the two conditional style dialogs into a single dialog



commit 4133d188c1cdb39357af3f5428013273eb186e81
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Sat Jul 9 21:00:21 2011 -0600

    Combine the two conditional style dialogs into a single dialog
    
    2011-07-09 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* Makefile.am: remove cell-format-cond-def.ui
    	* cell-format-cond-def.ui: deleted (combined into cell-format-cond.ui)
    	* cell-format-cond.ui: extended
    	* dialog-cell-format-cond.c: combine both dialogs into a single dialog
    
    2011-07-09 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* POTFILES.in: remove cell-format-cond-def.ui

 po-functions/ChangeLog                |    4 +
 po-functions/POTFILES.in              |    1 -
 po/ChangeLog                          |    4 +
 po/POTFILES.in                        |    1 -
 src/dialogs/ChangeLog                 |    7 +
 src/dialogs/Makefile.am               |    1 -
 src/dialogs/cell-format-cond-def.ui   |  400 -------------------------
 src/dialogs/cell-format-cond.ui       |  455 +++++++++++++++++++++++++----
 src/dialogs/dialog-cell-format-cond.c |  519 ++++++++++++++-------------------
 9 files changed, 634 insertions(+), 758 deletions(-)
---
diff --git a/po-functions/ChangeLog b/po-functions/ChangeLog
index f483cc6..36a886c 100644
--- a/po-functions/ChangeLog
+++ b/po-functions/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-09 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* POTFILES.in: remove cell-format-cond-def.ui
+
 2011-07-06 Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* POTFILES.in: add forgotten file
diff --git a/po-functions/POTFILES.in b/po-functions/POTFILES.in
index 68886b4..2866286 100644
--- a/po-functions/POTFILES.in
+++ b/po-functions/POTFILES.in
@@ -149,7 +149,6 @@ src/dialogs/dialog-zoom.c
 [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/ChangeLog b/po/ChangeLog
index 9029383..e694f9c 100644
--- a/po/ChangeLog
+++ b/po/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-09 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* POTFILES.in: remove cell-format-cond-def.ui
+
 2011-07-06 Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* POTFILES.in: add forgotten files
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 47e9858..26e46c2 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -212,7 +212,6 @@ src/dialogs/dialog-zoom.c
 [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/dialogs/ChangeLog b/src/dialogs/ChangeLog
index a7389f9..cd46040 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,10 @@
+2011-07-09 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* Makefile.am: remove cell-format-cond-def.ui
+	* cell-format-cond-def.ui: deleted (combined into cell-format-cond.ui)
+	* cell-format-cond.ui: extended
+	* dialog-cell-format-cond.c: combine both dialogs into a single dialog
+
 2011-07-08  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* dialog-cell-format-cond.c (c_fmt_dialog_condition_setter_tiled):
diff --git a/src/dialogs/Makefile.am b/src/dialogs/Makefile.am
index 5ce4b85..0058331 100644
--- a/src/dialogs/Makefile.am
+++ b/src/dialogs/Makefile.am
@@ -105,7 +105,6 @@ ui_DATA = 				\
 	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.ui b/src/dialogs/cell-format-cond.ui
index 523efd1..cf2e741 100644
--- a/src/dialogs/cell-format-cond.ui
+++ b/src/dialogs/cell-format-cond.ui
@@ -71,57 +71,58 @@
           </packing>
         </child>
         <child>
-          <object class="GtkTable" id="condition-table">
+          <object class="GtkHBox" id="hbox1">
             <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">
+              <object class="GtkTable" id="condition-view-table">
                 <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>
+                <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>
+                    <property name="wrap">True</property>
+                  </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>
                 <child>
-                  <object class="GtkTreeView" id="conditions_treeview">
+                  <object class="GtkScrolledWindow" id="scrolledwindow1">
+                    <property name="height_request">250</property>
                     <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>
+                    <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>
-              </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>
+                      <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>
@@ -150,13 +151,13 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkButton" id="conditions_clear">
-                        <property name="label">gtk-clear</property>
+                      <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_stock">True</property>
+                        <property name="use_underline">True</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -164,24 +165,356 @@
                         <property name="position">2</property>
                       </packing>
                     </child>
+                  </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>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkVSeparator" id="vseparator1">
+                <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>
+            <child>
+              <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="x_options">GTK_SHRINK | GTK_FILL</property>
+                        <property name="y_options">GTK_SHRINK | GTK_FILL</property>
+                      </packing>
+                    </child>
                     <child>
-                      <object class="GtkButton" id="conditions_expand">
-                        <property name="label" translatable="yes">E_xpand</property>
+                      <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>
+                      <object class="GtkLabel" id="label4">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">1</property>
+                        <property name="label">x:</property>
+                      </object>
+                      <packing>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                        <property name="x_options">GTK_SHRINK | GTK_FILL</property>
+                        <property name="y_options">GTK_SHRINK | GTK_FILL</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label5">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">1</property>
+                        <property name="label">y:</property>
+                      </object>
+                      <packing>
+                        <property name="top_attach">3</property>
+                        <property name="bottom_attach">4</property>
+                        <property name="x_options">GTK_SHRINK | GTK_FILL</property>
+                        <property name="y_options">GTK_SHRINK | GTK_FILL</property>
+                      </packing>
+                    </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="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="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="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="check-background">
+                        <property name="label" translatable="yes">Background</property>
+                        <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="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="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="vbox2">
+                    <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="hbox3">
+                        <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>
+                          </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="hbuttonbox4">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="layout_style">end</property>
+                        <child>
+                          <object class="GtkButton" id="edit-style-button">
+                            <property name="label" translatable="yes">_Edit Style</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="image">image1</property>
+                            <property name="use_underline">True</property>
+                            <property name="yalign">0.52999997138977051</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</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">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkHButtonBox" id="hbuttonbox3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="border_width">5</property>
+                    <property name="spacing">5</property>
+                    <property name="layout_style">end</property>
+                    <child>
+                      <object class="GtkButton" id="replace-button">
+                        <property name="label">Re_place</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="image">image2</property>
                         <property name="use_underline">True</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">False</property>
-                        <property name="position">3</property>
+                        <property name="position">0</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkButton" id="conditions_edit">
-                        <property name="label">gtk-edit</property>
+                      <object class="GtkButton" id="add-button">
+                        <property name="label">gtk-add</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
@@ -191,21 +524,23 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">False</property>
-                        <property name="position">4</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>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="padding">3</property>
+                    <property name="position">3</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>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="padding">6</property>
+                <property name="position">2</property>
               </packing>
             </child>
           </object>
@@ -222,4 +557,24 @@
       <action-widget response="0">closebutton</action-widget>
     </action-widgets>
   </object>
+  <object class="GtkImage" id="image1">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-edit</property>
+  </object>
+  <object class="GtkImage" id="image2">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-convert</property>
+  </object>
+  <object class="GtkListStore" id="liststore1">
+    <columns>
+      <!-- column-name gchararray1 -->
+      <column type="gchararray"/>
+      <!-- column-name type -->
+      <column type="gint"/>
+      <!-- column-name n_expressions -->
+      <column type="gint"/>
+    </columns>
+  </object>
 </interface>
diff --git a/src/dialogs/dialog-cell-format-cond.c b/src/dialogs/dialog-cell-format-cond.c
index 1818d63..e23422e 100644
--- a/src/dialogs/dialog-cell-format-cond.c
+++ b/src/dialogs/dialog-cell-format-cond.c
@@ -65,11 +65,9 @@ typedef struct _CFormatState {
 	gboolean         homogeneous;
 	GnmStyle	*style;
 
-	GtkButton       *add;
 	GtkButton       *remove;
 	GtkButton       *clear;
 	GtkButton       *expand;
-	GtkButton       *edit;
 	GtkLabel        *label;
 	GtkTreeView     *treeview;
 	GtkTreeStore    *model;
@@ -83,23 +81,19 @@ typedef struct _CFormatState {
 		GnmStyle *old_style;
 		gboolean  existing_conds_only;
 	} action;
+	struct {
+		GtkWidget	*edit_style_button;
+		GtkWidget	*add_button;
+		GtkWidget	*replace_button;
+		GtkWidget	*combo;
+		GtkWidget       *expr_x;
+		GtkWidget       *expr_y;
+		GtkListStore    *typestore;
+		GnmStyle        *style;
+		GtkWidget       *style_label;
+	} editor;
 } CFormatState;
 
-typedef struct _CFormatChooseState {
-	CFormatState    *cf_state;
-	GtkBuilder	*gui;
-	GtkDialog	*dialog;
-	GtkWidget	*cancel_button;
-	GtkWidget	*ok_button;
-	GtkWidget	*new_button;
-	GtkWidget	*combo;
-	GtkWidget       *expr_x;
-	GtkWidget       *expr_y;
-	GtkListStore    *typestore;
-	GnmStyle        *style;
-	GtkWidget       *style_label;
-} CFormatChooseState;
-
 enum {
 	CONDITIONS_RANGE,
 	CONDITIONS_COND,
@@ -116,10 +110,19 @@ static void c_fmt_dialog_update_buttons (CFormatState *state);
 
 /*****************************************************************************/
 
+/* 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_chooser_destroy (CFormatChooseState *state)
+cb_c_fmt_dialog_dialog_destroy (CFormatState *state)
 {
+	if (state->editor.style)
+		gnm_style_unref (state->editor.style);
 	if (state->style)
 		gnm_style_unref (state->style);
 	g_object_unref (G_OBJECT (state->gui));
@@ -127,29 +130,31 @@ cb_c_fmt_dialog_chooser_destroy (CFormatChooseState *state)
 }
 
 static void
-cb_dialog_chooser_destroy (GtkDialog *dialog)
+cb_dialog_destroy (GtkDialog *dialog)
 {
 	g_object_set_data (G_OBJECT (dialog), "state", NULL);
 }
 
+/*****************************************************************************/
+
 static void
-c_fmt_dialog_set_sensitive (CFormatChooseState *state)
+c_fmt_dialog_set_sensitive (CFormatState *state)
 {
-	gboolean ok = (state->style != NULL);
+	gboolean ok = (state->editor.style != NULL);
 	GnmParsePos pp;
 
-	parse_pos_init_editpos (&pp, state->cf_state->sv);
+	parse_pos_init_editpos (&pp, state->sv);
 
-	if (ok && gtk_widget_get_sensitive (state->expr_x)) {
-		GnmExprTop const *texpr = gnm_expr_entry_parse (GNM_EXPR_ENTRY (state->expr_x), &pp,
+	if (ok && gtk_widget_get_sensitive (state->editor.expr_x)) {
+		GnmExprTop const *texpr = gnm_expr_entry_parse (GNM_EXPR_ENTRY (state->editor.expr_x), &pp,
 								NULL, FALSE,
 								GNM_EXPR_PARSE_UNKNOWN_NAMES_ARE_STRINGS);
 		ok = (texpr != NULL);
 		if (texpr)
 			gnm_expr_top_unref (texpr);
 	}
-	if (ok && gtk_widget_get_sensitive (state->expr_y)) {
-		GnmExprTop const *texpr = gnm_expr_entry_parse (GNM_EXPR_ENTRY (state->expr_y), &pp,
+	if (ok && gtk_widget_get_sensitive (state->editor.expr_y)) {
+		GnmExprTop const *texpr = gnm_expr_entry_parse (GNM_EXPR_ENTRY (state->editor.expr_y), &pp,
 								NULL, FALSE,
 								GNM_EXPR_PARSE_UNKNOWN_NAMES_ARE_STRINGS);
 		ok = (texpr != NULL);
@@ -157,41 +162,41 @@ c_fmt_dialog_set_sensitive (CFormatChooseState *state)
 			gnm_expr_top_unref (texpr);
 	}
 	
-	gtk_widget_set_sensitive (state->ok_button, ok);
+	gtk_widget_set_sensitive (state->editor.add_button, ok);
 }
 
 static void
-c_fmt_dialog_set_expr_sensitive (CFormatChooseState *state)
+c_fmt_dialog_set_expr_sensitive (CFormatState *state)
 {
 	GtkTreeIter iter;
 	gint n_expr = 0;
 
-	if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (state->combo), &iter))
-		gtk_tree_model_get (GTK_TREE_MODEL (state->typestore),
+	if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (state->editor.combo), &iter))
+		gtk_tree_model_get (GTK_TREE_MODEL (state->editor.typestore),
 				    &iter,
 				    2, &n_expr,
 				    -1);
 	if (n_expr < 1) {
-		gtk_widget_set_sensitive (state->expr_x, FALSE);
-		gtk_entry_set_text (gnm_expr_entry_get_entry (GNM_EXPR_ENTRY (state->expr_x)), "");
+		gtk_widget_set_sensitive (state->editor.expr_x, FALSE);
+		gtk_entry_set_text (gnm_expr_entry_get_entry (GNM_EXPR_ENTRY (state->editor.expr_x)), "");
 	} else
-		gtk_widget_set_sensitive (state->expr_x, TRUE);
+		gtk_widget_set_sensitive (state->editor.expr_x, TRUE);
 	if (n_expr < 2) {
-		gtk_widget_set_sensitive (state->expr_y, FALSE);
-		gtk_entry_set_text (gnm_expr_entry_get_entry (GNM_EXPR_ENTRY (state->expr_y)), "");
+		gtk_widget_set_sensitive (state->editor.expr_y, FALSE);
+		gtk_entry_set_text (gnm_expr_entry_get_entry (GNM_EXPR_ENTRY (state->editor.expr_y)), "");
 	} else
-		gtk_widget_set_sensitive (state->expr_y, TRUE);
+		gtk_widget_set_sensitive (state->editor.expr_y, TRUE);
 }
 
 static void
-cb_c_fmt_dialog_chooser_type_changed (G_GNUC_UNUSED GtkComboBox *widget, CFormatChooseState *state)
+cb_c_fmt_dialog_chooser_type_changed (G_GNUC_UNUSED GtkComboBox *widget, CFormatState *state)
 {
 	c_fmt_dialog_set_expr_sensitive (state);
 	c_fmt_dialog_set_sensitive (state);
 }
 
 static void
-cb_c_fmt_dialog_chooser_entry_changed (G_GNUC_UNUSED GnmExprEntry *widget, CFormatChooseState *state)
+cb_c_fmt_dialog_chooser_entry_changed (G_GNUC_UNUSED GnmExprEntry *widget, CFormatState *state)
 {
 	c_fmt_dialog_set_sensitive (state);
 }
@@ -199,18 +204,18 @@ cb_c_fmt_dialog_chooser_entry_changed (G_GNUC_UNUSED GnmExprEntry *widget, CForm
 void     
 dialog_cell_format_style_added (gpointer closure, GnmStyle *style)
 {
-	CFormatChooseState *state = closure;
+	CFormatState *state = closure;
 	
-	if (state->style)
-		gnm_style_unref (state->style);
-	state->style = style;
-	gtk_label_set_text (GTK_LABEL (state->style_label), 
+	if (state->editor.style)
+		gnm_style_unref (state->editor.style);
+	state->editor.style = style;
+	gtk_label_set_text (GTK_LABEL (state->editor.style_label), 
 			    style ? _("(defined)") : _("undefined"));
 	c_fmt_dialog_set_sensitive (state);
 }
 
 static gint
-cb_c_fmt_dialog_chooser_check_page (CFormatChooseState *state, gchar const *name,
+cb_c_fmt_dialog_chooser_check_page (CFormatState *state, gchar const *name,
 				    gint page)
 {
 	GtkWidget *w = go_gtk_builder_get_widget (state->gui, name);
@@ -222,7 +227,7 @@ cb_c_fmt_dialog_chooser_check_page (CFormatChooseState *state, gchar const *name
 }
 
 static void
-cb_c_fmt_dialog_chooser_new_button (G_GNUC_UNUSED GtkWidget *btn, CFormatChooseState *state)
+cb_c_fmt_dialog_edit_style_button (G_GNUC_UNUSED GtkWidget *btn, CFormatState *state)
 {
 	int pages = 0;
 	pages |= cb_c_fmt_dialog_chooser_check_page 
@@ -240,127 +245,124 @@ cb_c_fmt_dialog_chooser_new_button (G_GNUC_UNUSED GtkWidget *btn, CFormatChooseS
 	pages |= cb_c_fmt_dialog_chooser_check_page 
 		(state, "check-validation", FD_VALIDATION);
 
-	dialog_cell_format_select_style (state->cf_state->wbcg, pages, 
+	dialog_cell_format_select_style (state->wbcg, pages, 
 					 GTK_WINDOW (state->dialog), state);
 }
 
 static void
-cb_c_fmt_dialog_chooser_buttons (GtkWidget *btn, CFormatChooseState *state)
+cb_c_fmt_dialog_add_button (GtkWidget *btn, CFormatState *state)
 {
-	if (btn == state->ok_button) {
-		GnmStyleCond *cond = g_new0(GnmStyleCond, 1);
-		GtkTreeIter iter;
-		gint n_expr = 0;
-		GnmParsePos pp;
-
-		parse_pos_init_editpos (&pp, state->cf_state->sv);
-
-		cond->overlay = gnm_style_new ();
-		if (state->style) {
-			if (cb_c_fmt_dialog_chooser_check_page 
-			    (state, "check-background", FD_BACKGROUND)) {
-				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 (cb_c_fmt_dialog_chooser_check_page 
-			    (state, "check-number", FD_NUMBER)) {
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_FORMAT);
-			}
-			if (cb_c_fmt_dialog_chooser_check_page 
-			    (state, "check-align", FD_ALIGNMENT)) {
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_ALIGN_V);
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_ALIGN_H);
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_INDENT);
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_ROTATION);
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_TEXT_DIR);
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_WRAP_TEXT);
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_SHRINK_TO_FIT);
-			}
-			if (cb_c_fmt_dialog_chooser_check_page 
-			    (state, "check-font", FD_FONT)) {
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_FONT_COLOR);
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_FONT_NAME);
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_FONT_BOLD);
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_FONT_ITALIC);
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_FONT_UNDERLINE);
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_FONT_STRIKETHROUGH);
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_FONT_SCRIPT);
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_FONT_SIZE);
-			}
-			if (cb_c_fmt_dialog_chooser_check_page 
-			     (state, "check-border", FD_BORDER)) {
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_BORDER_TOP);
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_BORDER_BOTTOM);
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_BORDER_LEFT);
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_BORDER_RIGHT);
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_BORDER_REV_DIAGONAL);
-				gnm_style_merge_element (cond->overlay, state->style, 
-							 MSTYLE_BORDER_DIAGONAL);
-			}
-			if (cb_c_fmt_dialog_chooser_check_page 
-			    (state, "check-protection", FD_PROTECTION)) {
+	GnmStyleCond *cond = g_new0(GnmStyleCond, 1);
+	GtkTreeIter iter;
+	gint n_expr = 0;
+	GnmParsePos pp;
 
-			}
-			if (cb_c_fmt_dialog_chooser_check_page 
-			    (state, "check-validation", FD_VALIDATION)) {
+	parse_pos_init_editpos (&pp, state->sv);
 
-			}
+	cond->overlay = gnm_style_new ();
+	if (state->editor.style) {
+		if (cb_c_fmt_dialog_chooser_check_page 
+		    (state, "check-background", FD_BACKGROUND)) {
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_COLOR_BACK);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_COLOR_PATTERN);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_PATTERN);
+		}
+		if (cb_c_fmt_dialog_chooser_check_page 
+		    (state, "check-number", FD_NUMBER)) {
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_FORMAT);
+		}
+		if (cb_c_fmt_dialog_chooser_check_page 
+		    (state, "check-align", FD_ALIGNMENT)) {
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_ALIGN_V);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_ALIGN_H);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_INDENT);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_ROTATION);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_TEXT_DIR);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_WRAP_TEXT);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_SHRINK_TO_FIT);
 		}
-		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,
-					    2, &n_expr,
-					    -1);
-		else
-			cond->op = GNM_STYLE_COND_CONTAINS_ERR;
-
-		if (n_expr > 0) {
-			GnmExprTop const *texpr = gnm_expr_entry_parse (GNM_EXPR_ENTRY (state->expr_x), &pp,
-									NULL, FALSE,
-									GNM_EXPR_PARSE_UNKNOWN_NAMES_ARE_STRINGS);
-			cond->texpr[0] = texpr;
+		if (cb_c_fmt_dialog_chooser_check_page 
+		    (state, "check-font", FD_FONT)) {
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_FONT_COLOR);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_FONT_NAME);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_FONT_BOLD);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_FONT_ITALIC);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_FONT_UNDERLINE);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_FONT_STRIKETHROUGH);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_FONT_SCRIPT);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_FONT_SIZE);
 		}
-		if (n_expr > 1) {
-			GnmExprTop const *texpr = gnm_expr_entry_parse (GNM_EXPR_ENTRY (state->expr_y), &pp,
-									NULL, FALSE,
-									GNM_EXPR_PARSE_UNKNOWN_NAMES_ARE_STRINGS);
-			cond->texpr[1] = texpr;
+		if (cb_c_fmt_dialog_chooser_check_page 
+		    (state, "check-border", FD_BORDER)) {
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_BORDER_TOP);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_BORDER_BOTTOM);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_BORDER_LEFT);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_BORDER_RIGHT);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_BORDER_REV_DIAGONAL);
+			gnm_style_merge_element (cond->overlay, state->editor.style, 
+						 MSTYLE_BORDER_DIAGONAL);
 		}
+		if (cb_c_fmt_dialog_chooser_check_page 
+		    (state, "check-protection", FD_PROTECTION)) {
 
-		c_fmt_dialog_apply_add_choice (state->cf_state, cond);
-		g_free (cond);
+		}
+		if (cb_c_fmt_dialog_chooser_check_page 
+		    (state, "check-validation", FD_VALIDATION)) {
+
+		}
+	}
+	if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (state->editor.combo), &iter))
+		gtk_tree_model_get (GTK_TREE_MODEL (state->editor.typestore),
+				    &iter,
+				    1, &cond->op,
+				    2, &n_expr,
+				    -1);
+	else
+		cond->op = GNM_STYLE_COND_CONTAINS_ERR;
+
+	if (n_expr > 0) {
+		GnmExprTop const *texpr = gnm_expr_entry_parse (GNM_EXPR_ENTRY (state->editor.expr_x), &pp,
+								NULL, FALSE,
+								GNM_EXPR_PARSE_UNKNOWN_NAMES_ARE_STRINGS);
+		cond->texpr[0] = texpr;
+	}
+	if (n_expr > 1) {
+		GnmExprTop const *texpr = gnm_expr_entry_parse (GNM_EXPR_ENTRY (state->editor.expr_y), &pp,
+								NULL, FALSE,
+								GNM_EXPR_PARSE_UNKNOWN_NAMES_ARE_STRINGS);
+		cond->texpr[1] = texpr;
 	}
-	gtk_widget_destroy (GTK_WIDGET (state->dialog));
+
+	c_fmt_dialog_apply_add_choice (state, cond);
+	g_free (cond);
 }
 
 static void	
-c_fmt_dialog_chooser_load_combo (CFormatChooseState *state)
+c_fmt_dialog_chooser_load_combo (CFormatState *state)
 {
 	static struct {
 		char const *label;
@@ -395,117 +397,21 @@ c_fmt_dialog_chooser_load_combo (CFormatChooseState *state)
 	GtkTreeIter iter;
 
 	for (i = 0; i < G_N_ELEMENTS (cond_types); i++)
-		gtk_list_store_insert_with_values (state->typestore,
+		gtk_list_store_insert_with_values (state->editor.typestore,
 						   NULL, G_MAXINT,
                                                    0, _(cond_types[i].label),
 						   1, cond_types[i].type,
 						   2, cond_types[i].n_expressions,
 						   -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);
+	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(state->editor.combo), cell, TRUE);
+	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(state->editor.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;
-	GtkTable  *table;
-
-	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");
-	table = GTK_TABLE (go_gtk_builder_get_widget (state->gui, "condition-table"));
-	state->expr_x = GTK_WIDGET (gnm_expr_entry_new (state->cf_state->wbcg, FALSE));
-	gtk_table_attach (table, state->expr_x, 1, 2, 2, 3, 
-			  GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
-	gtk_widget_show(state->expr_x);
-	gnm_expr_entry_set_flags (GNM_EXPR_ENTRY (state->expr_x),
-				  GNM_EE_CONSTANT_ALLOWED,
-				  GNM_EE_MASK);
-
-	state->expr_y = GTK_WIDGET (gnm_expr_entry_new (state->cf_state->wbcg, FALSE));
-	gtk_table_attach (table, state->expr_y, 1, 2, 3, 4, 
-			  GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
-	gtk_widget_show(state->expr_y);
-	gnm_expr_entry_set_flags (GNM_EXPR_ENTRY (state->expr_y),
-				  GNM_EE_CONSTANT_ALLOWED,
-				  GNM_EE_MASK);
-
-	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_expr_sensitive (state);
-	c_fmt_dialog_set_sensitive (state);
-
-	gnumeric_restore_window_geometry (GTK_WINDOW (state->dialog),
-					  CELL_FORMAT_DEF_KEY);
+	    (GTK_TREE_MODEL (state->editor.typestore), &iter))
+		gtk_combo_box_set_active_iter (GTK_COMBO_BOX (state->editor.combo), &iter);
 
-	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_signal_connect (G_OBJECT (state->combo),
-		"changed",
-		G_CALLBACK (cb_c_fmt_dialog_chooser_type_changed), state);
-	g_signal_connect (G_OBJECT (state->expr_x),
-		"changed",
-		G_CALLBACK (cb_c_fmt_dialog_chooser_entry_changed), state);
-	g_signal_connect (G_OBJECT (state->expr_y),
-		"changed",
-		G_CALLBACK (cb_c_fmt_dialog_chooser_entry_changed), 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
@@ -616,13 +522,6 @@ c_fmt_dialog_apply_add_choice (CFormatState *state, GnmStyleCond *cond)
 }
 
 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_clear_clicked (G_GNUC_UNUSED GtkButton *button, CFormatState *state)
 {
 	state->action.new_style = gnm_style_new ();
@@ -704,13 +603,6 @@ cb_c_fmt_dialog_expand_clicked (G_GNUC_UNUSED GtkButton *button, CFormatState *s
 }
 
 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)
 {
@@ -1029,13 +921,10 @@ c_fmt_dialog_update_buttons (CFormatState *state)
 	
 	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
@@ -1066,6 +955,59 @@ cb_c_format_dialog_range (SheetView *sv, GnmRange const *range, GString *str)
 }
 
 static void
+c_fmt_dialog_init_editor_page (CFormatState *state)
+{
+	GtkTable  *table;
+
+	state->editor.add_button = go_gtk_builder_get_widget (state->gui, "add-button");
+	state->editor.edit_style_button = go_gtk_builder_get_widget (state->gui, "edit-style-button");
+	state->editor.combo = go_gtk_builder_get_widget (state->gui, "condition-combo");
+	table = GTK_TABLE (go_gtk_builder_get_widget (state->gui, "condition-table"));
+	state->editor.expr_x = GTK_WIDGET (gnm_expr_entry_new (state->wbcg, FALSE));
+	gtk_table_attach (table, state->editor.expr_x, 1, 2, 2, 3, 
+			  GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+	gtk_widget_show(state->editor.expr_x);
+	gnm_expr_entry_set_flags (GNM_EXPR_ENTRY (state->editor.expr_x),
+				  GNM_EE_CONSTANT_ALLOWED,
+				  GNM_EE_MASK);
+
+	state->editor.expr_y = GTK_WIDGET (gnm_expr_entry_new (state->wbcg, FALSE));
+	gtk_table_attach (table, state->editor.expr_y, 1, 2, 3, 4, 
+			  GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+	gtk_widget_show(state->editor.expr_y);
+	gnm_expr_entry_set_flags (GNM_EXPR_ENTRY (state->editor.expr_y),
+				  GNM_EE_CONSTANT_ALLOWED,
+				  GNM_EE_MASK);
+
+	state->editor.typestore = GTK_LIST_STORE (gtk_combo_box_get_model 
+					   (GTK_COMBO_BOX (state->editor.combo)));
+	c_fmt_dialog_chooser_load_combo (state);
+	
+	state->editor.style_label = go_gtk_builder_get_widget (state->gui, "style-label");
+	gtk_label_set_text (GTK_LABEL (state->editor.style_label), _("(undefined)"));
+
+	c_fmt_dialog_set_expr_sensitive (state);
+	c_fmt_dialog_set_sensitive (state);
+
+	g_signal_connect (G_OBJECT (state->editor.add_button),
+		"clicked",
+		G_CALLBACK (cb_c_fmt_dialog_add_button), state);
+	g_signal_connect (G_OBJECT (state->editor.edit_style_button),
+		"clicked",
+		G_CALLBACK (cb_c_fmt_dialog_edit_style_button), state);
+	g_signal_connect (G_OBJECT (state->editor.combo),
+		"changed",
+		G_CALLBACK (cb_c_fmt_dialog_chooser_type_changed), state);
+	g_signal_connect (G_OBJECT (state->editor.expr_x),
+		"changed",
+		G_CALLBACK (cb_c_fmt_dialog_chooser_entry_changed), state);
+	g_signal_connect (G_OBJECT (state->editor.expr_y),
+		"changed",
+		G_CALLBACK (cb_c_fmt_dialog_chooser_entry_changed), state);
+	
+}
+
+static void
 c_fmt_dialog_init_conditions_page (CFormatState *state)
 {
 	GtkTreeViewColumn * column;
@@ -1075,9 +1017,6 @@ c_fmt_dialog_init_conditions_page (CFormatState *state)
 
 	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);
@@ -1087,9 +1026,6 @@ c_fmt_dialog_init_conditions_page (CFormatState *state)
 	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,
@@ -1131,45 +1067,16 @@ c_fmt_dialog_init_conditions_page (CFormatState *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->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)
@@ -1190,7 +1097,8 @@ dialog_cell_format_cond (WBCGtk *wbcg)
 	state->gui	= gui;
 	state->sv	= wb_control_cur_sheet_view (WORKBOOK_CONTROL (wbcg));
 	state->sheet	= sv_sheet (state->sv);
-	state->style		= NULL;
+	state->style	= NULL;
+	state->editor.style = NULL;
 
 	dialog = go_gtk_builder_get_widget (state->gui, "CellFormat");
 	g_return_if_fail (dialog != NULL);
@@ -1201,6 +1109,7 @@ dialog_cell_format_cond (WBCGtk *wbcg)
 	state->dialog	   = GTK_DIALOG (dialog);
 
 	c_fmt_dialog_init_conditions_page (state);
+	c_fmt_dialog_init_editor_page (state);
 
 	gnumeric_init_help_button (
 		go_gtk_builder_get_widget (state->gui, "helpbutton"),



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