[banshee/a11y] [a11y] Add --enable-custom-widget-a11y build flag



commit ce20689ee963c0821240ff2588125efec9d357b2
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Sat Nov 7 13:50:43 2009 -0800

    [a11y] Add --enable-custom-widget-a11y build flag
    
    Pass this if you have a fixed Atk# (that is, gtk-sharp 2.12 from trunk
    plus the patch to BNC #512477) and want to build the accessibility
    support we've implemented for our custom widgets (ListView and
    RatingEntry).

 build/build.rules.mk                               |    6 +++++-
 configure.ac                                       |    6 ++++++
 .../Accessibility/ListViewAccessible_Table.cs      |    4 +++-
 .../Hyena.Data.Gui/ListView/ListView_Accessible.cs |    4 ++++
 .../Hyena.Gui/Hyena.Widgets/RatingEntry.cs         |    4 ++++
 5 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/build/build.rules.mk b/build/build.rules.mk
index baaffc4..d429751 100644
--- a/build/build.rules.mk
+++ b/build/build.rules.mk
@@ -22,6 +22,10 @@ if ENABLE_TESTS
     ENABLE_TESTS_FLAG = "-define:ENABLE_TESTS"
 endif
 
+if ENABLE_ATK
+    ENABLE_ATK_FLAG = "-define:ENABLE_ATK"
+endif
+
 FILTERED_LINK = $(shell echo "$(LINK)" | $(UNIQUE_FILTER_PIPE))
 DEP_LINK = $(shell echo "$(LINK)" | $(UNIQUE_FILTER_PIPE) | sed s,-r:,,g | grep '$(top_builddir)/bin/')
 
@@ -56,7 +60,7 @@ $(ASSEMBLY_FILE): $(SOURCES_BUILD) $(RESOURCES_EXPANDED) $(DEP_LINK)
 		-nowarn:0278 -nowarn:0078 $$warn \
 		-define:HAVE_GTK_2_10 -define:NET_2_0 \
 		-debug -target:$(TARGET) -out:$@ \
-		$(BUILD_DEFINES) $(ENABLE_TESTS_FLAG) \
+		$(BUILD_DEFINES) $(ENABLE_TESTS_FLAG) $(ENABLE_ATK_FLAG) \
 		$(FILTERED_LINK) $(RESOURCES_BUILD) $(SOURCES_BUILD)
 	@if [ -e $(srcdir)/$(notdir $  config) ]; then \
 		cp $(srcdir)/$(notdir $  config) $(top_builddir)/bin; \
diff --git a/configure.ac b/configure.ac
index 7458282..36b8f00 100644
--- a/configure.ac
+++ b/configure.ac
@@ -127,6 +127,11 @@ else
 	AM_CONDITIONAL(ENABLE_GNOME, false)
 fi
 
+AC_ARG_ENABLE(custom-widget-a11y, 
+	AC_HELP_STRING([--enable-custom-widget-a11y], [Enable custom widget accessibility]), 
+	enable_atk="yes", enable_atk="no")
+AM_CONDITIONAL(ENABLE_ATK, test "x$enable_atk" = "xyes")
+
 dnl DAP support (each module is optional)
 BANSHEE_CHECK_DAP_MTP
 BANSHEE_CHECK_DAP_IPOD
@@ -324,6 +329,7 @@ ${PACKAGE}-${VERSION}
 
   Build/Development:
     Unit Tests:        ${do_tests} (requires nunit >= ${NUNIT_REQUIRED})
+    Custom a11y:       ${enable_atk} (requires gtk-sharp 2.12 from svn with patch from BNC 512477)
     Release Build:     ${enable_release}
     Vendor Build ID:   ${vendor_build_id}
 
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ListViewAccessible_Table.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ListViewAccessible_Table.cs
index add3d56..abfb6c9 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ListViewAccessible_Table.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ListViewAccessible_Table.cs
@@ -125,7 +125,7 @@ namespace Hyena.Data.Gui.Accessibility
         }
 
 // Ensure https://bugzilla.novell.com/show_bug.cgi?id=512477 is fixed
-#if ATK_TABLE_OK
+#if ENABLE_ATK
         private static readonly int [] empty_int_array = new int[0];
         public int [] SelectedColumns {
             get { return empty_int_array; }
@@ -135,6 +135,8 @@ namespace Hyena.Data.Gui.Accessibility
             get { return list_view.Selection.ToArray (); }
         }
 #else
+        public int GetSelectedRows (out int row) { row = 0; return 0; }
+        public int GetSelectedColumns (out int cols) { cols = 0; return 0; }
 #endif
 
         public bool IsColumnSelected (int column)
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Accessible.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Accessible.cs
index 14040cf..e415762 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Accessible.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Accessible.cs
@@ -42,7 +42,9 @@ namespace Hyena.Data.Gui
     {
         static ListView ()
         {
+#if ENABLE_ATK
             ListViewAccessibleFactory<T>.Init ();
+#endif
         }
 
         public Gdk.Rectangle GetColumnCellExtents (int row, int column)
@@ -149,6 +151,7 @@ namespace Hyena.Data.Gui
 
     }
 
+#if ENABLE_ATK
     internal class ListViewAccessibleFactory<T> : Atk.ObjectFactory
     {
         public static void Init ()
@@ -167,4 +170,5 @@ namespace Hyena.Data.Gui
             return ListViewAccessible<T>.GType;
         }
     }
+#endif
 }
diff --git a/src/Libraries/Hyena.Gui/Hyena.Widgets/RatingEntry.cs b/src/Libraries/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
index 19876d9..f36df2f 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
@@ -49,7 +49,9 @@ namespace Hyena.Widgets
 
         static RatingEntry ()
         {
+#if ENABLE_ATK
             RatingAccessibleFactory.Init ();
+#endif
         }
         
         public RatingEntry () : this (0) 
@@ -435,6 +437,7 @@ namespace Hyena.Widgets
         }
     }
 
+#if ENABLE_ATK
     internal class RatingAccessibleFactory : Atk.ObjectFactory
     {
         public static void Init ()
@@ -453,6 +456,7 @@ namespace Hyena.Widgets
             return RatingAccessible.GType;
         }
     }
+#endif
 
     [Hyena.Gui.TestModule ("Rating Entry")]
     internal class RatingEntryTestModule : Gtk.Window



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