pantheon.switchboard-with-plugs: don't use hardcode patches

There are really becoming a pain to maintain.
This commit is contained in:
worldofpeace 2019-11-25 22:25:15 -05:00
parent 23b11cc24c
commit 1575b3971c
9 changed files with 22 additions and 209 deletions

View File

@ -24,15 +24,6 @@ stdenv.mkDerivation rec {
sha256 = "1cg69nbdf4mcr16mi71aw9j8877lyj8yxjfk9bd3sml8f4fh7mmr";
};
patches = [
./hardcode-settings-daemon-gsettings.patch
];
postPatch = ''
substituteInPlace src/Views/Clicking.vala \
--subst-var-by GSD_GSETTINGS ${glib.getSchemaPath elementary-settings-daemon}
'';
passthru = {
updateScript = pantheon.updateScript {
repoName = pname;
@ -51,6 +42,7 @@ stdenv.mkDerivation rec {
granite
gtk3
libgee
elementary-settings-daemon
switchboard
];

View File

@ -1,76 +0,0 @@
diff --git a/src/Views/Clicking.vala b/src/Views/Clicking.vala
index cc4431b..d12ddfe 100644
--- a/src/Views/Clicking.vala
+++ b/src/Views/Clicking.vala
@@ -123,42 +123,39 @@ public class MouseTouchpad.ClickingView : Granite.SimpleSettingsPage {
content_area.attach (hold_scale, 3, 3);
content_area. attach (hold_help, 1, 4, 3);
- var xsettings_schema = SettingsSchemaSource.get_default ().lookup (
- "org.gnome.settings-daemon.plugins.xsettings",
- true
- );
-
- if (xsettings_schema != null) {
- var primary_paste_switch = new Gtk.Switch ();
- primary_paste_switch.halign = Gtk.Align.START;
+ SettingsSchemaSource daemon_schema_source = new SettingsSchemaSource.from_directory ("@GSD_GSETTINGS@", null, true);
+ SettingsSchema xsettings_schema = daemon_schema_source.lookup ("org.gnome.settings-daemon.plugins.xsettings", false);
- var primary_paste_help = new Gtk.Label (
- _("Middle or three-finger clicking on an input will paste any selected text")
- );
- primary_paste_help.margin_bottom = 18;
- primary_paste_help.wrap = true;
- primary_paste_help.xalign = 0;
- primary_paste_help.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL);
-
- content_area.attach (new SettingLabel (_("Middle click paste:")), 0, 5);
- content_area.attach (primary_paste_switch, 1, 5);
- content_area.attach (primary_paste_help, 1, 6, 3);
-
- var xsettings = new GLib.Settings ("org.gnome.settings-daemon.plugins.xsettings");
- primary_paste_switch.notify["active"].connect (() => {
- on_primary_paste_switch_changed (primary_paste_switch, xsettings);
- });
+ var primary_paste_switch = new Gtk.Switch ();
+ primary_paste_switch.halign = Gtk.Align.START;
- var current_value = xsettings.get_value ("overrides").lookup_value (
- "Gtk/EnablePrimaryPaste",
- VariantType.INT32
- );
- if (current_value != null) {
- primary_paste_switch.active = current_value.get_int32 () == 1;
- }
+ var primary_paste_help = new Gtk.Label (
+ _("Middle or three-finger clicking on an input will paste any selected text")
+ );
+ primary_paste_help.margin_bottom = 18;
+ primary_paste_help.wrap = true;
+ primary_paste_help.xalign = 0;
+ primary_paste_help.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL);
+
+ content_area.attach (new SettingLabel (_("Middle click paste:")), 0, 5);
+ content_area.attach (primary_paste_switch, 1, 5);
+ content_area.attach (primary_paste_help, 1, 6, 3);
+
+ var xsettings = new GLib.Settings.full (xsettings_schema, null, null);
+ primary_paste_switch.notify["active"].connect (() => {
+ on_primary_paste_switch_changed (primary_paste_switch, xsettings);
+ });
+
+ var current_value = xsettings.get_value ("overrides").lookup_value (
+ "Gtk/EnablePrimaryPaste",
+ VariantType.INT32
+ );
+ if (current_value != null) {
+ primary_paste_switch.active = current_value.get_int32 () == 1;
}
- var daemon_settings = new GLib.Settings ("org.gnome.settings-daemon.peripherals.mouse");
+ SettingsSchema daemon_schema = daemon_schema_source.lookup ("org.gnome.settings-daemon.peripherals.mouse", false);
+ var daemon_settings = new GLib.Settings.full (daemon_schema, null, null);
daemon_settings.bind ("double-click", double_click_speed_adjustment, "value", SettingsBindFlags.DEFAULT);
var a11y_mouse_settings = new GLib.Settings ("org.gnome.desktop.a11y.mouse");

View File

@ -36,24 +36,16 @@ stdenv.mkDerivation rec {
granite
gtk3
libgee
gala
wingpanel
plank
switchboard
];
patches = [
./backgrounds.patch # Having https://github.com/elementary/switchboard-plug-pantheon-shell/issues/166 would make this patch uneeded
./hardcode-gsettings.patch
];
postPatch = ''
substituteInPlace src/Views/Appearance.vala \
--subst-var-by GALA_GSETTINGS_PATH ${glib.getSchemaPath gala}
substituteInPlace src/Views/HotCorners.vala \
--subst-var-by GALA_GSETTINGS_PATH ${glib.getSchemaPath gala}
substituteInPlace src/Views/Appearance.vala \
--subst-var-by WINGPANEL_GSETTINGS_PATH ${glib.getSchemaPath wingpanel}
'';
meta = with stdenv.lib; {
description = "Switchboard Desktop Plug";
homepage = https://github.com/elementary/switchboard-plug-pantheon-shell;

View File

@ -1,39 +0,0 @@
diff --git a/src/Views/Appearance.vala b/src/Views/Appearance.vala
index c8300cc..fc48a0e 100644
--- a/src/Views/Appearance.vala
+++ b/src/Views/Appearance.vala
@@ -66,10 +66,16 @@ public class Appearance : Gtk.Grid {
attach (text_size_label, 0, 2);
attach (text_size_modebutton, 1, 2);
- var animations_settings = new Settings (ANIMATIONS_SCHEMA);
+ SettingsSchemaSource gala_schema_source = new SettingsSchemaSource.from_directory ("@GALA_GSETTINGS_PATH@", SettingsSchemaSource.get_default (), true);
+ SettingsSchema animations_schema = gala_schema_source.lookup (ANIMATIONS_SCHEMA, false);
+
+ var animations_settings = new Settings.full (animations_schema, null, null);
animations_settings.bind (ANIMATIONS_KEY, animations_switch, "active", SettingsBindFlags.DEFAULT);
- var panel_settings = new Settings (PANEL_SCHEMA);
+ SettingsSchemaSource panel_schema_source = new SettingsSchemaSource.from_directory ("@WINGPANEL_GSETTINGS_PATH@", SettingsSchemaSource.get_default (), true);
+ SettingsSchema panel_schema = panel_schema_source.lookup (PANEL_SCHEMA, false);
+
+ var panel_settings = new GLib.Settings.full (panel_schema, null, null);
panel_settings.bind (TRANSLUCENCY_KEY, translucency_switch, "active", SettingsBindFlags.DEFAULT);
var interface_settings = new Settings (INTERFACE_SCHEMA);
diff --git a/src/Views/HotCorners.vala b/src/Views/HotCorners.vala
index 481e7c5..d102d03 100644
--- a/src/Views/HotCorners.vala
+++ b/src/Views/HotCorners.vala
@@ -30,7 +30,10 @@ public class HotCorners : Gtk.Grid {
row_spacing = 24;
halign = Gtk.Align.CENTER;
- behavior_settings = new GLib.Settings ("org.pantheon.desktop.gala.behavior");
+
+ SettingsSchemaSource gala_schema_source = new SettingsSchemaSource.from_directory ("@GALA_GSETTINGS_PATH@", SettingsSchemaSource.get_default (), true);
+ SettingsSchema behavior_schema = gala_schema_source.lookup ("org.pantheon.desktop.gala.behavior", false);
+ behavior_settings = new GLib.Settings.full (behavior_schema, null, null);
custom_command_revealer = new Gtk.Revealer ();

View File

@ -43,6 +43,8 @@ stdenv.mkDerivation rec {
buildInputs = [
dbus
elementary-dpms-helper
elementary-settings-daemon
glib
granite
gtk3
@ -56,16 +58,8 @@ stdenv.mkDerivation rec {
src = ./dpms-helper-exec.patch;
elementary_dpms_helper = elementary-dpms-helper;
})
./hardcode-gsettings.patch
];
postPatch = ''
substituteInPlace src/MainView.vala \
--subst-var-by DPMS_HELPER_GSETTINGS_PATH ${glib.getSchemaPath elementary-dpms-helper}
substituteInPlace src/MainView.vala \
--subst-var-by GSD_GSETTINGS_PATH ${glib.getSchemaPath elementary-settings-daemon}
'';
PKG_CONFIG_SWITCHBOARD_2_0_PLUGSDIR = "${placeholder "out"}/lib/switchboard";
PKG_CONFIG_DBUS_1_SYSTEM_BUS_SERVICES_DIR = "${placeholder "out"}/share/dbus-1/system-services";
PKG_CONFIG_DBUS_1_SYSCONFDIR = "${placeholder "out"}/etc";

View File

@ -1,20 +0,0 @@
diff --git a/src/MainView.vala b/src/MainView.vala
index 1654e68..ad8fed9 100644
--- a/src/MainView.vala
+++ b/src/MainView.vala
@@ -46,8 +46,13 @@ public class Power.MainView : Gtk.Grid {
var label_size = new Gtk.SizeGroup (Gtk.SizeGroupMode.HORIZONTAL);
- settings = new GLib.Settings ("org.gnome.settings-daemon.plugins.power");
- elementary_dpms_settings = new GLib.Settings ("io.elementary.dpms");
+ SettingsSchemaSource gsd_sss = new SettingsSchemaSource.from_directory ("@GSD_GSETTINGS_PATH@", null, true);
+ SettingsSchema gsd_schema = gsd_sss.lookup ("org.gnome.settings-daemon.plugins.power", false);
+ settings = new GLib.Settings.full (gsd_schema, null, null);
+
+ SettingsSchemaSource dpms_sss = new SettingsSchemaSource.from_directory ("@DPMS_HELPER_GSETTINGS_PATH@", null, true);
+ SettingsSchema elementary_dpms_schema = dpms_sss.lookup ("io.elementary.dpms", false);
+ elementary_dpms_settings = new GLib.Settings.full (elementary_dpms_schema, null, null);
battery = new Battery ();
power_supply = new PowerSupply ();

View File

@ -48,21 +48,13 @@ stdenv.mkDerivation rec {
libgee
polkit
switchboard
lightlocker
zeitgeist
];
patches = [
./hardcode-gsettings.patch
];
postPatch = ''
chmod +x meson/post_install.py
patchShebangs meson/post_install.py
substituteInPlace src/Views/LockPanel.vala \
--subst-var-by LIGHTLOCKER_GSETTINGS_PATH ${glib.getSchemaPath lightlocker}
substituteInPlace src/Views/FirewallPanel.vala \
--subst-var-by SWITCHBOARD_SEC_PRIV_GSETTINGS_PATH ${glib.makeSchemaPath "$out" "${pname}-${version}"}
'';
meta = with stdenv.lib; {

View File

@ -1,33 +0,0 @@
diff --git a/src/Views/FirewallPanel.vala b/src/Views/FirewallPanel.vala
index 0335c29..481b1c8 100644
--- a/src/Views/FirewallPanel.vala
+++ b/src/Views/FirewallPanel.vala
@@ -49,7 +49,11 @@ public class SecurityPrivacy.FirewallPanel : Granite.SimpleSettingsPage {
}
construct {
- settings = new Settings ("io.elementary.switchboard.security-privacy");
+ SettingsSchemaSource sss = new SettingsSchemaSource.from_directory ("@SWITCHBOARD_SEC_PRIV_GSETTINGS_PATH@", SettingsSchemaSource.get_default (), true);
+ SettingsSchema security_privacy_schema = sss.lookup ("io.elementary.switchboard.security-privacy", false);
+
+ settings = new Settings.full (security_privacy_schema, null, null);
+
disabled_rules = new Gee.HashMap<string, UFWHelpers.Rule> ();
load_disabled_rules ();
diff --git a/src/Views/LockPanel.vala b/src/Views/LockPanel.vala
index 4f523f9..7135a83 100644
--- a/src/Views/LockPanel.vala
+++ b/src/Views/LockPanel.vala
@@ -30,7 +30,10 @@ public class SecurityPrivacy.LockPanel : Granite.SimpleSettingsPage {
}
construct {
- locker = new Settings ("apps.light-locker");
+ SettingsSchemaSource sss = new SettingsSchemaSource.from_directory ("@LIGHTLOCKER_GSETTINGS_PATH@", SettingsSchemaSource.get_default (), true);
+ SettingsSchema locker_schema = sss.lookup ("apps.light-locker", false);
+
+ locker = new Settings.full (locker_schema, null, null);
var lock_suspend_label = new Gtk.Label (_("Lock on suspend:"));
var lock_suspend_switch = new Gtk.Switch ();

View File

@ -1,4 +1,6 @@
{ makeWrapper
{ wrapGAppsHook
, glib
, lib
, symlinkJoin
, switchboard
, switchboardPlugs
@ -11,13 +13,22 @@ in
symlinkJoin {
name = "${switchboard.name}-with-plugs";
paths = [ switchboard ] ++ selectedPlugs;
paths = [
switchboard
] ++ selectedPlugs;
buildInputs = [ makeWrapper ];
buildInputs = [
wrapGAppsHook
glib
] ++ (lib.forEach selectedPlugs (x: x.buildInputs))
++ selectedPlugs;
postBuild = ''
wrapProgram $out/bin/io.elementary.switchboard \
--set SWITCHBOARD_PLUGS_PATH "$out/lib/switchboard"
make_glib_find_gsettings_schemas
gappsWrapperArgs+=(--set SWITCHBOARD_PLUGS_PATH "$out/lib/switchboard")
wrapGAppsHook
'';
inherit (switchboard) meta;