Improve AtkAction implementations
Implement get_localized_name, and also translate the strings returned by get_description. https://bugzilla.gnome.org/show_bug.cgi?id=525226
This commit is contained in:
@ -18,6 +18,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gtkbooleancellaccessible.h"
|
||||
|
||||
struct _GtkBooleanCellAccessiblePrivate
|
||||
@ -39,7 +40,7 @@ gtk_boolean_cell_accessible_get_description (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i == 0)
|
||||
return "toggles the cell";
|
||||
return C_("Action description", "Toggles the cell");
|
||||
|
||||
return parent_action_iface->get_description (action, i - 1);
|
||||
}
|
||||
@ -54,14 +55,24 @@ gtk_boolean_cell_accessible_action_get_name (AtkAction *action,
|
||||
return parent_action_iface->get_description (action, i - 1);
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
gtk_boolean_cell_accessible_action_get_localized_name (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action name", "Toggle");
|
||||
|
||||
return parent_action_iface->get_description (action, i - 1);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_boolean_cell_accessible_do_action (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i == 0)
|
||||
return parent_action_iface->do_action (action, 2);
|
||||
else
|
||||
return parent_action_iface->do_action (action, i - 1);
|
||||
|
||||
return parent_action_iface->do_action (action, i - 1);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -73,6 +84,7 @@ gtk_boolean_cell_accessible_action_interface_init (AtkActionIface *iface)
|
||||
iface->get_n_actions = gtk_boolean_cell_accessible_get_n_actions;
|
||||
iface->get_description = gtk_boolean_cell_accessible_get_description;
|
||||
iface->get_name = gtk_boolean_cell_accessible_action_get_name;
|
||||
iface->get_localized_name = gtk_boolean_cell_accessible_action_get_localized_name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gtkbuttonaccessible.h"
|
||||
|
||||
|
||||
@ -327,10 +328,27 @@ static const gchar *
|
||||
gtk_button_accessible_action_get_name (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i != 0)
|
||||
return NULL;
|
||||
if (i == 0)
|
||||
return "click";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return "click";
|
||||
static const gchar *
|
||||
gtk_button_accessible_action_get_localized_name (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action name", "Click");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
gtk_button_accessible_action_get_description (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action description", "Clicks the button");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -340,6 +358,8 @@ atk_action_interface_init (AtkActionIface *iface)
|
||||
iface->get_n_actions = gtk_button_accessible_get_n_actions;
|
||||
iface->get_keybinding = gtk_button_accessible_get_keybinding;
|
||||
iface->get_name = gtk_button_accessible_action_get_name;
|
||||
iface->get_localized_name = gtk_button_accessible_action_get_localized_name;
|
||||
iface->get_description = gtk_button_accessible_action_get_description;
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkcontainercellaccessible.h"
|
||||
#include "gtkcellaccessibleprivate.h"
|
||||
@ -247,6 +248,23 @@ gtk_cell_accessible_action_get_name (AtkAction *action,
|
||||
}
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
gtk_cell_accessible_action_get_localized_name (AtkAction *action,
|
||||
gint index)
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
return C_("Action name", "Expand or contract");
|
||||
case 1:
|
||||
return C_("Action name", "Edit");
|
||||
case 2:
|
||||
return C_("Action name", "Activate");
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
gtk_cell_accessible_action_get_description (AtkAction *action,
|
||||
gint index)
|
||||
@ -254,11 +272,11 @@ gtk_cell_accessible_action_get_description (AtkAction *action,
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
return "expands or contracts the row in the tree view containing this cell";
|
||||
return C_("Action description", "Expands or contracts the row in the tree view containing this cell");
|
||||
case 1:
|
||||
return "creates a widget in which the contents of the cell can be edited";
|
||||
return C_("Action description", "Creates a widget in which the contents of the cell can be edited");
|
||||
case 2:
|
||||
return "activate the cell";
|
||||
return C_("Action description", "Activates the cell");
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
@ -308,6 +326,7 @@ atk_action_interface_init (AtkActionIface *iface)
|
||||
iface->get_n_actions = gtk_cell_accessible_action_get_n_actions;
|
||||
iface->do_action = gtk_cell_accessible_action_do_action;
|
||||
iface->get_name = gtk_cell_accessible_action_get_name;
|
||||
iface->get_localized_name = gtk_cell_accessible_action_get_localized_name;
|
||||
iface->get_description = gtk_cell_accessible_action_get_description;
|
||||
iface->get_keybinding = gtk_cell_accessible_action_get_keybinding;
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkcolorswatchaccessibleprivate.h"
|
||||
|
||||
@ -61,6 +62,32 @@ gtk_color_swatch_accessible_get_name (AtkAction *action,
|
||||
}
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
gtk_color_swatch_accessible_get_localized_name (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return C_("Action name", "Select");
|
||||
case 1: return C_("Action name", "Activate");
|
||||
case 2: return C_("Action name", "Customize");
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
gtk_color_swatch_accessible_get_description (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return C_("Action description", "Selects the color");
|
||||
case 1: return C_("Action description", "Activates the color");
|
||||
case 2: return C_("Action description", "Customizes the color");
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_color_swatch_accessible_do_action (AtkAction *action,
|
||||
gint i)
|
||||
@ -99,4 +126,6 @@ atk_action_interface_init (AtkActionIface *iface)
|
||||
iface->get_n_actions = gtk_color_swatch_accessible_get_n_actions;
|
||||
iface->get_keybinding = gtk_color_swatch_accessible_get_keybinding;
|
||||
iface->get_name = gtk_color_swatch_accessible_get_name;
|
||||
iface->get_localized_name = gtk_color_swatch_accessible_get_localized_name;
|
||||
iface->get_description = gtk_color_swatch_accessible_get_description;
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkcomboboxaccessible.h"
|
||||
|
||||
@ -299,10 +300,27 @@ static const gchar *
|
||||
gtk_combo_box_accessible_action_get_name (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i != 0)
|
||||
return NULL;
|
||||
if (i == 0)
|
||||
return "press";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return "press";
|
||||
static const gchar *
|
||||
gtk_combo_box_accessible_action_get_localized_name (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action name", "Press");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
gtk_combo_box_accessible_action_get_description (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action description", "Presses the combobox");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -312,6 +330,8 @@ atk_action_interface_init (AtkActionIface *iface)
|
||||
iface->get_n_actions = gtk_combo_box_accessible_get_n_actions;
|
||||
iface->get_keybinding = gtk_combo_box_accessible_get_keybinding;
|
||||
iface->get_name = gtk_combo_box_accessible_action_get_name;
|
||||
iface->get_localized_name = gtk_combo_box_accessible_action_get_localized_name;
|
||||
iface->get_description = gtk_combo_box_accessible_action_get_description;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkpango.h"
|
||||
@ -1527,10 +1528,27 @@ static const gchar*
|
||||
gtk_entry_accessible_action_get_name (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i != 0)
|
||||
return NULL;
|
||||
if (i == 0)
|
||||
return "activate";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return "activate";
|
||||
static const gchar*
|
||||
gtk_entry_accessible_action_get_localized_name (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action name", "Activate");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const gchar*
|
||||
gtk_entry_accessible_action_get_description (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action description", "Activates the entry");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1540,4 +1558,6 @@ atk_action_interface_init (AtkActionIface *iface)
|
||||
iface->get_n_actions = gtk_entry_accessible_get_n_actions;
|
||||
iface->get_keybinding = gtk_entry_accessible_get_keybinding;
|
||||
iface->get_name = gtk_entry_accessible_action_get_name;
|
||||
iface->get_localized_name = gtk_entry_accessible_action_get_localized_name;
|
||||
iface->get_description = gtk_entry_accessible_action_get_description;
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkexpanderaccessible.h"
|
||||
|
||||
@ -267,10 +268,27 @@ static const gchar *
|
||||
gtk_expander_accessible_action_get_name (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i != 0)
|
||||
return NULL;
|
||||
if (i == 0)
|
||||
return "activate";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return "activate";
|
||||
static const gchar *
|
||||
gtk_expander_accessible_action_get_localized_name (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action name", "Activate");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
gtk_expander_accessible_action_get_description (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action description", "Activates the expander");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -280,4 +298,6 @@ atk_action_interface_init (AtkActionIface *iface)
|
||||
iface->get_n_actions = gtk_expander_accessible_get_n_actions;
|
||||
iface->get_keybinding = gtk_expander_accessible_get_keybinding;
|
||||
iface->get_name = gtk_expander_accessible_action_get_name;
|
||||
iface->get_localized_name = gtk_expander_accessible_action_get_localized_name;
|
||||
iface->get_description = gtk_expander_accessible_action_get_description;
|
||||
}
|
||||
|
||||
@ -15,6 +15,9 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkmenuitemaccessible.h"
|
||||
@ -420,10 +423,27 @@ static const gchar *
|
||||
gtk_menu_item_accessible_action_get_name (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i != 0 || gtk_menu_item_accessible_get_n_actions (action) == 0)
|
||||
return NULL;
|
||||
if (i == 0 && gtk_menu_item_accessible_get_n_actions (action) > 0)
|
||||
return "click";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return "click";
|
||||
static const gchar *
|
||||
gtk_menu_item_accessible_action_get_localized_name (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i == 0 && gtk_menu_item_accessible_get_n_actions (action) > 0)
|
||||
return C_("Action name", "Click");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
gtk_menu_item_accessible_action_get_description (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i == 0 && gtk_menu_item_accessible_get_n_actions (action) > 0)
|
||||
return C_("Action description", "Clicks the menuitem");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -615,6 +635,8 @@ atk_action_interface_init (AtkActionIface *iface)
|
||||
iface->do_action = gtk_menu_item_accessible_do_action;
|
||||
iface->get_n_actions = gtk_menu_item_accessible_get_n_actions;
|
||||
iface->get_name = gtk_menu_item_accessible_action_get_name;
|
||||
iface->get_localized_name = gtk_menu_item_accessible_action_get_localized_name;
|
||||
iface->get_description = gtk_menu_item_accessible_action_get_description;
|
||||
iface->get_keybinding = gtk_menu_item_accessible_get_keybinding;
|
||||
}
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkscalebuttonaccessible.h"
|
||||
|
||||
@ -133,7 +134,15 @@ static const gchar *
|
||||
gtk_scale_button_accessible_get_description (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
return NULL;
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
return C_("Action description", "Pops up the slider");
|
||||
case 1:
|
||||
return C_("Action description", "Dismisses the slider");
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
@ -151,6 +160,21 @@ gtk_scale_button_accessible_action_get_name (AtkAction *action,
|
||||
}
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
gtk_scale_button_accessible_action_get_localized_name (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
return C_("Action name", "Popup");
|
||||
case 1:
|
||||
return C_("Action name", "Dismiss");
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
atk_action_interface_init (AtkActionIface *iface)
|
||||
{
|
||||
@ -158,6 +182,7 @@ atk_action_interface_init (AtkActionIface *iface)
|
||||
iface->get_n_actions = gtk_scale_button_accessible_get_n_actions;
|
||||
iface->get_description = gtk_scale_button_accessible_get_description;
|
||||
iface->get_name = gtk_scale_button_accessible_action_get_name;
|
||||
iface->get_localized_name = gtk_scale_button_accessible_action_get_localized_name;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkintl.h"
|
||||
#include "gtkswitchaccessible.h"
|
||||
@ -87,10 +88,27 @@ static const gchar *
|
||||
gtk_switch_action_get_name (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i != 0)
|
||||
return NULL;
|
||||
if (i == 0)
|
||||
return "toggle";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return "toggle";
|
||||
static const gchar *
|
||||
gtk_switch_action_get_localized_name (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action name", "Toggle");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
gtk_switch_action_get_description (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action description", "Toggles the switch");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -122,4 +140,6 @@ atk_action_interface_init (AtkActionIface *iface)
|
||||
iface->do_action = gtk_switch_action_do_action;
|
||||
iface->get_n_actions = gtk_switch_action_get_n_actions;
|
||||
iface->get_name = gtk_switch_action_get_name;
|
||||
iface->get_localized_name = gtk_switch_action_get_localized_name;
|
||||
iface->get_description = gtk_switch_action_get_description;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user