Merge branch 'libmalcontent-ui' into 'master'

Split widgets into separate library

See merge request pwithnall/malcontent!23
This commit is contained in:
Philip Withnall 2020-02-04 11:42:16 +00:00
commit 106dc900c5
20 changed files with 158 additions and 31 deletions

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright © 2020 Endless Mobile, Inc. -->
<gresources>
<gresource prefix="/org/freedesktop/MalcontentUi/ui">
<file preprocess="xml-stripblanks">restrict-applications-dialog.ui</file>
<file preprocess="xml-stripblanks">restrict-applications-selector.ui</file>
<file preprocess="xml-stripblanks">user-controls.ui</file>
</gresource>
</gresources>

View File

@ -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 <withnall@endlessm.com>
*/
#pragma once
#include <libmalcontent-ui/restrict-applications-dialog.h>
#include <libmalcontent-ui/restrict-applications-selector.h>
#include <libmalcontent-ui/user-controls.h>

View File

@ -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')

View File

@ -186,7 +186,7 @@ mct_restrict_applications_dialog_class_init (MctRestrictApplicationsDialogClass
g_object_class_install_properties (object_class, G_N_ELEMENTS (properties), properties); 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, selector);
gtk_widget_class_bind_template_child (widget_class, MctRestrictApplicationsDialog, description); gtk_widget_class_bind_template_child (widget_class, MctRestrictApplicationsDialog, description);

View File

@ -209,7 +209,7 @@ mct_restrict_applications_selector_class_init (MctRestrictApplicationsSelectorCl
g_cclosure_marshal_VOID__VOID, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0); 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); gtk_widget_class_bind_template_child (widget_class, MctRestrictApplicationsSelector, listbox);
} }

View File

@ -749,7 +749,7 @@ mct_user_controls_class_init (MctUserControlsClass *klass)
g_object_class_install_properties (object_class, N_PROPS, properties); 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, age_menu);
gtk_widget_class_bind_template_child (widget_class, MctUserControls, allow_system_installation_switch); gtk_widget_class_bind_template_child (widget_class, MctUserControls, allow_system_installation_switch);

View File

@ -46,15 +46,14 @@ install_headers(libmalcontent_headers,
subdir: libmalcontent_include_subdir, subdir: libmalcontent_include_subdir,
) )
pkgconfig.generate( pkgconfig.generate(libmalcontent,
libraries: [ libmalcontent ],
subdirs: libmalcontent_api_name, subdirs: libmalcontent_api_name,
version: meson.project_version(), version: meson.project_version(),
name: 'libmalcontent', name: 'libmalcontent',
filebase: libmalcontent_api_name, filebase: libmalcontent_api_name,
description: 'Library providing access to parental control settings.', description: 'Library providing access to parental control settings.',
requires: libmalcontent_public_deps, libraries: libmalcontent_public_deps,
requires_private: libmalcontent_private_deps, libraries_private: libmalcontent_private_deps,
) )
gnome.generate_gir(libmalcontent, gnome.generate_gir(libmalcontent,

View File

@ -27,10 +27,10 @@
#include <glib/gi18n-lib.h> #include <glib/gi18n-lib.h>
#include <gio/gio.h> #include <gio/gio.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <libmalcontent-ui/malcontent-ui.h>
#include <polkit/polkit.h> #include <polkit/polkit.h>
#include "application.h" #include "application.h"
#include "user-controls.h"
#include "user-selector.h" #include "user-selector.h"

View File

@ -5,9 +5,6 @@
<file>carousel.css</file> <file>carousel.css</file>
<file preprocess="xml-stripblanks">carousel.ui</file> <file preprocess="xml-stripblanks">carousel.ui</file>
<file preprocess="xml-stripblanks">main.ui</file> <file preprocess="xml-stripblanks">main.ui</file>
<file preprocess="xml-stripblanks">restrict-applications-dialog.ui</file>
<file preprocess="xml-stripblanks">restrict-applications-selector.ui</file>
<file preprocess="xml-stripblanks">user-controls.ui</file>
<file preprocess="xml-stripblanks">user-selector.ui</file> <file preprocess="xml-stripblanks">user-selector.ui</file>
</gresource> </gresource>
</gresources> </gresources>

View File

@ -16,15 +16,7 @@ malcontent_control = executable('malcontent-control',
'application.h', 'application.h',
'carousel.c', 'carousel.c',
'carousel.h', 'carousel.h',
'gs-content-rating.c',
'gs-content-rating.h',
'main.c', '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.c',
'user-image.h', 'user-image.h',
'user-selector.c', 'user-selector.c',
@ -39,6 +31,7 @@ malcontent_control = executable('malcontent-control',
dependency('flatpak'), dependency('flatpak'),
dependency('polkit-gobject-1'), dependency('polkit-gobject-1'),
libmalcontent_dep, libmalcontent_dep,
libmalcontent_ui_dep,
], ],
include_directories: root_inc, include_directories: root_inc,
install: true, install: true,
@ -95,9 +88,6 @@ if xmllint.found()
files( files(
'carousel.ui', 'carousel.ui',
'main.ui', 'main.ui',
'restrict-applications-dialog.ui',
'restrict-applications-selector.ui',
'user-controls.ui',
'user-selector.ui', 'user-selector.ui',
), ),
], ],

View File

@ -1,6 +1,6 @@
project('malcontent', 'c', project('malcontent', 'c',
version : '0.4.0', version : '0.5.0',
meson_version : '>= 0.47.0', meson_version : '>= 0.49.0',
license: 'LGPLv2.1+', license: 'LGPLv2.1+',
default_options : [ default_options : [
'buildtype=debugoptimized', 'buildtype=debugoptimized',
@ -128,6 +128,7 @@ test_env = [
subdir('accounts-service') subdir('accounts-service')
subdir('libmalcontent') subdir('libmalcontent')
subdir('libmalcontent-ui')
subdir('malcontent-client') subdir('malcontent-client')
subdir('malcontent-control') subdir('malcontent-control')
subdir('pam') subdir('pam')

View File

@ -2,16 +2,16 @@
# Please keep this file sorted alphabetically. # Please keep this file sorted alphabetically.
accounts-service/com.endlessm.ParentalControls.policy.in accounts-service/com.endlessm.ParentalControls.policy.in
libmalcontent/manager.c 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/application.c
malcontent-control/gs-content-rating.c
malcontent-control/main.ui malcontent-control/main.ui
malcontent-control/org.freedesktop.MalcontentControl.appdata.xml.in malcontent-control/org.freedesktop.MalcontentControl.appdata.xml.in
malcontent-control/org.freedesktop.MalcontentControl.desktop.in malcontent-control/org.freedesktop.MalcontentControl.desktop.in
malcontent-control/org.freedesktop.MalcontentControl.policy.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 pam/pam_malcontent.c