[gcalctool] Merge base and display format together



commit 8752c56951970927c2211b0c9cad11a45ed7396a
Author: Robert Ancell <robert ancell gmail com>
Date:   Mon Apr 12 22:29:24 2010 +0800

    Merge base and display format together

 data/preferences.ui    |   49 +++++-------------------
 src/get.h              |    1 -
 src/math-display.c     |    8 ++--
 src/math-equation.c    |   96 ++++++++++++++++++++----------------------------
 src/math-equation.h    |    7 +--
 src/math-preferences.c |   45 ++++------------------
 src/ui.c               |   13 ++++--
 7 files changed, 74 insertions(+), 145 deletions(-)
---
diff --git a/data/preferences.ui b/data/preferences.ui
index 3a8ee02..1c66df1 100644
--- a/data/preferences.ui
+++ b/data/preferences.ui
@@ -10,7 +10,7 @@
       <column type="gint"/>
     </columns>
   </object>
-  <object class="GtkListStore" id="display_format_model">
+  <object class="GtkListStore" id="number_format_model">
     <columns>
       <!-- column-name label -->
       <column type="gchararray"/>
@@ -59,7 +59,7 @@
           <object class="GtkTable" id="preferences_table">
             <property name="visible">True</property>
             <property name="border_width">5</property>
-            <property name="n_rows">5</property>
+            <property name="n_rows">4</property>
             <property name="n_columns">2</property>
             <property name="column_spacing">6</property>
             <property name="row_spacing">12</property>
@@ -81,9 +81,9 @@
               <object class="GtkLabel" id="label9">
                 <property name="visible">True</property>
                 <property name="xalign">0</property>
-                <property name="label" translatable="yes" comments="Preferences dialog: Label for display format combo box">Display _Format:</property>
+                <property name="label" translatable="yes" comments="Preferences dialog: Label for display format combo box">Number _Format:</property>
                 <property name="use_underline">True</property>
-                <property name="mnemonic_widget">display_format_combobox</property>
+                <property name="mnemonic_widget">number_format_combobox</property>
               </object>
               <packing>
                 <property name="x_options">GTK_FILL</property>
@@ -103,10 +103,10 @@
               </packing>
             </child>
             <child>
-              <object class="GtkComboBox" id="display_format_combobox">
+              <object class="GtkComboBox" id="number_format_combobox">
                 <property name="visible">True</property>
-                <property name="model">display_format_model</property>
-                <signal name="changed" handler="display_format_combobox_changed_cb"/>
+                <property name="model">number_format_model</property>
+                <signal name="changed" handler="number_format_combobox_changed_cb"/>
               </object>
               <packing>
                 <property name="left_attach">1</property>
@@ -122,8 +122,8 @@
                 <property name="mnemonic_widget">word_size_combobox</property>
               </object>
               <packing>
-                <property name="top_attach">4</property>
-                <property name="bottom_attach">5</property>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
                 <property name="x_options">GTK_FILL</property>
               </packing>
             </child>
@@ -136,8 +136,8 @@
               <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="top_attach">3</property>
+                <property name="bottom_attach">4</property>
               </packing>
             </child>
             <child>
@@ -233,33 +233,6 @@
                 <property name="bottom_attach">2</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkLabel" id="label1">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes" comments="Preferences dialog: label for word size combo box">Number _base:</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">number_base_combobox</property>
-              </object>
-              <packing>
-                <property name="top_attach">3</property>
-                <property name="bottom_attach">4</property>
-                <property name="x_options">GTK_FILL</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkComboBox" id="number_base_combobox">
-                <property name="visible">True</property>
-                <property name="model">number_base_model</property>
-                <signal name="changed" handler="number_base_combobox_changed_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>
-              </packing>
-            </child>
           </object>
           <packing>
             <property name="position">1</property>
diff --git a/src/get.h b/src/get.h
index 46c46aa..5d5044f 100644
--- a/src/get.h
+++ b/src/get.h
@@ -27,7 +27,6 @@
 #define R_ZEROES   "showzeroes"
 #define R_TSEP     "showthousands"
 #define R_WORDLEN  "wordlen"
