Logo Search packages:      
Sourcecode: inkscape version File versions

bool Inkscape::Extension::Extension::check ( void   )  [virtual]

A function to check the validity of the extension.

Returns:
A boolean saying whether the extension passed the checks This function chekcs to make sure that there is an id, a name, a repr and an implemenation for this extension. Then it checks all of the dependencies to see if they pass. Finally, it asks the implmentation to do a check of itself.
On each check, if there is a failure, it will print a message to the error log for that failure. It is important to note that the function keeps executing if it finds an error, to try and get as many of them into the error log as possible. This should help people debug installations, and figure out what they need to get for the full functionality of Inkscape to be available.

Definition at line 224 of file extension.cpp.

References _deps, Inkscape::Extension::Implementation::Implementation::check(), error_file, imp, name, printFailure(), and repr.

{
      bool retval = true;

      // static int i = 0;
      // std::cout << "Checking module[" << i++ << "]: " << name << std::endl;

      const char * inx_failure = _("  This is caused by an improper .inx file for this extension."
                                     "  An improper .inx file could have been caused by a faulty installation of Inkscape.");
      if (id == NULL) {
            printFailure(Glib::ustring(_("an ID was not defined for it.")) + inx_failure);
            retval = false;
      }
      if (name == NULL) {
            printFailure(Glib::ustring(_("there was no name defined for it.")) + inx_failure);
            retval = false;
      }
      if (repr == NULL) {
            printFailure(Glib::ustring(_("the XML description of it got lost.")) + inx_failure);
            retval = false;
      }
      if (imp == NULL) {
            printFailure(Glib::ustring(_("no implementation was defined for the extension.")) + inx_failure);
            retval = false;
      }

      for (unsigned int i = 0 ; i < _deps.size(); i++) {
            if (_deps[i]->check() == FALSE) {
                  // std::cout << "Failed: " << *(_deps[i]) << std::endl;
                  printFailure(Glib::ustring(_("a dependency was not met.")));
                  error_file << *_deps[i] << std::endl;
                  retval = false;
            }
      }

      if (retval)
            return imp->check(this);
      return retval;
}


Generated by  Doxygen 1.6.0   Back to index