Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 1397 by [email protected]: [GObjectIntrospection] Failed to get GType of IBus.Engine in javascript
http://code.google.com/p/ibus/issues/detail?id=1397

What version of the product are you using? On what operating system?
OS (Linux distributions, UNIX or ...): opensuse 12.1
Architecture (i386, x86_64):i386
IBus version: 1.4
gtk version (if bug is about gtk applications): 3.2

Run the following javascript code

#!/usr/bin/env seed
const IBus = imports.gi.IBus;
    print("AttrList.type = " + IBus.AttrList.type);
    print("Attribute.type = " + IBus.Attribute.type);
    print("Bus.type = " + IBus.Bus.type);
    print("Component.type = " + IBus.Component.type);
    print("Config.type = " + IBus.Config.type);
    print("ConfigService.type = " + IBus.ConfigService.type);
    print("Engine.type = " + IBus.Engine.type);
    print("EngineDesc.type = " + IBus.EngineDesc.type);
    print("Factory.type = " + IBus.Factory.type);
    print("HotkeyProfile.type = " + IBus.HotkeyProfile.type);
    print("InputContext.type = " + IBus.InputContext.type);
    print("Keymap.type = " + IBus.Keymap.type);
    print("LookupTable.type = " + IBus.LookupTable.type);
    print("Object.type = " + IBus.Object.type);
    print("ObservedPath.type = " + IBus.ObservedPath.type);
    print("PanelService.type = " + IBus.PanelService.type);
    print("PropList.type = " + IBus.PropList.type);
    print("Property.type = " + IBus.Property.type);
    print("Proxy.type = " + IBus.Proxy.type);
    print("Serializable.type = " + IBus.Serializable.type);
    print("Service.type = " + IBus.Service.type);
    print("Text.type = " + IBus.Text.type);




Output:


AttrList.type = 134576336
Attribute.type = 134578176
Bus.type = 134578336
Component.type = 134578496
Config.type = 134764104
ConfigService.type = 134686464
Engine.type = [object gobject_named_constructor]
EngineDesc.type = 134688368
Factory.type = 134688616
HotkeyProfile.type = 134692432
InputContext.type = 134694472
Keymap.type = 134694680
LookupTable.type = 134698496
Object.type = 134576048
ObservedPath.type = 134716848
PanelService.type = 134717440
PropList.type = 134717648
Property.type = 134717848
Proxy.type = 134579768
Serializable.type = 134576160
Service.type = 134681416
Text.type = 134706000


All classes except Engine returns their GType, but Engine is not. "IBus.Engine.type" should call gobject macro "ibus_engine_get_type()", instead, maybe its calling "ibus_engine_new_type" . Without getting the GType of IBus.Engine, i cant instantiate it , and create new ibus engine. as ibus_factory_add_engine requires GType of IBUS_TYPE_ENGINE so i need the GType of ibus engine. This is not creating so much problem in another languages like vala or python because i can use "class" to create a subclass of ibus engine. But in javascript , subclassing a gobject require the GType of parent class.
Example,

newtext = new GType({
    name:"newtext",
    parent:IBus.Text.type
    });

newengine = new GType({
    name:"newengine",
    parent:IBus.Engine.type
    });

Output:

** (seed:3085): CRITICAL **: Line 9 in ./test.js: TypeError GType
constructor expected GType for parent

Here i can subclass Ibus.Text , but subclassing IBus.Engine failed because its not GType :(

Is this a bug or there is another way of getting GType of IBus.Engine ?

--
You received this message because you are subscribed to the Google
Groups "ibus-devel" group.
iBus project web page: http://code.google.com/p/ibus/
iBus dev group: http://groups.google.com/group/ibus-devel?hl=en

回复