[gnome-software: 1/25] build: Move desktop category data into libgnomesoftware




commit f3770ed8eaa2dfd511ea4b35b6eaab2232d373d5
Author: Philip Withnall <pwithnall endlessos org>
Date:   Mon Feb 1 14:55:15 2021 +0000

    build: Move desktop category data into libgnomesoftware
    
    This is one step towards removing the `desktop-categories` plugin and
    hard-coding the desktop categories in gnome-software. It seems the
    flexibility of defining the categories in a plugin has never been used,
    so it will simplify the code (significantly) to define them statically
    in the core. In particular, this means that they can be loaded
    synchronously at startup, rather than asynchronously via
    `gs_plugin_loader_job_get_categories_async()`.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 lib/gnome-software.h                                      |  1 +
 plugins/core/gs-desktop-common.c => lib/gs-desktop-data.c |  2 +-
 plugins/core/gs-desktop-common.h => lib/gs-desktop-data.h |  0
 lib/meson.build                                           |  2 ++
 plugins/core/gs-plugin-desktop-categories.c               |  2 --
 plugins/core/gs-plugin-desktop-menu-path.c                |  2 --
 plugins/core/meson.build                                  | 10 ++--------
 po/POTFILES.in                                            |  2 +-
 8 files changed, 7 insertions(+), 14 deletions(-)
---
diff --git a/lib/gnome-software.h b/lib/gnome-software.h
index cfa9da360..ef53be562 100644
--- a/lib/gnome-software.h
+++ b/lib/gnome-software.h
@@ -17,6 +17,7 @@
 #include <gs-app-collation.h>
 #include <gs-autocleanups.h>
 #include <gs-category.h>
+#include <gs-desktop-data.h>
 #include <gs-enums.h>
 #include <gs-metered.h>
 #include <gs-os-release.h>
diff --git a/plugins/core/gs-desktop-common.c b/lib/gs-desktop-data.c
similarity index 99%
rename from plugins/core/gs-desktop-common.c
rename to lib/gs-desktop-data.c
index d57692196..7900b39c9 100644
--- a/plugins/core/gs-desktop-common.c
+++ b/lib/gs-desktop-data.c
@@ -10,7 +10,7 @@
 
 #include <glib/gi18n.h>
 
-#include "gs-desktop-common.h"
+#include "gs-desktop-data.h"
 
 /* AudioVideo */
 static const GsDesktopMap map_audiovisual[] = {
diff --git a/plugins/core/gs-desktop-common.h b/lib/gs-desktop-data.h
similarity index 100%
rename from plugins/core/gs-desktop-common.h
rename to lib/gs-desktop-data.h
diff --git a/lib/meson.build b/lib/meson.build
index 108dd83f0..8ea280678 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -8,6 +8,7 @@ libgnomesoftware_public_headers = [
   'gs-app-list.h',
   'gs-autocleanups.h',
   'gs-category.h',
+  'gs-desktop-data.h',
   'gs-ioprio.h',
   'gs-metered.h',
   'gs-os-release.h',
@@ -64,6 +65,7 @@ libgnomesoftware = static_library(
     'gs-app-list.c',
     'gs-category.c',
     'gs-debug.c',
+    'gs-desktop-data.c',
     'gs-ioprio.c',
     'gs-ioprio.h',
     'gs-metered.c',
diff --git a/plugins/core/gs-plugin-desktop-categories.c b/plugins/core/gs-plugin-desktop-categories.c
index f90788dce..f24e12b92 100644
--- a/plugins/core/gs-plugin-desktop-categories.c
+++ b/plugins/core/gs-plugin-desktop-categories.c
@@ -12,8 +12,6 @@
 #include <gnome-software.h>
 #include <glib/gi18n.h>
 
-#include "gs-desktop-common.h"
-
 /*
  * SECTION:
  * Adds categories from a hardcoded list based on the the desktop menu
diff --git a/plugins/core/gs-plugin-desktop-menu-path.c b/plugins/core/gs-plugin-desktop-menu-path.c
index 2ec73b534..a1c53189f 100644
--- a/plugins/core/gs-plugin-desktop-menu-path.c
+++ b/plugins/core/gs-plugin-desktop-menu-path.c
@@ -13,8 +13,6 @@
 
 #include <gnome-software.h>
 
-#include "gs-desktop-common.h"
-
 /*
  * SECTION:
  * Adds categories from a hardcoded list based on the the desktop menu
diff --git a/plugins/core/meson.build b/plugins/core/meson.build
index 4cc42adab..7ec23bccf 100644
--- a/plugins/core/meson.build
+++ b/plugins/core/meson.build
@@ -100,10 +100,7 @@ shared_module(
 
 shared_module(
   'gs_plugin_desktop-categories',
-  sources : [
-    'gs-plugin-desktop-categories.c',
-    'gs-desktop-common.c',
-  ],
+  sources : 'gs-plugin-desktop-categories.c',
   include_directories : [
     include_directories('../..'),
     include_directories('../../lib'),
@@ -116,10 +113,7 @@ shared_module(
 
 shared_module(
   'gs_plugin_desktop-menu-path',
-  sources : [
-    'gs-plugin-desktop-menu-path.c',
-    'gs-desktop-common.c',
-  ],
+  sources : 'gs-plugin-desktop-menu-path.c',
   include_directories : [
     include_directories('../..'),
     include_directories('../../lib'),
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ecae3db32..c119b8628 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -17,6 +17,7 @@ lib/gs-category.c
 src/gs-category-page.c
 src/gs-category-page.ui
 lib/gs-cmd.c
+lib/gs-desktop-data.c
 src/gs-common.c
 src/gs-content-rating.c
 src/gs-dbus-helper.c
@@ -76,7 +77,6 @@ src/gs-updates-section.c
 src/gs-upgrade-banner.c
 src/gs-upgrade-banner.ui
 src/org.gnome.Software.desktop.in
-plugins/core/gs-desktop-common.c
 plugins/core/gs-plugin-generic-updates.c
 plugins/core/gs-plugin-rewrite-resource.c
 plugins/eos-updater/gs-plugin-eos-updater.c


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