Merge branch 'uncomment' into 'main'

gdesktopappinfo: Do not search Comment field

See merge request GNOME/glib!3610
This commit is contained in:
Philip Withnall
2023-10-03 17:12:59 +00:00
2 changed files with 8 additions and 16 deletions

View File

@@ -432,7 +432,6 @@ add_to_table_if_appropriate (GHashTable *apps,
enum
{
DESKTOP_KEY_Comment,
DESKTOP_KEY_Exec,
DESKTOP_KEY_GenericName,
DESKTOP_KEY_Keywords,
@@ -452,8 +451,7 @@ const gchar desktop_key_match_category[N_DESKTOP_KEYS] = {
[DESKTOP_KEY_Exec] = 2,
[DESKTOP_KEY_Keywords] = 3,
[DESKTOP_KEY_GenericName] = 4,
[DESKTOP_KEY_X_GNOME_FullName] = 5,
[DESKTOP_KEY_Comment] = 6
[DESKTOP_KEY_X_GNOME_FullName] = 5
};
typedef enum {
@@ -487,8 +485,6 @@ desktop_key_get_name (guint key_id)
{
switch (key_id)
{
case DESKTOP_KEY_Comment:
return "Comment";
case DESKTOP_KEY_Exec:
return "Exec";
case DESKTOP_KEY_GenericName:

View File

@@ -881,11 +881,10 @@ test_search (void)
assert_search ("frobni", "frobnicator.desktop\n", TRUE, FALSE, NULL, NULL);
/* Obvious multi-word search */
assert_search ("gno hel", "yelp.desktop\n", TRUE, TRUE, NULL, NULL);
assert_search ("doc hel", "yelp.desktop\n", TRUE, TRUE, NULL, NULL);
/* Repeated search terms should do nothing... */
assert_search ("files file fil fi f", "nautilus.desktop\n"
"gedit.desktop\n", TRUE, TRUE, NULL, NULL);
assert_search ("files file fil fi f", "nautilus.desktop\n", TRUE, TRUE, NULL, NULL);
/* "con" will match "connect" and "contacts" on name with prefix match in
* first group, then second group is a Keyword prefix match for "configuration" in dconf-editor.desktop
@@ -896,12 +895,10 @@ test_search (void)
"nautilus-classic.desktop\n", TRUE, TRUE, NULL, NULL);
/* "gnome" will match "eye of gnome" from the user's directory, plus
* matching "GNOME Clocks" X-GNOME-FullName. It's only a comment on
* yelp and gnome-contacts, though.
* matching "GNOME Clocks" X-GNOME-FullName.
*/
assert_search ("gnome", "eog.desktop\n"
"org.gnome.clocks.desktop\n"
"yelp.desktop gnome-contacts.desktop\n", TRUE, TRUE, NULL, NULL);
"org.gnome.clocks.desktop\n", TRUE, TRUE, NULL, NULL);
/* eog has exec name 'false' in usr only */
assert_search ("false", "eog.desktop\n", TRUE, FALSE, NULL, NULL);
@@ -913,9 +910,9 @@ test_search (void)
assert_search ("nonsearchable", "", TRUE, FALSE, NULL, NULL);
/* "gnome con" will match only gnome contacts; via the name for
* "contacts" and the comment for "gnome"
* "contacts" and keywords for "friend"
*/
assert_search ("gnome con", "gnome-contacts.desktop\n", TRUE, TRUE, NULL, NULL);
assert_search ("friend con", "gnome-contacts.desktop\n", TRUE, TRUE, NULL, NULL);
/* make sure we get the correct kde4- prefix on the application IDs
* from subdirectories
@@ -938,8 +935,7 @@ test_search (void)
/* make sure localised searching works properly */
assert_search ("foliumi", "nautilus.desktop\n"
"kde4-konqbrowser.desktop\n"
"eog.desktop\n", TRUE, FALSE, "en_US.UTF-8", "eo");
"kde4-konqbrowser.desktop\n", TRUE, FALSE, "en_US.UTF-8", "eo");
/* the user's eog.desktop has no translations... */
assert_search ("foliumi", "nautilus.desktop\n"
"kde4-konqbrowser.desktop\n", TRUE, TRUE, "en_US.UTF-8", "eo");