[gcalctool] More UI refactoring...



commit 2bbf30c13fe7ee5d03009981a1fd7e9ae05185c9
Author: Robert Ancell <robert ancell gmail com>
Date:   Sun Apr 4 16:12:48 2010 +1000

    More UI refactoring...

 data/Makefile.am            |   11 +-
 data/buttons-financial.ui   | 1920 ++++++++++++++++++++++++++++++++++++++++++
 data/buttons-programming.ui |   95 +++
 data/dialogs.ui             |  412 ---------
 data/financial.ui           | 1925 -------------------------------------------
 data/gcalctool.ui           |    2 +-
 src/ui-buttons.c            |  241 ++++--
 src/ui-buttons.h            |   40 +
 src/ui-display.c            |  108 ++-
 src/ui-display.h            |   28 +
 src/ui-financial.c          |   72 +-
 src/ui-internal.h           |    2 -
 src/ui-preferences.c        |   84 +-
 src/ui-preferences.h        |   13 +-
 src/ui.c                    |  215 ++----
 src/ui.h                    |   68 +--
 16 files changed, 2473 insertions(+), 2763 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index 0995645..4ec30f6 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,12 +1,11 @@
 uidir = $(datadir)/gcalctool
 ui_DATA = \
 	gcalctool.ui \
-	dialogs.ui \
-	financial.ui \
-    buttons-basic.ui \
-    buttons-advanced.ui \
-    buttons-financial.ui \
-    buttons-programming.ui
+	preferences.ui \
+	buttons-basic.ui \
+	buttons-advanced.ui \
+	buttons-financial.ui \
+	buttons-programming.ui
 
 schemadir   = @GCONF_SCHEMA_FILE_DIR@
 schema_in_files = gcalctool.schemas.in
diff --git a/data/buttons-financial.ui b/data/buttons-financial.ui
index f614203..6e26320 100644
--- a/data/buttons-financial.ui
+++ b/data/buttons-financial.ui
@@ -1187,4 +1187,1924 @@
       </object>
     </child>
   </object>
+  <object class="GtkDialog" id="ctrm_dialog">
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes" comments="Title of Compounding Term dialog">Compounding Term</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <property name="has_separator">False</property>
+    <signal name="response" handler="finc_response_cb"/>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox1">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkTable" id="table1">
+            <property name="visible">True</property>
+            <property name="border_width">6</property>
+            <property name="n_rows">4</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">6</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <object class="GtkEntry" id="ctrm_pint">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="ctrm_fv">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="ctrm_pv">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label5">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Compounding Term Dialog: Label before present value input">Present _Value:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">ctrm_pv</property>
+              </object>
+              <packing>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label3">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Compounding Term Dialog: Label before periodic interest rate input">Periodic Interest _Rate:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">ctrm_pint</property>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label2">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes" comments="Compounding Term Dialog: Description of calculation">Calculates the number of compounding periods necessary to increase an investment of present value to a future value, at a fixed interest rate per compounding period.</property>
+                <property name="wrap">True</property>
+              </object>
+              <packing>
+                <property name="right_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label4">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Compounding Term Dialog: Label before future value input">_Future Value:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">ctrm_fv</property>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area1">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button1">
+                <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">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button2">
+                <property name="label" translatable="yes" comments="Compounding Term Dialog: Calculate button">C_alculate</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_underline">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="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">button1</action-widget>
+      <action-widget response="-5">button2</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkDialog" id="ddb_dialog">
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes" comments="Title of Double-Declining Depreciation dialog">Double-Declining Depreciation</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <property name="has_separator">False</property>
+    <signal name="response" handler="finc_response_cb"/>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox2">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkTable" id="table2">
+            <property name="visible">True</property>
+            <property name="border_width">6</property>
+            <property name="n_rows">4</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">6</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="label7">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes" comments="Double-Declining Depreciation Dialog: Description of calculation">Calculates the depreciation allowance on an asset for a specified period of time, using the double-declining balance method.</property>
+                <property name="wrap">True</property>
+              </object>
+              <packing>
+                <property name="right_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label8">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Double-Declining Depreciation Dialog: Label before cost input">C_ost:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">ddb_cost</property>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label10">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Double-Declining Depreciation Dialog: Label before life input">_Life:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">ddb_life</property>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="ddb_life">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="ddb_cost">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label11">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Double-Declining Depreciation Dialog: Label before period input">_Period:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">ddb_period</property>
+              </object>
+              <packing>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="ddb_period">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area2">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button3">
+                <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">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button4">
+                <property name="label" translatable="yes" comments="Double-Declining Depreciation Dialog: Calculate button">C_alculate</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_underline">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="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">button3</action-widget>
+      <action-widget response="-5">button4</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkDialog" id="fv_dialog">
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes" comments="Title of Future Value dialog">Future Value</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <property name="has_separator">False</property>
+    <signal name="response" handler="finc_response_cb"/>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox3">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkTable" id="table3">
+            <property name="visible">True</property>
+            <property name="border_width">6</property>
+            <property name="n_rows">4</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">6</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="label12">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes" comments="Future Value Dialog: Description of calculation">Calculates the future value of an investment based on a series of equal payments at a periodic interest rate over the number of payment periods in the term.</property>
+                <property name="wrap">True</property>
+              </object>
+              <packing>
+                <property name="right_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label13">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Future Value Dialog: Label before periodic payment input">_Periodic Payment:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">fv_pmt</property>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label14">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Future Value Dialog: Label before periodic interest rate input">Periodic Interest _Rate:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">fv_pint</property>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label15">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Future Value Dialog: Label before number of periods input">_Number of Periods:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">fv_n</property>
+              </object>
+              <packing>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="fv_n">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="fv_pint">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="fv_pmt">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area3">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button5">
+                <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">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button6">
+                <property name="label" translatable="yes" comments="Future Value Dialog: Calculate button">C_alculate</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_underline">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="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">button5</action-widget>
+      <action-widget response="-5">button6</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkDialog" id="gpm_dialog">
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes" comments="Title of Gross Profit Margin dialog">Gross Profit Margin</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <property name="has_separator">False</property>
+    <signal name="response" handler="finc_response_cb"/>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox10">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkTable" id="table10">
+            <property name="visible">True</property>
+            <property name="border_width">6</property>
+            <property name="n_rows">3</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">6</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="label47">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes" comments="Gross Profit Margin Dialog: Description of calculation">Calculates the resale price of a product, based on the product cost and the wanted gross profit margin.</property>
+                <property name="wrap">True</property>
+              </object>
+              <packing>
+                <property name="right_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label48">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Gross Profit Margin Dialog: Label before cost input">C_ost:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">gpm_cost</property>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label49">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Gross Profit Margin Dialog: Label before margin input">_Margin:</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="gpm_cost">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="gpm_margin">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area10">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button19">
+                <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">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button20">
+                <property name="label" translatable="yes" comments="Gross Profit Margin Dialog: Calculate button">C_alculate</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_underline">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="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">button19</action-widget>
+      <action-widget response="-5">button20</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkDialog" id="pmt_dialog">
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes" comments="Title of Periodic Payment dialog">Periodic Payment</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <property name="has_separator">False</property>
+    <signal name="response" handler="finc_response_cb"/>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox4">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkTable" id="table4">
+            <property name="visible">True</property>
+            <property name="border_width">6</property>
+            <property name="n_rows">4</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">6</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="label17">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Periodic Payment Dialog: Description of calculation">Calculates the amount of the periodic payment of a loan, where payments are made at the end of each payment period. </property>
+                <property name="wrap">True</property>
+              </object>
+              <packing>
+                <property name="right_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label18">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Periodic Payment Dialog: Label before principal input">_Principal:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">pmt_prin</property>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label19">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Periodic Payment Dialog: Label before periodic interest rate input">Periodic Interest _Rate:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">pmt_pint</property>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label20">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Periodic Payment Dialog: Label before term input">_Term:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">pmt_n</property>
+              </object>
+              <packing>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="pmt_prin">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="pmt_pint">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="pmt_n">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area4">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button7">
+                <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">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button8">
+                <property name="label" translatable="yes" comments="Periodic Payment Dialog: Calculate button">C_alculate</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_underline">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="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">button7</action-widget>
+      <action-widget response="-5">button8</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkDialog" id="pv_dialog">
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes" comments="Title of Present Value dialog">Present Value</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <property name="has_separator">False</property>
+    <signal name="response" handler="finc_response_cb"/>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox5">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkTable" id="table5">
+            <property name="visible">True</property>
+            <property name="border_width">6</property>
+            <property name="n_rows">4</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">6</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="label23">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Present Value Dialog: Description of calculation">Calculates the present value of an investment based on a series of equal payments discounted at a periodic interest rate over the number of payment periods in the term. </property>
+                <property name="wrap">True</property>
+              </object>
+              <packing>
+                <property name="right_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label24">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Present Value Dialog: Label before periodic payment input">_Periodic Payment:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">pv_pmt</property>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label25">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Present Value Dialog: Label before periodic interest rate input">Periodic Interest _Rate:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">pv_pint</property>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label26">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Present Value Dialog: Label before number of periods input">_Number of Periods:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">pv_n</property>
+              </object>
+              <packing>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="pv_pmt">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="pv_pint">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="pv_n">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area5">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button9">
+                <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">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button10">
+                <property name="label" translatable="yes" comments="Present Value Dialog: Calculate button">C_alculate</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_underline">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="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">button9</action-widget>
+      <action-widget response="-5">button10</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkDialog" id="rate_dialog">
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes" comments="Title of Periodic Interest Rate dialog">Periodic Interest Rate</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <property name="has_separator">False</property>
+    <signal name="response" handler="finc_response_cb"/>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox6">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkTable" id="table6">
+            <property name="visible">True</property>
+            <property name="border_width">6</property>
+            <property name="n_rows">4</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">6</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="label28">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Periodic Interest Rate Dialog: Description of calculation">Calculates the periodic interest necessary to increase an investment to a future value, over the number of compounding periods. </property>
+                <property name="wrap">True</property>
+              </object>
+              <packing>
+                <property name="right_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label29">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Periodic Interest Rate Dialog: Label before future value input">_Future Value:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">rate_fv</property>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label30">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Periodic Interest Rate Dialog: Label before present value input">Present _Value:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">rate_pv</property>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label31">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Periodic Interest Rate Dialog: Label before term input">_Term:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">rate_n</property>
+              </object>
+              <packing>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="rate_fv">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="rate_pv">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="rate_n">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area6">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button11">
+                <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">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button12">
+                <property name="label" translatable="yes" comments="Periodic Interest Rate Dialog: Calculate button">C_alculate</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_underline">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="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">button11</action-widget>
+      <action-widget response="-5">button12</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkDialog" id="sln_dialog">
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes" comments="Title of Straight-Line Depreciation dialog">Straight-Line Depreciation</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <property name="has_separator">False</property>
+    <signal name="response" handler="finc_response_cb"/>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox7">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkTable" id="table7">
+            <property name="visible">True</property>
+            <property name="border_width">6</property>
+            <property name="n_rows">4</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">6</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="label33">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Straight-Line Depreciation Dialog: Label before cost input">_Cost:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">sln_cost</property>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label34">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Straight-Line Depreciation Dialog: Label before salvage input">_Salvage:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">sln_salvage</property>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label35">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Straight-Line Depreciation Dialog: Label before life input">_Life:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">sln_life</property>
+              </object>
+              <packing>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="sln_life">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="sln_salvage">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="sln_cost">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label32">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Straight-Line Depreciation Dialog: Description of calculation">Calculates the straight-line depreciation of an asset for one period. The straight-line method of depreciation divides the depreciable cost evenly over the useful life of an asset. The useful life is the number of periods, typically years, over which an asset is depreciated. </property>
+                <property name="wrap">True</property>
+              </object>
+              <packing>
+                <property name="right_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area7">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button13">
+                <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">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button14">
+                <property name="label" translatable="yes" comments="Straight-Line Depreciation Dialog: Calculate button">C_alculate</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_underline">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="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">button13</action-widget>
+      <action-widget response="-5">button14</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkDialog" id="syd_dialog">
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes" comments="Title of Sum-of-the-Years'-Digits Depreciation dialog">Sum-of-the-Years'-Digits Depreciation</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <property name="has_separator">False</property>
+    <signal name="response" handler="finc_response_cb"/>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox8">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkTable" id="table8">
+            <property name="visible">True</property>
+            <property name="border_width">6</property>
+            <property name="n_rows">5</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">6</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="label37">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Sum-of-the-Years'-Digits Depreciation Dialog: Label before period input">_Period:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">syd_period</property>
+              </object>
+              <packing>
+                <property name="top_attach">4</property>
+                <property name="bottom_attach">5</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label38">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Sum-of-the-Years'-Digits Depreciation Dialog: Label before life input">_Life:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">syd_life</property>
+              </object>
+              <packing>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label39">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Sum-of-the-Years'-Digits Depreciation Dialog: Label before salvage input">_Salvage:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">syd_salvage</property>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label40">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Sum-of-the-Years'-Digits Depreciation Dialog: Label before cost input">_Cost:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">syd_cost</property>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="syd_cost">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="syd_salvage">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="syd_life">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="syd_period">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">4</property>
+                <property name="bottom_attach">5</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label41">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Sum-of-the-Years'-Digits Depreciation Dialog: Description of calculation">Calculates the depreciation allowance on an asset for a specified period of time, using the Sum-of-the-Years'-Digits method. This method of depreciation accelerates the rate of depreciation, so that more depreciation expense occurs in earlier periods than in later ones. The useful life is the number of periods, typically years, over which an asset is depreciated. </property>
+                <property name="wrap">True</property>
+              </object>
+              <packing>
+                <property name="right_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area8">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button15">
+                <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">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button16">
+                <property name="label" translatable="yes" comments="Sum-of-the-Years'-Digits Depreciation Dialog: Calculate result button">C_alculate</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_underline">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="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">button15</action-widget>
+      <action-widget response="-5">button16</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkDialog" id="term_dialog">
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes" comments="Title of Payment Period dialog">Payment Period</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <property name="has_separator">False</property>
+    <signal name="response" handler="finc_response_cb"/>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox9">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkTable" id="table9">
+            <property name="visible">True</property>
+            <property name="border_width">6</property>
+            <property name="n_rows">4</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">6</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <object class="GtkEntry" id="term_pint">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="term_fv">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="term_pmt">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="text">0</property>
+                <signal name="activate" handler="finc_activate_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label43">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Payment Period Dialog: Label before periodic interest rate input">Periodic Interest _Rate:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">term_pint</property>
+              </object>
+              <packing>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label44">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Payment Period Dialog: Label before future value input">Future _Value:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">term_fv</property>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label45">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Payment Period Dialog: Label before periodic payment input">_Periodic Payment:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">term_pmt</property>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label46">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes" comments="Payment Period Dialog: Description of calculation">Calculates the number of payment periods that are necessary during the term of an ordinary annuity, to accumulate a future value, at a periodic interest rate.</property>
+                <property name="wrap">True</property>
+              </object>
+              <packing>
+                <property name="right_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area9">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button17">
+                <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">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button18">
+                <property name="label" translatable="yes" comments="Payment Period Dialog: Button to calculate result">C_alculate</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_underline">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="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">button17</action-widget>
+      <action-widget response="-5">button18</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkDialog" id="currency_dialog">
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Currency Conversion</property>
+    <property name="type_hint">normal</property>
+    <property name="has_separator">False</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox11">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child>
+          <object class="GtkTable" id="table11">
+            <property name="visible">True</property>
+            <property name="border_width">6</property>
+            <property name="n_rows">3</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">6</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Converts between different currencies. Enter the amount and the currency you want to convert from on the upper row, and the currency you want to convert to on the lower row, and the amount will be displayed on the lower row.</property>
+                <property name="wrap">True</property>
+              </object>
+              <packing>
+                <property name="right_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkSpinButton" id="currency_amount_upper">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="adjustment">adjustment1</property>
+                <property name="digits">2</property>
+                <property name="numeric">True</property>
+                <signal name="value_changed" handler="currency_amount_cb"/>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkSpinButton" id="currency_amount_lower">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="adjustment">adjustment2</property>
+                <property name="digits">2</property>
+                <property name="numeric">True</property>
+                <signal name="value_changed" handler="currency_amount_cb"/>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkComboBox" id="currency_type_upper">
+                <property name="visible">True</property>
+                <signal name="changed" handler="currency_type_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkComboBox" id="currency_type_lower">
+                <property name="visible">True</property>
+                <signal name="changed" handler="currency_type_cb"/>
+              </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>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area11">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button22">
+                <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_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="button21">
+                <property name="label">C_alculate</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">1</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>
+      <action-widget response="-6">button22</action-widget>
+      <action-widget response="-5">button21</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="upper">999999999999</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment2">
+    <property name="upper">999999999999</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
 </interface>
