lp:~therigu/unity-lens-applications/menu-entries-without-categories
- Get this branch:
- bzr branch lp:~therigu/unity-lens-applications/menu-entries-without-categories
Branch merges
- Mikkel Kamstrup Erlandsen (community): Disapprove
-
Diff: 79 lines (+33/-20)1 file modifiedsrc/unity-package-search.cc (+33/-20)
Related bugs
Bug #635223: Wine applications not listed in Unity Applications Place | Medium | Fix Released |
Related blueprints
Branch information
Recent revisions
- 100. By Adam Guthrie
-
Allow gmenu entries without categories in their respective .desktop files to indexed whilst still protecting against the case where unity cannot retrieve information from said .desktop file.
- 97. By Mikkel Kamstrup Erlandsen
-
Merge Mikkel's branch lp:~unity-team/unity-place-applications/global-search-fixes:
* Improves reliability of results in the global search mode
* Allows for searching apps by executable names. Not doing this resulted in lots of confused users that couldn't find Totem by typing "totem" because we only indexed it as "Movie Player"
* Some fixes in the de-duplication algorithm that could cause installed apps to only show up the Available group when they should be in the Installedd group
- 96. By Mikkel Kamstrup Erlandsen
-
Rebuild the application menu index on changes to the menu structure. Without this bugfix newly installed apps form Software Center will either not show up at all or show up in the Available section
- 95. By Mikkel Kamstrup Erlandsen
-
Too aggresive de-duplication of results could cause unique apps to be pruned from the results. This was especially visible when typing slowly.
Note: There still is another bug in the Unity rendering that causes some apps which are in the DeeModel to not be rendered. This is bug #609994: "Optimize texture memory usage for unexposed view icons"
--------- This line and the following will be ignored --------------
modified:
src/daemon.vala
src/utils.vala
unknown:
applications.place
log1.bustle
unity-place-applicati ons-0.2. 15.tar. gz
data/X-Unity- All-Application s.directory
data/X-Unity- Media.directory
data/unity-place- applications. menu
po/da.gmo
src/config.c
src/config.vala
src/daemon.c
src/schemas.c
src/unity-applications- daemon
src/unity_applications_ daemon. vala.stamp === modified file 'src/daemon.vala'
--- a/src/daemon.vala 2010-09-09 07:49:02 +0000
+++ b/src/daemon.vala 2010-09-13 12:58:15 +0000
@@ -422,7 +422,8 @@
}
else
{
- debug ("Doing filter search: '%s'", search.get_search_ string ());
+ debug ("Doing filter search on Most Used apps: '%s'",
+ search.get_search_ string ());
uint group = Group.MOST_USED;
Dee. ResultSet filter_set = results_ by_group. lookup (@"$group",
TermMatchFlag .EXACT) ;
@@ -435,8 +436,7 @@
app_ uris.add (ev.get_subject (0).get_uri ());
}- Unity.Applicati
onsPlace. apply_uri_ filter( app_uris,
- filter_set);
+ Utils.apply_uri_filter( app_uris, filter_set);
}debug ("Found %u/%u Most Used apps for query '%s'",
@@ -559,7 +559,8 @@
Set<string> available_uris = new HashSet<string> ();add_pkg_ search_ result (appresults, installed_uris, available_uris,
- model, results_by_group, is_filter_search);
+ model, Group.INSTALLED, results_by_group,
+ is_filter_search);timer.stop ();
debug ("Listed %i Installed apps in %fms for query: %s",
@@ -571,10 +572,11 @@
timer. start ();
var pkgresults = pkgsearcher.search (search_string);
add_ pkg_search_ result (pkgresults, installed_uris, available_uris,
- model, results_by_group, is_filter_search);
+ model, Group.AVAILABLE, results_by_group,
+ is_filter_search);
timer. stop ();
debug ("Listed %i Available apps in %fms for query: %s",
- appresults.num_hits, timer.elapsed ()*1000, search_string);
+ pkgresults.num_hits, timer.elapsed ()*1000, search_string);
}return false;
@@ -584,6 +586,7 @@
Set< string> installed_uris,
Set< string> available_uris,
Dee. Model model,
+ Group group,
Dee. Index results_by_group,
bool is_filter_search)
{
@@ -593,27 +596,42 @@
{
if (pkginfo.desktop_ file == null)
continue;
-
- string uri;
+
string desktop_id = Path.get_basename (pkginfo.desktop_ file);
AppInfo? app = appmanager.lookup (desktop_id);
- bool installed = app != null;if (app != null && !app.should_show ())
continue; - if (installed)
- uri = @"application://$(desktop_ id)";
- else
+ /* De-dupe by 'application://foo.desktop' URI */
+ string uri = @"application://$(desktop_ id)";
+ if (uri in installed_uris)
+ continue;
+
+ /* Apps that are not installed, ie. in the Available group
+ * use the 'unity-install: //pkgname/ Full App Name' URI scheme,
+ * but only use that after we've de-duped the results */
+ if (group == Group.AVAILABLE)
uri = @"unity-install: //$(pkginfo. package_ name)/$ (pkginfo. application_ name)"; - if (uri in installed_uris || uri in available_uris)
- continue;
-
- if (installed)
- installed_uris.add (uri);
- else
- available_uris.add (uri);
+ string display_name;
+ string comment;
+ switch (group)
+ {
+ case Group.INSTALLED:
+ installed_uris.add (uri);
+ display_name = app.get_display_ name ();
+ comment = app.get_description ();
+ break;
+ case Group.AVAILABLE:
+ available_uris.add (uri);
+ display_name = pkginfo.application_ name;
+ comment = "";
+ break;
+ default:
+ warning (@"Illegal group for package search $(group)");
+ continue;
+ }Icon icon = find_pkg_icon (pkginfo);
@@ -621,10 +639,10 @@
{
model. append (ResultsColumn.URI, uri,
ResultsCo lumn.ICON_ HINT, icon.to_string (),
- ResultsColumn.GROUP_ID, installed ? Group.INSTALLED : Group.AVAILABLE,
+ ResultsColumn.GROUP_ID, group,
ResultsCo lumn.MIMETYPE, "application/ x-desktop" ,
- ResultsColumn.DISPLAY_ NAME, installed ? app.get_ display_ name () : pkginfo. application_ name,
- ResultsColumn.COMMENT, app != null ? app.get_description () : "",
+ ResultsColumn.DISPLAY_ NAME, display_name,
+ ResultsColumn.COMMENT, comment,
- 1);
}
}
@@ -632,18 +650,20 @@
if (is_filter_search)
{
/* Filter the Installed group */
- uint group = Group.INSTALLED;
- var installed_set = results_by_group. lookup (@"$group",
- TermMatchFlag.EXACT);
- Unity.ApplicationsPlace. apply_uri_ filter (installed_uris,
- installed_set);
-
- /* Filter the Available group */
- group = Group.AVAILABLE;
- var available_set = results_by_group. lookup (@"$group",
- TermMatchFlag.EXACT);
- Unity.ApplicationsPlace. apply_uri_ filter (available_uris,
- available_set);
+ var filter_set = results_by_group. lookup (@"$((uint)group)",
+ TermMatchFlag.EXACT);
+ switch (group)
+ {
+ case Group.INSTALLED:
+ Utils.apply_uri_filter (installed_uris, filter_set);
+ break;
+ case Group.AVAILABLE:
+ Utils.apply_uri_filter (available_uris, filter_set);
+ break;
+ default:
+ warning (@"Illegal group for package search $(group)");
+ break;
+ }
}
}@@ -824,28 +844,6 @@
} /* END: class Daemon */
- /* Run through @filter_set and remove any row in which URI is not
- * in @valid_uris */
- public void apply_uri_filter (Set<string> valid_uris,
- Dee.ResultSet filter_set)
- {
- var model = filter_set.get_ model ();
- uint n_removed = 0;
-
- /* Anything in filter_set that is not in the event_uris set, is removed
- * from the results_model */
- foreach (var row in filter_set)
- {
- if (!(model.get_string (row, ResultsColumn.URI) in valid_uris))
- {
- model.remove (row);
- n_removed++;
- }
- }
-
- debug ("Removed %u rows from result set", n_removed);
- }
-
/*public void append_treedir_ with_group (GMenu. TreeDirectory treedir,
Dee. Model results,
uint group_id) === modified file 'src/utils.vala'
--- a/src/utils.vala 2010-09-06 13:22:00 +0000
+++ b/src/utils.vala 2010-09-13 12:58:29 +0000
@@ -118,7 +118,28 @@
else
return s1.strip () != s2.strip ();
}
-
- return true;
+ }
+
+ /* Run through @filter_set and remove any row in which URI is not
+ * in @valid_uris */
+ public void apply_uri_filter (Set<string> valid_uris,
+ Dee.ResultSet filter_set)
+ {
+ var model = filter_set.get_ model ();
+ uint n_removed = 0;
+
+ /* Anything in filter_set that is not in the event_uris set, is removed
+ * from the results_model */
+ foreach (var row in filter_set)
+ {
+ if (!(model.get_string (row, ResultsColumn.URI) in valid_uris))
+ {
+ //debug ("Removed: %s", model.get_string (row, ResultsColumn.URI));
+ model.remove (row);
+ n_removed++;
+ }
+ }
+
+ debug ("Removed %u rows from result set", n_removed);
}
} - 91. By Mikkel Kamstrup Erlandsen
-
Merge Mikkel's branch lp:~unity-team/unity-place-applications/i18nfixes:
* Fix an untranslatable string. Or to be precise - it was marked for translation, but was a Vala @-string which doesn't work with i18n generally.
* Fix a TRANSLATORS comment
Branch metadata
- Branch format:
- Branch format 7
- Repository format:
- Bazaar repository format 2a (needs bzr 1.16 or later)
- Stacked on:
- lp:unity-lens-applications