[gtk+/gtk-2-18] Add/Remove ATK_STATE_SENSITIVE according to cells' state.



commit f687aafe58a3077d91f73907c09ecdff0c1e8454
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Fri Mar 5 14:48:23 2010 +0800

    Add/Remove ATK_STATE_SENSITIVE according to cells' state.
    
    Bug #569042.
    (cherry picked from commit 4759da26348fd1063e2da2e8f85d7a7fa7b41acd)

 modules/other/gail/gailbooleancell.c |   19 ++++++++++++++++++-
 modules/other/gail/gailbooleancell.h |    1 +
 2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/modules/other/gail/gailbooleancell.c b/modules/other/gail/gailbooleancell.c
index 3e9f834..5c86d04 100644
--- a/modules/other/gail/gailbooleancell.c
+++ b/modules/other/gail/gailbooleancell.c
@@ -32,6 +32,7 @@ static gboolean gail_boolean_cell_update_cache         (GailRendererCell     *ce
 gchar *gail_boolean_cell_property_list[] = {
   "active",
   "radio",
+  "sensitive",
   NULL
 };
 
@@ -73,6 +74,7 @@ gail_boolean_cell_new (void)
   cell->renderer = gtk_cell_renderer_toggle_new ();
   g_object_ref_sink (cell->renderer);
   boolean_cell->cell_value = FALSE;
+  boolean_cell->cell_sensitive = TRUE;
   return atk_object;
 }
 
@@ -83,8 +85,10 @@ gail_boolean_cell_update_cache (GailRendererCell *cell,
   GailBooleanCell *boolean_cell = GAIL_BOOLEAN_CELL (cell);
   gboolean rv = FALSE;
   gboolean new_boolean;
+  gboolean new_sensitive;
 
-  g_object_get (G_OBJECT(cell->renderer), "active", &new_boolean, NULL);
+  g_object_get (G_OBJECT(cell->renderer), "active", &new_boolean,
+                                          "sensitive", &new_sensitive, NULL);
 
   if (boolean_cell->cell_value != new_boolean)
     {
@@ -99,5 +103,18 @@ gail_boolean_cell_update_cache (GailRendererCell *cell,
       gail_cell_remove_state (GAIL_CELL (cell), ATK_STATE_CHECKED, emit_change_signal);
     }
 
+  if (boolean_cell->cell_sensitive != new_sensitive)
+    {
+      rv = TRUE;
+      boolean_cell->cell_sensitive = !(boolean_cell->cell_sensitive);
+
+      /* Update cell's state */
+
+      if (new_sensitive)
+        gail_cell_add_state (GAIL_CELL (cell), ATK_STATE_SENSITIVE, emit_change_signal);
+      else
+        gail_cell_remove_state (GAIL_CELL (cell), ATK_STATE_SENSITIVE, emit_change_signal);
+    }
+
   return rv;
 }
diff --git a/modules/other/gail/gailbooleancell.h b/modules/other/gail/gailbooleancell.h
index ac803cf..f888b1d 100644
--- a/modules/other/gail/gailbooleancell.h
+++ b/modules/other/gail/gailbooleancell.h
@@ -39,6 +39,7 @@ struct _GailBooleanCell
 {
   GailRendererCell parent;
   gboolean cell_value;
+  gboolean cell_sensitive;
 };
 
  GType gail_boolean_cell_get_type (void);



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