diff --git a/data/buttons-programming.ui b/data/buttons-programming.ui
index 0d55912..5c0e516 100644
--- a/data/buttons-programming.ui
+++ b/data/buttons-programming.ui
@@ -3230,4 +3230,99 @@
       </object>
     </child>
   </object>
+  <object class="GtkDialog" id="ascii_dialog">
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes" comments="Title of insert ASCII dialog">Insert ASCII Value</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <property name="has_separator">False</property>
+    <signal name="response" handler="ascii_dialog_response_cb"/>
+    <signal name="delete_event" handler="ascii_dialog_delete_cb"/>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox3">
+        <property name="visible">True</property>
+        <child>
+          <object class="GtkHBox" id="hbox21">
+            <property name="visible">True</property>
+            <property name="border_width">5</property>
+            <child>
+              <object class="GtkLabel" id="label39">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes" comments="Insert ASCII dialog: Label before character entry">Ch_aracter:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">ascii_entry</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="ascii_entry">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="max_length">1</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <signal name="activate" handler="ascii_dialog_activate_cb"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area3">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button8">
+                <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">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="button9">
+                <property name="label" translatable="yes" comments="Insert ASCII dialog: Button to insert selected character">_Insert</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">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">1</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>
+      <action-widget response="-6">button8</action-widget>
+      <action-widget response="-5">button9</action-widget>
+    </action-widgets>
+  </object>
 </interface>
diff --git a/data/gcalctool.ui b/data/gcalctool.ui
index e7d0f50..6bcc711 100644
--- a/data/gcalctool.ui
+++ b/data/gcalctool.ui
@@ -238,7 +238,7 @@
         <child>
           <object class="GtkVBox" id="button_vbox">
             <property name="visible">True</property>
-            <property name="border_width">7</property>
+            <property name="border_width">5</property>
             <child>
               <placeholder/>
             </child>
