Player: bind to settings
All checks were successful
PostmarketOS Build / Prepare (push) Successful in 17s
PostmarketOS Build / Build for aarch64 (push) Successful in 3m4s
PostmarketOS Build / Build for x86_64 (push) Successful in 1m1s

Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
This commit is contained in:
Vasiliy Doylov 2025-07-11 10:58:12 +03:00
parent b81ab03924
commit 998079110e
4 changed files with 18 additions and 5 deletions

View file

@ -17,7 +17,7 @@ namespace MediaPlayer {
var replacer = new Utils.PlayerReplacer (); var replacer = new Utils.PlayerReplacer ();
child = replacer; child = replacer;
visible = false; visible = false;
replacer.player.margin_top = 12; replacer.player.bind_settings (Preferences.Keys.CHILD_QUICK_SETTINGS);
} }
} }
public class LockScreen : Gtk.Box { public class LockScreen : Gtk.Box {
@ -33,8 +33,7 @@ namespace MediaPlayer {
halign = Gtk.Align.CENTER; halign = Gtk.Align.CENTER;
visible = true; visible = true;
replacer.player.margin_start = 12; replacer.player.bind_settings (Preferences.Keys.CHILD_LOCK_SCREEN);
replacer.player.margin_end = 12;
} }
} }
} }

View file

@ -191,4 +191,16 @@ public class MediaPlayer.Player : Gtk.Box {
s.object.disconnect (s.signal); s.object.disconnect (s.signal);
} }
} }
public void bind_settings (string key) {
var settings = new Settings.with_path (Preferences.Keys.SCHEMA_ID, Preferences.Keys.SETTINGS_PATH);
settings = settings.get_child (key);
/*
* Margins
*/
settings.bind (Preferences.Keys.MARGIN_TOP, this, Preferences.Keys.MARGIN_TOP, SettingsBindFlags.DEFAULT);
settings.bind (Preferences.Keys.MARGIN_BOTTOM, this, Preferences.Keys.MARGIN_BOTTOM, SettingsBindFlags.DEFAULT);
settings.bind (Preferences.Keys.MARGIN_START, this, Preferences.Keys.MARGIN_START, SettingsBindFlags.DEFAULT);
settings.bind (Preferences.Keys.MARGIN_END, this, Preferences.Keys.MARGIN_END, SettingsBindFlags.DEFAULT);
}
} }

View file

@ -25,12 +25,12 @@ public class MediaPlayer.Preferences.Preferences : Adw.PreferencesDialog {
public class MediaPlayer.Preferences.QuickSettings : Preferences { public class MediaPlayer.Preferences.QuickSettings : Preferences {
construct { construct {
bind_preferences("quick-settings"); bind_preferences(Keys.CHILD_QUICK_SETTINGS);
} }
} }
public class MediaPlayer.Preferences.LockScreen : Preferences { public class MediaPlayer.Preferences.LockScreen : Preferences {
construct { construct {
bind_preferences("lock-screen"); bind_preferences(Keys.CHILD_LOCK_SCREEN);
} }
} }

View file

@ -5,4 +5,6 @@ namespace MediaPlayer.Preferences.Keys {
public const string MARGIN_END = "margin-end"; public const string MARGIN_END = "margin-end";
public const string SCHEMA_ID = "mobi.phosh.plugins.mediaplayer"; public const string SCHEMA_ID = "mobi.phosh.plugins.mediaplayer";
public const string SETTINGS_PATH = "/mobi/phosh/plugins/media-player/"; public const string SETTINGS_PATH = "/mobi/phosh/plugins/media-player/";
public const string CHILD_QUICK_SETTINGS = "quick-settings";
public const string CHILD_LOCK_SCREEN = "lock-screen";
} }