[gnome-music/wip/jfelder/3-36-do-not-force-pango-version: 5/5] Do not depend on pango 1.44
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/3-36-do-not-force-pango-version: 5/5] Do not depend on pango 1.44
- Date: Sat, 28 Mar 2020 21:07:16 +0000 (UTC)
commit acddcb9ac7c36d01d4ae6e08ed8bd90c29d4634a
Author: Jean Felder <jfelder src gnome org>
Date: Wed Mar 18 14:12:58 2020 +0100
Do not depend on pango 1.44
Since commit 2aa733b7dba72ee5261ae45ecc390e09c3826503, the SongsView
uses tabular number to display songs duration.
This is only possible since pango 1.44 because PangoAttribute needs to
be a boxed type (see
https://gitlab.gnome.org/GNOME/pygobject/issues/312)
By adding an explicit pango dependency, it prevents using Music
without the proper pango dependency. A simple try/except allows to use
Music with pango 1.42 and 1.44.
Related: #374
gnomemusic/views/songsview.py | 14 ++++++++++++--
meson.build | 1 -
2 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/views/songsview.py b/gnomemusic/views/songsview.py
index d76cd0e1..20b18ba6 100644
--- a/gnomemusic/views/songsview.py
+++ b/gnomemusic/views/songsview.py
@@ -26,6 +26,7 @@ from gettext import gettext as _
from gi.repository import Gdk, Gtk, Pango
from gnomemusic.coresong import CoreSong
+from gnomemusic.musiclogger import MusicLogger
from gnomemusic.player import PlayerPlaylist
from gnomemusic.utils import SongStateIcon
from gnomemusic.views.baseview import BaseView
@@ -39,6 +40,8 @@ class SongsView(BaseView):
and the album name.
"""
+ _log = MusicLogger()
+
def __init__(self, application):
"""Initialize
@@ -117,8 +120,15 @@ class SongsView(BaseView):
column_album.props.expand = True
self._view.append_column(column_album)
- attrs = Pango.AttrList()
- attrs.insert(Pango.AttrFontFeatures.new("tnum=1"))
+ attrs = None
+ # The attributes syntax is only possible with Pango 1.44 and above
+ # https://gitlab.gnome.org/GNOME/pygobject/issues/312
+ try:
+ attrs = Pango.AttrList()
+ attrs.insert(Pango.AttrFontFeatures.new("tnum=1"))
+ except AttributeError as error:
+ self._log.warning("Error: {}".format(error))
+
duration_renderer = Gtk.CellRendererText(xalign=1.0, attributes=attrs)
column_duration = Gtk.TreeViewColumn(
"Duration", duration_renderer, text=5)
diff --git a/meson.build b/meson.build
index 9bd65331..9882ef05 100644
--- a/meson.build
+++ b/meson.build
@@ -43,7 +43,6 @@ dependency('libdazzle-1.0', version: '>= 3.28.0')
dependency('libmediaart-2.0', version: '>= 1.9.1')
dependency('libsoup-2.4')
dependency('tracker-sparql-2.0', version: '>= 2.3.0')
-dependency('pango', version: '>= 1.44.0')
dependency('pygobject-3.0', version: '>= 3.29.1')
dependency('py3cairo', version: '>= 1.14.0')
dependency('grilo-0.3', version: '>= 0.3.12', fallback: ['grilo', 'libgrl_dep'])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]