[gnome-shell] remoteSearch: Parse 'DesktopId' field in key file



commit bc91b7dcaec48f69d51685b41dec0f79c1b194a1
Author: Florian MÃllner <fmuellner gnome org>
Date:   Fri Jun 22 17:44:15 2012 +0200

    remoteSearch: Parse 'DesktopId' field in key file
    
    We strongly expect applications to use the same values for the
    'Title'/'Icon' fields in their search provider .ini file as the
    'Name'/'Icon' fields in their .desktop file. Rather than requiring
    applications to duplicate those fields, allow them to specify a
    'DesktopId' field instead to point to the corresponding .desktop
    file, which makes it possible to ship search provider files without
    translatable strings (which is nice given that merging translations
    into search provider files lacks a standard rule).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=678816

 js/ui/remoteSearch.js |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/remoteSearch.js b/js/ui/remoteSearch.js
index 6a03607..bf391d2 100644
--- a/js/ui/remoteSearch.js
+++ b/js/ui/remoteSearch.js
@@ -62,12 +62,26 @@ function loadRemoteSearchProvidersFromDir(dir, addProviderCallback) {
             let remoteProvider, title;
             try {
                 let group = KEY_FILE_GROUP;
-                let iconName = keyfile.get_string(group, 'Icon');
                 let busName = keyfile.get_string(group, 'BusName');
                 let objectPath = keyfile.get_string(group, 'ObjectPath');
-                title = keyfile.get_locale_string(group, 'Title', null);
 
-                let icon = new Gio.ThemedIcon({ name: iconName });
+                let appInfo = null;
+                try {
+                    let desktopId = keyfile.get_string(group, 'DesktopId');
+                    appInfo = Gio.DesktopAppInfo.new(desktopId);
+                } catch (e) {
+                }
+
+                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,
                                                           busName,



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