diff --git a/src/ui-buttons.c b/src/ui-buttons.c
index 9326a4e..de49e50 100644
--- a/src/ui-buttons.c
+++ b/src/ui-buttons.c
@@ -94,6 +94,34 @@ static const char *subscript_digits[] = {"â??", "â??", "â??", "â??", "â??", "â??
 static const char *superscript_digits[] = {"�", "¹", "²", "³", "�", "�", "�", "�", "�", "�", NULL};
 
 
+Buttons *
+ui_buttons_new(GCalctoolUI *ui)
+{
+    Buttons *buttons;
+  
+    buttons = g_malloc0(sizeof(Buttons));
+    buttons->ui = ui;
+    buttons->button_vbox = GET_WIDGET(ui->ui, "button_vbox");
+    return buttons;
+}
+
+
+static GtkWidget *
+get_buttons(Buttons *buttons, ButtonMode mode)
+{
+    switch (mode) {
+    case BASIC:
+        return buttons->bas_panel;
+    case ADVANCED:
+        return buttons->adv_panel;
+    case FINANCIAL:
+        return buttons->fin_panel;
+    case PROGRAMMING:
+        return buttons->prog_panel;
+    }
+}
+
+
 static void
 set_tint (GtkWidget *widget, GdkColor *tint, gint alpha)
 {
@@ -103,6 +131,7 @@ set_tint (GtkWidget *widget, GdkColor *tint, gint alpha)
     if (!widget)
       return;
 
+    gtk_widget_ensure_style(widget);
     style = gtk_widget_get_style(widget);
   
     for (j = 0; j < 5; j++) {
@@ -139,8 +168,8 @@ static void set_int_data(GtkBuilder *ui, const gchar *object_name, const gchar *
 }
 
 
-void
-ui_load_mode(GCalctoolUI *ui, ModeType mode)
+static void
+load_mode(Buttons *buttons, ButtonMode mode)
 {
     GtkBuilder *builder, **builder_ptr;
     gint i;
@@ -176,36 +205,36 @@ ui_load_mode(GCalctoolUI *ui, ModeType mode)
     /* Get labels from popup menus */
     for (i = 0; registers[i]; i++) {
         SNPRINTF(name, MAXLINE, "store_menu_item%d", i);
-        widget = GET_WIDGET(ui->ui, name);
+        widget = GET_WIDGET(buttons->ui->ui, name);
         g_object_set_data(G_OBJECT(widget), "register_id", registers[i]);
-        ui->memory_store_labels[i] = gtk_bin_get_child(GTK_BIN(widget));
+        buttons->memory_store_labels[i] = gtk_bin_get_child(GTK_BIN(widget));
 
         SNPRINTF(name, MAXLINE, "recall_menu_item%d", i);
-        widget = GET_WIDGET(ui->ui, name);
+        widget = GET_WIDGET(buttons->ui->ui, name);
         g_object_set_data(G_OBJECT(widget), "register_id", registers[i]);
-        ui->memory_recall_labels[i] = gtk_bin_get_child(GTK_BIN(widget));
+        buttons->memory_recall_labels[i] = gtk_bin_get_child(GTK_BIN(widget));
     }
   
     switch (mode) {
     case BASIC:
-        builder_ptr = &ui->basic_ui;
+        builder_ptr = &buttons->basic_ui;
         builder_file = UI_BASIC_FILE;
-        panel = &ui->bas_panel;
+        panel = &buttons->bas_panel;
         break;
     case ADVANCED:
-        builder_ptr = &ui->advanced_ui;
+        builder_ptr = &buttons->advanced_ui;
         builder_file = UI_ADVANCED_FILE;
-        panel = &ui->adv_panel;
+        panel = &buttons->adv_panel;
         break;
     case FINANCIAL:
-        builder_ptr = &ui->financial_ui;
+        builder_ptr = &buttons->financial_ui;
         builder_file = UI_FINANCIAL_FILE;
-        panel = &ui->fin_panel;
+        panel = &buttons->fin_panel;
         break;
     case PROGRAMMING:
-        builder_ptr = &ui->programming_ui;
+        builder_ptr = &buttons->programming_ui;
         builder_file = UI_PROGRAMMING_FILE;
-        panel = &ui->prog_panel;
+        panel = &buttons->prog_panel;
         break;
     }
 
@@ -213,8 +242,7 @@ ui_load_mode(GCalctoolUI *ui, ModeType mode)
     // FIXME: Show dialog if failed to load
     gtk_builder_add_objects_from_file(builder, builder_file, objects, NULL);
     *panel = GET_WIDGET(builder, "button_panel");
-    gtk_box_pack_end(GTK_BOX(ui->button_vbox), *panel, FALSE, TRUE, 0);
-    gtk_widget_realize(*panel);
+    gtk_box_pack_end(GTK_BOX(buttons->button_vbox), *panel, FALSE, TRUE, 0);
 
     /* Connect text to buttons */
     for (i = 0; button_data[i].widget_name != NULL; i++) {
@@ -248,14 +276,14 @@ ui_load_mode(GCalctoolUI *ui, ModeType mode)
   
     widget = GET_WIDGET(builder, "superscript_togglebutton");
     if (widget) {
-        ui->superscript_toggles = g_list_append(ui->superscript_toggles, widget);
-        if (ui->number_mode == SUPERSCRIPT)
+        buttons->superscript_toggles = g_list_append(buttons->superscript_toggles, widget);
+        if (buttons->ui->display->number_mode == SUPERSCRIPT)
             gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
     }
     widget = GET_WIDGET(builder, "subscript_togglebutton");
     if (widget) {
-        ui->subscript_toggles = g_list_append(ui->subscript_toggles, widget);
-        if (ui->number_mode == SUBSCRIPT)
+        buttons->subscript_toggles = g_list_append(buttons->subscript_toggles, widget);
+        if (buttons->ui->display->number_mode == SUBSCRIPT)
             gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
     }
 
@@ -337,7 +365,7 @@ ui_load_mode(GCalctoolUI *ui, ModeType mode)
     if (mode == PROGRAMMING) {
         for (i = 0; i < MAXBITS; i++) {
             SNPRINTF(name, MAXLINE, "bit_label_%d", i);
-            ui->bit_labels[i] = GET_WIDGET(builder, name);
+            buttons->bit_labels[i] = GET_WIDGET(builder, name);
             SNPRINTF(name, MAXLINE, "bit_eventbox_%d", i);
             set_int_data(builder, name, "bit_index", i);
         }
@@ -345,6 +373,12 @@ ui_load_mode(GCalctoolUI *ui, ModeType mode)
 
     /* Setup financial functions */
     if (mode == FINANCIAL) {
+        ui_setup_finc_dialogs(buttons->ui);
+
+        buttons->ascii_dialog = GET_WIDGET(builder, "ascii_dialog");
+        buttons->ascii_entry = GET_WIDGET(builder, "ascii_entry");
+        gtk_window_set_transient_for(GTK_WINDOW(buttons->ascii_dialog), GTK_WINDOW(buttons->ui->main_window));
+
         set_data(builder, "calc_finc_compounding_term_button", "finc_dialog", "ctrm_dialog");
         set_data(builder, "calc_finc_double_declining_depreciation_button", "finc_dialog", "ddb_dialog");
         set_data(builder, "calc_finc_future_value_button", "finc_dialog", "fv_dialog");
@@ -357,85 +391,102 @@ ui_load_mode(GCalctoolUI *ui, ModeType mode)
         set_data(builder, "calc_finc_term_button", "finc_dialog", "term_dialog");
     }
 
-    gtk_builder_connect_signals(builder, ui);
+    gtk_builder_connect_signals(builder, buttons);
+}
+
+
+void
+ui_buttons_set_mode(Buttons *buttons, ButtonMode mode)
+{
+    ButtonMode old_mode;
+
+    old_mode = buttons->mode;
+    buttons->mode = mode;
+
+    /* Hide the existing mode */
+    if (get_buttons(buttons, old_mode))
+        gtk_widget_hide(get_buttons(buttons, old_mode));
+  
+    /* Create the new mode if necessary */
+    if (!get_buttons(buttons, mode))
+        load_mode(buttons, mode);
+    gtk_widget_show(get_buttons(buttons, mode));
 }
 
 
 G_MODULE_EXPORT
 void
-base_cb(GtkWidget *widget, GCalctoolUI *ui)
+base_cb(GtkWidget *widget, Buttons *buttons)
 {
-    ui_set_base(ui, GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "base")));
+    ui_set_base(buttons->ui, GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "base")));
 }
 
 
 G_MODULE_EXPORT
 void
-exponent_cb(GtkWidget *widget, GCalctoolUI *ui)
+exponent_cb(GtkWidget *widget, Buttons *buttons)
 {
-    ui_do_exponent(ui);
+    ui_do_exponent(buttons->ui);
 }
 
 
 G_MODULE_EXPORT
 void
-subtract_cb(GtkWidget *widget, GCalctoolUI *ui)
+subtract_cb(GtkWidget *widget, Buttons *buttons)
 {
-    ui_do_subtract(ui);
+    ui_do_subtract(buttons->ui);
 }
 
 
 G_MODULE_EXPORT
 void
-button_cb(GtkWidget *widget, GCalctoolUI *ui)
+button_cb(GtkWidget *widget, Buttons *buttons)
 {
-    ui_insert_text(ui, g_object_get_data(G_OBJECT(widget), "calc_text"));
+    ui_insert_text(buttons->ui, g_object_get_data(G_OBJECT(widget), "calc_text"));
 }
 
 
 G_MODULE_EXPORT
 void
-store_menu_cb(GtkMenuItem *menu, GCalctoolUI *ui)
+store_menu_cb(GtkMenuItem *menu, Buttons *buttons)
 {
-    ui_do_button(ui, FN_STORE, g_object_get_data(G_OBJECT(menu), "register_id"));
+    ui_do_button(buttons->ui, FN_STORE, g_object_get_data(G_OBJECT(menu), "register_id"));
 }
 
 
 G_MODULE_EXPORT
 void
-recall_menu_cb(GtkMenuItem *menu, GCalctoolUI *ui)
+recall_menu_cb(GtkMenuItem *menu, Buttons *buttons)
 {
-    ui_do_button(ui, FN_RECALL, g_object_get_data(G_OBJECT(menu), "register_id"));
+    ui_do_button(buttons->ui, FN_RECALL, g_object_get_data(G_OBJECT(menu), "register_id"));
 }
 
 
 G_MODULE_EXPORT
 void
-solve_cb(GtkWidget *widget, GCalctoolUI *ui)
+solve_cb(GtkWidget *widget, Buttons *buttons)
 {
-    ui_do_button(ui, FN_CALCULATE, NULL);
+    ui_do_button(buttons->ui, FN_CALCULATE, NULL);
 }
 
 
 G_MODULE_EXPORT
 void
-clear_cb(GtkWidget *widget, GCalctoolUI *ui)
+clear_cb(GtkWidget *widget, Buttons *buttons)
 {
-    ui_do_button(ui, FN_CLEAR, NULL);
+    ui_do_button(buttons->ui, FN_CLEAR, NULL);
 }
 
 
 G_MODULE_EXPORT
 void
-finc_cb(GtkWidget *widget, GCalctoolUI *ui)
+finc_cb(GtkWidget *widget, Buttons *buttons)
 {
     gchar *name;
 
-    if (ui->financial == NULL)
-        ui_setup_finc_dialogs(ui);
     name = g_object_get_data(G_OBJECT(widget), "finc_dialog");
-    gtk_dialog_run(GTK_DIALOG(GET_WIDGET(ui->financial, name)));
-    gtk_widget_hide(GTK_WIDGET(GET_WIDGET(ui->financial, name)));
+    gtk_dialog_run(GTK_DIALOG(GET_WIDGET(buttons->financial_ui, name)));
+    gtk_widget_hide(GTK_WIDGET(GET_WIDGET(buttons->financial_ui, name)));
 }
 
 
@@ -515,47 +566,45 @@ position_popup(GtkWidget *base, GtkWidget *popup,
 
 G_MODULE_EXPORT
 void
-insert_ascii_cb(GtkWidget *widget, GCalctoolUI *ui)
+insert_ascii_cb(GtkWidget *widget, Buttons *buttons)
 {
-    ui_create_dialogs(ui);
-  
-    if (!gtk_widget_get_visible(ui->ascii_dialog))
-        position_popup(ui->main_window, ui->ascii_dialog, POPUP_LEFT);
-    gtk_widget_grab_focus(GTK_WIDGET(ui->ascii_entry));
-    gtk_widget_show(ui->ascii_dialog);
+    if (!gtk_widget_get_visible(buttons->ascii_dialog))
+        position_popup(buttons->ui->main_window, buttons->ascii_dialog, POPUP_LEFT);
+    gtk_widget_grab_focus(GTK_WIDGET(buttons->ascii_entry));
+    gtk_widget_show(buttons->ascii_dialog);
 }
 
 
 G_MODULE_EXPORT
 void
-shift_cb(GtkWidget *widget, GCalctoolUI *ui)
+shift_cb(GtkWidget *widget, Buttons *buttons)
 {
-    ui_do_button(ui, FN_SHIFT, g_object_get_data(G_OBJECT(widget), "shiftcount"));
+    ui_do_button(buttons->ui, FN_SHIFT, g_object_get_data(G_OBJECT(widget), "shiftcount"));
 }
 
 G_MODULE_EXPORT
 void
-factorize_cb(GtkWidget *widget, GCalctoolUI *ui)
+factorize_cb(GtkWidget *widget, Buttons *buttons)
 {
-    ui_do_button(ui, FN_FACTORIZE, NULL);
+    ui_do_button(buttons->ui, FN_FACTORIZE, NULL);
 }
 
 
 G_MODULE_EXPORT
 void
-digit_cb(GtkWidget *widget, GCalctoolUI *ui)
+digit_cb(GtkWidget *widget, Buttons *buttons)
 {
-    if (ui->number_mode == SUPERSCRIPT)
-        ui_insert_text(ui, g_object_get_data(G_OBJECT(widget), "calc_superscript_text"));
-    else if (ui->number_mode == SUBSCRIPT)
-        ui_insert_text(ui, g_object_get_data(G_OBJECT(widget), "calc_subscript_text"));
+    if (buttons->ui->display->number_mode == SUPERSCRIPT)
+        ui_insert_text(buttons->ui, g_object_get_data(G_OBJECT(widget), "calc_superscript_text"));
+    else if (buttons->ui->display->number_mode == SUBSCRIPT)
+        ui_insert_text(buttons->ui, g_object_get_data(G_OBJECT(widget), "calc_subscript_text"));
     else
-        ui_insert_text(ui, g_object_get_data(G_OBJECT(widget), "calc_text"));
+        ui_insert_text(buttons->ui, g_object_get_data(G_OBJECT(widget), "calc_text"));
 }
 
 
 static void
-update_memory_menus(GCalctoolUI *ui)
+update_memory_menus(Buttons *buttons)
 {
     int i;
 
@@ -567,20 +616,20 @@ update_memory_menus(GCalctoolUI *ui)
         if (t)
             display_make_number(&v->display, value, MAXLINE, t);
         SNPRINTF(mstr, MAXLINE, "<span weight=\"bold\">%s</span> = %s", registers[i], value);
-        gtk_label_set_markup_with_mnemonic(GTK_LABEL(ui->memory_store_labels[i]), mstr);
-        gtk_label_set_markup_with_mnemonic(GTK_LABEL(ui->memory_recall_labels[i]), mstr);
+        gtk_label_set_markup_with_mnemonic(GTK_LABEL(buttons->memory_store_labels[i]), mstr);
+        gtk_label_set_markup_with_mnemonic(GTK_LABEL(buttons->memory_recall_labels[i]), mstr);
     }
 }
 
 
 G_MODULE_EXPORT
 void
-popup_cb(GtkWidget *widget, GCalctoolUI *ui)
+popup_cb(GtkWidget *widget, Buttons *buttons)
 {
     GtkWidget *menu;
     GdkPoint loc;
 
-    update_memory_menus(ui);
+    update_memory_menus(buttons);
 
     menu = (GtkWidget *)g_object_get_data(G_OBJECT(widget), "calc_menu");
     gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
@@ -589,14 +638,14 @@ popup_cb(GtkWidget *widget, GCalctoolUI *ui)
 
 G_MODULE_EXPORT
 void
-ascii_dialog_response_cb(GtkWidget *dialog, gint response_id, GCalctoolUI *ui)
+ascii_dialog_response_cb(GtkWidget *dialog, gint response_id, Buttons *buttons)
 {
     const gchar *text;
 
-    text = gtk_entry_get_text(GTK_ENTRY(ui->ascii_entry));
+    text = gtk_entry_get_text(GTK_ENTRY(buttons->ascii_entry));
 
     if (response_id == GTK_RESPONSE_OK)
-        ui_do_button(ui, FN_INSERT_CHARACTER, (gpointer) text);
+        ui_do_button(buttons->ui, FN_INSERT_CHARACTER, (gpointer) text);
 
     gtk_widget_hide(dialog);
 }
@@ -604,27 +653,27 @@ ascii_dialog_response_cb(GtkWidget *dialog, gint response_id, GCalctoolUI *ui)
 
 G_MODULE_EXPORT
 void
-ascii_dialog_activate_cb(GtkWidget *entry, GCalctoolUI *ui)
+ascii_dialog_activate_cb(GtkWidget *entry, Buttons *buttons)
 {
-    ascii_dialog_response_cb(ui->ascii_dialog, GTK_RESPONSE_OK, ui);
+    ascii_dialog_response_cb(buttons->ascii_dialog, GTK_RESPONSE_OK, buttons);
 }
 
 
 G_MODULE_EXPORT
 gboolean
-ascii_dialog_delete_cb(GtkWidget *dialog, GCalctoolUI *ui)
+ascii_dialog_delete_cb(GtkWidget *dialog, Buttons *buttons)
 {
-    ascii_dialog_response_cb(dialog, GTK_RESPONSE_CANCEL, ui);
+    ascii_dialog_response_cb(dialog, GTK_RESPONSE_CANCEL, buttons);
     return TRUE;
 }
 
 
 G_MODULE_EXPORT
 gboolean
-bit_toggle_cb(GtkWidget *event_box, GdkEventButton *event, GCalctoolUI *ui)
+bit_toggle_cb(GtkWidget *event_box, GdkEventButton *event, Buttons *buttons)
 {
-    ui_do_button(ui, FN_TOGGLE_BIT,
-              g_object_get_data(G_OBJECT(event_box), "bit_index"));
+    ui_do_button(buttons->ui, FN_TOGGLE_BIT,
+                 g_object_get_data(G_OBJECT(event_box), "bit_index"));
     return TRUE;
 }
 
@@ -632,26 +681,48 @@ bit_toggle_cb(GtkWidget *event_box, GdkEventButton *event, GCalctoolUI *ui)
 
 G_MODULE_EXPORT
 void
-set_superscript_cb(GtkWidget *widget, GCalctoolUI *ui)
+set_superscript_cb(GtkWidget *widget, Buttons *buttons)
 {
     if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
-       ui->can_super_minus = TRUE;
-       ui_set_number_mode(ui, SUPERSCRIPT);
+       buttons->ui->display->can_super_minus = TRUE;
+       ui_set_number_mode(buttons->ui, SUPERSCRIPT);
     }
     else {
-       ui->can_super_minus = FALSE;
-       if (ui->number_mode == SUPERSCRIPT)
-           ui_set_number_mode(ui, NORMAL);
+       buttons->ui->display->can_super_minus = FALSE;
+       if (buttons->ui->display->number_mode == SUPERSCRIPT)
+           ui_set_number_mode(buttons->ui, NORMAL);
     }
 }
 
 
 G_MODULE_EXPORT
 void
-set_subscript_cb(GtkWidget *widget, GCalctoolUI *ui)
+set_subscript_cb(GtkWidget *widget, Buttons *buttons)
 {
     if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
-       ui_set_number_mode(ui, SUBSCRIPT);
-    else if (ui->number_mode == SUBSCRIPT)
-       ui_set_number_mode(ui, NORMAL);
+       ui_set_number_mode(buttons->ui, SUBSCRIPT);
+    else if (buttons->ui->display->number_mode == SUBSCRIPT)
+       ui_set_number_mode(buttons->ui, NORMAL);
+}
+
+
+// FIXME: Watch for changes in programming mode
+void
+ui_set_bitfield(GCalctoolUI *ui, int enabled, guint64 bits)
+{
+    int i;
+    const gchar *label;
+  
+    if (!ui->buttons->bit_panel)
+       return;
+
+    gtk_widget_set_sensitive(ui->buttons->bit_panel, enabled);
+
+    for (i = 0; i < MAXBITS; i++) {
+        if (bits & (1LL << (MAXBITS-i-1)))
+            label = " 1";
+        else
+            label = " 0";
+        gtk_label_set_text(GTK_LABEL(ui->buttons->bit_labels[i]), label);
+    }
 }
diff --git a/src/ui-buttons.h b/src/ui-buttons.h
index c846400..debd104 100644
--- a/src/ui-buttons.h
+++ b/src/ui-buttons.h
@@ -19,6 +19,46 @@
 #ifndef UI_BUTTONS_H
 #define UI_BUTTONS_H
 
+typedef struct Buttons Buttons;
+
 #include "ui.h"
 
+typedef enum {
+    BASIC,
+    ADVANCED,
+    FINANCIAL,
+    PROGRAMMING
+} ButtonMode;
+
+#define MAXBITS 64      /* Bit panel: number of bit fields. */
+#define MAX_REGISTERS 6
+
+struct Buttons
+{
+    GCalctoolUI *ui;
+    ButtonMode mode;
+    GtkBuilder *financial_dialog_ui; // FIXME: Merge into financial UI
+    GtkBuilder *basic_ui, *advanced_ui, *financial_ui, *programming_ui;
+
+    GtkWidget *button_vbox;
+    GtkWidget *bas_panel, *adv_panel, *fin_panel, *prog_panel;
+
+    /* Labels for popup menus */
+    GtkWidget *memory_store_labels[MAX_REGISTERS];
+    GtkWidget *memory_recall_labels[MAX_REGISTERS];
+
+    GList *superscript_toggles;
+    GList *subscript_toggles;
+
+    GtkWidget *bit_panel;
+    GtkWidget *bit_labels[MAXBITS];
+
+    GtkWidget *ascii_dialog;
+    GtkWidget *ascii_entry;
+};
+
+Buttons *ui_buttons_new(GCalctoolUI *ui);
+
+void ui_buttons_set_mode(Buttons *buttons, ButtonMode mode);
+
 #endif /* UI_BUTTONS_H */
diff --git a/src/ui-display.c b/src/ui-display.c
index 86de091..45843dc 100644
--- a/src/ui-display.c
+++ b/src/ui-display.c
@@ -21,12 +21,44 @@
 #include "ui-display.h"
 #include "ui-internal.h"
 
+#define GET_WIDGET(ui, name)  GTK_WIDGET(gtk_builder_get_object(ui, name))
+
+MathDisplay *
+ui_display_new(GCalctoolUI *ui)
+{
+    MathDisplay *display;
+    PangoFontDescription *font_desc;
+    GtkCellRenderer *renderer;
+  
+    display = g_malloc0(sizeof(MathDisplay));
+    display->clipboard_atom = gdk_atom_intern("CLIPBOARD", FALSE);
+    display->primary_atom = gdk_atom_intern("PRIMARY", FALSE);
+
+    display->scrolledwindow = GET_WIDGET(ui->ui, "display_scroll");
+    display->display_item = GET_WIDGET(ui->ui, "displayitem");
+    display->info_buffer = GTK_TEXT_BUFFER(gtk_builder_get_object(ui->ui, "info_buffer"));
+
+/*    display->display_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(ui->display->display_item));
+    gtk_widget_ensure_style(ui->display->display_item);
+    font_desc = pango_font_description_copy(gtk_widget_get_style(ui->display->display_item)->font_desc);
+    pango_font_description_set_size(font_desc, 16 * PANGO_SCALE);
+    gtk_widget_modify_font(ui->display->display_item, font_desc);
+    pango_font_description_free(font_desc);
+    gtk_widget_set_name(ui->display->display_item, "displayitem");
+    atk_object_set_role(gtk_widget_get_accessible(ui->display->display_item),
+                                                  ATK_ROLE_EDITBAR);*/
+
+    return display;
+}
+
+
+
 gchar *
 ui_get_display(GCalctoolUI *ui)
 {
     GtkTextIter start, end;
-    gtk_text_buffer_get_bounds(ui->display_buffer, &start, &end);
-    return gtk_text_buffer_get_text(ui->display_buffer, &start, &end, FALSE);
+    gtk_text_buffer_get_bounds(ui->display->display_buffer, &start, &end);
+    return gtk_text_buffer_get_text(ui->display->display_buffer, &start, &end, FALSE);
 }
 
 
@@ -44,15 +76,15 @@ redo_display(GCalctoolUI *ui)
     GtkTextIter start, end, cursor;
     gint cursor_position;
 
-    gtk_text_buffer_get_start_iter(ui->display_buffer, &start);
-    gtk_text_buffer_get_end_iter(ui->display_buffer, &end);
-    text = gtk_text_buffer_get_text(ui->display_buffer, &start, &end, FALSE);
+    gtk_text_buffer_get_start_iter(ui->display->display_buffer, &start);
+    gtk_text_buffer_get_end_iter(ui->display->display_buffer, &end);
+    text = gtk_text_buffer_get_text(ui->display->display_buffer, &start, &end, FALSE);
 
-    g_object_get(G_OBJECT(ui->display_buffer), "cursor-position", &cursor_position, NULL);
+    g_object_get(G_OBJECT(ui->display->display_buffer), "cursor-position", &cursor_position, NULL);
 
-    gtk_text_buffer_set_text(ui->display_buffer, text, -1);
-    gtk_text_buffer_get_iter_at_offset(ui->display_buffer, &cursor, cursor_position);
-    gtk_text_buffer_place_cursor(ui->display_buffer, &cursor);
+    gtk_text_buffer_set_text(ui->display->display_buffer, text, -1);
+    gtk_text_buffer_get_iter_at_offset(ui->display->display_buffer, &cursor, cursor_position);
+    gtk_text_buffer_place_cursor(ui->display->display_buffer, &cursor);
 
     g_free(text);
 
@@ -66,14 +98,14 @@ ui_set_display(GCalctoolUI *ui, char *str, int cursor)
     GtkTextIter iter;
     GtkAdjustment *adj;
 
-    gtk_text_buffer_set_text(ui->display_buffer, str, -1);
+    gtk_text_buffer_set_text(ui->display->display_buffer, str, -1);
 
     if (cursor < 0)
-        gtk_text_buffer_get_end_iter(ui->display_buffer, &iter);
+        gtk_text_buffer_get_end_iter(ui->display->display_buffer, &iter);
     else
-        gtk_text_buffer_get_iter_at_offset(ui->display_buffer, &iter, cursor);
-    gtk_text_buffer_place_cursor(ui->display_buffer, &iter);
-    gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(ui->display_item), &iter, 0.0, TRUE, 1.0, 0.0);
+        gtk_text_buffer_get_iter_at_offset(ui->display->display_buffer, &iter, cursor);
+    gtk_text_buffer_place_cursor(ui->display->display_buffer, &iter);
+    gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(ui->display->display_item), &iter, 0.0, TRUE, 1.0, 0.0);
 
     /* This is a workaround for bug #524602.
      * Basically the above code can cause the display to disappear when going from
@@ -85,7 +117,7 @@ ui_set_display(GCalctoolUI *ui, char *str, int cursor)
     /* Align to the right */
     if (cursor < 0) {
         adj = gtk_scrolled_window_get_hadjustment(
-                 GTK_SCROLLED_WINDOW(ui->scrolledwindow));
+                 GTK_SCROLLED_WINDOW(ui->display->scrolledwindow));
         gtk_adjustment_set_value(adj, gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj));
     }
 }
