Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar
diff options
context:
space:
mode:
Diffstat (limited to 'sugar')
-rw-r--r--sugar/activity/bundle.py10
-rw-r--r--sugar/graphics/canvasicon.py9
2 files changed, 17 insertions, 2 deletions
diff --git a/sugar/activity/bundle.py b/sugar/activity/bundle.py
index d9fd0bf..3951c42 100644
--- a/sugar/activity/bundle.py
+++ b/sugar/activity/bundle.py
@@ -3,6 +3,8 @@ import os
from ConfigParser import ConfigParser
+import gtk
+
class Bundle:
"""Info about an activity bundle. Wraps the activity.info file."""
def __init__(self, path):
@@ -21,6 +23,8 @@ class Bundle:
self._valid = False
def _parse_info(self, info_path):
+ base_path = os.path.dirname(info_path)
+
cp = ConfigParser()
cp.read([info_path])
@@ -49,7 +53,11 @@ class Bundle:
self._show_launcher = False
if cp.has_option(section, 'icon'):
- self._icon = cp.get(section, 'icon')
+ icon = cp.get(section, 'icon')
+ if gtk.icon_theme_get_default().has_icon(icon):
+ self._icon = 'theme:' + icon
+ else:
+ self._icon = os.path.join(base_path, icon + ".svg")
if cp.has_option(section, 'activity_version'):
self._activity_version = int(cp.get(section, 'activity_version'))
diff --git a/sugar/graphics/canvasicon.py b/sugar/graphics/canvasicon.py
index 125ddf9..05d3b21 100644
--- a/sugar/graphics/canvasicon.py
+++ b/sugar/graphics/canvasicon.py
@@ -52,7 +52,14 @@ class _IconCache:
return rsvg.Handle(data=data)
def get_handle(self, name, color, size):
- info = self._theme.lookup_icon(name, int(size), 0)
+ if name[0:6] == "theme:":
+ icon = self._read_icon_from_name(name[6:], color, size)
+ else:
+ icon = self._read_icon(name, color)
+ return icon
+
+ def _read_icon_from_name(self, name, color, size):
+ info = self._theme.lookup_icon(name, size, 0)
if not info:
raise "Icon '" + name + "' not found."