-#define R_BASE     "base"
 
 void resources_init();
 
diff --git a/src/math-display.c b/src/math-display.c
index 77ae118..c62e9f8 100644
--- a/src/math-display.c
+++ b/src/math-display.c
@@ -97,10 +97,10 @@ display_key_press_cb(GtkWidget *widget, GdkEventKey *event, MathDisplay *display
         switch(event->keyval)
         {
         case GDK_b:
-            math_equation_set_base(display->priv->equation, 2);
+            math_equation_set_number_format(display->priv->equation, BIN);
             return TRUE;
         case GDK_d:
-            math_equation_set_base(display->priv->equation, 10);
+            math_equation_set_number_format(display->priv->equation, DEC);
             return TRUE;
         case GDK_e:
             math_equation_insert_exponent(display->priv->equation);
@@ -109,13 +109,13 @@ display_key_press_cb(GtkWidget *widget, GdkEventKey *event, MathDisplay *display
             math_equation_factorize(display->priv->equation);
             return TRUE;
         case GDK_h:
-            math_equation_set_base(display->priv->equation, 16);
+            math_equation_set_number_format(display->priv->equation, HEX);
             return TRUE;
         case GDK_i:
             math_equation_insert(display->priv->equation, "�¹");
             return TRUE;
         case GDK_o:
-            math_equation_set_base(display->priv->equation, 8);
+            math_equation_set_number_format(display->priv->equation, OCT);
             return TRUE;
         case GDK_p:
             math_equation_insert(display->priv->equation, "Ï?");
diff --git a/src/math-equation.c b/src/math-equation.c
index 4e07f8c..c2d5e6f 100644
--- a/src/math-equation.c
+++ b/src/math-equation.c
@@ -44,13 +44,12 @@ enum {
     PROP_ACCURACY,
     PROP_SHOW_THOUSANDS_SEPARATORS,
     PROP_SHOW_TRAILING_ZEROES,
-    PROP_DISPLAY_FORMAT,
+    PROP_NUMBER_FORMAT,
     PROP_WORD_SIZE,
-    PROP_ANGLE_UNITS,
-    PROP_BASE
+    PROP_ANGLE_UNITS
 };
 
-static GType number_mode_type, display_format_type, angle_unit_type;
+static GType number_mode_type, number_format_type, angle_unit_type;
 
 #define MAX_DIGITS 512
 
@@ -73,7 +72,6 @@ struct MathEquationPrivate
     int show_zeroes;          /* Set if trailing zeroes should be shown. */
     DisplayFormat format;     /* Number display mode. */
     int accuracy;             /* Number of digits to show */
-    int base;                 /* Number base */
     int word_size;            /* Word size in bits */
     MPAngleUnit angle_units;  /* Units for trigonometric functions */
     NumberMode number_mode;   /* ??? */
@@ -241,18 +239,18 @@ math_equation_get_show_trailing_zeroes(MathEquation *equation)
 
 
 void
-math_equation_set_display_format(MathEquation *equation, DisplayFormat format)
+math_equation_set_number_format(MathEquation *equation, DisplayFormat format)
 {
     if (equation->priv->format == format)
         return;
     equation->priv->format = format;
     display_refresh(equation);
-    g_object_notify(G_OBJECT(equation), "display-format");
+    g_object_notify(G_OBJECT(equation), "number-format");
 }
 
 
 DisplayFormat
-math_equation_get_display_format(MathEquation *equation)
+math_equation_get_number_format(MathEquation *equation)
 {
     return equation->priv->format;
 }
@@ -293,23 +291,6 @@ math_equation_get_angle_units(MathEquation *equation)
 
 
 void
-math_equation_set_base(MathEquation *equation, gint base)
-{
-    if (equation->priv->base == base)
-        return;
-    equation->priv->base = base;
-    g_object_notify(G_OBJECT(equation), "base");
-}
-
-
-gint
-math_equation_get_base(MathEquation *equation)
-{
-   return equation->priv->base;
-}
-
-
-void
 math_equation_set_status(MathEquation *equation, const gchar *status)
 {
     g_free(equation->priv->status);
@@ -373,6 +354,23 @@ math_equation_get_equation(MathEquation *equation)
 }
 
 
+static int
+get_base(MathEquation *equation)
+{
+    switch(equation->priv->format)
+    {
+    case BIN:
+      return 2;
+    case OCT:
+      return 8;
+    case HEX:
+      return 16;
+    default:
+      return 10;
+    }
+}
+
+
 gboolean
 math_equation_get_number(MathEquation *equation, MPNumber *z)
 {
@@ -380,7 +378,7 @@ math_equation_get_number(MathEquation *equation, MPNumber *z)
     gboolean result;
 
     text = math_equation_get_display(equation);
-    result = !mp_set_from_string(text, equation->priv->base, z);
+    result = !mp_set_from_string(text, get_base(equation), z);
     g_free (text);
 
     return result;
@@ -726,7 +724,7 @@ parse(MathEquation *equation, const char *text, MPNumber *z, char **error_token)
     MPEquationOptions options;
 
     memset(&options, 0, sizeof(options));
-    options.base = equation->priv->base;
+    options.base = get_base(equation);
     options.wordlen = equation->priv->word_size;
     options.angle_units = equation->priv->angle_units;
     options.variable_is_defined = variable_is_defined;
@@ -1034,22 +1032,22 @@ display_make_number(MathEquation *equation, char *target, int target_len, const
 {
     switch(equation->priv->format) {
     case DEC:
-        mp_cast_to_string(x, equation->priv->base, 10, equation->priv->accuracy, !equation->priv->show_zeroes, target, target_len);
+        mp_cast_to_string(x, get_base(equation), 10, equation->priv->accuracy, !equation->priv->show_zeroes, target, target_len);
         break;
     case BIN:
-        mp_cast_to_string(x, equation->priv->base, 2, equation->priv->accuracy, !equation->priv->show_zeroes, target, target_len);
+        mp_cast_to_string(x, get_base(equation), 2, equation->priv->accuracy, !equation->priv->show_zeroes, target, target_len);
         break;
     case OCT:
-        mp_cast_to_string(x, equation->priv->base, 8, equation->priv->accuracy, !equation->priv->show_zeroes, target, target_len);
+        mp_cast_to_string(x, get_base(equation), 8, equation->priv->accuracy, !equation->priv->show_zeroes, target, target_len);
         break;
     case HEX:
-        mp_cast_to_string(x, equation->priv->base, 16, equation->priv->accuracy, !equation->priv->show_zeroes, target, target_len);
+        mp_cast_to_string(x, get_base(equation), 16, equation->priv->accuracy, !equation->priv->show_zeroes, target, target_len);
         break;
     case SCI:
-        make_eng_sci(equation, target, target_len, x, equation->priv->base, 10);
+        make_eng_sci(equation, target, target_len, x, get_base(equation), 10);
         break;
     case ENG:
-        make_eng_sci(equation, target, target_len, x, equation->priv->base, 10);
+        make_eng_sci(equation, target, target_len, x, get_base(equation), 10);
         break;
     }
 }
@@ -1084,8 +1082,8 @@ math_equation_set_property(GObject      *object,
     case PROP_SHOW_TRAILING_ZEROES:
       math_equation_set_show_trailing_zeroes(self, g_value_get_boolean(value));
       break;
-    case PROP_DISPLAY_FORMAT:
-      math_equation_set_display_format(self, g_value_get_int(value));
+    case PROP_NUMBER_FORMAT:
+      math_equation_set_number_format(self, g_value_get_int(value));
       break;
     case PROP_WORD_SIZE:
       math_equation_set_word_size(self, g_value_get_int(value));
@@ -1093,9 +1091,6 @@ math_equation_set_property(GObject      *object,
     case PROP_ANGLE_UNITS:
       math_equation_set_angle_units(self, g_value_get_int(value));
       break;
-    case PROP_BASE:
-      math_equation_set_base(self, g_value_get_int(value));
-      break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         break;
@@ -1140,7 +1135,7 @@ math_equation_get_property(GObject    *object,
     case PROP_SHOW_TRAILING_ZEROES:
       g_value_set_boolean(value, self->priv->show_zeroes);
       break;
-    case PROP_DISPLAY_FORMAT:
+    case PROP_NUMBER_FORMAT:
       g_value_set_enum(value, self->priv->format);
       break;
     case PROP_WORD_SIZE:
@@ -1149,9 +1144,6 @@ math_equation_get_property(GObject    *object,
     case PROP_ANGLE_UNITS:
       g_value_set_enum(value, self->priv->angle_units);
       break;
-    case PROP_BASE:
-      g_value_set_int(value, self->priv->base);
-      break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         break;
@@ -1169,7 +1161,7 @@ math_equation_class_init (MathEquationClass *klass)
       {SUBSCRIPT,   "subscript",   "subscript"},
       {0, NULL, NULL}
     };
-    static GEnumValue display_format_values[] =
+    static GEnumValue number_format_values[] =
     {
       {DEC, "DEC", "DEC"},
       {BIN, "BIN", "BIN"},
@@ -1194,7 +1186,7 @@ math_equation_class_init (MathEquationClass *klass)
     g_type_class_add_private (klass, sizeof (MathEquationPrivate));
   
     number_mode_type = g_enum_register_static("NumberMode", number_mode_values);
-    display_format_type = g_enum_register_static("DisplayFormat", display_format_values);
+    number_format_type = g_enum_register_static("DisplayFormat", number_format_values);
     angle_unit_type = g_enum_register_static("AngleUnit", angle_unit_values);
 
     g_object_class_install_property(object_class,
@@ -1248,11 +1240,11 @@ math_equation_class_init (MathEquationClass *klass)
                                                          FALSE,
                                                          G_PARAM_READWRITE));
     g_object_class_install_property(object_class,
-                                    PROP_DISPLAY_FORMAT,
-                                    g_param_spec_enum("display-format",
-                                                      "display-format",
+                                    PROP_NUMBER_FORMAT,
+                                    g_param_spec_enum("number-format",
+                                                      "number-format",
                                                       "Display format",
-                                                      display_format_type,
+                                                      number_format_type,
                                                       DEC,
                                                       G_PARAM_READWRITE));
     g_object_class_install_property(object_class,
@@ -1270,13 +1262,6 @@ math_equation_class_init (MathEquationClass *klass)
                                                       angle_unit_type,
                                                       MP_DEGREES,
                                                       G_PARAM_READWRITE));
-    g_object_class_install_property(object_class,
-                                    PROP_BASE,
-                                    g_param_spec_int("base",
-                                                     "base",
-                                                     "Numeric base",
-                                                     2, 16, 10,
-                                                     G_PARAM_READWRITE));
 }
 
 
@@ -1352,7 +1337,6 @@ math_equation_init(MathEquation *equation)
     equation->priv->show_zeroes = FALSE;
     equation->priv->show_tsep = FALSE;
     equation->priv->format = DEC;
-    equation->priv->base = 10;
     equation->priv->accuracy = 9;
     equation->priv->word_size = 32;
     equation->priv->angle_units = MP_DEGREES;
diff --git a/src/math-equation.h b/src/math-equation.h
index e98ed03..4b66aaf 100644
--- a/src/math-equation.h
+++ b/src/math-equation.h
@@ -84,8 +84,8 @@ gboolean math_equation_get_show_thousands_separators(MathEquation *equation);
 void math_equation_set_show_trailing_zeroes(MathEquation *equation, gboolean visible);
 gboolean math_equation_get_show_trailing_zeroes(MathEquation *equation);
 
-void math_equation_set_display_format(MathEquation *equation, DisplayFormat format);
-DisplayFormat math_equation_get_display_format(MathEquation *equation);
+void math_equation_set_number_format(MathEquation *equation, DisplayFormat format);
+DisplayFormat math_equation_get_number_format(MathEquation *equation);
 
 void math_equation_set_word_size(MathEquation *equation, int word_size);
 int math_equation_get_word_size(MathEquation *equation);
@@ -93,9 +93,6 @@ int math_equation_get_word_size(MathEquation *equation);
 void math_equation_set_angle_unit(MathEquation *equation, MPAngleUnit angle_unit);
 MPAngleUnit math_equation_get_angle_unit(MathEquation *equation);
 
-void math_equation_set_base(MathEquation *equation, gint base);
-gint math_equation_get_base(MathEquation *equation);
-
 void math_equation_copy(MathEquation *equation);
 void math_equation_paste(MathEquation *equation);
 void math_equation_store(MathEquation *equation, const gchar *name);
diff --git a/src/math-preferences.c b/src/math-preferences.c
index cb49dec..91a1b7c 100644
--- a/src/math-preferences.c
+++ b/src/math-preferences.c
@@ -63,7 +63,7 @@ preferences_dialog_delete_cb(GtkWidget *widget, GdkEvent *event)
 
 G_MODULE_EXPORT
 void
-display_format_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialog)
+number_format_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialog)
 {
     DisplayFormat value;
     GtkTreeModel *model;
@@ -72,7 +72,7 @@ display_format_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dial
     model = gtk_combo_box_get_model(GTK_COMBO_BOX(combo));
     gtk_combo_box_get_active_iter(GTK_COMBO_BOX(combo), &iter);
     gtk_tree_model_get(model, &iter, 1, &value, -1);
-    math_equation_set_display_format(dialog->priv->equation, value);
+    math_equation_set_number_format(dialog->priv->equation, value);
 }
 
 
@@ -93,21 +93,6 @@ angle_unit_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialog)
 
 G_MODULE_EXPORT
 void
-number_base_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialog)
-{
-    MPAngleUnit value;
-    GtkTreeModel *model;
-    GtkTreeIter iter;
-
-    model = gtk_combo_box_get_model(GTK_COMBO_BOX(combo));
-    gtk_combo_box_get_active_iter(GTK_COMBO_BOX(combo), &iter);
-    gtk_tree_model_get(model, &iter, 1, &value, -1);
-    math_equation_set_base(dialog->priv->equation, value);
-}
-
-
-G_MODULE_EXPORT
-void
 word_size_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialog)
 {
     gint value;
@@ -205,9 +190,9 @@ show_trailing_zeroes_cb(MathEquation *equation, GParamSpec *spec, MathPreference
 
 
 static void
-display_format_cb(MathEquation *equation, GParamSpec *spec, MathPreferencesDialog *dialog)
+number_format_cb(MathEquation *equation, GParamSpec *spec, MathPreferencesDialog *dialog)
 {
-    set_combo_box_from_int(GET_WIDGET(dialog->priv->ui, "display_format_combobox"), math_equation_get_display_format(equation));
+    set_combo_box_from_int(GET_WIDGET(dialog->priv->ui, "number_format_combobox"), math_equation_get_number_format(equation));
 }
 
 
@@ -226,13 +211,6 @@ angle_unit_cb(MathEquation *equation, GParamSpec *spec, MathPreferencesDialog *d
 
 
 static void
-base_cb(MathEquation *equation, GParamSpec *spec, MathPreferencesDialog *dialog)
-{
-    set_combo_box_from_int(GET_WIDGET(dialog->priv->ui, "number_base_combobox"), math_equation_get_base(equation));
-}
-
-
-static void
 create_gui(MathPreferencesDialog *dialog)
 {
     GtkWidget *widget;
@@ -241,7 +219,7 @@ create_gui(MathPreferencesDialog *dialog)
     GtkCellRenderer *renderer;
     gchar *string, **tokens;
     GError *error = NULL;
-    static gchar *objects[] = { "preferences_table", "angle_unit_model", "display_format_model",
+    static gchar *objects[] = { "preferences_table", "angle_unit_model", "number_format_model",
                                 "word_size_model", "decimal_places_adjustment", "number_base_model", NULL };
 
     // FIXME: Handle errors
@@ -281,7 +259,7 @@ create_gui(MathPreferencesDialog *dialog)
     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(dialog->priv->ui, "display_format_combobox");
+    widget = GET_WIDGET(dialog->priv->ui, "number_format_combobox");
     model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
     gtk_list_store_append(GTK_LIST_STORE(model), &iter);
     gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0,
@@ -311,11 +289,6 @@ create_gui(MathPreferencesDialog *dialog)
     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(dialog->priv->ui, "number_base_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(dialog->priv->ui, "word_size_combobox");
     renderer = gtk_cell_renderer_text_new();
     gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget), renderer, TRUE);
@@ -351,18 +324,16 @@ create_gui(MathPreferencesDialog *dialog)
     g_signal_connect(dialog->priv->equation, "notify::accuracy", G_CALLBACK(accuracy_cb), dialog);
     g_signal_connect(dialog->priv->equation, "notify::show-thousands-separators", G_CALLBACK(show_thousands_separators_cb), dialog);
     g_signal_connect(dialog->priv->equation, "notify::show-trailing_zeroes", G_CALLBACK(show_trailing_zeroes_cb), dialog);
-    g_signal_connect(dialog->priv->equation, "notify::display_format", G_CALLBACK(display_format_cb), dialog);
+    g_signal_connect(dialog->priv->equation, "notify::number_format", G_CALLBACK(number_format_cb), dialog);
     g_signal_connect(dialog->priv->equation, "notify::word-size", G_CALLBACK(word_size_cb), dialog);
     g_signal_connect(dialog->priv->equation, "notify::angle-unit", G_CALLBACK(angle_unit_cb), dialog);
-    g_signal_connect(dialog->priv->equation, "notify::base", G_CALLBACK(base_cb), dialog);
 
     accuracy_cb(dialog->priv->equation, NULL, dialog);
     show_thousands_separators_cb(dialog->priv->equation, NULL, dialog);
     show_trailing_zeroes_cb(dialog->priv->equation, NULL, dialog);
-    display_format_cb(dialog->priv->equation, NULL, dialog);
+    number_format_cb(dialog->priv->equation, NULL, dialog);
     word_size_cb(dialog->priv->equation, NULL, dialog);
     angle_unit_cb(dialog->priv->equation, NULL, dialog);
-    base_cb(dialog->priv->equation, NULL, dialog);
 }
 
 
diff --git a/src/ui.c b/src/ui.c
index ce5da60..ed1a87f 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -325,21 +325,26 @@ ui_init(GCalctoolUI *ui)
     int accuracy = 9, base = 10, word_size = 64;
     gchar *angle_units;
     gboolean show_tsep = FALSE, show_zeroes = FALSE;
-    gchar *display_format, *angle_unit;
+    gchar *number_format, *angle_unit;
 
     ui->priv = G_TYPE_INSTANCE_GET_PRIVATE (ui, ui_get_type(), GCalctoolUIPrivate);
   
     ui->priv->equation = math_equation_new();
     get_int_resource(R_ACCURACY, &accuracy);
-    get_int_resource(R_BASE, &accuracy);
     get_int_resource(R_WORDLEN, &word_size);
     get_boolean_resource(R_TSEP, &show_tsep);  
     get_boolean_resource(R_ZEROES, &show_zeroes);
-    display_format = get_resource(R_DISPLAY);
+    number_format = get_resource(R_DISPLAY);
     angle_units = get_resource(R_TRIG);
   
     math_equation_set_accuracy(ui->priv->equation, accuracy);
-    g_free(display_format);
+    math_equation_set_word_length(ui->priv->equation, word_size);
+    math_equation_set_show_thousands_separators(ui->priv->equation, show_tsep);
+    math_equation_set_show_trailing_zeroes(ui->priv->equation, show_zeroes);
+    //math_equation_set_number_format(ui->priv->equation, ?);
+    //math_equation_set_angle_units(ui->priv->equation, ?);
+
+    g_free(number_format);
     g_free(angle_units);
   
     // FIXME: Save these on quit



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