@@ -99,7 +131,7 @@ ui_do_button(GCalctoolUI *ui, int function, gpointer arg)
   
     /* Can't enter superscript minus after entering digits */
     if (function == FN_TEXT && strstr("�¹²³������", (char *)arg) != NULL)
-        ui->can_super_minus = FALSE;
+        ui->display->can_super_minus = FALSE;
 
     /* Disable super/subscript mode when finished entering */
     if (function == FN_CALCULATE ||
@@ -108,30 +140,30 @@ ui_do_button(GCalctoolUI *ui, int function, gpointer arg)
         ui_set_number_mode(ui, NORMAL);
     }
 
-    if (gtk_text_buffer_get_selection_bounds(ui->display_buffer, &start, &end)) {
+    if (gtk_text_buffer_get_selection_bounds(ui->display->display_buffer, &start, &end)) {
         cursor_start = gtk_text_iter_get_offset(&start);
         cursor_end = gtk_text_iter_get_offset(&end);
     }
     else {
-        g_object_get(G_OBJECT(ui->display_buffer), "cursor-position", &cursor_start, NULL);
-        if (cursor_start == gtk_text_buffer_get_char_count(ui->display_buffer))
+        g_object_get(G_OBJECT(ui->display->display_buffer), "cursor-position", &cursor_start, NULL);
+        if (cursor_start == gtk_text_buffer_get_char_count(ui->display->display_buffer))
             cursor_start = -1;
         cursor_end = cursor_start;
     }
 
     /* Some keyboards don't have a '^' button so convert two multiplies to one '^' */
     if (cursor_start == cursor_end &&
-        function == FN_TEXT && ui->last_text != NULL &&
-        strcmp((char *)arg, "Ã?") == 0 && strcmp(ui->last_text, "Ã?") == 0) {
+        function == FN_TEXT && ui->display->last_text != NULL &&
+        strcmp((char *)arg, "Ã?") == 0 && strcmp(ui->display->last_text, "Ã?") == 0) {
         ui_do_button(ui, FN_BACKSPACE, NULL);
         ui_do_button(ui, FN_TEXT, "^");
     }
     else {
         display_do_function(&v->display, function, arg, cursor_start, cursor_end);
         if (function == FN_TEXT)
-            ui->last_text = (char *)arg;
+            ui->display->last_text = (char *)arg;
         else
-            ui->last_text = NULL;
+            ui->display->last_text = NULL;
     }
 }
 
