[gcalctool] Fix up some broken buttons



commit 8a80626ce136fc3f02ba6d78ca69e98c37c06979
Author: Robert Ancell <robert ancell gmail com>
Date:   Thu Apr 8 20:13:00 2010 +1000

    Fix up some broken buttons

 data/buttons-advanced.ui    |   16 +++----------
 data/buttons-basic.ui       |    4 +++
 data/buttons-programming.ui |   13 +++++-----
 src/math-buttons.c          |   52 ++++++++++++++++++------------------------
 4 files changed, 37 insertions(+), 48 deletions(-)
---
diff --git a/data/buttons-advanced.ui b/data/buttons-advanced.ui
index 9563daf..2cbc71d 100644
--- a/data/buttons-advanced.ui
+++ b/data/buttons-advanced.ui
@@ -773,6 +773,7 @@
             <property name="border_width">3</property>
             <property name="use_underline">True</property>
             <property name="focus_on_click">False</property>
+            <signal name="clicked" handler="button_cb"/>
           </object>
           <packing>
             <property name="left_attach">8</property>
@@ -792,6 +793,7 @@
             <property name="border_width">3</property>
             <property name="use_underline">True</property>
             <property name="focus_on_click">False</property>
+            <signal name="clicked" handler="button_cb"/>
           </object>
           <packing>
             <property name="left_attach">9</property>
@@ -804,24 +806,14 @@
         </child>
         <child>
           <object class="GtkButton" id="calc_conjugate_button">
+            <property name="label">conj</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="receives_default">True</property>
             <property name="border_width">3</property>
             <property name="use_underline">True</property>
             <property name="focus_on_click">False</property>
-            <child internal-child="accessible">
-              <object class="AtkObject" id="calc_conjugate_button-atkobject">
-                <property name="AtkObject::accessible-name" translatable="yes" comments="Accessible name for the absolute value button">Absolute Value</property>
-              </object>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label5">
-                <property name="visible">True</property>
-                <property name="label">conj</property>
-                <property name="use_markup">True</property>
-              </object>
-            </child>
+            <signal name="clicked" handler="button_cb"/>
           </object>
           <packing>
             <property name="left_attach">9</property>
diff --git a/data/buttons-basic.ui b/data/buttons-basic.ui
index da57a8a..798144a 100644
--- a/data/buttons-basic.ui
+++ b/data/buttons-basic.ui
@@ -409,6 +409,7 @@
                 <property name="AtkObject::accessible-name" translatable="yes" comments="Accessible name for the recall value button">Recall</property>
               </object>
             </child>
+            <signal name="clicked" handler="recall_cb"/>
             <child>
               <object class="GtkHBox" id="hbox19">
                 <property name="visible">True</property>
@@ -456,6 +457,7 @@
                 <property name="AtkObject::accessible-name" translatable="yes" comments="Accessible name for the store value button">Store</property>
               </object>
             </child>
+            <signal name="clicked" handler="store_cb"/>
             <child>
               <object class="GtkHBox" id="hbox20">
                 <property name="visible">True</property>
@@ -500,6 +502,7 @@
             <property name="border_width">3</property>
             <property name="use_underline">True</property>
             <property name="focus_on_click">False</property>
+            <signal name="clicked" handler="button_cb"/>
           </object>
           <packing>
             <property name="left_attach">5</property>
@@ -517,6 +520,7 @@
             <property name="receives_default">True</property>
             <property name="border_width">3</property>
             <property name="focus_on_click">False</property>
+            <signal name="clicked" handler="button_cb"/>
             <child internal-child="accessible">
               <object class="AtkObject" id="calc_x_squared_button-atkobject">
                 <property name="AtkObject::accessible-name" translatable="yes" comments="Accessible name for the exponentiation (x to the power of y) button">Exponent</property>
diff --git a/data/buttons-programming.ui b/data/buttons-programming.ui
index 50baec6..b70c22f 100644
--- a/data/buttons-programming.ui
+++ b/data/buttons-programming.ui
@@ -2289,7 +2289,7 @@
                 <property name="border_width">3</property>
                 <property name="use_underline">True</property>
                 <property name="focus_on_click">False</property>
-                <signal name="clicked" handler="button_cb"/>
+                <signal name="clicked" handler="digit_cb"/>
               </object>
               <packing>
                 <property name="left_attach">2</property>
@@ -2309,7 +2309,7 @@
                 <property name="border_width">3</property>
                 <property name="use_underline">True</property>
                 <property name="focus_on_click">False</property>
-                <signal name="clicked" handler="button_cb"/>
+                <signal name="clicked" handler="digit_cb"/>
               </object>
               <packing>
                 <property name="left_attach">3</property>
@@ -2329,7 +2329,7 @@
                 <property name="border_width">3</property>
                 <property name="use_underline">True</property>
                 <property name="focus_on_click">False</property>
-                <signal name="clicked" handler="button_cb"/>
+                <signal name="clicked" handler="digit_cb"/>
               </object>
               <packing>
                 <property name="top_attach">1</property>
@@ -2347,7 +2347,7 @@
                 <property name="border_width">3</property>
                 <property name="use_underline">True</property>
                 <property name="focus_on_click">False</property>
-                <signal name="clicked" handler="button_cb"/>
+                <signal name="clicked" handler="digit_cb"/>
               </object>
               <packing>
                 <property name="left_attach">1</property>
@@ -2367,7 +2367,7 @@
                 <property name="border_width">3</property>
                 <property name="use_underline">True</property>
                 <property name="focus_on_click">False</property>
