aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-util.c
diff options
context:
space:
mode:
authorMikael Hallendal <micke@codefactory.se>2001-04-13 09:58:14 +0800
committerMikael Hallendal <hallski@src.gnome.org>2001-04-13 09:58:14 +0800
commit9d81248e5f66bdefeedebe7642feb8e21f200950 (patch)
treeafdaae89e1511ba439f46659a6ba346479511097 /e-util/e-util.c
parent869c3b58240cd02bf1c8ad770b06b088882d8112 (diff)
downloadgsoc2013-evolution-9d81248e5f66bdefeedebe7642feb8e21f200950.tar
gsoc2013-evolution-9d81248e5f66bdefeedebe7642feb8e21f200950.tar.gz
gsoc2013-evolution-9d81248e5f66bdefeedebe7642feb8e21f200950.tar.bz2
gsoc2013-evolution-9d81248e5f66bdefeedebe7642feb8e21f200950.tar.lz
gsoc2013-evolution-9d81248e5f66bdefeedebe7642feb8e21f200950.tar.xz
gsoc2013-evolution-9d81248e5f66bdefeedebe7642feb8e21f200950.tar.zst
gsoc2013-evolution-9d81248e5f66bdefeedebe7642feb8e21f200950.zip
Added e-table/e-cell-spin-button.lo Added e-table/e-cell-float.lo
2001-04-13 Mikael Hallendal <micke@codefactory.se> * gal/Makefile.am (libgal_la_LIBADD): Added e-table/e-cell-spin-button.lo Added e-table/e-cell-float.lo * gal/util/e-util.[ch] (e_format_number_float): Added function to format floats. Uses e_format_number for the integer part. (e_marshal_NONE__POINTER_INT_INT_INT): Added used by gal/e-table/e-cell-spin-button.c svn path=/trunk/; revision=9295
Diffstat (limited to 'e-util/e-util.c')
-rw-r--r--e-util/e-util.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 204a2c3ad9..5bbb9522b4 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -661,6 +661,23 @@ e_marshal_INT__POINTER_POINTER_POINTER_POINTER (GtkObject *object,
func_data);
}
+
+void
+e_marshal_NONE__POINTER_INT_INT_INT (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args)
+{
+ (* (void (*)(GtkObject *, gpointer, int, int, int, gpointer)) func)
+ (object,
+ GTK_VALUE_POINTER (args[0]),
+ GTK_VALUE_INT (args[1]),
+ GTK_VALUE_INT (args[2]),
+
+ GTK_VALUE_INT (args[3]),
+ func_data);
+}
+
gchar**
e_strsplit (const gchar *string,
const gchar *delimiter,
@@ -825,6 +842,46 @@ e_format_number (gint number)
}
}
+gchar *
+e_format_number_float (gfloat number)
+{
+ gint int_part;
+ gint fraction;
+ struct lconv *locality;
+ gchar *str_intpart;
+ gchar *decimal_point;
+ gchar *str_fraction;
+ gchar *value;
+
+ locality = localeconv();
+
+ int_part = (int) number;
+ str_intpart = e_format_number (int_part);
+
+ if (!strcmp(locality->mon_decimal_point, "")) {
+ decimal_point = ".";
+ }
+ else {
+ decimal_point = locality->mon_decimal_point;
+ }
+
+ fraction = (int) ((number - int_part) * 100);
+
+ if (fraction == 0) {
+ str_fraction = g_strdup ("00");
+ }
+ else {
+ str_fraction = g_strdup_printf ("%02d", fraction);
+ }
+
+ value = g_strconcat (str_intpart, decimal_point, str_fraction, NULL);
+
+ g_free (str_intpart);
+ g_free (str_fraction);
+
+ return value;
+}
+
gboolean
e_create_directory (gchar *directory)
{