@@ -142,17 +174,17 @@ ui_display_copy(GCalctoolUI *ui)
     gchar *string = NULL;
     GtkTextIter start, end;
 
-    if (gtk_text_buffer_get_selection_bounds(ui->display_buffer, &start, &end) == TRUE)
-        string = gtk_text_buffer_get_text(ui->display_buffer, &start, &end, FALSE);
+    if (gtk_text_buffer_get_selection_bounds(ui->display->display_buffer, &start, &end) == TRUE)
+        string = gtk_text_buffer_get_text(ui->display->display_buffer, &start, &end, FALSE);
     else
         string = ui_get_display(ui);
 
-    if (ui->shelf != NULL)
-        g_free(ui->shelf);
-    ui->shelf = g_locale_from_utf8(string, strlen(string), NULL, NULL, NULL);
+    if (ui->display->shelf != NULL)
+        g_free(ui->display->shelf);
+    ui->display->shelf = g_locale_from_utf8(string, strlen(string), NULL, NULL, NULL);
     g_free(string);
 
-    gtk_clipboard_set_text(gtk_clipboard_get(ui->clipboard_atom), ui->shelf, -1);
+    gtk_clipboard_set_text(gtk_clipboard_get(ui->display->clipboard_atom), ui->display->shelf, -1);
 }
 
 
