pantheon.switchboard-plug-parental-controls: init at 8.0.1

Co-authored-by: davidak <git@davidak.de>
This commit is contained in:
Bobby Rong
2025-12-06 23:30:43 +08:00
parent f61125a668
commit 4104e0ff64
4 changed files with 142 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
diff --git a/src/common/PAM/Writer.vala b/src/common/PAM/Writer.vala
index 6b80269..063f3b0 100644
--- a/src/common/PAM/Writer.vala
+++ b/src/common/PAM/Writer.vala
@@ -25,6 +25,17 @@ namespace PC.PAM {
private string filename;
public static Writer new_for_time () {
+ var time_file = File.new_for_path (Constants.PAM_TIME_CONF_PATH);
+ if (!time_file.query_exists ()) {
+ var security_dir = time_file.get_parent ();
+ try {
+ security_dir.make_directory_with_parents ();
+ time_file.create (FileCreateFlags.NONE);
+ } catch (Error err) {
+ critical ("Could not create \"%s\": %s", Constants.PAM_TIME_CONF_PATH, err.message);
+ }
+ }
+
return new Writer (Constants.PAM_TIME_CONF_PATH);
}

View File

@@ -0,0 +1,106 @@
{
stdenv,
lib,
fetchFromGitHub,
fetchpatch,
gettext,
gtk4,
meson,
ninja,
pkg-config,
vala,
wrapGAppsHook4,
accountsservice,
dbus,
flatpak,
glib,
granite7,
libadwaita,
libgee,
malcontent,
polkit,
switchboard,
systemd,
iptables,
nix-update-script,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "switchboard-plug-parental-controls";
version = "8.0.1";
src = fetchFromGitHub {
owner = "elementary";
repo = "switchboard-plug-parental-controls";
tag = finalAttrs.version;
hash = "sha256-yxQZSbbtWP0+gMu4cZt4bKZC7z8iZILAILYnn9ExnJY=";
};
patches = [
# Change default config file path and separate default and run-time config file
# https://github.com/elementary/switchboard-plug-parental-controls/pull/206
(fetchpatch {
url = "https://github.com/elementary/switchboard-plug-parental-controls/commit/1e5a08c1c3b0a5503e9d3f6858047d53ed8188f7.patch";
hash = "sha256-daP/nBmrUw8b3UytIZz3bKdM+lIgAIQ/DJP0h9sdXmc=";
})
(fetchpatch {
url = "https://github.com/elementary/switchboard-plug-parental-controls/commit/51f027657616a5d4a6bd24478a5b94fad12edb95.patch";
hash = "sha256-JOogF1ychF7MAJdrKT4eiUgM8+Y7CN9nxnRNidRoMOk=";
})
# See the nixos/lightdm module for corresponding PAM files.
# Since we override conffile path we need to create time.conf ourselves.
./create-pam-time-conf.patch
# We cannot really setfacl on read-only desktop files.
./disable-applications-tab.patch
];
nativeBuildInputs = [
gettext
gtk4 # gtk4-update-icon-cache
meson
ninja
pkg-config
vala
wrapGAppsHook4
];
buildInputs = [
accountsservice
dbus
flatpak
glib
granite7
gtk4
libadwaita
libgee
malcontent
polkit
switchboard
systemd
];
mesonFlags = [
# For /var/lib/pantheon-parental-controls/daemon.conf
"-Dsharedstatedir=/var/lib"
"-Dsystemdunitdir=${placeholder "out"}/etc/systemd/system"
];
preFixup = ''
# For WebRestriction.
gappsWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ iptables ]})
'';
passthru = {
updateScript = nix-update-script { };
};
meta = {
description = "Switchboard Screen Time & Limits Plug";
homepage = "https://github.com/elementary/switchboard-plug-parental-controls";
license = lib.licenses.gpl3Plus;
platforms = lib.platforms.linux;
teams = [ lib.teams.pantheon ];
};
})

View File

@@ -0,0 +1,12 @@
diff --git a/src/plug/Widgets/ControlPage.vala b/src/plug/Widgets/ControlPage.vala
index 7d1a17d..0d37da2 100644
--- a/src/plug/Widgets/ControlPage.vala
+++ b/src/plug/Widgets/ControlPage.vala
@@ -36,7 +36,6 @@ public class PC.Widgets.ControlPage : Switchboard.SettingsPage {
stack = new Gtk.Stack ();
stack.add_titled (time_limit_view, "general", _("Screen Time"));
stack.add_titled (internet_box, "internet", _("Internet"));
- stack.add_titled (apps_box, "apps", _("Applications"));
var switcher = new Gtk.StackSwitcher () {
halign = CENTER,

View File

@@ -20,6 +20,7 @@ lib.makeScope pkgs.newScope (
switchboard-plug-notifications
switchboard-plug-onlineaccounts
switchboard-plug-pantheon-shell
switchboard-plug-parental-controls
switchboard-plug-power
switchboard-plug-printers
switchboard-plug-security-privacy
@@ -201,6 +202,8 @@ lib.makeScope pkgs.newScope (
switchboard-plug-pantheon-shell = callPackage ./apps/switchboard-plugs/pantheon-shell { };
switchboard-plug-parental-controls = callPackage ./apps/switchboard-plugs/parental-controls { };
switchboard-plug-power = callPackage ./apps/switchboard-plugs/power { };
switchboard-plug-printers = callPackage ./apps/switchboard-plugs/printers { };