[banshee] Fixed a Bit Rate column glitch (bgo#584587)
- From: Alexander Kojevnikov <alexk src gnome org>
- To: svn-commits-list gnome org
- Subject: [banshee] Fixed a Bit Rate column glitch (bgo#584587)
- Date: Tue, 2 Jun 2009 19:18:25 -0400 (EDT)
commit 768f89e5429e552513ec64276716f2e1c81d333b
Author: Alexander Kojevnikov <alexander kojevnikov com>
Date: Wed Jun 3 09:09:43 2009 +1000
Fixed a Bit Rate column glitch (bgo#584587)
Bit Rate column uses this format for its display value: "{0} kbps", but when
calculating the minimum and maximum required width only the "{0}" part was
taken into account.
---
.../Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
index 43e4ce0..2e07217 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
@@ -100,13 +100,7 @@ namespace Hyena.Data.Gui
context.Layout.FontDescription.Weight = font_weight;
context.Layout.Ellipsize = EllipsizeMode;
context.Layout.Alignment = alignment;
-
- if (text_format == null) {
- context.Layout.SetText (text);
- } else {
- context.Layout.SetText (String.Format (text_format, text));
- }
-
+ context.Layout.SetText (GetFormattedText (text));
context.Layout.GetPixelSize (out text_width, out text_height);
// Requires Gtk# 2.12
//is_ellipsized = context.Layout.IsEllipsized;
@@ -117,6 +111,14 @@ namespace Hyena.Data.Gui
return obj == null ? String.Empty : obj.ToString ();
}
+ private string GetFormattedText (string text)
+ {
+ if (text_format == null) {
+ return text;
+ }
+ return String.Format (text_format, text);
+ }
+
/*private bool is_ellipsized = false;
public bool IsEllipsized {
get { return is_ellipsized; }
@@ -177,14 +179,14 @@ namespace Hyena.Data.Gui
min = max = -1;
if (!String.IsNullOrEmpty (MinString)) {
- layout.SetText (MinString);
+ layout.SetText (GetFormattedText (MinString));
layout.GetPixelSize (out min, out height);
min += 2*Spacing;
//Console.WriteLine ("for {0} got min {1} for {2}", this, min, MinString);
}
if (!String.IsNullOrEmpty (MaxString)) {
- layout.SetText (MaxString);
+ layout.SetText (GetFormattedText (MaxString));
layout.GetPixelSize (out max, out height);
max += 2*Spacing;
//Console.WriteLine ("for {0} got max {1} for {2}", this, max, MaxString);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]