summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2001-11-27 17:49:53 +0000
committerMatt Wilson <msw@src.gnome.org>2001-11-27 17:49:53 +0000
commitaa5113459041cf86db2243a1e47e6c19f9a57b9a (patch)
tree409e665c0334116be1d52b1be3b37c2f0ba42b86
parent9299d897e9188b55b196174db2ffaf6e2a2d944f (diff)
downloadpygtk-aa5113459041cf86db2243a1e47e6c19f9a57b9a.tar.gz
added start of atk wrapper
2001-11-27 Matt Wilson <msw@redhat.com> * atk.defs, atk.override, atkmodule.c: added start of atk wrapper * gtk/Makefile.am (DISTCLEANFILES): remove generated files ($(srcdir)/gtk.c): modify targets to output generated files in the builddir, not the srcdir. ($(srcdir)/gdk.c): likewise. ($(srcdir)/libglade.c): likewise. * codegen/h2def.py (define_func): add check to workaround broken string.replace semantics on python 1.5 * codegen/codegen.py (write_enums): if the enum or flag doesn't have a GType, just add those enum values listed in the defs file by hand. * codegen/argtypes.py (ArgMatcher.register_enum): if defs file doesn't specify a GType for the enum, use G_TYPE_NONE. (ArgMatcher.register_flag): likewise. * gobjectmodule.c (pyg_enum_get_value): allow enums to pass G_TYPE_NONE in as the type, disabling the string to value conversion. (pyg_flags_get_value): likewise. (pyg_constant_strip_prefix): new function to combine common codepath. (pyg_enum_add_constants): use pyg_constant_strip_prefix (pyg_flags_add_constants): likewise. (functions): make pyg_constant_strip_prefix available to users of pygobject * pygobject.h: added pyg_constant_strip_prefix wrapper * configure.in: added ATK test, subst for ATK_CFLAGS and ATK_LIBS. * Makefile.am (%.c): added generic codegen target for pango and atk. Added DISTCLEANFILES so that generated files will be removed. Added atk targets, cflags, ldflags.
-rw-r--r--ChangeLog40
-rw-r--r--Makefile.am33
-rw-r--r--atk.defs1901
-rw-r--r--atk.override54
-rw-r--r--atkmodule.c31
-rw-r--r--codegen/argtypes.py6
-rw-r--r--codegen/codegen.py15
-rwxr-xr-xcodegen/h2def.py3
-rw-r--r--configure.in4
-rw-r--r--gobject/gobjectmodule.c89
-rw-r--r--gobject/pygobject.h4
-rw-r--r--gobjectmodule.c89
-rw-r--r--gtk/Makefile.am25
-rw-r--r--pygobject.h4
14 files changed, 2206 insertions, 92 deletions
diff --git a/ChangeLog b/ChangeLog
index 30ec65da..c2801298 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,43 @@
+2001-11-27 Matt Wilson <msw@redhat.com>
+
+ * atk.defs, atk.override, atkmodule.c: added start of atk wrapper
+
+ * gtk/Makefile.am (DISTCLEANFILES): remove generated files
+ ($(srcdir)/gtk.c): modify targets to output generated files in the
+ builddir, not the srcdir.
+ ($(srcdir)/gdk.c): likewise.
+ ($(srcdir)/libglade.c): likewise.
+
+ * codegen/h2def.py (define_func): add check to workaround broken
+ string.replace semantics on python 1.5
+
+ * codegen/codegen.py (write_enums): if the enum or flag doesn't
+ have a GType, just add those enum values listed in the defs file
+ by hand.
+
+ * codegen/argtypes.py (ArgMatcher.register_enum): if defs file
+ doesn't specify a GType for the enum, use G_TYPE_NONE.
+ (ArgMatcher.register_flag): likewise.
+
+ * gobjectmodule.c (pyg_enum_get_value): allow enums to pass
+ G_TYPE_NONE in as the type, disabling the string to value
+ conversion.
+ (pyg_flags_get_value): likewise.
+ (pyg_constant_strip_prefix): new function to combine common
+ codepath.
+ (pyg_enum_add_constants): use pyg_constant_strip_prefix
+ (pyg_flags_add_constants): likewise.
+ (functions): make pyg_constant_strip_prefix available to users of
+ pygobject
+
+ * pygobject.h: added pyg_constant_strip_prefix wrapper
+
+ * configure.in: added ATK test, subst for ATK_CFLAGS and ATK_LIBS.
+
+ * Makefile.am (%.c): added generic codegen target for pango and
+ atk. Added DISTCLEANFILES so that generated files will be
+ removed. Added atk targets, cflags, ldflags.
+
2001-11-26 Matt Wilson <msw@redhat.com>
* configure.in: bump up required versions of gtk, pango, and glib.
diff --git a/Makefile.am b/Makefile.am
index c42c47e7..49154b48 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,9 +3,9 @@ AUTOMAKE_OPTIONS = 1.5
SUBDIRS = codegen gtk
-INCLUDES = $(PYTHON_INCLUDES) $(GLIB_CFLAGS) $(PANGO_CFLAGS)
+INCLUDES = $(PYTHON_INCLUDES) $(GLIB_CFLAGS) $(PANGO_CFLAGS) $(ATK_CFLAGS)
-pyexec_LTLIBRARIES = gobjectmodule.la pangomodule.la
+pyexec_LTLIBRARIES = gobjectmodule.la pangomodule.la atkmodule.la
gobjectmodule_la_LDFLAGS = -module -avoid-version \
-export-symbols-regex initgobject
@@ -21,15 +21,22 @@ pangomodule_la_SOURCES = \
pango.c
pangomodule_la_LIBADD = $(PANGO_LIBS)
-$(srcdir)/pango.c: $(srcdir)/pango.defs $(srcdir)/pango-types.defs \
- $(srcdir)/pango.override
- -chmod a+w $(srcdir)
- cd $(srcdir) \
- && $(PYTHON) codegen/codegen.py \
- --override pango.override \
- --prefix pypango pango.defs > gen-pango.c \
- && cp gen-pango.c pango.c \
- && rm -f gen-pango.c
+atkmodule_la_LDFLAGS = -module -avoid-version -export-symbols-regex initatk
+atkmodule_la_SOURCES = \
+ atkmodule.c \
+ atk.c
+atkmodule_la_LIBADD = $(ATK_LIBS)
+
+%.c: $(srcdir)/%.defs $(srcdir)/%.override
+ (cd $(srcdir)\
+ && $(PYTHON) codegen/codegen.py \
+ --register pango-types.defs \
+ --register gtk/gdk-types.defs \
+ --register gtk/gtk-types.defs \
+ --override $*.override \
+ --prefix py$* $*.defs) > gen-$*.c \
+ && cp gen-$*.c $*.c \
+ && rm -f gen-$*.c
pkginclude_HEADERS = pygobject.h
pkgincludedir = $(includedir)/pygtk-2.0
@@ -39,6 +46,8 @@ noinst_PYTHON = ltihooks.py
dist-hook:
-rm -f $(distdir)/pango.c
+DISTCLEANFILES = pango.c atk.c
+
defsdir = $(pkgdatadir)/2.0/defs
defs_DATA = pango.defs pango-types.defs
@@ -51,6 +60,8 @@ EXTRA_DIST = \
pygtk-2.0.pc.in \
MAPPING \
THREADS \
+ atk.defs \
+ atk.override \
pango.defs \
pango-types.defs \
pango.override \
diff --git a/atk.defs b/atk.defs
new file mode 100644
index 00000000..9ad3fc41
--- /dev/null
+++ b/atk.defs
@@ -0,0 +1,1901 @@
+;; -*- scheme -*-
+; object definitions ...
+(define-object Hyperlink
+ (in-module "Atk")
+ (parent "GObject")
+ (c-name "AtkHyperlink")
+ (gtype-id "ATK_TYPE_HYPERLINK")
+)
+
+(define-object Object
+ (in-module "Atk")
+ (parent "GObject")
+ (c-name "AtkObject")
+ (gtype-id "ATK_TYPE_OBJECT")
+)
+
+(define-object NoOpObject
+ (in-module "Atk")
+ (parent "AtkObject")
+ (c-name "AtkNoOpObject")
+ (gtype-id "ATK_TYPE_NO_OP_OBJECT")
+)
+
+(define-object ObjectFactory
+ (in-module "Atk")
+ (parent "GObject")
+ (c-name "AtkObjectFactory")
+ (gtype-id "ATK_TYPE_OBJECT_FACTORY")
+)
+
+(define-object NoOpObjectFactory
+ (in-module "Atk")
+ (parent "AtkObjectFactory")
+ (c-name "AtkNoOpObjectFactory")
+ (gtype-id "ATK_TYPE_NO_OP_OBJECT_FACTORY")
+)
+
+(define-object Registry
+ (in-module "Atk")
+ (parent "GObject")
+ (c-name "AtkRegistry")
+ (gtype-id "ATK_TYPE_REGISTRY")
+)
+
+(define-object Relation
+ (in-module "Atk")
+ (parent "GObject")
+ (c-name "AtkRelation")
+ (gtype-id "ATK_TYPE_RELATION")
+)
+
+(define-object RelationSet
+ (in-module "Atk")
+ (parent "GObject")
+ (c-name "AtkRelationSet")
+ (gtype-id "ATK_TYPE_RELATION_SET")
+)
+
+(define-object StateSet
+ (in-module "Atk")
+ (parent "GObject")
+ (c-name "AtkStateSet")
+ (gtype-id "ATK_TYPE_STATE_SET")
+)
+
+(define-object Util
+ (in-module "Atk")
+ (parent "GObject")
+ (c-name "AtkUtil")
+ (gtype-id "ATK_TYPE_UTIL")
+)
+
+;; Enumerations and flags ...
+
+(define-enum Role
+ (in-module "Atk")
+ (c-name "AtkRole")
+ (values
+ '("invalid" "ATK_ROLE_INVALID")
+ '("accel-label" "ATK_ROLE_ACCEL_LABEL")
+ '("alert" "ATK_ROLE_ALERT")
+ '("animation" "ATK_ROLE_ANIMATION")
+ '("arrow" "ATK_ROLE_ARROW")
+ '("calendar" "ATK_ROLE_CALENDAR")
+ '("canvas" "ATK_ROLE_CANVAS")
+ '("check-box" "ATK_ROLE_CHECK_BOX")
+ '("check-menu-item" "ATK_ROLE_CHECK_MENU_ITEM")
+ '("color-chooser" "ATK_ROLE_COLOR_CHOOSER")
+ '("column-header" "ATK_ROLE_COLUMN_HEADER")
+ '("combo-box" "ATK_ROLE_COMBO_BOX")
+ '("date-editor" "ATK_ROLE_DATE_EDITOR")
+ '("desktop-icon" "ATK_ROLE_DESKTOP_ICON")
+ '("desktop-frame" "ATK_ROLE_DESKTOP_FRAME")
+ '("dial" "ATK_ROLE_DIAL")
+ '("dialog" "ATK_ROLE_DIALOG")
+ '("directory-pane" "ATK_ROLE_DIRECTORY_PANE")
+ '("drawing-area" "ATK_ROLE_DRAWING_AREA")
+ '("file-chooser" "ATK_ROLE_FILE_CHOOSER")
+ '("filler" "ATK_ROLE_FILLER")
+ '("font-chooser" "ATK_ROLE_FONT_CHOOSER")
+ '("frame" "ATK_ROLE_FRAME")
+ '("glass-pane" "ATK_ROLE_GLASS_PANE")
+ '("html-container" "ATK_ROLE_HTML_CONTAINER")
+ '("icon" "ATK_ROLE_ICON")
+ '("image" "ATK_ROLE_IMAGE")
+ '("internal-frame" "ATK_ROLE_INTERNAL_FRAME")
+ '("label" "ATK_ROLE_LABEL")
+ '("layered-pane" "ATK_ROLE_LAYERED_PANE")
+ '("list" "ATK_ROLE_LIST")
+ '("list-item" "ATK_ROLE_LIST_ITEM")
+ '("menu" "ATK_ROLE_MENU")
+ '("menu-bar" "ATK_ROLE_MENU_BAR")
+ '("menu-item" "ATK_ROLE_MENU_ITEM")
+ '("option-pane" "ATK_ROLE_OPTION_PANE")
+ '("page-tab" "ATK_ROLE_PAGE_TAB")
+ '("page-tab-list" "ATK_ROLE_PAGE_TAB_LIST")
+ '("panel" "ATK_ROLE_PANEL")
+ '("password-text" "ATK_ROLE_PASSWORD_TEXT")
+ '("popup-menu" "ATK_ROLE_POPUP_MENU")
+ '("progress-bar" "ATK_ROLE_PROGRESS_BAR")
+ '("push-button" "ATK_ROLE_PUSH_BUTTON")
+ '("radio-button" "ATK_ROLE_RADIO_BUTTON")
+ '("radio-menu-item" "ATK_ROLE_RADIO_MENU_ITEM")
+ '("root-pane" "ATK_ROLE_ROOT_PANE")
+ '("row-header" "ATK_ROLE_ROW_HEADER")
+ '("scroll-bar" "ATK_ROLE_SCROLL_BAR")
+ '("scroll-pane" "ATK_ROLE_SCROLL_PANE")
+ '("separator" "ATK_ROLE_SEPARATOR")
+ '("slider" "ATK_ROLE_SLIDER")
+ '("split-pane" "ATK_ROLE_SPLIT_PANE")
+ '("spin-button" "ATK_ROLE_SPIN_BUTTON")
+ '("statusbar" "ATK_ROLE_STATUSBAR")
+ '("table" "ATK_ROLE_TABLE")
+ '("table-cell" "ATK_ROLE_TABLE_CELL")
+ '("table-column-header" "ATK_ROLE_TABLE_COLUMN_HEADER")
+ '("table-row-header" "ATK_ROLE_TABLE_ROW_HEADER")
+ '("tear-off-menu-item" "ATK_ROLE_TEAR_OFF_MENU_ITEM")
+ '("terminal" "ATK_ROLE_TERMINAL")
+ '("text" "ATK_ROLE_TEXT")
+ '("toggle-button" "ATK_ROLE_TOGGLE_BUTTON")
+ '("tool-bar" "ATK_ROLE_TOOL_BAR")
+ '("tool-tip" "ATK_ROLE_TOOL_TIP")
+ '("tree" "ATK_ROLE_TREE")
+ '("tree-table" "ATK_ROLE_TREE_TABLE")
+ '("unknown" "ATK_ROLE_UNKNOWN")
+ '("viewport" "ATK_ROLE_VIEWPORT")
+ '("window" "ATK_ROLE_WINDOW")
+ '("last-defined" "ATK_ROLE_LAST_DEFINED")
+ )
+)
+
+(define-enum Layer
+ (in-module "Atk")
+ (c-name "AtkLayer")
+ (values
+ '("invalid" "ATK_LAYER_INVALID")
+ '("background" "ATK_LAYER_BACKGROUND")
+ '("canvas" "ATK_LAYER_CANVAS")
+ '("widget" "ATK_LAYER_WIDGET")
+ '("mdi" "ATK_LAYER_MDI")
+ '("popup" "ATK_LAYER_POPUP")
+ '("overlay" "ATK_LAYER_OVERLAY")
+ )
+)
+
+(define-enum RelationType
+ (in-module "Atk")
+ (c-name "AtkRelationType")
+ (values
+ '("null" "ATK_RELATION_NULL")
+ '("controlled-by" "ATK_RELATION_CONTROLLED_BY")
+ '("controller-for" "ATK_RELATION_CONTROLLER_FOR")
+ '("label-for" "ATK_RELATION_LABEL_FOR")
+ '("labelled-by" "ATK_RELATION_LABELLED_BY")
+ '("member-of" "ATK_RELATION_MEMBER_OF")
+ '("node-child-of" "ATK_RELATION_NODE_CHILD_OF")
+ '("last-defined" "ATK_RELATION_LAST_DEFINED")
+ )
+)
+
+(define-enum StateType
+ (in-module "Atk")
+ (c-name "AtkStateType")
+ (values
+ '("invalid" "ATK_STATE_INVALID")
+ '("active" "ATK_STATE_ACTIVE")
+ '("armed" "ATK_STATE_ARMED")
+ '("busy" "ATK_STATE_BUSY")
+ '("checked" "ATK_STATE_CHECKED")
+ '("defunct" "ATK_STATE_DEFUNCT")
+ '("editable" "ATK_STATE_EDITABLE")
+ '("enabled" "ATK_STATE_ENABLED")
+ '("expandable" "ATK_STATE_EXPANDABLE")
+ '("expanded" "ATK_STATE_EXPANDED")
+ '("focusable" "ATK_STATE_FOCUSABLE")
+ '("focused" "ATK_STATE_FOCUSED")
+ '("horizontal" "ATK_STATE_HORIZONTAL")
+ '("iconified" "ATK_STATE_ICONIFIED")
+ '("modal" "ATK_STATE_MODAL")
+ '("multi-line" "ATK_STATE_MULTI_LINE")
+ '("multiselectable" "ATK_STATE_MULTISELECTABLE")
+ '("opaque" "ATK_STATE_OPAQUE")
+ '("pressed" "ATK_STATE_PRESSED")
+ '("resizable" "ATK_STATE_RESIZABLE")
+ '("selectable" "ATK_STATE_SELECTABLE")
+ '("selected" "ATK_STATE_SELECTED")
+ '("sensitive" "ATK_STATE_SENSITIVE")
+ '("showing" "ATK_STATE_SHOWING")
+ '("single-line" "ATK_STATE_SINGLE_LINE")
+ '("stale" "ATK_STATE_STALE")
+ '("transient" "ATK_STATE_TRANSIENT")
+ '("vertical" "ATK_STATE_VERTICAL")
+ '("visible" "ATK_STATE_VISIBLE")
+ '("last-defined" "ATK_STATE_LAST_DEFINED")
+ )
+)
+
+(define-enum TextAttribute
+ (in-module "Atk")
+ (c-name "AtkTextAttribute")
+ (values
+ '("left-margin" "ATK_TEXT_ATTR_LEFT_MARGIN")
+ '("right-margin" "ATK_TEXT_ATTR_RIGHT_MARGIN")
+ '("indent" "ATK_TEXT_ATTR_INDENT")
+ '("invisible" "ATK_TEXT_ATTR_INVISIBLE")
+ '("editable" "ATK_TEXT_ATTR_EDITABLE")
+ '("pixels-above-lines" "ATK_TEXT_ATTR_PIXELS_ABOVE_LINES")
+ '("pixels-below-lines" "ATK_TEXT_ATTR_PIXELS_BELOW_LINES")
+ '("pixels-inside-wrap" "ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP")
+ '("bg-full-height" "ATK_TEXT_ATTR_BG_FULL_HEIGHT")
+ '("rise" "ATK_TEXT_ATTR_RISE")
+ '("underline" "ATK_TEXT_ATTR_UNDERLINE")
+ '("strikethrough" "ATK_TEXT_ATTR_STRIKETHROUGH")
+ '("size" "ATK_TEXT_ATTR_SIZE")
+ '("scale" "ATK_TEXT_ATTR_SCALE")
+ '("weight" "ATK_TEXT_ATTR_WEIGHT")
+ '("language" "ATK_TEXT_ATTR_LANGUAGE")
+ '("family-name" "ATK_TEXT_ATTR_FAMILY_NAME")
+ '("bg-color" "ATK_TEXT_ATTR_BG_COLOR")
+ '("fg-color" "ATK_TEXT_ATTR_FG_COLOR")
+ '("bg-stipple" "ATK_TEXT_ATTR_BG_STIPPLE")
+ '("fg-stipple" "ATK_TEXT_ATTR_FG_STIPPLE")
+ '("wrap-mode" "ATK_TEXT_ATTR_WRAP_MODE")
+ '("direction" "ATK_TEXT_ATTR_DIRECTION")
+ '("justification" "ATK_TEXT_ATTR_JUSTIFICATION")
+ '("stretch" "ATK_TEXT_ATTR_STRETCH")
+ '("variant" "ATK_TEXT_ATTR_VARIANT")
+ '("style" "ATK_TEXT_ATTR_STYLE")
+ )
+)
+
+(define-enum TextBoundary
+ (in-module "Atk")
+ (c-name "AtkTextBoundary")
+ (values
+ '("char" "ATK_TEXT_BOUNDARY_CHAR")
+ '("word-start" "ATK_TEXT_BOUNDARY_WORD_START")
+ '("word-end" "ATK_TEXT_BOUNDARY_WORD_END")
+ '("sentence-start" "ATK_TEXT_BOUNDARY_SENTENCE_START")
+ '("sentence-end" "ATK_TEXT_BOUNDARY_SENTENCE_END")
+ '("line-start" "ATK_TEXT_BOUNDARY_LINE_START")
+ '("line-end" "ATK_TEXT_BOUNDARY_LINE_END")
+ )
+)
+
+(define-enum KeyEventType
+ (in-module "Atk")
+ (c-name "AtkKeyEventType")
+ (values
+ '("press" "ATK_KEY_EVENT_PRESS")
+ '("release" "ATK_KEY_EVENT_RELEASE")
+ '("last-defined" "ATK_KEY_EVENT_LAST_DEFINED")
+ )
+)
+
+(define-enum CoordType
+ (in-module "Atk")
+ (c-name "AtkCoordType")
+ (values
+ '("screen" "ATK_XY_SCREEN")
+ '("window" "ATK_XY_WINDOW")
+ )
+)
+
+
+;; From /usr/include/atk-1.0/atk/atkaction.h
+
+(define-function atk_action_get_type
+ (c-name "atk_action_get_type")
+ (return-type "GType")
+ (parameters
+ )
+)
+
+(define-method do_action
+ (of-object "AtkAction")
+ (c-name "atk_action_do_action")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "i")
+ )
+)
+
+(define-method get_n_actions
+ (of-object "AtkAction")
+ (c-name "atk_action_get_n_actions")
+ (return-type "gint")
+)
+
+(define-method get_description
+ (of-object "AtkAction")
+ (c-name "atk_action_get_description")
+ (return-type "const-gchar*")
+ (parameters
+ '("gint" "i")
+ )
+)
+
+(define-method get_name
+ (of-object "AtkAction")
+ (c-name "atk_action_get_name")
+ (return-type "const-gchar*")
+ (parameters
+ '("gint" "i")
+ )
+)
+
+(define-method get_keybinding
+ (of-object "AtkAction")
+ (c-name "atk_action_get_keybinding")
+ (return-type "const-gchar*")
+ (parameters
+ '("gint" "i")
+ )
+)
+
+(define-method set_description
+ (of-object "AtkAction")
+ (c-name "atk_action_set_description")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "i")
+ '("const-gchar*" "desc")
+ )
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atkcomponent.h
+
+(define-function atk_component_get_type
+ (c-name "atk_component_get_type")
+ (return-type "GType")
+ (parameters
+ )
+)
+
+(define-method add_focus_handler
+ (of-object "AtkComponent")
+ (c-name "atk_component_add_focus_handler")
+ (return-type "guint")
+ (parameters
+ '("AtkFocusHandler" "handler")
+ )
+)
+
+(define-method contains
+ (of-object "AtkComponent")
+ (c-name "atk_component_contains")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "x")
+ '("gint" "y")
+ '("AtkCoordType" "coord_type")
+ )
+)
+
+(define-method ref_accessible_at_point
+ (of-object "AtkComponent")
+ (c-name "atk_component_ref_accessible_at_point")
+ (return-type "AtkObject*")
+ (parameters
+ '("gint" "x")
+ '("gint" "y")
+ '("AtkCoordType" "coord_type")
+ )
+)
+
+(define-method get_extents
+ (of-object "AtkComponent")
+ (c-name "atk_component_get_extents")
+ (return-type "none")
+ (parameters
+ '("gint*" "x")
+ '("gint*" "y")
+ '("gint*" "width")
+ '("gint*" "height")
+ '("AtkCoordType" "coord_type")
+ )
+)
+
+(define-method get_position
+ (of-object "AtkComponent")
+ (c-name "atk_component_get_position")
+ (return-type "none")
+ (parameters
+ '("gint*" "x")
+ '("gint*" "y")
+ '("AtkCoordType" "coord_type")
+ )
+)
+
+(define-method get_size
+ (of-object "AtkComponent")
+ (c-name "atk_component_get_size")
+ (return-type "none")
+ (parameters
+ '("gint*" "width")
+ '("gint*" "height")
+ )
+)
+
+(define-method grab_focus
+ (of-object "AtkComponent")
+ (c-name "atk_component_grab_focus")
+ (return-type "gboolean")
+)
+
+(define-method remove_focus_handler
+ (of-object "AtkComponent")
+ (c-name "atk_component_remove_focus_handler")
+ (return-type "none")
+ (parameters
+ '("guint" "handler_id")
+ )
+)
+
+(define-method set_extents
+ (of-object "AtkComponent")
+ (c-name "atk_component_set_extents")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "x")
+ '("gint" "y")
+ '("gint" "width")
+ '("gint" "height")
+ '("AtkCoordType" "coord_type")
+ )
+)
+
+(define-method set_position
+ (of-object "AtkComponent")
+ (c-name "atk_component_set_position")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "x")
+ '("gint" "y")
+ '("AtkCoordType" "coord_type")
+ )
+)
+
+(define-method set_size
+ (of-object "AtkComponent")
+ (c-name "atk_component_set_size")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "width")
+ '("gint" "height")
+ )
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atkdocument.h
+
+(define-function atk_document_get_type
+ (c-name "atk_document_get_type")
+ (return-type "GType")
+)
+
+(define-method get_document_type
+ (of-object "AtkDocument")
+ (c-name "atk_document_get_document_type")
+ (return-type "const-gchar*")
+)
+
+(define-method get_document
+ (of-object "AtkDocument")
+ (c-name "atk_document_get_document")
+ (return-type "gpointer")
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atkeditabletext.h
+
+(define-function atk_editable_text_get_type
+ (c-name "atk_editable_text_get_type")
+ (return-type "GType")
+)
+
+(define-method set_run_attributes
+ (of-object "AtkEditableText")
+ (c-name "atk_editable_text_set_run_attributes")
+ (return-type "gboolean")
+ (parameters
+ '("AtkAttributeSet*" "attrib_set")
+ '("gint" "start_offset")
+ '("gint" "end_offset")
+ )
+)
+
+(define-method set_text_contents
+ (of-object "AtkEditableText")
+ (c-name "atk_editable_text_set_text_contents")
+ (return-type "none")
+ (parameters
+ '("const-gchar*" "string")
+ )
+)
+
+(define-method insert_text
+ (of-object "AtkEditableText")
+ (c-name "atk_editable_text_insert_text")
+ (return-type "none")
+ (parameters
+ '("const-gchar*" "string")
+ '("gint" "length")
+ '("gint*" "position")
+ )
+)
+
+(define-method copy_text
+ (of-object "AtkEditableText")
+ (c-name "atk_editable_text_copy_text")
+ (return-type "none")
+ (parameters
+ '("gint" "start_pos")
+ '("gint" "end_pos")
+ )
+)
+
+(define-method cut_text
+ (of-object "AtkEditableText")
+ (c-name "atk_editable_text_cut_text")
+ (return-type "none")
+ (parameters
+ '("gint" "start_pos")
+ '("gint" "end_pos")
+ )
+)
+
+(define-method delete_text
+ (of-object "AtkEditableText")
+ (c-name "atk_editable_text_delete_text")
+ (return-type "none")
+ (parameters
+ '("gint" "start_pos")
+ '("gint" "end_pos")
+ )
+)
+
+(define-method paste_text
+ (of-object "AtkEditableText")
+ (c-name "atk_editable_text_paste_text")
+ (return-type "none")
+ (parameters
+ '("gint" "position")
+ )
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atk.h
+
+
+
+;; From /usr/include/atk-1.0/atk/atkhyperlink.h
+
+(define-function atk_hyperlink_get_type
+ (c-name "atk_hyperlink_get_type")
+ (return-type "GType")
+)
+
+(define-method get_uri
+ (of-object "AtkHyperlink")
+ (c-name "atk_hyperlink_get_uri")
+ (return-type "gchar*")
+ (parameters
+ '("gint" "i")
+ )
+)
+
+(define-method get_object
+ (of-object "AtkHyperlink")
+ (c-name "atk_hyperlink_get_object")
+ (return-type "AtkObject*")
+ (parameters
+ '("gint" "i")
+ )
+)
+
+(define-method get_end_index
+ (of-object "AtkHyperlink")
+ (c-name "atk_hyperlink_get_end_index")
+ (return-type "gint")
+)
+
+(define-method get_start_index
+ (of-object "AtkHyperlink")
+ (c-name "atk_hyperlink_get_start_index")
+ (return-type "gint")
+)
+
+(define-method is_valid
+ (of-object "AtkHyperlink")
+ (c-name "atk_hyperlink_is_valid")
+ (return-type "gboolean")
+)
+
+(define-method get_n_anchors
+ (of-object "AtkHyperlink")
+ (c-name "atk_hyperlink_get_n_anchors")
+ (return-type "gint")
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atkhypertext.h
+
+(define-function atk_hypertext_get_type
+ (c-name "atk_hypertext_get_type")
+ (return-type "GType")
+)
+
+(define-method get_link
+ (of-object "AtkHypertext")
+ (c-name "atk_hypertext_get_link")
+ (return-type "AtkHyperlink*")
+ (parameters
+ '("gint" "link_index")
+ )
+)
+
+(define-method get_n_links
+ (of-object "AtkHypertext")
+ (c-name "atk_hypertext_get_n_links")
+ (return-type "gint")
+)
+
+(define-method get_link_index
+ (of-object "AtkHypertext")
+ (c-name "atk_hypertext_get_link_index")
+ (return-type "gint")
+ (parameters
+ '("gint" "char_index")
+ )
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atkimage.h
+
+(define-function atk_image_get_type
+ (c-name "atk_image_get_type")
+ (return-type "GType")
+)
+
+(define-method get_image_description
+ (of-object "AtkImage")
+ (c-name "atk_image_get_image_description")
+ (return-type "const-gchar*")
+)
+
+(define-method get_image_size
+ (of-object "AtkImage")
+ (c-name "atk_image_get_image_size")
+ (return-type "none")
+ (parameters
+ '("gint*" "width")
+ '("gint*" "height")
+ )
+)
+
+(define-method set_image_description
+ (of-object "AtkImage")
+ (c-name "atk_image_set_image_description")
+ (return-type "gboolean")
+ (parameters
+ '("const-gchar*" "description")
+ )
+)
+
+(define-method get_image_position
+ (of-object "AtkImage")
+ (c-name "atk_image_get_image_position")
+ (return-type "none")
+ (parameters
+ '("gint*" "x")
+ '("gint*" "y")
+ '("AtkCoordType" "coord_type")
+ )
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atknoopobjectfactory.h
+
+(define-function atk_no_op_object_factory_get_type
+ (c-name "atk_no_op_object_factory_get_type")
+ (return-type "GType")
+ (parameters
+ )
+)
+
+(define-function atk_no_op_object_factory_new
+ (c-name "atk_no_op_object_factory_new")
+ (return-type "AtkObjectFactory*")
+ (parameters
+ )
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atknoopobject.h
+
+(define-function atk_no_op_object_get_type
+ (c-name "atk_no_op_object_get_type")
+ (return-type "GType")
+)
+
+(define-function atk_no_op_object_new
+ (c-name "atk_no_op_object_new")
+ (return-type "AtkNoOpObject*")
+ (is-constructor-of AtkNoOpObject)
+ (parameters
+ '("GObject*" "obj")
+ )
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atkobjectfactory.h
+
+(define-function atk_object_factory_get_type
+ (c-name "atk_object_factory_get_type")
+ (return-type "GType")
+ (parameters
+ )
+)
+
+(define-method create_accessible
+ (of-object "AtkObjectFactory")
+ (c-name "atk_object_factory_create_accessible")
+ (return-type "AtkObject*")
+ (parameters
+ '("GObject*" "obj")
+ )
+)
+
+(define-method invalidate
+ (of-object "AtkObjectFactory")
+ (c-name "atk_object_factory_invalidate")
+ (return-type "none")
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atkobject.h
+
+(define-function atk_object_get_type
+ (c-name "atk_object_get_type")
+ (return-type "GType")
+)
+
+(define-function atk_implementor_get_type
+ (c-name "atk_implementor_get_type")
+ (return-type "GType")
+)
+
+(define-method ref_accessible
+ (of-object "AtkImplementor")
+ (c-name "atk_implementor_ref_accessible")
+ (return-type "AtkObject*")
+)
+
+(define-method get_name
+ (of-object "AtkObject")
+ (c-name "atk_object_get_name")
+ (return-type "const-gchar*")
+)
+
+(define-method get_description
+ (of-object "AtkObject")
+ (c-name "atk_object_get_description")
+ (return-type "const-gchar*")
+)
+
+(define-method get_parent
+ (of-object "AtkObject")
+ (c-name "atk_object_get_parent")
+ (return-type "AtkObject*")
+)
+
+(define-method get_n_accessible_children
+ (of-object "AtkObject")
+ (c-name "atk_object_get_n_accessible_children")
+ (return-type "gint")
+)
+
+(define-method ref_accessible_child
+ (of-object "AtkObject")
+ (c-name "atk_object_ref_accessible_child")
+ (return-type "AtkObject*")
+ (parameters
+ '("gint" "i")
+ )
+)
+
+(define-method ref_relation_set
+ (of-object "AtkObject")
+ (c-name "atk_object_ref_relation_set")
+ (return-type "AtkRelationSet*")
+)
+
+(define-method get_role
+ (of-object "AtkObject")
+ (c-name "atk_object_get_role")
+ (return-type "AtkRole")
+)
+
+(define-method get_layer
+ (of-object "AtkObject")
+ (c-name "atk_object_get_layer")
+ (return-type "AtkLayer")
+)
+
+(define-method get_mdi_zorder
+ (of-object "AtkObject")
+ (c-name "atk_object_get_mdi_zorder")
+ (return-type "gint")
+)
+
+(define-method ref_state_set
+ (of-object "AtkObject")
+ (c-name "atk_object_ref_state_set")
+ (return-type "AtkStateSet*")
+)
+
+(define-method get_index_in_parent
+ (of-object "AtkObject")
+ (c-name "atk_object_get_index_in_parent")
+ (return-type "gint")
+)
+
+(define-method set_name
+ (of-object "AtkObject")
+ (c-name "atk_object_set_name")
+ (return-type "none")
+ (parameters
+ '("const-gchar*" "name")
+ )
+)
+
+(define-method set_description
+ (of-object "AtkObject")
+ (c-name "atk_object_set_description")
+ (return-type "none")
+ (parameters
+ '("const-gchar*" "description")
+ )
+)
+
+(define-method set_parent
+ (of-object "AtkObject")
+ (c-name "atk_object_set_parent")
+ (return-type "none")
+ (parameters
+ '("AtkObject*" "parent")
+ )
+)
+
+(define-method set_role
+ (of-object "AtkObject")
+ (c-name "atk_object_set_role")
+ (return-type "none")
+ (parameters
+ '("AtkRole" "role")
+ )
+)
+
+(define-method connect_property_change_handler
+ (of-object "AtkObject")
+ (c-name "atk_object_connect_property_change_handler")
+ (return-type "guint")
+ (parameters
+ '("AtkPropertyChangeHandler*" "handler")
+ )
+)
+
+(define-method remove_property_change_handler
+ (of-object "AtkObject")
+ (c-name "atk_object_remove_property_change_handler")
+ (return-type "none")
+ (parameters
+ '("guint" "handler_id")
+ )
+)
+
+(define-method notify_state_change
+ (of-object "AtkObject")
+ (c-name "atk_object_notify_state_change")
+ (return-type "none")
+ (parameters
+ '("AtkState" "state")
+ '("gboolean" "value")
+ )
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atkregistry.h
+
+(define-function atk_registry_get_type
+ (c-name "atk_registry_get_type")
+ (return-type "GType")
+)
+
+(define-method set_factory_type
+ (of-object "AtkRegistry")
+ (c-name "atk_registry_set_factory_type")
+ (return-type "none")
+ (parameters
+ '("GType" "type")
+ '("GType" "factory_type")
+ )
+)
+
+(define-method get_factory_type
+ (of-object "AtkRegistry")
+ (c-name "atk_registry_get_factory_type")
+ (return-type "GType")
+ (parameters
+ '("GType" "type")
+ )
+)
+
+(define-method get_factory
+ (of-object "AtkRegistry")
+ (c-name "atk_registry_get_factory")
+ (return-type "AtkObjectFactory*")
+ (parameters
+ '("GType" "type")
+ )
+)
+
+(define-function get_default_registry
+ (c-name "atk_get_default_registry")
+ (return-type "AtkRegistry*")
+ (parameters
+ )
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atkrelation.h
+
+(define-function atk_relation_get_type
+ (c-name "atk_relation_get_type")
+ (return-type "GType")
+)
+
+(define-function relation_type_register
+ (c-name "atk_relation_type_register")
+ (return-type "AtkRelationType")
+ (parameters
+ '("const-gchar*" "name")
+ )
+)
+
+(define-method get_name
+ (of-object "AtkRelationType")
+ (c-name "atk_relation_type_get_name")
+ (return-type "const-gchar*")
+)
+
+(define-function relation_type_for_name
+ (c-name "atk_relation_type_for_name")
+ (return-type "AtkRelationType")
+ (parameters
+ '("const-gchar*" "name")
+ )
+)
+
+(define-function relation_new
+ (c-name "atk_relation_new")
+ (return-type "AtkRelation*")
+ (parameters
+ '("AtkObject**" "targets")
+ '("gint" "n_targets")
+ '("AtkRelationType" "relationship")
+ )
+)
+
+(define-method get_relation_type
+ (of-object "AtkRelation")
+ (c-name "atk_relation_get_relation_type")
+ (return-type "AtkRelationType")
+)
+
+(define-method get_target
+ (of-object "AtkRelation")
+ (c-name "atk_relation_get_target")
+ (return-type "GPtrArray*")
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atkrelationset.h
+
+(define-function atk_relation_set_get_type
+ (c-name "atk_relation_set_get_type")
+ (return-type "GType")
+)
+
+(define-function relation_set_new
+ (c-name "atk_relation_set_new")
+ (is-constructor-of AtkRelationSet)
+ (return-type "AtkRelationSet*")
+)
+
+(define-method contains
+ (of-object "AtkRelationSet")
+ (c-name "atk_relation_set_contains")
+ (return-type "gboolean")
+ (parameters
+ '("AtkRelationType" "relationship")
+ )
+)
+
+(define-method remove
+ (of-object "AtkRelationSet")
+ (c-name "atk_relation_set_remove")
+ (return-type "none")
+ (parameters
+ '("AtkRelation*" "relation")
+ )
+)
+
+(define-method add
+ (of-object "AtkRelationSet")
+ (c-name "atk_relation_set_add")
+ (return-type "none")
+ (parameters
+ '("AtkRelation*" "relation")
+ )
+)
+
+(define-method get_n_relations
+ (of-object "AtkRelationSet")
+ (c-name "atk_relation_set_get_n_relations")
+ (return-type "gint")
+)
+
+(define-method get_relation
+ (of-object "AtkRelationSet")
+ (c-name "atk_relation_set_get_relation")
+ (return-type "AtkRelation*")
+ (parameters
+ '("gint" "i")
+ )
+)
+
+(define-method get_relation_by_type
+ (of-object "AtkRelationSet")
+ (c-name "atk_relation_set_get_relation_by_type")
+ (return-type "AtkRelation*")
+ (parameters
+ '("AtkRelationType" "relationship")
+ )
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atkselection.h
+
+(define-function atk_selection_get_type
+ (c-name "atk_selection_get_type")
+ (return-type "GType")
+ (parameters
+ )
+)
+
+(define-method add_selection
+ (of-object "AtkSelection")
+ (c-name "atk_selection_add_selection")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "i")
+ )
+)
+
+(define-method clear_selection
+ (of-object "AtkSelection")
+ (c-name "atk_selection_clear_selection")
+ (return-type "gboolean")
+)
+
+(define-method ref_selection
+ (of-object "AtkSelection")
+ (c-name "atk_selection_ref_selection")
+ (return-type "AtkObject*")
+ (parameters
+ '("gint" "i")
+ )
+)
+
+(define-method get_selection_count
+ (of-object "AtkSelection")
+ (c-name "atk_selection_get_selection_count")
+ (return-type "gint")
+)
+
+(define-method is_child_selected
+ (of-object "AtkSelection")
+ (c-name "atk_selection_is_child_selected")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "i")
+ )
+)
+
+(define-method remove_selection
+ (of-object "AtkSelection")
+ (c-name "atk_selection_remove_selection")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "i")
+ )
+)
+
+(define-method select_all_selection
+ (of-object "AtkSelection")
+ (c-name "atk_selection_select_all_selection")
+ (return-type "gboolean")
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atkstate.h
+
+(define-method get_name
+ (of-object "AtkStateType")
+ (c-name "atk_state_type_get_name")
+ (return-type "const-gchar*")
+)
+
+(define-function state_type_for_name
+ (c-name "atk_state_type_for_name")
+ (return-type "AtkStateType")
+ (parameters
+ '("const-gchar*" "name")
+ )
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atkstateset.h
+
+(define-function atk_state_set_get_type
+ (c-name "atk_state_set_get_type")
+ (return-type "GType")
+)
+
+(define-function atk_state_set_new
+ (c-name "atk_state_set_new")
+ (return-type "AtkStateSet*")
+ (is-constructor-of AtkSetSet)
+)
+
+(define-method is_empty
+ (of-object "AtkStateSet")
+ (c-name "atk_state_set_is_empty")
+ (return-type "gboolean")
+)
+
+(define-method add_state
+ (of-object "AtkStateSet")
+ (c-name "atk_state_set_add_state")
+ (return-type "gboolean")
+ (parameters
+ '("AtkStateType" "type")
+ )
+)
+
+(define-method add_states
+ (of-object "AtkStateSet")
+ (c-name "atk_state_set_add_states")
+ (return-type "none")
+ (parameters
+ '("AtkStateType*" "types")
+ '("gint" "n_types")
+ )
+)
+
+(define-method clear_states
+ (of-object "AtkStateSet")
+ (c-name "atk_state_set_clear_states")
+ (return-type "none")
+)
+
+(define-method contains_state
+ (of-object "AtkStateSet")
+ (c-name "atk_state_set_contains_state")
+ (return-type "gboolean")
+ (parameters
+ '("AtkStateType" "type")
+ )
+)
+
+(define-method contains_states
+ (of-object "AtkStateSet")
+ (c-name "atk_state_set_contains_states")
+ (return-type "gboolean")
+ (parameters
+ '("AtkStateType*" "types")
+ '("gint" "n_types")
+ )
+)
+
+(define-method remove_state
+ (of-object "AtkStateSet")
+ (c-name "atk_state_set_remove_state")
+ (return-type "gboolean")
+ (parameters
+ '("AtkStateType" "type")
+ )
+)
+
+(define-method and_sets
+ (of-object "AtkStateSet")
+ (c-name "atk_state_set_and_sets")
+ (return-type "AtkStateSet*")
+ (parameters
+ '("AtkStateSet*" "compare_set")
+ )
+)
+
+(define-method or_sets
+ (of-object "AtkStateSet")
+ (c-name "atk_state_set_or_sets")
+ (return-type "AtkStateSet*")
+ (parameters
+ '("AtkStateSet*" "compare_set")
+ )
+)
+
+(define-method xor_sets
+ (of-object "AtkStateSet")
+ (c-name "atk_state_set_xor_sets")
+ (return-type "AtkStateSet*")
+ (parameters
+ '("AtkStateSet*" "compare_set")
+ )
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atkstreamablecontent.h
+
+(define-function atk_streamable_content_get_type
+ (c-name "atk_streamable_content_get_type")
+ (return-type "GType")
+)
+
+(define-method get_n_mime_types
+ (of-object "AtkStreamableContent")
+ (c-name "atk_streamable_content_get_n_mime_types")
+ (return-type "gint")
+)
+
+(define-method get_mime_type
+ (of-object "AtkStreamableContent")
+ (c-name "atk_streamable_content_get_mime_type")
+ (return-type "const-gchar*")
+ (parameters
+ '("gint" "i")
+ )
+)
+
+(define-method get_stream
+ (of-object "AtkStreamableContent")
+ (c-name "atk_streamable_content_get_stream")
+ (return-type "GIOChannel*")
+ (parameters
+ '("const-gchar*" "mime_type")
+ )
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atktable.h
+
+(define-function atk_table_get_type
+ (c-name "atk_table_get_type")
+ (return-type "GType")
+ (parameters
+ )
+)
+
+(define-method ref_at
+ (of-object "AtkTable")
+ (c-name "atk_table_ref_at")
+ (return-type "AtkObject*")
+ (parameters
+ '("gint" "row")
+ '("gint" "column")
+ )
+)
+
+(define-method get_index_at
+ (of-object "AtkTable")
+ (c-name "atk_table_get_index_at")
+ (return-type "gint")
+ (parameters
+ '("gint" "row")
+ '("gint" "column")
+ )
+)
+
+(define-method get_column_at_index
+ (of-object "AtkTable")
+ (c-name "atk_table_get_column_at_index")
+ (return-type "gint")
+ (parameters
+ '("gint" "index")
+ )
+)
+
+(define-method get_row_at_index
+ (of-object "AtkTable")
+ (c-name "atk_table_get_row_at_index")
+ (return-type "gint")
+ (parameters
+ '("gint" "index")
+ )
+)
+
+(define-method get_n_columns
+ (of-object "AtkTable")
+ (c-name "atk_table_get_n_columns")
+ (return-type "gint")
+)
+
+(define-method get_n_rows
+ (of-object "AtkTable")
+ (c-name "atk_table_get_n_rows")
+ (return-type "gint")
+)
+
+(define-method get_column_extent_at
+ (of-object "AtkTable")
+ (c-name "atk_table_get_column_extent_at")
+ (return-type "gint")
+ (parameters
+ '("gint" "row")
+ '("gint" "column")
+ )
+)
+
+(define-method get_row_extent_at
+ (of-object "AtkTable")
+ (c-name "atk_table_get_row_extent_at")
+ (return-type "gint")
+ (parameters
+ '("gint" "row")
+ '("gint" "column")
+ )
+)
+
+(define-method get_caption
+ (of-object "AtkTable")
+ (c-name "atk_table_get_caption")
+ (return-type "AtkObject*")
+)
+
+(define-method get_column_description
+ (of-object "AtkTable")
+ (c-name "atk_table_get_column_description")
+ (return-type "const-gchar*")
+ (parameters
+ '("gint" "column")
+ )
+)
+
+(define-method get_column_header
+ (of-object "AtkTable")
+ (c-name "atk_table_get_column_header")
+ (return-type "AtkObject*")
+ (parameters
+ '("gint" "column")
+ )
+)
+
+(define-method get_row_description
+ (of-object "AtkTable")
+ (c-name "atk_table_get_row_description")
+ (return-type "const-gchar*")
+ (parameters
+ '("gint" "row")
+ )
+)
+
+(define-method get_row_header
+ (of-object "AtkTable")
+ (c-name "atk_table_get_row_header")
+ (return-type "AtkObject*")
+ (parameters
+ '("gint" "row")
+ )
+)
+
+(define-method get_summary
+ (of-object "AtkTable")
+ (c-name "atk_table_get_summary")
+ (return-type "AtkObject*")
+)
+
+(define-method set_caption
+ (of-object "AtkTable")
+ (c-name "atk_table_set_caption")
+ (return-type "none")
+ (parameters
+ '("AtkObject*" "caption")
+ )
+)
+
+(define-method set_column_description
+ (of-object "AtkTable")
+ (c-name "atk_table_set_column_description")
+ (return-type "none")
+ (parameters
+ '("gint" "column")
+ '("const-gchar*" "description")
+ )
+)
+
+(define-method set_column_header
+ (of-object "AtkTable")
+ (c-name "atk_table_set_column_header")
+ (return-type "none")
+ (parameters
+ '("gint" "column")
+ '("AtkObject*" "header")
+ )
+)
+
+(define-method set_row_description
+ (of-object "AtkTable")
+ (c-name "atk_table_set_row_description")
+ (return-type "none")
+ (parameters
+ '("gint" "row")
+ '("const-gchar*" "description")
+ )
+)
+
+(define-method set_row_header
+ (of-object "AtkTable")
+ (c-name "atk_table_set_row_header")
+ (return-type "none")
+ (parameters
+ '("gint" "row")
+ '("AtkObject*" "header")
+ )
+)
+
+(define-method set_summary
+ (of-object "AtkTable")
+ (c-name "atk_table_set_summary")
+ (return-type "none")
+ (parameters
+ '("AtkObject*" "accessible")
+ )
+)
+
+(define-method get_selected_columns
+ (of-object "AtkTable")
+ (c-name "atk_table_get_selected_columns")
+ (return-type "gint")
+ (parameters
+ '("gint**" "selected")
+ )
+)
+
+(define-method get_selected_rows
+ (of-object "AtkTable")
+ (c-name "atk_table_get_selected_rows")
+ (return-type "gint")
+ (parameters
+ '("gint**" "selected")
+ )
+)
+
+(define-method is_column_selected
+ (of-object "AtkTable")
+ (c-name "atk_table_is_column_selected")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "column")
+ )
+)
+
+(define-method is_row_selected
+ (of-object "AtkTable")
+ (c-name "atk_table_is_row_selected")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "row")
+ )
+)
+
+(define-method is_selected
+ (of-object "AtkTable")
+ (c-name "atk_table_is_selected")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "row")
+ '("gint" "column")
+ )
+)
+
+(define-method add_row_selection
+ (of-object "AtkTable")
+ (c-name "atk_table_add_row_selection")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "row")
+ )
+)
+
+(define-method remove_row_selection
+ (of-object "AtkTable")
+ (c-name "atk_table_remove_row_selection")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "row")
+ )
+)
+
+(define-method add_column_selection
+ (of-object "AtkTable")
+ (c-name "atk_table_add_column_selection")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "column")
+ )
+)
+
+(define-method remove_column_selection
+ (of-object "AtkTable")
+ (c-name "atk_table_remove_column_selection")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "column")
+ )
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atktext.h
+
+(define-function atk_text_get_type
+ (c-name "atk_text_get_type")
+ (return-type "GType")
+)
+
+(define-method get_text
+ (of-object "AtkText")
+ (c-name "atk_text_get_text")
+ (return-type "gchar*")
+ (parameters
+ '("gint" "start_offset")
+ '("gint" "end_offset")
+ )
+)
+
+(define-method get_character_at_offset
+ (of-object "AtkText")
+ (c-name "atk_text_get_character_at_offset")
+ (return-type "gunichar")
+ (parameters
+ '("gint" "offset")
+ )
+)
+
+(define-method get_text_after_offset
+ (of-object "AtkText")
+ (c-name "atk_text_get_text_after_offset")
+ (return-type "gchar*")
+ (parameters
+ '("gint" "offset")
+ '("AtkTextBoundary" "boundary_type")
+ '("gint*" "start_offset")
+ '("gint*" "end_offset")
+ )
+)
+
+(define-method get_text_at_offset
+ (of-object "AtkText")
+ (c-name "atk_text_get_text_at_offset")
+ (return-type "gchar*")
+ (parameters
+ '("gint" "offset")
+ '("AtkTextBoundary" "boundary_type")
+ '("gint*" "start_offset")
+ '("gint*" "end_offset")
+ )
+)
+
+(define-method get_text_before_offset
+ (of-object "AtkText")
+ (c-name "atk_text_get_text_before_offset")
+ (return-type "gchar*")
+ (parameters
+ '("gint" "offset")
+ '("AtkTextBoundary" "boundary_type")
+ '("gint*" "start_offset")
+ '("gint*" "end_offset")
+ )
+)
+
+(define-method get_caret_offset
+ (of-object "AtkText")
+ (c-name "atk_text_get_caret_offset")
+ (return-type "gint")
+)
+
+(define-method get_character_extents
+ (of-object "AtkText")
+ (c-name "atk_text_get_character_extents")
+ (return-type "none")
+ (parameters
+ '("gint" "offset")
+ '("gint*" "x")
+ '("gint*" "y")
+ '("gint*" "width")
+ '("gint*" "height")
+ '("AtkCoordType" "coords")
+ )
+)
+
+(define-method get_run_attributes
+ (of-object "AtkText")
+ (c-name "atk_text_get_run_attributes")
+ (return-type "AtkAttributeSet*")
+ (parameters
+ '("gint" "offset")
+ '("gint*" "start_offset")
+ '("gint*" "end_offset")
+ )
+)
+
+(define-method get_default_attributes
+ (of-object "AtkText")
+ (c-name "atk_text_get_default_attributes")
+ (return-type "AtkAttributeSet*")
+)
+
+(define-method get_character_count
+ (of-object "AtkText")
+ (c-name "atk_text_get_character_count")
+ (return-type "gint")
+)
+
+(define-method get_offset_at_point
+ (of-object "AtkText")
+ (c-name "atk_text_get_offset_at_point")
+ (return-type "gint")
+ (parameters
+ '("gint" "x")
+ '("gint" "y")
+ '("AtkCoordType" "coords")
+ )
+)
+
+(define-method get_n_selections
+ (of-object "AtkText")
+ (c-name "atk_text_get_n_selections")
+ (return-type "gint")
+)
+
+(define-method get_selection
+ (of-object "AtkText")
+ (c-name "atk_text_get_selection")
+ (return-type "gchar*")
+ (parameters
+ '("gint" "selection_num")
+ '("gint*" "start_offset")
+ '("gint*" "end_offset")
+ )
+)
+
+(define-method add_selection
+ (of-object "AtkText")
+ (c-name "atk_text_add_selection")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "start_offset")
+ '("gint" "end_offset")
+ )
+)
+
+(define-method remove_selection
+ (of-object "AtkText")
+ (c-name "atk_text_remove_selection")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "selection_num")
+ )
+)
+
+(define-method set_selection
+ (of-object "AtkText")
+ (c-name "atk_text_set_selection")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "selection_num")
+ '("gint" "start_offset")
+ '("gint" "end_offset")
+ )
+)
+
+(define-method set_caret_offset
+ (of-object "AtkText")
+ (c-name "atk_text_set_caret_offset")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "offset")
+ )
+)
+
+(define-method free
+ (of-object "AtkAttributeSet")
+ (c-name "atk_attribute_set_free")
+ (return-type "none")
+)
+
+(define-function attribute_get_name
+ (c-name "atk_attribute_get_name")
+ (return-type "const-gchar*")
+ (parameters
+ '("AtkTextAttribute" "attr")
+ )
+)
+
+(define-function attribute_get_value
+ (c-name "atk_attribute_get_value")
+ (return-type "const-gchar*")
+ (parameters
+ '("AtkTextAttribute" "attr")
+ '("gint" "index")
+ )
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atkutil.h
+
+(define-function atk_util_get_type
+ (c-name "atk_util_get_type")
+ (return-type "GType")
+)
+
+(define-function add_focus_tracker
+ (c-name "atk_add_focus_tracker")
+ (return-type "guint")
+ (parameters
+ '("AtkEventListener" "focus_tracker")
+ )
+)
+
+(define-function remove_focus_tracker
+ (c-name "atk_remove_focus_tracker")
+ (return-type "none")
+ (parameters
+ '("guint" "tracker_id")
+ )
+)
+
+(define-function focus_tracker_init
+ (c-name "atk_focus_tracker_init")
+ (return-type "none")
+ (parameters
+ '("AtkEventListenerInit" "add_function")
+ )
+)
+
+(define-function focus_tracker_notify
+ (c-name "atk_focus_tracker_notify")
+ (return-type "none")
+ (parameters
+ '("AtkObject*" "object")
+ )
+)
+
+(define-function add_global_event_listener
+ (c-name "atk_add_global_event_listener")
+ (return-type "guint")
+ (parameters
+ '("GSignalEmissionHook" "listener")
+ '("const-gchar*" "event_type")
+ )
+)
+
+(define-function remove_global_event_listener
+ (c-name "atk_remove_global_event_listener")
+ (return-type "none")
+ (parameters
+ '("guint" "listener_id")
+ )
+)
+
+(define-function add_key_event_listener
+ (c-name "atk_add_key_event_listener")
+ (return-type "guint")
+ (parameters
+ '("AtkKeySnoopFunc" "listener")
+ '("gpointer" "data")
+ )
+)
+
+(define-function remove_key_event_listener
+ (c-name "atk_remove_key_event_listener")
+ (return-type "none")
+ (parameters
+ '("guint" "listener_id")
+ )
+)
+
+(define-function get_root
+ (c-name "atk_get_root")
+ (return-type "AtkObject*")
+)
+
+(define-function get_toolkit_name
+ (c-name "atk_get_toolkit_name")
+ (return-type "const-gchar*")
+)
+
+(define-function get_toolkit_version
+ (c-name "atk_get_toolkit_version")
+ (return-type "const-gchar*")
+)
+
+
+
+;; From /usr/include/atk-1.0/atk/atkvalue.h
+
+(define-function atk_value_get_type
+ (c-name "atk_value_get_type")
+ (return-type "GType")
+)
+
+(define-method get_current_value
+ (of-object "AtkValue")
+ (c-name "atk_value_get_current_value")
+ (return-type "none")
+ (parameters
+ '("GValue*" "value")
+ )
+)
+
+(define-method get_maximum_value
+ (of-object "AtkValue")
+ (c-name "atk_value_get_maximum_value")
+ (return-type "none")
+ (parameters
+ '("GValue*" "value")
+ )
+)
+
+(define-method get_minimum_value
+ (of-object "AtkValue")
+ (c-name "atk_value_get_minimum_value")
+ (return-type "none")
+ (parameters
+ '("GValue*" "value")
+ )
+)
+
+(define-method set_current_value
+ (of-object "AtkValue")
+ (c-name "atk_value_set_current_value")
+ (return-type "gboolean")
+ (parameters
+ '("const-GValue*" "value")
+ )
+)
+
+
diff --git a/atk.override b/atk.override
new file mode 100644
index 00000000..08babd60
--- /dev/null
+++ b/atk.override
@@ -0,0 +1,54 @@
+/* -*- Mode: C; c-basic-offset: 4 -*- */
+%%
+headers
+#include <Python.h>
+
+#include "pygobject.h"
+#include <atk/atk.h>
+#include <atk/atknoopobjectfactory.h>
+#include <atk/atknoopobject.h>
+%%
+import gobject.GObject as PyGObject_Type
+%%
+ignore-glob
+ *_get_type
+%%
+override atk_relation_new kwargs
+static PyObject *
+_wrap_atk_relation_new(PyGBoxed *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "targets", "relationship", NULL };
+ AtkObject **targets;
+ AtkRelation *ret;
+ int relationship, count, i;
+ PyObject *py_targets;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "Oi#:relation_new", kwlist,
+ &py_targets, &relationship))
+ return NULL;
+
+ if (!PySequence_Check(py_targets)) {
+ PyErr_SetString(PyExc_TypeError, "targets argument must be a sequence");
+ return NULL;
+ }
+
+ count = PySequence_Length(py_targets);
+ targets = g_new(AtkObject *, count);
+ for (i = 0; i < count; i++) {
+ PyObject *item = PySequence_GetItem(py_targets, i);
+ Py_DECREF(item); /* PySequence_GetItem INCREF's */
+ if (!pygobject_check(item, &PyAtkObject_Type)) {
+ PyErr_SetString(PyExc_TypeError, "targets argument must be a sequence of AtkObjects.");
+ g_free(targets);
+ return NULL;
+ }
+
+ targets[i] = (AtkObject *) pygobject_get(item);
+ }
+
+ ret = atk_relation_new(targets, count, relationship);
+ g_free(targets);
+
+ return pygobject_new((GObject *) ret);
+}
diff --git a/atkmodule.c b/atkmodule.c
new file mode 100644
index 00000000..70bab607
--- /dev/null
+++ b/atkmodule.c
@@ -0,0 +1,31 @@
+/* -*- Mode: C; c-basic-offset: 4 -*- */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/* include this first, before NO_IMPORT_PYGOBJECT is defined */
+#include <pygobject.h>
+
+void pyatk_register_classes (PyObject *d);
+void pyatk_add_constants(PyObject *module, const gchar *strip_prefix);
+
+extern PyMethodDef pyatk_functions[];
+
+DL_EXPORT(void)
+initatk(void)
+{
+ PyObject *m, *d;
+
+ init_pygobject ();
+
+ m = Py_InitModule ("atk", pyatk_functions);
+ d = PyModule_GetDict (m);
+
+ pyatk_register_classes (d);
+ pyatk_add_constants(m, "ATK_");
+
+ if (PyErr_Occurred ()) {
+ Py_FatalError ("can't initialise module atk");
+ }
+}
diff --git a/codegen/argtypes.py b/codegen/argtypes.py
index 5b0b3e55..2bdeb5ee 100644
--- a/codegen/argtypes.py
+++ b/codegen/argtypes.py
@@ -501,8 +501,12 @@ class ArgMatcher:
def register(self, ptype, handler):
self.argtypes[ptype] = handler
def register_enum(self, ptype, typecode):
- self.register(ptype, EnumArg(ptype, typecode))
+ if typecode is None:
+ typecode = "G_TYPE_NONE"
+ self.register(ptype, EnumArg(ptype, typecode))
def register_flag(self, ptype, typecode):
+ if typecode is None:
+ typecode = "G_TYPE_NONE"
self.register(ptype, FlagsArg(ptype, typecode))
def register_object(self, ptype, parent, typecode):
oa = ObjectArg(ptype, parent, typecode)
diff --git a/codegen/codegen.py b/codegen/codegen.py
index e11d8309..e0363a06 100644
--- a/codegen/codegen.py
+++ b/codegen/codegen.py
@@ -836,12 +836,17 @@ def write_enums(parser, prefix, fp=sys.stdout):
fp.write('\n/* ----------- enums and flags ----------- */\n\n')
fp.write('void\n' + prefix + '_add_constants(PyObject *module, const gchar *strip_prefix)\n{\n')
for enum in parser.enums:
- if enum.deftype == 'enum':
- fp.write(' pyg_enum_add_constants(module, %s, strip_prefix);\n'
- % (enum.typecode,))
+ if enum.typecode is None:
+ for nick, value in enum.values:
+ fp.write(' PyModule_AddIntConstant(module, pyg_constant_strip_prefix("%s", strip_prefix), %s);\n'
+ % (value, value))
else:
- fp.write(' pyg_flags_add_constants(module, %s, strip_prefix);\n'
- % (enum.typecode,))
+ if enum.deftype == 'enum':
+ fp.write(' pyg_enum_add_constants(module, %s, strip_prefix);\n'
+ % (enum.typecode,))
+ else:
+ fp.write(' pyg_flags_add_constants(module, %s, strip_prefix);\n'
+ % (enum.typecode,))
fp.write('}\n\n')
def write_source(parser, overrides, prefix, fp=FileOutput(sys.stdout)):
diff --git a/codegen/h2def.py b/codegen/h2def.py
index 2ea44c12..a5858009 100755
--- a/codegen/h2def.py
+++ b/codegen/h2def.py
@@ -252,7 +252,8 @@ def define_func(buf,fp):
args=arg_split_pat.split(args,', ')
for i in range(len(args)):
spaces = string.count(args[i], ' ')
- args[i] = string.replace(args[i], ' ', '-', spaces - 1)
+ if spaces > 1:
+ args[i] = string.replace(args[i], ' ', '-', 0)
write_func(fp, func, ret, args)
diff --git a/configure.in b/configure.in
index 2c269fd6..10127ab4 100644
--- a/configure.in
+++ b/configure.in
@@ -52,6 +52,10 @@ AC_SUBST(PANGO_CFLAGS)
AC_SUBST(PANGO_LIBS)
AM_PATH_GTK_2_0(1.3.11,,[AC_MSG_ERROR(maybe you want the gtk-gnome-1-2 branch?)],$extra_mods)
+PKG_CHECK_MODULES(ATK, atk >= 0.7,,[AC_MSG_ERROR(maybe you want the gtk-gnome-1-2 branch?)])
+AC_SUBST(ATK_CFLAGS)
+AC_SUBST(ATK_LIBS)
+
dnl check for libglade ...
build_libglade=false
PKG_CHECK_MODULES(LIBGLADE, [libglade-2.0 >= 1.99.1],
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c
index 40623e08..5792f551 100644
--- a/gobject/gobjectmodule.c
+++ b/gobject/gobjectmodule.c
@@ -524,7 +524,7 @@ pyg_boxed_new(GType boxed_type, gpointer boxed, gboolean copy_boxed,
static gint
pyg_enum_get_value(GType enum_type, PyObject *obj, gint *val)
{
- GEnumClass *eclass = G_ENUM_CLASS(g_type_class_ref(enum_type));
+ GEnumClass *eclass = NULL;
gint res = -1;
g_return_val_if_fail(val != NULL, -1);
@@ -535,8 +535,17 @@ pyg_enum_get_value(GType enum_type, PyObject *obj, gint *val)
*val = PyInt_AsLong(obj);
res = 0;
} else if (PyString_Check(obj)) {
+ GEnumValue *info;
char *str = PyString_AsString(obj);
- GEnumValue *info = g_enum_get_value_by_name(eclass, str);
+
+ if (enum_type != G_TYPE_NONE)
+ eclass = G_ENUM_CLASS(g_type_class_ref(enum_type));
+ else {
+ PyErr_SetString(PyExc_TypeError, "could not convert string to enum because there is no GType associated to look up the value");
+ res = -1;
+ }
+ info = g_enum_get_value_by_name(eclass, str);
+ g_type_class_unref(eclass);
if (!info)
info = g_enum_get_value_by_nick(eclass, str);
@@ -551,14 +560,13 @@ pyg_enum_get_value(GType enum_type, PyObject *obj, gint *val)
PyErr_SetString(PyExc_TypeError,"enum values must be strings or ints");
res = -1;
}
- g_type_class_unref(eclass);
return res;
}
static gint
pyg_flags_get_value(GType flag_type, PyObject *obj, gint *val)
{
- GFlagsClass *fclass = G_FLAGS_CLASS(g_type_class_ref(flag_type));
+ GFlagsClass *fclass = NULL;
gint res = -1;
g_return_val_if_fail(val != NULL, -1);
@@ -569,9 +577,18 @@ pyg_flags_get_value(GType flag_type, PyObject *obj, gint *val)
*val = PyInt_AsLong(obj);
res = 0;
} else if (PyString_Check(obj)) {
+ GFlagsValue *info;
char *str = PyString_AsString(obj);
- GFlagsValue *info = g_flags_get_value_by_name(fclass, str);
+ if (flag_type != G_TYPE_NONE)
+ fclass = G_FLAGS_CLASS(g_type_class_ref(flag_type));
+ else {
+ PyErr_SetString(PyExc_TypeError, "could not convert string to flag because there is no GType associated to look up the value");
+ res = -1;
+ }
+ info = g_flags_get_value_by_name(fclass, str);
+ g_type_class_unref(fclass);
+
if (!info)
info = g_flags_get_value_by_nick(fclass, str);
if (info) {
@@ -587,6 +604,14 @@ pyg_flags_get_value(GType flag_type, PyObject *obj, gint *val)
len = PyTuple_Size(obj);
*val = 0;
res = 0;
+
+ if (flag_type != G_TYPE_NONE)
+ fclass = G_FLAGS_CLASS(g_type_class_ref(flag_type));
+ else {
+ PyErr_SetString(PyExc_TypeError, "could not convert string to flag because there is no GType associated to look up the value");
+ res = -1;
+ }
+
for (i = 0; i < len; i++) {
PyObject *item = PyTuple_GetItem(obj, i);
char *str = PyString_AsString(item);
@@ -602,12 +627,12 @@ pyg_flags_get_value(GType flag_type, PyObject *obj, gint *val)
break;
}
}
+ g_type_class_unref(fclass);
} else {
PyErr_SetString(PyExc_TypeError,
"flag values must be strings, ints or tuples");
res = -1;
}
- g_type_class_unref(fclass);
return res;
}
@@ -2211,13 +2236,30 @@ static PyMethodDef pygobject_functions[] = {
/* ----------------- Constant extraction ------------------------ */
+static char *
+pyg_constant_strip_prefix(gchar *name, const gchar *strip_prefix)
+{
+ gint prefix_len;
+ guint j;
+
+ prefix_len = strlen(strip_prefix);
+
+ /* strip off prefix from value name, while keeping it a valid
+ * identifier */
+ for (j = prefix_len; j >= 0; j--) {
+ if (g_ascii_isalpha(name[j]) || name[j] == '_') {
+ return &name[j];
+ }
+ }
+ return name;
+}
+
static void
pyg_enum_add_constants(PyObject *module, GType enum_type,
const gchar *strip_prefix)
{
GEnumClass *eclass;
- guint i, j;
- gint prefix_len;
+ guint i;
/* a more useful warning */
if (!G_TYPE_IS_ENUM(enum_type)) {
@@ -2226,22 +2268,15 @@ pyg_enum_add_constants(PyObject *module, GType enum_type,
}
g_return_if_fail (strip_prefix != NULL);
- prefix_len = strlen(strip_prefix);
eclass = G_ENUM_CLASS(g_type_class_ref(enum_type));
for (i = 0; i < eclass->n_values; i++) {
gchar *name = eclass->values[i].value_name;
gint value = eclass->values[i].value;
- /* strip off prefix from value name, while keeping it a valid
- * identifier */
- for (j = prefix_len; j >= 0; j--) {
- if (g_ascii_isalpha(name[j]) || name[j] == '_') {
- name = &name[j];
- break;
- }
- }
- PyModule_AddIntConstant(module, name, (long) value);
+ PyModule_AddIntConstant(module,
+ pyg_constant_strip_prefix(name, strip_prefix),
+ (long) value);
}
g_type_class_unref(eclass);
@@ -2252,8 +2287,7 @@ pyg_flags_add_constants(PyObject *module, GType flags_type,
const gchar *strip_prefix)
{
GFlagsClass *fclass;
- guint i, j;
- gint prefix_len;
+ guint i;
/* a more useful warning */
if (!G_TYPE_IS_FLAGS(flags_type)) {
@@ -2262,22 +2296,15 @@ pyg_flags_add_constants(PyObject *module, GType flags_type,
}
g_return_if_fail (strip_prefix != NULL);
- prefix_len = strlen(strip_prefix);
fclass = G_FLAGS_CLASS(g_type_class_ref(flags_type));
for (i = 0; i < fclass->n_values; i++) {
gchar *name = fclass->values[i].value_name;
guint value = fclass->values[i].value;
- /* strip off prefix from value name, while keeping it a valid
- * identifier */
- for (j = prefix_len; j >= 0; j--) {
- if (g_ascii_isalpha(name[j]) || name[j] == '_') {
- name = &name[j];
- break;
- }
- }
- PyModule_AddIntConstant(module, name, (long) value);
+ PyModule_AddIntConstant(module,
+ pyg_constant_strip_prefix(name, strip_prefix),
+ (long) value);
}
g_type_class_unref(fclass);
@@ -2337,6 +2364,8 @@ static struct _PyGObject_Functions functions = {
pyg_fatal_exceptions_notify_add,
pyg_fatal_exceptions_notify_remove,
+
+ pyg_constant_strip_prefix,
};
DL_EXPORT(void)
diff --git a/gobject/pygobject.h b/gobject/pygobject.h
index 95fd84e4..f5d6d681 100644
--- a/gobject/pygobject.h
+++ b/gobject/pygobject.h
@@ -66,6 +66,9 @@ struct _PyGObject_Functions {
void (* fatal_exceptions_notify_add)(PyGFatalExceptionFunc func);
void (* fatal_exceptions_notify_remove)(PyGFatalExceptionFunc func);
+
+ gchar *(* constant_strip_prefix)(gchar *name,
+ const gchar *strip_prefix);
};
#ifndef _INSIDE_PYGOBJECT_
@@ -96,6 +99,7 @@ struct _PyGObject_Functions *_PyGObject_API;
#define pyg_flags_add_constants (_PyGObject_API->flags_add_constants)
#define pyg_fatal_exceptions_notify_add (_PyGObject_API->fatal_exceptions_notify_add)
#define pyg_fatal_exceptions_notify_remove (_PyGObject_API->fatal_exceptions_notify_remove)
+#define pyg_constant_strip_prefix (_PyGObject_API->constant_strip_prefix)
#define init_pygobject() { \
PyObject *gobject = PyImport_ImportModule("gobject"); \
diff --git a/gobjectmodule.c b/gobjectmodule.c
index 40623e08..5792f551 100644
--- a/gobjectmodule.c
+++ b/gobjectmodule.c
@@ -524,7 +524,7 @@ pyg_boxed_new(GType boxed_type, gpointer boxed, gboolean copy_boxed,
static gint
pyg_enum_get_value(GType enum_type, PyObject *obj, gint *val)
{
- GEnumClass *eclass = G_ENUM_CLASS(g_type_class_ref(enum_type));
+ GEnumClass *eclass = NULL;
gint res = -1;
g_return_val_if_fail(val != NULL, -1);
@@ -535,8 +535,17 @@ pyg_enum_get_value(GType enum_type, PyObject *obj, gint *val)
*val = PyInt_AsLong(obj);
res = 0;
} else if (PyString_Check(obj)) {
+ GEnumValue *info;
char *str = PyString_AsString(obj);
- GEnumValue *info = g_enum_get_value_by_name(eclass, str);
+
+ if (enum_type != G_TYPE_NONE)
+ eclass = G_ENUM_CLASS(g_type_class_ref(enum_type));
+ else {
+ PyErr_SetString(PyExc_TypeError, "could not convert string to enum because there is no GType associated to look up the value");
+ res = -1;
+ }
+ info = g_enum_get_value_by_name(eclass, str);
+ g_type_class_unref(eclass);
if (!info)
info = g_enum_get_value_by_nick(eclass, str);
@@ -551,14 +560,13 @@ pyg_enum_get_value(GType enum_type, PyObject *obj, gint *val)
PyErr_SetString(PyExc_TypeError,"enum values must be strings or ints");
res = -1;
}
- g_type_class_unref(eclass);
return res;
}
static gint
pyg_flags_get_value(GType flag_type, PyObject *obj, gint *val)
{
- GFlagsClass *fclass = G_FLAGS_CLASS(g_type_class_ref(flag_type));
+ GFlagsClass *fclass = NULL;
gint res = -1;
g_return_val_if_fail(val != NULL, -1);
@@ -569,9 +577,18 @@ pyg_flags_get_value(GType flag_type, PyObject *obj, gint *val)
*val = PyInt_AsLong(obj);
res = 0;
} else if (PyString_Check(obj)) {
+ GFlagsValue *info;
char *str = PyString_AsString(obj);
- GFlagsValue *info = g_flags_get_value_by_name(fclass, str);
+ if (flag_type != G_TYPE_NONE)
+ fclass = G_FLAGS_CLASS(g_type_class_ref(flag_type));
+ else {
+ PyErr_SetString(PyExc_TypeError, "could not convert string to flag because there is no GType associated to look up the value");
+ res = -1;
+ }
+ info = g_flags_get_value_by_name(fclass, str);
+ g_type_class_unref(fclass);
+
if (!info)
info = g_flags_get_value_by_nick(fclass, str);
if (info) {
@@ -587,6 +604,14 @@ pyg_flags_get_value(GType flag_type, PyObject *obj, gint *val)
len = PyTuple_Size(obj);
*val = 0;
res = 0;
+
+ if (flag_type != G_TYPE_NONE)
+ fclass = G_FLAGS_CLASS(g_type_class_ref(flag_type));
+ else {
+ PyErr_SetString(PyExc_TypeError, "could not convert string to flag because there is no GType associated to look up the value");
+ res = -1;
+ }
+
for (i = 0; i < len; i++) {
PyObject *item = PyTuple_GetItem(obj, i);
char *str = PyString_AsString(item);
@@ -602,12 +627,12 @@ pyg_flags_get_value(GType flag_type, PyObject *obj, gint *val)
break;
}
}
+ g_type_class_unref(fclass);
} else {
PyErr_SetString(PyExc_TypeError,
"flag values must be strings, ints or tuples");
res = -1;
}
- g_type_class_unref(fclass);
return res;
}
@@ -2211,13 +2236,30 @@ static PyMethodDef pygobject_functions[] = {
/* ----------------- Constant extraction ------------------------ */
+static char *
+pyg_constant_strip_prefix(gchar *name, const gchar *strip_prefix)
+{
+ gint prefix_len;
+ guint j;
+
+ prefix_len = strlen(strip_prefix);
+
+ /* strip off prefix from value name, while keeping it a valid
+ * identifier */
+ for (j = prefix_len; j >= 0; j--) {
+ if (g_ascii_isalpha(name[j]) || name[j] == '_') {
+ return &name[j];
+ }
+ }
+ return name;
+}
+
static void
pyg_enum_add_constants(PyObject *module, GType enum_type,
const gchar *strip_prefix)
{
GEnumClass *eclass;
- guint i, j;
- gint prefix_len;
+ guint i;
/* a more useful warning */
if (!G_TYPE_IS_ENUM(enum_type)) {
@@ -2226,22 +2268,15 @@ pyg_enum_add_constants(PyObject *module, GType enum_type,
}
g_return_if_fail (strip_prefix != NULL);
- prefix_len = strlen(strip_prefix);
eclass = G_ENUM_CLASS(g_type_class_ref(enum_type));
for (i = 0; i < eclass->n_values; i++) {
gchar *name = eclass->values[i].value_name;
gint value = eclass->values[i].value;
- /* strip off prefix from value name, while keeping it a valid
- * identifier */
- for (j = prefix_len; j >= 0; j--) {
- if (g_ascii_isalpha(name[j]) || name[j] == '_') {
- name = &name[j];
- break;
- }
- }
- PyModule_AddIntConstant(module, name, (long) value);
+ PyModule_AddIntConstant(module,
+ pyg_constant_strip_prefix(name, strip_prefix),
+ (long) value);
}
g_type_class_unref(eclass);
@@ -2252,8 +2287,7 @@ pyg_flags_add_constants(PyObject *module, GType flags_type,
const gchar *strip_prefix)
{
GFlagsClass *fclass;
- guint i, j;
- gint prefix_len;
+ guint i;
/* a more useful warning */
if (!G_TYPE_IS_FLAGS(flags_type)) {
@@ -2262,22 +2296,15 @@ pyg_flags_add_constants(PyObject *module, GType flags_type,
}
g_return_if_fail (strip_prefix != NULL);
- prefix_len = strlen(strip_prefix);
fclass = G_FLAGS_CLASS(g_type_class_ref(flags_type));
for (i = 0; i < fclass->n_values; i++) {
gchar *name = fclass->values[i].value_name;
guint value = fclass->values[i].value;
- /* strip off prefix from value name, while keeping it a valid
- * identifier */
- for (j = prefix_len; j >= 0; j--) {
- if (g_ascii_isalpha(name[j]) || name[j] == '_') {
- name = &name[j];
- break;
- }
- }
- PyModule_AddIntConstant(module, name, (long) value);
+ PyModule_AddIntConstant(module,
+ pyg_constant_strip_prefix(name, strip_prefix),
+ (long) value);
}
g_type_class_unref(fclass);
@@ -2337,6 +2364,8 @@ static struct _PyGObject_Functions functions = {
pyg_fatal_exceptions_notify_add,
pyg_fatal_exceptions_notify_remove,
+
+ pyg_constant_strip_prefix,
};
DL_EXPORT(void)
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index d4c15c5c..1bafc751 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -34,42 +34,39 @@ glademodule_la_SOURCES = \
pkginclude_HEADERS = pygtk.h
pkgincludedir = $(includedir)/pygtk-2.0/pygtk
-# chmod hack here is because automake guys decided distdir should be
-# read only for the next version :(
+DISTCLEANFILES = gtk.c gdk.c libglade.c
+
$(srcdir)/gtk.c: $(srcdir)/gtk.defs $(srcdir)/gdk.defs \
$(srcdir)/gtk-extrafuncs.defs $(srcdir)/gtk-types.defs \
$(srcdir)/gtk.override
- -chmod a+w $(srcdir)
- cd $(srcdir) \
- && $(PYTHON) ../codegen/codegen.py \
+ (cd $(srcdir) \
+ && $(PYTHON) ../codegen/codegen.py \
--register ../pango-types.defs \
--register gdk-types.defs \
--override gtk.override \
- --prefix pygtk gtk.defs > gen-gtk.c \
+ --prefix pygtk gtk.defs) > gen-gtk.c \
&& cp gen-gtk.c gtk.c \
&& rm -f gen-gtk.c
$(srcdir)/gdk.c: $(srcdir)/gdk.defs $(srcdir)/gdk-types.defs \
$(srcdir)/gdk.override
- -chmod a+w $(srcdir)
- cd $(srcdir) \
- && $(PYTHON) ../codegen/codegen.py \
+ (cd $(srcdir) \
+ && $(PYTHON) ../codegen/codegen.py \
--register ../pango-types.defs \
--register gtk-types.defs \
--override gdk.override \
- --prefix pygdk gdk.defs > gen-gdk.c \
+ --prefix pygdk gdk.defs) > gen-gdk.c \
&& cp gen-gdk.c gdk.c \
&& rm -f gen-gdk.c
$(srcdir)/libglade.c: $(srcdir)/libglade.defs $(srcdir)/libglade.override
- -chmod a+w $(srcdir)
- cd $(srcdir) \
- && $(PYTHON) ../codegen/codegen.py \
+ (cd $(srcdir) \
+ && $(PYTHON) ../codegen/codegen.py \
--register ../pango-types.defs \
--register gdk-types.defs \
--register gtk-types.defs \
--override libglade.override \
- --prefix pylibglade libglade.defs > gen-libglade.c \
+ --prefix pylibglade libglade.defs) > gen-libglade.c \
&& cp gen-libglade.c libglade.c \
&& rm -f gen-libglade.c
diff --git a/pygobject.h b/pygobject.h
index 95fd84e4..f5d6d681 100644
--- a/pygobject.h
+++ b/pygobject.h
@@ -66,6 +66,9 @@ struct _PyGObject_Functions {
void (* fatal_exceptions_notify_add)(PyGFatalExceptionFunc func);
void (* fatal_exceptions_notify_remove)(PyGFatalExceptionFunc func);
+
+ gchar *(* constant_strip_prefix)(gchar *name,
+ const gchar *strip_prefix);
};
#ifndef _INSIDE_PYGOBJECT_
@@ -96,6 +99,7 @@ struct _PyGObject_Functions *_PyGObject_API;
#define pyg_flags_add_constants (_PyGObject_API->flags_add_constants)
#define pyg_fatal_exceptions_notify_add (_PyGObject_API->fatal_exceptions_notify_add)
#define pyg_fatal_exceptions_notify_remove (_PyGObject_API->fatal_exceptions_notify_remove)
+#define pyg_constant_strip_prefix (_PyGObject_API->constant_strip_prefix)
#define init_pygobject() { \
PyObject *gobject = PyImport_ImportModule("gobject"); \