[gnome-music] TrackWidget: make max-width-chars configurable
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] TrackWidget: make max-width-chars configurable
- Date: Mon, 24 Nov 2014 12:27:52 +0000 (UTC)
commit 3d828eac7c8383038f4f376d0a38238dcc0343a5
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date: Mon Nov 24 13:02:55 2014 +0100
TrackWidget: make max-width-chars configurable
data/TrackWidget.ui | 2 +-
data/org.gnome.Music.gschema.xml | 5 +++++
gnomemusic/widgets.py | 11 ++++++++++-
3 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/data/TrackWidget.ui b/data/TrackWidget.ui
index f2c5eb4..8b69b17 100644
--- a/data/TrackWidget.ui
+++ b/data/TrackWidget.ui
@@ -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>
diff --git a/data/org.gnome.Music.gschema.xml b/data/org.gnome.Music.gschema.xml
index 31cff0f..ef9474f 100644
--- a/data/org.gnome.Music.gschema.xml
+++ b/data/org.gnome.Music.gschema.xml
@@ -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>
diff --git a/gnomemusic/widgets.py b/gnomemusic/widgets.py
index d00467b..e9f0088 100644
--- a/gnomemusic/widgets.py
+++ b/gnomemusic/widgets.py
@@ -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)),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]