[libgda/gtk3] Corrected long strings truncating in cell renderer
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda/gtk3] Corrected long strings truncating in cell renderer
- Date: Thu, 16 Dec 2010 20:19:41 +0000 (UTC)
commit 3432baeed7fc9f82b844e31179bef1f012e2a7be
Author: Vivien Malerba <malerba gnome-db org>
Date: Mon Dec 13 22:07:53 2010 +0100
Corrected long strings truncating in cell renderer
.../gdaui-data-cell-renderer-textual.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/libgda-ui/data-entries/gdaui-data-cell-renderer-textual.c b/libgda-ui/data-entries/gdaui-data-cell-renderer-textual.c
index 105bd79..f9e47c1 100644
--- a/libgda-ui/data-entries/gdaui-data-cell-renderer-textual.c
+++ b/libgda-ui/data-entries/gdaui-data-cell-renderer-textual.c
@@ -37,7 +37,7 @@
#include "marshallers/gdaui-custom-marshal.h"
#include "gdaui-data-cell-renderer-util.h"
-#define MAX_ACCEPTED_STRING_LENGTH 32500U
+#define MAX_ACCEPTED_STRING_LENGTH 800U
static void gdaui_data_cell_renderer_textual_init (GdauiDataCellRendererTextual *celltext);
static void gdaui_data_cell_renderer_textual_class_init (GdauiDataCellRendererTextualClass *class);
@@ -460,13 +460,16 @@ gdaui_data_cell_renderer_textual_set_property (GObject *object,
gboolean use_markup = FALSE;
if (str) {
gint length;
- length = strlen (str);
+ length = g_utf8_strlen (str, -1);
if (length > MAX_ACCEPTED_STRING_LENGTH + too_long_msg_len) {
gchar *tmp;
- tmp = g_markup_escape_text (str, MAX_ACCEPTED_STRING_LENGTH +
- too_long_msg_len);
+ tmp = g_utf8_offset_to_pointer (str,
+ MAX_ACCEPTED_STRING_LENGTH);
+ *tmp = 0;
+ tmp = g_markup_escape_text (str, -1);
g_free (str);
str = g_strconcat (tmp, too_long_msg, NULL);
+ g_free (tmp);
use_markup = TRUE;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]