[gnome-software: 9/13] lib: Generate gs-enums.h to add GTypes for public enums




commit 5fcff9f6666ad56139eb938440021cd242c3a141
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Jan 26 16:44:46 2021 +0000

    lib: Generate gs-enums.h to add GTypes for public enums
    
    This will allow those enum and flag types to be used in GObject
    properties.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: #1007

 lib/gnome-software.h |  1 +
 lib/meson.build      | 49 +++++++++++++++++++++++++++++--------------------
 2 files changed, 30 insertions(+), 20 deletions(-)
---
diff --git a/lib/gnome-software.h b/lib/gnome-software.h
index 4ceeda16..cfa9da36 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-enums.h>
 #include <gs-metered.h>
 #include <gs-os-release.h>
 #include <gs-plugin.h>
diff --git a/lib/meson.build b/lib/meson.build
index e71583a3..124bc0cc 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -1,25 +1,27 @@
 cargs = ['-DG_LOG_DOMAIN="Gs"']
 cargs += ['-DLOCALPLUGINDIR=""']
 
-install_headers([
-    'gnome-software.h',
-    'gs-app.h',
-    'gs-app-collation.h',
-    'gs-app-list.h',
-    'gs-autocleanups.h',
-    'gs-category.h',
-    'gs-ioprio.h',
-    'gs-metered.h',
-    'gs-os-release.h',
-    'gs-plugin.h',
-    'gs-plugin-event.h',
-    'gs-plugin-job.h',
-    'gs-plugin-loader.h',
-    'gs-plugin-loader-sync.h',
-    'gs-plugin-types.h',
-    'gs-plugin-vfuncs.h',
-    'gs-utils.h'
-  ],
+libgnomesoftware_public_headers = [
+  'gnome-software.h',
+  'gs-app.h',
+  'gs-app-collation.h',
+  'gs-app-list.h',
+  'gs-autocleanups.h',
+  'gs-category.h',
+  'gs-ioprio.h',
+  'gs-metered.h',
+  'gs-os-release.h',
+  'gs-plugin.h',
+  'gs-plugin-event.h',
+  'gs-plugin-job.h',
+  'gs-plugin-loader.h',
+  'gs-plugin-loader-sync.h',
+  'gs-plugin-types.h',
+  'gs-plugin-vfuncs.h',
+  'gs-utils.h'
+]
+
+install_headers(libgnomesoftware_public_headers,
   subdir : 'gnome-software'
 )
 
@@ -45,6 +47,12 @@ if get_option('polkit')
   librarydeps += polkit
 endif
 
+libgnomesoftware_enums = gnome.mkenums_simple('gs-enums',
+  sources : libgnomesoftware_public_headers,
+  install_header : true,
+  install_dir : 'gnome-software',
+)
+
 libgnomesoftware_include_directories = [
   include_directories('..'),
 ]
@@ -67,7 +75,7 @@ libgnomesoftware = static_library(
     'gs-plugin-loader-sync.c',
     'gs-test.c',
     'gs-utils.c',
-  ],
+  ] + libgnomesoftware_enums,
   include_directories : libgnomesoftware_include_directories,
   dependencies : librarydeps,
   c_args : cargs,
@@ -75,6 +83,7 @@ libgnomesoftware = static_library(
 )
 
 libgnomesoftware_dep = declare_dependency(link_with : libgnomesoftware,
+  sources : libgnomesoftware_enums,
   include_directories : libgnomesoftware_include_directories
 )
 


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