shell: Make search results sorting smarter

Instead of just sorting by the name the sort order will now be:

1. Panels whose name match a search term
2. Panels whose keywords match the most search terms
3. Panels whose description match the most search terms
4. The remaining panels by name

https://bugzilla.gnome.org/show_bug.cgi?id=729027
This commit is contained in:
Rui Matos 2014-04-26 23:11:47 +02:00
parent 98a2ab2603
commit 13abc75273
4 changed files with 248 additions and 2 deletions

View file

@ -50,6 +50,7 @@ G_BEGIN_DECLS
typedef struct _CcShellModel CcShellModel;
typedef struct _CcShellModelClass CcShellModelClass;
typedef struct _CcShellModelPrivate CcShellModelPrivate;
typedef enum {
CC_CATEGORY_PERSONAL,
@ -76,6 +77,8 @@ enum
struct _CcShellModel
{
GtkListStore parent;
CcShellModelPrivate *priv;
};
struct _CcShellModelClass
@ -96,6 +99,9 @@ gboolean cc_shell_model_iter_matches_search (CcShellModel *model,
GtkTreeIter *iter,
const char *term);
void cc_shell_model_set_sort_terms (CcShellModel *model,
gchar **terms);
G_END_DECLS
#endif /* _CC_SHELL_MODEL_H */