aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/text
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-10-12 00:17:41 +0800
committerChris Lahey <clahey@src.gnome.org>2001-10-12 00:17:41 +0800
commit69b2e6d8eee098cf070e9797dd9d9bfde933d21f (patch)
tree819983f4074e2b418733dcd90b7493205e4ec188 /widgets/text
parentae61b9ce6897122308ec0224daec94182467ce23 (diff)
downloadgsoc2013-evolution-69b2e6d8eee098cf070e9797dd9d9bfde933d21f.tar
gsoc2013-evolution-69b2e6d8eee098cf070e9797dd9d9bfde933d21f.tar.gz
gsoc2013-evolution-69b2e6d8eee098cf070e9797dd9d9bfde933d21f.tar.bz2
gsoc2013-evolution-69b2e6d8eee098cf070e9797dd9d9bfde933d21f.tar.lz
gsoc2013-evolution-69b2e6d8eee098cf070e9797dd9d9bfde933d21f.tar.xz
gsoc2013-evolution-69b2e6d8eee098cf070e9797dd9d9bfde933d21f.tar.zst
gsoc2013-evolution-69b2e6d8eee098cf070e9797dd9d9bfde933d21f.zip
Use e_strdup_append_strings here instead of g_strdup_printf because
2001-10-11 Christopher James Lahey <clahey@ximian.com> * gal/e-text/e-table-text-model.c (e_table_text_model_insert, e_table_text_model_insert_length, e_table_text_model_delete), gal/e-text/e-text-model.c (e_text_model_real_insert, e_text_model_real_insert_length): Use e_strdup_append_strings here instead of g_strdup_printf because printf("%.*s") is locale dependent on some systems. * gal/util/e-util.c (e_strdup_append_strings): New function to append a bunch of strings with optional lengths. svn path=/trunk/; revision=13581
Diffstat (limited to 'widgets/text')
-rw-r--r--widgets/text/e-table-text-model.c21
-rw-r--r--widgets/text/e-text-model.c14
2 files changed, 30 insertions, 5 deletions
diff --git a/widgets/text/e-table-text-model.c b/widgets/text/e-table-text-model.c
index daf0456110..f7b7dc1400 100644
--- a/widgets/text/e-table-text-model.c
+++ b/widgets/text/e-table-text-model.c
@@ -19,6 +19,7 @@
#include <config.h>
#include <ctype.h>
#include <gtk/gtksignal.h>
+#include <gal/util/e-util.h>
#include "e-table-text-model.h"
static void e_table_text_model_class_init (ETableTextModelClass *class);
@@ -151,7 +152,12 @@ e_table_text_model_insert (ETextModel *text_model, gint position, const gchar *t
ETableTextModel *model = E_TABLE_TEXT_MODEL(text_model);
if (model->model){
gchar *temp = (gchar *)e_table_model_value_at (model->model, model->model_col, model->row);
- temp = g_strdup_printf ("%.*s%s%s", position, temp, text, temp + position);
+ /* Can't use g_strdup_printf here because on some
+ systems printf ("%.*s"); is locale dependent. */
+ temp = e_strdup_append_strings (temp, position,
+ text, -1,
+ temp + position, -1,
+ NULL);
e_table_model_set_value_at (model->model, model->model_col, model->row, temp);
g_free (temp);
}
@@ -163,7 +169,12 @@ e_table_text_model_insert_length (ETextModel *text_model, gint position, const g
ETableTextModel *model = E_TABLE_TEXT_MODEL(text_model);
if (model->model){
gchar *temp = (gchar *)e_table_model_value_at (model->model, model->model_col, model->row);
- temp = g_strdup_printf ("%.*s%.*s%s", position, temp, length, text, temp + position);
+ /* Can't use g_strdup_printf here because on some
+ systems printf ("%.*s"); is locale dependent. */
+ temp = e_strdup_append_strings (temp, position,
+ text, length,
+ temp + position, -1,
+ NULL);
e_table_model_set_value_at (model->model, model->model_col, model->row, temp);
g_free (temp);
}
@@ -175,7 +186,11 @@ e_table_text_model_delete (ETextModel *text_model, gint position, gint length)
ETableTextModel *model = E_TABLE_TEXT_MODEL(text_model);
if (model->model){
gchar *temp = (gchar *)e_table_model_value_at (model->model, model->model_col, model->row);
- temp = g_strdup_printf ("%.*s%s", position, temp, temp + position + length);
+ /* Can't use g_strdup_printf here because on some
+ systems printf ("%.*s"); is locale dependent. */
+ temp = e_strdup_append_strings (temp, position,
+ temp + position + length, -1,
+ NULL);
e_table_model_set_value_at (model->model, model->model_col, model->row, temp);
g_free (temp);
}
diff --git a/widgets/text/e-text-model.c b/widgets/text/e-text-model.c
index 97eb2a9a86..929247ed4e 100644
--- a/widgets/text/e-text-model.c
+++ b/widgets/text/e-text-model.c
@@ -268,7 +268,12 @@ e_text_model_real_insert (ETextModel *model, gint position, const gchar *text)
if (length <= 0)
return;
- new_text = g_strdup_printf ("%.*s%.*s%s", position, model->priv->text, length, text, model->priv->text + position);
+ /* Can't use g_strdup_printf here because on some systems
+ printf ("%.*s"); is locale dependent. */
+ new_text = e_strdup_append_strings (model->priv->text, position,
+ text, length,
+ model->priv->text + position, -1,
+ NULL);
if (model->priv->text)
g_free (model->priv->text);
@@ -301,7 +306,12 @@ e_text_model_real_insert_length (ETextModel *model, gint position, const gchar *
if (length <= 0)
return;
- new_text = g_strdup_printf ("%.*s%.*s%s", position, model->priv->text, length, text, model->priv->text + position);
+ /* Can't use g_strdup_printf here because on some systems
+ printf ("%.*s"); is locale dependent. */
+ new_text = e_strdup_append_strings (model->priv->text, position,
+ text, length,
+ model->priv->text + position, -1,
+ NULL);
if (model->priv->text)
g_free (model->priv->text);