Player: bind to settings
Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
This commit is contained in:
parent
b81ab03924
commit
998079110e
4 changed files with 18 additions and 5 deletions
|
@ -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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue