Merge lp:~abreu-alexandre/unity-webapps-gmail/fix-gmail-wmstartup-and-name into lp:unity-webapps-gmail

Proposed by Alexandre Abreu
Status: Merged
Merged at revision: 91
Proposed branch: lp:~abreu-alexandre/unity-webapps-gmail/fix-gmail-wmstartup-and-name
Merge into: lp:unity-webapps-gmail
Diff against target: 77 lines (+20/-19)
3 files modified
Gmailmailgooglecom.desktop (+3/-3)
debian/install (+1/-1)
scripts/update-desktop-file-unity-webapps-gmail.py (+16/-15)
To merge this branch: bzr merge lp:~abreu-alexandre/unity-webapps-gmail/fix-gmail-wmstartup-and-name
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Justin McPherson Approve
Review via email: mp+209525@code.launchpad.net

Commit message

GMail startupwmclass & various file names were messed up & not in sync w/ the webapp name (defined as 'Gmail')

Description of the change

GMail startupwmclass & various file names were messed up & not in sync w/ the webapp name (defined as 'Gmail')

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Justin McPherson (justinmcp) wrote :

APP_ID in the update script is also used to discover the .desktop files name. It will need to check both case forms to function correctly.

review: Needs Fixing
92. By Alexandre Abreu

handle both desktop filenames

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

> APP_ID in the update script is also used to discover the .desktop files name.
> It will need to check both case forms to function correctly.

updated

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
93. By Alexandre Abreu

fix premature return

Revision history for this message
Justin McPherson (justinmcp) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
David Barth (dbarth) wrote :

Fix applied correctly and verified to work in the silo build

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== renamed file 'GMailmailgooglecom.desktop' => 'Gmailmailgooglecom.desktop'
2--- GMailmailgooglecom.desktop 2013-09-24 16:15:51 +0000
3+++ Gmailmailgooglecom.desktop 2014-03-07 01:13:04 +0000
4@@ -1,9 +1,9 @@
5 [Desktop Entry]
6-Name=GMail
7+Name=Gmail
8 Type=Application
9 Icon=unity-webapps-gmail
10 MimeType=
11 Actions=S0;S1;S2;S3;S4;S5;S6;S7;S8;S9;S10;
12-Exec=unity-webapps-runner -n 'R01haWw=' -d 'mail.google.com' %u
13-StartupWMClass=GMailmailgooglecom
14+Exec=unity-webapps-runner -n 'R21haWw=' -d 'mail.google.com' %u
15+StartupWMClass=Gmailmailgooglecom
16
17\ No newline at end of file
18
19=== modified file 'debian/install'
20--- debian/install 2013-09-24 16:15:51 +0000
21+++ debian/install 2014-03-07 01:13:04 +0000
22@@ -6,4 +6,4 @@
23 64/unity-webapps-gmail.png usr/share/icons/unity-webapps-applications/64/apps
24 manifest.json usr/share/unity-webapps/userscripts/unity-webapps-gmail
25
26-GMailmailgooglecom.desktop usr/share/applications
27+Gmailmailgooglecom.desktop usr/share/applications
28
29=== modified file 'scripts/update-desktop-file-unity-webapps-gmail.py'
30--- scripts/update-desktop-file-unity-webapps-gmail.py 2013-09-24 16:15:51 +0000
31+++ scripts/update-desktop-file-unity-webapps-gmail.py 2014-03-07 01:13:04 +0000
32@@ -5,7 +5,8 @@
33 import glob
34 import re
35
36-APP_ID = 'GMailmailgooglecom'
37+APP_ID = 'Gmailmailgooglecom'
38+DESKTOP_FILENAMES = ['Gmailmailgooglecom.desktop', 'GMailmailgooglecom.desktop']
39
40 def get_local_applications_path():
41 return os.path.join(glib.get_user_data_dir(), 'applications')
42@@ -15,20 +16,20 @@
43 if not os.path.exists(local_applications_path) or not os.path.isdir(local_applications_path):
44 return
45
46- desktop_filename = os.path.join(local_applications_path, '{0}.desktop'.format(APP_ID))
47- if not os.path.exists(desktop_filename) or not os.path.isfile(desktop_filename):
48- return
49-
50- try:
51- desktop_file_content = open(desktop_filename).read()
52- start_idx = desktop_file_content.find('[Desktop Entry]')
53- if start_idx != -1 and desktop_file_content.find('StartupWMClass') == -1:
54- start_idx += len('[Desktop Entry]')
55- updated_desktop_file_content = desktop_file_content[:start_idx] + '\nStartupWMClass={0}'.format(APP_ID) + desktop_file_content[start_idx:]
56- open(desktop_filename, "w+").write(updated_desktop_file_content)
57- except Exception, e:
58- print 'Error while upgrading the desktop file: ', str(e)
59+ for desktop_filename in DESKTOP_FILENAMES:
60+ desktop_filename = os.path.join(local_applications_path, desktop_filename)
61+ if not os.path.exists(desktop_filename) or not os.path.isfile(desktop_filename):
62+ continue
63+ try:
64+ desktop_file_content = open(desktop_filename).read()
65+ start_idx = desktop_file_content.find('[Desktop Entry]')
66+ if start_idx != -1 and desktop_file_content.find('StartupWMClass') == -1:
67+ start_idx += len('[Desktop Entry]')
68+ updated_desktop_file_content = desktop_file_content[:start_idx] + '\nStartupWMClass={0}'.format(APP_ID) + desktop_file_content[start_idx:]
69+ open(desktop_filename, "w+").write(updated_desktop_file_content)
70+ except Exception, e:
71+ print 'Error while upgrading the desktop file: ', str(e)
72
73 if __name__ == "__main__":
74 update_desktop_file_startupwmclass()
75-
76\ No newline at end of file
77+

Subscribers

People subscribed via source and target branches

to all changes: