Add management of summary property to the activity.info file

This summary is translatable as the Activity name and will be displayed
in the Activity list in the Home View.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
This commit is contained in:
Gonzalo Odiard
2012-09-20 12:34:02 -03:00
committed by Simon Schampijer
parent 7eec45f031
commit 3a30d3f84e
2 changed files with 24 additions and 0 deletions
+15
View File
@@ -62,6 +62,8 @@ class ActivityBundle(Bundle):
self._tags = None
self._activity_version = '0'
self._installation_time = os.stat(path).st_mtime
self._summary = None
self._local_summary = None
info_file = self.get_file('activity/activity.info')
if info_file is None:
@@ -75,6 +77,9 @@ class ActivityBundle(Bundle):
if self._local_name == None:
self._local_name = self._name
if self._local_summary == None:
self._local_summary = self._summary
def _parse_info(self, info_file):
cp = ConfigParser()
cp.readfp(info_file)
@@ -126,6 +131,9 @@ class ActivityBundle(Bundle):
(self._path, version))
self._activity_version = version
if cp.has_option(section, 'summary'):
self._summary = cp.get(section, 'summary')
def _get_linfo_file(self):
lang = locale.getdefaultlocale()[0]
if not lang:
@@ -152,6 +160,9 @@ class ActivityBundle(Bundle):
if cp.has_option(section, 'name'):
self._local_name = cp.get(section, 'name')
if cp.has_option(section, 'summary'):
self._local_summary = cp.get(section, 'summary')
if cp.has_option(section, 'tags'):
tag_list = cp.get(section, 'tags').strip(';')
self._tags = [tag.strip() for tag in tag_list.split(';')]
@@ -225,6 +236,10 @@ class ActivityBundle(Bundle):
"""Get the tags that describe the activity"""
return self._tags
def get_summary(self):
"""Get the summary that describe the activity"""
return self._local_summary
def get_show_launcher(self):
"""Get whether there should be a visible launcher for the activity"""
return self._show_launcher