[gtk+] listbox: handle row sensitivity



commit ceda38ee4e6dba3f41194d0dd439fcef4863a7aa
Author: Kalev Lember <kalevlember gmail com>
Date:   Mon Jul 29 11:23:58 2013 +0200

    listbox: handle row sensitivity
    
    When a row is insensitive, don't emit button press events and avoid
    prelighting it.

 gtk/gtklistbox.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index 4842108..21fb7c5 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -1089,11 +1089,19 @@ gtk_list_box_update_prelight (GtkListBox    *list_box,
       if (priv->prelight_row)
         gtk_widget_unset_state_flags (GTK_WIDGET (priv->prelight_row),
                                       GTK_STATE_FLAG_PRELIGHT);
-      priv->prelight_row = row;
-      if (priv->prelight_row)
-        gtk_widget_set_state_flags (GTK_WIDGET (priv->prelight_row),
-                                    GTK_STATE_FLAG_PRELIGHT,
-                                    FALSE);
+
+      if (row != NULL && gtk_widget_is_sensitive (GTK_WIDGET (row)))
+        {
+          priv->prelight_row = row;
+          gtk_widget_set_state_flags (GTK_WIDGET (priv->prelight_row),
+                                      GTK_STATE_FLAG_PRELIGHT,
+                                      FALSE);
+        }
+      else
+        {
+          priv->prelight_row = NULL;
+        }
+
       gtk_widget_queue_draw (GTK_WIDGET (list_box));
     }
 }
@@ -1228,7 +1236,7 @@ gtk_list_box_real_button_press_event (GtkWidget      *widget,
         }
 
       row = gtk_list_box_get_row_at_y (list_box, y);
-      if (row != NULL)
+      if (row != NULL && gtk_widget_is_sensitive (GTK_WIDGET (row)))
         {
           if (event->type == GDK_2BUTTON_PRESS)
             {


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