mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
GtkNotebookPageAccessible: add a private struct
Move instance fields to a private struct, in preparation for installing a11y headers.
This commit is contained in:
parent
c86628b41e
commit
0ea0293356
@ -22,6 +22,12 @@
|
||||
#include "gtknotebookpageaccessible.h"
|
||||
|
||||
|
||||
struct _GtkNotebookPageAccessiblePrivate
|
||||
{
|
||||
GtkAccessible *notebook;
|
||||
GtkWidget *child;
|
||||
};
|
||||
|
||||
static void atk_component_interface_init (AtkComponentIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkNotebookPageAccessible, _gtk_notebook_page_accessible, ATK_TYPE_OBJECT,
|
||||
@ -62,14 +68,14 @@ get_label_from_notebook_page (GtkNotebookPageAccessible *page)
|
||||
GtkWidget *child;
|
||||
GtkNotebook *notebook;
|
||||
|
||||
notebook = GTK_NOTEBOOK (gtk_accessible_get_widget (page->notebook));
|
||||
notebook = GTK_NOTEBOOK (gtk_accessible_get_widget (page->priv->notebook));
|
||||
if (!notebook)
|
||||
return NULL;
|
||||
|
||||
if (!gtk_notebook_get_show_tabs (notebook))
|
||||
return NULL;
|
||||
|
||||
child = gtk_notebook_get_tab_label (notebook, page->child);
|
||||
child = gtk_notebook_get_tab_label (notebook, page->priv->child);
|
||||
|
||||
if (GTK_IS_LABEL (child))
|
||||
return child;
|
||||
@ -102,7 +108,7 @@ gtk_notebook_page_accessible_get_parent (AtkObject *accessible)
|
||||
|
||||
page = GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible);
|
||||
|
||||
return ATK_OBJECT (page->notebook);
|
||||
return ATK_OBJECT (page->priv->notebook);
|
||||
}
|
||||
|
||||
static gint
|
||||
@ -122,10 +128,10 @@ gtk_notebook_page_accessible_ref_child (AtkObject *accessible,
|
||||
return NULL;
|
||||
|
||||
page = GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible);
|
||||
if (!page->child)
|
||||
if (!page->priv->child)
|
||||
return NULL;
|
||||
|
||||
child_obj = gtk_widget_get_accessible (page->child);
|
||||
child_obj = gtk_widget_get_accessible (page->priv->child);
|
||||
g_object_ref (child_obj);
|
||||
|
||||
return child_obj;
|
||||
@ -180,11 +186,11 @@ gtk_notebook_page_accessible_get_index_in_parent (AtkObject *accessible)
|
||||
GtkNotebookPageAccessible *page;
|
||||
|
||||
page = GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible);
|
||||
if (!page->child)
|
||||
if (!page->priv->child)
|
||||
return -1;
|
||||
|
||||
return gtk_notebook_page_num (GTK_NOTEBOOK (gtk_accessible_get_widget (page->notebook)),
|
||||
page->child);
|
||||
return gtk_notebook_page_num (GTK_NOTEBOOK (gtk_accessible_get_widget (page->priv->notebook)),
|
||||
page->priv->child);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -198,11 +204,16 @@ _gtk_notebook_page_accessible_class_init (GtkNotebookPageAccessibleClass *klass)
|
||||
class->ref_child = gtk_notebook_page_accessible_ref_child;
|
||||
class->ref_state_set = gtk_notebook_page_accessible_ref_state_set;
|
||||
class->get_index_in_parent = gtk_notebook_page_accessible_get_index_in_parent;
|
||||
|
||||
g_type_class_add_private (klass, sizeof (GtkNotebookPageAccessiblePrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
_gtk_notebook_page_accessible_init (GtkNotebookPageAccessible *page)
|
||||
{
|
||||
page->priv = G_TYPE_INSTANCE_GET_PRIVATE (page,
|
||||
GTK_TYPE_NOTEBOOK_PAGE_ACCESSIBLE,
|
||||
GtkNotebookPageAccessiblePrivate);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -229,8 +240,8 @@ _gtk_notebook_page_accessible_new (GtkNotebookAccessible *notebook,
|
||||
object = g_object_new (GTK_TYPE_NOTEBOOK_PAGE_ACCESSIBLE, NULL);
|
||||
|
||||
page = GTK_NOTEBOOK_PAGE_ACCESSIBLE (object);
|
||||
page->notebook = GTK_ACCESSIBLE (notebook);
|
||||
page->child = child;
|
||||
page->priv->notebook = GTK_ACCESSIBLE (notebook);
|
||||
page->priv->child = child;
|
||||
|
||||
atk_object = ATK_OBJECT (page);
|
||||
atk_object->role = ATK_ROLE_PAGE_TAB;
|
||||
@ -238,7 +249,7 @@ _gtk_notebook_page_accessible_new (GtkNotebookAccessible *notebook,
|
||||
|
||||
atk_object_set_parent (gtk_widget_get_accessible (child), atk_object);
|
||||
|
||||
g_signal_connect (gtk_accessible_get_widget (page->notebook),
|
||||
g_signal_connect (gtk_accessible_get_widget (page->priv->notebook),
|
||||
"child-notify::tab-label",
|
||||
G_CALLBACK (notify_tab_label), page);
|
||||
|
||||
@ -251,15 +262,15 @@ _gtk_notebook_page_accessible_invalidate (GtkNotebookPageAccessible *page)
|
||||
AtkObject *obj = ATK_OBJECT (page);
|
||||
GtkWidget *notebook;
|
||||
|
||||
notebook = gtk_accessible_get_widget (page->notebook);
|
||||
notebook = gtk_accessible_get_widget (page->priv->notebook);
|
||||
if (notebook)
|
||||
g_signal_handlers_disconnect_by_func (notebook, notify_tab_label, page);
|
||||
|
||||
atk_object_notify_state_change (obj, ATK_STATE_DEFUNCT, TRUE);
|
||||
atk_object_set_parent (obj, NULL);
|
||||
page->notebook = NULL;
|
||||
atk_object_set_parent (gtk_widget_get_accessible (page->child), NULL);
|
||||
page->child = NULL;
|
||||
page->priv->notebook = NULL;
|
||||
atk_object_set_parent (gtk_widget_get_accessible (page->priv->child), NULL);
|
||||
page->priv->child = NULL;
|
||||
}
|
||||
|
||||
static AtkObject*
|
||||
|
@ -29,15 +29,15 @@ G_BEGIN_DECLS
|
||||
#define GTK_IS_NOTEBOOK_PAGE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_NOTEBOOK_PAGE_ACCESSIBLE))
|
||||
#define GTK_NOTEBOOK_PAGE_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_NOTEBOOK_PAGE_ACCESSIBLE, GtkNotebookPageAccessibleClass))
|
||||
|
||||
typedef struct _GtkNotebookPageAccessible GtkNotebookPageAccessible;
|
||||
typedef struct _GtkNotebookPageAccessibleClass GtkNotebookPageAccessibleClass;
|
||||
typedef struct _GtkNotebookPageAccessible GtkNotebookPageAccessible;
|
||||
typedef struct _GtkNotebookPageAccessibleClass GtkNotebookPageAccessibleClass;
|
||||
typedef struct _GtkNotebookPageAccessiblePrivate GtkNotebookPageAccessiblePrivate;
|
||||
|
||||
struct _GtkNotebookPageAccessible
|
||||
{
|
||||
AtkObject parent;
|
||||
|
||||
GtkAccessible *notebook;
|
||||
GtkWidget *child;
|
||||
GtkNotebookPageAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkNotebookPageAccessibleClass
|
||||
|
Loading…
Reference in New Issue
Block a user