[g-a-devel]AtkHypertext and at-poke



I have added code to at-poke to examine objects which implement AtkHypertext 
interface.

Suggestions for improvements welcome.

OK to commit?

Padraig
cvs server: Diffing .
cvs server: Diffing glade
Index: glade/at-poke.glade2
===================================================================
RCS file: /cvs/gnome/at-poke/glade/at-poke.glade2,v
retrieving revision 1.13
diff -u -p -r1.13 at-poke.glade2
--- glade/at-poke.glade2	24 Jul 2002 07:11:13 -0000	1.13
+++ glade/at-poke.glade2	11 Oct 2002 16:18:02 -0000
@@ -2389,6 +2389,55 @@
 	      </child>
 
 	      <child>
+		<widget class="GtkFrame" id="poker_hypertext_frame">
+		  <property name="visible">True</property>
+		  <property name="label_xalign">0</property>
+		  <property name="label_yalign">0.5</property>
+		  <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+
+		  <child>
+		    <widget class="GtkVBox" id="vbox3">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">0</property>
+
+		      <child>
+			<widget class="GtkScrolledWindow" id="scrolledwindow8">
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+			  <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+			  <property name="shadow_type">GTK_SHADOW_NONE</property>
+			  <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+			  <child>
+			    <widget class="GtkTreeView" id="hypertext_if_links">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="headers_visible">True</property>
+			      <property name="rules_hint">False</property>
+			      <property name="reorderable">False</property>
+			      <property name="enable_search">True</property>
+			    </widget>
+			  </child>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">True</property>
+			  <property name="fill">True</property>
+			</packing>
+		      </child>
+		    </widget>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">2</property>
+		  <property name="expand">True</property>
+		  <property name="fill">True</property>
+		</packing>
+	      </child>
+
+	      <child>
 		<widget class="GtkHButtonBox" id="hbuttonbox1">
 		  <property name="visible">True</property>
 		  <property name="layout_style">GTK_BUTTONBOX_END</property>
cvs server: Diffing icons
cvs server: Diffing src
Index: src/poke.c
===================================================================
RCS file: /cvs/gnome/at-poke/src/poke.c,v
retrieving revision 1.26
diff -u -p -r1.26 poke.c
--- src/poke.c	9 Oct 2002 09:20:24 -0000	1.26
+++ src/poke.c	11 Oct 2002 16:18:02 -0000
@@ -14,7 +14,6 @@
  *    + add 'getAccessibleAtPoint' on
  *      toplevel whatnot - if possible
  *    + Text selection view
- *    + AccessibleHypertext
  *    + AccessibleHyperlink
  *    + editable text
  *    + sync text caret spinbutton with text entry field, and changes to
@@ -84,6 +83,9 @@ typedef struct {
 	gulong        update_id;
 	gulong        text_update_id;
 
+	GtkListStore *hypertext_store;
+	GtkTreeView  *hypertext_view;
+
 	Accessible   *selected;
 
 	AccessibleCoordType ctype;
@@ -869,6 +871,30 @@ selection_all_clicked_cb (GtkButton *but
 	AccessibleSelection_unref (selection);
 }
 
+static void
+update_if_hypertext (Poker *poker, AccessibleHypertext *hypertext)
+{
+	long i;
+	long num_links;
+	GtkTreeIter iter;
+
+	num_links = AccessibleHypertext_getNLinks (hypertext);
+	gtk_list_store_clear (poker->hypertext_store);
+
+	for (i = 0; i < num_links; i++) {
+		AccessibleHyperlink *link;
+		long n_anchors;
+
+		link = AccessibleHypertext_getLink (hypertext, i);
+		n_anchors = AccessibleHyperlink_getNAnchors (link);
+		Accessible_unref (link);
+		gtk_list_store_append (poker->hypertext_store, &iter);	
+		gtk_list_store_set (poker->hypertext_store, &iter,
+				    0, i,
+                                    1, n_anchors,
+                                    -1);
+	}
+}
 
 static const struct {
 	const char *widget_name;
@@ -886,6 +912,7 @@ static const struct {
 	{ "poker_table_frame",         "IDL:Accessibility/Table:1.0",        update_if_table },
 	{ "poker_image_frame",         "IDL:Accessibility/Image:1.0",        update_if_image },
 	{ "poker_selection_frame",     "IDL:Accessibility/Selection:1.0",    update_if_selection },
+	{ "poker_hypertext_frame",     "IDL:Accessibility/Hypertext:1.0",    update_if_hypertext },
 	{ NULL, NULL, NULL }
 };
 
@@ -1345,6 +1372,28 @@ poke (Accessible *accessible)
 		g_signal_connect (
 			glade_xml_get_widget (poker->xml, "selection_if_all"),
 			"clicked", G_CALLBACK (selection_all_clicked_cb), poker);
+	}
+
+	{ /* hypertext interface */
+		poker->hypertext_store = gtk_list_store_new (
+			2, G_TYPE_INT, G_TYPE_INT);
+
+		widget = glade_xml_get_widget (
+			poker->xml, "hypertext_if_links");
+		poker->selection_view = GTK_TREE_VIEW (widget); 
+
+		gtk_tree_view_set_model (GTK_TREE_VIEW (widget),
+					 GTK_TREE_MODEL (poker->hypertext_store));
+		gtk_tree_view_insert_column_with_attributes (
+			GTK_TREE_VIEW (widget), 0, "Link",
+			gtk_cell_renderer_text_new (), "text",
+			0, NULL);
+
+		gtk_tree_view_insert_column_with_attributes (
+			GTK_TREE_VIEW (widget), 1, "Anchors",
+			gtk_cell_renderer_text_new (), "text",
+			1, NULL);
+
 	}
 
 	{ /* main frame buttons */


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