[gnome-music/wip/jfelder/gtk4-v3: 80/119] v2
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/gtk4-v3: 80/119] v2
- Date: Thu, 3 Feb 2022 04:51:46 +0000 (UTC)
commit 3a0973f45ee9106ed4ac6e085d837a9c4b9d18ec
Author: Jean Felder <jfelder src gnome org>
Date: Wed Jan 12 12:46:05 2022 +0100
v2
data/ui/SongListItem.ui | 12 ++++++++++++
gnomemusic/songlistscope.py | 7 ++++++-
2 files changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/data/ui/SongListItem.ui b/data/ui/SongListItem.ui
index 1781d5082..7d0905e0f 100644
--- a/data/ui/SongListItem.ui
+++ b/data/ui/SongListItem.ui
@@ -5,6 +5,18 @@
<property name="child">
<object class="GtkBox">
<property name="orientation">horizontal</property>
+ <child>
+ <object class="GtkImage" id="_play_icon">
+ <property name="can_focus">False</property>
+ <property name="icon_size">1</property>
+ <property name="icon-name">media-playback-start-symbolic</property>
+ <binding name="visible">
+ <closure type="gboolean" function="show_play_icon">
+ <lookup name="item">GtkListItem</lookup>
+ </closure>
+ </binding>
+ </object>
+ </child>
<child>
<object class="GtkBox">
<property name="homogeneous">True</property>
diff --git a/gnomemusic/songlistscope.py b/gnomemusic/songlistscope.py
index fb4436d02..19427f6bc 100644
--- a/gnomemusic/songlistscope.py
+++ b/gnomemusic/songlistscope.py
@@ -28,10 +28,11 @@ import typing
from gi.repository import GObject, Gtk
+from gnomemusic.coresong import CoreSong
+from gnomemusic.widgets.songwidget import SongWidget
from gnomemusic.widgets.songwidgetmenu import SongWidgetMenu
import gnomemusic.utils as utils
if typing.TYPE_CHECKING:
- from gnomemusic.coresong import CoreSong
ClosureType = Callable[[Gtk.ListItem, CoreSong], str]
@@ -50,6 +51,10 @@ class SongListScope(GObject.GObject, Gtk.BuilderScope):
obj: Optional[GObject.GObject]) -> ClosureType:
return getattr(self, func_name)
+ def show_play_icon(
+ self, listitem: Gtk.ListItem, coresong: CoreSong) -> bool:
+ return coresong.props.state == SongWidget.State.PLAYING
+
def song_duration(self, listitem: Gtk.ListItem, coresong: CoreSong) -> str:
return utils.seconds_to_string(coresong.props.duration)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]