[gtk+] Convert GailPaned to GtkPanedAccessible
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Convert GailPaned to GtkPanedAccessible
- Date: Tue, 5 Jul 2011 20:32:17 +0000 (UTC)
commit c750139c851f38cb13d5044257bc29f30b32dc3f
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Jun 27 22:55:54 2011 -0400
Convert GailPaned to GtkPanedAccessible
gtk/a11y/Makefile.am | 4 +-
gtk/a11y/gail.c | 6 --
gtk/a11y/gailpaned.h | 51 ------------
gtk/a11y/{gailpaned.c => gtkpanedaccessible.c} | 97 +++++++++--------------
gtk/a11y/gtkpanedaccessible.h | 51 ++++++++++++
gtk/gtkpaned.c | 3 +-
6 files changed, 93 insertions(+), 119 deletions(-)
---
diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am
index 80f1df1..1756bef 100644
--- a/gtk/a11y/Makefile.am
+++ b/gtk/a11y/Makefile.am
@@ -29,7 +29,7 @@ gail_c_sources = \
gailmenuitem.c \
gailnotebook.c \
gailnotebookpage.c \
- gailpaned.c \
+ gtkpanedaccessible.c \
gtkprogressbaraccessible.c \
gailradiobutton.c \
gailradiomenuitem.c \
@@ -81,7 +81,7 @@ gail_private_h_sources = \
gailmenuitem.h \
gailnotebook.h \
gailnotebookpage.h \
- gailpaned.h \
+ gtkpanedaccessible.h \
gtkprogressbaraccessible.h \
gailradiobutton.h \
gailradiomenuitem.h \
diff --git a/gtk/a11y/gail.c b/gtk/a11y/gail.c
index 0aeb9d3..3c4e13b 100644
--- a/gtk/a11y/gail.c
+++ b/gtk/a11y/gail.c
@@ -37,11 +37,9 @@
#include "gailmenushell.h"
#include "gailmenuitem.h"
#include "gailnotebook.h"
-#include "gailpaned.h"
#include "gailradiobutton.h"
#include "gailradiomenuitem.h"
#include "gailrenderercell.h"
-#include "gailrange.h"
#include "gailscalebutton.h"
#include "gailscrolledwindow.h"
#include "gailstatusbar.h"
@@ -108,14 +106,12 @@ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_COMBO_BOX, GailComboBox, gail_combo_box, GTK_T
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_MENU_SHELL, GailMenuShell, gail_menu_shell, GTK_TYPE_MENU_SHELL)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_MENU, GailMenu, gail_menu, GTK_TYPE_MENU)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_WINDOW, GailWindow, gail_window, GTK_TYPE_BIN)
-GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_RANGE, GailRange, gail_range, GTK_TYPE_RANGE)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SCALE_BUTTON, GailScaleButton, gail_scale_button, GTK_TYPE_SCALE_BUTTON)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_STATUSBAR, GailStatusbar, gail_statusbar, GTK_TYPE_STATUSBAR)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_NOTEBOOK, GailNotebook, gail_notebook, GTK_TYPE_NOTEBOOK)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_TREE_VIEW, GailTreeView, gail_tree_view, GTK_TYPE_TREE_VIEW)
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_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)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_EXPANDER, GailExpander, gail_expander, GTK_TYPE_EXPANDER)
@@ -872,7 +868,6 @@ gail_accessibility_module_init (void)
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_MENU_BAR, gail_menu_shell);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_MENU, gail_menu);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_WINDOW, gail_window);
- GAIL_WIDGET_SET_FACTORY (GTK_TYPE_RANGE, gail_range);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SCALE_BUTTON, gail_scale_button);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_STATUSBAR, gail_statusbar);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_NOTEBOOK, gail_notebook);
@@ -883,7 +878,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_CHECK_MENU_ITEM, gail_check_menu_item);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_RADIO_MENU_ITEM, gail_radio_menu_item);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_EXPANDER, gail_expander);
diff --git a/gtk/a11y/gailpaned.c b/gtk/a11y/gtkpanedaccessible.c
similarity index 53%
rename from gtk/a11y/gailpaned.c
rename to gtk/a11y/gtkpanedaccessible.c
index 7f91f13..9390870 100644
--- a/gtk/a11y/gailpaned.c
+++ b/gtk/a11y/gtkpanedaccessible.c
@@ -21,85 +21,58 @@
#include <string.h>
#include <gtk/gtk.h>
-#include "gailpaned.h"
-
-static void gail_paned_class_init (GailPanedClass *klass);
-
-static void gail_paned_init (GailPaned *paned);
-
-static void gail_paned_real_initialize (AtkObject *obj,
- gpointer data);
-static void gail_paned_size_allocate_gtk (GtkWidget *widget,
- GtkAllocation *allocation);
-static void atk_value_interface_init (AtkValueIface *iface);
-static void gail_paned_get_current_value (AtkValue *obj,
- GValue *value);
-static void gail_paned_get_maximum_value (AtkValue *obj,
- GValue *value);
-static void gail_paned_get_minimum_value (AtkValue *obj,
- GValue *value);
-static gboolean gail_paned_set_current_value (AtkValue *obj,
- const GValue *value);
-
-G_DEFINE_TYPE_WITH_CODE (GailPaned, gail_paned, GAIL_TYPE_CONTAINER,
- G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
+#include "gtkpanedaccessible.h"
-static void
-gail_paned_class_init (GailPanedClass *klass)
-{
- AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+static void atk_value_interface_init (AtkValueIface *iface);
- class->initialize = gail_paned_real_initialize;
-}
+G_DEFINE_TYPE_WITH_CODE (GtkPanedAccessible, gtk_paned_accessible, GAIL_TYPE_CONTAINER,
+ G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
static void
-gail_paned_init (GailPaned *paned)
+gtk_paned_accessible_size_allocate_gtk (GtkWidget *widget,
+ GtkAllocation *allocation)
{
+ AtkObject *obj = gtk_widget_get_accessible (widget);
+
+ g_object_notify (G_OBJECT (obj), "accessible-value");
}
static void
-gail_paned_real_initialize (AtkObject *obj,
- gpointer data)
+gtk_paned_accessible_initialize (AtkObject *obj,
+ gpointer data)
{
- ATK_OBJECT_CLASS (gail_paned_parent_class)->initialize (obj, data);
+ ATK_OBJECT_CLASS (gtk_paned_accessible_parent_class)->initialize (obj, data);
g_signal_connect (data,
"size_allocate",
- G_CALLBACK (gail_paned_size_allocate_gtk),
+ G_CALLBACK (gtk_paned_accessible_size_allocate_gtk),
NULL);
obj->role = ATK_ROLE_SPLIT_PANE;
}
-
+
static void
-gail_paned_size_allocate_gtk (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_paned_accessible_class_init (GtkPanedAccessibleClass *klass)
{
- AtkObject *obj = gtk_widget_get_accessible (widget);
+ AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
- g_object_notify (G_OBJECT (obj), "accessible-value");
+ class->initialize = gtk_paned_accessible_initialize;
}
-
static void
-atk_value_interface_init (AtkValueIface *iface)
+gtk_paned_accessible_init (GtkPanedAccessible *paned)
{
- iface->get_current_value = gail_paned_get_current_value;
- iface->get_maximum_value = gail_paned_get_maximum_value;
- iface->get_minimum_value = gail_paned_get_minimum_value;
- iface->set_current_value = gail_paned_set_current_value;
}
static void
-gail_paned_get_current_value (AtkValue *obj,
- GValue *value)
+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)
- /* State is defunct */
return;
current_value = gtk_paned_get_position (GTK_PANED (widget));
@@ -109,15 +82,14 @@ gail_paned_get_current_value (AtkValue *obj,
}
static void
-gail_paned_get_maximum_value (AtkValue *obj,
- GValue *value)
+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)
- /* State is defunct */
return;
g_object_get (GTK_PANED (widget),
@@ -129,15 +101,14 @@ gail_paned_get_maximum_value (AtkValue *obj,
}
static void
-gail_paned_get_minimum_value (AtkValue *obj,
- GValue *value)
+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)
- /* State is defunct */
return;
g_object_get (GTK_PANED (widget),
@@ -149,22 +120,21 @@ gail_paned_get_minimum_value (AtkValue *obj,
}
/*
- * Calling atk_value_set_current_value() is no guarantee that the value is
- * acceptable; it is necessary to listen for accessible-value signals
- * and check whether the current value has been changed or check what the
+ * Calling atk_value_set_current_value() is no guarantee that the value
+ * is acceptable; it is necessary to listen for accessible-value signals
+ * and check whether the current value has been changed or check what the
* maximum and minimum values are.
*/
static gboolean
-gail_paned_set_current_value (AtkValue *obj,
- const GValue *value)
+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)
- /* State is defunct */
return FALSE;
if (G_VALUE_HOLDS_INT (value))
@@ -177,3 +147,12 @@ gail_paned_set_current_value (AtkValue *obj,
else
return FALSE;
}
+
+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;
+}
diff --git a/gtk/a11y/gtkpanedaccessible.h b/gtk/a11y/gtkpanedaccessible.h
new file mode 100644
index 0000000..e255ec2
--- /dev/null
+++ b/gtk/a11y/gtkpanedaccessible.h
@@ -0,0 +1,51 @@
+/* GAIL - The GNOME Accessibility Implementation Library
+ * 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GTK_PANED_ACCESSIBLE_H__
+#define __GTK_PANED_ACCESSIBLE_H__
+
+#include "gailcontainer.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_IS_PANED_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PANED_ACCESSIBLE))
+#define GTK_IS_PANED_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PANED_ACCESSIBLE))
+#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
+{
+ GailContainer parent;
+};
+
+struct _GtkPanedAccessibleClass
+{
+ GailContainerClass parent_class;
+};
+
+GType gtk_paned_accessible_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GTK_PANED_ACCESSIBLE_H__ */
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index f997210..e2e761f 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -36,7 +36,7 @@
#include "gtktypebuiltins.h"
#include "gtkprivate.h"
#include "gtkintl.h"
-
+#include "a11y/gtkpanedaccessible.h"
/**
* SECTION:gtkpaned
@@ -653,6 +653,7 @@ gtk_paned_class_init (GtkPanedClass *class)
add_move_binding (binding_set, GDK_KEY_KP_End, 0, GTK_SCROLL_END);
g_type_class_add_private (object_class, sizeof (GtkPanedPrivate));
+ gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_PANED_ACCESSIBLE);
}
static GType
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]