Merge lp:~ken-vandine/unity-webapps-cnn-news/lp1369208 into lp:unity-webapps-cnn-news

Proposed by Ken VanDine on 2015-09-29
Status: Merged
Approved by: Alexandre Abreu on 2015-11-19
Approved revision: 31
Merged at revision: 30
Proposed branch: lp:~ken-vandine/unity-webapps-cnn-news/lp1369208
Merge into: lp:unity-webapps-cnn-news
Diff against target: 46 lines (+0/-35)
2 files modified
debian/unity-webapps-cnn-news.migrations (+0/-1)
scripts/update-desktop-file-unity-webapps-cnn-news.py (+0/-34)
To merge this branch: bzr merge lp:~ken-vandine/unity-webapps-cnn-news/lp1369208
Reviewer Review Type Date Requested Status
Alexandre Abreu (community) 2015-09-29 Approve on 2015-11-19
Review via email: mp+272794@code.launchpad.net

Commit message

When using gi.repository you must not import static modules like gobject, patch thanks to Puspendu Banerjee (LP: #1369208)

Description of the change

When using gi.repository you must not import static modules like gobject, patch thanks to Puspendu Banerjee (LP: #1369208)

To post a comment you must log in.
31. By Ken VanDine on 2015-09-29

dropped migration script, no longer needed

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== removed file 'debian/unity-webapps-cnn-news.migrations'
--- debian/unity-webapps-cnn-news.migrations 2013-09-24 16:18:33 +0000
+++ debian/unity-webapps-cnn-news.migrations 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
1scripts/update-desktop-file-unity-webapps-cnn-news.py
20
=== removed directory 'scripts'
=== removed file 'scripts/update-desktop-file-unity-webapps-cnn-news.py'
--- scripts/update-desktop-file-unity-webapps-cnn-news.py 2013-09-24 16:18:33 +0000
+++ scripts/update-desktop-file-unity-webapps-cnn-news.py 1970-01-01 00:00:00 +0000
@@ -1,34 +0,0 @@
1#!/usr/bin/python
2from gi.repository import Gio
3import os
4import glib
5import glob
6import re
7
8APP_ID = 'cnn-newscnncom'
9
10def get_local_applications_path():
11 return os.path.join(glib.get_user_data_dir(), 'applications')
12
13def update_desktop_file_startupwmclass():
14 local_applications_path = get_local_applications_path()
15 if not os.path.exists(local_applications_path) or not os.path.isdir(local_applications_path):
16 return
17
18 desktop_filename = os.path.join(local_applications_path, '{0}.desktop'.format(APP_ID))
19 if not os.path.exists(desktop_filename) or not os.path.isfile(desktop_filename):
20 return
21
22 try:
23 desktop_file_content = open(desktop_filename).read()
24 start_idx = desktop_file_content.find('[Desktop Entry]')
25 if start_idx != -1 and desktop_file_content.find('StartupWMClass') == -1:
26 start_idx += len('[Desktop Entry]')
27 updated_desktop_file_content = desktop_file_content[:start_idx] + '\nStartupWMClass={0}'.format(APP_ID) + desktop_file_content[start_idx:]
28 open(desktop_filename, "w+").write(updated_desktop_file_content)
29 except Exception, e:
30 print 'Error while upgrading the desktop file: ', str(e)
31
32if __name__ == "__main__":
33 update_desktop_file_startupwmclass()
34
35\ No newline at end of file0\ No newline at end of file

Subscribers

People subscribed via source and target branches

to all changes: