Please find the explanation to the patch in the comments.<br><br><div class="gmail_quote">On Fri, Oct 15, 2010 at 4:19 PM, Mukul Gupta <span dir="ltr"><<a href="mailto:mukul@seeta.in">mukul@seeta.in</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">The patch disables the Start and Start With menu items for files<br>
which can't be opened by any installed activity and instead<br>
replace it with a hover dropdown with a menu item 'No activity<br>
installed to start entry'<br>
---<br>
src/jarabe/journal/palettes.py | 38 +++++++++++++++++++++++---------------<br>
1 files changed, 23 insertions(+), 15 deletions(-)<br>
<br>
v1->v2: Patch remade as per pep8 standards<br>
<br>
diff --git a/src/jarabe/journal/palettes.py b/src/jarabe/journal/palettes.py<br>
index 7c3e5ff..2ab93fe 100644<br>
--- a/src/jarabe/journal/palettes.py<br>
+++ b/src/jarabe/journal/palettes.py<br>
@@ -62,22 +62,30 @@ class ObjectPalette(Palette):<br>
Palette.__init__(self, primary_text=title,<br>
icon=activity_icon)<br>
<br>
- if metadata.get('activity_id', ''):<br>
- resume_label = _('Resume')<br>
- resume_with_label = _('Resume with')<br>
- else:<br>
- resume_label = _('Start')<br>
- resume_with_label = _('Start with')<br>
- menu_item = MenuItem(resume_label, 'activity-start')<br>
- menu_item.connect('activate', self.__start_activate_cb)<br>
- self.menu.append(menu_item)<br>
- menu_item.show()<br></blockquote><div><br>""" <br>The function misc.get_activities(metadata) checks whether the file can be opened by any installed activity. If it is True, then Menu items Start and Start with are displayed<br>
"""<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
+ if misc.get_activities(metadata):<br>
+ if metadata.get('activity_id', ''):<br>
+ resume_label = _('Resume')<br>
+ resume_with_label = _('Resume with')<br>
+ else:<br>
+ resume_label = _('Start')<br>
+ resume_with_label = _('Start with')<br>
+ menu_item = MenuItem(resume_label, 'activity-start')<br>
+ menu_item.connect('activate', self.__start_activate_cb)<br>
+ self.menu.append(menu_item)<br>
+ menu_item.show()<br>
<br>
- menu_item = MenuItem(resume_with_label, 'activity-start')<br>
- self.menu.append(menu_item)<br>
- menu_item.show()<br>
- start_with_menu = StartWithMenu(self._metadata)<br>
- menu_item.set_submenu(start_with_menu)<br>
+ menu_item = MenuItem(resume_with_label, 'activity-start')<br>
+ self.menu.append(menu_item)<br>
+ menu_item.show()<br>
+ start_with_menu = StartWithMenu(self._metadata)<br>
+ menu_item.set_submenu(start_with_menu)<br>
+<br></blockquote><div>""" <br></div><div>If misc.get_activities(metadata) is False, the entries Start and Start with are replaced by a single frozen Menu entry stating " No activity installed to start entry"<br>
"""</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
+ else:<br>
+ resume_label = _('No activity installed to start entry')<br>
+ menu_item = MenuItem(resume_label)<br>
+ menu_item.set_sensitive(False)<br>
+ self.menu.append(menu_item)<br>
+ menu_item.show()<br>
<br>
client = gconf.client_get_default()<br>
color = XoColor(client.get_string('/desktop/sugar/user/color'))<br>
<font color="#888888">--<br>
1.7.0.4<br>
<br>
</font></blockquote></div><br>