Merge lp:~abreu-alexandre/webapps-applications/fix-migration-script-icon-order into lp:ubuntu/quantal/webapps-applications

Proposed by Alexandre Abreu
Status: Merged
Merge reported by: Ken VanDine
Merged at revision: not available
Proposed branch: lp:~abreu-alexandre/webapps-applications/fix-migration-script-icon-order
Merge into: lp:ubuntu/quantal/webapps-applications
Diff against target: 79 lines (+23/-22)
3 files modified
debian/patches/dont-add-launchers-on-edubuntu (+0/-20)
debian/patches/series (+1/-1)
scripts/install-default-webapps-in-launcher.py (+22/-1)
To merge this branch: bzr merge lp:~abreu-alexandre/webapps-applications/fix-migration-script-icon-order
Reviewer Review Type Date Requested Status
Ken VanDine Approve
Ubuntu Development Team Pending
Review via email: mp+128120@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Looks good, this has already been uploaded to quantal-proposed and merged into lp:ubuntu/quantal-proposed/webapps-applications

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'debian/patches/dont-add-launchers-on-edubuntu'
2--- debian/patches/dont-add-launchers-on-edubuntu 2012-09-25 16:58:17 +0000
3+++ debian/patches/dont-add-launchers-on-edubuntu 1970-01-01 00:00:00 +0000
4@@ -1,20 +0,0 @@
5---- webapps-applications-2.4.6.orig/scripts/install-default-webapps-in-launcher.py
6-+++ webapps-applications-2.4.6/scripts/install-default-webapps-in-launcher.py
7-@@ -1,5 +1,6 @@
8- #!/usr/bin/python
9- from gi.repository import Gio
10-+import os
11-
12- PREINSTALLED_LAUNCHER_DESKTOP_FILES = ["application://ubuntu-amazon-default.desktop", "application://UbuntuOneMusiconeubuntucom.desktop"]
13-
14-@@ -7,6 +8,10 @@ UNITY_LAUNCHER_SETTINGS = "com.canonical
15- UNITY_LAUNCHER_FAVORITE_KEY = "favorites"
16-
17- def install_default_webapps_in_launcher():
18-+ # Workaround for the script triggering on systems where it shouldn't.
19-+ if os.path.exists("/usr/share/glib-2.0/schemas/95_edubuntu-artwork.gschema.override"):
20-+ return
21-+
22- new_desktop_files = PREINSTALLED_LAUNCHER_DESKTOP_FILES
23-
24- if len(new_desktop_files) != 0:
25
26=== modified file 'debian/patches/series'
27--- debian/patches/series 2012-10-04 02:38:54 +0000
28+++ debian/patches/series 2012-10-04 21:44:22 +0000
29@@ -1,1 +1,1 @@
30-dont-add-launchers-on-edubuntu
31+
32
33=== modified file 'scripts/install-default-webapps-in-launcher.py'
34--- scripts/install-default-webapps-in-launcher.py 2012-10-04 00:05:53 +0000
35+++ scripts/install-default-webapps-in-launcher.py 2012-10-04 21:44:22 +0000
36@@ -1,12 +1,18 @@
37 #!/usr/bin/python
38 from gi.repository import Gio
39+import os
40
41 PREINSTALLED_LAUNCHER_DESKTOP_FILES = ["application://ubuntu-amazon-default.desktop", "application://UbuntuOneMusiconeubuntucom.desktop"]
42+AFTER_ICON = "unity://running-apps"
43
44 UNITY_LAUNCHER_SETTINGS = "com.canonical.Unity.Launcher"
45 UNITY_LAUNCHER_FAVORITE_KEY = "favorites"
46
47 def install_default_webapps_in_launcher():
48+ # Workaround for the script triggering on systems where it shouldn't.
49+ if os.path.exists("/usr/share/glib-2.0/schemas/95_edubuntu-artwork.gschema.override"):
50+ return
51+
52 new_desktop_files = PREINSTALLED_LAUNCHER_DESKTOP_FILES
53
54 if len(new_desktop_files) != 0:
55@@ -18,8 +24,23 @@
56 favorites = settings.get_strv(UNITY_LAUNCHER_FAVORITE_KEY)
57
58 # only append the desktop icons that are not already present in the favorites list if any
59- favorites.extend([desktop_file for desktop_file in new_desktop_files if not desktop_file in favorites])
60+ to_add = [d for d in new_desktop_files if not d in favorites]
61+ available_desktop_files = [d for d in favorites if ".desktop" in d]
62+ new_index = -1
63
64+ if len(available_desktop_files):
65+ new_index = favorites.index(available_desktop_files[-1]) + 1
66+ elif AFTER_ICON in favorites:
67+ new_index = favorites.index(AFTER_ICON)
68+
69+ if new_index >= 0:
70+ new_index = favorites.index(AFTER_ICON)
71+ next = favorites[new_index:]
72+ favorites[new_index:] = to_add
73+ favorites.extend(next)
74+ else:
75+ favorites.extend(to_add)
76+
77 settings.set_strv(UNITY_LAUNCHER_FAVORITE_KEY, favorites)
78 settings.sync()
79 except:

Subscribers

People subscribed via source and target branches