diff --git a/malcontent-control/gs-content-rating.c b/libmalcontent-ui/gs-content-rating.c
similarity index 100%
rename from malcontent-control/gs-content-rating.c
rename to libmalcontent-ui/gs-content-rating.c
diff --git a/malcontent-control/gs-content-rating.h b/libmalcontent-ui/gs-content-rating.h
similarity index 100%
rename from malcontent-control/gs-content-rating.h
rename to libmalcontent-ui/gs-content-rating.h
diff --git a/libmalcontent-ui/malcontent-ui.gresource.xml b/libmalcontent-ui/malcontent-ui.gresource.xml
new file mode 100644
index 0000000..cbdaa9f
--- /dev/null
+++ b/libmalcontent-ui/malcontent-ui.gresource.xml
@@ -0,0 +1,9 @@
+
+
+
+
+ restrict-applications-dialog.ui
+ restrict-applications-selector.ui
+ user-controls.ui
+
+
diff --git a/libmalcontent-ui/malcontent-ui.h b/libmalcontent-ui/malcontent-ui.h
new file mode 100644
index 0000000..d573c3f
--- /dev/null
+++ b/libmalcontent-ui/malcontent-ui.h
@@ -0,0 +1,27 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright © 2020 Endless Mobile, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors:
+ * - Philip Withnall
+ */
+
+#pragma once
+
+#include
+#include
+#include
diff --git a/libmalcontent-ui/meson.build b/libmalcontent-ui/meson.build
new file mode 100644
index 0000000..06208a3
--- /dev/null
+++ b/libmalcontent-ui/meson.build
@@ -0,0 +1,104 @@
+libmalcontent_ui_api_version = '0'
+libmalcontent_ui_api_name = 'malcontent-ui-' + libmalcontent_ui_api_version
+
+if not cc.has_function('atexit')
+ error('atexit() needed for generated GResource files')
+endif
+
+resources = gnome.compile_resources(
+ 'resources',
+ 'malcontent-ui.gresource.xml',
+ source_dir: meson.source_root(),
+)
+
+libmalcontent_ui_sources = [
+ 'gs-content-rating.c',
+ 'restrict-applications-dialog.c',
+ 'restrict-applications-selector.c',
+ 'user-controls.c',
+] + resources
+libmalcontent_ui_headers = [
+ 'malcontent-ui.h',
+ 'restrict-applications-dialog.h',
+ 'restrict-applications-selector.h',
+ 'user-controls.h',
+]
+libmalcontent_ui_private_headers = [
+ 'gs-content-rating.h',
+]
+
+libmalcontent_ui_public_deps = [
+ dependency('accountsservice', version: '>= 0.6.39'),
+ dependency('gio-2.0', version: '>= 2.44'),
+ dependency('glib-2.0', version: '>= 2.54.2'),
+ dependency('gobject-2.0', version: '>= 2.54'),
+ dependency('gtk+-3.0', version: '>= 3.24'),
+ libmalcontent_dep,
+]
+libmalcontent_ui_private_deps = [
+ dependency('flatpak'),
+]
+
+# FIXME: Would be good to use subdir here: https://github.com/mesonbuild/meson/issues/2969
+libmalcontent_ui_include_subdir = join_paths(libmalcontent_ui_api_name, 'libmalcontent-ui')
+
+libmalcontent_ui = library(libmalcontent_ui_api_name,
+ libmalcontent_ui_sources + libmalcontent_ui_headers + libmalcontent_ui_private_headers,
+ dependencies: libmalcontent_ui_public_deps + libmalcontent_ui_private_deps,
+ include_directories: root_inc,
+ install: true,
+ version: meson.project_version(),
+ soversion: libmalcontent_ui_api_version,
+)
+libmalcontent_ui_dep = declare_dependency(
+ link_with: libmalcontent_ui,
+ include_directories: root_inc,
+)
+
+# Public library bits.
+install_headers(libmalcontent_ui_headers,
+ subdir: libmalcontent_ui_include_subdir,
+)
+
+pkgconfig.generate(libmalcontent_ui,
+ subdirs: libmalcontent_ui_api_name,
+ version: meson.project_version(),
+ name: 'libmalcontent-ui',
+ filebase: libmalcontent_ui_api_name,
+ description: 'Library providing widgets for parental control settings.',
+ libraries: libmalcontent_ui_public_deps,
+ libraries_private: libmalcontent_ui_private_deps,
+)
+
+gnome.generate_gir(libmalcontent_ui,
+ sources: libmalcontent_ui_sources + libmalcontent_ui_headers + libmalcontent_ui_private_headers,
+ nsversion: libmalcontent_ui_api_version,
+ namespace: 'MalcontentUi',
+ symbol_prefix: 'mct_',
+ identifier_prefix: 'Mct',
+ export_packages: 'libmalcontent-ui',
+ includes: ['AccountsService-1.0', 'Gio-2.0', 'GObject-2.0', 'Gtk-3.0'],
+ install: true,
+ dependencies: libmalcontent_ui_dep,
+)
+
+xmllint = find_program('xmllint', required: false)
+if xmllint.found()
+ gtk_prefix = dependency('gtk+-3.0').get_pkgconfig_variable('prefix')
+ test(
+ 'validate-ui', xmllint,
+ args: [
+ '--nonet', '--noblanks', '--noout',
+ '--relaxng', join_paths(gtk_prefix, 'share', 'gtk-3.0', 'gtkbuilder.rng'),
+ files(
+ 'restrict-applications-dialog.ui',
+ 'restrict-applications-selector.ui',
+ 'user-controls.ui',
+ ),
+ ],
+ suite: ['libmalcontent-ui'],
+ )
+endif
+
+# FIXME: Add tests
+#subdir('tests')
diff --git a/malcontent-control/restrict-applications-dialog.c b/libmalcontent-ui/restrict-applications-dialog.c
similarity index 99%
rename from malcontent-control/restrict-applications-dialog.c
rename to libmalcontent-ui/restrict-applications-dialog.c
index 7d20ff1..98f663a 100644
--- a/malcontent-control/restrict-applications-dialog.c
+++ b/libmalcontent-ui/restrict-applications-dialog.c
@@ -186,7 +186,7 @@ mct_restrict_applications_dialog_class_init (MctRestrictApplicationsDialogClass
g_object_class_install_properties (object_class, G_N_ELEMENTS (properties), properties);
- gtk_widget_class_set_template_from_resource (widget_class, "/org/freedesktop/MalcontentControl/ui/restrict-applications-dialog.ui");
+ gtk_widget_class_set_template_from_resource (widget_class, "/org/freedesktop/MalcontentUi/ui/restrict-applications-dialog.ui");
gtk_widget_class_bind_template_child (widget_class, MctRestrictApplicationsDialog, selector);
gtk_widget_class_bind_template_child (widget_class, MctRestrictApplicationsDialog, description);
diff --git a/malcontent-control/restrict-applications-dialog.h b/libmalcontent-ui/restrict-applications-dialog.h
similarity index 100%
rename from malcontent-control/restrict-applications-dialog.h
rename to libmalcontent-ui/restrict-applications-dialog.h
diff --git a/malcontent-control/restrict-applications-dialog.ui b/libmalcontent-ui/restrict-applications-dialog.ui
similarity index 100%
rename from malcontent-control/restrict-applications-dialog.ui
rename to libmalcontent-ui/restrict-applications-dialog.ui
diff --git a/malcontent-control/restrict-applications-selector.c b/libmalcontent-ui/restrict-applications-selector.c
similarity index 99%
rename from malcontent-control/restrict-applications-selector.c
rename to libmalcontent-ui/restrict-applications-selector.c
index 6fb9d4b..b203bee 100644
--- a/malcontent-control/restrict-applications-selector.c
+++ b/libmalcontent-ui/restrict-applications-selector.c
@@ -209,7 +209,7 @@ mct_restrict_applications_selector_class_init (MctRestrictApplicationsSelectorCl
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- gtk_widget_class_set_template_from_resource (widget_class, "/org/freedesktop/MalcontentControl/ui/restrict-applications-selector.ui");
+ gtk_widget_class_set_template_from_resource (widget_class, "/org/freedesktop/MalcontentUi/ui/restrict-applications-selector.ui");
gtk_widget_class_bind_template_child (widget_class, MctRestrictApplicationsSelector, listbox);
}
diff --git a/malcontent-control/restrict-applications-selector.h b/libmalcontent-ui/restrict-applications-selector.h
similarity index 100%
rename from malcontent-control/restrict-applications-selector.h
rename to libmalcontent-ui/restrict-applications-selector.h
diff --git a/malcontent-control/restrict-applications-selector.ui b/libmalcontent-ui/restrict-applications-selector.ui
similarity index 100%
rename from malcontent-control/restrict-applications-selector.ui
rename to libmalcontent-ui/restrict-applications-selector.ui
diff --git a/malcontent-control/user-controls.c b/libmalcontent-ui/user-controls.c
similarity index 99%
rename from malcontent-control/user-controls.c
rename to libmalcontent-ui/user-controls.c
index a4bb8f4..e9310fb 100644
--- a/malcontent-control/user-controls.c
+++ b/libmalcontent-ui/user-controls.c
@@ -749,7 +749,7 @@ mct_user_controls_class_init (MctUserControlsClass *klass)
g_object_class_install_properties (object_class, N_PROPS, properties);
- gtk_widget_class_set_template_from_resource (widget_class, "/org/freedesktop/MalcontentControl/ui/user-controls.ui");
+ gtk_widget_class_set_template_from_resource (widget_class, "/org/freedesktop/MalcontentUi/ui/user-controls.ui");
gtk_widget_class_bind_template_child (widget_class, MctUserControls, age_menu);
gtk_widget_class_bind_template_child (widget_class, MctUserControls, allow_system_installation_switch);
diff --git a/malcontent-control/user-controls.h b/libmalcontent-ui/user-controls.h
similarity index 100%
rename from malcontent-control/user-controls.h
rename to libmalcontent-ui/user-controls.h
diff --git a/malcontent-control/user-controls.ui b/libmalcontent-ui/user-controls.ui
similarity index 100%
rename from malcontent-control/user-controls.ui
rename to libmalcontent-ui/user-controls.ui
diff --git a/libmalcontent/meson.build b/libmalcontent/meson.build
index e592f11..1aa0c45 100644
--- a/libmalcontent/meson.build
+++ b/libmalcontent/meson.build
@@ -46,15 +46,14 @@ install_headers(libmalcontent_headers,
subdir: libmalcontent_include_subdir,
)
-pkgconfig.generate(
- libraries: [ libmalcontent ],
+pkgconfig.generate(libmalcontent,
subdirs: libmalcontent_api_name,
version: meson.project_version(),
name: 'libmalcontent',
filebase: libmalcontent_api_name,
description: 'Library providing access to parental control settings.',
- requires: libmalcontent_public_deps,
- requires_private: libmalcontent_private_deps,
+ libraries: libmalcontent_public_deps,
+ libraries_private: libmalcontent_private_deps,
)
gnome.generate_gir(libmalcontent,
diff --git a/malcontent-control/application.c b/malcontent-control/application.c
index e97db71..77fbae0 100644
--- a/malcontent-control/application.c
+++ b/malcontent-control/application.c
@@ -27,10 +27,10 @@
#include
#include
#include
+#include
#include
#include "application.h"
-#include "user-controls.h"
#include "user-selector.h"
diff --git a/malcontent-control/malcontent-control.gresource.xml b/malcontent-control/malcontent-control.gresource.xml
index 8f4d8e9..62ef12c 100644
--- a/malcontent-control/malcontent-control.gresource.xml
+++ b/malcontent-control/malcontent-control.gresource.xml
@@ -5,9 +5,6 @@
carousel.css
carousel.ui
main.ui
- restrict-applications-dialog.ui
- restrict-applications-selector.ui
- user-controls.ui
user-selector.ui
diff --git a/malcontent-control/meson.build b/malcontent-control/meson.build
index 528ed3c..2ee2415 100644
--- a/malcontent-control/meson.build
+++ b/malcontent-control/meson.build
@@ -16,15 +16,7 @@ malcontent_control = executable('malcontent-control',
'application.h',
'carousel.c',
'carousel.h',
- 'gs-content-rating.c',
- 'gs-content-rating.h',
'main.c',
- 'restrict-applications-dialog.c',
- 'restrict-applications-dialog.h',
- 'restrict-applications-selector.c',
- 'restrict-applications-selector.h',
- 'user-controls.c',
- 'user-controls.h',
'user-image.c',
'user-image.h',
'user-selector.c',
@@ -39,6 +31,7 @@ malcontent_control = executable('malcontent-control',
dependency('flatpak'),
dependency('polkit-gobject-1'),
libmalcontent_dep,
+ libmalcontent_ui_dep,
],
include_directories: root_inc,
install: true,
@@ -95,9 +88,6 @@ if xmllint.found()
files(
'carousel.ui',
'main.ui',
- 'restrict-applications-dialog.ui',
- 'restrict-applications-selector.ui',
- 'user-controls.ui',
'user-selector.ui',
),
],
diff --git a/meson.build b/meson.build
index ea9fea2..301a10b 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
project('malcontent', 'c',
- version : '0.4.0',
- meson_version : '>= 0.47.0',
+ version : '0.5.0',
+ meson_version : '>= 0.49.0',
license: 'LGPLv2.1+',
default_options : [
'buildtype=debugoptimized',
@@ -128,6 +128,7 @@ test_env = [
subdir('accounts-service')
subdir('libmalcontent')
+subdir('libmalcontent-ui')
subdir('malcontent-client')
subdir('malcontent-control')
subdir('pam')
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d26b86e..51f8d6d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,16 +2,16 @@
# Please keep this file sorted alphabetically.
accounts-service/com.endlessm.ParentalControls.policy.in
libmalcontent/manager.c
+libmalcontent-ui/gs-content-rating.c
+libmalcontent-ui/restrict-applications-dialog.c
+libmalcontent-ui/restrict-applications-dialog.ui
+libmalcontent-ui/restrict-applications-selector.c
+libmalcontent-ui/restrict-applications-selector.ui
+libmalcontent-ui/user-controls.c
+libmalcontent-ui/user-controls.ui
malcontent-control/application.c
-malcontent-control/gs-content-rating.c
malcontent-control/main.ui
malcontent-control/org.freedesktop.MalcontentControl.appdata.xml.in
malcontent-control/org.freedesktop.MalcontentControl.desktop.in
malcontent-control/org.freedesktop.MalcontentControl.policy.in
-malcontent-control/restrict-applications-dialog.c
-malcontent-control/restrict-applications-dialog.ui
-malcontent-control/restrict-applications-selector.c
-malcontent-control/restrict-applications-selector.ui
-malcontent-control/user-controls.c
-malcontent-control/user-controls.ui
pam/pam_malcontent.c