banshee r3035 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Sources.Gui
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3035 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Sources.Gui
- Date: Sun, 27 Jan 2008 01:31:53 +0000 (GMT)
Author: abock
Date: Sun Jan 27 01:31:52 2008
New Revision: 3035
URL: http://svn.gnome.org/viewvc/banshee?rev=3035&view=rev
Log:
2008-01-26 Aaron Bockover <abockover novell com>
* src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs:
Remove the old manual ellipize calculations and just let Pango do it now
that we can (it wasn't supported in the binding years back); make source
text bold if it is the playback source, not the selected source
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs Sun Jan 27 01:31:52 2008
@@ -31,6 +31,8 @@
using Gdk;
using Pango;
+using Banshee.ServiceStack;
+
namespace Banshee.Sources.Gui
{
internal class SourceRowRenderer : CellRendererText
@@ -46,7 +48,6 @@
protected SourceRowRenderer(System.IntPtr ptr) : base(ptr)
{
-
}
private StateType RendererStateToWidgetState(CellRendererState flags)
@@ -90,10 +91,6 @@
StateType state = RendererStateToWidgetState(flags);
Pixbuf icon = null;
- if(source == null) {
- return;
- }
-
icon = source.Properties.Get<Gdk.Pixbuf>("IconPixbuf");
if(icon == null) {
Type icon_type = source.Properties.GetType("IconName");
@@ -117,43 +114,24 @@
Pango.Layout countLayout = new Pango.Layout(widget.PangoContext);
FontDescription fd = widget.PangoContext.FontDescription.Copy();
- fd.Weight = Selected ? Pango.Weight.Bold : Pango.Weight.Normal;
- if(Italicized/* || source.HasEmphasis*/) {
+ fd.Weight = ServiceManager.PlaybackController.Source == source ? Pango.Weight.Bold : Pango.Weight.Normal;
+
+ if(Italicized) {
fd.Style = Pango.Style.Italic;
hideCounts = true;
}
- titleLayout.FontDescription = fd;
countLayout.FontDescription = fd;
-
- titleLayout.SetMarkup("...");
- titleLayout.GetPixelSize(out titleLayoutWidth, out titleLayoutHeight);
- int ellipsisSize = titleLayoutWidth;
-
- string titleText = source.Name;
- titleLayout.SetMarkup(GLib.Markup.EscapeText(titleText));
countLayout.SetMarkup("<span size=\"small\">(" + source.Count + ")</span>");
-
- titleLayout.GetPixelSize(out titleLayoutWidth, out titleLayoutHeight);
countLayout.GetPixelSize(out countLayoutWidth, out countLayoutHeight);
maxTitleLayoutWidth = cell_area.Width - (icon == null ? 0 : icon.Width) - countLayoutWidth - 10;
- if(titleLayoutWidth > maxTitleLayoutWidth) {
- float ratio = (float)(maxTitleLayoutWidth - ellipsisSize) / (float)titleLayoutWidth;
- int characters = (int)(ratio * (float)titleText.Length);
- do {
- if(characters > 0) {
- titleLayout.SetMarkup(GLib.Markup.EscapeText(
- titleText.Substring(0, characters--)).Trim() + "...");
- titleLayout.GetPixelSize(out titleLayoutWidth, out titleLayoutHeight);
- } else {
- hideCounts = true;
- titleLayout.SetMarkup(GLib.Markup.EscapeText(titleText.Trim()));
- break;
- }
- } while (titleLayoutWidth > maxTitleLayoutWidth);
- }
+ titleLayout.FontDescription = fd;
+ titleLayout.Width = (int)((maxTitleLayoutWidth) * Pango.Scale.PangoScale);
+ titleLayout.Ellipsize = EllipsizeMode.End;
+ titleLayout.SetText(GLib.Markup.EscapeText(source.Name));
+ titleLayout.GetPixelSize(out titleLayoutWidth, out titleLayoutHeight);
Gdk.GC mainGC = widget.Style.TextGC(state);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]