[gnome-software: 1/3] gs-desktop-data: Condense category list




commit 8303c8a779f015cf87657939a858bbf17062e898
Author: Philip Withnall <pwithnall endlessos org>
Date:   Mon Jun 28 14:30:13 2021 +0100

    gs-desktop-data: Condense category list
    
    This makes the sidebar more manageable. The new set of categories
    contain the same apps as before, overall, due to containing more
    subcategories each than before.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Fixes: #1207

 lib/gs-desktop-data.c         | 310 +++++++++++++++++-------------------------
 lib/gs-desktop-data.h         |   2 +-
 plugins/dummy/gs-self-test.c  |   2 +-
 plugins/snap/gs-plugin-snap.c |  24 ++--
 src/gs-overview-page.c        |  23 ++--
 5 files changed, 147 insertions(+), 214 deletions(-)
---
diff --git a/lib/gs-desktop-data.c b/lib/gs-desktop-data.c
index 05ae704e9..3ad887735 100644
--- a/lib/gs-desktop-data.c
+++ b/lib/gs-desktop-data.c
@@ -12,13 +12,29 @@
 
 #include "gs-desktop-data.h"
 
-/* AudioVideo */
-static const GsDesktopMap map_audiovisual[] = {
-       { "all",                NC_("Menu of Audio & Video", "All"),
-                                       { "AudioVideo",
+static const GsDesktopMap map_create[] = {
+       { "all",                NC_("Menu of Graphics & Photography", "All"),
+                                       { "Graphics",
+                                         "AudioVideo",
                                          NULL } },
-       { "featured",           NC_("Menu of Audio & Video", "Featured"),
-                                       { "AudioVideo::Featured",
+       { "featured",           NC_("Menu of Graphics & Photography", "Featured"),
+                                       { "Graphics::Featured",
+                                         "AudioVideo::Featured",
+                                         NULL} },
+       { "3d",                 NC_("Menu of Graphics & Photography", "3D Graphics"),
+                                       { "Graphics::3DGraphics",
+                                         NULL} },
+       { "photography",        NC_("Menu of Graphics & Photography", "Photography"),
+                                       { "Graphics::Photography",
+                                         NULL} },
+       { "scanning",           NC_("Menu of Graphics & Photography", "Scanning"),
+                                       { "Graphics::Scanning",
+                                         NULL} },
+       { "vector",             NC_("Menu of Graphics & Photography", "Vector Graphics"),
+                                       { "Graphics::VectorGraphics",
+                                         NULL} },
+       { "viewers",            NC_("Menu of Graphics & Photography", "Viewers"),
+                                       { "Graphics::Viewer",
                                          NULL} },
        { "creation-editing",   NC_("Menu of Audio & Video", "Audio Creation & Editing"),
                                        { "AudioVideo::AudioVideoEditing",
@@ -26,77 +42,67 @@ static const GsDesktopMap map_audiovisual[] = {
                                          "AudioVideo::DiscBurning",
                                          "AudioVideo::Sequencer",
                                          NULL} },
-       { "music-players",      NC_("Menu of Audio & Video", "Music Players"),
-                                       { "AudioVideo::Music",
-                                         "AudioVideo::Player",
+       { "fonts",              NC_("Menu of Add-ons", "Fonts"),
+                                       { "Addon::Font",
                                          NULL} },
        { NULL }
 };
 
-/* Development */
-static const GsDesktopMap map_developertools[] = {
-       { "all",                NC_("Menu of Developer Tools", "All"),
-                                       { "Development",
+static const GsDesktopMap map_work[] = {
+       { "all",                NC_("Menu of Productivity", "All"),
+                                       { "Office",
+                                         "Utility",
+                                         "Addon",
                                          NULL } },
-       { "featured",           NC_("Menu of Developer Tools", "Featured"),
-                                       { "Development::Featured",
+       { "featured",           NC_("Menu of Productivity", "Featured"),
+                                       { "Office::Featured",
+                                         "Utility::Featured",
                                          NULL} },
-       { "debuggers",          NC_("Menu of Developer Tools", "Debuggers"),
-                                       { "Development::Debugger",
+       { "calendar",           NC_("Menu of Productivity", "Calendar"),
+                                       { "Office::Calendar",
+                                         "Office::ProjectManagement",
                                          NULL} },
-       { "ide",                NC_("Menu of Developer Tools", "IDEs"),
-                                       { "Development::IDE",
-                                         "Development::GUIDesigner",
+       { "database",           NC_("Menu of Productivity", "Database"),
+                                       { "Office::Database",
                                          NULL} },
-       { NULL }
-};
-
-/* Education & Science */
-static const GsDesktopMap map_education_science[] = {
-       { "all",                NC_("Menu of Education & Science", "All"),
-                                       { "Education",
-                                         "Science",
-                                         NULL } },
-       { "featured",           NC_("Menu of Education & Science", "Featured"),
-                                       { "Education::Featured",
-                                         "Science::Featured",
+       { "finance",            NC_("Menu of Productivity", "Finance"),
+                                       { "Office::Finance",
+                                         "Office::Spreadsheet",
                                          NULL} },
-       { "artificial-intelligence", NC_("Menu of Education & Science", "Artificial Intelligence"),
-                                       { "Science::ArtificialIntelligence",
+       { "word-processor",     NC_("Menu of Productivity", "Word Processor"),
+                                       { "Office::WordProcessor",
+                                         "Office::Dictionary",
                                          NULL} },
-       { "astronomy",          NC_("Menu of Education & Science", "Astronomy"),
-                                       { "Education::Astronomy",
-                                         "Science::Astronomy",
+       { "text-editors",       NC_("Menu of Utilities", "Text Editors"),
+                                       { "Utility::TextEditor",
                                          NULL} },
-       { "chemistry",          NC_("Menu of Education & Science", "Chemistry"),
-                                       { "Education::Chemistry",
-                                         "Science::Chemistry",
+       { "input-sources",      NC_("Menu of Add-ons", "Input Sources"),
+                                       { "Addon::InputSource",
                                          NULL} },
-       { "languages",          NC_("Menu of Education & Science", "Languages"),
-                                       { "Education::Languages",
-                                         "Education::Literature",
+       { "language-packs",     NC_("Menu of Add-ons", "Language Packs"),
+                                       { "Addon::LanguagePack",
                                          NULL} },
-       { "math",               NC_("Menu of Education & Science", "Math"),
-                                       { "Education::Math",
-                                         "Education::NumericalAnalysis",
-                                         "Science::Math",
-                                         "Science::Physics",
-                                         "Science::NumericalAnalysis",
+       { "localization",       NC_("Menu of Add-ons", "Localization"),
+                                       { "Addon::Localization",
                                          NULL} },
-       { "robotics",           NC_("Menu of Education & Science", "Robotics"),
-                                       { "Science::Robotics",
+       { "drivers",            NC_("Menu of Add-ons", "Hardware Drivers"),
+                                       { "Addon::Driver",
                                          NULL} },
-
        { NULL }
 };
 
-/* Games */
-static const GsDesktopMap map_games[] = {
-       { "all",                NC_("Menu of Games", "All"),
-                                       { "Game",
+static const GsDesktopMap map_play[] = {
+       { "all",                NC_("Menu of Audio & Video", "All"),
+                                       { "AudioVideo",
+                                         "Game",
                                          NULL } },
-       { "featured",           NC_("Menu of Games", "Featured"),
-                                       { "Game::Featured",
+       { "featured",           NC_("Menu of Audio & Video", "Featured"),
+                                       { "AudioVideo::Featured",
+                                         "Game::Featured",
+                                         NULL} },
+       { "music-players",      NC_("Menu of Audio & Video", "Music Players"),
+                                       { "AudioVideo::Music",
+                                         "AudioVideo::Player",
                                          NULL} },
        { "action",             NC_("Menu of Games", "Action"),
                                        { "Game::ActionGame",
@@ -135,89 +141,13 @@ static const GsDesktopMap map_games[] = {
        { "strategy",           NC_("Menu of Games", "Strategy"),
                                        { "Game::StrategyGame",
                                          NULL} },
-       { NULL }
-};
-
-/* Graphics */
-static const GsDesktopMap map_graphics[] = {
-       { "all",                NC_("Menu of Graphics & Photography", "All"),
-                                       { "Graphics",
-                                         NULL } },
-       { "featured",           NC_("Menu of Graphics & Photography", "Featured"),
-                                       { "Graphics::Featured",
-                                         NULL} },
-       { "3d",                 NC_("Menu of Graphics & Photography", "3D Graphics"),
-                                       { "Graphics::3DGraphics",
-                                         NULL} },
-       { "photography",        NC_("Menu of Graphics & Photography", "Photography"),
-                                       { "Graphics::Photography",
-                                         NULL} },
-       { "scanning",           NC_("Menu of Graphics & Photography", "Scanning"),
-                                       { "Graphics::Scanning",
-                                         NULL} },
-       { "vector",             NC_("Menu of Graphics & Photography", "Vector Graphics"),
-                                       { "Graphics::VectorGraphics",
-                                         NULL} },
-       { "viewers",            NC_("Menu of Graphics & Photography", "Viewers"),
-                                       { "Graphics::Viewer",
-                                         NULL} },
-       { NULL }
-};
-
-/* Office */
-static const GsDesktopMap map_productivity[] = {
-       { "all",                NC_("Menu of Productivity", "All"),
-                                       { "Office",
-                                         NULL } },
-       { "featured",           NC_("Menu of Productivity", "Featured"),
-                                       { "Office::Featured",
-                                         NULL} },
-       { "calendar",           NC_("Menu of Productivity", "Calendar"),
-                                       { "Office::Calendar",
-                                         "Office::ProjectManagement",
-                                         NULL} },
-       { "database",           NC_("Menu of Productivity", "Database"),
-                                       { "Office::Database",
-                                         NULL} },
-       { "finance",            NC_("Menu of Productivity", "Finance"),
-                                       { "Office::Finance",
-                                         "Office::Spreadsheet",
-                                         NULL} },
-       { "word-processor",     NC_("Menu of Productivity", "Word Processor"),
-                                       { "Office::WordProcessor",
-                                         "Office::Dictionary",
-                                         NULL} },
-       { NULL }
-};
-
-/* Addons */
-static const GsDesktopMap map_addons[] = {
-       { "all",                NC_("Menu of Add-ons", "All"),
-                                       { "Addon",
-                                         NULL} },
-       { "fonts",              NC_("Menu of Add-ons", "Fonts"),
-                                       { "Addon::Font",
-                                         NULL} },
        { "codecs",             NC_("Menu of Add-ons", "Codecs"),
                                        { "Addon::Codec",
                                          NULL} },
-       { "input-sources",      NC_("Menu of Add-ons", "Input Sources"),
-                                       { "Addon::InputSource",
-                                         NULL} },
-       { "language-packs",     NC_("Menu of Add-ons", "Language Packs"),
-                                       { "Addon::LanguagePack",
-                                         NULL} },
-       { "localization",       NC_("Menu of Add-ons", "Localization"),
-                                       { "Addon::Localization",
-                                         NULL} },
-       { "drivers",            NC_("Menu of Add-ons", "Hardware Drivers"),
-                                       { "Addon::Driver",
-                                         NULL} },
        { NULL }
 };
 
-/* Communication */
-static const GsDesktopMap map_communication[] = {
+static const GsDesktopMap map_socialize[] = {
        { "all",                NC_("Menu of Communication & News", "All"),
                                        { "Network",
                                          NULL } },
@@ -241,27 +171,41 @@ static const GsDesktopMap map_communication[] = {
        { NULL }
 };
 
-/* Utility */
-static const GsDesktopMap map_utilities[] = {
-       { "all",                NC_("Menu of Utilities", "All"),
-                                       { "Utility",
+static const GsDesktopMap map_learn[] = {
+       { "all",                NC_("Menu of Education & Science", "All"),
+                                       { "Education",
+                                         "Science",
+                                         "Reference",
                                          NULL } },
-       { "featured",           NC_("Menu of Utilities", "Featured"),
-                                       { "Utility::Featured",
+       { "featured",           NC_("Menu of Education & Science", "Featured"),
+                                       { "Education::Featured",
+                                         "Science::Featured",
+                                         "Reference::Featured",
                                          NULL} },
-       { "text-editors",       NC_("Menu of Utilities", "Text Editors"),
-                                       { "Utility::TextEditor",
+       { "artificial-intelligence", NC_("Menu of Education & Science", "Artificial Intelligence"),
+                                       { "Science::ArtificialIntelligence",
                                          NULL} },
-       { NULL }
-};
-
-/* Reference */
-static const GsDesktopMap map_reference[] = {
-       { "all",                NC_("Menu of Reference", "All"),
-                                       { "Reference",
-                                         NULL } },
-       { "featured",           NC_("Menu of Reference", "Featured"),
-                                       { "Reference::Featured",
+       { "astronomy",          NC_("Menu of Education & Science", "Astronomy"),
+                                       { "Education::Astronomy",
+                                         "Science::Astronomy",
+                                         NULL} },
+       { "chemistry",          NC_("Menu of Education & Science", "Chemistry"),
+                                       { "Education::Chemistry",
+                                         "Science::Chemistry",
+                                         NULL} },
+       { "languages",          NC_("Menu of Education & Science", "Languages"),
+                                       { "Education::Languages",
+                                         "Education::Literature",
+                                         NULL} },
+       { "math",               NC_("Menu of Education & Science", "Math"),
+                                       { "Education::Math",
+                                         "Education::NumericalAnalysis",
+                                         "Science::Math",
+                                         "Science::Physics",
+                                         "Science::NumericalAnalysis",
+                                         NULL} },
+       { "robotics",           NC_("Menu of Education & Science", "Robotics"),
+                                       { "Science::Robotics",
                                          NULL} },
        { "art",                NC_("Menu of Art", "Art"),
                                        { "Reference::Art",
@@ -293,39 +237,39 @@ static const GsDesktopMap map_reference[] = {
        { NULL }
 };
 
+static const GsDesktopMap map_develop[] = {
+       { "all",                NC_("Menu of Developer Tools", "All"),
+                                       { "Development",
+                                         NULL } },
+       { "featured",           NC_("Menu of Developer Tools", "Featured"),
+                                       { "Development::Featured",
+                                         NULL} },
+       { "debuggers",          NC_("Menu of Developer Tools", "Debuggers"),
+                                       { "Development::Debugger",
+                                         NULL} },
+       { "ide",                NC_("Menu of Developer Tools", "IDEs"),
+                                       { "Development::IDE",
+                                         "Development::GUIDesigner",
+                                         NULL} },
+       { NULL }
+};
+
 /* main categories */
 /* Please keep category name and subcategory context synchronized!!! */
 static const GsDesktopData msdata[] = {
-       /* TRANSLATORS: this is the menu spec main category for Audio & Video */
-       { "audio-video",        map_audiovisual,        N_("Audio & Video"),
-                               "folder-music-symbolic", 100 },
-       /* TRANSLATORS: this is the menu spec main category for Development */
-       { "developer-tools",    map_developertools,     N_("Developer Tools"),
-                               "applications-engineering-symbolic", 40 },
-       /* TRANSLATORS: this is the menu spec main category for Education & Science */
-       { "education-science",          map_education_science,  N_("Education & Science"),
-                               "system-help-symbolic", 30 },
-       /* TRANSLATORS: this is the menu spec main category for Game */
-       { "games",              map_games,              N_("Games"),
-                               "applications-games-symbolic", 70 },
-       /* TRANSLATORS: this is the menu spec main category for Graphics */
-       { "graphics",           map_graphics,           N_("Graphics & Photography"),
-                               "applications-graphics-symbolic", 60 },
-       /* TRANSLATORS: this is the menu spec main category for Office */
-       { "productivity",       map_productivity,       N_("Productivity"),
-                               "text-editor-symbolic", 80 },
-       /* TRANSLATORS: this is the menu spec main category for Add-ons */
-       { "addons",             map_addons,             N_("Add-ons"),
-                               "application-x-addon-symbolic", 50 },
-       /* TRANSLATORS: this is the menu spec main category for Communication */
-       { "communication",      map_communication,      N_("Communication & News"),
-                               "user-available-symbolic", 90 },
-       /* TRANSLATORS: this is the menu spec main category for Reference */
-       { "reference",          map_reference,          N_("Reference"),
-                               "view-dual-symbolic", 0 },
-       /* TRANSLATORS: this is the menu spec main category for Utilities */
-       { "utilities",          map_utilities,          N_("Utilities"),
-                               "applications-utilities-symbolic", 10 },
+       /* Translators: this is a menu category */
+       { "create", map_create, N_("Create"), "applications-graphics-symbolic", 100 },
+       /* Translators: this is a menu category */
+       { "work", map_work, N_("Work"), "checkbox-checked-symbolic", 90 },
+       /* Translators: this is a menu category */
+       { "play", map_play, N_("Play"), "applications-games-symbolic", 80 },
+       /* Translators: this is a menu category */
+       { "socialize", map_socialize, N_("Socialize"), "face-smile-big-symbolic", 70 },
+       /* Translators: this is a menu category */
+       { "learn", map_learn, N_("Learn"), "user-bookmarks-symbolic", 60 },
+       /* Translators: this is a menu category */
+       { "develop", map_develop, N_("Develop"), "utilities-terminal-symbolic", 50 },
+
        { NULL }
 };
 
diff --git a/lib/gs-desktop-data.h b/lib/gs-desktop-data.h
index 884f09292..5e9221591 100644
--- a/lib/gs-desktop-data.h
+++ b/lib/gs-desktop-data.h
@@ -38,6 +38,6 @@ const GsDesktopData   *gs_desktop_get_data            (void);
  *
  * Since: 40
  */
-#define GS_DESKTOP_DATA_N_ENTRIES 10
+#define GS_DESKTOP_DATA_N_ENTRIES 6
 
 G_END_DECLS
diff --git a/plugins/dummy/gs-self-test.c b/plugins/dummy/gs-self-test.c
index 7e6225620..a2a2332a0 100644
--- a/plugins/dummy/gs-self-test.c
+++ b/plugins/dummy/gs-self-test.c
@@ -393,7 +393,7 @@ gs_plugins_dummy_installed_func (GsPluginLoader *plugin_loader)
        g_assert (!gs_app_has_category (app, "ImageProcessing"));
        g_assert (gs_app_get_menu_path (app) != NULL);
        menu_path = g_strjoinv ("->", gs_app_get_menu_path (app));
-       g_assert_cmpstr (menu_path, ==, "Audio & Video->Music Players");
+       g_assert_cmpstr (menu_path, ==, "Play->Music Players");
 
        /* check addon */
        addons = gs_app_get_addons (app);
diff --git a/plugins/snap/gs-plugin-snap.c b/plugins/snap/gs-plugin-snap.c
index d7c223c8c..6cbab2ef2 100644
--- a/plugins/snap/gs-plugin-snap.c
+++ b/plugins/snap/gs-plugin-snap.c
@@ -465,24 +465,18 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
         * entertainment
         */
 
-       if (strcmp (id->str, "games/featured") == 0)
+       if (strcmp (id->str, "play/featured") == 0)
                sections = "games";
-       else if (strcmp (id->str, "audio-video/featured") == 0)
-               sections = "music-and-audio";
-       else if (strcmp (id->str, "graphics/featured") == 0)
-               sections = "photo-and-video;art-and-design";
-       else if (strcmp (id->str, "communication/featured") == 0)
+       else if (strcmp (id->str, "create/featured") == 0)
+               sections = "photo-and-video;art-and-design;music-and-video";
+       else if (strcmp (id->str, "socialize/featured") == 0)
                sections = "social;news-and-weather";
-       else if (strcmp (id->str, "productivity/featured") == 0)
-               sections = "productivity;finance";
-       else if (strcmp (id->str, "developer-tools/featured") == 0)
+       else if (strcmp (id->str, "work/featured") == 0)
+               sections = "productivity;finance;utilities";
+       else if (strcmp (id->str, "develop/featured") == 0)
                sections = "development";
-       else if (strcmp (id->str, "utilities/featured") == 0)
-               sections = "utilities";
-       else if (strcmp (id->str, "education-science/featured") == 0)
-               sections = "education;science";
-       else if (strcmp (id->str, "reference/featured") == 0)
-               sections = "books-and-reference";
+       else if (strcmp (id->str, "learn/featured") == 0)
+               sections = "education;science;books-and-reference";
 
        if (sections != NULL) {
                g_auto(GStrv) tokens = NULL;
diff --git a/src/gs-overview-page.c b/src/gs-overview-page.c
index 640bced64..e9c2677b4 100644
--- a/src/gs-overview-page.c
+++ b/src/gs-overview-page.c
@@ -472,25 +472,20 @@ out:
 static const gchar *
 gs_overview_page_get_category_label (const gchar *id)
 {
-       if (g_strcmp0 (id, "audio-video") == 0) {
-               /* TRANSLATORS: this is a heading for audio applications which
-                * have been featured ('recommended') by the distribution */
-               return _("Recommended Audio & Video Applications");
-       }
-       if (g_strcmp0 (id, "games") == 0) {
+       if (g_strcmp0 (id, "play") == 0) {
                /* TRANSLATORS: this is a heading for games which have been
                 * featured ('recommended') by the distribution */
                return _("Recommended Games");
        }
-       if (g_strcmp0 (id, "graphics") == 0) {
+       if (g_strcmp0 (id, "create") == 0) {
                /* TRANSLATORS: this is a heading for graphics applications
                 * which have been featured ('recommended') by the distribution */
-               return _("Recommended Graphics Applications");
+               return _("Recommended Creation Applications");
        }
-       if (g_strcmp0 (id, "productivity") == 0) {
+       if (g_strcmp0 (id, "work") == 0) {
                /* TRANSLATORS: this is a heading for office applications which
                 * have been featured ('recommended') by the distribution */
-               return _("Recommended Productivity Applications");
+               return _("Recommended Work Applications");
        }
        return NULL;
 }
@@ -502,10 +497,10 @@ gs_overview_page_get_random_categories (void)
        guint i;
        g_autoptr(GDateTime) date = NULL;
        g_autoptr(GRand) rand = NULL;
-       const gchar *ids[] = { "audio-video",
-                              "games",
-                              "graphics",
-                              "productivity",
+       const gchar *ids[] = { "create",
+                              "play",
+                              "socialize",
+                              "work",
                               NULL };
 
        date = g_date_time_new_now_utc ();


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