]> Pileus Git - ~andy/gtk/commitdiff
gtk: gtk_cell_renderer_get_state(): a row can be both selected and insensitive
authorMichael Natterer <mitch@gimp.org>
Sun, 6 Feb 2011 13:43:55 +0000 (14:43 +0100)
committerMichael Natterer <mitch@gimp.org>
Sun, 6 Feb 2011 13:45:49 +0000 (14:45 +0100)
so pull the SELECTED state flag out of the !sensitive branch. Also,
don't make FOCUSED depend on SELECTED here, it's up to the widget to
decide whether or not that is possible.

gtk/gtkcellrenderer.c

index 2ecdaf041483ff0e3108db1056e4c725d579937f..b0f793768bfd8a5fa7be2d46d3beca281bee53bb 100644 (file)
@@ -1703,21 +1703,21 @@ gtk_cell_renderer_get_state (GtkCellRenderer      *cell,
   if ((widget && !gtk_widget_get_sensitive (widget)) ||
       (cell && !gtk_cell_renderer_get_sensitive (cell)) ||
       (cell_state & GTK_CELL_RENDERER_INSENSITIVE) != 0)
-    state |= GTK_STATE_FLAG_INSENSITIVE;
+    {
+      state |= GTK_STATE_FLAG_INSENSITIVE;
+    }
   else
     {
-      if ((cell_state & GTK_CELL_RENDERER_SELECTED) != 0)
-        {
-          state |= GTK_STATE_FLAG_SELECTED;
-
-          if ((widget && gtk_widget_has_focus (widget)) &&
-              (cell_state & GTK_CELL_RENDERER_FOCUSED) != 0)
-            state |= GTK_STATE_FLAG_FOCUSED;
-        }
+      if ((widget && gtk_widget_has_focus (widget)) &&
+          (cell_state & GTK_CELL_RENDERER_FOCUSED) != 0)
+        state |= GTK_STATE_FLAG_FOCUSED;
 
       if ((cell_state & GTK_CELL_RENDERER_PRELIT) != 0)
         state |= GTK_STATE_FLAG_PRELIGHT;
     }
 
+  if ((cell_state & GTK_CELL_RENDERER_SELECTED) != 0)
+    state |= GTK_STATE_FLAG_SELECTED;
+
   return state;
 }