Skip to content
  • Jan Tojnar's avatar
    examples: Call GObject constructor in our constructors · 991754d6
    Jan Tojnar authored
    When overriding constructors, we need to call the parent constructor, otherwise GObject will not be properly initialized:
    
    >>> from importlib import import_module; ufia = import_module('examples.update-file-info-async')
    >>> ufia.UpdateFileInfoAsync()
    <update-file-info-async.UpdateFileInfoAsync object at 0x7f5fe326b5c0 (uninitialized at 0x(nil))>
    
    
    Furthermore, we can drop the constructors where we are not initializing any extra properties –
    then the constructor of the parent class (GObject will be called).
    
    We also need to ensure that GObject is the first parent class listed since otherwise,
    Python will try to call the constructor of the provider, which does not exist since it is an abstract class.
    
    We will keep it for TestExtension since it is the first example people reading the docs will see
    and hopefully that will reduce the amount of forgotten parent constructor calls.
    
    
    Noticed in https://github.com/linuxmint/nemo-extensions/commit/67a5d42489a1ae1715f620f281b62b8cc444d2d0
    991754d6