Author: gburt
Date: Mon Feb 18 00:41:32 2008
New Revision: 3262
URL: http://svn.gnome.org/viewvc/banshee?rev=3262&view=rev

Log:
2008-02-17  Gabriel Burt  <[EMAIL PROTECTED]>

        * 
src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs:
        Avoid hitting the model/database when clicking where there is no row.


Modified:
   trunk/banshee/ChangeLog
   
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs

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
       Mon Feb 18 00:41:32 2008
@@ -233,12 +233,16 @@
             GrabFocus ();
             
             int row_index = GetRowAtY ((int)press.Y);
+
+            if (row_index >= Model.Count) {
+                return true;
+            }
             
             if (press.Button == 1 && press.Type != 
Gdk.EventType.TwoButtonPress && 
                 (press.State & Gdk.ModifierType.ControlMask) == 0 && 
Selection.Contains (row_index)) {
                 return true;
             }
-            
+
             object item = model[row_index];
             if (item == null) {
                 return true;
@@ -320,6 +324,11 @@
                 GrabFocus ();
                 
                 int row_index = GetRowAtY ((int)evnt.Y);
+
+                if (row_index >= Model.Count) {
+                    return true;
+                }
+
                 object item = model[row_index];
                 if (item == null) {
                     return true;
@@ -412,7 +421,7 @@
             }
         }
         
-        private int GetRowAtY (int y)
+        protected int GetRowAtY (int y)
         {
             int page_offset = (int)vadjustment.Value % RowHeight;
             int first_row = (int)vadjustment.Value / RowHeight;
@@ -421,7 +430,7 @@
             return first_row + row_offset;
         }
 
-        private double GetYAtRow (int row)
+        protected double GetYAtRow (int row)
         {
             double y = (double) RowHeight * row;
             return y;
_______________________________________________
SVN-commits-list mailing list (read only)
http://mail.gnome.org/mailman/listinfo/svn-commits-list

Want to limit the commits to a few modules? Go to above URL, log in to edit 
your options and select the modules ('topics') you want.
Module maintainer? It is possible to set the reply-to to your development 
mailing list. Email [EMAIL PROTECTED] if interested.

Reply via email to