mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-05 16:20:10 +00:00
Add ATK names to the Up, Down, and Root buttons. Keep the focus from
2007-05-16 Matthias Clasen <mclasen@redhat.com> * gtk/gtkpathbar.c: Add ATK names to the Up, Down, and Root buttons. Keep the focus from vanishing when Up or Down arrows become insensitive or invisible. (#357005, Patrick Wade) svn path=/trunk/; revision=17856
This commit is contained in:
parent
94dcec33c1
commit
6d80f2d1dc
@ -1,3 +1,9 @@
|
||||
2007-05-16 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtkpathbar.c: Add ATK names to the Up, Down, and Root
|
||||
buttons. Keep the focus from vanishing when Up or Down arrows
|
||||
become insensitive or invisible. (#357005, Patrick Wade)
|
||||
|
||||
2007-05-16 Brian Cameron <brian.cameron@sun.com>
|
||||
|
||||
* acconfig.h, configure.in, gdk/Makefile.am, gdkprivate.h, gdkrgb.c,
|
||||
|
@ -98,6 +98,12 @@ static void gtk_path_bar_scroll_up (GtkWidget *button,
|
||||
static void gtk_path_bar_scroll_down (GtkWidget *button,
|
||||
GtkPathBar *path_bar);
|
||||
static void gtk_path_bar_stop_scrolling (GtkPathBar *path_bar);
|
||||
static gboolean gtk_path_bar_slider_up_defocus (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
GtkPathBar *path_bar);
|
||||
static gboolean gtk_path_bar_slider_down_defocus (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
GtkPathBar *path_bar);
|
||||
static gboolean gtk_path_bar_slider_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
GtkPathBar *path_bar);
|
||||
@ -132,10 +138,17 @@ get_slider_button (GtkPathBar *path_bar,
|
||||
GtkArrowType arrow_type)
|
||||
{
|
||||
GtkWidget *button;
|
||||
AtkObject *atk_obj;
|
||||
|
||||
gtk_widget_push_composite_child ();
|
||||
|
||||
button = gtk_button_new ();
|
||||
atk_obj = gtk_widget_get_accessible (button);
|
||||
if (arrow_type == GTK_ARROW_LEFT)
|
||||
atk_object_set_name (atk_obj, _("Up Path"));
|
||||
else
|
||||
atk_object_set_name (atk_obj, _("Down Path"));
|
||||
|
||||
gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (button), gtk_arrow_new (arrow_type, GTK_SHADOW_OUT));
|
||||
gtk_container_add (GTK_CONTAINER (path_bar), button);
|
||||
@ -165,6 +178,9 @@ gtk_path_bar_init (GtkPathBar *path_bar)
|
||||
g_signal_connect (path_bar->up_slider_button, "clicked", G_CALLBACK (gtk_path_bar_scroll_up), path_bar);
|
||||
g_signal_connect (path_bar->down_slider_button, "clicked", G_CALLBACK (gtk_path_bar_scroll_down), path_bar);
|
||||
|
||||
g_signal_connect (path_bar->up_slider_button, "focus_out_event", G_CALLBACK (gtk_path_bar_slider_up_defocus), path_bar);
|
||||
g_signal_connect (path_bar->down_slider_button, "focus_out_event", G_CALLBACK (gtk_path_bar_slider_down_defocus), path_bar);
|
||||
|
||||
g_signal_connect (path_bar->up_slider_button, "button_press_event", G_CALLBACK (gtk_path_bar_slider_button_press), path_bar);
|
||||
g_signal_connect (path_bar->up_slider_button, "button_release_event", G_CALLBACK (gtk_path_bar_slider_button_release), path_bar);
|
||||
g_signal_connect (path_bar->down_slider_button, "button_press_event", G_CALLBACK (gtk_path_bar_slider_button_press), path_bar);
|
||||
@ -793,6 +809,62 @@ gtk_path_bar_stop_scrolling (GtkPathBar *path_bar)
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_path_bar_slider_up_defocus (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
GtkPathBar *path_bar)
|
||||
{
|
||||
GList *list;
|
||||
GList *up_button = NULL;
|
||||
|
||||
if (event->type != GDK_FOCUS_CHANGE)
|
||||
return FALSE;
|
||||
|
||||
for (list = g_list_last (path_bar->button_list); list; list = list->prev)
|
||||
{
|
||||
if (gtk_widget_get_child_visible (BUTTON_DATA (list->data)->button))
|
||||
{
|
||||
up_button = list;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* don't let the focus vanish */
|
||||
if ((!GTK_WIDGET_IS_SENSITIVE (path_bar->up_slider_button)) ||
|
||||
(!gtk_widget_get_child_visible (path_bar->up_slider_button)))
|
||||
gtk_widget_grab_focus (BUTTON_DATA (up_button->data)->button);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_path_bar_slider_down_defocus (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
GtkPathBar *path_bar)
|
||||
{
|
||||
GList *list;
|
||||
GList *down_button = NULL;
|
||||
|
||||
if (event->type != GDK_FOCUS_CHANGE)
|
||||
return FALSE;
|
||||
|
||||
for (list = path_bar->button_list; list; list = list->next)
|
||||
{
|
||||
if (gtk_widget_get_child_visible (BUTTON_DATA (list->data)->button))
|
||||
{
|
||||
down_button = list;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* don't let the focus vanish */
|
||||
if ((!GTK_WIDGET_IS_SENSITIVE (path_bar->down_slider_button)) ||
|
||||
(!gtk_widget_get_child_visible (path_bar->down_slider_button)))
|
||||
gtk_widget_grab_focus (BUTTON_DATA (down_button->data)->button);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_path_bar_slider_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
@ -1279,6 +1351,7 @@ make_directory_button (GtkPathBar *path_bar,
|
||||
{ "text/uri-list", 0, 0 }
|
||||
};
|
||||
|
||||
AtkObject *atk_obj;
|
||||
GtkWidget *child = NULL;
|
||||
GtkWidget *label_alignment = NULL;
|
||||
ButtonData *button_data;
|
||||
@ -1289,6 +1362,7 @@ make_directory_button (GtkPathBar *path_bar,
|
||||
|
||||
button_data->type = find_button_type (path_bar, path);
|
||||
button_data->button = gtk_toggle_button_new ();
|
||||
atk_obj = gtk_widget_get_accessible (button_data->button);
|
||||
gtk_button_set_focus_on_click (GTK_BUTTON (button_data->button), FALSE);
|
||||
|
||||
switch (button_data->type)
|
||||
@ -1296,7 +1370,8 @@ make_directory_button (GtkPathBar *path_bar,
|
||||
case ROOT_BUTTON:
|
||||
button_data->image = gtk_image_new ();
|
||||
child = button_data->image;
|
||||
button_data->label = NULL;
|
||||
button_data->label = gtk_label_new (NULL);
|
||||
atk_object_set_name (atk_obj, _("File System Root"));
|
||||
break;
|
||||
case HOME_BUTTON:
|
||||
case DESKTOP_BUTTON:
|
||||
|
Loading…
Reference in New Issue
Block a user