@@ -167,9 +199,9 @@ ui_do_exponent(GCalctoolUI *ui)
 void
 ui_do_subtract(GCalctoolUI *ui)
 {
-    if (ui->can_super_minus) {
+    if (ui->display->can_super_minus) {
         ui_insert_text(ui, "â?»");
-        ui->can_super_minus = FALSE;
+        ui->display->can_super_minus = FALSE;
     }
     else {
         ui_insert_text(ui, "â??");
@@ -249,7 +281,7 @@ main_window_key_press_cb(GtkWidget *widget, GdkEventKey *event, GCalctoolUI *ui)
             return TRUE;
         }
     }
-    if (state == GDK_CONTROL_MASK || ui->number_mode == SUPERSCRIPT) {
+    if (state == GDK_CONTROL_MASK || ui->display->number_mode == SUPERSCRIPT) {
         switch(event->keyval)
         {
         case GDK_0:
@@ -284,7 +316,7 @@ main_window_key_press_cb(GtkWidget *widget, GdkEventKey *event, GCalctoolUI *ui)
             return TRUE;
         }
     }
-    else if (state == GDK_MOD1_MASK || ui->number_mode == SUBSCRIPT) {
+    else if (state == GDK_MOD1_MASK || ui->display->number_mode == SUBSCRIPT) {
         switch(event->keyval)
         {
         case GDK_0:
@@ -341,7 +373,7 @@ main_window_key_press_cb(GtkWidget *widget, GdkEventKey *event, GCalctoolUI *ui)
     /* Solve */
     if ((event->keyval == GDK_Return && state == 0) ||
         (event->keyval == GDK_KP_Enter && state == 0)) {
-        if (gtk_widget_has_focus(ui->display_item)) {
+        if (gtk_widget_has_focus(ui->display->display_item)) {
             ui_do_button(ui, FN_CALCULATE, NULL);
             return TRUE;
         }
@@ -353,7 +385,7 @@ main_window_key_press_cb(GtkWidget *widget, GdkEventKey *event, GCalctoolUI *ui)
     if (state == GDK_CONTROL_MASK && event->keyval == GDK_minus) 
     {
         ui_insert_text(ui, "â?»");
-        ui->can_super_minus = FALSE;
+        ui->display->can_super_minus = FALSE;
         return TRUE;
     }
 
@@ -392,7 +424,7 @@ main_window_key_press_cb(GtkWidget *widget, GdkEventKey *event, GCalctoolUI *ui)
     }
   
     /* Don't override space - it is used in UI */
-    if (event->string[0] == ' ' && !gtk_widget_has_focus(ui->display_item))
+    if (event->string[0] == ' ' && !gtk_widget_has_focus(ui->display->display_item))
         return FALSE;
 
     if (event->string[0] != '\0') {
@@ -422,7 +454,7 @@ for_each_menu(GtkWidget *widget, GCalctoolUI *ui)
         GtkWidget *label = gtk_bin_get_child(GTK_BIN(widget));
 
          if (strcmp(gtk_label_get_text(GTK_LABEL(label)), _("Paste")) == 0) {
-            if (gtk_clipboard_wait_is_text_available(gtk_clipboard_get(ui->clipboard_atom))) {
+            if (gtk_clipboard_wait_is_text_available(gtk_clipboard_get(ui->display->clipboard_atom))) {
                 gtk_widget_set_sensitive(GTK_WIDGET(widget), TRUE);
                 g_signal_connect(GTK_OBJECT(widget), "activate",
                                  G_CALLBACK(popup_paste_cb), ui);
@@ -451,7 +483,7 @@ on_paste(GtkClipboard *clipboard, const gchar *text, GCalctoolUI *ui)
 void
 ui_display_paste(GCalctoolUI *ui)
 {
-    gtk_clipboard_request_text(gtk_clipboard_get(ui->clipboard_atom),
+    gtk_clipboard_request_text(gtk_clipboard_get(ui->display->clipboard_atom),
                                (GtkClipboardTextReceivedFunc)on_paste, ui);
 }
 
diff --git a/src/ui-display.h b/src/ui-display.h
index 2222184..2b368c0 100644
--- a/src/ui-display.h
+++ b/src/ui-display.h
@@ -19,8 +19,36 @@
 #ifndef UI_DISPLAY_H
 #define UI_DISPLAY_H
 
+typedef struct MathDisplay MathDisplay;
+
 #include "ui.h"
 
+typedef enum {
+    NORMAL,
+    SUPERSCRIPT,
+    SUBSCRIPT
+} NumberMode;
+
+struct MathDisplay
+{
+    NumberMode number_mode;  
+
+    GtkWidget *display_item;           /* Calculator display. */
+    GtkTextBuffer *display_buffer;     /* Buffer used in display */
+    GtkTextBuffer *info_buffer;        /* Buffer used in info messages */
+    GtkWidget *scrolledwindow;         /* Scrolled window for display_item. */
+
+    GdkAtom clipboard_atom;
+    GdkAtom primary_atom;
+    char *shelf;                       /* PUT selection shelf contents. */
+
+    gboolean can_super_minus;
+
+    /* Last text entered */
+    char *last_text;
+};
+
+MathDisplay *ui_display_new(GCalctoolUI *ui);
 void ui_display_copy(GCalctoolUI *ui);
 void ui_display_paste(GCalctoolUI *ui);
 void ui_insert_text(GCalctoolUI *ui, const char *text);
diff --git a/src/ui-financial.c b/src/ui-financial.c
index d7e766a..33536f9 100644
--- a/src/ui-financial.c
+++ b/src/ui-financial.c
@@ -45,8 +45,6 @@ static char *finc_dialog_fields[][5] = {
     {NULL,        NULL,          NULL,         NULL,         NULL}
 };
 
-#define UI_FINC_FILE        UI_DIR "/financial.ui"
-
 G_MODULE_EXPORT
 void
 finc_activate_cb(GtkWidget *widget, GCalctoolUI *ui)
@@ -67,7 +65,7 @@ finc_activate_cb(GtkWidget *widget, GCalctoolUI *ui)
     }
     else {
         GtkWidget *next_widget;
-        next_widget = GET_WIDGET(ui->financial, finc_dialog_fields[dialog][field+1]);
+        next_widget = GET_WIDGET(ui->buttons->financial_ui, finc_dialog_fields[dialog][field+1]);
         gtk_widget_grab_focus(next_widget);
     }
 }
@@ -91,18 +89,19 @@ finc_response_cb(GtkWidget *widget, gint response_id, GCalctoolUI *ui)
         if (finc_dialog_fields[dialog][i] == NULL) {
             continue;
         }
-        entry = GET_WIDGET(ui->financial, finc_dialog_fields[dialog][i]);
+        entry = GET_WIDGET(ui->buttons->financial_ui, finc_dialog_fields[dialog][i]);
         // FIXME: Have to delocalize the input
         mp_set_from_string(gtk_entry_get_text(GTK_ENTRY(entry)), &arg[i]);
         gtk_entry_set_text(GTK_ENTRY(entry), "0");
     }
-    gtk_widget_grab_focus(GET_WIDGET(ui->financial, finc_dialog_fields[dialog][0]));
+    gtk_widget_grab_focus(GET_WIDGET(ui->buttons->financial_ui, finc_dialog_fields[dialog][0]));
 
     do_finc_expression(dialog, &arg[0], &arg[1], &arg[2], &arg[3]);
 }
 
 
-static void set_data(GtkBuilder *ui, const gchar *object_name, const gchar *name, const gpointer value)
+static void
+set_data(GtkBuilder *ui, const gchar *object_name, const gchar *name, const gpointer value)
 {
     GObject *object;  
     object = gtk_builder_get_object(ui, object_name);
@@ -111,7 +110,8 @@ static void set_data(GtkBuilder *ui, const gchar *object_name, const gchar *name
 }
 
 
-static void set_int_data(GtkBuilder *ui, const gchar *object_name, const gchar *name, gint value)
+static void
+set_int_data(GtkBuilder *ui, const gchar *object_name, const gchar *name, gint value)
 {
     set_data(ui, object_name, name, GINT_TO_POINTER(value));
 }
@@ -128,41 +128,37 @@ ui_setup_finc_dialogs(GCalctoolUI *ui)
     GtkComboBox   *currency_type_upper;
     GtkComboBox   *currency_type_lower;
 
-    // FIXME: Handle errors
-    ui->financial = gtk_builder_new();
-    gtk_builder_add_from_file(ui->financial, UI_FINC_FILE, NULL);
-
-    set_int_data(ui->financial, "ctrm_dialog", "finc_dialog", FINC_CTRM_DIALOG);
-    set_int_data(ui->financial, "ddb_dialog", "finc_dialog", FINC_DDB_DIALOG);
-    set_int_data(ui->financial, "fv_dialog", "finc_dialog", FINC_FV_DIALOG);
-    set_int_data(ui->financial, "gpm_dialog", "finc_dialog", FINC_GPM_DIALOG);
-    set_int_data(ui->financial, "pmt_dialog", "finc_dialog", FINC_PMT_DIALOG);
-    set_int_data(ui->financial, "pv_dialog", "finc_dialog", FINC_PV_DIALOG);
-    set_int_data(ui->financial, "rate_dialog", "finc_dialog", FINC_RATE_DIALOG);
-    set_int_data(ui->financial, "sln_dialog", "finc_dialog", FINC_SLN_DIALOG);
-    set_int_data(ui->financial, "syd_dialog", "finc_dialog", FINC_SYD_DIALOG);
-    set_int_data(ui->financial, "term_dialog", "finc_dialog", FINC_TERM_DIALOG);
+    set_int_data(ui->buttons->financial_ui, "ctrm_dialog", "finc_dialog", FINC_CTRM_DIALOG);
+    set_int_data(ui->buttons->financial_ui, "ddb_dialog", "finc_dialog", FINC_DDB_DIALOG);
+    set_int_data(ui->buttons->financial_ui, "fv_dialog", "finc_dialog", FINC_FV_DIALOG);
+    set_int_data(ui->buttons->financial_ui, "gpm_dialog", "finc_dialog", FINC_GPM_DIALOG);
+    set_int_data(ui->buttons->financial_ui, "pmt_dialog", "finc_dialog", FINC_PMT_DIALOG);
+    set_int_data(ui->buttons->financial_ui, "pv_dialog", "finc_dialog", FINC_PV_DIALOG);
+    set_int_data(ui->buttons->financial_ui, "rate_dialog", "finc_dialog", FINC_RATE_DIALOG);
+    set_int_data(ui->buttons->financial_ui, "sln_dialog", "finc_dialog", FINC_SLN_DIALOG);
+    set_int_data(ui->buttons->financial_ui, "syd_dialog", "finc_dialog", FINC_SYD_DIALOG);
+    set_int_data(ui->buttons->financial_ui, "term_dialog", "finc_dialog", FINC_TERM_DIALOG);
 
     for (i = 0; finc_dialog_fields[i][0] != NULL; i++) {
         for (j = 0; finc_dialog_fields[i][j]; j++) {
             GObject *o;
-            o = gtk_builder_get_object(ui->financial, finc_dialog_fields[i][j]);
+            o = gtk_builder_get_object(ui->buttons->financial_ui, finc_dialog_fields[i][j]);
             g_object_set_data(o, "finc_field", GINT_TO_POINTER(j));
             g_object_set_data(o, "finc_dialog", GINT_TO_POINTER(i));
         }
     }
 
     currency_amount_upper = GTK_SPIN_BUTTON(gtk_builder_get_object(
-        ui->financial,
+        ui->buttons->financial_ui,
         "currency_amount_upper"));
     currency_amount_lower = GTK_SPIN_BUTTON(gtk_builder_get_object(
-        ui->financial,
+        ui->buttons->financial_ui,
         "currency_amount_lower"));
     currency_type_upper = GTK_COMBO_BOX(gtk_builder_get_object(
-        ui->financial,
+        ui->buttons->financial_ui,
         "currency_type_upper"));
     currency_type_lower = GTK_COMBO_BOX(gtk_builder_get_object(
-        ui->financial,
+        ui->buttons->financial_ui,
         "currency_type_lower"));
 
     currency_store = gtk_list_store_new(2,
@@ -196,10 +192,10 @@ ui_setup_finc_dialogs(GCalctoolUI *ui)
                                   "text",
                                   1);
 
-    set_int_data(ui->financial, "currency_amount_upper", "target", CURRENCY_TARGET_LOWER);
-    set_int_data(ui->financial, "currency_amount_lower", "target", CURRENCY_TARGET_UPPER);
+    set_int_data(ui->buttons->financial_ui, "currency_amount_upper", "target", CURRENCY_TARGET_LOWER);
+    set_int_data(ui->buttons->financial_ui, "currency_amount_lower", "target", CURRENCY_TARGET_UPPER);
 
-    gtk_builder_connect_signals(ui->financial, ui);
+    gtk_builder_connect_signals(ui->buttons->financial_ui, ui);
 }
 
 
@@ -209,16 +205,16 @@ recalculate_currency(GCalctoolUI *ui, CurrencyTargetRow target)
     int upper_index, lower_index;
 
     GtkComboBox *combo_upper = GTK_COMBO_BOX(gtk_builder_get_object(
-        ui->financial,
+        ui->buttons->financial_ui,
         "currency_type_upper"));
     GtkComboBox *combo_lower = GTK_COMBO_BOX(gtk_builder_get_object(
-        ui->financial,
+        ui->buttons->financial_ui,
         "currency_type_lower"));
     GtkSpinButton *spin_upper = GTK_SPIN_BUTTON(gtk_builder_get_object(
-        ui->financial,
+        ui->buttons->financial_ui,
         "currency_amount_upper"));
     GtkSpinButton *spin_lower = GTK_SPIN_BUTTON(gtk_builder_get_object(
-        ui->financial,
+        ui->buttons->financial_ui,
         "currency_amount_lower"));
 
     GtkTreeModel *model = gtk_combo_box_get_model(combo_upper);
@@ -296,7 +292,7 @@ setup_currency_rates(GCalctoolUI *ui)
     }
     currency_load_rates();
 
-    currency_type = gtk_builder_get_object(ui->financial, "currency_type_upper");
+    currency_type = gtk_builder_get_object(ui->buttons->financial_ui, "currency_type_upper");
     currency_store = GTK_LIST_STORE(gtk_combo_box_get_model(
         GTK_COMBO_BOX(currency_type)));
 
@@ -326,17 +322,17 @@ currency_cb(GtkWidget *widget, GCalctoolUI *ui)
     GtkSpinButton *c_amount_upper, *c_amount_lower;
     MPNumber display_val;
 
-    if (ui->financial == NULL)
+    if (ui->buttons->financial_ui == NULL)
         ui_setup_finc_dialogs(ui);
 
     setup_currency_rates(ui);
 
-    win = GTK_DIALOG(gtk_builder_get_object(ui->financial, "currency_dialog"));
+    win = GTK_DIALOG(gtk_builder_get_object(ui->buttons->financial_ui, "currency_dialog"));
     c_amount_upper = GTK_SPIN_BUTTON(gtk_builder_get_object(
-        ui->financial,
+        ui->buttons->financial_ui,
         "currency_amount_upper"));
     c_amount_lower = GTK_SPIN_BUTTON(gtk_builder_get_object(
-        ui->financial,
+        ui->buttons->financial_ui,
         "currency_amount_lower"));
     if (display_is_usable_number(&v->display, &display_val)) {
         double start_val = mp_cast_to_double(&display_val);
diff --git a/src/ui-internal.h b/src/ui-internal.h
index f3c14d2..c3746b4 100644
--- a/src/ui-internal.h
+++ b/src/ui-internal.h
@@ -21,10 +21,8 @@
 
 #include "ui.h"
 
-void ui_load_mode(GCalctoolUI *ui, ModeType mode);
 void ui_do_button(GCalctoolUI *ui, int function, gpointer arg);
 void ui_setup_finc_dialogs(GCalctoolUI *ui);
-void ui_create_dialogs(GCalctoolUI *ui);
 void ui_set_number_mode(GCalctoolUI *ui, NumberMode mode);
 
 #endif /* UI_INTERNAL_H */
diff --git a/src/ui-preferences.c b/src/ui-preferences.c
index c6fcd1d..18d707c 100644
--- a/src/ui-preferences.c
+++ b/src/ui-preferences.c
@@ -22,28 +22,34 @@
 #include "ui-internal.h"
 #include "get.h"
 
+#define UI_DIALOGS_FILE  UI_DIR "/preferences.ui"
+#define GET_WIDGET(ui, name) \
+          GTK_WIDGET(gtk_builder_get_object(ui, name))
 
-#define UI_DIALOGS_FILE     UI_DIR "/dialogs.ui"
 
-#define GET_OBJECT(ui, name) \
-          gtk_builder_get_object((ui), (name))
-#define GET_WIDGET(ui, name) \
-          GTK_WIDGET(GET_OBJECT(ui, name))
+PreferencesDialog *ui_preferences_dialog_new(GCalctoolUI *ui)
+{
+    PreferencesDialog *dialog;
+  
+    dialog = g_malloc0(sizeof(PreferencesDialog));
+    dialog->ui = ui;
+    return dialog;
+}
 
 
 G_MODULE_EXPORT
 void
-preferences_response_cb(GtkWidget *widget, gint id, GCalctoolUI *ui)
+preferences_response_cb(GtkWidget *widget, gint id, PreferencesDialog *dialog)
 {
-    gtk_widget_hide(ui->preferences_dialog);
+    gtk_widget_hide(dialog->dialog);
 }
 
 
 G_MODULE_EXPORT
 gboolean
-preferences_dialog_delete_cb(GtkWidget *widget, GCalctoolUI *ui)
+preferences_dialog_delete_cb(GtkWidget *widget, GdkEvent *event, PreferencesDialog *dialog)
 {
-    preferences_response_cb(widget, 0, ui);
+    preferences_response_cb(widget, 0, dialog);
     return TRUE;
 }
 
@@ -165,16 +171,8 @@ trailing_zeroes_check_toggled_cb(GtkWidget *check)
 }
 
 
-void
-ui_show_preferences(GCalctoolUI *ui)
-{  
-    ui_create_dialogs(ui);
-    gtk_window_present(GTK_WINDOW(ui->preferences_dialog));
-}
-
-
 static void
-set_combo_box_from_config(GCalctoolUI *ui, const gchar *name, const gchar *key_name, GType key_type)
+set_combo_box_from_config(PreferencesDialog *dialog, const gchar *name, const gchar *key_name, GType key_type)
 {
     GtkWidget *combo;
     GtkTreeModel *model;
@@ -183,7 +181,7 @@ set_combo_box_from_config(GCalctoolUI *ui, const gchar *name, const gchar *key_n
     GtkTreeIter iter;
     gboolean valid;
 
-    combo = GET_WIDGET(ui->dialog_ui, name);
+    combo = GET_WIDGET(dialog->dialog_ui, name);
     model = gtk_combo_box_get_model(GTK_COMBO_BOX(combo));
     valid = gtk_tree_model_get_iter_first(model, &iter);
 
@@ -235,43 +233,39 @@ set_combo_box_from_config(GCalctoolUI *ui, const gchar *name, const gchar *key_n
 }
 
 
-// FIXME: Take out ascii dialog
 void
-ui_create_dialogs(GCalctoolUI *ui)
-{
+ui_preferences_show(PreferencesDialog *dialog)
+{  
     GtkWidget *widget;
     GtkCellRenderer *renderer;
     gchar *string, **tokens;
     int value;
   
-    if (ui->dialog_ui)
+    if (dialog->dialog_ui) {
+        gtk_window_present(GTK_WINDOW(dialog->dialog));
         return;
+    }
 
     // FIXME: Handle errors
-    ui->dialog_ui = gtk_builder_new();
-    gtk_builder_add_from_file(ui->dialog_ui, UI_DIALOGS_FILE, NULL);
-
-    ui->ascii_dialog = GET_WIDGET(ui->dialog_ui, "ascii_dialog");
-    ui->ascii_entry = GET_WIDGET(ui->dialog_ui, "ascii_entry");
+    dialog->dialog_ui = gtk_builder_new();
+    gtk_builder_add_from_file(dialog->dialog_ui, UI_DIALOGS_FILE, NULL);
 
-    /* Make dialogs transient of the main window */
-    gtk_window_set_transient_for(GTK_WINDOW(ui->ascii_dialog), GTK_WINDOW(ui->main_window));
-
-    ui->preferences_dialog = GET_WIDGET(ui->dialog_ui, "preferences_dialog");
+    dialog->dialog = GET_WIDGET(dialog->dialog_ui, "preferences_dialog");
+    gtk_window_set_transient_for(GTK_WINDOW(dialog->dialog), GTK_WINDOW(dialog->ui->main_window));
 
     /* Configuration dialog */
 
-    widget = GET_WIDGET(ui->dialog_ui, "angle_unit_combobox");
+    widget = GET_WIDGET(dialog->dialog_ui, "angle_unit_combobox");
     renderer = gtk_cell_renderer_text_new();
     gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget), renderer, TRUE);
     gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(widget), renderer, "text", 0);
 
-    widget = GET_WIDGET(ui->dialog_ui, "display_format_combobox");
+    widget = GET_WIDGET(dialog->dialog_ui, "display_format_combobox");
     renderer = gtk_cell_renderer_text_new();
     gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget), renderer, TRUE);
     gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(widget), renderer, "text", 0);
 
-    widget = GET_WIDGET(ui->dialog_ui, "word_size_combobox");
+    widget = GET_WIDGET(dialog->dialog_ui, "word_size_combobox");
     renderer = gtk_cell_renderer_text_new();
     gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget), renderer, TRUE);
     gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(widget), renderer, "text", 0);
@@ -279,7 +273,7 @@ ui_create_dialogs(GCalctoolUI *ui)
     /* Label used in preferences dialog.  The %d is replaced by a spinbutton */
     string = _("Show %d decimal _places");
     tokens = g_strsplit(string, "%d", 2);
-    widget = GET_WIDGET(ui->dialog_ui, "decimal_places_label1");
+    widget = GET_WIDGET(dialog->dialog_ui, "decimal_places_label1");
     if (tokens[0])
         string = g_strstrip(tokens[0]);
     else
@@ -289,7 +283,7 @@ ui_create_dialogs(GCalctoolUI *ui)
     else
         gtk_widget_hide(widget);
 
-    widget = GET_WIDGET(ui->dialog_ui, "decimal_places_label2");
+    widget = GET_WIDGET(dialog->dialog_ui, "decimal_places_label2");
     if (tokens[0] && tokens[1])
         string = g_strstrip(tokens[1]);
     else
@@ -301,21 +295,23 @@ ui_create_dialogs(GCalctoolUI *ui)
 
     g_strfreev(tokens);
 
-    set_combo_box_from_config(ui, "angle_unit_combobox", R_TRIG, G_TYPE_STRING);
-    set_combo_box_from_config(ui, "display_format_combobox", R_DISPLAY, G_TYPE_STRING);
-    set_combo_box_from_config(ui, "word_size_combobox", R_WORDLEN, G_TYPE_INT);
+    set_combo_box_from_config(dialog, "angle_unit_combobox", R_TRIG, G_TYPE_STRING);
+    set_combo_box_from_config(dialog, "display_format_combobox", R_DISPLAY, G_TYPE_STRING);
+    set_combo_box_from_config(dialog, "word_size_combobox", R_WORDLEN, G_TYPE_INT);
 
     if (!get_int_resource(R_ACCURACY, &value))
         value = 9;
-    gtk_spin_button_set_value(GTK_SPIN_BUTTON(GET_OBJECT(ui->dialog_ui, "decimal_places_spin")), value);
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(gtk_builder_get_object(dialog->dialog_ui, "decimal_places_spin")), value);
 
     if (!get_boolean_resource(R_TSEP, &value))
         value = FALSE;
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(GET_OBJECT(ui->dialog_ui, "thousands_separator_check")), value);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(dialog->dialog_ui, "thousands_separator_check")), value);
 
     if (!get_boolean_resource(R_ZEROES, &value))
         value = FALSE;
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(GET_OBJECT(ui->dialog_ui, "trailing_zeroes_check")), value);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(dialog->dialog_ui, "trailing_zeroes_check")), value);
+
+    gtk_builder_connect_signals(dialog->dialog_ui, dialog);
 
