hamster-applet r746 - trunk/hamster
- From: tbaugis svn gnome org
- To: svn-commits-list gnome org
- Subject: hamster-applet r746 - trunk/hamster
- Date: Thu, 19 Feb 2009 01:44:25 +0000 (UTC)
Author: tbaugis
Date: Thu Feb 19 01:44:25 2009
New Revision: 746
URL: http://svn.gnome.org/viewvc/hamster-applet?rev=746&view=rev
Log:
escaping user content where we are using pango markup
Modified:
trunk/hamster/stats.py
trunk/hamster/stuff.py
Modified: trunk/hamster/stats.py
==============================================================================
--- trunk/hamster/stats.py (original)
+++ trunk/hamster/stats.py Thu Feb 19 01:44:25 2009
@@ -172,8 +172,8 @@
cell.set_property('markup', text)
else:
- activity_name = cell_text
- description = model.get_value(iter, 4)
+ activity_name = stuff.escape_pango(cell_text)
+ description = stuff.escape_pango(model.get_value(iter, 4))
text = " %s" % activity_name
if description:
Modified: trunk/hamster/stuff.py
==============================================================================
--- trunk/hamster/stuff.py (original)
+++ trunk/hamster/stuff.py Thu Feb 19 01:44:25 2009
@@ -115,6 +115,16 @@
return res
+def escape_pango(text):
+ if not text:
+ return text
+
+ text = text.replace ("&", "&")
+ text = text.replace("<", "<")
+ text = text.replace(">", ">")
+ return text
+
+
class DayStore(object):
"""A day view contains a treeview for facts of the day and another
one for totals. It creates those widgets on init, use
@@ -127,6 +137,7 @@
self.fact_store = gtk.ListStore(int, str, str, str, str, str)
self.facts = storage.get_facts(date)
+
self.totals = {}
for fact in self.facts:
@@ -145,9 +156,9 @@
current_duration = format_duration(duration)
- self.fact_store.append([fact['id'], fact['name'],
+ self.fact_store.append([fact['id'], escape_pango(fact['name']),
fact["start_time"].strftime("%H:%M"),
current_duration,
fact["start_time"].strftime("%Y%m%d"),
- fact["description"]])
+ escape_pango(fact["description"])])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]