Author: benny Date: 2006-08-29 17:13:38 +0000 (Tue, 29 Aug 2006) New Revision: 22937
Modified: thunar/trunk/ChangeLog thunar/trunk/thunar/thunar-column-editor.c thunar/trunk/thunar/thunar-create-dialog.c thunar/trunk/thunar/thunar-gtk-extensions.c thunar/trunk/thunar/thunar-gtk-extensions.h thunar/trunk/thunar/thunar-location-dialog.c thunar/trunk/thunar/thunar-permissions-chooser.c thunar/trunk/thunar/thunar-preferences-dialog.c Log: 2006-08-29 Benedikt Meurer <[EMAIL PROTECTED]> * thunar/thunar-column-editor.c, thunar/thunar-preferences-dialog.c, thunar/thunar-gtk-extensions.{c,h}, thunar/thunar-location-dialog.c, thunar/thunar-permissions-chooser.c, thunar/thunar-create-dialog.c: Add helper function thunar_gtk_label_set_a11y_relation(), which sets up the ATK_RELATION_LABEL_FOR for a label and a widget, so we don't need to repeat the same code over and over again. Modified: thunar/trunk/ChangeLog =================================================================== --- thunar/trunk/ChangeLog 2006-08-29 15:53:32 UTC (rev 22936) +++ thunar/trunk/ChangeLog 2006-08-29 17:13:38 UTC (rev 22937) @@ -1,5 +1,14 @@ 2006-08-29 Benedikt Meurer <[EMAIL PROTECTED]> + * thunar/thunar-column-editor.c, thunar/thunar-preferences-dialog.c, + thunar/thunar-gtk-extensions.{c,h}, thunar/thunar-location-dialog.c, + thunar/thunar-permissions-chooser.c, thunar/thunar-create-dialog.c: + Add helper function thunar_gtk_label_set_a11y_relation(), which sets + up the ATK_RELATION_LABEL_FOR for a label and a widget, so we don't + need to repeat the same code over and over again. + +2006-08-29 Benedikt Meurer <[EMAIL PROTECTED]> + * thunar/thunar-file.{c,h}, thunar/thunar-location-button.c, thunar/thunar-shortcuts-model.c: Add desktop shortcut to the shortcuts pane, and use a special icon for the desktop folder. Modified: thunar/trunk/thunar/thunar-column-editor.c =================================================================== --- thunar/trunk/thunar/thunar-column-editor.c 2006-08-29 15:53:32 UTC (rev 22936) +++ thunar/trunk/thunar/thunar-column-editor.c 2006-08-29 17:13:38 UTC (rev 22937) @@ -23,6 +23,7 @@ #include <thunar/thunar-abstract-dialog.h> #include <thunar/thunar-column-editor.h> +#include <thunar/thunar-gtk-extensions.h> #include <thunar/thunar-pango-extensions.h> #include <thunar/thunar-preferences.h> #include <thunar/thunar-private.h> @@ -122,10 +123,7 @@ GtkTreeViewColumn *column; GtkTreeSelection *selection; GtkCellRenderer *renderer; - AtkRelationSet *relations; - AtkRelation *relation; GtkTreeIter iter; - AtkObject *object; GtkWidget *separator; GtkWidget *button; GtkWidget *frame; @@ -287,15 +285,9 @@ button = gtk_check_button_new_with_mnemonic (_("Automatically _expand columns as needed")); exo_mutual_binding_new_with_negation (G_OBJECT (column_editor->preferences), "last-details-view-fixed-columns", G_OBJECT (button), "active"); gtk_table_attach (GTK_TABLE (table), button, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0); + thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), button); gtk_widget_show (button); - /* set Atk label relation for the button */ - object = gtk_widget_get_accessible (button); - relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); - relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); - atk_relation_set_add (relations, relation); - g_object_unref (G_OBJECT (relation)); - /* setup the tree selection */ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (column_editor->tree_view)); g_signal_connect_swapped (G_OBJECT (selection), "changed", G_CALLBACK (thunar_column_editor_update_buttons), column_editor); Modified: thunar/trunk/thunar/thunar-create-dialog.c =================================================================== --- thunar/trunk/thunar/thunar-create-dialog.c 2006-08-29 15:53:32 UTC (rev 22936) +++ thunar/trunk/thunar/thunar-create-dialog.c 2006-08-29 17:13:38 UTC (rev 22937) @@ -25,6 +25,7 @@ #include <thunar/thunar-create-dialog.h> #include <thunar/thunar-dialogs.h> #include <thunar/thunar-gobject-extensions.h> +#include <thunar/thunar-gtk-extensions.h> #include <thunar/thunar-icon-factory.h> #include <thunar/thunar-private.h> @@ -153,11 +154,8 @@ static void thunar_create_dialog_init (ThunarCreateDialog *dialog) { - AtkRelationSet *relations; - AtkRelation *relation; - AtkObject *object; - GtkWidget *label; - GtkWidget *table; + GtkWidget *label; + GtkWidget *table; /* configure the dialog itself */ gtk_dialog_add_buttons (GTK_DIALOG (dialog), @@ -184,14 +182,8 @@ dialog->entry = g_object_new (GTK_TYPE_ENTRY, "activates-default", TRUE, NULL); g_signal_connect (G_OBJECT (dialog->entry), "changed", G_CALLBACK (thunar_create_dialog_text_changed), dialog); gtk_table_attach (GTK_TABLE (table), dialog->entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); + thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), dialog->entry); gtk_widget_show (dialog->entry); - - /* set Atk label relation for the entry */ - object = gtk_widget_get_accessible (dialog->entry); - relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); - relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); - atk_relation_set_add (relations, relation); - g_object_unref (G_OBJECT (relation)); } Modified: thunar/trunk/thunar/thunar-gtk-extensions.c =================================================================== --- thunar/trunk/thunar/thunar-gtk-extensions.c 2006-08-29 15:53:32 UTC (rev 22936) +++ thunar/trunk/thunar/thunar-gtk-extensions.c 2006-08-29 17:13:38 UTC (rev 22937) @@ -136,6 +136,35 @@ /** + * thunar_gtk_label_set_a11y_relation: + * @label : a #GtkLabel. + * @widget : a #GtkWidget. + * + * Sets the %ATK_RELATION_LABEL_FOR relation on @label for @widget, which means + * accessiblity tools will identify @label as descriptive item for the specified + * @widget. + **/ +void +thunar_gtk_label_set_a11y_relation (GtkLabel *label, + GtkWidget *widget) +{ + AtkRelationSet *relations; + AtkRelation *relation; + AtkObject *object; + + _thunar_return_if_fail (GTK_IS_WIDGET (widget)); + _thunar_return_if_fail (GTK_IS_LABEL (label)); + + object = gtk_widget_get_accessible (widget); + relations = atk_object_ref_relation_set (gtk_widget_get_accessible (GTK_WIDGET (label))); + relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); + atk_relation_set_add (relations, relation); + g_object_unref (G_OBJECT (relation)); +} + + + +/** * thunar_gtk_menu_run: * @menu : a #GtkMenu. * @parent : either a #GtkWidget or a #GdkScreen which determines the screen Modified: thunar/trunk/thunar/thunar-gtk-extensions.h =================================================================== --- thunar/trunk/thunar/thunar-gtk-extensions.h 2006-08-29 15:53:32 UTC (rev 22936) +++ thunar/trunk/thunar/thunar-gtk-extensions.h 2006-08-29 17:13:38 UTC (rev 22937) @@ -36,6 +36,9 @@ const gchar *stock_id, const gchar *icon_name) G_GNUC_INTERNAL; +void thunar_gtk_label_set_a11y_relation (GtkLabel *label, + GtkWidget *widget) G_GNUC_INTERNAL; + void thunar_gtk_menu_run (GtkMenu *menu, gpointer parent, GtkMenuPositionFunc func, Modified: thunar/trunk/thunar/thunar-location-dialog.c =================================================================== --- thunar/trunk/thunar/thunar-location-dialog.c 2006-08-29 15:53:32 UTC (rev 22936) +++ thunar/trunk/thunar/thunar-location-dialog.c 2006-08-29 17:13:38 UTC (rev 22937) @@ -21,6 +21,7 @@ #include <config.h> #endif +#include <thunar/thunar-gtk-extensions.h> #include <thunar/thunar-location-dialog.h> #include <thunar/thunar-path-entry.h> #include <thunar/thunar-private.h> @@ -74,13 +75,10 @@ static void thunar_location_dialog_init (ThunarLocationDialog *location_dialog) { - AtkRelationSet *relations; - AtkRelation *relation; - AtkObject *object; - GtkWidget *cancel_button; - GtkWidget *open_button; - GtkWidget *hbox; - GtkWidget *label; + GtkWidget *cancel_button; + GtkWidget *open_button; + GtkWidget *hbox; + GtkWidget *label; gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (location_dialog)->vbox), 2); gtk_container_set_border_width (GTK_CONTAINER (location_dialog), 5); @@ -107,15 +105,10 @@ location_dialog->entry = thunar_path_entry_new (); gtk_entry_set_activates_default (GTK_ENTRY (location_dialog->entry), TRUE); gtk_box_pack_start (GTK_BOX (hbox), location_dialog->entry, TRUE, TRUE, 0); + thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), location_dialog->entry); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), location_dialog->entry); gtk_widget_show (location_dialog->entry); - /* set Atk label relation for the entry */ - object = gtk_widget_get_accessible (location_dialog->entry); - relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); - relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); - atk_relation_set_add (relations, relation); - g_object_unref (G_OBJECT (relation)); - /* the "Open" button is only sensitive if a valid file is entered */ exo_binding_new_full (G_OBJECT (location_dialog->entry), "current-file", G_OBJECT (open_button), "sensitive", Modified: thunar/trunk/thunar/thunar-permissions-chooser.c =================================================================== --- thunar/trunk/thunar/thunar-permissions-chooser.c 2006-08-29 15:53:32 UTC (rev 22936) +++ thunar/trunk/thunar/thunar-permissions-chooser.c 2006-08-29 17:13:38 UTC (rev 22937) @@ -224,11 +224,8 @@ thunar_permissions_chooser_init (ThunarPermissionsChooser *chooser) { GtkCellRenderer *renderer_text; - AtkRelationSet *relations; GtkListStore *store; - AtkRelation *relation; GtkTreeIter iter; - AtkObject *object; GtkWidget *separator; GtkWidget *button; GtkWidget *label; @@ -272,15 +269,9 @@ chooser->user_label = gtk_label_new (_("Unknown")); gtk_misc_set_alignment (GTK_MISC (chooser->user_label), 0.0f, 0.5f); gtk_box_pack_start (GTK_BOX (hbox), chooser->user_label, TRUE, TRUE, 0); + thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), chooser->user_label); gtk_widget_show (chooser->user_label); - /* set Atk label relation for the user_label */ - object = gtk_widget_get_accessible (chooser->user_label); - relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); - relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); - atk_relation_set_add (relations, relation); - g_object_unref (G_OBJECT (relation)); - row += 1; label = gtk_label_new (_("Access:")); @@ -295,15 +286,9 @@ exo_binding_new (G_OBJECT (chooser), "mutable", G_OBJECT (chooser->access_combos[2]), "sensitive"); g_signal_connect_swapped (G_OBJECT (chooser->access_combos[2]), "changed", G_CALLBACK (thunar_permissions_chooser_access_changed), chooser); gtk_table_attach (GTK_TABLE (chooser->table), chooser->access_combos[2], 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); + thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), chooser->access_combos[2]); gtk_widget_show (chooser->access_combos[2]); - /* set Atk label relation for the combo */ - object = gtk_widget_get_accessible (chooser->access_combos[2]); - relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); - relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); - atk_relation_set_add (relations, relation); - g_object_unref (G_OBJECT (relation)); - row += 1; separator = gtk_alignment_new (0.0f, 0.0f, 0.0f, 0.0f); @@ -325,15 +310,9 @@ exo_binding_new (G_OBJECT (chooser), "mutable", G_OBJECT (chooser->group_combo), "sensitive"); g_signal_connect_swapped (G_OBJECT (chooser->group_combo), "changed", G_CALLBACK (thunar_permissions_chooser_group_changed), chooser); gtk_table_attach (GTK_TABLE (chooser->table), chooser->group_combo, 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); + thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), chooser->group_combo); gtk_widget_show (chooser->group_combo); - /* set Atk label relation for the combo */ - object = gtk_widget_get_accessible (chooser->group_combo); - relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); - relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); - atk_relation_set_add (relations, relation); - g_object_unref (G_OBJECT (relation)); - row += 1; label = gtk_label_new (_("Access:")); @@ -348,15 +327,9 @@ exo_binding_new (G_OBJECT (chooser), "mutable", G_OBJECT (chooser->access_combos[1]), "sensitive"); g_signal_connect_swapped (G_OBJECT (chooser->access_combos[1]), "changed", G_CALLBACK (thunar_permissions_chooser_access_changed), chooser); gtk_table_attach (GTK_TABLE (chooser->table), chooser->access_combos[1], 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); + thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), chooser->access_combos[1]); gtk_widget_show (chooser->access_combos[1]); - /* set Atk label relation for the combo */ - object = gtk_widget_get_accessible (chooser->access_combos[1]); - relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); - relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); - atk_relation_set_add (relations, relation); - g_object_unref (G_OBJECT (relation)); - row += 1; separator = gtk_alignment_new (0.0f, 0.0f, 0.0f, 0.0f); @@ -377,15 +350,9 @@ exo_binding_new (G_OBJECT (chooser), "mutable", G_OBJECT (chooser->access_combos[0]), "sensitive"); g_signal_connect_swapped (G_OBJECT (chooser->access_combos[0]), "changed", G_CALLBACK (thunar_permissions_chooser_access_changed), chooser); gtk_table_attach (GTK_TABLE (chooser->table), chooser->access_combos[0], 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); + thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), chooser->access_combos[0]); gtk_widget_show (chooser->access_combos[0]); - /* set Atk label relation for the combo */ - object = gtk_widget_get_accessible (chooser->access_combos[0]); - relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); - relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); - atk_relation_set_add (relations, relation); - g_object_unref (G_OBJECT (relation)); - row += 1; separator = gtk_alignment_new (0.0f, 0.0f, 0.0f, 0.0f); @@ -405,15 +372,9 @@ exo_binding_new (G_OBJECT (chooser), "mutable", G_OBJECT (chooser->program_button), "sensitive"); g_signal_connect_swapped (G_OBJECT (chooser->program_button), "toggled", G_CALLBACK (thunar_permissions_chooser_program_toggled), chooser); gtk_table_attach (GTK_TABLE (chooser->table), chooser->program_button, 1, 2, row, row + 1, GTK_FILL, GTK_FILL, 0, 0); + thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), chooser->program_button); gtk_widget_show (chooser->program_button); - /* set Atk label relation for the button */ - object = gtk_widget_get_accessible (chooser->program_button); - relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); - relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); - atk_relation_set_add (relations, relation); - g_object_unref (G_OBJECT (relation)); - row += 1; hbox = gtk_hbox_new (FALSE, 6); Modified: thunar/trunk/thunar/thunar-preferences-dialog.c =================================================================== --- thunar/trunk/thunar/thunar-preferences-dialog.c 2006-08-29 15:53:32 UTC (rev 22936) +++ thunar/trunk/thunar/thunar-preferences-dialog.c 2006-08-29 17:13:38 UTC (rev 22937) @@ -196,21 +196,18 @@ static void thunar_preferences_dialog_init (ThunarPreferencesDialog *dialog) { - AtkRelationSet *relations; - GtkAdjustment *adjustment; - AtkRelation *relation; - AtkObject *object; - GtkWidget *notebook; - GtkWidget *button; - GtkWidget *align; - GtkWidget *combo; - GtkWidget *frame; - GtkWidget *label; - GtkWidget *range; - GtkWidget *table; - GtkWidget *hbox; - GtkWidget *ibox; - GtkWidget *vbox; + GtkAdjustment *adjustment; + GtkWidget *notebook; + GtkWidget *button; + GtkWidget *align; + GtkWidget *combo; + GtkWidget *frame; + GtkWidget *label; + GtkWidget *range; + GtkWidget *table; + GtkWidget *hbox; + GtkWidget *ibox; + GtkWidget *vbox; /* grab a reference on the preferences */ dialog->preferences = thunar_preferences_get (); @@ -273,16 +270,10 @@ exo_mutual_binding_new_full (G_OBJECT (dialog->preferences), "default-view", G_OBJECT (combo), "active", transform_view_string_to_index, transform_view_index_to_string, NULL, NULL); gtk_table_attach (GTK_TABLE (table), combo, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); + thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), combo); gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo); gtk_widget_show (combo); - /* set Atk label relation for the combo */ - object = gtk_widget_get_accessible (combo); - relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); - relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); - atk_relation_set_add (relations, relation); - g_object_unref (G_OBJECT (relation)); - button = gtk_check_button_new_with_mnemonic (_("Sort _folders before files")); exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-folders-first", G_OBJECT (button), "active"); thunar_gtk_widget_set_tooltip (button, _("Select this option to list folders before files when you sort a folder.")); @@ -363,16 +354,10 @@ exo_mutual_binding_new_full (G_OBJECT (dialog->preferences), "shortcuts-icon-size", G_OBJECT (combo), "active", transform_icon_size_to_index, transform_index_to_icon_size, NULL, NULL); gtk_table_attach (GTK_TABLE (table), combo, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); + thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), combo); gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo); gtk_widget_show (combo); - /* set Atk label relation for the combo */ - object = gtk_widget_get_accessible (combo); - relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); - relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); - atk_relation_set_add (relations, relation); - g_object_unref (G_OBJECT (relation)); - button = gtk_check_button_new_with_mnemonic (_("Show Icon _Emblems")); exo_mutual_binding_new (G_OBJECT (dialog->preferences), "shortcuts-icon-emblems", G_OBJECT (button), "active"); thunar_gtk_widget_set_tooltip (button, _("Select this option to display icon emblems in the shortcuts pane for all folders " @@ -414,16 +399,10 @@ exo_mutual_binding_new_full (G_OBJECT (dialog->preferences), "tree-icon-size", G_OBJECT (combo), "active", transform_icon_size_to_index, transform_index_to_icon_size, NULL, NULL); gtk_table_attach (GTK_TABLE (table), combo, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); + thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), combo); gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo); gtk_widget_show (combo); - /* set Atk label relation for the combo */ - object = gtk_widget_get_accessible (combo); - relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); - relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); - atk_relation_set_add (relations, relation); - g_object_unref (G_OBJECT (relation)); - button = gtk_check_button_new_with_mnemonic (_("Show Icon E_mblems")); exo_mutual_binding_new (G_OBJECT (dialog->preferences), "tree-icon-emblems", G_OBJECT (button), "active"); thunar_gtk_widget_set_tooltip (button, _("Select this option to display icon emblems in the tree pane for all folders " @@ -495,6 +474,7 @@ "useful when single clicks activate items, and you want only to select the item " "without activating it.")); gtk_box_pack_start (GTK_BOX (ibox), range, FALSE, FALSE, 0); + thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), range); gtk_label_set_mnemonic_widget (GTK_LABEL (label), range); gtk_widget_show (range); @@ -502,13 +482,6 @@ adjustment = gtk_range_get_adjustment (GTK_RANGE (range)); exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-single-click-timeout", G_OBJECT (adjustment), "value"); - /* set Atk label relation for the range */ - object = gtk_widget_get_accessible (range); - relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); - relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); - atk_relation_set_add (relations, relation); - g_object_unref (G_OBJECT (relation)); - hbox = gtk_hbox_new (TRUE, 6); gtk_box_pack_start (GTK_BOX (ibox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); @@ -579,14 +552,8 @@ #endif exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-recursive-permissions", G_OBJECT (combo), "active"); gtk_table_attach (GTK_TABLE (table), combo, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); + thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), combo); gtk_widget_show (combo); - - /* set Atk label relation for the combo */ - object = gtk_widget_get_accessible (combo); - relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label)); - relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR); - atk_relation_set_add (relations, relation); - g_object_unref (G_OBJECT (relation)); } _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits