-
-
Notifications
You must be signed in to change notification settings - Fork 52
PlaybackManager: create actions internally #824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PlaybackManager: make next/previous private
d75f298 to
7e224cf
Compare
|
@ryonakano Should I move the action constants to PlaybackManager as well? I wasn't sure if those should stay all centralized or be with the action creation |
|
@danirabbit Hmm it's difficult to judge, but maybe they would be better to be kept in Application? These constants themselves are no longer used in Application but the actions invoked by using these constants are still registered to it. So thinking about where we use them, I feel the former (current) code makes sense and hide internal implementation that the handler of the actions are actually no longer in Application but in PlaybackManager: // example 1
var play_button = new Gtk.Button () {
action_name = Application.ACTION_PREFIX + Application.ACTION_PLAY_PAUSE,
child = play_pause_image,
halign = Gtk.Align.CENTER,
};
// example 2
var play_pause_action = GLib.Application.get_default ().lookup_action (Application.ACTION_PLAY_PAUSE);
play_pause_action.bind_property ("enabled", seekbar, "sensitive", BindingFlags.SYNC_CREATE);rather than: // example 1
var play_button = new Gtk.Button () {
// I think this implicitly make the users of this action, us programmers, to be aware of the internal implementation
action_name = Application.ACTION_PREFIX + PlaybackManager.ACTION_PLAY_PAUSE,
child = play_pause_image,
halign = Gtk.Align.CENTER,
};
// example 2
// Why do we use the constants of PlaybackManager to lookup actions in Application……?
var play_pause_action = GLib.Application.get_default ().lookup_action (PlaybackManager.ACTION_PLAY_PAUSE);
play_pause_action.bind_property ("enabled", seekbar, "sensitive", BindingFlags.SYNC_CREATE); |
Co-authored-by: Ryo Nakano <[email protected]>
ryonakano
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed these actions still works. One small nitpicking otherwise LGTM.
ryonakano
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the cleanup! 🧹 ✨
Setup playbackmanager actions inside the playbackmanager. Makes sure playback manager functions are private so they're only used through actions. Manage state internally. Simplify setup