-    gtk_builder_connect_signals(ui->dialog_ui, ui);
+    gtk_window_present(GTK_WINDOW(dialog->dialog));
 }
diff --git a/src/ui-preferences.h b/src/ui-preferences.h
index 724254c..f84c465 100644
--- a/src/ui-preferences.h
+++ b/src/ui-preferences.h
@@ -19,8 +19,19 @@
 #ifndef UI_PREFERENCES_H
 #define UI_PREFERENCES_H
 
+typedef struct PreferencesDialog PreferencesDialog;
+
 #include "ui.h"
 
-void ui_show_preferences(GCalctoolUI *ui);
+struct PreferencesDialog
+{
+    GCalctoolUI *ui;
+    GtkBuilder *dialog_ui;
+    GtkWidget *dialog;
+};
+
+PreferencesDialog *ui_preferences_dialog_new(GCalctoolUI *ui);
+
+void ui_preferences_show(PreferencesDialog *dialog);
 
 #endif /* UI_PREFERENCES_H */
diff --git a/src/ui.c b/src/ui.c
index 8e2be59..420b94a 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -17,19 +17,8 @@
  *  02111-1307, USA.
  */
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
 #include <gtk/gtk.h>
 
-#include <limits.h>
-#include <sys/param.h>
-#include <unistd.h>
-#include <netdb.h>
-
 #include "ui.h"
 #include "ui-internal.h"
 #include "ui-display.h"
@@ -51,15 +40,14 @@ ui_init(int *argc, char ***argv)
 }
 
 
-static void
-create_main_window(GCalctoolUI *ui)
+GCalctoolUI *
+ui_new()
 {
-    int i;
-    char name[MAXLINE];
-    GtkWidget *widget;
-    PangoFontDescription *font_desc;
-    GtkCellRenderer *renderer;
+    GCalctoolUI *ui;
     GError *error = NULL;
+    int i;
+
+    ui = g_malloc0(sizeof(GCalctoolUI));
 
     ui->ui = gtk_builder_new();
     gtk_builder_add_from_file(ui->ui, UI_FILE, &error);
@@ -75,65 +63,76 @@ create_main_window(GCalctoolUI *ui)
     }
     gtk_builder_connect_signals(ui->ui, ui);
 
-    ui->clipboard_atom  = gdk_atom_intern("CLIPBOARD", FALSE);
-    ui->primary_atom    = gdk_atom_intern("PRIMARY", FALSE);
-
-    ui->main_window     = GET_WIDGET(ui->ui, "calc_window");
-    ui->scrolledwindow  = GET_WIDGET(ui->ui, "display_scroll"),
-    ui->display_item    = GET_WIDGET(ui->ui, "displayitem"),
-    ui->info_buffer     = GTK_TEXT_BUFFER(gtk_builder_get_object(ui->ui, "info_buffer"));
-    ui->button_vbox     = GET_WIDGET(ui->ui, "button_vbox");
-
-    ui->display_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(ui->display_item));
-    gtk_widget_ensure_style(ui->display_item);
-    font_desc = pango_font_description_copy(gtk_widget_get_style(ui->display_item)->font_desc);
-    pango_font_description_set_size(font_desc, 16 * PANGO_SCALE);
-    gtk_widget_modify_font(ui->display_item, font_desc);
-    pango_font_description_free(font_desc);
-    gtk_widget_set_name(ui->display_item, "displayitem");
-    atk_object_set_role(gtk_widget_get_accessible(ui->display_item),
-                                                  ATK_ROLE_EDITBAR);
-
-    gtk_widget_realize(ui->main_window);
+    ui->main_window = GET_WIDGET(ui->ui, "calc_window");
 
     /* Set modes for menu items */
+  // FIXME: Move into buttons
     for (i = 1; i < 16; i++) {
+        char name[MAXLINE];
         SNPRINTF(name, MAXLINE, "shift_left%d_menu", i);
         g_object_set_data(gtk_builder_get_object(ui->ui, name), "shiftcount", GINT_TO_POINTER(i));
         SNPRINTF(name, MAXLINE, "shift_right%d_menu", i);
         g_object_set_data(gtk_builder_get_object(ui->ui, name), "shiftcount", GINT_TO_POINTER(-i));
     }
