[gnome-shell] remote-search: require a DesktopId field in search providers



commit 8e7758e280d7b9dc2977526d60d1f5377a6d3f00
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Nov 1 09:50:38 2012 -0400

    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

 js/ui/remoteSearch.js |   20 ++++++--------------
 1 files changed, 6 insertions(+), 14 deletions(-)
---
diff --git a/js/ui/remoteSearch.js b/js/ui/remoteSearch.js
index 35176f4..0625475 100644
--- a/js/ui/remoteSearch.js
+++ b/js/ui/remoteSearch.js
@@ -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;
             }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]