Logo Search packages:      
Sourcecode: inkscape version File versions

void Inkscape::Extension::Extension::set_state ( state_t  in_state  ) 

A function to set whether the extension should be loaded or unloaded.

Returns:
none
Parameters:
in_state Which state should the extension be in?
It checks to see if this is a state change or not. If we're changing states it will call the appropriate function in the implementation, load or unload. Currently, there is no error checking in this function. There should be.

Todo:
Need some more error checking here!

Definition at line 145 of file extension.cpp.

References _state, imp, Inkscape::Extension::Implementation::Implementation::load(), STATE_DEACTIVATED, STATE_LOADED, STATE_UNLOADED, timer, and Inkscape::Extension::Implementation::Implementation::unload().

Referenced by deactivate(), and ~Extension().

{
      if (_state == STATE_DEACTIVATED) return;
    if (in_state != _state) {
        /** \todo Need some more error checking here! */
            switch (in_state) {
                  case STATE_LOADED:
                        if (imp->load(this))
                              _state = STATE_LOADED;

                        if (timer != NULL) {
                              delete timer;
                        }
                        timer = new ExpirationTimer(this);

                        break;
                  case STATE_UNLOADED:
                        // std::cout << "Unloading: " << name << std::endl;
                        imp->unload(this);
                        _state = STATE_UNLOADED;

                        if (timer != NULL) {
                              delete timer;
                              timer = NULL;
                        }
                        break;
                  case STATE_DEACTIVATED:
                        _state = STATE_DEACTIVATED;

                        if (timer != NULL) {
                              delete timer;
                              timer = NULL;
                        }
                        break;
                  default:
                        break;
            }
    }

    return;
}


Generated by  Doxygen 1.6.0   Back to index