[gobject-introspection] Properly handle GParamSpec and descendants
- From: Pavel Holejsovsky <pholejs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] Properly handle GParamSpec and descendants
- Date: Thu, 25 Aug 2011 17:43:05 +0000 (UTC)
commit 2ea2bd7c18a9f9ff9293201172dfd3e83d2f5f26
Author: Pavel Holejsovsky <pholejs src gnome org>
Date: Sat Aug 13 13:10:53 2011 +0200
Properly handle GParamSpec and descendants
GParamSpec is introspected as fundamental class, and all GObject
classes derived from it (e.g. GParamSpecChar) are marked as such.
https://bugzilla.gnome.org/show_bug.cgi?id=656440
giscanner/gdumpparser.py | 27 +++++++++++++++++++++------
1 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py
index f94917e..eb074a9 100644
--- a/giscanner/gdumpparser.py
+++ b/giscanner/gdumpparser.py
@@ -29,6 +29,7 @@ from . import ast
from . import message
from . import utils
from .transformer import TransformerException
+from .utils import to_underscores
# GParamFlags
G_PARAM_READABLE = 1 << 0
@@ -175,11 +176,7 @@ blob containing data gleaned from GObject's primitive introspection."""
def _create_gobject(self, node):
symbol = 'intern'
parent_gitype = None
- if node.name == 'ParamSpec':
- type_name = 'GParam'
- # Some function use g_param_value instead
- c_symbol_prefix = 'param_spec'
- elif node.name == 'Object':
+ if node.name == 'Object':
type_name = 'GObject'
c_symbol_prefix = 'object'
elif node.name == 'InitiallyUnowned':
@@ -248,8 +245,26 @@ blob containing data gleaned from GObject's primitive introspection."""
def _initparse_gobject_record(self, record):
# Special handling for when we're parsing GObject / GLib
- if record.name in ('Object', 'InitiallyUnowned', 'ParamSpec'):
+ if record.name in ('Object', 'InitiallyUnowned'):
self._create_gobject(record)
+ elif (record.name.startswith('ParamSpec')
+ and not record.name in ('ParamSpecPool', 'ParamSpecClass',
+ 'ParamSpecTypeInfo')):
+ parent = None
+ if record.name != 'ParamSpec':
+ parent = ast.Type(target_giname='GObject.ParamSpec')
+ prefix = to_underscores(record.name).lower()
+ node = ast.Class(record.name, parent,
+ ctype=record.ctype,
+ # GParamSpecXxx has g_type_name 'GParamXxx'
+ gtype_name=record.ctype.replace('Spec', ''),
+ get_type='intern',
+ c_symbol_prefix=prefix)
+ node.fundamental = True
+ if record.name == 'ParamSpec':
+ node.is_abstract = True
+ self._add_record_fields(node)
+ self._namespace.append(node, replace=True)
elif record.name == 'Variant':
self._boxed_types['GVariant'] = ast.Boxed('Variant',
gtype_name='GVariant',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]