[gnome-music/wip/jfelder/playertoolbar-action-group] playertoolbar: Set the action group in the constructor
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/playertoolbar-action-group] playertoolbar: Set the action group in the constructor
- Date: Thu, 3 Feb 2022 04:46:42 +0000 (UTC)
commit c0905d24c00d1675082e9057f0115bad1a8bab82
Author: Jean Felder <jfelder src gnome org>
Date: Thu Feb 3 05:44:27 2022 +0100
playertoolbar: Set the action group in the constructor
This fixes a weakref issue in the Gtk4 port.
gnomemusic/widgets/playertoolbar.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/widgets/playertoolbar.py b/gnomemusic/widgets/playertoolbar.py
index 5b98d0e5c..11d5e6a3c 100644
--- a/gnomemusic/widgets/playertoolbar.py
+++ b/gnomemusic/widgets/playertoolbar.py
@@ -88,6 +88,10 @@ class PlayerToolbar(Gtk.ActionBar):
self._repeat_action: Gio.SimpleAction = Gio.SimpleAction.new_stateful(
"repeat", GLib.VariantType.new("s"), GLib.Variant("s", ""))
+ action_group = Gio.SimpleActionGroup()
+ action_group.add_action(self._repeat_action)
+ self.insert_action_group("playertoolbar", action_group)
+
# FIXME: This is a workaround for not being able to pass the player
# object via init when using Gtk.Builder.
@GObject.Property(type=Player, default=None)
@@ -122,9 +126,6 @@ class PlayerToolbar(Gtk.ActionBar):
self._repeat_action.set_state(
GLib.Variant("s", str(repeat_mode.value)))
self._repeat_action.connect("activate", self._repeat_menu_changed)
- action_group = Gio.SimpleActionGroup()
- action_group.add_action(self._repeat_action)
- self.insert_action_group("playertoolbar", action_group)
self._sync_repeat_image()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]