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
=== modified file 'gwibber/microblog/dispatcher.py'
--- gwibber/microblog/dispatcher.py 2012-03-07 21:01:20 +0000
+++ gwibber/microblog/dispatcher.py 2012-03-20 16:37:19 +0000
@@ -670,10 +670,6 @@
670 if self.notified_errors[error["account"]["service"]] == error["message"]:670 if self.notified_errors[error["account"]["service"]] == error["message"]:
671 return671 return
672 if util.can_notify:672 if util.can_notify:
673 #FIXME - we need to fix finding service icons in the service
674 #icon = util.resources.get_ui_asset("icons/breakdance/scalable/%s.svg" % error["account"]["service"])
675 if not icon:
676 icon = util.resources.get_ui_asset("gwibber.svg")
677 util.notify(error["account"]["service"], error["message"], icon, 2000)673 util.notify(error["account"]["service"], error["message"], icon, 2000)
678 self.notified_errors[error["account"]["service"]] = error["message"]674 self.notified_errors[error["account"]["service"]] = error["message"]
679675
680676
=== modified file 'gwibber/microblog/util/__init__.py'
--- gwibber/microblog/util/__init__.py 2012-03-04 23:44:04 +0000
+++ gwibber/microblog/util/__init__.py 2012-03-20 16:37:19 +0000
@@ -221,7 +221,10 @@
221221
222 def notify(title, text, icon = None, timeout = None, iconsize = 48):222 def notify(title, text, icon = None, timeout = None, iconsize = 48):
223 if icon is None:223 if icon is None:
224 icon = resources.get_ui_asset("gwibber.svg")224 icon = resources.get_ui_asset("icons/hicolor/scalable/apps/gwibber.svg")
225
226 if icon is None:
227 return
225 228
226 caps = Notify.get_server_caps()229 caps = Notify.get_server_caps()
227 230
228231
=== modified file 'gwibber/microblog/util/resources.py'
--- gwibber/microblog/util/resources.py 2012-03-12 23:47:12 +0000
+++ gwibber/microblog/util/resources.py 2012-03-20 16:37:19 +0000
@@ -37,9 +37,9 @@
37THEME_MIN_VERSION = 237THEME_MIN_VERSION = 2
3838
39try:39try:
40 import xdg40 from xdg import BaseDirectory
41 DATA_BASE_DIRS = xdg.BaseDirectory.xdg_data_dirs41 DATA_BASE_DIRS = BaseDirectory.xdg_data_dirs
42 CACHE_BASE_DIR = xdg.BaseDirectory.xdg_cache_home42 CACHE_BASE_DIR = BaseDirectory.xdg_cache_home
43except:43except:
44 DATA_BASE_DIRS = [44 DATA_BASE_DIRS = [
45 os.path.join(os.path.expanduser("~"), ".local", "share"),45 os.path.join(os.path.expanduser("~"), ".local", "share"),
@@ -179,6 +179,10 @@
179 asset_path = os.path.join(base, UI_DIR_NAME, asset_name)179 asset_path = os.path.join(base, UI_DIR_NAME, asset_name)
180 if os.path.exists(asset_path):180 if os.path.exists(asset_path):
181 return asset_path181 return asset_path
182
183 asset_path = os.path.join(base, asset_name)
184 if os.path.exists(asset_path):
185 return asset_path
182 return None186 return None
183187
184def get_template_dirs():188def get_template_dirs():