* added new virtual method -- load -- to perform the actual initialization
BasicItemFactory:
* implemented 'create' method
git-svn-id: file:///svnroot/simple-launcher/trunk@235
3ba93dab-e023-0410-b42a-
de7732cf370a
BasicItemFactory::BasicItemFactory() {
registerFactory(factoryName(), this);
}
+
+BasicItem *BasicItemFactory::create(const std::string& factoryName, const std::string& itemID) {
+ BasicItemFactory *factory = ourFactories.find(factoryName);
+ BasicItem *result = NULL;
+
+ if (factory != NULL) {
+ result = factory->createItem(itemID);
+
+ if (result != NULL) {
+ if (!result->load()) {
+ delete result;
+
+ result = NULL;
+ }
+ }
+ }
+
+ return result;
+}
const std::string& getType() const { return myType; }
const std::string& getID() const { return myID; }
+ virtual bool load() = 0;
+
virtual std::string getName() const = 0;
virtual std::string getComment() const = 0;
virtual GdkPixbuf *getIcon(int iconSize) const = 0;