banshee r3211 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Sources src/Core/Hyena.Gui/Hyena.Data.Gui src/Core/Hyena.Gui/Hyena.Data.Gui/ListView src/Core/Hyena.Gui/Hyena.Query.Gui src/Core/Hyena/Hyena.Data.Sqlite src/Core/Hyena/Hyena.Query src/Core/Hyena/Hyena.SExpEngine
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3211 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Sources src/Core/Hyena.Gui/Hyena.Data.Gui src/Core/Hyena.Gui/Hyena.Data.Gui/ListView src/Core/Hyena.Gui/Hyena.Query.Gui src/Core/Hyena/Hyena.Data.Sqlite src/Core/Hyena/Hyena.Query src/Core/Hyena/Hyena.SExpEngine
- Date: Sun, 10 Feb 2008 22:31:51 +0000 (GMT)
Author: abock
Date: Sun Feb 10 22:31:51 2008
New Revision: 3211
URL: http://svn.gnome.org/viewvc/banshee?rev=3211&view=rev
Log:
2008-02-10 Aaron Bockover <abock gnome org>
* src/Core/Hyena.Gui/Hyena.Data.Gui/ColumnController.cs:
* src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs:
* src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs:
Fixed some really bad compiler warnings and made more progress on column
show/hide support through the columns menu; visibility now persists
* src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs:
* src/Core/Hyena.Gui/Hyena.Data.Gui/ColumnHeaderCellText.cs:
* src/Core/Hyena.Gui/Hyena.Data.Gui/ObjectListView.cs:
* src/Core/Hyena.Gui/Hyena.Query.Gui/QueryTermBox.cs:
* src/Core/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs:
* src/Core/Hyena/Hyena.Query/XmlQueryParser.cs:
* src/Core/Hyena/Hyena.SExpEngine/ListFunctionSet.cs: Cleaned up
more compiler warnings
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs
trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ColumnController.cs
trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ColumnHeaderCellText.cs
trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ObjectListView.cs
trunk/banshee/src/Core/Hyena.Gui/Hyena.Query.Gui/QueryTermBox.cs
trunk/banshee/src/Core/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs
trunk/banshee/src/Core/Hyena/Hyena.Query/XmlQueryParser.cs
trunk/banshee/src/Core/Hyena/Hyena.SExpEngine/ListFunctionSet.cs
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs Sun Feb 10 22:31:51 2008
@@ -177,16 +177,6 @@
handler(evargs);
}
}
-
-// private void OnSourceViewChanged(object o, EventArgs args)
-// {
-// SourceEventHandler handler = SourceViewChanged;
-// if(handler != null) {
-// SourceEventArgs evargs = new SourceEventArgs();
-// evargs.Source = o as Source;
-// handler(evargs);
-// }
-// }
private void OnChildSourceAdded(SourceEventArgs args)
{
Modified: trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ColumnController.cs
==============================================================================
--- trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ColumnController.cs (original)
+++ trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ColumnController.cs Sun Feb 10 22:31:51 2008
@@ -53,6 +53,9 @@
public void Clear ()
{
lock (this) {
+ foreach (Column column in columns) {
+ column.VisibilityChanged -= OnColumnVisibilityChanged;
+ }
columns.Clear ();
}
@@ -62,6 +65,9 @@
public void AddRange (params Column [] range)
{
lock (this) {
+ foreach (Column column in range) {
+ column.VisibilityChanged += OnColumnVisibilityChanged;
+ }
columns.AddRange (range);
}
@@ -71,6 +77,7 @@
public void Add (Column column)
{
lock (this) {
+ column.VisibilityChanged += OnColumnVisibilityChanged;
columns.Add (column);
}
@@ -80,6 +87,7 @@
public void Insert (Column column, int index)
{
lock (this) {
+ column.VisibilityChanged += OnColumnVisibilityChanged;
columns.Insert (index, column);
}
@@ -89,6 +97,7 @@
public void Remove (Column column)
{
lock (this) {
+ column.VisibilityChanged -= OnColumnVisibilityChanged;
columns.Remove (column);
}
@@ -98,6 +107,8 @@
public void Remove (int index)
{
lock (this) {
+ Column column = columns[index];
+ column.VisibilityChanged -= OnColumnVisibilityChanged;
columns.RemoveAt (index);
}
@@ -132,6 +143,16 @@
}
}
+ public Column [] ToArray ()
+ {
+ return columns.ToArray ();
+ }
+
+ private void OnColumnVisibilityChanged (object o, EventArgs args)
+ {
+ OnUpdated ();
+ }
+
public Column this[int index] {
get { return columns[index]; }
}
Modified: trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ColumnHeaderCellText.cs
==============================================================================
--- trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ColumnHeaderCellText.cs (original)
+++ trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ColumnHeaderCellText.cs Sun Feb 10 22:31:51 2008
@@ -36,7 +36,6 @@
{
public delegate Column DataHandler ();
- private Pango.Layout layout;
private DataHandler data_handler;
private bool has_sort;
Modified: trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
==============================================================================
--- trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs (original)
+++ trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs Sun Feb 10 22:31:51 2008
@@ -73,7 +73,6 @@
}
for (int i = 0; i < column_cache.Length; i++) {
- column_cache[i].Column.VisibilityChanged -= OnColumnVisibilityChanged;
column_cache[i] = CachedColumn.Zero;
}
@@ -98,7 +97,6 @@
column_cache[i] = new CachedColumn ();
column_cache[i].Column = column;
- column.VisibilityChanged += OnColumnVisibilityChanged;
column_cache[i].Width = (int)Math.Round (((double)list_alloc.Width * column.Width));
column_cache[i].X1 = i == 0 ? 0 : column_cache[i - 1].X2;
@@ -113,12 +111,6 @@
Array.Resize (ref column_cache, i);
}
- private void OnColumnVisibilityChanged (object o, EventArgs args)
- {
- RegenerateColumnCache ();
- QueueDraw ();
- }
-
protected virtual void OnColumnControllerUpdated ()
{
RegenerateColumnCache ();
@@ -130,24 +122,21 @@
Menu menu = new Menu ();
if (clickedColumn.Id != null) { // FIXME: Also restrict if the column vis can't be changed
- MenuItem hide_item = new MenuItem (String.Format (Catalog.GetString ("Hide {0}"), clickedColumn.Title));
- hide_item.Data.Add ("column", clickedColumn);
- hide_item.Data.Add ("hide", true);
- hide_item.Activated += OnColumnMenuItemActivated;
- menu.Append (hide_item);
+ menu.Append (new ColumnHideMenuItem (clickedColumn));
menu.Append (new SeparatorMenuItem ());
}
- foreach (Column column in ColumnController) {
+ Column [] columns = ColumnController.ToArray ();
+ Array.Sort (columns, delegate (Column a, Column b) {
+ return String.Compare (a.Title, b.Title);
+ });
+
+ foreach (Column column in columns) {
if (column.Id == null) {
continue;
}
- CheckMenuItem item = new CheckMenuItem (column.Title);
- item.Active = column.Visible;
- item.Data.Add ("column", column);
- item.Activated += OnColumnMenuItemActivated;
- menu.Append (item);
+ menu.Append (new ColumnToggleMenuItem (column));
}
menu.ShowAll ();
@@ -160,28 +149,6 @@
}, 3, Gtk.Global.CurrentEventTime);
}
- private void OnColumnMenuItemActivated (object o, EventArgs args)
- {
- MenuItem item = (MenuItem)o;
- CheckMenuItem toggle_item = item as CheckMenuItem;
- Column column = null;
-
- if (item.Data.Contains ("column")) {
- column = item.Data["column"] as Column;
- }
-
- if (column == null) {
- return;
- }
-
- if (item.Data.Contains ("hide")) {
- column.Visible = false;
- return;
- } else if (toggle_item != null) {
- column.Visible = toggle_item.Active;
- }
- }
-
private void ResizeColumn (double x)
{
CachedColumn resizing_column = column_cache[resizing_column_index];
@@ -329,5 +296,49 @@
#endregion
+#region Gtk.MenuItem Wrappers for the column context menu
+
+ private class ColumnToggleMenuItem : CheckMenuItem
+ {
+ private Column column;
+ private bool ready = false;
+
+ public ColumnToggleMenuItem (Column column) : base (column.Title)
+ {
+ this.column = column;
+ Active = column.Visible;
+ ready = true;
+ }
+
+ protected override void OnActivated ()
+ {
+ base.OnActivated ();
+
+ if (!ready) {
+ return;
+ }
+
+ column.Visible = Active;
+ }
+ }
+
+ private class ColumnHideMenuItem : MenuItem
+ {
+ private Column column;
+
+ public ColumnHideMenuItem (Column column)
+ : base (String.Format (Catalog.GetString ("Hide {0}"), column.Title))
+ {
+ this.column = column;
+ }
+
+ protected override void OnActivated ()
+ {
+ column.Visible = false;
+ }
+ }
+
+#endregion
+
}
}
Modified: trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
==============================================================================
--- trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs (original)
+++ trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs Sun Feb 10 22:31:51 2008
@@ -350,7 +350,6 @@
header_window.Cursor = drag_cursor;
Column swap_column = GetColumnAt ((int)evnt.X);
- bool x_drag_updated = false;
if (swap_column != null) {
CachedColumn swap_column_c = GetCachedColumnForColumn (swap_column);
Modified: trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ObjectListView.cs
==============================================================================
--- trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ObjectListView.cs (original)
+++ trunk/banshee/src/Core/Hyena.Gui/Hyena.Data.Gui/ObjectListView.cs Sun Feb 10 22:31:51 2008
@@ -31,9 +31,7 @@
namespace Hyena.Data.Gui
{
public class ObjectListView : ListView<object>
- {
- private ColumnController column_controller;
-
+ {
public ObjectListView () : base ()
{
ColumnController = new ColumnController();
Modified: trunk/banshee/src/Core/Hyena.Gui/Hyena.Query.Gui/QueryTermBox.cs
==============================================================================
--- trunk/banshee/src/Core/Hyena.Gui/Hyena.Query.Gui/QueryTermBox.cs (original)
+++ trunk/banshee/src/Core/Hyena.Gui/Hyena.Query.Gui/QueryTermBox.cs Sun Feb 10 22:31:51 2008
@@ -53,7 +53,7 @@
private Operator op;
private QueryField [] sorted_fields;
- private Operator [] operators;
+ //private Operator [] operators; FIXME: not used --Aaron
public QueryTermBox (QueryFieldSet fieldSet) : base ()
{
Modified: trunk/banshee/src/Core/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs
==============================================================================
--- trunk/banshee/src/Core/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs (original)
+++ trunk/banshee/src/Core/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs Sun Feb 10 22:31:51 2008
@@ -45,7 +45,7 @@
private string reload_sql;
private int uid;
private int rows;
- private bool warm;
+ // private bool warm;
private int first_order_id;
public delegate void AggregatesUpdatedEventHandler (IDataReader reader);
@@ -207,7 +207,7 @@
));
} else {
//Console.WriteLine ("Found existing cache for {0}: {1}", id, uid);
- warm = true;
+ //warm = true;
Clear ();
UpdateAggregates ();
}
Modified: trunk/banshee/src/Core/Hyena/Hyena.Query/XmlQueryParser.cs
==============================================================================
--- trunk/banshee/src/Core/Hyena/Hyena.Query/XmlQueryParser.cs (original)
+++ trunk/banshee/src/Core/Hyena/Hyena.Query/XmlQueryParser.cs Sun Feb 10 22:31:51 2008
@@ -66,7 +66,7 @@
QueryNode node = Parse (query.FirstChild as XmlElement, null);
return (node != null) ? node.Trim () : null;
- } catch (Exception e) {
+ } catch (Exception) {
}
return null;
}
Modified: trunk/banshee/src/Core/Hyena/Hyena.SExpEngine/ListFunctionSet.cs
==============================================================================
--- trunk/banshee/src/Core/Hyena/Hyena.SExpEngine/ListFunctionSet.cs (original)
+++ trunk/banshee/src/Core/Hyena/Hyena.SExpEngine/ListFunctionSet.cs Sun Feb 10 22:31:51 2008
@@ -32,16 +32,18 @@
{
public class ListFunctionSet : FunctionSet
{
- private TreeNode EvaluateList(TreeNode node)
- {
- TreeNode list = new TreeNode();
-
- foreach(TreeNode child in node.Children) {
- list.AddChild(Evaluate(child));
- }
-
- return list;
- }
+ // FIXME: Why is this here? --Aaron
+ //
+ // private TreeNode EvaluateList(TreeNode node)
+ // {
+ // TreeNode list = new TreeNode();
+ //
+ // foreach(TreeNode child in node.Children) {
+ // list.AddChild(Evaluate(child));
+ // }
+ //
+ // return list;
+ // }
private bool IsList(TreeNode node)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]