banshee r3252 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView src/Libraries/Lastfm/Lastfm



Author: abock
Date: Sun Feb 17 02:26:08 2008
New Revision: 3252
URL: http://svn.gnome.org/viewvc/banshee?rev=3252&view=rev

Log:
2008-02-16  Aaron Bockover  <abock gnome org>

    * src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs:
    Set RowSensitivePropertyName to 'CanPlay'

    * src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs:
    * src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs:
    * src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs:
    Added a RowSensitivePropertyName property, defaulting to 'Sensitive';
    objects in the model will be queried for this property to indicate whether
    the object is sensitive (enabled) or not; render the row's sensitivity

    * src/Libraries/Lastfm/Lastfm/Connection.cs: Clear the password if invalid



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
   trunk/banshee/src/Libraries/Lastfm/Lastfm/Connection.cs

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs	Sun Feb 17 02:26:08 2008
@@ -69,6 +69,7 @@
             
             ColumnController = DefaultColumnController;
             RulesHint = true;
+            RowSensitivePropertyName = "CanPlay";
             
             ServiceManager.PlayerEngine.StateChanged += OnPlayerEngineStateChanged;
             

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs	Sun Feb 17 02:26:08 2008
@@ -84,16 +84,16 @@
                 // is not selected, select it and don't move the focus or vadjustment.
                 // Otherwise, select the new row and scroll etc as necessary.
                 if ((relative_row * relative_row != 1)) {
-                    Selection.SelectFromFirst(row_index, true);
+                    Selection.SelectFromFirst (row_index, true);
                 } else if (Selection.Contains (focused_row_index)) {
-                    Selection.SelectFromFirst(row_index, true);
+                    Selection.SelectFromFirst (row_index, true);
                 } else {
-                    Selection.Select(focused_row_index);
+                    Selection.Select (focused_row_index);
                     return true;
                 }
             } else {
-                Selection.Clear(false);
-                Selection.Select(row_index);
+                Selection.Clear (false);
+                Selection.Select (row_index);
             }
 
             // Scroll if needed

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs	Sun Feb 17 02:26:08 2008
@@ -27,6 +27,8 @@
 //
 
 using System;
+using System.Reflection;
+
 using Gtk;
 
 namespace Hyena.Data.Gui
@@ -108,5 +110,47 @@
         public virtual IListModel<T> Model {
             get { return model; }
         }
+        
+        private string row_sensitive_property_name = "Sensitive";
+        private PropertyInfo row_sensitive_property_info;
+        bool row_sensitive_property_invalid = false;
+        
+        public string RowSensitivePropertyName {
+            get { return row_sensitive_property_name; }
+            set { 
+                if (value == row_sensitive_property_name) {
+                    return;
+                }
+                
+                row_sensitive_property_name = value;
+                row_sensitive_property_info = null;
+                row_sensitive_property_invalid = false;
+                
+                InvalidateListWindow ();
+            }
+        }
+        
+        private bool IsRowSensitive (object item)
+        {
+            if (item == null || row_sensitive_property_invalid) {
+                return true;
+            }
+         
+            if (row_sensitive_property_info == null || row_sensitive_property_info.ReflectedType != item.GetType ()) {
+                row_sensitive_property_info = item.GetType ().GetProperty (row_sensitive_property_name);
+                if (row_sensitive_property_info == null || row_sensitive_property_info.PropertyType != typeof (bool)) {
+                    row_sensitive_property_info = null;
+                    row_sensitive_property_invalid = true;
+                    return true;
+                }
+            }
+            
+            return (bool)row_sensitive_property_info.GetValue (item, null);
+        }
+        
+        private bool IsRowSensitive (int index)
+        {
+            return IsRowSensitive (model[index]);
+        }
     }
 }

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs	Sun Feb 17 02:26:08 2008
@@ -274,6 +274,7 @@
             }
             
             object item = model[row_index];
+            bool sensitive = IsRowSensitive (item);
             
             Gdk.Rectangle cell_area = new Gdk.Rectangle ();
             cell_area.Height = RowHeight;
@@ -286,7 +287,7 @@
                 
                 cell_area.Width = column_cache[ci].Width;
                 cell_area.X = column_cache[ci].X1;
-                PaintCell (item, ci, row_index, cell_area, cell_area, state, false);
+                PaintCell (item, ci, row_index, cell_area, cell_area, sensitive ? state : StateType.Insensitive, false);
             }
             
             if (pressed_column_is_dragging && pressed_column_index >= 0) {   

Modified: trunk/banshee/src/Libraries/Lastfm/Lastfm/Connection.cs
==============================================================================
--- trunk/banshee/src/Libraries/Lastfm/Lastfm/Connection.cs	(original)
+++ trunk/banshee/src/Libraries/Lastfm/Lastfm/Connection.cs	Sun Feb 17 02:26:08 2008
@@ -311,6 +311,7 @@
                             Catalog.GetString ("Either your username or password is invalid."),
                             false
                         );
+                        account.CryptedPassword = null;
 						return false;
 					}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]