aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
Diffstat (limited to 'e-util')
-rw-r--r--e-util/e-util.c57
-rw-r--r--e-util/e-util.h7
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 */