Merge lp:~gary-lasker/software-center/unity-launcher-integration-fixes into lp:software-center/5.2

Proposed by Gary Lasker
Status: Merged
Merged at revision: 3063
Proposed branch: lp:~gary-lasker/software-center/unity-launcher-integration-fixes
Merge into: lp:software-center/5.2
Diff against target: 308 lines (+83/-42)
7 files modified
softwarecenter/backend/installbackend_impl/aptd.py (+5/-3)
softwarecenter/backend/unitylauncher.py (+5/-5)
softwarecenter/enums.py (+3/-0)
softwarecenter/ui/gtk3/panes/availablepane.py (+47/-30)
softwarecenter/utils.py (+7/-1)
test/gtk3/test_unity_launcher_integration.py (+2/-2)
test/test_utils.py (+14/-1)
To merge this branch: bzr merge lp:~gary-lasker/software-center/unity-launcher-integration-fixes
Reviewer Review Type Date Requested Status
Michael Vogt Needs Fixing
Matthew Paul Thomas Needs Fixing
Review via email: mp+109976@code.launchpad.net

Commit message

* lp:~gary-lasker/software-center/unity-launcher-integration-fixes:
   - fix bug where for-purchase items are not being added to the Unity
     launcher (LP: #925014)
   - fix bug where the Unity launcher item for an application incorrectly
     points to its app-install-data desktop file rather than its installed
     desktop file (LP: #999427)
   - fix bug where an application's icon remains in the Unity launcher after
     the corresponding application has been uninstalled (LP: #981488)
   - fix bug where the Unity launcher fails to auto-hide after installation
     of a for-purchase item (LP: #1002440)
   - fix bug where items in the "Independent" section are not being added
     to the Unity launcher (LP: #1012877)

Description of the change

This branch delays the firing of the add-to-Unity-launcher dbus call until the corresponding application install has completed. By doing this, Software Center is able to determine the actual installed desktop file path as well as the correct icon path for the installed application (the latter now also works for purchased applications whose icons are stored in the user's software-center cache directory).

This branch fixes five important bugs and obviates the need for immediate corresponding fixes on the Unity side.

The bugs are:

  Bug 925014 - Purchased items are not being added to the Unity launcher
  Bug 999427 - Launcher items added via Ubuntu Software Center incorrectly point to the app-install desktop files rather than the actual installed desktop files
  Bug 981488 - Program's icon stays in Launcher after removing the program
  Bug 1002440 - Unity Launcher Fails To Auto-Hide When Enabled & Installing Commercial Software
  Bug 1012877 - Applications in the "Independent" section are not being added to the Unity launcher

Please see comment #11 of bug 925014 for discussion of this fix with Bilal on the Unity side.

The downside to this fix is that the icon is added at the end of the install now (upon receipt of the "transaction-complete" signal from aptdaemon), and so the "installing" animation in the Unity launcher will no longer occur. This seems a small price to pay, however, to be able to have the five bugs above fixed quickly and in a straightforward manner, fully on the Software Center side.

In addition, this will buy us any time that we may need to fix these bugs on the Unity side, and once this is done we will have the freedom to revert this change and return to the current behavior.

Note that with current Unity version, the newly-added icon will have the tooltip "Waiting to Install". Bilal has a fix for this, please see bug 925014 for his branch and its status.

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks for your work on this branch.

The code looks good, I like the fact that we have a fake PURCHASE_TRANSACTION_ID now
in enums for example.

One minor nitpick would be that I liked that we had a seperate function in 5.0 _register_unity_launcher_transaction_started() for on_transaction_started(). But
given how small it is now its probably not needed.

During manual testing I noticed a delay for up to 20s between the finish of the install and the fly-in animation. This needs to be investigated before this can be merged.
I reproduced this delay on both my quantal box and on precise (to ensure that its not a quantal artifact).

Revision history for this message
Matthew Paul Thomas (mpt) wrote :

Ideally, the Launcher item should appear as soon as the download begins. By the time installation finishes, you might have queued up several other things to install or remove, or even closed USC altogether.

In the short term, though, I guess for an item to show up in the Launcher five minutes late is still better than not showing up at all.

I tried r3054 of this branch with Qreator and with IntelliJ IDEA Community Edition.

It did not work at all with Qreator.

With IntelliJ, the Launcher item appeared about ten seconds after installation finished, but its tooltip said "Waiting to install".

review: Needs Fixing
Revision history for this message
Gary Lasker (gary-lasker) wrote :

Hey mpt and mvo! Thanks for the reviews.

Regarding the "waiting to install", that's a one line fix in Unity that Bilal already has a branch in review for (I mentioned it above, see the last paragraph of my MP description).

The dbus signal to Unity is fired by Software Center immediately at the end of install. Any delay from that moment is due to issues in the Unity side. To be specific, I have found that the animation on my machine doesn't happen until I actually "show" my hidden launcher. It's important to note that this is not a regression with this branch, I verified the exact same behavior with current software-center 5.2.2.2 in precise. So it appears to be a regression in Unity, which I will report. Is this the "delay" that you are seeing?

As I said, Software Center fires the dbus signal immediately at the end of the install. If Unity does its work, the animation will happen at that exact moment.

Michael, I didn't use the old code as a model but since I remember very well how it worked I just implemented it directly based on what we have now. While implementing I was thinking about making the registering an explicit method and I agree it's nicer, so I'll make that change. Thank you for the suggestion and for noticing it in the old code!

mpt, I don't see anything like "5 minutes later", unless the install takes 5 minutes (which I am assuming to be the case). But, let's be fair, quick installs add the launcher quickly, with the caveat that I mentioned above about the Launcher unhiding. But that is not related to this fix (as I mentioned above) as it also happens in the released USC. I'll test the packages that you tried to see why Qreater didn't get added.

For the record, I tested this carefully for many cases:

  1. normal installs from the Ubuntu archive
  2. multiple simultaneous installs from the Ubuntu archive
  3. a new purchase
  4. reinstalls of previous purchases

So, I'd like to be clear about what "needs fixing". Based on what I see above, this looks like:

  1. Make the _register_unity_launcher_transaction_started() improvement.
  2. Unity lands and SRUs the "Waiting to install" fix. However, that is outside the scope of this MP and I personally feel this should *not* delay our releasing this current fix as is as it takes care of so many high-target bugs for which we are understandably under a lot of pressure to fix. The Waiting to install message is annoying and ugly, but it's far less annoying and ugly than the bugs being fixed. And this message is cleared after a restart, so it's not permanent.
  3. Verify and figure out why Qreator is not being added. I did not hit this issue with any of the applications that I tested with so this may just be an issue with Qreator
  4. The launcher "unhide" needed before animation. Again, this is not in scope for this SRU as it is also the case even in released USC in Precise right now.

Sound good?

Revision history for this message
Michael Vogt (mvo) wrote :
Download full text (4.0 KiB)

On Wed, Jun 13, 2012 at 01:39:28PM -0000, Gary Lasker wrote:
> Hey mpt and mvo! Thanks for the reviews.
Hi Gary,

thanks for your feedback.

> Regarding the "waiting to install", that's a one line fix in Unity
> that Bilal already has a branch in review for (I mentioned it above,
> see the last paragraph of my MP description).

Yeah, we need to case the unity team to see if/why that merge is
blocked and if there is anything we can do to help getting this
unblocked.

> The dbus signal to Unity is fired by Software Center immediately at
> the end of install. Any delay from that moment is due to issues in
> the Unity side. To be specific, I have found that the animation on
> my machine doesn't happen until I actually "show" my hidden
> launcher. It's important to note that this is not a regression with
> this branch, I verified the exact same behavior with current
> software-center 5.2.2.2 in precise. So it appears to be a regression
> in Unity, which I will report. Is this the "delay" that you are
> seeing?

Yes, that is the delay I'm seeing. Its rather odd and needs
investigation and a bugreport for unity. With that delay the UI looks
rather odd, I had a 20s delay between USC telling me that the app is
installed before it was going to the launcher. Before this was also
there but it was mitigated because the install was usually still in
progress.

> Michael, I didn't use the old code as a model but since I remember
> very well how it worked I just implemented it directly based on what
> we have now. While implementing I was thinking about making the
> registering an explicit method and I agree it's nicer, so I'll make
> that change. Thank you for the suggestion and for noticing it in the
> old code!

Like I said in the review, its really minor and not a blocker.

> So, I'd like to be clear about what "needs fixing". Based on what I see above, this looks like:
>
> 1. Make the _register_unity_launcher_transaction_started()
> improvement.

Low priority, not a blocker (but a low hanging fruit).

> 2. Unity lands and SRUs the "Waiting to install" fix. However,
> that is outside the scope of this MP and I personally feel this
> should *not* delay our releasing this current fix as is as it takes
> care of so many high-target bugs for which we are understandably
> under a lot of pressure to fix. The Waiting to install message is
> annoying and ugly, but it's far less annoying and ugly than the bugs
> being fixed. And this message is cleared after a restart, so it's
> not permanent.

It makes the experience look unpolished, so we need to get in touch
with the unity guys and get information about if there is anything
that is blocking that merge and what we can do to help (and also what
SRU this can go into).

> 3. Verify and figure out why Qreator is not being added. I did not
> hit this issue with any of the applications that I tested with so
> this may just be an issue with Qreator

Yes, that needs investigation, I think its just the fact that it comes
from extras and that our guessing code is not smart enough in this
case. A good fix would be to look at /var/lib/dpkg/info/$pkgname.list
for any desktop file in there if $pkgname.desktop ...

Read more...

3055. By Gary Lasker

REFACTOR: just make a _register_unity_launcher_transaction_started() method. it's nicer

Revision history for this message
Gary Lasker (gary-lasker) wrote :

Interestingly, Qreator's desktop file is named "extras-qreator.desktop", and so yes, our guessing code is not good enough, but it seems that all (two) of the current packages in "Independent" have their desktop file name prepended with "extras-" in the form:

  extras-<pkgname>.desktop

So it seems a convention (sample size of 2) and I'll just add this to the guessing code as this ony applies to purchased and ARB apps only and this has been reliable for purchased apps for cycles now, so adding the extras check should take care of those cases similarly. I've added this now and it seems to work fine, and will write a new bug for this case.

Indeed, /var/lib/dpkg/info/qreator.list has the correct name for the desktop file, so if we decide we do need to parse these files we can do that in a separate branch, as you suggested.

3056. By Gary Lasker

also fix the bug where apps in extras.ubuntu.com are not being added to the Unity launcher, thanks mpt for finding this

3057. By Gary Lasker

add the actual bug number in the comment

Revision history for this message
Gary Lasker (gary-lasker) wrote :

I added bug 1012877 for the case of apps in the extras.ubuntu.com section, this is how also fixed in this branch.

3058. By Gary Lasker

send an empty string for the transaction ID value, this is expected in Bilal's corresponding Unity-side fix at lp:~bilalakhtar/unity/waiting-to-install-tooltip-925014

Revision history for this message
Gary Lasker (gary-lasker) wrote :

I took at look at Bilal's Unity side fix at https://code.launchpad.net/~bilalakhtar/unity/waiting-to-install-tooltip-925014/+merge/108858, and it looks to me to be approved now and ready for merging.

I noticed that his code is expecting an empty value for the transaction ID in the launcher dbus call in order to avoid displaying the "Waiting to install" tooltip, so I made that supporting change in this branch. Note that since we are firing the dbus call at the very end of the transaction now, this value will have no use at the launcher side anyway.

I've included a TODO in the code to document this for when we need to change this back.

Revision history for this message
Gary Lasker (gary-lasker) wrote :

I've submitted a new bug for the Unity team describing the delayed "fly to launcher" behavior when the Unity launcher is set to auto-hide. It's bug 1012896.

Revision history for this message
Bilal Akhtar (bilalakhtar) wrote :

I've fixed the delay bug in this branch:

https://code.launchpad.net/~bilalakhtar/unity/5.0series-sru-software-center-integration-fixes/+merge/110214

That branch also contains the fix to the Waiting to install tooltip and the "launcher stays stuck in revealed mode" bug.

Revision history for this message
Michael Vogt (mvo) wrote :

On Wed, Jun 13, 2012 at 09:20:26PM -0000, Gary Lasker wrote:
> Interestingly, Qreator's desktop file is named "extras-qreator.desktop", and so yes, our guessing code is not good enough, but it seems that all (two) of the current packages in "Independent" have their desktop file name prepended with "extras-" in the form:
>
> extras-<pkgname>.desktop
>
> So it seems a convention (sample size of 2) and I'll just add this to the guessing code as this ony applies to purchased and ARB apps only and this has been reliable for purchased apps for cycles now, so adding the extras check should take care of those cases similarly. I've added this now and it seems to work fine, and will write a new bug for this case.

Yeah, that is the convention for extras.ubuntu.com, thanks for fixing it.

> Indeed, /var/lib/dpkg/info/qreator.list has the correct name for the desktop file, so if we decide we do need to parse these files we can do that in a separate branch, as you suggested.

Could you please file a bug about this so that we can keep track of
it? This would fix it for all cases when we can't guess the desktop
file from the pkgname (unless there are multiple desktop files in the
package in which case we will have to guess or add them all ;).

Cheers,
 Michael

Revision history for this message
Gary Lasker (gary-lasker) wrote :

Bilal, I just want to say thank you very much for your super-fast response in making the needed fixes on the Unity side. :) As always, I very much appreciate your dedication and your good work!!

My best to you,
Gary

Revision history for this message
Gary Lasker (gary-lasker) wrote :

I have a note in to didrocks to try to help get Bilal's branch reviewed and to get an idea about the timeline for when we can expect the fix to appear in a Unity Precise SRU.

Revision history for this message
Michael Vogt (mvo) wrote :

Thanks Gary, that is great to hear.

I will unset the "Needs fixing" as the branch is fine and ready. Given that we need to wait for the current SRU I think the approach to get the timeline for a unity SRU and sync with that (if its not in the too distant future) is the best approach.

Revision history for this message
Michael Vogt (mvo) :
review: Approve
Revision history for this message
Michael Vogt (mvo) wrote :
Revision history for this message
Gary Lasker (gary-lasker) wrote :

I removed bug 946789 and bug 993224 from the changelog set and from the description as, although these are fixed as a side effect of the fix in the branch, the proper and final fix for these will be to have the Unity launcher service monitor all of the installation events from aptdaemon and to react to them accordingly. Since this work on the Unity side is being tracked in bug 1011681, I have marked the above two bugs as duplicates of that one.

Revision history for this message
Michael Vogt (mvo) wrote :

While we are waiting for the unity side, it would be great if you could address the points in:
https://code.launchpad.net/~gary-lasker/software-center/tech-items-to-launcher-fix-lp1006483/+merge/111135/comments/238731 to update the test to the new even sending behavior.

review: Needs Fixing
3059. By Gary Lasker

sync to latest 5.2 branch

Revision history for this message
Gary Lasker (gary-lasker) wrote :

Hi Michael, please check the separate MP for the enhanced set of unit tests here:

  https://code.launchpad.net/~gary-lasker/software-center/launcher-integration-unit-tests/+merge/115236

Thanks!

Revision history for this message
Michael Vogt (mvo) wrote :

On Mon, Jul 16, 2012 at 10:03:18PM -0000, Gary Lasker wrote:
> Hi Michael, please check the separate MP for the enhanced set of unit tests here:
>
> https://code.launchpad.net/~gary-lasker/software-center/launcher-integration-unit-tests/+merge/115236

Thanks for your work on this. I commented in the above
merge-proposal. Its good that the tests are covering the start/end now
and that more of the desktop file cases are checked now. Unfortunately
there seems to be a issue with the patch not quite patching the right
spot (see the MP) so that _fake_send_application_to_launcher_and_check
is not called. That will need addressing before this can land.

Thanks,
 Michael

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/backend/installbackend_impl/aptd.py'
2--- softwarecenter/backend/installbackend_impl/aptd.py 2012-06-28 08:10:33 +0000
3+++ softwarecenter/backend/installbackend_impl/aptd.py 2012-07-16 16:45:26 +0000
4@@ -29,7 +29,7 @@
5 obfuscate_private_ppa_details,
6 utf8,
7 )
8-from softwarecenter.enums import TransactionTypes
9+from softwarecenter.enums import TransactionTypes, PURCHASE_TRANSACTION_ID
10
11 from aptdaemon import client
12 from aptdaemon import enums
13@@ -67,11 +67,13 @@
14
15
16 class FakePurchaseTransaction(object):
17+
18 def __init__(self, app, iconname):
19 self.pkgname = app.pkgname
20 self.appname = app.appname
21 self.iconname = iconname
22 self.progress = 0
23+ self.tid = PURCHASE_TRANSACTION_ID
24
25
26 class AptdaemonTransaction(BaseTransaction):
27@@ -545,8 +547,6 @@
28 and finally installing the specified application once the
29 package list reload has completed.
30 """
31- self.emit("transaction-started", app.pkgname, app.appname,
32- "FIXME-NEED-ID-HERE", TransactionTypes.INSTALL)
33 self._logger.info("add_repo_add_key_and_install_app() '%s' '%s' '%s'" %
34 (re.sub("deb https://.*@", "", deb_line), # strip out password
35 signing_key_id,
36@@ -565,6 +565,8 @@
37 return
38 # done
39 fake_trans = FakePurchaseTransaction(app, iconname)
40+ self.emit("transaction-started", app.pkgname, app.appname,
41+ fake_trans.tid, TransactionTypes.INSTALL)
42 self.pending_purchases[app.pkgname] = fake_trans
43 else:
44 # FIXME: add authenticate_for_added_repo here
45
46=== modified file 'softwarecenter/backend/unitylauncher.py'
47--- softwarecenter/backend/unitylauncher.py 2012-04-24 14:22:29 +0000
48+++ softwarecenter/backend/unitylauncher.py 2012-07-16 16:45:26 +0000
49@@ -33,7 +33,7 @@
50 icon_x,
51 icon_y,
52 icon_size,
53- app_install_desktop_file_path,
54+ installed_desktop_file_path,
55 trans_id):
56 self.name = name
57 self.icon_name = icon_name
58@@ -41,7 +41,7 @@
59 self.icon_x = icon_x
60 self.icon_y = icon_y
61 self.icon_size = icon_size
62- self.app_install_desktop_file_path = app_install_desktop_file_path
63+ self.installed_desktop_file_path = installed_desktop_file_path
64 self.trans_id = trans_id
65
66
67@@ -73,8 +73,8 @@
68 launcher_info.name)
69 LOG.debug(" launcher_info.icon_file_path: ",
70 launcher_info.icon_file_path)
71- LOG.debug(" launcher_info.app_install_desktop_file_path: ",
72- launcher_info.app_install_desktop_file_path)
73+ LOG.debug(" launcher_info.installed_desktop_file_path: ",
74+ launcher_info.installed_desktop_file_path)
75 LOG.debug(" launcher_info.trans_id: ", launcher_info.trans_id)
76
77 try:
78@@ -89,7 +89,7 @@
79 launcher_info.icon_x,
80 launcher_info.icon_y,
81 launcher_info.icon_size,
82- launcher_info.app_install_desktop_file_path,
83+ launcher_info.installed_desktop_file_path,
84 launcher_info.trans_id)
85 except Exception as e:
86 LOG.warn("could not send dbus signal to the Unity launcher: (%s)",
87
88=== modified file 'softwarecenter/enums.py'
89--- softwarecenter/enums.py 2012-05-22 14:36:03 +0000
90+++ softwarecenter/enums.py 2012-07-16 16:45:26 +0000
91@@ -258,6 +258,9 @@
92 #carousel app limit to override limit in .menu file for category
93 TOP_RATED_CAROUSEL_LIMIT = 12
94
95+# Transaction ID for the "fake" purchase transaction
96+PURCHASE_TRANSACTION_ID = "FakePurchaseTransactionID"
97+
98 from .version import VERSION, DISTRO, RELEASE, CODENAME
99 USER_AGENT = "Software Center/%s (N;) %s/%s (%s)" % (
100 VERSION, DISTRO, RELEASE, CODENAME)
101
102=== modified file 'softwarecenter/ui/gtk3/panes/availablepane.py'
103--- softwarecenter/ui/gtk3/panes/availablepane.py 2012-06-28 08:10:33 +0000
104+++ softwarecenter/ui/gtk3/panes/availablepane.py 2012-07-16 16:45:26 +0000
105@@ -37,7 +37,8 @@
106 from softwarecenter.paths import APP_INSTALL_PATH
107 from softwarecenter.utils import (wait_for_apt_cache_ready,
108 get_exec_line_from_desktop,
109- get_file_path_from_iconname)
110+ get_file_path_from_iconname,
111+ convert_desktop_file_to_installed_location)
112 from softwarecenter.db.appfilter import AppFilter
113 from softwarecenter.db.database import Application
114
115@@ -381,13 +382,8 @@
116
117 def on_transaction_started(self, backend, pkgname, appname, trans_id,
118 trans_type):
119- # we only care about installs for the launcher, queue here for
120- # later, see #972710
121- if trans_type == TransactionTypes.INSTALL:
122- transaction_details = TransactionDetails(
123- pkgname, appname, trans_id, trans_type)
124- self.unity_launcher_transaction_queue[pkgname] = (
125- transaction_details)
126+ self._register_unity_launcher_transaction_started(pkgname, appname,
127+ trans_id, trans_type)
128
129 def on_transactions_changed(self, backend, pending_transactions):
130 """internal helper that keeps the action bar up-to-date by
131@@ -395,61 +391,82 @@
132 """
133 if self._is_custom_list_search(self.state.search_term):
134 self._update_action_bar()
135- # add app to unity launcher on the first sign of progress
136- # and remove from the pending queue once that is done
137- for pkgname in pending_transactions:
138- if pkgname in self.unity_launcher_transaction_queue:
139- transaction_details = (
140- self.unity_launcher_transaction_queue.pop(pkgname))
141- self._add_application_to_unity_launcher(transaction_details)
142
143 def on_transaction_complete(self, backend, result):
144 if result.pkgname in self.unity_launcher_transaction_queue:
145- self.unity_launcher_transaction_queue.pop(result.pkgname)
146+ transaction_details = (
147+ self.unity_launcher_transaction_queue.pop(result.pkgname))
148+ self._add_application_to_unity_launcher(transaction_details)
149+
150+ def _register_unity_launcher_transaction_started(self, pkgname, appname,
151+ trans_id, trans_type):
152+ # at the start of the transaction, we gather details for use later
153+ # when it is time to add the installed app to the Unity launcher,
154+ # (see #972710). we only care about installs for the launcher
155+ # mvo: use softwarecenter.utils explicitly here so that we can monkey
156+ # patch it in the test
157+ if (trans_type == TransactionTypes.INSTALL and
158+ self.add_to_launcher_enabled and
159+ softwarecenter.utils.is_unity_running()):
160+ transaction_details = TransactionDetails(
161+ pkgname, appname, trans_id, trans_type)
162+ self.unity_launcher_transaction_queue[pkgname] = (
163+ transaction_details)
164
165 def _add_application_to_unity_launcher(self, transaction_details):
166- if not self.add_to_launcher_enabled:
167- return
168- # mvo: use use softwarecenter.utils explicitly so that we can monkey
169- # patch it in the test
170- if not softwarecenter.utils.is_unity_running():
171- return
172-
173 app = Application(pkgname=transaction_details.pkgname,
174 appname=transaction_details.appname)
175 appdetails = app.get_details(self.db)
176+ # convert the app-install desktop file location to the actual installed
177+ # desktop file location (or in the case of a purchased item from the
178+ # agent, generate the correct installed desktop file location)
179+ installed_desktop_file_path = (
180+ convert_desktop_file_to_installed_location(appdetails.desktop_file,
181+ app.pkgname))
182 # we only add items to the launcher that have a desktop file
183- if not appdetails.desktop_file:
184+ if not installed_desktop_file_path:
185 return
186 # do not add apps that have no Exec entry in their desktop file
187 # (e.g. wine, see LP: #848437 or ubuntu-restricted-extras,
188 # see LP: #913756)
189- if (os.path.exists(appdetails.desktop_file) and
190- not get_exec_line_from_desktop(appdetails.desktop_file)):
191+ if (os.path.exists(installed_desktop_file_path) and
192+ not get_exec_line_from_desktop(installed_desktop_file_path)):
193 return
194
195 # now gather up the unity launcher info items and send the app to the
196 # launcher service
197 launcher_info = self._get_unity_launcher_info(app, appdetails,
198+ installed_desktop_file_path,
199 transaction_details.trans_id)
200 self.unity_launcher.send_application_to_launcher(
201 transaction_details.pkgname,
202 launcher_info)
203
204- def _get_unity_launcher_info(self, app, appdetails, trans_id):
205+ def _get_unity_launcher_info(
206+ self, app, appdetails, installed_desktop_file_path, trans_id):
207 (icon_size, icon_x, icon_y) = (
208 self._get_onscreen_icon_details_for_launcher_service(app))
209 icon_path = get_file_path_from_iconname(
210 self.icons,
211- iconname=appdetails.icon_file_name)
212+ iconname=appdetails.icon)
213+ # Note that the transaction ID is not specified because we are firing
214+ # the dbus signal at the very end of the installation now, and the
215+ # corresponding fix in Unity is expecting this value to be empty (it
216+ # would not be useful to the Unity launcher at this point anyway,
217+ # as the corresponding transaction would be complete).
218+ # Please see bug LP: #925014 and corresponding Unity branch for
219+ # further details.
220+ # TODO: If and when we re-implement firing the dbus signal at the
221+ # start of the transaction, at that time we will need to replace
222+ # the empty string below with the trans_id value.
223 launcher_info = UnityLauncherInfo(app.name,
224 appdetails.icon,
225 icon_path,
226 icon_x,
227 icon_y,
228 icon_size,
229- appdetails.desktop_file,
230- trans_id)
231+ installed_desktop_file_path,
232+ "")
233 return launcher_info
234
235 def _get_onscreen_icon_details_for_launcher_service(self, app):
236
237=== modified file 'softwarecenter/utils.py'
238--- softwarecenter/utils.py 2012-05-24 08:55:44 +0000
239+++ softwarecenter/utils.py 2012-07-16 16:45:26 +0000
240@@ -430,12 +430,18 @@
241 if os.path.exists(installed_desktop_file_path):
242 return installed_desktop_file_path
243 # lastly, just try checking directly for the desktop file based on the
244- # pkgname itself
245+ # pkgname itself for the case of for-purchase items, etc.
246 if pkgname:
247 installed_desktop_file_path = "/usr/share/applications/%s.desktop" %\
248 pkgname
249 if os.path.exists(installed_desktop_file_path):
250 return installed_desktop_file_path
251+ # files in the extras archive have their desktop filenames prepended
252+ # by "extras-", so we check for that also (LP: #1012877)
253+ extras_desktop_file_path = ("/usr/share/applications/"
254+ "extras-%s.desktop" % pkgname)
255+ if os.path.exists(extras_desktop_file_path):
256+ return extras_desktop_file_path
257 LOG.warn("Could not determine the installed desktop file path for "
258 "app-install desktop file: '%s'" % app_install_data_file_path)
259 return ""
260
261=== modified file 'test/gtk3/test_unity_launcher_integration.py'
262--- test/gtk3/test_unity_launcher_integration.py 2012-03-07 06:06:59 +0000
263+++ test/gtk3/test_unity_launcher_integration.py 2012-07-16 16:45:26 +0000
264@@ -87,8 +87,8 @@
265 # list view case) or 96 pixels (for the details view case)
266 self.assertTrue(launcher_info.icon_size == 32 or
267 launcher_info.icon_size == 96)
268- self.assertEqual(launcher_info.app_install_desktop_file_path,
269- self.expected_launcher_info.app_install_desktop_file_path)
270+ self.assertEqual(launcher_info.installed_desktop_file_path,
271+ self.expected_launcher_info.installed_desktop_file_path)
272 self.assertEqual(launcher_info.trans_id,
273 self.expected_launcher_info.trans_id)
274
275
276=== modified file 'test/test_utils.py'
277--- test/test_utils.py 2012-05-24 08:55:44 +0000
278+++ test/test_utils.py 2012-07-16 16:45:26 +0000
279@@ -18,8 +18,11 @@
280 from softwarecenter.utils import (decode_xml_char_reference,
281 release_filename_in_lists_from_deb_line,
282 get_http_proxy_string_from_libproxy,
283+ get_file_path_from_iconname,
284 )
285-from softwarecenter.testutils import do_events
286+from softwarecenter.testutils import (do_events,
287+ get_test_gtk3_icon_cache,
288+ )
289
290
291 class TestSCUtils(unittest.TestCase):
292@@ -215,6 +218,16 @@
293 # cleanup
294 shutil.rmtree(tmp)
295
296+ def test_get_file_path_from_iconname(self):
297+ icons = get_test_gtk3_icon_cache()
298+ icon_path = get_file_path_from_iconname(
299+ icons,
300+ "softwarecenter")
301+ self.assertEqual(
302+ icon_path,
303+ "/usr/share/icons/hicolor/48x48/apps/softwarecenter.svg")
304+
305+
306 class TestExpungeCache(unittest.TestCase):
307
308 def test_expunge_cache(self):

Subscribers

People subscribed via source and target branches