Commit a166051b authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Convert GailProgressBar to GtkProgressBarAccessible

parent 87195bc3
......@@ -30,7 +30,7 @@ gail_c_sources = \
gailnotebook.c \
gailnotebookpage.c \
gailpaned.c \
gailprogressbar.c \
gtkprogressbaraccessible.c \
gailradiobutton.c \
gailradiomenuitem.c \
gailradiosubmenuitem.c \
......@@ -82,7 +82,7 @@ gail_private_h_sources = \
gailnotebook.h \
gailnotebookpage.h \
gailpaned.h \
gailprogressbar.h \
gtkprogressbaraccessible.h \
gailradiobutton.h \
gailradiomenuitem.h \
gailradiosubmenuitem.h \
......
......@@ -40,7 +40,6 @@
#include "gailmenuitem.h"
#include "gailnotebook.h"
#include "gailpaned.h"
#include "gailprogressbar.h"
#include "gailradiobutton.h"
#include "gailradiomenuitem.h"
#include "gailrenderercell.h"
......@@ -117,7 +116,6 @@ 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_PROGRESS_BAR, GailProgressBar, gail_progress_bar, GTK_TYPE_PROGRESS_BAR)
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)
......@@ -884,7 +882,6 @@ gail_accessibility_module_init (void)
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);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_PROGRESS_BAR, gail_progress_bar);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_TREE_VIEW, gail_tree_view);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_TEXT, gail_text_cell);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_TOGGLE, gail_boolean_cell);
......
......@@ -23,73 +23,62 @@
#include <gtk/gtk.h>
#include "gailprogressbar.h"
#include "gtkprogressbaraccessible.h"
#include "gailadjustment.h"
static void gail_progress_bar_class_init (GailProgressBarClass *klass);
static void gail_progress_bar_init (GailProgressBar *bar);
static void gail_progress_bar_real_initialize (AtkObject *obj,
gpointer data);
static void atk_value_interface_init (AtkValueIface *iface);
static void atk_value_interface_init (AtkValueIface *iface);
static void gail_progress_bar_real_notify_gtk (GObject *obj,
GParamSpec *pspec);
static void gail_progress_bar_get_current_value (AtkValue *obj,
GValue *value);
static void gail_progress_bar_get_maximum_value (AtkValue *obj,
GValue *value);
static void gail_progress_bar_get_minimum_value (AtkValue *obj,
GValue *value);
G_DEFINE_TYPE_WITH_CODE (GailProgressBar, gail_progress_bar, GAIL_TYPE_WIDGET,
G_DEFINE_TYPE_WITH_CODE (GtkProgressBarAccessible, gtk_progress_bar_accessible, GAIL_TYPE_WIDGET,
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
static void
gail_progress_bar_class_init (GailProgressBarClass *klass)
gtk_progress_bar_accessible_initialize (AtkObject *obj,
gpointer data)
{
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
GailWidgetClass *widget_class;
widget_class = (GailWidgetClass*)klass;
widget_class->notify_gtk = gail_progress_bar_real_notify_gtk;
ATK_OBJECT_CLASS (gtk_progress_bar_accessible_parent_class)->initialize (obj, data);
class->initialize = gail_progress_bar_real_initialize;
obj->role = ATK_ROLE_PROGRESS_BAR;
}
static void
gail_progress_bar_init (GailProgressBar *bar)
gtk_progress_bar_accessible_notify_gtk (GObject *obj,
GParamSpec *pspec)
{
}
GtkWidget *widget = GTK_WIDGET (obj);
AtkObject *accessible;
accessible = gtk_widget_get_accessible (widget);
if (strcmp (pspec->name, "fraction") == 0)
g_object_notify (G_OBJECT (accessible), "accessible-value");
else
GAIL_WIDGET_CLASS (gtk_progress_bar_accessible_parent_class)->notify_gtk (obj, pspec);
}
static void
gail_progress_bar_real_initialize (AtkObject *obj,
gpointer data)
gtk_progress_bar_accessible_class_init (GtkProgressBarAccessibleClass *klass)
{
ATK_OBJECT_CLASS (gail_progress_bar_parent_class)->initialize (obj, data);
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
GailWidgetClass *widget_class;
obj->role = ATK_ROLE_PROGRESS_BAR;
widget_class = (GailWidgetClass*)klass;
widget_class->notify_gtk = gtk_progress_bar_accessible_notify_gtk;
class->initialize = gtk_progress_bar_accessible_initialize;
}
static void
atk_value_interface_init (AtkValueIface *iface)
gtk_progress_bar_accessible_init (GtkProgressBarAccessible *bar)
{
iface->get_current_value = gail_progress_bar_get_current_value;
iface->get_maximum_value = gail_progress_bar_get_maximum_value;
iface->get_minimum_value = gail_progress_bar_get_minimum_value;
}
static void
gail_progress_bar_get_current_value (AtkValue *obj,
GValue *value)
gtk_progress_bar_accessible_get_current_value (AtkValue *obj,
GValue *value)
{
GtkWidget *widget;
g_return_if_fail (GAIL_IS_PROGRESS_BAR (obj));
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
memset (value, 0, sizeof (GValue));
......@@ -98,36 +87,27 @@ gail_progress_bar_get_current_value (AtkValue *obj,
}
static void
gail_progress_bar_get_maximum_value (AtkValue *obj,
GValue *value)
gtk_progress_bar_accessible_get_maximum_value (AtkValue *obj,
GValue *value)
{
g_return_if_fail (GAIL_IS_PROGRESS_BAR (obj));
memset (value, 0, sizeof (GValue));
g_value_init (value, G_TYPE_DOUBLE);
g_value_set_double (value, 1.0);
}
static void
gail_progress_bar_get_minimum_value (AtkValue *obj,
GValue *value)
static void
gtk_progress_bar_accessible_get_minimum_value (AtkValue *obj,
GValue *value)
{
g_return_if_fail (GAIL_IS_PROGRESS_BAR (obj));
memset (value, 0, sizeof (GValue));
g_value_init (value, G_TYPE_DOUBLE);
g_value_set_double (value, 0.0);
}
static void
gail_progress_bar_real_notify_gtk (GObject *obj,
GParamSpec *pspec)
atk_value_interface_init (AtkValueIface *iface)
{
GtkWidget *widget = GTK_WIDGET (obj);
GailProgressBar *progress_bar = GAIL_PROGRESS_BAR (gtk_widget_get_accessible (widget));
if (strcmp (pspec->name, "fraction") == 0)
g_object_notify (G_OBJECT (progress_bar), "accessible-value");
else
GAIL_WIDGET_CLASS (gail_progress_bar_parent_class)->notify_gtk (obj, pspec);
iface->get_current_value = gtk_progress_bar_accessible_get_current_value;
iface->get_maximum_value = gtk_progress_bar_accessible_get_maximum_value;
iface->get_minimum_value = gtk_progress_bar_accessible_get_minimum_value;
}
......@@ -8,7 +8,7 @@
*
* 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
* 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
......@@ -17,35 +17,35 @@
* Boston, MA 02111-1307, USA.
*/
#ifndef __GAIL_PROGRESS_BAR_H__
#define __GAIL_PROGRESS_BAR_H__
#ifndef __GTK_PROGRESS_BAR_ACCESSIBLE_H__
#define __GTK_PROGRESS_BAR_ACCESSIBLE_H__
#include "gailwidget.h"
G_BEGIN_DECLS
#define GAIL_TYPE_PROGRESS_BAR (gail_progress_bar_get_type ())
#define GAIL_PROGRESS_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_PROGRESS_BAR, GailProgressBar))
#define GAIL_PROGRESS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_PROGRESS_BAR, GailProgressBarClass))
#define GAIL_IS_PROGRESS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_PROGRESS_BAR))
#define GAIL_IS_PROGRESS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_PROGRESS_BAR))
#define GAIL_PROGRESS_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_PROGRESS_BAR, GailProgressBarClass))
#define GTK_TYPE_PROGRESS_BAR_ACCESSIBLE (gtk_progress_bar_accessible_get_type ())
#define GTK_PROGRESS_BAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE, GtkProgressBarAccessible))
#define GTK_PROGRESS_BAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE, GtkProgressBarAccessibleClass))
#define GTK_IS_PROGRESS_BAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE))
#define GTK_IS_PROGRESS_BAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE))
#define GTK_PROGRESS_BAR_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE, GtkProgressBarAccessibleClass))
typedef struct _GailProgressBar GailProgressBar;
typedef struct _GailProgressBarClass GailProgressBarClass;
typedef struct _GtkProgressBarAccessible GtkProgressBarAccessible;
typedef struct _GtkProgressBarAccessibleClass GtkProgressBarAccessibleClass;
struct _GailProgressBar
struct _GtkProgressBarAccessible
{
GailWidget parent;
};
GType gail_progress_bar_get_type (void);
struct _GailProgressBarClass
struct _GtkProgressBarAccessibleClass
{
GailWidgetClass parent_class;
};
GType gtk_progress_bar_accessible_get_type (void);
G_END_DECLS
#endif /* __GAIL_PROGRESS_BAR_H__ */
#endif /* __GTK_PROGRESS_BAR_ACCESSIBLE_H__ */
......@@ -33,6 +33,8 @@
#include "gtkprivate.h"
#include "gtkintl.h"
#include "a11y/gtkprogressbaraccessible.h"
/**
* SECTION:gtkprogressbar
* @Short_description: A widget which indicates progress visually
......@@ -284,6 +286,8 @@ gtk_progress_bar_class_init (GtkProgressBarClass *class)
G_PARAM_READWRITE));
g_type_class_add_private (class, sizeof (GtkProgressBarPrivate));
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_PROGRESS_BAR_ACCESSIBLE);
}
static void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment