libmalcontent: Add enum types to fix introspection of MctManagerError

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 <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2020-04-04 00:00:04 +01:00
parent 2d7e38aa74
commit aaca135199
3 changed files with 11 additions and 2 deletions

View File

@ -23,5 +23,6 @@
#pragma once
#include <libmalcontent/app-filter.h>
#include <libmalcontent/enums.h>
#include <libmalcontent/manager.h>
#include <libmalcontent/session-limits.h>

View File

@ -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_',

View File

@ -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 isnt exposed in accountsservice.pc
# See https://gitlab.freedesktop.org/accountsservice/accountsservice/merge_requests/16