From aaca1351993f877a7aff2b0b971656f667c9d91c Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Sat, 4 Apr 2020 00:00:04 +0100 Subject: [PATCH] libmalcontent: Add enum types to fix introspection of MctManagerError MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without a GType for the error enum, g-ir-scanner fails to properly associate it with the error quark function, and (for example) error code matching in JS doesn’t work. This adds the enum types in a new public header file. Signed-off-by: Philip Withnall --- libmalcontent/malcontent.h | 1 + libmalcontent/meson.build | 11 +++++++++-- meson.build | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libmalcontent/malcontent.h b/libmalcontent/malcontent.h index 2d523be..6dc7c9c 100644 --- a/libmalcontent/malcontent.h +++ b/libmalcontent/malcontent.h @@ -23,5 +23,6 @@ #pragma once #include +#include #include #include diff --git a/libmalcontent/meson.build b/libmalcontent/meson.build index a312823..9970d40 100644 --- a/libmalcontent/meson.build +++ b/libmalcontent/meson.build @@ -28,8 +28,14 @@ libmalcontent_private_deps = [ # FIXME: Would be good to use subdir here: https://github.com/mesonbuild/meson/issues/2969 libmalcontent_include_subdir = join_paths(libmalcontent_api_name, 'libmalcontent') +enums = gnome.mkenums_simple('enums', + sources: libmalcontent_headers, + install_header: true, + install_dir: join_paths(includedir, libmalcontent_include_subdir), +) + libmalcontent = library(libmalcontent_api_name, - libmalcontent_sources + libmalcontent_headers + libmalcontent_private_headers, + libmalcontent_sources + libmalcontent_headers + libmalcontent_private_headers + enums, dependencies: libmalcontent_public_deps + libmalcontent_private_deps, include_directories: root_inc, install: true, @@ -39,6 +45,7 @@ libmalcontent = library(libmalcontent_api_name, libmalcontent_dep = declare_dependency( link_with: libmalcontent, include_directories: root_inc, + sources: libmalcontent_headers + [enums[1]], ) # Public library bits. @@ -57,7 +64,7 @@ pkgconfig.generate(libmalcontent, ) libmalcontent_gir = gnome.generate_gir(libmalcontent, - sources: libmalcontent_sources + libmalcontent_headers + libmalcontent_private_headers, + sources: libmalcontent_sources + libmalcontent_headers + libmalcontent_private_headers + enums, nsversion: libmalcontent_api_version, namespace: 'Malcontent', symbol_prefix: 'mct_', diff --git a/meson.build b/meson.build index aacc0d3..b70ec5d 100644 --- a/meson.build +++ b/meson.build @@ -21,6 +21,7 @@ bindir = join_paths(prefix, get_option('bindir')) datadir = join_paths(prefix, get_option('datadir')) libdir = join_paths(prefix, get_option('libdir')) libexecdir = join_paths(prefix, get_option('libexecdir')) +includedir = join_paths(prefix, get_option('includedir')) # FIXME: This isn’t exposed in accountsservice.pc # See https://gitlab.freedesktop.org/accountsservice/accountsservice/merge_requests/16