-                <signal name="clicked" handler="button_cb"/>
+                <signal name="clicked" handler="digit_cb"/>
               </object>
               <packing>
                 <property name="left_attach">2</property>
@@ -2387,7 +2387,7 @@
                 <property name="border_width">3</property>
                 <property name="use_underline">True</property>
                 <property name="focus_on_click">False</property>
-                <signal name="clicked" handler="button_cb"/>
+                <signal name="clicked" handler="digit_cb"/>
               </object>
               <packing>
                 <property name="left_attach">3</property>
@@ -2785,6 +2785,7 @@
                 <property name="border_width">3</property>
                 <property name="use_underline">True</property>
                 <property name="focus_on_click">False</property>
+                <signal name="clicked" handler="button_cb"/>
               </object>
               <packing>
                 <property name="left_attach">6</property>
diff --git a/src/math-buttons.c b/src/math-buttons.c
index 211ad2a..15fb80e 100644
--- a/src/math-buttons.c
+++ b/src/math-buttons.c
@@ -84,6 +84,7 @@ typedef struct {
 static ButtonData button_data[] = {
     {"pi",                 "Ï?"},
     {"eulers_number",      "e"},
+    {"imaginary",          "i"},
     {"numeric_point",      "."},
     {"add",                "+"},
     {"multiply",           "Ã?"},
@@ -94,25 +95,28 @@ static ButtonData button_data[] = {
     {"percentage",         "%"},
     {"factorial",          "!"},
     {"abs",                "|"},
+    {"conjugate",          "conj "},
     {"root",               "â??"},
-    {"logarithm",          "log"},
-    {"natural_logarithm",  "ln"},
-    {"sine",               "sin"},
-    {"cosine",             "cos"},
-    {"tangent",            "tan"},
-    {"hyperbolic_sine",    "sinh"},
-    {"hyperbolic_cosine",  "cosh"},
-    {"hyperbolic_tangent", "tanh"},
+    {"logarithm",          "log "},
+    {"natural_logarithm",  "ln "},
+    {"sine",               "sin "},
+    {"cosine",             "cos "},
+    {"tangent",            "tan "},
+    {"hyperbolic_sine",    "sinh "},
+    {"hyperbolic_cosine",  "cosh "},
+    {"hyperbolic_tangent", "tanh "},
     {"inverse",            "�¹"},
     {"and",                "â?§"},
     {"or",                 "â?¨"},
     {"xor",                "â?»"},
     {"not",                "¬"},
-    {"integer_portion",    "int"},
-    {"fractional_portion", "frac"},
-    {"ones_complement",    "ones"},
-    {"twos_complement",    "twos"},
-    {"trunc",              "trunc"},
+    {"integer_portion",    "int "},
+    {"fractional_portion", "frac "},
+    {"real_portion",       "re "},
+    {"imaginary_portion",  "im "},
+    {"ones_complement",    "ones "},
+    {"twos_complement",    "twos "},
+    {"trunc",              "trunc "},
     {"start_group",        "("},
     {"end_group",          ")"},
     {NULL, NULL}
@@ -335,27 +339,21 @@ load_mode(MathButtons *buttons, ButtonMode mode)
         g_free(name);
     }
 
-    /* Localize buttons */
     for (i = 0; i < 16; i++) {
         GtkWidget *button;
 
         name = g_strdup_printf("calc_%d_button", i);
-        button = GET_WIDGET(builder, name);     
-        if (button)
+        button = GET_WIDGET(builder, name);
+        if (button) {
+            g_object_set_data(G_OBJECT(button), "calc_digit", GINT_TO_POINTER(i));
+            set_tint(button, &buttons->priv->colour_numbers, 1);
             gtk_button_set_label(GTK_BUTTON(button), math_equation_get_digit_text(buttons->priv->equation, i));
+        }
         g_free(name);
     }
     widget = GET_WIDGET(builder, "calc_numeric_point_button");
     if (widget)
         gtk_button_set_label(GTK_BUTTON(widget), math_equation_get_numeric_point_text(buttons->priv->equation));
-
-    /* Connect super and subscript */
-    for (i = 0; i < 10; i++) {
-        name = g_strdup_printf("calc_%d_button", i);
-        set_int_data(builder, name, "calc_digit", i);
-        set_tint(GET_WIDGET(builder, name), &buttons->priv->colour_numbers, 1);
-        g_free(name);
-    }
   
     widget = GET_WIDGET(builder, "superscript_togglebutton");
     if (widget) {
@@ -370,12 +368,6 @@ load_mode(MathButtons *buttons, ButtonMode mode)
             gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
     }
 
-    set_tint(GET_WIDGET(builder, "calc_10_button"), &buttons->priv->colour_numbers, 1);
-    set_tint(GET_WIDGET(builder, "calc_11_button"), &buttons->priv->colour_numbers, 1);  
-    set_tint(GET_WIDGET(builder, "calc_12_button"), &buttons->priv->colour_numbers, 1);
-    set_tint(GET_WIDGET(builder, "calc_13_button"), &buttons->priv->colour_numbers, 1);
-    set_tint(GET_WIDGET(builder, "calc_14_button"), &buttons->priv->colour_numbers, 1);  
-    set_tint(GET_WIDGET(builder, "calc_15_button"), &buttons->priv->colour_numbers, 1);
     set_tint(GET_WIDGET(builder, "calc_imaginary_button"), &buttons->priv->colour_numbers, 1);
     set_tint(GET_WIDGET(builder, "calc_pi_button"), &buttons->priv->colour_numbers, 1);
     set_tint(GET_WIDGET(builder, "calc_eulers_number_button"), &buttons->priv->colour_numbers, 1);



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