summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormbkma <[email protected]>2019-04-29 10:24:33 +0200
committerraveit65 <[email protected]>2019-05-07 21:13:40 +0200
commit9f79e160e37e63c078385a79ecca4c20f507d553 (patch)
treef989056375a786c71cbec8ee07fdc0e0e6f93e10
parent5419061e9ae44d73f38ab4d7ab73242337acff6d (diff)
downloadmate-calc-9f79e160e37e63c078385a79ecca4c20f507d553.tar.bz2
mate-calc-9f79e160e37e63c078385a79ecca4c20f507d553.tar.xz
Add unit tooltips to physical constants
This adds unit tooltips to the const menu which appear when hovering over a specific constant with the mouse. Changes to be committed: modified: math-buttons.c
-rw-r--r--src/math-buttons.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/math-buttons.c b/src/math-buttons.c
index 22d8570..3f9be51 100644
--- a/src/math-buttons.c
+++ b/src/math-buttons.c
@@ -1042,28 +1042,28 @@ const_cb(GtkWidget *widget, MathButtons *buttons)
GtkWidget *menu;
struct
{
- gchar *name, *constant;
+ gchar *name, *constant, *tooltip;
} constants[] =
{
{ /* Tooltip for the c₀ component button */
- N_("Velocity of Light"), "c₀" },
+ N_("Velocity of Light"), "c₀", N_("299,792,458 m/s") },
{ /* Tooltip for the μ₀ component button */
- N_("Magnetic constant"), "μ₀" },
+ N_("Magnetic constant"), "μ₀", N_("1.2566370614×10⁻⁶ N/A²") },
{ /* Tooltip for the ε₀ button */
- N_("Electric constant"), "ε₀" },
+ N_("Electric constant"), "ε₀", N_("8.85418782×10⁻¹² s⁴A²/m³kg") },
{ /* Tooltip for the G button */
- N_("Newtonian constant of gravitation"), "G" },
+ N_("Newtonian constant of gravitation"), "G", N_("6.67408×10⁻¹¹ m³/(s²kg)") },
{ /* Tooltip for the h button */
- N_("Planck constant"), "h" },
+ N_("Planck constant"), "h", N_("6.62607004×10⁻³⁴ m²kg/s") },
{ /* Tooltip for the e button */
- N_("Elementary charge"), "e" },
+ N_("Elementary charge"), "e", N_("1.6021766208(98)×10⁻¹⁹ C") },
{ /* Tooltip for the mₑ button */
- N_("Electron mass"), "mₑ" },
+ N_("Electron mass"), "mₑ", N_("9.10938356×10⁻³¹ kg") },
{ /* Tooltip for the mₚ button */
- N_("Proton mass"), "mₚ" },
+ N_("Proton mass"), "mₚ", N_("1.672621898(21)×10⁻²⁷ kg") },
{ /* Tooltip for the Nₐ button */
- N_("Avogrado constant"), "Nₐ" },
- { NULL, NULL }
+ N_("Avogrado constant"), "Nₐ", N_("6.02214086×10²³ mol⁻¹") },
+ { NULL, NULL, NULL }
};
menu = buttons->priv->const_menu = gtk_menu_new();
@@ -1073,6 +1073,7 @@ const_cb(GtkWidget *widget, MathButtons *buttons)
GtkWidget *item;
item = gtk_menu_item_new_with_label(_(constants[i].name));
+ gtk_widget_set_tooltip_text(item, _(constants[i].tooltip));
g_object_set_data(G_OBJECT(item), "const", g_strdup(constants[i].constant));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
g_signal_connect(item, "activate", G_CALLBACK(insert_const_cb), buttons);