mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-19 09:50:06 +00:00
bb1824c131
Deprecate widget flag macros GTK_WIDGET_STATE, GTK_WIDGET_SAVED_STATE, GTK_WIDGET_FLAGS, GTK_WIDGET_TOPLEVEL, GTK_WIDGET_NO_WINDOW and GTK_WIDGET_COMPOSITE_CHILD. Also deprecate the type macros GTK_WIDGET_TYPE, GTK_OBJECT_TYPE_NAME and GTK_OBJECT_TYPE which have become redundant. Instances of GTK_WIDGET_TOPLEVEL are replaced with gtk_widget_is_toplevel, GTK_WIDGET_TYPE is replaced with G_OBJECT_TYPE, GTK_WIDGET_COMPOSITE_CHILD is replaced with use of the "composite-child" property and uses of GTK_WIDGET_NO_WINDOW are adjusted to use gtk_widget_get_has_window. Uses of GTK_WIDGET_SAVED_STATE and GTK_WIDGET_FLAGS inside GtkWidget are changed to direct flag usage. Documentation is updated to refer to gtk_widget_set_has_window and gtk_widget_get_has_window. Gail and tests are updated as well. Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=69872
88 lines
2.3 KiB
C
88 lines
2.3 KiB
C
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <gtk/gtk.h>
|
|
#include "testlib.h"
|
|
|
|
/*
|
|
* This module is used to test the implementation of AtkAction,
|
|
* i.e. the getting of the name and the getting and setting of description
|
|
*/
|
|
|
|
static void _create_event_watcher (void);
|
|
static void _check_object (AtkObject *obj);
|
|
|
|
static void
|
|
_check_object (AtkObject *obj)
|
|
{
|
|
G_CONST_RETURN char *accessible_name;
|
|
G_CONST_RETURN gchar * typename = NULL;
|
|
|
|
if (GTK_IS_ACCESSIBLE (obj))
|
|
{
|
|
GtkWidget* widget = NULL;
|
|
|
|
widget = GTK_ACCESSIBLE (obj)->widget;
|
|
typename = g_type_name (G_OBJECT_TYPE (widget));
|
|
g_print ("Widget type name: %s\n", typename ? typename : "NULL");
|
|
}
|
|
typename = g_type_name (G_OBJECT_TYPE (obj));
|
|
g_print ("Accessible type name: %s\n", typename ? typename : "NULL");
|
|
accessible_name = atk_object_get_name (obj);
|
|
if (accessible_name)
|
|
g_print ("Name: %s\n", accessible_name);
|
|
|
|
if (ATK_IS_ACTION (obj))
|
|
{
|
|
AtkAction *action = ATK_ACTION (obj);
|
|
gint n_actions, i;
|
|
G_CONST_RETURN gchar *action_name;
|
|
G_CONST_RETURN gchar *action_desc;
|
|
G_CONST_RETURN gchar *action_binding;
|
|
const gchar *desc = "Test description";
|
|
|
|
n_actions = atk_action_get_n_actions (action);
|
|
g_print ("AtkAction supported number of actions: %d\n", n_actions);
|
|
for (i = 0; i < n_actions; i++)
|
|
{
|
|
action_name = atk_action_get_name (action, i);
|
|
g_print ("Name of Action %d: %s\n", i, action_name);
|
|
action_binding = atk_action_get_keybinding (action, i);
|
|
if (action_binding)
|
|
g_print ("Name of Action Keybinding %d: %s\n", i, action_binding);
|
|
|
|
if (!atk_action_set_description (action, i, desc))
|
|
{
|
|
g_print ("atk_action_set_description failed\n");
|
|
}
|
|
else
|
|
{
|
|
action_desc = atk_action_get_description (action, i);
|
|
if (strcmp (desc, action_desc) != 0)
|
|
{
|
|
g_print ("Problem with setting and getting action description\n");
|
|
}
|
|
}
|
|
}
|
|
if (atk_action_set_description (action, n_actions, desc))
|
|
{
|
|
g_print ("atk_action_set_description succeeded but should not have\n");
|
|
}
|
|
}
|
|
}
|
|
|
|
static void
|
|
_create_event_watcher (void)
|
|
{
|
|
atk_add_focus_tracker (_check_object);
|
|
}
|
|
|
|
int
|
|
gtk_module_init(gint argc, char* argv[])
|
|
{
|
|
g_print("testaction Module loaded\n");
|
|
|
|
_create_event_watcher();
|
|
|
|
return 0;
|
|
}
|