forked from AuroraMiddleware/gtk
Merge branch 'filechooser-a11y' into 'gtk-3-24'
Improve FileChooser a11y See merge request GNOME/gtk!2721
This commit is contained in:
commit
26119e5fc0
@ -11,6 +11,7 @@ a11y_h_sources = \
|
|||||||
a11y/gtkcontainercellaccessible.h \
|
a11y/gtkcontainercellaccessible.h \
|
||||||
a11y/gtkentryaccessible.h \
|
a11y/gtkentryaccessible.h \
|
||||||
a11y/gtkexpanderaccessible.h \
|
a11y/gtkexpanderaccessible.h \
|
||||||
|
a11y/gtkfilechooserwidgetaccessible.h \
|
||||||
a11y/gtkflowboxaccessible.h \
|
a11y/gtkflowboxaccessible.h \
|
||||||
a11y/gtkflowboxchildaccessible.h \
|
a11y/gtkflowboxchildaccessible.h \
|
||||||
a11y/gtkframeaccessible.h \
|
a11y/gtkframeaccessible.h \
|
||||||
@ -88,6 +89,7 @@ a11y_c_sources = \
|
|||||||
a11y/gtkcontainercellaccessible.c \
|
a11y/gtkcontainercellaccessible.c \
|
||||||
a11y/gtkentryaccessible.c \
|
a11y/gtkentryaccessible.c \
|
||||||
a11y/gtkexpanderaccessible.c \
|
a11y/gtkexpanderaccessible.c \
|
||||||
|
a11y/gtkfilechooserwidgetaccessible.c \
|
||||||
a11y/gtkflowboxaccessible.c \
|
a11y/gtkflowboxaccessible.c \
|
||||||
a11y/gtkflowboxchildaccessible.c \
|
a11y/gtkflowboxchildaccessible.c \
|
||||||
a11y/gtkframeaccessible.c \
|
a11y/gtkframeaccessible.c \
|
||||||
|
122
gtk/a11y/gtkfilechooserwidgetaccessible.c
Normal file
122
gtk/a11y/gtkfilechooserwidgetaccessible.c
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
/* GTK+ - accessibility implementations
|
||||||
|
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#include <glib/gi18n-lib.h>
|
||||||
|
#include "gtkfilechooserwidgetaccessible.h"
|
||||||
|
|
||||||
|
|
||||||
|
static void atk_action_interface_init (AtkActionIface *iface);
|
||||||
|
|
||||||
|
G_DEFINE_TYPE_WITH_CODE (GtkFileChooserWidgetAccessible, gtk_file_chooser_widget_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE,
|
||||||
|
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init))
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_file_chooser_widget_accessible_initialize (AtkObject *obj,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
ATK_OBJECT_CLASS (gtk_file_chooser_widget_accessible_parent_class)->initialize (obj, data);
|
||||||
|
obj->role = ATK_ROLE_FILE_CHOOSER;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_file_chooser_widget_accessible_class_init (GtkFileChooserWidgetAccessibleClass *klass)
|
||||||
|
{
|
||||||
|
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||||
|
GtkContainerAccessibleClass *container_class = (GtkContainerAccessibleClass*)klass;
|
||||||
|
|
||||||
|
class->initialize = gtk_file_chooser_widget_accessible_initialize;
|
||||||
|
|
||||||
|
container_class->add_gtk = NULL;
|
||||||
|
container_class->remove_gtk = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_file_chooser_widget_accessible_init (GtkFileChooserWidgetAccessible *file_chooser_widget)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_file_chooser_widget_accessible_do_action (AtkAction *action,
|
||||||
|
gint i)
|
||||||
|
{
|
||||||
|
GtkWidget *widget;
|
||||||
|
|
||||||
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action));
|
||||||
|
if (widget == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!gtk_widget_is_sensitive (widget) || !gtk_widget_get_visible (widget))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
switch (i)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
g_signal_emit_by_name (GTK_FILE_CHOOSER_WIDGET (widget), "location-popup", "");
|
||||||
|
return TRUE;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gint
|
||||||
|
gtk_file_chooser_widget_accessible_get_n_actions (AtkAction *action)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const gchar *
|
||||||
|
gtk_file_chooser_widget_accessible_action_get_name (AtkAction *action,
|
||||||
|
gint i)
|
||||||
|
{
|
||||||
|
if (i == 0)
|
||||||
|
return "show_location";
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const gchar *
|
||||||
|
gtk_file_chooser_widget_accessible_action_get_localized_name (AtkAction *action,
|
||||||
|
gint i)
|
||||||
|
{
|
||||||
|
if (i == 0)
|
||||||
|
return C_("Action name", "Show location");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const gchar *
|
||||||
|
gtk_file_chooser_widget_accessible_action_get_description (AtkAction *action,
|
||||||
|
gint i)
|
||||||
|
{
|
||||||
|
if (i == 0)
|
||||||
|
return C_("Action description", "Show the File Chooser's Location text field");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
atk_action_interface_init (AtkActionIface *iface)
|
||||||
|
{
|
||||||
|
iface->do_action = gtk_file_chooser_widget_accessible_do_action;
|
||||||
|
iface->get_n_actions = gtk_file_chooser_widget_accessible_get_n_actions;
|
||||||
|
iface->get_name = gtk_file_chooser_widget_accessible_action_get_name;
|
||||||
|
iface->get_localized_name = gtk_file_chooser_widget_accessible_action_get_localized_name;
|
||||||
|
iface->get_description = gtk_file_chooser_widget_accessible_action_get_description;
|
||||||
|
}
|
57
gtk/a11y/gtkfilechooserwidgetaccessible.h
Normal file
57
gtk/a11y/gtkfilechooserwidgetaccessible.h
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/* GTK+ - accessibility implementations
|
||||||
|
* Copyright 2001 Sun Microsystems Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GTK_FILE_CHOOSER_WIDGET_ACCESSIBLE_H__
|
||||||
|
#define __GTK_FILE_CHOOSER_WIDGET_ACCESSIBLE_H__
|
||||||
|
|
||||||
|
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||||
|
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <gtk/a11y/gtkcontaineraccessible.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define GTK_TYPE_FILE_CHOOSER_WIDGET_ACCESSIBLE (gtk_file_chooser_widget_accessible_get_type ())
|
||||||
|
#define GTK_FILE_CHOOSER_WIDGET_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FILE_CHOOSER_WIDGET_ACCESSIBLE, GtkFileChooserWidgetAccessible))
|
||||||
|
#define GTK_FILE_CHOOSER_WIDGET_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FILE_CHOOSER_WIDGET_ACCESSIBLE, GtkFileChooserWidgetAccessibleClass))
|
||||||
|
#define GTK_IS_FILE_CHOOSER_WIDGET_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FILE_CHOOSER_WIDGET_ACCESSIBLE))
|
||||||
|
#define GTK_IS_FILE_CHOOSER_WIDGET_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FILE_CHOOSER_WIDGET_ACCESSIBLE))
|
||||||
|
#define GTK_FILE_CHOOSER_WIDGET_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FILE_CHOOSER_WIDGET_ACCESSIBLE, GtkFileChooserWidgetAccessibleClass))
|
||||||
|
|
||||||
|
typedef struct _GtkFileChooserWidgetAccessible GtkFileChooserWidgetAccessible;
|
||||||
|
typedef struct _GtkFileChooserWidgetAccessibleClass GtkFileChooserWidgetAccessibleClass;
|
||||||
|
typedef struct _GtkFileChooserWidgetAccessiblePrivate GtkFileChooserWidgetAccessiblePrivate;
|
||||||
|
|
||||||
|
struct _GtkFileChooserWidgetAccessible
|
||||||
|
{
|
||||||
|
GtkContainerAccessible parent;
|
||||||
|
|
||||||
|
GtkFileChooserWidgetAccessiblePrivate *priv;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GtkFileChooserWidgetAccessibleClass
|
||||||
|
{
|
||||||
|
GtkContainerAccessibleClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GType gtk_file_chooser_widget_accessible_get_type (void);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __GTK_FILE_CHOOSER_WIDGET_ACCESSIBLE_H__ */
|
@ -14,6 +14,7 @@ a11y_sources = files(
|
|||||||
'gtkcontainercellaccessible.c',
|
'gtkcontainercellaccessible.c',
|
||||||
'gtkentryaccessible.c',
|
'gtkentryaccessible.c',
|
||||||
'gtkexpanderaccessible.c',
|
'gtkexpanderaccessible.c',
|
||||||
|
'gtkfilechooserwidgetaccessible.c',
|
||||||
'gtkflowboxaccessible.c',
|
'gtkflowboxaccessible.c',
|
||||||
'gtkflowboxchildaccessible.c',
|
'gtkflowboxchildaccessible.c',
|
||||||
'gtkframeaccessible.c',
|
'gtkframeaccessible.c',
|
||||||
@ -72,6 +73,7 @@ a11y_headers = files(
|
|||||||
'gtkcontainercellaccessible.h',
|
'gtkcontainercellaccessible.h',
|
||||||
'gtkentryaccessible.h',
|
'gtkentryaccessible.h',
|
||||||
'gtkexpanderaccessible.h',
|
'gtkexpanderaccessible.h',
|
||||||
|
'gtkfilechooserwidgetaccessible.h',
|
||||||
'gtkflowboxaccessible.h',
|
'gtkflowboxaccessible.h',
|
||||||
'gtkflowboxchildaccessible.h',
|
'gtkflowboxchildaccessible.h',
|
||||||
'gtkframeaccessible.h',
|
'gtkframeaccessible.h',
|
||||||
|
@ -69,6 +69,7 @@
|
|||||||
#include "gtkcheckbutton.h"
|
#include "gtkcheckbutton.h"
|
||||||
#include "gtkwindowgroup.h"
|
#include "gtkwindowgroup.h"
|
||||||
#include "gtkintl.h"
|
#include "gtkintl.h"
|
||||||
|
#include "a11y/gtkfilechooserwidgetaccessible.h"
|
||||||
#include "gtkshow.h"
|
#include "gtkshow.h"
|
||||||
#include "gtkmain.h"
|
#include "gtkmain.h"
|
||||||
#include "gtkscrollable.h"
|
#include "gtkscrollable.h"
|
||||||
@ -8752,6 +8753,7 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
|
|||||||
gtk_widget_class_bind_template_callback (widget_class, rename_file_rename_clicked);
|
gtk_widget_class_bind_template_callback (widget_class, rename_file_rename_clicked);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, rename_file_end);
|
gtk_widget_class_bind_template_callback (widget_class, rename_file_end);
|
||||||
|
|
||||||
|
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_FILE_CHOOSER_WIDGET_ACCESSIBLE);
|
||||||
gtk_widget_class_set_css_name (widget_class, "filechooser");
|
gtk_widget_class_set_css_name (widget_class, "filechooser");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,11 @@
|
|||||||
<signal name="file-activated" handler="file_chooser_widget_file_activated" swapped="no"/>
|
<signal name="file-activated" handler="file_chooser_widget_file_activated" swapped="no"/>
|
||||||
<signal name="response-requested" handler="file_chooser_widget_response_requested" swapped="no"/>
|
<signal name="response-requested" handler="file_chooser_widget_response_requested" swapped="no"/>
|
||||||
<signal name="selection-changed" handler="file_chooser_widget_selection_changed" swapped="no"/>
|
<signal name="selection-changed" handler="file_chooser_widget_selection_changed" swapped="no"/>
|
||||||
|
<child internal-child="accessible">
|
||||||
|
<object class="AtkObject">
|
||||||
|
<property name="AtkObject::accessible-name" translatable="yes">File Chooser Widget</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">1</property>
|
<property name="expand">1</property>
|
||||||
|
@ -17,6 +17,11 @@
|
|||||||
<property name="hscrollbar-policy">never</property>
|
<property name="hscrollbar-policy">never</property>
|
||||||
<property name="local-only">1</property>
|
<property name="local-only">1</property>
|
||||||
<property name="show-other-locations">1</property>
|
<property name="show-other-locations">1</property>
|
||||||
|
<child internal-child="accessible">
|
||||||
|
<object class="AtkObject">
|
||||||
|
<property name="AtkObject::accessible-name" translatable="yes">Places</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
<style>
|
<style>
|
||||||
<class name="sidebar"/>
|
<class name="sidebar"/>
|
||||||
</style>
|
</style>
|
||||||
@ -37,6 +42,11 @@
|
|||||||
<object class="GtkRevealer" id="browse_header_revealer">
|
<object class="GtkRevealer" id="browse_header_revealer">
|
||||||
<property name="visible">1</property>
|
<property name="visible">1</property>
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
|
<child internal-child="accessible">
|
||||||
|
<object class="AtkObject">
|
||||||
|
<property name="AtkObject::accessible-name" translatable="yes">Browse Header Revealer</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="visible">1</property>
|
<property name="visible">1</property>
|
||||||
@ -50,11 +60,21 @@
|
|||||||
<object class="GtkStack" id="browse_header_stack">
|
<object class="GtkStack" id="browse_header_stack">
|
||||||
<property name="visible">1</property>
|
<property name="visible">1</property>
|
||||||
<property name="transition-type">crossfade</property>
|
<property name="transition-type">crossfade</property>
|
||||||
|
<child internal-child="accessible">
|
||||||
|
<object class="AtkObject">
|
||||||
|
<property name="AtkObject::accessible-name" translatable="yes">Browse Header Stack</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="visible">1</property>
|
<property name="visible">1</property>
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<property name="border-width">6</property>
|
<property name="border-width">6</property>
|
||||||
|
<child internal-child="accessible">
|
||||||
|
<object class="AtkObject">
|
||||||
|
<property name="AtkObject::accessible-name" translatable="yes">PathBar Layer</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkPathBar" id="browse_path_bar">
|
<object class="GtkPathBar" id="browse_path_bar">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@ -96,6 +116,11 @@
|
|||||||
<property name="no-show-all">1</property>
|
<property name="no-show-all">1</property>
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<property name="border-width">6</property>
|
<property name="border-width">6</property>
|
||||||
|
<child internal-child="accessible">
|
||||||
|
<object class="AtkObject">
|
||||||
|
<property name="AtkObject::accessible-name" translatable="yes">Location Layer</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="name">location</property>
|
<property name="name">location</property>
|
||||||
@ -107,6 +132,11 @@
|
|||||||
<property name="no-show-all">1</property>
|
<property name="no-show-all">1</property>
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<property name="border-width">6</property>
|
<property name="border-width">6</property>
|
||||||
|
<child internal-child="accessible">
|
||||||
|
<object class="AtkObject">
|
||||||
|
<property name="AtkObject::accessible-name" translatable="yes">Search Layer</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
<child type="center">
|
<child type="center">
|
||||||
<object class="GtkSearchEntry" id="search_entry">
|
<object class="GtkSearchEntry" id="search_entry">
|
||||||
<property name="visible">1</property>
|
<property name="visible">1</property>
|
||||||
|
Loading…
Reference in New Issue
Block a user