Merge lp:~ken-vandine/gwibber/lp_949395 into lp:gwibber

Proposed by Ken VanDine
Status: Merged
Merged at revision: 1320
Proposed branch: lp:~ken-vandine/gwibber/lp_949395
Merge into: lp:gwibber
Diff against target: 58 lines (+11/-8)
3 files modified
gwibber/microblog/dispatcher.py (+0/-4)
gwibber/microblog/util/__init__.py (+4/-1)
gwibber/microblog/util/resources.py (+7/-3)
To merge this branch: bzr merge lp:~ken-vandine/gwibber/lp_949395
Reviewer Review Type Date Requested Status
David Klasinc (community) Approve
Review via email: mp+98449@code.launchpad.net

Description of the change

* Fixed xdg import and get_ui_asset to fallback to find UI assets in more places
* Protect against trying to create a pixbuf from an icon that doesn't exist (LP: #949395)

To post a comment you must log in.
Revision history for this message
David Klasinc (bigwhale) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'gwibber/microblog/dispatcher.py'
2--- gwibber/microblog/dispatcher.py 2012-03-07 21:01:20 +0000
3+++ gwibber/microblog/dispatcher.py 2012-03-20 16:37:19 +0000
4@@ -670,10 +670,6 @@
5 if self.notified_errors[error["account"]["service"]] == error["message"]:
6 return
7 if util.can_notify:
8- #FIXME - we need to fix finding service icons in the service
9- #icon = util.resources.get_ui_asset("icons/breakdance/scalable/%s.svg" % error["account"]["service"])
10- if not icon:
11- icon = util.resources.get_ui_asset("gwibber.svg")
12 util.notify(error["account"]["service"], error["message"], icon, 2000)
13 self.notified_errors[error["account"]["service"]] = error["message"]
14
15
16=== modified file 'gwibber/microblog/util/__init__.py'
17--- gwibber/microblog/util/__init__.py 2012-03-04 23:44:04 +0000
18+++ gwibber/microblog/util/__init__.py 2012-03-20 16:37:19 +0000
19@@ -221,7 +221,10 @@
20
21 def notify(title, text, icon = None, timeout = None, iconsize = 48):
22 if icon is None:
23- icon = resources.get_ui_asset("gwibber.svg")
24+ icon = resources.get_ui_asset("icons/hicolor/scalable/apps/gwibber.svg")
25+
26+ if icon is None:
27+ return
28
29 caps = Notify.get_server_caps()
30
31
32=== modified file 'gwibber/microblog/util/resources.py'
33--- gwibber/microblog/util/resources.py 2012-03-12 23:47:12 +0000
34+++ gwibber/microblog/util/resources.py 2012-03-20 16:37:19 +0000
35@@ -37,9 +37,9 @@
36 THEME_MIN_VERSION = 2
37
38 try:
39- import xdg
40- DATA_BASE_DIRS = xdg.BaseDirectory.xdg_data_dirs
41- CACHE_BASE_DIR = xdg.BaseDirectory.xdg_cache_home
42+ from xdg import BaseDirectory
43+ DATA_BASE_DIRS = BaseDirectory.xdg_data_dirs
44+ CACHE_BASE_DIR = BaseDirectory.xdg_cache_home
45 except:
46 DATA_BASE_DIRS = [
47 os.path.join(os.path.expanduser("~"), ".local", "share"),
48@@ -179,6 +179,10 @@
49 asset_path = os.path.join(base, UI_DIR_NAME, asset_name)
50 if os.path.exists(asset_path):
51 return asset_path
52+
53+ asset_path = os.path.join(base, asset_name)
54+ if os.path.exists(asset_path):
55+ return asset_path
56 return None
57
58 def get_template_dirs():