+
     g_object_set_data(gtk_builder_get_object(ui->ui, "view_basic_menu"), "calcmode", GINT_TO_POINTER(BASIC));
     g_object_set_data(gtk_builder_get_object(ui->ui, "view_advanced_menu"), "calcmode", GINT_TO_POINTER(ADVANCED));
     g_object_set_data(gtk_builder_get_object(ui->ui, "view_financial_menu"), "calcmode", GINT_TO_POINTER(FINANCIAL));
     g_object_set_data(gtk_builder_get_object(ui->ui, "view_programming_menu"), "calcmode", GINT_TO_POINTER(PROGRAMMING));
+
+    ui->display = ui_display_new(ui);
+    ui->buttons = ui_buttons_new(ui);
+    ui->preferences_dialog = ui_preferences_dialog_new(ui);
+
+    return ui;
 }
 
 
-GCalctoolUI *
-ui_new()
+static void
+ui_set_mode(GCalctoolUI *ui, ButtonMode mode)
 {
-    gchar *path;
-    int value;
-    GCalctoolUI *ui;
+    GtkWidget *menu;
 
-    ui = g_malloc0(sizeof(GCalctoolUI));
+    /* Save mode */
+    set_enumerated_resource(R_MODE, mode_names, (int)mode);
 
-    if (get_enumerated_resource(R_MODE, mode_names, &value))
-        ui->mode = (ModeType) value;
-    else
-        ui->mode = BASIC;
+    ui_buttons_set_mode(ui->buttons, mode);
 
-    /* Create main gcalctool window. */
-    create_main_window(ui);
+    /* Update the menu */
+    switch (mode) {
+        case BASIC:
+            menu = GET_WIDGET(ui->ui, "view_basic_menu");
+            break;
 
-    return ui;
+        case ADVANCED:
+            menu = GET_WIDGET(ui->ui, "view_advanced_menu");
+            break;
+
+        case FINANCIAL:
+            menu = GET_WIDGET(ui->ui, "view_financial_menu");
+            break;
+
+        case PROGRAMMING:
+            menu = GET_WIDGET(ui->ui, "view_programming_menu");
+            break;
+
+        default:
+            g_assert(FALSE);
+            return;
+    }
+    gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
 }
 
 
 void
 ui_start(GCalctoolUI *ui)
 {
+    gint mode;
+
+    mode = BASIC;
+    get_enumerated_resource(R_MODE, mode_names, &mode);
+    ui_set_mode(ui, (ButtonMode)mode);
+
     gtk_widget_show(ui->main_window);
     gtk_main();
 }
@@ -158,112 +157,27 @@ ui_critical_error(GCalctoolUI *ui, const gchar *title, const gchar *contents)
 }
 
 
-// FIXME: Watch for changes in programming mode
-void
-ui_set_bitfield(GCalctoolUI *ui, int enabled, guint64 bits)
-{
-    int i;
-    const gchar *label;
-  
-    if (!ui->bit_panel)
-       return;
-
-    gtk_widget_set_sensitive(ui->bit_panel, enabled);
-
-    for (i = 0; i < MAXBITS; i++) {
-        if (bits & (1LL << (MAXBITS-i-1)))
-            label = " 1";
-        else
-            label = " 0";
-        gtk_label_set_text(GTK_LABEL(ui->bit_labels[i]), label);
-    }
-}
-
-
 void
 ui_set_number_mode(GCalctoolUI *ui, NumberMode mode)
 {
     GList *i;
 
-    ui->number_mode = mode;
-    for (i = ui->superscript_toggles; i; i = i->next) {
+    ui->display->number_mode = mode;
+    for (i = ui->buttons->superscript_toggles; i; i = i->next) {
         GtkWidget *widget = i->data;
         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), mode == SUPERSCRIPT);
     }
-    for (i = ui->subscript_toggles; i; i = i->next) {
+    for (i = ui->buttons->subscript_toggles; i; i = i->next) {
         GtkWidget *widget = i->data;
         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), mode == SUBSCRIPT);
     }
 }
 
 
-static GtkWidget *
-get_buttons(GCalctoolUI *ui, ModeType mode)
-{
-    switch (mode) {
-    case BASIC:
-        return ui->bas_panel;
-    case ADVANCED:
-        return ui->adv_panel;
-    case FINANCIAL:
-        return ui->fin_panel;
-    case PROGRAMMING:
-        return ui->prog_panel;
-    }
-}
-
-
-static void
-ui_set_mode(GCalctoolUI *ui, ModeType mode)
-{
-    GtkWidget *menu;
-    ModeType old_mode;
-
-    old_mode = ui->mode;
-    ui->mode = mode;
-
-    /* Save mode */
-    set_enumerated_resource(R_MODE, mode_names, (int)mode);
-
-    /* Hide the existing mode */
-    if (get_buttons(ui, old_mode))
-        gtk_widget_hide(get_buttons(ui, old_mode));
-  
-    /* Create the new mode if necessary */
-    if (!get_buttons(ui, mode))
-        ui_load_mode(ui, mode);
-    gtk_widget_show(get_buttons(ui, mode));
-
-    /* Update the menu */
-    switch (mode) {
-        case BASIC:
-            menu = GET_WIDGET(ui->ui, "view_basic_menu");
-            break;
-
-        case ADVANCED:
-            menu = GET_WIDGET(ui->ui, "view_advanced_menu");
-            break;
-
-        case FINANCIAL:
-            menu = GET_WIDGET(ui->ui, "view_financial_menu");
-            break;
-
-        case PROGRAMMING:
-            menu = GET_WIDGET(ui->ui, "view_programming_menu");
-            break;
-
-        default:
-            assert(FALSE);
-            return;
-    }
-    gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
-}
-
-
 void
 ui_set_statusbar(GCalctoolUI *ui, const gchar *text)
 {
-    gtk_text_buffer_set_text(ui->info_buffer, text, -1);
+    gtk_text_buffer_set_text(ui->display->info_buffer, text, -1);
 }
 
 
@@ -301,7 +215,7 @@ G_MODULE_EXPORT
 void
 show_preferences_cb(GtkMenuItem *menu, GCalctoolUI *ui)
 {
-    ui_show_preferences(ui);
+    ui_preferences_show(ui->preferences_dialog);
 }
 
 
@@ -350,10 +264,10 @@ about_cb(GtkWidget *widget, GCalctoolUI *ui)
         NULL
     };
 
-    /* Translators: The translator credits. Please translate this with your name(s). */
+    /* The translator credits. Please translate this with your name(s). */
     const gchar *translator_credits = _("translator-credits");
 
-    /* Translators: The license this software is under (GPL2+) */
+    /* The license this software is under (GPL2+) */
     char *license = _("Gcalctool is free software; you can redistribute it and/or modify\n"
           "it under the terms of the GNU General Public License as published by\n"
           "the Free Software Foundation; either version 2 of the License, or\n"
@@ -369,14 +283,17 @@ about_cb(GtkWidget *widget, GCalctoolUI *ui)
           "51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA");
 
     gtk_show_about_dialog(GTK_WINDOW(ui->main_window),
-                          /* Translators: Program name in the about dialog */
-                          "name", _("Gcalctool"),
+                          "name",
+                          /* Program name in the about dialog */
+                          _("Gcalctool"),
                           "version", VERSION,
-                          /* Translators: Copyright notice in the about dialog */
-                          "copyright", _("\xc2\xa9 1986â??2008 The Gcalctool authors"),
+                          "copyright",
+                          /* Copyright notice in the about dialog */
+                          _("\xc2\xa9 1986â??2008 The Gcalctool authors"),
                           "license", license,
-                          /* Translators: Short description in the about dialog */
-                          "comments", _("Calculator with financial and scientific modes."),
+                          "comments",
+                          /* Short description in the about dialog */
+                          _("Calculator with financial and scientific modes."),
                           "authors", authors,
                           "documenters", documenters,
                           "translator_credits", translator_credits,
diff --git a/src/ui.h b/src/ui.h
index 57f6c5d..ba9f2cc 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -20,87 +20,31 @@
 #ifndef UI_H
 #define UI_H
 
-#include <stdint.h>
 #include <gtk/gtk.h>
 
 typedef struct GCalctoolUI GCalctoolUI;
 
 #include "calctool.h"
-
-/* Calculator modes. */
-typedef enum {
-    BASIC,
-    ADVANCED,
-    FINANCIAL,
-    PROGRAMMING
-} ModeType;
-
-typedef enum {
-    NORMAL,
-    SUPERSCRIPT,
-    SUBSCRIPT
-} NumberMode;
-
-#define MAXBITS 64      /* Bit panel: number of bit fields. */
-#define MAX_REGISTERS 6
+#include "ui-display.h"
+#include "ui-buttons.h"
+#include "ui-preferences.h"
 
 // FIXME: Make opaque
 struct GCalctoolUI {
-    ModeType mode;  /* Current calculator mode. */
-    NumberMode number_mode;
-
     GtkBuilder *ui;
-    GtkBuilder *dialog_ui;
-    GtkBuilder *financial;
-    GtkBuilder *basic_ui, *advanced_ui, *financial_ui, *programming_ui;
-
     GtkWidget *main_window;
-
-    GtkWidget *bit_panel;
-    GtkWidget *bit_labels[MAXBITS];
-
-    GtkWidget *ascii_dialog;
-    GtkWidget *ascii_entry;
-
-    GtkWidget *display_item;           /* Calculator display. */
-    GtkTextBuffer *display_buffer;     /* Buffer used in display */
-    GtkTextBuffer *info_buffer;        /* Buffer used in info messages */
-    GtkWidget *scrolledwindow;         /* Scrolled window for display_item. */
-
-    GtkWidget *button_vbox;
-    GtkWidget *bas_panel;      /* Panel containing basic mode widgets. */
-    GtkWidget *adv_panel;      /* Panel containing advanced mode widgets. */
-    GtkWidget *fin_panel;      /* Panel containing financial mode widgets. */
-    GtkWidget *prog_panel;     /* Panel containing programming mode widgets. */
-
-    GList *superscript_toggles;
-    GList *subscript_toggles;
-
-    gboolean can_super_minus;
-
-    /* Labels for popup menus */
-    GtkWidget *memory_store_labels[MAX_REGISTERS];
-    GtkWidget *memory_recall_labels[MAX_REGISTERS];
-
-    GtkWidget *preferences_dialog;
-
-    GdkAtom clipboard_atom;
-    GdkAtom primary_atom;
-    char *shelf;                       /* PUT selection shelf contents. */
-
-    /* Last text entered */
-    char *last_text;
+    MathDisplay *display;
+    Buttons *buttons;
+    PreferencesDialog *preferences_dialog;
 };
 
 void ui_init(int *argc, char ***argv);
 GCalctoolUI *ui_new(void);
 void ui_critical_error(GCalctoolUI *ui, const gchar *title, const gchar *contents);
 void ui_start(GCalctoolUI *ui);
-
 void ui_set_display(GCalctoolUI *ui, char *, int);
 void ui_set_bitfield(GCalctoolUI *ui, int enabled, guint64 bits);
 void ui_set_statusbar(GCalctoolUI *ui, const gchar *);
-
 gchar *ui_get_display(GCalctoolUI *ui);
 
 #endif /* UI_H */



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