Open vixalien opened 4 months ago
This is when you have properties that will sync to another object.
Instead of updating that object's property using getters/setters, you can use a simple bind_property.
bind_property
Before:
private _selection_mode = false; get selection_mode() { return this._selection_mode; } set selection_mode(value: boolean) { if (this.selection_mode == value) return; this._selection_mode = value; this._bar.selection_mode = value; this._playlist_item_view.selection_mode = value; this.notify("selection-mode"); }
After:
// selection-mode this.bind_property( "selection-mode", this._bar, "selection-mode", GObject.BindingFlags.SYNC_CREATE, ); this.bind_property( "selection-mode", this._playlist_item_view, "selection-mode", GObject.BindingFlags.SYNC_CREATE, );
This is when you have properties that will sync to another object.
Instead of updating that object's property using getters/setters, you can use a simple
bind_property
.Before:
After: