[gtksourceview/wip/chergert/gsv-gtk4] snippet: add GtkSourceSnippetChunk:tooltip-text property
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/gsv-gtk4] snippet: add GtkSourceSnippetChunk:tooltip-text property
- Date: Wed, 9 Sep 2020 21:36:41 +0000 (UTC)
commit 2e7d1732c76805d46c5e94456fb26d30f4b883c7
Author: Christian Hergert <chergert redhat com>
Date: Wed Sep 9 11:30:45 2020 -0700
snippet: add GtkSourceSnippetChunk:tooltip-text property
This will be used to provide informative information about the chunk as
we work through the snippet chunks.
gtksourceview/gtksourcesnippetchunk-private.h | 5 +++--
gtksourceview/gtksourcesnippetchunk.c | 24 ++++++++++++++++++++++++
gtksourceview/gtksourcesnippetchunk.h | 5 +++++
3 files changed, 32 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/gtksourcesnippetchunk-private.h b/gtksourceview/gtksourcesnippetchunk-private.h
index 052aa864..b2aa2208 100644
--- a/gtksourceview/gtksourcesnippetchunk-private.h
+++ b/gtksourceview/gtksourcesnippetchunk-private.h
@@ -30,8 +30,9 @@ struct _GtkSourceSnippetChunk
GList link;
GtkSourceSnippetContext *context;
- gchar *spec;
- gchar *text;
+ char *spec;
+ char *text;
+ char *tooltip_text;
GtkTextMark *begin_mark;
GtkTextMark *end_mark;
diff --git a/gtksourceview/gtksourcesnippetchunk.c b/gtksourceview/gtksourcesnippetchunk.c
index 001f26d1..4259f20f 100644
--- a/gtksourceview/gtksourcesnippetchunk.c
+++ b/gtksourceview/gtksourcesnippetchunk.c
@@ -44,6 +44,7 @@ enum {
PROP_FOCUS_POSITION,
PROP_TEXT,
PROP_TEXT_SET,
+ PROP_TOOLTIP_TEXT,
N_PROPS
};
@@ -379,6 +380,7 @@ gtk_source_snippet_chunk_finalize (GObject *object)
g_clear_pointer (&chunk->end_mark, delete_and_unref_mark);
g_clear_pointer (&chunk->spec, g_free);
g_clear_pointer (&chunk->text, g_free);
+ g_clear_pointer (&chunk->tooltip_text, g_free);
g_clear_object (&chunk->context);
G_OBJECT_CLASS (gtk_source_snippet_chunk_parent_class)->finalize (object);
@@ -590,3 +592,25 @@ _gtk_source_snippet_chunk_contains (GtkSourceSnippetChunk *chunk,
return FALSE;
}
+
+const char *
+gtk_source_snippet_chunk_get_tooltip_text (GtkSourceSnippetChunk *chunk)
+{
+ g_return_val_if_fail (GTK_SOURCE_IS_SNIPPET_CHUNK (chunk), NULL);
+
+ return chunk->tooltip_text;
+}
+
+void
+gtk_source_snippet_chunk_set_tooltip_text (GtkSourceSnippetChunk *chunk,
+ const char *tooltip_text)
+{
+ g_return_if_fail (GTK_SOURCE_IS_SNIPPET_CHUNK (chunk));
+
+ if (g_strcmp0 (tooltip_text, chunk->tooltip_text) != 0)
+ {
+ g_free (chunk->tooltip_text);
+ chunk->tooltip_text = g_strdup (tooltip_text);
+ g_object_notify_by_pspec (G_OBJECT (chunk), properties [PROP_TOOLTIP_TEXT]);
+ }
+}
diff --git a/gtksourceview/gtksourcesnippetchunk.h b/gtksourceview/gtksourcesnippetchunk.h
index d06f9530..7f71a1aa 100644
--- a/gtksourceview/gtksourcesnippetchunk.h
+++ b/gtksourceview/gtksourcesnippetchunk.h
@@ -63,5 +63,10 @@ gboolean gtk_source_snippet_chunk_get_text_set (GtkSourceS
GTK_SOURCE_AVAILABLE_IN_5_0
void gtk_source_snippet_chunk_set_text_set (GtkSourceSnippetChunk *chunk,
gboolean text_set);
+GTK_SOURCE_AVAILABLE_IN_5_0
+const char *gtk_source_snippet_chunk_get_tooltip_text (GtkSourceSnippetChunk *chunk);
+GTK_SOURCE_AVAILABLE_IN_5_0
+void gtk_source_snippet_chunk_set_tooltip_text (GtkSourceSnippetChunk *chunk,
+ const char *tooltip_text);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]