appDisplay: Properly check for TerminalEmulator in the Categories key

get_categories() returns an unparsed string, not a list of categories.
We need to parse the list by splitting on ';' to deterine whether the
actual 'TerminalEmulator' category is in the list, rather than something
like 'X-GNOME-TerminalEmulator'. It's an edge case, but I need to split
the list properly for the new folders, so I might as well fix this.

https://bugzilla.gnome.org/show_bug.cgi?id=723179
This commit is contained in:
Jasper St. Pierre 2014-01-28 12:09:35 -05:00
parent 634adc9f71
commit 887a21afb9

View File

@ -46,11 +46,18 @@ const INDICATORS_ANIMATION_MAX_TIME = 0.75;
const PAGE_SWITCH_TRESHOLD = 0.2; const PAGE_SWITCH_TRESHOLD = 0.2;
const PAGE_SWITCH_TIME = 0.3; const PAGE_SWITCH_TIME = 0.3;
function _getCategories(info) {
let categoriesStr = info.get_categories();
if (!categoriesStr)
return [];
return categoriesStr.split(';');
}
function _isTerminal(app) { function _isTerminal(app) {
let info = app.get_app_info(); let info = app.get_app_info();
if (!info) if (!info)
return false; return false;
let categories = info.get_categories() || []; let categories = _getCategories(info);
return categories.indexOf('TerminalEmulator') > -1; return categories.indexOf('TerminalEmulator') > -1;
} }