[gnome-builder] greeter: add project path to search keywords



commit 33f5d00dd525f61b00196b463395a6aefcd1176e
Author: Christian Hergert <christian hergert me>
Date:   Sun Feb 21 19:02:39 2016 -0800

    greeter: add project path to search keywords
    
    Adds the path to the project path to the search keywords. This allows for
    searching for things like "gobject-introspection" when the project is
    contained in that directory.
    
    We only add the parent directory, so that we don't have to deal with
    local paths vs remote URIs.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=757722

 libide/greeter/ide-greeter-project-row.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/libide/greeter/ide-greeter-project-row.c b/libide/greeter/ide-greeter-project-row.c
index b90151b..a9bcbb4 100644
--- a/libide/greeter/ide-greeter-project-row.c
+++ b/libide/greeter/ide-greeter-project-row.c
@@ -79,6 +79,7 @@ ide_greeter_project_row_create_search_text (IdeGreeterProjectRow *self,
   const gchar *tmp;
   IdeDoap *doap;
   GString *str;
+  GFile *file;
 
   g_assert (IDE_IS_GREETER_PROJECT_ROW (self));
 
@@ -111,6 +112,27 @@ ide_greeter_project_row_create_search_text (IdeGreeterProjectRow *self,
         }
     }
 
+  file = ide_project_info_get_file (project_info);
+
+  if (file != NULL)
+    {
+      g_autoptr(GFile) parent = g_file_get_parent (file);
+      g_autofree gchar *dir = parent ? g_file_get_basename (parent) : NULL;
+      g_autofree gchar *base = g_file_get_basename (file);
+
+      if (dir != NULL)
+        {
+          g_string_append (str, dir);
+          g_string_append (str, " ");
+        }
+
+      if (base != NULL)
+        {
+          g_string_append (str, base);
+          g_string_append (str, " ");
+        }
+    }
+
   g_free (self->search_text);
   self->search_text = g_strdelimit (g_string_free (str, FALSE), "\n", ' ');
 }


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