Commit 3d828eac authored by Vadim Rutkovsky's avatar Vadim Rutkovsky

TrackWidget: make max-width-chars configurable

parent 0cbb6f7b
......@@ -80,7 +80,7 @@
<property name="valign">start</property>
<property name="xalign">0</property>
<property name="ellipsize">end</property>
<property name="max-width-chars">20</property>
<property name="max-width-chars">90</property>
</object>
<packing>
<property name="expand">True</property>
......
......@@ -38,5 +38,10 @@
<summary>Notifications mode</summary>
<description>Enables or disables playback notifications</description>
</key>
<key type="i" name="max-width-chars">
<default>20</default>
<summary>Max chars to display in track name on Artist view</summary>
<description>This setting modifies the amount of chars for track title on Artist view before its been ellipsized. Set this to -1 to disable</description>
</key>
</schema>
</schemalist>
......@@ -31,7 +31,7 @@
# delete this exception statement from your version.
from gi.repository import Gtk, Gdk, Gd, GLib, GObject, Pango
from gi.repository import Gtk, Gdk, Gd, GLib, GObject, Pango, Gio
from gi.repository import GdkPixbuf, Grl
from gi.repository import Tracker
from gettext import gettext as _, ngettext
......@@ -502,6 +502,13 @@ class ArtistAlbumWidget(Gtk.Box):
self.pack_start(self.ui.get_object('ArtistAlbumWidget'), True, True, 0)
self.show_all()
try:
self.settings = Gio.Settings.new('org.gnome.Music')
self.max_title_width = self.settings.get_int('max-width-chars')
except Exception as e:
self.max_title_width = 20
logger.error("Error on setting widget max-width-chars: %s" % str(e))
@log
def _on_discovered(self, info, error, song_widget):
if error:
......@@ -528,6 +535,8 @@ class ArtistAlbumWidget(Gtk.Box):
title = AlbumArtCache.get_media_title(track)
ui.get_object('title').set_text(title)
ui.get_object('title').set_alignment(0.0, 0.5)
ui.get_object('title').set_max_width_chars(self.max_title_width)
self.songsGrid.attach(
song_widget,
int(i / (len(self.tracks) / 2)),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment