Merge lp:~fboucault/unity-2d/differentiate_apps_with_same_executable into lp:unity-2d/3.0

Proposed by Florian Boucault
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 538
Merged at revision: 543
Proposed branch: lp:~fboucault/unity-2d/differentiate_apps_with_same_executable
Merge into: lp:unity-2d/3.0
Diff against target: 37 lines (+20/-0)
1 file modified
launcher/UnityApplications/launcherapplicationslist.cpp (+20/-0)
To merge this branch: bzr merge lp:~fboucault/unity-2d/differentiate_apps_with_same_executable
Reviewer Review Type Date Requested Status
Olivier Tilloy (community) Approve
Review via email: mp+57875@code.launchpad.net

Description of the change

[launcher] Support for distinct applications that have the same executable but different desktop files.

To post a comment you must log in.
Revision history for this message
Olivier Tilloy (osomon) wrote :

Awesome, this also seems to fix bug #759776! (at least in the case of synaptic, I cannot reproduce the bug for empathy)

Revision history for this message
Olivier Tilloy (osomon) wrote :

It fixes the bugs linked, nice…

… BUT it introduces a regression: launching nautilus (either from the default favorite icon or from the dash) adds a new home folder icon to the launcher instead of marking the existing one active.

review: Needs Fixing
Revision history for this message
Florian Boucault (fboucault) wrote :

Good catch Olivier. We are hitting the same old bamf bug where sometimes nautilus is given as desktop file 'nautilus-home.desktop' and sometimes 'nautilus.desktop'. Unity hits the same bug if you first killall bamfdaemon.

Revision history for this message
Florian Boucault (fboucault) wrote :
Revision history for this message
Florian Boucault (fboucault) wrote :

$ Start Unity

Unity does not exhibit the bug.

$ killall bamfdaemon

Unity exhibits the bug.

$ unity --replace

Unity does not exhibit the bug anymore.

Revision history for this message
Florian Boucault (fboucault) wrote :

Bug finally registered against Unity: https://bugs.launchpad.net/unity/+bug/762898

Revision history for this message
Florian Boucault (fboucault) wrote :

An easy workaround for new Unity 2D users is to change the default favorite from nautilus-home.desktop to nautilus.desktop

Revision history for this message
Florian Boucault (fboucault) wrote :

Does the code look ok btw?

537. By Florian Boucault

Merged from trunk.

538. By Florian Boucault

Register favorites' desktop files.

Revision history for this message
Olivier Tilloy (osomon) wrote :

This works well, it fixes both bug #739454, bug #759776 and bug #760522, and despite stress-testing I wasn’t able to observe any regressions.

Note: it is critical that we don’t forget to push a new version of libqtbamf before pushing a new version of unity-2d.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/UnityApplications/launcherapplicationslist.cpp'
2--- launcher/UnityApplications/launcherapplicationslist.cpp 2011-04-15 17:37:34 +0000
3+++ launcher/UnityApplications/launcherapplicationslist.cpp 2011-04-18 10:19:39 +0000
4@@ -232,6 +232,15 @@
5 } else if (m_applicationForExecutable.contains(executable)) {
6 /* A LauncherApplication with the same executable already exists */
7 matchingApplication = m_applicationForExecutable[executable];
8+ /* If the application already registered for that executable has a
9+ desktop file assigned then make sure that the one to be inserted
10+ has the same desktop file.
11+ */
12+ QString matchingDesktopFile = matchingApplication->desktop_file();
13+ if (!matchingDesktopFile.isEmpty() && !desktop_file.isEmpty() &&
14+ matchingDesktopFile != desktop_file) {
15+ matchingApplication = NULL;
16+ }
17 }
18
19 if (matchingApplication != NULL) {
20@@ -265,6 +274,17 @@
21 << desktop_file << ")";
22 delete application;
23 } else {
24+ /* Register favorite desktop file into BAMF: applications with the same
25+ executable file will match with the given desktop file. This replicates
26+ the behaviour of Unity that does it automatically when calling libbamf's
27+ bamf_matcher_get_application_for_desktop_file.
28+ It fixes bug https://bugs.launchpad.net/unity-2d/+bug/739454
29+ The need for that API call is odd and causes at least one bug:
30+ https://bugs.launchpad.net/unity/+bug/762898
31+ */
32+ BamfMatcher& matcher = BamfMatcher::get_default();
33+ matcher.register_favorites(QStringList(application->desktop_file()));
34+
35 insertApplication(application);
36 application->setSticky(true);
37 }

Subscribers

People subscribed via source and target branches