diff options
author | Mikael Hallendal <micke@codefactory.se> | 2001-04-13 09:58:14 +0800 |
---|---|---|
committer | Mikael Hallendal <hallski@src.gnome.org> | 2001-04-13 09:58:14 +0800 |
commit | 9d81248e5f66bdefeedebe7642feb8e21f200950 (patch) | |
tree | afdaae89e1511ba439f46659a6ba346479511097 /e-util | |
parent | 869c3b58240cd02bf1c8ad770b06b088882d8112 (diff) | |
download | gsoc2013-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')
-rw-r--r-- | e-util/e-util.c | 57 | ||||
-rw-r--r-- | e-util/e-util.h | 7 |
2 files changed, 64 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) { diff --git a/e-util/e-util.h b/e-util/e-util.h index 374c41693a..bf89b27aa1 100644 --- a/e-util/e-util.h +++ b/e-util/e-util.h @@ -79,6 +79,8 @@ gchar *e_strstrcase (cons const gchar *needle); void e_filename_make_safe (gchar *string); gchar *e_format_number (gint number); +gchar *e_format_number_float (gfloat number); + gboolean e_create_directory (gchar *directory); @@ -191,6 +193,11 @@ void e_marshal_INT__POINTER_POINTER_POINTER_POINTER (GtkO gpointer func_data, GtkArg *args); +void e_marshal_NONE__POINTER_INT_INT_INT (GtkObject *object, + GtkSignalFunc func, + gpointer func_data, + GtkArg *args); + #ifdef __cplusplus } #endif /* __cplusplus */ |