[gtk+/drop-gail: 19/24] Move GailPaned to GtkPanedAccessible
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/drop-gail: 19/24] Move GailPaned to GtkPanedAccessible
- Date: Sun, 15 May 2011 02:13:41 +0000 (UTC)
commit 7ef45b49d89f09709e378cce9aa4c5f1dd544d8c
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Feb 24 23:55:15 2011 -0500
Move GailPaned to GtkPanedAccessible
gtk/Makefile.am | 1 +
gtk/gtkpaned.c | 133 +++++++++++++++++++++++++++++++++++++++++++++
gtk/gtkpanedaccessible.h | 57 +++++++++++++++++++
modules/other/gail/gail.c | 6 ++-
4 files changed, 195 insertions(+), 2 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index fc59795..b40b81c 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -418,6 +418,7 @@ gtk_private_h_sources = \
gtknumerableiconprivate.h \
gtkorientableprivate.h \
gtkpango.h \
+ gtkpanedaccessible.h \
gtkpathbar.h \
gtkprintoperation-private.h \
gtkprintutils.h \
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 0fe290e..66a4aab 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -2756,3 +2756,136 @@ gtk_paned_get_handle_window (GtkPaned *paned)
return paned->priv->handle;
}
+
+/* --- Accessibility --- */
+
+#include "gtkaccessibility.h"
+#include "gtkpanedaccessible.h"
+
+static void atk_value_interface_init (AtkValueIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GtkPanedAccessible, gtk_paned_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE,
+ G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
+
+static void
+gtk_paned_accessible_size_allocate_cb (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ AtkObject *obj = gtk_widget_get_accessible (widget);
+
+ g_object_notify (G_OBJECT (obj), "accessible-value");
+}
+
+static void
+gtk_paned_accessible_initialize (AtkObject *accessible,
+ gpointer data)
+{
+ ATK_OBJECT_CLASS (gtk_paned_accessible_parent_class)->initialize (accessible, data);
+ atk_object_set_role (accessible, ATK_ROLE_SPLIT_PANE);
+
+ g_signal_connect (data, "size_allocate",
+ G_CALLBACK (gtk_paned_accessible_size_allocate_cb),
+ NULL);
+}
+
+static void
+gtk_paned_accessible_class_init (GtkPanedAccessibleClass *klass)
+{
+ AtkObjectClass *atkobject_class = ATK_OBJECT_CLASS (klass);
+
+ atkobject_class->initialize = gtk_paned_accessible_initialize;
+}
+
+static void
+gtk_paned_accessible_init (GtkPanedAccessible *accessible)
+{
+}
+
+static void
+gtk_paned_accessible_get_current_value (AtkValue *obj,
+ GValue *value)
+{
+ GtkWidget* widget;
+ gint current_value;
+
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+ if (widget == NULL)
+ return;
+
+ current_value = gtk_paned_get_position (GTK_PANED (widget));
+
+ memset (value, 0, sizeof (GValue));
+ g_value_init (value, G_TYPE_INT);
+ g_value_set_int (value, current_value);
+}
+
+static void
+gtk_paned_accessible_get_maximum_value (AtkValue *obj,
+ GValue *value)
+{
+ GtkWidget* widget;
+ gint maximum_value;
+
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+ if (widget == NULL)
+ return;
+
+ g_object_get (GTK_PANED (widget),
+ "max-position", &maximum_value,
+ NULL);
+
+ memset (value, 0, sizeof (GValue));
+ g_value_init (value, G_TYPE_INT);
+ g_value_set_int (value, maximum_value);
+}
+
+static void
+gtk_paned_accessible_get_minimum_value (AtkValue *obj,
+ GValue *value)
+{
+ GtkWidget* widget;
+ gint minimum_value;
+
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+ if (widget == NULL)
+ return;
+
+ g_object_get (GTK_PANED (widget),
+ "min-position", &minimum_value,
+ NULL);
+
+ memset (value, 0, sizeof (GValue));
+ g_value_init (value, G_TYPE_INT);
+ g_value_set_int (value, minimum_value);
+}
+
+static gboolean
+gtk_paned_accessible_set_current_value (AtkValue *obj,
+ const GValue *value)
+{
+ GtkWidget* widget;
+ gint new_value;
+
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+ if (widget == NULL)
+ return FALSE;
+
+ if (!G_VALUE_HOLDS_INT (value))
+ return FALSE;
+
+ new_value = g_value_get_int (value);
+ gtk_paned_set_position (GTK_PANED (widget), new_value);
+
+ return TRUE;
+}
+
+static void
+atk_value_interface_init (AtkValueIface *iface)
+{
+ iface->get_current_value = gtk_paned_accessible_get_current_value;
+ iface->get_maximum_value = gtk_paned_accessible_get_maximum_value;
+ iface->get_minimum_value = gtk_paned_accessible_get_minimum_value;
+ iface->set_current_value = gtk_paned_accessible_set_current_value;
+}
+
+GTK_ACCESSIBLE_FACTORY(GTK_TYPE_PANED_ACCESSIBLE, gtk_paned_accessible)
diff --git a/gtk/gtkpanedaccessible.h b/gtk/gtkpanedaccessible.h
new file mode 100644
index 0000000..b0c3c5a
--- /dev/null
+++ b/gtk/gtkpanedaccessible.h
@@ -0,0 +1,57 @@
+/* GTK - The GIMP Toolkit
+ * Copyright 2011 Red Hat, 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_PANED_ACCESSIBLE_H__
+#define __GTK_PANED_ACCESSIBLE_H__
+
+#include <gtk/gtkcontaineraccessible.h>
+#include <gtk/gtkpaned.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_PANED_ACCESSIBLE (gtk_paned_accessible_get_type ())
+#define GTK_PANED_ACCESSIBLE(obj)(G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PANED_ACCESSIBLE, GtkPanedAccessible))
+#define GTK_PANED_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PANED_ACCESSIBLE, GtkPanedAccessibleClass))
+#define GTK_PANED_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PANED_ACCESSIBLE, GtkPanedAccessibleClass))
+
+typedef struct _GtkPanedAccessible GtkPanedAccessible;
+typedef struct _GtkPanedAccessibleClass GtkPanedAccessibleClass;
+
+struct _GtkPanedAccessible
+{
+ GtkContainerAccessible parent;
+};
+
+struct _GtkPanedAccessibleClass
+{
+ GtkContainerAccessibleClass parent_class;
+};
+
+
+GType gtk_paned_accessible_get_type (void) G_GNUC_CONST;
+GType gtk_paned_accessible_factory_get_type (void) G_GNUC_CONST;
+
+
+G_END_DECLS
+
+#endif /* __GTK_PANED_ACCESSIBLE_H__ */
diff --git a/modules/other/gail/gail.c b/modules/other/gail/gail.c
index 01e4480..73fac3c 100644
--- a/modules/other/gail/gail.c
+++ b/modules/other/gail/gail.c
@@ -29,6 +29,7 @@
#include <gtk/gtkcalendaraccessible.h>
#include <gtk/gtkcontaineraccessible.h>
#include <gtk/gtkimageaccessible.h>
+#include <gtk/gtkpanedaccessible.h>
#include <gtk/gtkprogressbaraccessible.h>
#include <gtk/gtkseparatoraccessible.h>
#include <gtk/gtkwidgetaccessible.h>
@@ -103,7 +104,6 @@ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_TREE_VIEW, GailTreeView, gail_tree_view, GTK_T
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_FRAME, GailFrame, gail_frame, GTK_TYPE_FRAME)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_RADIO_BUTTON, GailRadioButton, gail_radio_button, GTK_TYPE_RADIO_BUTTON)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SCROLLED_WINDOW, GailScrolledWindow, gail_scrolled_window, GTK_TYPE_SCROLLED_WINDOW)
-GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_PANED, GailPaned, gail_paned, GTK_TYPE_PANED)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SCROLLBAR, GailScrollbar, gail_scrollbar, GTK_TYPE_SCROLLBAR)
GAIL_IMPLEMENT_FACTORY_WITH_FUNC (GAIL_TYPE_CHECK_MENU_ITEM, GailCheckMenuItem, gail_check_menu_item, gail_check_menu_item_new)
GAIL_IMPLEMENT_FACTORY_WITH_FUNC (GAIL_TYPE_RADIO_MENU_ITEM, GailRadioMenuItem, gail_radio_menu_item, gail_radio_menu_item_new)
@@ -908,6 +908,9 @@ gail_accessibility_module_init (void)
atk_registry_set_factory_type (atk_get_default_registry (),
GTK_TYPE_BOX,
gtk_box_accessible_factory_get_type ());
+ atk_registry_set_factory_type (atk_get_default_registry (),
+ GTK_TYPE_PANED,
+ gtk_paned_accessible_factory_get_type ());
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_BUTTON, gail_button);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_LINK_BUTTON, gail_link_button);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_MENU_ITEM, gail_menu_item);
@@ -933,7 +936,6 @@ gail_accessibility_module_init (void)
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER, gail_renderer_cell);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_RADIO_BUTTON, gail_radio_button);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SCROLLED_WINDOW, gail_scrolled_window);
- GAIL_WIDGET_SET_FACTORY (GTK_TYPE_PANED, gail_paned);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SCROLLBAR, gail_scrollbar);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CHECK_MENU_ITEM, gail_check_menu_item);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_RADIO_MENU_ITEM, gail_radio_menu_item);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]