Skip to content

Commit

Permalink
Core: Moved Handler::getIcon() => API::getIcon() (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersevenrud committed Jan 4, 2015
1 parent a455023 commit fad100a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
19 changes: 18 additions & 1 deletion src/javascript/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,23 @@
return root + '/' + name + '.css';
}

/**
* Get a icon (wrapper for above methods)
*/
function doGetIcon(name, app, args) {
name = name || '';
if ( name.match(/\.\//) ) {
if ( (app instanceof OSjs.Core.Application) || (typeof app === 'string') ) {
return API.getApplicationResource(app, name);
} else {
if ( typeof app === 'object' ) {
return API.getApplicationResource(app.path, name);
}
}
}
return API.getThemeResource(name, 'icon', args);
}

/////////////////////////////////////////////////////////////////////////////
// BASE CLASSES
/////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1480,7 +1497,6 @@
// Handler shortcuts
OSjs.API.getDefaultPath = function(fallback) { return _HANDLER.getConfig('Core').Home || fallback || '/'; };
OSjs.API.getThemeResource = function(name, type, args) { return _HANDLER.getThemeResource(name, type, args); };
OSjs.API.getIcon = function(name, app) { return _HANDLER.getIcon(name, app); };

// Common API functions
OSjs.API._ = doTranslate;
Expand All @@ -1501,6 +1517,7 @@
OSjs.API.destroyLoading = destroyLoading;
OSjs.API.getApplicationResource = doGetApplicationResource;
OSjs.API.getThemeCSS = doGetThemeCSS;
OSjs.API.getIcon = doGetIcon;
OSjs.API.getDefaultSettings = OSjs.API.getDefaultSettings || function __noop__() { return {}; };
OSjs.API.getProcesses = function() { return _PROCS; };
OSjs.API.getHandlerInstance = function() { return OSjs.Handlers.getInstance(); };
Expand Down
17 changes: 0 additions & 17 deletions src/javascript/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -975,23 +975,6 @@
return name;
};

/**
* Default method for getting a icon (wrapper for above methods)
*/
DefaultHandler.prototype.getIcon = function(name, app, args) {
name = name || '';
if ( name.match(/\.\//) ) {
if ( (app instanceof OSjs.Core.Application) || (typeof app === 'string') ) {
return API.getApplicationResource(app, name);
} else {
if ( typeof app === 'object' ) {
return API.getApplicationResource(app.path, name);
}
}
}
return API.getThemeResource(name, 'icon', args);
};

//
// EXPORTS
//
Expand Down

0 comments on commit fad100a

Please sign in to comment.