[gtk/wip/otte/for-master: 11/17] node-editor: Report all errors in tooltip
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/for-master: 11/17] node-editor: Report all errors in tooltip
- Date: Sun, 12 May 2019 14:02:40 +0000 (UTC)
commit 9bcd2c725f84cefe54dc401ba4c991f97c77d6f9
Author: Benjamin Otte <otte redhat com>
Date: Fri May 10 05:09:12 2019 +0200
node-editor: Report all errors in tooltip
Don't just report the first one.
demos/node-editor/node-editor-window.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/demos/node-editor/node-editor-window.c b/demos/node-editor/node-editor-window.c
index bb6c37201c..1b853d4984 100644
--- a/demos/node-editor/node-editor-window.c
+++ b/demos/node-editor/node-editor-window.c
@@ -265,6 +265,7 @@ text_view_query_tooltip_cb (GtkWidget *widget,
{
GtkTextIter iter;
guint i;
+ GString *text;
if (keyboard_tip)
{
@@ -282,6 +283,8 @@ text_view_query_tooltip_cb (GtkWidget *widget,
gtk_text_view_get_iter_at_position (GTK_TEXT_VIEW (self->text_view), &iter, &trailing, bx, by);
}
+ text = g_string_new ("");
+
for (i = 0; i < self->errors->len; i ++)
{
const TextViewError *e = &g_array_index (self->errors, TextViewError, i);
@@ -292,12 +295,23 @@ text_view_query_tooltip_cb (GtkWidget *widget,
if (gtk_text_iter_in_range (&iter, &start_iter, &end_iter))
{
- gtk_tooltip_set_text (tooltip, e->message);
- return TRUE;
+ if (text->len > 0)
+ g_string_append (text, "\n");
+ g_string_append (text, e->message);
}
}
- return FALSE;
+ if (text->len > 0)
+ {
+ gtk_tooltip_set_text (tooltip, text->str);
+ g_string_free (text, TRUE);
+ return TRUE;
+ }
+ else
+ {
+ g_string_free (text, TRUE);
+ return FALSE;
+ }
}
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]