property browser a11y & consistancy issue ...



Hi there,

	I'd like to commit the attached patch to make the property browsers'
radio-buttons look like this:

	http://primates.ximian.com/~michael/foo-props.png

	Since - that's how it behaves, and not using a radio-button means we
have to re-write the RadioButton accessibility code, which is not
altogether fun.

	However - since I guess the 'custom' look is much loved, I'll try and
do the painful relation stuff manually as well, so that we can have it
working soon.

	Regards,

		Michael.

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.5412
diff -u -p -u -r1.5412 ChangeLog
--- ChangeLog	5 Jul 2002 20:58:42 -0000	1.5412
+++ ChangeLog	8 Jul 2002 11:48:39 -0000
@@ -1,3 +1,15 @@
+2002-07-08  Michael Meeks  <michael ximian com>
+
+	* src/nautilus-property-browser.c
+	(nautilus_property_browser_init): re-instate label
+	boldness for Alex.
+	(property_browser_category_button_new): use new eel's
+	labeled radio button, so we get a11y right.
+	(nautilus_property_browser_update_contents): pass group.
+	(make_category_link): do grouping.
+	(category_clicked_callback): kill horrid DIY radio-button
+	mess.
+
 2002-07-05  Dave Camp  <dave ximian com>
 
 	* src/nautilus-sidebar.c (nautilus_sidebar_create_context_menu):
Index: src/nautilus-property-browser.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-property-browser.c,v
retrieving revision 1.187
diff -u -p -u -r1.187 nautilus-property-browser.c
--- src/nautilus-property-browser.c	2 Jul 2002 16:07:26 -0000	1.187
+++ src/nautilus-property-browser.c	8 Jul 2002 11:48:41 -0000
@@ -64,6 +64,7 @@
 #include <gtk/gtkstock.h>
 #include <gtk/gtktable.h>
 #include <gtk/gtktogglebutton.h>
+#include <gtk/gtkradiobutton.h>
 #include <gtk/gtkvbox.h>
 #include <gtk/gtkviewport.h>
 #include <libgnome/gnome-i18n.h>
@@ -340,7 +341,7 @@ nautilus_property_browser_init (GtkObjec
 	/* add the title label */
 	property_browser->details->title_label = gtk_label_new ("");
 	eel_gtk_label_set_scale (GTK_LABEL (property_browser->details->title_label), PANGO_SCALE_X_LARGE);
-/*	eel_gtk_label_make_bold (GTK_LABEL (property_browser->details->title_label)); */
+	eel_gtk_label_make_bold (GTK_LABEL (property_browser->details->title_label));
  	
 	gtk_widget_show(property_browser->details->title_label);
 	gtk_box_pack_start (GTK_BOX(temp_hbox), property_browser->details->title_label, FALSE, FALSE, 8);
@@ -779,29 +780,17 @@ make_color_drag_image (NautilusPropertyB
 static void
 category_clicked_callback (GtkWidget *widget, char *category_name)
 {
-	gboolean save_flag;
 	NautilusPropertyBrowser *property_browser;
 	
-	property_browser = NAUTILUS_PROPERTY_BROWSER (g_object_get_data (G_OBJECT (widget), "user_data"));
-	
-	/* special case the user clicking on the already selected button, since we don't want that to toggle */
-	if (widget == GTK_WIDGET(property_browser->details->selected_button)) {
-		if (!property_browser->details->toggle_button_flag)
-			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (property_browser->details->selected_button), TRUE);		
-		return;
-	}	
+	property_browser = NAUTILUS_PROPERTY_BROWSER
+		(g_object_get_data (G_OBJECT (widget), "user_data"));
 
-	/* exit remove mode when the user switches categories, since there might be nothing to remove
-	   in the new category */
+	/* exit remove mode when the user switches categories, since there might
+	 * be nothing to remove in the new category
+	 */
 	property_browser->details->remove_mode = FALSE;
-		
-	save_flag = property_browser->details->toggle_button_flag;
-	property_browser->details->toggle_button_flag = TRUE;	
-	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (property_browser->details->selected_button), FALSE);
-	property_browser->details->toggle_button_flag = save_flag;	
-	
+
 	nautilus_property_browser_set_category (property_browser, category_name);
-	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
 	property_browser->details->selected_button = widget;
 }
 
@@ -1913,7 +1902,7 @@ property_browser_category_button_new (co
 	file_name = nautilus_pixmap_file (image); 
 	g_return_val_if_fail (file_name != NULL, NULL);
 
-	button = eel_labeled_image_toggle_button_new_from_file_name (display_name, file_name);
+	button = eel_labeled_image_radio_button_new_from_file_name (display_name, file_name);
 
 	/* We also want all of the buttons to be the same height */
 	eel_labeled_image_set_fixed_image_height (EEL_LABELED_IMAGE (GTK_BIN (button)->child), STANDARD_BUTTON_IMAGE_HEIGHT);
@@ -1928,7 +1917,8 @@ static void
 make_category_link (NautilusPropertyBrowser *property_browser,
 		    const char *name,
 		    const char *display_name,
-		    const char *image)
+		    const char *image,
+		    GtkRadioButton **group)
 {
 	GtkWidget *button;
 
@@ -1939,10 +1929,18 @@ make_category_link (NautilusPropertyBrow
 
 	button = property_browser_category_button_new (display_name, image);
 	gtk_widget_show (button);
+
+	if (*group) {
+		gtk_radio_button_set_group (GTK_RADIO_BUTTON (button),
+					    gtk_radio_button_get_group (*group));
+	} else {
+		*group = GTK_RADIO_BUTTON (button);
+	}
 	
 	/* if the button represents the current category, highlight it */	
 	if (property_browser->details->category &&
 	    strcmp (property_browser->details->category, name) == 0) {
+		
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
 		property_browser->details->selected_button = button;		
 	}
@@ -1969,6 +1967,7 @@ nautilus_property_browser_update_content
  	xmlDocPtr document;
  	EelBackground *background;
 	GtkWidget *viewport;
+	GtkRadioButton *group;
 	gboolean got_categories;
 	char *name, *image, *type, *description, *display_name, *path, *mode;
 	const char *text;
@@ -2016,7 +2015,8 @@ nautilus_property_browser_update_content
 	if (!got_categories) {
 		property_browser->details->category_position = 0;
 	}
-	
+
+	group = NULL;
 	for (cur_node = eel_xml_get_children (xmlDocGetRootElement (document));
 	     cur_node != NULL;
 	     cur_node = cur_node->next) {
@@ -2055,7 +2055,8 @@ nautilus_property_browser_update_content
 				make_category_link (property_browser,
 						    name,
 						    display_name,
-						    image);
+						    image,
+						    &group);
 				
 				xmlFree (display_name);
 				xmlFree (image);
-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot




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