remote-search: require a DesktopId field in search providers

Remote search providers install an auxiliary keyfile to specify
static information, such as the object path/bus name needed to activate
the binary. Such keyfiles also specify the application the providers
pushes results for; currently, we support two formats for application
information
- two fields, "Title" and "Icon" that specify a (translatable) title and
  an icon name for display
- one field "DesktopId" that specifies the desktop file name of the
  application backing the provider, which obsoletes the previous
  Title/Icon syntax

Since all providers in GNOME use DesktopId now, and we need to ensure a
remote search providers is always backed by an application for future
development, this commit drops the support for the older syntax.

https://bugzilla.gnome.org/show_bug.cgi?id=687491
This commit is contained in:
Cosimo Cecchi 2012-11-01 09:50:38 -04:00
parent 9aefbd189c
commit 8e7758e280

View File

@ -60,7 +60,7 @@ function loadRemoteSearchProvidersFromDir(dir, loadedProviders, addProviderCallb
if (!keyfile.has_group(KEY_FILE_GROUP))
continue;
let remoteProvider, title;
let remoteProvider;
try {
let group = KEY_FILE_GROUP;
let busName = keyfile.get_string(group, 'BusName');
@ -74,25 +74,17 @@ function loadRemoteSearchProvidersFromDir(dir, loadedProviders, addProviderCallb
let desktopId = keyfile.get_string(group, 'DesktopId');
appInfo = Gio.DesktopAppInfo.new(desktopId);
} catch (e) {
log('Ignoring search provider ' + path + ': missing DesktopId');
continue;
}
let icon;
if (appInfo) {
icon = appInfo.get_icon();
title = appInfo.get_name();
} else {
let iconName = keyfile.get_string(group, 'Icon');
icon = new Gio.ThemedIcon({ name: iconName });
title = keyfile.get_locale_string(group, 'Title', null);
}
remoteProvider = new RemoteSearchProvider(title,
icon,
remoteProvider = new RemoteSearchProvider(appInfo.get_name(),
appInfo.get_icon(),
busName,
objectPath);
loadedProviders[objectPath] = remoteProvider;
} catch(e) {
log('Failed to add search provider "%s": %s'.format(title, e.toString()));
log('Failed to add search provider %s: %s'.format(path, e.toString()));
continue;
}