malcontent-control: Add initial skeleton application

This does nothing at the moment (not even showing a main window), but it
soon will do.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2019-12-17 15:41:03 +00:00
parent 254eac4a55
commit 1d8f7d665c
7 changed files with 193 additions and 2 deletions

View File

@ -5,7 +5,7 @@ before_script:
libxml2-devel dbus-daemon
glib2-devel dbus-devel gobject-introspection-devel
gettext-devel polkit-devel polkit-gnome git
lcov pam-devel
lcov pam-devel gtk3-devel
- export LANG=C.UTF-8
stages:

View File

@ -0,0 +1,92 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright © 2019 Endless Mobile, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
* Authors:
* - Philip Withnall <withnall@endlessm.com>
*/
#include "config.h"
#include <glib.h>
#include <glib-object.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include "application.h"
/**
* MctApplication:
*
* #MctApplication is a top-level object representing the parental controls
* application.
*
* Since: 0.5.0
*/
struct _MctApplication
{
GtkApplication parent_instance;
};
G_DEFINE_TYPE (MctApplication, mct_application, GTK_TYPE_APPLICATION)
static void
mct_application_init (MctApplication *self)
{
/* Nothing to do here. */
}
static void
mct_application_constructed (GObject *object)
{
GApplication *application = G_APPLICATION (object);
g_application_set_application_id (application, "org.freedesktop.MalcontentControl");
/* Localisation */
bindtextdomain ("malcontent", PACKAGE_LOCALE_DIR);
bind_textdomain_codeset ("malcontent", "UTF-8");
textdomain ("malcontent");
g_set_application_name (_("Parental Controls"));
gtk_window_set_default_icon_name ("org.freedesktop.MalcontentControl");
G_OBJECT_CLASS (mct_application_parent_class)->constructed (object);
}
static void
mct_application_class_init (MctApplicationClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->constructed = mct_application_constructed;
}
/**
* mct_application_new:
*
* Create a new #MctApplication.
*
* Returns: (transfer full): a new #MctApplication
* Since: 0.5.0
*/
MctApplication *
mct_application_new (void)
{
return g_object_new (MCT_TYPE_APPLICATION, NULL);
}

View File

@ -0,0 +1,37 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright © 2019 Endless Mobile, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
* Authors:
* - Philip Withnall <withnall@endlessm.com>
*/
#pragma once
#include <gio/gio.h>
#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define MCT_TYPE_APPLICATION mct_application_get_type ()
G_DECLARE_FINAL_TYPE (MctApplication, mct_application, MCT, APPLICATION, GtkApplication)
MctApplication *mct_application_new (void);
G_END_DECLS

37
malcontent-control/main.c Normal file
View File

@ -0,0 +1,37 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright © 2019 Endless Mobile, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
* Authors:
* - Philip Withnall <withnall@endlessm.com>
*/
#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include "application.h"
int
main (int argc,
char *argv[])
{
g_autoptr(MctApplication) app = NULL;
app = mct_application_new ();
return g_application_run (G_APPLICATION (app), argc, argv);
}

View File

@ -0,0 +1,22 @@
application_id = 'org.freedesktop.MalcontentControl'
malcontent_control = executable('malcontent-control',
[
'application.c',
'application.h',
'main.c',
],
dependencies: [
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'),
libmalcontent_dep,
],
include_directories: root_inc,
install: true,
)
# FIXME: Add icons and tests
#subdir('icons')
#subdir('tests')

View File

@ -48,6 +48,7 @@ libglib_testing_dep = dependency(
config_h = configuration_data()
config_h.set_quoted('GETTEXT_PACKAGE', meson.project_name())
config_h.set_quoted('PACKAGE_LOCALE_DIR', join_paths(get_option('localedir'), meson.project_name()))
configure_file(
output: 'config.h',
configuration: config_h,
@ -126,7 +127,8 @@ test_env = [
]
subdir('accounts-service')
subdir('malcontent-client')
subdir('libmalcontent')
subdir('malcontent-client')
subdir('malcontent-control')
subdir('pam')
subdir('po')

View File

@ -2,4 +2,5 @@
# Please keep this file sorted alphabetically.
accounts-service/com.endlessm.ParentalControls.policy.in
libmalcontent/manager.c
malcontent-control/application.c
pam/pam_malcontent.c