[gnome-builder] plugins/code-index: fix search result construction



commit 42cfb9cda7b93547db1bd9518ff39bf9654260c4
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jul 12 21:42:36 2022 -0700

    plugins/code-index: fix search result construction
    
    This fixes the search result object construction so that it uses the right
    properties. Also cleans up some old typedef usage.

 src/plugins/code-index/ide-code-index-index.c         | 18 +++++++++---------
 src/plugins/code-index/ide-code-index-search-result.c | 10 +++++-----
 src/plugins/code-index/ide-code-index-search-result.h |  8 ++++----
 3 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/src/plugins/code-index/ide-code-index-index.c b/src/plugins/code-index/ide-code-index-index.c
index 5170b8940..2358eac8a 100644
--- a/src/plugins/code-index/ide-code-index-index.c
+++ b/src/plugins/code-index/ide-code-index-index.c
@@ -286,21 +286,21 @@ static IdeCodeIndexSearchResult *
 ide_code_index_index_create_search_result (IdeContext       *context,
                                            const FuzzyMatch *fuzzy_match)
 {
-  g_autoptr(GFile) file = NULL;
   g_autoptr(IdeLocation) location = NULL;
   g_autoptr(GString) subtitle = NULL;
-  const gchar *key;
-  const gchar *icon_name;
-  const gchar *shortname;
-  const gchar *path;
+  g_autoptr(GFile) file = NULL;
+  const char *key;
+  const char *shortname;
+  const char *path;
   GVariant *value;
-  gfloat score;
+  GIcon *gicon;
+  float score;
   guint file_id;
   guint line;
   guint line_offset;
   guint kind;
   guint flags;
-  gchar num [20];
+  char num [20];
 
   g_assert (IDE_IS_CONTEXT (context));
   g_assert (fuzzy_match != NULL);
@@ -322,7 +322,7 @@ ide_code_index_index_create_search_result (IdeContext       *context,
   file = g_file_new_for_path (path);
   location = ide_location_new (file, line - 1, line_offset - 1);
 
-  icon_name = ide_symbol_kind_get_icon_name (kind);
+  gicon = ide_symbol_kind_get_gicon (kind);
   score = ide_fuzzy_index_match_get_score (fuzzy_match->match);
 
   subtitle = g_string_new (NULL);
@@ -338,7 +338,7 @@ ide_code_index_index_create_search_result (IdeContext       *context,
       g_string_append_printf (subtitle, " (%s)", _("Declaration"));
     }
 
-  return ide_code_index_search_result_new (key + 2, subtitle->str, icon_name, location, score);
+  return ide_code_index_search_result_new (key + 2, subtitle->str, gicon, location, score);
 }
 
 static void
diff --git a/src/plugins/code-index/ide-code-index-search-result.c 
b/src/plugins/code-index/ide-code-index-search-result.c
index e04927726..87c2c5899 100644
--- a/src/plugins/code-index/ide-code-index-search-result.c
+++ b/src/plugins/code-index/ide-code-index-search-result.c
@@ -136,18 +136,18 @@ ide_code_index_search_result_init (IdeCodeIndexSearchResult *self)
 }
 
 IdeCodeIndexSearchResult *
-ide_code_index_search_result_new (const gchar *title,
-                                  const gchar *subtitle,
-                                  const gchar *icon_name,
+ide_code_index_search_result_new (const char  *title,
+                                  const char  *subtitle,
+                                  GIcon       *gicon,
                                   IdeLocation *location,
-                                  gfloat       score)
+                                  float        score)
 {
   g_autofree gchar *etitle = g_markup_escape_text (title, -1);
 
   return g_object_new (IDE_TYPE_CODE_INDEX_SEARCH_RESULT,
                        "title", etitle,
                        "subtitle", subtitle,
-                       "icon-name", icon_name,
+                       "gicon", gicon,
                        "location", location,
                        "score", score,
                        NULL);
diff --git a/src/plugins/code-index/ide-code-index-search-result.h 
b/src/plugins/code-index/ide-code-index-search-result.h
index 519221dc9..2266c8f0b 100644
--- a/src/plugins/code-index/ide-code-index-search-result.h
+++ b/src/plugins/code-index/ide-code-index-search-result.h
@@ -29,10 +29,10 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (IdeCodeIndexSearchResult, ide_code_index_search_result, IDE, CODE_INDEX_SEARCH_RESULT, 
IdeSearchResult)
 
-IdeCodeIndexSearchResult *ide_code_index_search_result_new (const gchar *title,
-                                                            const gchar *subtitle,
-                                                            const gchar *icon_name,
+IdeCodeIndexSearchResult *ide_code_index_search_result_new (const char  *title,
+                                                            const char  *subtitle,
+                                                            GIcon       *icon,
                                                             IdeLocation *location,
-                                                            gfloat       score);
+                                                            float        score);
 
 G_END_DECLS


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