[gtksourceview] snippetbundle: give search listings access to tooltips



commit 331b15aa6483f4870182c1066b703a75a4c24ccc
Author: Christian Hergert <chergert redhat com>
Date:   Wed Aug 31 17:28:56 2022 -0700

    snippetbundle: give search listings access to tooltips
    
    We could probably limit these if we wanted, but it's unlikely to be
    worth it compared to just memcpy() as the complexity would be greater
    than the memcpy costs when you have to look at every element anyway.
    
    A better long term solution would be to have a tooltips structure that
    we can reference (other than just the array) which we don't want to
    possibly mutate.

 gtksourceview/gtksourcesnippetbundle.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/gtksourceview/gtksourcesnippetbundle.c b/gtksourceview/gtksourcesnippetbundle.c
index 21e9db88..4bd252ec 100644
--- a/gtksourceview/gtksourcesnippetbundle.c
+++ b/gtksourceview/gtksourcesnippetbundle.c
@@ -745,6 +745,15 @@ _gtk_source_snippet_bundle_list_matching (GtkSourceSnippetBundle *self,
                }
        }
 
+       g_array_set_size (ret->tooltips, self->tooltips->len);
+
+       if (self->tooltips->len > 0)
+       {
+               memcpy (ret->tooltips->data,
+                       self->tooltips->data,
+                       sizeof (GtkSourceSnippetTooltip) * self->tooltips->len);
+       }
+
        return G_LIST_MODEL (g_steal_pointer (&ret));
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]