[nautilus/wip/antoniof/search-list-redesign: 2/3] search-engine-tracker: Highlight matching word in snippet




commit ce1495f9635502c6ead50f11cf4352ab6961c4af
Author: António Fernandes <antoniof gnome org>
Date:   Wed Aug 3 10:03:05 2022 +0100

    search-engine-tracker: Highlight matching word in snippet
    
    Using pango markup.

 src/nautilus-name-cell.c             | 2 +-
 src/nautilus-search-engine-tracker.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-name-cell.c b/src/nautilus-name-cell.c
index 6986dff47..ab3cd05db 100644
--- a/src/nautilus-name-cell.c
+++ b/src/nautilus-name-cell.c
@@ -126,7 +126,7 @@ update_labels (NautilusNameCell *self)
 
     gtk_label_set_text (GTK_LABEL (self->label), display_name);
     gtk_label_set_text (GTK_LABEL (self->path), path_text);
-    gtk_label_set_text (GTK_LABEL (self->snippet), fts_snippet);
+    gtk_label_set_markup (GTK_LABEL (self->snippet), fts_snippet);
 
     gtk_widget_set_visible (self->path, (path_text != NULL));
     gtk_widget_set_visible (self->snippet, (fts_snippet != NULL));
diff --git a/src/nautilus-search-engine-tracker.c b/src/nautilus-search-engine-tracker.c
index e0c2c8c8d..3bfcbb787 100644
--- a/src/nautilus-search-engine-tracker.c
+++ b/src/nautilus-search-engine-tracker.c
@@ -357,7 +357,7 @@ nautilus_search_engine_tracker_start (NautilusSearchProvider *provider)
 
     if (tracker->fts_enabled && *search_text)
     {
-        g_string_append (sparql, " fts:snippet(?content)");
+        g_string_append (sparql, " fts:snippet(?content, '<b>', '</b>')");
     }
 
     g_string_append (sparql, "FROM tracker:FileSystem ");


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